pdf.worker.js 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2020 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 /******/ (function(modules) { // webpackBootstrap
  33. /******/ // The module cache
  34. /******/ var installedModules = {};
  35. /******/
  36. /******/ // The require function
  37. /******/ function __w_pdfjs_require__(moduleId) {
  38. /******/
  39. /******/ // Check if module is in cache
  40. /******/ if(installedModules[moduleId]) {
  41. /******/ return installedModules[moduleId].exports;
  42. /******/ }
  43. /******/ // Create a new module (and put it into the cache)
  44. /******/ var module = installedModules[moduleId] = {
  45. /******/ i: moduleId,
  46. /******/ l: false,
  47. /******/ exports: {}
  48. /******/ };
  49. /******/
  50. /******/ // Execute the module function
  51. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  52. /******/
  53. /******/ // Flag the module as loaded
  54. /******/ module.l = true;
  55. /******/
  56. /******/ // Return the exports of the module
  57. /******/ return module.exports;
  58. /******/ }
  59. /******/
  60. /******/
  61. /******/ // expose the modules object (__webpack_modules__)
  62. /******/ __w_pdfjs_require__.m = modules;
  63. /******/
  64. /******/ // expose the module cache
  65. /******/ __w_pdfjs_require__.c = installedModules;
  66. /******/
  67. /******/ // define getter function for harmony exports
  68. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  69. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  70. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  71. /******/ }
  72. /******/ };
  73. /******/
  74. /******/ // define __esModule on exports
  75. /******/ __w_pdfjs_require__.r = function(exports) {
  76. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  77. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  78. /******/ }
  79. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  80. /******/ };
  81. /******/
  82. /******/ // create a fake namespace object
  83. /******/ // mode & 1: value is a module id, require it
  84. /******/ // mode & 2: merge all properties of value into the ns
  85. /******/ // mode & 4: return value when already ns object
  86. /******/ // mode & 8|1: behave like require
  87. /******/ __w_pdfjs_require__.t = function(value, mode) {
  88. /******/ if(mode & 1) value = __w_pdfjs_require__(value);
  89. /******/ if(mode & 8) return value;
  90. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  91. /******/ var ns = Object.create(null);
  92. /******/ __w_pdfjs_require__.r(ns);
  93. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  94. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  95. /******/ return ns;
  96. /******/ };
  97. /******/
  98. /******/ // getDefaultExport function for compatibility with non-harmony modules
  99. /******/ __w_pdfjs_require__.n = function(module) {
  100. /******/ var getter = module && module.__esModule ?
  101. /******/ function getDefault() { return module['default']; } :
  102. /******/ function getModuleExports() { return module; };
  103. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  104. /******/ return getter;
  105. /******/ };
  106. /******/
  107. /******/ // Object.prototype.hasOwnProperty.call
  108. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  109. /******/
  110. /******/ // __webpack_public_path__
  111. /******/ __w_pdfjs_require__.p = "";
  112. /******/
  113. /******/
  114. /******/ // Load entry module and return exports
  115. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0);
  116. /******/ })
  117. /************************************************************************/
  118. /******/ ([
  119. /* 0 */
  120. /***/ (function(module, exports, __w_pdfjs_require__) {
  121. "use strict";
  122. Object.defineProperty(exports, "__esModule", {
  123. value: true
  124. });
  125. Object.defineProperty(exports, "WorkerMessageHandler", {
  126. enumerable: true,
  127. get: function () {
  128. return _worker.WorkerMessageHandler;
  129. }
  130. });
  131. var _worker = __w_pdfjs_require__(1);
  132. const pdfjsVersion = '2.5.207';
  133. const pdfjsBuild = '0974d605';
  134. /***/ }),
  135. /* 1 */
  136. /***/ (function(module, exports, __w_pdfjs_require__) {
  137. "use strict";
  138. Object.defineProperty(exports, "__esModule", {
  139. value: true
  140. });
  141. exports.WorkerMessageHandler = exports.WorkerTask = void 0;
  142. var _util = __w_pdfjs_require__(2);
  143. var _primitives = __w_pdfjs_require__(5);
  144. var _pdf_manager = __w_pdfjs_require__(6);
  145. var _is_node = __w_pdfjs_require__(4);
  146. var _message_handler = __w_pdfjs_require__(45);
  147. var _worker_stream = __w_pdfjs_require__(46);
  148. var _core_utils = __w_pdfjs_require__(8);
  149. var WorkerTask = function WorkerTaskClosure() {
  150. function WorkerTask(name) {
  151. this.name = name;
  152. this.terminated = false;
  153. this._capability = (0, _util.createPromiseCapability)();
  154. }
  155. WorkerTask.prototype = {
  156. get finished() {
  157. return this._capability.promise;
  158. },
  159. finish() {
  160. this._capability.resolve();
  161. },
  162. terminate() {
  163. this.terminated = true;
  164. },
  165. ensureNotTerminated() {
  166. if (this.terminated) {
  167. throw new Error("Worker task was terminated");
  168. }
  169. }
  170. };
  171. return WorkerTask;
  172. }();
  173. exports.WorkerTask = WorkerTask;
  174. var WorkerMessageHandler = {
  175. setup(handler, port) {
  176. var testMessageProcessed = false;
  177. handler.on("test", function wphSetupTest(data) {
  178. if (testMessageProcessed) {
  179. return;
  180. }
  181. testMessageProcessed = true;
  182. if (!(data instanceof Uint8Array)) {
  183. handler.send("test", null);
  184. return;
  185. }
  186. const supportTransfers = data[0] === 255;
  187. handler.postMessageTransfers = supportTransfers;
  188. handler.send("test", {
  189. supportTransfers
  190. });
  191. });
  192. handler.on("configure", function wphConfigure(data) {
  193. (0, _util.setVerbosityLevel)(data.verbosity);
  194. });
  195. handler.on("GetDocRequest", function wphSetupDoc(data) {
  196. return WorkerMessageHandler.createDocumentHandler(data, port);
  197. });
  198. },
  199. createDocumentHandler(docParams, port) {
  200. var pdfManager;
  201. var terminated = false;
  202. var cancelXHRs = null;
  203. var WorkerTasks = [];
  204. const verbosity = (0, _util.getVerbosityLevel)();
  205. const apiVersion = docParams.apiVersion;
  206. const workerVersion = '2.5.207';
  207. if (apiVersion !== workerVersion) {
  208. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  209. }
  210. const enumerableProperties = [];
  211. for (const property in []) {
  212. enumerableProperties.push(property);
  213. }
  214. if (enumerableProperties.length) {
  215. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  216. }
  217. if (typeof ReadableStream === "undefined" || typeof Promise.allSettled === "undefined") {
  218. throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. " + "`ReadableStream` and/or `Promise.allSettled`); " + "please use an ES5-compatible build instead.");
  219. }
  220. var docId = docParams.docId;
  221. var docBaseUrl = docParams.docBaseUrl;
  222. var workerHandlerName = docParams.docId + "_worker";
  223. var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  224. handler.postMessageTransfers = docParams.postMessageTransfers;
  225. function ensureNotTerminated() {
  226. if (terminated) {
  227. throw new Error("Worker was terminated");
  228. }
  229. }
  230. function startWorkerTask(task) {
  231. WorkerTasks.push(task);
  232. }
  233. function finishWorkerTask(task) {
  234. task.finish();
  235. var i = WorkerTasks.indexOf(task);
  236. WorkerTasks.splice(i, 1);
  237. }
  238. async function loadDocument(recoveryMode) {
  239. await pdfManager.ensureDoc("checkHeader");
  240. await pdfManager.ensureDoc("parseStartXRef");
  241. await pdfManager.ensureDoc("parse", [recoveryMode]);
  242. if (!recoveryMode) {
  243. await pdfManager.ensureDoc("checkFirstPage");
  244. }
  245. const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]);
  246. return {
  247. numPages,
  248. fingerprint
  249. };
  250. }
  251. function getPdfManager(data, evaluatorOptions) {
  252. var pdfManagerCapability = (0, _util.createPromiseCapability)();
  253. let newPdfManager;
  254. var source = data.source;
  255. if (source.data) {
  256. try {
  257. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  258. pdfManagerCapability.resolve(newPdfManager);
  259. } catch (ex) {
  260. pdfManagerCapability.reject(ex);
  261. }
  262. return pdfManagerCapability.promise;
  263. }
  264. var pdfStream,
  265. cachedChunks = [];
  266. try {
  267. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  268. } catch (ex) {
  269. pdfManagerCapability.reject(ex);
  270. return pdfManagerCapability.promise;
  271. }
  272. var fullRequest = pdfStream.getFullReader();
  273. fullRequest.headersReady.then(function () {
  274. if (!fullRequest.isRangeSupported) {
  275. return;
  276. }
  277. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  278. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  279. msgHandler: handler,
  280. password: source.password,
  281. length: fullRequest.contentLength,
  282. disableAutoFetch,
  283. rangeChunkSize: source.rangeChunkSize
  284. }, evaluatorOptions, docBaseUrl);
  285. for (let i = 0; i < cachedChunks.length; i++) {
  286. newPdfManager.sendProgressiveData(cachedChunks[i]);
  287. }
  288. cachedChunks = [];
  289. pdfManagerCapability.resolve(newPdfManager);
  290. cancelXHRs = null;
  291. }).catch(function (reason) {
  292. pdfManagerCapability.reject(reason);
  293. cancelXHRs = null;
  294. });
  295. var loaded = 0;
  296. var flushChunks = function () {
  297. var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  298. if (source.length && pdfFile.length !== source.length) {
  299. (0, _util.warn)("reported HTTP length is different from actual");
  300. }
  301. try {
  302. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  303. pdfManagerCapability.resolve(newPdfManager);
  304. } catch (ex) {
  305. pdfManagerCapability.reject(ex);
  306. }
  307. cachedChunks = [];
  308. };
  309. var readPromise = new Promise(function (resolve, reject) {
  310. var readChunk = function ({
  311. value,
  312. done
  313. }) {
  314. try {
  315. ensureNotTerminated();
  316. if (done) {
  317. if (!newPdfManager) {
  318. flushChunks();
  319. }
  320. cancelXHRs = null;
  321. return;
  322. }
  323. loaded += (0, _util.arrayByteLength)(value);
  324. if (!fullRequest.isStreamingSupported) {
  325. handler.send("DocProgress", {
  326. loaded,
  327. total: Math.max(loaded, fullRequest.contentLength || 0)
  328. });
  329. }
  330. if (newPdfManager) {
  331. newPdfManager.sendProgressiveData(value);
  332. } else {
  333. cachedChunks.push(value);
  334. }
  335. fullRequest.read().then(readChunk, reject);
  336. } catch (e) {
  337. reject(e);
  338. }
  339. };
  340. fullRequest.read().then(readChunk, reject);
  341. });
  342. readPromise.catch(function (e) {
  343. pdfManagerCapability.reject(e);
  344. cancelXHRs = null;
  345. });
  346. cancelXHRs = function (reason) {
  347. pdfStream.cancelAllRequests(reason);
  348. };
  349. return pdfManagerCapability.promise;
  350. }
  351. function setupDoc(data) {
  352. function onSuccess(doc) {
  353. ensureNotTerminated();
  354. handler.send("GetDoc", {
  355. pdfInfo: doc
  356. });
  357. }
  358. function onFailure(ex) {
  359. ensureNotTerminated();
  360. if (ex instanceof _util.PasswordException) {
  361. var task = new WorkerTask(`PasswordException: response ${ex.code}`);
  362. startWorkerTask(task);
  363. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  364. password
  365. }) {
  366. finishWorkerTask(task);
  367. pdfManager.updatePassword(password);
  368. pdfManagerReady();
  369. }).catch(function () {
  370. finishWorkerTask(task);
  371. handler.send("DocException", ex);
  372. });
  373. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  374. handler.send("DocException", ex);
  375. } else {
  376. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  377. }
  378. }
  379. function pdfManagerReady() {
  380. ensureNotTerminated();
  381. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  382. ensureNotTerminated();
  383. if (!(ex instanceof _core_utils.XRefParseException)) {
  384. onFailure(ex);
  385. return;
  386. }
  387. pdfManager.requestLoadedStream();
  388. pdfManager.onLoadedStream().then(function () {
  389. ensureNotTerminated();
  390. loadDocument(true).then(onSuccess, onFailure);
  391. });
  392. }, onFailure);
  393. }
  394. ensureNotTerminated();
  395. var evaluatorOptions = {
  396. maxImageSize: data.maxImageSize,
  397. disableFontFace: data.disableFontFace,
  398. ignoreErrors: data.ignoreErrors,
  399. isEvalSupported: data.isEvalSupported,
  400. fontExtraProperties: data.fontExtraProperties
  401. };
  402. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  403. if (terminated) {
  404. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  405. throw new Error("Worker was terminated");
  406. }
  407. pdfManager = newPdfManager;
  408. pdfManager.onLoadedStream().then(function (stream) {
  409. handler.send("DataLoaded", {
  410. length: stream.bytes.byteLength
  411. });
  412. });
  413. }).then(pdfManagerReady, onFailure);
  414. }
  415. handler.on("GetPage", function wphSetupGetPage(data) {
  416. return pdfManager.getPage(data.pageIndex).then(function (page) {
  417. 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]) {
  418. return {
  419. rotate,
  420. ref,
  421. userUnit,
  422. view
  423. };
  424. });
  425. });
  426. });
  427. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  428. var ref = _primitives.Ref.get(data.ref.num, data.ref.gen);
  429. var catalog = pdfManager.pdfDocument.catalog;
  430. return catalog.getPageIndex(ref);
  431. });
  432. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  433. return pdfManager.ensureCatalog("destinations");
  434. });
  435. handler.on("GetDestination", function wphSetupGetDestination(data) {
  436. return pdfManager.ensureCatalog("getDestination", [data.id]);
  437. });
  438. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  439. return pdfManager.ensureCatalog("pageLabels");
  440. });
  441. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  442. return pdfManager.ensureCatalog("pageLayout");
  443. });
  444. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  445. return pdfManager.ensureCatalog("pageMode");
  446. });
  447. handler.on("GetViewerPreferences", function (data) {
  448. return pdfManager.ensureCatalog("viewerPreferences");
  449. });
  450. handler.on("GetOpenAction", function (data) {
  451. return pdfManager.ensureCatalog("openAction");
  452. });
  453. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  454. return pdfManager.ensureCatalog("attachments");
  455. });
  456. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  457. return pdfManager.ensureCatalog("javaScript");
  458. });
  459. handler.on("GetOutline", function wphSetupGetOutline(data) {
  460. return pdfManager.ensureCatalog("documentOutline");
  461. });
  462. handler.on("GetPermissions", function (data) {
  463. return pdfManager.ensureCatalog("permissions");
  464. });
  465. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  466. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  467. });
  468. handler.on("GetData", function wphSetupGetData(data) {
  469. pdfManager.requestLoadedStream();
  470. return pdfManager.onLoadedStream().then(function (stream) {
  471. return stream.bytes;
  472. });
  473. });
  474. handler.on("GetStats", function wphSetupGetStats(data) {
  475. return pdfManager.pdfDocument.xref.stats;
  476. });
  477. handler.on("GetAnnotations", function ({
  478. pageIndex,
  479. intent
  480. }) {
  481. return pdfManager.getPage(pageIndex).then(function (page) {
  482. return page.getAnnotationsData(intent);
  483. });
  484. });
  485. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  486. var pageIndex = data.pageIndex;
  487. pdfManager.getPage(pageIndex).then(function (page) {
  488. var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  489. startWorkerTask(task);
  490. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  491. page.getOperatorList({
  492. handler,
  493. sink,
  494. task,
  495. intent: data.intent,
  496. renderInteractiveForms: data.renderInteractiveForms
  497. }).then(function (operatorListInfo) {
  498. finishWorkerTask(task);
  499. if (start) {
  500. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  501. }
  502. sink.close();
  503. }, function (reason) {
  504. finishWorkerTask(task);
  505. if (task.terminated) {
  506. return;
  507. }
  508. handler.send("UnsupportedFeature", {
  509. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  510. });
  511. sink.error(reason);
  512. });
  513. });
  514. }, this);
  515. handler.on("GetTextContent", function wphExtractText(data, sink) {
  516. var pageIndex = data.pageIndex;
  517. sink.onPull = function (desiredSize) {};
  518. sink.onCancel = function (reason) {};
  519. pdfManager.getPage(pageIndex).then(function (page) {
  520. var task = new WorkerTask("GetTextContent: page " + pageIndex);
  521. startWorkerTask(task);
  522. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  523. page.extractTextContent({
  524. handler,
  525. task,
  526. sink,
  527. normalizeWhitespace: data.normalizeWhitespace,
  528. combineTextItems: data.combineTextItems
  529. }).then(function () {
  530. finishWorkerTask(task);
  531. if (start) {
  532. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  533. }
  534. sink.close();
  535. }, function (reason) {
  536. finishWorkerTask(task);
  537. if (task.terminated) {
  538. return;
  539. }
  540. sink.error(reason);
  541. });
  542. });
  543. });
  544. handler.on("FontFallback", function (data) {
  545. return pdfManager.fontFallback(data.id, handler);
  546. });
  547. handler.on("Cleanup", function wphCleanup(data) {
  548. return pdfManager.cleanup(true);
  549. });
  550. handler.on("Terminate", function wphTerminate(data) {
  551. terminated = true;
  552. const waitOn = [];
  553. if (pdfManager) {
  554. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  555. const cleanupPromise = pdfManager.cleanup();
  556. waitOn.push(cleanupPromise);
  557. pdfManager = null;
  558. } else {
  559. (0, _primitives.clearPrimitiveCaches)();
  560. }
  561. if (cancelXHRs) {
  562. cancelXHRs(new _util.AbortException("Worker was terminated."));
  563. }
  564. WorkerTasks.forEach(function (task) {
  565. waitOn.push(task.finished);
  566. task.terminate();
  567. });
  568. return Promise.all(waitOn).then(function () {
  569. handler.destroy();
  570. handler = null;
  571. });
  572. });
  573. handler.on("Ready", function wphReady(data) {
  574. setupDoc(docParams);
  575. docParams = null;
  576. });
  577. return workerHandlerName;
  578. },
  579. initializeFromPort(port) {
  580. var handler = new _message_handler.MessageHandler("worker", "main", port);
  581. WorkerMessageHandler.setup(handler, port);
  582. handler.send("ready", null);
  583. }
  584. };
  585. exports.WorkerMessageHandler = WorkerMessageHandler;
  586. function isMessagePort(maybePort) {
  587. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  588. }
  589. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  590. WorkerMessageHandler.initializeFromPort(self);
  591. }
  592. /***/ }),
  593. /* 2 */
  594. /***/ (function(module, exports, __w_pdfjs_require__) {
  595. "use strict";
  596. Object.defineProperty(exports, "__esModule", {
  597. value: true
  598. });
  599. exports.arrayByteLength = arrayByteLength;
  600. exports.arraysToBytes = arraysToBytes;
  601. exports.assert = assert;
  602. exports.bytesToString = bytesToString;
  603. exports.createPromiseCapability = createPromiseCapability;
  604. exports.getVerbosityLevel = getVerbosityLevel;
  605. exports.info = info;
  606. exports.isArrayBuffer = isArrayBuffer;
  607. exports.isArrayEqual = isArrayEqual;
  608. exports.isBool = isBool;
  609. exports.isEmptyObj = isEmptyObj;
  610. exports.isNum = isNum;
  611. exports.isString = isString;
  612. exports.isSameOrigin = isSameOrigin;
  613. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  614. exports.removeNullCharacters = removeNullCharacters;
  615. exports.setVerbosityLevel = setVerbosityLevel;
  616. exports.shadow = shadow;
  617. exports.string32 = string32;
  618. exports.stringToBytes = stringToBytes;
  619. exports.stringToPDFString = stringToPDFString;
  620. exports.stringToUTF8String = stringToUTF8String;
  621. exports.utf8StringToString = utf8StringToString;
  622. exports.warn = warn;
  623. exports.unreachable = unreachable;
  624. exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0;
  625. __w_pdfjs_require__(3);
  626. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  627. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  628. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  629. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  630. const PermissionFlag = {
  631. PRINT: 0x04,
  632. MODIFY_CONTENTS: 0x08,
  633. COPY: 0x10,
  634. MODIFY_ANNOTATIONS: 0x20,
  635. FILL_INTERACTIVE_FORMS: 0x100,
  636. COPY_FOR_ACCESSIBILITY: 0x200,
  637. ASSEMBLE: 0x400,
  638. PRINT_HIGH_QUALITY: 0x800
  639. };
  640. exports.PermissionFlag = PermissionFlag;
  641. const TextRenderingMode = {
  642. FILL: 0,
  643. STROKE: 1,
  644. FILL_STROKE: 2,
  645. INVISIBLE: 3,
  646. FILL_ADD_TO_PATH: 4,
  647. STROKE_ADD_TO_PATH: 5,
  648. FILL_STROKE_ADD_TO_PATH: 6,
  649. ADD_TO_PATH: 7,
  650. FILL_STROKE_MASK: 3,
  651. ADD_TO_PATH_FLAG: 4
  652. };
  653. exports.TextRenderingMode = TextRenderingMode;
  654. const ImageKind = {
  655. GRAYSCALE_1BPP: 1,
  656. RGB_24BPP: 2,
  657. RGBA_32BPP: 3
  658. };
  659. exports.ImageKind = ImageKind;
  660. const AnnotationType = {
  661. TEXT: 1,
  662. LINK: 2,
  663. FREETEXT: 3,
  664. LINE: 4,
  665. SQUARE: 5,
  666. CIRCLE: 6,
  667. POLYGON: 7,
  668. POLYLINE: 8,
  669. HIGHLIGHT: 9,
  670. UNDERLINE: 10,
  671. SQUIGGLY: 11,
  672. STRIKEOUT: 12,
  673. STAMP: 13,
  674. CARET: 14,
  675. INK: 15,
  676. POPUP: 16,
  677. FILEATTACHMENT: 17,
  678. SOUND: 18,
  679. MOVIE: 19,
  680. WIDGET: 20,
  681. SCREEN: 21,
  682. PRINTERMARK: 22,
  683. TRAPNET: 23,
  684. WATERMARK: 24,
  685. THREED: 25,
  686. REDACT: 26
  687. };
  688. exports.AnnotationType = AnnotationType;
  689. const AnnotationStateModelType = {
  690. MARKED: "Marked",
  691. REVIEW: "Review"
  692. };
  693. exports.AnnotationStateModelType = AnnotationStateModelType;
  694. const AnnotationMarkedState = {
  695. MARKED: "Marked",
  696. UNMARKED: "Unmarked"
  697. };
  698. exports.AnnotationMarkedState = AnnotationMarkedState;
  699. const AnnotationReviewState = {
  700. ACCEPTED: "Accepted",
  701. REJECTED: "Rejected",
  702. CANCELLED: "Cancelled",
  703. COMPLETED: "Completed",
  704. NONE: "None"
  705. };
  706. exports.AnnotationReviewState = AnnotationReviewState;
  707. const AnnotationReplyType = {
  708. GROUP: "Group",
  709. REPLY: "R"
  710. };
  711. exports.AnnotationReplyType = AnnotationReplyType;
  712. const AnnotationFlag = {
  713. INVISIBLE: 0x01,
  714. HIDDEN: 0x02,
  715. PRINT: 0x04,
  716. NOZOOM: 0x08,
  717. NOROTATE: 0x10,
  718. NOVIEW: 0x20,
  719. READONLY: 0x40,
  720. LOCKED: 0x80,
  721. TOGGLENOVIEW: 0x100,
  722. LOCKEDCONTENTS: 0x200
  723. };
  724. exports.AnnotationFlag = AnnotationFlag;
  725. const AnnotationFieldFlag = {
  726. READONLY: 0x0000001,
  727. REQUIRED: 0x0000002,
  728. NOEXPORT: 0x0000004,
  729. MULTILINE: 0x0001000,
  730. PASSWORD: 0x0002000,
  731. NOTOGGLETOOFF: 0x0004000,
  732. RADIO: 0x0008000,
  733. PUSHBUTTON: 0x0010000,
  734. COMBO: 0x0020000,
  735. EDIT: 0x0040000,
  736. SORT: 0x0080000,
  737. FILESELECT: 0x0100000,
  738. MULTISELECT: 0x0200000,
  739. DONOTSPELLCHECK: 0x0400000,
  740. DONOTSCROLL: 0x0800000,
  741. COMB: 0x1000000,
  742. RICHTEXT: 0x2000000,
  743. RADIOSINUNISON: 0x2000000,
  744. COMMITONSELCHANGE: 0x4000000
  745. };
  746. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  747. const AnnotationBorderStyleType = {
  748. SOLID: 1,
  749. DASHED: 2,
  750. BEVELED: 3,
  751. INSET: 4,
  752. UNDERLINE: 5
  753. };
  754. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  755. const StreamType = {
  756. UNKNOWN: "UNKNOWN",
  757. FLATE: "FLATE",
  758. LZW: "LZW",
  759. DCT: "DCT",
  760. JPX: "JPX",
  761. JBIG: "JBIG",
  762. A85: "A85",
  763. AHX: "AHX",
  764. CCF: "CCF",
  765. RLX: "RLX"
  766. };
  767. exports.StreamType = StreamType;
  768. const FontType = {
  769. UNKNOWN: "UNKNOWN",
  770. TYPE1: "TYPE1",
  771. TYPE1C: "TYPE1C",
  772. CIDFONTTYPE0: "CIDFONTTYPE0",
  773. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  774. TRUETYPE: "TRUETYPE",
  775. CIDFONTTYPE2: "CIDFONTTYPE2",
  776. TYPE3: "TYPE3",
  777. OPENTYPE: "OPENTYPE",
  778. TYPE0: "TYPE0",
  779. MMTYPE1: "MMTYPE1"
  780. };
  781. exports.FontType = FontType;
  782. const VerbosityLevel = {
  783. ERRORS: 0,
  784. WARNINGS: 1,
  785. INFOS: 5
  786. };
  787. exports.VerbosityLevel = VerbosityLevel;
  788. const CMapCompressionType = {
  789. NONE: 0,
  790. BINARY: 1,
  791. STREAM: 2
  792. };
  793. exports.CMapCompressionType = CMapCompressionType;
  794. const OPS = {
  795. dependency: 1,
  796. setLineWidth: 2,
  797. setLineCap: 3,
  798. setLineJoin: 4,
  799. setMiterLimit: 5,
  800. setDash: 6,
  801. setRenderingIntent: 7,
  802. setFlatness: 8,
  803. setGState: 9,
  804. save: 10,
  805. restore: 11,
  806. transform: 12,
  807. moveTo: 13,
  808. lineTo: 14,
  809. curveTo: 15,
  810. curveTo2: 16,
  811. curveTo3: 17,
  812. closePath: 18,
  813. rectangle: 19,
  814. stroke: 20,
  815. closeStroke: 21,
  816. fill: 22,
  817. eoFill: 23,
  818. fillStroke: 24,
  819. eoFillStroke: 25,
  820. closeFillStroke: 26,
  821. closeEOFillStroke: 27,
  822. endPath: 28,
  823. clip: 29,
  824. eoClip: 30,
  825. beginText: 31,
  826. endText: 32,
  827. setCharSpacing: 33,
  828. setWordSpacing: 34,
  829. setHScale: 35,
  830. setLeading: 36,
  831. setFont: 37,
  832. setTextRenderingMode: 38,
  833. setTextRise: 39,
  834. moveText: 40,
  835. setLeadingMoveText: 41,
  836. setTextMatrix: 42,
  837. nextLine: 43,
  838. showText: 44,
  839. showSpacedText: 45,
  840. nextLineShowText: 46,
  841. nextLineSetSpacingShowText: 47,
  842. setCharWidth: 48,
  843. setCharWidthAndBounds: 49,
  844. setStrokeColorSpace: 50,
  845. setFillColorSpace: 51,
  846. setStrokeColor: 52,
  847. setStrokeColorN: 53,
  848. setFillColor: 54,
  849. setFillColorN: 55,
  850. setStrokeGray: 56,
  851. setFillGray: 57,
  852. setStrokeRGBColor: 58,
  853. setFillRGBColor: 59,
  854. setStrokeCMYKColor: 60,
  855. setFillCMYKColor: 61,
  856. shadingFill: 62,
  857. beginInlineImage: 63,
  858. beginImageData: 64,
  859. endInlineImage: 65,
  860. paintXObject: 66,
  861. markPoint: 67,
  862. markPointProps: 68,
  863. beginMarkedContent: 69,
  864. beginMarkedContentProps: 70,
  865. endMarkedContent: 71,
  866. beginCompat: 72,
  867. endCompat: 73,
  868. paintFormXObjectBegin: 74,
  869. paintFormXObjectEnd: 75,
  870. beginGroup: 76,
  871. endGroup: 77,
  872. beginAnnotations: 78,
  873. endAnnotations: 79,
  874. beginAnnotation: 80,
  875. endAnnotation: 81,
  876. paintJpegXObject: 82,
  877. paintImageMaskXObject: 83,
  878. paintImageMaskXObjectGroup: 84,
  879. paintImageXObject: 85,
  880. paintInlineImageXObject: 86,
  881. paintInlineImageXObjectGroup: 87,
  882. paintImageXObjectRepeat: 88,
  883. paintImageMaskXObjectRepeat: 89,
  884. paintSolidColorImageMask: 90,
  885. constructPath: 91
  886. };
  887. exports.OPS = OPS;
  888. const UNSUPPORTED_FEATURES = {
  889. unknown: "unknown",
  890. forms: "forms",
  891. javaScript: "javaScript",
  892. smask: "smask",
  893. shadingPattern: "shadingPattern",
  894. font: "font",
  895. errorTilingPattern: "errorTilingPattern",
  896. errorExtGState: "errorExtGState",
  897. errorXObject: "errorXObject",
  898. errorFontLoadType3: "errorFontLoadType3",
  899. errorFontState: "errorFontState",
  900. errorFontMissing: "errorFontMissing",
  901. errorFontTranslate: "errorFontTranslate",
  902. errorColorSpace: "errorColorSpace",
  903. errorOperatorList: "errorOperatorList",
  904. errorFontToUnicode: "errorFontToUnicode",
  905. errorFontLoadNative: "errorFontLoadNative",
  906. errorFontGetPath: "errorFontGetPath"
  907. };
  908. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  909. const PasswordResponses = {
  910. NEED_PASSWORD: 1,
  911. INCORRECT_PASSWORD: 2
  912. };
  913. exports.PasswordResponses = PasswordResponses;
  914. let verbosity = VerbosityLevel.WARNINGS;
  915. function setVerbosityLevel(level) {
  916. if (Number.isInteger(level)) {
  917. verbosity = level;
  918. }
  919. }
  920. function getVerbosityLevel() {
  921. return verbosity;
  922. }
  923. function info(msg) {
  924. if (verbosity >= VerbosityLevel.INFOS) {
  925. console.log(`Info: ${msg}`);
  926. }
  927. }
  928. function warn(msg) {
  929. if (verbosity >= VerbosityLevel.WARNINGS) {
  930. console.log(`Warning: ${msg}`);
  931. }
  932. }
  933. function unreachable(msg) {
  934. throw new Error(msg);
  935. }
  936. function assert(cond, msg) {
  937. if (!cond) {
  938. unreachable(msg);
  939. }
  940. }
  941. function isSameOrigin(baseUrl, otherUrl) {
  942. let base;
  943. try {
  944. base = new URL(baseUrl);
  945. if (!base.origin || base.origin === "null") {
  946. return false;
  947. }
  948. } catch (e) {
  949. return false;
  950. }
  951. const other = new URL(otherUrl, base);
  952. return base.origin === other.origin;
  953. }
  954. function _isValidProtocol(url) {
  955. if (!url) {
  956. return false;
  957. }
  958. switch (url.protocol) {
  959. case "http:":
  960. case "https:":
  961. case "ftp:":
  962. case "mailto:":
  963. case "tel:":
  964. return true;
  965. default:
  966. return false;
  967. }
  968. }
  969. function createValidAbsoluteUrl(url, baseUrl) {
  970. if (!url) {
  971. return null;
  972. }
  973. try {
  974. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  975. if (_isValidProtocol(absoluteUrl)) {
  976. return absoluteUrl;
  977. }
  978. } catch (ex) {}
  979. return null;
  980. }
  981. function shadow(obj, prop, value) {
  982. Object.defineProperty(obj, prop, {
  983. value,
  984. enumerable: true,
  985. configurable: true,
  986. writable: false
  987. });
  988. return value;
  989. }
  990. const BaseException = function BaseExceptionClosure() {
  991. function BaseException(message) {
  992. if (this.constructor === BaseException) {
  993. unreachable("Cannot initialize BaseException.");
  994. }
  995. this.message = message;
  996. this.name = this.constructor.name;
  997. }
  998. BaseException.prototype = new Error();
  999. BaseException.constructor = BaseException;
  1000. return BaseException;
  1001. }();
  1002. exports.BaseException = BaseException;
  1003. class PasswordException extends BaseException {
  1004. constructor(msg, code) {
  1005. super(msg);
  1006. this.code = code;
  1007. }
  1008. }
  1009. exports.PasswordException = PasswordException;
  1010. class UnknownErrorException extends BaseException {
  1011. constructor(msg, details) {
  1012. super(msg);
  1013. this.details = details;
  1014. }
  1015. }
  1016. exports.UnknownErrorException = UnknownErrorException;
  1017. class InvalidPDFException extends BaseException {}
  1018. exports.InvalidPDFException = InvalidPDFException;
  1019. class MissingPDFException extends BaseException {}
  1020. exports.MissingPDFException = MissingPDFException;
  1021. class UnexpectedResponseException extends BaseException {
  1022. constructor(msg, status) {
  1023. super(msg);
  1024. this.status = status;
  1025. }
  1026. }
  1027. exports.UnexpectedResponseException = UnexpectedResponseException;
  1028. class FormatError extends BaseException {}
  1029. exports.FormatError = FormatError;
  1030. class AbortException extends BaseException {}
  1031. exports.AbortException = AbortException;
  1032. const NullCharactersRegExp = /\x00/g;
  1033. function removeNullCharacters(str) {
  1034. if (typeof str !== "string") {
  1035. warn("The argument for removeNullCharacters must be a string.");
  1036. return str;
  1037. }
  1038. return str.replace(NullCharactersRegExp, "");
  1039. }
  1040. function bytesToString(bytes) {
  1041. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1042. const length = bytes.length;
  1043. const MAX_ARGUMENT_COUNT = 8192;
  1044. if (length < MAX_ARGUMENT_COUNT) {
  1045. return String.fromCharCode.apply(null, bytes);
  1046. }
  1047. const strBuf = [];
  1048. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1049. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1050. const chunk = bytes.subarray(i, chunkEnd);
  1051. strBuf.push(String.fromCharCode.apply(null, chunk));
  1052. }
  1053. return strBuf.join("");
  1054. }
  1055. function stringToBytes(str) {
  1056. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1057. const length = str.length;
  1058. const bytes = new Uint8Array(length);
  1059. for (let i = 0; i < length; ++i) {
  1060. bytes[i] = str.charCodeAt(i) & 0xff;
  1061. }
  1062. return bytes;
  1063. }
  1064. function arrayByteLength(arr) {
  1065. if (arr.length !== undefined) {
  1066. return arr.length;
  1067. }
  1068. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1069. return arr.byteLength;
  1070. }
  1071. function arraysToBytes(arr) {
  1072. const length = arr.length;
  1073. if (length === 1 && arr[0] instanceof Uint8Array) {
  1074. return arr[0];
  1075. }
  1076. let resultLength = 0;
  1077. for (let i = 0; i < length; i++) {
  1078. resultLength += arrayByteLength(arr[i]);
  1079. }
  1080. let pos = 0;
  1081. const data = new Uint8Array(resultLength);
  1082. for (let i = 0; i < length; i++) {
  1083. let item = arr[i];
  1084. if (!(item instanceof Uint8Array)) {
  1085. if (typeof item === "string") {
  1086. item = stringToBytes(item);
  1087. } else {
  1088. item = new Uint8Array(item);
  1089. }
  1090. }
  1091. const itemLength = item.byteLength;
  1092. data.set(item, pos);
  1093. pos += itemLength;
  1094. }
  1095. return data;
  1096. }
  1097. function string32(value) {
  1098. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1099. }
  1100. function isLittleEndian() {
  1101. const buffer8 = new Uint8Array(4);
  1102. buffer8[0] = 1;
  1103. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1104. return view32[0] === 1;
  1105. }
  1106. const IsLittleEndianCached = {
  1107. get value() {
  1108. return shadow(this, "value", isLittleEndian());
  1109. }
  1110. };
  1111. exports.IsLittleEndianCached = IsLittleEndianCached;
  1112. function isEvalSupported() {
  1113. try {
  1114. new Function("");
  1115. return true;
  1116. } catch (e) {
  1117. return false;
  1118. }
  1119. }
  1120. const IsEvalSupportedCached = {
  1121. get value() {
  1122. return shadow(this, "value", isEvalSupported());
  1123. }
  1124. };
  1125. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1126. const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
  1127. class Util {
  1128. static makeCssRgb(r, g, b) {
  1129. rgbBuf[1] = r;
  1130. rgbBuf[3] = g;
  1131. rgbBuf[5] = b;
  1132. return rgbBuf.join("");
  1133. }
  1134. static transform(m1, m2) {
  1135. 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]];
  1136. }
  1137. static applyTransform(p, m) {
  1138. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1139. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1140. return [xt, yt];
  1141. }
  1142. static applyInverseTransform(p, m) {
  1143. const d = m[0] * m[3] - m[1] * m[2];
  1144. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1145. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1146. return [xt, yt];
  1147. }
  1148. static getAxialAlignedBoundingBox(r, m) {
  1149. const p1 = Util.applyTransform(r, m);
  1150. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1151. const p3 = Util.applyTransform([r[0], r[3]], m);
  1152. const p4 = Util.applyTransform([r[2], r[1]], m);
  1153. 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])];
  1154. }
  1155. static inverseTransform(m) {
  1156. const d = m[0] * m[3] - m[1] * m[2];
  1157. 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];
  1158. }
  1159. static apply3dTransform(m, v) {
  1160. 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]];
  1161. }
  1162. static singularValueDecompose2dScale(m) {
  1163. const transpose = [m[0], m[2], m[1], m[3]];
  1164. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1165. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1166. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1167. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1168. const first = (a + d) / 2;
  1169. const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  1170. const sx = first + second || 1;
  1171. const sy = first - second || 1;
  1172. return [Math.sqrt(sx), Math.sqrt(sy)];
  1173. }
  1174. static normalizeRect(rect) {
  1175. const r = rect.slice(0);
  1176. if (rect[0] > rect[2]) {
  1177. r[0] = rect[2];
  1178. r[2] = rect[0];
  1179. }
  1180. if (rect[1] > rect[3]) {
  1181. r[1] = rect[3];
  1182. r[3] = rect[1];
  1183. }
  1184. return r;
  1185. }
  1186. static intersect(rect1, rect2) {
  1187. function compare(a, b) {
  1188. return a - b;
  1189. }
  1190. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1191. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1192. const result = [];
  1193. rect1 = Util.normalizeRect(rect1);
  1194. rect2 = Util.normalizeRect(rect2);
  1195. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1196. result[0] = orderedX[1];
  1197. result[2] = orderedX[2];
  1198. } else {
  1199. return null;
  1200. }
  1201. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1202. result[1] = orderedY[1];
  1203. result[3] = orderedY[2];
  1204. } else {
  1205. return null;
  1206. }
  1207. return result;
  1208. }
  1209. }
  1210. exports.Util = Util;
  1211. 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];
  1212. function stringToPDFString(str) {
  1213. const length = str.length,
  1214. strBuf = [];
  1215. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1216. for (let i = 2; i < length; i += 2) {
  1217. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1218. }
  1219. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1220. for (let i = 2; i < length; i += 2) {
  1221. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1222. }
  1223. } else {
  1224. for (let i = 0; i < length; ++i) {
  1225. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1226. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1227. }
  1228. }
  1229. return strBuf.join("");
  1230. }
  1231. function stringToUTF8String(str) {
  1232. return decodeURIComponent(escape(str));
  1233. }
  1234. function utf8StringToString(str) {
  1235. return unescape(encodeURIComponent(str));
  1236. }
  1237. function isEmptyObj(obj) {
  1238. for (const key in obj) {
  1239. return false;
  1240. }
  1241. return true;
  1242. }
  1243. function isBool(v) {
  1244. return typeof v === "boolean";
  1245. }
  1246. function isNum(v) {
  1247. return typeof v === "number";
  1248. }
  1249. function isString(v) {
  1250. return typeof v === "string";
  1251. }
  1252. function isArrayBuffer(v) {
  1253. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1254. }
  1255. function isArrayEqual(arr1, arr2) {
  1256. if (arr1.length !== arr2.length) {
  1257. return false;
  1258. }
  1259. return arr1.every(function (element, index) {
  1260. return element === arr2[index];
  1261. });
  1262. }
  1263. function createPromiseCapability() {
  1264. const capability = Object.create(null);
  1265. let isSettled = false;
  1266. Object.defineProperty(capability, "settled", {
  1267. get() {
  1268. return isSettled;
  1269. }
  1270. });
  1271. capability.promise = new Promise(function (resolve, reject) {
  1272. capability.resolve = function (data) {
  1273. isSettled = true;
  1274. resolve(data);
  1275. };
  1276. capability.reject = function (reason) {
  1277. isSettled = true;
  1278. reject(reason);
  1279. };
  1280. });
  1281. return capability;
  1282. }
  1283. const createObjectURL = function createObjectURLClosure() {
  1284. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1285. return function createObjectURL(data, contentType, forceDataSchema = false) {
  1286. if (!forceDataSchema && URL.createObjectURL) {
  1287. const blob = new Blob([data], {
  1288. type: contentType
  1289. });
  1290. return URL.createObjectURL(blob);
  1291. }
  1292. let buffer = `data:${contentType};base64,`;
  1293. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1294. const b1 = data[i] & 0xff;
  1295. const b2 = data[i + 1] & 0xff;
  1296. const b3 = data[i + 2] & 0xff;
  1297. const d1 = b1 >> 2,
  1298. d2 = (b1 & 3) << 4 | b2 >> 4;
  1299. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1300. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1301. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1302. }
  1303. return buffer;
  1304. };
  1305. }();
  1306. exports.createObjectURL = createObjectURL;
  1307. /***/ }),
  1308. /* 3 */
  1309. /***/ (function(module, exports, __w_pdfjs_require__) {
  1310. "use strict";
  1311. var _is_node = __w_pdfjs_require__(4);
  1312. ;
  1313. /***/ }),
  1314. /* 4 */
  1315. /***/ (function(module, exports, __w_pdfjs_require__) {
  1316. "use strict";
  1317. Object.defineProperty(exports, "__esModule", {
  1318. value: true
  1319. });
  1320. exports.isNodeJS = void 0;
  1321. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron;
  1322. exports.isNodeJS = isNodeJS;
  1323. /***/ }),
  1324. /* 5 */
  1325. /***/ (function(module, exports, __w_pdfjs_require__) {
  1326. "use strict";
  1327. Object.defineProperty(exports, "__esModule", {
  1328. value: true
  1329. });
  1330. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1331. exports.isEOF = isEOF;
  1332. exports.isCmd = isCmd;
  1333. exports.isDict = isDict;
  1334. exports.isName = isName;
  1335. exports.isRef = isRef;
  1336. exports.isRefsEqual = isRefsEqual;
  1337. exports.isStream = isStream;
  1338. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0;
  1339. var _util = __w_pdfjs_require__(2);
  1340. var EOF = {};
  1341. exports.EOF = EOF;
  1342. var Name = function NameClosure() {
  1343. let nameCache = Object.create(null);
  1344. function Name(name) {
  1345. this.name = name;
  1346. }
  1347. Name.prototype = {};
  1348. Name.get = function Name_get(name) {
  1349. var nameValue = nameCache[name];
  1350. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1351. };
  1352. Name._clearCache = function () {
  1353. nameCache = Object.create(null);
  1354. };
  1355. return Name;
  1356. }();
  1357. exports.Name = Name;
  1358. var Cmd = function CmdClosure() {
  1359. let cmdCache = Object.create(null);
  1360. function Cmd(cmd) {
  1361. this.cmd = cmd;
  1362. }
  1363. Cmd.prototype = {};
  1364. Cmd.get = function Cmd_get(cmd) {
  1365. var cmdValue = cmdCache[cmd];
  1366. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1367. };
  1368. Cmd._clearCache = function () {
  1369. cmdCache = Object.create(null);
  1370. };
  1371. return Cmd;
  1372. }();
  1373. exports.Cmd = Cmd;
  1374. var Dict = function DictClosure() {
  1375. var nonSerializable = function nonSerializableClosure() {
  1376. return nonSerializable;
  1377. };
  1378. function Dict(xref) {
  1379. this._map = Object.create(null);
  1380. this.xref = xref;
  1381. this.objId = null;
  1382. this.suppressEncryption = false;
  1383. this.__nonSerializable__ = nonSerializable;
  1384. }
  1385. Dict.prototype = {
  1386. assignXref: function Dict_assignXref(newXref) {
  1387. this.xref = newXref;
  1388. },
  1389. get(key1, key2, key3) {
  1390. let value = this._map[key1];
  1391. if (value === undefined && key2 !== undefined) {
  1392. value = this._map[key2];
  1393. if (value === undefined && key3 !== undefined) {
  1394. value = this._map[key3];
  1395. }
  1396. }
  1397. if (value instanceof Ref && this.xref) {
  1398. return this.xref.fetch(value, this.suppressEncryption);
  1399. }
  1400. return value;
  1401. },
  1402. async getAsync(key1, key2, key3) {
  1403. let value = this._map[key1];
  1404. if (value === undefined && key2 !== undefined) {
  1405. value = this._map[key2];
  1406. if (value === undefined && key3 !== undefined) {
  1407. value = this._map[key3];
  1408. }
  1409. }
  1410. if (value instanceof Ref && this.xref) {
  1411. return this.xref.fetchAsync(value, this.suppressEncryption);
  1412. }
  1413. return value;
  1414. },
  1415. getArray(key1, key2, key3) {
  1416. let value = this.get(key1, key2, key3);
  1417. if (!Array.isArray(value) || !this.xref) {
  1418. return value;
  1419. }
  1420. value = value.slice();
  1421. for (let i = 0, ii = value.length; i < ii; i++) {
  1422. if (!(value[i] instanceof Ref)) {
  1423. continue;
  1424. }
  1425. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1426. }
  1427. return value;
  1428. },
  1429. getRaw: function Dict_getRaw(key) {
  1430. return this._map[key];
  1431. },
  1432. getKeys: function Dict_getKeys() {
  1433. return Object.keys(this._map);
  1434. },
  1435. set: function Dict_set(key, value) {
  1436. this._map[key] = value;
  1437. },
  1438. has: function Dict_has(key) {
  1439. return this._map[key] !== undefined;
  1440. },
  1441. forEach: function Dict_forEach(callback) {
  1442. for (var key in this._map) {
  1443. callback(key, this.get(key));
  1444. }
  1445. }
  1446. };
  1447. Dict.empty = new Dict(null);
  1448. Dict.merge = function (xref, dictArray) {
  1449. const mergedDict = new Dict(xref);
  1450. for (let i = 0, ii = dictArray.length; i < ii; i++) {
  1451. const dict = dictArray[i];
  1452. if (!isDict(dict)) {
  1453. continue;
  1454. }
  1455. for (const keyName in dict._map) {
  1456. if (mergedDict._map[keyName] !== undefined) {
  1457. continue;
  1458. }
  1459. mergedDict._map[keyName] = dict._map[keyName];
  1460. }
  1461. }
  1462. return mergedDict;
  1463. };
  1464. return Dict;
  1465. }();
  1466. exports.Dict = Dict;
  1467. var Ref = function RefClosure() {
  1468. let refCache = Object.create(null);
  1469. function Ref(num, gen) {
  1470. this.num = num;
  1471. this.gen = gen;
  1472. }
  1473. Ref.prototype = {
  1474. toString: function Ref_toString() {
  1475. if (this.gen === 0) {
  1476. return `${this.num}R`;
  1477. }
  1478. return `${this.num}R${this.gen}`;
  1479. }
  1480. };
  1481. Ref.get = function (num, gen) {
  1482. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1483. const refValue = refCache[key];
  1484. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1485. };
  1486. Ref._clearCache = function () {
  1487. refCache = Object.create(null);
  1488. };
  1489. return Ref;
  1490. }();
  1491. exports.Ref = Ref;
  1492. var RefSet = function RefSetClosure() {
  1493. function RefSet() {
  1494. this.dict = Object.create(null);
  1495. }
  1496. RefSet.prototype = {
  1497. has: function RefSet_has(ref) {
  1498. return ref.toString() in this.dict;
  1499. },
  1500. put: function RefSet_put(ref) {
  1501. this.dict[ref.toString()] = true;
  1502. },
  1503. remove: function RefSet_remove(ref) {
  1504. delete this.dict[ref.toString()];
  1505. }
  1506. };
  1507. return RefSet;
  1508. }();
  1509. exports.RefSet = RefSet;
  1510. var RefSetCache = function RefSetCacheClosure() {
  1511. function RefSetCache() {
  1512. this.dict = Object.create(null);
  1513. }
  1514. RefSetCache.prototype = {
  1515. get size() {
  1516. return Object.keys(this.dict).length;
  1517. },
  1518. get: function RefSetCache_get(ref) {
  1519. return this.dict[ref.toString()];
  1520. },
  1521. has: function RefSetCache_has(ref) {
  1522. return ref.toString() in this.dict;
  1523. },
  1524. put: function RefSetCache_put(ref, obj) {
  1525. this.dict[ref.toString()] = obj;
  1526. },
  1527. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1528. this.dict[ref.toString()] = this.get(aliasRef);
  1529. },
  1530. forEach: function RefSetCache_forEach(callback) {
  1531. for (const i in this.dict) {
  1532. callback(this.dict[i]);
  1533. }
  1534. },
  1535. clear: function RefSetCache_clear() {
  1536. this.dict = Object.create(null);
  1537. }
  1538. };
  1539. return RefSetCache;
  1540. }();
  1541. exports.RefSetCache = RefSetCache;
  1542. function isEOF(v) {
  1543. return v === EOF;
  1544. }
  1545. function isName(v, name) {
  1546. return v instanceof Name && (name === undefined || v.name === name);
  1547. }
  1548. function isCmd(v, cmd) {
  1549. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1550. }
  1551. function isDict(v, type) {
  1552. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1553. }
  1554. function isRef(v) {
  1555. return v instanceof Ref;
  1556. }
  1557. function isRefsEqual(v1, v2) {
  1558. return v1.num === v2.num && v1.gen === v2.gen;
  1559. }
  1560. function isStream(v) {
  1561. return typeof v === "object" && v !== null && v.getBytes !== undefined;
  1562. }
  1563. function clearPrimitiveCaches() {
  1564. Cmd._clearCache();
  1565. Name._clearCache();
  1566. Ref._clearCache();
  1567. }
  1568. /***/ }),
  1569. /* 6 */
  1570. /***/ (function(module, exports, __w_pdfjs_require__) {
  1571. "use strict";
  1572. Object.defineProperty(exports, "__esModule", {
  1573. value: true
  1574. });
  1575. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1576. var _util = __w_pdfjs_require__(2);
  1577. var _chunked_stream = __w_pdfjs_require__(7);
  1578. var _core_utils = __w_pdfjs_require__(8);
  1579. var _document = __w_pdfjs_require__(9);
  1580. var _stream = __w_pdfjs_require__(12);
  1581. class BasePdfManager {
  1582. constructor() {
  1583. if (this.constructor === BasePdfManager) {
  1584. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1585. }
  1586. }
  1587. get docId() {
  1588. return this._docId;
  1589. }
  1590. get password() {
  1591. return this._password;
  1592. }
  1593. get docBaseUrl() {
  1594. let docBaseUrl = null;
  1595. if (this._docBaseUrl) {
  1596. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
  1597. if (absoluteUrl) {
  1598. docBaseUrl = absoluteUrl.href;
  1599. } else {
  1600. (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`);
  1601. }
  1602. }
  1603. return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
  1604. }
  1605. onLoadedStream() {
  1606. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1607. }
  1608. ensureDoc(prop, args) {
  1609. return this.ensure(this.pdfDocument, prop, args);
  1610. }
  1611. ensureXRef(prop, args) {
  1612. return this.ensure(this.pdfDocument.xref, prop, args);
  1613. }
  1614. ensureCatalog(prop, args) {
  1615. return this.ensure(this.pdfDocument.catalog, prop, args);
  1616. }
  1617. getPage(pageIndex) {
  1618. return this.pdfDocument.getPage(pageIndex);
  1619. }
  1620. fontFallback(id, handler) {
  1621. return this.pdfDocument.fontFallback(id, handler);
  1622. }
  1623. cleanup(manuallyTriggered = false) {
  1624. return this.pdfDocument.cleanup(manuallyTriggered);
  1625. }
  1626. async ensure(obj, prop, args) {
  1627. (0, _util.unreachable)("Abstract method `ensure` called");
  1628. }
  1629. requestRange(begin, end) {
  1630. (0, _util.unreachable)("Abstract method `requestRange` called");
  1631. }
  1632. requestLoadedStream() {
  1633. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1634. }
  1635. sendProgressiveData(chunk) {
  1636. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1637. }
  1638. updatePassword(password) {
  1639. this._password = password;
  1640. }
  1641. terminate(reason) {
  1642. (0, _util.unreachable)("Abstract method `terminate` called");
  1643. }
  1644. }
  1645. class LocalPdfManager extends BasePdfManager {
  1646. constructor(docId, data, password, evaluatorOptions, docBaseUrl) {
  1647. super();
  1648. this._docId = docId;
  1649. this._password = password;
  1650. this._docBaseUrl = docBaseUrl;
  1651. this.evaluatorOptions = evaluatorOptions;
  1652. const stream = new _stream.Stream(data);
  1653. this.pdfDocument = new _document.PDFDocument(this, stream);
  1654. this._loadedStreamPromise = Promise.resolve(stream);
  1655. }
  1656. async ensure(obj, prop, args) {
  1657. const value = obj[prop];
  1658. if (typeof value === "function") {
  1659. return value.apply(obj, args);
  1660. }
  1661. return value;
  1662. }
  1663. requestRange(begin, end) {
  1664. return Promise.resolve();
  1665. }
  1666. requestLoadedStream() {}
  1667. onLoadedStream() {
  1668. return this._loadedStreamPromise;
  1669. }
  1670. terminate(reason) {}
  1671. }
  1672. exports.LocalPdfManager = LocalPdfManager;
  1673. class NetworkPdfManager extends BasePdfManager {
  1674. constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  1675. super();
  1676. this._docId = docId;
  1677. this._password = args.password;
  1678. this._docBaseUrl = docBaseUrl;
  1679. this.msgHandler = args.msgHandler;
  1680. this.evaluatorOptions = evaluatorOptions;
  1681. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1682. msgHandler: args.msgHandler,
  1683. length: args.length,
  1684. disableAutoFetch: args.disableAutoFetch,
  1685. rangeChunkSize: args.rangeChunkSize
  1686. });
  1687. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1688. }
  1689. async ensure(obj, prop, args) {
  1690. try {
  1691. const value = obj[prop];
  1692. if (typeof value === "function") {
  1693. return value.apply(obj, args);
  1694. }
  1695. return value;
  1696. } catch (ex) {
  1697. if (!(ex instanceof _core_utils.MissingDataException)) {
  1698. throw ex;
  1699. }
  1700. await this.requestRange(ex.begin, ex.end);
  1701. return this.ensure(obj, prop, args);
  1702. }
  1703. }
  1704. requestRange(begin, end) {
  1705. return this.streamManager.requestRange(begin, end);
  1706. }
  1707. requestLoadedStream() {
  1708. this.streamManager.requestAllChunks();
  1709. }
  1710. sendProgressiveData(chunk) {
  1711. this.streamManager.onReceiveData({
  1712. chunk
  1713. });
  1714. }
  1715. onLoadedStream() {
  1716. return this.streamManager.onLoadedStream();
  1717. }
  1718. terminate(reason) {
  1719. this.streamManager.abort(reason);
  1720. }
  1721. }
  1722. exports.NetworkPdfManager = NetworkPdfManager;
  1723. /***/ }),
  1724. /* 7 */
  1725. /***/ (function(module, exports, __w_pdfjs_require__) {
  1726. "use strict";
  1727. Object.defineProperty(exports, "__esModule", {
  1728. value: true
  1729. });
  1730. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1731. var _util = __w_pdfjs_require__(2);
  1732. var _core_utils = __w_pdfjs_require__(8);
  1733. class ChunkedStream {
  1734. constructor(length, chunkSize, manager) {
  1735. this.bytes = new Uint8Array(length);
  1736. this.start = 0;
  1737. this.pos = 0;
  1738. this.end = length;
  1739. this.chunkSize = chunkSize;
  1740. this.loadedChunks = [];
  1741. this.numChunksLoaded = 0;
  1742. this.numChunks = Math.ceil(length / chunkSize);
  1743. this.manager = manager;
  1744. this.progressiveDataLength = 0;
  1745. this.lastSuccessfulEnsureByteChunk = -1;
  1746. }
  1747. getMissingChunks() {
  1748. const chunks = [];
  1749. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1750. if (!this.loadedChunks[chunk]) {
  1751. chunks.push(chunk);
  1752. }
  1753. }
  1754. return chunks;
  1755. }
  1756. getBaseStreams() {
  1757. return [this];
  1758. }
  1759. allChunksLoaded() {
  1760. return this.numChunksLoaded === this.numChunks;
  1761. }
  1762. onReceiveData(begin, chunk) {
  1763. const chunkSize = this.chunkSize;
  1764. if (begin % chunkSize !== 0) {
  1765. throw new Error(`Bad begin offset: ${begin}`);
  1766. }
  1767. const end = begin + chunk.byteLength;
  1768. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1769. throw new Error(`Bad end offset: ${end}`);
  1770. }
  1771. this.bytes.set(new Uint8Array(chunk), begin);
  1772. const beginChunk = Math.floor(begin / chunkSize);
  1773. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1774. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1775. if (!this.loadedChunks[curChunk]) {
  1776. this.loadedChunks[curChunk] = true;
  1777. ++this.numChunksLoaded;
  1778. }
  1779. }
  1780. }
  1781. onReceiveProgressiveData(data) {
  1782. let position = this.progressiveDataLength;
  1783. const beginChunk = Math.floor(position / this.chunkSize);
  1784. this.bytes.set(new Uint8Array(data), position);
  1785. position += data.byteLength;
  1786. this.progressiveDataLength = position;
  1787. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1788. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1789. if (!this.loadedChunks[curChunk]) {
  1790. this.loadedChunks[curChunk] = true;
  1791. ++this.numChunksLoaded;
  1792. }
  1793. }
  1794. }
  1795. ensureByte(pos) {
  1796. if (pos < this.progressiveDataLength) {
  1797. return;
  1798. }
  1799. const chunk = Math.floor(pos / this.chunkSize);
  1800. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1801. return;
  1802. }
  1803. if (!this.loadedChunks[chunk]) {
  1804. throw new _core_utils.MissingDataException(pos, pos + 1);
  1805. }
  1806. this.lastSuccessfulEnsureByteChunk = chunk;
  1807. }
  1808. ensureRange(begin, end) {
  1809. if (begin >= end) {
  1810. return;
  1811. }
  1812. if (end <= this.progressiveDataLength) {
  1813. return;
  1814. }
  1815. const chunkSize = this.chunkSize;
  1816. const beginChunk = Math.floor(begin / chunkSize);
  1817. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1818. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1819. if (!this.loadedChunks[chunk]) {
  1820. throw new _core_utils.MissingDataException(begin, end);
  1821. }
  1822. }
  1823. }
  1824. nextEmptyChunk(beginChunk) {
  1825. const numChunks = this.numChunks;
  1826. for (let i = 0; i < numChunks; ++i) {
  1827. const chunk = (beginChunk + i) % numChunks;
  1828. if (!this.loadedChunks[chunk]) {
  1829. return chunk;
  1830. }
  1831. }
  1832. return null;
  1833. }
  1834. hasChunk(chunk) {
  1835. return !!this.loadedChunks[chunk];
  1836. }
  1837. get length() {
  1838. return this.end - this.start;
  1839. }
  1840. get isEmpty() {
  1841. return this.length === 0;
  1842. }
  1843. getByte() {
  1844. const pos = this.pos;
  1845. if (pos >= this.end) {
  1846. return -1;
  1847. }
  1848. if (pos >= this.progressiveDataLength) {
  1849. this.ensureByte(pos);
  1850. }
  1851. return this.bytes[this.pos++];
  1852. }
  1853. getUint16() {
  1854. const b0 = this.getByte();
  1855. const b1 = this.getByte();
  1856. if (b0 === -1 || b1 === -1) {
  1857. return -1;
  1858. }
  1859. return (b0 << 8) + b1;
  1860. }
  1861. getInt32() {
  1862. const b0 = this.getByte();
  1863. const b1 = this.getByte();
  1864. const b2 = this.getByte();
  1865. const b3 = this.getByte();
  1866. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1867. }
  1868. getBytes(length, forceClamped = false) {
  1869. const bytes = this.bytes;
  1870. const pos = this.pos;
  1871. const strEnd = this.end;
  1872. if (!length) {
  1873. if (strEnd > this.progressiveDataLength) {
  1874. this.ensureRange(pos, strEnd);
  1875. }
  1876. const subarray = bytes.subarray(pos, strEnd);
  1877. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  1878. }
  1879. let end = pos + length;
  1880. if (end > strEnd) {
  1881. end = strEnd;
  1882. }
  1883. if (end > this.progressiveDataLength) {
  1884. this.ensureRange(pos, end);
  1885. }
  1886. this.pos = end;
  1887. const subarray = bytes.subarray(pos, end);
  1888. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  1889. }
  1890. peekByte() {
  1891. const peekedByte = this.getByte();
  1892. if (peekedByte !== -1) {
  1893. this.pos--;
  1894. }
  1895. return peekedByte;
  1896. }
  1897. peekBytes(length, forceClamped = false) {
  1898. const bytes = this.getBytes(length, forceClamped);
  1899. this.pos -= bytes.length;
  1900. return bytes;
  1901. }
  1902. getByteRange(begin, end) {
  1903. if (begin < 0) {
  1904. begin = 0;
  1905. }
  1906. if (end > this.end) {
  1907. end = this.end;
  1908. }
  1909. if (end > this.progressiveDataLength) {
  1910. this.ensureRange(begin, end);
  1911. }
  1912. return this.bytes.subarray(begin, end);
  1913. }
  1914. skip(n) {
  1915. if (!n) {
  1916. n = 1;
  1917. }
  1918. this.pos += n;
  1919. }
  1920. reset() {
  1921. this.pos = this.start;
  1922. }
  1923. moveStart() {
  1924. this.start = this.pos;
  1925. }
  1926. makeSubStream(start, length, dict) {
  1927. if (length) {
  1928. if (start + length > this.progressiveDataLength) {
  1929. this.ensureRange(start, start + length);
  1930. }
  1931. } else {
  1932. if (start >= this.progressiveDataLength) {
  1933. this.ensureByte(start);
  1934. }
  1935. }
  1936. function ChunkedStreamSubstream() {}
  1937. ChunkedStreamSubstream.prototype = Object.create(this);
  1938. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  1939. const chunkSize = this.chunkSize;
  1940. const beginChunk = Math.floor(this.start / chunkSize);
  1941. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  1942. const missingChunks = [];
  1943. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1944. if (!this.loadedChunks[chunk]) {
  1945. missingChunks.push(chunk);
  1946. }
  1947. }
  1948. return missingChunks;
  1949. };
  1950. ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
  1951. if (this.numChunksLoaded === this.numChunks) {
  1952. return true;
  1953. }
  1954. return this.getMissingChunks().length === 0;
  1955. };
  1956. const subStream = new ChunkedStreamSubstream();
  1957. subStream.pos = subStream.start = start;
  1958. subStream.end = start + length || this.end;
  1959. subStream.dict = dict;
  1960. return subStream;
  1961. }
  1962. }
  1963. exports.ChunkedStream = ChunkedStream;
  1964. class ChunkedStreamManager {
  1965. constructor(pdfNetworkStream, args) {
  1966. this.length = args.length;
  1967. this.chunkSize = args.rangeChunkSize;
  1968. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  1969. this.pdfNetworkStream = pdfNetworkStream;
  1970. this.disableAutoFetch = args.disableAutoFetch;
  1971. this.msgHandler = args.msgHandler;
  1972. this.currRequestId = 0;
  1973. this.chunksNeededByRequest = Object.create(null);
  1974. this.requestsByChunk = Object.create(null);
  1975. this.promisesByRequest = Object.create(null);
  1976. this.progressiveDataLength = 0;
  1977. this.aborted = false;
  1978. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  1979. }
  1980. onLoadedStream() {
  1981. return this._loadedStreamCapability.promise;
  1982. }
  1983. sendRequest(begin, end) {
  1984. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  1985. if (!rangeReader.isStreamingSupported) {
  1986. rangeReader.onProgress = this.onProgress.bind(this);
  1987. }
  1988. let chunks = [],
  1989. loaded = 0;
  1990. const promise = new Promise((resolve, reject) => {
  1991. const readChunk = chunk => {
  1992. try {
  1993. if (!chunk.done) {
  1994. const data = chunk.value;
  1995. chunks.push(data);
  1996. loaded += (0, _util.arrayByteLength)(data);
  1997. if (rangeReader.isStreamingSupported) {
  1998. this.onProgress({
  1999. loaded
  2000. });
  2001. }
  2002. rangeReader.read().then(readChunk, reject);
  2003. return;
  2004. }
  2005. const chunkData = (0, _util.arraysToBytes)(chunks);
  2006. chunks = null;
  2007. resolve(chunkData);
  2008. } catch (e) {
  2009. reject(e);
  2010. }
  2011. };
  2012. rangeReader.read().then(readChunk, reject);
  2013. });
  2014. promise.then(data => {
  2015. if (this.aborted) {
  2016. return;
  2017. }
  2018. this.onReceiveData({
  2019. chunk: data,
  2020. begin
  2021. });
  2022. });
  2023. }
  2024. requestAllChunks() {
  2025. const missingChunks = this.stream.getMissingChunks();
  2026. this._requestChunks(missingChunks);
  2027. return this._loadedStreamCapability.promise;
  2028. }
  2029. _requestChunks(chunks) {
  2030. const requestId = this.currRequestId++;
  2031. const chunksNeeded = Object.create(null);
  2032. this.chunksNeededByRequest[requestId] = chunksNeeded;
  2033. for (const chunk of chunks) {
  2034. if (!this.stream.hasChunk(chunk)) {
  2035. chunksNeeded[chunk] = true;
  2036. }
  2037. }
  2038. if ((0, _util.isEmptyObj)(chunksNeeded)) {
  2039. return Promise.resolve();
  2040. }
  2041. const capability = (0, _util.createPromiseCapability)();
  2042. this.promisesByRequest[requestId] = capability;
  2043. const chunksToRequest = [];
  2044. for (let chunk in chunksNeeded) {
  2045. chunk = chunk | 0;
  2046. if (!(chunk in this.requestsByChunk)) {
  2047. this.requestsByChunk[chunk] = [];
  2048. chunksToRequest.push(chunk);
  2049. }
  2050. this.requestsByChunk[chunk].push(requestId);
  2051. }
  2052. if (!chunksToRequest.length) {
  2053. return capability.promise;
  2054. }
  2055. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2056. for (const groupedChunk of groupedChunksToRequest) {
  2057. const begin = groupedChunk.beginChunk * this.chunkSize;
  2058. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2059. this.sendRequest(begin, end);
  2060. }
  2061. return capability.promise;
  2062. }
  2063. getStream() {
  2064. return this.stream;
  2065. }
  2066. requestRange(begin, end) {
  2067. end = Math.min(end, this.length);
  2068. const beginChunk = this.getBeginChunk(begin);
  2069. const endChunk = this.getEndChunk(end);
  2070. const chunks = [];
  2071. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2072. chunks.push(chunk);
  2073. }
  2074. return this._requestChunks(chunks);
  2075. }
  2076. requestRanges(ranges = []) {
  2077. const chunksToRequest = [];
  2078. for (const range of ranges) {
  2079. const beginChunk = this.getBeginChunk(range.begin);
  2080. const endChunk = this.getEndChunk(range.end);
  2081. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2082. if (!chunksToRequest.includes(chunk)) {
  2083. chunksToRequest.push(chunk);
  2084. }
  2085. }
  2086. }
  2087. chunksToRequest.sort(function (a, b) {
  2088. return a - b;
  2089. });
  2090. return this._requestChunks(chunksToRequest);
  2091. }
  2092. groupChunks(chunks) {
  2093. const groupedChunks = [];
  2094. let beginChunk = -1;
  2095. let prevChunk = -1;
  2096. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2097. const chunk = chunks[i];
  2098. if (beginChunk < 0) {
  2099. beginChunk = chunk;
  2100. }
  2101. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2102. groupedChunks.push({
  2103. beginChunk,
  2104. endChunk: prevChunk + 1
  2105. });
  2106. beginChunk = chunk;
  2107. }
  2108. if (i + 1 === chunks.length) {
  2109. groupedChunks.push({
  2110. beginChunk,
  2111. endChunk: chunk + 1
  2112. });
  2113. }
  2114. prevChunk = chunk;
  2115. }
  2116. return groupedChunks;
  2117. }
  2118. onProgress(args) {
  2119. this.msgHandler.send("DocProgress", {
  2120. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2121. total: this.length
  2122. });
  2123. }
  2124. onReceiveData(args) {
  2125. const chunk = args.chunk;
  2126. const isProgressive = args.begin === undefined;
  2127. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2128. const end = begin + chunk.byteLength;
  2129. const beginChunk = Math.floor(begin / this.chunkSize);
  2130. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2131. if (isProgressive) {
  2132. this.stream.onReceiveProgressiveData(chunk);
  2133. this.progressiveDataLength = end;
  2134. } else {
  2135. this.stream.onReceiveData(begin, chunk);
  2136. }
  2137. if (this.stream.allChunksLoaded()) {
  2138. this._loadedStreamCapability.resolve(this.stream);
  2139. }
  2140. const loadedRequests = [];
  2141. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2142. const requestIds = this.requestsByChunk[curChunk] || [];
  2143. delete this.requestsByChunk[curChunk];
  2144. for (const requestId of requestIds) {
  2145. const chunksNeeded = this.chunksNeededByRequest[requestId];
  2146. if (curChunk in chunksNeeded) {
  2147. delete chunksNeeded[curChunk];
  2148. }
  2149. if (!(0, _util.isEmptyObj)(chunksNeeded)) {
  2150. continue;
  2151. }
  2152. loadedRequests.push(requestId);
  2153. }
  2154. }
  2155. if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
  2156. let nextEmptyChunk;
  2157. if (this.stream.numChunksLoaded === 1) {
  2158. const lastChunk = this.stream.numChunks - 1;
  2159. if (!this.stream.hasChunk(lastChunk)) {
  2160. nextEmptyChunk = lastChunk;
  2161. }
  2162. } else {
  2163. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2164. }
  2165. if (Number.isInteger(nextEmptyChunk)) {
  2166. this._requestChunks([nextEmptyChunk]);
  2167. }
  2168. }
  2169. for (const requestId of loadedRequests) {
  2170. const capability = this.promisesByRequest[requestId];
  2171. delete this.promisesByRequest[requestId];
  2172. capability.resolve();
  2173. }
  2174. this.msgHandler.send("DocProgress", {
  2175. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2176. total: this.length
  2177. });
  2178. }
  2179. onError(err) {
  2180. this._loadedStreamCapability.reject(err);
  2181. }
  2182. getBeginChunk(begin) {
  2183. return Math.floor(begin / this.chunkSize);
  2184. }
  2185. getEndChunk(end) {
  2186. return Math.floor((end - 1) / this.chunkSize) + 1;
  2187. }
  2188. abort(reason) {
  2189. this.aborted = true;
  2190. if (this.pdfNetworkStream) {
  2191. this.pdfNetworkStream.cancelAllRequests(reason);
  2192. }
  2193. for (const requestId in this.promisesByRequest) {
  2194. this.promisesByRequest[requestId].reject(reason);
  2195. }
  2196. }
  2197. }
  2198. exports.ChunkedStreamManager = ChunkedStreamManager;
  2199. /***/ }),
  2200. /* 8 */
  2201. /***/ (function(module, exports, __w_pdfjs_require__) {
  2202. "use strict";
  2203. Object.defineProperty(exports, "__esModule", {
  2204. value: true
  2205. });
  2206. exports.getLookupTableFactory = getLookupTableFactory;
  2207. exports.getInheritableProperty = getInheritableProperty;
  2208. exports.toRomanNumerals = toRomanNumerals;
  2209. exports.log2 = log2;
  2210. exports.readInt8 = readInt8;
  2211. exports.readUint16 = readUint16;
  2212. exports.readUint32 = readUint32;
  2213. exports.isWhiteSpace = isWhiteSpace;
  2214. exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
  2215. var _util = __w_pdfjs_require__(2);
  2216. function getLookupTableFactory(initializer) {
  2217. let lookup;
  2218. return function () {
  2219. if (initializer) {
  2220. lookup = Object.create(null);
  2221. initializer(lookup);
  2222. initializer = null;
  2223. }
  2224. return lookup;
  2225. };
  2226. }
  2227. class MissingDataException extends _util.BaseException {
  2228. constructor(begin, end) {
  2229. super(`Missing data [${begin}, ${end})`);
  2230. this.begin = begin;
  2231. this.end = end;
  2232. }
  2233. }
  2234. exports.MissingDataException = MissingDataException;
  2235. class XRefEntryException extends _util.BaseException {}
  2236. exports.XRefEntryException = XRefEntryException;
  2237. class XRefParseException extends _util.BaseException {}
  2238. exports.XRefParseException = XRefParseException;
  2239. function getInheritableProperty({
  2240. dict,
  2241. key,
  2242. getArray = false,
  2243. stopWhenFound = true
  2244. }) {
  2245. const LOOP_LIMIT = 100;
  2246. let loopCount = 0;
  2247. let values;
  2248. while (dict) {
  2249. const value = getArray ? dict.getArray(key) : dict.get(key);
  2250. if (value !== undefined) {
  2251. if (stopWhenFound) {
  2252. return value;
  2253. }
  2254. if (!values) {
  2255. values = [];
  2256. }
  2257. values.push(value);
  2258. }
  2259. if (++loopCount > LOOP_LIMIT) {
  2260. (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for "${key}"`);
  2261. break;
  2262. }
  2263. dict = dict.get("Parent");
  2264. }
  2265. return values;
  2266. }
  2267. 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"];
  2268. function toRomanNumerals(number, lowerCase = false) {
  2269. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2270. const romanBuf = [];
  2271. let pos;
  2272. while (number >= 1000) {
  2273. number -= 1000;
  2274. romanBuf.push("M");
  2275. }
  2276. pos = number / 100 | 0;
  2277. number %= 100;
  2278. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2279. pos = number / 10 | 0;
  2280. number %= 10;
  2281. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2282. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2283. const romanStr = romanBuf.join("");
  2284. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2285. }
  2286. function log2(x) {
  2287. if (x <= 0) {
  2288. return 0;
  2289. }
  2290. return Math.ceil(Math.log2(x));
  2291. }
  2292. function readInt8(data, offset) {
  2293. return data[offset] << 24 >> 24;
  2294. }
  2295. function readUint16(data, offset) {
  2296. return data[offset] << 8 | data[offset + 1];
  2297. }
  2298. function readUint32(data, offset) {
  2299. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2300. }
  2301. function isWhiteSpace(ch) {
  2302. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2303. }
  2304. /***/ }),
  2305. /* 9 */
  2306. /***/ (function(module, exports, __w_pdfjs_require__) {
  2307. "use strict";
  2308. Object.defineProperty(exports, "__esModule", {
  2309. value: true
  2310. });
  2311. exports.PDFDocument = exports.Page = void 0;
  2312. var _util = __w_pdfjs_require__(2);
  2313. var _obj = __w_pdfjs_require__(10);
  2314. var _primitives = __w_pdfjs_require__(5);
  2315. var _core_utils = __w_pdfjs_require__(8);
  2316. var _stream = __w_pdfjs_require__(12);
  2317. var _annotation = __w_pdfjs_require__(25);
  2318. var _crypto = __w_pdfjs_require__(22);
  2319. var _parser = __w_pdfjs_require__(11);
  2320. var _operator_list = __w_pdfjs_require__(26);
  2321. var _evaluator = __w_pdfjs_require__(27);
  2322. var _function = __w_pdfjs_require__(41);
  2323. const DEFAULT_USER_UNIT = 1.0;
  2324. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2325. function isAnnotationRenderable(annotation, intent) {
  2326. return intent === "display" && annotation.viewable || intent === "print" && annotation.printable;
  2327. }
  2328. class Page {
  2329. constructor({
  2330. pdfManager,
  2331. xref,
  2332. pageIndex,
  2333. pageDict,
  2334. ref,
  2335. fontCache,
  2336. builtInCMapCache,
  2337. globalImageCache,
  2338. pdfFunctionFactory
  2339. }) {
  2340. this.pdfManager = pdfManager;
  2341. this.pageIndex = pageIndex;
  2342. this.pageDict = pageDict;
  2343. this.xref = xref;
  2344. this.ref = ref;
  2345. this.fontCache = fontCache;
  2346. this.builtInCMapCache = builtInCMapCache;
  2347. this.globalImageCache = globalImageCache;
  2348. this.pdfFunctionFactory = pdfFunctionFactory;
  2349. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2350. this.resourcesPromise = null;
  2351. const idCounters = {
  2352. obj: 0
  2353. };
  2354. this.idFactory = {
  2355. createObjId() {
  2356. return `p${pageIndex}_${++idCounters.obj}`;
  2357. },
  2358. getDocId() {
  2359. return `g_${pdfManager.docId}`;
  2360. }
  2361. };
  2362. }
  2363. _getInheritableProperty(key, getArray = false) {
  2364. const value = (0, _core_utils.getInheritableProperty)({
  2365. dict: this.pageDict,
  2366. key,
  2367. getArray,
  2368. stopWhenFound: false
  2369. });
  2370. if (!Array.isArray(value)) {
  2371. return value;
  2372. }
  2373. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2374. return value[0];
  2375. }
  2376. return _primitives.Dict.merge(this.xref, value);
  2377. }
  2378. get content() {
  2379. return this.pageDict.get("Contents");
  2380. }
  2381. get resources() {
  2382. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2383. }
  2384. _getBoundingBox(name) {
  2385. const box = this._getInheritableProperty(name, true);
  2386. if (Array.isArray(box) && box.length === 4) {
  2387. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2388. return box;
  2389. }
  2390. (0, _util.warn)(`Empty /${name} entry.`);
  2391. }
  2392. return null;
  2393. }
  2394. get mediaBox() {
  2395. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2396. }
  2397. get cropBox() {
  2398. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2399. }
  2400. get userUnit() {
  2401. let obj = this.pageDict.get("UserUnit");
  2402. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2403. obj = DEFAULT_USER_UNIT;
  2404. }
  2405. return (0, _util.shadow)(this, "userUnit", obj);
  2406. }
  2407. get view() {
  2408. const {
  2409. cropBox,
  2410. mediaBox
  2411. } = this;
  2412. let view;
  2413. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2414. view = mediaBox;
  2415. } else {
  2416. const box = _util.Util.intersect(cropBox, mediaBox);
  2417. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2418. view = box;
  2419. } else {
  2420. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2421. }
  2422. }
  2423. return (0, _util.shadow)(this, "view", view || mediaBox);
  2424. }
  2425. get rotate() {
  2426. let rotate = this._getInheritableProperty("Rotate") || 0;
  2427. if (rotate % 90 !== 0) {
  2428. rotate = 0;
  2429. } else if (rotate >= 360) {
  2430. rotate = rotate % 360;
  2431. } else if (rotate < 0) {
  2432. rotate = (rotate % 360 + 360) % 360;
  2433. }
  2434. return (0, _util.shadow)(this, "rotate", rotate);
  2435. }
  2436. getContentStream() {
  2437. const content = this.content;
  2438. let stream;
  2439. if (Array.isArray(content)) {
  2440. const xref = this.xref;
  2441. const streams = [];
  2442. for (const subStream of content) {
  2443. streams.push(xref.fetchIfRef(subStream));
  2444. }
  2445. stream = new _stream.StreamsSequenceStream(streams);
  2446. } else if ((0, _primitives.isStream)(content)) {
  2447. stream = content;
  2448. } else {
  2449. stream = new _stream.NullStream();
  2450. }
  2451. return stream;
  2452. }
  2453. loadResources(keys) {
  2454. if (!this.resourcesPromise) {
  2455. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  2456. }
  2457. return this.resourcesPromise.then(() => {
  2458. const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
  2459. return objectLoader.load();
  2460. });
  2461. }
  2462. getOperatorList({
  2463. handler,
  2464. sink,
  2465. task,
  2466. intent,
  2467. renderInteractiveForms
  2468. }) {
  2469. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2470. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  2471. const partialEvaluator = new _evaluator.PartialEvaluator({
  2472. xref: this.xref,
  2473. handler,
  2474. pageIndex: this.pageIndex,
  2475. idFactory: this.idFactory,
  2476. fontCache: this.fontCache,
  2477. builtInCMapCache: this.builtInCMapCache,
  2478. globalImageCache: this.globalImageCache,
  2479. options: this.evaluatorOptions,
  2480. pdfFunctionFactory: this.pdfFunctionFactory
  2481. });
  2482. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2483. const pageListPromise = dataPromises.then(([contentStream]) => {
  2484. const opList = new _operator_list.OperatorList(intent, sink, this.pageIndex);
  2485. handler.send("StartRenderPage", {
  2486. transparency: partialEvaluator.hasBlendModes(this.resources),
  2487. pageIndex: this.pageIndex,
  2488. intent
  2489. });
  2490. return partialEvaluator.getOperatorList({
  2491. stream: contentStream,
  2492. task,
  2493. resources: this.resources,
  2494. operatorList: opList
  2495. }).then(function () {
  2496. return opList;
  2497. });
  2498. });
  2499. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  2500. if (annotations.length === 0) {
  2501. pageOpList.flush(true);
  2502. return {
  2503. length: pageOpList.totalLength
  2504. };
  2505. }
  2506. const opListPromises = [];
  2507. for (const annotation of annotations) {
  2508. if (isAnnotationRenderable(annotation, intent)) {
  2509. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms).catch(function (reason) {
  2510. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2511. return null;
  2512. }));
  2513. }
  2514. }
  2515. return Promise.all(opListPromises).then(function (opLists) {
  2516. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  2517. for (const opList of opLists) {
  2518. pageOpList.addOpList(opList);
  2519. }
  2520. pageOpList.addOp(_util.OPS.endAnnotations, []);
  2521. pageOpList.flush(true);
  2522. return {
  2523. length: pageOpList.totalLength
  2524. };
  2525. });
  2526. });
  2527. }
  2528. extractTextContent({
  2529. handler,
  2530. task,
  2531. normalizeWhitespace,
  2532. sink,
  2533. combineTextItems
  2534. }) {
  2535. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2536. const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]);
  2537. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2538. return dataPromises.then(([contentStream]) => {
  2539. const partialEvaluator = new _evaluator.PartialEvaluator({
  2540. xref: this.xref,
  2541. handler,
  2542. pageIndex: this.pageIndex,
  2543. idFactory: this.idFactory,
  2544. fontCache: this.fontCache,
  2545. builtInCMapCache: this.builtInCMapCache,
  2546. globalImageCache: this.globalImageCache,
  2547. options: this.evaluatorOptions,
  2548. pdfFunctionFactory: this.pdfFunctionFactory
  2549. });
  2550. return partialEvaluator.getTextContent({
  2551. stream: contentStream,
  2552. task,
  2553. resources: this.resources,
  2554. normalizeWhitespace,
  2555. combineTextItems,
  2556. sink
  2557. });
  2558. });
  2559. }
  2560. getAnnotationsData(intent) {
  2561. return this._parsedAnnotations.then(function (annotations) {
  2562. const annotationsData = [];
  2563. for (let i = 0, ii = annotations.length; i < ii; i++) {
  2564. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  2565. annotationsData.push(annotations[i].data);
  2566. }
  2567. }
  2568. return annotationsData;
  2569. });
  2570. }
  2571. get annotations() {
  2572. return (0, _util.shadow)(this, "annotations", this._getInheritableProperty("Annots") || []);
  2573. }
  2574. get _parsedAnnotations() {
  2575. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  2576. const annotationPromises = [];
  2577. for (const annotationRef of this.annotations) {
  2578. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory).catch(function (reason) {
  2579. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  2580. return null;
  2581. }));
  2582. }
  2583. return Promise.all(annotationPromises).then(function (annotations) {
  2584. return annotations.filter(annotation => !!annotation);
  2585. });
  2586. });
  2587. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  2588. }
  2589. }
  2590. exports.Page = Page;
  2591. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  2592. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  2593. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  2594. const FINGERPRINT_FIRST_BYTES = 1024;
  2595. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  2596. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
  2597. function find(stream, signature, limit = 1024, backwards = false) {
  2598. const signatureLength = signature.length;
  2599. const scanBytes = stream.peekBytes(limit);
  2600. const scanLength = scanBytes.length - signatureLength;
  2601. if (scanLength <= 0) {
  2602. return false;
  2603. }
  2604. if (backwards) {
  2605. const signatureEnd = signatureLength - 1;
  2606. let pos = scanBytes.length - 1;
  2607. while (pos >= signatureEnd) {
  2608. let j = 0;
  2609. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  2610. j++;
  2611. }
  2612. if (j >= signatureLength) {
  2613. stream.pos += pos - signatureEnd;
  2614. return true;
  2615. }
  2616. pos--;
  2617. }
  2618. } else {
  2619. let pos = 0;
  2620. while (pos <= scanLength) {
  2621. let j = 0;
  2622. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  2623. j++;
  2624. }
  2625. if (j >= signatureLength) {
  2626. stream.pos += pos;
  2627. return true;
  2628. }
  2629. pos++;
  2630. }
  2631. }
  2632. return false;
  2633. }
  2634. class PDFDocument {
  2635. constructor(pdfManager, arg) {
  2636. let stream;
  2637. if ((0, _primitives.isStream)(arg)) {
  2638. stream = arg;
  2639. } else if ((0, _util.isArrayBuffer)(arg)) {
  2640. stream = new _stream.Stream(arg);
  2641. } else {
  2642. throw new Error("PDFDocument: Unknown argument type");
  2643. }
  2644. if (stream.length <= 0) {
  2645. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  2646. }
  2647. this.pdfManager = pdfManager;
  2648. this.stream = stream;
  2649. this.xref = new _obj.XRef(stream, pdfManager);
  2650. this.pdfFunctionFactory = new _function.PDFFunctionFactory({
  2651. xref: this.xref,
  2652. isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported
  2653. });
  2654. this._pagePromises = [];
  2655. }
  2656. parse(recoveryMode) {
  2657. this.setup(recoveryMode);
  2658. const version = this.catalog.catDict.get("Version");
  2659. if ((0, _primitives.isName)(version)) {
  2660. this.pdfFormatVersion = version.name;
  2661. }
  2662. try {
  2663. this.acroForm = this.catalog.catDict.get("AcroForm");
  2664. if (this.acroForm) {
  2665. this.xfa = this.acroForm.get("XFA");
  2666. const fields = this.acroForm.get("Fields");
  2667. if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
  2668. this.acroForm = null;
  2669. }
  2670. }
  2671. } catch (ex) {
  2672. if (ex instanceof _core_utils.MissingDataException) {
  2673. throw ex;
  2674. }
  2675. (0, _util.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present");
  2676. this.acroForm = null;
  2677. }
  2678. try {
  2679. const collection = this.catalog.catDict.get("Collection");
  2680. if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {
  2681. this.collection = collection;
  2682. }
  2683. } catch (ex) {
  2684. if (ex instanceof _core_utils.MissingDataException) {
  2685. throw ex;
  2686. }
  2687. (0, _util.info)("Cannot fetch Collection dictionary.");
  2688. }
  2689. }
  2690. get linearization() {
  2691. let linearization = null;
  2692. try {
  2693. linearization = _parser.Linearization.create(this.stream);
  2694. } catch (err) {
  2695. if (err instanceof _core_utils.MissingDataException) {
  2696. throw err;
  2697. }
  2698. (0, _util.info)(err);
  2699. }
  2700. return (0, _util.shadow)(this, "linearization", linearization);
  2701. }
  2702. get startXRef() {
  2703. const stream = this.stream;
  2704. let startXRef = 0;
  2705. if (this.linearization) {
  2706. stream.reset();
  2707. if (find(stream, ENDOBJ_SIGNATURE)) {
  2708. startXRef = stream.pos + 6 - stream.start;
  2709. }
  2710. } else {
  2711. const step = 1024;
  2712. const startXRefLength = STARTXREF_SIGNATURE.length;
  2713. let found = false,
  2714. pos = stream.end;
  2715. while (!found && pos > 0) {
  2716. pos -= step - startXRefLength;
  2717. if (pos < 0) {
  2718. pos = 0;
  2719. }
  2720. stream.pos = pos;
  2721. found = find(stream, STARTXREF_SIGNATURE, step, true);
  2722. }
  2723. if (found) {
  2724. stream.skip(9);
  2725. let ch;
  2726. do {
  2727. ch = stream.getByte();
  2728. } while ((0, _core_utils.isWhiteSpace)(ch));
  2729. let str = "";
  2730. while (ch >= 0x20 && ch <= 0x39) {
  2731. str += String.fromCharCode(ch);
  2732. ch = stream.getByte();
  2733. }
  2734. startXRef = parseInt(str, 10);
  2735. if (isNaN(startXRef)) {
  2736. startXRef = 0;
  2737. }
  2738. }
  2739. }
  2740. return (0, _util.shadow)(this, "startXRef", startXRef);
  2741. }
  2742. checkHeader() {
  2743. const stream = this.stream;
  2744. stream.reset();
  2745. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  2746. return;
  2747. }
  2748. stream.moveStart();
  2749. const MAX_PDF_VERSION_LENGTH = 12;
  2750. let version = "",
  2751. ch;
  2752. while ((ch = stream.getByte()) > 0x20) {
  2753. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  2754. break;
  2755. }
  2756. version += String.fromCharCode(ch);
  2757. }
  2758. if (!this.pdfFormatVersion) {
  2759. this.pdfFormatVersion = version.substring(5);
  2760. }
  2761. }
  2762. parseStartXRef() {
  2763. this.xref.setStartXRef(this.startXRef);
  2764. }
  2765. setup(recoveryMode) {
  2766. this.xref.parse(recoveryMode);
  2767. this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
  2768. }
  2769. get numPages() {
  2770. const linearization = this.linearization;
  2771. const num = linearization ? linearization.numPages : this.catalog.numPages;
  2772. return (0, _util.shadow)(this, "numPages", num);
  2773. }
  2774. get documentInfo() {
  2775. const DocumentInfoValidators = {
  2776. Title: _util.isString,
  2777. Author: _util.isString,
  2778. Subject: _util.isString,
  2779. Keywords: _util.isString,
  2780. Creator: _util.isString,
  2781. Producer: _util.isString,
  2782. CreationDate: _util.isString,
  2783. ModDate: _util.isString,
  2784. Trapped: _primitives.isName
  2785. };
  2786. let version = this.pdfFormatVersion;
  2787. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  2788. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  2789. version = null;
  2790. }
  2791. const docInfo = {
  2792. PDFFormatVersion: version,
  2793. IsLinearized: !!this.linearization,
  2794. IsAcroFormPresent: !!this.acroForm,
  2795. IsXFAPresent: !!this.xfa,
  2796. IsCollectionPresent: !!this.collection
  2797. };
  2798. let infoDict;
  2799. try {
  2800. infoDict = this.xref.trailer.get("Info");
  2801. } catch (err) {
  2802. if (err instanceof _core_utils.MissingDataException) {
  2803. throw err;
  2804. }
  2805. (0, _util.info)("The document information dictionary is invalid.");
  2806. }
  2807. if ((0, _primitives.isDict)(infoDict)) {
  2808. for (const key of infoDict.getKeys()) {
  2809. const value = infoDict.get(key);
  2810. if (DocumentInfoValidators[key]) {
  2811. if (DocumentInfoValidators[key](value)) {
  2812. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  2813. } else {
  2814. (0, _util.info)(`Bad value in document info for "${key}".`);
  2815. }
  2816. } else if (typeof key === "string") {
  2817. let customValue;
  2818. if ((0, _util.isString)(value)) {
  2819. customValue = (0, _util.stringToPDFString)(value);
  2820. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  2821. customValue = value;
  2822. } else {
  2823. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  2824. continue;
  2825. }
  2826. if (!docInfo.Custom) {
  2827. docInfo.Custom = Object.create(null);
  2828. }
  2829. docInfo.Custom[key] = customValue;
  2830. }
  2831. }
  2832. }
  2833. return (0, _util.shadow)(this, "documentInfo", docInfo);
  2834. }
  2835. get fingerprint() {
  2836. let hash;
  2837. const idArray = this.xref.trailer.get("ID");
  2838. if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  2839. hash = (0, _util.stringToBytes)(idArray[0]);
  2840. } else {
  2841. hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  2842. }
  2843. const fingerprintBuf = [];
  2844. for (let i = 0, ii = hash.length; i < ii; i++) {
  2845. const hex = hash[i].toString(16);
  2846. fingerprintBuf.push(hex.padStart(2, "0"));
  2847. }
  2848. return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
  2849. }
  2850. _getLinearizationPage(pageIndex) {
  2851. const {
  2852. catalog,
  2853. linearization
  2854. } = this;
  2855. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  2856. return this.xref.fetchAsync(ref).then(obj => {
  2857. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  2858. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  2859. catalog.pageKidsCountCache.put(ref, 1);
  2860. }
  2861. return [obj, ref];
  2862. }
  2863. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  2864. }).catch(reason => {
  2865. (0, _util.info)(reason);
  2866. return catalog.getPageDict(pageIndex);
  2867. });
  2868. }
  2869. getPage(pageIndex) {
  2870. if (this._pagePromises[pageIndex] !== undefined) {
  2871. return this._pagePromises[pageIndex];
  2872. }
  2873. const {
  2874. catalog,
  2875. linearization
  2876. } = this;
  2877. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  2878. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  2879. return new Page({
  2880. pdfManager: this.pdfManager,
  2881. xref: this.xref,
  2882. pageIndex,
  2883. pageDict,
  2884. ref,
  2885. fontCache: catalog.fontCache,
  2886. builtInCMapCache: catalog.builtInCMapCache,
  2887. globalImageCache: catalog.globalImageCache,
  2888. pdfFunctionFactory: this.pdfFunctionFactory
  2889. });
  2890. });
  2891. }
  2892. checkFirstPage() {
  2893. return this.getPage(0).catch(async reason => {
  2894. if (reason instanceof _core_utils.XRefEntryException) {
  2895. this._pagePromises.length = 0;
  2896. await this.cleanup();
  2897. throw new _core_utils.XRefParseException();
  2898. }
  2899. });
  2900. }
  2901. fontFallback(id, handler) {
  2902. return this.catalog.fontFallback(id, handler);
  2903. }
  2904. async cleanup(manuallyTriggered = false) {
  2905. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  2906. }
  2907. }
  2908. exports.PDFDocument = PDFDocument;
  2909. /***/ }),
  2910. /* 10 */
  2911. /***/ (function(module, exports, __w_pdfjs_require__) {
  2912. "use strict";
  2913. Object.defineProperty(exports, "__esModule", {
  2914. value: true
  2915. });
  2916. exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0;
  2917. var _util = __w_pdfjs_require__(2);
  2918. var _primitives = __w_pdfjs_require__(5);
  2919. var _parser = __w_pdfjs_require__(11);
  2920. var _core_utils = __w_pdfjs_require__(8);
  2921. var _crypto = __w_pdfjs_require__(22);
  2922. var _colorspace = __w_pdfjs_require__(23);
  2923. var _image_utils = __w_pdfjs_require__(24);
  2924. function fetchDestination(dest) {
  2925. return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
  2926. }
  2927. class Catalog {
  2928. constructor(pdfManager, xref) {
  2929. this.pdfManager = pdfManager;
  2930. this.xref = xref;
  2931. this.catDict = xref.getCatalogObj();
  2932. if (!(0, _primitives.isDict)(this.catDict)) {
  2933. throw new _util.FormatError("Catalog object is not a dictionary.");
  2934. }
  2935. this.fontCache = new _primitives.RefSetCache();
  2936. this.builtInCMapCache = new Map();
  2937. this.globalImageCache = new _image_utils.GlobalImageCache();
  2938. this.pageKidsCountCache = new _primitives.RefSetCache();
  2939. }
  2940. get metadata() {
  2941. const streamRef = this.catDict.getRaw("Metadata");
  2942. if (!(0, _primitives.isRef)(streamRef)) {
  2943. return (0, _util.shadow)(this, "metadata", null);
  2944. }
  2945. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  2946. const stream = this.xref.fetch(streamRef, suppressEncryption);
  2947. let metadata;
  2948. if (stream && (0, _primitives.isDict)(stream.dict)) {
  2949. const type = stream.dict.get("Type");
  2950. const subtype = stream.dict.get("Subtype");
  2951. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  2952. try {
  2953. metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
  2954. } catch (e) {
  2955. if (e instanceof _core_utils.MissingDataException) {
  2956. throw e;
  2957. }
  2958. (0, _util.info)("Skipping invalid metadata.");
  2959. }
  2960. }
  2961. }
  2962. return (0, _util.shadow)(this, "metadata", metadata);
  2963. }
  2964. get toplevelPagesDict() {
  2965. const pagesObj = this.catDict.get("Pages");
  2966. if (!(0, _primitives.isDict)(pagesObj)) {
  2967. throw new _util.FormatError("Invalid top-level pages dictionary.");
  2968. }
  2969. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  2970. }
  2971. get documentOutline() {
  2972. let obj = null;
  2973. try {
  2974. obj = this._readDocumentOutline();
  2975. } catch (ex) {
  2976. if (ex instanceof _core_utils.MissingDataException) {
  2977. throw ex;
  2978. }
  2979. (0, _util.warn)("Unable to read document outline.");
  2980. }
  2981. return (0, _util.shadow)(this, "documentOutline", obj);
  2982. }
  2983. _readDocumentOutline() {
  2984. let obj = this.catDict.get("Outlines");
  2985. if (!(0, _primitives.isDict)(obj)) {
  2986. return null;
  2987. }
  2988. obj = obj.getRaw("First");
  2989. if (!(0, _primitives.isRef)(obj)) {
  2990. return null;
  2991. }
  2992. const root = {
  2993. items: []
  2994. };
  2995. const queue = [{
  2996. obj,
  2997. parent: root
  2998. }];
  2999. const processed = new _primitives.RefSet();
  3000. processed.put(obj);
  3001. const xref = this.xref,
  3002. blackColor = new Uint8ClampedArray(3);
  3003. while (queue.length > 0) {
  3004. const i = queue.shift();
  3005. const outlineDict = xref.fetchIfRef(i.obj);
  3006. if (outlineDict === null) {
  3007. continue;
  3008. }
  3009. if (!outlineDict.has("Title")) {
  3010. throw new _util.FormatError("Invalid outline item encountered.");
  3011. }
  3012. const data = {
  3013. url: null,
  3014. dest: null
  3015. };
  3016. Catalog.parseDestDictionary({
  3017. destDict: outlineDict,
  3018. resultObj: data,
  3019. docBaseUrl: this.pdfManager.docBaseUrl
  3020. });
  3021. const title = outlineDict.get("Title");
  3022. const flags = outlineDict.get("F") || 0;
  3023. const color = outlineDict.getArray("C");
  3024. const count = outlineDict.get("Count");
  3025. let rgbColor = blackColor;
  3026. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  3027. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  3028. }
  3029. const outlineItem = {
  3030. dest: data.dest,
  3031. url: data.url,
  3032. unsafeUrl: data.unsafeUrl,
  3033. newWindow: data.newWindow,
  3034. title: (0, _util.stringToPDFString)(title),
  3035. color: rgbColor,
  3036. count: Number.isInteger(count) ? count : undefined,
  3037. bold: !!(flags & 2),
  3038. italic: !!(flags & 1),
  3039. items: []
  3040. };
  3041. i.parent.items.push(outlineItem);
  3042. obj = outlineDict.getRaw("First");
  3043. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3044. queue.push({
  3045. obj,
  3046. parent: outlineItem
  3047. });
  3048. processed.put(obj);
  3049. }
  3050. obj = outlineDict.getRaw("Next");
  3051. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3052. queue.push({
  3053. obj,
  3054. parent: i.parent
  3055. });
  3056. processed.put(obj);
  3057. }
  3058. }
  3059. return root.items.length > 0 ? root.items : null;
  3060. }
  3061. get permissions() {
  3062. let permissions = null;
  3063. try {
  3064. permissions = this._readPermissions();
  3065. } catch (ex) {
  3066. if (ex instanceof _core_utils.MissingDataException) {
  3067. throw ex;
  3068. }
  3069. (0, _util.warn)("Unable to read permissions.");
  3070. }
  3071. return (0, _util.shadow)(this, "permissions", permissions);
  3072. }
  3073. _readPermissions() {
  3074. const encrypt = this.xref.trailer.get("Encrypt");
  3075. if (!(0, _primitives.isDict)(encrypt)) {
  3076. return null;
  3077. }
  3078. let flags = encrypt.get("P");
  3079. if (!(0, _util.isNum)(flags)) {
  3080. return null;
  3081. }
  3082. flags += 2 ** 32;
  3083. const permissions = [];
  3084. for (const key in _util.PermissionFlag) {
  3085. const value = _util.PermissionFlag[key];
  3086. if (flags & value) {
  3087. permissions.push(value);
  3088. }
  3089. }
  3090. return permissions;
  3091. }
  3092. get numPages() {
  3093. const obj = this.toplevelPagesDict.get("Count");
  3094. if (!Number.isInteger(obj)) {
  3095. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  3096. }
  3097. return (0, _util.shadow)(this, "numPages", obj);
  3098. }
  3099. get destinations() {
  3100. const obj = this._readDests(),
  3101. dests = Object.create(null);
  3102. if (obj instanceof NameTree) {
  3103. const names = obj.getAll();
  3104. for (const name in names) {
  3105. dests[name] = fetchDestination(names[name]);
  3106. }
  3107. } else if (obj instanceof _primitives.Dict) {
  3108. obj.forEach(function (key, value) {
  3109. if (value) {
  3110. dests[key] = fetchDestination(value);
  3111. }
  3112. });
  3113. }
  3114. return (0, _util.shadow)(this, "destinations", dests);
  3115. }
  3116. getDestination(destinationId) {
  3117. const obj = this._readDests();
  3118. if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
  3119. return fetchDestination(obj.get(destinationId) || null);
  3120. }
  3121. return null;
  3122. }
  3123. _readDests() {
  3124. const obj = this.catDict.get("Names");
  3125. if (obj && obj.has("Dests")) {
  3126. return new NameTree(obj.getRaw("Dests"), this.xref);
  3127. } else if (this.catDict.has("Dests")) {
  3128. return this.catDict.get("Dests");
  3129. }
  3130. return undefined;
  3131. }
  3132. get pageLabels() {
  3133. let obj = null;
  3134. try {
  3135. obj = this._readPageLabels();
  3136. } catch (ex) {
  3137. if (ex instanceof _core_utils.MissingDataException) {
  3138. throw ex;
  3139. }
  3140. (0, _util.warn)("Unable to read page labels.");
  3141. }
  3142. return (0, _util.shadow)(this, "pageLabels", obj);
  3143. }
  3144. _readPageLabels() {
  3145. const obj = this.catDict.getRaw("PageLabels");
  3146. if (!obj) {
  3147. return null;
  3148. }
  3149. const pageLabels = new Array(this.numPages);
  3150. let style = null,
  3151. prefix = "";
  3152. const numberTree = new NumberTree(obj, this.xref);
  3153. const nums = numberTree.getAll();
  3154. let currentLabel = "",
  3155. currentIndex = 1;
  3156. for (let i = 0, ii = this.numPages; i < ii; i++) {
  3157. if (i in nums) {
  3158. const labelDict = nums[i];
  3159. if (!(0, _primitives.isDict)(labelDict)) {
  3160. throw new _util.FormatError("PageLabel is not a dictionary.");
  3161. }
  3162. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  3163. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  3164. }
  3165. if (labelDict.has("S")) {
  3166. const s = labelDict.get("S");
  3167. if (!(0, _primitives.isName)(s)) {
  3168. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  3169. }
  3170. style = s.name;
  3171. } else {
  3172. style = null;
  3173. }
  3174. if (labelDict.has("P")) {
  3175. const p = labelDict.get("P");
  3176. if (!(0, _util.isString)(p)) {
  3177. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  3178. }
  3179. prefix = (0, _util.stringToPDFString)(p);
  3180. } else {
  3181. prefix = "";
  3182. }
  3183. if (labelDict.has("St")) {
  3184. const st = labelDict.get("St");
  3185. if (!(Number.isInteger(st) && st >= 1)) {
  3186. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  3187. }
  3188. currentIndex = st;
  3189. } else {
  3190. currentIndex = 1;
  3191. }
  3192. }
  3193. switch (style) {
  3194. case "D":
  3195. currentLabel = currentIndex;
  3196. break;
  3197. case "R":
  3198. case "r":
  3199. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  3200. break;
  3201. case "A":
  3202. case "a":
  3203. const LIMIT = 26;
  3204. const A_UPPER_CASE = 0x41,
  3205. A_LOWER_CASE = 0x61;
  3206. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  3207. const letterIndex = currentIndex - 1;
  3208. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  3209. const charBuf = [];
  3210. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  3211. charBuf.push(character);
  3212. }
  3213. currentLabel = charBuf.join("");
  3214. break;
  3215. default:
  3216. if (style) {
  3217. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  3218. }
  3219. currentLabel = "";
  3220. }
  3221. pageLabels[i] = prefix + currentLabel;
  3222. currentIndex++;
  3223. }
  3224. return pageLabels;
  3225. }
  3226. get pageLayout() {
  3227. const obj = this.catDict.get("PageLayout");
  3228. let pageLayout = "";
  3229. if ((0, _primitives.isName)(obj)) {
  3230. switch (obj.name) {
  3231. case "SinglePage":
  3232. case "OneColumn":
  3233. case "TwoColumnLeft":
  3234. case "TwoColumnRight":
  3235. case "TwoPageLeft":
  3236. case "TwoPageRight":
  3237. pageLayout = obj.name;
  3238. }
  3239. }
  3240. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  3241. }
  3242. get pageMode() {
  3243. const obj = this.catDict.get("PageMode");
  3244. let pageMode = "UseNone";
  3245. if ((0, _primitives.isName)(obj)) {
  3246. switch (obj.name) {
  3247. case "UseNone":
  3248. case "UseOutlines":
  3249. case "UseThumbs":
  3250. case "FullScreen":
  3251. case "UseOC":
  3252. case "UseAttachments":
  3253. pageMode = obj.name;
  3254. }
  3255. }
  3256. return (0, _util.shadow)(this, "pageMode", pageMode);
  3257. }
  3258. get viewerPreferences() {
  3259. const ViewerPreferencesValidators = {
  3260. HideToolbar: _util.isBool,
  3261. HideMenubar: _util.isBool,
  3262. HideWindowUI: _util.isBool,
  3263. FitWindow: _util.isBool,
  3264. CenterWindow: _util.isBool,
  3265. DisplayDocTitle: _util.isBool,
  3266. NonFullScreenPageMode: _primitives.isName,
  3267. Direction: _primitives.isName,
  3268. ViewArea: _primitives.isName,
  3269. ViewClip: _primitives.isName,
  3270. PrintArea: _primitives.isName,
  3271. PrintClip: _primitives.isName,
  3272. PrintScaling: _primitives.isName,
  3273. Duplex: _primitives.isName,
  3274. PickTrayByPDFSize: _util.isBool,
  3275. PrintPageRange: Array.isArray,
  3276. NumCopies: Number.isInteger
  3277. };
  3278. const obj = this.catDict.get("ViewerPreferences");
  3279. let prefs = null;
  3280. if ((0, _primitives.isDict)(obj)) {
  3281. for (const key in ViewerPreferencesValidators) {
  3282. if (!obj.has(key)) {
  3283. continue;
  3284. }
  3285. const value = obj.get(key);
  3286. if (!ViewerPreferencesValidators[key](value)) {
  3287. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3288. continue;
  3289. }
  3290. let prefValue;
  3291. switch (key) {
  3292. case "NonFullScreenPageMode":
  3293. switch (value.name) {
  3294. case "UseNone":
  3295. case "UseOutlines":
  3296. case "UseThumbs":
  3297. case "UseOC":
  3298. prefValue = value.name;
  3299. break;
  3300. default:
  3301. prefValue = "UseNone";
  3302. }
  3303. break;
  3304. case "Direction":
  3305. switch (value.name) {
  3306. case "L2R":
  3307. case "R2L":
  3308. prefValue = value.name;
  3309. break;
  3310. default:
  3311. prefValue = "L2R";
  3312. }
  3313. break;
  3314. case "ViewArea":
  3315. case "ViewClip":
  3316. case "PrintArea":
  3317. case "PrintClip":
  3318. switch (value.name) {
  3319. case "MediaBox":
  3320. case "CropBox":
  3321. case "BleedBox":
  3322. case "TrimBox":
  3323. case "ArtBox":
  3324. prefValue = value.name;
  3325. break;
  3326. default:
  3327. prefValue = "CropBox";
  3328. }
  3329. break;
  3330. case "PrintScaling":
  3331. switch (value.name) {
  3332. case "None":
  3333. case "AppDefault":
  3334. prefValue = value.name;
  3335. break;
  3336. default:
  3337. prefValue = "AppDefault";
  3338. }
  3339. break;
  3340. case "Duplex":
  3341. switch (value.name) {
  3342. case "Simplex":
  3343. case "DuplexFlipShortEdge":
  3344. case "DuplexFlipLongEdge":
  3345. prefValue = value.name;
  3346. break;
  3347. default:
  3348. prefValue = "None";
  3349. }
  3350. break;
  3351. case "PrintPageRange":
  3352. const length = value.length;
  3353. if (length % 2 !== 0) {
  3354. break;
  3355. }
  3356. const isValid = value.every((page, i, arr) => {
  3357. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  3358. });
  3359. if (isValid) {
  3360. prefValue = value;
  3361. }
  3362. break;
  3363. case "NumCopies":
  3364. if (value > 0) {
  3365. prefValue = value;
  3366. }
  3367. break;
  3368. default:
  3369. if (typeof value !== "boolean") {
  3370. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  3371. }
  3372. prefValue = value;
  3373. }
  3374. if (prefValue !== undefined) {
  3375. if (!prefs) {
  3376. prefs = Object.create(null);
  3377. }
  3378. prefs[key] = prefValue;
  3379. } else {
  3380. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3381. }
  3382. }
  3383. }
  3384. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  3385. }
  3386. get openAction() {
  3387. const obj = this.catDict.get("OpenAction");
  3388. let openAction = null;
  3389. if ((0, _primitives.isDict)(obj)) {
  3390. const destDict = new _primitives.Dict(this.xref);
  3391. destDict.set("A", obj);
  3392. const resultObj = {
  3393. url: null,
  3394. dest: null,
  3395. action: null
  3396. };
  3397. Catalog.parseDestDictionary({
  3398. destDict,
  3399. resultObj
  3400. });
  3401. if (Array.isArray(resultObj.dest)) {
  3402. if (!openAction) {
  3403. openAction = Object.create(null);
  3404. }
  3405. openAction.dest = resultObj.dest;
  3406. } else if (resultObj.action) {
  3407. if (!openAction) {
  3408. openAction = Object.create(null);
  3409. }
  3410. openAction.action = resultObj.action;
  3411. }
  3412. } else if (Array.isArray(obj)) {
  3413. if (!openAction) {
  3414. openAction = Object.create(null);
  3415. }
  3416. openAction.dest = obj;
  3417. }
  3418. return (0, _util.shadow)(this, "openAction", openAction);
  3419. }
  3420. get attachments() {
  3421. const obj = this.catDict.get("Names");
  3422. let attachments = null;
  3423. if (obj && obj.has("EmbeddedFiles")) {
  3424. const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  3425. const names = nameTree.getAll();
  3426. for (const name in names) {
  3427. const fs = new FileSpec(names[name], this.xref);
  3428. if (!attachments) {
  3429. attachments = Object.create(null);
  3430. }
  3431. attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
  3432. }
  3433. }
  3434. return (0, _util.shadow)(this, "attachments", attachments);
  3435. }
  3436. get javaScript() {
  3437. const obj = this.catDict.get("Names");
  3438. let javaScript = null;
  3439. function appendIfJavaScriptDict(jsDict) {
  3440. const type = jsDict.get("S");
  3441. if (!(0, _primitives.isName)(type, "JavaScript")) {
  3442. return;
  3443. }
  3444. let js = jsDict.get("JS");
  3445. if ((0, _primitives.isStream)(js)) {
  3446. js = (0, _util.bytesToString)(js.getBytes());
  3447. } else if (!(0, _util.isString)(js)) {
  3448. return;
  3449. }
  3450. if (!javaScript) {
  3451. javaScript = [];
  3452. }
  3453. javaScript.push((0, _util.stringToPDFString)(js));
  3454. }
  3455. if (obj && obj.has("JavaScript")) {
  3456. const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
  3457. const names = nameTree.getAll();
  3458. for (const name in names) {
  3459. const jsDict = names[name];
  3460. if ((0, _primitives.isDict)(jsDict)) {
  3461. appendIfJavaScriptDict(jsDict);
  3462. }
  3463. }
  3464. }
  3465. const openAction = this.catDict.get("OpenAction");
  3466. if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
  3467. appendIfJavaScriptDict(openAction);
  3468. }
  3469. return (0, _util.shadow)(this, "javaScript", javaScript);
  3470. }
  3471. fontFallback(id, handler) {
  3472. const promises = [];
  3473. this.fontCache.forEach(function (promise) {
  3474. promises.push(promise);
  3475. });
  3476. return Promise.all(promises).then(translatedFonts => {
  3477. for (const translatedFont of translatedFonts) {
  3478. if (translatedFont.loadedName === id) {
  3479. translatedFont.fallback(handler);
  3480. return;
  3481. }
  3482. }
  3483. });
  3484. }
  3485. cleanup(manuallyTriggered = false) {
  3486. (0, _primitives.clearPrimitiveCaches)();
  3487. this.globalImageCache.clear(manuallyTriggered);
  3488. this.pageKidsCountCache.clear();
  3489. const promises = [];
  3490. this.fontCache.forEach(function (promise) {
  3491. promises.push(promise);
  3492. });
  3493. return Promise.all(promises).then(translatedFonts => {
  3494. for (const {
  3495. dict
  3496. } of translatedFonts) {
  3497. delete dict.translated;
  3498. }
  3499. this.fontCache.clear();
  3500. this.builtInCMapCache.clear();
  3501. });
  3502. }
  3503. getPageDict(pageIndex) {
  3504. const capability = (0, _util.createPromiseCapability)();
  3505. const nodesToVisit = [this.catDict.getRaw("Pages")];
  3506. const visitedNodes = new _primitives.RefSet();
  3507. const xref = this.xref,
  3508. pageKidsCountCache = this.pageKidsCountCache;
  3509. let count,
  3510. currentPageIndex = 0;
  3511. function next() {
  3512. while (nodesToVisit.length) {
  3513. const currentNode = nodesToVisit.pop();
  3514. if ((0, _primitives.isRef)(currentNode)) {
  3515. count = pageKidsCountCache.get(currentNode);
  3516. if (count > 0 && currentPageIndex + count < pageIndex) {
  3517. currentPageIndex += count;
  3518. continue;
  3519. }
  3520. if (visitedNodes.has(currentNode)) {
  3521. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  3522. return;
  3523. }
  3524. visitedNodes.put(currentNode);
  3525. xref.fetchAsync(currentNode).then(function (obj) {
  3526. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  3527. if (pageIndex === currentPageIndex) {
  3528. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  3529. pageKidsCountCache.put(currentNode, 1);
  3530. }
  3531. capability.resolve([obj, currentNode]);
  3532. } else {
  3533. currentPageIndex++;
  3534. next();
  3535. }
  3536. return;
  3537. }
  3538. nodesToVisit.push(obj);
  3539. next();
  3540. }, capability.reject);
  3541. return;
  3542. }
  3543. if (!(0, _primitives.isDict)(currentNode)) {
  3544. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  3545. return;
  3546. }
  3547. count = currentNode.get("Count");
  3548. if (Number.isInteger(count) && count >= 0) {
  3549. const objId = currentNode.objId;
  3550. if (objId && !pageKidsCountCache.has(objId)) {
  3551. pageKidsCountCache.put(objId, count);
  3552. }
  3553. if (currentPageIndex + count <= pageIndex) {
  3554. currentPageIndex += count;
  3555. continue;
  3556. }
  3557. }
  3558. const kids = currentNode.get("Kids");
  3559. if (!Array.isArray(kids)) {
  3560. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  3561. if (currentPageIndex === pageIndex) {
  3562. capability.resolve([currentNode, null]);
  3563. return;
  3564. }
  3565. currentPageIndex++;
  3566. continue;
  3567. }
  3568. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  3569. return;
  3570. }
  3571. for (let last = kids.length - 1; last >= 0; last--) {
  3572. nodesToVisit.push(kids[last]);
  3573. }
  3574. }
  3575. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  3576. }
  3577. next();
  3578. return capability.promise;
  3579. }
  3580. getPageIndex(pageRef) {
  3581. const xref = this.xref;
  3582. function pagesBeforeRef(kidRef) {
  3583. let total = 0,
  3584. parentRef;
  3585. return xref.fetchAsync(kidRef).then(function (node) {
  3586. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  3587. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  3588. }
  3589. if (!node) {
  3590. return null;
  3591. }
  3592. if (!(0, _primitives.isDict)(node)) {
  3593. throw new _util.FormatError("Node must be a dictionary.");
  3594. }
  3595. parentRef = node.getRaw("Parent");
  3596. return node.getAsync("Parent");
  3597. }).then(function (parent) {
  3598. if (!parent) {
  3599. return null;
  3600. }
  3601. if (!(0, _primitives.isDict)(parent)) {
  3602. throw new _util.FormatError("Parent must be a dictionary.");
  3603. }
  3604. return parent.getAsync("Kids");
  3605. }).then(function (kids) {
  3606. if (!kids) {
  3607. return null;
  3608. }
  3609. const kidPromises = [];
  3610. let found = false;
  3611. for (let i = 0, ii = kids.length; i < ii; i++) {
  3612. const kid = kids[i];
  3613. if (!(0, _primitives.isRef)(kid)) {
  3614. throw new _util.FormatError("Kid must be a reference.");
  3615. }
  3616. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  3617. found = true;
  3618. break;
  3619. }
  3620. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  3621. if (!(0, _primitives.isDict)(obj)) {
  3622. throw new _util.FormatError("Kid node must be a dictionary.");
  3623. }
  3624. if (obj.has("Count")) {
  3625. total += obj.get("Count");
  3626. } else {
  3627. total++;
  3628. }
  3629. }));
  3630. }
  3631. if (!found) {
  3632. throw new _util.FormatError("Kid reference not found in parent's kids.");
  3633. }
  3634. return Promise.all(kidPromises).then(function () {
  3635. return [total, parentRef];
  3636. });
  3637. });
  3638. }
  3639. let total = 0;
  3640. function next(ref) {
  3641. return pagesBeforeRef(ref).then(function (args) {
  3642. if (!args) {
  3643. return total;
  3644. }
  3645. const [count, parentRef] = args;
  3646. total += count;
  3647. return next(parentRef);
  3648. });
  3649. }
  3650. return next(pageRef);
  3651. }
  3652. static parseDestDictionary(params) {
  3653. function addDefaultProtocolToUrl(url) {
  3654. return url.startsWith("www.") ? `http://${url}` : url;
  3655. }
  3656. function tryConvertUrlEncoding(url) {
  3657. try {
  3658. return (0, _util.stringToUTF8String)(url);
  3659. } catch (e) {
  3660. return url;
  3661. }
  3662. }
  3663. const destDict = params.destDict;
  3664. if (!(0, _primitives.isDict)(destDict)) {
  3665. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  3666. return;
  3667. }
  3668. const resultObj = params.resultObj;
  3669. if (typeof resultObj !== "object") {
  3670. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  3671. return;
  3672. }
  3673. const docBaseUrl = params.docBaseUrl || null;
  3674. let action = destDict.get("A"),
  3675. url,
  3676. dest;
  3677. if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) {
  3678. action = destDict.get("Dest");
  3679. }
  3680. if ((0, _primitives.isDict)(action)) {
  3681. const actionType = action.get("S");
  3682. if (!(0, _primitives.isName)(actionType)) {
  3683. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  3684. return;
  3685. }
  3686. const actionName = actionType.name;
  3687. switch (actionName) {
  3688. case "URI":
  3689. url = action.get("URI");
  3690. if ((0, _primitives.isName)(url)) {
  3691. url = "/" + url.name;
  3692. } else if ((0, _util.isString)(url)) {
  3693. url = addDefaultProtocolToUrl(url);
  3694. }
  3695. break;
  3696. case "GoTo":
  3697. dest = action.get("D");
  3698. break;
  3699. case "Launch":
  3700. case "GoToR":
  3701. const urlDict = action.get("F");
  3702. if ((0, _primitives.isDict)(urlDict)) {
  3703. url = urlDict.get("F") || null;
  3704. } else if ((0, _util.isString)(urlDict)) {
  3705. url = urlDict;
  3706. }
  3707. let remoteDest = action.get("D");
  3708. if (remoteDest) {
  3709. if ((0, _primitives.isName)(remoteDest)) {
  3710. remoteDest = remoteDest.name;
  3711. }
  3712. if ((0, _util.isString)(url)) {
  3713. const baseUrl = url.split("#")[0];
  3714. if ((0, _util.isString)(remoteDest)) {
  3715. url = baseUrl + "#" + remoteDest;
  3716. } else if (Array.isArray(remoteDest)) {
  3717. url = baseUrl + "#" + JSON.stringify(remoteDest);
  3718. }
  3719. }
  3720. }
  3721. const newWindow = action.get("NewWindow");
  3722. if ((0, _util.isBool)(newWindow)) {
  3723. resultObj.newWindow = newWindow;
  3724. }
  3725. break;
  3726. case "Named":
  3727. const namedAction = action.get("N");
  3728. if ((0, _primitives.isName)(namedAction)) {
  3729. resultObj.action = namedAction.name;
  3730. }
  3731. break;
  3732. case "JavaScript":
  3733. const jsAction = action.get("JS");
  3734. let js;
  3735. if ((0, _primitives.isStream)(jsAction)) {
  3736. js = (0, _util.bytesToString)(jsAction.getBytes());
  3737. } else if ((0, _util.isString)(jsAction)) {
  3738. js = jsAction;
  3739. }
  3740. if (js) {
  3741. const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
  3742. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  3743. const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  3744. if (jsUrl && jsUrl[2]) {
  3745. url = jsUrl[2];
  3746. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  3747. resultObj.newWindow = true;
  3748. }
  3749. break;
  3750. }
  3751. }
  3752. default:
  3753. (0, _util.warn)(`parseDestDictionary: unsupported action type "${actionName}".`);
  3754. break;
  3755. }
  3756. } else if (destDict.has("Dest")) {
  3757. dest = destDict.get("Dest");
  3758. }
  3759. if ((0, _util.isString)(url)) {
  3760. url = tryConvertUrlEncoding(url);
  3761. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  3762. if (absoluteUrl) {
  3763. resultObj.url = absoluteUrl.href;
  3764. }
  3765. resultObj.unsafeUrl = url;
  3766. }
  3767. if (dest) {
  3768. if ((0, _primitives.isName)(dest)) {
  3769. dest = dest.name;
  3770. }
  3771. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  3772. resultObj.dest = dest;
  3773. }
  3774. }
  3775. }
  3776. }
  3777. exports.Catalog = Catalog;
  3778. var XRef = function XRefClosure() {
  3779. function XRef(stream, pdfManager) {
  3780. this.stream = stream;
  3781. this.pdfManager = pdfManager;
  3782. this.entries = [];
  3783. this.xrefstms = Object.create(null);
  3784. this._cacheMap = new Map();
  3785. this.stats = {
  3786. streamTypes: Object.create(null),
  3787. fontTypes: Object.create(null)
  3788. };
  3789. }
  3790. XRef.prototype = {
  3791. setStartXRef: function XRef_setStartXRef(startXRef) {
  3792. this.startXRefQueue = [startXRef];
  3793. },
  3794. parse: function XRef_parse(recoveryMode) {
  3795. var trailerDict;
  3796. if (!recoveryMode) {
  3797. trailerDict = this.readXRef();
  3798. } else {
  3799. (0, _util.warn)("Indexing all PDF objects");
  3800. trailerDict = this.indexObjects();
  3801. }
  3802. trailerDict.assignXref(this);
  3803. this.trailer = trailerDict;
  3804. let encrypt;
  3805. try {
  3806. encrypt = trailerDict.get("Encrypt");
  3807. } catch (ex) {
  3808. if (ex instanceof _core_utils.MissingDataException) {
  3809. throw ex;
  3810. }
  3811. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  3812. }
  3813. if ((0, _primitives.isDict)(encrypt)) {
  3814. var ids = trailerDict.get("ID");
  3815. var fileId = ids && ids.length ? ids[0] : "";
  3816. encrypt.suppressEncryption = true;
  3817. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  3818. }
  3819. let root;
  3820. try {
  3821. root = trailerDict.get("Root");
  3822. } catch (ex) {
  3823. if (ex instanceof _core_utils.MissingDataException) {
  3824. throw ex;
  3825. }
  3826. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  3827. }
  3828. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  3829. this.root = root;
  3830. } else {
  3831. if (!recoveryMode) {
  3832. throw new _core_utils.XRefParseException();
  3833. }
  3834. throw new _util.FormatError("Invalid root reference");
  3835. }
  3836. },
  3837. processXRefTable: function XRef_processXRefTable(parser) {
  3838. if (!("tableState" in this)) {
  3839. this.tableState = {
  3840. entryNum: 0,
  3841. streamPos: parser.lexer.stream.pos,
  3842. parserBuf1: parser.buf1,
  3843. parserBuf2: parser.buf2
  3844. };
  3845. }
  3846. var obj = this.readXRefTable(parser);
  3847. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  3848. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  3849. }
  3850. var dict = parser.getObj();
  3851. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  3852. dict = dict.dict;
  3853. }
  3854. if (!(0, _primitives.isDict)(dict)) {
  3855. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  3856. }
  3857. delete this.tableState;
  3858. return dict;
  3859. },
  3860. readXRefTable: function XRef_readXRefTable(parser) {
  3861. var stream = parser.lexer.stream;
  3862. var tableState = this.tableState;
  3863. stream.pos = tableState.streamPos;
  3864. parser.buf1 = tableState.parserBuf1;
  3865. parser.buf2 = tableState.parserBuf2;
  3866. var obj;
  3867. while (true) {
  3868. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  3869. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  3870. break;
  3871. }
  3872. tableState.firstEntryNum = obj;
  3873. tableState.entryCount = parser.getObj();
  3874. }
  3875. var first = tableState.firstEntryNum;
  3876. var count = tableState.entryCount;
  3877. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  3878. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  3879. }
  3880. for (var i = tableState.entryNum; i < count; i++) {
  3881. tableState.streamPos = stream.pos;
  3882. tableState.entryNum = i;
  3883. tableState.parserBuf1 = parser.buf1;
  3884. tableState.parserBuf2 = parser.buf2;
  3885. var entry = {};
  3886. entry.offset = parser.getObj();
  3887. entry.gen = parser.getObj();
  3888. var type = parser.getObj();
  3889. if (type instanceof _primitives.Cmd) {
  3890. switch (type.cmd) {
  3891. case "f":
  3892. entry.free = true;
  3893. break;
  3894. case "n":
  3895. entry.uncompressed = true;
  3896. break;
  3897. }
  3898. }
  3899. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  3900. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  3901. }
  3902. if (i === 0 && entry.free && first === 1) {
  3903. first = 0;
  3904. }
  3905. if (!this.entries[i + first]) {
  3906. this.entries[i + first] = entry;
  3907. }
  3908. }
  3909. tableState.entryNum = 0;
  3910. tableState.streamPos = stream.pos;
  3911. tableState.parserBuf1 = parser.buf1;
  3912. tableState.parserBuf2 = parser.buf2;
  3913. delete tableState.firstEntryNum;
  3914. delete tableState.entryCount;
  3915. }
  3916. if (this.entries[0] && !this.entries[0].free) {
  3917. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  3918. }
  3919. return obj;
  3920. },
  3921. processXRefStream: function XRef_processXRefStream(stream) {
  3922. if (!("streamState" in this)) {
  3923. var streamParameters = stream.dict;
  3924. var byteWidths = streamParameters.get("W");
  3925. var range = streamParameters.get("Index");
  3926. if (!range) {
  3927. range = [0, streamParameters.get("Size")];
  3928. }
  3929. this.streamState = {
  3930. entryRanges: range,
  3931. byteWidths,
  3932. entryNum: 0,
  3933. streamPos: stream.pos
  3934. };
  3935. }
  3936. this.readXRefStream(stream);
  3937. delete this.streamState;
  3938. return stream.dict;
  3939. },
  3940. readXRefStream: function XRef_readXRefStream(stream) {
  3941. var i, j;
  3942. var streamState = this.streamState;
  3943. stream.pos = streamState.streamPos;
  3944. var byteWidths = streamState.byteWidths;
  3945. var typeFieldWidth = byteWidths[0];
  3946. var offsetFieldWidth = byteWidths[1];
  3947. var generationFieldWidth = byteWidths[2];
  3948. var entryRanges = streamState.entryRanges;
  3949. while (entryRanges.length > 0) {
  3950. var first = entryRanges[0];
  3951. var n = entryRanges[1];
  3952. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  3953. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  3954. }
  3955. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  3956. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  3957. }
  3958. for (i = streamState.entryNum; i < n; ++i) {
  3959. streamState.entryNum = i;
  3960. streamState.streamPos = stream.pos;
  3961. var type = 0,
  3962. offset = 0,
  3963. generation = 0;
  3964. for (j = 0; j < typeFieldWidth; ++j) {
  3965. type = type << 8 | stream.getByte();
  3966. }
  3967. if (typeFieldWidth === 0) {
  3968. type = 1;
  3969. }
  3970. for (j = 0; j < offsetFieldWidth; ++j) {
  3971. offset = offset << 8 | stream.getByte();
  3972. }
  3973. for (j = 0; j < generationFieldWidth; ++j) {
  3974. generation = generation << 8 | stream.getByte();
  3975. }
  3976. var entry = {};
  3977. entry.offset = offset;
  3978. entry.gen = generation;
  3979. switch (type) {
  3980. case 0:
  3981. entry.free = true;
  3982. break;
  3983. case 1:
  3984. entry.uncompressed = true;
  3985. break;
  3986. case 2:
  3987. break;
  3988. default:
  3989. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  3990. }
  3991. if (!this.entries[first + i]) {
  3992. this.entries[first + i] = entry;
  3993. }
  3994. }
  3995. streamState.entryNum = 0;
  3996. streamState.streamPos = stream.pos;
  3997. entryRanges.splice(0, 2);
  3998. }
  3999. },
  4000. indexObjects: function XRef_indexObjects() {
  4001. var TAB = 0x9,
  4002. LF = 0xa,
  4003. CR = 0xd,
  4004. SPACE = 0x20;
  4005. var PERCENT = 0x25,
  4006. LT = 0x3c;
  4007. function readToken(data, offset) {
  4008. var token = "",
  4009. ch = data[offset];
  4010. while (ch !== LF && ch !== CR && ch !== LT) {
  4011. if (++offset >= data.length) {
  4012. break;
  4013. }
  4014. token += String.fromCharCode(ch);
  4015. ch = data[offset];
  4016. }
  4017. return token;
  4018. }
  4019. function skipUntil(data, offset, what) {
  4020. var length = what.length,
  4021. dataLength = data.length;
  4022. var skipped = 0;
  4023. while (offset < dataLength) {
  4024. var i = 0;
  4025. while (i < length && data[offset + i] === what[i]) {
  4026. ++i;
  4027. }
  4028. if (i >= length) {
  4029. break;
  4030. }
  4031. offset++;
  4032. skipped++;
  4033. }
  4034. return skipped;
  4035. }
  4036. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  4037. const endobjRegExp = /\bendobj[\b\s]$/;
  4038. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  4039. const CHECK_CONTENT_LENGTH = 25;
  4040. var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  4041. var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  4042. const objBytes = new Uint8Array([111, 98, 106]);
  4043. var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  4044. this.entries.length = 0;
  4045. var stream = this.stream;
  4046. stream.pos = 0;
  4047. var buffer = stream.getBytes();
  4048. var position = stream.start,
  4049. length = buffer.length;
  4050. var trailers = [],
  4051. xrefStms = [];
  4052. while (position < length) {
  4053. var ch = buffer[position];
  4054. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  4055. ++position;
  4056. continue;
  4057. }
  4058. if (ch === PERCENT) {
  4059. do {
  4060. ++position;
  4061. if (position >= length) {
  4062. break;
  4063. }
  4064. ch = buffer[position];
  4065. } while (ch !== LF && ch !== CR);
  4066. continue;
  4067. }
  4068. var token = readToken(buffer, position);
  4069. var m;
  4070. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  4071. position += skipUntil(buffer, position, trailerBytes);
  4072. trailers.push(position);
  4073. position += skipUntil(buffer, position, startxrefBytes);
  4074. } else if (m = objRegExp.exec(token)) {
  4075. const num = m[1] | 0,
  4076. gen = m[2] | 0;
  4077. if (!this.entries[num] || this.entries[num].gen === gen) {
  4078. this.entries[num] = {
  4079. offset: position - stream.start,
  4080. gen,
  4081. uncompressed: true
  4082. };
  4083. }
  4084. let contentLength,
  4085. startPos = position + token.length;
  4086. while (startPos < buffer.length) {
  4087. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  4088. contentLength = endPos - position;
  4089. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  4090. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  4091. if (endobjRegExp.test(tokenStr)) {
  4092. break;
  4093. } else {
  4094. const objToken = nestedObjRegExp.exec(tokenStr);
  4095. if (objToken && objToken[1]) {
  4096. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  4097. contentLength -= objToken[1].length;
  4098. break;
  4099. }
  4100. }
  4101. startPos = endPos;
  4102. }
  4103. const content = buffer.subarray(position, position + contentLength);
  4104. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  4105. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  4106. xrefStms.push(position - stream.start);
  4107. this.xrefstms[position - stream.start] = 1;
  4108. }
  4109. position += contentLength;
  4110. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  4111. trailers.push(position);
  4112. position += skipUntil(buffer, position, startxrefBytes);
  4113. } else {
  4114. position += token.length + 1;
  4115. }
  4116. }
  4117. var i, ii;
  4118. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  4119. this.startXRefQueue.push(xrefStms[i]);
  4120. this.readXRef(true);
  4121. }
  4122. let trailerDict;
  4123. for (i = 0, ii = trailers.length; i < ii; ++i) {
  4124. stream.pos = trailers[i];
  4125. const parser = new _parser.Parser({
  4126. lexer: new _parser.Lexer(stream),
  4127. xref: this,
  4128. allowStreams: true,
  4129. recoveryMode: true
  4130. });
  4131. var obj = parser.getObj();
  4132. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  4133. continue;
  4134. }
  4135. const dict = parser.getObj();
  4136. if (!(0, _primitives.isDict)(dict)) {
  4137. continue;
  4138. }
  4139. let rootDict;
  4140. try {
  4141. rootDict = dict.get("Root");
  4142. } catch (ex) {
  4143. if (ex instanceof _core_utils.MissingDataException) {
  4144. throw ex;
  4145. }
  4146. continue;
  4147. }
  4148. if (!(0, _primitives.isDict)(rootDict) || !rootDict.has("Pages")) {
  4149. continue;
  4150. }
  4151. if (dict.has("ID")) {
  4152. return dict;
  4153. }
  4154. trailerDict = dict;
  4155. }
  4156. if (trailerDict) {
  4157. return trailerDict;
  4158. }
  4159. throw new _util.InvalidPDFException("Invalid PDF structure.");
  4160. },
  4161. readXRef: function XRef_readXRef(recoveryMode) {
  4162. var stream = this.stream;
  4163. const startXRefParsedCache = Object.create(null);
  4164. try {
  4165. while (this.startXRefQueue.length) {
  4166. var startXRef = this.startXRefQueue[0];
  4167. if (startXRefParsedCache[startXRef]) {
  4168. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  4169. this.startXRefQueue.shift();
  4170. continue;
  4171. }
  4172. startXRefParsedCache[startXRef] = true;
  4173. stream.pos = startXRef + stream.start;
  4174. const parser = new _parser.Parser({
  4175. lexer: new _parser.Lexer(stream),
  4176. xref: this,
  4177. allowStreams: true
  4178. });
  4179. var obj = parser.getObj();
  4180. var dict;
  4181. if ((0, _primitives.isCmd)(obj, "xref")) {
  4182. dict = this.processXRefTable(parser);
  4183. if (!this.topDict) {
  4184. this.topDict = dict;
  4185. }
  4186. obj = dict.get("XRefStm");
  4187. if (Number.isInteger(obj)) {
  4188. var pos = obj;
  4189. if (!(pos in this.xrefstms)) {
  4190. this.xrefstms[pos] = 1;
  4191. this.startXRefQueue.push(pos);
  4192. }
  4193. }
  4194. } else if (Number.isInteger(obj)) {
  4195. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  4196. throw new _util.FormatError("Invalid XRef stream");
  4197. }
  4198. dict = this.processXRefStream(obj);
  4199. if (!this.topDict) {
  4200. this.topDict = dict;
  4201. }
  4202. if (!dict) {
  4203. throw new _util.FormatError("Failed to read XRef stream");
  4204. }
  4205. } else {
  4206. throw new _util.FormatError("Invalid XRef stream header");
  4207. }
  4208. obj = dict.get("Prev");
  4209. if (Number.isInteger(obj)) {
  4210. this.startXRefQueue.push(obj);
  4211. } else if ((0, _primitives.isRef)(obj)) {
  4212. this.startXRefQueue.push(obj.num);
  4213. }
  4214. this.startXRefQueue.shift();
  4215. }
  4216. return this.topDict;
  4217. } catch (e) {
  4218. if (e instanceof _core_utils.MissingDataException) {
  4219. throw e;
  4220. }
  4221. (0, _util.info)("(while reading XRef): " + e);
  4222. }
  4223. if (recoveryMode) {
  4224. return undefined;
  4225. }
  4226. throw new _core_utils.XRefParseException();
  4227. },
  4228. getEntry: function XRef_getEntry(i) {
  4229. var xrefEntry = this.entries[i];
  4230. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  4231. return xrefEntry;
  4232. }
  4233. return null;
  4234. },
  4235. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  4236. if (obj instanceof _primitives.Ref) {
  4237. return this.fetch(obj, suppressEncryption);
  4238. }
  4239. return obj;
  4240. },
  4241. fetch: function XRef_fetch(ref, suppressEncryption) {
  4242. if (!(ref instanceof _primitives.Ref)) {
  4243. throw new Error("ref object is not a reference");
  4244. }
  4245. const num = ref.num;
  4246. const cacheEntry = this._cacheMap.get(num);
  4247. if (cacheEntry !== undefined) {
  4248. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  4249. cacheEntry.objId = ref.toString();
  4250. }
  4251. return cacheEntry;
  4252. }
  4253. let xrefEntry = this.getEntry(num);
  4254. if (xrefEntry === null) {
  4255. this._cacheMap.set(num, xrefEntry);
  4256. return xrefEntry;
  4257. }
  4258. if (xrefEntry.uncompressed) {
  4259. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  4260. } else {
  4261. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  4262. }
  4263. if ((0, _primitives.isDict)(xrefEntry)) {
  4264. xrefEntry.objId = ref.toString();
  4265. } else if ((0, _primitives.isStream)(xrefEntry)) {
  4266. xrefEntry.dict.objId = ref.toString();
  4267. }
  4268. return xrefEntry;
  4269. },
  4270. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  4271. var gen = ref.gen;
  4272. var num = ref.num;
  4273. if (xrefEntry.gen !== gen) {
  4274. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  4275. }
  4276. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  4277. const parser = new _parser.Parser({
  4278. lexer: new _parser.Lexer(stream),
  4279. xref: this,
  4280. allowStreams: true
  4281. });
  4282. var obj1 = parser.getObj();
  4283. var obj2 = parser.getObj();
  4284. var obj3 = parser.getObj();
  4285. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  4286. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  4287. }
  4288. if (obj3.cmd !== "obj") {
  4289. if (obj3.cmd.startsWith("obj")) {
  4290. num = parseInt(obj3.cmd.substring(3), 10);
  4291. if (!Number.isNaN(num)) {
  4292. return num;
  4293. }
  4294. }
  4295. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  4296. }
  4297. if (this.encrypt && !suppressEncryption) {
  4298. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  4299. } else {
  4300. xrefEntry = parser.getObj();
  4301. }
  4302. if (!(0, _primitives.isStream)(xrefEntry)) {
  4303. this._cacheMap.set(num, xrefEntry);
  4304. }
  4305. return xrefEntry;
  4306. },
  4307. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  4308. const tableOffset = xrefEntry.offset;
  4309. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  4310. if (!(0, _primitives.isStream)(stream)) {
  4311. throw new _util.FormatError("bad ObjStm stream");
  4312. }
  4313. const first = stream.dict.get("First");
  4314. const n = stream.dict.get("N");
  4315. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  4316. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  4317. }
  4318. const parser = new _parser.Parser({
  4319. lexer: new _parser.Lexer(stream),
  4320. xref: this,
  4321. allowStreams: true
  4322. });
  4323. const nums = new Array(n);
  4324. for (let i = 0; i < n; ++i) {
  4325. const num = parser.getObj();
  4326. if (!Number.isInteger(num)) {
  4327. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  4328. }
  4329. const offset = parser.getObj();
  4330. if (!Number.isInteger(offset)) {
  4331. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  4332. }
  4333. nums[i] = num;
  4334. }
  4335. const entries = new Array(n);
  4336. for (let i = 0; i < n; ++i) {
  4337. const obj = parser.getObj();
  4338. entries[i] = obj;
  4339. if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === "endobj") {
  4340. parser.shift();
  4341. }
  4342. if ((0, _primitives.isStream)(obj)) {
  4343. continue;
  4344. }
  4345. const num = nums[i],
  4346. entry = this.entries[num];
  4347. if (entry && entry.offset === tableOffset && entry.gen === i) {
  4348. this._cacheMap.set(num, obj);
  4349. }
  4350. }
  4351. xrefEntry = entries[xrefEntry.gen];
  4352. if (xrefEntry === undefined) {
  4353. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  4354. }
  4355. return xrefEntry;
  4356. },
  4357. async fetchIfRefAsync(obj, suppressEncryption) {
  4358. if (obj instanceof _primitives.Ref) {
  4359. return this.fetchAsync(obj, suppressEncryption);
  4360. }
  4361. return obj;
  4362. },
  4363. async fetchAsync(ref, suppressEncryption) {
  4364. try {
  4365. return this.fetch(ref, suppressEncryption);
  4366. } catch (ex) {
  4367. if (!(ex instanceof _core_utils.MissingDataException)) {
  4368. throw ex;
  4369. }
  4370. await this.pdfManager.requestRange(ex.begin, ex.end);
  4371. return this.fetchAsync(ref, suppressEncryption);
  4372. }
  4373. },
  4374. getCatalogObj: function XRef_getCatalogObj() {
  4375. return this.root;
  4376. }
  4377. };
  4378. return XRef;
  4379. }();
  4380. exports.XRef = XRef;
  4381. class NameOrNumberTree {
  4382. constructor(root, xref, type) {
  4383. if (this.constructor === NameOrNumberTree) {
  4384. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  4385. }
  4386. this.root = root;
  4387. this.xref = xref;
  4388. this._type = type;
  4389. }
  4390. getAll() {
  4391. const dict = Object.create(null);
  4392. if (!this.root) {
  4393. return dict;
  4394. }
  4395. const xref = this.xref;
  4396. const processed = new _primitives.RefSet();
  4397. processed.put(this.root);
  4398. const queue = [this.root];
  4399. while (queue.length > 0) {
  4400. const obj = xref.fetchIfRef(queue.shift());
  4401. if (!(0, _primitives.isDict)(obj)) {
  4402. continue;
  4403. }
  4404. if (obj.has("Kids")) {
  4405. const kids = obj.get("Kids");
  4406. for (let i = 0, ii = kids.length; i < ii; i++) {
  4407. const kid = kids[i];
  4408. if (processed.has(kid)) {
  4409. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  4410. }
  4411. queue.push(kid);
  4412. processed.put(kid);
  4413. }
  4414. continue;
  4415. }
  4416. const entries = obj.get(this._type);
  4417. if (Array.isArray(entries)) {
  4418. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  4419. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  4420. }
  4421. }
  4422. }
  4423. return dict;
  4424. }
  4425. get(key) {
  4426. if (!this.root) {
  4427. return null;
  4428. }
  4429. const xref = this.xref;
  4430. let kidsOrEntries = xref.fetchIfRef(this.root);
  4431. let loopCount = 0;
  4432. const MAX_LEVELS = 10;
  4433. while (kidsOrEntries.has("Kids")) {
  4434. if (++loopCount > MAX_LEVELS) {
  4435. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  4436. return null;
  4437. }
  4438. const kids = kidsOrEntries.get("Kids");
  4439. if (!Array.isArray(kids)) {
  4440. return null;
  4441. }
  4442. let l = 0,
  4443. r = kids.length - 1;
  4444. while (l <= r) {
  4445. const m = l + r >> 1;
  4446. const kid = xref.fetchIfRef(kids[m]);
  4447. const limits = kid.get("Limits");
  4448. if (key < xref.fetchIfRef(limits[0])) {
  4449. r = m - 1;
  4450. } else if (key > xref.fetchIfRef(limits[1])) {
  4451. l = m + 1;
  4452. } else {
  4453. kidsOrEntries = xref.fetchIfRef(kids[m]);
  4454. break;
  4455. }
  4456. }
  4457. if (l > r) {
  4458. return null;
  4459. }
  4460. }
  4461. const entries = kidsOrEntries.get(this._type);
  4462. if (Array.isArray(entries)) {
  4463. let l = 0,
  4464. r = entries.length - 2;
  4465. while (l <= r) {
  4466. const tmp = l + r >> 1,
  4467. m = tmp + (tmp & 1);
  4468. const currentKey = xref.fetchIfRef(entries[m]);
  4469. if (key < currentKey) {
  4470. r = m - 2;
  4471. } else if (key > currentKey) {
  4472. l = m + 2;
  4473. } else {
  4474. return xref.fetchIfRef(entries[m + 1]);
  4475. }
  4476. }
  4477. (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`);
  4478. for (let m = 0, mm = entries.length; m < mm; m += 2) {
  4479. const currentKey = xref.fetchIfRef(entries[m]);
  4480. if (currentKey === key) {
  4481. (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`);
  4482. return xref.fetchIfRef(entries[m + 1]);
  4483. }
  4484. }
  4485. }
  4486. return null;
  4487. }
  4488. }
  4489. class NameTree extends NameOrNumberTree {
  4490. constructor(root, xref) {
  4491. super(root, xref, "Names");
  4492. }
  4493. }
  4494. class NumberTree extends NameOrNumberTree {
  4495. constructor(root, xref) {
  4496. super(root, xref, "Nums");
  4497. }
  4498. }
  4499. var FileSpec = function FileSpecClosure() {
  4500. function FileSpec(root, xref) {
  4501. if (!root || !(0, _primitives.isDict)(root)) {
  4502. return;
  4503. }
  4504. this.xref = xref;
  4505. this.root = root;
  4506. if (root.has("FS")) {
  4507. this.fs = root.get("FS");
  4508. }
  4509. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  4510. if (root.has("RF")) {
  4511. (0, _util.warn)("Related file specifications are not supported");
  4512. }
  4513. this.contentAvailable = true;
  4514. if (!root.has("EF")) {
  4515. this.contentAvailable = false;
  4516. (0, _util.warn)("Non-embedded file specifications are not supported");
  4517. }
  4518. }
  4519. function pickPlatformItem(dict) {
  4520. if (dict.has("UF")) {
  4521. return dict.get("UF");
  4522. } else if (dict.has("F")) {
  4523. return dict.get("F");
  4524. } else if (dict.has("Unix")) {
  4525. return dict.get("Unix");
  4526. } else if (dict.has("Mac")) {
  4527. return dict.get("Mac");
  4528. } else if (dict.has("DOS")) {
  4529. return dict.get("DOS");
  4530. }
  4531. return null;
  4532. }
  4533. FileSpec.prototype = {
  4534. get filename() {
  4535. if (!this._filename && this.root) {
  4536. var filename = pickPlatformItem(this.root) || "unnamed";
  4537. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  4538. }
  4539. return this._filename;
  4540. },
  4541. get content() {
  4542. if (!this.contentAvailable) {
  4543. return null;
  4544. }
  4545. if (!this.contentRef && this.root) {
  4546. this.contentRef = pickPlatformItem(this.root.get("EF"));
  4547. }
  4548. var content = null;
  4549. if (this.contentRef) {
  4550. var xref = this.xref;
  4551. var fileObj = xref.fetchIfRef(this.contentRef);
  4552. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  4553. content = fileObj.getBytes();
  4554. } else {
  4555. (0, _util.warn)("Embedded file specification points to non-existing/invalid " + "content");
  4556. }
  4557. } else {
  4558. (0, _util.warn)("Embedded file specification does not have a content");
  4559. }
  4560. return content;
  4561. },
  4562. get serializable() {
  4563. return {
  4564. filename: this.filename,
  4565. content: this.content
  4566. };
  4567. }
  4568. };
  4569. return FileSpec;
  4570. }();
  4571. exports.FileSpec = FileSpec;
  4572. const ObjectLoader = function () {
  4573. function mayHaveChildren(value) {
  4574. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  4575. }
  4576. function addChildren(node, nodesToVisit) {
  4577. if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) {
  4578. const dict = node instanceof _primitives.Dict ? node : node.dict;
  4579. const dictKeys = dict.getKeys();
  4580. for (let i = 0, ii = dictKeys.length; i < ii; i++) {
  4581. const rawValue = dict.getRaw(dictKeys[i]);
  4582. if (mayHaveChildren(rawValue)) {
  4583. nodesToVisit.push(rawValue);
  4584. }
  4585. }
  4586. } else if (Array.isArray(node)) {
  4587. for (let i = 0, ii = node.length; i < ii; i++) {
  4588. const value = node[i];
  4589. if (mayHaveChildren(value)) {
  4590. nodesToVisit.push(value);
  4591. }
  4592. }
  4593. }
  4594. }
  4595. function ObjectLoader(dict, keys, xref) {
  4596. this.dict = dict;
  4597. this.keys = keys;
  4598. this.xref = xref;
  4599. this.refSet = null;
  4600. }
  4601. ObjectLoader.prototype = {
  4602. async load() {
  4603. if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {
  4604. return undefined;
  4605. }
  4606. const {
  4607. keys,
  4608. dict
  4609. } = this;
  4610. this.refSet = new _primitives.RefSet();
  4611. const nodesToVisit = [];
  4612. for (let i = 0, ii = keys.length; i < ii; i++) {
  4613. const rawValue = dict.getRaw(keys[i]);
  4614. if (rawValue !== undefined) {
  4615. nodesToVisit.push(rawValue);
  4616. }
  4617. }
  4618. return this._walk(nodesToVisit);
  4619. },
  4620. async _walk(nodesToVisit) {
  4621. const nodesToRevisit = [];
  4622. const pendingRequests = [];
  4623. while (nodesToVisit.length) {
  4624. let currentNode = nodesToVisit.pop();
  4625. if (currentNode instanceof _primitives.Ref) {
  4626. if (this.refSet.has(currentNode)) {
  4627. continue;
  4628. }
  4629. try {
  4630. this.refSet.put(currentNode);
  4631. currentNode = this.xref.fetch(currentNode);
  4632. } catch (ex) {
  4633. if (!(ex instanceof _core_utils.MissingDataException)) {
  4634. throw ex;
  4635. }
  4636. nodesToRevisit.push(currentNode);
  4637. pendingRequests.push({
  4638. begin: ex.begin,
  4639. end: ex.end
  4640. });
  4641. }
  4642. }
  4643. if (currentNode && currentNode.getBaseStreams) {
  4644. const baseStreams = currentNode.getBaseStreams();
  4645. let foundMissingData = false;
  4646. for (let i = 0, ii = baseStreams.length; i < ii; i++) {
  4647. const stream = baseStreams[i];
  4648. if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
  4649. foundMissingData = true;
  4650. pendingRequests.push({
  4651. begin: stream.start,
  4652. end: stream.end
  4653. });
  4654. }
  4655. }
  4656. if (foundMissingData) {
  4657. nodesToRevisit.push(currentNode);
  4658. }
  4659. }
  4660. addChildren(currentNode, nodesToVisit);
  4661. }
  4662. if (pendingRequests.length) {
  4663. await this.xref.stream.manager.requestRanges(pendingRequests);
  4664. for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
  4665. const node = nodesToRevisit[i];
  4666. if (node instanceof _primitives.Ref) {
  4667. this.refSet.remove(node);
  4668. }
  4669. }
  4670. return this._walk(nodesToRevisit);
  4671. }
  4672. this.refSet = null;
  4673. return undefined;
  4674. }
  4675. };
  4676. return ObjectLoader;
  4677. }();
  4678. exports.ObjectLoader = ObjectLoader;
  4679. /***/ }),
  4680. /* 11 */
  4681. /***/ (function(module, exports, __w_pdfjs_require__) {
  4682. "use strict";
  4683. Object.defineProperty(exports, "__esModule", {
  4684. value: true
  4685. });
  4686. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  4687. var _stream = __w_pdfjs_require__(12);
  4688. var _util = __w_pdfjs_require__(2);
  4689. var _primitives = __w_pdfjs_require__(5);
  4690. var _core_utils = __w_pdfjs_require__(8);
  4691. var _ccitt_stream = __w_pdfjs_require__(13);
  4692. var _jbig2_stream = __w_pdfjs_require__(15);
  4693. var _jpeg_stream = __w_pdfjs_require__(18);
  4694. var _jpx_stream = __w_pdfjs_require__(20);
  4695. const MAX_LENGTH_TO_CACHE = 1000;
  4696. const MAX_ADLER32_LENGTH = 5552;
  4697. function computeAdler32(bytes) {
  4698. const bytesLength = bytes.length;
  4699. let a = 1,
  4700. b = 0;
  4701. for (let i = 0; i < bytesLength; ++i) {
  4702. a += bytes[i] & 0xff;
  4703. b += a;
  4704. }
  4705. return b % 65521 << 16 | a % 65521;
  4706. }
  4707. class Parser {
  4708. constructor({
  4709. lexer,
  4710. xref,
  4711. allowStreams = false,
  4712. recoveryMode = false
  4713. }) {
  4714. this.lexer = lexer;
  4715. this.xref = xref;
  4716. this.allowStreams = allowStreams;
  4717. this.recoveryMode = recoveryMode;
  4718. this.imageCache = Object.create(null);
  4719. this.refill();
  4720. }
  4721. refill() {
  4722. this.buf1 = this.lexer.getObj();
  4723. this.buf2 = this.lexer.getObj();
  4724. }
  4725. shift() {
  4726. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  4727. this.buf1 = this.buf2;
  4728. this.buf2 = null;
  4729. } else {
  4730. this.buf1 = this.buf2;
  4731. this.buf2 = this.lexer.getObj();
  4732. }
  4733. }
  4734. tryShift() {
  4735. try {
  4736. this.shift();
  4737. return true;
  4738. } catch (e) {
  4739. if (e instanceof _core_utils.MissingDataException) {
  4740. throw e;
  4741. }
  4742. return false;
  4743. }
  4744. }
  4745. getObj(cipherTransform = null) {
  4746. const buf1 = this.buf1;
  4747. this.shift();
  4748. if (buf1 instanceof _primitives.Cmd) {
  4749. switch (buf1.cmd) {
  4750. case "BI":
  4751. return this.makeInlineImage(cipherTransform);
  4752. case "[":
  4753. const array = [];
  4754. while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
  4755. array.push(this.getObj(cipherTransform));
  4756. }
  4757. if ((0, _primitives.isEOF)(this.buf1)) {
  4758. if (!this.recoveryMode) {
  4759. throw new _util.FormatError("End of file inside array");
  4760. }
  4761. return array;
  4762. }
  4763. this.shift();
  4764. return array;
  4765. case "<<":
  4766. const dict = new _primitives.Dict(this.xref);
  4767. while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
  4768. if (!(0, _primitives.isName)(this.buf1)) {
  4769. (0, _util.info)("Malformed dictionary: key must be a name object");
  4770. this.shift();
  4771. continue;
  4772. }
  4773. const key = this.buf1.name;
  4774. this.shift();
  4775. if ((0, _primitives.isEOF)(this.buf1)) {
  4776. break;
  4777. }
  4778. dict.set(key, this.getObj(cipherTransform));
  4779. }
  4780. if ((0, _primitives.isEOF)(this.buf1)) {
  4781. if (!this.recoveryMode) {
  4782. throw new _util.FormatError("End of file inside dictionary");
  4783. }
  4784. return dict;
  4785. }
  4786. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  4787. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  4788. }
  4789. this.shift();
  4790. return dict;
  4791. default:
  4792. return buf1;
  4793. }
  4794. }
  4795. if (Number.isInteger(buf1)) {
  4796. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  4797. const ref = _primitives.Ref.get(buf1, this.buf1);
  4798. this.shift();
  4799. this.shift();
  4800. return ref;
  4801. }
  4802. return buf1;
  4803. }
  4804. if (typeof buf1 === "string") {
  4805. if (cipherTransform) {
  4806. return cipherTransform.decryptString(buf1);
  4807. }
  4808. return buf1;
  4809. }
  4810. return buf1;
  4811. }
  4812. findDefaultInlineStreamEnd(stream) {
  4813. const E = 0x45,
  4814. I = 0x49,
  4815. SPACE = 0x20,
  4816. LF = 0xa,
  4817. CR = 0xd;
  4818. const n = 10,
  4819. NUL = 0x0;
  4820. const startPos = stream.pos;
  4821. let state = 0,
  4822. ch,
  4823. maybeEIPos;
  4824. while ((ch = stream.getByte()) !== -1) {
  4825. if (state === 0) {
  4826. state = ch === E ? 1 : 0;
  4827. } else if (state === 1) {
  4828. state = ch === I ? 2 : 0;
  4829. } else {
  4830. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  4831. if (ch === SPACE || ch === LF || ch === CR) {
  4832. maybeEIPos = stream.pos;
  4833. const followingBytes = stream.peekBytes(n);
  4834. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  4835. ch = followingBytes[i];
  4836. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  4837. continue;
  4838. }
  4839. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  4840. state = 0;
  4841. break;
  4842. }
  4843. }
  4844. if (state === 2) {
  4845. break;
  4846. }
  4847. } else {
  4848. state = 0;
  4849. }
  4850. }
  4851. }
  4852. if (ch === -1) {
  4853. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  4854. if (maybeEIPos) {
  4855. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  4856. stream.skip(-(stream.pos - maybeEIPos));
  4857. }
  4858. }
  4859. let endOffset = 4;
  4860. stream.skip(-endOffset);
  4861. ch = stream.peekByte();
  4862. stream.skip(endOffset);
  4863. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  4864. endOffset--;
  4865. }
  4866. return stream.pos - endOffset - startPos;
  4867. }
  4868. findDCTDecodeInlineStreamEnd(stream) {
  4869. const startPos = stream.pos;
  4870. let foundEOI = false,
  4871. b,
  4872. markerLength;
  4873. while ((b = stream.getByte()) !== -1) {
  4874. if (b !== 0xff) {
  4875. continue;
  4876. }
  4877. switch (stream.getByte()) {
  4878. case 0x00:
  4879. break;
  4880. case 0xff:
  4881. stream.skip(-1);
  4882. break;
  4883. case 0xd9:
  4884. foundEOI = true;
  4885. break;
  4886. case 0xc0:
  4887. case 0xc1:
  4888. case 0xc2:
  4889. case 0xc3:
  4890. case 0xc5:
  4891. case 0xc6:
  4892. case 0xc7:
  4893. case 0xc9:
  4894. case 0xca:
  4895. case 0xcb:
  4896. case 0xcd:
  4897. case 0xce:
  4898. case 0xcf:
  4899. case 0xc4:
  4900. case 0xcc:
  4901. case 0xda:
  4902. case 0xdb:
  4903. case 0xdc:
  4904. case 0xdd:
  4905. case 0xde:
  4906. case 0xdf:
  4907. case 0xe0:
  4908. case 0xe1:
  4909. case 0xe2:
  4910. case 0xe3:
  4911. case 0xe4:
  4912. case 0xe5:
  4913. case 0xe6:
  4914. case 0xe7:
  4915. case 0xe8:
  4916. case 0xe9:
  4917. case 0xea:
  4918. case 0xeb:
  4919. case 0xec:
  4920. case 0xed:
  4921. case 0xee:
  4922. case 0xef:
  4923. case 0xfe:
  4924. markerLength = stream.getUint16();
  4925. if (markerLength > 2) {
  4926. stream.skip(markerLength - 2);
  4927. } else {
  4928. stream.skip(-2);
  4929. }
  4930. break;
  4931. }
  4932. if (foundEOI) {
  4933. break;
  4934. }
  4935. }
  4936. const length = stream.pos - startPos;
  4937. if (b === -1) {
  4938. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  4939. stream.skip(-length);
  4940. return this.findDefaultInlineStreamEnd(stream);
  4941. }
  4942. this.inlineStreamSkipEI(stream);
  4943. return length;
  4944. }
  4945. findASCII85DecodeInlineStreamEnd(stream) {
  4946. const TILDE = 0x7e,
  4947. GT = 0x3e;
  4948. const startPos = stream.pos;
  4949. let ch;
  4950. while ((ch = stream.getByte()) !== -1) {
  4951. if (ch === TILDE) {
  4952. const tildePos = stream.pos;
  4953. ch = stream.peekByte();
  4954. while ((0, _core_utils.isWhiteSpace)(ch)) {
  4955. stream.skip();
  4956. ch = stream.peekByte();
  4957. }
  4958. if (ch === GT) {
  4959. stream.skip();
  4960. break;
  4961. }
  4962. if (stream.pos > tildePos) {
  4963. const maybeEI = stream.peekBytes(2);
  4964. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  4965. break;
  4966. }
  4967. }
  4968. }
  4969. }
  4970. const length = stream.pos - startPos;
  4971. if (ch === -1) {
  4972. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  4973. stream.skip(-length);
  4974. return this.findDefaultInlineStreamEnd(stream);
  4975. }
  4976. this.inlineStreamSkipEI(stream);
  4977. return length;
  4978. }
  4979. findASCIIHexDecodeInlineStreamEnd(stream) {
  4980. const GT = 0x3e;
  4981. const startPos = stream.pos;
  4982. let ch;
  4983. while ((ch = stream.getByte()) !== -1) {
  4984. if (ch === GT) {
  4985. break;
  4986. }
  4987. }
  4988. const length = stream.pos - startPos;
  4989. if (ch === -1) {
  4990. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  4991. stream.skip(-length);
  4992. return this.findDefaultInlineStreamEnd(stream);
  4993. }
  4994. this.inlineStreamSkipEI(stream);
  4995. return length;
  4996. }
  4997. inlineStreamSkipEI(stream) {
  4998. const E = 0x45,
  4999. I = 0x49;
  5000. let state = 0,
  5001. ch;
  5002. while ((ch = stream.getByte()) !== -1) {
  5003. if (state === 0) {
  5004. state = ch === E ? 1 : 0;
  5005. } else if (state === 1) {
  5006. state = ch === I ? 2 : 0;
  5007. } else if (state === 2) {
  5008. break;
  5009. }
  5010. }
  5011. }
  5012. makeInlineImage(cipherTransform) {
  5013. const lexer = this.lexer;
  5014. const stream = lexer.stream;
  5015. const dict = new _primitives.Dict(this.xref);
  5016. let dictLength;
  5017. while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
  5018. if (!(0, _primitives.isName)(this.buf1)) {
  5019. throw new _util.FormatError("Dictionary key must be a name object");
  5020. }
  5021. const key = this.buf1.name;
  5022. this.shift();
  5023. if ((0, _primitives.isEOF)(this.buf1)) {
  5024. break;
  5025. }
  5026. dict.set(key, this.getObj(cipherTransform));
  5027. }
  5028. if (lexer.beginInlineImagePos !== -1) {
  5029. dictLength = stream.pos - lexer.beginInlineImagePos;
  5030. }
  5031. const filter = dict.get("Filter", "F");
  5032. let filterName;
  5033. if ((0, _primitives.isName)(filter)) {
  5034. filterName = filter.name;
  5035. } else if (Array.isArray(filter)) {
  5036. const filterZero = this.xref.fetchIfRef(filter[0]);
  5037. if ((0, _primitives.isName)(filterZero)) {
  5038. filterName = filterZero.name;
  5039. }
  5040. }
  5041. const startPos = stream.pos;
  5042. let length;
  5043. if (filterName === "DCTDecode" || filterName === "DCT") {
  5044. length = this.findDCTDecodeInlineStreamEnd(stream);
  5045. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  5046. length = this.findASCII85DecodeInlineStreamEnd(stream);
  5047. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  5048. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  5049. } else {
  5050. length = this.findDefaultInlineStreamEnd(stream);
  5051. }
  5052. let imageStream = stream.makeSubStream(startPos, length, dict);
  5053. let cacheKey;
  5054. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  5055. const imageBytes = imageStream.getBytes();
  5056. imageStream.reset();
  5057. const initialStreamPos = stream.pos;
  5058. stream.pos = lexer.beginInlineImagePos;
  5059. const dictBytes = stream.getBytes(dictLength);
  5060. stream.pos = initialStreamPos;
  5061. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  5062. const cacheEntry = this.imageCache[cacheKey];
  5063. if (cacheEntry !== undefined) {
  5064. this.buf2 = _primitives.Cmd.get("EI");
  5065. this.shift();
  5066. cacheEntry.reset();
  5067. return cacheEntry;
  5068. }
  5069. }
  5070. if (cipherTransform) {
  5071. imageStream = cipherTransform.createStream(imageStream, length);
  5072. }
  5073. imageStream = this.filter(imageStream, dict, length);
  5074. imageStream.dict = dict;
  5075. if (cacheKey !== undefined) {
  5076. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  5077. this.imageCache[cacheKey] = imageStream;
  5078. }
  5079. this.buf2 = _primitives.Cmd.get("EI");
  5080. this.shift();
  5081. return imageStream;
  5082. }
  5083. _findStreamLength(startPos, signature) {
  5084. const {
  5085. stream
  5086. } = this.lexer;
  5087. stream.pos = startPos;
  5088. const SCAN_BLOCK_LENGTH = 2048;
  5089. const signatureLength = signature.length;
  5090. while (stream.pos < stream.end) {
  5091. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  5092. const scanLength = scanBytes.length - signatureLength;
  5093. if (scanLength <= 0) {
  5094. break;
  5095. }
  5096. let pos = 0;
  5097. while (pos < scanLength) {
  5098. let j = 0;
  5099. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  5100. j++;
  5101. }
  5102. if (j >= signatureLength) {
  5103. stream.pos += pos;
  5104. return stream.pos - startPos;
  5105. }
  5106. pos++;
  5107. }
  5108. stream.pos += scanLength;
  5109. }
  5110. return -1;
  5111. }
  5112. makeStream(dict, cipherTransform) {
  5113. const lexer = this.lexer;
  5114. let stream = lexer.stream;
  5115. lexer.skipToNextLine();
  5116. const startPos = stream.pos - 1;
  5117. let length = dict.get("Length");
  5118. if (!Number.isInteger(length)) {
  5119. (0, _util.info)(`Bad length "${length}" in stream`);
  5120. length = 0;
  5121. }
  5122. stream.pos = startPos + length;
  5123. lexer.nextChar();
  5124. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  5125. this.shift();
  5126. } else {
  5127. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
  5128. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  5129. if (actualLength < 0) {
  5130. const MAX_TRUNCATION = 1;
  5131. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  5132. const end = ENDSTREAM_SIGNATURE.length - i;
  5133. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  5134. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  5135. if (maybeLength >= 0) {
  5136. const lastByte = stream.peekBytes(end + 1)[end];
  5137. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  5138. break;
  5139. }
  5140. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  5141. actualLength = maybeLength;
  5142. break;
  5143. }
  5144. }
  5145. if (actualLength < 0) {
  5146. throw new _util.FormatError("Missing endstream command.");
  5147. }
  5148. }
  5149. length = actualLength;
  5150. lexer.nextChar();
  5151. this.shift();
  5152. this.shift();
  5153. }
  5154. this.shift();
  5155. stream = stream.makeSubStream(startPos, length, dict);
  5156. if (cipherTransform) {
  5157. stream = cipherTransform.createStream(stream, length);
  5158. }
  5159. stream = this.filter(stream, dict, length);
  5160. stream.dict = dict;
  5161. return stream;
  5162. }
  5163. filter(stream, dict, length) {
  5164. let filter = dict.get("Filter", "F");
  5165. let params = dict.get("DecodeParms", "DP");
  5166. if ((0, _primitives.isName)(filter)) {
  5167. if (Array.isArray(params)) {
  5168. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  5169. }
  5170. return this.makeFilter(stream, filter.name, length, params);
  5171. }
  5172. let maybeLength = length;
  5173. if (Array.isArray(filter)) {
  5174. const filterArray = filter;
  5175. const paramsArray = params;
  5176. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  5177. filter = this.xref.fetchIfRef(filterArray[i]);
  5178. if (!(0, _primitives.isName)(filter)) {
  5179. throw new _util.FormatError(`Bad filter name "${filter}"`);
  5180. }
  5181. params = null;
  5182. if (Array.isArray(paramsArray) && i in paramsArray) {
  5183. params = this.xref.fetchIfRef(paramsArray[i]);
  5184. }
  5185. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  5186. maybeLength = null;
  5187. }
  5188. }
  5189. return stream;
  5190. }
  5191. makeFilter(stream, name, maybeLength, params) {
  5192. if (maybeLength === 0) {
  5193. (0, _util.warn)(`Empty "${name}" stream.`);
  5194. return new _stream.NullStream();
  5195. }
  5196. try {
  5197. const xrefStreamStats = this.xref.stats.streamTypes;
  5198. if (name === "FlateDecode" || name === "Fl") {
  5199. xrefStreamStats[_util.StreamType.FLATE] = true;
  5200. if (params) {
  5201. return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
  5202. }
  5203. return new _stream.FlateStream(stream, maybeLength);
  5204. }
  5205. if (name === "LZWDecode" || name === "LZW") {
  5206. xrefStreamStats[_util.StreamType.LZW] = true;
  5207. let earlyChange = 1;
  5208. if (params) {
  5209. if (params.has("EarlyChange")) {
  5210. earlyChange = params.get("EarlyChange");
  5211. }
  5212. return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  5213. }
  5214. return new _stream.LZWStream(stream, maybeLength, earlyChange);
  5215. }
  5216. if (name === "DCTDecode" || name === "DCT") {
  5217. xrefStreamStats[_util.StreamType.DCT] = true;
  5218. return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
  5219. }
  5220. if (name === "JPXDecode" || name === "JPX") {
  5221. xrefStreamStats[_util.StreamType.JPX] = true;
  5222. return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
  5223. }
  5224. if (name === "ASCII85Decode" || name === "A85") {
  5225. xrefStreamStats[_util.StreamType.A85] = true;
  5226. return new _stream.Ascii85Stream(stream, maybeLength);
  5227. }
  5228. if (name === "ASCIIHexDecode" || name === "AHx") {
  5229. xrefStreamStats[_util.StreamType.AHX] = true;
  5230. return new _stream.AsciiHexStream(stream, maybeLength);
  5231. }
  5232. if (name === "CCITTFaxDecode" || name === "CCF") {
  5233. xrefStreamStats[_util.StreamType.CCF] = true;
  5234. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  5235. }
  5236. if (name === "RunLengthDecode" || name === "RL") {
  5237. xrefStreamStats[_util.StreamType.RLX] = true;
  5238. return new _stream.RunLengthStream(stream, maybeLength);
  5239. }
  5240. if (name === "JBIG2Decode") {
  5241. xrefStreamStats[_util.StreamType.JBIG] = true;
  5242. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
  5243. }
  5244. (0, _util.warn)(`Filter "${name}" is not supported.`);
  5245. return stream;
  5246. } catch (ex) {
  5247. if (ex instanceof _core_utils.MissingDataException) {
  5248. throw ex;
  5249. }
  5250. (0, _util.warn)(`Invalid stream: "${ex}"`);
  5251. return new _stream.NullStream();
  5252. }
  5253. }
  5254. }
  5255. exports.Parser = Parser;
  5256. 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];
  5257. function toHexDigit(ch) {
  5258. if (ch >= 0x30 && ch <= 0x39) {
  5259. return ch & 0x0f;
  5260. }
  5261. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  5262. return (ch & 0x0f) + 9;
  5263. }
  5264. return -1;
  5265. }
  5266. class Lexer {
  5267. constructor(stream, knownCommands = null) {
  5268. this.stream = stream;
  5269. this.nextChar();
  5270. this.strBuf = [];
  5271. this.knownCommands = knownCommands;
  5272. this._hexStringNumWarn = 0;
  5273. this.beginInlineImagePos = -1;
  5274. }
  5275. nextChar() {
  5276. return this.currentChar = this.stream.getByte();
  5277. }
  5278. peekChar() {
  5279. return this.stream.peekByte();
  5280. }
  5281. getNumber() {
  5282. let ch = this.currentChar;
  5283. let eNotation = false;
  5284. let divideBy = 0;
  5285. let sign = 0;
  5286. if (ch === 0x2d) {
  5287. sign = -1;
  5288. ch = this.nextChar();
  5289. if (ch === 0x2d) {
  5290. ch = this.nextChar();
  5291. }
  5292. } else if (ch === 0x2b) {
  5293. sign = 1;
  5294. ch = this.nextChar();
  5295. }
  5296. if (ch === 0x0a || ch === 0x0d) {
  5297. do {
  5298. ch = this.nextChar();
  5299. } while (ch === 0x0a || ch === 0x0d);
  5300. }
  5301. if (ch === 0x2e) {
  5302. divideBy = 10;
  5303. ch = this.nextChar();
  5304. }
  5305. if (ch < 0x30 || ch > 0x39) {
  5306. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  5307. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  5308. return 0;
  5309. }
  5310. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  5311. }
  5312. sign = sign || 1;
  5313. let baseValue = ch - 0x30;
  5314. let powerValue = 0;
  5315. let powerValueSign = 1;
  5316. while ((ch = this.nextChar()) >= 0) {
  5317. if (ch >= 0x30 && ch <= 0x39) {
  5318. const currentDigit = ch - 0x30;
  5319. if (eNotation) {
  5320. powerValue = powerValue * 10 + currentDigit;
  5321. } else {
  5322. if (divideBy !== 0) {
  5323. divideBy *= 10;
  5324. }
  5325. baseValue = baseValue * 10 + currentDigit;
  5326. }
  5327. } else if (ch === 0x2e) {
  5328. if (divideBy === 0) {
  5329. divideBy = 1;
  5330. } else {
  5331. break;
  5332. }
  5333. } else if (ch === 0x2d) {
  5334. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  5335. } else if (ch === 0x45 || ch === 0x65) {
  5336. ch = this.peekChar();
  5337. if (ch === 0x2b || ch === 0x2d) {
  5338. powerValueSign = ch === 0x2d ? -1 : 1;
  5339. this.nextChar();
  5340. } else if (ch < 0x30 || ch > 0x39) {
  5341. break;
  5342. }
  5343. eNotation = true;
  5344. } else {
  5345. break;
  5346. }
  5347. }
  5348. if (divideBy !== 0) {
  5349. baseValue /= divideBy;
  5350. }
  5351. if (eNotation) {
  5352. baseValue *= 10 ** (powerValueSign * powerValue);
  5353. }
  5354. return sign * baseValue;
  5355. }
  5356. getString() {
  5357. let numParen = 1;
  5358. let done = false;
  5359. const strBuf = this.strBuf;
  5360. strBuf.length = 0;
  5361. let ch = this.nextChar();
  5362. while (true) {
  5363. let charBuffered = false;
  5364. switch (ch | 0) {
  5365. case -1:
  5366. (0, _util.warn)("Unterminated string");
  5367. done = true;
  5368. break;
  5369. case 0x28:
  5370. ++numParen;
  5371. strBuf.push("(");
  5372. break;
  5373. case 0x29:
  5374. if (--numParen === 0) {
  5375. this.nextChar();
  5376. done = true;
  5377. } else {
  5378. strBuf.push(")");
  5379. }
  5380. break;
  5381. case 0x5c:
  5382. ch = this.nextChar();
  5383. switch (ch) {
  5384. case -1:
  5385. (0, _util.warn)("Unterminated string");
  5386. done = true;
  5387. break;
  5388. case 0x6e:
  5389. strBuf.push("\n");
  5390. break;
  5391. case 0x72:
  5392. strBuf.push("\r");
  5393. break;
  5394. case 0x74:
  5395. strBuf.push("\t");
  5396. break;
  5397. case 0x62:
  5398. strBuf.push("\b");
  5399. break;
  5400. case 0x66:
  5401. strBuf.push("\f");
  5402. break;
  5403. case 0x5c:
  5404. case 0x28:
  5405. case 0x29:
  5406. strBuf.push(String.fromCharCode(ch));
  5407. break;
  5408. case 0x30:
  5409. case 0x31:
  5410. case 0x32:
  5411. case 0x33:
  5412. case 0x34:
  5413. case 0x35:
  5414. case 0x36:
  5415. case 0x37:
  5416. let x = ch & 0x0f;
  5417. ch = this.nextChar();
  5418. charBuffered = true;
  5419. if (ch >= 0x30 && ch <= 0x37) {
  5420. x = (x << 3) + (ch & 0x0f);
  5421. ch = this.nextChar();
  5422. if (ch >= 0x30 && ch <= 0x37) {
  5423. charBuffered = false;
  5424. x = (x << 3) + (ch & 0x0f);
  5425. }
  5426. }
  5427. strBuf.push(String.fromCharCode(x));
  5428. break;
  5429. case 0x0d:
  5430. if (this.peekChar() === 0x0a) {
  5431. this.nextChar();
  5432. }
  5433. break;
  5434. case 0x0a:
  5435. break;
  5436. default:
  5437. strBuf.push(String.fromCharCode(ch));
  5438. break;
  5439. }
  5440. break;
  5441. default:
  5442. strBuf.push(String.fromCharCode(ch));
  5443. break;
  5444. }
  5445. if (done) {
  5446. break;
  5447. }
  5448. if (!charBuffered) {
  5449. ch = this.nextChar();
  5450. }
  5451. }
  5452. return strBuf.join("");
  5453. }
  5454. getName() {
  5455. let ch, previousCh;
  5456. const strBuf = this.strBuf;
  5457. strBuf.length = 0;
  5458. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  5459. if (ch === 0x23) {
  5460. ch = this.nextChar();
  5461. if (specialChars[ch]) {
  5462. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  5463. strBuf.push("#");
  5464. break;
  5465. }
  5466. const x = toHexDigit(ch);
  5467. if (x !== -1) {
  5468. previousCh = ch;
  5469. ch = this.nextChar();
  5470. const x2 = toHexDigit(ch);
  5471. if (x2 === -1) {
  5472. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  5473. strBuf.push("#", String.fromCharCode(previousCh));
  5474. if (specialChars[ch]) {
  5475. break;
  5476. }
  5477. strBuf.push(String.fromCharCode(ch));
  5478. continue;
  5479. }
  5480. strBuf.push(String.fromCharCode(x << 4 | x2));
  5481. } else {
  5482. strBuf.push("#", String.fromCharCode(ch));
  5483. }
  5484. } else {
  5485. strBuf.push(String.fromCharCode(ch));
  5486. }
  5487. }
  5488. if (strBuf.length > 127) {
  5489. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  5490. }
  5491. return _primitives.Name.get(strBuf.join(""));
  5492. }
  5493. _hexStringWarn(ch) {
  5494. const MAX_HEX_STRING_NUM_WARN = 5;
  5495. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  5496. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  5497. return;
  5498. }
  5499. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  5500. return;
  5501. }
  5502. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  5503. }
  5504. getHexString() {
  5505. const strBuf = this.strBuf;
  5506. strBuf.length = 0;
  5507. let ch = this.currentChar;
  5508. let isFirstHex = true;
  5509. let firstDigit, secondDigit;
  5510. this._hexStringNumWarn = 0;
  5511. while (true) {
  5512. if (ch < 0) {
  5513. (0, _util.warn)("Unterminated hex string");
  5514. break;
  5515. } else if (ch === 0x3e) {
  5516. this.nextChar();
  5517. break;
  5518. } else if (specialChars[ch] === 1) {
  5519. ch = this.nextChar();
  5520. continue;
  5521. } else {
  5522. if (isFirstHex) {
  5523. firstDigit = toHexDigit(ch);
  5524. if (firstDigit === -1) {
  5525. this._hexStringWarn(ch);
  5526. ch = this.nextChar();
  5527. continue;
  5528. }
  5529. } else {
  5530. secondDigit = toHexDigit(ch);
  5531. if (secondDigit === -1) {
  5532. this._hexStringWarn(ch);
  5533. ch = this.nextChar();
  5534. continue;
  5535. }
  5536. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  5537. }
  5538. isFirstHex = !isFirstHex;
  5539. ch = this.nextChar();
  5540. }
  5541. }
  5542. return strBuf.join("");
  5543. }
  5544. getObj() {
  5545. let comment = false;
  5546. let ch = this.currentChar;
  5547. while (true) {
  5548. if (ch < 0) {
  5549. return _primitives.EOF;
  5550. }
  5551. if (comment) {
  5552. if (ch === 0x0a || ch === 0x0d) {
  5553. comment = false;
  5554. }
  5555. } else if (ch === 0x25) {
  5556. comment = true;
  5557. } else if (specialChars[ch] !== 1) {
  5558. break;
  5559. }
  5560. ch = this.nextChar();
  5561. }
  5562. switch (ch | 0) {
  5563. case 0x30:
  5564. case 0x31:
  5565. case 0x32:
  5566. case 0x33:
  5567. case 0x34:
  5568. case 0x35:
  5569. case 0x36:
  5570. case 0x37:
  5571. case 0x38:
  5572. case 0x39:
  5573. case 0x2b:
  5574. case 0x2d:
  5575. case 0x2e:
  5576. return this.getNumber();
  5577. case 0x28:
  5578. return this.getString();
  5579. case 0x2f:
  5580. return this.getName();
  5581. case 0x5b:
  5582. this.nextChar();
  5583. return _primitives.Cmd.get("[");
  5584. case 0x5d:
  5585. this.nextChar();
  5586. return _primitives.Cmd.get("]");
  5587. case 0x3c:
  5588. ch = this.nextChar();
  5589. if (ch === 0x3c) {
  5590. this.nextChar();
  5591. return _primitives.Cmd.get("<<");
  5592. }
  5593. return this.getHexString();
  5594. case 0x3e:
  5595. ch = this.nextChar();
  5596. if (ch === 0x3e) {
  5597. this.nextChar();
  5598. return _primitives.Cmd.get(">>");
  5599. }
  5600. return _primitives.Cmd.get(">");
  5601. case 0x7b:
  5602. this.nextChar();
  5603. return _primitives.Cmd.get("{");
  5604. case 0x7d:
  5605. this.nextChar();
  5606. return _primitives.Cmd.get("}");
  5607. case 0x29:
  5608. this.nextChar();
  5609. throw new _util.FormatError(`Illegal character: ${ch}`);
  5610. }
  5611. let str = String.fromCharCode(ch);
  5612. const knownCommands = this.knownCommands;
  5613. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  5614. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  5615. const possibleCommand = str + String.fromCharCode(ch);
  5616. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  5617. break;
  5618. }
  5619. if (str.length === 128) {
  5620. throw new _util.FormatError(`Command token too long: ${str.length}`);
  5621. }
  5622. str = possibleCommand;
  5623. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  5624. }
  5625. if (str === "true") {
  5626. return true;
  5627. }
  5628. if (str === "false") {
  5629. return false;
  5630. }
  5631. if (str === "null") {
  5632. return null;
  5633. }
  5634. if (str === "BI") {
  5635. this.beginInlineImagePos = this.stream.pos;
  5636. }
  5637. return _primitives.Cmd.get(str);
  5638. }
  5639. skipToNextLine() {
  5640. let ch = this.currentChar;
  5641. while (ch >= 0) {
  5642. if (ch === 0x0d) {
  5643. ch = this.nextChar();
  5644. if (ch === 0x0a) {
  5645. this.nextChar();
  5646. }
  5647. break;
  5648. } else if (ch === 0x0a) {
  5649. this.nextChar();
  5650. break;
  5651. }
  5652. ch = this.nextChar();
  5653. }
  5654. }
  5655. }
  5656. exports.Lexer = Lexer;
  5657. class Linearization {
  5658. static create(stream) {
  5659. function getInt(linDict, name, allowZeroValue = false) {
  5660. const obj = linDict.get(name);
  5661. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  5662. return obj;
  5663. }
  5664. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  5665. }
  5666. function getHints(linDict) {
  5667. const hints = linDict.get("H");
  5668. let hintsLength;
  5669. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  5670. for (let index = 0; index < hintsLength; index++) {
  5671. const hint = hints[index];
  5672. if (!(Number.isInteger(hint) && hint > 0)) {
  5673. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  5674. }
  5675. }
  5676. return hints;
  5677. }
  5678. throw new Error("Hint array in the linearization dictionary is invalid.");
  5679. }
  5680. const parser = new Parser({
  5681. lexer: new Lexer(stream),
  5682. xref: null
  5683. });
  5684. const obj1 = parser.getObj();
  5685. const obj2 = parser.getObj();
  5686. const obj3 = parser.getObj();
  5687. const linDict = parser.getObj();
  5688. let obj, length;
  5689. 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)) {
  5690. return null;
  5691. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  5692. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  5693. }
  5694. return {
  5695. length,
  5696. hints: getHints(linDict),
  5697. objectNumberFirst: getInt(linDict, "O"),
  5698. endFirst: getInt(linDict, "E"),
  5699. numPages: getInt(linDict, "N"),
  5700. mainXRefEntriesOffset: getInt(linDict, "T"),
  5701. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  5702. };
  5703. }
  5704. }
  5705. exports.Linearization = Linearization;
  5706. /***/ }),
  5707. /* 12 */
  5708. /***/ (function(module, exports, __w_pdfjs_require__) {
  5709. "use strict";
  5710. Object.defineProperty(exports, "__esModule", {
  5711. value: true
  5712. });
  5713. exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
  5714. var _util = __w_pdfjs_require__(2);
  5715. var _primitives = __w_pdfjs_require__(5);
  5716. var _core_utils = __w_pdfjs_require__(8);
  5717. var Stream = function StreamClosure() {
  5718. function Stream(arrayBuffer, start, length, dict) {
  5719. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  5720. this.start = start || 0;
  5721. this.pos = this.start;
  5722. this.end = start + length || this.bytes.length;
  5723. this.dict = dict;
  5724. }
  5725. Stream.prototype = {
  5726. get length() {
  5727. return this.end - this.start;
  5728. },
  5729. get isEmpty() {
  5730. return this.length === 0;
  5731. },
  5732. getByte: function Stream_getByte() {
  5733. if (this.pos >= this.end) {
  5734. return -1;
  5735. }
  5736. return this.bytes[this.pos++];
  5737. },
  5738. getUint16: function Stream_getUint16() {
  5739. var b0 = this.getByte();
  5740. var b1 = this.getByte();
  5741. if (b0 === -1 || b1 === -1) {
  5742. return -1;
  5743. }
  5744. return (b0 << 8) + b1;
  5745. },
  5746. getInt32: function Stream_getInt32() {
  5747. var b0 = this.getByte();
  5748. var b1 = this.getByte();
  5749. var b2 = this.getByte();
  5750. var b3 = this.getByte();
  5751. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5752. },
  5753. getBytes(length, forceClamped = false) {
  5754. var bytes = this.bytes;
  5755. var pos = this.pos;
  5756. var strEnd = this.end;
  5757. if (!length) {
  5758. const subarray = bytes.subarray(pos, strEnd);
  5759. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  5760. }
  5761. var end = pos + length;
  5762. if (end > strEnd) {
  5763. end = strEnd;
  5764. }
  5765. this.pos = end;
  5766. const subarray = bytes.subarray(pos, end);
  5767. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  5768. },
  5769. peekByte: function Stream_peekByte() {
  5770. var peekedByte = this.getByte();
  5771. if (peekedByte !== -1) {
  5772. this.pos--;
  5773. }
  5774. return peekedByte;
  5775. },
  5776. peekBytes(length, forceClamped = false) {
  5777. var bytes = this.getBytes(length, forceClamped);
  5778. this.pos -= bytes.length;
  5779. return bytes;
  5780. },
  5781. getByteRange(begin, end) {
  5782. if (begin < 0) {
  5783. begin = 0;
  5784. }
  5785. if (end > this.end) {
  5786. end = this.end;
  5787. }
  5788. return this.bytes.subarray(begin, end);
  5789. },
  5790. skip: function Stream_skip(n) {
  5791. if (!n) {
  5792. n = 1;
  5793. }
  5794. this.pos += n;
  5795. },
  5796. reset: function Stream_reset() {
  5797. this.pos = this.start;
  5798. },
  5799. moveStart: function Stream_moveStart() {
  5800. this.start = this.pos;
  5801. },
  5802. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  5803. return new Stream(this.bytes.buffer, start, length, dict);
  5804. }
  5805. };
  5806. return Stream;
  5807. }();
  5808. exports.Stream = Stream;
  5809. var StringStream = function StringStreamClosure() {
  5810. function StringStream(str) {
  5811. const bytes = (0, _util.stringToBytes)(str);
  5812. Stream.call(this, bytes);
  5813. }
  5814. StringStream.prototype = Stream.prototype;
  5815. return StringStream;
  5816. }();
  5817. exports.StringStream = StringStream;
  5818. var DecodeStream = function DecodeStreamClosure() {
  5819. var emptyBuffer = new Uint8Array(0);
  5820. function DecodeStream(maybeMinBufferLength) {
  5821. this._rawMinBufferLength = maybeMinBufferLength || 0;
  5822. this.pos = 0;
  5823. this.bufferLength = 0;
  5824. this.eof = false;
  5825. this.buffer = emptyBuffer;
  5826. this.minBufferLength = 512;
  5827. if (maybeMinBufferLength) {
  5828. while (this.minBufferLength < maybeMinBufferLength) {
  5829. this.minBufferLength *= 2;
  5830. }
  5831. }
  5832. }
  5833. DecodeStream.prototype = {
  5834. get isEmpty() {
  5835. while (!this.eof && this.bufferLength === 0) {
  5836. this.readBlock();
  5837. }
  5838. return this.bufferLength === 0;
  5839. },
  5840. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  5841. var buffer = this.buffer;
  5842. if (requested <= buffer.byteLength) {
  5843. return buffer;
  5844. }
  5845. var size = this.minBufferLength;
  5846. while (size < requested) {
  5847. size *= 2;
  5848. }
  5849. var buffer2 = new Uint8Array(size);
  5850. buffer2.set(buffer);
  5851. return this.buffer = buffer2;
  5852. },
  5853. getByte: function DecodeStream_getByte() {
  5854. var pos = this.pos;
  5855. while (this.bufferLength <= pos) {
  5856. if (this.eof) {
  5857. return -1;
  5858. }
  5859. this.readBlock();
  5860. }
  5861. return this.buffer[this.pos++];
  5862. },
  5863. getUint16: function DecodeStream_getUint16() {
  5864. var b0 = this.getByte();
  5865. var b1 = this.getByte();
  5866. if (b0 === -1 || b1 === -1) {
  5867. return -1;
  5868. }
  5869. return (b0 << 8) + b1;
  5870. },
  5871. getInt32: function DecodeStream_getInt32() {
  5872. var b0 = this.getByte();
  5873. var b1 = this.getByte();
  5874. var b2 = this.getByte();
  5875. var b3 = this.getByte();
  5876. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  5877. },
  5878. getBytes(length, forceClamped = false) {
  5879. var end,
  5880. pos = this.pos;
  5881. if (length) {
  5882. this.ensureBuffer(pos + length);
  5883. end = pos + length;
  5884. while (!this.eof && this.bufferLength < end) {
  5885. this.readBlock();
  5886. }
  5887. var bufEnd = this.bufferLength;
  5888. if (end > bufEnd) {
  5889. end = bufEnd;
  5890. }
  5891. } else {
  5892. while (!this.eof) {
  5893. this.readBlock();
  5894. }
  5895. end = this.bufferLength;
  5896. }
  5897. this.pos = end;
  5898. const subarray = this.buffer.subarray(pos, end);
  5899. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  5900. },
  5901. peekByte: function DecodeStream_peekByte() {
  5902. var peekedByte = this.getByte();
  5903. if (peekedByte !== -1) {
  5904. this.pos--;
  5905. }
  5906. return peekedByte;
  5907. },
  5908. peekBytes(length, forceClamped = false) {
  5909. var bytes = this.getBytes(length, forceClamped);
  5910. this.pos -= bytes.length;
  5911. return bytes;
  5912. },
  5913. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  5914. var end = start + length;
  5915. while (this.bufferLength <= end && !this.eof) {
  5916. this.readBlock();
  5917. }
  5918. return new Stream(this.buffer, start, length, dict);
  5919. },
  5920. getByteRange(begin, end) {
  5921. (0, _util.unreachable)("Should not call DecodeStream.getByteRange");
  5922. },
  5923. skip: function DecodeStream_skip(n) {
  5924. if (!n) {
  5925. n = 1;
  5926. }
  5927. this.pos += n;
  5928. },
  5929. reset: function DecodeStream_reset() {
  5930. this.pos = 0;
  5931. },
  5932. getBaseStreams: function DecodeStream_getBaseStreams() {
  5933. if (this.str && this.str.getBaseStreams) {
  5934. return this.str.getBaseStreams();
  5935. }
  5936. return [];
  5937. }
  5938. };
  5939. return DecodeStream;
  5940. }();
  5941. exports.DecodeStream = DecodeStream;
  5942. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  5943. function StreamsSequenceStream(streams) {
  5944. this.streams = streams;
  5945. let maybeLength = 0;
  5946. for (let i = 0, ii = streams.length; i < ii; i++) {
  5947. const stream = streams[i];
  5948. if (stream instanceof DecodeStream) {
  5949. maybeLength += stream._rawMinBufferLength;
  5950. } else {
  5951. maybeLength += stream.length;
  5952. }
  5953. }
  5954. DecodeStream.call(this, maybeLength);
  5955. }
  5956. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  5957. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  5958. var streams = this.streams;
  5959. if (streams.length === 0) {
  5960. this.eof = true;
  5961. return;
  5962. }
  5963. var stream = streams.shift();
  5964. var chunk = stream.getBytes();
  5965. var bufferLength = this.bufferLength;
  5966. var newLength = bufferLength + chunk.length;
  5967. var buffer = this.ensureBuffer(newLength);
  5968. buffer.set(chunk, bufferLength);
  5969. this.bufferLength = newLength;
  5970. };
  5971. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  5972. var baseStreams = [];
  5973. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  5974. var stream = this.streams[i];
  5975. if (stream.getBaseStreams) {
  5976. baseStreams.push(...stream.getBaseStreams());
  5977. }
  5978. }
  5979. return baseStreams;
  5980. };
  5981. return StreamsSequenceStream;
  5982. }();
  5983. exports.StreamsSequenceStream = StreamsSequenceStream;
  5984. var FlateStream = function FlateStreamClosure() {
  5985. var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  5986. var 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]);
  5987. var 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]);
  5988. var 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];
  5989. var 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];
  5990. function FlateStream(str, maybeLength) {
  5991. this.str = str;
  5992. this.dict = str.dict;
  5993. var cmf = str.getByte();
  5994. var flg = str.getByte();
  5995. if (cmf === -1 || flg === -1) {
  5996. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  5997. }
  5998. if ((cmf & 0x0f) !== 0x08) {
  5999. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  6000. }
  6001. if (((cmf << 8) + flg) % 31 !== 0) {
  6002. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  6003. }
  6004. if (flg & 0x20) {
  6005. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  6006. }
  6007. this.codeSize = 0;
  6008. this.codeBuf = 0;
  6009. DecodeStream.call(this, maybeLength);
  6010. }
  6011. FlateStream.prototype = Object.create(DecodeStream.prototype);
  6012. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  6013. var str = this.str;
  6014. var codeSize = this.codeSize;
  6015. var codeBuf = this.codeBuf;
  6016. var b;
  6017. while (codeSize < bits) {
  6018. if ((b = str.getByte()) === -1) {
  6019. throw new _util.FormatError("Bad encoding in flate stream");
  6020. }
  6021. codeBuf |= b << codeSize;
  6022. codeSize += 8;
  6023. }
  6024. b = codeBuf & (1 << bits) - 1;
  6025. this.codeBuf = codeBuf >> bits;
  6026. this.codeSize = codeSize -= bits;
  6027. return b;
  6028. };
  6029. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  6030. var str = this.str;
  6031. var codes = table[0];
  6032. var maxLen = table[1];
  6033. var codeSize = this.codeSize;
  6034. var codeBuf = this.codeBuf;
  6035. var b;
  6036. while (codeSize < maxLen) {
  6037. if ((b = str.getByte()) === -1) {
  6038. break;
  6039. }
  6040. codeBuf |= b << codeSize;
  6041. codeSize += 8;
  6042. }
  6043. var code = codes[codeBuf & (1 << maxLen) - 1];
  6044. var codeLen = code >> 16;
  6045. var codeVal = code & 0xffff;
  6046. if (codeLen < 1 || codeSize < codeLen) {
  6047. throw new _util.FormatError("Bad encoding in flate stream");
  6048. }
  6049. this.codeBuf = codeBuf >> codeLen;
  6050. this.codeSize = codeSize - codeLen;
  6051. return codeVal;
  6052. };
  6053. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  6054. var n = lengths.length;
  6055. var maxLen = 0;
  6056. var i;
  6057. for (i = 0; i < n; ++i) {
  6058. if (lengths[i] > maxLen) {
  6059. maxLen = lengths[i];
  6060. }
  6061. }
  6062. var size = 1 << maxLen;
  6063. var codes = new Int32Array(size);
  6064. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  6065. for (var val = 0; val < n; ++val) {
  6066. if (lengths[val] === len) {
  6067. var code2 = 0;
  6068. var t = code;
  6069. for (i = 0; i < len; ++i) {
  6070. code2 = code2 << 1 | t & 1;
  6071. t >>= 1;
  6072. }
  6073. for (i = code2; i < size; i += skip) {
  6074. codes[i] = len << 16 | val;
  6075. }
  6076. ++code;
  6077. }
  6078. }
  6079. }
  6080. return [codes, maxLen];
  6081. };
  6082. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  6083. var buffer, len;
  6084. var str = this.str;
  6085. var hdr = this.getBits(3);
  6086. if (hdr & 1) {
  6087. this.eof = true;
  6088. }
  6089. hdr >>= 1;
  6090. if (hdr === 0) {
  6091. var b;
  6092. if ((b = str.getByte()) === -1) {
  6093. throw new _util.FormatError("Bad block header in flate stream");
  6094. }
  6095. var blockLen = b;
  6096. if ((b = str.getByte()) === -1) {
  6097. throw new _util.FormatError("Bad block header in flate stream");
  6098. }
  6099. blockLen |= b << 8;
  6100. if ((b = str.getByte()) === -1) {
  6101. throw new _util.FormatError("Bad block header in flate stream");
  6102. }
  6103. var check = b;
  6104. if ((b = str.getByte()) === -1) {
  6105. throw new _util.FormatError("Bad block header in flate stream");
  6106. }
  6107. check |= b << 8;
  6108. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  6109. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  6110. }
  6111. this.codeBuf = 0;
  6112. this.codeSize = 0;
  6113. const bufferLength = this.bufferLength,
  6114. end = bufferLength + blockLen;
  6115. buffer = this.ensureBuffer(end);
  6116. this.bufferLength = end;
  6117. if (blockLen === 0) {
  6118. if (str.peekByte() === -1) {
  6119. this.eof = true;
  6120. }
  6121. } else {
  6122. const block = str.getBytes(blockLen);
  6123. buffer.set(block, bufferLength);
  6124. if (block.length < blockLen) {
  6125. this.eof = true;
  6126. }
  6127. }
  6128. return;
  6129. }
  6130. var litCodeTable;
  6131. var distCodeTable;
  6132. if (hdr === 1) {
  6133. litCodeTable = fixedLitCodeTab;
  6134. distCodeTable = fixedDistCodeTab;
  6135. } else if (hdr === 2) {
  6136. var numLitCodes = this.getBits(5) + 257;
  6137. var numDistCodes = this.getBits(5) + 1;
  6138. var numCodeLenCodes = this.getBits(4) + 4;
  6139. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  6140. var i;
  6141. for (i = 0; i < numCodeLenCodes; ++i) {
  6142. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  6143. }
  6144. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  6145. len = 0;
  6146. i = 0;
  6147. var codes = numLitCodes + numDistCodes;
  6148. var codeLengths = new Uint8Array(codes);
  6149. var bitsLength, bitsOffset, what;
  6150. while (i < codes) {
  6151. var code = this.getCode(codeLenCodeTab);
  6152. if (code === 16) {
  6153. bitsLength = 2;
  6154. bitsOffset = 3;
  6155. what = len;
  6156. } else if (code === 17) {
  6157. bitsLength = 3;
  6158. bitsOffset = 3;
  6159. what = len = 0;
  6160. } else if (code === 18) {
  6161. bitsLength = 7;
  6162. bitsOffset = 11;
  6163. what = len = 0;
  6164. } else {
  6165. codeLengths[i++] = len = code;
  6166. continue;
  6167. }
  6168. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  6169. while (repeatLength-- > 0) {
  6170. codeLengths[i++] = what;
  6171. }
  6172. }
  6173. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  6174. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  6175. } else {
  6176. throw new _util.FormatError("Unknown block type in flate stream");
  6177. }
  6178. buffer = this.buffer;
  6179. var limit = buffer ? buffer.length : 0;
  6180. var pos = this.bufferLength;
  6181. while (true) {
  6182. var code1 = this.getCode(litCodeTable);
  6183. if (code1 < 256) {
  6184. if (pos + 1 >= limit) {
  6185. buffer = this.ensureBuffer(pos + 1);
  6186. limit = buffer.length;
  6187. }
  6188. buffer[pos++] = code1;
  6189. continue;
  6190. }
  6191. if (code1 === 256) {
  6192. this.bufferLength = pos;
  6193. return;
  6194. }
  6195. code1 -= 257;
  6196. code1 = lengthDecode[code1];
  6197. var code2 = code1 >> 16;
  6198. if (code2 > 0) {
  6199. code2 = this.getBits(code2);
  6200. }
  6201. len = (code1 & 0xffff) + code2;
  6202. code1 = this.getCode(distCodeTable);
  6203. code1 = distDecode[code1];
  6204. code2 = code1 >> 16;
  6205. if (code2 > 0) {
  6206. code2 = this.getBits(code2);
  6207. }
  6208. var dist = (code1 & 0xffff) + code2;
  6209. if (pos + len >= limit) {
  6210. buffer = this.ensureBuffer(pos + len);
  6211. limit = buffer.length;
  6212. }
  6213. for (var k = 0; k < len; ++k, ++pos) {
  6214. buffer[pos] = buffer[pos - dist];
  6215. }
  6216. }
  6217. };
  6218. return FlateStream;
  6219. }();
  6220. exports.FlateStream = FlateStream;
  6221. var PredictorStream = function PredictorStreamClosure() {
  6222. function PredictorStream(str, maybeLength, params) {
  6223. if (!(0, _primitives.isDict)(params)) {
  6224. return str;
  6225. }
  6226. var predictor = this.predictor = params.get("Predictor") || 1;
  6227. if (predictor <= 1) {
  6228. return str;
  6229. }
  6230. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  6231. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  6232. }
  6233. if (predictor === 2) {
  6234. this.readBlock = this.readBlockTiff;
  6235. } else {
  6236. this.readBlock = this.readBlockPng;
  6237. }
  6238. this.str = str;
  6239. this.dict = str.dict;
  6240. var colors = this.colors = params.get("Colors") || 1;
  6241. var bits = this.bits = params.get("BitsPerComponent") || 8;
  6242. var columns = this.columns = params.get("Columns") || 1;
  6243. this.pixBytes = colors * bits + 7 >> 3;
  6244. this.rowBytes = columns * colors * bits + 7 >> 3;
  6245. DecodeStream.call(this, maybeLength);
  6246. return this;
  6247. }
  6248. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  6249. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  6250. var rowBytes = this.rowBytes;
  6251. var bufferLength = this.bufferLength;
  6252. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  6253. var bits = this.bits;
  6254. var colors = this.colors;
  6255. var rawBytes = this.str.getBytes(rowBytes);
  6256. this.eof = !rawBytes.length;
  6257. if (this.eof) {
  6258. return;
  6259. }
  6260. var inbuf = 0,
  6261. outbuf = 0;
  6262. var inbits = 0,
  6263. outbits = 0;
  6264. var pos = bufferLength;
  6265. var i;
  6266. if (bits === 1 && colors === 1) {
  6267. for (i = 0; i < rowBytes; ++i) {
  6268. var c = rawBytes[i] ^ inbuf;
  6269. c ^= c >> 1;
  6270. c ^= c >> 2;
  6271. c ^= c >> 4;
  6272. inbuf = (c & 1) << 7;
  6273. buffer[pos++] = c;
  6274. }
  6275. } else if (bits === 8) {
  6276. for (i = 0; i < colors; ++i) {
  6277. buffer[pos++] = rawBytes[i];
  6278. }
  6279. for (; i < rowBytes; ++i) {
  6280. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  6281. pos++;
  6282. }
  6283. } else if (bits === 16) {
  6284. var bytesPerPixel = colors * 2;
  6285. for (i = 0; i < bytesPerPixel; ++i) {
  6286. buffer[pos++] = rawBytes[i];
  6287. }
  6288. for (; i < rowBytes; i += 2) {
  6289. var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  6290. buffer[pos++] = sum >> 8 & 0xff;
  6291. buffer[pos++] = sum & 0xff;
  6292. }
  6293. } else {
  6294. var compArray = new Uint8Array(colors + 1);
  6295. var bitMask = (1 << bits) - 1;
  6296. var j = 0,
  6297. k = bufferLength;
  6298. var columns = this.columns;
  6299. for (i = 0; i < columns; ++i) {
  6300. for (var kk = 0; kk < colors; ++kk) {
  6301. if (inbits < bits) {
  6302. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  6303. inbits += 8;
  6304. }
  6305. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  6306. inbits -= bits;
  6307. outbuf = outbuf << bits | compArray[kk];
  6308. outbits += bits;
  6309. if (outbits >= 8) {
  6310. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  6311. outbits -= 8;
  6312. }
  6313. }
  6314. }
  6315. if (outbits > 0) {
  6316. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  6317. }
  6318. }
  6319. this.bufferLength += rowBytes;
  6320. };
  6321. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  6322. var rowBytes = this.rowBytes;
  6323. var pixBytes = this.pixBytes;
  6324. var predictor = this.str.getByte();
  6325. var rawBytes = this.str.getBytes(rowBytes);
  6326. this.eof = !rawBytes.length;
  6327. if (this.eof) {
  6328. return;
  6329. }
  6330. var bufferLength = this.bufferLength;
  6331. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  6332. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  6333. if (prevRow.length === 0) {
  6334. prevRow = new Uint8Array(rowBytes);
  6335. }
  6336. var i,
  6337. j = bufferLength,
  6338. up,
  6339. c;
  6340. switch (predictor) {
  6341. case 0:
  6342. for (i = 0; i < rowBytes; ++i) {
  6343. buffer[j++] = rawBytes[i];
  6344. }
  6345. break;
  6346. case 1:
  6347. for (i = 0; i < pixBytes; ++i) {
  6348. buffer[j++] = rawBytes[i];
  6349. }
  6350. for (; i < rowBytes; ++i) {
  6351. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  6352. j++;
  6353. }
  6354. break;
  6355. case 2:
  6356. for (i = 0; i < rowBytes; ++i) {
  6357. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  6358. }
  6359. break;
  6360. case 3:
  6361. for (i = 0; i < pixBytes; ++i) {
  6362. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  6363. }
  6364. for (; i < rowBytes; ++i) {
  6365. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  6366. j++;
  6367. }
  6368. break;
  6369. case 4:
  6370. for (i = 0; i < pixBytes; ++i) {
  6371. up = prevRow[i];
  6372. c = rawBytes[i];
  6373. buffer[j++] = up + c;
  6374. }
  6375. for (; i < rowBytes; ++i) {
  6376. up = prevRow[i];
  6377. var upLeft = prevRow[i - pixBytes];
  6378. var left = buffer[j - pixBytes];
  6379. var p = left + up - upLeft;
  6380. var pa = p - left;
  6381. if (pa < 0) {
  6382. pa = -pa;
  6383. }
  6384. var pb = p - up;
  6385. if (pb < 0) {
  6386. pb = -pb;
  6387. }
  6388. var pc = p - upLeft;
  6389. if (pc < 0) {
  6390. pc = -pc;
  6391. }
  6392. c = rawBytes[i];
  6393. if (pa <= pb && pa <= pc) {
  6394. buffer[j++] = left + c;
  6395. } else if (pb <= pc) {
  6396. buffer[j++] = up + c;
  6397. } else {
  6398. buffer[j++] = upLeft + c;
  6399. }
  6400. }
  6401. break;
  6402. default:
  6403. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  6404. }
  6405. this.bufferLength += rowBytes;
  6406. };
  6407. return PredictorStream;
  6408. }();
  6409. exports.PredictorStream = PredictorStream;
  6410. var DecryptStream = function DecryptStreamClosure() {
  6411. function DecryptStream(str, maybeLength, decrypt) {
  6412. this.str = str;
  6413. this.dict = str.dict;
  6414. this.decrypt = decrypt;
  6415. this.nextChunk = null;
  6416. this.initialized = false;
  6417. DecodeStream.call(this, maybeLength);
  6418. }
  6419. var chunkSize = 512;
  6420. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  6421. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  6422. var chunk;
  6423. if (this.initialized) {
  6424. chunk = this.nextChunk;
  6425. } else {
  6426. chunk = this.str.getBytes(chunkSize);
  6427. this.initialized = true;
  6428. }
  6429. if (!chunk || chunk.length === 0) {
  6430. this.eof = true;
  6431. return;
  6432. }
  6433. this.nextChunk = this.str.getBytes(chunkSize);
  6434. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  6435. var decrypt = this.decrypt;
  6436. chunk = decrypt(chunk, !hasMoreData);
  6437. var bufferLength = this.bufferLength;
  6438. var i,
  6439. n = chunk.length;
  6440. var buffer = this.ensureBuffer(bufferLength + n);
  6441. for (i = 0; i < n; i++) {
  6442. buffer[bufferLength++] = chunk[i];
  6443. }
  6444. this.bufferLength = bufferLength;
  6445. };
  6446. return DecryptStream;
  6447. }();
  6448. exports.DecryptStream = DecryptStream;
  6449. var Ascii85Stream = function Ascii85StreamClosure() {
  6450. function Ascii85Stream(str, maybeLength) {
  6451. this.str = str;
  6452. this.dict = str.dict;
  6453. this.input = new Uint8Array(5);
  6454. if (maybeLength) {
  6455. maybeLength = 0.8 * maybeLength;
  6456. }
  6457. DecodeStream.call(this, maybeLength);
  6458. }
  6459. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  6460. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  6461. var TILDA_CHAR = 0x7e;
  6462. var Z_LOWER_CHAR = 0x7a;
  6463. var EOF = -1;
  6464. var str = this.str;
  6465. var c = str.getByte();
  6466. while ((0, _core_utils.isWhiteSpace)(c)) {
  6467. c = str.getByte();
  6468. }
  6469. if (c === EOF || c === TILDA_CHAR) {
  6470. this.eof = true;
  6471. return;
  6472. }
  6473. var bufferLength = this.bufferLength,
  6474. buffer;
  6475. var i;
  6476. if (c === Z_LOWER_CHAR) {
  6477. buffer = this.ensureBuffer(bufferLength + 4);
  6478. for (i = 0; i < 4; ++i) {
  6479. buffer[bufferLength + i] = 0;
  6480. }
  6481. this.bufferLength += 4;
  6482. } else {
  6483. var input = this.input;
  6484. input[0] = c;
  6485. for (i = 1; i < 5; ++i) {
  6486. c = str.getByte();
  6487. while ((0, _core_utils.isWhiteSpace)(c)) {
  6488. c = str.getByte();
  6489. }
  6490. input[i] = c;
  6491. if (c === EOF || c === TILDA_CHAR) {
  6492. break;
  6493. }
  6494. }
  6495. buffer = this.ensureBuffer(bufferLength + i - 1);
  6496. this.bufferLength += i - 1;
  6497. if (i < 5) {
  6498. for (; i < 5; ++i) {
  6499. input[i] = 0x21 + 84;
  6500. }
  6501. this.eof = true;
  6502. }
  6503. var t = 0;
  6504. for (i = 0; i < 5; ++i) {
  6505. t = t * 85 + (input[i] - 0x21);
  6506. }
  6507. for (i = 3; i >= 0; --i) {
  6508. buffer[bufferLength + i] = t & 0xff;
  6509. t >>= 8;
  6510. }
  6511. }
  6512. };
  6513. return Ascii85Stream;
  6514. }();
  6515. exports.Ascii85Stream = Ascii85Stream;
  6516. var AsciiHexStream = function AsciiHexStreamClosure() {
  6517. function AsciiHexStream(str, maybeLength) {
  6518. this.str = str;
  6519. this.dict = str.dict;
  6520. this.firstDigit = -1;
  6521. if (maybeLength) {
  6522. maybeLength = 0.5 * maybeLength;
  6523. }
  6524. DecodeStream.call(this, maybeLength);
  6525. }
  6526. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  6527. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  6528. var UPSTREAM_BLOCK_SIZE = 8000;
  6529. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  6530. if (!bytes.length) {
  6531. this.eof = true;
  6532. return;
  6533. }
  6534. var maxDecodeLength = bytes.length + 1 >> 1;
  6535. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  6536. var bufferLength = this.bufferLength;
  6537. var firstDigit = this.firstDigit;
  6538. for (var i = 0, ii = bytes.length; i < ii; i++) {
  6539. var ch = bytes[i],
  6540. digit;
  6541. if (ch >= 0x30 && ch <= 0x39) {
  6542. digit = ch & 0x0f;
  6543. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  6544. digit = (ch & 0x0f) + 9;
  6545. } else if (ch === 0x3e) {
  6546. this.eof = true;
  6547. break;
  6548. } else {
  6549. continue;
  6550. }
  6551. if (firstDigit < 0) {
  6552. firstDigit = digit;
  6553. } else {
  6554. buffer[bufferLength++] = firstDigit << 4 | digit;
  6555. firstDigit = -1;
  6556. }
  6557. }
  6558. if (firstDigit >= 0 && this.eof) {
  6559. buffer[bufferLength++] = firstDigit << 4;
  6560. firstDigit = -1;
  6561. }
  6562. this.firstDigit = firstDigit;
  6563. this.bufferLength = bufferLength;
  6564. };
  6565. return AsciiHexStream;
  6566. }();
  6567. exports.AsciiHexStream = AsciiHexStream;
  6568. var RunLengthStream = function RunLengthStreamClosure() {
  6569. function RunLengthStream(str, maybeLength) {
  6570. this.str = str;
  6571. this.dict = str.dict;
  6572. DecodeStream.call(this, maybeLength);
  6573. }
  6574. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  6575. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  6576. var repeatHeader = this.str.getBytes(2);
  6577. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  6578. this.eof = true;
  6579. return;
  6580. }
  6581. var buffer;
  6582. var bufferLength = this.bufferLength;
  6583. var n = repeatHeader[0];
  6584. if (n < 128) {
  6585. buffer = this.ensureBuffer(bufferLength + n + 1);
  6586. buffer[bufferLength++] = repeatHeader[1];
  6587. if (n > 0) {
  6588. var source = this.str.getBytes(n);
  6589. buffer.set(source, bufferLength);
  6590. bufferLength += n;
  6591. }
  6592. } else {
  6593. n = 257 - n;
  6594. var b = repeatHeader[1];
  6595. buffer = this.ensureBuffer(bufferLength + n + 1);
  6596. for (var i = 0; i < n; i++) {
  6597. buffer[bufferLength++] = b;
  6598. }
  6599. }
  6600. this.bufferLength = bufferLength;
  6601. };
  6602. return RunLengthStream;
  6603. }();
  6604. exports.RunLengthStream = RunLengthStream;
  6605. var LZWStream = function LZWStreamClosure() {
  6606. function LZWStream(str, maybeLength, earlyChange) {
  6607. this.str = str;
  6608. this.dict = str.dict;
  6609. this.cachedData = 0;
  6610. this.bitsCached = 0;
  6611. var maxLzwDictionarySize = 4096;
  6612. var lzwState = {
  6613. earlyChange,
  6614. codeLength: 9,
  6615. nextCode: 258,
  6616. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  6617. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  6618. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  6619. currentSequence: new Uint8Array(maxLzwDictionarySize),
  6620. currentSequenceLength: 0
  6621. };
  6622. for (var i = 0; i < 256; ++i) {
  6623. lzwState.dictionaryValues[i] = i;
  6624. lzwState.dictionaryLengths[i] = 1;
  6625. }
  6626. this.lzwState = lzwState;
  6627. DecodeStream.call(this, maybeLength);
  6628. }
  6629. LZWStream.prototype = Object.create(DecodeStream.prototype);
  6630. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  6631. var bitsCached = this.bitsCached;
  6632. var cachedData = this.cachedData;
  6633. while (bitsCached < n) {
  6634. var c = this.str.getByte();
  6635. if (c === -1) {
  6636. this.eof = true;
  6637. return null;
  6638. }
  6639. cachedData = cachedData << 8 | c;
  6640. bitsCached += 8;
  6641. }
  6642. this.bitsCached = bitsCached -= n;
  6643. this.cachedData = cachedData;
  6644. this.lastCode = null;
  6645. return cachedData >>> bitsCached & (1 << n) - 1;
  6646. };
  6647. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  6648. var blockSize = 512;
  6649. var estimatedDecodedSize = blockSize * 2,
  6650. decodedSizeDelta = blockSize;
  6651. var i, j, q;
  6652. var lzwState = this.lzwState;
  6653. if (!lzwState) {
  6654. return;
  6655. }
  6656. var earlyChange = lzwState.earlyChange;
  6657. var nextCode = lzwState.nextCode;
  6658. var dictionaryValues = lzwState.dictionaryValues;
  6659. var dictionaryLengths = lzwState.dictionaryLengths;
  6660. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  6661. var codeLength = lzwState.codeLength;
  6662. var prevCode = lzwState.prevCode;
  6663. var currentSequence = lzwState.currentSequence;
  6664. var currentSequenceLength = lzwState.currentSequenceLength;
  6665. var decodedLength = 0;
  6666. var currentBufferLength = this.bufferLength;
  6667. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  6668. for (i = 0; i < blockSize; i++) {
  6669. var code = this.readBits(codeLength);
  6670. var hasPrev = currentSequenceLength > 0;
  6671. if (code < 256) {
  6672. currentSequence[0] = code;
  6673. currentSequenceLength = 1;
  6674. } else if (code >= 258) {
  6675. if (code < nextCode) {
  6676. currentSequenceLength = dictionaryLengths[code];
  6677. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  6678. currentSequence[j] = dictionaryValues[q];
  6679. q = dictionaryPrevCodes[q];
  6680. }
  6681. } else {
  6682. currentSequence[currentSequenceLength++] = currentSequence[0];
  6683. }
  6684. } else if (code === 256) {
  6685. codeLength = 9;
  6686. nextCode = 258;
  6687. currentSequenceLength = 0;
  6688. continue;
  6689. } else {
  6690. this.eof = true;
  6691. delete this.lzwState;
  6692. break;
  6693. }
  6694. if (hasPrev) {
  6695. dictionaryPrevCodes[nextCode] = prevCode;
  6696. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  6697. dictionaryValues[nextCode] = currentSequence[0];
  6698. nextCode++;
  6699. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  6700. }
  6701. prevCode = code;
  6702. decodedLength += currentSequenceLength;
  6703. if (estimatedDecodedSize < decodedLength) {
  6704. do {
  6705. estimatedDecodedSize += decodedSizeDelta;
  6706. } while (estimatedDecodedSize < decodedLength);
  6707. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  6708. }
  6709. for (j = 0; j < currentSequenceLength; j++) {
  6710. buffer[currentBufferLength++] = currentSequence[j];
  6711. }
  6712. }
  6713. lzwState.nextCode = nextCode;
  6714. lzwState.codeLength = codeLength;
  6715. lzwState.prevCode = prevCode;
  6716. lzwState.currentSequenceLength = currentSequenceLength;
  6717. this.bufferLength = currentBufferLength;
  6718. };
  6719. return LZWStream;
  6720. }();
  6721. exports.LZWStream = LZWStream;
  6722. var NullStream = function NullStreamClosure() {
  6723. function NullStream() {
  6724. Stream.call(this, new Uint8Array(0));
  6725. }
  6726. NullStream.prototype = Stream.prototype;
  6727. return NullStream;
  6728. }();
  6729. exports.NullStream = NullStream;
  6730. /***/ }),
  6731. /* 13 */
  6732. /***/ (function(module, exports, __w_pdfjs_require__) {
  6733. "use strict";
  6734. Object.defineProperty(exports, "__esModule", {
  6735. value: true
  6736. });
  6737. exports.CCITTFaxStream = void 0;
  6738. var _primitives = __w_pdfjs_require__(5);
  6739. var _ccitt = __w_pdfjs_require__(14);
  6740. var _stream = __w_pdfjs_require__(12);
  6741. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  6742. function CCITTFaxStream(str, maybeLength, params) {
  6743. this.str = str;
  6744. this.dict = str.dict;
  6745. if (!(0, _primitives.isDict)(params)) {
  6746. params = _primitives.Dict.empty;
  6747. }
  6748. const source = {
  6749. next() {
  6750. return str.getByte();
  6751. }
  6752. };
  6753. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  6754. K: params.get("K"),
  6755. EndOfLine: params.get("EndOfLine"),
  6756. EncodedByteAlign: params.get("EncodedByteAlign"),
  6757. Columns: params.get("Columns"),
  6758. Rows: params.get("Rows"),
  6759. EndOfBlock: params.get("EndOfBlock"),
  6760. BlackIs1: params.get("BlackIs1")
  6761. });
  6762. _stream.DecodeStream.call(this, maybeLength);
  6763. }
  6764. CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  6765. CCITTFaxStream.prototype.readBlock = function () {
  6766. while (!this.eof) {
  6767. const c = this.ccittFaxDecoder.readNextChar();
  6768. if (c === -1) {
  6769. this.eof = true;
  6770. return;
  6771. }
  6772. this.ensureBuffer(this.bufferLength + 1);
  6773. this.buffer[this.bufferLength++] = c;
  6774. }
  6775. };
  6776. return CCITTFaxStream;
  6777. }();
  6778. exports.CCITTFaxStream = CCITTFaxStream;
  6779. /***/ }),
  6780. /* 14 */
  6781. /***/ (function(module, exports, __w_pdfjs_require__) {
  6782. "use strict";
  6783. Object.defineProperty(exports, "__esModule", {
  6784. value: true
  6785. });
  6786. exports.CCITTFaxDecoder = void 0;
  6787. var _util = __w_pdfjs_require__(2);
  6788. const CCITTFaxDecoder = function CCITTFaxDecoder() {
  6789. const ccittEOL = -2;
  6790. const ccittEOF = -1;
  6791. const twoDimPass = 0;
  6792. const twoDimHoriz = 1;
  6793. const twoDimVert0 = 2;
  6794. const twoDimVertR1 = 3;
  6795. const twoDimVertL1 = 4;
  6796. const twoDimVertR2 = 5;
  6797. const twoDimVertL2 = 6;
  6798. const twoDimVertR3 = 7;
  6799. const twoDimVertL3 = 8;
  6800. 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]];
  6801. 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]];
  6802. 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]];
  6803. 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]];
  6804. 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]];
  6805. 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]];
  6806. function CCITTFaxDecoder(source, options = {}) {
  6807. if (!source || typeof source.next !== "function") {
  6808. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  6809. }
  6810. this.source = source;
  6811. this.eof = false;
  6812. this.encoding = options.K || 0;
  6813. this.eoline = options.EndOfLine || false;
  6814. this.byteAlign = options.EncodedByteAlign || false;
  6815. this.columns = options.Columns || 1728;
  6816. this.rows = options.Rows || 0;
  6817. let eoblock = options.EndOfBlock;
  6818. if (eoblock === null || eoblock === undefined) {
  6819. eoblock = true;
  6820. }
  6821. this.eoblock = eoblock;
  6822. this.black = options.BlackIs1 || false;
  6823. this.codingLine = new Uint32Array(this.columns + 1);
  6824. this.refLine = new Uint32Array(this.columns + 2);
  6825. this.codingLine[0] = this.columns;
  6826. this.codingPos = 0;
  6827. this.row = 0;
  6828. this.nextLine2D = this.encoding < 0;
  6829. this.inputBits = 0;
  6830. this.inputBuf = 0;
  6831. this.outputBits = 0;
  6832. this.rowsDone = false;
  6833. let code1;
  6834. while ((code1 = this._lookBits(12)) === 0) {
  6835. this._eatBits(1);
  6836. }
  6837. if (code1 === 1) {
  6838. this._eatBits(12);
  6839. }
  6840. if (this.encoding > 0) {
  6841. this.nextLine2D = !this._lookBits(1);
  6842. this._eatBits(1);
  6843. }
  6844. }
  6845. CCITTFaxDecoder.prototype = {
  6846. readNextChar() {
  6847. if (this.eof) {
  6848. return -1;
  6849. }
  6850. const refLine = this.refLine;
  6851. const codingLine = this.codingLine;
  6852. const columns = this.columns;
  6853. let refPos, blackPixels, bits, i;
  6854. if (this.outputBits === 0) {
  6855. if (this.rowsDone) {
  6856. this.eof = true;
  6857. }
  6858. if (this.eof) {
  6859. return -1;
  6860. }
  6861. this.err = false;
  6862. let code1, code2, code3;
  6863. if (this.nextLine2D) {
  6864. for (i = 0; codingLine[i] < columns; ++i) {
  6865. refLine[i] = codingLine[i];
  6866. }
  6867. refLine[i++] = columns;
  6868. refLine[i] = columns;
  6869. codingLine[0] = 0;
  6870. this.codingPos = 0;
  6871. refPos = 0;
  6872. blackPixels = 0;
  6873. while (codingLine[this.codingPos] < columns) {
  6874. code1 = this._getTwoDimCode();
  6875. switch (code1) {
  6876. case twoDimPass:
  6877. this._addPixels(refLine[refPos + 1], blackPixels);
  6878. if (refLine[refPos + 1] < columns) {
  6879. refPos += 2;
  6880. }
  6881. break;
  6882. case twoDimHoriz:
  6883. code1 = code2 = 0;
  6884. if (blackPixels) {
  6885. do {
  6886. code1 += code3 = this._getBlackCode();
  6887. } while (code3 >= 64);
  6888. do {
  6889. code2 += code3 = this._getWhiteCode();
  6890. } while (code3 >= 64);
  6891. } else {
  6892. do {
  6893. code1 += code3 = this._getWhiteCode();
  6894. } while (code3 >= 64);
  6895. do {
  6896. code2 += code3 = this._getBlackCode();
  6897. } while (code3 >= 64);
  6898. }
  6899. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  6900. if (codingLine[this.codingPos] < columns) {
  6901. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  6902. }
  6903. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6904. refPos += 2;
  6905. }
  6906. break;
  6907. case twoDimVertR3:
  6908. this._addPixels(refLine[refPos] + 3, blackPixels);
  6909. blackPixels ^= 1;
  6910. if (codingLine[this.codingPos] < columns) {
  6911. ++refPos;
  6912. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6913. refPos += 2;
  6914. }
  6915. }
  6916. break;
  6917. case twoDimVertR2:
  6918. this._addPixels(refLine[refPos] + 2, blackPixels);
  6919. blackPixels ^= 1;
  6920. if (codingLine[this.codingPos] < columns) {
  6921. ++refPos;
  6922. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6923. refPos += 2;
  6924. }
  6925. }
  6926. break;
  6927. case twoDimVertR1:
  6928. this._addPixels(refLine[refPos] + 1, blackPixels);
  6929. blackPixels ^= 1;
  6930. if (codingLine[this.codingPos] < columns) {
  6931. ++refPos;
  6932. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6933. refPos += 2;
  6934. }
  6935. }
  6936. break;
  6937. case twoDimVert0:
  6938. this._addPixels(refLine[refPos], blackPixels);
  6939. blackPixels ^= 1;
  6940. if (codingLine[this.codingPos] < columns) {
  6941. ++refPos;
  6942. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6943. refPos += 2;
  6944. }
  6945. }
  6946. break;
  6947. case twoDimVertL3:
  6948. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  6949. blackPixels ^= 1;
  6950. if (codingLine[this.codingPos] < columns) {
  6951. if (refPos > 0) {
  6952. --refPos;
  6953. } else {
  6954. ++refPos;
  6955. }
  6956. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6957. refPos += 2;
  6958. }
  6959. }
  6960. break;
  6961. case twoDimVertL2:
  6962. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  6963. blackPixels ^= 1;
  6964. if (codingLine[this.codingPos] < columns) {
  6965. if (refPos > 0) {
  6966. --refPos;
  6967. } else {
  6968. ++refPos;
  6969. }
  6970. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6971. refPos += 2;
  6972. }
  6973. }
  6974. break;
  6975. case twoDimVertL1:
  6976. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  6977. blackPixels ^= 1;
  6978. if (codingLine[this.codingPos] < columns) {
  6979. if (refPos > 0) {
  6980. --refPos;
  6981. } else {
  6982. ++refPos;
  6983. }
  6984. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6985. refPos += 2;
  6986. }
  6987. }
  6988. break;
  6989. case ccittEOF:
  6990. this._addPixels(columns, 0);
  6991. this.eof = true;
  6992. break;
  6993. default:
  6994. (0, _util.info)("bad 2d code");
  6995. this._addPixels(columns, 0);
  6996. this.err = true;
  6997. }
  6998. }
  6999. } else {
  7000. codingLine[0] = 0;
  7001. this.codingPos = 0;
  7002. blackPixels = 0;
  7003. while (codingLine[this.codingPos] < columns) {
  7004. code1 = 0;
  7005. if (blackPixels) {
  7006. do {
  7007. code1 += code3 = this._getBlackCode();
  7008. } while (code3 >= 64);
  7009. } else {
  7010. do {
  7011. code1 += code3 = this._getWhiteCode();
  7012. } while (code3 >= 64);
  7013. }
  7014. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7015. blackPixels ^= 1;
  7016. }
  7017. }
  7018. let gotEOL = false;
  7019. if (this.byteAlign) {
  7020. this.inputBits &= ~7;
  7021. }
  7022. if (!this.eoblock && this.row === this.rows - 1) {
  7023. this.rowsDone = true;
  7024. } else {
  7025. code1 = this._lookBits(12);
  7026. if (this.eoline) {
  7027. while (code1 !== ccittEOF && code1 !== 1) {
  7028. this._eatBits(1);
  7029. code1 = this._lookBits(12);
  7030. }
  7031. } else {
  7032. while (code1 === 0) {
  7033. this._eatBits(1);
  7034. code1 = this._lookBits(12);
  7035. }
  7036. }
  7037. if (code1 === 1) {
  7038. this._eatBits(12);
  7039. gotEOL = true;
  7040. } else if (code1 === ccittEOF) {
  7041. this.eof = true;
  7042. }
  7043. }
  7044. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  7045. this.nextLine2D = !this._lookBits(1);
  7046. this._eatBits(1);
  7047. }
  7048. if (this.eoblock && gotEOL && this.byteAlign) {
  7049. code1 = this._lookBits(12);
  7050. if (code1 === 1) {
  7051. this._eatBits(12);
  7052. if (this.encoding > 0) {
  7053. this._lookBits(1);
  7054. this._eatBits(1);
  7055. }
  7056. if (this.encoding >= 0) {
  7057. for (i = 0; i < 4; ++i) {
  7058. code1 = this._lookBits(12);
  7059. if (code1 !== 1) {
  7060. (0, _util.info)("bad rtc code: " + code1);
  7061. }
  7062. this._eatBits(12);
  7063. if (this.encoding > 0) {
  7064. this._lookBits(1);
  7065. this._eatBits(1);
  7066. }
  7067. }
  7068. }
  7069. this.eof = true;
  7070. }
  7071. } else if (this.err && this.eoline) {
  7072. while (true) {
  7073. code1 = this._lookBits(13);
  7074. if (code1 === ccittEOF) {
  7075. this.eof = true;
  7076. return -1;
  7077. }
  7078. if (code1 >> 1 === 1) {
  7079. break;
  7080. }
  7081. this._eatBits(1);
  7082. }
  7083. this._eatBits(12);
  7084. if (this.encoding > 0) {
  7085. this._eatBits(1);
  7086. this.nextLine2D = !(code1 & 1);
  7087. }
  7088. }
  7089. if (codingLine[0] > 0) {
  7090. this.outputBits = codingLine[this.codingPos = 0];
  7091. } else {
  7092. this.outputBits = codingLine[this.codingPos = 1];
  7093. }
  7094. this.row++;
  7095. }
  7096. let c;
  7097. if (this.outputBits >= 8) {
  7098. c = this.codingPos & 1 ? 0 : 0xff;
  7099. this.outputBits -= 8;
  7100. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7101. this.codingPos++;
  7102. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7103. }
  7104. } else {
  7105. bits = 8;
  7106. c = 0;
  7107. do {
  7108. if (this.outputBits > bits) {
  7109. c <<= bits;
  7110. if (!(this.codingPos & 1)) {
  7111. c |= 0xff >> 8 - bits;
  7112. }
  7113. this.outputBits -= bits;
  7114. bits = 0;
  7115. } else {
  7116. c <<= this.outputBits;
  7117. if (!(this.codingPos & 1)) {
  7118. c |= 0xff >> 8 - this.outputBits;
  7119. }
  7120. bits -= this.outputBits;
  7121. this.outputBits = 0;
  7122. if (codingLine[this.codingPos] < columns) {
  7123. this.codingPos++;
  7124. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7125. } else if (bits > 0) {
  7126. c <<= bits;
  7127. bits = 0;
  7128. }
  7129. }
  7130. } while (bits);
  7131. }
  7132. if (this.black) {
  7133. c ^= 0xff;
  7134. }
  7135. return c;
  7136. },
  7137. _addPixels(a1, blackPixels) {
  7138. const codingLine = this.codingLine;
  7139. let codingPos = this.codingPos;
  7140. if (a1 > codingLine[codingPos]) {
  7141. if (a1 > this.columns) {
  7142. (0, _util.info)("row is wrong length");
  7143. this.err = true;
  7144. a1 = this.columns;
  7145. }
  7146. if (codingPos & 1 ^ blackPixels) {
  7147. ++codingPos;
  7148. }
  7149. codingLine[codingPos] = a1;
  7150. }
  7151. this.codingPos = codingPos;
  7152. },
  7153. _addPixelsNeg(a1, blackPixels) {
  7154. const codingLine = this.codingLine;
  7155. let codingPos = this.codingPos;
  7156. if (a1 > codingLine[codingPos]) {
  7157. if (a1 > this.columns) {
  7158. (0, _util.info)("row is wrong length");
  7159. this.err = true;
  7160. a1 = this.columns;
  7161. }
  7162. if (codingPos & 1 ^ blackPixels) {
  7163. ++codingPos;
  7164. }
  7165. codingLine[codingPos] = a1;
  7166. } else if (a1 < codingLine[codingPos]) {
  7167. if (a1 < 0) {
  7168. (0, _util.info)("invalid code");
  7169. this.err = true;
  7170. a1 = 0;
  7171. }
  7172. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7173. --codingPos;
  7174. }
  7175. codingLine[codingPos] = a1;
  7176. }
  7177. this.codingPos = codingPos;
  7178. },
  7179. _findTableCode(start, end, table, limit) {
  7180. const limitValue = limit || 0;
  7181. for (let i = start; i <= end; ++i) {
  7182. let code = this._lookBits(i);
  7183. if (code === ccittEOF) {
  7184. return [true, 1, false];
  7185. }
  7186. if (i < end) {
  7187. code <<= end - i;
  7188. }
  7189. if (!limitValue || code >= limitValue) {
  7190. const p = table[code - limitValue];
  7191. if (p[0] === i) {
  7192. this._eatBits(i);
  7193. return [true, p[1], true];
  7194. }
  7195. }
  7196. }
  7197. return [false, 0, false];
  7198. },
  7199. _getTwoDimCode() {
  7200. let code = 0;
  7201. let p;
  7202. if (this.eoblock) {
  7203. code = this._lookBits(7);
  7204. p = twoDimTable[code];
  7205. if (p && p[0] > 0) {
  7206. this._eatBits(p[0]);
  7207. return p[1];
  7208. }
  7209. } else {
  7210. const result = this._findTableCode(1, 7, twoDimTable);
  7211. if (result[0] && result[2]) {
  7212. return result[1];
  7213. }
  7214. }
  7215. (0, _util.info)("Bad two dim code");
  7216. return ccittEOF;
  7217. },
  7218. _getWhiteCode() {
  7219. let code = 0;
  7220. let p;
  7221. if (this.eoblock) {
  7222. code = this._lookBits(12);
  7223. if (code === ccittEOF) {
  7224. return 1;
  7225. }
  7226. if (code >> 5 === 0) {
  7227. p = whiteTable1[code];
  7228. } else {
  7229. p = whiteTable2[code >> 3];
  7230. }
  7231. if (p[0] > 0) {
  7232. this._eatBits(p[0]);
  7233. return p[1];
  7234. }
  7235. } else {
  7236. let result = this._findTableCode(1, 9, whiteTable2);
  7237. if (result[0]) {
  7238. return result[1];
  7239. }
  7240. result = this._findTableCode(11, 12, whiteTable1);
  7241. if (result[0]) {
  7242. return result[1];
  7243. }
  7244. }
  7245. (0, _util.info)("bad white code");
  7246. this._eatBits(1);
  7247. return 1;
  7248. },
  7249. _getBlackCode() {
  7250. let code, p;
  7251. if (this.eoblock) {
  7252. code = this._lookBits(13);
  7253. if (code === ccittEOF) {
  7254. return 1;
  7255. }
  7256. if (code >> 7 === 0) {
  7257. p = blackTable1[code];
  7258. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  7259. p = blackTable2[(code >> 1) - 64];
  7260. } else {
  7261. p = blackTable3[code >> 7];
  7262. }
  7263. if (p[0] > 0) {
  7264. this._eatBits(p[0]);
  7265. return p[1];
  7266. }
  7267. } else {
  7268. let result = this._findTableCode(2, 6, blackTable3);
  7269. if (result[0]) {
  7270. return result[1];
  7271. }
  7272. result = this._findTableCode(7, 12, blackTable2, 64);
  7273. if (result[0]) {
  7274. return result[1];
  7275. }
  7276. result = this._findTableCode(10, 13, blackTable1);
  7277. if (result[0]) {
  7278. return result[1];
  7279. }
  7280. }
  7281. (0, _util.info)("bad black code");
  7282. this._eatBits(1);
  7283. return 1;
  7284. },
  7285. _lookBits(n) {
  7286. let c;
  7287. while (this.inputBits < n) {
  7288. if ((c = this.source.next()) === -1) {
  7289. if (this.inputBits === 0) {
  7290. return ccittEOF;
  7291. }
  7292. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  7293. }
  7294. this.inputBuf = this.inputBuf << 8 | c;
  7295. this.inputBits += 8;
  7296. }
  7297. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  7298. },
  7299. _eatBits(n) {
  7300. if ((this.inputBits -= n) < 0) {
  7301. this.inputBits = 0;
  7302. }
  7303. }
  7304. };
  7305. return CCITTFaxDecoder;
  7306. }();
  7307. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  7308. /***/ }),
  7309. /* 15 */
  7310. /***/ (function(module, exports, __w_pdfjs_require__) {
  7311. "use strict";
  7312. Object.defineProperty(exports, "__esModule", {
  7313. value: true
  7314. });
  7315. exports.Jbig2Stream = void 0;
  7316. var _primitives = __w_pdfjs_require__(5);
  7317. var _stream = __w_pdfjs_require__(12);
  7318. var _jbig = __w_pdfjs_require__(16);
  7319. var _util = __w_pdfjs_require__(2);
  7320. const Jbig2Stream = function Jbig2StreamClosure() {
  7321. function Jbig2Stream(stream, maybeLength, dict, params) {
  7322. this.stream = stream;
  7323. this.maybeLength = maybeLength;
  7324. this.dict = dict;
  7325. this.params = params;
  7326. _stream.DecodeStream.call(this, maybeLength);
  7327. }
  7328. Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
  7329. Object.defineProperty(Jbig2Stream.prototype, "bytes", {
  7330. get() {
  7331. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  7332. },
  7333. configurable: true
  7334. });
  7335. Jbig2Stream.prototype.ensureBuffer = function (requested) {};
  7336. Jbig2Stream.prototype.readBlock = function () {
  7337. if (this.eof) {
  7338. return;
  7339. }
  7340. const jbig2Image = new _jbig.Jbig2Image();
  7341. const chunks = [];
  7342. if ((0, _primitives.isDict)(this.params)) {
  7343. const globalsStream = this.params.get("JBIG2Globals");
  7344. if ((0, _primitives.isStream)(globalsStream)) {
  7345. const globals = globalsStream.getBytes();
  7346. chunks.push({
  7347. data: globals,
  7348. start: 0,
  7349. end: globals.length
  7350. });
  7351. }
  7352. }
  7353. chunks.push({
  7354. data: this.bytes,
  7355. start: 0,
  7356. end: this.bytes.length
  7357. });
  7358. const data = jbig2Image.parseChunks(chunks);
  7359. const dataLength = data.length;
  7360. for (let i = 0; i < dataLength; i++) {
  7361. data[i] ^= 0xff;
  7362. }
  7363. this.buffer = data;
  7364. this.bufferLength = dataLength;
  7365. this.eof = true;
  7366. };
  7367. return Jbig2Stream;
  7368. }();
  7369. exports.Jbig2Stream = Jbig2Stream;
  7370. /***/ }),
  7371. /* 16 */
  7372. /***/ (function(module, exports, __w_pdfjs_require__) {
  7373. "use strict";
  7374. Object.defineProperty(exports, "__esModule", {
  7375. value: true
  7376. });
  7377. exports.Jbig2Image = void 0;
  7378. var _util = __w_pdfjs_require__(2);
  7379. var _core_utils = __w_pdfjs_require__(8);
  7380. var _arithmetic_decoder = __w_pdfjs_require__(17);
  7381. var _ccitt = __w_pdfjs_require__(14);
  7382. class Jbig2Error extends _util.BaseException {
  7383. constructor(msg) {
  7384. super(`JBIG2 error: ${msg}`);
  7385. }
  7386. }
  7387. var Jbig2Image = function Jbig2ImageClosure() {
  7388. function ContextCache() {}
  7389. ContextCache.prototype = {
  7390. getContexts(id) {
  7391. if (id in this) {
  7392. return this[id];
  7393. }
  7394. return this[id] = new Int8Array(1 << 16);
  7395. }
  7396. };
  7397. function DecodingContext(data, start, end) {
  7398. this.data = data;
  7399. this.start = start;
  7400. this.end = end;
  7401. }
  7402. DecodingContext.prototype = {
  7403. get decoder() {
  7404. var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  7405. return (0, _util.shadow)(this, "decoder", decoder);
  7406. },
  7407. get contextCache() {
  7408. var cache = new ContextCache();
  7409. return (0, _util.shadow)(this, "contextCache", cache);
  7410. }
  7411. };
  7412. function decodeInteger(contextCache, procedure, decoder) {
  7413. var contexts = contextCache.getContexts(procedure);
  7414. var prev = 1;
  7415. function readBits(length) {
  7416. var v = 0;
  7417. for (var i = 0; i < length; i++) {
  7418. var bit = decoder.readBit(contexts, prev);
  7419. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  7420. v = v << 1 | bit;
  7421. }
  7422. return v >>> 0;
  7423. }
  7424. var sign = readBits(1);
  7425. var 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);
  7426. if (sign === 0) {
  7427. return value;
  7428. } else if (value > 0) {
  7429. return -value;
  7430. }
  7431. return null;
  7432. }
  7433. function decodeIAID(contextCache, decoder, codeLength) {
  7434. var contexts = contextCache.getContexts("IAID");
  7435. var prev = 1;
  7436. for (var i = 0; i < codeLength; i++) {
  7437. var bit = decoder.readBit(contexts, prev);
  7438. prev = prev << 1 | bit;
  7439. }
  7440. if (codeLength < 31) {
  7441. return prev & (1 << codeLength) - 1;
  7442. }
  7443. return prev & 0x7fffffff;
  7444. }
  7445. var 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"];
  7446. var CodingTemplates = [[{
  7447. x: -1,
  7448. y: -2
  7449. }, {
  7450. x: 0,
  7451. y: -2
  7452. }, {
  7453. x: 1,
  7454. y: -2
  7455. }, {
  7456. x: -2,
  7457. y: -1
  7458. }, {
  7459. x: -1,
  7460. y: -1
  7461. }, {
  7462. x: 0,
  7463. y: -1
  7464. }, {
  7465. x: 1,
  7466. y: -1
  7467. }, {
  7468. x: 2,
  7469. y: -1
  7470. }, {
  7471. x: -4,
  7472. y: 0
  7473. }, {
  7474. x: -3,
  7475. y: 0
  7476. }, {
  7477. x: -2,
  7478. y: 0
  7479. }, {
  7480. x: -1,
  7481. y: 0
  7482. }], [{
  7483. x: -1,
  7484. y: -2
  7485. }, {
  7486. x: 0,
  7487. y: -2
  7488. }, {
  7489. x: 1,
  7490. y: -2
  7491. }, {
  7492. x: 2,
  7493. y: -2
  7494. }, {
  7495. x: -2,
  7496. y: -1
  7497. }, {
  7498. x: -1,
  7499. y: -1
  7500. }, {
  7501. x: 0,
  7502. y: -1
  7503. }, {
  7504. x: 1,
  7505. y: -1
  7506. }, {
  7507. x: 2,
  7508. y: -1
  7509. }, {
  7510. x: -3,
  7511. y: 0
  7512. }, {
  7513. x: -2,
  7514. y: 0
  7515. }, {
  7516. x: -1,
  7517. y: 0
  7518. }], [{
  7519. x: -1,
  7520. y: -2
  7521. }, {
  7522. x: 0,
  7523. y: -2
  7524. }, {
  7525. x: 1,
  7526. y: -2
  7527. }, {
  7528. x: -2,
  7529. y: -1
  7530. }, {
  7531. x: -1,
  7532. y: -1
  7533. }, {
  7534. x: 0,
  7535. y: -1
  7536. }, {
  7537. x: 1,
  7538. y: -1
  7539. }, {
  7540. x: -2,
  7541. y: 0
  7542. }, {
  7543. x: -1,
  7544. y: 0
  7545. }], [{
  7546. x: -3,
  7547. y: -1
  7548. }, {
  7549. x: -2,
  7550. y: -1
  7551. }, {
  7552. x: -1,
  7553. y: -1
  7554. }, {
  7555. x: 0,
  7556. y: -1
  7557. }, {
  7558. x: 1,
  7559. y: -1
  7560. }, {
  7561. x: -4,
  7562. y: 0
  7563. }, {
  7564. x: -3,
  7565. y: 0
  7566. }, {
  7567. x: -2,
  7568. y: 0
  7569. }, {
  7570. x: -1,
  7571. y: 0
  7572. }]];
  7573. var RefinementTemplates = [{
  7574. coding: [{
  7575. x: 0,
  7576. y: -1
  7577. }, {
  7578. x: 1,
  7579. y: -1
  7580. }, {
  7581. x: -1,
  7582. y: 0
  7583. }],
  7584. reference: [{
  7585. x: 0,
  7586. y: -1
  7587. }, {
  7588. x: 1,
  7589. y: -1
  7590. }, {
  7591. x: -1,
  7592. y: 0
  7593. }, {
  7594. x: 0,
  7595. y: 0
  7596. }, {
  7597. x: 1,
  7598. y: 0
  7599. }, {
  7600. x: -1,
  7601. y: 1
  7602. }, {
  7603. x: 0,
  7604. y: 1
  7605. }, {
  7606. x: 1,
  7607. y: 1
  7608. }]
  7609. }, {
  7610. coding: [{
  7611. x: -1,
  7612. y: -1
  7613. }, {
  7614. x: 0,
  7615. y: -1
  7616. }, {
  7617. x: 1,
  7618. y: -1
  7619. }, {
  7620. x: -1,
  7621. y: 0
  7622. }],
  7623. reference: [{
  7624. x: 0,
  7625. y: -1
  7626. }, {
  7627. x: -1,
  7628. y: 0
  7629. }, {
  7630. x: 0,
  7631. y: 0
  7632. }, {
  7633. x: 1,
  7634. y: 0
  7635. }, {
  7636. x: 0,
  7637. y: 1
  7638. }, {
  7639. x: 1,
  7640. y: 1
  7641. }]
  7642. }];
  7643. var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  7644. var RefinementReusedContexts = [0x0020, 0x0008];
  7645. function decodeBitmapTemplate0(width, height, decodingContext) {
  7646. var decoder = decodingContext.decoder;
  7647. var contexts = decodingContext.contextCache.getContexts("GB");
  7648. var contextLabel,
  7649. i,
  7650. j,
  7651. pixel,
  7652. row,
  7653. row1,
  7654. row2,
  7655. bitmap = [];
  7656. var OLD_PIXEL_MASK = 0x7bf7;
  7657. for (i = 0; i < height; i++) {
  7658. row = bitmap[i] = new Uint8Array(width);
  7659. row1 = i < 1 ? row : bitmap[i - 1];
  7660. row2 = i < 2 ? row : bitmap[i - 2];
  7661. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  7662. for (j = 0; j < width; j++) {
  7663. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  7664. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  7665. }
  7666. }
  7667. return bitmap;
  7668. }
  7669. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  7670. if (mmr) {
  7671. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  7672. return decodeMMRBitmap(input, width, height, false);
  7673. }
  7674. 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) {
  7675. return decodeBitmapTemplate0(width, height, decodingContext);
  7676. }
  7677. var useskip = !!skip;
  7678. var template = CodingTemplates[templateIndex].concat(at);
  7679. template.sort(function (a, b) {
  7680. return a.y - b.y || a.x - b.x;
  7681. });
  7682. var templateLength = template.length;
  7683. var templateX = new Int8Array(templateLength);
  7684. var templateY = new Int8Array(templateLength);
  7685. var changingTemplateEntries = [];
  7686. var reuseMask = 0,
  7687. minX = 0,
  7688. maxX = 0,
  7689. minY = 0;
  7690. var c, k;
  7691. for (k = 0; k < templateLength; k++) {
  7692. templateX[k] = template[k].x;
  7693. templateY[k] = template[k].y;
  7694. minX = Math.min(minX, template[k].x);
  7695. maxX = Math.max(maxX, template[k].x);
  7696. minY = Math.min(minY, template[k].y);
  7697. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  7698. reuseMask |= 1 << templateLength - 1 - k;
  7699. } else {
  7700. changingTemplateEntries.push(k);
  7701. }
  7702. }
  7703. var changingEntriesLength = changingTemplateEntries.length;
  7704. var changingTemplateX = new Int8Array(changingEntriesLength);
  7705. var changingTemplateY = new Int8Array(changingEntriesLength);
  7706. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  7707. for (c = 0; c < changingEntriesLength; c++) {
  7708. k = changingTemplateEntries[c];
  7709. changingTemplateX[c] = template[k].x;
  7710. changingTemplateY[c] = template[k].y;
  7711. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  7712. }
  7713. var sbb_left = -minX;
  7714. var sbb_top = -minY;
  7715. var sbb_right = width - maxX;
  7716. var pseudoPixelContext = ReusedContexts[templateIndex];
  7717. var row = new Uint8Array(width);
  7718. var bitmap = [];
  7719. var decoder = decodingContext.decoder;
  7720. var contexts = decodingContext.contextCache.getContexts("GB");
  7721. var ltp = 0,
  7722. j,
  7723. i0,
  7724. j0,
  7725. contextLabel = 0,
  7726. bit,
  7727. shift;
  7728. for (var i = 0; i < height; i++) {
  7729. if (prediction) {
  7730. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  7731. ltp ^= sltp;
  7732. if (ltp) {
  7733. bitmap.push(row);
  7734. continue;
  7735. }
  7736. }
  7737. row = new Uint8Array(row);
  7738. bitmap.push(row);
  7739. for (j = 0; j < width; j++) {
  7740. if (useskip && skip[i][j]) {
  7741. row[j] = 0;
  7742. continue;
  7743. }
  7744. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  7745. contextLabel = contextLabel << 1 & reuseMask;
  7746. for (k = 0; k < changingEntriesLength; k++) {
  7747. i0 = i + changingTemplateY[k];
  7748. j0 = j + changingTemplateX[k];
  7749. bit = bitmap[i0][j0];
  7750. if (bit) {
  7751. bit = changingTemplateBit[k];
  7752. contextLabel |= bit;
  7753. }
  7754. }
  7755. } else {
  7756. contextLabel = 0;
  7757. shift = templateLength - 1;
  7758. for (k = 0; k < templateLength; k++, shift--) {
  7759. j0 = j + templateX[k];
  7760. if (j0 >= 0 && j0 < width) {
  7761. i0 = i + templateY[k];
  7762. if (i0 >= 0) {
  7763. bit = bitmap[i0][j0];
  7764. if (bit) {
  7765. contextLabel |= bit << shift;
  7766. }
  7767. }
  7768. }
  7769. }
  7770. }
  7771. var pixel = decoder.readBit(contexts, contextLabel);
  7772. row[j] = pixel;
  7773. }
  7774. }
  7775. return bitmap;
  7776. }
  7777. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  7778. var codingTemplate = RefinementTemplates[templateIndex].coding;
  7779. if (templateIndex === 0) {
  7780. codingTemplate = codingTemplate.concat([at[0]]);
  7781. }
  7782. var codingTemplateLength = codingTemplate.length;
  7783. var codingTemplateX = new Int32Array(codingTemplateLength);
  7784. var codingTemplateY = new Int32Array(codingTemplateLength);
  7785. var k;
  7786. for (k = 0; k < codingTemplateLength; k++) {
  7787. codingTemplateX[k] = codingTemplate[k].x;
  7788. codingTemplateY[k] = codingTemplate[k].y;
  7789. }
  7790. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  7791. if (templateIndex === 0) {
  7792. referenceTemplate = referenceTemplate.concat([at[1]]);
  7793. }
  7794. var referenceTemplateLength = referenceTemplate.length;
  7795. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  7796. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  7797. for (k = 0; k < referenceTemplateLength; k++) {
  7798. referenceTemplateX[k] = referenceTemplate[k].x;
  7799. referenceTemplateY[k] = referenceTemplate[k].y;
  7800. }
  7801. var referenceWidth = referenceBitmap[0].length;
  7802. var referenceHeight = referenceBitmap.length;
  7803. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  7804. var bitmap = [];
  7805. var decoder = decodingContext.decoder;
  7806. var contexts = decodingContext.contextCache.getContexts("GR");
  7807. var ltp = 0;
  7808. for (var i = 0; i < height; i++) {
  7809. if (prediction) {
  7810. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  7811. ltp ^= sltp;
  7812. if (ltp) {
  7813. throw new Jbig2Error("prediction is not supported");
  7814. }
  7815. }
  7816. var row = new Uint8Array(width);
  7817. bitmap.push(row);
  7818. for (var j = 0; j < width; j++) {
  7819. var i0, j0;
  7820. var contextLabel = 0;
  7821. for (k = 0; k < codingTemplateLength; k++) {
  7822. i0 = i + codingTemplateY[k];
  7823. j0 = j + codingTemplateX[k];
  7824. if (i0 < 0 || j0 < 0 || j0 >= width) {
  7825. contextLabel <<= 1;
  7826. } else {
  7827. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  7828. }
  7829. }
  7830. for (k = 0; k < referenceTemplateLength; k++) {
  7831. i0 = i + referenceTemplateY[k] - offsetY;
  7832. j0 = j + referenceTemplateX[k] - offsetX;
  7833. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  7834. contextLabel <<= 1;
  7835. } else {
  7836. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  7837. }
  7838. }
  7839. var pixel = decoder.readBit(contexts, contextLabel);
  7840. row[j] = pixel;
  7841. }
  7842. }
  7843. return bitmap;
  7844. }
  7845. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  7846. if (huffman && refinement) {
  7847. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  7848. }
  7849. var newSymbols = [];
  7850. var currentHeight = 0;
  7851. var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  7852. var decoder = decodingContext.decoder;
  7853. var contextCache = decodingContext.contextCache;
  7854. let tableB1, symbolWidths;
  7855. if (huffman) {
  7856. tableB1 = getStandardTable(1);
  7857. symbolWidths = [];
  7858. symbolCodeLength = Math.max(symbolCodeLength, 1);
  7859. }
  7860. while (newSymbols.length < numberOfNewSymbols) {
  7861. var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  7862. currentHeight += deltaHeight;
  7863. let currentWidth = 0,
  7864. totalWidth = 0;
  7865. const firstSymbol = huffman ? symbolWidths.length : 0;
  7866. while (true) {
  7867. var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  7868. if (deltaWidth === null) {
  7869. break;
  7870. }
  7871. currentWidth += deltaWidth;
  7872. totalWidth += currentWidth;
  7873. var bitmap;
  7874. if (refinement) {
  7875. var numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  7876. if (numberOfInstances > 1) {
  7877. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  7878. } else {
  7879. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  7880. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  7881. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  7882. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  7883. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  7884. }
  7885. newSymbols.push(bitmap);
  7886. } else if (huffman) {
  7887. symbolWidths.push(currentWidth);
  7888. } else {
  7889. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  7890. newSymbols.push(bitmap);
  7891. }
  7892. }
  7893. if (huffman && !refinement) {
  7894. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  7895. huffmanInput.byteAlign();
  7896. let collectiveBitmap;
  7897. if (bitmapSize === 0) {
  7898. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  7899. } else {
  7900. const originalEnd = huffmanInput.end;
  7901. const bitmapEnd = huffmanInput.position + bitmapSize;
  7902. huffmanInput.end = bitmapEnd;
  7903. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  7904. huffmanInput.end = originalEnd;
  7905. huffmanInput.position = bitmapEnd;
  7906. }
  7907. const numberOfSymbolsDecoded = symbolWidths.length;
  7908. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  7909. newSymbols.push(collectiveBitmap);
  7910. } else {
  7911. let i,
  7912. y,
  7913. xMin = 0,
  7914. xMax,
  7915. bitmapWidth,
  7916. symbolBitmap;
  7917. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  7918. bitmapWidth = symbolWidths[i];
  7919. xMax = xMin + bitmapWidth;
  7920. symbolBitmap = [];
  7921. for (y = 0; y < currentHeight; y++) {
  7922. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  7923. }
  7924. newSymbols.push(symbolBitmap);
  7925. xMin = xMax;
  7926. }
  7927. }
  7928. }
  7929. }
  7930. var exportedSymbols = [];
  7931. var flags = [],
  7932. currentFlag = false;
  7933. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  7934. while (flags.length < totalSymbolsLength) {
  7935. var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  7936. while (runLength--) {
  7937. flags.push(currentFlag);
  7938. }
  7939. currentFlag = !currentFlag;
  7940. }
  7941. for (var i = 0, ii = symbols.length; i < ii; i++) {
  7942. if (flags[i]) {
  7943. exportedSymbols.push(symbols[i]);
  7944. }
  7945. }
  7946. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  7947. if (flags[i]) {
  7948. exportedSymbols.push(newSymbols[j]);
  7949. }
  7950. }
  7951. return exportedSymbols;
  7952. }
  7953. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  7954. if (huffman && refinement) {
  7955. throw new Jbig2Error("refinement with Huffman is not supported");
  7956. }
  7957. var bitmap = [];
  7958. var i, row;
  7959. for (i = 0; i < height; i++) {
  7960. row = new Uint8Array(width);
  7961. if (defaultPixelValue) {
  7962. for (var j = 0; j < width; j++) {
  7963. row[j] = defaultPixelValue;
  7964. }
  7965. }
  7966. bitmap.push(row);
  7967. }
  7968. var decoder = decodingContext.decoder;
  7969. var contextCache = decodingContext.contextCache;
  7970. var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  7971. var firstS = 0;
  7972. i = 0;
  7973. while (i < numberOfSymbolInstances) {
  7974. var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  7975. stripT += deltaT;
  7976. var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  7977. firstS += deltaFirstS;
  7978. var currentS = firstS;
  7979. do {
  7980. let currentT = 0;
  7981. if (stripSize > 1) {
  7982. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  7983. }
  7984. var t = stripSize * stripT + currentT;
  7985. var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  7986. var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  7987. var symbolBitmap = inputSymbols[symbolId];
  7988. var symbolWidth = symbolBitmap[0].length;
  7989. var symbolHeight = symbolBitmap.length;
  7990. if (applyRefinement) {
  7991. var rdw = decodeInteger(contextCache, "IARDW", decoder);
  7992. var rdh = decodeInteger(contextCache, "IARDH", decoder);
  7993. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  7994. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  7995. symbolWidth += rdw;
  7996. symbolHeight += rdh;
  7997. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  7998. }
  7999. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  8000. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  8001. var s2, t2, symbolRow;
  8002. if (transposed) {
  8003. for (s2 = 0; s2 < symbolHeight; s2++) {
  8004. row = bitmap[offsetS + s2];
  8005. if (!row) {
  8006. continue;
  8007. }
  8008. symbolRow = symbolBitmap[s2];
  8009. var maxWidth = Math.min(width - offsetT, symbolWidth);
  8010. switch (combinationOperator) {
  8011. case 0:
  8012. for (t2 = 0; t2 < maxWidth; t2++) {
  8013. row[offsetT + t2] |= symbolRow[t2];
  8014. }
  8015. break;
  8016. case 2:
  8017. for (t2 = 0; t2 < maxWidth; t2++) {
  8018. row[offsetT + t2] ^= symbolRow[t2];
  8019. }
  8020. break;
  8021. default:
  8022. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8023. }
  8024. }
  8025. currentS += symbolHeight - 1;
  8026. } else {
  8027. for (t2 = 0; t2 < symbolHeight; t2++) {
  8028. row = bitmap[offsetT + t2];
  8029. if (!row) {
  8030. continue;
  8031. }
  8032. symbolRow = symbolBitmap[t2];
  8033. switch (combinationOperator) {
  8034. case 0:
  8035. for (s2 = 0; s2 < symbolWidth; s2++) {
  8036. row[offsetS + s2] |= symbolRow[s2];
  8037. }
  8038. break;
  8039. case 2:
  8040. for (s2 = 0; s2 < symbolWidth; s2++) {
  8041. row[offsetS + s2] ^= symbolRow[s2];
  8042. }
  8043. break;
  8044. default:
  8045. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8046. }
  8047. }
  8048. currentS += symbolWidth - 1;
  8049. }
  8050. i++;
  8051. var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  8052. if (deltaS === null) {
  8053. break;
  8054. }
  8055. currentS += deltaS + dsOffset;
  8056. } while (true);
  8057. }
  8058. return bitmap;
  8059. }
  8060. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  8061. const at = [];
  8062. if (!mmr) {
  8063. at.push({
  8064. x: -patternWidth,
  8065. y: 0
  8066. });
  8067. if (template === 0) {
  8068. at.push({
  8069. x: -3,
  8070. y: -1
  8071. });
  8072. at.push({
  8073. x: 2,
  8074. y: -2
  8075. });
  8076. at.push({
  8077. x: -2,
  8078. y: -2
  8079. });
  8080. }
  8081. }
  8082. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  8083. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  8084. const patterns = [];
  8085. for (let i = 0; i <= maxPatternIndex; i++) {
  8086. const patternBitmap = [];
  8087. const xMin = patternWidth * i;
  8088. const xMax = xMin + patternWidth;
  8089. for (let y = 0; y < patternHeight; y++) {
  8090. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  8091. }
  8092. patterns.push(patternBitmap);
  8093. }
  8094. return patterns;
  8095. }
  8096. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  8097. const skip = null;
  8098. if (enableSkip) {
  8099. throw new Jbig2Error("skip is not supported");
  8100. }
  8101. if (combinationOperator !== 0) {
  8102. throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region");
  8103. }
  8104. const regionBitmap = [];
  8105. let i, j, row;
  8106. for (i = 0; i < regionHeight; i++) {
  8107. row = new Uint8Array(regionWidth);
  8108. if (defaultPixelValue) {
  8109. for (j = 0; j < regionWidth; j++) {
  8110. row[j] = defaultPixelValue;
  8111. }
  8112. }
  8113. regionBitmap.push(row);
  8114. }
  8115. const numberOfPatterns = patterns.length;
  8116. const pattern0 = patterns[0];
  8117. const patternWidth = pattern0[0].length,
  8118. patternHeight = pattern0.length;
  8119. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  8120. const at = [];
  8121. if (!mmr) {
  8122. at.push({
  8123. x: template <= 1 ? 3 : 2,
  8124. y: -1
  8125. });
  8126. if (template === 0) {
  8127. at.push({
  8128. x: -3,
  8129. y: -1
  8130. });
  8131. at.push({
  8132. x: 2,
  8133. y: -2
  8134. });
  8135. at.push({
  8136. x: -2,
  8137. y: -2
  8138. });
  8139. }
  8140. }
  8141. const grayScaleBitPlanes = [];
  8142. let mmrInput, bitmap;
  8143. if (mmr) {
  8144. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  8145. }
  8146. for (i = bitsPerValue - 1; i >= 0; i--) {
  8147. if (mmr) {
  8148. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  8149. } else {
  8150. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  8151. }
  8152. grayScaleBitPlanes[i] = bitmap;
  8153. }
  8154. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  8155. for (mg = 0; mg < gridHeight; mg++) {
  8156. for (ng = 0; ng < gridWidth; ng++) {
  8157. bit = 0;
  8158. patternIndex = 0;
  8159. for (j = bitsPerValue - 1; j >= 0; j--) {
  8160. bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
  8161. patternIndex |= bit << j;
  8162. }
  8163. patternBitmap = patterns[patternIndex];
  8164. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  8165. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  8166. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  8167. for (i = 0; i < patternHeight; i++) {
  8168. regionRow = regionBitmap[y + i];
  8169. patternRow = patternBitmap[i];
  8170. for (j = 0; j < patternWidth; j++) {
  8171. regionRow[x + j] |= patternRow[j];
  8172. }
  8173. }
  8174. } else {
  8175. let regionX, regionY;
  8176. for (i = 0; i < patternHeight; i++) {
  8177. regionY = y + i;
  8178. if (regionY < 0 || regionY >= regionHeight) {
  8179. continue;
  8180. }
  8181. regionRow = regionBitmap[regionY];
  8182. patternRow = patternBitmap[i];
  8183. for (j = 0; j < patternWidth; j++) {
  8184. regionX = x + j;
  8185. if (regionX >= 0 && regionX < regionWidth) {
  8186. regionRow[regionX] |= patternRow[j];
  8187. }
  8188. }
  8189. }
  8190. }
  8191. }
  8192. }
  8193. return regionBitmap;
  8194. }
  8195. function readSegmentHeader(data, start) {
  8196. var segmentHeader = {};
  8197. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  8198. var flags = data[start + 4];
  8199. var segmentType = flags & 0x3f;
  8200. if (!SegmentTypes[segmentType]) {
  8201. throw new Jbig2Error("invalid segment type: " + segmentType);
  8202. }
  8203. segmentHeader.type = segmentType;
  8204. segmentHeader.typeName = SegmentTypes[segmentType];
  8205. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  8206. var pageAssociationFieldSize = !!(flags & 0x40);
  8207. var referredFlags = data[start + 5];
  8208. var referredToCount = referredFlags >> 5 & 7;
  8209. var retainBits = [referredFlags & 31];
  8210. var position = start + 6;
  8211. if (referredFlags === 7) {
  8212. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  8213. position += 3;
  8214. var bytes = referredToCount + 7 >> 3;
  8215. retainBits[0] = data[position++];
  8216. while (--bytes > 0) {
  8217. retainBits.push(data[position++]);
  8218. }
  8219. } else if (referredFlags === 5 || referredFlags === 6) {
  8220. throw new Jbig2Error("invalid referred-to flags");
  8221. }
  8222. segmentHeader.retainBits = retainBits;
  8223. let referredToSegmentNumberSize = 4;
  8224. if (segmentHeader.number <= 256) {
  8225. referredToSegmentNumberSize = 1;
  8226. } else if (segmentHeader.number <= 65536) {
  8227. referredToSegmentNumberSize = 2;
  8228. }
  8229. var referredTo = [];
  8230. var i, ii;
  8231. for (i = 0; i < referredToCount; i++) {
  8232. let number;
  8233. if (referredToSegmentNumberSize === 1) {
  8234. number = data[position];
  8235. } else if (referredToSegmentNumberSize === 2) {
  8236. number = (0, _core_utils.readUint16)(data, position);
  8237. } else {
  8238. number = (0, _core_utils.readUint32)(data, position);
  8239. }
  8240. referredTo.push(number);
  8241. position += referredToSegmentNumberSize;
  8242. }
  8243. segmentHeader.referredTo = referredTo;
  8244. if (!pageAssociationFieldSize) {
  8245. segmentHeader.pageAssociation = data[position++];
  8246. } else {
  8247. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  8248. position += 4;
  8249. }
  8250. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  8251. position += 4;
  8252. if (segmentHeader.length === 0xffffffff) {
  8253. if (segmentType === 38) {
  8254. var genericRegionInfo = readRegionSegmentInformation(data, position);
  8255. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  8256. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  8257. var searchPatternLength = 6;
  8258. var searchPattern = new Uint8Array(searchPatternLength);
  8259. if (!genericRegionMmr) {
  8260. searchPattern[0] = 0xff;
  8261. searchPattern[1] = 0xac;
  8262. }
  8263. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  8264. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  8265. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  8266. searchPattern[5] = genericRegionInfo.height & 0xff;
  8267. for (i = position, ii = data.length; i < ii; i++) {
  8268. var j = 0;
  8269. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  8270. j++;
  8271. }
  8272. if (j === searchPatternLength) {
  8273. segmentHeader.length = i + searchPatternLength;
  8274. break;
  8275. }
  8276. }
  8277. if (segmentHeader.length === 0xffffffff) {
  8278. throw new Jbig2Error("segment end was not found");
  8279. }
  8280. } else {
  8281. throw new Jbig2Error("invalid unknown segment length");
  8282. }
  8283. }
  8284. segmentHeader.headerEnd = position;
  8285. return segmentHeader;
  8286. }
  8287. function readSegments(header, data, start, end) {
  8288. var segments = [];
  8289. var position = start;
  8290. while (position < end) {
  8291. var segmentHeader = readSegmentHeader(data, position);
  8292. position = segmentHeader.headerEnd;
  8293. var segment = {
  8294. header: segmentHeader,
  8295. data
  8296. };
  8297. if (!header.randomAccess) {
  8298. segment.start = position;
  8299. position += segmentHeader.length;
  8300. segment.end = position;
  8301. }
  8302. segments.push(segment);
  8303. if (segmentHeader.type === 51) {
  8304. break;
  8305. }
  8306. }
  8307. if (header.randomAccess) {
  8308. for (var i = 0, ii = segments.length; i < ii; i++) {
  8309. segments[i].start = position;
  8310. position += segments[i].header.length;
  8311. segments[i].end = position;
  8312. }
  8313. }
  8314. return segments;
  8315. }
  8316. function readRegionSegmentInformation(data, start) {
  8317. return {
  8318. width: (0, _core_utils.readUint32)(data, start),
  8319. height: (0, _core_utils.readUint32)(data, start + 4),
  8320. x: (0, _core_utils.readUint32)(data, start + 8),
  8321. y: (0, _core_utils.readUint32)(data, start + 12),
  8322. combinationOperator: data[start + 16] & 7
  8323. };
  8324. }
  8325. var RegionSegmentInformationFieldLength = 17;
  8326. function processSegment(segment, visitor) {
  8327. var header = segment.header;
  8328. var data = segment.data,
  8329. position = segment.start,
  8330. end = segment.end;
  8331. var args, at, i, atLength;
  8332. switch (header.type) {
  8333. case 0:
  8334. var dictionary = {};
  8335. var dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  8336. dictionary.huffman = !!(dictionaryFlags & 1);
  8337. dictionary.refinement = !!(dictionaryFlags & 2);
  8338. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  8339. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  8340. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  8341. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  8342. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  8343. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  8344. dictionary.template = dictionaryFlags >> 10 & 3;
  8345. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  8346. position += 2;
  8347. if (!dictionary.huffman) {
  8348. atLength = dictionary.template === 0 ? 4 : 1;
  8349. at = [];
  8350. for (i = 0; i < atLength; i++) {
  8351. at.push({
  8352. x: (0, _core_utils.readInt8)(data, position),
  8353. y: (0, _core_utils.readInt8)(data, position + 1)
  8354. });
  8355. position += 2;
  8356. }
  8357. dictionary.at = at;
  8358. }
  8359. if (dictionary.refinement && !dictionary.refinementTemplate) {
  8360. at = [];
  8361. for (i = 0; i < 2; i++) {
  8362. at.push({
  8363. x: (0, _core_utils.readInt8)(data, position),
  8364. y: (0, _core_utils.readInt8)(data, position + 1)
  8365. });
  8366. position += 2;
  8367. }
  8368. dictionary.refinementAt = at;
  8369. }
  8370. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  8371. position += 4;
  8372. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  8373. position += 4;
  8374. args = [dictionary, header.number, header.referredTo, data, position, end];
  8375. break;
  8376. case 6:
  8377. case 7:
  8378. var textRegion = {};
  8379. textRegion.info = readRegionSegmentInformation(data, position);
  8380. position += RegionSegmentInformationFieldLength;
  8381. var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  8382. position += 2;
  8383. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  8384. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  8385. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  8386. textRegion.stripSize = 1 << textRegion.logStripSize;
  8387. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  8388. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  8389. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  8390. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  8391. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  8392. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  8393. if (textRegion.huffman) {
  8394. var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  8395. position += 2;
  8396. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  8397. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  8398. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  8399. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  8400. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  8401. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  8402. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  8403. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  8404. }
  8405. if (textRegion.refinement && !textRegion.refinementTemplate) {
  8406. at = [];
  8407. for (i = 0; i < 2; i++) {
  8408. at.push({
  8409. x: (0, _core_utils.readInt8)(data, position),
  8410. y: (0, _core_utils.readInt8)(data, position + 1)
  8411. });
  8412. position += 2;
  8413. }
  8414. textRegion.refinementAt = at;
  8415. }
  8416. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  8417. position += 4;
  8418. args = [textRegion, header.referredTo, data, position, end];
  8419. break;
  8420. case 16:
  8421. const patternDictionary = {};
  8422. const patternDictionaryFlags = data[position++];
  8423. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  8424. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  8425. patternDictionary.patternWidth = data[position++];
  8426. patternDictionary.patternHeight = data[position++];
  8427. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  8428. position += 4;
  8429. args = [patternDictionary, header.number, data, position, end];
  8430. break;
  8431. case 22:
  8432. case 23:
  8433. const halftoneRegion = {};
  8434. halftoneRegion.info = readRegionSegmentInformation(data, position);
  8435. position += RegionSegmentInformationFieldLength;
  8436. const halftoneRegionFlags = data[position++];
  8437. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  8438. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  8439. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  8440. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  8441. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  8442. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  8443. position += 4;
  8444. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  8445. position += 4;
  8446. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  8447. position += 4;
  8448. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  8449. position += 4;
  8450. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  8451. position += 2;
  8452. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  8453. position += 2;
  8454. args = [halftoneRegion, header.referredTo, data, position, end];
  8455. break;
  8456. case 38:
  8457. case 39:
  8458. var genericRegion = {};
  8459. genericRegion.info = readRegionSegmentInformation(data, position);
  8460. position += RegionSegmentInformationFieldLength;
  8461. var genericRegionSegmentFlags = data[position++];
  8462. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  8463. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  8464. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  8465. if (!genericRegion.mmr) {
  8466. atLength = genericRegion.template === 0 ? 4 : 1;
  8467. at = [];
  8468. for (i = 0; i < atLength; i++) {
  8469. at.push({
  8470. x: (0, _core_utils.readInt8)(data, position),
  8471. y: (0, _core_utils.readInt8)(data, position + 1)
  8472. });
  8473. position += 2;
  8474. }
  8475. genericRegion.at = at;
  8476. }
  8477. args = [genericRegion, data, position, end];
  8478. break;
  8479. case 48:
  8480. var pageInfo = {
  8481. width: (0, _core_utils.readUint32)(data, position),
  8482. height: (0, _core_utils.readUint32)(data, position + 4),
  8483. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  8484. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  8485. };
  8486. if (pageInfo.height === 0xffffffff) {
  8487. delete pageInfo.height;
  8488. }
  8489. var pageSegmentFlags = data[position + 16];
  8490. (0, _core_utils.readUint16)(data, position + 17);
  8491. pageInfo.lossless = !!(pageSegmentFlags & 1);
  8492. pageInfo.refinement = !!(pageSegmentFlags & 2);
  8493. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  8494. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  8495. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  8496. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  8497. args = [pageInfo];
  8498. break;
  8499. case 49:
  8500. break;
  8501. case 50:
  8502. break;
  8503. case 51:
  8504. break;
  8505. case 53:
  8506. args = [header.number, data, position, end];
  8507. break;
  8508. case 62:
  8509. break;
  8510. default:
  8511. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  8512. }
  8513. var callbackName = "on" + header.typeName;
  8514. if (callbackName in visitor) {
  8515. visitor[callbackName].apply(visitor, args);
  8516. }
  8517. }
  8518. function processSegments(segments, visitor) {
  8519. for (var i = 0, ii = segments.length; i < ii; i++) {
  8520. processSegment(segments[i], visitor);
  8521. }
  8522. }
  8523. function parseJbig2Chunks(chunks) {
  8524. var visitor = new SimpleSegmentVisitor();
  8525. for (var i = 0, ii = chunks.length; i < ii; i++) {
  8526. var chunk = chunks[i];
  8527. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  8528. processSegments(segments, visitor);
  8529. }
  8530. return visitor.buffer;
  8531. }
  8532. function parseJbig2(data) {
  8533. const end = data.length;
  8534. let position = 0;
  8535. 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) {
  8536. throw new Jbig2Error("parseJbig2 - invalid header.");
  8537. }
  8538. const header = Object.create(null);
  8539. position += 8;
  8540. const flags = data[position++];
  8541. header.randomAccess = !(flags & 1);
  8542. if (!(flags & 2)) {
  8543. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  8544. position += 4;
  8545. }
  8546. const segments = readSegments(header, data, position, end);
  8547. const visitor = new SimpleSegmentVisitor();
  8548. processSegments(segments, visitor);
  8549. const {
  8550. width,
  8551. height
  8552. } = visitor.currentPageInfo;
  8553. const bitPacked = visitor.buffer;
  8554. const imgData = new Uint8ClampedArray(width * height);
  8555. let q = 0,
  8556. k = 0;
  8557. for (let i = 0; i < height; i++) {
  8558. let mask = 0,
  8559. buffer;
  8560. for (let j = 0; j < width; j++) {
  8561. if (!mask) {
  8562. mask = 128;
  8563. buffer = bitPacked[k++];
  8564. }
  8565. imgData[q++] = buffer & mask ? 0 : 255;
  8566. mask >>= 1;
  8567. }
  8568. }
  8569. return {
  8570. imgData,
  8571. width,
  8572. height
  8573. };
  8574. }
  8575. function SimpleSegmentVisitor() {}
  8576. SimpleSegmentVisitor.prototype = {
  8577. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  8578. this.currentPageInfo = info;
  8579. var rowSize = info.width + 7 >> 3;
  8580. var buffer = new Uint8ClampedArray(rowSize * info.height);
  8581. if (info.defaultPixelValue) {
  8582. for (var i = 0, ii = buffer.length; i < ii; i++) {
  8583. buffer[i] = 0xff;
  8584. }
  8585. }
  8586. this.buffer = buffer;
  8587. },
  8588. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  8589. var pageInfo = this.currentPageInfo;
  8590. var width = regionInfo.width,
  8591. height = regionInfo.height;
  8592. var rowSize = pageInfo.width + 7 >> 3;
  8593. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  8594. var buffer = this.buffer;
  8595. var mask0 = 128 >> (regionInfo.x & 7);
  8596. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  8597. var i, j, mask, offset;
  8598. switch (combinationOperator) {
  8599. case 0:
  8600. for (i = 0; i < height; i++) {
  8601. mask = mask0;
  8602. offset = offset0;
  8603. for (j = 0; j < width; j++) {
  8604. if (bitmap[i][j]) {
  8605. buffer[offset] |= mask;
  8606. }
  8607. mask >>= 1;
  8608. if (!mask) {
  8609. mask = 128;
  8610. offset++;
  8611. }
  8612. }
  8613. offset0 += rowSize;
  8614. }
  8615. break;
  8616. case 2:
  8617. for (i = 0; i < height; i++) {
  8618. mask = mask0;
  8619. offset = offset0;
  8620. for (j = 0; j < width; j++) {
  8621. if (bitmap[i][j]) {
  8622. buffer[offset] ^= mask;
  8623. }
  8624. mask >>= 1;
  8625. if (!mask) {
  8626. mask = 128;
  8627. offset++;
  8628. }
  8629. }
  8630. offset0 += rowSize;
  8631. }
  8632. break;
  8633. default:
  8634. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8635. }
  8636. },
  8637. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  8638. var regionInfo = region.info;
  8639. var decodingContext = new DecodingContext(data, start, end);
  8640. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  8641. this.drawBitmap(regionInfo, bitmap);
  8642. },
  8643. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  8644. this.onImmediateGenericRegion.apply(this, arguments);
  8645. },
  8646. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  8647. let huffmanTables, huffmanInput;
  8648. if (dictionary.huffman) {
  8649. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  8650. huffmanInput = new Reader(data, start, end);
  8651. }
  8652. var symbols = this.symbols;
  8653. if (!symbols) {
  8654. this.symbols = symbols = {};
  8655. }
  8656. var inputSymbols = [];
  8657. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  8658. const referredSymbols = symbols[referredSegments[i]];
  8659. if (referredSymbols) {
  8660. inputSymbols = inputSymbols.concat(referredSymbols);
  8661. }
  8662. }
  8663. var decodingContext = new DecodingContext(data, start, end);
  8664. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  8665. },
  8666. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  8667. var regionInfo = region.info;
  8668. let huffmanTables, huffmanInput;
  8669. var symbols = this.symbols;
  8670. var inputSymbols = [];
  8671. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  8672. const referredSymbols = symbols[referredSegments[i]];
  8673. if (referredSymbols) {
  8674. inputSymbols = inputSymbols.concat(referredSymbols);
  8675. }
  8676. }
  8677. var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  8678. if (region.huffman) {
  8679. huffmanInput = new Reader(data, start, end);
  8680. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  8681. }
  8682. var decodingContext = new DecodingContext(data, start, end);
  8683. var 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);
  8684. this.drawBitmap(regionInfo, bitmap);
  8685. },
  8686. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  8687. this.onImmediateTextRegion.apply(this, arguments);
  8688. },
  8689. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  8690. let patterns = this.patterns;
  8691. if (!patterns) {
  8692. this.patterns = patterns = {};
  8693. }
  8694. const decodingContext = new DecodingContext(data, start, end);
  8695. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  8696. },
  8697. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  8698. const patterns = this.patterns[referredSegments[0]];
  8699. const regionInfo = region.info;
  8700. const decodingContext = new DecodingContext(data, start, end);
  8701. 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);
  8702. this.drawBitmap(regionInfo, bitmap);
  8703. },
  8704. onImmediateLosslessHalftoneRegion() {
  8705. this.onImmediateHalftoneRegion.apply(this, arguments);
  8706. },
  8707. onTables(currentSegment, data, start, end) {
  8708. let customTables = this.customTables;
  8709. if (!customTables) {
  8710. this.customTables = customTables = {};
  8711. }
  8712. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  8713. }
  8714. };
  8715. function HuffmanLine(lineData) {
  8716. if (lineData.length === 2) {
  8717. this.isOOB = true;
  8718. this.rangeLow = 0;
  8719. this.prefixLength = lineData[0];
  8720. this.rangeLength = 0;
  8721. this.prefixCode = lineData[1];
  8722. this.isLowerRange = false;
  8723. } else {
  8724. this.isOOB = false;
  8725. this.rangeLow = lineData[0];
  8726. this.prefixLength = lineData[1];
  8727. this.rangeLength = lineData[2];
  8728. this.prefixCode = lineData[3];
  8729. this.isLowerRange = lineData[4] === "lower";
  8730. }
  8731. }
  8732. function HuffmanTreeNode(line) {
  8733. this.children = [];
  8734. if (line) {
  8735. this.isLeaf = true;
  8736. this.rangeLength = line.rangeLength;
  8737. this.rangeLow = line.rangeLow;
  8738. this.isLowerRange = line.isLowerRange;
  8739. this.isOOB = line.isOOB;
  8740. } else {
  8741. this.isLeaf = false;
  8742. }
  8743. }
  8744. HuffmanTreeNode.prototype = {
  8745. buildTree(line, shift) {
  8746. const bit = line.prefixCode >> shift & 1;
  8747. if (shift <= 0) {
  8748. this.children[bit] = new HuffmanTreeNode(line);
  8749. } else {
  8750. let node = this.children[bit];
  8751. if (!node) {
  8752. this.children[bit] = node = new HuffmanTreeNode(null);
  8753. }
  8754. node.buildTree(line, shift - 1);
  8755. }
  8756. },
  8757. decodeNode(reader) {
  8758. if (this.isLeaf) {
  8759. if (this.isOOB) {
  8760. return null;
  8761. }
  8762. const htOffset = reader.readBits(this.rangeLength);
  8763. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  8764. }
  8765. const node = this.children[reader.readBit()];
  8766. if (!node) {
  8767. throw new Jbig2Error("invalid Huffman data");
  8768. }
  8769. return node.decodeNode(reader);
  8770. }
  8771. };
  8772. function HuffmanTable(lines, prefixCodesDone) {
  8773. if (!prefixCodesDone) {
  8774. this.assignPrefixCodes(lines);
  8775. }
  8776. this.rootNode = new HuffmanTreeNode(null);
  8777. for (let i = 0, ii = lines.length; i < ii; i++) {
  8778. const line = lines[i];
  8779. if (line.prefixLength > 0) {
  8780. this.rootNode.buildTree(line, line.prefixLength - 1);
  8781. }
  8782. }
  8783. }
  8784. HuffmanTable.prototype = {
  8785. decode(reader) {
  8786. return this.rootNode.decodeNode(reader);
  8787. },
  8788. assignPrefixCodes(lines) {
  8789. const linesLength = lines.length;
  8790. let prefixLengthMax = 0;
  8791. for (let i = 0; i < linesLength; i++) {
  8792. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  8793. }
  8794. const histogram = new Uint32Array(prefixLengthMax + 1);
  8795. for (let i = 0; i < linesLength; i++) {
  8796. histogram[lines[i].prefixLength]++;
  8797. }
  8798. let currentLength = 1,
  8799. firstCode = 0,
  8800. currentCode,
  8801. currentTemp,
  8802. line;
  8803. histogram[0] = 0;
  8804. while (currentLength <= prefixLengthMax) {
  8805. firstCode = firstCode + histogram[currentLength - 1] << 1;
  8806. currentCode = firstCode;
  8807. currentTemp = 0;
  8808. while (currentTemp < linesLength) {
  8809. line = lines[currentTemp];
  8810. if (line.prefixLength === currentLength) {
  8811. line.prefixCode = currentCode;
  8812. currentCode++;
  8813. }
  8814. currentTemp++;
  8815. }
  8816. currentLength++;
  8817. }
  8818. }
  8819. };
  8820. function decodeTablesSegment(data, start, end) {
  8821. const flags = data[start];
  8822. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  8823. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  8824. const reader = new Reader(data, start + 9, end);
  8825. const prefixSizeBits = (flags >> 1 & 7) + 1;
  8826. const rangeSizeBits = (flags >> 4 & 7) + 1;
  8827. const lines = [];
  8828. let prefixLength,
  8829. rangeLength,
  8830. currentRangeLow = lowestValue;
  8831. do {
  8832. prefixLength = reader.readBits(prefixSizeBits);
  8833. rangeLength = reader.readBits(rangeSizeBits);
  8834. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  8835. currentRangeLow += 1 << rangeLength;
  8836. } while (currentRangeLow < highestValue);
  8837. prefixLength = reader.readBits(prefixSizeBits);
  8838. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  8839. prefixLength = reader.readBits(prefixSizeBits);
  8840. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  8841. if (flags & 1) {
  8842. prefixLength = reader.readBits(prefixSizeBits);
  8843. lines.push(new HuffmanLine([prefixLength, 0]));
  8844. }
  8845. return new HuffmanTable(lines, false);
  8846. }
  8847. const standardTablesCache = {};
  8848. function getStandardTable(number) {
  8849. let table = standardTablesCache[number];
  8850. if (table) {
  8851. return table;
  8852. }
  8853. let lines;
  8854. switch (number) {
  8855. case 1:
  8856. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  8857. break;
  8858. case 2:
  8859. 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]];
  8860. break;
  8861. case 3:
  8862. 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]];
  8863. break;
  8864. case 4:
  8865. 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]];
  8866. break;
  8867. case 5:
  8868. 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]];
  8869. break;
  8870. case 6:
  8871. 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]];
  8872. break;
  8873. case 7:
  8874. 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]];
  8875. break;
  8876. case 8:
  8877. 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]];
  8878. break;
  8879. case 9:
  8880. 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]];
  8881. break;
  8882. case 10:
  8883. 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]];
  8884. break;
  8885. case 11:
  8886. 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]];
  8887. break;
  8888. case 12:
  8889. 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]];
  8890. break;
  8891. case 13:
  8892. 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]];
  8893. break;
  8894. case 14:
  8895. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  8896. break;
  8897. case 15:
  8898. 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]];
  8899. break;
  8900. default:
  8901. throw new Jbig2Error(`standard table B.${number} does not exist`);
  8902. }
  8903. for (let i = 0, ii = lines.length; i < ii; i++) {
  8904. lines[i] = new HuffmanLine(lines[i]);
  8905. }
  8906. table = new HuffmanTable(lines, true);
  8907. standardTablesCache[number] = table;
  8908. return table;
  8909. }
  8910. function Reader(data, start, end) {
  8911. this.data = data;
  8912. this.start = start;
  8913. this.end = end;
  8914. this.position = start;
  8915. this.shift = -1;
  8916. this.currentByte = 0;
  8917. }
  8918. Reader.prototype = {
  8919. readBit() {
  8920. if (this.shift < 0) {
  8921. if (this.position >= this.end) {
  8922. throw new Jbig2Error("end of data while reading bit");
  8923. }
  8924. this.currentByte = this.data[this.position++];
  8925. this.shift = 7;
  8926. }
  8927. const bit = this.currentByte >> this.shift & 1;
  8928. this.shift--;
  8929. return bit;
  8930. },
  8931. readBits(numBits) {
  8932. let result = 0,
  8933. i;
  8934. for (i = numBits - 1; i >= 0; i--) {
  8935. result |= this.readBit() << i;
  8936. }
  8937. return result;
  8938. },
  8939. byteAlign() {
  8940. this.shift = -1;
  8941. },
  8942. next() {
  8943. if (this.position >= this.end) {
  8944. return -1;
  8945. }
  8946. return this.data[this.position++];
  8947. }
  8948. };
  8949. function getCustomHuffmanTable(index, referredTo, customTables) {
  8950. let currentIndex = 0;
  8951. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  8952. const table = customTables[referredTo[i]];
  8953. if (table) {
  8954. if (index === currentIndex) {
  8955. return table;
  8956. }
  8957. currentIndex++;
  8958. }
  8959. }
  8960. throw new Jbig2Error("can't find custom Huffman table");
  8961. }
  8962. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  8963. const codes = [];
  8964. for (let i = 0; i <= 34; i++) {
  8965. const codeLength = reader.readBits(4);
  8966. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  8967. }
  8968. const runCodesTable = new HuffmanTable(codes, false);
  8969. codes.length = 0;
  8970. for (let i = 0; i < numberOfSymbols;) {
  8971. const codeLength = runCodesTable.decode(reader);
  8972. if (codeLength >= 32) {
  8973. let repeatedLength, numberOfRepeats, j;
  8974. switch (codeLength) {
  8975. case 32:
  8976. if (i === 0) {
  8977. throw new Jbig2Error("no previous value in symbol ID table");
  8978. }
  8979. numberOfRepeats = reader.readBits(2) + 3;
  8980. repeatedLength = codes[i - 1].prefixLength;
  8981. break;
  8982. case 33:
  8983. numberOfRepeats = reader.readBits(3) + 3;
  8984. repeatedLength = 0;
  8985. break;
  8986. case 34:
  8987. numberOfRepeats = reader.readBits(7) + 11;
  8988. repeatedLength = 0;
  8989. break;
  8990. default:
  8991. throw new Jbig2Error("invalid code length in symbol ID table");
  8992. }
  8993. for (j = 0; j < numberOfRepeats; j++) {
  8994. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  8995. i++;
  8996. }
  8997. } else {
  8998. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  8999. i++;
  9000. }
  9001. }
  9002. reader.byteAlign();
  9003. const symbolIDTable = new HuffmanTable(codes, false);
  9004. let customIndex = 0,
  9005. tableFirstS,
  9006. tableDeltaS,
  9007. tableDeltaT;
  9008. switch (textRegion.huffmanFS) {
  9009. case 0:
  9010. case 1:
  9011. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  9012. break;
  9013. case 3:
  9014. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9015. customIndex++;
  9016. break;
  9017. default:
  9018. throw new Jbig2Error("invalid Huffman FS selector");
  9019. }
  9020. switch (textRegion.huffmanDS) {
  9021. case 0:
  9022. case 1:
  9023. case 2:
  9024. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  9025. break;
  9026. case 3:
  9027. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9028. customIndex++;
  9029. break;
  9030. default:
  9031. throw new Jbig2Error("invalid Huffman DS selector");
  9032. }
  9033. switch (textRegion.huffmanDT) {
  9034. case 0:
  9035. case 1:
  9036. case 2:
  9037. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  9038. break;
  9039. case 3:
  9040. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9041. customIndex++;
  9042. break;
  9043. default:
  9044. throw new Jbig2Error("invalid Huffman DT selector");
  9045. }
  9046. if (textRegion.refinement) {
  9047. throw new Jbig2Error("refinement with Huffman is not supported");
  9048. }
  9049. return {
  9050. symbolIDTable,
  9051. tableFirstS,
  9052. tableDeltaS,
  9053. tableDeltaT
  9054. };
  9055. }
  9056. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  9057. let customIndex = 0,
  9058. tableDeltaHeight,
  9059. tableDeltaWidth;
  9060. switch (dictionary.huffmanDHSelector) {
  9061. case 0:
  9062. case 1:
  9063. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  9064. break;
  9065. case 3:
  9066. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9067. customIndex++;
  9068. break;
  9069. default:
  9070. throw new Jbig2Error("invalid Huffman DH selector");
  9071. }
  9072. switch (dictionary.huffmanDWSelector) {
  9073. case 0:
  9074. case 1:
  9075. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  9076. break;
  9077. case 3:
  9078. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9079. customIndex++;
  9080. break;
  9081. default:
  9082. throw new Jbig2Error("invalid Huffman DW selector");
  9083. }
  9084. let tableBitmapSize, tableAggregateInstances;
  9085. if (dictionary.bitmapSizeSelector) {
  9086. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9087. customIndex++;
  9088. } else {
  9089. tableBitmapSize = getStandardTable(1);
  9090. }
  9091. if (dictionary.aggregationInstancesSelector) {
  9092. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9093. } else {
  9094. tableAggregateInstances = getStandardTable(1);
  9095. }
  9096. return {
  9097. tableDeltaHeight,
  9098. tableDeltaWidth,
  9099. tableBitmapSize,
  9100. tableAggregateInstances
  9101. };
  9102. }
  9103. function readUncompressedBitmap(reader, width, height) {
  9104. const bitmap = [];
  9105. for (let y = 0; y < height; y++) {
  9106. const row = new Uint8Array(width);
  9107. bitmap.push(row);
  9108. for (let x = 0; x < width; x++) {
  9109. row[x] = reader.readBit();
  9110. }
  9111. reader.byteAlign();
  9112. }
  9113. return bitmap;
  9114. }
  9115. function decodeMMRBitmap(input, width, height, endOfBlock) {
  9116. const params = {
  9117. K: -1,
  9118. Columns: width,
  9119. Rows: height,
  9120. BlackIs1: true,
  9121. EndOfBlock: endOfBlock
  9122. };
  9123. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  9124. const bitmap = [];
  9125. let currentByte,
  9126. eof = false;
  9127. for (let y = 0; y < height; y++) {
  9128. const row = new Uint8Array(width);
  9129. bitmap.push(row);
  9130. let shift = -1;
  9131. for (let x = 0; x < width; x++) {
  9132. if (shift < 0) {
  9133. currentByte = decoder.readNextChar();
  9134. if (currentByte === -1) {
  9135. currentByte = 0;
  9136. eof = true;
  9137. }
  9138. shift = 7;
  9139. }
  9140. row[x] = currentByte >> shift & 1;
  9141. shift--;
  9142. }
  9143. }
  9144. if (endOfBlock && !eof) {
  9145. const lookForEOFLimit = 5;
  9146. for (let i = 0; i < lookForEOFLimit; i++) {
  9147. if (decoder.readNextChar() === -1) {
  9148. break;
  9149. }
  9150. }
  9151. }
  9152. return bitmap;
  9153. }
  9154. function Jbig2Image() {}
  9155. Jbig2Image.prototype = {
  9156. parseChunks(chunks) {
  9157. return parseJbig2Chunks(chunks);
  9158. },
  9159. parse(data) {
  9160. const {
  9161. imgData,
  9162. width,
  9163. height
  9164. } = parseJbig2(data);
  9165. this.width = width;
  9166. this.height = height;
  9167. return imgData;
  9168. }
  9169. };
  9170. return Jbig2Image;
  9171. }();
  9172. exports.Jbig2Image = Jbig2Image;
  9173. /***/ }),
  9174. /* 17 */
  9175. /***/ (function(module, exports, __w_pdfjs_require__) {
  9176. "use strict";
  9177. Object.defineProperty(exports, "__esModule", {
  9178. value: true
  9179. });
  9180. exports.ArithmeticDecoder = void 0;
  9181. const QeTable = [{
  9182. qe: 0x5601,
  9183. nmps: 1,
  9184. nlps: 1,
  9185. switchFlag: 1
  9186. }, {
  9187. qe: 0x3401,
  9188. nmps: 2,
  9189. nlps: 6,
  9190. switchFlag: 0
  9191. }, {
  9192. qe: 0x1801,
  9193. nmps: 3,
  9194. nlps: 9,
  9195. switchFlag: 0
  9196. }, {
  9197. qe: 0x0ac1,
  9198. nmps: 4,
  9199. nlps: 12,
  9200. switchFlag: 0
  9201. }, {
  9202. qe: 0x0521,
  9203. nmps: 5,
  9204. nlps: 29,
  9205. switchFlag: 0
  9206. }, {
  9207. qe: 0x0221,
  9208. nmps: 38,
  9209. nlps: 33,
  9210. switchFlag: 0
  9211. }, {
  9212. qe: 0x5601,
  9213. nmps: 7,
  9214. nlps: 6,
  9215. switchFlag: 1
  9216. }, {
  9217. qe: 0x5401,
  9218. nmps: 8,
  9219. nlps: 14,
  9220. switchFlag: 0
  9221. }, {
  9222. qe: 0x4801,
  9223. nmps: 9,
  9224. nlps: 14,
  9225. switchFlag: 0
  9226. }, {
  9227. qe: 0x3801,
  9228. nmps: 10,
  9229. nlps: 14,
  9230. switchFlag: 0
  9231. }, {
  9232. qe: 0x3001,
  9233. nmps: 11,
  9234. nlps: 17,
  9235. switchFlag: 0
  9236. }, {
  9237. qe: 0x2401,
  9238. nmps: 12,
  9239. nlps: 18,
  9240. switchFlag: 0
  9241. }, {
  9242. qe: 0x1c01,
  9243. nmps: 13,
  9244. nlps: 20,
  9245. switchFlag: 0
  9246. }, {
  9247. qe: 0x1601,
  9248. nmps: 29,
  9249. nlps: 21,
  9250. switchFlag: 0
  9251. }, {
  9252. qe: 0x5601,
  9253. nmps: 15,
  9254. nlps: 14,
  9255. switchFlag: 1
  9256. }, {
  9257. qe: 0x5401,
  9258. nmps: 16,
  9259. nlps: 14,
  9260. switchFlag: 0
  9261. }, {
  9262. qe: 0x5101,
  9263. nmps: 17,
  9264. nlps: 15,
  9265. switchFlag: 0
  9266. }, {
  9267. qe: 0x4801,
  9268. nmps: 18,
  9269. nlps: 16,
  9270. switchFlag: 0
  9271. }, {
  9272. qe: 0x3801,
  9273. nmps: 19,
  9274. nlps: 17,
  9275. switchFlag: 0
  9276. }, {
  9277. qe: 0x3401,
  9278. nmps: 20,
  9279. nlps: 18,
  9280. switchFlag: 0
  9281. }, {
  9282. qe: 0x3001,
  9283. nmps: 21,
  9284. nlps: 19,
  9285. switchFlag: 0
  9286. }, {
  9287. qe: 0x2801,
  9288. nmps: 22,
  9289. nlps: 19,
  9290. switchFlag: 0
  9291. }, {
  9292. qe: 0x2401,
  9293. nmps: 23,
  9294. nlps: 20,
  9295. switchFlag: 0
  9296. }, {
  9297. qe: 0x2201,
  9298. nmps: 24,
  9299. nlps: 21,
  9300. switchFlag: 0
  9301. }, {
  9302. qe: 0x1c01,
  9303. nmps: 25,
  9304. nlps: 22,
  9305. switchFlag: 0
  9306. }, {
  9307. qe: 0x1801,
  9308. nmps: 26,
  9309. nlps: 23,
  9310. switchFlag: 0
  9311. }, {
  9312. qe: 0x1601,
  9313. nmps: 27,
  9314. nlps: 24,
  9315. switchFlag: 0
  9316. }, {
  9317. qe: 0x1401,
  9318. nmps: 28,
  9319. nlps: 25,
  9320. switchFlag: 0
  9321. }, {
  9322. qe: 0x1201,
  9323. nmps: 29,
  9324. nlps: 26,
  9325. switchFlag: 0
  9326. }, {
  9327. qe: 0x1101,
  9328. nmps: 30,
  9329. nlps: 27,
  9330. switchFlag: 0
  9331. }, {
  9332. qe: 0x0ac1,
  9333. nmps: 31,
  9334. nlps: 28,
  9335. switchFlag: 0
  9336. }, {
  9337. qe: 0x09c1,
  9338. nmps: 32,
  9339. nlps: 29,
  9340. switchFlag: 0
  9341. }, {
  9342. qe: 0x08a1,
  9343. nmps: 33,
  9344. nlps: 30,
  9345. switchFlag: 0
  9346. }, {
  9347. qe: 0x0521,
  9348. nmps: 34,
  9349. nlps: 31,
  9350. switchFlag: 0
  9351. }, {
  9352. qe: 0x0441,
  9353. nmps: 35,
  9354. nlps: 32,
  9355. switchFlag: 0
  9356. }, {
  9357. qe: 0x02a1,
  9358. nmps: 36,
  9359. nlps: 33,
  9360. switchFlag: 0
  9361. }, {
  9362. qe: 0x0221,
  9363. nmps: 37,
  9364. nlps: 34,
  9365. switchFlag: 0
  9366. }, {
  9367. qe: 0x0141,
  9368. nmps: 38,
  9369. nlps: 35,
  9370. switchFlag: 0
  9371. }, {
  9372. qe: 0x0111,
  9373. nmps: 39,
  9374. nlps: 36,
  9375. switchFlag: 0
  9376. }, {
  9377. qe: 0x0085,
  9378. nmps: 40,
  9379. nlps: 37,
  9380. switchFlag: 0
  9381. }, {
  9382. qe: 0x0049,
  9383. nmps: 41,
  9384. nlps: 38,
  9385. switchFlag: 0
  9386. }, {
  9387. qe: 0x0025,
  9388. nmps: 42,
  9389. nlps: 39,
  9390. switchFlag: 0
  9391. }, {
  9392. qe: 0x0015,
  9393. nmps: 43,
  9394. nlps: 40,
  9395. switchFlag: 0
  9396. }, {
  9397. qe: 0x0009,
  9398. nmps: 44,
  9399. nlps: 41,
  9400. switchFlag: 0
  9401. }, {
  9402. qe: 0x0005,
  9403. nmps: 45,
  9404. nlps: 42,
  9405. switchFlag: 0
  9406. }, {
  9407. qe: 0x0001,
  9408. nmps: 45,
  9409. nlps: 43,
  9410. switchFlag: 0
  9411. }, {
  9412. qe: 0x5601,
  9413. nmps: 46,
  9414. nlps: 46,
  9415. switchFlag: 0
  9416. }];
  9417. class ArithmeticDecoder {
  9418. constructor(data, start, end) {
  9419. this.data = data;
  9420. this.bp = start;
  9421. this.dataEnd = end;
  9422. this.chigh = data[start];
  9423. this.clow = 0;
  9424. this.byteIn();
  9425. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  9426. this.clow = this.clow << 7 & 0xffff;
  9427. this.ct -= 7;
  9428. this.a = 0x8000;
  9429. }
  9430. byteIn() {
  9431. const data = this.data;
  9432. let bp = this.bp;
  9433. if (data[bp] === 0xff) {
  9434. if (data[bp + 1] > 0x8f) {
  9435. this.clow += 0xff00;
  9436. this.ct = 8;
  9437. } else {
  9438. bp++;
  9439. this.clow += data[bp] << 9;
  9440. this.ct = 7;
  9441. this.bp = bp;
  9442. }
  9443. } else {
  9444. bp++;
  9445. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  9446. this.ct = 8;
  9447. this.bp = bp;
  9448. }
  9449. if (this.clow > 0xffff) {
  9450. this.chigh += this.clow >> 16;
  9451. this.clow &= 0xffff;
  9452. }
  9453. }
  9454. readBit(contexts, pos) {
  9455. let cx_index = contexts[pos] >> 1,
  9456. cx_mps = contexts[pos] & 1;
  9457. const qeTableIcx = QeTable[cx_index];
  9458. const qeIcx = qeTableIcx.qe;
  9459. let d;
  9460. let a = this.a - qeIcx;
  9461. if (this.chigh < qeIcx) {
  9462. if (a < qeIcx) {
  9463. a = qeIcx;
  9464. d = cx_mps;
  9465. cx_index = qeTableIcx.nmps;
  9466. } else {
  9467. a = qeIcx;
  9468. d = 1 ^ cx_mps;
  9469. if (qeTableIcx.switchFlag === 1) {
  9470. cx_mps = d;
  9471. }
  9472. cx_index = qeTableIcx.nlps;
  9473. }
  9474. } else {
  9475. this.chigh -= qeIcx;
  9476. if ((a & 0x8000) !== 0) {
  9477. this.a = a;
  9478. return cx_mps;
  9479. }
  9480. if (a < qeIcx) {
  9481. d = 1 ^ cx_mps;
  9482. if (qeTableIcx.switchFlag === 1) {
  9483. cx_mps = d;
  9484. }
  9485. cx_index = qeTableIcx.nlps;
  9486. } else {
  9487. d = cx_mps;
  9488. cx_index = qeTableIcx.nmps;
  9489. }
  9490. }
  9491. do {
  9492. if (this.ct === 0) {
  9493. this.byteIn();
  9494. }
  9495. a <<= 1;
  9496. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  9497. this.clow = this.clow << 1 & 0xffff;
  9498. this.ct--;
  9499. } while ((a & 0x8000) === 0);
  9500. this.a = a;
  9501. contexts[pos] = cx_index << 1 | cx_mps;
  9502. return d;
  9503. }
  9504. }
  9505. exports.ArithmeticDecoder = ArithmeticDecoder;
  9506. /***/ }),
  9507. /* 18 */
  9508. /***/ (function(module, exports, __w_pdfjs_require__) {
  9509. "use strict";
  9510. Object.defineProperty(exports, "__esModule", {
  9511. value: true
  9512. });
  9513. exports.JpegStream = void 0;
  9514. var _stream = __w_pdfjs_require__(12);
  9515. var _primitives = __w_pdfjs_require__(5);
  9516. var _jpg = __w_pdfjs_require__(19);
  9517. var _util = __w_pdfjs_require__(2);
  9518. const JpegStream = function JpegStreamClosure() {
  9519. function JpegStream(stream, maybeLength, dict, params) {
  9520. let ch;
  9521. while ((ch = stream.getByte()) !== -1) {
  9522. if (ch === 0xff) {
  9523. stream.skip(-1);
  9524. break;
  9525. }
  9526. }
  9527. this.stream = stream;
  9528. this.maybeLength = maybeLength;
  9529. this.dict = dict;
  9530. this.params = params;
  9531. _stream.DecodeStream.call(this, maybeLength);
  9532. }
  9533. JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);
  9534. Object.defineProperty(JpegStream.prototype, "bytes", {
  9535. get: function JpegStream_bytes() {
  9536. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  9537. },
  9538. configurable: true
  9539. });
  9540. JpegStream.prototype.ensureBuffer = function (requested) {};
  9541. JpegStream.prototype.readBlock = function () {
  9542. if (this.eof) {
  9543. return;
  9544. }
  9545. const jpegOptions = {
  9546. decodeTransform: undefined,
  9547. colorTransform: undefined
  9548. };
  9549. const decodeArr = this.dict.getArray("Decode", "D");
  9550. if (this.forceRGB && Array.isArray(decodeArr)) {
  9551. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  9552. const decodeArrLength = decodeArr.length;
  9553. const transform = new Int32Array(decodeArrLength);
  9554. let transformNeeded = false;
  9555. const maxValue = (1 << bitsPerComponent) - 1;
  9556. for (let i = 0; i < decodeArrLength; i += 2) {
  9557. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  9558. transform[i + 1] = decodeArr[i] * maxValue | 0;
  9559. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  9560. transformNeeded = true;
  9561. }
  9562. }
  9563. if (transformNeeded) {
  9564. jpegOptions.decodeTransform = transform;
  9565. }
  9566. }
  9567. if ((0, _primitives.isDict)(this.params)) {
  9568. const colorTransform = this.params.get("ColorTransform");
  9569. if (Number.isInteger(colorTransform)) {
  9570. jpegOptions.colorTransform = colorTransform;
  9571. }
  9572. }
  9573. const jpegImage = new _jpg.JpegImage(jpegOptions);
  9574. jpegImage.parse(this.bytes);
  9575. const data = jpegImage.getData({
  9576. width: this.drawWidth,
  9577. height: this.drawHeight,
  9578. forceRGB: this.forceRGB,
  9579. isSourcePDF: true
  9580. });
  9581. this.buffer = data;
  9582. this.bufferLength = data.length;
  9583. this.eof = true;
  9584. };
  9585. return JpegStream;
  9586. }();
  9587. exports.JpegStream = JpegStream;
  9588. /***/ }),
  9589. /* 19 */
  9590. /***/ (function(module, exports, __w_pdfjs_require__) {
  9591. "use strict";
  9592. Object.defineProperty(exports, "__esModule", {
  9593. value: true
  9594. });
  9595. exports.JpegImage = void 0;
  9596. var _util = __w_pdfjs_require__(2);
  9597. var _core_utils = __w_pdfjs_require__(8);
  9598. class JpegError extends _util.BaseException {
  9599. constructor(msg) {
  9600. super(`JPEG error: ${msg}`);
  9601. }
  9602. }
  9603. class DNLMarkerError extends _util.BaseException {
  9604. constructor(message, scanLines) {
  9605. super(message);
  9606. this.scanLines = scanLines;
  9607. }
  9608. }
  9609. class EOIMarkerError extends _util.BaseException {}
  9610. var JpegImage = function JpegImageClosure() {
  9611. var 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]);
  9612. var dctCos1 = 4017;
  9613. var dctSin1 = 799;
  9614. var dctCos3 = 3406;
  9615. var dctSin3 = 2276;
  9616. var dctCos6 = 1567;
  9617. var dctSin6 = 3784;
  9618. var dctSqrt2 = 5793;
  9619. var dctSqrt1d2 = 2896;
  9620. function JpegImage({
  9621. decodeTransform = null,
  9622. colorTransform = -1
  9623. } = {}) {
  9624. this._decodeTransform = decodeTransform;
  9625. this._colorTransform = colorTransform;
  9626. }
  9627. function buildHuffmanTable(codeLengths, values) {
  9628. var k = 0,
  9629. code = [],
  9630. i,
  9631. j,
  9632. length = 16;
  9633. while (length > 0 && !codeLengths[length - 1]) {
  9634. length--;
  9635. }
  9636. code.push({
  9637. children: [],
  9638. index: 0
  9639. });
  9640. var p = code[0],
  9641. q;
  9642. for (i = 0; i < length; i++) {
  9643. for (j = 0; j < codeLengths[i]; j++) {
  9644. p = code.pop();
  9645. p.children[p.index] = values[k];
  9646. while (p.index > 0) {
  9647. p = code.pop();
  9648. }
  9649. p.index++;
  9650. code.push(p);
  9651. while (code.length <= i) {
  9652. code.push(q = {
  9653. children: [],
  9654. index: 0
  9655. });
  9656. p.children[p.index] = q.children;
  9657. p = q;
  9658. }
  9659. k++;
  9660. }
  9661. if (i + 1 < length) {
  9662. code.push(q = {
  9663. children: [],
  9664. index: 0
  9665. });
  9666. p.children[p.index] = q.children;
  9667. p = q;
  9668. }
  9669. }
  9670. return code[0].children;
  9671. }
  9672. function getBlockBufferOffset(component, row, col) {
  9673. return 64 * ((component.blocksPerLine + 1) * row + col);
  9674. }
  9675. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  9676. var mcusPerLine = frame.mcusPerLine;
  9677. var progressive = frame.progressive;
  9678. const startOffset = offset;
  9679. let bitsData = 0,
  9680. bitsCount = 0;
  9681. function readBit() {
  9682. if (bitsCount > 0) {
  9683. bitsCount--;
  9684. return bitsData >> bitsCount & 1;
  9685. }
  9686. bitsData = data[offset++];
  9687. if (bitsData === 0xff) {
  9688. var nextByte = data[offset++];
  9689. if (nextByte) {
  9690. if (nextByte === 0xdc && parseDNLMarker) {
  9691. offset += 2;
  9692. const scanLines = (0, _core_utils.readUint16)(data, offset);
  9693. offset += 2;
  9694. if (scanLines > 0 && scanLines !== frame.scanLines) {
  9695. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  9696. }
  9697. } else if (nextByte === 0xd9) {
  9698. if (parseDNLMarker) {
  9699. const maybeScanLines = blockRow * 8;
  9700. if (maybeScanLines > 0 && maybeScanLines < frame.scanLines / 10) {
  9701. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  9702. }
  9703. }
  9704. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  9705. }
  9706. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  9707. }
  9708. }
  9709. bitsCount = 7;
  9710. return bitsData >>> 7;
  9711. }
  9712. function decodeHuffman(tree) {
  9713. var node = tree;
  9714. while (true) {
  9715. node = node[readBit()];
  9716. switch (typeof node) {
  9717. case "number":
  9718. return node;
  9719. case "object":
  9720. continue;
  9721. }
  9722. throw new JpegError("invalid huffman sequence");
  9723. }
  9724. }
  9725. function receive(length) {
  9726. var n = 0;
  9727. while (length > 0) {
  9728. n = n << 1 | readBit();
  9729. length--;
  9730. }
  9731. return n;
  9732. }
  9733. function receiveAndExtend(length) {
  9734. if (length === 1) {
  9735. return readBit() === 1 ? 1 : -1;
  9736. }
  9737. var n = receive(length);
  9738. if (n >= 1 << length - 1) {
  9739. return n;
  9740. }
  9741. return n + (-1 << length) + 1;
  9742. }
  9743. function decodeBaseline(component, blockOffset) {
  9744. var t = decodeHuffman(component.huffmanTableDC);
  9745. var diff = t === 0 ? 0 : receiveAndExtend(t);
  9746. component.blockData[blockOffset] = component.pred += diff;
  9747. var k = 1;
  9748. while (k < 64) {
  9749. var rs = decodeHuffman(component.huffmanTableAC);
  9750. var s = rs & 15,
  9751. r = rs >> 4;
  9752. if (s === 0) {
  9753. if (r < 15) {
  9754. break;
  9755. }
  9756. k += 16;
  9757. continue;
  9758. }
  9759. k += r;
  9760. var z = dctZigZag[k];
  9761. component.blockData[blockOffset + z] = receiveAndExtend(s);
  9762. k++;
  9763. }
  9764. }
  9765. function decodeDCFirst(component, blockOffset) {
  9766. var t = decodeHuffman(component.huffmanTableDC);
  9767. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  9768. component.blockData[blockOffset] = component.pred += diff;
  9769. }
  9770. function decodeDCSuccessive(component, blockOffset) {
  9771. component.blockData[blockOffset] |= readBit() << successive;
  9772. }
  9773. var eobrun = 0;
  9774. function decodeACFirst(component, blockOffset) {
  9775. if (eobrun > 0) {
  9776. eobrun--;
  9777. return;
  9778. }
  9779. var k = spectralStart,
  9780. e = spectralEnd;
  9781. while (k <= e) {
  9782. var rs = decodeHuffman(component.huffmanTableAC);
  9783. var s = rs & 15,
  9784. r = rs >> 4;
  9785. if (s === 0) {
  9786. if (r < 15) {
  9787. eobrun = receive(r) + (1 << r) - 1;
  9788. break;
  9789. }
  9790. k += 16;
  9791. continue;
  9792. }
  9793. k += r;
  9794. var z = dctZigZag[k];
  9795. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  9796. k++;
  9797. }
  9798. }
  9799. var successiveACState = 0,
  9800. successiveACNextValue;
  9801. function decodeACSuccessive(component, blockOffset) {
  9802. var k = spectralStart;
  9803. var e = spectralEnd;
  9804. var r = 0;
  9805. var s;
  9806. var rs;
  9807. while (k <= e) {
  9808. const offsetZ = blockOffset + dctZigZag[k];
  9809. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  9810. switch (successiveACState) {
  9811. case 0:
  9812. rs = decodeHuffman(component.huffmanTableAC);
  9813. s = rs & 15;
  9814. r = rs >> 4;
  9815. if (s === 0) {
  9816. if (r < 15) {
  9817. eobrun = receive(r) + (1 << r);
  9818. successiveACState = 4;
  9819. } else {
  9820. r = 16;
  9821. successiveACState = 1;
  9822. }
  9823. } else {
  9824. if (s !== 1) {
  9825. throw new JpegError("invalid ACn encoding");
  9826. }
  9827. successiveACNextValue = receiveAndExtend(s);
  9828. successiveACState = r ? 2 : 3;
  9829. }
  9830. continue;
  9831. case 1:
  9832. case 2:
  9833. if (component.blockData[offsetZ]) {
  9834. component.blockData[offsetZ] += sign * (readBit() << successive);
  9835. } else {
  9836. r--;
  9837. if (r === 0) {
  9838. successiveACState = successiveACState === 2 ? 3 : 0;
  9839. }
  9840. }
  9841. break;
  9842. case 3:
  9843. if (component.blockData[offsetZ]) {
  9844. component.blockData[offsetZ] += sign * (readBit() << successive);
  9845. } else {
  9846. component.blockData[offsetZ] = successiveACNextValue << successive;
  9847. successiveACState = 0;
  9848. }
  9849. break;
  9850. case 4:
  9851. if (component.blockData[offsetZ]) {
  9852. component.blockData[offsetZ] += sign * (readBit() << successive);
  9853. }
  9854. break;
  9855. }
  9856. k++;
  9857. }
  9858. if (successiveACState === 4) {
  9859. eobrun--;
  9860. if (eobrun === 0) {
  9861. successiveACState = 0;
  9862. }
  9863. }
  9864. }
  9865. let blockRow = 0;
  9866. function decodeMcu(component, decode, mcu, row, col) {
  9867. var mcuRow = mcu / mcusPerLine | 0;
  9868. var mcuCol = mcu % mcusPerLine;
  9869. blockRow = mcuRow * component.v + row;
  9870. var blockCol = mcuCol * component.h + col;
  9871. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  9872. decode(component, blockOffset);
  9873. }
  9874. function decodeBlock(component, decode, mcu) {
  9875. blockRow = mcu / component.blocksPerLine | 0;
  9876. var blockCol = mcu % component.blocksPerLine;
  9877. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  9878. decode(component, blockOffset);
  9879. }
  9880. var componentsLength = components.length;
  9881. var component, i, j, k, n;
  9882. var decodeFn;
  9883. if (progressive) {
  9884. if (spectralStart === 0) {
  9885. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  9886. } else {
  9887. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  9888. }
  9889. } else {
  9890. decodeFn = decodeBaseline;
  9891. }
  9892. var mcu = 0,
  9893. fileMarker;
  9894. var mcuExpected;
  9895. if (componentsLength === 1) {
  9896. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  9897. } else {
  9898. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  9899. }
  9900. var h, v;
  9901. while (mcu <= mcuExpected) {
  9902. var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  9903. if (mcuToRead > 0) {
  9904. for (i = 0; i < componentsLength; i++) {
  9905. components[i].pred = 0;
  9906. }
  9907. eobrun = 0;
  9908. if (componentsLength === 1) {
  9909. component = components[0];
  9910. for (n = 0; n < mcuToRead; n++) {
  9911. decodeBlock(component, decodeFn, mcu);
  9912. mcu++;
  9913. }
  9914. } else {
  9915. for (n = 0; n < mcuToRead; n++) {
  9916. for (i = 0; i < componentsLength; i++) {
  9917. component = components[i];
  9918. h = component.h;
  9919. v = component.v;
  9920. for (j = 0; j < v; j++) {
  9921. for (k = 0; k < h; k++) {
  9922. decodeMcu(component, decodeFn, mcu, j, k);
  9923. }
  9924. }
  9925. }
  9926. mcu++;
  9927. }
  9928. }
  9929. }
  9930. bitsCount = 0;
  9931. fileMarker = findNextFileMarker(data, offset);
  9932. if (!fileMarker) {
  9933. break;
  9934. }
  9935. if (fileMarker.invalid) {
  9936. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  9937. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  9938. offset = fileMarker.offset;
  9939. }
  9940. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  9941. offset += 2;
  9942. } else {
  9943. break;
  9944. }
  9945. }
  9946. return offset - startOffset;
  9947. }
  9948. function quantizeAndInverse(component, blockBufferOffset, p) {
  9949. var qt = component.quantizationTable,
  9950. blockData = component.blockData;
  9951. var v0, v1, v2, v3, v4, v5, v6, v7;
  9952. var p0, p1, p2, p3, p4, p5, p6, p7;
  9953. var t;
  9954. if (!qt) {
  9955. throw new JpegError("missing required Quantization Table.");
  9956. }
  9957. for (var row = 0; row < 64; row += 8) {
  9958. p0 = blockData[blockBufferOffset + row];
  9959. p1 = blockData[blockBufferOffset + row + 1];
  9960. p2 = blockData[blockBufferOffset + row + 2];
  9961. p3 = blockData[blockBufferOffset + row + 3];
  9962. p4 = blockData[blockBufferOffset + row + 4];
  9963. p5 = blockData[blockBufferOffset + row + 5];
  9964. p6 = blockData[blockBufferOffset + row + 6];
  9965. p7 = blockData[blockBufferOffset + row + 7];
  9966. p0 *= qt[row];
  9967. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  9968. t = dctSqrt2 * p0 + 512 >> 10;
  9969. p[row] = t;
  9970. p[row + 1] = t;
  9971. p[row + 2] = t;
  9972. p[row + 3] = t;
  9973. p[row + 4] = t;
  9974. p[row + 5] = t;
  9975. p[row + 6] = t;
  9976. p[row + 7] = t;
  9977. continue;
  9978. }
  9979. p1 *= qt[row + 1];
  9980. p2 *= qt[row + 2];
  9981. p3 *= qt[row + 3];
  9982. p4 *= qt[row + 4];
  9983. p5 *= qt[row + 5];
  9984. p6 *= qt[row + 6];
  9985. p7 *= qt[row + 7];
  9986. v0 = dctSqrt2 * p0 + 128 >> 8;
  9987. v1 = dctSqrt2 * p4 + 128 >> 8;
  9988. v2 = p2;
  9989. v3 = p6;
  9990. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  9991. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  9992. v5 = p3 << 4;
  9993. v6 = p5 << 4;
  9994. v0 = v0 + v1 + 1 >> 1;
  9995. v1 = v0 - v1;
  9996. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  9997. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  9998. v3 = t;
  9999. v4 = v4 + v6 + 1 >> 1;
  10000. v6 = v4 - v6;
  10001. v7 = v7 + v5 + 1 >> 1;
  10002. v5 = v7 - v5;
  10003. v0 = v0 + v3 + 1 >> 1;
  10004. v3 = v0 - v3;
  10005. v1 = v1 + v2 + 1 >> 1;
  10006. v2 = v1 - v2;
  10007. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10008. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10009. v7 = t;
  10010. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10011. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10012. v6 = t;
  10013. p[row] = v0 + v7;
  10014. p[row + 7] = v0 - v7;
  10015. p[row + 1] = v1 + v6;
  10016. p[row + 6] = v1 - v6;
  10017. p[row + 2] = v2 + v5;
  10018. p[row + 5] = v2 - v5;
  10019. p[row + 3] = v3 + v4;
  10020. p[row + 4] = v3 - v4;
  10021. }
  10022. for (var col = 0; col < 8; ++col) {
  10023. p0 = p[col];
  10024. p1 = p[col + 8];
  10025. p2 = p[col + 16];
  10026. p3 = p[col + 24];
  10027. p4 = p[col + 32];
  10028. p5 = p[col + 40];
  10029. p6 = p[col + 48];
  10030. p7 = p[col + 56];
  10031. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10032. t = dctSqrt2 * p0 + 8192 >> 14;
  10033. if (t < -2040) {
  10034. t = 0;
  10035. } else if (t >= 2024) {
  10036. t = 255;
  10037. } else {
  10038. t = t + 2056 >> 4;
  10039. }
  10040. blockData[blockBufferOffset + col] = t;
  10041. blockData[blockBufferOffset + col + 8] = t;
  10042. blockData[blockBufferOffset + col + 16] = t;
  10043. blockData[blockBufferOffset + col + 24] = t;
  10044. blockData[blockBufferOffset + col + 32] = t;
  10045. blockData[blockBufferOffset + col + 40] = t;
  10046. blockData[blockBufferOffset + col + 48] = t;
  10047. blockData[blockBufferOffset + col + 56] = t;
  10048. continue;
  10049. }
  10050. v0 = dctSqrt2 * p0 + 2048 >> 12;
  10051. v1 = dctSqrt2 * p4 + 2048 >> 12;
  10052. v2 = p2;
  10053. v3 = p6;
  10054. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  10055. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  10056. v5 = p3;
  10057. v6 = p5;
  10058. v0 = (v0 + v1 + 1 >> 1) + 4112;
  10059. v1 = v0 - v1;
  10060. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  10061. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  10062. v3 = t;
  10063. v4 = v4 + v6 + 1 >> 1;
  10064. v6 = v4 - v6;
  10065. v7 = v7 + v5 + 1 >> 1;
  10066. v5 = v7 - v5;
  10067. v0 = v0 + v3 + 1 >> 1;
  10068. v3 = v0 - v3;
  10069. v1 = v1 + v2 + 1 >> 1;
  10070. v2 = v1 - v2;
  10071. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10072. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10073. v7 = t;
  10074. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10075. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10076. v6 = t;
  10077. p0 = v0 + v7;
  10078. p7 = v0 - v7;
  10079. p1 = v1 + v6;
  10080. p6 = v1 - v6;
  10081. p2 = v2 + v5;
  10082. p5 = v2 - v5;
  10083. p3 = v3 + v4;
  10084. p4 = v3 - v4;
  10085. if (p0 < 16) {
  10086. p0 = 0;
  10087. } else if (p0 >= 4080) {
  10088. p0 = 255;
  10089. } else {
  10090. p0 >>= 4;
  10091. }
  10092. if (p1 < 16) {
  10093. p1 = 0;
  10094. } else if (p1 >= 4080) {
  10095. p1 = 255;
  10096. } else {
  10097. p1 >>= 4;
  10098. }
  10099. if (p2 < 16) {
  10100. p2 = 0;
  10101. } else if (p2 >= 4080) {
  10102. p2 = 255;
  10103. } else {
  10104. p2 >>= 4;
  10105. }
  10106. if (p3 < 16) {
  10107. p3 = 0;
  10108. } else if (p3 >= 4080) {
  10109. p3 = 255;
  10110. } else {
  10111. p3 >>= 4;
  10112. }
  10113. if (p4 < 16) {
  10114. p4 = 0;
  10115. } else if (p4 >= 4080) {
  10116. p4 = 255;
  10117. } else {
  10118. p4 >>= 4;
  10119. }
  10120. if (p5 < 16) {
  10121. p5 = 0;
  10122. } else if (p5 >= 4080) {
  10123. p5 = 255;
  10124. } else {
  10125. p5 >>= 4;
  10126. }
  10127. if (p6 < 16) {
  10128. p6 = 0;
  10129. } else if (p6 >= 4080) {
  10130. p6 = 255;
  10131. } else {
  10132. p6 >>= 4;
  10133. }
  10134. if (p7 < 16) {
  10135. p7 = 0;
  10136. } else if (p7 >= 4080) {
  10137. p7 = 255;
  10138. } else {
  10139. p7 >>= 4;
  10140. }
  10141. blockData[blockBufferOffset + col] = p0;
  10142. blockData[blockBufferOffset + col + 8] = p1;
  10143. blockData[blockBufferOffset + col + 16] = p2;
  10144. blockData[blockBufferOffset + col + 24] = p3;
  10145. blockData[blockBufferOffset + col + 32] = p4;
  10146. blockData[blockBufferOffset + col + 40] = p5;
  10147. blockData[blockBufferOffset + col + 48] = p6;
  10148. blockData[blockBufferOffset + col + 56] = p7;
  10149. }
  10150. }
  10151. function buildComponentData(frame, component) {
  10152. var blocksPerLine = component.blocksPerLine;
  10153. var blocksPerColumn = component.blocksPerColumn;
  10154. var computationBuffer = new Int16Array(64);
  10155. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  10156. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  10157. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  10158. quantizeAndInverse(component, offset, computationBuffer);
  10159. }
  10160. }
  10161. return component.blockData;
  10162. }
  10163. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  10164. const maxPos = data.length - 1;
  10165. var newPos = startPos < currentPos ? startPos : currentPos;
  10166. if (currentPos >= maxPos) {
  10167. return null;
  10168. }
  10169. var currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  10170. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  10171. return {
  10172. invalid: null,
  10173. marker: currentMarker,
  10174. offset: currentPos
  10175. };
  10176. }
  10177. var newMarker = (0, _core_utils.readUint16)(data, newPos);
  10178. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  10179. if (++newPos >= maxPos) {
  10180. return null;
  10181. }
  10182. newMarker = (0, _core_utils.readUint16)(data, newPos);
  10183. }
  10184. return {
  10185. invalid: currentMarker.toString(16),
  10186. marker: newMarker,
  10187. offset: newPos
  10188. };
  10189. }
  10190. JpegImage.prototype = {
  10191. parse(data, {
  10192. dnlScanLines = null
  10193. } = {}) {
  10194. function readDataBlock() {
  10195. const length = (0, _core_utils.readUint16)(data, offset);
  10196. offset += 2;
  10197. let endOffset = offset + length - 2;
  10198. var fileMarker = findNextFileMarker(data, endOffset, offset);
  10199. if (fileMarker && fileMarker.invalid) {
  10200. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  10201. endOffset = fileMarker.offset;
  10202. }
  10203. var array = data.subarray(offset, endOffset);
  10204. offset += array.length;
  10205. return array;
  10206. }
  10207. function prepareComponents(frame) {
  10208. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  10209. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  10210. for (var i = 0; i < frame.components.length; i++) {
  10211. component = frame.components[i];
  10212. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  10213. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  10214. var blocksPerLineForMcu = mcusPerLine * component.h;
  10215. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  10216. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  10217. component.blockData = new Int16Array(blocksBufferSize);
  10218. component.blocksPerLine = blocksPerLine;
  10219. component.blocksPerColumn = blocksPerColumn;
  10220. }
  10221. frame.mcusPerLine = mcusPerLine;
  10222. frame.mcusPerColumn = mcusPerColumn;
  10223. }
  10224. var offset = 0;
  10225. var jfif = null;
  10226. var adobe = null;
  10227. var frame, resetInterval;
  10228. let numSOSMarkers = 0;
  10229. var quantizationTables = [];
  10230. var huffmanTablesAC = [],
  10231. huffmanTablesDC = [];
  10232. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  10233. offset += 2;
  10234. if (fileMarker !== 0xffd8) {
  10235. throw new JpegError("SOI not found");
  10236. }
  10237. fileMarker = (0, _core_utils.readUint16)(data, offset);
  10238. offset += 2;
  10239. markerLoop: while (fileMarker !== 0xffd9) {
  10240. var i, j, l;
  10241. switch (fileMarker) {
  10242. case 0xffe0:
  10243. case 0xffe1:
  10244. case 0xffe2:
  10245. case 0xffe3:
  10246. case 0xffe4:
  10247. case 0xffe5:
  10248. case 0xffe6:
  10249. case 0xffe7:
  10250. case 0xffe8:
  10251. case 0xffe9:
  10252. case 0xffea:
  10253. case 0xffeb:
  10254. case 0xffec:
  10255. case 0xffed:
  10256. case 0xffee:
  10257. case 0xffef:
  10258. case 0xfffe:
  10259. var appData = readDataBlock();
  10260. if (fileMarker === 0xffe0) {
  10261. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  10262. jfif = {
  10263. version: {
  10264. major: appData[5],
  10265. minor: appData[6]
  10266. },
  10267. densityUnits: appData[7],
  10268. xDensity: appData[8] << 8 | appData[9],
  10269. yDensity: appData[10] << 8 | appData[11],
  10270. thumbWidth: appData[12],
  10271. thumbHeight: appData[13],
  10272. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  10273. };
  10274. }
  10275. }
  10276. if (fileMarker === 0xffee) {
  10277. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  10278. adobe = {
  10279. version: appData[5] << 8 | appData[6],
  10280. flags0: appData[7] << 8 | appData[8],
  10281. flags1: appData[9] << 8 | appData[10],
  10282. transformCode: appData[11]
  10283. };
  10284. }
  10285. }
  10286. break;
  10287. case 0xffdb:
  10288. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  10289. offset += 2;
  10290. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  10291. var z;
  10292. while (offset < quantizationTablesEnd) {
  10293. var quantizationTableSpec = data[offset++];
  10294. var tableData = new Uint16Array(64);
  10295. if (quantizationTableSpec >> 4 === 0) {
  10296. for (j = 0; j < 64; j++) {
  10297. z = dctZigZag[j];
  10298. tableData[z] = data[offset++];
  10299. }
  10300. } else if (quantizationTableSpec >> 4 === 1) {
  10301. for (j = 0; j < 64; j++) {
  10302. z = dctZigZag[j];
  10303. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  10304. offset += 2;
  10305. }
  10306. } else {
  10307. throw new JpegError("DQT - invalid table spec");
  10308. }
  10309. quantizationTables[quantizationTableSpec & 15] = tableData;
  10310. }
  10311. break;
  10312. case 0xffc0:
  10313. case 0xffc1:
  10314. case 0xffc2:
  10315. if (frame) {
  10316. throw new JpegError("Only single frame JPEGs supported");
  10317. }
  10318. offset += 2;
  10319. frame = {};
  10320. frame.extended = fileMarker === 0xffc1;
  10321. frame.progressive = fileMarker === 0xffc2;
  10322. frame.precision = data[offset++];
  10323. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  10324. offset += 2;
  10325. frame.scanLines = dnlScanLines || sofScanLines;
  10326. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  10327. offset += 2;
  10328. frame.components = [];
  10329. frame.componentIds = {};
  10330. var componentsCount = data[offset++],
  10331. componentId;
  10332. var maxH = 0,
  10333. maxV = 0;
  10334. for (i = 0; i < componentsCount; i++) {
  10335. componentId = data[offset];
  10336. var h = data[offset + 1] >> 4;
  10337. var v = data[offset + 1] & 15;
  10338. if (maxH < h) {
  10339. maxH = h;
  10340. }
  10341. if (maxV < v) {
  10342. maxV = v;
  10343. }
  10344. var qId = data[offset + 2];
  10345. l = frame.components.push({
  10346. h,
  10347. v,
  10348. quantizationId: qId,
  10349. quantizationTable: null
  10350. });
  10351. frame.componentIds[componentId] = l - 1;
  10352. offset += 3;
  10353. }
  10354. frame.maxH = maxH;
  10355. frame.maxV = maxV;
  10356. prepareComponents(frame);
  10357. break;
  10358. case 0xffc4:
  10359. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  10360. offset += 2;
  10361. for (i = 2; i < huffmanLength;) {
  10362. var huffmanTableSpec = data[offset++];
  10363. var codeLengths = new Uint8Array(16);
  10364. var codeLengthSum = 0;
  10365. for (j = 0; j < 16; j++, offset++) {
  10366. codeLengthSum += codeLengths[j] = data[offset];
  10367. }
  10368. var huffmanValues = new Uint8Array(codeLengthSum);
  10369. for (j = 0; j < codeLengthSum; j++, offset++) {
  10370. huffmanValues[j] = data[offset];
  10371. }
  10372. i += 17 + codeLengthSum;
  10373. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  10374. }
  10375. break;
  10376. case 0xffdd:
  10377. offset += 2;
  10378. resetInterval = (0, _core_utils.readUint16)(data, offset);
  10379. offset += 2;
  10380. break;
  10381. case 0xffda:
  10382. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  10383. offset += 2;
  10384. var selectorsCount = data[offset++];
  10385. var components = [],
  10386. component;
  10387. for (i = 0; i < selectorsCount; i++) {
  10388. var componentIndex = frame.componentIds[data[offset++]];
  10389. component = frame.components[componentIndex];
  10390. var tableSpec = data[offset++];
  10391. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  10392. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  10393. components.push(component);
  10394. }
  10395. var spectralStart = data[offset++];
  10396. var spectralEnd = data[offset++];
  10397. var successiveApproximation = data[offset++];
  10398. try {
  10399. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  10400. offset += processed;
  10401. } catch (ex) {
  10402. if (ex instanceof DNLMarkerError) {
  10403. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  10404. return this.parse(data, {
  10405. dnlScanLines: ex.scanLines
  10406. });
  10407. } else if (ex instanceof EOIMarkerError) {
  10408. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  10409. break markerLoop;
  10410. }
  10411. throw ex;
  10412. }
  10413. break;
  10414. case 0xffdc:
  10415. offset += 4;
  10416. break;
  10417. case 0xffff:
  10418. if (data[offset] !== 0xff) {
  10419. offset--;
  10420. }
  10421. break;
  10422. default:
  10423. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  10424. if (nextFileMarker && nextFileMarker.invalid) {
  10425. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  10426. offset = nextFileMarker.offset;
  10427. break;
  10428. }
  10429. if (offset >= data.length - 1) {
  10430. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  10431. break markerLoop;
  10432. }
  10433. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  10434. }
  10435. fileMarker = (0, _core_utils.readUint16)(data, offset);
  10436. offset += 2;
  10437. }
  10438. this.width = frame.samplesPerLine;
  10439. this.height = frame.scanLines;
  10440. this.jfif = jfif;
  10441. this.adobe = adobe;
  10442. this.components = [];
  10443. for (i = 0; i < frame.components.length; i++) {
  10444. component = frame.components[i];
  10445. var quantizationTable = quantizationTables[component.quantizationId];
  10446. if (quantizationTable) {
  10447. component.quantizationTable = quantizationTable;
  10448. }
  10449. this.components.push({
  10450. output: buildComponentData(frame, component),
  10451. scaleX: component.h / frame.maxH,
  10452. scaleY: component.v / frame.maxV,
  10453. blocksPerLine: component.blocksPerLine,
  10454. blocksPerColumn: component.blocksPerColumn
  10455. });
  10456. }
  10457. this.numComponents = this.components.length;
  10458. return undefined;
  10459. },
  10460. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  10461. var scaleX = this.width / width,
  10462. scaleY = this.height / height;
  10463. var component, componentScaleX, componentScaleY, blocksPerScanline;
  10464. var x, y, i, j, k;
  10465. var index;
  10466. var offset = 0;
  10467. var output;
  10468. var numComponents = this.components.length;
  10469. var dataLength = width * height * numComponents;
  10470. var data = new Uint8ClampedArray(dataLength);
  10471. var xScaleBlockOffset = new Uint32Array(width);
  10472. var mask3LSB = 0xfffffff8;
  10473. let lastComponentScaleX;
  10474. for (i = 0; i < numComponents; i++) {
  10475. component = this.components[i];
  10476. componentScaleX = component.scaleX * scaleX;
  10477. componentScaleY = component.scaleY * scaleY;
  10478. offset = i;
  10479. output = component.output;
  10480. blocksPerScanline = component.blocksPerLine + 1 << 3;
  10481. if (componentScaleX !== lastComponentScaleX) {
  10482. for (x = 0; x < width; x++) {
  10483. j = 0 | x * componentScaleX;
  10484. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  10485. }
  10486. lastComponentScaleX = componentScaleX;
  10487. }
  10488. for (y = 0; y < height; y++) {
  10489. j = 0 | y * componentScaleY;
  10490. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  10491. for (x = 0; x < width; x++) {
  10492. data[offset] = output[index + xScaleBlockOffset[x]];
  10493. offset += numComponents;
  10494. }
  10495. }
  10496. }
  10497. let transform = this._decodeTransform;
  10498. if (!isSourcePDF && numComponents === 4 && !transform) {
  10499. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  10500. }
  10501. if (transform) {
  10502. for (i = 0; i < dataLength;) {
  10503. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  10504. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  10505. }
  10506. }
  10507. }
  10508. return data;
  10509. },
  10510. get _isColorConversionNeeded() {
  10511. if (this.adobe) {
  10512. return !!this.adobe.transformCode;
  10513. }
  10514. if (this.numComponents === 3) {
  10515. if (this._colorTransform === 0) {
  10516. return false;
  10517. }
  10518. return true;
  10519. }
  10520. if (this._colorTransform === 1) {
  10521. return true;
  10522. }
  10523. return false;
  10524. },
  10525. _convertYccToRgb: function convertYccToRgb(data) {
  10526. var Y, Cb, Cr;
  10527. for (var i = 0, length = data.length; i < length; i += 3) {
  10528. Y = data[i];
  10529. Cb = data[i + 1];
  10530. Cr = data[i + 2];
  10531. data[i] = Y - 179.456 + 1.402 * Cr;
  10532. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  10533. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  10534. }
  10535. return data;
  10536. },
  10537. _convertYcckToRgb: function convertYcckToRgb(data) {
  10538. var Y, Cb, Cr, k;
  10539. var offset = 0;
  10540. for (var i = 0, length = data.length; i < length; i += 4) {
  10541. Y = data[i];
  10542. Cb = data[i + 1];
  10543. Cr = data[i + 2];
  10544. k = data[i + 3];
  10545. 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);
  10546. 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);
  10547. 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);
  10548. }
  10549. return data.subarray(0, offset);
  10550. },
  10551. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  10552. var Y, Cb, Cr;
  10553. for (var i = 0, length = data.length; i < length; i += 4) {
  10554. Y = data[i];
  10555. Cb = data[i + 1];
  10556. Cr = data[i + 2];
  10557. data[i] = 434.456 - Y - 1.402 * Cr;
  10558. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  10559. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  10560. }
  10561. return data;
  10562. },
  10563. _convertCmykToRgb: function convertCmykToRgb(data) {
  10564. var c, m, y, k;
  10565. var offset = 0;
  10566. for (var i = 0, length = data.length; i < length; i += 4) {
  10567. c = data[i];
  10568. m = data[i + 1];
  10569. y = data[i + 2];
  10570. k = data[i + 3];
  10571. 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);
  10572. 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);
  10573. 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);
  10574. }
  10575. return data.subarray(0, offset);
  10576. },
  10577. getData({
  10578. width,
  10579. height,
  10580. forceRGB = false,
  10581. isSourcePDF = false
  10582. }) {
  10583. if (this.numComponents > 4) {
  10584. throw new JpegError("Unsupported color mode");
  10585. }
  10586. var data = this._getLinearizedBlockData(width, height, isSourcePDF);
  10587. if (this.numComponents === 1 && forceRGB) {
  10588. var dataLength = data.length;
  10589. var rgbData = new Uint8ClampedArray(dataLength * 3);
  10590. var offset = 0;
  10591. for (var i = 0; i < dataLength; i++) {
  10592. var grayColor = data[i];
  10593. rgbData[offset++] = grayColor;
  10594. rgbData[offset++] = grayColor;
  10595. rgbData[offset++] = grayColor;
  10596. }
  10597. return rgbData;
  10598. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  10599. return this._convertYccToRgb(data);
  10600. } else if (this.numComponents === 4) {
  10601. if (this._isColorConversionNeeded) {
  10602. if (forceRGB) {
  10603. return this._convertYcckToRgb(data);
  10604. }
  10605. return this._convertYcckToCmyk(data);
  10606. } else if (forceRGB) {
  10607. return this._convertCmykToRgb(data);
  10608. }
  10609. }
  10610. return data;
  10611. }
  10612. };
  10613. return JpegImage;
  10614. }();
  10615. exports.JpegImage = JpegImage;
  10616. /***/ }),
  10617. /* 20 */
  10618. /***/ (function(module, exports, __w_pdfjs_require__) {
  10619. "use strict";
  10620. Object.defineProperty(exports, "__esModule", {
  10621. value: true
  10622. });
  10623. exports.JpxStream = void 0;
  10624. var _stream = __w_pdfjs_require__(12);
  10625. var _jpx = __w_pdfjs_require__(21);
  10626. var _util = __w_pdfjs_require__(2);
  10627. const JpxStream = function JpxStreamClosure() {
  10628. function JpxStream(stream, maybeLength, dict, params) {
  10629. this.stream = stream;
  10630. this.maybeLength = maybeLength;
  10631. this.dict = dict;
  10632. this.params = params;
  10633. _stream.DecodeStream.call(this, maybeLength);
  10634. }
  10635. JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  10636. Object.defineProperty(JpxStream.prototype, "bytes", {
  10637. get: function JpxStream_bytes() {
  10638. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  10639. },
  10640. configurable: true
  10641. });
  10642. JpxStream.prototype.ensureBuffer = function (requested) {};
  10643. JpxStream.prototype.readBlock = function () {
  10644. if (this.eof) {
  10645. return;
  10646. }
  10647. const jpxImage = new _jpx.JpxImage();
  10648. jpxImage.parse(this.bytes);
  10649. const width = jpxImage.width;
  10650. const height = jpxImage.height;
  10651. const componentsCount = jpxImage.componentsCount;
  10652. const tileCount = jpxImage.tiles.length;
  10653. if (tileCount === 1) {
  10654. this.buffer = jpxImage.tiles[0].items;
  10655. } else {
  10656. const data = new Uint8ClampedArray(width * height * componentsCount);
  10657. for (let k = 0; k < tileCount; k++) {
  10658. const tileComponents = jpxImage.tiles[k];
  10659. const tileWidth = tileComponents.width;
  10660. const tileHeight = tileComponents.height;
  10661. const tileLeft = tileComponents.left;
  10662. const tileTop = tileComponents.top;
  10663. const src = tileComponents.items;
  10664. let srcPosition = 0;
  10665. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  10666. const imgRowSize = width * componentsCount;
  10667. const tileRowSize = tileWidth * componentsCount;
  10668. for (let j = 0; j < tileHeight; j++) {
  10669. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  10670. data.set(rowBytes, dataPosition);
  10671. srcPosition += tileRowSize;
  10672. dataPosition += imgRowSize;
  10673. }
  10674. }
  10675. this.buffer = data;
  10676. }
  10677. this.bufferLength = this.buffer.length;
  10678. this.eof = true;
  10679. };
  10680. return JpxStream;
  10681. }();
  10682. exports.JpxStream = JpxStream;
  10683. /***/ }),
  10684. /* 21 */
  10685. /***/ (function(module, exports, __w_pdfjs_require__) {
  10686. "use strict";
  10687. Object.defineProperty(exports, "__esModule", {
  10688. value: true
  10689. });
  10690. exports.JpxImage = void 0;
  10691. var _util = __w_pdfjs_require__(2);
  10692. var _core_utils = __w_pdfjs_require__(8);
  10693. var _arithmetic_decoder = __w_pdfjs_require__(17);
  10694. class JpxError extends _util.BaseException {
  10695. constructor(msg) {
  10696. super(`JPX error: ${msg}`);
  10697. }
  10698. }
  10699. var JpxImage = function JpxImageClosure() {
  10700. var SubbandsGainLog2 = {
  10701. LL: 0,
  10702. LH: 1,
  10703. HL: 1,
  10704. HH: 2
  10705. };
  10706. function JpxImage() {
  10707. this.failOnCorruptedImage = false;
  10708. }
  10709. JpxImage.prototype = {
  10710. parse: function JpxImage_parse(data) {
  10711. var head = (0, _core_utils.readUint16)(data, 0);
  10712. if (head === 0xff4f) {
  10713. this.parseCodestream(data, 0, data.length);
  10714. return;
  10715. }
  10716. var position = 0,
  10717. length = data.length;
  10718. while (position < length) {
  10719. var headerSize = 8;
  10720. var lbox = (0, _core_utils.readUint32)(data, position);
  10721. var tbox = (0, _core_utils.readUint32)(data, position + 4);
  10722. position += headerSize;
  10723. if (lbox === 1) {
  10724. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  10725. position += 8;
  10726. headerSize += 8;
  10727. }
  10728. if (lbox === 0) {
  10729. lbox = length - position + headerSize;
  10730. }
  10731. if (lbox < headerSize) {
  10732. throw new JpxError("Invalid box field size");
  10733. }
  10734. var dataLength = lbox - headerSize;
  10735. var jumpDataLength = true;
  10736. switch (tbox) {
  10737. case 0x6a703268:
  10738. jumpDataLength = false;
  10739. break;
  10740. case 0x636f6c72:
  10741. var method = data[position];
  10742. if (method === 1) {
  10743. var colorspace = (0, _core_utils.readUint32)(data, position + 3);
  10744. switch (colorspace) {
  10745. case 16:
  10746. case 17:
  10747. case 18:
  10748. break;
  10749. default:
  10750. (0, _util.warn)("Unknown colorspace " + colorspace);
  10751. break;
  10752. }
  10753. } else if (method === 2) {
  10754. (0, _util.info)("ICC profile not supported");
  10755. }
  10756. break;
  10757. case 0x6a703263:
  10758. this.parseCodestream(data, position, position + dataLength);
  10759. break;
  10760. case 0x6a502020:
  10761. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  10762. (0, _util.warn)("Invalid JP2 signature");
  10763. }
  10764. break;
  10765. case 0x6a501a1a:
  10766. case 0x66747970:
  10767. case 0x72726571:
  10768. case 0x72657320:
  10769. case 0x69686472:
  10770. break;
  10771. default:
  10772. var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  10773. (0, _util.warn)("Unsupported header type " + tbox + " (" + headerType + ")");
  10774. break;
  10775. }
  10776. if (jumpDataLength) {
  10777. position += dataLength;
  10778. }
  10779. }
  10780. },
  10781. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  10782. var newByte = stream.getByte();
  10783. while (newByte >= 0) {
  10784. var oldByte = newByte;
  10785. newByte = stream.getByte();
  10786. var code = oldByte << 8 | newByte;
  10787. if (code === 0xff51) {
  10788. stream.skip(4);
  10789. var Xsiz = stream.getInt32() >>> 0;
  10790. var Ysiz = stream.getInt32() >>> 0;
  10791. var XOsiz = stream.getInt32() >>> 0;
  10792. var YOsiz = stream.getInt32() >>> 0;
  10793. stream.skip(16);
  10794. var Csiz = stream.getUint16();
  10795. this.width = Xsiz - XOsiz;
  10796. this.height = Ysiz - YOsiz;
  10797. this.componentsCount = Csiz;
  10798. this.bitsPerComponent = 8;
  10799. return;
  10800. }
  10801. }
  10802. throw new JpxError("No size marker found in JPX stream");
  10803. },
  10804. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  10805. var context = {};
  10806. var doNotRecover = false;
  10807. try {
  10808. var position = start;
  10809. while (position + 1 < end) {
  10810. var code = (0, _core_utils.readUint16)(data, position);
  10811. position += 2;
  10812. var length = 0,
  10813. j,
  10814. sqcd,
  10815. spqcds,
  10816. spqcdSize,
  10817. scalarExpounded,
  10818. tile;
  10819. switch (code) {
  10820. case 0xff4f:
  10821. context.mainHeader = true;
  10822. break;
  10823. case 0xffd9:
  10824. break;
  10825. case 0xff51:
  10826. length = (0, _core_utils.readUint16)(data, position);
  10827. var siz = {};
  10828. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  10829. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  10830. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  10831. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  10832. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  10833. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  10834. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  10835. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  10836. var componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  10837. siz.Csiz = componentsCount;
  10838. var components = [];
  10839. j = position + 38;
  10840. for (var i = 0; i < componentsCount; i++) {
  10841. var component = {
  10842. precision: (data[j] & 0x7f) + 1,
  10843. isSigned: !!(data[j] & 0x80),
  10844. XRsiz: data[j + 1],
  10845. YRsiz: data[j + 2]
  10846. };
  10847. j += 3;
  10848. calculateComponentDimensions(component, siz);
  10849. components.push(component);
  10850. }
  10851. context.SIZ = siz;
  10852. context.components = components;
  10853. calculateTileGrids(context, components);
  10854. context.QCC = [];
  10855. context.COC = [];
  10856. break;
  10857. case 0xff5c:
  10858. length = (0, _core_utils.readUint16)(data, position);
  10859. var qcd = {};
  10860. j = position + 2;
  10861. sqcd = data[j++];
  10862. switch (sqcd & 0x1f) {
  10863. case 0:
  10864. spqcdSize = 8;
  10865. scalarExpounded = true;
  10866. break;
  10867. case 1:
  10868. spqcdSize = 16;
  10869. scalarExpounded = false;
  10870. break;
  10871. case 2:
  10872. spqcdSize = 16;
  10873. scalarExpounded = true;
  10874. break;
  10875. default:
  10876. throw new Error("Invalid SQcd value " + sqcd);
  10877. }
  10878. qcd.noQuantization = spqcdSize === 8;
  10879. qcd.scalarExpounded = scalarExpounded;
  10880. qcd.guardBits = sqcd >> 5;
  10881. spqcds = [];
  10882. while (j < length + position) {
  10883. var spqcd = {};
  10884. if (spqcdSize === 8) {
  10885. spqcd.epsilon = data[j++] >> 3;
  10886. spqcd.mu = 0;
  10887. } else {
  10888. spqcd.epsilon = data[j] >> 3;
  10889. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  10890. j += 2;
  10891. }
  10892. spqcds.push(spqcd);
  10893. }
  10894. qcd.SPqcds = spqcds;
  10895. if (context.mainHeader) {
  10896. context.QCD = qcd;
  10897. } else {
  10898. context.currentTile.QCD = qcd;
  10899. context.currentTile.QCC = [];
  10900. }
  10901. break;
  10902. case 0xff5d:
  10903. length = (0, _core_utils.readUint16)(data, position);
  10904. var qcc = {};
  10905. j = position + 2;
  10906. var cqcc;
  10907. if (context.SIZ.Csiz < 257) {
  10908. cqcc = data[j++];
  10909. } else {
  10910. cqcc = (0, _core_utils.readUint16)(data, j);
  10911. j += 2;
  10912. }
  10913. sqcd = data[j++];
  10914. switch (sqcd & 0x1f) {
  10915. case 0:
  10916. spqcdSize = 8;
  10917. scalarExpounded = true;
  10918. break;
  10919. case 1:
  10920. spqcdSize = 16;
  10921. scalarExpounded = false;
  10922. break;
  10923. case 2:
  10924. spqcdSize = 16;
  10925. scalarExpounded = true;
  10926. break;
  10927. default:
  10928. throw new Error("Invalid SQcd value " + sqcd);
  10929. }
  10930. qcc.noQuantization = spqcdSize === 8;
  10931. qcc.scalarExpounded = scalarExpounded;
  10932. qcc.guardBits = sqcd >> 5;
  10933. spqcds = [];
  10934. while (j < length + position) {
  10935. spqcd = {};
  10936. if (spqcdSize === 8) {
  10937. spqcd.epsilon = data[j++] >> 3;
  10938. spqcd.mu = 0;
  10939. } else {
  10940. spqcd.epsilon = data[j] >> 3;
  10941. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  10942. j += 2;
  10943. }
  10944. spqcds.push(spqcd);
  10945. }
  10946. qcc.SPqcds = spqcds;
  10947. if (context.mainHeader) {
  10948. context.QCC[cqcc] = qcc;
  10949. } else {
  10950. context.currentTile.QCC[cqcc] = qcc;
  10951. }
  10952. break;
  10953. case 0xff52:
  10954. length = (0, _core_utils.readUint16)(data, position);
  10955. var cod = {};
  10956. j = position + 2;
  10957. var scod = data[j++];
  10958. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  10959. cod.sopMarkerUsed = !!(scod & 2);
  10960. cod.ephMarkerUsed = !!(scod & 4);
  10961. cod.progressionOrder = data[j++];
  10962. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  10963. j += 2;
  10964. cod.multipleComponentTransform = data[j++];
  10965. cod.decompositionLevelsCount = data[j++];
  10966. cod.xcb = (data[j++] & 0xf) + 2;
  10967. cod.ycb = (data[j++] & 0xf) + 2;
  10968. var blockStyle = data[j++];
  10969. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  10970. cod.resetContextProbabilities = !!(blockStyle & 2);
  10971. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  10972. cod.verticallyStripe = !!(blockStyle & 8);
  10973. cod.predictableTermination = !!(blockStyle & 16);
  10974. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  10975. cod.reversibleTransformation = data[j++];
  10976. if (cod.entropyCoderWithCustomPrecincts) {
  10977. var precinctsSizes = [];
  10978. while (j < length + position) {
  10979. var precinctsSize = data[j++];
  10980. precinctsSizes.push({
  10981. PPx: precinctsSize & 0xf,
  10982. PPy: precinctsSize >> 4
  10983. });
  10984. }
  10985. cod.precinctsSizes = precinctsSizes;
  10986. }
  10987. var unsupported = [];
  10988. if (cod.selectiveArithmeticCodingBypass) {
  10989. unsupported.push("selectiveArithmeticCodingBypass");
  10990. }
  10991. if (cod.resetContextProbabilities) {
  10992. unsupported.push("resetContextProbabilities");
  10993. }
  10994. if (cod.terminationOnEachCodingPass) {
  10995. unsupported.push("terminationOnEachCodingPass");
  10996. }
  10997. if (cod.verticallyStripe) {
  10998. unsupported.push("verticallyStripe");
  10999. }
  11000. if (cod.predictableTermination) {
  11001. unsupported.push("predictableTermination");
  11002. }
  11003. if (unsupported.length > 0) {
  11004. doNotRecover = true;
  11005. throw new Error("Unsupported COD options (" + unsupported.join(", ") + ")");
  11006. }
  11007. if (context.mainHeader) {
  11008. context.COD = cod;
  11009. } else {
  11010. context.currentTile.COD = cod;
  11011. context.currentTile.COC = [];
  11012. }
  11013. break;
  11014. case 0xff90:
  11015. length = (0, _core_utils.readUint16)(data, position);
  11016. tile = {};
  11017. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  11018. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  11019. tile.dataEnd = tile.length + position - 2;
  11020. tile.partIndex = data[position + 8];
  11021. tile.partsCount = data[position + 9];
  11022. context.mainHeader = false;
  11023. if (tile.partIndex === 0) {
  11024. tile.COD = context.COD;
  11025. tile.COC = context.COC.slice(0);
  11026. tile.QCD = context.QCD;
  11027. tile.QCC = context.QCC.slice(0);
  11028. }
  11029. context.currentTile = tile;
  11030. break;
  11031. case 0xff93:
  11032. tile = context.currentTile;
  11033. if (tile.partIndex === 0) {
  11034. initializeTile(context, tile.index);
  11035. buildPackets(context);
  11036. }
  11037. length = tile.dataEnd - position;
  11038. parseTilePackets(context, data, position, length);
  11039. break;
  11040. case 0xff55:
  11041. case 0xff57:
  11042. case 0xff58:
  11043. case 0xff64:
  11044. length = (0, _core_utils.readUint16)(data, position);
  11045. break;
  11046. case 0xff53:
  11047. throw new Error("Codestream code 0xFF53 (COC) is not implemented");
  11048. default:
  11049. throw new Error("Unknown codestream code: " + code.toString(16));
  11050. }
  11051. position += length;
  11052. }
  11053. } catch (e) {
  11054. if (doNotRecover || this.failOnCorruptedImage) {
  11055. throw new JpxError(e.message);
  11056. } else {
  11057. (0, _util.warn)("JPX: Trying to recover from: " + e.message);
  11058. }
  11059. }
  11060. this.tiles = transformComponents(context);
  11061. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  11062. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  11063. this.componentsCount = context.SIZ.Csiz;
  11064. }
  11065. };
  11066. function calculateComponentDimensions(component, siz) {
  11067. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  11068. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  11069. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  11070. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  11071. component.width = component.x1 - component.x0;
  11072. component.height = component.y1 - component.y0;
  11073. }
  11074. function calculateTileGrids(context, components) {
  11075. var siz = context.SIZ;
  11076. var tile,
  11077. tiles = [];
  11078. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  11079. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  11080. for (var q = 0; q < numYtiles; q++) {
  11081. for (var p = 0; p < numXtiles; p++) {
  11082. tile = {};
  11083. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  11084. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  11085. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  11086. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  11087. tile.width = tile.tx1 - tile.tx0;
  11088. tile.height = tile.ty1 - tile.ty0;
  11089. tile.components = [];
  11090. tiles.push(tile);
  11091. }
  11092. }
  11093. context.tiles = tiles;
  11094. var componentsCount = siz.Csiz;
  11095. for (var i = 0, ii = componentsCount; i < ii; i++) {
  11096. var component = components[i];
  11097. for (var j = 0, jj = tiles.length; j < jj; j++) {
  11098. var tileComponent = {};
  11099. tile = tiles[j];
  11100. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  11101. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  11102. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  11103. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  11104. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  11105. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  11106. tile.components[i] = tileComponent;
  11107. }
  11108. }
  11109. }
  11110. function getBlocksDimensions(context, component, r) {
  11111. var codOrCoc = component.codingStyleParameters;
  11112. var result = {};
  11113. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  11114. result.PPx = 15;
  11115. result.PPy = 15;
  11116. } else {
  11117. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  11118. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  11119. }
  11120. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  11121. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  11122. return result;
  11123. }
  11124. function buildPrecincts(context, resolution, dimensions) {
  11125. var precinctWidth = 1 << dimensions.PPx;
  11126. var precinctHeight = 1 << dimensions.PPy;
  11127. var isZeroRes = resolution.resLevel === 0;
  11128. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  11129. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  11130. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  11131. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  11132. var numprecincts = numprecinctswide * numprecinctshigh;
  11133. resolution.precinctParameters = {
  11134. precinctWidth,
  11135. precinctHeight,
  11136. numprecinctswide,
  11137. numprecinctshigh,
  11138. numprecincts,
  11139. precinctWidthInSubband,
  11140. precinctHeightInSubband
  11141. };
  11142. }
  11143. function buildCodeblocks(context, subband, dimensions) {
  11144. var xcb_ = dimensions.xcb_;
  11145. var ycb_ = dimensions.ycb_;
  11146. var codeblockWidth = 1 << xcb_;
  11147. var codeblockHeight = 1 << ycb_;
  11148. var cbx0 = subband.tbx0 >> xcb_;
  11149. var cby0 = subband.tby0 >> ycb_;
  11150. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  11151. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  11152. var precinctParameters = subband.resolution.precinctParameters;
  11153. var codeblocks = [];
  11154. var precincts = [];
  11155. var i, j, codeblock, precinctNumber;
  11156. for (j = cby0; j < cby1; j++) {
  11157. for (i = cbx0; i < cbx1; i++) {
  11158. codeblock = {
  11159. cbx: i,
  11160. cby: j,
  11161. tbx0: codeblockWidth * i,
  11162. tby0: codeblockHeight * j,
  11163. tbx1: codeblockWidth * (i + 1),
  11164. tby1: codeblockHeight * (j + 1)
  11165. };
  11166. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  11167. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  11168. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  11169. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  11170. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  11171. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  11172. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  11173. codeblock.precinctNumber = precinctNumber;
  11174. codeblock.subbandType = subband.type;
  11175. codeblock.Lblock = 3;
  11176. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  11177. continue;
  11178. }
  11179. codeblocks.push(codeblock);
  11180. var precinct = precincts[precinctNumber];
  11181. if (precinct !== undefined) {
  11182. if (i < precinct.cbxMin) {
  11183. precinct.cbxMin = i;
  11184. } else if (i > precinct.cbxMax) {
  11185. precinct.cbxMax = i;
  11186. }
  11187. if (j < precinct.cbyMin) {
  11188. precinct.cbxMin = j;
  11189. } else if (j > precinct.cbyMax) {
  11190. precinct.cbyMax = j;
  11191. }
  11192. } else {
  11193. precincts[precinctNumber] = precinct = {
  11194. cbxMin: i,
  11195. cbyMin: j,
  11196. cbxMax: i,
  11197. cbyMax: j
  11198. };
  11199. }
  11200. codeblock.precinct = precinct;
  11201. }
  11202. }
  11203. subband.codeblockParameters = {
  11204. codeblockWidth: xcb_,
  11205. codeblockHeight: ycb_,
  11206. numcodeblockwide: cbx1 - cbx0 + 1,
  11207. numcodeblockhigh: cby1 - cby0 + 1
  11208. };
  11209. subband.codeblocks = codeblocks;
  11210. subband.precincts = precincts;
  11211. }
  11212. function createPacket(resolution, precinctNumber, layerNumber) {
  11213. var precinctCodeblocks = [];
  11214. var subbands = resolution.subbands;
  11215. for (var i = 0, ii = subbands.length; i < ii; i++) {
  11216. var subband = subbands[i];
  11217. var codeblocks = subband.codeblocks;
  11218. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  11219. var codeblock = codeblocks[j];
  11220. if (codeblock.precinctNumber !== precinctNumber) {
  11221. continue;
  11222. }
  11223. precinctCodeblocks.push(codeblock);
  11224. }
  11225. }
  11226. return {
  11227. layerNumber,
  11228. codeblocks: precinctCodeblocks
  11229. };
  11230. }
  11231. function LayerResolutionComponentPositionIterator(context) {
  11232. var siz = context.SIZ;
  11233. var tileIndex = context.currentTile.index;
  11234. var tile = context.tiles[tileIndex];
  11235. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11236. var componentsCount = siz.Csiz;
  11237. var maxDecompositionLevelsCount = 0;
  11238. for (var q = 0; q < componentsCount; q++) {
  11239. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  11240. }
  11241. var l = 0,
  11242. r = 0,
  11243. i = 0,
  11244. k = 0;
  11245. this.nextPacket = function JpxImage_nextPacket() {
  11246. for (; l < layersCount; l++) {
  11247. for (; r <= maxDecompositionLevelsCount; r++) {
  11248. for (; i < componentsCount; i++) {
  11249. var component = tile.components[i];
  11250. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11251. continue;
  11252. }
  11253. var resolution = component.resolutions[r];
  11254. var numprecincts = resolution.precinctParameters.numprecincts;
  11255. for (; k < numprecincts;) {
  11256. var packet = createPacket(resolution, k, l);
  11257. k++;
  11258. return packet;
  11259. }
  11260. k = 0;
  11261. }
  11262. i = 0;
  11263. }
  11264. r = 0;
  11265. }
  11266. throw new JpxError("Out of packets");
  11267. };
  11268. }
  11269. function ResolutionLayerComponentPositionIterator(context) {
  11270. var siz = context.SIZ;
  11271. var tileIndex = context.currentTile.index;
  11272. var tile = context.tiles[tileIndex];
  11273. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11274. var componentsCount = siz.Csiz;
  11275. var maxDecompositionLevelsCount = 0;
  11276. for (var q = 0; q < componentsCount; q++) {
  11277. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  11278. }
  11279. var r = 0,
  11280. l = 0,
  11281. i = 0,
  11282. k = 0;
  11283. this.nextPacket = function JpxImage_nextPacket() {
  11284. for (; r <= maxDecompositionLevelsCount; r++) {
  11285. for (; l < layersCount; l++) {
  11286. for (; i < componentsCount; i++) {
  11287. var component = tile.components[i];
  11288. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11289. continue;
  11290. }
  11291. var resolution = component.resolutions[r];
  11292. var numprecincts = resolution.precinctParameters.numprecincts;
  11293. for (; k < numprecincts;) {
  11294. var packet = createPacket(resolution, k, l);
  11295. k++;
  11296. return packet;
  11297. }
  11298. k = 0;
  11299. }
  11300. i = 0;
  11301. }
  11302. l = 0;
  11303. }
  11304. throw new JpxError("Out of packets");
  11305. };
  11306. }
  11307. function ResolutionPositionComponentLayerIterator(context) {
  11308. var siz = context.SIZ;
  11309. var tileIndex = context.currentTile.index;
  11310. var tile = context.tiles[tileIndex];
  11311. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11312. var componentsCount = siz.Csiz;
  11313. var l, r, c, p;
  11314. var maxDecompositionLevelsCount = 0;
  11315. for (c = 0; c < componentsCount; c++) {
  11316. const component = tile.components[c];
  11317. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  11318. }
  11319. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  11320. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  11321. var maxNumPrecincts = 0;
  11322. for (c = 0; c < componentsCount; ++c) {
  11323. var resolutions = tile.components[c].resolutions;
  11324. if (r < resolutions.length) {
  11325. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  11326. }
  11327. }
  11328. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  11329. }
  11330. l = 0;
  11331. r = 0;
  11332. c = 0;
  11333. p = 0;
  11334. this.nextPacket = function JpxImage_nextPacket() {
  11335. for (; r <= maxDecompositionLevelsCount; r++) {
  11336. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  11337. for (; c < componentsCount; c++) {
  11338. const component = tile.components[c];
  11339. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  11340. continue;
  11341. }
  11342. var resolution = component.resolutions[r];
  11343. var numprecincts = resolution.precinctParameters.numprecincts;
  11344. if (p >= numprecincts) {
  11345. continue;
  11346. }
  11347. for (; l < layersCount;) {
  11348. var packet = createPacket(resolution, p, l);
  11349. l++;
  11350. return packet;
  11351. }
  11352. l = 0;
  11353. }
  11354. c = 0;
  11355. }
  11356. p = 0;
  11357. }
  11358. throw new JpxError("Out of packets");
  11359. };
  11360. }
  11361. function PositionComponentResolutionLayerIterator(context) {
  11362. var siz = context.SIZ;
  11363. var tileIndex = context.currentTile.index;
  11364. var tile = context.tiles[tileIndex];
  11365. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11366. var componentsCount = siz.Csiz;
  11367. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  11368. var precinctsIterationSizes = precinctsSizes;
  11369. var l = 0,
  11370. r = 0,
  11371. c = 0,
  11372. px = 0,
  11373. py = 0;
  11374. this.nextPacket = function JpxImage_nextPacket() {
  11375. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  11376. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  11377. for (; c < componentsCount; c++) {
  11378. var component = tile.components[c];
  11379. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11380. for (; r <= decompositionLevelsCount; r++) {
  11381. var resolution = component.resolutions[r];
  11382. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  11383. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  11384. if (k === null) {
  11385. continue;
  11386. }
  11387. for (; l < layersCount;) {
  11388. var packet = createPacket(resolution, k, l);
  11389. l++;
  11390. return packet;
  11391. }
  11392. l = 0;
  11393. }
  11394. r = 0;
  11395. }
  11396. c = 0;
  11397. }
  11398. px = 0;
  11399. }
  11400. throw new JpxError("Out of packets");
  11401. };
  11402. }
  11403. function ComponentPositionResolutionLayerIterator(context) {
  11404. var siz = context.SIZ;
  11405. var tileIndex = context.currentTile.index;
  11406. var tile = context.tiles[tileIndex];
  11407. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  11408. var componentsCount = siz.Csiz;
  11409. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  11410. var l = 0,
  11411. r = 0,
  11412. c = 0,
  11413. px = 0,
  11414. py = 0;
  11415. this.nextPacket = function JpxImage_nextPacket() {
  11416. for (; c < componentsCount; ++c) {
  11417. var component = tile.components[c];
  11418. var precinctsIterationSizes = precinctsSizes.components[c];
  11419. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11420. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  11421. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  11422. for (; r <= decompositionLevelsCount; r++) {
  11423. var resolution = component.resolutions[r];
  11424. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  11425. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  11426. if (k === null) {
  11427. continue;
  11428. }
  11429. for (; l < layersCount;) {
  11430. var packet = createPacket(resolution, k, l);
  11431. l++;
  11432. return packet;
  11433. }
  11434. l = 0;
  11435. }
  11436. r = 0;
  11437. }
  11438. px = 0;
  11439. }
  11440. py = 0;
  11441. }
  11442. throw new JpxError("Out of packets");
  11443. };
  11444. }
  11445. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  11446. var posX = pxIndex * precinctIterationSizes.minWidth;
  11447. var posY = pyIndex * precinctIterationSizes.minHeight;
  11448. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  11449. return null;
  11450. }
  11451. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  11452. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  11453. }
  11454. function getPrecinctSizesInImageScale(tile) {
  11455. var componentsCount = tile.components.length;
  11456. var minWidth = Number.MAX_VALUE;
  11457. var minHeight = Number.MAX_VALUE;
  11458. var maxNumWide = 0;
  11459. var maxNumHigh = 0;
  11460. var sizePerComponent = new Array(componentsCount);
  11461. for (var c = 0; c < componentsCount; c++) {
  11462. var component = tile.components[c];
  11463. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11464. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  11465. var minWidthCurrentComponent = Number.MAX_VALUE;
  11466. var minHeightCurrentComponent = Number.MAX_VALUE;
  11467. var maxNumWideCurrentComponent = 0;
  11468. var maxNumHighCurrentComponent = 0;
  11469. var scale = 1;
  11470. for (var r = decompositionLevelsCount; r >= 0; --r) {
  11471. var resolution = component.resolutions[r];
  11472. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  11473. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  11474. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  11475. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  11476. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  11477. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  11478. sizePerResolution[r] = {
  11479. width: widthCurrentResolution,
  11480. height: heightCurrentResolution
  11481. };
  11482. scale <<= 1;
  11483. }
  11484. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  11485. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  11486. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  11487. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  11488. sizePerComponent[c] = {
  11489. resolutions: sizePerResolution,
  11490. minWidth: minWidthCurrentComponent,
  11491. minHeight: minHeightCurrentComponent,
  11492. maxNumWide: maxNumWideCurrentComponent,
  11493. maxNumHigh: maxNumHighCurrentComponent
  11494. };
  11495. }
  11496. return {
  11497. components: sizePerComponent,
  11498. minWidth,
  11499. minHeight,
  11500. maxNumWide,
  11501. maxNumHigh
  11502. };
  11503. }
  11504. function buildPackets(context) {
  11505. var siz = context.SIZ;
  11506. var tileIndex = context.currentTile.index;
  11507. var tile = context.tiles[tileIndex];
  11508. var componentsCount = siz.Csiz;
  11509. for (var c = 0; c < componentsCount; c++) {
  11510. var component = tile.components[c];
  11511. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  11512. var resolutions = [];
  11513. var subbands = [];
  11514. for (var r = 0; r <= decompositionLevelsCount; r++) {
  11515. var blocksDimensions = getBlocksDimensions(context, component, r);
  11516. var resolution = {};
  11517. var scale = 1 << decompositionLevelsCount - r;
  11518. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  11519. resolution.try0 = Math.ceil(component.tcy0 / scale);
  11520. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  11521. resolution.try1 = Math.ceil(component.tcy1 / scale);
  11522. resolution.resLevel = r;
  11523. buildPrecincts(context, resolution, blocksDimensions);
  11524. resolutions.push(resolution);
  11525. var subband;
  11526. if (r === 0) {
  11527. subband = {};
  11528. subband.type = "LL";
  11529. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  11530. subband.tby0 = Math.ceil(component.tcy0 / scale);
  11531. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  11532. subband.tby1 = Math.ceil(component.tcy1 / scale);
  11533. subband.resolution = resolution;
  11534. buildCodeblocks(context, subband, blocksDimensions);
  11535. subbands.push(subband);
  11536. resolution.subbands = [subband];
  11537. } else {
  11538. var bscale = 1 << decompositionLevelsCount - r + 1;
  11539. var resolutionSubbands = [];
  11540. subband = {};
  11541. subband.type = "HL";
  11542. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  11543. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  11544. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  11545. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  11546. subband.resolution = resolution;
  11547. buildCodeblocks(context, subband, blocksDimensions);
  11548. subbands.push(subband);
  11549. resolutionSubbands.push(subband);
  11550. subband = {};
  11551. subband.type = "LH";
  11552. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  11553. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  11554. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  11555. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  11556. subband.resolution = resolution;
  11557. buildCodeblocks(context, subband, blocksDimensions);
  11558. subbands.push(subband);
  11559. resolutionSubbands.push(subband);
  11560. subband = {};
  11561. subband.type = "HH";
  11562. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  11563. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  11564. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  11565. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  11566. subband.resolution = resolution;
  11567. buildCodeblocks(context, subband, blocksDimensions);
  11568. subbands.push(subband);
  11569. resolutionSubbands.push(subband);
  11570. resolution.subbands = resolutionSubbands;
  11571. }
  11572. }
  11573. component.resolutions = resolutions;
  11574. component.subbands = subbands;
  11575. }
  11576. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  11577. switch (progressionOrder) {
  11578. case 0:
  11579. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  11580. break;
  11581. case 1:
  11582. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  11583. break;
  11584. case 2:
  11585. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  11586. break;
  11587. case 3:
  11588. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  11589. break;
  11590. case 4:
  11591. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  11592. break;
  11593. default:
  11594. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  11595. }
  11596. }
  11597. function parseTilePackets(context, data, offset, dataLength) {
  11598. var position = 0;
  11599. var buffer,
  11600. bufferSize = 0,
  11601. skipNextBit = false;
  11602. function readBits(count) {
  11603. while (bufferSize < count) {
  11604. var b = data[offset + position];
  11605. position++;
  11606. if (skipNextBit) {
  11607. buffer = buffer << 7 | b;
  11608. bufferSize += 7;
  11609. skipNextBit = false;
  11610. } else {
  11611. buffer = buffer << 8 | b;
  11612. bufferSize += 8;
  11613. }
  11614. if (b === 0xff) {
  11615. skipNextBit = true;
  11616. }
  11617. }
  11618. bufferSize -= count;
  11619. return buffer >>> bufferSize & (1 << count) - 1;
  11620. }
  11621. function skipMarkerIfEqual(value) {
  11622. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  11623. skipBytes(1);
  11624. return true;
  11625. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  11626. skipBytes(2);
  11627. return true;
  11628. }
  11629. return false;
  11630. }
  11631. function skipBytes(count) {
  11632. position += count;
  11633. }
  11634. function alignToByte() {
  11635. bufferSize = 0;
  11636. if (skipNextBit) {
  11637. position++;
  11638. skipNextBit = false;
  11639. }
  11640. }
  11641. function readCodingpasses() {
  11642. if (readBits(1) === 0) {
  11643. return 1;
  11644. }
  11645. if (readBits(1) === 0) {
  11646. return 2;
  11647. }
  11648. var value = readBits(2);
  11649. if (value < 3) {
  11650. return value + 3;
  11651. }
  11652. value = readBits(5);
  11653. if (value < 31) {
  11654. return value + 6;
  11655. }
  11656. value = readBits(7);
  11657. return value + 37;
  11658. }
  11659. var tileIndex = context.currentTile.index;
  11660. var tile = context.tiles[tileIndex];
  11661. var sopMarkerUsed = context.COD.sopMarkerUsed;
  11662. var ephMarkerUsed = context.COD.ephMarkerUsed;
  11663. var packetsIterator = tile.packetsIterator;
  11664. while (position < dataLength) {
  11665. alignToByte();
  11666. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  11667. skipBytes(4);
  11668. }
  11669. var packet = packetsIterator.nextPacket();
  11670. if (!readBits(1)) {
  11671. continue;
  11672. }
  11673. var layerNumber = packet.layerNumber;
  11674. var queue = [],
  11675. codeblock;
  11676. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  11677. codeblock = packet.codeblocks[i];
  11678. var precinct = codeblock.precinct;
  11679. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  11680. var codeblockRow = codeblock.cby - precinct.cbyMin;
  11681. var codeblockIncluded = false;
  11682. var firstTimeInclusion = false;
  11683. var valueReady;
  11684. if (codeblock.included !== undefined) {
  11685. codeblockIncluded = !!readBits(1);
  11686. } else {
  11687. precinct = codeblock.precinct;
  11688. var inclusionTree, zeroBitPlanesTree;
  11689. if (precinct.inclusionTree !== undefined) {
  11690. inclusionTree = precinct.inclusionTree;
  11691. } else {
  11692. var width = precinct.cbxMax - precinct.cbxMin + 1;
  11693. var height = precinct.cbyMax - precinct.cbyMin + 1;
  11694. inclusionTree = new InclusionTree(width, height, layerNumber);
  11695. zeroBitPlanesTree = new TagTree(width, height);
  11696. precinct.inclusionTree = inclusionTree;
  11697. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  11698. }
  11699. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  11700. while (true) {
  11701. if (readBits(1)) {
  11702. valueReady = !inclusionTree.nextLevel();
  11703. if (valueReady) {
  11704. codeblock.included = true;
  11705. codeblockIncluded = firstTimeInclusion = true;
  11706. break;
  11707. }
  11708. } else {
  11709. inclusionTree.incrementValue(layerNumber);
  11710. break;
  11711. }
  11712. }
  11713. }
  11714. }
  11715. if (!codeblockIncluded) {
  11716. continue;
  11717. }
  11718. if (firstTimeInclusion) {
  11719. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  11720. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  11721. while (true) {
  11722. if (readBits(1)) {
  11723. valueReady = !zeroBitPlanesTree.nextLevel();
  11724. if (valueReady) {
  11725. break;
  11726. }
  11727. } else {
  11728. zeroBitPlanesTree.incrementValue();
  11729. }
  11730. }
  11731. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  11732. }
  11733. var codingpasses = readCodingpasses();
  11734. while (readBits(1)) {
  11735. codeblock.Lblock++;
  11736. }
  11737. var codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  11738. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  11739. var codedDataLength = readBits(bits);
  11740. queue.push({
  11741. codeblock,
  11742. codingpasses,
  11743. dataLength: codedDataLength
  11744. });
  11745. }
  11746. alignToByte();
  11747. if (ephMarkerUsed) {
  11748. skipMarkerIfEqual(0x92);
  11749. }
  11750. while (queue.length > 0) {
  11751. var packetItem = queue.shift();
  11752. codeblock = packetItem.codeblock;
  11753. if (codeblock.data === undefined) {
  11754. codeblock.data = [];
  11755. }
  11756. codeblock.data.push({
  11757. data,
  11758. start: offset + position,
  11759. end: offset + position + packetItem.dataLength,
  11760. codingpasses: packetItem.codingpasses
  11761. });
  11762. position += packetItem.dataLength;
  11763. }
  11764. }
  11765. return position;
  11766. }
  11767. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  11768. var x0 = subband.tbx0;
  11769. var y0 = subband.tby0;
  11770. var width = subband.tbx1 - subband.tbx0;
  11771. var codeblocks = subband.codeblocks;
  11772. var right = subband.type.charAt(0) === "H" ? 1 : 0;
  11773. var bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  11774. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  11775. var codeblock = codeblocks[i];
  11776. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  11777. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  11778. if (blockWidth === 0 || blockHeight === 0) {
  11779. continue;
  11780. }
  11781. if (codeblock.data === undefined) {
  11782. continue;
  11783. }
  11784. var bitModel, currentCodingpassType;
  11785. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  11786. currentCodingpassType = 2;
  11787. var data = codeblock.data,
  11788. totalLength = 0,
  11789. codingpasses = 0;
  11790. var j, jj, dataItem;
  11791. for (j = 0, jj = data.length; j < jj; j++) {
  11792. dataItem = data[j];
  11793. totalLength += dataItem.end - dataItem.start;
  11794. codingpasses += dataItem.codingpasses;
  11795. }
  11796. var encodedData = new Uint8Array(totalLength);
  11797. var position = 0;
  11798. for (j = 0, jj = data.length; j < jj; j++) {
  11799. dataItem = data[j];
  11800. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  11801. encodedData.set(chunk, position);
  11802. position += chunk.length;
  11803. }
  11804. var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  11805. bitModel.setDecoder(decoder);
  11806. for (j = 0; j < codingpasses; j++) {
  11807. switch (currentCodingpassType) {
  11808. case 0:
  11809. bitModel.runSignificancePropagationPass();
  11810. break;
  11811. case 1:
  11812. bitModel.runMagnitudeRefinementPass();
  11813. break;
  11814. case 2:
  11815. bitModel.runCleanupPass();
  11816. if (segmentationSymbolUsed) {
  11817. bitModel.checkSegmentationSymbol();
  11818. }
  11819. break;
  11820. }
  11821. currentCodingpassType = (currentCodingpassType + 1) % 3;
  11822. }
  11823. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  11824. var sign = bitModel.coefficentsSign;
  11825. var magnitude = bitModel.coefficentsMagnitude;
  11826. var bitsDecoded = bitModel.bitsDecoded;
  11827. var magnitudeCorrection = reversible ? 0 : 0.5;
  11828. var k, n, nb;
  11829. position = 0;
  11830. var interleave = subband.type !== "LL";
  11831. for (j = 0; j < blockHeight; j++) {
  11832. var row = offset / width | 0;
  11833. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  11834. for (k = 0; k < blockWidth; k++) {
  11835. n = magnitude[position];
  11836. if (n !== 0) {
  11837. n = (n + magnitudeCorrection) * delta;
  11838. if (sign[position] !== 0) {
  11839. n = -n;
  11840. }
  11841. nb = bitsDecoded[position];
  11842. var pos = interleave ? levelOffset + (offset << 1) : offset;
  11843. if (reversible && nb >= mb) {
  11844. coefficients[pos] = n;
  11845. } else {
  11846. coefficients[pos] = n * (1 << mb - nb);
  11847. }
  11848. }
  11849. offset++;
  11850. position++;
  11851. }
  11852. offset += width - blockWidth;
  11853. }
  11854. }
  11855. }
  11856. function transformTile(context, tile, c) {
  11857. var component = tile.components[c];
  11858. var codingStyleParameters = component.codingStyleParameters;
  11859. var quantizationParameters = component.quantizationParameters;
  11860. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  11861. var spqcds = quantizationParameters.SPqcds;
  11862. var scalarExpounded = quantizationParameters.scalarExpounded;
  11863. var guardBits = quantizationParameters.guardBits;
  11864. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  11865. var precision = context.components[c].precision;
  11866. var reversible = codingStyleParameters.reversibleTransformation;
  11867. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  11868. var subbandCoefficients = [];
  11869. var b = 0;
  11870. for (var i = 0; i <= decompositionLevelsCount; i++) {
  11871. var resolution = component.resolutions[i];
  11872. var width = resolution.trx1 - resolution.trx0;
  11873. var height = resolution.try1 - resolution.try0;
  11874. var coefficients = new Float32Array(width * height);
  11875. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  11876. var mu, epsilon;
  11877. if (!scalarExpounded) {
  11878. mu = spqcds[0].mu;
  11879. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  11880. } else {
  11881. mu = spqcds[b].mu;
  11882. epsilon = spqcds[b].epsilon;
  11883. b++;
  11884. }
  11885. var subband = resolution.subbands[j];
  11886. var gainLog2 = SubbandsGainLog2[subband.type];
  11887. var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  11888. var mb = guardBits + epsilon - 1;
  11889. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  11890. }
  11891. subbandCoefficients.push({
  11892. width,
  11893. height,
  11894. items: coefficients
  11895. });
  11896. }
  11897. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  11898. return {
  11899. left: component.tcx0,
  11900. top: component.tcy0,
  11901. width: result.width,
  11902. height: result.height,
  11903. items: result.items
  11904. };
  11905. }
  11906. function transformComponents(context) {
  11907. var siz = context.SIZ;
  11908. var components = context.components;
  11909. var componentsCount = siz.Csiz;
  11910. var resultImages = [];
  11911. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  11912. var tile = context.tiles[i];
  11913. var transformedTiles = [];
  11914. var c;
  11915. for (c = 0; c < componentsCount; c++) {
  11916. transformedTiles[c] = transformTile(context, tile, c);
  11917. }
  11918. var tile0 = transformedTiles[0];
  11919. var out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  11920. var result = {
  11921. left: tile0.left,
  11922. top: tile0.top,
  11923. width: tile0.width,
  11924. height: tile0.height,
  11925. items: out
  11926. };
  11927. var shift, offset;
  11928. var pos = 0,
  11929. j,
  11930. jj,
  11931. y0,
  11932. y1,
  11933. y2;
  11934. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  11935. var fourComponents = componentsCount === 4;
  11936. var y0items = transformedTiles[0].items;
  11937. var y1items = transformedTiles[1].items;
  11938. var y2items = transformedTiles[2].items;
  11939. var y3items = fourComponents ? transformedTiles[3].items : null;
  11940. shift = components[0].precision - 8;
  11941. offset = (128 << shift) + 0.5;
  11942. var component0 = tile.components[0];
  11943. var alpha01 = componentsCount - 3;
  11944. jj = y0items.length;
  11945. if (!component0.codingStyleParameters.reversibleTransformation) {
  11946. for (j = 0; j < jj; j++, pos += alpha01) {
  11947. y0 = y0items[j] + offset;
  11948. y1 = y1items[j];
  11949. y2 = y2items[j];
  11950. out[pos++] = y0 + 1.402 * y2 >> shift;
  11951. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  11952. out[pos++] = y0 + 1.772 * y1 >> shift;
  11953. }
  11954. } else {
  11955. for (j = 0; j < jj; j++, pos += alpha01) {
  11956. y0 = y0items[j] + offset;
  11957. y1 = y1items[j];
  11958. y2 = y2items[j];
  11959. const g = y0 - (y2 + y1 >> 2);
  11960. out[pos++] = g + y2 >> shift;
  11961. out[pos++] = g >> shift;
  11962. out[pos++] = g + y1 >> shift;
  11963. }
  11964. }
  11965. if (fourComponents) {
  11966. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  11967. out[pos] = y3items[j] + offset >> shift;
  11968. }
  11969. }
  11970. } else {
  11971. for (c = 0; c < componentsCount; c++) {
  11972. var items = transformedTiles[c].items;
  11973. shift = components[c].precision - 8;
  11974. offset = (128 << shift) + 0.5;
  11975. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  11976. out[pos] = items[j] + offset >> shift;
  11977. pos += componentsCount;
  11978. }
  11979. }
  11980. }
  11981. resultImages.push(result);
  11982. }
  11983. return resultImages;
  11984. }
  11985. function initializeTile(context, tileIndex) {
  11986. var siz = context.SIZ;
  11987. var componentsCount = siz.Csiz;
  11988. var tile = context.tiles[tileIndex];
  11989. for (var c = 0; c < componentsCount; c++) {
  11990. var component = tile.components[c];
  11991. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  11992. component.quantizationParameters = qcdOrQcc;
  11993. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  11994. component.codingStyleParameters = codOrCoc;
  11995. }
  11996. tile.codingStyleDefaultParameters = context.currentTile.COD;
  11997. }
  11998. var TagTree = function TagTreeClosure() {
  11999. function TagTree(width, height) {
  12000. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12001. this.levels = [];
  12002. for (var i = 0; i < levelsLength; i++) {
  12003. var level = {
  12004. width,
  12005. height,
  12006. items: []
  12007. };
  12008. this.levels.push(level);
  12009. width = Math.ceil(width / 2);
  12010. height = Math.ceil(height / 2);
  12011. }
  12012. }
  12013. TagTree.prototype = {
  12014. reset: function TagTree_reset(i, j) {
  12015. var currentLevel = 0,
  12016. value = 0,
  12017. level;
  12018. while (currentLevel < this.levels.length) {
  12019. level = this.levels[currentLevel];
  12020. var index = i + j * level.width;
  12021. if (level.items[index] !== undefined) {
  12022. value = level.items[index];
  12023. break;
  12024. }
  12025. level.index = index;
  12026. i >>= 1;
  12027. j >>= 1;
  12028. currentLevel++;
  12029. }
  12030. currentLevel--;
  12031. level = this.levels[currentLevel];
  12032. level.items[level.index] = value;
  12033. this.currentLevel = currentLevel;
  12034. delete this.value;
  12035. },
  12036. incrementValue: function TagTree_incrementValue() {
  12037. var level = this.levels[this.currentLevel];
  12038. level.items[level.index]++;
  12039. },
  12040. nextLevel: function TagTree_nextLevel() {
  12041. var currentLevel = this.currentLevel;
  12042. var level = this.levels[currentLevel];
  12043. var value = level.items[level.index];
  12044. currentLevel--;
  12045. if (currentLevel < 0) {
  12046. this.value = value;
  12047. return false;
  12048. }
  12049. this.currentLevel = currentLevel;
  12050. level = this.levels[currentLevel];
  12051. level.items[level.index] = value;
  12052. return true;
  12053. }
  12054. };
  12055. return TagTree;
  12056. }();
  12057. var InclusionTree = function InclusionTreeClosure() {
  12058. function InclusionTree(width, height, defaultValue) {
  12059. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12060. this.levels = [];
  12061. for (var i = 0; i < levelsLength; i++) {
  12062. var items = new Uint8Array(width * height);
  12063. for (var j = 0, jj = items.length; j < jj; j++) {
  12064. items[j] = defaultValue;
  12065. }
  12066. var level = {
  12067. width,
  12068. height,
  12069. items
  12070. };
  12071. this.levels.push(level);
  12072. width = Math.ceil(width / 2);
  12073. height = Math.ceil(height / 2);
  12074. }
  12075. }
  12076. InclusionTree.prototype = {
  12077. reset: function InclusionTree_reset(i, j, stopValue) {
  12078. var currentLevel = 0;
  12079. while (currentLevel < this.levels.length) {
  12080. var level = this.levels[currentLevel];
  12081. var index = i + j * level.width;
  12082. level.index = index;
  12083. var value = level.items[index];
  12084. if (value === 0xff) {
  12085. break;
  12086. }
  12087. if (value > stopValue) {
  12088. this.currentLevel = currentLevel;
  12089. this.propagateValues();
  12090. return false;
  12091. }
  12092. i >>= 1;
  12093. j >>= 1;
  12094. currentLevel++;
  12095. }
  12096. this.currentLevel = currentLevel - 1;
  12097. return true;
  12098. },
  12099. incrementValue: function InclusionTree_incrementValue(stopValue) {
  12100. var level = this.levels[this.currentLevel];
  12101. level.items[level.index] = stopValue + 1;
  12102. this.propagateValues();
  12103. },
  12104. propagateValues: function InclusionTree_propagateValues() {
  12105. var levelIndex = this.currentLevel;
  12106. var level = this.levels[levelIndex];
  12107. var currentValue = level.items[level.index];
  12108. while (--levelIndex >= 0) {
  12109. level = this.levels[levelIndex];
  12110. level.items[level.index] = currentValue;
  12111. }
  12112. },
  12113. nextLevel: function InclusionTree_nextLevel() {
  12114. var currentLevel = this.currentLevel;
  12115. var level = this.levels[currentLevel];
  12116. var value = level.items[level.index];
  12117. level.items[level.index] = 0xff;
  12118. currentLevel--;
  12119. if (currentLevel < 0) {
  12120. return false;
  12121. }
  12122. this.currentLevel = currentLevel;
  12123. level = this.levels[currentLevel];
  12124. level.items[level.index] = value;
  12125. return true;
  12126. }
  12127. };
  12128. return InclusionTree;
  12129. }();
  12130. var BitModel = function BitModelClosure() {
  12131. var UNIFORM_CONTEXT = 17;
  12132. var RUNLENGTH_CONTEXT = 18;
  12133. var 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]);
  12134. var 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]);
  12135. var 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]);
  12136. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  12137. this.width = width;
  12138. this.height = height;
  12139. let contextLabelTable;
  12140. if (subband === "HH") {
  12141. contextLabelTable = HHContextLabel;
  12142. } else if (subband === "HL") {
  12143. contextLabelTable = HLContextLabel;
  12144. } else {
  12145. contextLabelTable = LLAndLHContextsLabel;
  12146. }
  12147. this.contextLabelTable = contextLabelTable;
  12148. var coefficientCount = width * height;
  12149. this.neighborsSignificance = new Uint8Array(coefficientCount);
  12150. this.coefficentsSign = new Uint8Array(coefficientCount);
  12151. let coefficentsMagnitude;
  12152. if (mb > 14) {
  12153. coefficentsMagnitude = new Uint32Array(coefficientCount);
  12154. } else if (mb > 6) {
  12155. coefficentsMagnitude = new Uint16Array(coefficientCount);
  12156. } else {
  12157. coefficentsMagnitude = new Uint8Array(coefficientCount);
  12158. }
  12159. this.coefficentsMagnitude = coefficentsMagnitude;
  12160. this.processingFlags = new Uint8Array(coefficientCount);
  12161. var bitsDecoded = new Uint8Array(coefficientCount);
  12162. if (zeroBitPlanes !== 0) {
  12163. for (var i = 0; i < coefficientCount; i++) {
  12164. bitsDecoded[i] = zeroBitPlanes;
  12165. }
  12166. }
  12167. this.bitsDecoded = bitsDecoded;
  12168. this.reset();
  12169. }
  12170. BitModel.prototype = {
  12171. setDecoder: function BitModel_setDecoder(decoder) {
  12172. this.decoder = decoder;
  12173. },
  12174. reset: function BitModel_reset() {
  12175. this.contexts = new Int8Array(19);
  12176. this.contexts[0] = 4 << 1 | 0;
  12177. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  12178. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  12179. },
  12180. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  12181. var neighborsSignificance = this.neighborsSignificance;
  12182. var width = this.width,
  12183. height = this.height;
  12184. var left = column > 0;
  12185. var right = column + 1 < width;
  12186. var i;
  12187. if (row > 0) {
  12188. i = index - width;
  12189. if (left) {
  12190. neighborsSignificance[i - 1] += 0x10;
  12191. }
  12192. if (right) {
  12193. neighborsSignificance[i + 1] += 0x10;
  12194. }
  12195. neighborsSignificance[i] += 0x04;
  12196. }
  12197. if (row + 1 < height) {
  12198. i = index + width;
  12199. if (left) {
  12200. neighborsSignificance[i - 1] += 0x10;
  12201. }
  12202. if (right) {
  12203. neighborsSignificance[i + 1] += 0x10;
  12204. }
  12205. neighborsSignificance[i] += 0x04;
  12206. }
  12207. if (left) {
  12208. neighborsSignificance[index - 1] += 0x01;
  12209. }
  12210. if (right) {
  12211. neighborsSignificance[index + 1] += 0x01;
  12212. }
  12213. neighborsSignificance[index] |= 0x80;
  12214. },
  12215. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  12216. var decoder = this.decoder;
  12217. var width = this.width,
  12218. height = this.height;
  12219. var coefficentsMagnitude = this.coefficentsMagnitude;
  12220. var coefficentsSign = this.coefficentsSign;
  12221. var neighborsSignificance = this.neighborsSignificance;
  12222. var processingFlags = this.processingFlags;
  12223. var contexts = this.contexts;
  12224. var labels = this.contextLabelTable;
  12225. var bitsDecoded = this.bitsDecoded;
  12226. var processedInverseMask = ~1;
  12227. var processedMask = 1;
  12228. var firstMagnitudeBitMask = 2;
  12229. for (var i0 = 0; i0 < height; i0 += 4) {
  12230. for (var j = 0; j < width; j++) {
  12231. var index = i0 * width + j;
  12232. for (var i1 = 0; i1 < 4; i1++, index += width) {
  12233. var i = i0 + i1;
  12234. if (i >= height) {
  12235. break;
  12236. }
  12237. processingFlags[index] &= processedInverseMask;
  12238. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  12239. continue;
  12240. }
  12241. var contextLabel = labels[neighborsSignificance[index]];
  12242. var decision = decoder.readBit(contexts, contextLabel);
  12243. if (decision) {
  12244. var sign = this.decodeSignBit(i, j, index);
  12245. coefficentsSign[index] = sign;
  12246. coefficentsMagnitude[index] = 1;
  12247. this.setNeighborsSignificance(i, j, index);
  12248. processingFlags[index] |= firstMagnitudeBitMask;
  12249. }
  12250. bitsDecoded[index]++;
  12251. processingFlags[index] |= processedMask;
  12252. }
  12253. }
  12254. }
  12255. },
  12256. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  12257. var width = this.width,
  12258. height = this.height;
  12259. var coefficentsMagnitude = this.coefficentsMagnitude;
  12260. var coefficentsSign = this.coefficentsSign;
  12261. var contribution, sign0, sign1, significance1;
  12262. var contextLabel, decoded;
  12263. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  12264. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  12265. sign1 = coefficentsSign[index + 1];
  12266. if (significance1) {
  12267. sign0 = coefficentsSign[index - 1];
  12268. contribution = 1 - sign1 - sign0;
  12269. } else {
  12270. contribution = 1 - sign1 - sign1;
  12271. }
  12272. } else if (significance1) {
  12273. sign0 = coefficentsSign[index - 1];
  12274. contribution = 1 - sign0 - sign0;
  12275. } else {
  12276. contribution = 0;
  12277. }
  12278. var horizontalContribution = 3 * contribution;
  12279. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  12280. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  12281. sign1 = coefficentsSign[index + width];
  12282. if (significance1) {
  12283. sign0 = coefficentsSign[index - width];
  12284. contribution = 1 - sign1 - sign0 + horizontalContribution;
  12285. } else {
  12286. contribution = 1 - sign1 - sign1 + horizontalContribution;
  12287. }
  12288. } else if (significance1) {
  12289. sign0 = coefficentsSign[index - width];
  12290. contribution = 1 - sign0 - sign0 + horizontalContribution;
  12291. } else {
  12292. contribution = horizontalContribution;
  12293. }
  12294. if (contribution >= 0) {
  12295. contextLabel = 9 + contribution;
  12296. decoded = this.decoder.readBit(this.contexts, contextLabel);
  12297. } else {
  12298. contextLabel = 9 - contribution;
  12299. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  12300. }
  12301. return decoded;
  12302. },
  12303. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  12304. var decoder = this.decoder;
  12305. var width = this.width,
  12306. height = this.height;
  12307. var coefficentsMagnitude = this.coefficentsMagnitude;
  12308. var neighborsSignificance = this.neighborsSignificance;
  12309. var contexts = this.contexts;
  12310. var bitsDecoded = this.bitsDecoded;
  12311. var processingFlags = this.processingFlags;
  12312. var processedMask = 1;
  12313. var firstMagnitudeBitMask = 2;
  12314. var length = width * height;
  12315. var width4 = width * 4;
  12316. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  12317. indexNext = Math.min(length, index0 + width4);
  12318. for (var j = 0; j < width; j++) {
  12319. for (var index = index0 + j; index < indexNext; index += width) {
  12320. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  12321. continue;
  12322. }
  12323. var contextLabel = 16;
  12324. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  12325. processingFlags[index] ^= firstMagnitudeBitMask;
  12326. var significance = neighborsSignificance[index] & 127;
  12327. contextLabel = significance === 0 ? 15 : 14;
  12328. }
  12329. var bit = decoder.readBit(contexts, contextLabel);
  12330. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  12331. bitsDecoded[index]++;
  12332. processingFlags[index] |= processedMask;
  12333. }
  12334. }
  12335. }
  12336. },
  12337. runCleanupPass: function BitModel_runCleanupPass() {
  12338. var decoder = this.decoder;
  12339. var width = this.width,
  12340. height = this.height;
  12341. var neighborsSignificance = this.neighborsSignificance;
  12342. var coefficentsMagnitude = this.coefficentsMagnitude;
  12343. var coefficentsSign = this.coefficentsSign;
  12344. var contexts = this.contexts;
  12345. var labels = this.contextLabelTable;
  12346. var bitsDecoded = this.bitsDecoded;
  12347. var processingFlags = this.processingFlags;
  12348. var processedMask = 1;
  12349. var firstMagnitudeBitMask = 2;
  12350. var oneRowDown = width;
  12351. var twoRowsDown = width * 2;
  12352. var threeRowsDown = width * 3;
  12353. var iNext;
  12354. for (var i0 = 0; i0 < height; i0 = iNext) {
  12355. iNext = Math.min(i0 + 4, height);
  12356. var indexBase = i0 * width;
  12357. var checkAllEmpty = i0 + 3 < height;
  12358. for (var j = 0; j < width; j++) {
  12359. var index0 = indexBase + j;
  12360. var 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;
  12361. var i1 = 0,
  12362. index = index0;
  12363. var i = i0,
  12364. sign;
  12365. if (allEmpty) {
  12366. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  12367. if (!hasSignificantCoefficent) {
  12368. bitsDecoded[index0]++;
  12369. bitsDecoded[index0 + oneRowDown]++;
  12370. bitsDecoded[index0 + twoRowsDown]++;
  12371. bitsDecoded[index0 + threeRowsDown]++;
  12372. continue;
  12373. }
  12374. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  12375. if (i1 !== 0) {
  12376. i = i0 + i1;
  12377. index += i1 * width;
  12378. }
  12379. sign = this.decodeSignBit(i, j, index);
  12380. coefficentsSign[index] = sign;
  12381. coefficentsMagnitude[index] = 1;
  12382. this.setNeighborsSignificance(i, j, index);
  12383. processingFlags[index] |= firstMagnitudeBitMask;
  12384. index = index0;
  12385. for (var i2 = i0; i2 <= i; i2++, index += width) {
  12386. bitsDecoded[index]++;
  12387. }
  12388. i1++;
  12389. }
  12390. for (i = i0 + i1; i < iNext; i++, index += width) {
  12391. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  12392. continue;
  12393. }
  12394. var contextLabel = labels[neighborsSignificance[index]];
  12395. var decision = decoder.readBit(contexts, contextLabel);
  12396. if (decision === 1) {
  12397. sign = this.decodeSignBit(i, j, index);
  12398. coefficentsSign[index] = sign;
  12399. coefficentsMagnitude[index] = 1;
  12400. this.setNeighborsSignificance(i, j, index);
  12401. processingFlags[index] |= firstMagnitudeBitMask;
  12402. }
  12403. bitsDecoded[index]++;
  12404. }
  12405. }
  12406. }
  12407. },
  12408. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  12409. var decoder = this.decoder;
  12410. var contexts = this.contexts;
  12411. var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  12412. if (symbol !== 0xa) {
  12413. throw new JpxError("Invalid segmentation symbol");
  12414. }
  12415. }
  12416. };
  12417. return BitModel;
  12418. }();
  12419. var Transform = function TransformClosure() {
  12420. function Transform() {}
  12421. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  12422. var ll = subbands[0];
  12423. for (var i = 1, ii = subbands.length; i < ii; i++) {
  12424. ll = this.iterate(ll, subbands[i], u0, v0);
  12425. }
  12426. return ll;
  12427. };
  12428. Transform.prototype.extend = function extend(buffer, offset, size) {
  12429. var i1 = offset - 1,
  12430. j1 = offset + 1;
  12431. var i2 = offset + size - 2,
  12432. j2 = offset + size;
  12433. buffer[i1--] = buffer[j1++];
  12434. buffer[j2++] = buffer[i2--];
  12435. buffer[i1--] = buffer[j1++];
  12436. buffer[j2++] = buffer[i2--];
  12437. buffer[i1--] = buffer[j1++];
  12438. buffer[j2++] = buffer[i2--];
  12439. buffer[i1] = buffer[j1];
  12440. buffer[j2] = buffer[i2];
  12441. };
  12442. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  12443. var llWidth = ll.width,
  12444. llHeight = ll.height,
  12445. llItems = ll.items;
  12446. var width = hl_lh_hh.width;
  12447. var height = hl_lh_hh.height;
  12448. var items = hl_lh_hh.items;
  12449. var i, j, k, l, u, v;
  12450. for (k = 0, i = 0; i < llHeight; i++) {
  12451. l = i * 2 * width;
  12452. for (j = 0; j < llWidth; j++, k++, l += 2) {
  12453. items[l] = llItems[k];
  12454. }
  12455. }
  12456. llItems = ll.items = null;
  12457. var bufferPadding = 4;
  12458. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  12459. if (width === 1) {
  12460. if ((u0 & 1) !== 0) {
  12461. for (v = 0, k = 0; v < height; v++, k += width) {
  12462. items[k] *= 0.5;
  12463. }
  12464. }
  12465. } else {
  12466. for (v = 0, k = 0; v < height; v++, k += width) {
  12467. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  12468. this.extend(rowBuffer, bufferPadding, width);
  12469. this.filter(rowBuffer, bufferPadding, width);
  12470. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  12471. }
  12472. }
  12473. var numBuffers = 16;
  12474. var colBuffers = [];
  12475. for (i = 0; i < numBuffers; i++) {
  12476. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  12477. }
  12478. var b,
  12479. currentBuffer = 0;
  12480. ll = bufferPadding + height;
  12481. if (height === 1) {
  12482. if ((v0 & 1) !== 0) {
  12483. for (u = 0; u < width; u++) {
  12484. items[u] *= 0.5;
  12485. }
  12486. }
  12487. } else {
  12488. for (u = 0; u < width; u++) {
  12489. if (currentBuffer === 0) {
  12490. numBuffers = Math.min(width - u, numBuffers);
  12491. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  12492. for (b = 0; b < numBuffers; b++) {
  12493. colBuffers[b][l] = items[k + b];
  12494. }
  12495. }
  12496. currentBuffer = numBuffers;
  12497. }
  12498. currentBuffer--;
  12499. var buffer = colBuffers[currentBuffer];
  12500. this.extend(buffer, bufferPadding, height);
  12501. this.filter(buffer, bufferPadding, height);
  12502. if (currentBuffer === 0) {
  12503. k = u - numBuffers + 1;
  12504. for (l = bufferPadding; l < ll; k += width, l++) {
  12505. for (b = 0; b < numBuffers; b++) {
  12506. items[k + b] = colBuffers[b][l];
  12507. }
  12508. }
  12509. }
  12510. }
  12511. }
  12512. return {
  12513. width,
  12514. height,
  12515. items
  12516. };
  12517. };
  12518. return Transform;
  12519. }();
  12520. var IrreversibleTransform = function IrreversibleTransformClosure() {
  12521. function IrreversibleTransform() {
  12522. Transform.call(this);
  12523. }
  12524. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  12525. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  12526. var len = length >> 1;
  12527. offset = offset | 0;
  12528. var j, n, current, next;
  12529. var alpha = -1.586134342059924;
  12530. var beta = -0.052980118572961;
  12531. var gamma = 0.882911075530934;
  12532. var delta = 0.443506852043971;
  12533. var K = 1.230174104914001;
  12534. var K_ = 1 / K;
  12535. j = offset - 3;
  12536. for (n = len + 4; n--; j += 2) {
  12537. x[j] *= K_;
  12538. }
  12539. j = offset - 2;
  12540. current = delta * x[j - 1];
  12541. for (n = len + 3; n--; j += 2) {
  12542. next = delta * x[j + 1];
  12543. x[j] = K * x[j] - current - next;
  12544. if (n--) {
  12545. j += 2;
  12546. current = delta * x[j + 1];
  12547. x[j] = K * x[j] - current - next;
  12548. } else {
  12549. break;
  12550. }
  12551. }
  12552. j = offset - 1;
  12553. current = gamma * x[j - 1];
  12554. for (n = len + 2; n--; j += 2) {
  12555. next = gamma * x[j + 1];
  12556. x[j] -= current + next;
  12557. if (n--) {
  12558. j += 2;
  12559. current = gamma * x[j + 1];
  12560. x[j] -= current + next;
  12561. } else {
  12562. break;
  12563. }
  12564. }
  12565. j = offset;
  12566. current = beta * x[j - 1];
  12567. for (n = len + 1; n--; j += 2) {
  12568. next = beta * x[j + 1];
  12569. x[j] -= current + next;
  12570. if (n--) {
  12571. j += 2;
  12572. current = beta * x[j + 1];
  12573. x[j] -= current + next;
  12574. } else {
  12575. break;
  12576. }
  12577. }
  12578. if (len !== 0) {
  12579. j = offset + 1;
  12580. current = alpha * x[j - 1];
  12581. for (n = len; n--; j += 2) {
  12582. next = alpha * x[j + 1];
  12583. x[j] -= current + next;
  12584. if (n--) {
  12585. j += 2;
  12586. current = alpha * x[j + 1];
  12587. x[j] -= current + next;
  12588. } else {
  12589. break;
  12590. }
  12591. }
  12592. }
  12593. };
  12594. return IrreversibleTransform;
  12595. }();
  12596. var ReversibleTransform = function ReversibleTransformClosure() {
  12597. function ReversibleTransform() {
  12598. Transform.call(this);
  12599. }
  12600. ReversibleTransform.prototype = Object.create(Transform.prototype);
  12601. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  12602. var len = length >> 1;
  12603. offset = offset | 0;
  12604. var j, n;
  12605. for (j = offset, n = len + 1; n--; j += 2) {
  12606. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  12607. }
  12608. for (j = offset + 1, n = len; n--; j += 2) {
  12609. x[j] += x[j - 1] + x[j + 1] >> 1;
  12610. }
  12611. };
  12612. return ReversibleTransform;
  12613. }();
  12614. return JpxImage;
  12615. }();
  12616. exports.JpxImage = JpxImage;
  12617. /***/ }),
  12618. /* 22 */
  12619. /***/ (function(module, exports, __w_pdfjs_require__) {
  12620. "use strict";
  12621. Object.defineProperty(exports, "__esModule", {
  12622. value: true
  12623. });
  12624. exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  12625. var _util = __w_pdfjs_require__(2);
  12626. var _primitives = __w_pdfjs_require__(5);
  12627. var _stream = __w_pdfjs_require__(12);
  12628. var ARCFourCipher = function ARCFourCipherClosure() {
  12629. function ARCFourCipher(key) {
  12630. this.a = 0;
  12631. this.b = 0;
  12632. var s = new Uint8Array(256);
  12633. var i,
  12634. j = 0,
  12635. tmp,
  12636. keyLength = key.length;
  12637. for (i = 0; i < 256; ++i) {
  12638. s[i] = i;
  12639. }
  12640. for (i = 0; i < 256; ++i) {
  12641. tmp = s[i];
  12642. j = j + tmp + key[i % keyLength] & 0xff;
  12643. s[i] = s[j];
  12644. s[j] = tmp;
  12645. }
  12646. this.s = s;
  12647. }
  12648. ARCFourCipher.prototype = {
  12649. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  12650. var i,
  12651. n = data.length,
  12652. tmp,
  12653. tmp2;
  12654. var a = this.a,
  12655. b = this.b,
  12656. s = this.s;
  12657. var output = new Uint8Array(n);
  12658. for (i = 0; i < n; ++i) {
  12659. a = a + 1 & 0xff;
  12660. tmp = s[a];
  12661. b = b + tmp & 0xff;
  12662. tmp2 = s[b];
  12663. s[a] = tmp2;
  12664. s[b] = tmp;
  12665. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  12666. }
  12667. this.a = a;
  12668. this.b = b;
  12669. return output;
  12670. }
  12671. };
  12672. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  12673. return ARCFourCipher;
  12674. }();
  12675. exports.ARCFourCipher = ARCFourCipher;
  12676. var calculateMD5 = function calculateMD5Closure() {
  12677. var 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]);
  12678. var 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]);
  12679. function hash(data, offset, length) {
  12680. var h0 = 1732584193,
  12681. h1 = -271733879,
  12682. h2 = -1732584194,
  12683. h3 = 271733878;
  12684. var paddedLength = length + 72 & ~63;
  12685. var padded = new Uint8Array(paddedLength);
  12686. var i, j, n;
  12687. for (i = 0; i < length; ++i) {
  12688. padded[i] = data[offset++];
  12689. }
  12690. padded[i++] = 0x80;
  12691. n = paddedLength - 8;
  12692. while (i < n) {
  12693. padded[i++] = 0;
  12694. }
  12695. padded[i++] = length << 3 & 0xff;
  12696. padded[i++] = length >> 5 & 0xff;
  12697. padded[i++] = length >> 13 & 0xff;
  12698. padded[i++] = length >> 21 & 0xff;
  12699. padded[i++] = length >>> 29 & 0xff;
  12700. padded[i++] = 0;
  12701. padded[i++] = 0;
  12702. padded[i++] = 0;
  12703. var w = new Int32Array(16);
  12704. for (i = 0; i < paddedLength;) {
  12705. for (j = 0; j < 16; ++j, i += 4) {
  12706. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  12707. }
  12708. var a = h0,
  12709. b = h1,
  12710. c = h2,
  12711. d = h3,
  12712. f,
  12713. g;
  12714. for (j = 0; j < 64; ++j) {
  12715. if (j < 16) {
  12716. f = b & c | ~b & d;
  12717. g = j;
  12718. } else if (j < 32) {
  12719. f = d & b | ~d & c;
  12720. g = 5 * j + 1 & 15;
  12721. } else if (j < 48) {
  12722. f = b ^ c ^ d;
  12723. g = 3 * j + 5 & 15;
  12724. } else {
  12725. f = c ^ (b | ~d);
  12726. g = 7 * j & 15;
  12727. }
  12728. var tmp = d,
  12729. rotateArg = a + f + k[j] + w[g] | 0,
  12730. rotate = r[j];
  12731. d = c;
  12732. c = b;
  12733. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  12734. a = tmp;
  12735. }
  12736. h0 = h0 + a | 0;
  12737. h1 = h1 + b | 0;
  12738. h2 = h2 + c | 0;
  12739. h3 = h3 + d | 0;
  12740. }
  12741. 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]);
  12742. }
  12743. return hash;
  12744. }();
  12745. exports.calculateMD5 = calculateMD5;
  12746. var Word64 = function Word64Closure() {
  12747. function Word64(highInteger, lowInteger) {
  12748. this.high = highInteger | 0;
  12749. this.low = lowInteger | 0;
  12750. }
  12751. Word64.prototype = {
  12752. and: function Word64_and(word) {
  12753. this.high &= word.high;
  12754. this.low &= word.low;
  12755. },
  12756. xor: function Word64_xor(word) {
  12757. this.high ^= word.high;
  12758. this.low ^= word.low;
  12759. },
  12760. or: function Word64_or(word) {
  12761. this.high |= word.high;
  12762. this.low |= word.low;
  12763. },
  12764. shiftRight: function Word64_shiftRight(places) {
  12765. if (places >= 32) {
  12766. this.low = this.high >>> places - 32 | 0;
  12767. this.high = 0;
  12768. } else {
  12769. this.low = this.low >>> places | this.high << 32 - places;
  12770. this.high = this.high >>> places | 0;
  12771. }
  12772. },
  12773. shiftLeft: function Word64_shiftLeft(places) {
  12774. if (places >= 32) {
  12775. this.high = this.low << places - 32;
  12776. this.low = 0;
  12777. } else {
  12778. this.high = this.high << places | this.low >>> 32 - places;
  12779. this.low = this.low << places;
  12780. }
  12781. },
  12782. rotateRight: function Word64_rotateRight(places) {
  12783. var low, high;
  12784. if (places & 32) {
  12785. high = this.low;
  12786. low = this.high;
  12787. } else {
  12788. low = this.low;
  12789. high = this.high;
  12790. }
  12791. places &= 31;
  12792. this.low = low >>> places | high << 32 - places;
  12793. this.high = high >>> places | low << 32 - places;
  12794. },
  12795. not: function Word64_not() {
  12796. this.high = ~this.high;
  12797. this.low = ~this.low;
  12798. },
  12799. add: function Word64_add(word) {
  12800. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  12801. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  12802. if (lowAdd > 0xffffffff) {
  12803. highAdd += 1;
  12804. }
  12805. this.low = lowAdd | 0;
  12806. this.high = highAdd | 0;
  12807. },
  12808. copyTo: function Word64_copyTo(bytes, offset) {
  12809. bytes[offset] = this.high >>> 24 & 0xff;
  12810. bytes[offset + 1] = this.high >> 16 & 0xff;
  12811. bytes[offset + 2] = this.high >> 8 & 0xff;
  12812. bytes[offset + 3] = this.high & 0xff;
  12813. bytes[offset + 4] = this.low >>> 24 & 0xff;
  12814. bytes[offset + 5] = this.low >> 16 & 0xff;
  12815. bytes[offset + 6] = this.low >> 8 & 0xff;
  12816. bytes[offset + 7] = this.low & 0xff;
  12817. },
  12818. assign: function Word64_assign(word) {
  12819. this.high = word.high;
  12820. this.low = word.low;
  12821. }
  12822. };
  12823. return Word64;
  12824. }();
  12825. var calculateSHA256 = function calculateSHA256Closure() {
  12826. function rotr(x, n) {
  12827. return x >>> n | x << 32 - n;
  12828. }
  12829. function ch(x, y, z) {
  12830. return x & y ^ ~x & z;
  12831. }
  12832. function maj(x, y, z) {
  12833. return x & y ^ x & z ^ y & z;
  12834. }
  12835. function sigma(x) {
  12836. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  12837. }
  12838. function sigmaPrime(x) {
  12839. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  12840. }
  12841. function littleSigma(x) {
  12842. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  12843. }
  12844. function littleSigmaPrime(x) {
  12845. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  12846. }
  12847. var 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];
  12848. function hash(data, offset, length) {
  12849. var h0 = 0x6a09e667,
  12850. h1 = 0xbb67ae85,
  12851. h2 = 0x3c6ef372,
  12852. h3 = 0xa54ff53a,
  12853. h4 = 0x510e527f,
  12854. h5 = 0x9b05688c,
  12855. h6 = 0x1f83d9ab,
  12856. h7 = 0x5be0cd19;
  12857. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  12858. var padded = new Uint8Array(paddedLength);
  12859. var i, j, n;
  12860. for (i = 0; i < length; ++i) {
  12861. padded[i] = data[offset++];
  12862. }
  12863. padded[i++] = 0x80;
  12864. n = paddedLength - 8;
  12865. while (i < n) {
  12866. padded[i++] = 0;
  12867. }
  12868. padded[i++] = 0;
  12869. padded[i++] = 0;
  12870. padded[i++] = 0;
  12871. padded[i++] = length >>> 29 & 0xff;
  12872. padded[i++] = length >> 21 & 0xff;
  12873. padded[i++] = length >> 13 & 0xff;
  12874. padded[i++] = length >> 5 & 0xff;
  12875. padded[i++] = length << 3 & 0xff;
  12876. var w = new Uint32Array(64);
  12877. for (i = 0; i < paddedLength;) {
  12878. for (j = 0; j < 16; ++j) {
  12879. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  12880. i += 4;
  12881. }
  12882. for (j = 16; j < 64; ++j) {
  12883. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  12884. }
  12885. var a = h0,
  12886. b = h1,
  12887. c = h2,
  12888. d = h3,
  12889. e = h4,
  12890. f = h5,
  12891. g = h6,
  12892. h = h7,
  12893. t1,
  12894. t2;
  12895. for (j = 0; j < 64; ++j) {
  12896. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  12897. t2 = sigma(a) + maj(a, b, c);
  12898. h = g;
  12899. g = f;
  12900. f = e;
  12901. e = d + t1 | 0;
  12902. d = c;
  12903. c = b;
  12904. b = a;
  12905. a = t1 + t2 | 0;
  12906. }
  12907. h0 = h0 + a | 0;
  12908. h1 = h1 + b | 0;
  12909. h2 = h2 + c | 0;
  12910. h3 = h3 + d | 0;
  12911. h4 = h4 + e | 0;
  12912. h5 = h5 + f | 0;
  12913. h6 = h6 + g | 0;
  12914. h7 = h7 + h | 0;
  12915. }
  12916. 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]);
  12917. }
  12918. return hash;
  12919. }();
  12920. exports.calculateSHA256 = calculateSHA256;
  12921. var calculateSHA512 = function calculateSHA512Closure() {
  12922. function ch(result, x, y, z, tmp) {
  12923. result.assign(x);
  12924. result.and(y);
  12925. tmp.assign(x);
  12926. tmp.not();
  12927. tmp.and(z);
  12928. result.xor(tmp);
  12929. }
  12930. function maj(result, x, y, z, tmp) {
  12931. result.assign(x);
  12932. result.and(y);
  12933. tmp.assign(x);
  12934. tmp.and(z);
  12935. result.xor(tmp);
  12936. tmp.assign(y);
  12937. tmp.and(z);
  12938. result.xor(tmp);
  12939. }
  12940. function sigma(result, x, tmp) {
  12941. result.assign(x);
  12942. result.rotateRight(28);
  12943. tmp.assign(x);
  12944. tmp.rotateRight(34);
  12945. result.xor(tmp);
  12946. tmp.assign(x);
  12947. tmp.rotateRight(39);
  12948. result.xor(tmp);
  12949. }
  12950. function sigmaPrime(result, x, tmp) {
  12951. result.assign(x);
  12952. result.rotateRight(14);
  12953. tmp.assign(x);
  12954. tmp.rotateRight(18);
  12955. result.xor(tmp);
  12956. tmp.assign(x);
  12957. tmp.rotateRight(41);
  12958. result.xor(tmp);
  12959. }
  12960. function littleSigma(result, x, tmp) {
  12961. result.assign(x);
  12962. result.rotateRight(1);
  12963. tmp.assign(x);
  12964. tmp.rotateRight(8);
  12965. result.xor(tmp);
  12966. tmp.assign(x);
  12967. tmp.shiftRight(7);
  12968. result.xor(tmp);
  12969. }
  12970. function littleSigmaPrime(result, x, tmp) {
  12971. result.assign(x);
  12972. result.rotateRight(19);
  12973. tmp.assign(x);
  12974. tmp.rotateRight(61);
  12975. result.xor(tmp);
  12976. tmp.assign(x);
  12977. tmp.shiftRight(6);
  12978. result.xor(tmp);
  12979. }
  12980. var 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)];
  12981. function hash(data, offset, length, mode384) {
  12982. mode384 = !!mode384;
  12983. var h0, h1, h2, h3, h4, h5, h6, h7;
  12984. if (!mode384) {
  12985. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  12986. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  12987. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  12988. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  12989. h4 = new Word64(0x510e527f, 0xade682d1);
  12990. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  12991. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  12992. h7 = new Word64(0x5be0cd19, 0x137e2179);
  12993. } else {
  12994. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  12995. h1 = new Word64(0x629a292a, 0x367cd507);
  12996. h2 = new Word64(0x9159015a, 0x3070dd17);
  12997. h3 = new Word64(0x152fecd8, 0xf70e5939);
  12998. h4 = new Word64(0x67332667, 0xffc00b31);
  12999. h5 = new Word64(0x8eb44a87, 0x68581511);
  13000. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  13001. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  13002. }
  13003. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  13004. var padded = new Uint8Array(paddedLength);
  13005. var i, j, n;
  13006. for (i = 0; i < length; ++i) {
  13007. padded[i] = data[offset++];
  13008. }
  13009. padded[i++] = 0x80;
  13010. n = paddedLength - 16;
  13011. while (i < n) {
  13012. padded[i++] = 0;
  13013. }
  13014. padded[i++] = 0;
  13015. padded[i++] = 0;
  13016. padded[i++] = 0;
  13017. padded[i++] = 0;
  13018. padded[i++] = 0;
  13019. padded[i++] = 0;
  13020. padded[i++] = 0;
  13021. padded[i++] = 0;
  13022. padded[i++] = 0;
  13023. padded[i++] = 0;
  13024. padded[i++] = 0;
  13025. padded[i++] = length >>> 29 & 0xff;
  13026. padded[i++] = length >> 21 & 0xff;
  13027. padded[i++] = length >> 13 & 0xff;
  13028. padded[i++] = length >> 5 & 0xff;
  13029. padded[i++] = length << 3 & 0xff;
  13030. var w = new Array(80);
  13031. for (i = 0; i < 80; i++) {
  13032. w[i] = new Word64(0, 0);
  13033. }
  13034. var a = new Word64(0, 0),
  13035. b = new Word64(0, 0),
  13036. c = new Word64(0, 0);
  13037. var d = new Word64(0, 0),
  13038. e = new Word64(0, 0),
  13039. f = new Word64(0, 0);
  13040. var g = new Word64(0, 0),
  13041. h = new Word64(0, 0);
  13042. var t1 = new Word64(0, 0),
  13043. t2 = new Word64(0, 0);
  13044. var tmp1 = new Word64(0, 0),
  13045. tmp2 = new Word64(0, 0),
  13046. tmp3;
  13047. for (i = 0; i < paddedLength;) {
  13048. for (j = 0; j < 16; ++j) {
  13049. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13050. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  13051. i += 8;
  13052. }
  13053. for (j = 16; j < 80; ++j) {
  13054. tmp3 = w[j];
  13055. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  13056. tmp3.add(w[j - 7]);
  13057. littleSigma(tmp1, w[j - 15], tmp2);
  13058. tmp3.add(tmp1);
  13059. tmp3.add(w[j - 16]);
  13060. }
  13061. a.assign(h0);
  13062. b.assign(h1);
  13063. c.assign(h2);
  13064. d.assign(h3);
  13065. e.assign(h4);
  13066. f.assign(h5);
  13067. g.assign(h6);
  13068. h.assign(h7);
  13069. for (j = 0; j < 80; ++j) {
  13070. t1.assign(h);
  13071. sigmaPrime(tmp1, e, tmp2);
  13072. t1.add(tmp1);
  13073. ch(tmp1, e, f, g, tmp2);
  13074. t1.add(tmp1);
  13075. t1.add(k[j]);
  13076. t1.add(w[j]);
  13077. sigma(t2, a, tmp2);
  13078. maj(tmp1, a, b, c, tmp2);
  13079. t2.add(tmp1);
  13080. tmp3 = h;
  13081. h = g;
  13082. g = f;
  13083. f = e;
  13084. d.add(t1);
  13085. e = d;
  13086. d = c;
  13087. c = b;
  13088. b = a;
  13089. tmp3.assign(t1);
  13090. tmp3.add(t2);
  13091. a = tmp3;
  13092. }
  13093. h0.add(a);
  13094. h1.add(b);
  13095. h2.add(c);
  13096. h3.add(d);
  13097. h4.add(e);
  13098. h5.add(f);
  13099. h6.add(g);
  13100. h7.add(h);
  13101. }
  13102. var result;
  13103. if (!mode384) {
  13104. result = new Uint8Array(64);
  13105. h0.copyTo(result, 0);
  13106. h1.copyTo(result, 8);
  13107. h2.copyTo(result, 16);
  13108. h3.copyTo(result, 24);
  13109. h4.copyTo(result, 32);
  13110. h5.copyTo(result, 40);
  13111. h6.copyTo(result, 48);
  13112. h7.copyTo(result, 56);
  13113. } else {
  13114. result = new Uint8Array(48);
  13115. h0.copyTo(result, 0);
  13116. h1.copyTo(result, 8);
  13117. h2.copyTo(result, 16);
  13118. h3.copyTo(result, 24);
  13119. h4.copyTo(result, 32);
  13120. h5.copyTo(result, 40);
  13121. }
  13122. return result;
  13123. }
  13124. return hash;
  13125. }();
  13126. exports.calculateSHA512 = calculateSHA512;
  13127. var calculateSHA384 = function calculateSHA384Closure() {
  13128. function hash(data, offset, length) {
  13129. return calculateSHA512(data, offset, length, true);
  13130. }
  13131. return hash;
  13132. }();
  13133. exports.calculateSHA384 = calculateSHA384;
  13134. var NullCipher = function NullCipherClosure() {
  13135. function NullCipher() {}
  13136. NullCipher.prototype = {
  13137. decryptBlock: function NullCipher_decryptBlock(data) {
  13138. return data;
  13139. }
  13140. };
  13141. return NullCipher;
  13142. }();
  13143. class AESBaseCipher {
  13144. constructor() {
  13145. if (this.constructor === AESBaseCipher) {
  13146. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  13147. }
  13148. 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]);
  13149. 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]);
  13150. 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]);
  13151. this._mixCol = new Uint8Array(256);
  13152. for (let i = 0; i < 256; i++) {
  13153. if (i < 128) {
  13154. this._mixCol[i] = i << 1;
  13155. } else {
  13156. this._mixCol[i] = i << 1 ^ 0x1b;
  13157. }
  13158. }
  13159. this.buffer = new Uint8Array(16);
  13160. this.bufferPosition = 0;
  13161. }
  13162. _expandKey(cipherKey) {
  13163. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  13164. }
  13165. _decrypt(input, key) {
  13166. let t, u, v;
  13167. const state = new Uint8Array(16);
  13168. state.set(input);
  13169. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13170. state[j] ^= key[k];
  13171. }
  13172. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  13173. t = state[13];
  13174. state[13] = state[9];
  13175. state[9] = state[5];
  13176. state[5] = state[1];
  13177. state[1] = t;
  13178. t = state[14];
  13179. u = state[10];
  13180. state[14] = state[6];
  13181. state[10] = state[2];
  13182. state[6] = t;
  13183. state[2] = u;
  13184. t = state[15];
  13185. u = state[11];
  13186. v = state[7];
  13187. state[15] = state[3];
  13188. state[11] = t;
  13189. state[7] = u;
  13190. state[3] = v;
  13191. for (let j = 0; j < 16; ++j) {
  13192. state[j] = this._inv_s[state[j]];
  13193. }
  13194. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13195. state[j] ^= key[k];
  13196. }
  13197. for (let j = 0; j < 16; j += 4) {
  13198. const s0 = this._mix[state[j]];
  13199. const s1 = this._mix[state[j + 1]];
  13200. const s2 = this._mix[state[j + 2]];
  13201. const s3 = this._mix[state[j + 3]];
  13202. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  13203. state[j] = t >>> 24 & 0xff;
  13204. state[j + 1] = t >> 16 & 0xff;
  13205. state[j + 2] = t >> 8 & 0xff;
  13206. state[j + 3] = t & 0xff;
  13207. }
  13208. }
  13209. t = state[13];
  13210. state[13] = state[9];
  13211. state[9] = state[5];
  13212. state[5] = state[1];
  13213. state[1] = t;
  13214. t = state[14];
  13215. u = state[10];
  13216. state[14] = state[6];
  13217. state[10] = state[2];
  13218. state[6] = t;
  13219. state[2] = u;
  13220. t = state[15];
  13221. u = state[11];
  13222. v = state[7];
  13223. state[15] = state[3];
  13224. state[11] = t;
  13225. state[7] = u;
  13226. state[3] = v;
  13227. for (let j = 0; j < 16; ++j) {
  13228. state[j] = this._inv_s[state[j]];
  13229. state[j] ^= key[j];
  13230. }
  13231. return state;
  13232. }
  13233. _encrypt(input, key) {
  13234. const s = this._s;
  13235. let t, u, v;
  13236. const state = new Uint8Array(16);
  13237. state.set(input);
  13238. for (let j = 0; j < 16; ++j) {
  13239. state[j] ^= key[j];
  13240. }
  13241. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  13242. for (let j = 0; j < 16; ++j) {
  13243. state[j] = s[state[j]];
  13244. }
  13245. v = state[1];
  13246. state[1] = state[5];
  13247. state[5] = state[9];
  13248. state[9] = state[13];
  13249. state[13] = v;
  13250. v = state[2];
  13251. u = state[6];
  13252. state[2] = state[10];
  13253. state[6] = state[14];
  13254. state[10] = v;
  13255. state[14] = u;
  13256. v = state[3];
  13257. u = state[7];
  13258. t = state[11];
  13259. state[3] = state[15];
  13260. state[7] = v;
  13261. state[11] = u;
  13262. state[15] = t;
  13263. for (let j = 0; j < 16; j += 4) {
  13264. const s0 = state[j + 0];
  13265. const s1 = state[j + 1];
  13266. const s2 = state[j + 2];
  13267. const s3 = state[j + 3];
  13268. t = s0 ^ s1 ^ s2 ^ s3;
  13269. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  13270. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  13271. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  13272. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  13273. }
  13274. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13275. state[j] ^= key[k];
  13276. }
  13277. }
  13278. for (let j = 0; j < 16; ++j) {
  13279. state[j] = s[state[j]];
  13280. }
  13281. v = state[1];
  13282. state[1] = state[5];
  13283. state[5] = state[9];
  13284. state[9] = state[13];
  13285. state[13] = v;
  13286. v = state[2];
  13287. u = state[6];
  13288. state[2] = state[10];
  13289. state[6] = state[14];
  13290. state[10] = v;
  13291. state[14] = u;
  13292. v = state[3];
  13293. u = state[7];
  13294. t = state[11];
  13295. state[3] = state[15];
  13296. state[7] = v;
  13297. state[11] = u;
  13298. state[15] = t;
  13299. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13300. state[j] ^= key[k];
  13301. }
  13302. return state;
  13303. }
  13304. _decryptBlock2(data, finalize) {
  13305. const sourceLength = data.length;
  13306. let buffer = this.buffer,
  13307. bufferLength = this.bufferPosition;
  13308. const result = [];
  13309. let iv = this.iv;
  13310. for (let i = 0; i < sourceLength; ++i) {
  13311. buffer[bufferLength] = data[i];
  13312. ++bufferLength;
  13313. if (bufferLength < 16) {
  13314. continue;
  13315. }
  13316. const plain = this._decrypt(buffer, this._key);
  13317. for (let j = 0; j < 16; ++j) {
  13318. plain[j] ^= iv[j];
  13319. }
  13320. iv = buffer;
  13321. result.push(plain);
  13322. buffer = new Uint8Array(16);
  13323. bufferLength = 0;
  13324. }
  13325. this.buffer = buffer;
  13326. this.bufferLength = bufferLength;
  13327. this.iv = iv;
  13328. if (result.length === 0) {
  13329. return new Uint8Array(0);
  13330. }
  13331. let outputLength = 16 * result.length;
  13332. if (finalize) {
  13333. const lastBlock = result[result.length - 1];
  13334. let psLen = lastBlock[15];
  13335. if (psLen <= 16) {
  13336. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  13337. if (lastBlock[i] !== psLen) {
  13338. psLen = 0;
  13339. break;
  13340. }
  13341. }
  13342. outputLength -= psLen;
  13343. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  13344. }
  13345. }
  13346. const output = new Uint8Array(outputLength);
  13347. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  13348. output.set(result[i], j);
  13349. }
  13350. return output;
  13351. }
  13352. decryptBlock(data, finalize, iv = null) {
  13353. const sourceLength = data.length;
  13354. const buffer = this.buffer;
  13355. let bufferLength = this.bufferPosition;
  13356. if (iv) {
  13357. this.iv = iv;
  13358. } else {
  13359. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  13360. buffer[bufferLength] = data[i];
  13361. }
  13362. if (bufferLength < 16) {
  13363. this.bufferLength = bufferLength;
  13364. return new Uint8Array(0);
  13365. }
  13366. this.iv = buffer;
  13367. data = data.subarray(16);
  13368. }
  13369. this.buffer = new Uint8Array(16);
  13370. this.bufferLength = 0;
  13371. this.decryptBlock = this._decryptBlock2;
  13372. return this.decryptBlock(data, finalize);
  13373. }
  13374. encrypt(data, iv) {
  13375. const sourceLength = data.length;
  13376. let buffer = this.buffer,
  13377. bufferLength = this.bufferPosition;
  13378. const result = [];
  13379. if (!iv) {
  13380. iv = new Uint8Array(16);
  13381. }
  13382. for (let i = 0; i < sourceLength; ++i) {
  13383. buffer[bufferLength] = data[i];
  13384. ++bufferLength;
  13385. if (bufferLength < 16) {
  13386. continue;
  13387. }
  13388. for (let j = 0; j < 16; ++j) {
  13389. buffer[j] ^= iv[j];
  13390. }
  13391. const cipher = this._encrypt(buffer, this._key);
  13392. iv = cipher;
  13393. result.push(cipher);
  13394. buffer = new Uint8Array(16);
  13395. bufferLength = 0;
  13396. }
  13397. this.buffer = buffer;
  13398. this.bufferLength = bufferLength;
  13399. this.iv = iv;
  13400. if (result.length === 0) {
  13401. return new Uint8Array(0);
  13402. }
  13403. const outputLength = 16 * result.length;
  13404. const output = new Uint8Array(outputLength);
  13405. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  13406. output.set(result[i], j);
  13407. }
  13408. return output;
  13409. }
  13410. }
  13411. class AES128Cipher extends AESBaseCipher {
  13412. constructor(key) {
  13413. super();
  13414. this._cyclesOfRepetition = 10;
  13415. this._keySize = 160;
  13416. 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]);
  13417. this._key = this._expandKey(key);
  13418. }
  13419. _expandKey(cipherKey) {
  13420. const b = 176;
  13421. const s = this._s;
  13422. const rcon = this._rcon;
  13423. const result = new Uint8Array(b);
  13424. result.set(cipherKey);
  13425. for (let j = 16, i = 1; j < b; ++i) {
  13426. let t1 = result[j - 3];
  13427. let t2 = result[j - 2];
  13428. let t3 = result[j - 1];
  13429. let t4 = result[j - 4];
  13430. t1 = s[t1];
  13431. t2 = s[t2];
  13432. t3 = s[t3];
  13433. t4 = s[t4];
  13434. t1 = t1 ^ rcon[i];
  13435. for (let n = 0; n < 4; ++n) {
  13436. result[j] = t1 ^= result[j - 16];
  13437. j++;
  13438. result[j] = t2 ^= result[j - 16];
  13439. j++;
  13440. result[j] = t3 ^= result[j - 16];
  13441. j++;
  13442. result[j] = t4 ^= result[j - 16];
  13443. j++;
  13444. }
  13445. }
  13446. return result;
  13447. }
  13448. }
  13449. exports.AES128Cipher = AES128Cipher;
  13450. class AES256Cipher extends AESBaseCipher {
  13451. constructor(key) {
  13452. super();
  13453. this._cyclesOfRepetition = 14;
  13454. this._keySize = 224;
  13455. this._key = this._expandKey(key);
  13456. }
  13457. _expandKey(cipherKey) {
  13458. const b = 240;
  13459. const s = this._s;
  13460. const result = new Uint8Array(b);
  13461. result.set(cipherKey);
  13462. let r = 1;
  13463. let t1, t2, t3, t4;
  13464. for (let j = 32, i = 1; j < b; ++i) {
  13465. if (j % 32 === 16) {
  13466. t1 = s[t1];
  13467. t2 = s[t2];
  13468. t3 = s[t3];
  13469. t4 = s[t4];
  13470. } else if (j % 32 === 0) {
  13471. t1 = result[j - 3];
  13472. t2 = result[j - 2];
  13473. t3 = result[j - 1];
  13474. t4 = result[j - 4];
  13475. t1 = s[t1];
  13476. t2 = s[t2];
  13477. t3 = s[t3];
  13478. t4 = s[t4];
  13479. t1 = t1 ^ r;
  13480. if ((r <<= 1) >= 256) {
  13481. r = (r ^ 0x1b) & 0xff;
  13482. }
  13483. }
  13484. for (let n = 0; n < 4; ++n) {
  13485. result[j] = t1 ^= result[j - 32];
  13486. j++;
  13487. result[j] = t2 ^= result[j - 32];
  13488. j++;
  13489. result[j] = t3 ^= result[j - 32];
  13490. j++;
  13491. result[j] = t4 ^= result[j - 32];
  13492. j++;
  13493. }
  13494. }
  13495. return result;
  13496. }
  13497. }
  13498. exports.AES256Cipher = AES256Cipher;
  13499. var PDF17 = function PDF17Closure() {
  13500. function compareByteArrays(array1, array2) {
  13501. if (array1.length !== array2.length) {
  13502. return false;
  13503. }
  13504. for (var i = 0; i < array1.length; i++) {
  13505. if (array1[i] !== array2[i]) {
  13506. return false;
  13507. }
  13508. }
  13509. return true;
  13510. }
  13511. function PDF17() {}
  13512. PDF17.prototype = {
  13513. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  13514. var hashData = new Uint8Array(password.length + 56);
  13515. hashData.set(password, 0);
  13516. hashData.set(ownerValidationSalt, password.length);
  13517. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  13518. var result = calculateSHA256(hashData, 0, hashData.length);
  13519. return compareByteArrays(result, ownerPassword);
  13520. },
  13521. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  13522. var hashData = new Uint8Array(password.length + 8);
  13523. hashData.set(password, 0);
  13524. hashData.set(userValidationSalt, password.length);
  13525. var result = calculateSHA256(hashData, 0, hashData.length);
  13526. return compareByteArrays(result, userPassword);
  13527. },
  13528. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  13529. var hashData = new Uint8Array(password.length + 56);
  13530. hashData.set(password, 0);
  13531. hashData.set(ownerKeySalt, password.length);
  13532. hashData.set(userBytes, password.length + ownerKeySalt.length);
  13533. var key = calculateSHA256(hashData, 0, hashData.length);
  13534. var cipher = new AES256Cipher(key);
  13535. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  13536. },
  13537. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  13538. var hashData = new Uint8Array(password.length + 8);
  13539. hashData.set(password, 0);
  13540. hashData.set(userKeySalt, password.length);
  13541. var key = calculateSHA256(hashData, 0, hashData.length);
  13542. var cipher = new AES256Cipher(key);
  13543. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  13544. }
  13545. };
  13546. return PDF17;
  13547. }();
  13548. exports.PDF17 = PDF17;
  13549. var PDF20 = function PDF20Closure() {
  13550. function concatArrays(array1, array2) {
  13551. var t = new Uint8Array(array1.length + array2.length);
  13552. t.set(array1, 0);
  13553. t.set(array2, array1.length);
  13554. return t;
  13555. }
  13556. function calculatePDF20Hash(password, input, userBytes) {
  13557. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  13558. var e = [0];
  13559. var i = 0;
  13560. while (i < 64 || e[e.length - 1] > i - 32) {
  13561. var arrayLength = password.length + k.length + userBytes.length;
  13562. var k1 = new Uint8Array(arrayLength * 64);
  13563. var array = concatArrays(password, k);
  13564. array = concatArrays(array, userBytes);
  13565. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  13566. k1.set(array, pos);
  13567. }
  13568. var cipher = new AES128Cipher(k.subarray(0, 16));
  13569. e = cipher.encrypt(k1, k.subarray(16, 32));
  13570. var remainder = 0;
  13571. for (var z = 0; z < 16; z++) {
  13572. remainder *= 256 % 3;
  13573. remainder %= 3;
  13574. remainder += (e[z] >>> 0) % 3;
  13575. remainder %= 3;
  13576. }
  13577. if (remainder === 0) {
  13578. k = calculateSHA256(e, 0, e.length);
  13579. } else if (remainder === 1) {
  13580. k = calculateSHA384(e, 0, e.length);
  13581. } else if (remainder === 2) {
  13582. k = calculateSHA512(e, 0, e.length);
  13583. }
  13584. i++;
  13585. }
  13586. return k.subarray(0, 32);
  13587. }
  13588. function PDF20() {}
  13589. function compareByteArrays(array1, array2) {
  13590. if (array1.length !== array2.length) {
  13591. return false;
  13592. }
  13593. for (var i = 0; i < array1.length; i++) {
  13594. if (array1[i] !== array2[i]) {
  13595. return false;
  13596. }
  13597. }
  13598. return true;
  13599. }
  13600. PDF20.prototype = {
  13601. hash: function PDF20_hash(password, concatBytes, userBytes) {
  13602. return calculatePDF20Hash(password, concatBytes, userBytes);
  13603. },
  13604. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  13605. var hashData = new Uint8Array(password.length + 56);
  13606. hashData.set(password, 0);
  13607. hashData.set(ownerValidationSalt, password.length);
  13608. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  13609. var result = calculatePDF20Hash(password, hashData, userBytes);
  13610. return compareByteArrays(result, ownerPassword);
  13611. },
  13612. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  13613. var hashData = new Uint8Array(password.length + 8);
  13614. hashData.set(password, 0);
  13615. hashData.set(userValidationSalt, password.length);
  13616. var result = calculatePDF20Hash(password, hashData, []);
  13617. return compareByteArrays(result, userPassword);
  13618. },
  13619. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  13620. var hashData = new Uint8Array(password.length + 56);
  13621. hashData.set(password, 0);
  13622. hashData.set(ownerKeySalt, password.length);
  13623. hashData.set(userBytes, password.length + ownerKeySalt.length);
  13624. var key = calculatePDF20Hash(password, hashData, userBytes);
  13625. var cipher = new AES256Cipher(key);
  13626. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  13627. },
  13628. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  13629. var hashData = new Uint8Array(password.length + 8);
  13630. hashData.set(password, 0);
  13631. hashData.set(userKeySalt, password.length);
  13632. var key = calculatePDF20Hash(password, hashData, []);
  13633. var cipher = new AES256Cipher(key);
  13634. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  13635. }
  13636. };
  13637. return PDF20;
  13638. }();
  13639. exports.PDF20 = PDF20;
  13640. var CipherTransform = function CipherTransformClosure() {
  13641. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  13642. this.StringCipherConstructor = stringCipherConstructor;
  13643. this.StreamCipherConstructor = streamCipherConstructor;
  13644. }
  13645. CipherTransform.prototype = {
  13646. createStream: function CipherTransform_createStream(stream, length) {
  13647. var cipher = new this.StreamCipherConstructor();
  13648. return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  13649. return cipher.decryptBlock(data, finalize);
  13650. });
  13651. },
  13652. decryptString: function CipherTransform_decryptString(s) {
  13653. var cipher = new this.StringCipherConstructor();
  13654. var data = (0, _util.stringToBytes)(s);
  13655. data = cipher.decryptBlock(data, true);
  13656. return (0, _util.bytesToString)(data);
  13657. }
  13658. };
  13659. return CipherTransform;
  13660. }();
  13661. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  13662. var 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]);
  13663. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  13664. if (password) {
  13665. var passwordLength = Math.min(127, password.length);
  13666. password = password.subarray(0, passwordLength);
  13667. } else {
  13668. password = [];
  13669. }
  13670. var pdfAlgorithm;
  13671. if (revision === 6) {
  13672. pdfAlgorithm = new PDF20();
  13673. } else {
  13674. pdfAlgorithm = new PDF17();
  13675. }
  13676. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  13677. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  13678. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  13679. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  13680. }
  13681. return null;
  13682. }
  13683. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  13684. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  13685. var hashData = new Uint8Array(hashDataSize),
  13686. i = 0,
  13687. j,
  13688. n;
  13689. if (password) {
  13690. n = Math.min(32, password.length);
  13691. for (; i < n; ++i) {
  13692. hashData[i] = password[i];
  13693. }
  13694. }
  13695. j = 0;
  13696. while (i < 32) {
  13697. hashData[i++] = defaultPasswordBytes[j++];
  13698. }
  13699. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  13700. hashData[i++] = ownerPassword[j];
  13701. }
  13702. hashData[i++] = flags & 0xff;
  13703. hashData[i++] = flags >> 8 & 0xff;
  13704. hashData[i++] = flags >> 16 & 0xff;
  13705. hashData[i++] = flags >>> 24 & 0xff;
  13706. for (j = 0, n = fileId.length; j < n; ++j) {
  13707. hashData[i++] = fileId[j];
  13708. }
  13709. if (revision >= 4 && !encryptMetadata) {
  13710. hashData[i++] = 0xff;
  13711. hashData[i++] = 0xff;
  13712. hashData[i++] = 0xff;
  13713. hashData[i++] = 0xff;
  13714. }
  13715. var hash = calculateMD5(hashData, 0, i);
  13716. var keyLengthInBytes = keyLength >> 3;
  13717. if (revision >= 3) {
  13718. for (j = 0; j < 50; ++j) {
  13719. hash = calculateMD5(hash, 0, keyLengthInBytes);
  13720. }
  13721. }
  13722. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  13723. var cipher, checkData;
  13724. if (revision >= 3) {
  13725. for (i = 0; i < 32; ++i) {
  13726. hashData[i] = defaultPasswordBytes[i];
  13727. }
  13728. for (j = 0, n = fileId.length; j < n; ++j) {
  13729. hashData[i++] = fileId[j];
  13730. }
  13731. cipher = new ARCFourCipher(encryptionKey);
  13732. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  13733. n = encryptionKey.length;
  13734. var derivedKey = new Uint8Array(n),
  13735. k;
  13736. for (j = 1; j <= 19; ++j) {
  13737. for (k = 0; k < n; ++k) {
  13738. derivedKey[k] = encryptionKey[k] ^ j;
  13739. }
  13740. cipher = new ARCFourCipher(derivedKey);
  13741. checkData = cipher.encryptBlock(checkData);
  13742. }
  13743. for (j = 0, n = checkData.length; j < n; ++j) {
  13744. if (userPassword[j] !== checkData[j]) {
  13745. return null;
  13746. }
  13747. }
  13748. } else {
  13749. cipher = new ARCFourCipher(encryptionKey);
  13750. checkData = cipher.encryptBlock(defaultPasswordBytes);
  13751. for (j = 0, n = checkData.length; j < n; ++j) {
  13752. if (userPassword[j] !== checkData[j]) {
  13753. return null;
  13754. }
  13755. }
  13756. }
  13757. return encryptionKey;
  13758. }
  13759. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  13760. var hashData = new Uint8Array(32),
  13761. i = 0,
  13762. j,
  13763. n;
  13764. n = Math.min(32, password.length);
  13765. for (; i < n; ++i) {
  13766. hashData[i] = password[i];
  13767. }
  13768. j = 0;
  13769. while (i < 32) {
  13770. hashData[i++] = defaultPasswordBytes[j++];
  13771. }
  13772. var hash = calculateMD5(hashData, 0, i);
  13773. var keyLengthInBytes = keyLength >> 3;
  13774. if (revision >= 3) {
  13775. for (j = 0; j < 50; ++j) {
  13776. hash = calculateMD5(hash, 0, hash.length);
  13777. }
  13778. }
  13779. var cipher, userPassword;
  13780. if (revision >= 3) {
  13781. userPassword = ownerPassword;
  13782. var derivedKey = new Uint8Array(keyLengthInBytes),
  13783. k;
  13784. for (j = 19; j >= 0; j--) {
  13785. for (k = 0; k < keyLengthInBytes; ++k) {
  13786. derivedKey[k] = hash[k] ^ j;
  13787. }
  13788. cipher = new ARCFourCipher(derivedKey);
  13789. userPassword = cipher.encryptBlock(userPassword);
  13790. }
  13791. } else {
  13792. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  13793. userPassword = cipher.encryptBlock(ownerPassword);
  13794. }
  13795. return userPassword;
  13796. }
  13797. var identityName = _primitives.Name.get("Identity");
  13798. function CipherTransformFactory(dict, fileId, password) {
  13799. var filter = dict.get("Filter");
  13800. if (!(0, _primitives.isName)(filter, "Standard")) {
  13801. throw new _util.FormatError("unknown encryption method");
  13802. }
  13803. this.dict = dict;
  13804. var algorithm = dict.get("V");
  13805. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  13806. throw new _util.FormatError("unsupported encryption algorithm");
  13807. }
  13808. this.algorithm = algorithm;
  13809. var keyLength = dict.get("Length");
  13810. if (!keyLength) {
  13811. if (algorithm <= 3) {
  13812. keyLength = 40;
  13813. } else {
  13814. var cfDict = dict.get("CF");
  13815. var streamCryptoName = dict.get("StmF");
  13816. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  13817. cfDict.suppressEncryption = true;
  13818. var handlerDict = cfDict.get(streamCryptoName.name);
  13819. keyLength = handlerDict && handlerDict.get("Length") || 128;
  13820. if (keyLength < 40) {
  13821. keyLength <<= 3;
  13822. }
  13823. }
  13824. }
  13825. }
  13826. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  13827. throw new _util.FormatError("invalid key length");
  13828. }
  13829. var ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  13830. var userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  13831. var flags = dict.get("P");
  13832. var revision = dict.get("R");
  13833. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  13834. this.encryptMetadata = encryptMetadata;
  13835. var fileIdBytes = (0, _util.stringToBytes)(fileId);
  13836. var passwordBytes;
  13837. if (password) {
  13838. if (revision === 6) {
  13839. try {
  13840. password = (0, _util.utf8StringToString)(password);
  13841. } catch (ex) {
  13842. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  13843. }
  13844. }
  13845. passwordBytes = (0, _util.stringToBytes)(password);
  13846. }
  13847. var encryptionKey;
  13848. if (algorithm !== 5) {
  13849. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  13850. } else {
  13851. var ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  13852. var ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  13853. var uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  13854. var userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  13855. var userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  13856. var ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  13857. var userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  13858. var perms = (0, _util.stringToBytes)(dict.get("Perms"));
  13859. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  13860. }
  13861. if (!encryptionKey && !password) {
  13862. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  13863. } else if (!encryptionKey && password) {
  13864. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  13865. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  13866. }
  13867. if (!encryptionKey) {
  13868. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  13869. }
  13870. this.encryptionKey = encryptionKey;
  13871. if (algorithm >= 4) {
  13872. var cf = dict.get("CF");
  13873. if ((0, _primitives.isDict)(cf)) {
  13874. cf.suppressEncryption = true;
  13875. }
  13876. this.cf = cf;
  13877. this.stmf = dict.get("StmF") || identityName;
  13878. this.strf = dict.get("StrF") || identityName;
  13879. this.eff = dict.get("EFF") || this.stmf;
  13880. }
  13881. }
  13882. function buildObjectKey(num, gen, encryptionKey, isAes) {
  13883. var key = new Uint8Array(encryptionKey.length + 9),
  13884. i,
  13885. n;
  13886. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  13887. key[i] = encryptionKey[i];
  13888. }
  13889. key[i++] = num & 0xff;
  13890. key[i++] = num >> 8 & 0xff;
  13891. key[i++] = num >> 16 & 0xff;
  13892. key[i++] = gen & 0xff;
  13893. key[i++] = gen >> 8 & 0xff;
  13894. if (isAes) {
  13895. key[i++] = 0x73;
  13896. key[i++] = 0x41;
  13897. key[i++] = 0x6c;
  13898. key[i++] = 0x54;
  13899. }
  13900. var hash = calculateMD5(key, 0, i);
  13901. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  13902. }
  13903. function buildCipherConstructor(cf, name, num, gen, key) {
  13904. if (!(0, _primitives.isName)(name)) {
  13905. throw new _util.FormatError("Invalid crypt filter name.");
  13906. }
  13907. var cryptFilter = cf.get(name.name);
  13908. var cfm;
  13909. if (cryptFilter !== null && cryptFilter !== undefined) {
  13910. cfm = cryptFilter.get("CFM");
  13911. }
  13912. if (!cfm || cfm.name === "None") {
  13913. return function cipherTransformFactoryBuildCipherConstructorNone() {
  13914. return new NullCipher();
  13915. };
  13916. }
  13917. if (cfm.name === "V2") {
  13918. return function cipherTransformFactoryBuildCipherConstructorV2() {
  13919. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  13920. };
  13921. }
  13922. if (cfm.name === "AESV2") {
  13923. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  13924. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  13925. };
  13926. }
  13927. if (cfm.name === "AESV3") {
  13928. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  13929. return new AES256Cipher(key);
  13930. };
  13931. }
  13932. throw new _util.FormatError("Unknown crypto method");
  13933. }
  13934. CipherTransformFactory.prototype = {
  13935. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  13936. if (this.algorithm === 4 || this.algorithm === 5) {
  13937. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  13938. }
  13939. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  13940. var cipherConstructor = function buildCipherCipherConstructor() {
  13941. return new ARCFourCipher(key);
  13942. };
  13943. return new CipherTransform(cipherConstructor, cipherConstructor);
  13944. }
  13945. };
  13946. return CipherTransformFactory;
  13947. }();
  13948. exports.CipherTransformFactory = CipherTransformFactory;
  13949. /***/ }),
  13950. /* 23 */
  13951. /***/ (function(module, exports, __w_pdfjs_require__) {
  13952. "use strict";
  13953. Object.defineProperty(exports, "__esModule", {
  13954. value: true
  13955. });
  13956. exports.ColorSpace = void 0;
  13957. var _util = __w_pdfjs_require__(2);
  13958. var _primitives = __w_pdfjs_require__(5);
  13959. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  13960. const COMPONENTS = 3;
  13961. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  13962. const xRatio = w1 / w2;
  13963. const yRatio = h1 / h2;
  13964. let newIndex = 0,
  13965. oldIndex;
  13966. const xScaled = new Uint16Array(w2);
  13967. const w1Scanline = w1 * COMPONENTS;
  13968. for (let i = 0; i < w2; i++) {
  13969. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  13970. }
  13971. for (let i = 0; i < h2; i++) {
  13972. const py = Math.floor(i * yRatio) * w1Scanline;
  13973. for (let j = 0; j < w2; j++) {
  13974. oldIndex = py + xScaled[j];
  13975. dest[newIndex++] = src[oldIndex++];
  13976. dest[newIndex++] = src[oldIndex++];
  13977. dest[newIndex++] = src[oldIndex++];
  13978. newIndex += alpha01;
  13979. }
  13980. }
  13981. }
  13982. class ColorSpace {
  13983. constructor(name, numComps) {
  13984. if (this.constructor === ColorSpace) {
  13985. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  13986. }
  13987. this.name = name;
  13988. this.numComps = numComps;
  13989. }
  13990. getRgb(src, srcOffset) {
  13991. const rgb = new Uint8ClampedArray(3);
  13992. this.getRgbItem(src, srcOffset, rgb, 0);
  13993. return rgb;
  13994. }
  13995. getRgbItem(src, srcOffset, dest, destOffset) {
  13996. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  13997. }
  13998. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  13999. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  14000. }
  14001. getOutputLength(inputLength, alpha01) {
  14002. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  14003. }
  14004. isPassthrough(bits) {
  14005. return false;
  14006. }
  14007. isDefaultDecode(decodeMap, bpc) {
  14008. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  14009. }
  14010. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  14011. const count = originalWidth * originalHeight;
  14012. let rgbBuf = null;
  14013. const numComponentColors = 1 << bpc;
  14014. const needsResizing = originalHeight !== height || originalWidth !== width;
  14015. if (this.isPassthrough(bpc)) {
  14016. rgbBuf = comps;
  14017. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  14018. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  14019. for (let i = 0; i < numComponentColors; i++) {
  14020. allColors[i] = i;
  14021. }
  14022. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  14023. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  14024. if (!needsResizing) {
  14025. let destPos = 0;
  14026. for (let i = 0; i < count; ++i) {
  14027. const key = comps[i] * 3;
  14028. dest[destPos++] = colorMap[key];
  14029. dest[destPos++] = colorMap[key + 1];
  14030. dest[destPos++] = colorMap[key + 2];
  14031. destPos += alpha01;
  14032. }
  14033. } else {
  14034. rgbBuf = new Uint8Array(count * 3);
  14035. let rgbPos = 0;
  14036. for (let i = 0; i < count; ++i) {
  14037. const key = comps[i] * 3;
  14038. rgbBuf[rgbPos++] = colorMap[key];
  14039. rgbBuf[rgbPos++] = colorMap[key + 1];
  14040. rgbBuf[rgbPos++] = colorMap[key + 2];
  14041. }
  14042. }
  14043. } else {
  14044. if (!needsResizing) {
  14045. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  14046. } else {
  14047. rgbBuf = new Uint8ClampedArray(count * 3);
  14048. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  14049. }
  14050. }
  14051. if (rgbBuf) {
  14052. if (needsResizing) {
  14053. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  14054. } else {
  14055. let destPos = 0,
  14056. rgbPos = 0;
  14057. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  14058. dest[destPos++] = rgbBuf[rgbPos++];
  14059. dest[destPos++] = rgbBuf[rgbPos++];
  14060. dest[destPos++] = rgbBuf[rgbPos++];
  14061. destPos += alpha01;
  14062. }
  14063. }
  14064. }
  14065. }
  14066. get usesZeroToOneRange() {
  14067. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  14068. }
  14069. static parse(cs, xref, res, pdfFunctionFactory) {
  14070. const IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
  14071. return this.fromIR(IR);
  14072. }
  14073. static fromIR(IR) {
  14074. const name = Array.isArray(IR) ? IR[0] : IR;
  14075. let whitePoint, blackPoint, gamma;
  14076. switch (name) {
  14077. case "DeviceGrayCS":
  14078. return this.singletons.gray;
  14079. case "DeviceRgbCS":
  14080. return this.singletons.rgb;
  14081. case "DeviceCmykCS":
  14082. return this.singletons.cmyk;
  14083. case "CalGrayCS":
  14084. whitePoint = IR[1];
  14085. blackPoint = IR[2];
  14086. gamma = IR[3];
  14087. return new CalGrayCS(whitePoint, blackPoint, gamma);
  14088. case "CalRGBCS":
  14089. whitePoint = IR[1];
  14090. blackPoint = IR[2];
  14091. gamma = IR[3];
  14092. const matrix = IR[4];
  14093. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  14094. case "PatternCS":
  14095. let basePatternCS = IR[1];
  14096. if (basePatternCS) {
  14097. basePatternCS = this.fromIR(basePatternCS);
  14098. }
  14099. return new PatternCS(basePatternCS);
  14100. case "IndexedCS":
  14101. const baseIndexedCS = IR[1];
  14102. const hiVal = IR[2];
  14103. const lookup = IR[3];
  14104. return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
  14105. case "AlternateCS":
  14106. const numComps = IR[1];
  14107. const alt = IR[2];
  14108. const tintFn = IR[3];
  14109. return new AlternateCS(numComps, this.fromIR(alt), tintFn);
  14110. case "LabCS":
  14111. whitePoint = IR[1];
  14112. blackPoint = IR[2];
  14113. const range = IR[3];
  14114. return new LabCS(whitePoint, blackPoint, range);
  14115. default:
  14116. throw new _util.FormatError(`Unknown colorspace name: ${name}`);
  14117. }
  14118. }
  14119. static parseToIR(cs, xref, res = null, pdfFunctionFactory) {
  14120. cs = xref.fetchIfRef(cs);
  14121. if ((0, _primitives.isName)(cs)) {
  14122. switch (cs.name) {
  14123. case "DeviceGray":
  14124. case "G":
  14125. return "DeviceGrayCS";
  14126. case "DeviceRGB":
  14127. case "RGB":
  14128. return "DeviceRgbCS";
  14129. case "DeviceCMYK":
  14130. case "CMYK":
  14131. return "DeviceCmykCS";
  14132. case "Pattern":
  14133. return ["PatternCS", null];
  14134. default:
  14135. if ((0, _primitives.isDict)(res)) {
  14136. const colorSpaces = res.get("ColorSpace");
  14137. if ((0, _primitives.isDict)(colorSpaces)) {
  14138. const resCS = colorSpaces.get(cs.name);
  14139. if (resCS) {
  14140. if ((0, _primitives.isName)(resCS)) {
  14141. return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
  14142. }
  14143. cs = resCS;
  14144. break;
  14145. }
  14146. }
  14147. }
  14148. throw new _util.FormatError(`unrecognized colorspace ${cs.name}`);
  14149. }
  14150. }
  14151. if (Array.isArray(cs)) {
  14152. const mode = xref.fetchIfRef(cs[0]).name;
  14153. let numComps, params, alt, whitePoint, blackPoint, gamma;
  14154. switch (mode) {
  14155. case "DeviceGray":
  14156. case "G":
  14157. return "DeviceGrayCS";
  14158. case "DeviceRGB":
  14159. case "RGB":
  14160. return "DeviceRgbCS";
  14161. case "DeviceCMYK":
  14162. case "CMYK":
  14163. return "DeviceCmykCS";
  14164. case "CalGray":
  14165. params = xref.fetchIfRef(cs[1]);
  14166. whitePoint = params.getArray("WhitePoint");
  14167. blackPoint = params.getArray("BlackPoint");
  14168. gamma = params.get("Gamma");
  14169. return ["CalGrayCS", whitePoint, blackPoint, gamma];
  14170. case "CalRGB":
  14171. params = xref.fetchIfRef(cs[1]);
  14172. whitePoint = params.getArray("WhitePoint");
  14173. blackPoint = params.getArray("BlackPoint");
  14174. gamma = params.getArray("Gamma");
  14175. const matrix = params.getArray("Matrix");
  14176. return ["CalRGBCS", whitePoint, blackPoint, gamma, matrix];
  14177. case "ICCBased":
  14178. const stream = xref.fetchIfRef(cs[1]);
  14179. const dict = stream.dict;
  14180. numComps = dict.get("N");
  14181. alt = dict.get("Alternate");
  14182. if (alt) {
  14183. const altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
  14184. const altCS = this.fromIR(altIR, pdfFunctionFactory);
  14185. if (altCS.numComps === numComps) {
  14186. return altIR;
  14187. }
  14188. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  14189. }
  14190. if (numComps === 1) {
  14191. return "DeviceGrayCS";
  14192. } else if (numComps === 3) {
  14193. return "DeviceRgbCS";
  14194. } else if (numComps === 4) {
  14195. return "DeviceCmykCS";
  14196. }
  14197. break;
  14198. case "Pattern":
  14199. let basePatternCS = cs[1] || null;
  14200. if (basePatternCS) {
  14201. basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);
  14202. }
  14203. return ["PatternCS", basePatternCS];
  14204. case "Indexed":
  14205. case "I":
  14206. const baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);
  14207. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  14208. let lookup = xref.fetchIfRef(cs[3]);
  14209. if ((0, _primitives.isStream)(lookup)) {
  14210. lookup = lookup.getBytes();
  14211. }
  14212. return ["IndexedCS", baseIndexedCS, hiVal, lookup];
  14213. case "Separation":
  14214. case "DeviceN":
  14215. const name = xref.fetchIfRef(cs[1]);
  14216. numComps = Array.isArray(name) ? name.length : 1;
  14217. alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
  14218. const tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
  14219. return ["AlternateCS", numComps, alt, tintFn];
  14220. case "Lab":
  14221. params = xref.fetchIfRef(cs[1]);
  14222. whitePoint = params.getArray("WhitePoint");
  14223. blackPoint = params.getArray("BlackPoint");
  14224. const range = params.getArray("Range");
  14225. return ["LabCS", whitePoint, blackPoint, range];
  14226. default:
  14227. throw new _util.FormatError(`unimplemented color space object "${mode}"`);
  14228. }
  14229. }
  14230. throw new _util.FormatError(`unrecognized color space object: "${cs}"`);
  14231. }
  14232. static isDefaultDecode(decode, numComps) {
  14233. if (!Array.isArray(decode)) {
  14234. return true;
  14235. }
  14236. if (numComps * 2 !== decode.length) {
  14237. (0, _util.warn)("The decode map is not the correct length");
  14238. return true;
  14239. }
  14240. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  14241. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  14242. return false;
  14243. }
  14244. }
  14245. return true;
  14246. }
  14247. static get singletons() {
  14248. return (0, _util.shadow)(this, "singletons", {
  14249. get gray() {
  14250. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  14251. },
  14252. get rgb() {
  14253. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  14254. },
  14255. get cmyk() {
  14256. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  14257. }
  14258. });
  14259. }
  14260. }
  14261. exports.ColorSpace = ColorSpace;
  14262. class AlternateCS extends ColorSpace {
  14263. constructor(numComps, base, tintFn) {
  14264. super("Alternate", numComps);
  14265. this.base = base;
  14266. this.tintFn = tintFn;
  14267. this.tmpBuf = new Float32Array(base.numComps);
  14268. }
  14269. getRgbItem(src, srcOffset, dest, destOffset) {
  14270. const tmpBuf = this.tmpBuf;
  14271. this.tintFn(src, srcOffset, tmpBuf, 0);
  14272. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  14273. }
  14274. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14275. const tintFn = this.tintFn;
  14276. const base = this.base;
  14277. const scale = 1 / ((1 << bits) - 1);
  14278. const baseNumComps = base.numComps;
  14279. const usesZeroToOneRange = base.usesZeroToOneRange;
  14280. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  14281. let pos = isPassthrough ? destOffset : 0;
  14282. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  14283. const numComps = this.numComps;
  14284. const scaled = new Float32Array(numComps);
  14285. const tinted = new Float32Array(baseNumComps);
  14286. let i, j;
  14287. for (i = 0; i < count; i++) {
  14288. for (j = 0; j < numComps; j++) {
  14289. scaled[j] = src[srcOffset++] * scale;
  14290. }
  14291. tintFn(scaled, 0, tinted, 0);
  14292. if (usesZeroToOneRange) {
  14293. for (j = 0; j < baseNumComps; j++) {
  14294. baseBuf[pos++] = tinted[j] * 255;
  14295. }
  14296. } else {
  14297. base.getRgbItem(tinted, 0, baseBuf, pos);
  14298. pos += baseNumComps;
  14299. }
  14300. }
  14301. if (!isPassthrough) {
  14302. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  14303. }
  14304. }
  14305. getOutputLength(inputLength, alpha01) {
  14306. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  14307. }
  14308. }
  14309. class PatternCS extends ColorSpace {
  14310. constructor(baseCS) {
  14311. super("Pattern", null);
  14312. this.base = baseCS;
  14313. }
  14314. isDefaultDecode(decodeMap, bpc) {
  14315. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  14316. }
  14317. }
  14318. class IndexedCS extends ColorSpace {
  14319. constructor(base, highVal, lookup) {
  14320. super("Indexed", 1);
  14321. this.base = base;
  14322. this.highVal = highVal;
  14323. const baseNumComps = base.numComps;
  14324. const length = baseNumComps * highVal;
  14325. if ((0, _primitives.isStream)(lookup)) {
  14326. this.lookup = new Uint8Array(length);
  14327. const bytes = lookup.getBytes(length);
  14328. this.lookup.set(bytes);
  14329. } else if ((0, _util.isString)(lookup)) {
  14330. this.lookup = new Uint8Array(length);
  14331. for (let i = 0; i < length; ++i) {
  14332. this.lookup[i] = lookup.charCodeAt(i);
  14333. }
  14334. } else if (lookup instanceof Uint8Array) {
  14335. this.lookup = lookup;
  14336. } else {
  14337. throw new _util.FormatError(`Unrecognized lookup table: ${lookup}`);
  14338. }
  14339. }
  14340. getRgbItem(src, srcOffset, dest, destOffset) {
  14341. const numComps = this.base.numComps;
  14342. const start = src[srcOffset] * numComps;
  14343. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  14344. }
  14345. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14346. const base = this.base;
  14347. const numComps = base.numComps;
  14348. const outputDelta = base.getOutputLength(numComps, alpha01);
  14349. const lookup = this.lookup;
  14350. for (let i = 0; i < count; ++i) {
  14351. const lookupPos = src[srcOffset++] * numComps;
  14352. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  14353. destOffset += outputDelta;
  14354. }
  14355. }
  14356. getOutputLength(inputLength, alpha01) {
  14357. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  14358. }
  14359. isDefaultDecode(decodeMap, bpc) {
  14360. if (!Array.isArray(decodeMap)) {
  14361. return true;
  14362. }
  14363. if (decodeMap.length !== 2) {
  14364. (0, _util.warn)("Decode map length is not correct");
  14365. return true;
  14366. }
  14367. if (!Number.isInteger(bpc) || bpc < 1) {
  14368. (0, _util.warn)("Bits per component is not correct");
  14369. return true;
  14370. }
  14371. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  14372. }
  14373. }
  14374. class DeviceGrayCS extends ColorSpace {
  14375. constructor() {
  14376. super("DeviceGray", 1);
  14377. }
  14378. getRgbItem(src, srcOffset, dest, destOffset) {
  14379. const c = src[srcOffset] * 255;
  14380. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  14381. }
  14382. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14383. const scale = 255 / ((1 << bits) - 1);
  14384. let j = srcOffset,
  14385. q = destOffset;
  14386. for (let i = 0; i < count; ++i) {
  14387. const c = scale * src[j++];
  14388. dest[q++] = c;
  14389. dest[q++] = c;
  14390. dest[q++] = c;
  14391. q += alpha01;
  14392. }
  14393. }
  14394. getOutputLength(inputLength, alpha01) {
  14395. return inputLength * (3 + alpha01);
  14396. }
  14397. }
  14398. class DeviceRgbCS extends ColorSpace {
  14399. constructor() {
  14400. super("DeviceRGB", 3);
  14401. }
  14402. getRgbItem(src, srcOffset, dest, destOffset) {
  14403. dest[destOffset] = src[srcOffset] * 255;
  14404. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  14405. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  14406. }
  14407. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14408. if (bits === 8 && alpha01 === 0) {
  14409. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  14410. return;
  14411. }
  14412. const scale = 255 / ((1 << bits) - 1);
  14413. let j = srcOffset,
  14414. q = destOffset;
  14415. for (let i = 0; i < count; ++i) {
  14416. dest[q++] = scale * src[j++];
  14417. dest[q++] = scale * src[j++];
  14418. dest[q++] = scale * src[j++];
  14419. q += alpha01;
  14420. }
  14421. }
  14422. getOutputLength(inputLength, alpha01) {
  14423. return inputLength * (3 + alpha01) / 3 | 0;
  14424. }
  14425. isPassthrough(bits) {
  14426. return bits === 8;
  14427. }
  14428. }
  14429. const DeviceCmykCS = function DeviceCmykCSClosure() {
  14430. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  14431. const c = src[srcOffset] * srcScale;
  14432. const m = src[srcOffset + 1] * srcScale;
  14433. const y = src[srcOffset + 2] * srcScale;
  14434. const k = src[srcOffset + 3] * srcScale;
  14435. 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);
  14436. 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);
  14437. 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);
  14438. }
  14439. class DeviceCmykCS extends ColorSpace {
  14440. constructor() {
  14441. super("DeviceCMYK", 4);
  14442. }
  14443. getRgbItem(src, srcOffset, dest, destOffset) {
  14444. convertToRgb(src, srcOffset, 1, dest, destOffset);
  14445. }
  14446. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14447. const scale = 1 / ((1 << bits) - 1);
  14448. for (let i = 0; i < count; i++) {
  14449. convertToRgb(src, srcOffset, scale, dest, destOffset);
  14450. srcOffset += 4;
  14451. destOffset += 3 + alpha01;
  14452. }
  14453. }
  14454. getOutputLength(inputLength, alpha01) {
  14455. return inputLength / 4 * (3 + alpha01) | 0;
  14456. }
  14457. }
  14458. return DeviceCmykCS;
  14459. }();
  14460. const CalGrayCS = function CalGrayCSClosure() {
  14461. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  14462. const A = src[srcOffset] * scale;
  14463. const AG = A ** cs.G;
  14464. const L = cs.YW * AG;
  14465. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  14466. dest[destOffset] = val;
  14467. dest[destOffset + 1] = val;
  14468. dest[destOffset + 2] = val;
  14469. }
  14470. class CalGrayCS extends ColorSpace {
  14471. constructor(whitePoint, blackPoint, gamma) {
  14472. super("CalGray", 1);
  14473. if (!whitePoint) {
  14474. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  14475. }
  14476. blackPoint = blackPoint || [0, 0, 0];
  14477. gamma = gamma || 1;
  14478. this.XW = whitePoint[0];
  14479. this.YW = whitePoint[1];
  14480. this.ZW = whitePoint[2];
  14481. this.XB = blackPoint[0];
  14482. this.YB = blackPoint[1];
  14483. this.ZB = blackPoint[2];
  14484. this.G = gamma;
  14485. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  14486. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  14487. }
  14488. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  14489. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  14490. this.XB = this.YB = this.ZB = 0;
  14491. }
  14492. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  14493. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  14494. }
  14495. if (this.G < 1) {
  14496. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  14497. this.G = 1;
  14498. }
  14499. }
  14500. getRgbItem(src, srcOffset, dest, destOffset) {
  14501. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  14502. }
  14503. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14504. const scale = 1 / ((1 << bits) - 1);
  14505. for (let i = 0; i < count; ++i) {
  14506. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  14507. srcOffset += 1;
  14508. destOffset += 3 + alpha01;
  14509. }
  14510. }
  14511. getOutputLength(inputLength, alpha01) {
  14512. return inputLength * (3 + alpha01);
  14513. }
  14514. }
  14515. return CalGrayCS;
  14516. }();
  14517. const CalRGBCS = function CalRGBCSClosure() {
  14518. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  14519. 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]);
  14520. 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]);
  14521. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  14522. const tempNormalizeMatrix = new Float32Array(3);
  14523. const tempConvertMatrix1 = new Float32Array(3);
  14524. const tempConvertMatrix2 = new Float32Array(3);
  14525. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  14526. function matrixProduct(a, b, result) {
  14527. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  14528. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  14529. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  14530. }
  14531. function convertToFlat(sourceWhitePoint, LMS, result) {
  14532. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  14533. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  14534. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  14535. }
  14536. function convertToD65(sourceWhitePoint, LMS, result) {
  14537. const D65X = 0.95047;
  14538. const D65Y = 1;
  14539. const D65Z = 1.08883;
  14540. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  14541. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  14542. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  14543. }
  14544. function sRGBTransferFunction(color) {
  14545. if (color <= 0.0031308) {
  14546. return adjustToRange(0, 1, 12.92 * color);
  14547. }
  14548. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  14549. }
  14550. function adjustToRange(min, max, value) {
  14551. return Math.max(min, Math.min(max, value));
  14552. }
  14553. function decodeL(L) {
  14554. if (L < 0) {
  14555. return -decodeL(-L);
  14556. }
  14557. if (L > 8.0) {
  14558. return ((L + 16) / 116) ** 3;
  14559. }
  14560. return L * DECODE_L_CONSTANT;
  14561. }
  14562. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  14563. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  14564. result[0] = XYZ_Flat[0];
  14565. result[1] = XYZ_Flat[1];
  14566. result[2] = XYZ_Flat[2];
  14567. return;
  14568. }
  14569. const zeroDecodeL = decodeL(0);
  14570. const X_DST = zeroDecodeL;
  14571. const X_SRC = decodeL(sourceBlackPoint[0]);
  14572. const Y_DST = zeroDecodeL;
  14573. const Y_SRC = decodeL(sourceBlackPoint[1]);
  14574. const Z_DST = zeroDecodeL;
  14575. const Z_SRC = decodeL(sourceBlackPoint[2]);
  14576. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  14577. const X_Offset = 1 - X_Scale;
  14578. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  14579. const Y_Offset = 1 - Y_Scale;
  14580. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  14581. const Z_Offset = 1 - Z_Scale;
  14582. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  14583. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  14584. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  14585. }
  14586. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  14587. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  14588. result[0] = XYZ_In[0];
  14589. result[1] = XYZ_In[1];
  14590. result[2] = XYZ_In[2];
  14591. return;
  14592. }
  14593. const LMS = result;
  14594. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  14595. const LMS_Flat = tempNormalizeMatrix;
  14596. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  14597. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  14598. }
  14599. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  14600. const LMS = result;
  14601. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  14602. const LMS_D65 = tempNormalizeMatrix;
  14603. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  14604. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  14605. }
  14606. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  14607. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  14608. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  14609. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  14610. const AGR = A ** cs.GR;
  14611. const BGG = B ** cs.GG;
  14612. const CGB = C ** cs.GB;
  14613. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  14614. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  14615. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  14616. const XYZ = tempConvertMatrix1;
  14617. XYZ[0] = X;
  14618. XYZ[1] = Y;
  14619. XYZ[2] = Z;
  14620. const XYZ_Flat = tempConvertMatrix2;
  14621. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  14622. const XYZ_Black = tempConvertMatrix1;
  14623. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  14624. const XYZ_D65 = tempConvertMatrix2;
  14625. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  14626. const SRGB = tempConvertMatrix1;
  14627. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  14628. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  14629. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  14630. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  14631. }
  14632. class CalRGBCS extends ColorSpace {
  14633. constructor(whitePoint, blackPoint, gamma, matrix) {
  14634. super("CalRGB", 3);
  14635. if (!whitePoint) {
  14636. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  14637. }
  14638. blackPoint = blackPoint || new Float32Array(3);
  14639. gamma = gamma || new Float32Array([1, 1, 1]);
  14640. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  14641. const XW = whitePoint[0];
  14642. const YW = whitePoint[1];
  14643. const ZW = whitePoint[2];
  14644. this.whitePoint = whitePoint;
  14645. const XB = blackPoint[0];
  14646. const YB = blackPoint[1];
  14647. const ZB = blackPoint[2];
  14648. this.blackPoint = blackPoint;
  14649. this.GR = gamma[0];
  14650. this.GG = gamma[1];
  14651. this.GB = gamma[2];
  14652. this.MXA = matrix[0];
  14653. this.MYA = matrix[1];
  14654. this.MZA = matrix[2];
  14655. this.MXB = matrix[3];
  14656. this.MYB = matrix[4];
  14657. this.MZB = matrix[5];
  14658. this.MXC = matrix[6];
  14659. this.MYC = matrix[7];
  14660. this.MZC = matrix[8];
  14661. if (XW < 0 || ZW < 0 || YW !== 1) {
  14662. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  14663. }
  14664. if (XB < 0 || YB < 0 || ZB < 0) {
  14665. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  14666. this.blackPoint = new Float32Array(3);
  14667. }
  14668. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  14669. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  14670. this.GR = this.GG = this.GB = 1;
  14671. }
  14672. }
  14673. getRgbItem(src, srcOffset, dest, destOffset) {
  14674. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  14675. }
  14676. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14677. const scale = 1 / ((1 << bits) - 1);
  14678. for (let i = 0; i < count; ++i) {
  14679. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  14680. srcOffset += 3;
  14681. destOffset += 3 + alpha01;
  14682. }
  14683. }
  14684. getOutputLength(inputLength, alpha01) {
  14685. return inputLength * (3 + alpha01) / 3 | 0;
  14686. }
  14687. }
  14688. return CalRGBCS;
  14689. }();
  14690. const LabCS = function LabCSClosure() {
  14691. function fn_g(x) {
  14692. let result;
  14693. if (x >= 6 / 29) {
  14694. result = x * x * x;
  14695. } else {
  14696. result = 108 / 841 * (x - 4 / 29);
  14697. }
  14698. return result;
  14699. }
  14700. function decode(value, high1, low2, high2) {
  14701. return low2 + value * (high2 - low2) / high1;
  14702. }
  14703. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  14704. let Ls = src[srcOffset];
  14705. let as = src[srcOffset + 1];
  14706. let bs = src[srcOffset + 2];
  14707. if (maxVal !== false) {
  14708. Ls = decode(Ls, maxVal, 0, 100);
  14709. as = decode(as, maxVal, cs.amin, cs.amax);
  14710. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  14711. }
  14712. if (as > cs.amax) {
  14713. as = cs.amax;
  14714. } else if (as < cs.amin) {
  14715. as = cs.amin;
  14716. }
  14717. if (bs > cs.bmax) {
  14718. bs = cs.bmax;
  14719. } else if (bs < cs.bmin) {
  14720. bs = cs.bmin;
  14721. }
  14722. const M = (Ls + 16) / 116;
  14723. const L = M + as / 500;
  14724. const N = M - bs / 200;
  14725. const X = cs.XW * fn_g(L);
  14726. const Y = cs.YW * fn_g(M);
  14727. const Z = cs.ZW * fn_g(N);
  14728. let r, g, b;
  14729. if (cs.ZW < 1) {
  14730. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  14731. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  14732. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  14733. } else {
  14734. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  14735. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  14736. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  14737. }
  14738. dest[destOffset] = Math.sqrt(r) * 255;
  14739. dest[destOffset + 1] = Math.sqrt(g) * 255;
  14740. dest[destOffset + 2] = Math.sqrt(b) * 255;
  14741. }
  14742. class LabCS extends ColorSpace {
  14743. constructor(whitePoint, blackPoint, range) {
  14744. super("Lab", 3);
  14745. if (!whitePoint) {
  14746. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  14747. }
  14748. blackPoint = blackPoint || [0, 0, 0];
  14749. range = range || [-100, 100, -100, 100];
  14750. this.XW = whitePoint[0];
  14751. this.YW = whitePoint[1];
  14752. this.ZW = whitePoint[2];
  14753. this.amin = range[0];
  14754. this.amax = range[1];
  14755. this.bmin = range[2];
  14756. this.bmax = range[3];
  14757. this.XB = blackPoint[0];
  14758. this.YB = blackPoint[1];
  14759. this.ZB = blackPoint[2];
  14760. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  14761. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  14762. }
  14763. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  14764. (0, _util.info)("Invalid BlackPoint, falling back to default");
  14765. this.XB = this.YB = this.ZB = 0;
  14766. }
  14767. if (this.amin > this.amax || this.bmin > this.bmax) {
  14768. (0, _util.info)("Invalid Range, falling back to defaults");
  14769. this.amin = -100;
  14770. this.amax = 100;
  14771. this.bmin = -100;
  14772. this.bmax = 100;
  14773. }
  14774. }
  14775. getRgbItem(src, srcOffset, dest, destOffset) {
  14776. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  14777. }
  14778. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14779. const maxVal = (1 << bits) - 1;
  14780. for (let i = 0; i < count; i++) {
  14781. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  14782. srcOffset += 3;
  14783. destOffset += 3 + alpha01;
  14784. }
  14785. }
  14786. getOutputLength(inputLength, alpha01) {
  14787. return inputLength * (3 + alpha01) / 3 | 0;
  14788. }
  14789. isDefaultDecode(decodeMap, bpc) {
  14790. return true;
  14791. }
  14792. get usesZeroToOneRange() {
  14793. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  14794. }
  14795. }
  14796. return LabCS;
  14797. }();
  14798. /***/ }),
  14799. /* 24 */
  14800. /***/ (function(module, exports, __w_pdfjs_require__) {
  14801. "use strict";
  14802. Object.defineProperty(exports, "__esModule", {
  14803. value: true
  14804. });
  14805. exports.GlobalImageCache = exports.LocalImageCache = void 0;
  14806. var _util = __w_pdfjs_require__(2);
  14807. var _primitives = __w_pdfjs_require__(5);
  14808. class LocalImageCache {
  14809. constructor() {
  14810. this._nameRefMap = new Map();
  14811. this._imageMap = new Map();
  14812. this._imageCache = new _primitives.RefSetCache();
  14813. }
  14814. getByName(name) {
  14815. const ref = this._nameRefMap.get(name);
  14816. if (ref) {
  14817. return this.getByRef(ref);
  14818. }
  14819. return this._imageMap.get(name) || null;
  14820. }
  14821. getByRef(ref) {
  14822. return this._imageCache.get(ref) || null;
  14823. }
  14824. set(name, ref = null, data) {
  14825. if (!name) {
  14826. throw new Error('LocalImageCache.set - expected "name" argument.');
  14827. }
  14828. if (ref) {
  14829. if (this._imageCache.has(ref)) {
  14830. return;
  14831. }
  14832. this._nameRefMap.set(name, ref);
  14833. this._imageCache.put(ref, data);
  14834. return;
  14835. }
  14836. if (this._imageMap.has(name)) {
  14837. return;
  14838. }
  14839. this._imageMap.set(name, data);
  14840. }
  14841. }
  14842. exports.LocalImageCache = LocalImageCache;
  14843. class GlobalImageCache {
  14844. static get NUM_PAGES_THRESHOLD() {
  14845. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  14846. }
  14847. static get MAX_IMAGES_TO_CACHE() {
  14848. return (0, _util.shadow)(this, "MAX_IMAGES_TO_CACHE", 10);
  14849. }
  14850. constructor() {
  14851. this._refCache = new _primitives.RefSetCache();
  14852. this._imageCache = new _primitives.RefSetCache();
  14853. }
  14854. shouldCache(ref, pageIndex) {
  14855. const pageIndexSet = this._refCache.get(ref);
  14856. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  14857. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  14858. return false;
  14859. }
  14860. if (!this._imageCache.has(ref) && this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
  14861. return false;
  14862. }
  14863. return true;
  14864. }
  14865. addPageIndex(ref, pageIndex) {
  14866. let pageIndexSet = this._refCache.get(ref);
  14867. if (!pageIndexSet) {
  14868. pageIndexSet = new Set();
  14869. this._refCache.put(ref, pageIndexSet);
  14870. }
  14871. pageIndexSet.add(pageIndex);
  14872. }
  14873. getData(ref, pageIndex) {
  14874. if (!this._refCache.has(ref)) {
  14875. return null;
  14876. }
  14877. const pageIndexSet = this._refCache.get(ref);
  14878. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  14879. return null;
  14880. }
  14881. if (!this._imageCache.has(ref)) {
  14882. return null;
  14883. }
  14884. pageIndexSet.add(pageIndex);
  14885. return this._imageCache.get(ref);
  14886. }
  14887. setData(ref, data) {
  14888. if (!this._refCache.has(ref)) {
  14889. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  14890. }
  14891. if (this._imageCache.has(ref)) {
  14892. return;
  14893. }
  14894. if (this._imageCache.size >= GlobalImageCache.MAX_IMAGES_TO_CACHE) {
  14895. (0, _util.info)("GlobalImageCache.setData - ignoring image above MAX_IMAGES_TO_CACHE.");
  14896. return;
  14897. }
  14898. this._imageCache.put(ref, data);
  14899. }
  14900. clear(onlyData = false) {
  14901. if (!onlyData) {
  14902. this._refCache.clear();
  14903. }
  14904. this._imageCache.clear();
  14905. }
  14906. }
  14907. exports.GlobalImageCache = GlobalImageCache;
  14908. /***/ }),
  14909. /* 25 */
  14910. /***/ (function(module, exports, __w_pdfjs_require__) {
  14911. "use strict";
  14912. Object.defineProperty(exports, "__esModule", {
  14913. value: true
  14914. });
  14915. exports.getQuadPoints = getQuadPoints;
  14916. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  14917. var _util = __w_pdfjs_require__(2);
  14918. var _obj = __w_pdfjs_require__(10);
  14919. var _primitives = __w_pdfjs_require__(5);
  14920. var _colorspace = __w_pdfjs_require__(23);
  14921. var _core_utils = __w_pdfjs_require__(8);
  14922. var _operator_list = __w_pdfjs_require__(26);
  14923. var _stream = __w_pdfjs_require__(12);
  14924. class AnnotationFactory {
  14925. static create(xref, ref, pdfManager, idFactory) {
  14926. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory]);
  14927. }
  14928. static _create(xref, ref, pdfManager, idFactory) {
  14929. const dict = xref.fetchIfRef(ref);
  14930. if (!(0, _primitives.isDict)(dict)) {
  14931. return undefined;
  14932. }
  14933. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  14934. let subtype = dict.get("Subtype");
  14935. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  14936. const parameters = {
  14937. xref,
  14938. dict,
  14939. subtype,
  14940. id,
  14941. pdfManager
  14942. };
  14943. switch (subtype) {
  14944. case "Link":
  14945. return new LinkAnnotation(parameters);
  14946. case "Text":
  14947. return new TextAnnotation(parameters);
  14948. case "Widget":
  14949. let fieldType = (0, _core_utils.getInheritableProperty)({
  14950. dict,
  14951. key: "FT"
  14952. });
  14953. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  14954. switch (fieldType) {
  14955. case "Tx":
  14956. return new TextWidgetAnnotation(parameters);
  14957. case "Btn":
  14958. return new ButtonWidgetAnnotation(parameters);
  14959. case "Ch":
  14960. return new ChoiceWidgetAnnotation(parameters);
  14961. }
  14962. (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type.");
  14963. return new WidgetAnnotation(parameters);
  14964. case "Popup":
  14965. return new PopupAnnotation(parameters);
  14966. case "FreeText":
  14967. return new FreeTextAnnotation(parameters);
  14968. case "Line":
  14969. return new LineAnnotation(parameters);
  14970. case "Square":
  14971. return new SquareAnnotation(parameters);
  14972. case "Circle":
  14973. return new CircleAnnotation(parameters);
  14974. case "PolyLine":
  14975. return new PolylineAnnotation(parameters);
  14976. case "Polygon":
  14977. return new PolygonAnnotation(parameters);
  14978. case "Caret":
  14979. return new CaretAnnotation(parameters);
  14980. case "Ink":
  14981. return new InkAnnotation(parameters);
  14982. case "Highlight":
  14983. return new HighlightAnnotation(parameters);
  14984. case "Underline":
  14985. return new UnderlineAnnotation(parameters);
  14986. case "Squiggly":
  14987. return new SquigglyAnnotation(parameters);
  14988. case "StrikeOut":
  14989. return new StrikeOutAnnotation(parameters);
  14990. case "Stamp":
  14991. return new StampAnnotation(parameters);
  14992. case "FileAttachment":
  14993. return new FileAttachmentAnnotation(parameters);
  14994. default:
  14995. if (!subtype) {
  14996. (0, _util.warn)("Annotation is missing the required /Subtype.");
  14997. } else {
  14998. (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation.");
  14999. }
  15000. return new Annotation(parameters);
  15001. }
  15002. }
  15003. }
  15004. exports.AnnotationFactory = AnnotationFactory;
  15005. function getQuadPoints(dict, rect) {
  15006. if (!dict.has("QuadPoints")) {
  15007. return null;
  15008. }
  15009. const quadPoints = dict.getArray("QuadPoints");
  15010. if (!Array.isArray(quadPoints) || quadPoints.length % 8 > 0) {
  15011. return null;
  15012. }
  15013. const quadPointsLists = [];
  15014. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  15015. quadPointsLists.push([]);
  15016. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  15017. const x = quadPoints[j];
  15018. const y = quadPoints[j + 1];
  15019. if (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3]) {
  15020. return null;
  15021. }
  15022. quadPointsLists[i].push({
  15023. x,
  15024. y
  15025. });
  15026. }
  15027. }
  15028. return quadPointsLists;
  15029. }
  15030. function getTransformMatrix(rect, bbox, matrix) {
  15031. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  15032. if (minX === maxX || minY === maxY) {
  15033. return [1, 0, 0, 1, rect[0], rect[1]];
  15034. }
  15035. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  15036. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  15037. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  15038. }
  15039. class Annotation {
  15040. constructor(params) {
  15041. const dict = params.dict;
  15042. this.setContents(dict.get("Contents"));
  15043. this.setModificationDate(dict.get("M"));
  15044. this.setFlags(dict.get("F"));
  15045. this.setRectangle(dict.getArray("Rect"));
  15046. this.setColor(dict.getArray("C"));
  15047. this.setBorderStyle(dict);
  15048. this.setAppearance(dict);
  15049. this.data = {
  15050. annotationFlags: this.flags,
  15051. borderStyle: this.borderStyle,
  15052. color: this.color,
  15053. contents: this.contents,
  15054. hasAppearance: !!this.appearance,
  15055. id: params.id,
  15056. modificationDate: this.modificationDate,
  15057. rect: this.rectangle,
  15058. subtype: params.subtype
  15059. };
  15060. }
  15061. _hasFlag(flags, flag) {
  15062. return !!(flags & flag);
  15063. }
  15064. _isViewable(flags) {
  15065. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  15066. }
  15067. _isPrintable(flags) {
  15068. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
  15069. }
  15070. get viewable() {
  15071. if (this.flags === 0) {
  15072. return true;
  15073. }
  15074. return this._isViewable(this.flags);
  15075. }
  15076. get printable() {
  15077. if (this.flags === 0) {
  15078. return false;
  15079. }
  15080. return this._isPrintable(this.flags);
  15081. }
  15082. setContents(contents) {
  15083. this.contents = (0, _util.stringToPDFString)(contents || "");
  15084. }
  15085. setModificationDate(modificationDate) {
  15086. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  15087. }
  15088. setFlags(flags) {
  15089. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  15090. }
  15091. hasFlag(flag) {
  15092. return this._hasFlag(this.flags, flag);
  15093. }
  15094. setRectangle(rectangle) {
  15095. if (Array.isArray(rectangle) && rectangle.length === 4) {
  15096. this.rectangle = _util.Util.normalizeRect(rectangle);
  15097. } else {
  15098. this.rectangle = [0, 0, 0, 0];
  15099. }
  15100. }
  15101. setColor(color) {
  15102. const rgbColor = new Uint8ClampedArray(3);
  15103. if (!Array.isArray(color)) {
  15104. this.color = rgbColor;
  15105. return;
  15106. }
  15107. switch (color.length) {
  15108. case 0:
  15109. this.color = null;
  15110. break;
  15111. case 1:
  15112. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  15113. this.color = rgbColor;
  15114. break;
  15115. case 3:
  15116. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  15117. this.color = rgbColor;
  15118. break;
  15119. case 4:
  15120. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  15121. this.color = rgbColor;
  15122. break;
  15123. default:
  15124. this.color = rgbColor;
  15125. break;
  15126. }
  15127. }
  15128. setBorderStyle(borderStyle) {
  15129. this.borderStyle = new AnnotationBorderStyle();
  15130. if (!(0, _primitives.isDict)(borderStyle)) {
  15131. return;
  15132. }
  15133. if (borderStyle.has("BS")) {
  15134. const dict = borderStyle.get("BS");
  15135. const dictType = dict.get("Type");
  15136. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  15137. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  15138. this.borderStyle.setStyle(dict.get("S"));
  15139. this.borderStyle.setDashArray(dict.getArray("D"));
  15140. }
  15141. } else if (borderStyle.has("Border")) {
  15142. const array = borderStyle.getArray("Border");
  15143. if (Array.isArray(array) && array.length >= 3) {
  15144. this.borderStyle.setHorizontalCornerRadius(array[0]);
  15145. this.borderStyle.setVerticalCornerRadius(array[1]);
  15146. this.borderStyle.setWidth(array[2], this.rectangle);
  15147. if (array.length === 4) {
  15148. this.borderStyle.setDashArray(array[3]);
  15149. }
  15150. }
  15151. } else {
  15152. this.borderStyle.setWidth(0);
  15153. }
  15154. }
  15155. setAppearance(dict) {
  15156. this.appearance = null;
  15157. const appearanceStates = dict.get("AP");
  15158. if (!(0, _primitives.isDict)(appearanceStates)) {
  15159. return;
  15160. }
  15161. const normalAppearanceState = appearanceStates.get("N");
  15162. if ((0, _primitives.isStream)(normalAppearanceState)) {
  15163. this.appearance = normalAppearanceState;
  15164. return;
  15165. }
  15166. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  15167. return;
  15168. }
  15169. const as = dict.get("AS");
  15170. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  15171. return;
  15172. }
  15173. this.appearance = normalAppearanceState.get(as.name);
  15174. }
  15175. loadResources(keys) {
  15176. return this.appearance.dict.getAsync("Resources").then(resources => {
  15177. if (!resources) {
  15178. return undefined;
  15179. }
  15180. const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
  15181. return objectLoader.load().then(function () {
  15182. return resources;
  15183. });
  15184. });
  15185. }
  15186. getOperatorList(evaluator, task, renderForms) {
  15187. if (!this.appearance) {
  15188. return Promise.resolve(new _operator_list.OperatorList());
  15189. }
  15190. const data = this.data;
  15191. const appearanceDict = this.appearance.dict;
  15192. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  15193. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  15194. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  15195. const transform = getTransformMatrix(data.rect, bbox, matrix);
  15196. return resourcesPromise.then(resources => {
  15197. const opList = new _operator_list.OperatorList();
  15198. opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
  15199. return evaluator.getOperatorList({
  15200. stream: this.appearance,
  15201. task,
  15202. resources,
  15203. operatorList: opList
  15204. }).then(() => {
  15205. opList.addOp(_util.OPS.endAnnotation, []);
  15206. this.appearance.reset();
  15207. return opList;
  15208. });
  15209. });
  15210. }
  15211. }
  15212. exports.Annotation = Annotation;
  15213. class AnnotationBorderStyle {
  15214. constructor() {
  15215. this.width = 1;
  15216. this.style = _util.AnnotationBorderStyleType.SOLID;
  15217. this.dashArray = [3];
  15218. this.horizontalCornerRadius = 0;
  15219. this.verticalCornerRadius = 0;
  15220. }
  15221. setWidth(width, rect = [0, 0, 0, 0]) {
  15222. if ((0, _primitives.isName)(width)) {
  15223. this.width = 0;
  15224. return;
  15225. }
  15226. if (Number.isInteger(width)) {
  15227. if (width > 0) {
  15228. const maxWidth = (rect[2] - rect[0]) / 2;
  15229. const maxHeight = (rect[3] - rect[1]) / 2;
  15230. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  15231. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  15232. width = 1;
  15233. }
  15234. }
  15235. this.width = width;
  15236. }
  15237. }
  15238. setStyle(style) {
  15239. if (!(0, _primitives.isName)(style)) {
  15240. return;
  15241. }
  15242. switch (style.name) {
  15243. case "S":
  15244. this.style = _util.AnnotationBorderStyleType.SOLID;
  15245. break;
  15246. case "D":
  15247. this.style = _util.AnnotationBorderStyleType.DASHED;
  15248. break;
  15249. case "B":
  15250. this.style = _util.AnnotationBorderStyleType.BEVELED;
  15251. break;
  15252. case "I":
  15253. this.style = _util.AnnotationBorderStyleType.INSET;
  15254. break;
  15255. case "U":
  15256. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  15257. break;
  15258. default:
  15259. break;
  15260. }
  15261. }
  15262. setDashArray(dashArray) {
  15263. if (Array.isArray(dashArray) && dashArray.length > 0) {
  15264. let isValid = true;
  15265. let allZeros = true;
  15266. for (const element of dashArray) {
  15267. const validNumber = +element >= 0;
  15268. if (!validNumber) {
  15269. isValid = false;
  15270. break;
  15271. } else if (element > 0) {
  15272. allZeros = false;
  15273. }
  15274. }
  15275. if (isValid && !allZeros) {
  15276. this.dashArray = dashArray;
  15277. } else {
  15278. this.width = 0;
  15279. }
  15280. } else if (dashArray) {
  15281. this.width = 0;
  15282. }
  15283. }
  15284. setHorizontalCornerRadius(radius) {
  15285. if (Number.isInteger(radius)) {
  15286. this.horizontalCornerRadius = radius;
  15287. }
  15288. }
  15289. setVerticalCornerRadius(radius) {
  15290. if (Number.isInteger(radius)) {
  15291. this.verticalCornerRadius = radius;
  15292. }
  15293. }
  15294. }
  15295. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  15296. class MarkupAnnotation extends Annotation {
  15297. constructor(parameters) {
  15298. super(parameters);
  15299. const dict = parameters.dict;
  15300. if (dict.has("IRT")) {
  15301. const rawIRT = dict.getRaw("IRT");
  15302. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  15303. const rt = dict.get("RT");
  15304. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  15305. }
  15306. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  15307. const parent = dict.get("IRT");
  15308. this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
  15309. this.setContents(parent.get("Contents"));
  15310. this.data.contents = this.contents;
  15311. if (!parent.has("CreationDate")) {
  15312. this.data.creationDate = null;
  15313. } else {
  15314. this.setCreationDate(parent.get("CreationDate"));
  15315. this.data.creationDate = this.creationDate;
  15316. }
  15317. if (!parent.has("M")) {
  15318. this.data.modificationDate = null;
  15319. } else {
  15320. this.setModificationDate(parent.get("M"));
  15321. this.data.modificationDate = this.modificationDate;
  15322. }
  15323. this.data.hasPopup = parent.has("Popup");
  15324. if (!parent.has("C")) {
  15325. this.data.color = null;
  15326. } else {
  15327. this.setColor(parent.getArray("C"));
  15328. this.data.color = this.color;
  15329. }
  15330. } else {
  15331. this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
  15332. this.setCreationDate(dict.get("CreationDate"));
  15333. this.data.creationDate = this.creationDate;
  15334. this.data.hasPopup = dict.has("Popup");
  15335. if (!dict.has("C")) {
  15336. this.data.color = null;
  15337. }
  15338. }
  15339. }
  15340. setCreationDate(creationDate) {
  15341. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  15342. }
  15343. }
  15344. exports.MarkupAnnotation = MarkupAnnotation;
  15345. class WidgetAnnotation extends Annotation {
  15346. constructor(params) {
  15347. super(params);
  15348. const dict = params.dict;
  15349. const data = this.data;
  15350. data.annotationType = _util.AnnotationType.WIDGET;
  15351. data.fieldName = this._constructFieldName(dict);
  15352. data.fieldValue = (0, _core_utils.getInheritableProperty)({
  15353. dict,
  15354. key: "V",
  15355. getArray: true
  15356. });
  15357. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  15358. data.defaultAppearance = (0, _core_utils.getInheritableProperty)({
  15359. dict,
  15360. key: "DA"
  15361. }) || "";
  15362. const fieldType = (0, _core_utils.getInheritableProperty)({
  15363. dict,
  15364. key: "FT"
  15365. });
  15366. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  15367. this.fieldResources = (0, _core_utils.getInheritableProperty)({
  15368. dict,
  15369. key: "DR"
  15370. }) || _primitives.Dict.empty;
  15371. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  15372. dict,
  15373. key: "Ff"
  15374. });
  15375. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  15376. data.fieldFlags = 0;
  15377. }
  15378. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  15379. if (data.fieldType === "Sig") {
  15380. data.fieldValue = null;
  15381. this.setFlags(_util.AnnotationFlag.HIDDEN);
  15382. }
  15383. }
  15384. _constructFieldName(dict) {
  15385. if (!dict.has("T") && !dict.has("Parent")) {
  15386. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  15387. return "";
  15388. }
  15389. if (!dict.has("Parent")) {
  15390. return (0, _util.stringToPDFString)(dict.get("T"));
  15391. }
  15392. const fieldName = [];
  15393. if (dict.has("T")) {
  15394. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  15395. }
  15396. let loopDict = dict;
  15397. while (loopDict.has("Parent")) {
  15398. loopDict = loopDict.get("Parent");
  15399. if (!(0, _primitives.isDict)(loopDict)) {
  15400. break;
  15401. }
  15402. if (loopDict.has("T")) {
  15403. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  15404. }
  15405. }
  15406. return fieldName.join(".");
  15407. }
  15408. hasFieldFlag(flag) {
  15409. return !!(this.data.fieldFlags & flag);
  15410. }
  15411. getOperatorList(evaluator, task, renderForms) {
  15412. if (renderForms) {
  15413. return Promise.resolve(new _operator_list.OperatorList());
  15414. }
  15415. return super.getOperatorList(evaluator, task, renderForms);
  15416. }
  15417. }
  15418. class TextWidgetAnnotation extends WidgetAnnotation {
  15419. constructor(params) {
  15420. super(params);
  15421. const dict = params.dict;
  15422. this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || "");
  15423. let alignment = (0, _core_utils.getInheritableProperty)({
  15424. dict,
  15425. key: "Q"
  15426. });
  15427. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  15428. alignment = null;
  15429. }
  15430. this.data.textAlignment = alignment;
  15431. let maximumLength = (0, _core_utils.getInheritableProperty)({
  15432. dict,
  15433. key: "MaxLen"
  15434. });
  15435. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  15436. maximumLength = null;
  15437. }
  15438. this.data.maxLen = maximumLength;
  15439. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  15440. 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;
  15441. }
  15442. getOperatorList(evaluator, task, renderForms) {
  15443. if (renderForms || this.appearance) {
  15444. return super.getOperatorList(evaluator, task, renderForms);
  15445. }
  15446. const operatorList = new _operator_list.OperatorList();
  15447. if (!this.data.defaultAppearance) {
  15448. return Promise.resolve(operatorList);
  15449. }
  15450. const stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
  15451. return evaluator.getOperatorList({
  15452. stream,
  15453. task,
  15454. resources: this.fieldResources,
  15455. operatorList
  15456. }).then(function () {
  15457. return operatorList;
  15458. });
  15459. }
  15460. }
  15461. class ButtonWidgetAnnotation extends WidgetAnnotation {
  15462. constructor(params) {
  15463. super(params);
  15464. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  15465. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  15466. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  15467. if (this.data.checkBox) {
  15468. this._processCheckBox(params);
  15469. } else if (this.data.radioButton) {
  15470. this._processRadioButton(params);
  15471. } else if (this.data.pushButton) {
  15472. this._processPushButton(params);
  15473. } else {
  15474. (0, _util.warn)("Invalid field flags for button widget annotation");
  15475. }
  15476. }
  15477. _processCheckBox(params) {
  15478. if ((0, _primitives.isName)(this.data.fieldValue)) {
  15479. this.data.fieldValue = this.data.fieldValue.name;
  15480. }
  15481. const customAppearance = params.dict.get("AP");
  15482. if (!(0, _primitives.isDict)(customAppearance)) {
  15483. return;
  15484. }
  15485. const exportValueOptionsDict = customAppearance.get("D");
  15486. if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
  15487. return;
  15488. }
  15489. const exportValues = exportValueOptionsDict.getKeys();
  15490. const hasCorrectOptionCount = exportValues.length === 2;
  15491. if (!hasCorrectOptionCount) {
  15492. return;
  15493. }
  15494. this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
  15495. }
  15496. _processRadioButton(params) {
  15497. this.data.fieldValue = this.data.buttonValue = null;
  15498. const fieldParent = params.dict.get("Parent");
  15499. if ((0, _primitives.isDict)(fieldParent) && fieldParent.has("V")) {
  15500. const fieldParentValue = fieldParent.get("V");
  15501. if ((0, _primitives.isName)(fieldParentValue)) {
  15502. this.data.fieldValue = fieldParentValue.name;
  15503. }
  15504. }
  15505. const appearanceStates = params.dict.get("AP");
  15506. if (!(0, _primitives.isDict)(appearanceStates)) {
  15507. return;
  15508. }
  15509. const normalAppearanceState = appearanceStates.get("N");
  15510. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  15511. return;
  15512. }
  15513. for (const key of normalAppearanceState.getKeys()) {
  15514. if (key !== "Off") {
  15515. this.data.buttonValue = key;
  15516. break;
  15517. }
  15518. }
  15519. }
  15520. _processPushButton(params) {
  15521. if (!params.dict.has("A")) {
  15522. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  15523. return;
  15524. }
  15525. _obj.Catalog.parseDestDictionary({
  15526. destDict: params.dict,
  15527. resultObj: this.data,
  15528. docBaseUrl: params.pdfManager.docBaseUrl
  15529. });
  15530. }
  15531. }
  15532. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  15533. constructor(params) {
  15534. super(params);
  15535. this.data.options = [];
  15536. const options = (0, _core_utils.getInheritableProperty)({
  15537. dict: params.dict,
  15538. key: "Opt"
  15539. });
  15540. if (Array.isArray(options)) {
  15541. const xref = params.xref;
  15542. for (let i = 0, ii = options.length; i < ii; i++) {
  15543. const option = xref.fetchIfRef(options[i]);
  15544. const isOptionArray = Array.isArray(option);
  15545. this.data.options[i] = {
  15546. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  15547. displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  15548. };
  15549. }
  15550. }
  15551. if (!Array.isArray(this.data.fieldValue)) {
  15552. this.data.fieldValue = [this.data.fieldValue];
  15553. }
  15554. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  15555. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  15556. }
  15557. }
  15558. class TextAnnotation extends MarkupAnnotation {
  15559. constructor(parameters) {
  15560. const DEFAULT_ICON_SIZE = 22;
  15561. super(parameters);
  15562. const dict = parameters.dict;
  15563. this.data.annotationType = _util.AnnotationType.TEXT;
  15564. if (this.data.hasAppearance) {
  15565. this.data.name = "NoIcon";
  15566. } else {
  15567. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  15568. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  15569. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  15570. }
  15571. if (dict.has("State")) {
  15572. this.data.state = dict.get("State") || null;
  15573. this.data.stateModel = dict.get("StateModel") || null;
  15574. } else {
  15575. this.data.state = null;
  15576. this.data.stateModel = null;
  15577. }
  15578. }
  15579. }
  15580. class LinkAnnotation extends Annotation {
  15581. constructor(params) {
  15582. super(params);
  15583. this.data.annotationType = _util.AnnotationType.LINK;
  15584. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  15585. if (quadPoints) {
  15586. this.data.quadPoints = quadPoints;
  15587. }
  15588. _obj.Catalog.parseDestDictionary({
  15589. destDict: params.dict,
  15590. resultObj: this.data,
  15591. docBaseUrl: params.pdfManager.docBaseUrl
  15592. });
  15593. }
  15594. }
  15595. class PopupAnnotation extends Annotation {
  15596. constructor(parameters) {
  15597. super(parameters);
  15598. this.data.annotationType = _util.AnnotationType.POPUP;
  15599. let parentItem = parameters.dict.get("Parent");
  15600. if (!parentItem) {
  15601. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  15602. return;
  15603. }
  15604. const parentSubtype = parentItem.get("Subtype");
  15605. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  15606. const rawParent = parameters.dict.getRaw("Parent");
  15607. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  15608. const rt = parentItem.get("RT");
  15609. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  15610. parentItem = parentItem.get("IRT");
  15611. }
  15612. if (!parentItem.has("M")) {
  15613. this.data.modificationDate = null;
  15614. } else {
  15615. this.setModificationDate(parentItem.get("M"));
  15616. this.data.modificationDate = this.modificationDate;
  15617. }
  15618. if (!parentItem.has("C")) {
  15619. this.data.color = null;
  15620. } else {
  15621. this.setColor(parentItem.getArray("C"));
  15622. this.data.color = this.color;
  15623. }
  15624. if (!this.viewable) {
  15625. const parentFlags = parentItem.get("F");
  15626. if (this._isViewable(parentFlags)) {
  15627. this.setFlags(parentFlags);
  15628. }
  15629. }
  15630. this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
  15631. this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
  15632. }
  15633. }
  15634. class FreeTextAnnotation extends MarkupAnnotation {
  15635. constructor(parameters) {
  15636. super(parameters);
  15637. this.data.annotationType = _util.AnnotationType.FREETEXT;
  15638. }
  15639. }
  15640. class LineAnnotation extends MarkupAnnotation {
  15641. constructor(parameters) {
  15642. super(parameters);
  15643. this.data.annotationType = _util.AnnotationType.LINE;
  15644. this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L"));
  15645. }
  15646. }
  15647. class SquareAnnotation extends MarkupAnnotation {
  15648. constructor(parameters) {
  15649. super(parameters);
  15650. this.data.annotationType = _util.AnnotationType.SQUARE;
  15651. }
  15652. }
  15653. class CircleAnnotation extends MarkupAnnotation {
  15654. constructor(parameters) {
  15655. super(parameters);
  15656. this.data.annotationType = _util.AnnotationType.CIRCLE;
  15657. }
  15658. }
  15659. class PolylineAnnotation extends MarkupAnnotation {
  15660. constructor(parameters) {
  15661. super(parameters);
  15662. this.data.annotationType = _util.AnnotationType.POLYLINE;
  15663. const rawVertices = parameters.dict.getArray("Vertices");
  15664. this.data.vertices = [];
  15665. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  15666. this.data.vertices.push({
  15667. x: rawVertices[i],
  15668. y: rawVertices[i + 1]
  15669. });
  15670. }
  15671. }
  15672. }
  15673. class PolygonAnnotation extends PolylineAnnotation {
  15674. constructor(parameters) {
  15675. super(parameters);
  15676. this.data.annotationType = _util.AnnotationType.POLYGON;
  15677. }
  15678. }
  15679. class CaretAnnotation extends MarkupAnnotation {
  15680. constructor(parameters) {
  15681. super(parameters);
  15682. this.data.annotationType = _util.AnnotationType.CARET;
  15683. }
  15684. }
  15685. class InkAnnotation extends MarkupAnnotation {
  15686. constructor(parameters) {
  15687. super(parameters);
  15688. this.data.annotationType = _util.AnnotationType.INK;
  15689. const xref = parameters.xref;
  15690. const originalInkLists = parameters.dict.getArray("InkList");
  15691. this.data.inkLists = [];
  15692. for (let i = 0, ii = originalInkLists.length; i < ii; ++i) {
  15693. this.data.inkLists.push([]);
  15694. for (let j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
  15695. this.data.inkLists[i].push({
  15696. x: xref.fetchIfRef(originalInkLists[i][j]),
  15697. y: xref.fetchIfRef(originalInkLists[i][j + 1])
  15698. });
  15699. }
  15700. }
  15701. }
  15702. }
  15703. class HighlightAnnotation extends MarkupAnnotation {
  15704. constructor(parameters) {
  15705. super(parameters);
  15706. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  15707. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15708. if (quadPoints) {
  15709. this.data.quadPoints = quadPoints;
  15710. }
  15711. }
  15712. }
  15713. class UnderlineAnnotation extends MarkupAnnotation {
  15714. constructor(parameters) {
  15715. super(parameters);
  15716. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  15717. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15718. if (quadPoints) {
  15719. this.data.quadPoints = quadPoints;
  15720. }
  15721. }
  15722. }
  15723. class SquigglyAnnotation extends MarkupAnnotation {
  15724. constructor(parameters) {
  15725. super(parameters);
  15726. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  15727. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15728. if (quadPoints) {
  15729. this.data.quadPoints = quadPoints;
  15730. }
  15731. }
  15732. }
  15733. class StrikeOutAnnotation extends MarkupAnnotation {
  15734. constructor(parameters) {
  15735. super(parameters);
  15736. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  15737. const quadPoints = getQuadPoints(parameters.dict, this.rectangle);
  15738. if (quadPoints) {
  15739. this.data.quadPoints = quadPoints;
  15740. }
  15741. }
  15742. }
  15743. class StampAnnotation extends MarkupAnnotation {
  15744. constructor(parameters) {
  15745. super(parameters);
  15746. this.data.annotationType = _util.AnnotationType.STAMP;
  15747. }
  15748. }
  15749. class FileAttachmentAnnotation extends MarkupAnnotation {
  15750. constructor(parameters) {
  15751. super(parameters);
  15752. const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref);
  15753. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  15754. this.data.file = file.serializable;
  15755. }
  15756. }
  15757. /***/ }),
  15758. /* 26 */
  15759. /***/ (function(module, exports, __w_pdfjs_require__) {
  15760. "use strict";
  15761. Object.defineProperty(exports, "__esModule", {
  15762. value: true
  15763. });
  15764. exports.OperatorList = void 0;
  15765. var _util = __w_pdfjs_require__(2);
  15766. var QueueOptimizer = function QueueOptimizerClosure() {
  15767. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  15768. var state = parentState;
  15769. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  15770. var item = pattern[i];
  15771. state = state[item] || (state[item] = []);
  15772. }
  15773. state[pattern[pattern.length - 1]] = {
  15774. checkFn,
  15775. iterateFn,
  15776. processFn
  15777. };
  15778. }
  15779. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  15780. var iFirstPIMXO = iFirstSave + 2;
  15781. for (var i = 0; i < count; i++) {
  15782. var arg = argsArray[iFirstPIMXO + 4 * i];
  15783. var imageMask = arg.length === 1 && arg[0];
  15784. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  15785. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  15786. continue;
  15787. }
  15788. break;
  15789. }
  15790. return count - i;
  15791. }
  15792. var InitialState = [];
  15793. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  15794. var fnArray = context.fnArray;
  15795. var iFirstSave = context.iCurr - 3;
  15796. var pos = (i - iFirstSave) % 4;
  15797. switch (pos) {
  15798. case 0:
  15799. return fnArray[i] === _util.OPS.save;
  15800. case 1:
  15801. return fnArray[i] === _util.OPS.transform;
  15802. case 2:
  15803. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  15804. case 3:
  15805. return fnArray[i] === _util.OPS.restore;
  15806. }
  15807. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  15808. }, function foundInlineImageGroup(context, i) {
  15809. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  15810. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  15811. var MAX_WIDTH = 1000;
  15812. var IMAGE_PADDING = 1;
  15813. var fnArray = context.fnArray,
  15814. argsArray = context.argsArray;
  15815. var curr = context.iCurr;
  15816. var iFirstSave = curr - 3;
  15817. var iFirstTransform = curr - 2;
  15818. var iFirstPIIXO = curr - 1;
  15819. var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  15820. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  15821. return i - (i - iFirstSave) % 4;
  15822. }
  15823. var maxX = 0;
  15824. var map = [],
  15825. maxLineHeight = 0;
  15826. var currentX = IMAGE_PADDING,
  15827. currentY = IMAGE_PADDING;
  15828. var q;
  15829. for (q = 0; q < count; q++) {
  15830. var transform = argsArray[iFirstTransform + (q << 2)];
  15831. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  15832. if (currentX + img.width > MAX_WIDTH) {
  15833. maxX = Math.max(maxX, currentX);
  15834. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  15835. currentX = 0;
  15836. maxLineHeight = 0;
  15837. }
  15838. map.push({
  15839. transform,
  15840. x: currentX,
  15841. y: currentY,
  15842. w: img.width,
  15843. h: img.height
  15844. });
  15845. currentX += img.width + 2 * IMAGE_PADDING;
  15846. maxLineHeight = Math.max(maxLineHeight, img.height);
  15847. }
  15848. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  15849. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  15850. var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  15851. var imgRowSize = imgWidth << 2;
  15852. for (q = 0; q < count; q++) {
  15853. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  15854. var rowSize = map[q].w << 2;
  15855. var dataOffset = 0;
  15856. var offset = map[q].x + map[q].y * imgWidth << 2;
  15857. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  15858. for (var k = 0, kk = map[q].h; k < kk; k++) {
  15859. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  15860. dataOffset += rowSize;
  15861. offset += imgRowSize;
  15862. }
  15863. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  15864. while (offset >= 0) {
  15865. data[offset - 4] = data[offset];
  15866. data[offset - 3] = data[offset + 1];
  15867. data[offset - 2] = data[offset + 2];
  15868. data[offset - 1] = data[offset + 3];
  15869. data[offset + rowSize] = data[offset + rowSize - 4];
  15870. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  15871. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  15872. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  15873. offset -= imgRowSize;
  15874. }
  15875. }
  15876. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  15877. argsArray.splice(iFirstSave, count * 4, [{
  15878. width: imgWidth,
  15879. height: imgHeight,
  15880. kind: _util.ImageKind.RGBA_32BPP,
  15881. data: imgData
  15882. }, map]);
  15883. return iFirstSave + 1;
  15884. });
  15885. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  15886. var fnArray = context.fnArray;
  15887. var iFirstSave = context.iCurr - 3;
  15888. var pos = (i - iFirstSave) % 4;
  15889. switch (pos) {
  15890. case 0:
  15891. return fnArray[i] === _util.OPS.save;
  15892. case 1:
  15893. return fnArray[i] === _util.OPS.transform;
  15894. case 2:
  15895. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  15896. case 3:
  15897. return fnArray[i] === _util.OPS.restore;
  15898. }
  15899. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  15900. }, function foundImageMaskGroup(context, i) {
  15901. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  15902. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  15903. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  15904. var fnArray = context.fnArray,
  15905. argsArray = context.argsArray;
  15906. var curr = context.iCurr;
  15907. var iFirstSave = curr - 3;
  15908. var iFirstTransform = curr - 2;
  15909. var iFirstPIMXO = curr - 1;
  15910. var count = Math.floor((i - iFirstSave) / 4);
  15911. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  15912. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  15913. return i - (i - iFirstSave) % 4;
  15914. }
  15915. var q;
  15916. var isSameImage = false;
  15917. var iTransform, transformArgs;
  15918. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  15919. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  15920. isSameImage = true;
  15921. var firstTransformArg0 = argsArray[iFirstTransform][0];
  15922. var firstTransformArg3 = argsArray[iFirstTransform][3];
  15923. iTransform = iFirstTransform + 4;
  15924. var iPIMXO = iFirstPIMXO + 4;
  15925. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  15926. transformArgs = argsArray[iTransform];
  15927. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  15928. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  15929. isSameImage = false;
  15930. } else {
  15931. count = q;
  15932. }
  15933. break;
  15934. }
  15935. }
  15936. }
  15937. if (isSameImage) {
  15938. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  15939. var positions = new Float32Array(count * 2);
  15940. iTransform = iFirstTransform;
  15941. for (q = 0; q < count; q++, iTransform += 4) {
  15942. transformArgs = argsArray[iTransform];
  15943. positions[q << 1] = transformArgs[4];
  15944. positions[(q << 1) + 1] = transformArgs[5];
  15945. }
  15946. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  15947. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]);
  15948. } else {
  15949. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  15950. var images = [];
  15951. for (q = 0; q < count; q++) {
  15952. transformArgs = argsArray[iFirstTransform + (q << 2)];
  15953. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  15954. images.push({
  15955. data: maskParams.data,
  15956. width: maskParams.width,
  15957. height: maskParams.height,
  15958. transform: transformArgs
  15959. });
  15960. }
  15961. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  15962. argsArray.splice(iFirstSave, count * 4, [images]);
  15963. }
  15964. return iFirstSave + 1;
  15965. });
  15966. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  15967. var argsArray = context.argsArray;
  15968. var iFirstTransform = context.iCurr - 2;
  15969. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  15970. }, function iterateImageGroup(context, i) {
  15971. var fnArray = context.fnArray,
  15972. argsArray = context.argsArray;
  15973. var iFirstSave = context.iCurr - 3;
  15974. var pos = (i - iFirstSave) % 4;
  15975. switch (pos) {
  15976. case 0:
  15977. return fnArray[i] === _util.OPS.save;
  15978. case 1:
  15979. if (fnArray[i] !== _util.OPS.transform) {
  15980. return false;
  15981. }
  15982. var iFirstTransform = context.iCurr - 2;
  15983. var firstTransformArg0 = argsArray[iFirstTransform][0];
  15984. var firstTransformArg3 = argsArray[iFirstTransform][3];
  15985. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  15986. return false;
  15987. }
  15988. return true;
  15989. case 2:
  15990. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  15991. return false;
  15992. }
  15993. var iFirstPIXO = context.iCurr - 1;
  15994. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  15995. if (argsArray[i][0] !== firstPIXOArg0) {
  15996. return false;
  15997. }
  15998. return true;
  15999. case 3:
  16000. return fnArray[i] === _util.OPS.restore;
  16001. }
  16002. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  16003. }, function (context, i) {
  16004. var MIN_IMAGES_IN_BLOCK = 3;
  16005. var MAX_IMAGES_IN_BLOCK = 1000;
  16006. var fnArray = context.fnArray,
  16007. argsArray = context.argsArray;
  16008. var curr = context.iCurr;
  16009. var iFirstSave = curr - 3;
  16010. var iFirstTransform = curr - 2;
  16011. var iFirstPIXO = curr - 1;
  16012. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  16013. var firstTransformArg0 = argsArray[iFirstTransform][0];
  16014. var firstTransformArg3 = argsArray[iFirstTransform][3];
  16015. var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  16016. if (count < MIN_IMAGES_IN_BLOCK) {
  16017. return i - (i - iFirstSave) % 4;
  16018. }
  16019. var positions = new Float32Array(count * 2);
  16020. var iTransform = iFirstTransform;
  16021. for (var q = 0; q < count; q++, iTransform += 4) {
  16022. var transformArgs = argsArray[iTransform];
  16023. positions[q << 1] = transformArgs[4];
  16024. positions[(q << 1) + 1] = transformArgs[5];
  16025. }
  16026. var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  16027. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  16028. argsArray.splice(iFirstSave, count * 4, args);
  16029. return iFirstSave + 1;
  16030. });
  16031. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  16032. var fnArray = context.fnArray,
  16033. argsArray = context.argsArray;
  16034. var iFirstSave = context.iCurr - 4;
  16035. var pos = (i - iFirstSave) % 5;
  16036. switch (pos) {
  16037. case 0:
  16038. return fnArray[i] === _util.OPS.beginText;
  16039. case 1:
  16040. return fnArray[i] === _util.OPS.setFont;
  16041. case 2:
  16042. return fnArray[i] === _util.OPS.setTextMatrix;
  16043. case 3:
  16044. if (fnArray[i] !== _util.OPS.showText) {
  16045. return false;
  16046. }
  16047. var iFirstSetFont = context.iCurr - 3;
  16048. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  16049. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  16050. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  16051. return false;
  16052. }
  16053. return true;
  16054. case 4:
  16055. return fnArray[i] === _util.OPS.endText;
  16056. }
  16057. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  16058. }, function (context, i) {
  16059. var MIN_CHARS_IN_BLOCK = 3;
  16060. var MAX_CHARS_IN_BLOCK = 1000;
  16061. var fnArray = context.fnArray,
  16062. argsArray = context.argsArray;
  16063. var curr = context.iCurr;
  16064. var iFirstBeginText = curr - 4;
  16065. var iFirstSetFont = curr - 3;
  16066. var iFirstSetTextMatrix = curr - 2;
  16067. var iFirstShowText = curr - 1;
  16068. var iFirstEndText = curr;
  16069. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  16070. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  16071. var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  16072. if (count < MIN_CHARS_IN_BLOCK) {
  16073. return i - (i - iFirstBeginText) % 5;
  16074. }
  16075. var iFirst = iFirstBeginText;
  16076. 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) {
  16077. count++;
  16078. iFirst -= 5;
  16079. }
  16080. var iEndText = iFirst + 4;
  16081. for (var q = 1; q < count; q++) {
  16082. fnArray.splice(iEndText, 3);
  16083. argsArray.splice(iEndText, 3);
  16084. iEndText += 2;
  16085. }
  16086. return iEndText + 1;
  16087. });
  16088. function QueueOptimizer(queue) {
  16089. this.queue = queue;
  16090. this.state = null;
  16091. this.context = {
  16092. iCurr: 0,
  16093. fnArray: queue.fnArray,
  16094. argsArray: queue.argsArray
  16095. };
  16096. this.match = null;
  16097. this.lastProcessed = 0;
  16098. }
  16099. QueueOptimizer.prototype = {
  16100. _optimize() {
  16101. const fnArray = this.queue.fnArray;
  16102. let i = this.lastProcessed,
  16103. ii = fnArray.length;
  16104. let state = this.state;
  16105. let match = this.match;
  16106. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  16107. this.lastProcessed = ii;
  16108. return;
  16109. }
  16110. const context = this.context;
  16111. while (i < ii) {
  16112. if (match) {
  16113. const iterate = (0, match.iterateFn)(context, i);
  16114. if (iterate) {
  16115. i++;
  16116. continue;
  16117. }
  16118. i = (0, match.processFn)(context, i + 1);
  16119. ii = fnArray.length;
  16120. match = null;
  16121. state = null;
  16122. if (i >= ii) {
  16123. break;
  16124. }
  16125. }
  16126. state = (state || InitialState)[fnArray[i]];
  16127. if (!state || Array.isArray(state)) {
  16128. i++;
  16129. continue;
  16130. }
  16131. context.iCurr = i;
  16132. i++;
  16133. if (state.checkFn && !(0, state.checkFn)(context)) {
  16134. state = null;
  16135. continue;
  16136. }
  16137. match = state;
  16138. state = null;
  16139. }
  16140. this.state = state;
  16141. this.match = match;
  16142. this.lastProcessed = i;
  16143. },
  16144. push(fn, args) {
  16145. this.queue.fnArray.push(fn);
  16146. this.queue.argsArray.push(args);
  16147. this._optimize();
  16148. },
  16149. flush() {
  16150. while (this.match) {
  16151. const length = this.queue.fnArray.length;
  16152. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  16153. this.match = null;
  16154. this.state = null;
  16155. this._optimize();
  16156. }
  16157. },
  16158. reset() {
  16159. this.state = null;
  16160. this.match = null;
  16161. this.lastProcessed = 0;
  16162. }
  16163. };
  16164. return QueueOptimizer;
  16165. }();
  16166. var NullOptimizer = function NullOptimizerClosure() {
  16167. function NullOptimizer(queue) {
  16168. this.queue = queue;
  16169. }
  16170. NullOptimizer.prototype = {
  16171. push(fn, args) {
  16172. this.queue.fnArray.push(fn);
  16173. this.queue.argsArray.push(args);
  16174. },
  16175. flush() {},
  16176. reset() {}
  16177. };
  16178. return NullOptimizer;
  16179. }();
  16180. var OperatorList = function OperatorListClosure() {
  16181. var CHUNK_SIZE = 1000;
  16182. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  16183. function OperatorList(intent, streamSink, pageIndex) {
  16184. this._streamSink = streamSink;
  16185. this.fnArray = [];
  16186. this.argsArray = [];
  16187. if (streamSink && intent !== "oplist") {
  16188. this.optimizer = new QueueOptimizer(this);
  16189. } else {
  16190. this.optimizer = new NullOptimizer(this);
  16191. }
  16192. this.dependencies = Object.create(null);
  16193. this._totalLength = 0;
  16194. this.pageIndex = pageIndex;
  16195. this.intent = intent;
  16196. this.weight = 0;
  16197. this._resolved = streamSink ? null : Promise.resolve();
  16198. }
  16199. OperatorList.prototype = {
  16200. get length() {
  16201. return this.argsArray.length;
  16202. },
  16203. get ready() {
  16204. return this._resolved || this._streamSink.ready;
  16205. },
  16206. get totalLength() {
  16207. return this._totalLength + this.length;
  16208. },
  16209. addOp(fn, args) {
  16210. this.optimizer.push(fn, args);
  16211. this.weight++;
  16212. if (this._streamSink) {
  16213. if (this.weight >= CHUNK_SIZE) {
  16214. this.flush();
  16215. } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  16216. this.flush();
  16217. }
  16218. }
  16219. },
  16220. addDependency(dependency) {
  16221. if (dependency in this.dependencies) {
  16222. return;
  16223. }
  16224. this.dependencies[dependency] = true;
  16225. this.addOp(_util.OPS.dependency, [dependency]);
  16226. },
  16227. addDependencies(dependencies) {
  16228. for (var key in dependencies) {
  16229. this.addDependency(key);
  16230. }
  16231. },
  16232. addOpList(opList) {
  16233. if (!(opList instanceof OperatorList)) {
  16234. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  16235. return;
  16236. }
  16237. Object.assign(this.dependencies, opList.dependencies);
  16238. for (var i = 0, ii = opList.length; i < ii; i++) {
  16239. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  16240. }
  16241. },
  16242. getIR() {
  16243. return {
  16244. fnArray: this.fnArray,
  16245. argsArray: this.argsArray,
  16246. length: this.length
  16247. };
  16248. },
  16249. get _transfers() {
  16250. const transfers = [];
  16251. const {
  16252. fnArray,
  16253. argsArray,
  16254. length
  16255. } = this;
  16256. for (let i = 0; i < length; i++) {
  16257. switch (fnArray[i]) {
  16258. case _util.OPS.paintInlineImageXObject:
  16259. case _util.OPS.paintInlineImageXObjectGroup:
  16260. case _util.OPS.paintImageMaskXObject:
  16261. const arg = argsArray[i][0];
  16262. ;
  16263. if (!arg.cached) {
  16264. transfers.push(arg.data.buffer);
  16265. }
  16266. break;
  16267. }
  16268. }
  16269. return transfers;
  16270. },
  16271. flush(lastChunk = false) {
  16272. this.optimizer.flush();
  16273. const length = this.length;
  16274. this._totalLength += length;
  16275. this._streamSink.enqueue({
  16276. fnArray: this.fnArray,
  16277. argsArray: this.argsArray,
  16278. lastChunk,
  16279. length
  16280. }, 1, this._transfers);
  16281. this.dependencies = Object.create(null);
  16282. this.fnArray.length = 0;
  16283. this.argsArray.length = 0;
  16284. this.weight = 0;
  16285. this.optimizer.reset();
  16286. }
  16287. };
  16288. return OperatorList;
  16289. }();
  16290. exports.OperatorList = OperatorList;
  16291. /***/ }),
  16292. /* 27 */
  16293. /***/ (function(module, exports, __w_pdfjs_require__) {
  16294. "use strict";
  16295. Object.defineProperty(exports, "__esModule", {
  16296. value: true
  16297. });
  16298. exports.PartialEvaluator = void 0;
  16299. var _util = __w_pdfjs_require__(2);
  16300. var _cmap = __w_pdfjs_require__(28);
  16301. var _primitives = __w_pdfjs_require__(5);
  16302. var _fonts = __w_pdfjs_require__(29);
  16303. var _encodings = __w_pdfjs_require__(32);
  16304. var _core_utils = __w_pdfjs_require__(8);
  16305. var _unicode = __w_pdfjs_require__(35);
  16306. var _standard_fonts = __w_pdfjs_require__(34);
  16307. var _pattern = __w_pdfjs_require__(38);
  16308. var _parser = __w_pdfjs_require__(11);
  16309. var _bidi = __w_pdfjs_require__(39);
  16310. var _colorspace = __w_pdfjs_require__(23);
  16311. var _stream = __w_pdfjs_require__(12);
  16312. var _glyphlist = __w_pdfjs_require__(33);
  16313. var _metrics = __w_pdfjs_require__(40);
  16314. var _function = __w_pdfjs_require__(41);
  16315. var _image_utils = __w_pdfjs_require__(24);
  16316. var _murmurhash = __w_pdfjs_require__(43);
  16317. var _operator_list = __w_pdfjs_require__(26);
  16318. var _image = __w_pdfjs_require__(44);
  16319. var PartialEvaluator = function PartialEvaluatorClosure() {
  16320. const DefaultPartialEvaluatorOptions = {
  16321. maxImageSize: -1,
  16322. disableFontFace: false,
  16323. ignoreErrors: false,
  16324. isEvalSupported: true,
  16325. fontExtraProperties: false
  16326. };
  16327. function PartialEvaluator({
  16328. xref,
  16329. handler,
  16330. pageIndex,
  16331. idFactory,
  16332. fontCache,
  16333. builtInCMapCache,
  16334. globalImageCache,
  16335. options = null,
  16336. pdfFunctionFactory
  16337. }) {
  16338. this.xref = xref;
  16339. this.handler = handler;
  16340. this.pageIndex = pageIndex;
  16341. this.idFactory = idFactory;
  16342. this.fontCache = fontCache;
  16343. this.builtInCMapCache = builtInCMapCache;
  16344. this.globalImageCache = globalImageCache;
  16345. this.options = options || DefaultPartialEvaluatorOptions;
  16346. this.pdfFunctionFactory = pdfFunctionFactory;
  16347. this.parsingType3Font = false;
  16348. this.fetchBuiltInCMap = async name => {
  16349. if (this.builtInCMapCache.has(name)) {
  16350. return this.builtInCMapCache.get(name);
  16351. }
  16352. const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", {
  16353. name
  16354. });
  16355. const reader = readableStream.getReader();
  16356. const data = await new Promise(function (resolve, reject) {
  16357. function pump() {
  16358. reader.read().then(function ({
  16359. value,
  16360. done
  16361. }) {
  16362. if (done) {
  16363. return;
  16364. }
  16365. resolve(value);
  16366. pump();
  16367. }, reject);
  16368. }
  16369. pump();
  16370. });
  16371. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  16372. this.builtInCMapCache.set(name, data);
  16373. }
  16374. return data;
  16375. };
  16376. }
  16377. var TIME_SLOT_DURATION_MS = 20;
  16378. var CHECK_TIME_EVERY = 100;
  16379. function TimeSlotManager() {
  16380. this.reset();
  16381. }
  16382. TimeSlotManager.prototype = {
  16383. check: function TimeSlotManager_check() {
  16384. if (++this.checked < CHECK_TIME_EVERY) {
  16385. return false;
  16386. }
  16387. this.checked = 0;
  16388. return this.endTime <= Date.now();
  16389. },
  16390. reset: function TimeSlotManager_reset() {
  16391. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  16392. this.checked = 0;
  16393. }
  16394. };
  16395. function normalizeBlendMode(value, parsingArray = false) {
  16396. if (Array.isArray(value)) {
  16397. for (let i = 0, ii = value.length; i < ii; i++) {
  16398. const maybeBM = normalizeBlendMode(value[i], true);
  16399. if (maybeBM) {
  16400. return maybeBM;
  16401. }
  16402. }
  16403. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  16404. return "source-over";
  16405. }
  16406. if (!(0, _primitives.isName)(value)) {
  16407. if (parsingArray) {
  16408. return null;
  16409. }
  16410. return "source-over";
  16411. }
  16412. switch (value.name) {
  16413. case "Normal":
  16414. case "Compatible":
  16415. return "source-over";
  16416. case "Multiply":
  16417. return "multiply";
  16418. case "Screen":
  16419. return "screen";
  16420. case "Overlay":
  16421. return "overlay";
  16422. case "Darken":
  16423. return "darken";
  16424. case "Lighten":
  16425. return "lighten";
  16426. case "ColorDodge":
  16427. return "color-dodge";
  16428. case "ColorBurn":
  16429. return "color-burn";
  16430. case "HardLight":
  16431. return "hard-light";
  16432. case "SoftLight":
  16433. return "soft-light";
  16434. case "Difference":
  16435. return "difference";
  16436. case "Exclusion":
  16437. return "exclusion";
  16438. case "Hue":
  16439. return "hue";
  16440. case "Saturation":
  16441. return "saturation";
  16442. case "Color":
  16443. return "color";
  16444. case "Luminosity":
  16445. return "luminosity";
  16446. }
  16447. if (parsingArray) {
  16448. return null;
  16449. }
  16450. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  16451. return "source-over";
  16452. }
  16453. var deferred = Promise.resolve();
  16454. var TILING_PATTERN = 1,
  16455. SHADING_PATTERN = 2;
  16456. PartialEvaluator.prototype = {
  16457. clone(newOptions = DefaultPartialEvaluatorOptions) {
  16458. var newEvaluator = Object.create(this);
  16459. newEvaluator.options = newOptions;
  16460. return newEvaluator;
  16461. },
  16462. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  16463. if (!(resources instanceof _primitives.Dict)) {
  16464. return false;
  16465. }
  16466. var processed = Object.create(null);
  16467. if (resources.objId) {
  16468. processed[resources.objId] = true;
  16469. }
  16470. var nodes = [resources],
  16471. xref = this.xref;
  16472. while (nodes.length) {
  16473. var node = nodes.shift();
  16474. var graphicStates = node.get("ExtGState");
  16475. if (graphicStates instanceof _primitives.Dict) {
  16476. var graphicStatesKeys = graphicStates.getKeys();
  16477. for (let i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  16478. const key = graphicStatesKeys[i];
  16479. let graphicState = graphicStates.getRaw(key);
  16480. if (graphicState instanceof _primitives.Ref) {
  16481. if (processed[graphicState.toString()]) {
  16482. continue;
  16483. }
  16484. try {
  16485. graphicState = xref.fetch(graphicState);
  16486. } catch (ex) {
  16487. if (ex instanceof _core_utils.MissingDataException) {
  16488. throw ex;
  16489. }
  16490. if (this.options.ignoreErrors) {
  16491. if (graphicState instanceof _primitives.Ref) {
  16492. processed[graphicState.toString()] = true;
  16493. }
  16494. this.handler.send("UnsupportedFeature", {
  16495. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  16496. });
  16497. (0, _util.warn)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  16498. continue;
  16499. }
  16500. throw ex;
  16501. }
  16502. }
  16503. if (!(graphicState instanceof _primitives.Dict)) {
  16504. continue;
  16505. }
  16506. if (graphicState.objId) {
  16507. processed[graphicState.objId] = true;
  16508. }
  16509. const bm = graphicState.get("BM");
  16510. if (bm instanceof _primitives.Name) {
  16511. if (bm.name !== "Normal") {
  16512. return true;
  16513. }
  16514. continue;
  16515. }
  16516. if (bm !== undefined && Array.isArray(bm)) {
  16517. for (let j = 0, jj = bm.length; j < jj; j++) {
  16518. if (bm[j] instanceof _primitives.Name && bm[j].name !== "Normal") {
  16519. return true;
  16520. }
  16521. }
  16522. }
  16523. }
  16524. }
  16525. var xObjects = node.get("XObject");
  16526. if (!(xObjects instanceof _primitives.Dict)) {
  16527. continue;
  16528. }
  16529. var xObjectsKeys = xObjects.getKeys();
  16530. for (let i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  16531. const key = xObjectsKeys[i];
  16532. var xObject = xObjects.getRaw(key);
  16533. if (xObject instanceof _primitives.Ref) {
  16534. if (processed[xObject.toString()]) {
  16535. continue;
  16536. }
  16537. try {
  16538. xObject = xref.fetch(xObject);
  16539. } catch (ex) {
  16540. if (ex instanceof _core_utils.MissingDataException) {
  16541. throw ex;
  16542. }
  16543. if (this.options.ignoreErrors) {
  16544. if (xObject instanceof _primitives.Ref) {
  16545. processed[xObject.toString()] = true;
  16546. }
  16547. this.handler.send("UnsupportedFeature", {
  16548. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  16549. });
  16550. (0, _util.warn)(`hasBlendModes - ignoring XObject: "${ex}".`);
  16551. continue;
  16552. }
  16553. throw ex;
  16554. }
  16555. }
  16556. if (!(0, _primitives.isStream)(xObject)) {
  16557. continue;
  16558. }
  16559. if (xObject.dict.objId) {
  16560. if (processed[xObject.dict.objId]) {
  16561. continue;
  16562. }
  16563. processed[xObject.dict.objId] = true;
  16564. }
  16565. var xResources = xObject.dict.get("Resources");
  16566. if (xResources instanceof _primitives.Dict && (!xResources.objId || !processed[xResources.objId])) {
  16567. nodes.push(xResources);
  16568. if (xResources.objId) {
  16569. processed[xResources.objId] = true;
  16570. }
  16571. }
  16572. }
  16573. }
  16574. return false;
  16575. },
  16576. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  16577. var dict = xobj.dict;
  16578. var matrix = dict.getArray("Matrix");
  16579. var bbox = dict.getArray("BBox");
  16580. if (Array.isArray(bbox) && bbox.length === 4) {
  16581. bbox = _util.Util.normalizeRect(bbox);
  16582. } else {
  16583. bbox = null;
  16584. }
  16585. var group = dict.get("Group");
  16586. if (group) {
  16587. var groupOptions = {
  16588. matrix,
  16589. bbox,
  16590. smask,
  16591. isolated: false,
  16592. knockout: false
  16593. };
  16594. var groupSubtype = group.get("S");
  16595. var colorSpace = null;
  16596. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  16597. groupOptions.isolated = group.get("I") || false;
  16598. groupOptions.knockout = group.get("K") || false;
  16599. if (group.has("CS")) {
  16600. colorSpace = await this.parseColorSpace({
  16601. cs: group.get("CS"),
  16602. resources
  16603. });
  16604. }
  16605. }
  16606. if (smask && smask.backdrop) {
  16607. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  16608. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  16609. }
  16610. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  16611. }
  16612. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  16613. return this.getOperatorList({
  16614. stream: xobj,
  16615. task,
  16616. resources: dict.get("Resources") || resources,
  16617. operatorList,
  16618. initialState
  16619. }).then(function () {
  16620. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  16621. if (group) {
  16622. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  16623. }
  16624. });
  16625. },
  16626. async buildPaintImageXObject({
  16627. resources,
  16628. image,
  16629. isInline = false,
  16630. operatorList,
  16631. cacheKey,
  16632. localImageCache
  16633. }) {
  16634. var dict = image.dict;
  16635. const imageRef = dict.objId;
  16636. var w = dict.get("Width", "W");
  16637. var h = dict.get("Height", "H");
  16638. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  16639. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  16640. return undefined;
  16641. }
  16642. var maxImageSize = this.options.maxImageSize;
  16643. if (maxImageSize !== -1 && w * h > maxImageSize) {
  16644. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  16645. return undefined;
  16646. }
  16647. var imageMask = dict.get("ImageMask", "IM") || false;
  16648. var imgData, args;
  16649. if (imageMask) {
  16650. var width = dict.get("Width", "W");
  16651. var height = dict.get("Height", "H");
  16652. var bitStrideLength = width + 7 >> 3;
  16653. var imgArray = image.getBytes(bitStrideLength * height, true);
  16654. var decode = dict.getArray("Decode", "D");
  16655. imgData = _image.PDFImage.createMask({
  16656. imgArray,
  16657. width,
  16658. height,
  16659. imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
  16660. inverseDecode: !!decode && decode[0] > 0
  16661. });
  16662. imgData.cached = !!cacheKey;
  16663. args = [imgData];
  16664. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  16665. if (cacheKey) {
  16666. localImageCache.set(cacheKey, imageRef, {
  16667. fn: _util.OPS.paintImageMaskXObject,
  16668. args
  16669. });
  16670. }
  16671. return undefined;
  16672. }
  16673. var softMask = dict.get("SMask", "SM") || false;
  16674. var mask = dict.get("Mask") || false;
  16675. var SMALL_IMAGE_DIMENSIONS = 200;
  16676. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  16677. const imageObj = new _image.PDFImage({
  16678. xref: this.xref,
  16679. res: resources,
  16680. image,
  16681. isInline,
  16682. pdfFunctionFactory: this.pdfFunctionFactory
  16683. });
  16684. imgData = imageObj.createImageData(true);
  16685. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  16686. return undefined;
  16687. }
  16688. let objId = `img_${this.idFactory.createObjId()}`,
  16689. cacheGlobally = false;
  16690. if (this.parsingType3Font) {
  16691. objId = `${this.idFactory.getDocId()}_type3res_${objId}`;
  16692. } else if (imageRef) {
  16693. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  16694. if (cacheGlobally) {
  16695. objId = `${this.idFactory.getDocId()}_${objId}`;
  16696. }
  16697. }
  16698. operatorList.addDependency(objId);
  16699. args = [objId, w, h];
  16700. const imgPromise = _image.PDFImage.buildImage({
  16701. xref: this.xref,
  16702. res: resources,
  16703. image,
  16704. isInline,
  16705. pdfFunctionFactory: this.pdfFunctionFactory
  16706. }).then(imageObj => {
  16707. imgData = imageObj.createImageData(false);
  16708. if (this.parsingType3Font) {
  16709. return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", imgData], [imgData.data.buffer]);
  16710. } else if (cacheGlobally) {
  16711. this.handler.send("commonobj", [objId, "Image", imgData], [imgData.data.buffer]);
  16712. return undefined;
  16713. }
  16714. this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], [imgData.data.buffer]);
  16715. return undefined;
  16716. }).catch(reason => {
  16717. (0, _util.warn)("Unable to decode image: " + reason);
  16718. if (this.parsingType3Font) {
  16719. return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", null]);
  16720. } else if (cacheGlobally) {
  16721. this.handler.send("commonobj", [objId, "Image", null]);
  16722. return undefined;
  16723. }
  16724. this.handler.send("obj", [objId, this.pageIndex, "Image", null]);
  16725. return undefined;
  16726. });
  16727. if (this.parsingType3Font) {
  16728. await imgPromise;
  16729. }
  16730. operatorList.addOp(_util.OPS.paintImageXObject, args);
  16731. if (cacheKey) {
  16732. localImageCache.set(cacheKey, imageRef, {
  16733. fn: _util.OPS.paintImageXObject,
  16734. args
  16735. });
  16736. if (imageRef) {
  16737. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  16738. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  16739. if (cacheGlobally) {
  16740. this.globalImageCache.setData(imageRef, {
  16741. objId,
  16742. fn: _util.OPS.paintImageXObject,
  16743. args
  16744. });
  16745. }
  16746. }
  16747. }
  16748. return undefined;
  16749. },
  16750. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  16751. var smaskContent = smask.get("G");
  16752. var smaskOptions = {
  16753. subtype: smask.get("S").name,
  16754. backdrop: smask.get("BC")
  16755. };
  16756. var transferObj = smask.get("TR");
  16757. if ((0, _function.isPDFFunction)(transferObj)) {
  16758. const transferFn = this.pdfFunctionFactory.create(transferObj);
  16759. var transferMap = new Uint8Array(256);
  16760. var tmp = new Float32Array(1);
  16761. for (var i = 0; i < 256; i++) {
  16762. tmp[0] = i / 255;
  16763. transferFn(tmp, 0, tmp, 0);
  16764. transferMap[i] = tmp[0] * 255 | 0;
  16765. }
  16766. smaskOptions.transferMap = transferMap;
  16767. }
  16768. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  16769. },
  16770. handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  16771. const tilingOpList = new _operator_list.OperatorList();
  16772. const resourcesArray = [patternDict.get("Resources"), resources];
  16773. const patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
  16774. return this.getOperatorList({
  16775. stream: pattern,
  16776. task,
  16777. resources: patternResources,
  16778. operatorList: tilingOpList
  16779. }).then(function () {
  16780. return (0, _pattern.getTilingPatternIR)({
  16781. fnArray: tilingOpList.fnArray,
  16782. argsArray: tilingOpList.argsArray
  16783. }, patternDict, args);
  16784. }).then(function (tilingPatternIR) {
  16785. operatorList.addDependencies(tilingOpList.dependencies);
  16786. operatorList.addOp(fn, tilingPatternIR);
  16787. }, reason => {
  16788. if (reason instanceof _util.AbortException) {
  16789. return;
  16790. }
  16791. if (this.options.ignoreErrors) {
  16792. this.handler.send("UnsupportedFeature", {
  16793. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  16794. });
  16795. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  16796. return;
  16797. }
  16798. throw reason;
  16799. });
  16800. },
  16801. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  16802. var fontName;
  16803. if (fontArgs) {
  16804. fontArgs = fontArgs.slice();
  16805. fontName = fontArgs[0].name;
  16806. }
  16807. return this.loadFont(fontName, fontRef, resources).then(translated => {
  16808. if (!translated.font.isType3Font) {
  16809. return translated;
  16810. }
  16811. return translated.loadType3Data(this, resources, operatorList, task).then(function () {
  16812. return translated;
  16813. }).catch(reason => {
  16814. this.handler.send("UnsupportedFeature", {
  16815. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  16816. });
  16817. return new TranslatedFont({
  16818. loadedName: "g_font_error",
  16819. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  16820. dict: translated.font,
  16821. extraProperties: this.options.fontExtraProperties
  16822. });
  16823. });
  16824. }).then(translated => {
  16825. state.font = translated.font;
  16826. translated.send(this.handler);
  16827. return translated.loadedName;
  16828. });
  16829. },
  16830. handleText(chars, state) {
  16831. const font = state.font;
  16832. const glyphs = font.charsToGlyphs(chars);
  16833. if (font.data) {
  16834. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  16835. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  16836. PartialEvaluator.buildFontPaths(font, glyphs, this.handler);
  16837. }
  16838. }
  16839. return glyphs;
  16840. },
  16841. ensureStateFont(state) {
  16842. if (state.font) {
  16843. return;
  16844. }
  16845. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  16846. if (this.options.ignoreErrors) {
  16847. this.handler.send("UnsupportedFeature", {
  16848. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  16849. });
  16850. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  16851. return;
  16852. }
  16853. throw reason;
  16854. },
  16855. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
  16856. var gStateObj = [];
  16857. var gStateKeys = gState.getKeys();
  16858. var promise = Promise.resolve();
  16859. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  16860. const key = gStateKeys[i];
  16861. const value = gState.get(key);
  16862. switch (key) {
  16863. case "Type":
  16864. break;
  16865. case "LW":
  16866. case "LC":
  16867. case "LJ":
  16868. case "ML":
  16869. case "D":
  16870. case "RI":
  16871. case "FL":
  16872. case "CA":
  16873. case "ca":
  16874. gStateObj.push([key, value]);
  16875. break;
  16876. case "Font":
  16877. promise = promise.then(() => {
  16878. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  16879. operatorList.addDependency(loadedName);
  16880. gStateObj.push([key, [loadedName, value[1]]]);
  16881. });
  16882. });
  16883. break;
  16884. case "BM":
  16885. gStateObj.push([key, normalizeBlendMode(value)]);
  16886. break;
  16887. case "SMask":
  16888. if ((0, _primitives.isName)(value, "None")) {
  16889. gStateObj.push([key, false]);
  16890. break;
  16891. }
  16892. if ((0, _primitives.isDict)(value)) {
  16893. promise = promise.then(() => {
  16894. return this.handleSMask(value, resources, operatorList, task, stateManager);
  16895. });
  16896. gStateObj.push([key, true]);
  16897. } else {
  16898. (0, _util.warn)("Unsupported SMask type");
  16899. }
  16900. break;
  16901. case "OP":
  16902. case "op":
  16903. case "OPM":
  16904. case "BG":
  16905. case "BG2":
  16906. case "UCR":
  16907. case "UCR2":
  16908. case "TR":
  16909. case "TR2":
  16910. case "HT":
  16911. case "SM":
  16912. case "SA":
  16913. case "AIS":
  16914. case "TK":
  16915. (0, _util.info)("graphic state operator " + key);
  16916. break;
  16917. default:
  16918. (0, _util.info)("Unknown graphic state operator " + key);
  16919. break;
  16920. }
  16921. }
  16922. return promise.then(function () {
  16923. if (gStateObj.length > 0) {
  16924. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  16925. }
  16926. });
  16927. },
  16928. loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {
  16929. const errorFont = () => {
  16930. return Promise.resolve(new TranslatedFont({
  16931. loadedName: "g_font_error",
  16932. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  16933. dict: font,
  16934. extraProperties: this.options.fontExtraProperties
  16935. }));
  16936. };
  16937. var fontRef,
  16938. xref = this.xref;
  16939. if (font) {
  16940. if (!(0, _primitives.isRef)(font)) {
  16941. throw new _util.FormatError('The "font" object should be a reference.');
  16942. }
  16943. fontRef = font;
  16944. } else {
  16945. var fontRes = resources.get("Font");
  16946. if (fontRes) {
  16947. fontRef = fontRes.getRaw(fontName);
  16948. }
  16949. }
  16950. if (!fontRef) {
  16951. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  16952. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  16953. (0, _util.warn)(`${partialMsg}.`);
  16954. return errorFont();
  16955. }
  16956. this.handler.send("UnsupportedFeature", {
  16957. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  16958. });
  16959. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  16960. fontRef = PartialEvaluator.getFallbackFontDict();
  16961. }
  16962. if (this.fontCache.has(fontRef)) {
  16963. return this.fontCache.get(fontRef);
  16964. }
  16965. font = xref.fetchIfRef(fontRef);
  16966. if (!(0, _primitives.isDict)(font)) {
  16967. return errorFont();
  16968. }
  16969. if (font.translated) {
  16970. return font.translated;
  16971. }
  16972. var fontCapability = (0, _util.createPromiseCapability)();
  16973. var preEvaluatedFont = this.preEvaluateFont(font);
  16974. const {
  16975. descriptor,
  16976. hash
  16977. } = preEvaluatedFont;
  16978. var fontRefIsRef = (0, _primitives.isRef)(fontRef),
  16979. fontID;
  16980. if (fontRefIsRef) {
  16981. fontID = fontRef.toString();
  16982. }
  16983. if (hash && (0, _primitives.isDict)(descriptor)) {
  16984. if (!descriptor.fontAliases) {
  16985. descriptor.fontAliases = Object.create(null);
  16986. }
  16987. var fontAliases = descriptor.fontAliases;
  16988. if (fontAliases[hash]) {
  16989. var aliasFontRef = fontAliases[hash].aliasRef;
  16990. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  16991. this.fontCache.putAlias(fontRef, aliasFontRef);
  16992. return this.fontCache.get(fontRef);
  16993. }
  16994. } else {
  16995. fontAliases[hash] = {
  16996. fontID: _fonts.Font.getFontID()
  16997. };
  16998. }
  16999. if (fontRefIsRef) {
  17000. fontAliases[hash].aliasRef = fontRef;
  17001. }
  17002. fontID = fontAliases[hash].fontID;
  17003. }
  17004. if (fontRefIsRef) {
  17005. this.fontCache.put(fontRef, fontCapability.promise);
  17006. } else {
  17007. if (!fontID) {
  17008. fontID = this.idFactory.createObjId();
  17009. }
  17010. this.fontCache.put(`id_${fontID}`, fontCapability.promise);
  17011. }
  17012. (0, _util.assert)(fontID, 'The "fontID" must be defined.');
  17013. font.loadedName = `${this.idFactory.getDocId()}_f${fontID}`;
  17014. font.translated = fontCapability.promise;
  17015. var translatedPromise;
  17016. try {
  17017. translatedPromise = this.translateFont(preEvaluatedFont);
  17018. } catch (e) {
  17019. translatedPromise = Promise.reject(e);
  17020. }
  17021. translatedPromise.then(translatedFont => {
  17022. if (translatedFont.fontType !== undefined) {
  17023. var xrefFontStats = xref.stats.fontTypes;
  17024. xrefFontStats[translatedFont.fontType] = true;
  17025. }
  17026. fontCapability.resolve(new TranslatedFont({
  17027. loadedName: font.loadedName,
  17028. font: translatedFont,
  17029. dict: font,
  17030. extraProperties: this.options.fontExtraProperties
  17031. }));
  17032. }).catch(reason => {
  17033. this.handler.send("UnsupportedFeature", {
  17034. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  17035. });
  17036. try {
  17037. var fontFile3 = descriptor && descriptor.get("FontFile3");
  17038. var subtype = fontFile3 && fontFile3.get("Subtype");
  17039. var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  17040. var xrefFontStats = xref.stats.fontTypes;
  17041. xrefFontStats[fontType] = true;
  17042. } catch (ex) {}
  17043. fontCapability.resolve(new TranslatedFont({
  17044. loadedName: font.loadedName,
  17045. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  17046. dict: font,
  17047. extraProperties: this.options.fontExtraProperties
  17048. }));
  17049. });
  17050. return fontCapability.promise;
  17051. },
  17052. buildPath(operatorList, fn, args, parsingText = false) {
  17053. var lastIndex = operatorList.length - 1;
  17054. if (!args) {
  17055. args = [];
  17056. }
  17057. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  17058. if (parsingText) {
  17059. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  17060. operatorList.addOp(_util.OPS.save, null);
  17061. }
  17062. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  17063. if (parsingText) {
  17064. operatorList.addOp(_util.OPS.restore, null);
  17065. }
  17066. } else {
  17067. var opArgs = operatorList.argsArray[lastIndex];
  17068. opArgs[0].push(fn);
  17069. Array.prototype.push.apply(opArgs[1], args);
  17070. }
  17071. },
  17072. parseColorSpace({
  17073. cs,
  17074. resources
  17075. }) {
  17076. return new Promise(resolve => {
  17077. resolve(_colorspace.ColorSpace.parse(cs, this.xref, resources, this.pdfFunctionFactory));
  17078. }).catch(reason => {
  17079. if (reason instanceof _util.AbortException) {
  17080. return null;
  17081. }
  17082. if (this.options.ignoreErrors) {
  17083. this.handler.send("UnsupportedFeature", {
  17084. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  17085. });
  17086. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  17087. return null;
  17088. }
  17089. throw reason;
  17090. });
  17091. },
  17092. async handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
  17093. var patternName = args[args.length - 1];
  17094. var pattern;
  17095. if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) {
  17096. var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  17097. var typeNum = dict.get("PatternType");
  17098. if (typeNum === TILING_PATTERN) {
  17099. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  17100. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  17101. } else if (typeNum === SHADING_PATTERN) {
  17102. var shading = dict.get("Shading");
  17103. var matrix = dict.getArray("Matrix");
  17104. pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory);
  17105. operatorList.addOp(fn, pattern.getIR());
  17106. return undefined;
  17107. }
  17108. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  17109. }
  17110. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  17111. },
  17112. getOperatorList({
  17113. stream,
  17114. task,
  17115. resources,
  17116. operatorList,
  17117. initialState = null
  17118. }) {
  17119. resources = resources || _primitives.Dict.empty;
  17120. initialState = initialState || new EvalState();
  17121. if (!operatorList) {
  17122. throw new Error('getOperatorList: missing "operatorList" parameter');
  17123. }
  17124. var self = this;
  17125. var xref = this.xref;
  17126. let parsingText = false;
  17127. const localImageCache = new _image_utils.LocalImageCache();
  17128. var xobjs = resources.get("XObject") || _primitives.Dict.empty;
  17129. var patterns = resources.get("Pattern") || _primitives.Dict.empty;
  17130. var stateManager = new StateManager(initialState);
  17131. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  17132. var timeSlotManager = new TimeSlotManager();
  17133. function closePendingRestoreOPS(argument) {
  17134. for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  17135. operatorList.addOp(_util.OPS.restore, []);
  17136. }
  17137. }
  17138. return new Promise(function promiseBody(resolve, reject) {
  17139. const next = function (promise) {
  17140. Promise.all([promise, operatorList.ready]).then(function () {
  17141. try {
  17142. promiseBody(resolve, reject);
  17143. } catch (ex) {
  17144. reject(ex);
  17145. }
  17146. }, reject);
  17147. };
  17148. task.ensureNotTerminated();
  17149. timeSlotManager.reset();
  17150. var stop,
  17151. operation = {},
  17152. i,
  17153. ii,
  17154. cs;
  17155. while (!(stop = timeSlotManager.check())) {
  17156. operation.args = null;
  17157. if (!preprocessor.read(operation)) {
  17158. break;
  17159. }
  17160. var args = operation.args;
  17161. var fn = operation.fn;
  17162. switch (fn | 0) {
  17163. case _util.OPS.paintXObject:
  17164. var name = args[0].name;
  17165. if (name) {
  17166. const localImage = localImageCache.getByName(name);
  17167. if (localImage) {
  17168. operatorList.addOp(localImage.fn, localImage.args);
  17169. args = null;
  17170. continue;
  17171. }
  17172. }
  17173. next(new Promise(function (resolveXObject, rejectXObject) {
  17174. if (!name) {
  17175. throw new _util.FormatError("XObject must be referred to by name.");
  17176. }
  17177. let xobj = xobjs.getRaw(name);
  17178. if (xobj instanceof _primitives.Ref) {
  17179. const localImage = localImageCache.getByRef(xobj);
  17180. if (localImage) {
  17181. operatorList.addOp(localImage.fn, localImage.args);
  17182. resolveXObject();
  17183. return;
  17184. }
  17185. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  17186. if (globalImage) {
  17187. operatorList.addDependency(globalImage.objId);
  17188. operatorList.addOp(globalImage.fn, globalImage.args);
  17189. resolveXObject();
  17190. return;
  17191. }
  17192. xobj = xref.fetch(xobj);
  17193. }
  17194. if (!xobj) {
  17195. operatorList.addOp(fn, args);
  17196. resolveXObject();
  17197. return;
  17198. }
  17199. if (!(0, _primitives.isStream)(xobj)) {
  17200. throw new _util.FormatError("XObject should be a stream");
  17201. }
  17202. const type = xobj.dict.get("Subtype");
  17203. if (!(0, _primitives.isName)(type)) {
  17204. throw new _util.FormatError("XObject should have a Name subtype");
  17205. }
  17206. if (type.name === "Form") {
  17207. stateManager.save();
  17208. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  17209. stateManager.restore();
  17210. resolveXObject();
  17211. }, rejectXObject);
  17212. return;
  17213. } else if (type.name === "Image") {
  17214. self.buildPaintImageXObject({
  17215. resources,
  17216. image: xobj,
  17217. operatorList,
  17218. cacheKey: name,
  17219. localImageCache
  17220. }).then(resolveXObject, rejectXObject);
  17221. return;
  17222. } else if (type.name === "PS") {
  17223. (0, _util.info)("Ignored XObject subtype PS");
  17224. } else {
  17225. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  17226. }
  17227. resolveXObject();
  17228. }).catch(function (reason) {
  17229. if (reason instanceof _util.AbortException) {
  17230. return;
  17231. }
  17232. if (self.options.ignoreErrors) {
  17233. self.handler.send("UnsupportedFeature", {
  17234. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  17235. });
  17236. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  17237. return;
  17238. }
  17239. throw reason;
  17240. }));
  17241. return;
  17242. case _util.OPS.setFont:
  17243. var fontSize = args[1];
  17244. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  17245. operatorList.addDependency(loadedName);
  17246. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  17247. }));
  17248. return;
  17249. case _util.OPS.beginText:
  17250. parsingText = true;
  17251. break;
  17252. case _util.OPS.endText:
  17253. parsingText = false;
  17254. break;
  17255. case _util.OPS.endInlineImage:
  17256. var cacheKey = args[0].cacheKey;
  17257. if (cacheKey) {
  17258. const localImage = localImageCache.getByName(cacheKey);
  17259. if (localImage) {
  17260. operatorList.addOp(localImage.fn, localImage.args);
  17261. args = null;
  17262. continue;
  17263. }
  17264. }
  17265. next(self.buildPaintImageXObject({
  17266. resources,
  17267. image: args[0],
  17268. isInline: true,
  17269. operatorList,
  17270. cacheKey,
  17271. localImageCache
  17272. }));
  17273. return;
  17274. case _util.OPS.showText:
  17275. if (!stateManager.state.font) {
  17276. self.ensureStateFont(stateManager.state);
  17277. continue;
  17278. }
  17279. args[0] = self.handleText(args[0], stateManager.state);
  17280. break;
  17281. case _util.OPS.showSpacedText:
  17282. if (!stateManager.state.font) {
  17283. self.ensureStateFont(stateManager.state);
  17284. continue;
  17285. }
  17286. var arr = args[0];
  17287. var combinedGlyphs = [];
  17288. var arrLength = arr.length;
  17289. var state = stateManager.state;
  17290. for (i = 0; i < arrLength; ++i) {
  17291. var arrItem = arr[i];
  17292. if ((0, _util.isString)(arrItem)) {
  17293. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  17294. } else if ((0, _util.isNum)(arrItem)) {
  17295. combinedGlyphs.push(arrItem);
  17296. }
  17297. }
  17298. args[0] = combinedGlyphs;
  17299. fn = _util.OPS.showText;
  17300. break;
  17301. case _util.OPS.nextLineShowText:
  17302. if (!stateManager.state.font) {
  17303. self.ensureStateFont(stateManager.state);
  17304. continue;
  17305. }
  17306. operatorList.addOp(_util.OPS.nextLine);
  17307. args[0] = self.handleText(args[0], stateManager.state);
  17308. fn = _util.OPS.showText;
  17309. break;
  17310. case _util.OPS.nextLineSetSpacingShowText:
  17311. if (!stateManager.state.font) {
  17312. self.ensureStateFont(stateManager.state);
  17313. continue;
  17314. }
  17315. operatorList.addOp(_util.OPS.nextLine);
  17316. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  17317. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  17318. args[0] = self.handleText(args[0], stateManager.state);
  17319. fn = _util.OPS.showText;
  17320. break;
  17321. case _util.OPS.setTextRenderingMode:
  17322. stateManager.state.textRenderingMode = args[0];
  17323. break;
  17324. case _util.OPS.setFillColorSpace:
  17325. next(self.parseColorSpace({
  17326. cs: args[0],
  17327. resources
  17328. }).then(function (colorSpace) {
  17329. if (colorSpace) {
  17330. stateManager.state.fillColorSpace = colorSpace;
  17331. }
  17332. }));
  17333. return;
  17334. case _util.OPS.setStrokeColorSpace:
  17335. next(self.parseColorSpace({
  17336. cs: args[0],
  17337. resources
  17338. }).then(function (colorSpace) {
  17339. if (colorSpace) {
  17340. stateManager.state.strokeColorSpace = colorSpace;
  17341. }
  17342. }));
  17343. return;
  17344. case _util.OPS.setFillColor:
  17345. cs = stateManager.state.fillColorSpace;
  17346. args = cs.getRgb(args, 0);
  17347. fn = _util.OPS.setFillRGBColor;
  17348. break;
  17349. case _util.OPS.setStrokeColor:
  17350. cs = stateManager.state.strokeColorSpace;
  17351. args = cs.getRgb(args, 0);
  17352. fn = _util.OPS.setStrokeRGBColor;
  17353. break;
  17354. case _util.OPS.setFillGray:
  17355. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  17356. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  17357. fn = _util.OPS.setFillRGBColor;
  17358. break;
  17359. case _util.OPS.setStrokeGray:
  17360. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  17361. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  17362. fn = _util.OPS.setStrokeRGBColor;
  17363. break;
  17364. case _util.OPS.setFillCMYKColor:
  17365. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  17366. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  17367. fn = _util.OPS.setFillRGBColor;
  17368. break;
  17369. case _util.OPS.setStrokeCMYKColor:
  17370. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  17371. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  17372. fn = _util.OPS.setStrokeRGBColor;
  17373. break;
  17374. case _util.OPS.setFillRGBColor:
  17375. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  17376. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  17377. break;
  17378. case _util.OPS.setStrokeRGBColor:
  17379. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  17380. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  17381. break;
  17382. case _util.OPS.setFillColorN:
  17383. cs = stateManager.state.fillColorSpace;
  17384. if (cs.name === "Pattern") {
  17385. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task));
  17386. return;
  17387. }
  17388. args = cs.getRgb(args, 0);
  17389. fn = _util.OPS.setFillRGBColor;
  17390. break;
  17391. case _util.OPS.setStrokeColorN:
  17392. cs = stateManager.state.strokeColorSpace;
  17393. if (cs.name === "Pattern") {
  17394. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task));
  17395. return;
  17396. }
  17397. args = cs.getRgb(args, 0);
  17398. fn = _util.OPS.setStrokeRGBColor;
  17399. break;
  17400. case _util.OPS.shadingFill:
  17401. var shadingRes = resources.get("Shading");
  17402. if (!shadingRes) {
  17403. throw new _util.FormatError("No shading resource found");
  17404. }
  17405. var shading = shadingRes.get(args[0].name);
  17406. if (!shading) {
  17407. throw new _util.FormatError("No shading object found");
  17408. }
  17409. var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory);
  17410. var patternIR = shadingFill.getIR();
  17411. args = [patternIR];
  17412. fn = _util.OPS.shadingFill;
  17413. break;
  17414. case _util.OPS.setGState:
  17415. var dictName = args[0];
  17416. var extGState = resources.get("ExtGState");
  17417. if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) {
  17418. break;
  17419. }
  17420. var gState = extGState.get(dictName.name);
  17421. next(self.setGState(resources, gState, operatorList, task, stateManager));
  17422. return;
  17423. case _util.OPS.moveTo:
  17424. case _util.OPS.lineTo:
  17425. case _util.OPS.curveTo:
  17426. case _util.OPS.curveTo2:
  17427. case _util.OPS.curveTo3:
  17428. case _util.OPS.closePath:
  17429. case _util.OPS.rectangle:
  17430. self.buildPath(operatorList, fn, args, parsingText);
  17431. continue;
  17432. case _util.OPS.markPoint:
  17433. case _util.OPS.markPointProps:
  17434. case _util.OPS.beginMarkedContent:
  17435. case _util.OPS.beginMarkedContentProps:
  17436. case _util.OPS.endMarkedContent:
  17437. case _util.OPS.beginCompat:
  17438. case _util.OPS.endCompat:
  17439. continue;
  17440. default:
  17441. if (args !== null) {
  17442. for (i = 0, ii = args.length; i < ii; i++) {
  17443. if (args[i] instanceof _primitives.Dict) {
  17444. break;
  17445. }
  17446. }
  17447. if (i < ii) {
  17448. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  17449. continue;
  17450. }
  17451. }
  17452. }
  17453. operatorList.addOp(fn, args);
  17454. }
  17455. if (stop) {
  17456. next(deferred);
  17457. return;
  17458. }
  17459. closePendingRestoreOPS();
  17460. resolve();
  17461. }).catch(reason => {
  17462. if (reason instanceof _util.AbortException) {
  17463. return;
  17464. }
  17465. if (this.options.ignoreErrors) {
  17466. this.handler.send("UnsupportedFeature", {
  17467. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  17468. });
  17469. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  17470. closePendingRestoreOPS();
  17471. return;
  17472. }
  17473. throw reason;
  17474. });
  17475. },
  17476. getTextContent({
  17477. stream,
  17478. task,
  17479. resources,
  17480. stateManager = null,
  17481. normalizeWhitespace = false,
  17482. combineTextItems = false,
  17483. sink,
  17484. seenStyles = Object.create(null)
  17485. }) {
  17486. resources = resources || _primitives.Dict.empty;
  17487. stateManager = stateManager || new StateManager(new TextState());
  17488. var WhitespaceRegexp = /\s/g;
  17489. var textContent = {
  17490. items: [],
  17491. styles: Object.create(null)
  17492. };
  17493. var textContentItem = {
  17494. initialized: false,
  17495. str: [],
  17496. width: 0,
  17497. height: 0,
  17498. vertical: false,
  17499. lastAdvanceWidth: 0,
  17500. lastAdvanceHeight: 0,
  17501. textAdvanceScale: 0,
  17502. spaceWidth: 0,
  17503. fakeSpaceMin: Infinity,
  17504. fakeMultiSpaceMin: Infinity,
  17505. fakeMultiSpaceMax: -0,
  17506. textRunBreakAllowed: false,
  17507. transform: null,
  17508. fontName: null
  17509. };
  17510. var SPACE_FACTOR = 0.3;
  17511. var MULTI_SPACE_FACTOR = 1.5;
  17512. var MULTI_SPACE_FACTOR_MAX = 4;
  17513. var self = this;
  17514. var xref = this.xref;
  17515. var xobjs = null;
  17516. const emptyXObjectCache = new _image_utils.LocalImageCache();
  17517. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  17518. var textState;
  17519. function ensureTextContentItem() {
  17520. if (textContentItem.initialized) {
  17521. return textContentItem;
  17522. }
  17523. var font = textState.font;
  17524. if (!(font.loadedName in seenStyles)) {
  17525. seenStyles[font.loadedName] = true;
  17526. textContent.styles[font.loadedName] = {
  17527. fontFamily: font.fallbackName,
  17528. ascent: font.ascent,
  17529. descent: font.descent,
  17530. vertical: font.vertical
  17531. };
  17532. }
  17533. textContentItem.fontName = font.loadedName;
  17534. var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  17535. if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  17536. const glyphHeight = font.bbox[3] - font.bbox[1];
  17537. if (glyphHeight > 0) {
  17538. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  17539. }
  17540. }
  17541. var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  17542. textContentItem.transform = trm;
  17543. if (!font.vertical) {
  17544. textContentItem.width = 0;
  17545. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  17546. textContentItem.vertical = false;
  17547. } else {
  17548. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  17549. textContentItem.height = 0;
  17550. textContentItem.vertical = true;
  17551. }
  17552. var a = textState.textLineMatrix[0];
  17553. var b = textState.textLineMatrix[1];
  17554. var scaleLineX = Math.sqrt(a * a + b * b);
  17555. a = textState.ctm[0];
  17556. b = textState.ctm[1];
  17557. var scaleCtmX = Math.sqrt(a * a + b * b);
  17558. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  17559. textContentItem.lastAdvanceWidth = 0;
  17560. textContentItem.lastAdvanceHeight = 0;
  17561. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  17562. if (spaceWidth) {
  17563. textContentItem.spaceWidth = spaceWidth;
  17564. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  17565. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  17566. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  17567. textContentItem.textRunBreakAllowed = !font.isMonospace;
  17568. } else {
  17569. textContentItem.spaceWidth = 0;
  17570. textContentItem.fakeSpaceMin = Infinity;
  17571. textContentItem.fakeMultiSpaceMin = Infinity;
  17572. textContentItem.fakeMultiSpaceMax = 0;
  17573. textContentItem.textRunBreakAllowed = false;
  17574. }
  17575. textContentItem.initialized = true;
  17576. return textContentItem;
  17577. }
  17578. function replaceWhitespace(str) {
  17579. var i = 0,
  17580. ii = str.length,
  17581. code;
  17582. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  17583. i++;
  17584. }
  17585. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  17586. }
  17587. function runBidiTransform(textChunk) {
  17588. var str = textChunk.str.join("");
  17589. var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
  17590. return {
  17591. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  17592. dir: bidiResult.dir,
  17593. width: textChunk.width,
  17594. height: textChunk.height,
  17595. transform: textChunk.transform,
  17596. fontName: textChunk.fontName
  17597. };
  17598. }
  17599. function handleSetFont(fontName, fontRef) {
  17600. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  17601. textState.font = translated.font;
  17602. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  17603. });
  17604. }
  17605. function buildTextContentItem(chars) {
  17606. var font = textState.font;
  17607. var textChunk = ensureTextContentItem();
  17608. var width = 0;
  17609. var height = 0;
  17610. var glyphs = font.charsToGlyphs(chars);
  17611. for (var i = 0; i < glyphs.length; i++) {
  17612. var glyph = glyphs[i];
  17613. var glyphWidth = null;
  17614. if (font.vertical && glyph.vmetric) {
  17615. glyphWidth = glyph.vmetric[0];
  17616. } else {
  17617. glyphWidth = glyph.width;
  17618. }
  17619. var glyphUnicode = glyph.unicode;
  17620. var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  17621. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  17622. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  17623. }
  17624. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  17625. var charSpacing = textState.charSpacing;
  17626. if (glyph.isSpace) {
  17627. var wordSpacing = textState.wordSpacing;
  17628. charSpacing += wordSpacing;
  17629. if (wordSpacing > 0) {
  17630. addFakeSpaces(wordSpacing, textChunk.str);
  17631. }
  17632. }
  17633. var tx = 0;
  17634. var ty = 0;
  17635. if (!font.vertical) {
  17636. var w0 = glyphWidth * textState.fontMatrix[0];
  17637. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  17638. width += tx;
  17639. } else {
  17640. var w1 = glyphWidth * textState.fontMatrix[0];
  17641. ty = w1 * textState.fontSize + charSpacing;
  17642. height += ty;
  17643. }
  17644. textState.translateTextMatrix(tx, ty);
  17645. textChunk.str.push(glyphUnicode);
  17646. }
  17647. if (!font.vertical) {
  17648. textChunk.lastAdvanceWidth = width;
  17649. textChunk.width += width;
  17650. } else {
  17651. textChunk.lastAdvanceHeight = height;
  17652. textChunk.height += Math.abs(height);
  17653. }
  17654. return textChunk;
  17655. }
  17656. function addFakeSpaces(width, strBuf) {
  17657. if (width < textContentItem.fakeSpaceMin) {
  17658. return;
  17659. }
  17660. if (width < textContentItem.fakeMultiSpaceMin) {
  17661. strBuf.push(" ");
  17662. return;
  17663. }
  17664. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  17665. while (fakeSpaces-- > 0) {
  17666. strBuf.push(" ");
  17667. }
  17668. }
  17669. function flushTextContentItem() {
  17670. if (!textContentItem.initialized) {
  17671. return;
  17672. }
  17673. if (!textContentItem.vertical) {
  17674. textContentItem.width *= textContentItem.textAdvanceScale;
  17675. } else {
  17676. textContentItem.height *= textContentItem.textAdvanceScale;
  17677. }
  17678. textContent.items.push(runBidiTransform(textContentItem));
  17679. textContentItem.initialized = false;
  17680. textContentItem.str.length = 0;
  17681. }
  17682. function enqueueChunk() {
  17683. const length = textContent.items.length;
  17684. if (length > 0) {
  17685. sink.enqueue(textContent, length);
  17686. textContent.items = [];
  17687. textContent.styles = Object.create(null);
  17688. }
  17689. }
  17690. var timeSlotManager = new TimeSlotManager();
  17691. return new Promise(function promiseBody(resolve, reject) {
  17692. const next = function (promise) {
  17693. enqueueChunk();
  17694. Promise.all([promise, sink.ready]).then(function () {
  17695. try {
  17696. promiseBody(resolve, reject);
  17697. } catch (ex) {
  17698. reject(ex);
  17699. }
  17700. }, reject);
  17701. };
  17702. task.ensureNotTerminated();
  17703. timeSlotManager.reset();
  17704. var stop,
  17705. operation = {},
  17706. args = [];
  17707. while (!(stop = timeSlotManager.check())) {
  17708. args.length = 0;
  17709. operation.args = args;
  17710. if (!preprocessor.read(operation)) {
  17711. break;
  17712. }
  17713. textState = stateManager.state;
  17714. var fn = operation.fn;
  17715. args = operation.args;
  17716. var advance, diff;
  17717. switch (fn | 0) {
  17718. case _util.OPS.setFont:
  17719. var fontNameArg = args[0].name,
  17720. fontSizeArg = args[1];
  17721. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  17722. break;
  17723. }
  17724. flushTextContentItem();
  17725. textState.fontName = fontNameArg;
  17726. textState.fontSize = fontSizeArg;
  17727. next(handleSetFont(fontNameArg, null));
  17728. return;
  17729. case _util.OPS.setTextRise:
  17730. flushTextContentItem();
  17731. textState.textRise = args[0];
  17732. break;
  17733. case _util.OPS.setHScale:
  17734. flushTextContentItem();
  17735. textState.textHScale = args[0] / 100;
  17736. break;
  17737. case _util.OPS.setLeading:
  17738. flushTextContentItem();
  17739. textState.leading = args[0];
  17740. break;
  17741. case _util.OPS.moveText:
  17742. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  17743. advance = args[0] - args[1];
  17744. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  17745. textState.translateTextLineMatrix(args[0], args[1]);
  17746. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  17747. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  17748. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  17749. addFakeSpaces(diff, textContentItem.str);
  17750. break;
  17751. }
  17752. flushTextContentItem();
  17753. textState.translateTextLineMatrix(args[0], args[1]);
  17754. textState.textMatrix = textState.textLineMatrix.slice();
  17755. break;
  17756. case _util.OPS.setLeadingMoveText:
  17757. flushTextContentItem();
  17758. textState.leading = -args[1];
  17759. textState.translateTextLineMatrix(args[0], args[1]);
  17760. textState.textMatrix = textState.textLineMatrix.slice();
  17761. break;
  17762. case _util.OPS.nextLine:
  17763. flushTextContentItem();
  17764. textState.carriageReturn();
  17765. break;
  17766. case _util.OPS.setTextMatrix:
  17767. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  17768. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  17769. textState.translateTextLineMatrix(advance.width, advance.height);
  17770. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  17771. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  17772. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  17773. addFakeSpaces(diff, textContentItem.str);
  17774. break;
  17775. }
  17776. flushTextContentItem();
  17777. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  17778. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  17779. break;
  17780. case _util.OPS.setCharSpacing:
  17781. textState.charSpacing = args[0];
  17782. break;
  17783. case _util.OPS.setWordSpacing:
  17784. textState.wordSpacing = args[0];
  17785. break;
  17786. case _util.OPS.beginText:
  17787. flushTextContentItem();
  17788. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  17789. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  17790. break;
  17791. case _util.OPS.showSpacedText:
  17792. if (!stateManager.state.font) {
  17793. self.ensureStateFont(stateManager.state);
  17794. continue;
  17795. }
  17796. var items = args[0];
  17797. var offset;
  17798. for (var j = 0, jj = items.length; j < jj; j++) {
  17799. if (typeof items[j] === "string") {
  17800. buildTextContentItem(items[j]);
  17801. } else if ((0, _util.isNum)(items[j])) {
  17802. ensureTextContentItem();
  17803. advance = items[j] * textState.fontSize / 1000;
  17804. var breakTextRun = false;
  17805. if (textState.font.vertical) {
  17806. offset = advance;
  17807. textState.translateTextMatrix(0, offset);
  17808. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  17809. if (!breakTextRun) {
  17810. textContentItem.height += offset;
  17811. }
  17812. } else {
  17813. advance = -advance;
  17814. offset = advance * textState.textHScale;
  17815. textState.translateTextMatrix(offset, 0);
  17816. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  17817. if (!breakTextRun) {
  17818. textContentItem.width += offset;
  17819. }
  17820. }
  17821. if (breakTextRun) {
  17822. flushTextContentItem();
  17823. } else if (advance > 0) {
  17824. addFakeSpaces(advance, textContentItem.str);
  17825. }
  17826. }
  17827. }
  17828. break;
  17829. case _util.OPS.showText:
  17830. if (!stateManager.state.font) {
  17831. self.ensureStateFont(stateManager.state);
  17832. continue;
  17833. }
  17834. buildTextContentItem(args[0]);
  17835. break;
  17836. case _util.OPS.nextLineShowText:
  17837. if (!stateManager.state.font) {
  17838. self.ensureStateFont(stateManager.state);
  17839. continue;
  17840. }
  17841. flushTextContentItem();
  17842. textState.carriageReturn();
  17843. buildTextContentItem(args[0]);
  17844. break;
  17845. case _util.OPS.nextLineSetSpacingShowText:
  17846. if (!stateManager.state.font) {
  17847. self.ensureStateFont(stateManager.state);
  17848. continue;
  17849. }
  17850. flushTextContentItem();
  17851. textState.wordSpacing = args[0];
  17852. textState.charSpacing = args[1];
  17853. textState.carriageReturn();
  17854. buildTextContentItem(args[2]);
  17855. break;
  17856. case _util.OPS.paintXObject:
  17857. flushTextContentItem();
  17858. if (!xobjs) {
  17859. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  17860. }
  17861. var name = args[0].name;
  17862. if (name && emptyXObjectCache.getByName(name)) {
  17863. break;
  17864. }
  17865. next(new Promise(function (resolveXObject, rejectXObject) {
  17866. if (!name) {
  17867. throw new _util.FormatError("XObject must be referred to by name.");
  17868. }
  17869. let xobj = xobjs.getRaw(name);
  17870. if (xobj instanceof _primitives.Ref) {
  17871. if (emptyXObjectCache.getByRef(xobj)) {
  17872. resolveXObject();
  17873. return;
  17874. }
  17875. xobj = xref.fetch(xobj);
  17876. }
  17877. if (!xobj) {
  17878. resolveXObject();
  17879. return;
  17880. }
  17881. if (!(0, _primitives.isStream)(xobj)) {
  17882. throw new _util.FormatError("XObject should be a stream");
  17883. }
  17884. const type = xobj.dict.get("Subtype");
  17885. if (!(0, _primitives.isName)(type)) {
  17886. throw new _util.FormatError("XObject should have a Name subtype");
  17887. }
  17888. if (type.name !== "Form") {
  17889. emptyXObjectCache.set(name, xobj.dict.objId, true);
  17890. resolveXObject();
  17891. return;
  17892. }
  17893. const currentState = stateManager.state.clone();
  17894. const xObjStateManager = new StateManager(currentState);
  17895. const matrix = xobj.dict.getArray("Matrix");
  17896. if (Array.isArray(matrix) && matrix.length === 6) {
  17897. xObjStateManager.transform(matrix);
  17898. }
  17899. enqueueChunk();
  17900. const sinkWrapper = {
  17901. enqueueInvoked: false,
  17902. enqueue(chunk, size) {
  17903. this.enqueueInvoked = true;
  17904. sink.enqueue(chunk, size);
  17905. },
  17906. get desiredSize() {
  17907. return sink.desiredSize;
  17908. },
  17909. get ready() {
  17910. return sink.ready;
  17911. }
  17912. };
  17913. self.getTextContent({
  17914. stream: xobj,
  17915. task,
  17916. resources: xobj.dict.get("Resources") || resources,
  17917. stateManager: xObjStateManager,
  17918. normalizeWhitespace,
  17919. combineTextItems,
  17920. sink: sinkWrapper,
  17921. seenStyles
  17922. }).then(function () {
  17923. if (!sinkWrapper.enqueueInvoked) {
  17924. emptyXObjectCache.set(name, xobj.dict.objId, true);
  17925. }
  17926. resolveXObject();
  17927. }, rejectXObject);
  17928. }).catch(function (reason) {
  17929. if (reason instanceof _util.AbortException) {
  17930. return;
  17931. }
  17932. if (self.options.ignoreErrors) {
  17933. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  17934. return;
  17935. }
  17936. throw reason;
  17937. }));
  17938. return;
  17939. case _util.OPS.setGState:
  17940. flushTextContentItem();
  17941. var dictName = args[0];
  17942. var extGState = resources.get("ExtGState");
  17943. if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
  17944. break;
  17945. }
  17946. var gState = extGState.get(dictName.name);
  17947. if (!(0, _primitives.isDict)(gState)) {
  17948. break;
  17949. }
  17950. var gStateFont = gState.get("Font");
  17951. if (gStateFont) {
  17952. textState.fontName = null;
  17953. textState.fontSize = gStateFont[1];
  17954. next(handleSetFont(null, gStateFont[0]));
  17955. return;
  17956. }
  17957. break;
  17958. }
  17959. if (textContent.items.length >= sink.desiredSize) {
  17960. stop = true;
  17961. break;
  17962. }
  17963. }
  17964. if (stop) {
  17965. next(deferred);
  17966. return;
  17967. }
  17968. flushTextContentItem();
  17969. enqueueChunk();
  17970. resolve();
  17971. }).catch(reason => {
  17972. if (reason instanceof _util.AbortException) {
  17973. return;
  17974. }
  17975. if (this.options.ignoreErrors) {
  17976. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  17977. flushTextContentItem();
  17978. enqueueChunk();
  17979. return;
  17980. }
  17981. throw reason;
  17982. });
  17983. },
  17984. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
  17985. const xref = this.xref;
  17986. let cidToGidBytes;
  17987. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  17988. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  17989. if (properties.composite) {
  17990. var cidSystemInfo = dict.get("CIDSystemInfo");
  17991. if ((0, _primitives.isDict)(cidSystemInfo)) {
  17992. properties.cidSystemInfo = {
  17993. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  17994. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  17995. supplement: cidSystemInfo.get("Supplement")
  17996. };
  17997. }
  17998. var cidToGidMap = dict.get("CIDToGIDMap");
  17999. if ((0, _primitives.isStream)(cidToGidMap)) {
  18000. cidToGidBytes = cidToGidMap.getBytes();
  18001. }
  18002. }
  18003. var differences = [];
  18004. var baseEncodingName = null;
  18005. var encoding;
  18006. if (dict.has("Encoding")) {
  18007. encoding = dict.get("Encoding");
  18008. if ((0, _primitives.isDict)(encoding)) {
  18009. baseEncodingName = encoding.get("BaseEncoding");
  18010. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  18011. if (encoding.has("Differences")) {
  18012. var diffEncoding = encoding.get("Differences");
  18013. var index = 0;
  18014. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  18015. var data = xref.fetchIfRef(diffEncoding[j]);
  18016. if ((0, _util.isNum)(data)) {
  18017. index = data;
  18018. } else if ((0, _primitives.isName)(data)) {
  18019. differences[index++] = data.name;
  18020. } else {
  18021. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  18022. }
  18023. }
  18024. }
  18025. } else if ((0, _primitives.isName)(encoding)) {
  18026. baseEncodingName = encoding.name;
  18027. } else {
  18028. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  18029. }
  18030. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  18031. baseEncodingName = null;
  18032. }
  18033. }
  18034. if (baseEncodingName) {
  18035. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
  18036. } else {
  18037. var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
  18038. var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
  18039. encoding = _encodings.StandardEncoding;
  18040. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  18041. encoding = _encodings.WinAnsiEncoding;
  18042. }
  18043. if (isSymbolicFont) {
  18044. encoding = _encodings.MacRomanEncoding;
  18045. if (!properties.file) {
  18046. if (/Symbol/i.test(properties.name)) {
  18047. encoding = _encodings.SymbolSetEncoding;
  18048. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  18049. encoding = _encodings.ZapfDingbatsEncoding;
  18050. }
  18051. }
  18052. }
  18053. properties.defaultEncoding = encoding;
  18054. }
  18055. properties.differences = differences;
  18056. properties.baseEncodingName = baseEncodingName;
  18057. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  18058. properties.dict = dict;
  18059. return toUnicodePromise.then(readToUnicode => {
  18060. properties.toUnicode = readToUnicode;
  18061. return this.buildToUnicode(properties);
  18062. }).then(builtToUnicode => {
  18063. properties.toUnicode = builtToUnicode;
  18064. if (cidToGidBytes) {
  18065. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  18066. }
  18067. return properties;
  18068. });
  18069. },
  18070. _buildSimpleFontToUnicode(properties, forceGlyphs = false) {
  18071. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  18072. const toUnicode = [];
  18073. const encoding = properties.defaultEncoding.slice();
  18074. const baseEncodingName = properties.baseEncodingName;
  18075. const differences = properties.differences;
  18076. for (const charcode in differences) {
  18077. const glyphName = differences[charcode];
  18078. if (glyphName === ".notdef") {
  18079. continue;
  18080. }
  18081. encoding[charcode] = glyphName;
  18082. }
  18083. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  18084. for (const charcode in encoding) {
  18085. let glyphName = encoding[charcode];
  18086. if (glyphName === "") {
  18087. continue;
  18088. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  18089. let code = 0;
  18090. switch (glyphName[0]) {
  18091. case "G":
  18092. if (glyphName.length === 3) {
  18093. code = parseInt(glyphName.substring(1), 16);
  18094. }
  18095. break;
  18096. case "g":
  18097. if (glyphName.length === 5) {
  18098. code = parseInt(glyphName.substring(1), 16);
  18099. }
  18100. break;
  18101. case "C":
  18102. case "c":
  18103. if (glyphName.length >= 3 && glyphName.length <= 4) {
  18104. const codeStr = glyphName.substring(1);
  18105. if (forceGlyphs) {
  18106. code = parseInt(codeStr, 16);
  18107. break;
  18108. }
  18109. code = +codeStr;
  18110. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  18111. return this._buildSimpleFontToUnicode(properties, true);
  18112. }
  18113. }
  18114. break;
  18115. default:
  18116. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  18117. if (unicode !== -1) {
  18118. code = unicode;
  18119. }
  18120. }
  18121. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  18122. if (baseEncodingName && code === +charcode) {
  18123. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  18124. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  18125. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  18126. continue;
  18127. }
  18128. }
  18129. toUnicode[charcode] = String.fromCodePoint(code);
  18130. }
  18131. continue;
  18132. }
  18133. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  18134. }
  18135. return new _fonts.ToUnicodeMap(toUnicode);
  18136. },
  18137. buildToUnicode(properties) {
  18138. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  18139. if (properties.hasIncludedToUnicodeMap) {
  18140. if (!properties.composite && properties.hasEncoding) {
  18141. properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
  18142. }
  18143. return Promise.resolve(properties.toUnicode);
  18144. }
  18145. if (!properties.composite) {
  18146. return Promise.resolve(this._buildSimpleFontToUnicode(properties));
  18147. }
  18148. 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"))) {
  18149. const registry = properties.cidSystemInfo.registry;
  18150. const ordering = properties.cidSystemInfo.ordering;
  18151. const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
  18152. return _cmap.CMapFactory.create({
  18153. encoding: ucs2CMapName,
  18154. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18155. useCMap: null
  18156. }).then(function (ucs2CMap) {
  18157. const cMap = properties.cMap;
  18158. const toUnicode = [];
  18159. cMap.forEach(function (charcode, cid) {
  18160. if (cid > 0xffff) {
  18161. throw new _util.FormatError("Max size of CID is 65,535");
  18162. }
  18163. const ucs2 = ucs2CMap.lookup(cid);
  18164. if (ucs2) {
  18165. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  18166. }
  18167. });
  18168. return new _fonts.ToUnicodeMap(toUnicode);
  18169. });
  18170. }
  18171. return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  18172. },
  18173. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  18174. var cmapObj = toUnicode;
  18175. if ((0, _primitives.isName)(cmapObj)) {
  18176. return _cmap.CMapFactory.create({
  18177. encoding: cmapObj,
  18178. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18179. useCMap: null
  18180. }).then(function (cmap) {
  18181. if (cmap instanceof _cmap.IdentityCMap) {
  18182. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  18183. }
  18184. return new _fonts.ToUnicodeMap(cmap.getMap());
  18185. });
  18186. } else if ((0, _primitives.isStream)(cmapObj)) {
  18187. return _cmap.CMapFactory.create({
  18188. encoding: cmapObj,
  18189. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18190. useCMap: null
  18191. }).then(function (cmap) {
  18192. if (cmap instanceof _cmap.IdentityCMap) {
  18193. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  18194. }
  18195. var map = new Array(cmap.length);
  18196. cmap.forEach(function (charCode, token) {
  18197. var str = [];
  18198. for (var k = 0; k < token.length; k += 2) {
  18199. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  18200. if ((w1 & 0xf800) !== 0xd800) {
  18201. str.push(w1);
  18202. continue;
  18203. }
  18204. k += 2;
  18205. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  18206. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  18207. }
  18208. map[charCode] = String.fromCodePoint.apply(String, str);
  18209. });
  18210. return new _fonts.ToUnicodeMap(map);
  18211. }, reason => {
  18212. if (reason instanceof _util.AbortException) {
  18213. return null;
  18214. }
  18215. if (this.options.ignoreErrors) {
  18216. this.handler.send("UnsupportedFeature", {
  18217. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  18218. });
  18219. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  18220. return null;
  18221. }
  18222. throw reason;
  18223. });
  18224. }
  18225. return Promise.resolve(null);
  18226. },
  18227. readCidToGidMap(glyphsData, toUnicode) {
  18228. var result = [];
  18229. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  18230. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  18231. const code = j >> 1;
  18232. if (glyphID === 0 && !toUnicode.has(code)) {
  18233. continue;
  18234. }
  18235. result[code] = glyphID;
  18236. }
  18237. return result;
  18238. },
  18239. extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
  18240. var xref = this.xref;
  18241. var glyphsWidths = [];
  18242. var defaultWidth = 0;
  18243. var glyphsVMetrics = [];
  18244. var defaultVMetrics;
  18245. var i, ii, j, jj, start, code, widths;
  18246. if (properties.composite) {
  18247. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  18248. widths = dict.get("W");
  18249. if (widths) {
  18250. for (i = 0, ii = widths.length; i < ii; i++) {
  18251. start = xref.fetchIfRef(widths[i++]);
  18252. code = xref.fetchIfRef(widths[i]);
  18253. if (Array.isArray(code)) {
  18254. for (j = 0, jj = code.length; j < jj; j++) {
  18255. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  18256. }
  18257. } else {
  18258. var width = xref.fetchIfRef(widths[++i]);
  18259. for (j = start; j <= code; j++) {
  18260. glyphsWidths[j] = width;
  18261. }
  18262. }
  18263. }
  18264. }
  18265. if (properties.vertical) {
  18266. var vmetrics = dict.getArray("DW2") || [880, -1000];
  18267. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  18268. vmetrics = dict.get("W2");
  18269. if (vmetrics) {
  18270. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  18271. start = xref.fetchIfRef(vmetrics[i++]);
  18272. code = xref.fetchIfRef(vmetrics[i]);
  18273. if (Array.isArray(code)) {
  18274. for (j = 0, jj = code.length; j < jj; j++) {
  18275. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  18276. }
  18277. } else {
  18278. var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  18279. for (j = start; j <= code; j++) {
  18280. glyphsVMetrics[j] = vmetric;
  18281. }
  18282. }
  18283. }
  18284. }
  18285. }
  18286. } else {
  18287. var firstChar = properties.firstChar;
  18288. widths = dict.get("Widths");
  18289. if (widths) {
  18290. j = firstChar;
  18291. for (i = 0, ii = widths.length; i < ii; i++) {
  18292. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  18293. }
  18294. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  18295. } else {
  18296. var baseFontName = dict.get("BaseFont");
  18297. if ((0, _primitives.isName)(baseFontName)) {
  18298. var metrics = this.getBaseFontMetrics(baseFontName.name);
  18299. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  18300. defaultWidth = metrics.defaultWidth;
  18301. }
  18302. }
  18303. }
  18304. var isMonospace = true;
  18305. var firstWidth = defaultWidth;
  18306. for (var glyph in glyphsWidths) {
  18307. var glyphWidth = glyphsWidths[glyph];
  18308. if (!glyphWidth) {
  18309. continue;
  18310. }
  18311. if (!firstWidth) {
  18312. firstWidth = glyphWidth;
  18313. continue;
  18314. }
  18315. if (firstWidth !== glyphWidth) {
  18316. isMonospace = false;
  18317. break;
  18318. }
  18319. }
  18320. if (isMonospace) {
  18321. properties.flags |= _fonts.FontFlags.FixedPitch;
  18322. }
  18323. properties.defaultWidth = defaultWidth;
  18324. properties.widths = glyphsWidths;
  18325. properties.defaultVMetrics = defaultVMetrics;
  18326. properties.vmetrics = glyphsVMetrics;
  18327. },
  18328. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  18329. var fontNameWoStyle = baseFontName.split("-")[0];
  18330. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  18331. },
  18332. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  18333. var defaultWidth = 0;
  18334. var widths = [];
  18335. var monospace = false;
  18336. var stdFontMap = (0, _standard_fonts.getStdFontMap)();
  18337. var lookupName = stdFontMap[name] || name;
  18338. var Metrics = (0, _metrics.getMetrics)();
  18339. if (!(lookupName in Metrics)) {
  18340. if (this.isSerifFont(name)) {
  18341. lookupName = "Times-Roman";
  18342. } else {
  18343. lookupName = "Helvetica";
  18344. }
  18345. }
  18346. var glyphWidths = Metrics[lookupName];
  18347. if ((0, _util.isNum)(glyphWidths)) {
  18348. defaultWidth = glyphWidths;
  18349. monospace = true;
  18350. } else {
  18351. widths = glyphWidths();
  18352. }
  18353. return {
  18354. defaultWidth,
  18355. monospace,
  18356. widths
  18357. };
  18358. },
  18359. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  18360. var widths = Object.create(null);
  18361. var differences = properties.differences;
  18362. var encoding = properties.defaultEncoding;
  18363. for (var charCode = 0; charCode < 256; charCode++) {
  18364. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  18365. widths[charCode] = widthsByGlyphName[differences[charCode]];
  18366. continue;
  18367. }
  18368. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  18369. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  18370. continue;
  18371. }
  18372. }
  18373. return widths;
  18374. },
  18375. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) {
  18376. var baseDict = dict;
  18377. var type = dict.get("Subtype");
  18378. if (!(0, _primitives.isName)(type)) {
  18379. throw new _util.FormatError("invalid font Subtype");
  18380. }
  18381. var composite = false;
  18382. var uint8array;
  18383. if (type.name === "Type0") {
  18384. var df = dict.get("DescendantFonts");
  18385. if (!df) {
  18386. throw new _util.FormatError("Descendant fonts are not specified");
  18387. }
  18388. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  18389. type = dict.get("Subtype");
  18390. if (!(0, _primitives.isName)(type)) {
  18391. throw new _util.FormatError("invalid font Subtype");
  18392. }
  18393. composite = true;
  18394. }
  18395. var descriptor = dict.get("FontDescriptor");
  18396. if (descriptor) {
  18397. var hash = new _murmurhash.MurmurHash3_64();
  18398. var encoding = baseDict.getRaw("Encoding");
  18399. if ((0, _primitives.isName)(encoding)) {
  18400. hash.update(encoding.name);
  18401. } else if ((0, _primitives.isRef)(encoding)) {
  18402. hash.update(encoding.toString());
  18403. } else if ((0, _primitives.isDict)(encoding)) {
  18404. var keys = encoding.getKeys();
  18405. for (var i = 0, ii = keys.length; i < ii; i++) {
  18406. var entry = encoding.getRaw(keys[i]);
  18407. if ((0, _primitives.isName)(entry)) {
  18408. hash.update(entry.name);
  18409. } else if ((0, _primitives.isRef)(entry)) {
  18410. hash.update(entry.toString());
  18411. } else if (Array.isArray(entry)) {
  18412. var diffLength = entry.length,
  18413. diffBuf = new Array(diffLength);
  18414. for (var j = 0; j < diffLength; j++) {
  18415. var diffEntry = entry[j];
  18416. if ((0, _primitives.isName)(diffEntry)) {
  18417. diffBuf[j] = diffEntry.name;
  18418. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  18419. diffBuf[j] = diffEntry.toString();
  18420. }
  18421. }
  18422. hash.update(diffBuf.join());
  18423. }
  18424. }
  18425. }
  18426. const firstChar = dict.get("FirstChar") || 0;
  18427. const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  18428. hash.update(`${firstChar}-${lastChar}`);
  18429. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  18430. if ((0, _primitives.isStream)(toUnicode)) {
  18431. var stream = toUnicode.str || toUnicode;
  18432. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  18433. hash.update(uint8array);
  18434. } else if ((0, _primitives.isName)(toUnicode)) {
  18435. hash.update(toUnicode.name);
  18436. }
  18437. var widths = dict.get("Widths") || baseDict.get("Widths");
  18438. if (widths) {
  18439. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  18440. hash.update(uint8array);
  18441. }
  18442. }
  18443. return {
  18444. descriptor,
  18445. dict,
  18446. baseDict,
  18447. composite,
  18448. type: type.name,
  18449. hash: hash ? hash.hexdigest() : ""
  18450. };
  18451. },
  18452. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) {
  18453. var baseDict = preEvaluatedFont.baseDict;
  18454. var dict = preEvaluatedFont.dict;
  18455. var composite = preEvaluatedFont.composite;
  18456. var descriptor = preEvaluatedFont.descriptor;
  18457. var type = preEvaluatedFont.type;
  18458. var maxCharIndex = composite ? 0xffff : 0xff;
  18459. var properties;
  18460. const firstChar = dict.get("FirstChar") || 0;
  18461. const lastChar = dict.get("LastChar") || maxCharIndex;
  18462. if (!descriptor) {
  18463. if (type === "Type3") {
  18464. descriptor = new _primitives.Dict(null);
  18465. descriptor.set("FontName", _primitives.Name.get(type));
  18466. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  18467. } else {
  18468. var baseFontName = dict.get("BaseFont");
  18469. if (!(0, _primitives.isName)(baseFontName)) {
  18470. throw new _util.FormatError("Base font is not specified");
  18471. }
  18472. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  18473. var metrics = this.getBaseFontMetrics(baseFontName);
  18474. var fontNameWoStyle = baseFontName.split("-")[0];
  18475. var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic);
  18476. properties = {
  18477. type,
  18478. name: baseFontName,
  18479. widths: metrics.widths,
  18480. defaultWidth: metrics.defaultWidth,
  18481. flags,
  18482. firstChar,
  18483. lastChar
  18484. };
  18485. const widths = dict.get("Widths");
  18486. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  18487. if (widths) {
  18488. const glyphWidths = [];
  18489. let j = firstChar;
  18490. for (let i = 0, ii = widths.length; i < ii; i++) {
  18491. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  18492. }
  18493. newProperties.widths = glyphWidths;
  18494. } else {
  18495. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  18496. }
  18497. return new _fonts.Font(baseFontName, null, newProperties);
  18498. });
  18499. }
  18500. }
  18501. var fontName = descriptor.get("FontName");
  18502. var baseFont = dict.get("BaseFont");
  18503. if ((0, _util.isString)(fontName)) {
  18504. fontName = _primitives.Name.get(fontName);
  18505. }
  18506. if ((0, _util.isString)(baseFont)) {
  18507. baseFont = _primitives.Name.get(baseFont);
  18508. }
  18509. if (type !== "Type3") {
  18510. var fontNameStr = fontName && fontName.name;
  18511. var baseFontStr = baseFont && baseFont.name;
  18512. if (fontNameStr !== baseFontStr) {
  18513. (0, _util.info)(`The FontDescriptor\'s FontName is "${fontNameStr}" but ` + `should be the same as the Font\'s BaseFont "${baseFontStr}".`);
  18514. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  18515. fontName = baseFont;
  18516. }
  18517. }
  18518. }
  18519. fontName = fontName || baseFont;
  18520. if (!(0, _primitives.isName)(fontName)) {
  18521. throw new _util.FormatError("invalid font name");
  18522. }
  18523. var fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  18524. if (fontFile) {
  18525. if (fontFile.dict) {
  18526. var subtype = fontFile.dict.get("Subtype");
  18527. if (subtype) {
  18528. subtype = subtype.name;
  18529. }
  18530. var length1 = fontFile.dict.get("Length1");
  18531. var length2 = fontFile.dict.get("Length2");
  18532. var length3 = fontFile.dict.get("Length3");
  18533. }
  18534. }
  18535. properties = {
  18536. type,
  18537. name: fontName.name,
  18538. subtype,
  18539. file: fontFile,
  18540. length1,
  18541. length2,
  18542. length3,
  18543. loadedName: baseDict.loadedName,
  18544. composite,
  18545. fixedPitch: false,
  18546. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  18547. firstChar: firstChar || 0,
  18548. lastChar: lastChar || maxCharIndex,
  18549. bbox: descriptor.getArray("FontBBox"),
  18550. ascent: descriptor.get("Ascent"),
  18551. descent: descriptor.get("Descent"),
  18552. xHeight: descriptor.get("XHeight"),
  18553. capHeight: descriptor.get("CapHeight"),
  18554. flags: descriptor.get("Flags"),
  18555. italicAngle: descriptor.get("ItalicAngle"),
  18556. isType3Font: false
  18557. };
  18558. var cMapPromise;
  18559. if (composite) {
  18560. var cidEncoding = baseDict.get("Encoding");
  18561. if ((0, _primitives.isName)(cidEncoding)) {
  18562. properties.cidEncoding = cidEncoding.name;
  18563. }
  18564. cMapPromise = _cmap.CMapFactory.create({
  18565. encoding: cidEncoding,
  18566. fetchBuiltInCMap: this.fetchBuiltInCMap,
  18567. useCMap: null
  18568. }).then(function (cMap) {
  18569. properties.cMap = cMap;
  18570. properties.vertical = properties.cMap.vertical;
  18571. });
  18572. } else {
  18573. cMapPromise = Promise.resolve(undefined);
  18574. }
  18575. return cMapPromise.then(() => {
  18576. return this.extractDataStructures(dict, baseDict, properties);
  18577. }).then(newProperties => {
  18578. this.extractWidths(dict, descriptor, newProperties);
  18579. if (type === "Type3") {
  18580. newProperties.isType3Font = true;
  18581. }
  18582. return new _fonts.Font(fontName.name, fontFile, newProperties);
  18583. });
  18584. }
  18585. };
  18586. PartialEvaluator.buildFontPaths = function (font, glyphs, handler) {
  18587. function buildPath(fontChar) {
  18588. if (font.renderer.hasBuiltPath(fontChar)) {
  18589. return;
  18590. }
  18591. handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]);
  18592. }
  18593. for (const glyph of glyphs) {
  18594. buildPath(glyph.fontChar);
  18595. const accent = glyph.accent;
  18596. if (accent && accent.fontChar) {
  18597. buildPath(accent.fontChar);
  18598. }
  18599. }
  18600. };
  18601. PartialEvaluator.getFallbackFontDict = function () {
  18602. if (this._fallbackFontDict) {
  18603. return this._fallbackFontDict;
  18604. }
  18605. const dict = new _primitives.Dict();
  18606. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  18607. dict.set("Type", _primitives.Name.get("FallbackType"));
  18608. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18609. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  18610. return this._fallbackFontDict = dict;
  18611. };
  18612. return PartialEvaluator;
  18613. }();
  18614. exports.PartialEvaluator = PartialEvaluator;
  18615. class TranslatedFont {
  18616. constructor({
  18617. loadedName,
  18618. font,
  18619. dict,
  18620. extraProperties = false
  18621. }) {
  18622. this.loadedName = loadedName;
  18623. this.font = font;
  18624. this.dict = dict;
  18625. this._extraProperties = extraProperties;
  18626. this.type3Loaded = null;
  18627. this.sent = false;
  18628. }
  18629. send(handler) {
  18630. if (this.sent) {
  18631. return;
  18632. }
  18633. this.sent = true;
  18634. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._extraProperties)]);
  18635. }
  18636. fallback(handler) {
  18637. if (!this.font.data) {
  18638. return;
  18639. }
  18640. this.font.disableFontFace = true;
  18641. const glyphs = this.font.glyphCacheValues;
  18642. PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
  18643. }
  18644. loadType3Data(evaluator, resources, parentOperatorList, task) {
  18645. if (!this.font.isType3Font) {
  18646. throw new Error("Must be a Type3 font.");
  18647. }
  18648. if (this.type3Loaded) {
  18649. return this.type3Loaded;
  18650. }
  18651. var type3Options = Object.create(evaluator.options);
  18652. type3Options.ignoreErrors = false;
  18653. var type3Evaluator = evaluator.clone(type3Options);
  18654. type3Evaluator.parsingType3Font = true;
  18655. var translatedFont = this.font;
  18656. var loadCharProcsPromise = Promise.resolve();
  18657. var charProcs = this.dict.get("CharProcs");
  18658. var fontResources = this.dict.get("Resources") || resources;
  18659. var charProcKeys = charProcs.getKeys();
  18660. var charProcOperatorList = Object.create(null);
  18661. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  18662. const key = charProcKeys[i];
  18663. loadCharProcsPromise = loadCharProcsPromise.then(function () {
  18664. var glyphStream = charProcs.get(key);
  18665. var operatorList = new _operator_list.OperatorList();
  18666. return type3Evaluator.getOperatorList({
  18667. stream: glyphStream,
  18668. task,
  18669. resources: fontResources,
  18670. operatorList
  18671. }).then(function () {
  18672. charProcOperatorList[key] = operatorList.getIR();
  18673. parentOperatorList.addDependencies(operatorList.dependencies);
  18674. }).catch(function (reason) {
  18675. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  18676. const dummyOperatorList = new _operator_list.OperatorList();
  18677. charProcOperatorList[key] = dummyOperatorList.getIR();
  18678. });
  18679. });
  18680. }
  18681. this.type3Loaded = loadCharProcsPromise.then(function () {
  18682. translatedFont.charProcOperatorList = charProcOperatorList;
  18683. });
  18684. return this.type3Loaded;
  18685. }
  18686. }
  18687. var StateManager = function StateManagerClosure() {
  18688. function StateManager(initialState) {
  18689. this.state = initialState;
  18690. this.stateStack = [];
  18691. }
  18692. StateManager.prototype = {
  18693. save() {
  18694. var old = this.state;
  18695. this.stateStack.push(this.state);
  18696. this.state = old.clone();
  18697. },
  18698. restore() {
  18699. var prev = this.stateStack.pop();
  18700. if (prev) {
  18701. this.state = prev;
  18702. }
  18703. },
  18704. transform(args) {
  18705. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  18706. }
  18707. };
  18708. return StateManager;
  18709. }();
  18710. var TextState = function TextStateClosure() {
  18711. function TextState() {
  18712. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  18713. this.fontName = null;
  18714. this.fontSize = 0;
  18715. this.font = null;
  18716. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  18717. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  18718. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  18719. this.charSpacing = 0;
  18720. this.wordSpacing = 0;
  18721. this.leading = 0;
  18722. this.textHScale = 1;
  18723. this.textRise = 0;
  18724. }
  18725. TextState.prototype = {
  18726. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  18727. var m = this.textMatrix;
  18728. m[0] = a;
  18729. m[1] = b;
  18730. m[2] = c;
  18731. m[3] = d;
  18732. m[4] = e;
  18733. m[5] = f;
  18734. },
  18735. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  18736. var m = this.textLineMatrix;
  18737. m[0] = a;
  18738. m[1] = b;
  18739. m[2] = c;
  18740. m[3] = d;
  18741. m[4] = e;
  18742. m[5] = f;
  18743. },
  18744. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  18745. var m = this.textMatrix;
  18746. m[4] = m[0] * x + m[2] * y + m[4];
  18747. m[5] = m[1] * x + m[3] * y + m[5];
  18748. },
  18749. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  18750. var m = this.textLineMatrix;
  18751. m[4] = m[0] * x + m[2] * y + m[4];
  18752. m[5] = m[1] * x + m[3] * y + m[5];
  18753. },
  18754. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  18755. var font = this.font;
  18756. if (!font) {
  18757. return null;
  18758. }
  18759. var m = this.textLineMatrix;
  18760. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  18761. return null;
  18762. }
  18763. var txDiff = e - m[4],
  18764. tyDiff = f - m[5];
  18765. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  18766. return null;
  18767. }
  18768. var tx,
  18769. ty,
  18770. denominator = a * d - b * c;
  18771. if (font.vertical) {
  18772. tx = -tyDiff * c / denominator;
  18773. ty = tyDiff * a / denominator;
  18774. } else {
  18775. tx = txDiff * d / denominator;
  18776. ty = -txDiff * b / denominator;
  18777. }
  18778. return {
  18779. width: tx,
  18780. height: ty,
  18781. value: font.vertical ? ty : tx
  18782. };
  18783. },
  18784. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  18785. var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
  18786. return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
  18787. },
  18788. carriageReturn: function TextState_carriageReturn() {
  18789. this.translateTextLineMatrix(0, -this.leading);
  18790. this.textMatrix = this.textLineMatrix.slice();
  18791. },
  18792. clone: function TextState_clone() {
  18793. var clone = Object.create(this);
  18794. clone.textMatrix = this.textMatrix.slice();
  18795. clone.textLineMatrix = this.textLineMatrix.slice();
  18796. clone.fontMatrix = this.fontMatrix.slice();
  18797. return clone;
  18798. }
  18799. };
  18800. return TextState;
  18801. }();
  18802. var EvalState = function EvalStateClosure() {
  18803. function EvalState() {
  18804. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  18805. this.font = null;
  18806. this.textRenderingMode = _util.TextRenderingMode.FILL;
  18807. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  18808. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  18809. }
  18810. EvalState.prototype = {
  18811. clone: function CanvasExtraState_clone() {
  18812. return Object.create(this);
  18813. }
  18814. };
  18815. return EvalState;
  18816. }();
  18817. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  18818. var getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  18819. t.w = {
  18820. id: _util.OPS.setLineWidth,
  18821. numArgs: 1,
  18822. variableArgs: false
  18823. };
  18824. t.J = {
  18825. id: _util.OPS.setLineCap,
  18826. numArgs: 1,
  18827. variableArgs: false
  18828. };
  18829. t.j = {
  18830. id: _util.OPS.setLineJoin,
  18831. numArgs: 1,
  18832. variableArgs: false
  18833. };
  18834. t.M = {
  18835. id: _util.OPS.setMiterLimit,
  18836. numArgs: 1,
  18837. variableArgs: false
  18838. };
  18839. t.d = {
  18840. id: _util.OPS.setDash,
  18841. numArgs: 2,
  18842. variableArgs: false
  18843. };
  18844. t.ri = {
  18845. id: _util.OPS.setRenderingIntent,
  18846. numArgs: 1,
  18847. variableArgs: false
  18848. };
  18849. t.i = {
  18850. id: _util.OPS.setFlatness,
  18851. numArgs: 1,
  18852. variableArgs: false
  18853. };
  18854. t.gs = {
  18855. id: _util.OPS.setGState,
  18856. numArgs: 1,
  18857. variableArgs: false
  18858. };
  18859. t.q = {
  18860. id: _util.OPS.save,
  18861. numArgs: 0,
  18862. variableArgs: false
  18863. };
  18864. t.Q = {
  18865. id: _util.OPS.restore,
  18866. numArgs: 0,
  18867. variableArgs: false
  18868. };
  18869. t.cm = {
  18870. id: _util.OPS.transform,
  18871. numArgs: 6,
  18872. variableArgs: false
  18873. };
  18874. t.m = {
  18875. id: _util.OPS.moveTo,
  18876. numArgs: 2,
  18877. variableArgs: false
  18878. };
  18879. t.l = {
  18880. id: _util.OPS.lineTo,
  18881. numArgs: 2,
  18882. variableArgs: false
  18883. };
  18884. t.c = {
  18885. id: _util.OPS.curveTo,
  18886. numArgs: 6,
  18887. variableArgs: false
  18888. };
  18889. t.v = {
  18890. id: _util.OPS.curveTo2,
  18891. numArgs: 4,
  18892. variableArgs: false
  18893. };
  18894. t.y = {
  18895. id: _util.OPS.curveTo3,
  18896. numArgs: 4,
  18897. variableArgs: false
  18898. };
  18899. t.h = {
  18900. id: _util.OPS.closePath,
  18901. numArgs: 0,
  18902. variableArgs: false
  18903. };
  18904. t.re = {
  18905. id: _util.OPS.rectangle,
  18906. numArgs: 4,
  18907. variableArgs: false
  18908. };
  18909. t.S = {
  18910. id: _util.OPS.stroke,
  18911. numArgs: 0,
  18912. variableArgs: false
  18913. };
  18914. t.s = {
  18915. id: _util.OPS.closeStroke,
  18916. numArgs: 0,
  18917. variableArgs: false
  18918. };
  18919. t.f = {
  18920. id: _util.OPS.fill,
  18921. numArgs: 0,
  18922. variableArgs: false
  18923. };
  18924. t.F = {
  18925. id: _util.OPS.fill,
  18926. numArgs: 0,
  18927. variableArgs: false
  18928. };
  18929. t["f*"] = {
  18930. id: _util.OPS.eoFill,
  18931. numArgs: 0,
  18932. variableArgs: false
  18933. };
  18934. t.B = {
  18935. id: _util.OPS.fillStroke,
  18936. numArgs: 0,
  18937. variableArgs: false
  18938. };
  18939. t["B*"] = {
  18940. id: _util.OPS.eoFillStroke,
  18941. numArgs: 0,
  18942. variableArgs: false
  18943. };
  18944. t.b = {
  18945. id: _util.OPS.closeFillStroke,
  18946. numArgs: 0,
  18947. variableArgs: false
  18948. };
  18949. t["b*"] = {
  18950. id: _util.OPS.closeEOFillStroke,
  18951. numArgs: 0,
  18952. variableArgs: false
  18953. };
  18954. t.n = {
  18955. id: _util.OPS.endPath,
  18956. numArgs: 0,
  18957. variableArgs: false
  18958. };
  18959. t.W = {
  18960. id: _util.OPS.clip,
  18961. numArgs: 0,
  18962. variableArgs: false
  18963. };
  18964. t["W*"] = {
  18965. id: _util.OPS.eoClip,
  18966. numArgs: 0,
  18967. variableArgs: false
  18968. };
  18969. t.BT = {
  18970. id: _util.OPS.beginText,
  18971. numArgs: 0,
  18972. variableArgs: false
  18973. };
  18974. t.ET = {
  18975. id: _util.OPS.endText,
  18976. numArgs: 0,
  18977. variableArgs: false
  18978. };
  18979. t.Tc = {
  18980. id: _util.OPS.setCharSpacing,
  18981. numArgs: 1,
  18982. variableArgs: false
  18983. };
  18984. t.Tw = {
  18985. id: _util.OPS.setWordSpacing,
  18986. numArgs: 1,
  18987. variableArgs: false
  18988. };
  18989. t.Tz = {
  18990. id: _util.OPS.setHScale,
  18991. numArgs: 1,
  18992. variableArgs: false
  18993. };
  18994. t.TL = {
  18995. id: _util.OPS.setLeading,
  18996. numArgs: 1,
  18997. variableArgs: false
  18998. };
  18999. t.Tf = {
  19000. id: _util.OPS.setFont,
  19001. numArgs: 2,
  19002. variableArgs: false
  19003. };
  19004. t.Tr = {
  19005. id: _util.OPS.setTextRenderingMode,
  19006. numArgs: 1,
  19007. variableArgs: false
  19008. };
  19009. t.Ts = {
  19010. id: _util.OPS.setTextRise,
  19011. numArgs: 1,
  19012. variableArgs: false
  19013. };
  19014. t.Td = {
  19015. id: _util.OPS.moveText,
  19016. numArgs: 2,
  19017. variableArgs: false
  19018. };
  19019. t.TD = {
  19020. id: _util.OPS.setLeadingMoveText,
  19021. numArgs: 2,
  19022. variableArgs: false
  19023. };
  19024. t.Tm = {
  19025. id: _util.OPS.setTextMatrix,
  19026. numArgs: 6,
  19027. variableArgs: false
  19028. };
  19029. t["T*"] = {
  19030. id: _util.OPS.nextLine,
  19031. numArgs: 0,
  19032. variableArgs: false
  19033. };
  19034. t.Tj = {
  19035. id: _util.OPS.showText,
  19036. numArgs: 1,
  19037. variableArgs: false
  19038. };
  19039. t.TJ = {
  19040. id: _util.OPS.showSpacedText,
  19041. numArgs: 1,
  19042. variableArgs: false
  19043. };
  19044. t["'"] = {
  19045. id: _util.OPS.nextLineShowText,
  19046. numArgs: 1,
  19047. variableArgs: false
  19048. };
  19049. t['"'] = {
  19050. id: _util.OPS.nextLineSetSpacingShowText,
  19051. numArgs: 3,
  19052. variableArgs: false
  19053. };
  19054. t.d0 = {
  19055. id: _util.OPS.setCharWidth,
  19056. numArgs: 2,
  19057. variableArgs: false
  19058. };
  19059. t.d1 = {
  19060. id: _util.OPS.setCharWidthAndBounds,
  19061. numArgs: 6,
  19062. variableArgs: false
  19063. };
  19064. t.CS = {
  19065. id: _util.OPS.setStrokeColorSpace,
  19066. numArgs: 1,
  19067. variableArgs: false
  19068. };
  19069. t.cs = {
  19070. id: _util.OPS.setFillColorSpace,
  19071. numArgs: 1,
  19072. variableArgs: false
  19073. };
  19074. t.SC = {
  19075. id: _util.OPS.setStrokeColor,
  19076. numArgs: 4,
  19077. variableArgs: true
  19078. };
  19079. t.SCN = {
  19080. id: _util.OPS.setStrokeColorN,
  19081. numArgs: 33,
  19082. variableArgs: true
  19083. };
  19084. t.sc = {
  19085. id: _util.OPS.setFillColor,
  19086. numArgs: 4,
  19087. variableArgs: true
  19088. };
  19089. t.scn = {
  19090. id: _util.OPS.setFillColorN,
  19091. numArgs: 33,
  19092. variableArgs: true
  19093. };
  19094. t.G = {
  19095. id: _util.OPS.setStrokeGray,
  19096. numArgs: 1,
  19097. variableArgs: false
  19098. };
  19099. t.g = {
  19100. id: _util.OPS.setFillGray,
  19101. numArgs: 1,
  19102. variableArgs: false
  19103. };
  19104. t.RG = {
  19105. id: _util.OPS.setStrokeRGBColor,
  19106. numArgs: 3,
  19107. variableArgs: false
  19108. };
  19109. t.rg = {
  19110. id: _util.OPS.setFillRGBColor,
  19111. numArgs: 3,
  19112. variableArgs: false
  19113. };
  19114. t.K = {
  19115. id: _util.OPS.setStrokeCMYKColor,
  19116. numArgs: 4,
  19117. variableArgs: false
  19118. };
  19119. t.k = {
  19120. id: _util.OPS.setFillCMYKColor,
  19121. numArgs: 4,
  19122. variableArgs: false
  19123. };
  19124. t.sh = {
  19125. id: _util.OPS.shadingFill,
  19126. numArgs: 1,
  19127. variableArgs: false
  19128. };
  19129. t.BI = {
  19130. id: _util.OPS.beginInlineImage,
  19131. numArgs: 0,
  19132. variableArgs: false
  19133. };
  19134. t.ID = {
  19135. id: _util.OPS.beginImageData,
  19136. numArgs: 0,
  19137. variableArgs: false
  19138. };
  19139. t.EI = {
  19140. id: _util.OPS.endInlineImage,
  19141. numArgs: 1,
  19142. variableArgs: false
  19143. };
  19144. t.Do = {
  19145. id: _util.OPS.paintXObject,
  19146. numArgs: 1,
  19147. variableArgs: false
  19148. };
  19149. t.MP = {
  19150. id: _util.OPS.markPoint,
  19151. numArgs: 1,
  19152. variableArgs: false
  19153. };
  19154. t.DP = {
  19155. id: _util.OPS.markPointProps,
  19156. numArgs: 2,
  19157. variableArgs: false
  19158. };
  19159. t.BMC = {
  19160. id: _util.OPS.beginMarkedContent,
  19161. numArgs: 1,
  19162. variableArgs: false
  19163. };
  19164. t.BDC = {
  19165. id: _util.OPS.beginMarkedContentProps,
  19166. numArgs: 2,
  19167. variableArgs: false
  19168. };
  19169. t.EMC = {
  19170. id: _util.OPS.endMarkedContent,
  19171. numArgs: 0,
  19172. variableArgs: false
  19173. };
  19174. t.BX = {
  19175. id: _util.OPS.beginCompat,
  19176. numArgs: 0,
  19177. variableArgs: false
  19178. };
  19179. t.EX = {
  19180. id: _util.OPS.endCompat,
  19181. numArgs: 0,
  19182. variableArgs: false
  19183. };
  19184. t.BM = null;
  19185. t.BD = null;
  19186. t.true = null;
  19187. t.fa = null;
  19188. t.fal = null;
  19189. t.fals = null;
  19190. t.false = null;
  19191. t.nu = null;
  19192. t.nul = null;
  19193. t.null = null;
  19194. });
  19195. const MAX_INVALID_PATH_OPS = 20;
  19196. function EvaluatorPreprocessor(stream, xref, stateManager) {
  19197. this.opMap = getOPMap();
  19198. this.parser = new _parser.Parser({
  19199. lexer: new _parser.Lexer(stream, this.opMap),
  19200. xref
  19201. });
  19202. this.stateManager = stateManager;
  19203. this.nonProcessedArgs = [];
  19204. this._numInvalidPathOPS = 0;
  19205. }
  19206. EvaluatorPreprocessor.prototype = {
  19207. get savedStatesDepth() {
  19208. return this.stateManager.stateStack.length;
  19209. },
  19210. read: function EvaluatorPreprocessor_read(operation) {
  19211. var args = operation.args;
  19212. while (true) {
  19213. var obj = this.parser.getObj();
  19214. if (obj instanceof _primitives.Cmd) {
  19215. var cmd = obj.cmd;
  19216. var opSpec = this.opMap[cmd];
  19217. if (!opSpec) {
  19218. (0, _util.warn)(`Unknown command "${cmd}".`);
  19219. continue;
  19220. }
  19221. var fn = opSpec.id;
  19222. var numArgs = opSpec.numArgs;
  19223. var argsLength = args !== null ? args.length : 0;
  19224. if (!opSpec.variableArgs) {
  19225. if (argsLength !== numArgs) {
  19226. var nonProcessedArgs = this.nonProcessedArgs;
  19227. while (argsLength > numArgs) {
  19228. nonProcessedArgs.push(args.shift());
  19229. argsLength--;
  19230. }
  19231. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  19232. if (args === null) {
  19233. args = [];
  19234. }
  19235. args.unshift(nonProcessedArgs.pop());
  19236. argsLength++;
  19237. }
  19238. }
  19239. if (argsLength < numArgs) {
  19240. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  19241. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > MAX_INVALID_PATH_OPS) {
  19242. throw new _util.FormatError(`Invalid ${partialMsg}`);
  19243. }
  19244. (0, _util.warn)(`Skipping ${partialMsg}`);
  19245. if (args !== null) {
  19246. args.length = 0;
  19247. }
  19248. continue;
  19249. }
  19250. } else if (argsLength > numArgs) {
  19251. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  19252. }
  19253. this.preprocessCommand(fn, args);
  19254. operation.fn = fn;
  19255. operation.args = args;
  19256. return true;
  19257. }
  19258. if (obj === _primitives.EOF) {
  19259. return false;
  19260. }
  19261. if (obj !== null) {
  19262. if (args === null) {
  19263. args = [];
  19264. }
  19265. args.push(obj);
  19266. if (args.length > 33) {
  19267. throw new _util.FormatError("Too many arguments");
  19268. }
  19269. }
  19270. }
  19271. },
  19272. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  19273. switch (fn | 0) {
  19274. case _util.OPS.save:
  19275. this.stateManager.save();
  19276. break;
  19277. case _util.OPS.restore:
  19278. this.stateManager.restore();
  19279. break;
  19280. case _util.OPS.transform:
  19281. this.stateManager.transform(args);
  19282. break;
  19283. }
  19284. }
  19285. };
  19286. return EvaluatorPreprocessor;
  19287. }();
  19288. /***/ }),
  19289. /* 28 */
  19290. /***/ (function(module, exports, __w_pdfjs_require__) {
  19291. "use strict";
  19292. Object.defineProperty(exports, "__esModule", {
  19293. value: true
  19294. });
  19295. exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0;
  19296. var _util = __w_pdfjs_require__(2);
  19297. var _primitives = __w_pdfjs_require__(5);
  19298. var _parser = __w_pdfjs_require__(11);
  19299. var _core_utils = __w_pdfjs_require__(8);
  19300. var _stream = __w_pdfjs_require__(12);
  19301. var 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"];
  19302. const MAX_MAP_RANGE = 2 ** 24 - 1;
  19303. class CMap {
  19304. constructor(builtInCMap = false) {
  19305. this.codespaceRanges = [[], [], [], []];
  19306. this.numCodespaceRanges = 0;
  19307. this._map = [];
  19308. this.name = "";
  19309. this.vertical = false;
  19310. this.useCMap = null;
  19311. this.builtInCMap = builtInCMap;
  19312. }
  19313. addCodespaceRange(n, low, high) {
  19314. this.codespaceRanges[n - 1].push(low, high);
  19315. this.numCodespaceRanges++;
  19316. }
  19317. mapCidRange(low, high, dstLow) {
  19318. if (high - low > MAX_MAP_RANGE) {
  19319. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  19320. }
  19321. while (low <= high) {
  19322. this._map[low++] = dstLow++;
  19323. }
  19324. }
  19325. mapBfRange(low, high, dstLow) {
  19326. if (high - low > MAX_MAP_RANGE) {
  19327. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  19328. }
  19329. var lastByte = dstLow.length - 1;
  19330. while (low <= high) {
  19331. this._map[low++] = dstLow;
  19332. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  19333. }
  19334. }
  19335. mapBfRangeToArray(low, high, array) {
  19336. if (high - low > MAX_MAP_RANGE) {
  19337. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  19338. }
  19339. const ii = array.length;
  19340. let i = 0;
  19341. while (low <= high && i < ii) {
  19342. this._map[low] = array[i++];
  19343. ++low;
  19344. }
  19345. }
  19346. mapOne(src, dst) {
  19347. this._map[src] = dst;
  19348. }
  19349. lookup(code) {
  19350. return this._map[code];
  19351. }
  19352. contains(code) {
  19353. return this._map[code] !== undefined;
  19354. }
  19355. forEach(callback) {
  19356. const map = this._map;
  19357. const length = map.length;
  19358. if (length <= 0x10000) {
  19359. for (let i = 0; i < length; i++) {
  19360. if (map[i] !== undefined) {
  19361. callback(i, map[i]);
  19362. }
  19363. }
  19364. } else {
  19365. for (const i in map) {
  19366. callback(i, map[i]);
  19367. }
  19368. }
  19369. }
  19370. charCodeOf(value) {
  19371. const map = this._map;
  19372. if (map.length <= 0x10000) {
  19373. return map.indexOf(value);
  19374. }
  19375. for (const charCode in map) {
  19376. if (map[charCode] === value) {
  19377. return charCode | 0;
  19378. }
  19379. }
  19380. return -1;
  19381. }
  19382. getMap() {
  19383. return this._map;
  19384. }
  19385. readCharCode(str, offset, out) {
  19386. let c = 0;
  19387. const codespaceRanges = this.codespaceRanges;
  19388. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  19389. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  19390. const codespaceRange = codespaceRanges[n];
  19391. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  19392. const low = codespaceRange[k++];
  19393. const high = codespaceRange[k++];
  19394. if (c >= low && c <= high) {
  19395. out.charcode = c;
  19396. out.length = n + 1;
  19397. return;
  19398. }
  19399. }
  19400. }
  19401. out.charcode = 0;
  19402. out.length = 1;
  19403. }
  19404. get length() {
  19405. return this._map.length;
  19406. }
  19407. get isIdentityCMap() {
  19408. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  19409. return false;
  19410. }
  19411. if (this._map.length !== 0x10000) {
  19412. return false;
  19413. }
  19414. for (let i = 0; i < 0x10000; i++) {
  19415. if (this._map[i] !== i) {
  19416. return false;
  19417. }
  19418. }
  19419. return true;
  19420. }
  19421. }
  19422. exports.CMap = CMap;
  19423. class IdentityCMap extends CMap {
  19424. constructor(vertical, n) {
  19425. super();
  19426. this.vertical = vertical;
  19427. this.addCodespaceRange(n, 0, 0xffff);
  19428. }
  19429. mapCidRange(low, high, dstLow) {
  19430. (0, _util.unreachable)("should not call mapCidRange");
  19431. }
  19432. mapBfRange(low, high, dstLow) {
  19433. (0, _util.unreachable)("should not call mapBfRange");
  19434. }
  19435. mapBfRangeToArray(low, high, array) {
  19436. (0, _util.unreachable)("should not call mapBfRangeToArray");
  19437. }
  19438. mapOne(src, dst) {
  19439. (0, _util.unreachable)("should not call mapCidOne");
  19440. }
  19441. lookup(code) {
  19442. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  19443. }
  19444. contains(code) {
  19445. return Number.isInteger(code) && code <= 0xffff;
  19446. }
  19447. forEach(callback) {
  19448. for (let i = 0; i <= 0xffff; i++) {
  19449. callback(i, i);
  19450. }
  19451. }
  19452. charCodeOf(value) {
  19453. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  19454. }
  19455. getMap() {
  19456. const map = new Array(0x10000);
  19457. for (let i = 0; i <= 0xffff; i++) {
  19458. map[i] = i;
  19459. }
  19460. return map;
  19461. }
  19462. get length() {
  19463. return 0x10000;
  19464. }
  19465. get isIdentityCMap() {
  19466. (0, _util.unreachable)("should not access .isIdentityCMap");
  19467. }
  19468. }
  19469. exports.IdentityCMap = IdentityCMap;
  19470. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  19471. function hexToInt(a, size) {
  19472. var n = 0;
  19473. for (var i = 0; i <= size; i++) {
  19474. n = n << 8 | a[i];
  19475. }
  19476. return n >>> 0;
  19477. }
  19478. function hexToStr(a, size) {
  19479. if (size === 1) {
  19480. return String.fromCharCode(a[0], a[1]);
  19481. }
  19482. if (size === 3) {
  19483. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  19484. }
  19485. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  19486. }
  19487. function addHex(a, b, size) {
  19488. var c = 0;
  19489. for (var i = size; i >= 0; i--) {
  19490. c += a[i] + b[i];
  19491. a[i] = c & 255;
  19492. c >>= 8;
  19493. }
  19494. }
  19495. function incHex(a, size) {
  19496. var c = 1;
  19497. for (var i = size; i >= 0 && c > 0; i--) {
  19498. c += a[i];
  19499. a[i] = c & 255;
  19500. c >>= 8;
  19501. }
  19502. }
  19503. var MAX_NUM_SIZE = 16;
  19504. var MAX_ENCODED_NUM_SIZE = 19;
  19505. function BinaryCMapStream(data) {
  19506. this.buffer = data;
  19507. this.pos = 0;
  19508. this.end = data.length;
  19509. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  19510. }
  19511. BinaryCMapStream.prototype = {
  19512. readByte() {
  19513. if (this.pos >= this.end) {
  19514. return -1;
  19515. }
  19516. return this.buffer[this.pos++];
  19517. },
  19518. readNumber() {
  19519. var n = 0;
  19520. var last;
  19521. do {
  19522. var b = this.readByte();
  19523. if (b < 0) {
  19524. throw new _util.FormatError("unexpected EOF in bcmap");
  19525. }
  19526. last = !(b & 0x80);
  19527. n = n << 7 | b & 0x7f;
  19528. } while (!last);
  19529. return n;
  19530. },
  19531. readSigned() {
  19532. var n = this.readNumber();
  19533. return n & 1 ? ~(n >>> 1) : n >>> 1;
  19534. },
  19535. readHex(num, size) {
  19536. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  19537. this.pos += size + 1;
  19538. },
  19539. readHexNumber(num, size) {
  19540. var last;
  19541. var stack = this.tmpBuf,
  19542. sp = 0;
  19543. do {
  19544. var b = this.readByte();
  19545. if (b < 0) {
  19546. throw new _util.FormatError("unexpected EOF in bcmap");
  19547. }
  19548. last = !(b & 0x80);
  19549. stack[sp++] = b & 0x7f;
  19550. } while (!last);
  19551. var i = size,
  19552. buffer = 0,
  19553. bufferSize = 0;
  19554. while (i >= 0) {
  19555. while (bufferSize < 8 && stack.length > 0) {
  19556. buffer = stack[--sp] << bufferSize | buffer;
  19557. bufferSize += 7;
  19558. }
  19559. num[i] = buffer & 255;
  19560. i--;
  19561. buffer >>= 8;
  19562. bufferSize -= 8;
  19563. }
  19564. },
  19565. readHexSigned(num, size) {
  19566. this.readHexNumber(num, size);
  19567. var sign = num[size] & 1 ? 255 : 0;
  19568. var c = 0;
  19569. for (var i = 0; i <= size; i++) {
  19570. c = (c & 1) << 8 | num[i];
  19571. num[i] = c >> 1 ^ sign;
  19572. }
  19573. },
  19574. readString() {
  19575. var len = this.readNumber();
  19576. var s = "";
  19577. for (var i = 0; i < len; i++) {
  19578. s += String.fromCharCode(this.readNumber());
  19579. }
  19580. return s;
  19581. }
  19582. };
  19583. function processBinaryCMap(data, cMap, extend) {
  19584. return new Promise(function (resolve, reject) {
  19585. var stream = new BinaryCMapStream(data);
  19586. var header = stream.readByte();
  19587. cMap.vertical = !!(header & 1);
  19588. var useCMap = null;
  19589. var start = new Uint8Array(MAX_NUM_SIZE);
  19590. var end = new Uint8Array(MAX_NUM_SIZE);
  19591. var char = new Uint8Array(MAX_NUM_SIZE);
  19592. var charCode = new Uint8Array(MAX_NUM_SIZE);
  19593. var tmp = new Uint8Array(MAX_NUM_SIZE);
  19594. var code;
  19595. var b;
  19596. while ((b = stream.readByte()) >= 0) {
  19597. var type = b >> 5;
  19598. if (type === 7) {
  19599. switch (b & 0x1f) {
  19600. case 0:
  19601. stream.readString();
  19602. break;
  19603. case 1:
  19604. useCMap = stream.readString();
  19605. break;
  19606. }
  19607. continue;
  19608. }
  19609. var sequence = !!(b & 0x10);
  19610. var dataSize = b & 15;
  19611. if (dataSize + 1 > MAX_NUM_SIZE) {
  19612. throw new Error("processBinaryCMap: Invalid dataSize.");
  19613. }
  19614. var ucs2DataSize = 1;
  19615. var subitemsCount = stream.readNumber();
  19616. var i;
  19617. switch (type) {
  19618. case 0:
  19619. stream.readHex(start, dataSize);
  19620. stream.readHexNumber(end, dataSize);
  19621. addHex(end, start, dataSize);
  19622. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  19623. for (i = 1; i < subitemsCount; i++) {
  19624. incHex(end, dataSize);
  19625. stream.readHexNumber(start, dataSize);
  19626. addHex(start, end, dataSize);
  19627. stream.readHexNumber(end, dataSize);
  19628. addHex(end, start, dataSize);
  19629. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  19630. }
  19631. break;
  19632. case 1:
  19633. stream.readHex(start, dataSize);
  19634. stream.readHexNumber(end, dataSize);
  19635. addHex(end, start, dataSize);
  19636. stream.readNumber();
  19637. for (i = 1; i < subitemsCount; i++) {
  19638. incHex(end, dataSize);
  19639. stream.readHexNumber(start, dataSize);
  19640. addHex(start, end, dataSize);
  19641. stream.readHexNumber(end, dataSize);
  19642. addHex(end, start, dataSize);
  19643. stream.readNumber();
  19644. }
  19645. break;
  19646. case 2:
  19647. stream.readHex(char, dataSize);
  19648. code = stream.readNumber();
  19649. cMap.mapOne(hexToInt(char, dataSize), code);
  19650. for (i = 1; i < subitemsCount; i++) {
  19651. incHex(char, dataSize);
  19652. if (!sequence) {
  19653. stream.readHexNumber(tmp, dataSize);
  19654. addHex(char, tmp, dataSize);
  19655. }
  19656. code = stream.readSigned() + (code + 1);
  19657. cMap.mapOne(hexToInt(char, dataSize), code);
  19658. }
  19659. break;
  19660. case 3:
  19661. stream.readHex(start, dataSize);
  19662. stream.readHexNumber(end, dataSize);
  19663. addHex(end, start, dataSize);
  19664. code = stream.readNumber();
  19665. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  19666. for (i = 1; i < subitemsCount; i++) {
  19667. incHex(end, dataSize);
  19668. if (!sequence) {
  19669. stream.readHexNumber(start, dataSize);
  19670. addHex(start, end, dataSize);
  19671. } else {
  19672. start.set(end);
  19673. }
  19674. stream.readHexNumber(end, dataSize);
  19675. addHex(end, start, dataSize);
  19676. code = stream.readNumber();
  19677. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  19678. }
  19679. break;
  19680. case 4:
  19681. stream.readHex(char, ucs2DataSize);
  19682. stream.readHex(charCode, dataSize);
  19683. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  19684. for (i = 1; i < subitemsCount; i++) {
  19685. incHex(char, ucs2DataSize);
  19686. if (!sequence) {
  19687. stream.readHexNumber(tmp, ucs2DataSize);
  19688. addHex(char, tmp, ucs2DataSize);
  19689. }
  19690. incHex(charCode, dataSize);
  19691. stream.readHexSigned(tmp, dataSize);
  19692. addHex(charCode, tmp, dataSize);
  19693. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  19694. }
  19695. break;
  19696. case 5:
  19697. stream.readHex(start, ucs2DataSize);
  19698. stream.readHexNumber(end, ucs2DataSize);
  19699. addHex(end, start, ucs2DataSize);
  19700. stream.readHex(charCode, dataSize);
  19701. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  19702. for (i = 1; i < subitemsCount; i++) {
  19703. incHex(end, ucs2DataSize);
  19704. if (!sequence) {
  19705. stream.readHexNumber(start, ucs2DataSize);
  19706. addHex(start, end, ucs2DataSize);
  19707. } else {
  19708. start.set(end);
  19709. }
  19710. stream.readHexNumber(end, ucs2DataSize);
  19711. addHex(end, start, ucs2DataSize);
  19712. stream.readHex(charCode, dataSize);
  19713. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  19714. }
  19715. break;
  19716. default:
  19717. reject(new Error("processBinaryCMap: Unknown type: " + type));
  19718. return;
  19719. }
  19720. }
  19721. if (useCMap) {
  19722. resolve(extend(useCMap));
  19723. return;
  19724. }
  19725. resolve(cMap);
  19726. });
  19727. }
  19728. function BinaryCMapReader() {}
  19729. BinaryCMapReader.prototype = {
  19730. process: processBinaryCMap
  19731. };
  19732. return BinaryCMapReader;
  19733. }();
  19734. var CMapFactory = function CMapFactoryClosure() {
  19735. function strToInt(str) {
  19736. var a = 0;
  19737. for (var i = 0; i < str.length; i++) {
  19738. a = a << 8 | str.charCodeAt(i);
  19739. }
  19740. return a >>> 0;
  19741. }
  19742. function expectString(obj) {
  19743. if (!(0, _util.isString)(obj)) {
  19744. throw new _util.FormatError("Malformed CMap: expected string.");
  19745. }
  19746. }
  19747. function expectInt(obj) {
  19748. if (!Number.isInteger(obj)) {
  19749. throw new _util.FormatError("Malformed CMap: expected int.");
  19750. }
  19751. }
  19752. function parseBfChar(cMap, lexer) {
  19753. while (true) {
  19754. var obj = lexer.getObj();
  19755. if ((0, _primitives.isEOF)(obj)) {
  19756. break;
  19757. }
  19758. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  19759. return;
  19760. }
  19761. expectString(obj);
  19762. var src = strToInt(obj);
  19763. obj = lexer.getObj();
  19764. expectString(obj);
  19765. var dst = obj;
  19766. cMap.mapOne(src, dst);
  19767. }
  19768. }
  19769. function parseBfRange(cMap, lexer) {
  19770. while (true) {
  19771. var obj = lexer.getObj();
  19772. if ((0, _primitives.isEOF)(obj)) {
  19773. break;
  19774. }
  19775. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  19776. return;
  19777. }
  19778. expectString(obj);
  19779. var low = strToInt(obj);
  19780. obj = lexer.getObj();
  19781. expectString(obj);
  19782. var high = strToInt(obj);
  19783. obj = lexer.getObj();
  19784. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  19785. var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  19786. cMap.mapBfRange(low, high, dstLow);
  19787. } else if ((0, _primitives.isCmd)(obj, "[")) {
  19788. obj = lexer.getObj();
  19789. var array = [];
  19790. while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
  19791. array.push(obj);
  19792. obj = lexer.getObj();
  19793. }
  19794. cMap.mapBfRangeToArray(low, high, array);
  19795. } else {
  19796. break;
  19797. }
  19798. }
  19799. throw new _util.FormatError("Invalid bf range.");
  19800. }
  19801. function parseCidChar(cMap, lexer) {
  19802. while (true) {
  19803. var obj = lexer.getObj();
  19804. if ((0, _primitives.isEOF)(obj)) {
  19805. break;
  19806. }
  19807. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  19808. return;
  19809. }
  19810. expectString(obj);
  19811. var src = strToInt(obj);
  19812. obj = lexer.getObj();
  19813. expectInt(obj);
  19814. var dst = obj;
  19815. cMap.mapOne(src, dst);
  19816. }
  19817. }
  19818. function parseCidRange(cMap, lexer) {
  19819. while (true) {
  19820. var obj = lexer.getObj();
  19821. if ((0, _primitives.isEOF)(obj)) {
  19822. break;
  19823. }
  19824. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  19825. return;
  19826. }
  19827. expectString(obj);
  19828. var low = strToInt(obj);
  19829. obj = lexer.getObj();
  19830. expectString(obj);
  19831. var high = strToInt(obj);
  19832. obj = lexer.getObj();
  19833. expectInt(obj);
  19834. var dstLow = obj;
  19835. cMap.mapCidRange(low, high, dstLow);
  19836. }
  19837. }
  19838. function parseCodespaceRange(cMap, lexer) {
  19839. while (true) {
  19840. var obj = lexer.getObj();
  19841. if ((0, _primitives.isEOF)(obj)) {
  19842. break;
  19843. }
  19844. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  19845. return;
  19846. }
  19847. if (!(0, _util.isString)(obj)) {
  19848. break;
  19849. }
  19850. var low = strToInt(obj);
  19851. obj = lexer.getObj();
  19852. if (!(0, _util.isString)(obj)) {
  19853. break;
  19854. }
  19855. var high = strToInt(obj);
  19856. cMap.addCodespaceRange(obj.length, low, high);
  19857. }
  19858. throw new _util.FormatError("Invalid codespace range.");
  19859. }
  19860. function parseWMode(cMap, lexer) {
  19861. var obj = lexer.getObj();
  19862. if (Number.isInteger(obj)) {
  19863. cMap.vertical = !!obj;
  19864. }
  19865. }
  19866. function parseCMapName(cMap, lexer) {
  19867. var obj = lexer.getObj();
  19868. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  19869. cMap.name = obj.name;
  19870. }
  19871. }
  19872. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  19873. var previous;
  19874. var embeddedUseCMap;
  19875. objLoop: while (true) {
  19876. try {
  19877. var obj = lexer.getObj();
  19878. if ((0, _primitives.isEOF)(obj)) {
  19879. break;
  19880. } else if ((0, _primitives.isName)(obj)) {
  19881. if (obj.name === "WMode") {
  19882. parseWMode(cMap, lexer);
  19883. } else if (obj.name === "CMapName") {
  19884. parseCMapName(cMap, lexer);
  19885. }
  19886. previous = obj;
  19887. } else if ((0, _primitives.isCmd)(obj)) {
  19888. switch (obj.cmd) {
  19889. case "endcmap":
  19890. break objLoop;
  19891. case "usecmap":
  19892. if ((0, _primitives.isName)(previous)) {
  19893. embeddedUseCMap = previous.name;
  19894. }
  19895. break;
  19896. case "begincodespacerange":
  19897. parseCodespaceRange(cMap, lexer);
  19898. break;
  19899. case "beginbfchar":
  19900. parseBfChar(cMap, lexer);
  19901. break;
  19902. case "begincidchar":
  19903. parseCidChar(cMap, lexer);
  19904. break;
  19905. case "beginbfrange":
  19906. parseBfRange(cMap, lexer);
  19907. break;
  19908. case "begincidrange":
  19909. parseCidRange(cMap, lexer);
  19910. break;
  19911. }
  19912. }
  19913. } catch (ex) {
  19914. if (ex instanceof _core_utils.MissingDataException) {
  19915. throw ex;
  19916. }
  19917. (0, _util.warn)("Invalid cMap data: " + ex);
  19918. continue;
  19919. }
  19920. }
  19921. if (!useCMap && embeddedUseCMap) {
  19922. useCMap = embeddedUseCMap;
  19923. }
  19924. if (useCMap) {
  19925. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  19926. }
  19927. return Promise.resolve(cMap);
  19928. }
  19929. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  19930. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  19931. cMap.useCMap = newCMap;
  19932. if (cMap.numCodespaceRanges === 0) {
  19933. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  19934. for (var i = 0; i < useCodespaceRanges.length; i++) {
  19935. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  19936. }
  19937. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  19938. }
  19939. cMap.useCMap.forEach(function (key, value) {
  19940. if (!cMap.contains(key)) {
  19941. cMap.mapOne(key, cMap.useCMap.lookup(key));
  19942. }
  19943. });
  19944. return cMap;
  19945. });
  19946. }
  19947. function createBuiltInCMap(name, fetchBuiltInCMap) {
  19948. if (name === "Identity-H") {
  19949. return Promise.resolve(new IdentityCMap(false, 2));
  19950. } else if (name === "Identity-V") {
  19951. return Promise.resolve(new IdentityCMap(true, 2));
  19952. }
  19953. if (!BUILT_IN_CMAPS.includes(name)) {
  19954. return Promise.reject(new Error("Unknown CMap name: " + name));
  19955. }
  19956. if (!fetchBuiltInCMap) {
  19957. return Promise.reject(new Error("Built-in CMap parameters are not provided."));
  19958. }
  19959. return fetchBuiltInCMap(name).then(function (data) {
  19960. var cMapData = data.cMapData,
  19961. compressionType = data.compressionType;
  19962. var cMap = new CMap(true);
  19963. if (compressionType === _util.CMapCompressionType.BINARY) {
  19964. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  19965. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  19966. });
  19967. }
  19968. if (compressionType === _util.CMapCompressionType.NONE) {
  19969. var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  19970. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  19971. }
  19972. return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported."));
  19973. });
  19974. }
  19975. return {
  19976. async create(params) {
  19977. var encoding = params.encoding;
  19978. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  19979. var useCMap = params.useCMap;
  19980. if ((0, _primitives.isName)(encoding)) {
  19981. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  19982. } else if ((0, _primitives.isStream)(encoding)) {
  19983. var cMap = new CMap();
  19984. var lexer = new _parser.Lexer(encoding);
  19985. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  19986. if (parsedCMap.isIdentityCMap) {
  19987. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  19988. }
  19989. return parsedCMap;
  19990. });
  19991. }
  19992. throw new Error("Encoding required.");
  19993. }
  19994. };
  19995. }();
  19996. exports.CMapFactory = CMapFactory;
  19997. /***/ }),
  19998. /* 29 */
  19999. /***/ (function(module, exports, __w_pdfjs_require__) {
  20000. "use strict";
  20001. Object.defineProperty(exports, "__esModule", {
  20002. value: true
  20003. });
  20004. exports.getFontType = getFontType;
  20005. exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0;
  20006. var _util = __w_pdfjs_require__(2);
  20007. var _cff_parser = __w_pdfjs_require__(30);
  20008. var _glyphlist = __w_pdfjs_require__(33);
  20009. var _encodings = __w_pdfjs_require__(32);
  20010. var _standard_fonts = __w_pdfjs_require__(34);
  20011. var _unicode = __w_pdfjs_require__(35);
  20012. var _core_utils = __w_pdfjs_require__(8);
  20013. var _font_renderer = __w_pdfjs_require__(36);
  20014. var _cmap = __w_pdfjs_require__(28);
  20015. var _stream = __w_pdfjs_require__(12);
  20016. var _type1_parser = __w_pdfjs_require__(37);
  20017. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  20018. var PDF_GLYPH_SPACE_UNITS = 1000;
  20019. var SEAC_ANALYSIS_ENABLED = true;
  20020. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  20021. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isMonospace", "isSerifFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  20022. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  20023. var FontFlags = {
  20024. FixedPitch: 1,
  20025. Serif: 2,
  20026. Symbolic: 4,
  20027. Script: 8,
  20028. Nonsymbolic: 32,
  20029. Italic: 64,
  20030. AllCap: 65536,
  20031. SmallCap: 131072,
  20032. ForceBold: 262144
  20033. };
  20034. exports.FontFlags = FontFlags;
  20035. var 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"];
  20036. function adjustWidths(properties) {
  20037. if (!properties.fontMatrix) {
  20038. return;
  20039. }
  20040. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  20041. return;
  20042. }
  20043. var scale = 0.001 / properties.fontMatrix[0];
  20044. var glyphsWidths = properties.widths;
  20045. for (var glyph in glyphsWidths) {
  20046. glyphsWidths[glyph] *= scale;
  20047. }
  20048. properties.defaultWidth *= scale;
  20049. }
  20050. function adjustToUnicode(properties, builtInEncoding) {
  20051. if (properties.hasIncludedToUnicodeMap) {
  20052. return;
  20053. }
  20054. if (properties.hasEncoding) {
  20055. return;
  20056. }
  20057. if (builtInEncoding === properties.defaultEncoding) {
  20058. return;
  20059. }
  20060. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  20061. return;
  20062. }
  20063. var toUnicode = [],
  20064. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20065. for (var charCode in builtInEncoding) {
  20066. var glyphName = builtInEncoding[charCode];
  20067. var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20068. if (unicode !== -1) {
  20069. toUnicode[charCode] = String.fromCharCode(unicode);
  20070. }
  20071. }
  20072. properties.toUnicode.amend(toUnicode);
  20073. }
  20074. function getFontType(type, subtype) {
  20075. switch (type) {
  20076. case "Type1":
  20077. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  20078. case "CIDFontType0":
  20079. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  20080. case "OpenType":
  20081. return _util.FontType.OPENTYPE;
  20082. case "TrueType":
  20083. return _util.FontType.TRUETYPE;
  20084. case "CIDFontType2":
  20085. return _util.FontType.CIDFONTTYPE2;
  20086. case "MMType1":
  20087. return _util.FontType.MMTYPE1;
  20088. case "Type0":
  20089. return _util.FontType.TYPE0;
  20090. default:
  20091. return _util.FontType.UNKNOWN;
  20092. }
  20093. }
  20094. function recoverGlyphName(name, glyphsUnicodeMap) {
  20095. if (glyphsUnicodeMap[name] !== undefined) {
  20096. return name;
  20097. }
  20098. var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  20099. if (unicode !== -1) {
  20100. for (var key in glyphsUnicodeMap) {
  20101. if (glyphsUnicodeMap[key] === unicode) {
  20102. return key;
  20103. }
  20104. }
  20105. }
  20106. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  20107. return name;
  20108. }
  20109. var Glyph = function GlyphClosure() {
  20110. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20111. this.fontChar = fontChar;
  20112. this.unicode = unicode;
  20113. this.accent = accent;
  20114. this.width = width;
  20115. this.vmetric = vmetric;
  20116. this.operatorListId = operatorListId;
  20117. this.isSpace = isSpace;
  20118. this.isInFont = isInFont;
  20119. }
  20120. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  20121. 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;
  20122. };
  20123. return Glyph;
  20124. }();
  20125. var ToUnicodeMap = function ToUnicodeMapClosure() {
  20126. function ToUnicodeMap(cmap = []) {
  20127. this._map = cmap;
  20128. }
  20129. ToUnicodeMap.prototype = {
  20130. get length() {
  20131. return this._map.length;
  20132. },
  20133. forEach(callback) {
  20134. for (var charCode in this._map) {
  20135. callback(charCode, this._map[charCode].charCodeAt(0));
  20136. }
  20137. },
  20138. has(i) {
  20139. return this._map[i] !== undefined;
  20140. },
  20141. get(i) {
  20142. return this._map[i];
  20143. },
  20144. charCodeOf(value) {
  20145. const map = this._map;
  20146. if (map.length <= 0x10000) {
  20147. return map.indexOf(value);
  20148. }
  20149. for (const charCode in map) {
  20150. if (map[charCode] === value) {
  20151. return charCode | 0;
  20152. }
  20153. }
  20154. return -1;
  20155. },
  20156. amend(map) {
  20157. for (var charCode in map) {
  20158. this._map[charCode] = map[charCode];
  20159. }
  20160. }
  20161. };
  20162. return ToUnicodeMap;
  20163. }();
  20164. exports.ToUnicodeMap = ToUnicodeMap;
  20165. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  20166. function IdentityToUnicodeMap(firstChar, lastChar) {
  20167. this.firstChar = firstChar;
  20168. this.lastChar = lastChar;
  20169. }
  20170. IdentityToUnicodeMap.prototype = {
  20171. get length() {
  20172. return this.lastChar + 1 - this.firstChar;
  20173. },
  20174. forEach(callback) {
  20175. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  20176. callback(i, i);
  20177. }
  20178. },
  20179. has(i) {
  20180. return this.firstChar <= i && i <= this.lastChar;
  20181. },
  20182. get(i) {
  20183. if (this.firstChar <= i && i <= this.lastChar) {
  20184. return String.fromCharCode(i);
  20185. }
  20186. return undefined;
  20187. },
  20188. charCodeOf(v) {
  20189. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  20190. },
  20191. amend(map) {
  20192. (0, _util.unreachable)("Should not call amend()");
  20193. }
  20194. };
  20195. return IdentityToUnicodeMap;
  20196. }();
  20197. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  20198. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  20199. function writeInt16(dest, offset, num) {
  20200. dest[offset] = num >> 8 & 0xff;
  20201. dest[offset + 1] = num & 0xff;
  20202. }
  20203. function writeInt32(dest, offset, num) {
  20204. dest[offset] = num >> 24 & 0xff;
  20205. dest[offset + 1] = num >> 16 & 0xff;
  20206. dest[offset + 2] = num >> 8 & 0xff;
  20207. dest[offset + 3] = num & 0xff;
  20208. }
  20209. function writeData(dest, offset, data) {
  20210. var i, ii;
  20211. if (data instanceof Uint8Array) {
  20212. dest.set(data, offset);
  20213. } else if (typeof data === "string") {
  20214. for (i = 0, ii = data.length; i < ii; i++) {
  20215. dest[offset++] = data.charCodeAt(i) & 0xff;
  20216. }
  20217. } else {
  20218. for (i = 0, ii = data.length; i < ii; i++) {
  20219. dest[offset++] = data[i] & 0xff;
  20220. }
  20221. }
  20222. }
  20223. function OpenTypeFileBuilder(sfnt) {
  20224. this.sfnt = sfnt;
  20225. this.tables = Object.create(null);
  20226. }
  20227. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  20228. var maxPower2 = 1,
  20229. log2 = 0;
  20230. while ((maxPower2 ^ entriesCount) > maxPower2) {
  20231. maxPower2 <<= 1;
  20232. log2++;
  20233. }
  20234. var searchRange = maxPower2 * entrySize;
  20235. return {
  20236. range: searchRange,
  20237. entry: log2,
  20238. rangeShift: entrySize * entriesCount - searchRange
  20239. };
  20240. };
  20241. var OTF_HEADER_SIZE = 12;
  20242. var OTF_TABLE_ENTRY_SIZE = 16;
  20243. OpenTypeFileBuilder.prototype = {
  20244. toArray: function OpenTypeFileBuilder_toArray() {
  20245. var sfnt = this.sfnt;
  20246. var tables = this.tables;
  20247. var tablesNames = Object.keys(tables);
  20248. tablesNames.sort();
  20249. var numTables = tablesNames.length;
  20250. var i, j, jj, table, tableName;
  20251. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  20252. var tableOffsets = [offset];
  20253. for (i = 0; i < numTables; i++) {
  20254. table = tables[tablesNames[i]];
  20255. var paddedLength = (table.length + 3 & ~3) >>> 0;
  20256. offset += paddedLength;
  20257. tableOffsets.push(offset);
  20258. }
  20259. var file = new Uint8Array(offset);
  20260. for (i = 0; i < numTables; i++) {
  20261. table = tables[tablesNames[i]];
  20262. writeData(file, tableOffsets[i], table);
  20263. }
  20264. if (sfnt === "true") {
  20265. sfnt = (0, _util.string32)(0x00010000);
  20266. }
  20267. file[0] = sfnt.charCodeAt(0) & 0xff;
  20268. file[1] = sfnt.charCodeAt(1) & 0xff;
  20269. file[2] = sfnt.charCodeAt(2) & 0xff;
  20270. file[3] = sfnt.charCodeAt(3) & 0xff;
  20271. writeInt16(file, 4, numTables);
  20272. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  20273. writeInt16(file, 6, searchParams.range);
  20274. writeInt16(file, 8, searchParams.entry);
  20275. writeInt16(file, 10, searchParams.rangeShift);
  20276. offset = OTF_HEADER_SIZE;
  20277. for (i = 0; i < numTables; i++) {
  20278. tableName = tablesNames[i];
  20279. file[offset] = tableName.charCodeAt(0) & 0xff;
  20280. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  20281. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  20282. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  20283. var checksum = 0;
  20284. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  20285. var quad = (0, _core_utils.readUint32)(file, j);
  20286. checksum = checksum + quad >>> 0;
  20287. }
  20288. writeInt32(file, offset + 4, checksum);
  20289. writeInt32(file, offset + 8, tableOffsets[i]);
  20290. writeInt32(file, offset + 12, tables[tableName].length);
  20291. offset += OTF_TABLE_ENTRY_SIZE;
  20292. }
  20293. return file;
  20294. },
  20295. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  20296. if (tag in this.tables) {
  20297. throw new Error("Table " + tag + " already exists");
  20298. }
  20299. this.tables[tag] = data;
  20300. }
  20301. };
  20302. return OpenTypeFileBuilder;
  20303. }();
  20304. var Font = function FontClosure() {
  20305. function Font(name, file, properties) {
  20306. var charCode;
  20307. this.name = name;
  20308. this.loadedName = properties.loadedName;
  20309. this.isType3Font = properties.isType3Font;
  20310. this.missingFile = false;
  20311. this.glyphCache = Object.create(null);
  20312. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  20313. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  20314. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  20315. var type = properties.type;
  20316. var subtype = properties.subtype;
  20317. this.type = type;
  20318. this.subtype = subtype;
  20319. let fallbackName = "sans-serif";
  20320. if (this.isMonospace) {
  20321. fallbackName = "monospace";
  20322. } else if (this.isSerifFont) {
  20323. fallbackName = "serif";
  20324. }
  20325. this.fallbackName = fallbackName;
  20326. this.differences = properties.differences;
  20327. this.widths = properties.widths;
  20328. this.defaultWidth = properties.defaultWidth;
  20329. this.composite = properties.composite;
  20330. this.cMap = properties.cMap;
  20331. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  20332. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  20333. this.fontMatrix = properties.fontMatrix;
  20334. this.bbox = properties.bbox;
  20335. this.defaultEncoding = properties.defaultEncoding;
  20336. this.toUnicode = properties.toUnicode;
  20337. this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
  20338. this.toFontChar = [];
  20339. if (properties.type === "Type3") {
  20340. for (charCode = 0; charCode < 256; charCode++) {
  20341. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  20342. }
  20343. this.fontType = _util.FontType.TYPE3;
  20344. return;
  20345. }
  20346. this.cidEncoding = properties.cidEncoding;
  20347. this.vertical = !!properties.vertical;
  20348. if (this.vertical) {
  20349. this.vmetrics = properties.vmetrics;
  20350. this.defaultVMetrics = properties.defaultVMetrics;
  20351. }
  20352. if (!file || file.isEmpty) {
  20353. if (file) {
  20354. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  20355. }
  20356. this.fallbackToSystemFont();
  20357. return;
  20358. }
  20359. [type, subtype] = getFontFileType(file, properties);
  20360. if (type !== this.type || subtype !== this.subtype) {
  20361. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  20362. }
  20363. try {
  20364. var data;
  20365. switch (type) {
  20366. case "MMType1":
  20367. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  20368. case "Type1":
  20369. case "CIDFontType0":
  20370. this.mimetype = "font/opentype";
  20371. var cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  20372. adjustWidths(properties);
  20373. data = this.convert(name, cff, properties);
  20374. break;
  20375. case "OpenType":
  20376. case "TrueType":
  20377. case "CIDFontType2":
  20378. this.mimetype = "font/opentype";
  20379. data = this.checkAndRepair(name, file, properties);
  20380. if (this.isOpenType) {
  20381. adjustWidths(properties);
  20382. type = "OpenType";
  20383. }
  20384. break;
  20385. default:
  20386. throw new _util.FormatError(`Font ${type} is not supported`);
  20387. }
  20388. } catch (e) {
  20389. (0, _util.warn)(e);
  20390. this.fallbackToSystemFont();
  20391. return;
  20392. }
  20393. this.data = data;
  20394. this.fontType = getFontType(type, subtype);
  20395. this.fontMatrix = properties.fontMatrix;
  20396. this.widths = properties.widths;
  20397. this.defaultWidth = properties.defaultWidth;
  20398. this.toUnicode = properties.toUnicode;
  20399. this.seacMap = properties.seacMap;
  20400. }
  20401. Font.getFontID = function () {
  20402. var ID = 1;
  20403. return function Font_getFontID() {
  20404. return String(ID++);
  20405. };
  20406. }();
  20407. function int16(b0, b1) {
  20408. return (b0 << 8) + b1;
  20409. }
  20410. function writeSignedInt16(bytes, index, value) {
  20411. bytes[index + 1] = value;
  20412. bytes[index] = value >>> 8;
  20413. }
  20414. function signedInt16(b0, b1) {
  20415. var value = (b0 << 8) + b1;
  20416. return value & 1 << 15 ? value - 0x10000 : value;
  20417. }
  20418. function int32(b0, b1, b2, b3) {
  20419. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  20420. }
  20421. function string16(value) {
  20422. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20423. }
  20424. function safeString16(value) {
  20425. if (value > 0x7fff) {
  20426. value = 0x7fff;
  20427. } else if (value < -0x8000) {
  20428. value = -0x8000;
  20429. }
  20430. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  20431. }
  20432. function isTrueTypeFile(file) {
  20433. var header = file.peekBytes(4);
  20434. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  20435. }
  20436. function isTrueTypeCollectionFile(file) {
  20437. const header = file.peekBytes(4);
  20438. return (0, _util.bytesToString)(header) === "ttcf";
  20439. }
  20440. function isOpenTypeFile(file) {
  20441. var header = file.peekBytes(4);
  20442. return (0, _util.bytesToString)(header) === "OTTO";
  20443. }
  20444. function isType1File(file) {
  20445. var header = file.peekBytes(2);
  20446. if (header[0] === 0x25 && header[1] === 0x21) {
  20447. return true;
  20448. }
  20449. if (header[0] === 0x80 && header[1] === 0x01) {
  20450. return true;
  20451. }
  20452. return false;
  20453. }
  20454. function isCFFFile(file) {
  20455. const header = file.peekBytes(4);
  20456. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  20457. return true;
  20458. }
  20459. return false;
  20460. }
  20461. function getFontFileType(file, {
  20462. type,
  20463. subtype,
  20464. composite
  20465. }) {
  20466. let fileType, fileSubtype;
  20467. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  20468. if (composite) {
  20469. fileType = "CIDFontType2";
  20470. } else {
  20471. fileType = "TrueType";
  20472. }
  20473. } else if (isOpenTypeFile(file)) {
  20474. if (composite) {
  20475. fileType = "CIDFontType2";
  20476. } else {
  20477. fileType = "OpenType";
  20478. }
  20479. } else if (isType1File(file)) {
  20480. if (composite) {
  20481. fileType = "CIDFontType0";
  20482. } else {
  20483. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20484. }
  20485. } else if (isCFFFile(file)) {
  20486. if (composite) {
  20487. fileType = "CIDFontType0";
  20488. fileSubtype = "CIDFontType0C";
  20489. } else {
  20490. fileType = type === "MMType1" ? "MMType1" : "Type1";
  20491. fileSubtype = "Type1C";
  20492. }
  20493. } else {
  20494. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  20495. fileType = type;
  20496. fileSubtype = subtype;
  20497. }
  20498. return [fileType, fileSubtype];
  20499. }
  20500. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  20501. var toFontChar = [],
  20502. unicode;
  20503. for (var i = 0, ii = encoding.length; i < ii; i++) {
  20504. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  20505. if (unicode !== -1) {
  20506. toFontChar[i] = unicode;
  20507. }
  20508. }
  20509. for (var charCode in differences) {
  20510. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  20511. if (unicode !== -1) {
  20512. toFontChar[+charCode] = unicode;
  20513. }
  20514. }
  20515. return toFontChar;
  20516. }
  20517. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  20518. var newMap = Object.create(null);
  20519. var toFontChar = [];
  20520. var privateUseAreaIndex = 0;
  20521. var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20522. var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20523. for (var originalCharCode in charCodeToGlyphId) {
  20524. originalCharCode |= 0;
  20525. var glyphId = charCodeToGlyphId[originalCharCode];
  20526. if (!hasGlyph(glyphId)) {
  20527. continue;
  20528. }
  20529. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  20530. privateUseAreaIndex++;
  20531. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  20532. (0, _util.warn)("Ran out of space in font private use area.");
  20533. break;
  20534. }
  20535. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  20536. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  20537. }
  20538. var fontCharCode = nextAvailableFontCharCode++;
  20539. if (glyphId === 0) {
  20540. glyphId = newGlyphZeroId;
  20541. }
  20542. newMap[fontCharCode] = glyphId;
  20543. toFontChar[originalCharCode] = fontCharCode;
  20544. }
  20545. return {
  20546. toFontChar,
  20547. charCodeToGlyphId: newMap,
  20548. nextAvailableFontCharCode
  20549. };
  20550. }
  20551. function getRanges(glyphs, numGlyphs) {
  20552. var codes = [];
  20553. for (var charCode in glyphs) {
  20554. if (glyphs[charCode] >= numGlyphs) {
  20555. continue;
  20556. }
  20557. codes.push({
  20558. fontCharCode: charCode | 0,
  20559. glyphId: glyphs[charCode]
  20560. });
  20561. }
  20562. if (codes.length === 0) {
  20563. codes.push({
  20564. fontCharCode: 0,
  20565. glyphId: 0
  20566. });
  20567. }
  20568. codes.sort(function fontGetRangesSort(a, b) {
  20569. return a.fontCharCode - b.fontCharCode;
  20570. });
  20571. var ranges = [];
  20572. var length = codes.length;
  20573. for (var n = 0; n < length;) {
  20574. var start = codes[n].fontCharCode;
  20575. var codeIndices = [codes[n].glyphId];
  20576. ++n;
  20577. var end = start;
  20578. while (n < length && end + 1 === codes[n].fontCharCode) {
  20579. codeIndices.push(codes[n].glyphId);
  20580. ++end;
  20581. ++n;
  20582. if (end === 0xffff) {
  20583. break;
  20584. }
  20585. }
  20586. ranges.push([start, end, codeIndices]);
  20587. }
  20588. return ranges;
  20589. }
  20590. function createCmapTable(glyphs, numGlyphs) {
  20591. var ranges = getRanges(glyphs, numGlyphs);
  20592. var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  20593. var cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  20594. var i, ii, j, jj;
  20595. for (i = ranges.length - 1; i >= 0; --i) {
  20596. if (ranges[i][0] <= 0xffff) {
  20597. break;
  20598. }
  20599. }
  20600. var bmpLength = i + 1;
  20601. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  20602. ranges[i][1] = 0xfffe;
  20603. }
  20604. var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  20605. var segCount = bmpLength + trailingRangesCount;
  20606. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  20607. var startCount = "";
  20608. var endCount = "";
  20609. var idDeltas = "";
  20610. var idRangeOffsets = "";
  20611. var glyphsIds = "";
  20612. var bias = 0;
  20613. var range, start, end, codes;
  20614. for (i = 0, ii = bmpLength; i < ii; i++) {
  20615. range = ranges[i];
  20616. start = range[0];
  20617. end = range[1];
  20618. startCount += string16(start);
  20619. endCount += string16(end);
  20620. codes = range[2];
  20621. var contiguous = true;
  20622. for (j = 1, jj = codes.length; j < jj; ++j) {
  20623. if (codes[j] !== codes[j - 1] + 1) {
  20624. contiguous = false;
  20625. break;
  20626. }
  20627. }
  20628. if (!contiguous) {
  20629. var offset = (segCount - i) * 2 + bias * 2;
  20630. bias += end - start + 1;
  20631. idDeltas += string16(0);
  20632. idRangeOffsets += string16(offset);
  20633. for (j = 0, jj = codes.length; j < jj; ++j) {
  20634. glyphsIds += string16(codes[j]);
  20635. }
  20636. } else {
  20637. var startCode = codes[0];
  20638. idDeltas += string16(startCode - start & 0xffff);
  20639. idRangeOffsets += string16(0);
  20640. }
  20641. }
  20642. if (trailingRangesCount > 0) {
  20643. endCount += "\xFF\xFF";
  20644. startCount += "\xFF\xFF";
  20645. idDeltas += "\x00\x01";
  20646. idRangeOffsets += "\x00\x00";
  20647. }
  20648. var format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  20649. var format31012 = "";
  20650. var header31012 = "";
  20651. if (numTables > 1) {
  20652. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  20653. format31012 = "";
  20654. for (i = 0, ii = ranges.length; i < ii; i++) {
  20655. range = ranges[i];
  20656. start = range[0];
  20657. codes = range[2];
  20658. var code = codes[0];
  20659. for (j = 1, jj = codes.length; j < jj; ++j) {
  20660. if (codes[j] !== codes[j - 1] + 1) {
  20661. end = range[0] + j - 1;
  20662. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  20663. start = end + 1;
  20664. code = codes[j];
  20665. }
  20666. }
  20667. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  20668. }
  20669. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  20670. }
  20671. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  20672. }
  20673. function validateOS2Table(os2, file) {
  20674. file.pos = (file.start || 0) + os2.offset;
  20675. var version = file.getUint16();
  20676. file.skip(60);
  20677. var selection = file.getUint16();
  20678. if (version < 4 && selection & 0x0300) {
  20679. return false;
  20680. }
  20681. var firstChar = file.getUint16();
  20682. var lastChar = file.getUint16();
  20683. if (firstChar > lastChar) {
  20684. return false;
  20685. }
  20686. file.skip(6);
  20687. var usWinAscent = file.getUint16();
  20688. if (usWinAscent === 0) {
  20689. return false;
  20690. }
  20691. os2.data[8] = os2.data[9] = 0;
  20692. return true;
  20693. }
  20694. function createOS2Table(properties, charstrings, override) {
  20695. override = override || {
  20696. unitsPerEm: 0,
  20697. yMax: 0,
  20698. yMin: 0,
  20699. ascent: 0,
  20700. descent: 0
  20701. };
  20702. var ulUnicodeRange1 = 0;
  20703. var ulUnicodeRange2 = 0;
  20704. var ulUnicodeRange3 = 0;
  20705. var ulUnicodeRange4 = 0;
  20706. var firstCharIndex = null;
  20707. var lastCharIndex = 0;
  20708. if (charstrings) {
  20709. for (var code in charstrings) {
  20710. code |= 0;
  20711. if (firstCharIndex > code || !firstCharIndex) {
  20712. firstCharIndex = code;
  20713. }
  20714. if (lastCharIndex < code) {
  20715. lastCharIndex = code;
  20716. }
  20717. var position = (0, _unicode.getUnicodeRangeFor)(code);
  20718. if (position < 32) {
  20719. ulUnicodeRange1 |= 1 << position;
  20720. } else if (position < 64) {
  20721. ulUnicodeRange2 |= 1 << position - 32;
  20722. } else if (position < 96) {
  20723. ulUnicodeRange3 |= 1 << position - 64;
  20724. } else if (position < 123) {
  20725. ulUnicodeRange4 |= 1 << position - 96;
  20726. } else {
  20727. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  20728. }
  20729. }
  20730. if (lastCharIndex > 0xffff) {
  20731. lastCharIndex = 0xffff;
  20732. }
  20733. } else {
  20734. firstCharIndex = 0;
  20735. lastCharIndex = 255;
  20736. }
  20737. var bbox = properties.bbox || [0, 0, 0, 0];
  20738. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  20739. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  20740. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  20741. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  20742. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  20743. typoDescent = -typoDescent;
  20744. }
  20745. var winAscent = override.yMax || typoAscent;
  20746. var winDescent = -override.yMin || -typoDescent;
  20747. 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";
  20748. }
  20749. function createPostTable(properties) {
  20750. var angle = Math.floor(properties.italicAngle * 2 ** 16);
  20751. 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";
  20752. }
  20753. function createNameTable(name, proto) {
  20754. if (!proto) {
  20755. proto = [[], []];
  20756. }
  20757. var 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] || "", proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  20758. var stringsUnicode = [];
  20759. var i, ii, j, jj, str;
  20760. for (i = 0, ii = strings.length; i < ii; i++) {
  20761. str = proto[1][i] || strings[i];
  20762. var strBufUnicode = [];
  20763. for (j = 0, jj = str.length; j < jj; j++) {
  20764. strBufUnicode.push(string16(str.charCodeAt(j)));
  20765. }
  20766. stringsUnicode.push(strBufUnicode.join(""));
  20767. }
  20768. var names = [strings, stringsUnicode];
  20769. var platforms = ["\x00\x01", "\x00\x03"];
  20770. var encodings = ["\x00\x00", "\x00\x01"];
  20771. var languages = ["\x00\x00", "\x04\x09"];
  20772. var namesRecordCount = strings.length * platforms.length;
  20773. var nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  20774. var strOffset = 0;
  20775. for (i = 0, ii = platforms.length; i < ii; i++) {
  20776. var strs = names[i];
  20777. for (j = 0, jj = strs.length; j < jj; j++) {
  20778. str = strs[j];
  20779. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  20780. nameTable += nameRecord;
  20781. strOffset += str.length;
  20782. }
  20783. }
  20784. nameTable += strings.join("") + stringsUnicode.join("");
  20785. return nameTable;
  20786. }
  20787. Font.prototype = {
  20788. name: null,
  20789. font: null,
  20790. mimetype: null,
  20791. disableFontFace: false,
  20792. get renderer() {
  20793. var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  20794. return (0, _util.shadow)(this, "renderer", renderer);
  20795. },
  20796. exportData(extraProperties = false) {
  20797. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  20798. const data = Object.create(null);
  20799. let property, value;
  20800. for (property of exportDataProperties) {
  20801. value = this[property];
  20802. if (value !== undefined) {
  20803. data[property] = value;
  20804. }
  20805. }
  20806. return data;
  20807. },
  20808. fallbackToSystemFont: function Font_fallbackToSystemFont() {
  20809. this.missingFile = true;
  20810. var name = this.name;
  20811. var type = this.type;
  20812. var subtype = this.subtype;
  20813. let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
  20814. var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  20815. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  20816. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  20817. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  20818. this.bold = fontName.search(/bold/gi) !== -1;
  20819. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  20820. this.black = name.search(/Black/g) !== -1;
  20821. this.remeasure = Object.keys(this.widths).length > 0;
  20822. if (isStandardFont && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  20823. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  20824. const map = [];
  20825. for (const charCode in GlyphMapForStandardFonts) {
  20826. map[+charCode] = GlyphMapForStandardFonts[charCode];
  20827. }
  20828. if (/Arial-?Black/i.test(name)) {
  20829. var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  20830. for (const charCode in SupplementalGlyphMapForArialBlack) {
  20831. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  20832. }
  20833. } else if (/Calibri/i.test(name)) {
  20834. const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
  20835. for (const charCode in SupplementalGlyphMapForCalibri) {
  20836. map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
  20837. }
  20838. }
  20839. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  20840. if (!isIdentityUnicode) {
  20841. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  20842. map[+charCode] = unicodeCharCode;
  20843. });
  20844. }
  20845. this.toFontChar = map;
  20846. this.toUnicode = new ToUnicodeMap(map);
  20847. } else if (/Symbol/i.test(fontName)) {
  20848. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20849. } else if (/Dingbats/i.test(fontName)) {
  20850. if (/Wingdings/i.test(name)) {
  20851. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  20852. }
  20853. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  20854. } else if (isStandardFont) {
  20855. this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  20856. } else {
  20857. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20858. const map = [];
  20859. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  20860. if (!this.composite) {
  20861. var glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  20862. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20863. if (unicode !== -1) {
  20864. unicodeCharCode = unicode;
  20865. }
  20866. }
  20867. map[+charCode] = unicodeCharCode;
  20868. });
  20869. if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
  20870. if (/Verdana/i.test(name)) {
  20871. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  20872. for (const charCode in GlyphMapForStandardFonts) {
  20873. map[+charCode] = GlyphMapForStandardFonts[charCode];
  20874. }
  20875. }
  20876. }
  20877. this.toFontChar = map;
  20878. }
  20879. this.loadedName = fontName.split("-")[0];
  20880. this.fontType = getFontType(type, subtype);
  20881. },
  20882. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  20883. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  20884. function readTables(file, numTables) {
  20885. const tables = Object.create(null);
  20886. tables["OS/2"] = null;
  20887. tables.cmap = null;
  20888. tables.head = null;
  20889. tables.hhea = null;
  20890. tables.hmtx = null;
  20891. tables.maxp = null;
  20892. tables.name = null;
  20893. tables.post = null;
  20894. for (let i = 0; i < numTables; i++) {
  20895. const table = readTableEntry(file);
  20896. if (!VALID_TABLES.includes(table.tag)) {
  20897. continue;
  20898. }
  20899. if (table.length === 0) {
  20900. continue;
  20901. }
  20902. tables[table.tag] = table;
  20903. }
  20904. return tables;
  20905. }
  20906. function readTableEntry(file) {
  20907. var tag = (0, _util.bytesToString)(file.getBytes(4));
  20908. var checksum = file.getInt32() >>> 0;
  20909. var offset = file.getInt32() >>> 0;
  20910. var length = file.getInt32() >>> 0;
  20911. var previousPosition = file.pos;
  20912. file.pos = file.start ? file.start : 0;
  20913. file.skip(offset);
  20914. var data = file.getBytes(length);
  20915. file.pos = previousPosition;
  20916. if (tag === "head") {
  20917. data[8] = data[9] = data[10] = data[11] = 0;
  20918. data[17] |= 0x20;
  20919. }
  20920. return {
  20921. tag,
  20922. checksum,
  20923. length,
  20924. offset,
  20925. data
  20926. };
  20927. }
  20928. function readOpenTypeHeader(ttf) {
  20929. return {
  20930. version: (0, _util.bytesToString)(ttf.getBytes(4)),
  20931. numTables: ttf.getUint16(),
  20932. searchRange: ttf.getUint16(),
  20933. entrySelector: ttf.getUint16(),
  20934. rangeShift: ttf.getUint16()
  20935. };
  20936. }
  20937. function readTrueTypeCollectionHeader(ttc) {
  20938. const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
  20939. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  20940. const majorVersion = ttc.getUint16();
  20941. const minorVersion = ttc.getUint16();
  20942. const numFonts = ttc.getInt32() >>> 0;
  20943. const offsetTable = [];
  20944. for (let i = 0; i < numFonts; i++) {
  20945. offsetTable.push(ttc.getInt32() >>> 0);
  20946. }
  20947. const header = {
  20948. ttcTag,
  20949. majorVersion,
  20950. minorVersion,
  20951. numFonts,
  20952. offsetTable
  20953. };
  20954. switch (majorVersion) {
  20955. case 1:
  20956. return header;
  20957. case 2:
  20958. header.dsigTag = ttc.getInt32() >>> 0;
  20959. header.dsigLength = ttc.getInt32() >>> 0;
  20960. header.dsigOffset = ttc.getInt32() >>> 0;
  20961. return header;
  20962. }
  20963. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  20964. }
  20965. function readTrueTypeCollectionData(ttc, fontName) {
  20966. const {
  20967. numFonts,
  20968. offsetTable
  20969. } = readTrueTypeCollectionHeader(ttc);
  20970. for (let i = 0; i < numFonts; i++) {
  20971. ttc.pos = (ttc.start || 0) + offsetTable[i];
  20972. const potentialHeader = readOpenTypeHeader(ttc);
  20973. const potentialTables = readTables(ttc, potentialHeader.numTables);
  20974. if (!potentialTables.name) {
  20975. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  20976. }
  20977. const nameTable = readNameTable(potentialTables.name);
  20978. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  20979. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  20980. const nameEntry = nameTable[j][k];
  20981. if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) {
  20982. return {
  20983. header: potentialHeader,
  20984. tables: potentialTables
  20985. };
  20986. }
  20987. }
  20988. }
  20989. }
  20990. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  20991. }
  20992. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  20993. if (!cmap) {
  20994. (0, _util.warn)("No cmap table available.");
  20995. return {
  20996. platformId: -1,
  20997. encodingId: -1,
  20998. mappings: [],
  20999. hasShortCmap: false
  21000. };
  21001. }
  21002. var segment;
  21003. var start = (file.start ? file.start : 0) + cmap.offset;
  21004. file.pos = start;
  21005. file.skip(2);
  21006. var numTables = file.getUint16();
  21007. var potentialTable;
  21008. var canBreak = false;
  21009. for (var i = 0; i < numTables; i++) {
  21010. var platformId = file.getUint16();
  21011. var encodingId = file.getUint16();
  21012. var offset = file.getInt32() >>> 0;
  21013. var useTable = false;
  21014. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  21015. continue;
  21016. }
  21017. if (platformId === 0 && encodingId === 0) {
  21018. useTable = true;
  21019. } else if (platformId === 1 && encodingId === 0) {
  21020. useTable = true;
  21021. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  21022. useTable = true;
  21023. if (!isSymbolicFont) {
  21024. canBreak = true;
  21025. }
  21026. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  21027. useTable = true;
  21028. canBreak = true;
  21029. }
  21030. if (useTable) {
  21031. potentialTable = {
  21032. platformId,
  21033. encodingId,
  21034. offset
  21035. };
  21036. }
  21037. if (canBreak) {
  21038. break;
  21039. }
  21040. }
  21041. if (potentialTable) {
  21042. file.pos = start + potentialTable.offset;
  21043. }
  21044. if (!potentialTable || file.peekByte() === -1) {
  21045. (0, _util.warn)("Could not find a preferred cmap table.");
  21046. return {
  21047. platformId: -1,
  21048. encodingId: -1,
  21049. mappings: [],
  21050. hasShortCmap: false
  21051. };
  21052. }
  21053. var format = file.getUint16();
  21054. file.skip(2 + 2);
  21055. var hasShortCmap = false;
  21056. var mappings = [];
  21057. var j, glyphId;
  21058. if (format === 0) {
  21059. for (j = 0; j < 256; j++) {
  21060. var index = file.getByte();
  21061. if (!index) {
  21062. continue;
  21063. }
  21064. mappings.push({
  21065. charCode: j,
  21066. glyphId: index
  21067. });
  21068. }
  21069. hasShortCmap = true;
  21070. } else if (format === 4) {
  21071. var segCount = file.getUint16() >> 1;
  21072. file.skip(6);
  21073. var segIndex,
  21074. segments = [];
  21075. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21076. segments.push({
  21077. end: file.getUint16()
  21078. });
  21079. }
  21080. file.skip(2);
  21081. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21082. segments[segIndex].start = file.getUint16();
  21083. }
  21084. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21085. segments[segIndex].delta = file.getUint16();
  21086. }
  21087. var offsetsCount = 0;
  21088. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21089. segment = segments[segIndex];
  21090. var rangeOffset = file.getUint16();
  21091. if (!rangeOffset) {
  21092. segment.offsetIndex = -1;
  21093. continue;
  21094. }
  21095. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  21096. segment.offsetIndex = offsetIndex;
  21097. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  21098. }
  21099. var offsets = [];
  21100. for (j = 0; j < offsetsCount; j++) {
  21101. offsets.push(file.getUint16());
  21102. }
  21103. for (segIndex = 0; segIndex < segCount; segIndex++) {
  21104. segment = segments[segIndex];
  21105. start = segment.start;
  21106. var end = segment.end;
  21107. var delta = segment.delta;
  21108. offsetIndex = segment.offsetIndex;
  21109. for (j = start; j <= end; j++) {
  21110. if (j === 0xffff) {
  21111. continue;
  21112. }
  21113. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  21114. glyphId = glyphId + delta & 0xffff;
  21115. mappings.push({
  21116. charCode: j,
  21117. glyphId
  21118. });
  21119. }
  21120. }
  21121. } else if (format === 6) {
  21122. var firstCode = file.getUint16();
  21123. var entryCount = file.getUint16();
  21124. for (j = 0; j < entryCount; j++) {
  21125. glyphId = file.getUint16();
  21126. var charCode = firstCode + j;
  21127. mappings.push({
  21128. charCode,
  21129. glyphId
  21130. });
  21131. }
  21132. } else {
  21133. (0, _util.warn)("cmap table has unsupported format: " + format);
  21134. return {
  21135. platformId: -1,
  21136. encodingId: -1,
  21137. mappings: [],
  21138. hasShortCmap: false
  21139. };
  21140. }
  21141. mappings.sort(function (a, b) {
  21142. return a.charCode - b.charCode;
  21143. });
  21144. for (i = 1; i < mappings.length; i++) {
  21145. if (mappings[i - 1].charCode === mappings[i].charCode) {
  21146. mappings.splice(i, 1);
  21147. i--;
  21148. }
  21149. }
  21150. return {
  21151. platformId: potentialTable.platformId,
  21152. encodingId: potentialTable.encodingId,
  21153. mappings,
  21154. hasShortCmap
  21155. };
  21156. }
  21157. function sanitizeMetrics(file, header, metrics, numGlyphs, dupFirstEntry) {
  21158. if (!header) {
  21159. if (metrics) {
  21160. metrics.data = null;
  21161. }
  21162. return;
  21163. }
  21164. file.pos = (file.start ? file.start : 0) + header.offset;
  21165. file.pos += 4;
  21166. file.pos += 2;
  21167. file.pos += 2;
  21168. file.pos += 2;
  21169. file.pos += 2;
  21170. file.pos += 2;
  21171. file.pos += 2;
  21172. file.pos += 2;
  21173. file.pos += 2;
  21174. file.pos += 2;
  21175. file.pos += 2;
  21176. file.pos += 8;
  21177. file.pos += 2;
  21178. var numOfMetrics = file.getUint16();
  21179. if (numOfMetrics > numGlyphs) {
  21180. (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")");
  21181. numOfMetrics = numGlyphs;
  21182. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  21183. header.data[35] = numOfMetrics & 0x00ff;
  21184. }
  21185. var numOfSidebearings = numGlyphs - numOfMetrics;
  21186. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  21187. if (numMissing > 0) {
  21188. var entries = new Uint8Array(metrics.length + numMissing * 2);
  21189. entries.set(metrics.data);
  21190. if (dupFirstEntry) {
  21191. entries[metrics.length] = metrics.data[2];
  21192. entries[metrics.length + 1] = metrics.data[3];
  21193. }
  21194. metrics.data = entries;
  21195. }
  21196. }
  21197. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  21198. var glyphProfile = {
  21199. length: 0,
  21200. sizeOfInstructions: 0
  21201. };
  21202. if (sourceEnd - sourceStart <= 12) {
  21203. return glyphProfile;
  21204. }
  21205. var glyf = source.subarray(sourceStart, sourceEnd);
  21206. var contoursCount = signedInt16(glyf[0], glyf[1]);
  21207. if (contoursCount < 0) {
  21208. contoursCount = -1;
  21209. writeSignedInt16(glyf, 0, contoursCount);
  21210. dest.set(glyf, destStart);
  21211. glyphProfile.length = glyf.length;
  21212. return glyphProfile;
  21213. }
  21214. var i,
  21215. j = 10,
  21216. flagsCount = 0;
  21217. for (i = 0; i < contoursCount; i++) {
  21218. var endPoint = glyf[j] << 8 | glyf[j + 1];
  21219. flagsCount = endPoint + 1;
  21220. j += 2;
  21221. }
  21222. var instructionsStart = j;
  21223. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  21224. glyphProfile.sizeOfInstructions = instructionsLength;
  21225. j += 2 + instructionsLength;
  21226. var instructionsEnd = j;
  21227. var coordinatesLength = 0;
  21228. for (i = 0; i < flagsCount; i++) {
  21229. var flag = glyf[j++];
  21230. if (flag & 0xc0) {
  21231. glyf[j - 1] = flag & 0x3f;
  21232. }
  21233. let xLength = 2;
  21234. if (flag & 2) {
  21235. xLength = 1;
  21236. } else if (flag & 16) {
  21237. xLength = 0;
  21238. }
  21239. let yLength = 2;
  21240. if (flag & 4) {
  21241. yLength = 1;
  21242. } else if (flag & 32) {
  21243. yLength = 0;
  21244. }
  21245. const xyLength = xLength + yLength;
  21246. coordinatesLength += xyLength;
  21247. if (flag & 8) {
  21248. var repeat = glyf[j++];
  21249. i += repeat;
  21250. coordinatesLength += repeat * xyLength;
  21251. }
  21252. }
  21253. if (coordinatesLength === 0) {
  21254. return glyphProfile;
  21255. }
  21256. var glyphDataLength = j + coordinatesLength;
  21257. if (glyphDataLength > glyf.length) {
  21258. return glyphProfile;
  21259. }
  21260. if (!hintsValid && instructionsLength > 0) {
  21261. dest.set(glyf.subarray(0, instructionsStart), destStart);
  21262. dest.set([0, 0], destStart + instructionsStart);
  21263. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  21264. glyphDataLength -= instructionsLength;
  21265. if (glyf.length - glyphDataLength > 3) {
  21266. glyphDataLength = glyphDataLength + 3 & ~3;
  21267. }
  21268. glyphProfile.length = glyphDataLength;
  21269. return glyphProfile;
  21270. }
  21271. if (glyf.length - glyphDataLength > 3) {
  21272. glyphDataLength = glyphDataLength + 3 & ~3;
  21273. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  21274. glyphProfile.length = glyphDataLength;
  21275. return glyphProfile;
  21276. }
  21277. dest.set(glyf, destStart);
  21278. glyphProfile.length = glyf.length;
  21279. return glyphProfile;
  21280. }
  21281. function sanitizeHead(head, numGlyphs, locaLength) {
  21282. var data = head.data;
  21283. var version = int32(data[0], data[1], data[2], data[3]);
  21284. if (version >> 16 !== 1) {
  21285. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  21286. data[0] = 0;
  21287. data[1] = 1;
  21288. data[2] = 0;
  21289. data[3] = 0;
  21290. }
  21291. var indexToLocFormat = int16(data[50], data[51]);
  21292. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  21293. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  21294. var numGlyphsPlusOne = numGlyphs + 1;
  21295. if (locaLength === numGlyphsPlusOne << 1) {
  21296. data[50] = 0;
  21297. data[51] = 0;
  21298. } else if (locaLength === numGlyphsPlusOne << 2) {
  21299. data[50] = 0;
  21300. data[51] = 1;
  21301. } else {
  21302. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  21303. }
  21304. }
  21305. }
  21306. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  21307. var itemSize, itemDecode, itemEncode;
  21308. if (isGlyphLocationsLong) {
  21309. itemSize = 4;
  21310. itemDecode = function fontItemDecodeLong(data, offset) {
  21311. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  21312. };
  21313. itemEncode = function fontItemEncodeLong(data, offset, value) {
  21314. data[offset] = value >>> 24 & 0xff;
  21315. data[offset + 1] = value >> 16 & 0xff;
  21316. data[offset + 2] = value >> 8 & 0xff;
  21317. data[offset + 3] = value & 0xff;
  21318. };
  21319. } else {
  21320. itemSize = 2;
  21321. itemDecode = function fontItemDecode(data, offset) {
  21322. return data[offset] << 9 | data[offset + 1] << 1;
  21323. };
  21324. itemEncode = function fontItemEncode(data, offset, value) {
  21325. data[offset] = value >> 9 & 0xff;
  21326. data[offset + 1] = value >> 1 & 0xff;
  21327. };
  21328. }
  21329. var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  21330. var locaDataSize = itemSize * (1 + numGlyphsOut);
  21331. var locaData = new Uint8Array(locaDataSize);
  21332. locaData.set(loca.data.subarray(0, locaDataSize));
  21333. loca.data = locaData;
  21334. var oldGlyfData = glyf.data;
  21335. var oldGlyfDataLength = oldGlyfData.length;
  21336. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  21337. var startOffset = itemDecode(locaData, 0);
  21338. var writeOffset = 0;
  21339. var missingGlyphs = Object.create(null);
  21340. itemEncode(locaData, 0, writeOffset);
  21341. var i, j;
  21342. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  21343. var endOffset = itemDecode(locaData, j);
  21344. if (endOffset === 0) {
  21345. endOffset = startOffset;
  21346. }
  21347. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  21348. endOffset = oldGlyfDataLength;
  21349. }
  21350. if (endOffset > oldGlyfDataLength) {
  21351. startOffset = endOffset;
  21352. }
  21353. var glyphProfile = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  21354. var newLength = glyphProfile.length;
  21355. if (newLength === 0) {
  21356. missingGlyphs[i] = true;
  21357. }
  21358. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  21359. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  21360. }
  21361. writeOffset += newLength;
  21362. itemEncode(locaData, j, writeOffset);
  21363. startOffset = endOffset;
  21364. }
  21365. if (writeOffset === 0) {
  21366. var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  21367. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  21368. itemEncode(locaData, j, simpleGlyph.length);
  21369. }
  21370. glyf.data = simpleGlyph;
  21371. } else if (dupFirstEntry) {
  21372. var firstEntryLength = itemDecode(locaData, itemSize);
  21373. if (newGlyfData.length > firstEntryLength + writeOffset) {
  21374. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  21375. } else {
  21376. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  21377. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  21378. }
  21379. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  21380. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  21381. } else {
  21382. glyf.data = newGlyfData.subarray(0, writeOffset);
  21383. }
  21384. return {
  21385. missingGlyphs,
  21386. maxSizeOfInstructions
  21387. };
  21388. }
  21389. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  21390. var start = (font.start ? font.start : 0) + post.offset;
  21391. font.pos = start;
  21392. var length = post.length,
  21393. end = start + length;
  21394. var version = font.getInt32();
  21395. font.skip(28);
  21396. var glyphNames;
  21397. var valid = true;
  21398. var i;
  21399. switch (version) {
  21400. case 0x00010000:
  21401. glyphNames = MacStandardGlyphOrdering;
  21402. break;
  21403. case 0x00020000:
  21404. var numGlyphs = font.getUint16();
  21405. if (numGlyphs !== maxpNumGlyphs) {
  21406. valid = false;
  21407. break;
  21408. }
  21409. var glyphNameIndexes = [];
  21410. for (i = 0; i < numGlyphs; ++i) {
  21411. var index = font.getUint16();
  21412. if (index >= 32768) {
  21413. valid = false;
  21414. break;
  21415. }
  21416. glyphNameIndexes.push(index);
  21417. }
  21418. if (!valid) {
  21419. break;
  21420. }
  21421. var customNames = [];
  21422. var strBuf = [];
  21423. while (font.pos < end) {
  21424. var stringLength = font.getByte();
  21425. strBuf.length = stringLength;
  21426. for (i = 0; i < stringLength; ++i) {
  21427. strBuf[i] = String.fromCharCode(font.getByte());
  21428. }
  21429. customNames.push(strBuf.join(""));
  21430. }
  21431. glyphNames = [];
  21432. for (i = 0; i < numGlyphs; ++i) {
  21433. var j = glyphNameIndexes[i];
  21434. if (j < 258) {
  21435. glyphNames.push(MacStandardGlyphOrdering[j]);
  21436. continue;
  21437. }
  21438. glyphNames.push(customNames[j - 258]);
  21439. }
  21440. break;
  21441. case 0x00030000:
  21442. break;
  21443. default:
  21444. (0, _util.warn)("Unknown/unsupported post table version " + version);
  21445. valid = false;
  21446. if (propertiesObj.defaultEncoding) {
  21447. glyphNames = propertiesObj.defaultEncoding;
  21448. }
  21449. break;
  21450. }
  21451. propertiesObj.glyphNames = glyphNames;
  21452. return valid;
  21453. }
  21454. function readNameTable(nameTable) {
  21455. var start = (font.start ? font.start : 0) + nameTable.offset;
  21456. font.pos = start;
  21457. var names = [[], []];
  21458. var length = nameTable.length,
  21459. end = start + length;
  21460. var format = font.getUint16();
  21461. var FORMAT_0_HEADER_LENGTH = 6;
  21462. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  21463. return names;
  21464. }
  21465. var numRecords = font.getUint16();
  21466. var stringsStart = font.getUint16();
  21467. var records = [];
  21468. var NAME_RECORD_LENGTH = 12;
  21469. var i, ii;
  21470. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  21471. var r = {
  21472. platform: font.getUint16(),
  21473. encoding: font.getUint16(),
  21474. language: font.getUint16(),
  21475. name: font.getUint16(),
  21476. length: font.getUint16(),
  21477. offset: font.getUint16()
  21478. };
  21479. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  21480. records.push(r);
  21481. }
  21482. }
  21483. for (i = 0, ii = records.length; i < ii; i++) {
  21484. var record = records[i];
  21485. if (record.length <= 0) {
  21486. continue;
  21487. }
  21488. var pos = start + stringsStart + record.offset;
  21489. if (pos + record.length > end) {
  21490. continue;
  21491. }
  21492. font.pos = pos;
  21493. var nameIndex = record.name;
  21494. if (record.encoding) {
  21495. var str = "";
  21496. for (var j = 0, jj = record.length; j < jj; j += 2) {
  21497. str += String.fromCharCode(font.getUint16());
  21498. }
  21499. names[1][nameIndex] = str;
  21500. } else {
  21501. names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
  21502. }
  21503. }
  21504. return names;
  21505. }
  21506. var 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];
  21507. function sanitizeTTProgram(table, ttContext) {
  21508. var data = table.data;
  21509. var i = 0,
  21510. j,
  21511. n,
  21512. b,
  21513. funcId,
  21514. pc,
  21515. lastEndf = 0,
  21516. lastDeff = 0;
  21517. var stack = [];
  21518. var callstack = [];
  21519. var functionsCalled = [];
  21520. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  21521. var inFDEF = false,
  21522. ifLevel = 0,
  21523. inELSE = 0;
  21524. for (var ii = data.length; i < ii;) {
  21525. var op = data[i++];
  21526. if (op === 0x40) {
  21527. n = data[i++];
  21528. if (inFDEF || inELSE) {
  21529. i += n;
  21530. } else {
  21531. for (j = 0; j < n; j++) {
  21532. stack.push(data[i++]);
  21533. }
  21534. }
  21535. } else if (op === 0x41) {
  21536. n = data[i++];
  21537. if (inFDEF || inELSE) {
  21538. i += n * 2;
  21539. } else {
  21540. for (j = 0; j < n; j++) {
  21541. b = data[i++];
  21542. stack.push(b << 8 | data[i++]);
  21543. }
  21544. }
  21545. } else if ((op & 0xf8) === 0xb0) {
  21546. n = op - 0xb0 + 1;
  21547. if (inFDEF || inELSE) {
  21548. i += n;
  21549. } else {
  21550. for (j = 0; j < n; j++) {
  21551. stack.push(data[i++]);
  21552. }
  21553. }
  21554. } else if ((op & 0xf8) === 0xb8) {
  21555. n = op - 0xb8 + 1;
  21556. if (inFDEF || inELSE) {
  21557. i += n * 2;
  21558. } else {
  21559. for (j = 0; j < n; j++) {
  21560. b = data[i++];
  21561. stack.push(b << 8 | data[i++]);
  21562. }
  21563. }
  21564. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  21565. if (!inFDEF && !inELSE) {
  21566. funcId = stack[stack.length - 1];
  21567. if (isNaN(funcId)) {
  21568. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  21569. } else {
  21570. ttContext.functionsUsed[funcId] = true;
  21571. if (funcId in ttContext.functionsStackDeltas) {
  21572. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  21573. if (newStackLength < 0) {
  21574. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  21575. ttContext.hintsValid = false;
  21576. return;
  21577. }
  21578. stack.length = newStackLength;
  21579. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  21580. callstack.push({
  21581. data,
  21582. i,
  21583. stackTop: stack.length - 1
  21584. });
  21585. functionsCalled.push(funcId);
  21586. pc = ttContext.functionsDefined[funcId];
  21587. if (!pc) {
  21588. (0, _util.warn)("TT: CALL non-existent function");
  21589. ttContext.hintsValid = false;
  21590. return;
  21591. }
  21592. data = pc.data;
  21593. i = pc.i;
  21594. }
  21595. }
  21596. }
  21597. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  21598. if (inFDEF || inELSE) {
  21599. (0, _util.warn)("TT: nested FDEFs not allowed");
  21600. tooComplexToFollowFunctions = true;
  21601. }
  21602. inFDEF = true;
  21603. lastDeff = i;
  21604. funcId = stack.pop();
  21605. ttContext.functionsDefined[funcId] = {
  21606. data,
  21607. i
  21608. };
  21609. } else if (op === 0x2d) {
  21610. if (inFDEF) {
  21611. inFDEF = false;
  21612. lastEndf = i;
  21613. } else {
  21614. pc = callstack.pop();
  21615. if (!pc) {
  21616. (0, _util.warn)("TT: ENDF bad stack");
  21617. ttContext.hintsValid = false;
  21618. return;
  21619. }
  21620. funcId = functionsCalled.pop();
  21621. data = pc.data;
  21622. i = pc.i;
  21623. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  21624. }
  21625. } else if (op === 0x89) {
  21626. if (inFDEF || inELSE) {
  21627. (0, _util.warn)("TT: nested IDEFs not allowed");
  21628. tooComplexToFollowFunctions = true;
  21629. }
  21630. inFDEF = true;
  21631. lastDeff = i;
  21632. } else if (op === 0x58) {
  21633. ++ifLevel;
  21634. } else if (op === 0x1b) {
  21635. inELSE = ifLevel;
  21636. } else if (op === 0x59) {
  21637. if (inELSE === ifLevel) {
  21638. inELSE = 0;
  21639. }
  21640. --ifLevel;
  21641. } else if (op === 0x1c) {
  21642. if (!inFDEF && !inELSE) {
  21643. var offset = stack[stack.length - 1];
  21644. if (offset > 0) {
  21645. i += offset - 1;
  21646. }
  21647. }
  21648. }
  21649. if (!inFDEF && !inELSE) {
  21650. let stackDelta = 0;
  21651. if (op <= 0x8e) {
  21652. stackDelta = TTOpsStackDeltas[op];
  21653. } else if (op >= 0xc0 && op <= 0xdf) {
  21654. stackDelta = -1;
  21655. } else if (op >= 0xe0) {
  21656. stackDelta = -2;
  21657. }
  21658. if (op >= 0x71 && op <= 0x75) {
  21659. n = stack.pop();
  21660. if (!isNaN(n)) {
  21661. stackDelta = -n * 2;
  21662. }
  21663. }
  21664. while (stackDelta < 0 && stack.length > 0) {
  21665. stack.pop();
  21666. stackDelta++;
  21667. }
  21668. while (stackDelta > 0) {
  21669. stack.push(NaN);
  21670. stackDelta--;
  21671. }
  21672. }
  21673. }
  21674. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  21675. var content = [data];
  21676. if (i > data.length) {
  21677. content.push(new Uint8Array(i - data.length));
  21678. }
  21679. if (lastDeff > lastEndf) {
  21680. (0, _util.warn)("TT: complementing a missing function tail");
  21681. content.push(new Uint8Array([0x22, 0x2d]));
  21682. }
  21683. foldTTTable(table, content);
  21684. }
  21685. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  21686. if (ttContext.tooComplexToFollowFunctions) {
  21687. return;
  21688. }
  21689. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  21690. (0, _util.warn)("TT: more functions defined than expected");
  21691. ttContext.hintsValid = false;
  21692. return;
  21693. }
  21694. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  21695. if (j > maxFunctionDefs) {
  21696. (0, _util.warn)("TT: invalid function id: " + j);
  21697. ttContext.hintsValid = false;
  21698. return;
  21699. }
  21700. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  21701. (0, _util.warn)("TT: undefined function: " + j);
  21702. ttContext.hintsValid = false;
  21703. return;
  21704. }
  21705. }
  21706. }
  21707. function foldTTTable(table, content) {
  21708. if (content.length > 1) {
  21709. var newLength = 0;
  21710. var j, jj;
  21711. for (j = 0, jj = content.length; j < jj; j++) {
  21712. newLength += content[j].length;
  21713. }
  21714. newLength = newLength + 3 & ~3;
  21715. var result = new Uint8Array(newLength);
  21716. var pos = 0;
  21717. for (j = 0, jj = content.length; j < jj; j++) {
  21718. result.set(content[j], pos);
  21719. pos += content[j].length;
  21720. }
  21721. table.data = result;
  21722. table.length = newLength;
  21723. }
  21724. }
  21725. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  21726. var ttContext = {
  21727. functionsDefined: [],
  21728. functionsUsed: [],
  21729. functionsStackDeltas: [],
  21730. tooComplexToFollowFunctions: false,
  21731. hintsValid: true
  21732. };
  21733. if (fpgm) {
  21734. sanitizeTTProgram(fpgm, ttContext);
  21735. }
  21736. if (prep) {
  21737. sanitizeTTProgram(prep, ttContext);
  21738. }
  21739. if (fpgm) {
  21740. checkInvalidFunctions(ttContext, maxFunctionDefs);
  21741. }
  21742. if (cvt && cvt.length & 1) {
  21743. var cvtData = new Uint8Array(cvt.length + 1);
  21744. cvtData.set(cvt.data);
  21745. cvt.data = cvtData;
  21746. }
  21747. return ttContext.hintsValid;
  21748. }
  21749. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  21750. let header, tables;
  21751. if (isTrueTypeCollectionFile(font)) {
  21752. const ttcData = readTrueTypeCollectionData(font, this.name);
  21753. header = ttcData.header;
  21754. tables = ttcData.tables;
  21755. } else {
  21756. header = readOpenTypeHeader(font);
  21757. tables = readTables(font, header.numTables);
  21758. }
  21759. let cff, cffFile;
  21760. var isTrueType = !tables["CFF "];
  21761. if (!isTrueType) {
  21762. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  21763. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  21764. cffFile = new _stream.Stream(tables["CFF "].data);
  21765. cff = new CFFFont(cffFile, properties);
  21766. adjustWidths(properties);
  21767. return this.convert(name, cff, properties);
  21768. }
  21769. delete tables.glyf;
  21770. delete tables.loca;
  21771. delete tables.fpgm;
  21772. delete tables.prep;
  21773. delete tables["cvt "];
  21774. this.isOpenType = true;
  21775. } else {
  21776. if (!tables.loca) {
  21777. throw new _util.FormatError('Required "loca" table is not found');
  21778. }
  21779. if (!tables.glyf) {
  21780. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  21781. tables.glyf = {
  21782. tag: "glyf",
  21783. data: new Uint8Array(0)
  21784. };
  21785. }
  21786. this.isOpenType = false;
  21787. }
  21788. if (!tables.maxp) {
  21789. throw new _util.FormatError('Required "maxp" table is not found');
  21790. }
  21791. font.pos = (font.start || 0) + tables.maxp.offset;
  21792. var version = font.getInt32();
  21793. const numGlyphs = font.getUint16();
  21794. let numGlyphsOut = numGlyphs + 1;
  21795. let dupFirstEntry = true;
  21796. if (numGlyphsOut > 0xffff) {
  21797. dupFirstEntry = false;
  21798. numGlyphsOut = numGlyphs;
  21799. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  21800. }
  21801. var maxFunctionDefs = 0;
  21802. var maxSizeOfInstructions = 0;
  21803. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  21804. font.pos += 8;
  21805. var maxZones = font.getUint16();
  21806. if (maxZones > 2) {
  21807. tables.maxp.data[14] = 0;
  21808. tables.maxp.data[15] = 2;
  21809. }
  21810. font.pos += 4;
  21811. maxFunctionDefs = font.getUint16();
  21812. font.pos += 4;
  21813. maxSizeOfInstructions = font.getUint16();
  21814. }
  21815. tables.maxp.data[4] = numGlyphsOut >> 8;
  21816. tables.maxp.data[5] = numGlyphsOut & 255;
  21817. var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  21818. if (!hintsValid) {
  21819. delete tables.fpgm;
  21820. delete tables.prep;
  21821. delete tables["cvt "];
  21822. }
  21823. sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphsOut, dupFirstEntry);
  21824. if (!tables.head) {
  21825. throw new _util.FormatError('Required "head" table is not found');
  21826. }
  21827. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  21828. var missingGlyphs = Object.create(null);
  21829. if (isTrueType) {
  21830. var isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  21831. var glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  21832. missingGlyphs = glyphsInfo.missingGlyphs;
  21833. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  21834. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  21835. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  21836. }
  21837. }
  21838. if (!tables.hhea) {
  21839. throw new _util.FormatError('Required "hhea" table is not found');
  21840. }
  21841. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  21842. tables.hhea.data[10] = 0xff;
  21843. tables.hhea.data[11] = 0xff;
  21844. }
  21845. var metricsOverride = {
  21846. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  21847. yMax: int16(tables.head.data[42], tables.head.data[43]),
  21848. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  21849. ascent: int16(tables.hhea.data[4], tables.hhea.data[5]),
  21850. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7])
  21851. };
  21852. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  21853. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  21854. if (tables.post) {
  21855. readPostScriptTable(tables.post, properties, numGlyphs);
  21856. }
  21857. tables.post = {
  21858. tag: "post",
  21859. data: createPostTable(properties)
  21860. };
  21861. const charCodeToGlyphId = [];
  21862. function hasGlyph(glyphId) {
  21863. return !missingGlyphs[glyphId];
  21864. }
  21865. if (properties.composite) {
  21866. var cidToGidMap = properties.cidToGidMap || [];
  21867. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  21868. properties.cMap.forEach(function (charCode, cid) {
  21869. if (cid > 0xffff) {
  21870. throw new _util.FormatError("Max size of CID is 65,535");
  21871. }
  21872. var glyphId = -1;
  21873. if (isCidToGidMapEmpty) {
  21874. glyphId = cid;
  21875. } else if (cidToGidMap[cid] !== undefined) {
  21876. glyphId = cidToGidMap[cid];
  21877. }
  21878. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  21879. charCodeToGlyphId[charCode] = glyphId;
  21880. }
  21881. });
  21882. } else {
  21883. var cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  21884. var cmapPlatformId = cmapTable.platformId;
  21885. var cmapEncodingId = cmapTable.encodingId;
  21886. var cmapMappings = cmapTable.mappings;
  21887. var cmapMappingsLength = cmapMappings.length;
  21888. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) {
  21889. var baseEncoding = [];
  21890. if (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding") {
  21891. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  21892. }
  21893. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  21894. for (let charCode = 0; charCode < 256; charCode++) {
  21895. var glyphName, standardGlyphName;
  21896. if (this.differences && charCode in this.differences) {
  21897. glyphName = this.differences[charCode];
  21898. } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") {
  21899. glyphName = baseEncoding[charCode];
  21900. } else {
  21901. glyphName = _encodings.StandardEncoding[charCode];
  21902. }
  21903. if (!glyphName) {
  21904. continue;
  21905. }
  21906. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  21907. var unicodeOrCharCode;
  21908. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  21909. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  21910. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  21911. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  21912. }
  21913. var found = false;
  21914. for (let i = 0; i < cmapMappingsLength; ++i) {
  21915. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  21916. continue;
  21917. }
  21918. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  21919. found = true;
  21920. break;
  21921. }
  21922. if (!found && properties.glyphNames) {
  21923. var glyphId = properties.glyphNames.indexOf(glyphName);
  21924. if (glyphId === -1 && standardGlyphName !== glyphName) {
  21925. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  21926. }
  21927. if (glyphId > 0 && hasGlyph(glyphId)) {
  21928. charCodeToGlyphId[charCode] = glyphId;
  21929. }
  21930. }
  21931. }
  21932. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  21933. for (let i = 0; i < cmapMappingsLength; ++i) {
  21934. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  21935. }
  21936. } else {
  21937. for (let i = 0; i < cmapMappingsLength; ++i) {
  21938. let charCode = cmapMappings[i].charCode;
  21939. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  21940. charCode &= 0xff;
  21941. }
  21942. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  21943. }
  21944. }
  21945. }
  21946. if (charCodeToGlyphId.length === 0) {
  21947. charCodeToGlyphId[0] = 0;
  21948. }
  21949. let glyphZeroId = numGlyphsOut - 1;
  21950. if (!dupFirstEntry) {
  21951. glyphZeroId = 0;
  21952. }
  21953. var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  21954. this.toFontChar = newMapping.toFontChar;
  21955. tables.cmap = {
  21956. tag: "cmap",
  21957. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  21958. };
  21959. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  21960. tables["OS/2"] = {
  21961. tag: "OS/2",
  21962. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  21963. };
  21964. }
  21965. if (!isTrueType) {
  21966. try {
  21967. cffFile = new _stream.Stream(tables["CFF "].data);
  21968. var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  21969. cff = parser.parse();
  21970. cff.duplicateFirstGlyph();
  21971. var compiler = new _cff_parser.CFFCompiler(cff);
  21972. tables["CFF "].data = compiler.compile();
  21973. } catch (e) {
  21974. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  21975. }
  21976. }
  21977. if (!tables.name) {
  21978. tables.name = {
  21979. tag: "name",
  21980. data: createNameTable(this.name)
  21981. };
  21982. } else {
  21983. var namePrototype = readNameTable(tables.name);
  21984. tables.name.data = createNameTable(name, namePrototype);
  21985. }
  21986. var builder = new OpenTypeFileBuilder(header.version);
  21987. for (var tableTag in tables) {
  21988. builder.addTable(tableTag, tables[tableTag].data);
  21989. }
  21990. return builder.toArray();
  21991. },
  21992. convert: function Font_convert(fontName, font, properties) {
  21993. properties.fixedPitch = false;
  21994. if (properties.builtInEncoding) {
  21995. adjustToUnicode(properties, properties.builtInEncoding);
  21996. }
  21997. let glyphZeroId = 1;
  21998. if (font instanceof CFFFont) {
  21999. glyphZeroId = font.numGlyphs - 1;
  22000. }
  22001. var mapping = font.getGlyphMapping(properties);
  22002. var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  22003. this.toFontChar = newMapping.toFontChar;
  22004. var numGlyphs = font.numGlyphs;
  22005. function getCharCodes(charCodeToGlyphId, glyphId) {
  22006. var charCodes = null;
  22007. for (var charCode in charCodeToGlyphId) {
  22008. if (glyphId === charCodeToGlyphId[charCode]) {
  22009. if (!charCodes) {
  22010. charCodes = [];
  22011. }
  22012. charCodes.push(charCode | 0);
  22013. }
  22014. }
  22015. return charCodes;
  22016. }
  22017. function createCharCode(charCodeToGlyphId, glyphId) {
  22018. for (var charCode in charCodeToGlyphId) {
  22019. if (glyphId === charCodeToGlyphId[charCode]) {
  22020. return charCode | 0;
  22021. }
  22022. }
  22023. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  22024. return newMapping.nextAvailableFontCharCode++;
  22025. }
  22026. var seacs = font.seacs;
  22027. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  22028. var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  22029. var charset = font.getCharset();
  22030. var seacMap = Object.create(null);
  22031. for (var glyphId in seacs) {
  22032. glyphId |= 0;
  22033. var seac = seacs[glyphId];
  22034. var baseGlyphName = _encodings.StandardEncoding[seac[2]];
  22035. var accentGlyphName = _encodings.StandardEncoding[seac[3]];
  22036. var baseGlyphId = charset.indexOf(baseGlyphName);
  22037. var accentGlyphId = charset.indexOf(accentGlyphName);
  22038. if (baseGlyphId < 0 || accentGlyphId < 0) {
  22039. continue;
  22040. }
  22041. var accentOffset = {
  22042. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  22043. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  22044. };
  22045. var charCodes = getCharCodes(mapping, glyphId);
  22046. if (!charCodes) {
  22047. continue;
  22048. }
  22049. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  22050. var charCode = charCodes[i];
  22051. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  22052. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  22053. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  22054. seacMap[charCode] = {
  22055. baseFontCharCode,
  22056. accentFontCharCode,
  22057. accentOffset
  22058. };
  22059. }
  22060. }
  22061. properties.seacMap = seacMap;
  22062. }
  22063. var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22064. var builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  22065. builder.addTable("CFF ", font.data);
  22066. builder.addTable("OS/2", createOS2Table(properties, newMapping.charCodeToGlyphId));
  22067. builder.addTable("cmap", createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  22068. 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");
  22069. 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));
  22070. builder.addTable("hmtx", function fontFieldsHmtx() {
  22071. var charstrings = font.charstrings;
  22072. var cffWidths = font.cff ? font.cff.widths : null;
  22073. var hmtx = "\x00\x00\x00\x00";
  22074. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  22075. var width = 0;
  22076. if (charstrings) {
  22077. var charstring = charstrings[i - 1];
  22078. width = "width" in charstring ? charstring.width : 0;
  22079. } else if (cffWidths) {
  22080. width = Math.ceil(cffWidths[i] || 0);
  22081. }
  22082. hmtx += string16(width) + string16(0);
  22083. }
  22084. return hmtx;
  22085. }());
  22086. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  22087. builder.addTable("name", createNameTable(fontName));
  22088. builder.addTable("post", createPostTable(properties));
  22089. return builder.toArray();
  22090. },
  22091. get spaceWidth() {
  22092. var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  22093. var width;
  22094. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  22095. var glyphName = possibleSpaceReplacements[i];
  22096. if (glyphName in this.widths) {
  22097. width = this.widths[glyphName];
  22098. break;
  22099. }
  22100. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22101. var glyphUnicode = glyphsUnicodeMap[glyphName];
  22102. var charcode = 0;
  22103. if (this.composite && this.cMap.contains(glyphUnicode)) {
  22104. charcode = this.cMap.lookup(glyphUnicode);
  22105. }
  22106. if (!charcode && this.toUnicode) {
  22107. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  22108. }
  22109. if (charcode <= 0) {
  22110. charcode = glyphUnicode;
  22111. }
  22112. width = this.widths[charcode];
  22113. if (width) {
  22114. break;
  22115. }
  22116. }
  22117. width = width || this.defaultWidth;
  22118. return (0, _util.shadow)(this, "spaceWidth", width);
  22119. },
  22120. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  22121. var fontCharCode, width, operatorListId;
  22122. var widthCode = charcode;
  22123. if (this.cMap && this.cMap.contains(charcode)) {
  22124. widthCode = this.cMap.lookup(charcode);
  22125. }
  22126. width = this.widths[widthCode];
  22127. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  22128. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  22129. let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
  22130. if (typeof unicode === "number") {
  22131. unicode = String.fromCharCode(unicode);
  22132. }
  22133. var isInFont = (charcode in this.toFontChar);
  22134. fontCharCode = this.toFontChar[charcode] || charcode;
  22135. if (this.missingFile) {
  22136. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  22137. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  22138. fontCharCode = 0x20;
  22139. }
  22140. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  22141. }
  22142. if (this.isType3Font) {
  22143. operatorListId = fontCharCode;
  22144. }
  22145. var accent = null;
  22146. if (this.seacMap && this.seacMap[charcode]) {
  22147. isInFont = true;
  22148. var seac = this.seacMap[charcode];
  22149. fontCharCode = seac.baseFontCharCode;
  22150. accent = {
  22151. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  22152. offset: seac.accentOffset
  22153. };
  22154. }
  22155. let fontChar = "";
  22156. if (typeof fontCharCode === "number") {
  22157. if (fontCharCode <= 0x10ffff) {
  22158. fontChar = String.fromCodePoint(fontCharCode);
  22159. } else {
  22160. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  22161. }
  22162. }
  22163. var glyph = this.glyphCache[charcode];
  22164. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  22165. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  22166. this.glyphCache[charcode] = glyph;
  22167. }
  22168. return glyph;
  22169. },
  22170. charsToGlyphs: function Font_charsToGlyphs(chars) {
  22171. var charsCache = this.charsCache;
  22172. var glyphs, glyph, charcode;
  22173. if (charsCache) {
  22174. glyphs = charsCache[chars];
  22175. if (glyphs) {
  22176. return glyphs;
  22177. }
  22178. }
  22179. if (!charsCache) {
  22180. charsCache = this.charsCache = Object.create(null);
  22181. }
  22182. glyphs = [];
  22183. var charsCacheKey = chars;
  22184. var i = 0,
  22185. ii;
  22186. if (this.cMap) {
  22187. var c = Object.create(null);
  22188. while (i < chars.length) {
  22189. this.cMap.readCharCode(chars, i, c);
  22190. charcode = c.charcode;
  22191. var length = c.length;
  22192. i += length;
  22193. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  22194. glyph = this.charToGlyph(charcode, isSpace);
  22195. glyphs.push(glyph);
  22196. }
  22197. } else {
  22198. for (i = 0, ii = chars.length; i < ii; ++i) {
  22199. charcode = chars.charCodeAt(i);
  22200. glyph = this.charToGlyph(charcode, charcode === 0x20);
  22201. glyphs.push(glyph);
  22202. }
  22203. }
  22204. return charsCache[charsCacheKey] = glyphs;
  22205. },
  22206. get glyphCacheValues() {
  22207. return Object.values(this.glyphCache);
  22208. }
  22209. };
  22210. return Font;
  22211. }();
  22212. exports.Font = Font;
  22213. var ErrorFont = function ErrorFontClosure() {
  22214. function ErrorFont(error) {
  22215. this.error = error;
  22216. this.loadedName = "g_font_error";
  22217. this.missingFile = true;
  22218. }
  22219. ErrorFont.prototype = {
  22220. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  22221. return [];
  22222. },
  22223. exportData(extraProperties = false) {
  22224. return {
  22225. error: this.error
  22226. };
  22227. }
  22228. };
  22229. return ErrorFont;
  22230. }();
  22231. exports.ErrorFont = ErrorFont;
  22232. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  22233. var charCodeToGlyphId = Object.create(null);
  22234. var glyphId, charCode, baseEncoding;
  22235. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  22236. if (properties.baseEncodingName) {
  22237. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  22238. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22239. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22240. if (glyphId >= 0) {
  22241. charCodeToGlyphId[charCode] = glyphId;
  22242. } else {
  22243. charCodeToGlyphId[charCode] = 0;
  22244. }
  22245. }
  22246. } else if (isSymbolicFont) {
  22247. for (charCode in builtInEncoding) {
  22248. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  22249. }
  22250. } else {
  22251. baseEncoding = _encodings.StandardEncoding;
  22252. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  22253. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  22254. if (glyphId >= 0) {
  22255. charCodeToGlyphId[charCode] = glyphId;
  22256. } else {
  22257. charCodeToGlyphId[charCode] = 0;
  22258. }
  22259. }
  22260. }
  22261. var differences = properties.differences,
  22262. glyphsUnicodeMap;
  22263. if (differences) {
  22264. for (charCode in differences) {
  22265. var glyphName = differences[charCode];
  22266. glyphId = glyphNames.indexOf(glyphName);
  22267. if (glyphId === -1) {
  22268. if (!glyphsUnicodeMap) {
  22269. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22270. }
  22271. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  22272. if (standardGlyphName !== glyphName) {
  22273. glyphId = glyphNames.indexOf(standardGlyphName);
  22274. }
  22275. }
  22276. if (glyphId >= 0) {
  22277. charCodeToGlyphId[charCode] = glyphId;
  22278. } else {
  22279. charCodeToGlyphId[charCode] = 0;
  22280. }
  22281. }
  22282. }
  22283. return charCodeToGlyphId;
  22284. }
  22285. var Type1Font = function Type1FontClosure() {
  22286. function findBlock(streamBytes, signature, startIndex) {
  22287. var streamBytesLength = streamBytes.length;
  22288. var signatureLength = signature.length;
  22289. var scanLength = streamBytesLength - signatureLength;
  22290. var i = startIndex,
  22291. j,
  22292. found = false;
  22293. while (i < scanLength) {
  22294. j = 0;
  22295. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  22296. j++;
  22297. }
  22298. if (j >= signatureLength) {
  22299. i += j;
  22300. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  22301. i++;
  22302. }
  22303. found = true;
  22304. break;
  22305. }
  22306. i++;
  22307. }
  22308. return {
  22309. found,
  22310. length: i
  22311. };
  22312. }
  22313. function getHeaderBlock(stream, suggestedLength) {
  22314. var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  22315. var streamStartPos = stream.pos;
  22316. var headerBytes, headerBytesLength, block;
  22317. try {
  22318. headerBytes = stream.getBytes(suggestedLength);
  22319. headerBytesLength = headerBytes.length;
  22320. } catch (ex) {
  22321. if (ex instanceof _core_utils.MissingDataException) {
  22322. throw ex;
  22323. }
  22324. }
  22325. if (headerBytesLength === suggestedLength) {
  22326. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  22327. if (block.found && block.length === suggestedLength) {
  22328. return {
  22329. stream: new _stream.Stream(headerBytes),
  22330. length: suggestedLength
  22331. };
  22332. }
  22333. }
  22334. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  22335. stream.pos = streamStartPos;
  22336. var SCAN_BLOCK_LENGTH = 2048;
  22337. var actualLength;
  22338. while (true) {
  22339. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  22340. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  22341. if (block.length === 0) {
  22342. break;
  22343. }
  22344. stream.pos += block.length;
  22345. if (block.found) {
  22346. actualLength = stream.pos - streamStartPos;
  22347. break;
  22348. }
  22349. }
  22350. stream.pos = streamStartPos;
  22351. if (actualLength) {
  22352. return {
  22353. stream: new _stream.Stream(stream.getBytes(actualLength)),
  22354. length: actualLength
  22355. };
  22356. }
  22357. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  22358. return {
  22359. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  22360. length: suggestedLength
  22361. };
  22362. }
  22363. function getEexecBlock(stream, suggestedLength) {
  22364. var eexecBytes = stream.getBytes();
  22365. return {
  22366. stream: new _stream.Stream(eexecBytes),
  22367. length: eexecBytes.length
  22368. };
  22369. }
  22370. function Type1Font(name, file, properties) {
  22371. var PFB_HEADER_SIZE = 6;
  22372. var headerBlockLength = properties.length1;
  22373. var eexecBlockLength = properties.length2;
  22374. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  22375. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  22376. if (pfbHeaderPresent) {
  22377. file.skip(PFB_HEADER_SIZE);
  22378. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22379. }
  22380. var headerBlock = getHeaderBlock(file, headerBlockLength);
  22381. var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  22382. headerBlockParser.extractFontHeader(properties);
  22383. if (pfbHeaderPresent) {
  22384. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  22385. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22386. }
  22387. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  22388. var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  22389. var data = eexecBlockParser.extractFontProgram(properties);
  22390. for (const key in data.properties) {
  22391. properties[key] = data.properties[key];
  22392. }
  22393. var charstrings = data.charstrings;
  22394. var type2Charstrings = this.getType2Charstrings(charstrings);
  22395. var subrs = this.getType2Subrs(data.subrs);
  22396. this.charstrings = charstrings;
  22397. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  22398. this.seacs = this.getSeacs(data.charstrings);
  22399. }
  22400. Type1Font.prototype = {
  22401. get numGlyphs() {
  22402. return this.charstrings.length + 1;
  22403. },
  22404. getCharset: function Type1Font_getCharset() {
  22405. var charset = [".notdef"];
  22406. var charstrings = this.charstrings;
  22407. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  22408. charset.push(charstrings[glyphId].glyphName);
  22409. }
  22410. return charset;
  22411. },
  22412. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  22413. var charstrings = this.charstrings;
  22414. if (properties.composite) {
  22415. const charCodeToGlyphId = Object.create(null);
  22416. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  22417. const charCode = properties.cMap.charCodeOf(glyphId);
  22418. charCodeToGlyphId[charCode] = glyphId + 1;
  22419. }
  22420. return charCodeToGlyphId;
  22421. }
  22422. var glyphNames = [".notdef"],
  22423. glyphId;
  22424. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  22425. glyphNames.push(charstrings[glyphId].glyphName);
  22426. }
  22427. var encoding = properties.builtInEncoding;
  22428. if (encoding) {
  22429. var builtInEncoding = Object.create(null);
  22430. for (var charCode in encoding) {
  22431. glyphId = glyphNames.indexOf(encoding[charCode]);
  22432. if (glyphId >= 0) {
  22433. builtInEncoding[charCode] = glyphId;
  22434. }
  22435. }
  22436. }
  22437. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  22438. },
  22439. hasGlyphId: function Type1Font_hasGlyphID(id) {
  22440. if (id < 0 || id >= this.numGlyphs) {
  22441. return false;
  22442. }
  22443. if (id === 0) {
  22444. return true;
  22445. }
  22446. var glyph = this.charstrings[id - 1];
  22447. return glyph.charstring.length > 0;
  22448. },
  22449. getSeacs: function Type1Font_getSeacs(charstrings) {
  22450. var i, ii;
  22451. var seacMap = [];
  22452. for (i = 0, ii = charstrings.length; i < ii; i++) {
  22453. var charstring = charstrings[i];
  22454. if (charstring.seac) {
  22455. seacMap[i + 1] = charstring.seac;
  22456. }
  22457. }
  22458. return seacMap;
  22459. },
  22460. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  22461. var type2Charstrings = [];
  22462. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  22463. type2Charstrings.push(type1Charstrings[i].charstring);
  22464. }
  22465. return type2Charstrings;
  22466. },
  22467. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  22468. var bias = 0;
  22469. var count = type1Subrs.length;
  22470. if (count < 1133) {
  22471. bias = 107;
  22472. } else if (count < 33769) {
  22473. bias = 1131;
  22474. } else {
  22475. bias = 32768;
  22476. }
  22477. var type2Subrs = [];
  22478. var i;
  22479. for (i = 0; i < bias; i++) {
  22480. type2Subrs.push([0x0b]);
  22481. }
  22482. for (i = 0; i < count; i++) {
  22483. type2Subrs.push(type1Subrs[i]);
  22484. }
  22485. return type2Subrs;
  22486. },
  22487. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  22488. var cff = new _cff_parser.CFF();
  22489. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  22490. cff.names = [name];
  22491. var topDict = new _cff_parser.CFFTopDict();
  22492. topDict.setByName("version", 391);
  22493. topDict.setByName("Notice", 392);
  22494. topDict.setByName("FullName", 393);
  22495. topDict.setByName("FamilyName", 394);
  22496. topDict.setByName("Weight", 395);
  22497. topDict.setByName("Encoding", null);
  22498. topDict.setByName("FontMatrix", properties.fontMatrix);
  22499. topDict.setByName("FontBBox", properties.bbox);
  22500. topDict.setByName("charset", null);
  22501. topDict.setByName("CharStrings", null);
  22502. topDict.setByName("Private", null);
  22503. cff.topDict = topDict;
  22504. var strings = new _cff_parser.CFFStrings();
  22505. strings.add("Version 0.11");
  22506. strings.add("See original notice");
  22507. strings.add(name);
  22508. strings.add(name);
  22509. strings.add("Medium");
  22510. cff.strings = strings;
  22511. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  22512. var count = glyphs.length;
  22513. var charsetArray = [".notdef"];
  22514. var i, ii;
  22515. for (i = 0; i < count; i++) {
  22516. const glyphName = charstrings[i].glyphName;
  22517. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  22518. if (index === -1) {
  22519. strings.add(glyphName);
  22520. }
  22521. charsetArray.push(glyphName);
  22522. }
  22523. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  22524. var charStringsIndex = new _cff_parser.CFFIndex();
  22525. charStringsIndex.add([0x8b, 0x0e]);
  22526. for (i = 0; i < count; i++) {
  22527. charStringsIndex.add(glyphs[i]);
  22528. }
  22529. cff.charStrings = charStringsIndex;
  22530. var privateDict = new _cff_parser.CFFPrivateDict();
  22531. privateDict.setByName("Subrs", null);
  22532. var fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  22533. for (i = 0, ii = fields.length; i < ii; i++) {
  22534. var field = fields[i];
  22535. if (!(field in properties.privateData)) {
  22536. continue;
  22537. }
  22538. var value = properties.privateData[field];
  22539. if (Array.isArray(value)) {
  22540. for (var j = value.length - 1; j > 0; j--) {
  22541. value[j] -= value[j - 1];
  22542. }
  22543. }
  22544. privateDict.setByName(field, value);
  22545. }
  22546. cff.topDict.privateDict = privateDict;
  22547. var subrIndex = new _cff_parser.CFFIndex();
  22548. for (i = 0, ii = subrs.length; i < ii; i++) {
  22549. subrIndex.add(subrs[i]);
  22550. }
  22551. privateDict.subrsIndex = subrIndex;
  22552. var compiler = new _cff_parser.CFFCompiler(cff);
  22553. return compiler.compile();
  22554. }
  22555. };
  22556. return Type1Font;
  22557. }();
  22558. var CFFFont = function CFFFontClosure() {
  22559. function CFFFont(file, properties) {
  22560. this.properties = properties;
  22561. var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  22562. this.cff = parser.parse();
  22563. this.cff.duplicateFirstGlyph();
  22564. var compiler = new _cff_parser.CFFCompiler(this.cff);
  22565. this.seacs = this.cff.seacs;
  22566. try {
  22567. this.data = compiler.compile();
  22568. } catch (e) {
  22569. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  22570. this.data = file;
  22571. }
  22572. }
  22573. CFFFont.prototype = {
  22574. get numGlyphs() {
  22575. return this.cff.charStrings.count;
  22576. },
  22577. getCharset: function CFFFont_getCharset() {
  22578. return this.cff.charset.charset;
  22579. },
  22580. getGlyphMapping: function CFFFont_getGlyphMapping() {
  22581. var cff = this.cff;
  22582. var properties = this.properties;
  22583. var charsets = cff.charset.charset;
  22584. var charCodeToGlyphId;
  22585. var glyphId;
  22586. if (properties.composite) {
  22587. charCodeToGlyphId = Object.create(null);
  22588. let charCode;
  22589. if (cff.isCIDFont) {
  22590. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  22591. var cid = charsets[glyphId];
  22592. charCode = properties.cMap.charCodeOf(cid);
  22593. charCodeToGlyphId[charCode] = glyphId;
  22594. }
  22595. } else {
  22596. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  22597. charCode = properties.cMap.charCodeOf(glyphId);
  22598. charCodeToGlyphId[charCode] = glyphId;
  22599. }
  22600. }
  22601. return charCodeToGlyphId;
  22602. }
  22603. var encoding = cff.encoding ? cff.encoding.encoding : null;
  22604. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  22605. return charCodeToGlyphId;
  22606. },
  22607. hasGlyphId: function CFFFont_hasGlyphID(id) {
  22608. return this.cff.hasGlyphId(id);
  22609. }
  22610. };
  22611. return CFFFont;
  22612. }();
  22613. /***/ }),
  22614. /* 30 */
  22615. /***/ (function(module, exports, __w_pdfjs_require__) {
  22616. "use strict";
  22617. Object.defineProperty(exports, "__esModule", {
  22618. value: true
  22619. });
  22620. exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0;
  22621. var _util = __w_pdfjs_require__(2);
  22622. var _charsets = __w_pdfjs_require__(31);
  22623. var _encodings = __w_pdfjs_require__(32);
  22624. var MAX_SUBR_NESTING = 10;
  22625. var 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"];
  22626. exports.CFFStandardStrings = CFFStandardStrings;
  22627. const NUM_STANDARD_CFF_STRINGS = 391;
  22628. var CFFParser = function CFFParserClosure() {
  22629. var CharstringValidationData = [null, {
  22630. id: "hstem",
  22631. min: 2,
  22632. stackClearing: true,
  22633. stem: true
  22634. }, null, {
  22635. id: "vstem",
  22636. min: 2,
  22637. stackClearing: true,
  22638. stem: true
  22639. }, {
  22640. id: "vmoveto",
  22641. min: 1,
  22642. stackClearing: true
  22643. }, {
  22644. id: "rlineto",
  22645. min: 2,
  22646. resetStack: true
  22647. }, {
  22648. id: "hlineto",
  22649. min: 1,
  22650. resetStack: true
  22651. }, {
  22652. id: "vlineto",
  22653. min: 1,
  22654. resetStack: true
  22655. }, {
  22656. id: "rrcurveto",
  22657. min: 6,
  22658. resetStack: true
  22659. }, null, {
  22660. id: "callsubr",
  22661. min: 1,
  22662. undefStack: true
  22663. }, {
  22664. id: "return",
  22665. min: 0,
  22666. undefStack: true
  22667. }, null, null, {
  22668. id: "endchar",
  22669. min: 0,
  22670. stackClearing: true
  22671. }, null, null, null, {
  22672. id: "hstemhm",
  22673. min: 2,
  22674. stackClearing: true,
  22675. stem: true
  22676. }, {
  22677. id: "hintmask",
  22678. min: 0,
  22679. stackClearing: true
  22680. }, {
  22681. id: "cntrmask",
  22682. min: 0,
  22683. stackClearing: true
  22684. }, {
  22685. id: "rmoveto",
  22686. min: 2,
  22687. stackClearing: true
  22688. }, {
  22689. id: "hmoveto",
  22690. min: 1,
  22691. stackClearing: true
  22692. }, {
  22693. id: "vstemhm",
  22694. min: 2,
  22695. stackClearing: true,
  22696. stem: true
  22697. }, {
  22698. id: "rcurveline",
  22699. min: 8,
  22700. resetStack: true
  22701. }, {
  22702. id: "rlinecurve",
  22703. min: 8,
  22704. resetStack: true
  22705. }, {
  22706. id: "vvcurveto",
  22707. min: 4,
  22708. resetStack: true
  22709. }, {
  22710. id: "hhcurveto",
  22711. min: 4,
  22712. resetStack: true
  22713. }, null, {
  22714. id: "callgsubr",
  22715. min: 1,
  22716. undefStack: true
  22717. }, {
  22718. id: "vhcurveto",
  22719. min: 4,
  22720. resetStack: true
  22721. }, {
  22722. id: "hvcurveto",
  22723. min: 4,
  22724. resetStack: true
  22725. }];
  22726. var CharstringValidationData12 = [null, null, null, {
  22727. id: "and",
  22728. min: 2,
  22729. stackDelta: -1
  22730. }, {
  22731. id: "or",
  22732. min: 2,
  22733. stackDelta: -1
  22734. }, {
  22735. id: "not",
  22736. min: 1,
  22737. stackDelta: 0
  22738. }, null, null, null, {
  22739. id: "abs",
  22740. min: 1,
  22741. stackDelta: 0
  22742. }, {
  22743. id: "add",
  22744. min: 2,
  22745. stackDelta: -1,
  22746. stackFn: function stack_div(stack, index) {
  22747. stack[index - 2] = stack[index - 2] + stack[index - 1];
  22748. }
  22749. }, {
  22750. id: "sub",
  22751. min: 2,
  22752. stackDelta: -1,
  22753. stackFn: function stack_div(stack, index) {
  22754. stack[index - 2] = stack[index - 2] - stack[index - 1];
  22755. }
  22756. }, {
  22757. id: "div",
  22758. min: 2,
  22759. stackDelta: -1,
  22760. stackFn: function stack_div(stack, index) {
  22761. stack[index - 2] = stack[index - 2] / stack[index - 1];
  22762. }
  22763. }, null, {
  22764. id: "neg",
  22765. min: 1,
  22766. stackDelta: 0,
  22767. stackFn: function stack_div(stack, index) {
  22768. stack[index - 1] = -stack[index - 1];
  22769. }
  22770. }, {
  22771. id: "eq",
  22772. min: 2,
  22773. stackDelta: -1
  22774. }, null, null, {
  22775. id: "drop",
  22776. min: 1,
  22777. stackDelta: -1
  22778. }, null, {
  22779. id: "put",
  22780. min: 2,
  22781. stackDelta: -2
  22782. }, {
  22783. id: "get",
  22784. min: 1,
  22785. stackDelta: 0
  22786. }, {
  22787. id: "ifelse",
  22788. min: 4,
  22789. stackDelta: -3
  22790. }, {
  22791. id: "random",
  22792. min: 0,
  22793. stackDelta: 1
  22794. }, {
  22795. id: "mul",
  22796. min: 2,
  22797. stackDelta: -1,
  22798. stackFn: function stack_div(stack, index) {
  22799. stack[index - 2] = stack[index - 2] * stack[index - 1];
  22800. }
  22801. }, null, {
  22802. id: "sqrt",
  22803. min: 1,
  22804. stackDelta: 0
  22805. }, {
  22806. id: "dup",
  22807. min: 1,
  22808. stackDelta: 1
  22809. }, {
  22810. id: "exch",
  22811. min: 2,
  22812. stackDelta: 0
  22813. }, {
  22814. id: "index",
  22815. min: 2,
  22816. stackDelta: 0
  22817. }, {
  22818. id: "roll",
  22819. min: 3,
  22820. stackDelta: -2
  22821. }, null, null, null, {
  22822. id: "hflex",
  22823. min: 7,
  22824. resetStack: true
  22825. }, {
  22826. id: "flex",
  22827. min: 13,
  22828. resetStack: true
  22829. }, {
  22830. id: "hflex1",
  22831. min: 9,
  22832. resetStack: true
  22833. }, {
  22834. id: "flex1",
  22835. min: 11,
  22836. resetStack: true
  22837. }];
  22838. function CFFParser(file, properties, seacAnalysisEnabled) {
  22839. this.bytes = file.getBytes();
  22840. this.properties = properties;
  22841. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  22842. }
  22843. CFFParser.prototype = {
  22844. parse: function CFFParser_parse() {
  22845. var properties = this.properties;
  22846. var cff = new CFF();
  22847. this.cff = cff;
  22848. var header = this.parseHeader();
  22849. var nameIndex = this.parseIndex(header.endPos);
  22850. var topDictIndex = this.parseIndex(nameIndex.endPos);
  22851. var stringIndex = this.parseIndex(topDictIndex.endPos);
  22852. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  22853. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  22854. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  22855. cff.header = header.obj;
  22856. cff.names = this.parseNameIndex(nameIndex.obj);
  22857. cff.strings = this.parseStringIndex(stringIndex.obj);
  22858. cff.topDict = topDict;
  22859. cff.globalSubrIndex = globalSubrIndex.obj;
  22860. this.parsePrivateDict(cff.topDict);
  22861. cff.isCIDFont = topDict.hasName("ROS");
  22862. var charStringOffset = topDict.getByName("CharStrings");
  22863. var charStringIndex = this.parseIndex(charStringOffset).obj;
  22864. var fontMatrix = topDict.getByName("FontMatrix");
  22865. if (fontMatrix) {
  22866. properties.fontMatrix = fontMatrix;
  22867. }
  22868. var fontBBox = topDict.getByName("FontBBox");
  22869. if (fontBBox) {
  22870. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  22871. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  22872. properties.ascentScaled = true;
  22873. }
  22874. var charset, encoding;
  22875. if (cff.isCIDFont) {
  22876. var fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  22877. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  22878. var dictRaw = fdArrayIndex.get(i);
  22879. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  22880. this.parsePrivateDict(fontDict);
  22881. cff.fdArray.push(fontDict);
  22882. }
  22883. encoding = null;
  22884. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  22885. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  22886. } else {
  22887. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  22888. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  22889. }
  22890. cff.charset = charset;
  22891. cff.encoding = encoding;
  22892. var charStringsAndSeacs = this.parseCharStrings({
  22893. charStrings: charStringIndex,
  22894. localSubrIndex: topDict.privateDict.subrsIndex,
  22895. globalSubrIndex: globalSubrIndex.obj,
  22896. fdSelect: cff.fdSelect,
  22897. fdArray: cff.fdArray,
  22898. privateDict: topDict.privateDict
  22899. });
  22900. cff.charStrings = charStringsAndSeacs.charStrings;
  22901. cff.seacs = charStringsAndSeacs.seacs;
  22902. cff.widths = charStringsAndSeacs.widths;
  22903. return cff;
  22904. },
  22905. parseHeader: function CFFParser_parseHeader() {
  22906. var bytes = this.bytes;
  22907. var bytesLength = bytes.length;
  22908. var offset = 0;
  22909. while (offset < bytesLength && bytes[offset] !== 1) {
  22910. ++offset;
  22911. }
  22912. if (offset >= bytesLength) {
  22913. throw new _util.FormatError("Invalid CFF header");
  22914. }
  22915. if (offset !== 0) {
  22916. (0, _util.info)("cff data is shifted");
  22917. bytes = bytes.subarray(offset);
  22918. this.bytes = bytes;
  22919. }
  22920. var major = bytes[0];
  22921. var minor = bytes[1];
  22922. var hdrSize = bytes[2];
  22923. var offSize = bytes[3];
  22924. var header = new CFFHeader(major, minor, hdrSize, offSize);
  22925. return {
  22926. obj: header,
  22927. endPos: hdrSize
  22928. };
  22929. },
  22930. parseDict: function CFFParser_parseDict(dict) {
  22931. var pos = 0;
  22932. function parseOperand() {
  22933. var value = dict[pos++];
  22934. if (value === 30) {
  22935. return parseFloatOperand();
  22936. } else if (value === 28) {
  22937. value = dict[pos++];
  22938. value = (value << 24 | dict[pos++] << 16) >> 16;
  22939. return value;
  22940. } else if (value === 29) {
  22941. value = dict[pos++];
  22942. value = value << 8 | dict[pos++];
  22943. value = value << 8 | dict[pos++];
  22944. value = value << 8 | dict[pos++];
  22945. return value;
  22946. } else if (value >= 32 && value <= 246) {
  22947. return value - 139;
  22948. } else if (value >= 247 && value <= 250) {
  22949. return (value - 247) * 256 + dict[pos++] + 108;
  22950. } else if (value >= 251 && value <= 254) {
  22951. return -((value - 251) * 256) - dict[pos++] - 108;
  22952. }
  22953. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  22954. return NaN;
  22955. }
  22956. function parseFloatOperand() {
  22957. var str = "";
  22958. var eof = 15;
  22959. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  22960. var length = dict.length;
  22961. while (pos < length) {
  22962. var b = dict[pos++];
  22963. var b1 = b >> 4;
  22964. var b2 = b & 15;
  22965. if (b1 === eof) {
  22966. break;
  22967. }
  22968. str += lookup[b1];
  22969. if (b2 === eof) {
  22970. break;
  22971. }
  22972. str += lookup[b2];
  22973. }
  22974. return parseFloat(str);
  22975. }
  22976. var operands = [];
  22977. var entries = [];
  22978. pos = 0;
  22979. var end = dict.length;
  22980. while (pos < end) {
  22981. var b = dict[pos];
  22982. if (b <= 21) {
  22983. if (b === 12) {
  22984. b = b << 8 | dict[++pos];
  22985. }
  22986. entries.push([b, operands]);
  22987. operands = [];
  22988. ++pos;
  22989. } else {
  22990. operands.push(parseOperand());
  22991. }
  22992. }
  22993. return entries;
  22994. },
  22995. parseIndex: function CFFParser_parseIndex(pos) {
  22996. var cffIndex = new CFFIndex();
  22997. var bytes = this.bytes;
  22998. var count = bytes[pos++] << 8 | bytes[pos++];
  22999. var offsets = [];
  23000. var end = pos;
  23001. var i, ii;
  23002. if (count !== 0) {
  23003. var offsetSize = bytes[pos++];
  23004. var startPos = pos + (count + 1) * offsetSize - 1;
  23005. for (i = 0, ii = count + 1; i < ii; ++i) {
  23006. var offset = 0;
  23007. for (var j = 0; j < offsetSize; ++j) {
  23008. offset <<= 8;
  23009. offset += bytes[pos++];
  23010. }
  23011. offsets.push(startPos + offset);
  23012. }
  23013. end = offsets[count];
  23014. }
  23015. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  23016. var offsetStart = offsets[i];
  23017. var offsetEnd = offsets[i + 1];
  23018. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  23019. }
  23020. return {
  23021. obj: cffIndex,
  23022. endPos: end
  23023. };
  23024. },
  23025. parseNameIndex: function CFFParser_parseNameIndex(index) {
  23026. var names = [];
  23027. for (var i = 0, ii = index.count; i < ii; ++i) {
  23028. var name = index.get(i);
  23029. names.push((0, _util.bytesToString)(name));
  23030. }
  23031. return names;
  23032. },
  23033. parseStringIndex: function CFFParser_parseStringIndex(index) {
  23034. var strings = new CFFStrings();
  23035. for (var i = 0, ii = index.count; i < ii; ++i) {
  23036. var data = index.get(i);
  23037. strings.add((0, _util.bytesToString)(data));
  23038. }
  23039. return strings;
  23040. },
  23041. createDict: function CFFParser_createDict(Type, dict, strings) {
  23042. var cffDict = new Type(strings);
  23043. for (var i = 0, ii = dict.length; i < ii; ++i) {
  23044. var pair = dict[i];
  23045. var key = pair[0];
  23046. var value = pair[1];
  23047. cffDict.setByKey(key, value);
  23048. }
  23049. return cffDict;
  23050. },
  23051. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  23052. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  23053. return false;
  23054. }
  23055. var stackSize = state.stackSize;
  23056. var stack = state.stack;
  23057. var length = data.length;
  23058. for (var j = 0; j < length;) {
  23059. var value = data[j++];
  23060. var validationCommand = null;
  23061. if (value === 12) {
  23062. var q = data[j++];
  23063. if (q === 0) {
  23064. data[j - 2] = 139;
  23065. data[j - 1] = 22;
  23066. stackSize = 0;
  23067. } else {
  23068. validationCommand = CharstringValidationData12[q];
  23069. }
  23070. } else if (value === 28) {
  23071. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  23072. j += 2;
  23073. stackSize++;
  23074. } else if (value === 14) {
  23075. if (stackSize >= 4) {
  23076. stackSize -= 4;
  23077. if (this.seacAnalysisEnabled) {
  23078. state.seac = stack.slice(stackSize, stackSize + 4);
  23079. return false;
  23080. }
  23081. }
  23082. validationCommand = CharstringValidationData[value];
  23083. } else if (value >= 32 && value <= 246) {
  23084. stack[stackSize] = value - 139;
  23085. stackSize++;
  23086. } else if (value >= 247 && value <= 254) {
  23087. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  23088. j++;
  23089. stackSize++;
  23090. } else if (value === 255) {
  23091. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  23092. j += 4;
  23093. stackSize++;
  23094. } else if (value === 19 || value === 20) {
  23095. state.hints += stackSize >> 1;
  23096. j += state.hints + 7 >> 3;
  23097. stackSize %= 2;
  23098. validationCommand = CharstringValidationData[value];
  23099. } else if (value === 10 || value === 29) {
  23100. var subrsIndex;
  23101. if (value === 10) {
  23102. subrsIndex = localSubrIndex;
  23103. } else {
  23104. subrsIndex = globalSubrIndex;
  23105. }
  23106. if (!subrsIndex) {
  23107. validationCommand = CharstringValidationData[value];
  23108. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  23109. return false;
  23110. }
  23111. var bias = 32768;
  23112. if (subrsIndex.count < 1240) {
  23113. bias = 107;
  23114. } else if (subrsIndex.count < 33900) {
  23115. bias = 1131;
  23116. }
  23117. var subrNumber = stack[--stackSize] + bias;
  23118. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  23119. validationCommand = CharstringValidationData[value];
  23120. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  23121. return false;
  23122. }
  23123. state.stackSize = stackSize;
  23124. state.callDepth++;
  23125. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  23126. if (!valid) {
  23127. return false;
  23128. }
  23129. state.callDepth--;
  23130. stackSize = state.stackSize;
  23131. continue;
  23132. } else if (value === 11) {
  23133. state.stackSize = stackSize;
  23134. return true;
  23135. } else {
  23136. validationCommand = CharstringValidationData[value];
  23137. }
  23138. if (validationCommand) {
  23139. if (validationCommand.stem) {
  23140. state.hints += stackSize >> 1;
  23141. if (value === 3 || value === 23) {
  23142. state.hasVStems = true;
  23143. } else if (state.hasVStems && (value === 1 || value === 18)) {
  23144. (0, _util.warn)("CFF stem hints are in wrong order");
  23145. data[j - 1] = value === 1 ? 3 : 23;
  23146. }
  23147. }
  23148. if ("min" in validationCommand) {
  23149. if (!state.undefStack && stackSize < validationCommand.min) {
  23150. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  23151. return false;
  23152. }
  23153. }
  23154. if (state.firstStackClearing && validationCommand.stackClearing) {
  23155. state.firstStackClearing = false;
  23156. stackSize -= validationCommand.min;
  23157. if (stackSize >= 2 && validationCommand.stem) {
  23158. stackSize %= 2;
  23159. } else if (stackSize > 1) {
  23160. (0, _util.warn)("Found too many parameters for stack-clearing command");
  23161. }
  23162. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  23163. state.width = stack[stackSize - 1];
  23164. }
  23165. }
  23166. if ("stackDelta" in validationCommand) {
  23167. if ("stackFn" in validationCommand) {
  23168. validationCommand.stackFn(stack, stackSize);
  23169. }
  23170. stackSize += validationCommand.stackDelta;
  23171. } else if (validationCommand.stackClearing) {
  23172. stackSize = 0;
  23173. } else if (validationCommand.resetStack) {
  23174. stackSize = 0;
  23175. state.undefStack = false;
  23176. } else if (validationCommand.undefStack) {
  23177. stackSize = 0;
  23178. state.undefStack = true;
  23179. state.firstStackClearing = false;
  23180. }
  23181. }
  23182. }
  23183. state.stackSize = stackSize;
  23184. return true;
  23185. },
  23186. parseCharStrings({
  23187. charStrings,
  23188. localSubrIndex,
  23189. globalSubrIndex,
  23190. fdSelect,
  23191. fdArray,
  23192. privateDict
  23193. }) {
  23194. var seacs = [];
  23195. var widths = [];
  23196. var count = charStrings.count;
  23197. for (var i = 0; i < count; i++) {
  23198. var charstring = charStrings.get(i);
  23199. var state = {
  23200. callDepth: 0,
  23201. stackSize: 0,
  23202. stack: [],
  23203. undefStack: true,
  23204. hints: 0,
  23205. firstStackClearing: true,
  23206. seac: null,
  23207. width: null,
  23208. hasVStems: false
  23209. };
  23210. var valid = true;
  23211. var localSubrToUse = null;
  23212. var privateDictToUse = privateDict;
  23213. if (fdSelect && fdArray.length) {
  23214. var fdIndex = fdSelect.getFDIndex(i);
  23215. if (fdIndex === -1) {
  23216. (0, _util.warn)("Glyph index is not in fd select.");
  23217. valid = false;
  23218. }
  23219. if (fdIndex >= fdArray.length) {
  23220. (0, _util.warn)("Invalid fd index for glyph index.");
  23221. valid = false;
  23222. }
  23223. if (valid) {
  23224. privateDictToUse = fdArray[fdIndex].privateDict;
  23225. localSubrToUse = privateDictToUse.subrsIndex;
  23226. }
  23227. } else if (localSubrIndex) {
  23228. localSubrToUse = localSubrIndex;
  23229. }
  23230. if (valid) {
  23231. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  23232. }
  23233. if (state.width !== null) {
  23234. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  23235. widths[i] = nominalWidth + state.width;
  23236. } else {
  23237. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  23238. widths[i] = defaultWidth;
  23239. }
  23240. if (state.seac !== null) {
  23241. seacs[i] = state.seac;
  23242. }
  23243. if (!valid) {
  23244. charStrings.set(i, new Uint8Array([14]));
  23245. }
  23246. }
  23247. return {
  23248. charStrings,
  23249. seacs,
  23250. widths
  23251. };
  23252. },
  23253. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  23254. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  23255. parentDict.setByKey(18, [0, 0]);
  23256. parentDict.privateDict = privateDict;
  23257. },
  23258. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  23259. if (!parentDict.hasName("Private")) {
  23260. this.emptyPrivateDictionary(parentDict);
  23261. return;
  23262. }
  23263. var privateOffset = parentDict.getByName("Private");
  23264. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  23265. parentDict.removeByName("Private");
  23266. return;
  23267. }
  23268. var size = privateOffset[0];
  23269. var offset = privateOffset[1];
  23270. if (size === 0 || offset >= this.bytes.length) {
  23271. this.emptyPrivateDictionary(parentDict);
  23272. return;
  23273. }
  23274. var privateDictEnd = offset + size;
  23275. var dictData = this.bytes.subarray(offset, privateDictEnd);
  23276. var dict = this.parseDict(dictData);
  23277. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  23278. parentDict.privateDict = privateDict;
  23279. if (!privateDict.getByName("Subrs")) {
  23280. return;
  23281. }
  23282. var subrsOffset = privateDict.getByName("Subrs");
  23283. var relativeOffset = offset + subrsOffset;
  23284. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  23285. this.emptyPrivateDictionary(parentDict);
  23286. return;
  23287. }
  23288. var subrsIndex = this.parseIndex(relativeOffset);
  23289. privateDict.subrsIndex = subrsIndex.obj;
  23290. },
  23291. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  23292. if (pos === 0) {
  23293. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  23294. } else if (pos === 1) {
  23295. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  23296. } else if (pos === 2) {
  23297. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  23298. }
  23299. var bytes = this.bytes;
  23300. var start = pos;
  23301. var format = bytes[pos++];
  23302. const charset = [cid ? 0 : ".notdef"];
  23303. var id, count, i;
  23304. length -= 1;
  23305. switch (format) {
  23306. case 0:
  23307. for (i = 0; i < length; i++) {
  23308. id = bytes[pos++] << 8 | bytes[pos++];
  23309. charset.push(cid ? id : strings.get(id));
  23310. }
  23311. break;
  23312. case 1:
  23313. while (charset.length <= length) {
  23314. id = bytes[pos++] << 8 | bytes[pos++];
  23315. count = bytes[pos++];
  23316. for (i = 0; i <= count; i++) {
  23317. charset.push(cid ? id++ : strings.get(id++));
  23318. }
  23319. }
  23320. break;
  23321. case 2:
  23322. while (charset.length <= length) {
  23323. id = bytes[pos++] << 8 | bytes[pos++];
  23324. count = bytes[pos++] << 8 | bytes[pos++];
  23325. for (i = 0; i <= count; i++) {
  23326. charset.push(cid ? id++ : strings.get(id++));
  23327. }
  23328. }
  23329. break;
  23330. default:
  23331. throw new _util.FormatError("Unknown charset format");
  23332. }
  23333. var end = pos;
  23334. var raw = bytes.subarray(start, end);
  23335. return new CFFCharset(false, format, charset, raw);
  23336. },
  23337. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  23338. var encoding = Object.create(null);
  23339. var bytes = this.bytes;
  23340. var predefined = false;
  23341. var format, i, ii;
  23342. var raw = null;
  23343. function readSupplement() {
  23344. var supplementsCount = bytes[pos++];
  23345. for (i = 0; i < supplementsCount; i++) {
  23346. var code = bytes[pos++];
  23347. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  23348. encoding[code] = charset.indexOf(strings.get(sid));
  23349. }
  23350. }
  23351. if (pos === 0 || pos === 1) {
  23352. predefined = true;
  23353. format = pos;
  23354. var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  23355. for (i = 0, ii = charset.length; i < ii; i++) {
  23356. var index = baseEncoding.indexOf(charset[i]);
  23357. if (index !== -1) {
  23358. encoding[index] = i;
  23359. }
  23360. }
  23361. } else {
  23362. var dataStart = pos;
  23363. format = bytes[pos++];
  23364. switch (format & 0x7f) {
  23365. case 0:
  23366. var glyphsCount = bytes[pos++];
  23367. for (i = 1; i <= glyphsCount; i++) {
  23368. encoding[bytes[pos++]] = i;
  23369. }
  23370. break;
  23371. case 1:
  23372. var rangesCount = bytes[pos++];
  23373. var gid = 1;
  23374. for (i = 0; i < rangesCount; i++) {
  23375. var start = bytes[pos++];
  23376. var left = bytes[pos++];
  23377. for (var j = start; j <= start + left; j++) {
  23378. encoding[j] = gid++;
  23379. }
  23380. }
  23381. break;
  23382. default:
  23383. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  23384. }
  23385. var dataEnd = pos;
  23386. if (format & 0x80) {
  23387. bytes[dataStart] &= 0x7f;
  23388. readSupplement();
  23389. }
  23390. raw = bytes.subarray(dataStart, dataEnd);
  23391. }
  23392. format = format & 0x7f;
  23393. return new CFFEncoding(predefined, format, encoding, raw);
  23394. },
  23395. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  23396. var bytes = this.bytes;
  23397. var format = bytes[pos++];
  23398. var fdSelect = [];
  23399. var i;
  23400. switch (format) {
  23401. case 0:
  23402. for (i = 0; i < length; ++i) {
  23403. var id = bytes[pos++];
  23404. fdSelect.push(id);
  23405. }
  23406. break;
  23407. case 3:
  23408. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  23409. for (i = 0; i < rangesCount; ++i) {
  23410. var first = bytes[pos++] << 8 | bytes[pos++];
  23411. if (i === 0 && first !== 0) {
  23412. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  23413. first = 0;
  23414. }
  23415. var fdIndex = bytes[pos++];
  23416. var next = bytes[pos] << 8 | bytes[pos + 1];
  23417. for (var j = first; j < next; ++j) {
  23418. fdSelect.push(fdIndex);
  23419. }
  23420. }
  23421. pos += 2;
  23422. break;
  23423. default:
  23424. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  23425. }
  23426. if (fdSelect.length !== length) {
  23427. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  23428. }
  23429. return new CFFFDSelect(format, fdSelect);
  23430. }
  23431. };
  23432. return CFFParser;
  23433. }();
  23434. exports.CFFParser = CFFParser;
  23435. var CFF = function CFFClosure() {
  23436. function CFF() {
  23437. this.header = null;
  23438. this.names = [];
  23439. this.topDict = null;
  23440. this.strings = new CFFStrings();
  23441. this.globalSubrIndex = null;
  23442. this.encoding = null;
  23443. this.charset = null;
  23444. this.charStrings = null;
  23445. this.fdArray = [];
  23446. this.fdSelect = null;
  23447. this.isCIDFont = false;
  23448. }
  23449. CFF.prototype = {
  23450. duplicateFirstGlyph: function CFF_duplicateFirstGlyph() {
  23451. if (this.charStrings.count >= 65535) {
  23452. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  23453. return;
  23454. }
  23455. var glyphZero = this.charStrings.get(0);
  23456. this.charStrings.add(glyphZero);
  23457. if (this.isCIDFont) {
  23458. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  23459. }
  23460. },
  23461. hasGlyphId: function CFF_hasGlyphID(id) {
  23462. if (id < 0 || id >= this.charStrings.count) {
  23463. return false;
  23464. }
  23465. var glyph = this.charStrings.get(id);
  23466. return glyph.length > 0;
  23467. }
  23468. };
  23469. return CFF;
  23470. }();
  23471. exports.CFF = CFF;
  23472. var CFFHeader = function CFFHeaderClosure() {
  23473. function CFFHeader(major, minor, hdrSize, offSize) {
  23474. this.major = major;
  23475. this.minor = minor;
  23476. this.hdrSize = hdrSize;
  23477. this.offSize = offSize;
  23478. }
  23479. return CFFHeader;
  23480. }();
  23481. exports.CFFHeader = CFFHeader;
  23482. var CFFStrings = function CFFStringsClosure() {
  23483. function CFFStrings() {
  23484. this.strings = [];
  23485. }
  23486. CFFStrings.prototype = {
  23487. get: function CFFStrings_get(index) {
  23488. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  23489. return CFFStandardStrings[index];
  23490. }
  23491. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  23492. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  23493. }
  23494. return CFFStandardStrings[0];
  23495. },
  23496. getSID: function CFFStrings_getSID(str) {
  23497. let index = CFFStandardStrings.indexOf(str);
  23498. if (index !== -1) {
  23499. return index;
  23500. }
  23501. index = this.strings.indexOf(str);
  23502. if (index !== -1) {
  23503. return index + NUM_STANDARD_CFF_STRINGS;
  23504. }
  23505. return -1;
  23506. },
  23507. add: function CFFStrings_add(value) {
  23508. this.strings.push(value);
  23509. },
  23510. get count() {
  23511. return this.strings.length;
  23512. }
  23513. };
  23514. return CFFStrings;
  23515. }();
  23516. exports.CFFStrings = CFFStrings;
  23517. var CFFIndex = function CFFIndexClosure() {
  23518. function CFFIndex() {
  23519. this.objects = [];
  23520. this.length = 0;
  23521. }
  23522. CFFIndex.prototype = {
  23523. add: function CFFIndex_add(data) {
  23524. this.length += data.length;
  23525. this.objects.push(data);
  23526. },
  23527. set: function CFFIndex_set(index, data) {
  23528. this.length += data.length - this.objects[index].length;
  23529. this.objects[index] = data;
  23530. },
  23531. get: function CFFIndex_get(index) {
  23532. return this.objects[index];
  23533. },
  23534. get count() {
  23535. return this.objects.length;
  23536. }
  23537. };
  23538. return CFFIndex;
  23539. }();
  23540. exports.CFFIndex = CFFIndex;
  23541. var CFFDict = function CFFDictClosure() {
  23542. function CFFDict(tables, strings) {
  23543. this.keyToNameMap = tables.keyToNameMap;
  23544. this.nameToKeyMap = tables.nameToKeyMap;
  23545. this.defaults = tables.defaults;
  23546. this.types = tables.types;
  23547. this.opcodes = tables.opcodes;
  23548. this.order = tables.order;
  23549. this.strings = strings;
  23550. this.values = Object.create(null);
  23551. }
  23552. CFFDict.prototype = {
  23553. setByKey: function CFFDict_setByKey(key, value) {
  23554. if (!(key in this.keyToNameMap)) {
  23555. return false;
  23556. }
  23557. var valueLength = value.length;
  23558. if (valueLength === 0) {
  23559. return true;
  23560. }
  23561. for (var i = 0; i < valueLength; i++) {
  23562. if (isNaN(value[i])) {
  23563. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  23564. return true;
  23565. }
  23566. }
  23567. var type = this.types[key];
  23568. if (type === "num" || type === "sid" || type === "offset") {
  23569. value = value[0];
  23570. }
  23571. this.values[key] = value;
  23572. return true;
  23573. },
  23574. setByName: function CFFDict_setByName(name, value) {
  23575. if (!(name in this.nameToKeyMap)) {
  23576. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  23577. }
  23578. this.values[this.nameToKeyMap[name]] = value;
  23579. },
  23580. hasName: function CFFDict_hasName(name) {
  23581. return this.nameToKeyMap[name] in this.values;
  23582. },
  23583. getByName: function CFFDict_getByName(name) {
  23584. if (!(name in this.nameToKeyMap)) {
  23585. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  23586. }
  23587. var key = this.nameToKeyMap[name];
  23588. if (!(key in this.values)) {
  23589. return this.defaults[key];
  23590. }
  23591. return this.values[key];
  23592. },
  23593. removeByName: function CFFDict_removeByName(name) {
  23594. delete this.values[this.nameToKeyMap[name]];
  23595. }
  23596. };
  23597. CFFDict.createTables = function CFFDict_createTables(layout) {
  23598. var tables = {
  23599. keyToNameMap: {},
  23600. nameToKeyMap: {},
  23601. defaults: {},
  23602. types: {},
  23603. opcodes: {},
  23604. order: []
  23605. };
  23606. for (var i = 0, ii = layout.length; i < ii; ++i) {
  23607. var entry = layout[i];
  23608. var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  23609. tables.keyToNameMap[key] = entry[1];
  23610. tables.nameToKeyMap[entry[1]] = key;
  23611. tables.types[key] = entry[2];
  23612. tables.defaults[key] = entry[3];
  23613. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  23614. tables.order.push(key);
  23615. }
  23616. return tables;
  23617. };
  23618. return CFFDict;
  23619. }();
  23620. var CFFTopDict = function CFFTopDictClosure() {
  23621. var 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]];
  23622. var tables = null;
  23623. function CFFTopDict(strings) {
  23624. if (tables === null) {
  23625. tables = CFFDict.createTables(layout);
  23626. }
  23627. CFFDict.call(this, tables, strings);
  23628. this.privateDict = null;
  23629. }
  23630. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  23631. return CFFTopDict;
  23632. }();
  23633. exports.CFFTopDict = CFFTopDict;
  23634. var CFFPrivateDict = function CFFPrivateDictClosure() {
  23635. var 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]];
  23636. var tables = null;
  23637. function CFFPrivateDict(strings) {
  23638. if (tables === null) {
  23639. tables = CFFDict.createTables(layout);
  23640. }
  23641. CFFDict.call(this, tables, strings);
  23642. this.subrsIndex = null;
  23643. }
  23644. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  23645. return CFFPrivateDict;
  23646. }();
  23647. exports.CFFPrivateDict = CFFPrivateDict;
  23648. var CFFCharsetPredefinedTypes = {
  23649. ISO_ADOBE: 0,
  23650. EXPERT: 1,
  23651. EXPERT_SUBSET: 2
  23652. };
  23653. var CFFCharset = function CFFCharsetClosure() {
  23654. function CFFCharset(predefined, format, charset, raw) {
  23655. this.predefined = predefined;
  23656. this.format = format;
  23657. this.charset = charset;
  23658. this.raw = raw;
  23659. }
  23660. return CFFCharset;
  23661. }();
  23662. exports.CFFCharset = CFFCharset;
  23663. var CFFEncoding = function CFFEncodingClosure() {
  23664. function CFFEncoding(predefined, format, encoding, raw) {
  23665. this.predefined = predefined;
  23666. this.format = format;
  23667. this.encoding = encoding;
  23668. this.raw = raw;
  23669. }
  23670. return CFFEncoding;
  23671. }();
  23672. var CFFFDSelect = function CFFFDSelectClosure() {
  23673. function CFFFDSelect(format, fdSelect) {
  23674. this.format = format;
  23675. this.fdSelect = fdSelect;
  23676. }
  23677. CFFFDSelect.prototype = {
  23678. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  23679. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  23680. return -1;
  23681. }
  23682. return this.fdSelect[glyphIndex];
  23683. }
  23684. };
  23685. return CFFFDSelect;
  23686. }();
  23687. exports.CFFFDSelect = CFFFDSelect;
  23688. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  23689. function CFFOffsetTracker() {
  23690. this.offsets = Object.create(null);
  23691. }
  23692. CFFOffsetTracker.prototype = {
  23693. isTracking: function CFFOffsetTracker_isTracking(key) {
  23694. return key in this.offsets;
  23695. },
  23696. track: function CFFOffsetTracker_track(key, location) {
  23697. if (key in this.offsets) {
  23698. throw new _util.FormatError(`Already tracking location of ${key}`);
  23699. }
  23700. this.offsets[key] = location;
  23701. },
  23702. offset: function CFFOffsetTracker_offset(value) {
  23703. for (var key in this.offsets) {
  23704. this.offsets[key] += value;
  23705. }
  23706. },
  23707. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  23708. if (!(key in this.offsets)) {
  23709. throw new _util.FormatError(`Not tracking location of ${key}`);
  23710. }
  23711. var data = output.data;
  23712. var dataOffset = this.offsets[key];
  23713. var size = 5;
  23714. for (var i = 0, ii = values.length; i < ii; ++i) {
  23715. var offset0 = i * size + dataOffset;
  23716. var offset1 = offset0 + 1;
  23717. var offset2 = offset0 + 2;
  23718. var offset3 = offset0 + 3;
  23719. var offset4 = offset0 + 4;
  23720. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  23721. throw new _util.FormatError("writing to an offset that is not empty");
  23722. }
  23723. var value = values[i];
  23724. data[offset0] = 0x1d;
  23725. data[offset1] = value >> 24 & 0xff;
  23726. data[offset2] = value >> 16 & 0xff;
  23727. data[offset3] = value >> 8 & 0xff;
  23728. data[offset4] = value & 0xff;
  23729. }
  23730. }
  23731. };
  23732. return CFFOffsetTracker;
  23733. }();
  23734. var CFFCompiler = function CFFCompilerClosure() {
  23735. function CFFCompiler(cff) {
  23736. this.cff = cff;
  23737. }
  23738. CFFCompiler.prototype = {
  23739. compile: function CFFCompiler_compile() {
  23740. var cff = this.cff;
  23741. var output = {
  23742. data: [],
  23743. length: 0,
  23744. add: function CFFCompiler_add(data) {
  23745. this.data = this.data.concat(data);
  23746. this.length = this.data.length;
  23747. }
  23748. };
  23749. var header = this.compileHeader(cff.header);
  23750. output.add(header);
  23751. var nameIndex = this.compileNameIndex(cff.names);
  23752. output.add(nameIndex);
  23753. if (cff.isCIDFont) {
  23754. if (cff.topDict.hasName("FontMatrix")) {
  23755. var base = cff.topDict.getByName("FontMatrix");
  23756. cff.topDict.removeByName("FontMatrix");
  23757. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  23758. var subDict = cff.fdArray[i];
  23759. var matrix = base.slice(0);
  23760. if (subDict.hasName("FontMatrix")) {
  23761. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  23762. }
  23763. subDict.setByName("FontMatrix", matrix);
  23764. }
  23765. }
  23766. }
  23767. cff.topDict.setByName("charset", 0);
  23768. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  23769. output.add(compiled.output);
  23770. var topDictTracker = compiled.trackers[0];
  23771. var stringIndex = this.compileStringIndex(cff.strings.strings);
  23772. output.add(stringIndex);
  23773. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  23774. output.add(globalSubrIndex);
  23775. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  23776. if (cff.encoding.predefined) {
  23777. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  23778. } else {
  23779. var encoding = this.compileEncoding(cff.encoding);
  23780. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  23781. output.add(encoding);
  23782. }
  23783. }
  23784. var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  23785. topDictTracker.setEntryLocation("charset", [output.length], output);
  23786. output.add(charset);
  23787. var charStrings = this.compileCharStrings(cff.charStrings);
  23788. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  23789. output.add(charStrings);
  23790. if (cff.isCIDFont) {
  23791. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  23792. var fdSelect = this.compileFDSelect(cff.fdSelect);
  23793. output.add(fdSelect);
  23794. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  23795. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  23796. output.add(compiled.output);
  23797. var fontDictTrackers = compiled.trackers;
  23798. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  23799. }
  23800. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  23801. output.add([0]);
  23802. return output.data;
  23803. },
  23804. encodeNumber: function CFFCompiler_encodeNumber(value) {
  23805. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  23806. return this.encodeInteger(value);
  23807. }
  23808. return this.encodeFloat(value);
  23809. },
  23810. encodeFloat: function CFFCompiler_encodeFloat(num) {
  23811. var value = num.toString();
  23812. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  23813. if (m) {
  23814. var epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  23815. value = (Math.round(num * epsilon) / epsilon).toString();
  23816. }
  23817. var nibbles = "";
  23818. var i, ii;
  23819. for (i = 0, ii = value.length; i < ii; ++i) {
  23820. var a = value[i];
  23821. if (a === "e") {
  23822. nibbles += value[++i] === "-" ? "c" : "b";
  23823. } else if (a === ".") {
  23824. nibbles += "a";
  23825. } else if (a === "-") {
  23826. nibbles += "e";
  23827. } else {
  23828. nibbles += a;
  23829. }
  23830. }
  23831. nibbles += nibbles.length & 1 ? "f" : "ff";
  23832. var out = [30];
  23833. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  23834. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  23835. }
  23836. return out;
  23837. },
  23838. encodeInteger: function CFFCompiler_encodeInteger(value) {
  23839. var code;
  23840. if (value >= -107 && value <= 107) {
  23841. code = [value + 139];
  23842. } else if (value >= 108 && value <= 1131) {
  23843. value = value - 108;
  23844. code = [(value >> 8) + 247, value & 0xff];
  23845. } else if (value >= -1131 && value <= -108) {
  23846. value = -value - 108;
  23847. code = [(value >> 8) + 251, value & 0xff];
  23848. } else if (value >= -32768 && value <= 32767) {
  23849. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  23850. } else {
  23851. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  23852. }
  23853. return code;
  23854. },
  23855. compileHeader: function CFFCompiler_compileHeader(header) {
  23856. return [header.major, header.minor, header.hdrSize, header.offSize];
  23857. },
  23858. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  23859. var nameIndex = new CFFIndex();
  23860. for (var i = 0, ii = names.length; i < ii; ++i) {
  23861. var name = names[i];
  23862. var length = Math.min(name.length, 127);
  23863. var sanitizedName = new Array(length);
  23864. for (var j = 0; j < length; j++) {
  23865. var char = name[j];
  23866. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  23867. char = "_";
  23868. }
  23869. sanitizedName[j] = char;
  23870. }
  23871. sanitizedName = sanitizedName.join("");
  23872. if (sanitizedName === "") {
  23873. sanitizedName = "Bad_Font_Name";
  23874. }
  23875. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  23876. }
  23877. return this.compileIndex(nameIndex);
  23878. },
  23879. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  23880. var fontDictTrackers = [];
  23881. var fdArrayIndex = new CFFIndex();
  23882. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  23883. var fontDict = dicts[i];
  23884. if (removeCidKeys) {
  23885. fontDict.removeByName("CIDFontVersion");
  23886. fontDict.removeByName("CIDFontRevision");
  23887. fontDict.removeByName("CIDFontType");
  23888. fontDict.removeByName("CIDCount");
  23889. fontDict.removeByName("UIDBase");
  23890. }
  23891. var fontDictTracker = new CFFOffsetTracker();
  23892. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  23893. fontDictTrackers.push(fontDictTracker);
  23894. fdArrayIndex.add(fontDictData);
  23895. fontDictTracker.offset(length);
  23896. }
  23897. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  23898. return {
  23899. trackers: fontDictTrackers,
  23900. output: fdArrayIndex
  23901. };
  23902. },
  23903. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  23904. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  23905. var fontDict = dicts[i];
  23906. var privateDict = fontDict.privateDict;
  23907. if (!privateDict || !fontDict.hasName("Private")) {
  23908. throw new _util.FormatError("There must be a private dictionary.");
  23909. }
  23910. var privateDictTracker = new CFFOffsetTracker();
  23911. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  23912. var outputLength = output.length;
  23913. privateDictTracker.offset(outputLength);
  23914. if (!privateDictData.length) {
  23915. outputLength = 0;
  23916. }
  23917. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  23918. output.add(privateDictData);
  23919. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  23920. var subrs = this.compileIndex(privateDict.subrsIndex);
  23921. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  23922. output.add(subrs);
  23923. }
  23924. }
  23925. },
  23926. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  23927. var out = [];
  23928. var order = dict.order;
  23929. for (var i = 0; i < order.length; ++i) {
  23930. var key = order[i];
  23931. if (!(key in dict.values)) {
  23932. continue;
  23933. }
  23934. var values = dict.values[key];
  23935. var types = dict.types[key];
  23936. if (!Array.isArray(types)) {
  23937. types = [types];
  23938. }
  23939. if (!Array.isArray(values)) {
  23940. values = [values];
  23941. }
  23942. if (values.length === 0) {
  23943. continue;
  23944. }
  23945. for (var j = 0, jj = types.length; j < jj; ++j) {
  23946. var type = types[j];
  23947. var value = values[j];
  23948. switch (type) {
  23949. case "num":
  23950. case "sid":
  23951. out = out.concat(this.encodeNumber(value));
  23952. break;
  23953. case "offset":
  23954. var name = dict.keyToNameMap[key];
  23955. if (!offsetTracker.isTracking(name)) {
  23956. offsetTracker.track(name, out.length);
  23957. }
  23958. out = out.concat([0x1d, 0, 0, 0, 0]);
  23959. break;
  23960. case "array":
  23961. case "delta":
  23962. out = out.concat(this.encodeNumber(value));
  23963. for (var k = 1, kk = values.length; k < kk; ++k) {
  23964. out = out.concat(this.encodeNumber(values[k]));
  23965. }
  23966. break;
  23967. default:
  23968. throw new _util.FormatError(`Unknown data type of ${type}`);
  23969. }
  23970. }
  23971. out = out.concat(dict.opcodes[key]);
  23972. }
  23973. return out;
  23974. },
  23975. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  23976. var stringIndex = new CFFIndex();
  23977. for (var i = 0, ii = strings.length; i < ii; ++i) {
  23978. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  23979. }
  23980. return this.compileIndex(stringIndex);
  23981. },
  23982. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  23983. var globalSubrIndex = this.cff.globalSubrIndex;
  23984. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  23985. },
  23986. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  23987. var charStringsIndex = new CFFIndex();
  23988. for (var i = 0; i < charStrings.count; i++) {
  23989. var glyph = charStrings.get(i);
  23990. if (glyph.length === 0) {
  23991. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  23992. continue;
  23993. }
  23994. charStringsIndex.add(glyph);
  23995. }
  23996. return this.compileIndex(charStringsIndex);
  23997. },
  23998. compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) {
  23999. let out;
  24000. const numGlyphsLessNotDef = numGlyphs - 1;
  24001. if (isCIDFont) {
  24002. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  24003. } else {
  24004. const length = 1 + numGlyphsLessNotDef * 2;
  24005. out = new Uint8Array(length);
  24006. out[0] = 0;
  24007. let charsetIndex = 0;
  24008. const numCharsets = charset.charset.length;
  24009. let warned = false;
  24010. for (let i = 1; i < out.length; i += 2) {
  24011. let sid = 0;
  24012. if (charsetIndex < numCharsets) {
  24013. const name = charset.charset[charsetIndex++];
  24014. sid = strings.getSID(name);
  24015. if (sid === -1) {
  24016. sid = 0;
  24017. if (!warned) {
  24018. warned = true;
  24019. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  24020. }
  24021. }
  24022. }
  24023. out[i] = sid >> 8 & 0xff;
  24024. out[i + 1] = sid & 0xff;
  24025. }
  24026. }
  24027. return this.compileTypedArray(out);
  24028. },
  24029. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  24030. return this.compileTypedArray(encoding.raw);
  24031. },
  24032. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  24033. const format = fdSelect.format;
  24034. let out, i;
  24035. switch (format) {
  24036. case 0:
  24037. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  24038. out[0] = format;
  24039. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  24040. out[i + 1] = fdSelect.fdSelect[i];
  24041. }
  24042. break;
  24043. case 3:
  24044. const start = 0;
  24045. let lastFD = fdSelect.fdSelect[0];
  24046. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  24047. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  24048. const currentFD = fdSelect.fdSelect[i];
  24049. if (currentFD !== lastFD) {
  24050. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  24051. lastFD = currentFD;
  24052. }
  24053. }
  24054. const numRanges = (ranges.length - 3) / 3;
  24055. ranges[1] = numRanges >> 8 & 0xff;
  24056. ranges[2] = numRanges & 0xff;
  24057. ranges.push(i >> 8 & 0xff, i & 0xff);
  24058. out = new Uint8Array(ranges);
  24059. break;
  24060. }
  24061. return this.compileTypedArray(out);
  24062. },
  24063. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  24064. var out = [];
  24065. for (var i = 0, ii = data.length; i < ii; ++i) {
  24066. out[i] = data[i];
  24067. }
  24068. return out;
  24069. },
  24070. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  24071. trackers = trackers || [];
  24072. var objects = index.objects;
  24073. var count = objects.length;
  24074. if (count === 0) {
  24075. return [0, 0, 0];
  24076. }
  24077. var data = [count >> 8 & 0xff, count & 0xff];
  24078. var lastOffset = 1,
  24079. i;
  24080. for (i = 0; i < count; ++i) {
  24081. lastOffset += objects[i].length;
  24082. }
  24083. var offsetSize;
  24084. if (lastOffset < 0x100) {
  24085. offsetSize = 1;
  24086. } else if (lastOffset < 0x10000) {
  24087. offsetSize = 2;
  24088. } else if (lastOffset < 0x1000000) {
  24089. offsetSize = 3;
  24090. } else {
  24091. offsetSize = 4;
  24092. }
  24093. data.push(offsetSize);
  24094. var relativeOffset = 1;
  24095. for (i = 0; i < count + 1; i++) {
  24096. if (offsetSize === 1) {
  24097. data.push(relativeOffset & 0xff);
  24098. } else if (offsetSize === 2) {
  24099. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24100. } else if (offsetSize === 3) {
  24101. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24102. } else {
  24103. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  24104. }
  24105. if (objects[i]) {
  24106. relativeOffset += objects[i].length;
  24107. }
  24108. }
  24109. for (i = 0; i < count; i++) {
  24110. if (trackers[i]) {
  24111. trackers[i].offset(data.length);
  24112. }
  24113. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  24114. data.push(objects[i][j]);
  24115. }
  24116. }
  24117. return data;
  24118. }
  24119. };
  24120. return CFFCompiler;
  24121. }();
  24122. exports.CFFCompiler = CFFCompiler;
  24123. /***/ }),
  24124. /* 31 */
  24125. /***/ (function(module, exports, __w_pdfjs_require__) {
  24126. "use strict";
  24127. Object.defineProperty(exports, "__esModule", {
  24128. value: true
  24129. });
  24130. exports.ExpertSubsetCharset = exports.ExpertCharset = exports.ISOAdobeCharset = void 0;
  24131. 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"];
  24132. exports.ISOAdobeCharset = ISOAdobeCharset;
  24133. 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"];
  24134. exports.ExpertCharset = ExpertCharset;
  24135. 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"];
  24136. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  24137. /***/ }),
  24138. /* 32 */
  24139. /***/ (function(module, exports, __w_pdfjs_require__) {
  24140. "use strict";
  24141. Object.defineProperty(exports, "__esModule", {
  24142. value: true
  24143. });
  24144. exports.getEncoding = getEncoding;
  24145. exports.ExpertEncoding = exports.ZapfDingbatsEncoding = exports.SymbolSetEncoding = exports.MacRomanEncoding = exports.StandardEncoding = exports.WinAnsiEncoding = void 0;
  24146. 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"];
  24147. exports.ExpertEncoding = ExpertEncoding;
  24148. 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", "", "", "", ""];
  24149. 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"];
  24150. exports.MacRomanEncoding = MacRomanEncoding;
  24151. 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", "", "", "", ""];
  24152. exports.StandardEncoding = StandardEncoding;
  24153. 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"];
  24154. exports.WinAnsiEncoding = WinAnsiEncoding;
  24155. 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", ""];
  24156. exports.SymbolSetEncoding = SymbolSetEncoding;
  24157. 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", ""];
  24158. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  24159. function getEncoding(encodingName) {
  24160. switch (encodingName) {
  24161. case "WinAnsiEncoding":
  24162. return WinAnsiEncoding;
  24163. case "StandardEncoding":
  24164. return StandardEncoding;
  24165. case "MacRomanEncoding":
  24166. return MacRomanEncoding;
  24167. case "SymbolSetEncoding":
  24168. return SymbolSetEncoding;
  24169. case "ZapfDingbatsEncoding":
  24170. return ZapfDingbatsEncoding;
  24171. case "ExpertEncoding":
  24172. return ExpertEncoding;
  24173. case "MacExpertEncoding":
  24174. return MacExpertEncoding;
  24175. default:
  24176. return null;
  24177. }
  24178. }
  24179. /***/ }),
  24180. /* 33 */
  24181. /***/ (function(module, exports, __w_pdfjs_require__) {
  24182. var getLookupTableFactory = __w_pdfjs_require__(8).getLookupTableFactory;
  24183. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  24184. t.A = 0x0041;
  24185. t.AE = 0x00c6;
  24186. t.AEacute = 0x01fc;
  24187. t.AEmacron = 0x01e2;
  24188. t.AEsmall = 0xf7e6;
  24189. t.Aacute = 0x00c1;
  24190. t.Aacutesmall = 0xf7e1;
  24191. t.Abreve = 0x0102;
  24192. t.Abreveacute = 0x1eae;
  24193. t.Abrevecyrillic = 0x04d0;
  24194. t.Abrevedotbelow = 0x1eb6;
  24195. t.Abrevegrave = 0x1eb0;
  24196. t.Abrevehookabove = 0x1eb2;
  24197. t.Abrevetilde = 0x1eb4;
  24198. t.Acaron = 0x01cd;
  24199. t.Acircle = 0x24b6;
  24200. t.Acircumflex = 0x00c2;
  24201. t.Acircumflexacute = 0x1ea4;
  24202. t.Acircumflexdotbelow = 0x1eac;
  24203. t.Acircumflexgrave = 0x1ea6;
  24204. t.Acircumflexhookabove = 0x1ea8;
  24205. t.Acircumflexsmall = 0xf7e2;
  24206. t.Acircumflextilde = 0x1eaa;
  24207. t.Acute = 0xf6c9;
  24208. t.Acutesmall = 0xf7b4;
  24209. t.Acyrillic = 0x0410;
  24210. t.Adblgrave = 0x0200;
  24211. t.Adieresis = 0x00c4;
  24212. t.Adieresiscyrillic = 0x04d2;
  24213. t.Adieresismacron = 0x01de;
  24214. t.Adieresissmall = 0xf7e4;
  24215. t.Adotbelow = 0x1ea0;
  24216. t.Adotmacron = 0x01e0;
  24217. t.Agrave = 0x00c0;
  24218. t.Agravesmall = 0xf7e0;
  24219. t.Ahookabove = 0x1ea2;
  24220. t.Aiecyrillic = 0x04d4;
  24221. t.Ainvertedbreve = 0x0202;
  24222. t.Alpha = 0x0391;
  24223. t.Alphatonos = 0x0386;
  24224. t.Amacron = 0x0100;
  24225. t.Amonospace = 0xff21;
  24226. t.Aogonek = 0x0104;
  24227. t.Aring = 0x00c5;
  24228. t.Aringacute = 0x01fa;
  24229. t.Aringbelow = 0x1e00;
  24230. t.Aringsmall = 0xf7e5;
  24231. t.Asmall = 0xf761;
  24232. t.Atilde = 0x00c3;
  24233. t.Atildesmall = 0xf7e3;
  24234. t.Aybarmenian = 0x0531;
  24235. t.B = 0x0042;
  24236. t.Bcircle = 0x24b7;
  24237. t.Bdotaccent = 0x1e02;
  24238. t.Bdotbelow = 0x1e04;
  24239. t.Becyrillic = 0x0411;
  24240. t.Benarmenian = 0x0532;
  24241. t.Beta = 0x0392;
  24242. t.Bhook = 0x0181;
  24243. t.Blinebelow = 0x1e06;
  24244. t.Bmonospace = 0xff22;
  24245. t.Brevesmall = 0xf6f4;
  24246. t.Bsmall = 0xf762;
  24247. t.Btopbar = 0x0182;
  24248. t.C = 0x0043;
  24249. t.Caarmenian = 0x053e;
  24250. t.Cacute = 0x0106;
  24251. t.Caron = 0xf6ca;
  24252. t.Caronsmall = 0xf6f5;
  24253. t.Ccaron = 0x010c;
  24254. t.Ccedilla = 0x00c7;
  24255. t.Ccedillaacute = 0x1e08;
  24256. t.Ccedillasmall = 0xf7e7;
  24257. t.Ccircle = 0x24b8;
  24258. t.Ccircumflex = 0x0108;
  24259. t.Cdot = 0x010a;
  24260. t.Cdotaccent = 0x010a;
  24261. t.Cedillasmall = 0xf7b8;
  24262. t.Chaarmenian = 0x0549;
  24263. t.Cheabkhasiancyrillic = 0x04bc;
  24264. t.Checyrillic = 0x0427;
  24265. t.Chedescenderabkhasiancyrillic = 0x04be;
  24266. t.Chedescendercyrillic = 0x04b6;
  24267. t.Chedieresiscyrillic = 0x04f4;
  24268. t.Cheharmenian = 0x0543;
  24269. t.Chekhakassiancyrillic = 0x04cb;
  24270. t.Cheverticalstrokecyrillic = 0x04b8;
  24271. t.Chi = 0x03a7;
  24272. t.Chook = 0x0187;
  24273. t.Circumflexsmall = 0xf6f6;
  24274. t.Cmonospace = 0xff23;
  24275. t.Coarmenian = 0x0551;
  24276. t.Csmall = 0xf763;
  24277. t.D = 0x0044;
  24278. t.DZ = 0x01f1;
  24279. t.DZcaron = 0x01c4;
  24280. t.Daarmenian = 0x0534;
  24281. t.Dafrican = 0x0189;
  24282. t.Dcaron = 0x010e;
  24283. t.Dcedilla = 0x1e10;
  24284. t.Dcircle = 0x24b9;
  24285. t.Dcircumflexbelow = 0x1e12;
  24286. t.Dcroat = 0x0110;
  24287. t.Ddotaccent = 0x1e0a;
  24288. t.Ddotbelow = 0x1e0c;
  24289. t.Decyrillic = 0x0414;
  24290. t.Deicoptic = 0x03ee;
  24291. t.Delta = 0x2206;
  24292. t.Deltagreek = 0x0394;
  24293. t.Dhook = 0x018a;
  24294. t.Dieresis = 0xf6cb;
  24295. t.DieresisAcute = 0xf6cc;
  24296. t.DieresisGrave = 0xf6cd;
  24297. t.Dieresissmall = 0xf7a8;
  24298. t.Digammagreek = 0x03dc;
  24299. t.Djecyrillic = 0x0402;
  24300. t.Dlinebelow = 0x1e0e;
  24301. t.Dmonospace = 0xff24;
  24302. t.Dotaccentsmall = 0xf6f7;
  24303. t.Dslash = 0x0110;
  24304. t.Dsmall = 0xf764;
  24305. t.Dtopbar = 0x018b;
  24306. t.Dz = 0x01f2;
  24307. t.Dzcaron = 0x01c5;
  24308. t.Dzeabkhasiancyrillic = 0x04e0;
  24309. t.Dzecyrillic = 0x0405;
  24310. t.Dzhecyrillic = 0x040f;
  24311. t.E = 0x0045;
  24312. t.Eacute = 0x00c9;
  24313. t.Eacutesmall = 0xf7e9;
  24314. t.Ebreve = 0x0114;
  24315. t.Ecaron = 0x011a;
  24316. t.Ecedillabreve = 0x1e1c;
  24317. t.Echarmenian = 0x0535;
  24318. t.Ecircle = 0x24ba;
  24319. t.Ecircumflex = 0x00ca;
  24320. t.Ecircumflexacute = 0x1ebe;
  24321. t.Ecircumflexbelow = 0x1e18;
  24322. t.Ecircumflexdotbelow = 0x1ec6;
  24323. t.Ecircumflexgrave = 0x1ec0;
  24324. t.Ecircumflexhookabove = 0x1ec2;
  24325. t.Ecircumflexsmall = 0xf7ea;
  24326. t.Ecircumflextilde = 0x1ec4;
  24327. t.Ecyrillic = 0x0404;
  24328. t.Edblgrave = 0x0204;
  24329. t.Edieresis = 0x00cb;
  24330. t.Edieresissmall = 0xf7eb;
  24331. t.Edot = 0x0116;
  24332. t.Edotaccent = 0x0116;
  24333. t.Edotbelow = 0x1eb8;
  24334. t.Efcyrillic = 0x0424;
  24335. t.Egrave = 0x00c8;
  24336. t.Egravesmall = 0xf7e8;
  24337. t.Eharmenian = 0x0537;
  24338. t.Ehookabove = 0x1eba;
  24339. t.Eightroman = 0x2167;
  24340. t.Einvertedbreve = 0x0206;
  24341. t.Eiotifiedcyrillic = 0x0464;
  24342. t.Elcyrillic = 0x041b;
  24343. t.Elevenroman = 0x216a;
  24344. t.Emacron = 0x0112;
  24345. t.Emacronacute = 0x1e16;
  24346. t.Emacrongrave = 0x1e14;
  24347. t.Emcyrillic = 0x041c;
  24348. t.Emonospace = 0xff25;
  24349. t.Encyrillic = 0x041d;
  24350. t.Endescendercyrillic = 0x04a2;
  24351. t.Eng = 0x014a;
  24352. t.Enghecyrillic = 0x04a4;
  24353. t.Enhookcyrillic = 0x04c7;
  24354. t.Eogonek = 0x0118;
  24355. t.Eopen = 0x0190;
  24356. t.Epsilon = 0x0395;
  24357. t.Epsilontonos = 0x0388;
  24358. t.Ercyrillic = 0x0420;
  24359. t.Ereversed = 0x018e;
  24360. t.Ereversedcyrillic = 0x042d;
  24361. t.Escyrillic = 0x0421;
  24362. t.Esdescendercyrillic = 0x04aa;
  24363. t.Esh = 0x01a9;
  24364. t.Esmall = 0xf765;
  24365. t.Eta = 0x0397;
  24366. t.Etarmenian = 0x0538;
  24367. t.Etatonos = 0x0389;
  24368. t.Eth = 0x00d0;
  24369. t.Ethsmall = 0xf7f0;
  24370. t.Etilde = 0x1ebc;
  24371. t.Etildebelow = 0x1e1a;
  24372. t.Euro = 0x20ac;
  24373. t.Ezh = 0x01b7;
  24374. t.Ezhcaron = 0x01ee;
  24375. t.Ezhreversed = 0x01b8;
  24376. t.F = 0x0046;
  24377. t.Fcircle = 0x24bb;
  24378. t.Fdotaccent = 0x1e1e;
  24379. t.Feharmenian = 0x0556;
  24380. t.Feicoptic = 0x03e4;
  24381. t.Fhook = 0x0191;
  24382. t.Fitacyrillic = 0x0472;
  24383. t.Fiveroman = 0x2164;
  24384. t.Fmonospace = 0xff26;
  24385. t.Fourroman = 0x2163;
  24386. t.Fsmall = 0xf766;
  24387. t.G = 0x0047;
  24388. t.GBsquare = 0x3387;
  24389. t.Gacute = 0x01f4;
  24390. t.Gamma = 0x0393;
  24391. t.Gammaafrican = 0x0194;
  24392. t.Gangiacoptic = 0x03ea;
  24393. t.Gbreve = 0x011e;
  24394. t.Gcaron = 0x01e6;
  24395. t.Gcedilla = 0x0122;
  24396. t.Gcircle = 0x24bc;
  24397. t.Gcircumflex = 0x011c;
  24398. t.Gcommaaccent = 0x0122;
  24399. t.Gdot = 0x0120;
  24400. t.Gdotaccent = 0x0120;
  24401. t.Gecyrillic = 0x0413;
  24402. t.Ghadarmenian = 0x0542;
  24403. t.Ghemiddlehookcyrillic = 0x0494;
  24404. t.Ghestrokecyrillic = 0x0492;
  24405. t.Gheupturncyrillic = 0x0490;
  24406. t.Ghook = 0x0193;
  24407. t.Gimarmenian = 0x0533;
  24408. t.Gjecyrillic = 0x0403;
  24409. t.Gmacron = 0x1e20;
  24410. t.Gmonospace = 0xff27;
  24411. t.Grave = 0xf6ce;
  24412. t.Gravesmall = 0xf760;
  24413. t.Gsmall = 0xf767;
  24414. t.Gsmallhook = 0x029b;
  24415. t.Gstroke = 0x01e4;
  24416. t.H = 0x0048;
  24417. t.H18533 = 0x25cf;
  24418. t.H18543 = 0x25aa;
  24419. t.H18551 = 0x25ab;
  24420. t.H22073 = 0x25a1;
  24421. t.HPsquare = 0x33cb;
  24422. t.Haabkhasiancyrillic = 0x04a8;
  24423. t.Hadescendercyrillic = 0x04b2;
  24424. t.Hardsigncyrillic = 0x042a;
  24425. t.Hbar = 0x0126;
  24426. t.Hbrevebelow = 0x1e2a;
  24427. t.Hcedilla = 0x1e28;
  24428. t.Hcircle = 0x24bd;
  24429. t.Hcircumflex = 0x0124;
  24430. t.Hdieresis = 0x1e26;
  24431. t.Hdotaccent = 0x1e22;
  24432. t.Hdotbelow = 0x1e24;
  24433. t.Hmonospace = 0xff28;
  24434. t.Hoarmenian = 0x0540;
  24435. t.Horicoptic = 0x03e8;
  24436. t.Hsmall = 0xf768;
  24437. t.Hungarumlaut = 0xf6cf;
  24438. t.Hungarumlautsmall = 0xf6f8;
  24439. t.Hzsquare = 0x3390;
  24440. t.I = 0x0049;
  24441. t.IAcyrillic = 0x042f;
  24442. t.IJ = 0x0132;
  24443. t.IUcyrillic = 0x042e;
  24444. t.Iacute = 0x00cd;
  24445. t.Iacutesmall = 0xf7ed;
  24446. t.Ibreve = 0x012c;
  24447. t.Icaron = 0x01cf;
  24448. t.Icircle = 0x24be;
  24449. t.Icircumflex = 0x00ce;
  24450. t.Icircumflexsmall = 0xf7ee;
  24451. t.Icyrillic = 0x0406;
  24452. t.Idblgrave = 0x0208;
  24453. t.Idieresis = 0x00cf;
  24454. t.Idieresisacute = 0x1e2e;
  24455. t.Idieresiscyrillic = 0x04e4;
  24456. t.Idieresissmall = 0xf7ef;
  24457. t.Idot = 0x0130;
  24458. t.Idotaccent = 0x0130;
  24459. t.Idotbelow = 0x1eca;
  24460. t.Iebrevecyrillic = 0x04d6;
  24461. t.Iecyrillic = 0x0415;
  24462. t.Ifraktur = 0x2111;
  24463. t.Igrave = 0x00cc;
  24464. t.Igravesmall = 0xf7ec;
  24465. t.Ihookabove = 0x1ec8;
  24466. t.Iicyrillic = 0x0418;
  24467. t.Iinvertedbreve = 0x020a;
  24468. t.Iishortcyrillic = 0x0419;
  24469. t.Imacron = 0x012a;
  24470. t.Imacroncyrillic = 0x04e2;
  24471. t.Imonospace = 0xff29;
  24472. t.Iniarmenian = 0x053b;
  24473. t.Iocyrillic = 0x0401;
  24474. t.Iogonek = 0x012e;
  24475. t.Iota = 0x0399;
  24476. t.Iotaafrican = 0x0196;
  24477. t.Iotadieresis = 0x03aa;
  24478. t.Iotatonos = 0x038a;
  24479. t.Ismall = 0xf769;
  24480. t.Istroke = 0x0197;
  24481. t.Itilde = 0x0128;
  24482. t.Itildebelow = 0x1e2c;
  24483. t.Izhitsacyrillic = 0x0474;
  24484. t.Izhitsadblgravecyrillic = 0x0476;
  24485. t.J = 0x004a;
  24486. t.Jaarmenian = 0x0541;
  24487. t.Jcircle = 0x24bf;
  24488. t.Jcircumflex = 0x0134;
  24489. t.Jecyrillic = 0x0408;
  24490. t.Jheharmenian = 0x054b;
  24491. t.Jmonospace = 0xff2a;
  24492. t.Jsmall = 0xf76a;
  24493. t.K = 0x004b;
  24494. t.KBsquare = 0x3385;
  24495. t.KKsquare = 0x33cd;
  24496. t.Kabashkircyrillic = 0x04a0;
  24497. t.Kacute = 0x1e30;
  24498. t.Kacyrillic = 0x041a;
  24499. t.Kadescendercyrillic = 0x049a;
  24500. t.Kahookcyrillic = 0x04c3;
  24501. t.Kappa = 0x039a;
  24502. t.Kastrokecyrillic = 0x049e;
  24503. t.Kaverticalstrokecyrillic = 0x049c;
  24504. t.Kcaron = 0x01e8;
  24505. t.Kcedilla = 0x0136;
  24506. t.Kcircle = 0x24c0;
  24507. t.Kcommaaccent = 0x0136;
  24508. t.Kdotbelow = 0x1e32;
  24509. t.Keharmenian = 0x0554;
  24510. t.Kenarmenian = 0x053f;
  24511. t.Khacyrillic = 0x0425;
  24512. t.Kheicoptic = 0x03e6;
  24513. t.Khook = 0x0198;
  24514. t.Kjecyrillic = 0x040c;
  24515. t.Klinebelow = 0x1e34;
  24516. t.Kmonospace = 0xff2b;
  24517. t.Koppacyrillic = 0x0480;
  24518. t.Koppagreek = 0x03de;
  24519. t.Ksicyrillic = 0x046e;
  24520. t.Ksmall = 0xf76b;
  24521. t.L = 0x004c;
  24522. t.LJ = 0x01c7;
  24523. t.LL = 0xf6bf;
  24524. t.Lacute = 0x0139;
  24525. t.Lambda = 0x039b;
  24526. t.Lcaron = 0x013d;
  24527. t.Lcedilla = 0x013b;
  24528. t.Lcircle = 0x24c1;
  24529. t.Lcircumflexbelow = 0x1e3c;
  24530. t.Lcommaaccent = 0x013b;
  24531. t.Ldot = 0x013f;
  24532. t.Ldotaccent = 0x013f;
  24533. t.Ldotbelow = 0x1e36;
  24534. t.Ldotbelowmacron = 0x1e38;
  24535. t.Liwnarmenian = 0x053c;
  24536. t.Lj = 0x01c8;
  24537. t.Ljecyrillic = 0x0409;
  24538. t.Llinebelow = 0x1e3a;
  24539. t.Lmonospace = 0xff2c;
  24540. t.Lslash = 0x0141;
  24541. t.Lslashsmall = 0xf6f9;
  24542. t.Lsmall = 0xf76c;
  24543. t.M = 0x004d;
  24544. t.MBsquare = 0x3386;
  24545. t.Macron = 0xf6d0;
  24546. t.Macronsmall = 0xf7af;
  24547. t.Macute = 0x1e3e;
  24548. t.Mcircle = 0x24c2;
  24549. t.Mdotaccent = 0x1e40;
  24550. t.Mdotbelow = 0x1e42;
  24551. t.Menarmenian = 0x0544;
  24552. t.Mmonospace = 0xff2d;
  24553. t.Msmall = 0xf76d;
  24554. t.Mturned = 0x019c;
  24555. t.Mu = 0x039c;
  24556. t.N = 0x004e;
  24557. t.NJ = 0x01ca;
  24558. t.Nacute = 0x0143;
  24559. t.Ncaron = 0x0147;
  24560. t.Ncedilla = 0x0145;
  24561. t.Ncircle = 0x24c3;
  24562. t.Ncircumflexbelow = 0x1e4a;
  24563. t.Ncommaaccent = 0x0145;
  24564. t.Ndotaccent = 0x1e44;
  24565. t.Ndotbelow = 0x1e46;
  24566. t.Nhookleft = 0x019d;
  24567. t.Nineroman = 0x2168;
  24568. t.Nj = 0x01cb;
  24569. t.Njecyrillic = 0x040a;
  24570. t.Nlinebelow = 0x1e48;
  24571. t.Nmonospace = 0xff2e;
  24572. t.Nowarmenian = 0x0546;
  24573. t.Nsmall = 0xf76e;
  24574. t.Ntilde = 0x00d1;
  24575. t.Ntildesmall = 0xf7f1;
  24576. t.Nu = 0x039d;
  24577. t.O = 0x004f;
  24578. t.OE = 0x0152;
  24579. t.OEsmall = 0xf6fa;
  24580. t.Oacute = 0x00d3;
  24581. t.Oacutesmall = 0xf7f3;
  24582. t.Obarredcyrillic = 0x04e8;
  24583. t.Obarreddieresiscyrillic = 0x04ea;
  24584. t.Obreve = 0x014e;
  24585. t.Ocaron = 0x01d1;
  24586. t.Ocenteredtilde = 0x019f;
  24587. t.Ocircle = 0x24c4;
  24588. t.Ocircumflex = 0x00d4;
  24589. t.Ocircumflexacute = 0x1ed0;
  24590. t.Ocircumflexdotbelow = 0x1ed8;
  24591. t.Ocircumflexgrave = 0x1ed2;
  24592. t.Ocircumflexhookabove = 0x1ed4;
  24593. t.Ocircumflexsmall = 0xf7f4;
  24594. t.Ocircumflextilde = 0x1ed6;
  24595. t.Ocyrillic = 0x041e;
  24596. t.Odblacute = 0x0150;
  24597. t.Odblgrave = 0x020c;
  24598. t.Odieresis = 0x00d6;
  24599. t.Odieresiscyrillic = 0x04e6;
  24600. t.Odieresissmall = 0xf7f6;
  24601. t.Odotbelow = 0x1ecc;
  24602. t.Ogoneksmall = 0xf6fb;
  24603. t.Ograve = 0x00d2;
  24604. t.Ogravesmall = 0xf7f2;
  24605. t.Oharmenian = 0x0555;
  24606. t.Ohm = 0x2126;
  24607. t.Ohookabove = 0x1ece;
  24608. t.Ohorn = 0x01a0;
  24609. t.Ohornacute = 0x1eda;
  24610. t.Ohorndotbelow = 0x1ee2;
  24611. t.Ohorngrave = 0x1edc;
  24612. t.Ohornhookabove = 0x1ede;
  24613. t.Ohorntilde = 0x1ee0;
  24614. t.Ohungarumlaut = 0x0150;
  24615. t.Oi = 0x01a2;
  24616. t.Oinvertedbreve = 0x020e;
  24617. t.Omacron = 0x014c;
  24618. t.Omacronacute = 0x1e52;
  24619. t.Omacrongrave = 0x1e50;
  24620. t.Omega = 0x2126;
  24621. t.Omegacyrillic = 0x0460;
  24622. t.Omegagreek = 0x03a9;
  24623. t.Omegaroundcyrillic = 0x047a;
  24624. t.Omegatitlocyrillic = 0x047c;
  24625. t.Omegatonos = 0x038f;
  24626. t.Omicron = 0x039f;
  24627. t.Omicrontonos = 0x038c;
  24628. t.Omonospace = 0xff2f;
  24629. t.Oneroman = 0x2160;
  24630. t.Oogonek = 0x01ea;
  24631. t.Oogonekmacron = 0x01ec;
  24632. t.Oopen = 0x0186;
  24633. t.Oslash = 0x00d8;
  24634. t.Oslashacute = 0x01fe;
  24635. t.Oslashsmall = 0xf7f8;
  24636. t.Osmall = 0xf76f;
  24637. t.Ostrokeacute = 0x01fe;
  24638. t.Otcyrillic = 0x047e;
  24639. t.Otilde = 0x00d5;
  24640. t.Otildeacute = 0x1e4c;
  24641. t.Otildedieresis = 0x1e4e;
  24642. t.Otildesmall = 0xf7f5;
  24643. t.P = 0x0050;
  24644. t.Pacute = 0x1e54;
  24645. t.Pcircle = 0x24c5;
  24646. t.Pdotaccent = 0x1e56;
  24647. t.Pecyrillic = 0x041f;
  24648. t.Peharmenian = 0x054a;
  24649. t.Pemiddlehookcyrillic = 0x04a6;
  24650. t.Phi = 0x03a6;
  24651. t.Phook = 0x01a4;
  24652. t.Pi = 0x03a0;
  24653. t.Piwrarmenian = 0x0553;
  24654. t.Pmonospace = 0xff30;
  24655. t.Psi = 0x03a8;
  24656. t.Psicyrillic = 0x0470;
  24657. t.Psmall = 0xf770;
  24658. t.Q = 0x0051;
  24659. t.Qcircle = 0x24c6;
  24660. t.Qmonospace = 0xff31;
  24661. t.Qsmall = 0xf771;
  24662. t.R = 0x0052;
  24663. t.Raarmenian = 0x054c;
  24664. t.Racute = 0x0154;
  24665. t.Rcaron = 0x0158;
  24666. t.Rcedilla = 0x0156;
  24667. t.Rcircle = 0x24c7;
  24668. t.Rcommaaccent = 0x0156;
  24669. t.Rdblgrave = 0x0210;
  24670. t.Rdotaccent = 0x1e58;
  24671. t.Rdotbelow = 0x1e5a;
  24672. t.Rdotbelowmacron = 0x1e5c;
  24673. t.Reharmenian = 0x0550;
  24674. t.Rfraktur = 0x211c;
  24675. t.Rho = 0x03a1;
  24676. t.Ringsmall = 0xf6fc;
  24677. t.Rinvertedbreve = 0x0212;
  24678. t.Rlinebelow = 0x1e5e;
  24679. t.Rmonospace = 0xff32;
  24680. t.Rsmall = 0xf772;
  24681. t.Rsmallinverted = 0x0281;
  24682. t.Rsmallinvertedsuperior = 0x02b6;
  24683. t.S = 0x0053;
  24684. t.SF010000 = 0x250c;
  24685. t.SF020000 = 0x2514;
  24686. t.SF030000 = 0x2510;
  24687. t.SF040000 = 0x2518;
  24688. t.SF050000 = 0x253c;
  24689. t.SF060000 = 0x252c;
  24690. t.SF070000 = 0x2534;
  24691. t.SF080000 = 0x251c;
  24692. t.SF090000 = 0x2524;
  24693. t.SF100000 = 0x2500;
  24694. t.SF110000 = 0x2502;
  24695. t.SF190000 = 0x2561;
  24696. t.SF200000 = 0x2562;
  24697. t.SF210000 = 0x2556;
  24698. t.SF220000 = 0x2555;
  24699. t.SF230000 = 0x2563;
  24700. t.SF240000 = 0x2551;
  24701. t.SF250000 = 0x2557;
  24702. t.SF260000 = 0x255d;
  24703. t.SF270000 = 0x255c;
  24704. t.SF280000 = 0x255b;
  24705. t.SF360000 = 0x255e;
  24706. t.SF370000 = 0x255f;
  24707. t.SF380000 = 0x255a;
  24708. t.SF390000 = 0x2554;
  24709. t.SF400000 = 0x2569;
  24710. t.SF410000 = 0x2566;
  24711. t.SF420000 = 0x2560;
  24712. t.SF430000 = 0x2550;
  24713. t.SF440000 = 0x256c;
  24714. t.SF450000 = 0x2567;
  24715. t.SF460000 = 0x2568;
  24716. t.SF470000 = 0x2564;
  24717. t.SF480000 = 0x2565;
  24718. t.SF490000 = 0x2559;
  24719. t.SF500000 = 0x2558;
  24720. t.SF510000 = 0x2552;
  24721. t.SF520000 = 0x2553;
  24722. t.SF530000 = 0x256b;
  24723. t.SF540000 = 0x256a;
  24724. t.Sacute = 0x015a;
  24725. t.Sacutedotaccent = 0x1e64;
  24726. t.Sampigreek = 0x03e0;
  24727. t.Scaron = 0x0160;
  24728. t.Scarondotaccent = 0x1e66;
  24729. t.Scaronsmall = 0xf6fd;
  24730. t.Scedilla = 0x015e;
  24731. t.Schwa = 0x018f;
  24732. t.Schwacyrillic = 0x04d8;
  24733. t.Schwadieresiscyrillic = 0x04da;
  24734. t.Scircle = 0x24c8;
  24735. t.Scircumflex = 0x015c;
  24736. t.Scommaaccent = 0x0218;
  24737. t.Sdotaccent = 0x1e60;
  24738. t.Sdotbelow = 0x1e62;
  24739. t.Sdotbelowdotaccent = 0x1e68;
  24740. t.Seharmenian = 0x054d;
  24741. t.Sevenroman = 0x2166;
  24742. t.Shaarmenian = 0x0547;
  24743. t.Shacyrillic = 0x0428;
  24744. t.Shchacyrillic = 0x0429;
  24745. t.Sheicoptic = 0x03e2;
  24746. t.Shhacyrillic = 0x04ba;
  24747. t.Shimacoptic = 0x03ec;
  24748. t.Sigma = 0x03a3;
  24749. t.Sixroman = 0x2165;
  24750. t.Smonospace = 0xff33;
  24751. t.Softsigncyrillic = 0x042c;
  24752. t.Ssmall = 0xf773;
  24753. t.Stigmagreek = 0x03da;
  24754. t.T = 0x0054;
  24755. t.Tau = 0x03a4;
  24756. t.Tbar = 0x0166;
  24757. t.Tcaron = 0x0164;
  24758. t.Tcedilla = 0x0162;
  24759. t.Tcircle = 0x24c9;
  24760. t.Tcircumflexbelow = 0x1e70;
  24761. t.Tcommaaccent = 0x0162;
  24762. t.Tdotaccent = 0x1e6a;
  24763. t.Tdotbelow = 0x1e6c;
  24764. t.Tecyrillic = 0x0422;
  24765. t.Tedescendercyrillic = 0x04ac;
  24766. t.Tenroman = 0x2169;
  24767. t.Tetsecyrillic = 0x04b4;
  24768. t.Theta = 0x0398;
  24769. t.Thook = 0x01ac;
  24770. t.Thorn = 0x00de;
  24771. t.Thornsmall = 0xf7fe;
  24772. t.Threeroman = 0x2162;
  24773. t.Tildesmall = 0xf6fe;
  24774. t.Tiwnarmenian = 0x054f;
  24775. t.Tlinebelow = 0x1e6e;
  24776. t.Tmonospace = 0xff34;
  24777. t.Toarmenian = 0x0539;
  24778. t.Tonefive = 0x01bc;
  24779. t.Tonesix = 0x0184;
  24780. t.Tonetwo = 0x01a7;
  24781. t.Tretroflexhook = 0x01ae;
  24782. t.Tsecyrillic = 0x0426;
  24783. t.Tshecyrillic = 0x040b;
  24784. t.Tsmall = 0xf774;
  24785. t.Twelveroman = 0x216b;
  24786. t.Tworoman = 0x2161;
  24787. t.U = 0x0055;
  24788. t.Uacute = 0x00da;
  24789. t.Uacutesmall = 0xf7fa;
  24790. t.Ubreve = 0x016c;
  24791. t.Ucaron = 0x01d3;
  24792. t.Ucircle = 0x24ca;
  24793. t.Ucircumflex = 0x00db;
  24794. t.Ucircumflexbelow = 0x1e76;
  24795. t.Ucircumflexsmall = 0xf7fb;
  24796. t.Ucyrillic = 0x0423;
  24797. t.Udblacute = 0x0170;
  24798. t.Udblgrave = 0x0214;
  24799. t.Udieresis = 0x00dc;
  24800. t.Udieresisacute = 0x01d7;
  24801. t.Udieresisbelow = 0x1e72;
  24802. t.Udieresiscaron = 0x01d9;
  24803. t.Udieresiscyrillic = 0x04f0;
  24804. t.Udieresisgrave = 0x01db;
  24805. t.Udieresismacron = 0x01d5;
  24806. t.Udieresissmall = 0xf7fc;
  24807. t.Udotbelow = 0x1ee4;
  24808. t.Ugrave = 0x00d9;
  24809. t.Ugravesmall = 0xf7f9;
  24810. t.Uhookabove = 0x1ee6;
  24811. t.Uhorn = 0x01af;
  24812. t.Uhornacute = 0x1ee8;
  24813. t.Uhorndotbelow = 0x1ef0;
  24814. t.Uhorngrave = 0x1eea;
  24815. t.Uhornhookabove = 0x1eec;
  24816. t.Uhorntilde = 0x1eee;
  24817. t.Uhungarumlaut = 0x0170;
  24818. t.Uhungarumlautcyrillic = 0x04f2;
  24819. t.Uinvertedbreve = 0x0216;
  24820. t.Ukcyrillic = 0x0478;
  24821. t.Umacron = 0x016a;
  24822. t.Umacroncyrillic = 0x04ee;
  24823. t.Umacrondieresis = 0x1e7a;
  24824. t.Umonospace = 0xff35;
  24825. t.Uogonek = 0x0172;
  24826. t.Upsilon = 0x03a5;
  24827. t.Upsilon1 = 0x03d2;
  24828. t.Upsilonacutehooksymbolgreek = 0x03d3;
  24829. t.Upsilonafrican = 0x01b1;
  24830. t.Upsilondieresis = 0x03ab;
  24831. t.Upsilondieresishooksymbolgreek = 0x03d4;
  24832. t.Upsilonhooksymbol = 0x03d2;
  24833. t.Upsilontonos = 0x038e;
  24834. t.Uring = 0x016e;
  24835. t.Ushortcyrillic = 0x040e;
  24836. t.Usmall = 0xf775;
  24837. t.Ustraightcyrillic = 0x04ae;
  24838. t.Ustraightstrokecyrillic = 0x04b0;
  24839. t.Utilde = 0x0168;
  24840. t.Utildeacute = 0x1e78;
  24841. t.Utildebelow = 0x1e74;
  24842. t.V = 0x0056;
  24843. t.Vcircle = 0x24cb;
  24844. t.Vdotbelow = 0x1e7e;
  24845. t.Vecyrillic = 0x0412;
  24846. t.Vewarmenian = 0x054e;
  24847. t.Vhook = 0x01b2;
  24848. t.Vmonospace = 0xff36;
  24849. t.Voarmenian = 0x0548;
  24850. t.Vsmall = 0xf776;
  24851. t.Vtilde = 0x1e7c;
  24852. t.W = 0x0057;
  24853. t.Wacute = 0x1e82;
  24854. t.Wcircle = 0x24cc;
  24855. t.Wcircumflex = 0x0174;
  24856. t.Wdieresis = 0x1e84;
  24857. t.Wdotaccent = 0x1e86;
  24858. t.Wdotbelow = 0x1e88;
  24859. t.Wgrave = 0x1e80;
  24860. t.Wmonospace = 0xff37;
  24861. t.Wsmall = 0xf777;
  24862. t.X = 0x0058;
  24863. t.Xcircle = 0x24cd;
  24864. t.Xdieresis = 0x1e8c;
  24865. t.Xdotaccent = 0x1e8a;
  24866. t.Xeharmenian = 0x053d;
  24867. t.Xi = 0x039e;
  24868. t.Xmonospace = 0xff38;
  24869. t.Xsmall = 0xf778;
  24870. t.Y = 0x0059;
  24871. t.Yacute = 0x00dd;
  24872. t.Yacutesmall = 0xf7fd;
  24873. t.Yatcyrillic = 0x0462;
  24874. t.Ycircle = 0x24ce;
  24875. t.Ycircumflex = 0x0176;
  24876. t.Ydieresis = 0x0178;
  24877. t.Ydieresissmall = 0xf7ff;
  24878. t.Ydotaccent = 0x1e8e;
  24879. t.Ydotbelow = 0x1ef4;
  24880. t.Yericyrillic = 0x042b;
  24881. t.Yerudieresiscyrillic = 0x04f8;
  24882. t.Ygrave = 0x1ef2;
  24883. t.Yhook = 0x01b3;
  24884. t.Yhookabove = 0x1ef6;
  24885. t.Yiarmenian = 0x0545;
  24886. t.Yicyrillic = 0x0407;
  24887. t.Yiwnarmenian = 0x0552;
  24888. t.Ymonospace = 0xff39;
  24889. t.Ysmall = 0xf779;
  24890. t.Ytilde = 0x1ef8;
  24891. t.Yusbigcyrillic = 0x046a;
  24892. t.Yusbigiotifiedcyrillic = 0x046c;
  24893. t.Yuslittlecyrillic = 0x0466;
  24894. t.Yuslittleiotifiedcyrillic = 0x0468;
  24895. t.Z = 0x005a;
  24896. t.Zaarmenian = 0x0536;
  24897. t.Zacute = 0x0179;
  24898. t.Zcaron = 0x017d;
  24899. t.Zcaronsmall = 0xf6ff;
  24900. t.Zcircle = 0x24cf;
  24901. t.Zcircumflex = 0x1e90;
  24902. t.Zdot = 0x017b;
  24903. t.Zdotaccent = 0x017b;
  24904. t.Zdotbelow = 0x1e92;
  24905. t.Zecyrillic = 0x0417;
  24906. t.Zedescendercyrillic = 0x0498;
  24907. t.Zedieresiscyrillic = 0x04de;
  24908. t.Zeta = 0x0396;
  24909. t.Zhearmenian = 0x053a;
  24910. t.Zhebrevecyrillic = 0x04c1;
  24911. t.Zhecyrillic = 0x0416;
  24912. t.Zhedescendercyrillic = 0x0496;
  24913. t.Zhedieresiscyrillic = 0x04dc;
  24914. t.Zlinebelow = 0x1e94;
  24915. t.Zmonospace = 0xff3a;
  24916. t.Zsmall = 0xf77a;
  24917. t.Zstroke = 0x01b5;
  24918. t.a = 0x0061;
  24919. t.aabengali = 0x0986;
  24920. t.aacute = 0x00e1;
  24921. t.aadeva = 0x0906;
  24922. t.aagujarati = 0x0a86;
  24923. t.aagurmukhi = 0x0a06;
  24924. t.aamatragurmukhi = 0x0a3e;
  24925. t.aarusquare = 0x3303;
  24926. t.aavowelsignbengali = 0x09be;
  24927. t.aavowelsigndeva = 0x093e;
  24928. t.aavowelsigngujarati = 0x0abe;
  24929. t.abbreviationmarkarmenian = 0x055f;
  24930. t.abbreviationsigndeva = 0x0970;
  24931. t.abengali = 0x0985;
  24932. t.abopomofo = 0x311a;
  24933. t.abreve = 0x0103;
  24934. t.abreveacute = 0x1eaf;
  24935. t.abrevecyrillic = 0x04d1;
  24936. t.abrevedotbelow = 0x1eb7;
  24937. t.abrevegrave = 0x1eb1;
  24938. t.abrevehookabove = 0x1eb3;
  24939. t.abrevetilde = 0x1eb5;
  24940. t.acaron = 0x01ce;
  24941. t.acircle = 0x24d0;
  24942. t.acircumflex = 0x00e2;
  24943. t.acircumflexacute = 0x1ea5;
  24944. t.acircumflexdotbelow = 0x1ead;
  24945. t.acircumflexgrave = 0x1ea7;
  24946. t.acircumflexhookabove = 0x1ea9;
  24947. t.acircumflextilde = 0x1eab;
  24948. t.acute = 0x00b4;
  24949. t.acutebelowcmb = 0x0317;
  24950. t.acutecmb = 0x0301;
  24951. t.acutecomb = 0x0301;
  24952. t.acutedeva = 0x0954;
  24953. t.acutelowmod = 0x02cf;
  24954. t.acutetonecmb = 0x0341;
  24955. t.acyrillic = 0x0430;
  24956. t.adblgrave = 0x0201;
  24957. t.addakgurmukhi = 0x0a71;
  24958. t.adeva = 0x0905;
  24959. t.adieresis = 0x00e4;
  24960. t.adieresiscyrillic = 0x04d3;
  24961. t.adieresismacron = 0x01df;
  24962. t.adotbelow = 0x1ea1;
  24963. t.adotmacron = 0x01e1;
  24964. t.ae = 0x00e6;
  24965. t.aeacute = 0x01fd;
  24966. t.aekorean = 0x3150;
  24967. t.aemacron = 0x01e3;
  24968. t.afii00208 = 0x2015;
  24969. t.afii08941 = 0x20a4;
  24970. t.afii10017 = 0x0410;
  24971. t.afii10018 = 0x0411;
  24972. t.afii10019 = 0x0412;
  24973. t.afii10020 = 0x0413;
  24974. t.afii10021 = 0x0414;
  24975. t.afii10022 = 0x0415;
  24976. t.afii10023 = 0x0401;
  24977. t.afii10024 = 0x0416;
  24978. t.afii10025 = 0x0417;
  24979. t.afii10026 = 0x0418;
  24980. t.afii10027 = 0x0419;
  24981. t.afii10028 = 0x041a;
  24982. t.afii10029 = 0x041b;
  24983. t.afii10030 = 0x041c;
  24984. t.afii10031 = 0x041d;
  24985. t.afii10032 = 0x041e;
  24986. t.afii10033 = 0x041f;
  24987. t.afii10034 = 0x0420;
  24988. t.afii10035 = 0x0421;
  24989. t.afii10036 = 0x0422;
  24990. t.afii10037 = 0x0423;
  24991. t.afii10038 = 0x0424;
  24992. t.afii10039 = 0x0425;
  24993. t.afii10040 = 0x0426;
  24994. t.afii10041 = 0x0427;
  24995. t.afii10042 = 0x0428;
  24996. t.afii10043 = 0x0429;
  24997. t.afii10044 = 0x042a;
  24998. t.afii10045 = 0x042b;
  24999. t.afii10046 = 0x042c;
  25000. t.afii10047 = 0x042d;
  25001. t.afii10048 = 0x042e;
  25002. t.afii10049 = 0x042f;
  25003. t.afii10050 = 0x0490;
  25004. t.afii10051 = 0x0402;
  25005. t.afii10052 = 0x0403;
  25006. t.afii10053 = 0x0404;
  25007. t.afii10054 = 0x0405;
  25008. t.afii10055 = 0x0406;
  25009. t.afii10056 = 0x0407;
  25010. t.afii10057 = 0x0408;
  25011. t.afii10058 = 0x0409;
  25012. t.afii10059 = 0x040a;
  25013. t.afii10060 = 0x040b;
  25014. t.afii10061 = 0x040c;
  25015. t.afii10062 = 0x040e;
  25016. t.afii10063 = 0xf6c4;
  25017. t.afii10064 = 0xf6c5;
  25018. t.afii10065 = 0x0430;
  25019. t.afii10066 = 0x0431;
  25020. t.afii10067 = 0x0432;
  25021. t.afii10068 = 0x0433;
  25022. t.afii10069 = 0x0434;
  25023. t.afii10070 = 0x0435;
  25024. t.afii10071 = 0x0451;
  25025. t.afii10072 = 0x0436;
  25026. t.afii10073 = 0x0437;
  25027. t.afii10074 = 0x0438;
  25028. t.afii10075 = 0x0439;
  25029. t.afii10076 = 0x043a;
  25030. t.afii10077 = 0x043b;
  25031. t.afii10078 = 0x043c;
  25032. t.afii10079 = 0x043d;
  25033. t.afii10080 = 0x043e;
  25034. t.afii10081 = 0x043f;
  25035. t.afii10082 = 0x0440;
  25036. t.afii10083 = 0x0441;
  25037. t.afii10084 = 0x0442;
  25038. t.afii10085 = 0x0443;
  25039. t.afii10086 = 0x0444;
  25040. t.afii10087 = 0x0445;
  25041. t.afii10088 = 0x0446;
  25042. t.afii10089 = 0x0447;
  25043. t.afii10090 = 0x0448;
  25044. t.afii10091 = 0x0449;
  25045. t.afii10092 = 0x044a;
  25046. t.afii10093 = 0x044b;
  25047. t.afii10094 = 0x044c;
  25048. t.afii10095 = 0x044d;
  25049. t.afii10096 = 0x044e;
  25050. t.afii10097 = 0x044f;
  25051. t.afii10098 = 0x0491;
  25052. t.afii10099 = 0x0452;
  25053. t.afii10100 = 0x0453;
  25054. t.afii10101 = 0x0454;
  25055. t.afii10102 = 0x0455;
  25056. t.afii10103 = 0x0456;
  25057. t.afii10104 = 0x0457;
  25058. t.afii10105 = 0x0458;
  25059. t.afii10106 = 0x0459;
  25060. t.afii10107 = 0x045a;
  25061. t.afii10108 = 0x045b;
  25062. t.afii10109 = 0x045c;
  25063. t.afii10110 = 0x045e;
  25064. t.afii10145 = 0x040f;
  25065. t.afii10146 = 0x0462;
  25066. t.afii10147 = 0x0472;
  25067. t.afii10148 = 0x0474;
  25068. t.afii10192 = 0xf6c6;
  25069. t.afii10193 = 0x045f;
  25070. t.afii10194 = 0x0463;
  25071. t.afii10195 = 0x0473;
  25072. t.afii10196 = 0x0475;
  25073. t.afii10831 = 0xf6c7;
  25074. t.afii10832 = 0xf6c8;
  25075. t.afii10846 = 0x04d9;
  25076. t.afii299 = 0x200e;
  25077. t.afii300 = 0x200f;
  25078. t.afii301 = 0x200d;
  25079. t.afii57381 = 0x066a;
  25080. t.afii57388 = 0x060c;
  25081. t.afii57392 = 0x0660;
  25082. t.afii57393 = 0x0661;
  25083. t.afii57394 = 0x0662;
  25084. t.afii57395 = 0x0663;
  25085. t.afii57396 = 0x0664;
  25086. t.afii57397 = 0x0665;
  25087. t.afii57398 = 0x0666;
  25088. t.afii57399 = 0x0667;
  25089. t.afii57400 = 0x0668;
  25090. t.afii57401 = 0x0669;
  25091. t.afii57403 = 0x061b;
  25092. t.afii57407 = 0x061f;
  25093. t.afii57409 = 0x0621;
  25094. t.afii57410 = 0x0622;
  25095. t.afii57411 = 0x0623;
  25096. t.afii57412 = 0x0624;
  25097. t.afii57413 = 0x0625;
  25098. t.afii57414 = 0x0626;
  25099. t.afii57415 = 0x0627;
  25100. t.afii57416 = 0x0628;
  25101. t.afii57417 = 0x0629;
  25102. t.afii57418 = 0x062a;
  25103. t.afii57419 = 0x062b;
  25104. t.afii57420 = 0x062c;
  25105. t.afii57421 = 0x062d;
  25106. t.afii57422 = 0x062e;
  25107. t.afii57423 = 0x062f;
  25108. t.afii57424 = 0x0630;
  25109. t.afii57425 = 0x0631;
  25110. t.afii57426 = 0x0632;
  25111. t.afii57427 = 0x0633;
  25112. t.afii57428 = 0x0634;
  25113. t.afii57429 = 0x0635;
  25114. t.afii57430 = 0x0636;
  25115. t.afii57431 = 0x0637;
  25116. t.afii57432 = 0x0638;
  25117. t.afii57433 = 0x0639;
  25118. t.afii57434 = 0x063a;
  25119. t.afii57440 = 0x0640;
  25120. t.afii57441 = 0x0641;
  25121. t.afii57442 = 0x0642;
  25122. t.afii57443 = 0x0643;
  25123. t.afii57444 = 0x0644;
  25124. t.afii57445 = 0x0645;
  25125. t.afii57446 = 0x0646;
  25126. t.afii57448 = 0x0648;
  25127. t.afii57449 = 0x0649;
  25128. t.afii57450 = 0x064a;
  25129. t.afii57451 = 0x064b;
  25130. t.afii57452 = 0x064c;
  25131. t.afii57453 = 0x064d;
  25132. t.afii57454 = 0x064e;
  25133. t.afii57455 = 0x064f;
  25134. t.afii57456 = 0x0650;
  25135. t.afii57457 = 0x0651;
  25136. t.afii57458 = 0x0652;
  25137. t.afii57470 = 0x0647;
  25138. t.afii57505 = 0x06a4;
  25139. t.afii57506 = 0x067e;
  25140. t.afii57507 = 0x0686;
  25141. t.afii57508 = 0x0698;
  25142. t.afii57509 = 0x06af;
  25143. t.afii57511 = 0x0679;
  25144. t.afii57512 = 0x0688;
  25145. t.afii57513 = 0x0691;
  25146. t.afii57514 = 0x06ba;
  25147. t.afii57519 = 0x06d2;
  25148. t.afii57534 = 0x06d5;
  25149. t.afii57636 = 0x20aa;
  25150. t.afii57645 = 0x05be;
  25151. t.afii57658 = 0x05c3;
  25152. t.afii57664 = 0x05d0;
  25153. t.afii57665 = 0x05d1;
  25154. t.afii57666 = 0x05d2;
  25155. t.afii57667 = 0x05d3;
  25156. t.afii57668 = 0x05d4;
  25157. t.afii57669 = 0x05d5;
  25158. t.afii57670 = 0x05d6;
  25159. t.afii57671 = 0x05d7;
  25160. t.afii57672 = 0x05d8;
  25161. t.afii57673 = 0x05d9;
  25162. t.afii57674 = 0x05da;
  25163. t.afii57675 = 0x05db;
  25164. t.afii57676 = 0x05dc;
  25165. t.afii57677 = 0x05dd;
  25166. t.afii57678 = 0x05de;
  25167. t.afii57679 = 0x05df;
  25168. t.afii57680 = 0x05e0;
  25169. t.afii57681 = 0x05e1;
  25170. t.afii57682 = 0x05e2;
  25171. t.afii57683 = 0x05e3;
  25172. t.afii57684 = 0x05e4;
  25173. t.afii57685 = 0x05e5;
  25174. t.afii57686 = 0x05e6;
  25175. t.afii57687 = 0x05e7;
  25176. t.afii57688 = 0x05e8;
  25177. t.afii57689 = 0x05e9;
  25178. t.afii57690 = 0x05ea;
  25179. t.afii57694 = 0xfb2a;
  25180. t.afii57695 = 0xfb2b;
  25181. t.afii57700 = 0xfb4b;
  25182. t.afii57705 = 0xfb1f;
  25183. t.afii57716 = 0x05f0;
  25184. t.afii57717 = 0x05f1;
  25185. t.afii57718 = 0x05f2;
  25186. t.afii57723 = 0xfb35;
  25187. t.afii57793 = 0x05b4;
  25188. t.afii57794 = 0x05b5;
  25189. t.afii57795 = 0x05b6;
  25190. t.afii57796 = 0x05bb;
  25191. t.afii57797 = 0x05b8;
  25192. t.afii57798 = 0x05b7;
  25193. t.afii57799 = 0x05b0;
  25194. t.afii57800 = 0x05b2;
  25195. t.afii57801 = 0x05b1;
  25196. t.afii57802 = 0x05b3;
  25197. t.afii57803 = 0x05c2;
  25198. t.afii57804 = 0x05c1;
  25199. t.afii57806 = 0x05b9;
  25200. t.afii57807 = 0x05bc;
  25201. t.afii57839 = 0x05bd;
  25202. t.afii57841 = 0x05bf;
  25203. t.afii57842 = 0x05c0;
  25204. t.afii57929 = 0x02bc;
  25205. t.afii61248 = 0x2105;
  25206. t.afii61289 = 0x2113;
  25207. t.afii61352 = 0x2116;
  25208. t.afii61573 = 0x202c;
  25209. t.afii61574 = 0x202d;
  25210. t.afii61575 = 0x202e;
  25211. t.afii61664 = 0x200c;
  25212. t.afii63167 = 0x066d;
  25213. t.afii64937 = 0x02bd;
  25214. t.agrave = 0x00e0;
  25215. t.agujarati = 0x0a85;
  25216. t.agurmukhi = 0x0a05;
  25217. t.ahiragana = 0x3042;
  25218. t.ahookabove = 0x1ea3;
  25219. t.aibengali = 0x0990;
  25220. t.aibopomofo = 0x311e;
  25221. t.aideva = 0x0910;
  25222. t.aiecyrillic = 0x04d5;
  25223. t.aigujarati = 0x0a90;
  25224. t.aigurmukhi = 0x0a10;
  25225. t.aimatragurmukhi = 0x0a48;
  25226. t.ainarabic = 0x0639;
  25227. t.ainfinalarabic = 0xfeca;
  25228. t.aininitialarabic = 0xfecb;
  25229. t.ainmedialarabic = 0xfecc;
  25230. t.ainvertedbreve = 0x0203;
  25231. t.aivowelsignbengali = 0x09c8;
  25232. t.aivowelsigndeva = 0x0948;
  25233. t.aivowelsigngujarati = 0x0ac8;
  25234. t.akatakana = 0x30a2;
  25235. t.akatakanahalfwidth = 0xff71;
  25236. t.akorean = 0x314f;
  25237. t.alef = 0x05d0;
  25238. t.alefarabic = 0x0627;
  25239. t.alefdageshhebrew = 0xfb30;
  25240. t.aleffinalarabic = 0xfe8e;
  25241. t.alefhamzaabovearabic = 0x0623;
  25242. t.alefhamzaabovefinalarabic = 0xfe84;
  25243. t.alefhamzabelowarabic = 0x0625;
  25244. t.alefhamzabelowfinalarabic = 0xfe88;
  25245. t.alefhebrew = 0x05d0;
  25246. t.aleflamedhebrew = 0xfb4f;
  25247. t.alefmaddaabovearabic = 0x0622;
  25248. t.alefmaddaabovefinalarabic = 0xfe82;
  25249. t.alefmaksuraarabic = 0x0649;
  25250. t.alefmaksurafinalarabic = 0xfef0;
  25251. t.alefmaksurainitialarabic = 0xfef3;
  25252. t.alefmaksuramedialarabic = 0xfef4;
  25253. t.alefpatahhebrew = 0xfb2e;
  25254. t.alefqamatshebrew = 0xfb2f;
  25255. t.aleph = 0x2135;
  25256. t.allequal = 0x224c;
  25257. t.alpha = 0x03b1;
  25258. t.alphatonos = 0x03ac;
  25259. t.amacron = 0x0101;
  25260. t.amonospace = 0xff41;
  25261. t.ampersand = 0x0026;
  25262. t.ampersandmonospace = 0xff06;
  25263. t.ampersandsmall = 0xf726;
  25264. t.amsquare = 0x33c2;
  25265. t.anbopomofo = 0x3122;
  25266. t.angbopomofo = 0x3124;
  25267. t.angbracketleft = 0x3008;
  25268. t.angbracketright = 0x3009;
  25269. t.angkhankhuthai = 0x0e5a;
  25270. t.angle = 0x2220;
  25271. t.anglebracketleft = 0x3008;
  25272. t.anglebracketleftvertical = 0xfe3f;
  25273. t.anglebracketright = 0x3009;
  25274. t.anglebracketrightvertical = 0xfe40;
  25275. t.angleleft = 0x2329;
  25276. t.angleright = 0x232a;
  25277. t.angstrom = 0x212b;
  25278. t.anoteleia = 0x0387;
  25279. t.anudattadeva = 0x0952;
  25280. t.anusvarabengali = 0x0982;
  25281. t.anusvaradeva = 0x0902;
  25282. t.anusvaragujarati = 0x0a82;
  25283. t.aogonek = 0x0105;
  25284. t.apaatosquare = 0x3300;
  25285. t.aparen = 0x249c;
  25286. t.apostrophearmenian = 0x055a;
  25287. t.apostrophemod = 0x02bc;
  25288. t.apple = 0xf8ff;
  25289. t.approaches = 0x2250;
  25290. t.approxequal = 0x2248;
  25291. t.approxequalorimage = 0x2252;
  25292. t.approximatelyequal = 0x2245;
  25293. t.araeaekorean = 0x318e;
  25294. t.araeakorean = 0x318d;
  25295. t.arc = 0x2312;
  25296. t.arighthalfring = 0x1e9a;
  25297. t.aring = 0x00e5;
  25298. t.aringacute = 0x01fb;
  25299. t.aringbelow = 0x1e01;
  25300. t.arrowboth = 0x2194;
  25301. t.arrowdashdown = 0x21e3;
  25302. t.arrowdashleft = 0x21e0;
  25303. t.arrowdashright = 0x21e2;
  25304. t.arrowdashup = 0x21e1;
  25305. t.arrowdblboth = 0x21d4;
  25306. t.arrowdbldown = 0x21d3;
  25307. t.arrowdblleft = 0x21d0;
  25308. t.arrowdblright = 0x21d2;
  25309. t.arrowdblup = 0x21d1;
  25310. t.arrowdown = 0x2193;
  25311. t.arrowdownleft = 0x2199;
  25312. t.arrowdownright = 0x2198;
  25313. t.arrowdownwhite = 0x21e9;
  25314. t.arrowheaddownmod = 0x02c5;
  25315. t.arrowheadleftmod = 0x02c2;
  25316. t.arrowheadrightmod = 0x02c3;
  25317. t.arrowheadupmod = 0x02c4;
  25318. t.arrowhorizex = 0xf8e7;
  25319. t.arrowleft = 0x2190;
  25320. t.arrowleftdbl = 0x21d0;
  25321. t.arrowleftdblstroke = 0x21cd;
  25322. t.arrowleftoverright = 0x21c6;
  25323. t.arrowleftwhite = 0x21e6;
  25324. t.arrowright = 0x2192;
  25325. t.arrowrightdblstroke = 0x21cf;
  25326. t.arrowrightheavy = 0x279e;
  25327. t.arrowrightoverleft = 0x21c4;
  25328. t.arrowrightwhite = 0x21e8;
  25329. t.arrowtableft = 0x21e4;
  25330. t.arrowtabright = 0x21e5;
  25331. t.arrowup = 0x2191;
  25332. t.arrowupdn = 0x2195;
  25333. t.arrowupdnbse = 0x21a8;
  25334. t.arrowupdownbase = 0x21a8;
  25335. t.arrowupleft = 0x2196;
  25336. t.arrowupleftofdown = 0x21c5;
  25337. t.arrowupright = 0x2197;
  25338. t.arrowupwhite = 0x21e7;
  25339. t.arrowvertex = 0xf8e6;
  25340. t.asciicircum = 0x005e;
  25341. t.asciicircummonospace = 0xff3e;
  25342. t.asciitilde = 0x007e;
  25343. t.asciitildemonospace = 0xff5e;
  25344. t.ascript = 0x0251;
  25345. t.ascriptturned = 0x0252;
  25346. t.asmallhiragana = 0x3041;
  25347. t.asmallkatakana = 0x30a1;
  25348. t.asmallkatakanahalfwidth = 0xff67;
  25349. t.asterisk = 0x002a;
  25350. t.asteriskaltonearabic = 0x066d;
  25351. t.asteriskarabic = 0x066d;
  25352. t.asteriskmath = 0x2217;
  25353. t.asteriskmonospace = 0xff0a;
  25354. t.asterisksmall = 0xfe61;
  25355. t.asterism = 0x2042;
  25356. t.asuperior = 0xf6e9;
  25357. t.asymptoticallyequal = 0x2243;
  25358. t.at = 0x0040;
  25359. t.atilde = 0x00e3;
  25360. t.atmonospace = 0xff20;
  25361. t.atsmall = 0xfe6b;
  25362. t.aturned = 0x0250;
  25363. t.aubengali = 0x0994;
  25364. t.aubopomofo = 0x3120;
  25365. t.audeva = 0x0914;
  25366. t.augujarati = 0x0a94;
  25367. t.augurmukhi = 0x0a14;
  25368. t.aulengthmarkbengali = 0x09d7;
  25369. t.aumatragurmukhi = 0x0a4c;
  25370. t.auvowelsignbengali = 0x09cc;
  25371. t.auvowelsigndeva = 0x094c;
  25372. t.auvowelsigngujarati = 0x0acc;
  25373. t.avagrahadeva = 0x093d;
  25374. t.aybarmenian = 0x0561;
  25375. t.ayin = 0x05e2;
  25376. t.ayinaltonehebrew = 0xfb20;
  25377. t.ayinhebrew = 0x05e2;
  25378. t.b = 0x0062;
  25379. t.babengali = 0x09ac;
  25380. t.backslash = 0x005c;
  25381. t.backslashmonospace = 0xff3c;
  25382. t.badeva = 0x092c;
  25383. t.bagujarati = 0x0aac;
  25384. t.bagurmukhi = 0x0a2c;
  25385. t.bahiragana = 0x3070;
  25386. t.bahtthai = 0x0e3f;
  25387. t.bakatakana = 0x30d0;
  25388. t.bar = 0x007c;
  25389. t.barmonospace = 0xff5c;
  25390. t.bbopomofo = 0x3105;
  25391. t.bcircle = 0x24d1;
  25392. t.bdotaccent = 0x1e03;
  25393. t.bdotbelow = 0x1e05;
  25394. t.beamedsixteenthnotes = 0x266c;
  25395. t.because = 0x2235;
  25396. t.becyrillic = 0x0431;
  25397. t.beharabic = 0x0628;
  25398. t.behfinalarabic = 0xfe90;
  25399. t.behinitialarabic = 0xfe91;
  25400. t.behiragana = 0x3079;
  25401. t.behmedialarabic = 0xfe92;
  25402. t.behmeeminitialarabic = 0xfc9f;
  25403. t.behmeemisolatedarabic = 0xfc08;
  25404. t.behnoonfinalarabic = 0xfc6d;
  25405. t.bekatakana = 0x30d9;
  25406. t.benarmenian = 0x0562;
  25407. t.bet = 0x05d1;
  25408. t.beta = 0x03b2;
  25409. t.betasymbolgreek = 0x03d0;
  25410. t.betdagesh = 0xfb31;
  25411. t.betdageshhebrew = 0xfb31;
  25412. t.bethebrew = 0x05d1;
  25413. t.betrafehebrew = 0xfb4c;
  25414. t.bhabengali = 0x09ad;
  25415. t.bhadeva = 0x092d;
  25416. t.bhagujarati = 0x0aad;
  25417. t.bhagurmukhi = 0x0a2d;
  25418. t.bhook = 0x0253;
  25419. t.bihiragana = 0x3073;
  25420. t.bikatakana = 0x30d3;
  25421. t.bilabialclick = 0x0298;
  25422. t.bindigurmukhi = 0x0a02;
  25423. t.birusquare = 0x3331;
  25424. t.blackcircle = 0x25cf;
  25425. t.blackdiamond = 0x25c6;
  25426. t.blackdownpointingtriangle = 0x25bc;
  25427. t.blackleftpointingpointer = 0x25c4;
  25428. t.blackleftpointingtriangle = 0x25c0;
  25429. t.blacklenticularbracketleft = 0x3010;
  25430. t.blacklenticularbracketleftvertical = 0xfe3b;
  25431. t.blacklenticularbracketright = 0x3011;
  25432. t.blacklenticularbracketrightvertical = 0xfe3c;
  25433. t.blacklowerlefttriangle = 0x25e3;
  25434. t.blacklowerrighttriangle = 0x25e2;
  25435. t.blackrectangle = 0x25ac;
  25436. t.blackrightpointingpointer = 0x25ba;
  25437. t.blackrightpointingtriangle = 0x25b6;
  25438. t.blacksmallsquare = 0x25aa;
  25439. t.blacksmilingface = 0x263b;
  25440. t.blacksquare = 0x25a0;
  25441. t.blackstar = 0x2605;
  25442. t.blackupperlefttriangle = 0x25e4;
  25443. t.blackupperrighttriangle = 0x25e5;
  25444. t.blackuppointingsmalltriangle = 0x25b4;
  25445. t.blackuppointingtriangle = 0x25b2;
  25446. t.blank = 0x2423;
  25447. t.blinebelow = 0x1e07;
  25448. t.block = 0x2588;
  25449. t.bmonospace = 0xff42;
  25450. t.bobaimaithai = 0x0e1a;
  25451. t.bohiragana = 0x307c;
  25452. t.bokatakana = 0x30dc;
  25453. t.bparen = 0x249d;
  25454. t.bqsquare = 0x33c3;
  25455. t.braceex = 0xf8f4;
  25456. t.braceleft = 0x007b;
  25457. t.braceleftbt = 0xf8f3;
  25458. t.braceleftmid = 0xf8f2;
  25459. t.braceleftmonospace = 0xff5b;
  25460. t.braceleftsmall = 0xfe5b;
  25461. t.bracelefttp = 0xf8f1;
  25462. t.braceleftvertical = 0xfe37;
  25463. t.braceright = 0x007d;
  25464. t.bracerightbt = 0xf8fe;
  25465. t.bracerightmid = 0xf8fd;
  25466. t.bracerightmonospace = 0xff5d;
  25467. t.bracerightsmall = 0xfe5c;
  25468. t.bracerighttp = 0xf8fc;
  25469. t.bracerightvertical = 0xfe38;
  25470. t.bracketleft = 0x005b;
  25471. t.bracketleftbt = 0xf8f0;
  25472. t.bracketleftex = 0xf8ef;
  25473. t.bracketleftmonospace = 0xff3b;
  25474. t.bracketlefttp = 0xf8ee;
  25475. t.bracketright = 0x005d;
  25476. t.bracketrightbt = 0xf8fb;
  25477. t.bracketrightex = 0xf8fa;
  25478. t.bracketrightmonospace = 0xff3d;
  25479. t.bracketrighttp = 0xf8f9;
  25480. t.breve = 0x02d8;
  25481. t.brevebelowcmb = 0x032e;
  25482. t.brevecmb = 0x0306;
  25483. t.breveinvertedbelowcmb = 0x032f;
  25484. t.breveinvertedcmb = 0x0311;
  25485. t.breveinverteddoublecmb = 0x0361;
  25486. t.bridgebelowcmb = 0x032a;
  25487. t.bridgeinvertedbelowcmb = 0x033a;
  25488. t.brokenbar = 0x00a6;
  25489. t.bstroke = 0x0180;
  25490. t.bsuperior = 0xf6ea;
  25491. t.btopbar = 0x0183;
  25492. t.buhiragana = 0x3076;
  25493. t.bukatakana = 0x30d6;
  25494. t.bullet = 0x2022;
  25495. t.bulletinverse = 0x25d8;
  25496. t.bulletoperator = 0x2219;
  25497. t.bullseye = 0x25ce;
  25498. t.c = 0x0063;
  25499. t.caarmenian = 0x056e;
  25500. t.cabengali = 0x099a;
  25501. t.cacute = 0x0107;
  25502. t.cadeva = 0x091a;
  25503. t.cagujarati = 0x0a9a;
  25504. t.cagurmukhi = 0x0a1a;
  25505. t.calsquare = 0x3388;
  25506. t.candrabindubengali = 0x0981;
  25507. t.candrabinducmb = 0x0310;
  25508. t.candrabindudeva = 0x0901;
  25509. t.candrabindugujarati = 0x0a81;
  25510. t.capslock = 0x21ea;
  25511. t.careof = 0x2105;
  25512. t.caron = 0x02c7;
  25513. t.caronbelowcmb = 0x032c;
  25514. t.caroncmb = 0x030c;
  25515. t.carriagereturn = 0x21b5;
  25516. t.cbopomofo = 0x3118;
  25517. t.ccaron = 0x010d;
  25518. t.ccedilla = 0x00e7;
  25519. t.ccedillaacute = 0x1e09;
  25520. t.ccircle = 0x24d2;
  25521. t.ccircumflex = 0x0109;
  25522. t.ccurl = 0x0255;
  25523. t.cdot = 0x010b;
  25524. t.cdotaccent = 0x010b;
  25525. t.cdsquare = 0x33c5;
  25526. t.cedilla = 0x00b8;
  25527. t.cedillacmb = 0x0327;
  25528. t.cent = 0x00a2;
  25529. t.centigrade = 0x2103;
  25530. t.centinferior = 0xf6df;
  25531. t.centmonospace = 0xffe0;
  25532. t.centoldstyle = 0xf7a2;
  25533. t.centsuperior = 0xf6e0;
  25534. t.chaarmenian = 0x0579;
  25535. t.chabengali = 0x099b;
  25536. t.chadeva = 0x091b;
  25537. t.chagujarati = 0x0a9b;
  25538. t.chagurmukhi = 0x0a1b;
  25539. t.chbopomofo = 0x3114;
  25540. t.cheabkhasiancyrillic = 0x04bd;
  25541. t.checkmark = 0x2713;
  25542. t.checyrillic = 0x0447;
  25543. t.chedescenderabkhasiancyrillic = 0x04bf;
  25544. t.chedescendercyrillic = 0x04b7;
  25545. t.chedieresiscyrillic = 0x04f5;
  25546. t.cheharmenian = 0x0573;
  25547. t.chekhakassiancyrillic = 0x04cc;
  25548. t.cheverticalstrokecyrillic = 0x04b9;
  25549. t.chi = 0x03c7;
  25550. t.chieuchacirclekorean = 0x3277;
  25551. t.chieuchaparenkorean = 0x3217;
  25552. t.chieuchcirclekorean = 0x3269;
  25553. t.chieuchkorean = 0x314a;
  25554. t.chieuchparenkorean = 0x3209;
  25555. t.chochangthai = 0x0e0a;
  25556. t.chochanthai = 0x0e08;
  25557. t.chochingthai = 0x0e09;
  25558. t.chochoethai = 0x0e0c;
  25559. t.chook = 0x0188;
  25560. t.cieucacirclekorean = 0x3276;
  25561. t.cieucaparenkorean = 0x3216;
  25562. t.cieuccirclekorean = 0x3268;
  25563. t.cieuckorean = 0x3148;
  25564. t.cieucparenkorean = 0x3208;
  25565. t.cieucuparenkorean = 0x321c;
  25566. t.circle = 0x25cb;
  25567. t.circlecopyrt = 0x00a9;
  25568. t.circlemultiply = 0x2297;
  25569. t.circleot = 0x2299;
  25570. t.circleplus = 0x2295;
  25571. t.circlepostalmark = 0x3036;
  25572. t.circlewithlefthalfblack = 0x25d0;
  25573. t.circlewithrighthalfblack = 0x25d1;
  25574. t.circumflex = 0x02c6;
  25575. t.circumflexbelowcmb = 0x032d;
  25576. t.circumflexcmb = 0x0302;
  25577. t.clear = 0x2327;
  25578. t.clickalveolar = 0x01c2;
  25579. t.clickdental = 0x01c0;
  25580. t.clicklateral = 0x01c1;
  25581. t.clickretroflex = 0x01c3;
  25582. t.club = 0x2663;
  25583. t.clubsuitblack = 0x2663;
  25584. t.clubsuitwhite = 0x2667;
  25585. t.cmcubedsquare = 0x33a4;
  25586. t.cmonospace = 0xff43;
  25587. t.cmsquaredsquare = 0x33a0;
  25588. t.coarmenian = 0x0581;
  25589. t.colon = 0x003a;
  25590. t.colonmonetary = 0x20a1;
  25591. t.colonmonospace = 0xff1a;
  25592. t.colonsign = 0x20a1;
  25593. t.colonsmall = 0xfe55;
  25594. t.colontriangularhalfmod = 0x02d1;
  25595. t.colontriangularmod = 0x02d0;
  25596. t.comma = 0x002c;
  25597. t.commaabovecmb = 0x0313;
  25598. t.commaaboverightcmb = 0x0315;
  25599. t.commaaccent = 0xf6c3;
  25600. t.commaarabic = 0x060c;
  25601. t.commaarmenian = 0x055d;
  25602. t.commainferior = 0xf6e1;
  25603. t.commamonospace = 0xff0c;
  25604. t.commareversedabovecmb = 0x0314;
  25605. t.commareversedmod = 0x02bd;
  25606. t.commasmall = 0xfe50;
  25607. t.commasuperior = 0xf6e2;
  25608. t.commaturnedabovecmb = 0x0312;
  25609. t.commaturnedmod = 0x02bb;
  25610. t.compass = 0x263c;
  25611. t.congruent = 0x2245;
  25612. t.contourintegral = 0x222e;
  25613. t.control = 0x2303;
  25614. t.controlACK = 0x0006;
  25615. t.controlBEL = 0x0007;
  25616. t.controlBS = 0x0008;
  25617. t.controlCAN = 0x0018;
  25618. t.controlCR = 0x000d;
  25619. t.controlDC1 = 0x0011;
  25620. t.controlDC2 = 0x0012;
  25621. t.controlDC3 = 0x0013;
  25622. t.controlDC4 = 0x0014;
  25623. t.controlDEL = 0x007f;
  25624. t.controlDLE = 0x0010;
  25625. t.controlEM = 0x0019;
  25626. t.controlENQ = 0x0005;
  25627. t.controlEOT = 0x0004;
  25628. t.controlESC = 0x001b;
  25629. t.controlETB = 0x0017;
  25630. t.controlETX = 0x0003;
  25631. t.controlFF = 0x000c;
  25632. t.controlFS = 0x001c;
  25633. t.controlGS = 0x001d;
  25634. t.controlHT = 0x0009;
  25635. t.controlLF = 0x000a;
  25636. t.controlNAK = 0x0015;
  25637. t.controlNULL = 0x0000;
  25638. t.controlRS = 0x001e;
  25639. t.controlSI = 0x000f;
  25640. t.controlSO = 0x000e;
  25641. t.controlSOT = 0x0002;
  25642. t.controlSTX = 0x0001;
  25643. t.controlSUB = 0x001a;
  25644. t.controlSYN = 0x0016;
  25645. t.controlUS = 0x001f;
  25646. t.controlVT = 0x000b;
  25647. t.copyright = 0x00a9;
  25648. t.copyrightsans = 0xf8e9;
  25649. t.copyrightserif = 0xf6d9;
  25650. t.cornerbracketleft = 0x300c;
  25651. t.cornerbracketlefthalfwidth = 0xff62;
  25652. t.cornerbracketleftvertical = 0xfe41;
  25653. t.cornerbracketright = 0x300d;
  25654. t.cornerbracketrighthalfwidth = 0xff63;
  25655. t.cornerbracketrightvertical = 0xfe42;
  25656. t.corporationsquare = 0x337f;
  25657. t.cosquare = 0x33c7;
  25658. t.coverkgsquare = 0x33c6;
  25659. t.cparen = 0x249e;
  25660. t.cruzeiro = 0x20a2;
  25661. t.cstretched = 0x0297;
  25662. t.curlyand = 0x22cf;
  25663. t.curlyor = 0x22ce;
  25664. t.currency = 0x00a4;
  25665. t.cyrBreve = 0xf6d1;
  25666. t.cyrFlex = 0xf6d2;
  25667. t.cyrbreve = 0xf6d4;
  25668. t.cyrflex = 0xf6d5;
  25669. t.d = 0x0064;
  25670. t.daarmenian = 0x0564;
  25671. t.dabengali = 0x09a6;
  25672. t.dadarabic = 0x0636;
  25673. t.dadeva = 0x0926;
  25674. t.dadfinalarabic = 0xfebe;
  25675. t.dadinitialarabic = 0xfebf;
  25676. t.dadmedialarabic = 0xfec0;
  25677. t.dagesh = 0x05bc;
  25678. t.dageshhebrew = 0x05bc;
  25679. t.dagger = 0x2020;
  25680. t.daggerdbl = 0x2021;
  25681. t.dagujarati = 0x0aa6;
  25682. t.dagurmukhi = 0x0a26;
  25683. t.dahiragana = 0x3060;
  25684. t.dakatakana = 0x30c0;
  25685. t.dalarabic = 0x062f;
  25686. t.dalet = 0x05d3;
  25687. t.daletdagesh = 0xfb33;
  25688. t.daletdageshhebrew = 0xfb33;
  25689. t.dalethebrew = 0x05d3;
  25690. t.dalfinalarabic = 0xfeaa;
  25691. t.dammaarabic = 0x064f;
  25692. t.dammalowarabic = 0x064f;
  25693. t.dammatanaltonearabic = 0x064c;
  25694. t.dammatanarabic = 0x064c;
  25695. t.danda = 0x0964;
  25696. t.dargahebrew = 0x05a7;
  25697. t.dargalefthebrew = 0x05a7;
  25698. t.dasiapneumatacyrilliccmb = 0x0485;
  25699. t.dblGrave = 0xf6d3;
  25700. t.dblanglebracketleft = 0x300a;
  25701. t.dblanglebracketleftvertical = 0xfe3d;
  25702. t.dblanglebracketright = 0x300b;
  25703. t.dblanglebracketrightvertical = 0xfe3e;
  25704. t.dblarchinvertedbelowcmb = 0x032b;
  25705. t.dblarrowleft = 0x21d4;
  25706. t.dblarrowright = 0x21d2;
  25707. t.dbldanda = 0x0965;
  25708. t.dblgrave = 0xf6d6;
  25709. t.dblgravecmb = 0x030f;
  25710. t.dblintegral = 0x222c;
  25711. t.dbllowline = 0x2017;
  25712. t.dbllowlinecmb = 0x0333;
  25713. t.dbloverlinecmb = 0x033f;
  25714. t.dblprimemod = 0x02ba;
  25715. t.dblverticalbar = 0x2016;
  25716. t.dblverticallineabovecmb = 0x030e;
  25717. t.dbopomofo = 0x3109;
  25718. t.dbsquare = 0x33c8;
  25719. t.dcaron = 0x010f;
  25720. t.dcedilla = 0x1e11;
  25721. t.dcircle = 0x24d3;
  25722. t.dcircumflexbelow = 0x1e13;
  25723. t.dcroat = 0x0111;
  25724. t.ddabengali = 0x09a1;
  25725. t.ddadeva = 0x0921;
  25726. t.ddagujarati = 0x0aa1;
  25727. t.ddagurmukhi = 0x0a21;
  25728. t.ddalarabic = 0x0688;
  25729. t.ddalfinalarabic = 0xfb89;
  25730. t.dddhadeva = 0x095c;
  25731. t.ddhabengali = 0x09a2;
  25732. t.ddhadeva = 0x0922;
  25733. t.ddhagujarati = 0x0aa2;
  25734. t.ddhagurmukhi = 0x0a22;
  25735. t.ddotaccent = 0x1e0b;
  25736. t.ddotbelow = 0x1e0d;
  25737. t.decimalseparatorarabic = 0x066b;
  25738. t.decimalseparatorpersian = 0x066b;
  25739. t.decyrillic = 0x0434;
  25740. t.degree = 0x00b0;
  25741. t.dehihebrew = 0x05ad;
  25742. t.dehiragana = 0x3067;
  25743. t.deicoptic = 0x03ef;
  25744. t.dekatakana = 0x30c7;
  25745. t.deleteleft = 0x232b;
  25746. t.deleteright = 0x2326;
  25747. t.delta = 0x03b4;
  25748. t.deltaturned = 0x018d;
  25749. t.denominatorminusonenumeratorbengali = 0x09f8;
  25750. t.dezh = 0x02a4;
  25751. t.dhabengali = 0x09a7;
  25752. t.dhadeva = 0x0927;
  25753. t.dhagujarati = 0x0aa7;
  25754. t.dhagurmukhi = 0x0a27;
  25755. t.dhook = 0x0257;
  25756. t.dialytikatonos = 0x0385;
  25757. t.dialytikatonoscmb = 0x0344;
  25758. t.diamond = 0x2666;
  25759. t.diamondsuitwhite = 0x2662;
  25760. t.dieresis = 0x00a8;
  25761. t.dieresisacute = 0xf6d7;
  25762. t.dieresisbelowcmb = 0x0324;
  25763. t.dieresiscmb = 0x0308;
  25764. t.dieresisgrave = 0xf6d8;
  25765. t.dieresistonos = 0x0385;
  25766. t.dihiragana = 0x3062;
  25767. t.dikatakana = 0x30c2;
  25768. t.dittomark = 0x3003;
  25769. t.divide = 0x00f7;
  25770. t.divides = 0x2223;
  25771. t.divisionslash = 0x2215;
  25772. t.djecyrillic = 0x0452;
  25773. t.dkshade = 0x2593;
  25774. t.dlinebelow = 0x1e0f;
  25775. t.dlsquare = 0x3397;
  25776. t.dmacron = 0x0111;
  25777. t.dmonospace = 0xff44;
  25778. t.dnblock = 0x2584;
  25779. t.dochadathai = 0x0e0e;
  25780. t.dodekthai = 0x0e14;
  25781. t.dohiragana = 0x3069;
  25782. t.dokatakana = 0x30c9;
  25783. t.dollar = 0x0024;
  25784. t.dollarinferior = 0xf6e3;
  25785. t.dollarmonospace = 0xff04;
  25786. t.dollaroldstyle = 0xf724;
  25787. t.dollarsmall = 0xfe69;
  25788. t.dollarsuperior = 0xf6e4;
  25789. t.dong = 0x20ab;
  25790. t.dorusquare = 0x3326;
  25791. t.dotaccent = 0x02d9;
  25792. t.dotaccentcmb = 0x0307;
  25793. t.dotbelowcmb = 0x0323;
  25794. t.dotbelowcomb = 0x0323;
  25795. t.dotkatakana = 0x30fb;
  25796. t.dotlessi = 0x0131;
  25797. t.dotlessj = 0xf6be;
  25798. t.dotlessjstrokehook = 0x0284;
  25799. t.dotmath = 0x22c5;
  25800. t.dottedcircle = 0x25cc;
  25801. t.doubleyodpatah = 0xfb1f;
  25802. t.doubleyodpatahhebrew = 0xfb1f;
  25803. t.downtackbelowcmb = 0x031e;
  25804. t.downtackmod = 0x02d5;
  25805. t.dparen = 0x249f;
  25806. t.dsuperior = 0xf6eb;
  25807. t.dtail = 0x0256;
  25808. t.dtopbar = 0x018c;
  25809. t.duhiragana = 0x3065;
  25810. t.dukatakana = 0x30c5;
  25811. t.dz = 0x01f3;
  25812. t.dzaltone = 0x02a3;
  25813. t.dzcaron = 0x01c6;
  25814. t.dzcurl = 0x02a5;
  25815. t.dzeabkhasiancyrillic = 0x04e1;
  25816. t.dzecyrillic = 0x0455;
  25817. t.dzhecyrillic = 0x045f;
  25818. t.e = 0x0065;
  25819. t.eacute = 0x00e9;
  25820. t.earth = 0x2641;
  25821. t.ebengali = 0x098f;
  25822. t.ebopomofo = 0x311c;
  25823. t.ebreve = 0x0115;
  25824. t.ecandradeva = 0x090d;
  25825. t.ecandragujarati = 0x0a8d;
  25826. t.ecandravowelsigndeva = 0x0945;
  25827. t.ecandravowelsigngujarati = 0x0ac5;
  25828. t.ecaron = 0x011b;
  25829. t.ecedillabreve = 0x1e1d;
  25830. t.echarmenian = 0x0565;
  25831. t.echyiwnarmenian = 0x0587;
  25832. t.ecircle = 0x24d4;
  25833. t.ecircumflex = 0x00ea;
  25834. t.ecircumflexacute = 0x1ebf;
  25835. t.ecircumflexbelow = 0x1e19;
  25836. t.ecircumflexdotbelow = 0x1ec7;
  25837. t.ecircumflexgrave = 0x1ec1;
  25838. t.ecircumflexhookabove = 0x1ec3;
  25839. t.ecircumflextilde = 0x1ec5;
  25840. t.ecyrillic = 0x0454;
  25841. t.edblgrave = 0x0205;
  25842. t.edeva = 0x090f;
  25843. t.edieresis = 0x00eb;
  25844. t.edot = 0x0117;
  25845. t.edotaccent = 0x0117;
  25846. t.edotbelow = 0x1eb9;
  25847. t.eegurmukhi = 0x0a0f;
  25848. t.eematragurmukhi = 0x0a47;
  25849. t.efcyrillic = 0x0444;
  25850. t.egrave = 0x00e8;
  25851. t.egujarati = 0x0a8f;
  25852. t.eharmenian = 0x0567;
  25853. t.ehbopomofo = 0x311d;
  25854. t.ehiragana = 0x3048;
  25855. t.ehookabove = 0x1ebb;
  25856. t.eibopomofo = 0x311f;
  25857. t.eight = 0x0038;
  25858. t.eightarabic = 0x0668;
  25859. t.eightbengali = 0x09ee;
  25860. t.eightcircle = 0x2467;
  25861. t.eightcircleinversesansserif = 0x2791;
  25862. t.eightdeva = 0x096e;
  25863. t.eighteencircle = 0x2471;
  25864. t.eighteenparen = 0x2485;
  25865. t.eighteenperiod = 0x2499;
  25866. t.eightgujarati = 0x0aee;
  25867. t.eightgurmukhi = 0x0a6e;
  25868. t.eighthackarabic = 0x0668;
  25869. t.eighthangzhou = 0x3028;
  25870. t.eighthnotebeamed = 0x266b;
  25871. t.eightideographicparen = 0x3227;
  25872. t.eightinferior = 0x2088;
  25873. t.eightmonospace = 0xff18;
  25874. t.eightoldstyle = 0xf738;
  25875. t.eightparen = 0x247b;
  25876. t.eightperiod = 0x248f;
  25877. t.eightpersian = 0x06f8;
  25878. t.eightroman = 0x2177;
  25879. t.eightsuperior = 0x2078;
  25880. t.eightthai = 0x0e58;
  25881. t.einvertedbreve = 0x0207;
  25882. t.eiotifiedcyrillic = 0x0465;
  25883. t.ekatakana = 0x30a8;
  25884. t.ekatakanahalfwidth = 0xff74;
  25885. t.ekonkargurmukhi = 0x0a74;
  25886. t.ekorean = 0x3154;
  25887. t.elcyrillic = 0x043b;
  25888. t.element = 0x2208;
  25889. t.elevencircle = 0x246a;
  25890. t.elevenparen = 0x247e;
  25891. t.elevenperiod = 0x2492;
  25892. t.elevenroman = 0x217a;
  25893. t.ellipsis = 0x2026;
  25894. t.ellipsisvertical = 0x22ee;
  25895. t.emacron = 0x0113;
  25896. t.emacronacute = 0x1e17;
  25897. t.emacrongrave = 0x1e15;
  25898. t.emcyrillic = 0x043c;
  25899. t.emdash = 0x2014;
  25900. t.emdashvertical = 0xfe31;
  25901. t.emonospace = 0xff45;
  25902. t.emphasismarkarmenian = 0x055b;
  25903. t.emptyset = 0x2205;
  25904. t.enbopomofo = 0x3123;
  25905. t.encyrillic = 0x043d;
  25906. t.endash = 0x2013;
  25907. t.endashvertical = 0xfe32;
  25908. t.endescendercyrillic = 0x04a3;
  25909. t.eng = 0x014b;
  25910. t.engbopomofo = 0x3125;
  25911. t.enghecyrillic = 0x04a5;
  25912. t.enhookcyrillic = 0x04c8;
  25913. t.enspace = 0x2002;
  25914. t.eogonek = 0x0119;
  25915. t.eokorean = 0x3153;
  25916. t.eopen = 0x025b;
  25917. t.eopenclosed = 0x029a;
  25918. t.eopenreversed = 0x025c;
  25919. t.eopenreversedclosed = 0x025e;
  25920. t.eopenreversedhook = 0x025d;
  25921. t.eparen = 0x24a0;
  25922. t.epsilon = 0x03b5;
  25923. t.epsilontonos = 0x03ad;
  25924. t.equal = 0x003d;
  25925. t.equalmonospace = 0xff1d;
  25926. t.equalsmall = 0xfe66;
  25927. t.equalsuperior = 0x207c;
  25928. t.equivalence = 0x2261;
  25929. t.erbopomofo = 0x3126;
  25930. t.ercyrillic = 0x0440;
  25931. t.ereversed = 0x0258;
  25932. t.ereversedcyrillic = 0x044d;
  25933. t.escyrillic = 0x0441;
  25934. t.esdescendercyrillic = 0x04ab;
  25935. t.esh = 0x0283;
  25936. t.eshcurl = 0x0286;
  25937. t.eshortdeva = 0x090e;
  25938. t.eshortvowelsigndeva = 0x0946;
  25939. t.eshreversedloop = 0x01aa;
  25940. t.eshsquatreversed = 0x0285;
  25941. t.esmallhiragana = 0x3047;
  25942. t.esmallkatakana = 0x30a7;
  25943. t.esmallkatakanahalfwidth = 0xff6a;
  25944. t.estimated = 0x212e;
  25945. t.esuperior = 0xf6ec;
  25946. t.eta = 0x03b7;
  25947. t.etarmenian = 0x0568;
  25948. t.etatonos = 0x03ae;
  25949. t.eth = 0x00f0;
  25950. t.etilde = 0x1ebd;
  25951. t.etildebelow = 0x1e1b;
  25952. t.etnahtafoukhhebrew = 0x0591;
  25953. t.etnahtafoukhlefthebrew = 0x0591;
  25954. t.etnahtahebrew = 0x0591;
  25955. t.etnahtalefthebrew = 0x0591;
  25956. t.eturned = 0x01dd;
  25957. t.eukorean = 0x3161;
  25958. t.euro = 0x20ac;
  25959. t.evowelsignbengali = 0x09c7;
  25960. t.evowelsigndeva = 0x0947;
  25961. t.evowelsigngujarati = 0x0ac7;
  25962. t.exclam = 0x0021;
  25963. t.exclamarmenian = 0x055c;
  25964. t.exclamdbl = 0x203c;
  25965. t.exclamdown = 0x00a1;
  25966. t.exclamdownsmall = 0xf7a1;
  25967. t.exclammonospace = 0xff01;
  25968. t.exclamsmall = 0xf721;
  25969. t.existential = 0x2203;
  25970. t.ezh = 0x0292;
  25971. t.ezhcaron = 0x01ef;
  25972. t.ezhcurl = 0x0293;
  25973. t.ezhreversed = 0x01b9;
  25974. t.ezhtail = 0x01ba;
  25975. t.f = 0x0066;
  25976. t.fadeva = 0x095e;
  25977. t.fagurmukhi = 0x0a5e;
  25978. t.fahrenheit = 0x2109;
  25979. t.fathaarabic = 0x064e;
  25980. t.fathalowarabic = 0x064e;
  25981. t.fathatanarabic = 0x064b;
  25982. t.fbopomofo = 0x3108;
  25983. t.fcircle = 0x24d5;
  25984. t.fdotaccent = 0x1e1f;
  25985. t.feharabic = 0x0641;
  25986. t.feharmenian = 0x0586;
  25987. t.fehfinalarabic = 0xfed2;
  25988. t.fehinitialarabic = 0xfed3;
  25989. t.fehmedialarabic = 0xfed4;
  25990. t.feicoptic = 0x03e5;
  25991. t.female = 0x2640;
  25992. t.ff = 0xfb00;
  25993. t.f_f = 0xfb00;
  25994. t.ffi = 0xfb03;
  25995. t.ffl = 0xfb04;
  25996. t.fi = 0xfb01;
  25997. t.fifteencircle = 0x246e;
  25998. t.fifteenparen = 0x2482;
  25999. t.fifteenperiod = 0x2496;
  26000. t.figuredash = 0x2012;
  26001. t.filledbox = 0x25a0;
  26002. t.filledrect = 0x25ac;
  26003. t.finalkaf = 0x05da;
  26004. t.finalkafdagesh = 0xfb3a;
  26005. t.finalkafdageshhebrew = 0xfb3a;
  26006. t.finalkafhebrew = 0x05da;
  26007. t.finalmem = 0x05dd;
  26008. t.finalmemhebrew = 0x05dd;
  26009. t.finalnun = 0x05df;
  26010. t.finalnunhebrew = 0x05df;
  26011. t.finalpe = 0x05e3;
  26012. t.finalpehebrew = 0x05e3;
  26013. t.finaltsadi = 0x05e5;
  26014. t.finaltsadihebrew = 0x05e5;
  26015. t.firsttonechinese = 0x02c9;
  26016. t.fisheye = 0x25c9;
  26017. t.fitacyrillic = 0x0473;
  26018. t.five = 0x0035;
  26019. t.fivearabic = 0x0665;
  26020. t.fivebengali = 0x09eb;
  26021. t.fivecircle = 0x2464;
  26022. t.fivecircleinversesansserif = 0x278e;
  26023. t.fivedeva = 0x096b;
  26024. t.fiveeighths = 0x215d;
  26025. t.fivegujarati = 0x0aeb;
  26026. t.fivegurmukhi = 0x0a6b;
  26027. t.fivehackarabic = 0x0665;
  26028. t.fivehangzhou = 0x3025;
  26029. t.fiveideographicparen = 0x3224;
  26030. t.fiveinferior = 0x2085;
  26031. t.fivemonospace = 0xff15;
  26032. t.fiveoldstyle = 0xf735;
  26033. t.fiveparen = 0x2478;
  26034. t.fiveperiod = 0x248c;
  26035. t.fivepersian = 0x06f5;
  26036. t.fiveroman = 0x2174;
  26037. t.fivesuperior = 0x2075;
  26038. t.fivethai = 0x0e55;
  26039. t.fl = 0xfb02;
  26040. t.florin = 0x0192;
  26041. t.fmonospace = 0xff46;
  26042. t.fmsquare = 0x3399;
  26043. t.fofanthai = 0x0e1f;
  26044. t.fofathai = 0x0e1d;
  26045. t.fongmanthai = 0x0e4f;
  26046. t.forall = 0x2200;
  26047. t.four = 0x0034;
  26048. t.fourarabic = 0x0664;
  26049. t.fourbengali = 0x09ea;
  26050. t.fourcircle = 0x2463;
  26051. t.fourcircleinversesansserif = 0x278d;
  26052. t.fourdeva = 0x096a;
  26053. t.fourgujarati = 0x0aea;
  26054. t.fourgurmukhi = 0x0a6a;
  26055. t.fourhackarabic = 0x0664;
  26056. t.fourhangzhou = 0x3024;
  26057. t.fourideographicparen = 0x3223;
  26058. t.fourinferior = 0x2084;
  26059. t.fourmonospace = 0xff14;
  26060. t.fournumeratorbengali = 0x09f7;
  26061. t.fouroldstyle = 0xf734;
  26062. t.fourparen = 0x2477;
  26063. t.fourperiod = 0x248b;
  26064. t.fourpersian = 0x06f4;
  26065. t.fourroman = 0x2173;
  26066. t.foursuperior = 0x2074;
  26067. t.fourteencircle = 0x246d;
  26068. t.fourteenparen = 0x2481;
  26069. t.fourteenperiod = 0x2495;
  26070. t.fourthai = 0x0e54;
  26071. t.fourthtonechinese = 0x02cb;
  26072. t.fparen = 0x24a1;
  26073. t.fraction = 0x2044;
  26074. t.franc = 0x20a3;
  26075. t.g = 0x0067;
  26076. t.gabengali = 0x0997;
  26077. t.gacute = 0x01f5;
  26078. t.gadeva = 0x0917;
  26079. t.gafarabic = 0x06af;
  26080. t.gaffinalarabic = 0xfb93;
  26081. t.gafinitialarabic = 0xfb94;
  26082. t.gafmedialarabic = 0xfb95;
  26083. t.gagujarati = 0x0a97;
  26084. t.gagurmukhi = 0x0a17;
  26085. t.gahiragana = 0x304c;
  26086. t.gakatakana = 0x30ac;
  26087. t.gamma = 0x03b3;
  26088. t.gammalatinsmall = 0x0263;
  26089. t.gammasuperior = 0x02e0;
  26090. t.gangiacoptic = 0x03eb;
  26091. t.gbopomofo = 0x310d;
  26092. t.gbreve = 0x011f;
  26093. t.gcaron = 0x01e7;
  26094. t.gcedilla = 0x0123;
  26095. t.gcircle = 0x24d6;
  26096. t.gcircumflex = 0x011d;
  26097. t.gcommaaccent = 0x0123;
  26098. t.gdot = 0x0121;
  26099. t.gdotaccent = 0x0121;
  26100. t.gecyrillic = 0x0433;
  26101. t.gehiragana = 0x3052;
  26102. t.gekatakana = 0x30b2;
  26103. t.geometricallyequal = 0x2251;
  26104. t.gereshaccenthebrew = 0x059c;
  26105. t.gereshhebrew = 0x05f3;
  26106. t.gereshmuqdamhebrew = 0x059d;
  26107. t.germandbls = 0x00df;
  26108. t.gershayimaccenthebrew = 0x059e;
  26109. t.gershayimhebrew = 0x05f4;
  26110. t.getamark = 0x3013;
  26111. t.ghabengali = 0x0998;
  26112. t.ghadarmenian = 0x0572;
  26113. t.ghadeva = 0x0918;
  26114. t.ghagujarati = 0x0a98;
  26115. t.ghagurmukhi = 0x0a18;
  26116. t.ghainarabic = 0x063a;
  26117. t.ghainfinalarabic = 0xfece;
  26118. t.ghaininitialarabic = 0xfecf;
  26119. t.ghainmedialarabic = 0xfed0;
  26120. t.ghemiddlehookcyrillic = 0x0495;
  26121. t.ghestrokecyrillic = 0x0493;
  26122. t.gheupturncyrillic = 0x0491;
  26123. t.ghhadeva = 0x095a;
  26124. t.ghhagurmukhi = 0x0a5a;
  26125. t.ghook = 0x0260;
  26126. t.ghzsquare = 0x3393;
  26127. t.gihiragana = 0x304e;
  26128. t.gikatakana = 0x30ae;
  26129. t.gimarmenian = 0x0563;
  26130. t.gimel = 0x05d2;
  26131. t.gimeldagesh = 0xfb32;
  26132. t.gimeldageshhebrew = 0xfb32;
  26133. t.gimelhebrew = 0x05d2;
  26134. t.gjecyrillic = 0x0453;
  26135. t.glottalinvertedstroke = 0x01be;
  26136. t.glottalstop = 0x0294;
  26137. t.glottalstopinverted = 0x0296;
  26138. t.glottalstopmod = 0x02c0;
  26139. t.glottalstopreversed = 0x0295;
  26140. t.glottalstopreversedmod = 0x02c1;
  26141. t.glottalstopreversedsuperior = 0x02e4;
  26142. t.glottalstopstroke = 0x02a1;
  26143. t.glottalstopstrokereversed = 0x02a2;
  26144. t.gmacron = 0x1e21;
  26145. t.gmonospace = 0xff47;
  26146. t.gohiragana = 0x3054;
  26147. t.gokatakana = 0x30b4;
  26148. t.gparen = 0x24a2;
  26149. t.gpasquare = 0x33ac;
  26150. t.gradient = 0x2207;
  26151. t.grave = 0x0060;
  26152. t.gravebelowcmb = 0x0316;
  26153. t.gravecmb = 0x0300;
  26154. t.gravecomb = 0x0300;
  26155. t.gravedeva = 0x0953;
  26156. t.gravelowmod = 0x02ce;
  26157. t.gravemonospace = 0xff40;
  26158. t.gravetonecmb = 0x0340;
  26159. t.greater = 0x003e;
  26160. t.greaterequal = 0x2265;
  26161. t.greaterequalorless = 0x22db;
  26162. t.greatermonospace = 0xff1e;
  26163. t.greaterorequivalent = 0x2273;
  26164. t.greaterorless = 0x2277;
  26165. t.greateroverequal = 0x2267;
  26166. t.greatersmall = 0xfe65;
  26167. t.gscript = 0x0261;
  26168. t.gstroke = 0x01e5;
  26169. t.guhiragana = 0x3050;
  26170. t.guillemotleft = 0x00ab;
  26171. t.guillemotright = 0x00bb;
  26172. t.guilsinglleft = 0x2039;
  26173. t.guilsinglright = 0x203a;
  26174. t.gukatakana = 0x30b0;
  26175. t.guramusquare = 0x3318;
  26176. t.gysquare = 0x33c9;
  26177. t.h = 0x0068;
  26178. t.haabkhasiancyrillic = 0x04a9;
  26179. t.haaltonearabic = 0x06c1;
  26180. t.habengali = 0x09b9;
  26181. t.hadescendercyrillic = 0x04b3;
  26182. t.hadeva = 0x0939;
  26183. t.hagujarati = 0x0ab9;
  26184. t.hagurmukhi = 0x0a39;
  26185. t.haharabic = 0x062d;
  26186. t.hahfinalarabic = 0xfea2;
  26187. t.hahinitialarabic = 0xfea3;
  26188. t.hahiragana = 0x306f;
  26189. t.hahmedialarabic = 0xfea4;
  26190. t.haitusquare = 0x332a;
  26191. t.hakatakana = 0x30cf;
  26192. t.hakatakanahalfwidth = 0xff8a;
  26193. t.halantgurmukhi = 0x0a4d;
  26194. t.hamzaarabic = 0x0621;
  26195. t.hamzalowarabic = 0x0621;
  26196. t.hangulfiller = 0x3164;
  26197. t.hardsigncyrillic = 0x044a;
  26198. t.harpoonleftbarbup = 0x21bc;
  26199. t.harpoonrightbarbup = 0x21c0;
  26200. t.hasquare = 0x33ca;
  26201. t.hatafpatah = 0x05b2;
  26202. t.hatafpatah16 = 0x05b2;
  26203. t.hatafpatah23 = 0x05b2;
  26204. t.hatafpatah2f = 0x05b2;
  26205. t.hatafpatahhebrew = 0x05b2;
  26206. t.hatafpatahnarrowhebrew = 0x05b2;
  26207. t.hatafpatahquarterhebrew = 0x05b2;
  26208. t.hatafpatahwidehebrew = 0x05b2;
  26209. t.hatafqamats = 0x05b3;
  26210. t.hatafqamats1b = 0x05b3;
  26211. t.hatafqamats28 = 0x05b3;
  26212. t.hatafqamats34 = 0x05b3;
  26213. t.hatafqamatshebrew = 0x05b3;
  26214. t.hatafqamatsnarrowhebrew = 0x05b3;
  26215. t.hatafqamatsquarterhebrew = 0x05b3;
  26216. t.hatafqamatswidehebrew = 0x05b3;
  26217. t.hatafsegol = 0x05b1;
  26218. t.hatafsegol17 = 0x05b1;
  26219. t.hatafsegol24 = 0x05b1;
  26220. t.hatafsegol30 = 0x05b1;
  26221. t.hatafsegolhebrew = 0x05b1;
  26222. t.hatafsegolnarrowhebrew = 0x05b1;
  26223. t.hatafsegolquarterhebrew = 0x05b1;
  26224. t.hatafsegolwidehebrew = 0x05b1;
  26225. t.hbar = 0x0127;
  26226. t.hbopomofo = 0x310f;
  26227. t.hbrevebelow = 0x1e2b;
  26228. t.hcedilla = 0x1e29;
  26229. t.hcircle = 0x24d7;
  26230. t.hcircumflex = 0x0125;
  26231. t.hdieresis = 0x1e27;
  26232. t.hdotaccent = 0x1e23;
  26233. t.hdotbelow = 0x1e25;
  26234. t.he = 0x05d4;
  26235. t.heart = 0x2665;
  26236. t.heartsuitblack = 0x2665;
  26237. t.heartsuitwhite = 0x2661;
  26238. t.hedagesh = 0xfb34;
  26239. t.hedageshhebrew = 0xfb34;
  26240. t.hehaltonearabic = 0x06c1;
  26241. t.heharabic = 0x0647;
  26242. t.hehebrew = 0x05d4;
  26243. t.hehfinalaltonearabic = 0xfba7;
  26244. t.hehfinalalttwoarabic = 0xfeea;
  26245. t.hehfinalarabic = 0xfeea;
  26246. t.hehhamzaabovefinalarabic = 0xfba5;
  26247. t.hehhamzaaboveisolatedarabic = 0xfba4;
  26248. t.hehinitialaltonearabic = 0xfba8;
  26249. t.hehinitialarabic = 0xfeeb;
  26250. t.hehiragana = 0x3078;
  26251. t.hehmedialaltonearabic = 0xfba9;
  26252. t.hehmedialarabic = 0xfeec;
  26253. t.heiseierasquare = 0x337b;
  26254. t.hekatakana = 0x30d8;
  26255. t.hekatakanahalfwidth = 0xff8d;
  26256. t.hekutaarusquare = 0x3336;
  26257. t.henghook = 0x0267;
  26258. t.herutusquare = 0x3339;
  26259. t.het = 0x05d7;
  26260. t.hethebrew = 0x05d7;
  26261. t.hhook = 0x0266;
  26262. t.hhooksuperior = 0x02b1;
  26263. t.hieuhacirclekorean = 0x327b;
  26264. t.hieuhaparenkorean = 0x321b;
  26265. t.hieuhcirclekorean = 0x326d;
  26266. t.hieuhkorean = 0x314e;
  26267. t.hieuhparenkorean = 0x320d;
  26268. t.hihiragana = 0x3072;
  26269. t.hikatakana = 0x30d2;
  26270. t.hikatakanahalfwidth = 0xff8b;
  26271. t.hiriq = 0x05b4;
  26272. t.hiriq14 = 0x05b4;
  26273. t.hiriq21 = 0x05b4;
  26274. t.hiriq2d = 0x05b4;
  26275. t.hiriqhebrew = 0x05b4;
  26276. t.hiriqnarrowhebrew = 0x05b4;
  26277. t.hiriqquarterhebrew = 0x05b4;
  26278. t.hiriqwidehebrew = 0x05b4;
  26279. t.hlinebelow = 0x1e96;
  26280. t.hmonospace = 0xff48;
  26281. t.hoarmenian = 0x0570;
  26282. t.hohipthai = 0x0e2b;
  26283. t.hohiragana = 0x307b;
  26284. t.hokatakana = 0x30db;
  26285. t.hokatakanahalfwidth = 0xff8e;
  26286. t.holam = 0x05b9;
  26287. t.holam19 = 0x05b9;
  26288. t.holam26 = 0x05b9;
  26289. t.holam32 = 0x05b9;
  26290. t.holamhebrew = 0x05b9;
  26291. t.holamnarrowhebrew = 0x05b9;
  26292. t.holamquarterhebrew = 0x05b9;
  26293. t.holamwidehebrew = 0x05b9;
  26294. t.honokhukthai = 0x0e2e;
  26295. t.hookabovecomb = 0x0309;
  26296. t.hookcmb = 0x0309;
  26297. t.hookpalatalizedbelowcmb = 0x0321;
  26298. t.hookretroflexbelowcmb = 0x0322;
  26299. t.hoonsquare = 0x3342;
  26300. t.horicoptic = 0x03e9;
  26301. t.horizontalbar = 0x2015;
  26302. t.horncmb = 0x031b;
  26303. t.hotsprings = 0x2668;
  26304. t.house = 0x2302;
  26305. t.hparen = 0x24a3;
  26306. t.hsuperior = 0x02b0;
  26307. t.hturned = 0x0265;
  26308. t.huhiragana = 0x3075;
  26309. t.huiitosquare = 0x3333;
  26310. t.hukatakana = 0x30d5;
  26311. t.hukatakanahalfwidth = 0xff8c;
  26312. t.hungarumlaut = 0x02dd;
  26313. t.hungarumlautcmb = 0x030b;
  26314. t.hv = 0x0195;
  26315. t.hyphen = 0x002d;
  26316. t.hypheninferior = 0xf6e5;
  26317. t.hyphenmonospace = 0xff0d;
  26318. t.hyphensmall = 0xfe63;
  26319. t.hyphensuperior = 0xf6e6;
  26320. t.hyphentwo = 0x2010;
  26321. t.i = 0x0069;
  26322. t.iacute = 0x00ed;
  26323. t.iacyrillic = 0x044f;
  26324. t.ibengali = 0x0987;
  26325. t.ibopomofo = 0x3127;
  26326. t.ibreve = 0x012d;
  26327. t.icaron = 0x01d0;
  26328. t.icircle = 0x24d8;
  26329. t.icircumflex = 0x00ee;
  26330. t.icyrillic = 0x0456;
  26331. t.idblgrave = 0x0209;
  26332. t.ideographearthcircle = 0x328f;
  26333. t.ideographfirecircle = 0x328b;
  26334. t.ideographicallianceparen = 0x323f;
  26335. t.ideographiccallparen = 0x323a;
  26336. t.ideographiccentrecircle = 0x32a5;
  26337. t.ideographicclose = 0x3006;
  26338. t.ideographiccomma = 0x3001;
  26339. t.ideographiccommaleft = 0xff64;
  26340. t.ideographiccongratulationparen = 0x3237;
  26341. t.ideographiccorrectcircle = 0x32a3;
  26342. t.ideographicearthparen = 0x322f;
  26343. t.ideographicenterpriseparen = 0x323d;
  26344. t.ideographicexcellentcircle = 0x329d;
  26345. t.ideographicfestivalparen = 0x3240;
  26346. t.ideographicfinancialcircle = 0x3296;
  26347. t.ideographicfinancialparen = 0x3236;
  26348. t.ideographicfireparen = 0x322b;
  26349. t.ideographichaveparen = 0x3232;
  26350. t.ideographichighcircle = 0x32a4;
  26351. t.ideographiciterationmark = 0x3005;
  26352. t.ideographiclaborcircle = 0x3298;
  26353. t.ideographiclaborparen = 0x3238;
  26354. t.ideographicleftcircle = 0x32a7;
  26355. t.ideographiclowcircle = 0x32a6;
  26356. t.ideographicmedicinecircle = 0x32a9;
  26357. t.ideographicmetalparen = 0x322e;
  26358. t.ideographicmoonparen = 0x322a;
  26359. t.ideographicnameparen = 0x3234;
  26360. t.ideographicperiod = 0x3002;
  26361. t.ideographicprintcircle = 0x329e;
  26362. t.ideographicreachparen = 0x3243;
  26363. t.ideographicrepresentparen = 0x3239;
  26364. t.ideographicresourceparen = 0x323e;
  26365. t.ideographicrightcircle = 0x32a8;
  26366. t.ideographicsecretcircle = 0x3299;
  26367. t.ideographicselfparen = 0x3242;
  26368. t.ideographicsocietyparen = 0x3233;
  26369. t.ideographicspace = 0x3000;
  26370. t.ideographicspecialparen = 0x3235;
  26371. t.ideographicstockparen = 0x3231;
  26372. t.ideographicstudyparen = 0x323b;
  26373. t.ideographicsunparen = 0x3230;
  26374. t.ideographicsuperviseparen = 0x323c;
  26375. t.ideographicwaterparen = 0x322c;
  26376. t.ideographicwoodparen = 0x322d;
  26377. t.ideographiczero = 0x3007;
  26378. t.ideographmetalcircle = 0x328e;
  26379. t.ideographmooncircle = 0x328a;
  26380. t.ideographnamecircle = 0x3294;
  26381. t.ideographsuncircle = 0x3290;
  26382. t.ideographwatercircle = 0x328c;
  26383. t.ideographwoodcircle = 0x328d;
  26384. t.ideva = 0x0907;
  26385. t.idieresis = 0x00ef;
  26386. t.idieresisacute = 0x1e2f;
  26387. t.idieresiscyrillic = 0x04e5;
  26388. t.idotbelow = 0x1ecb;
  26389. t.iebrevecyrillic = 0x04d7;
  26390. t.iecyrillic = 0x0435;
  26391. t.ieungacirclekorean = 0x3275;
  26392. t.ieungaparenkorean = 0x3215;
  26393. t.ieungcirclekorean = 0x3267;
  26394. t.ieungkorean = 0x3147;
  26395. t.ieungparenkorean = 0x3207;
  26396. t.igrave = 0x00ec;
  26397. t.igujarati = 0x0a87;
  26398. t.igurmukhi = 0x0a07;
  26399. t.ihiragana = 0x3044;
  26400. t.ihookabove = 0x1ec9;
  26401. t.iibengali = 0x0988;
  26402. t.iicyrillic = 0x0438;
  26403. t.iideva = 0x0908;
  26404. t.iigujarati = 0x0a88;
  26405. t.iigurmukhi = 0x0a08;
  26406. t.iimatragurmukhi = 0x0a40;
  26407. t.iinvertedbreve = 0x020b;
  26408. t.iishortcyrillic = 0x0439;
  26409. t.iivowelsignbengali = 0x09c0;
  26410. t.iivowelsigndeva = 0x0940;
  26411. t.iivowelsigngujarati = 0x0ac0;
  26412. t.ij = 0x0133;
  26413. t.ikatakana = 0x30a4;
  26414. t.ikatakanahalfwidth = 0xff72;
  26415. t.ikorean = 0x3163;
  26416. t.ilde = 0x02dc;
  26417. t.iluyhebrew = 0x05ac;
  26418. t.imacron = 0x012b;
  26419. t.imacroncyrillic = 0x04e3;
  26420. t.imageorapproximatelyequal = 0x2253;
  26421. t.imatragurmukhi = 0x0a3f;
  26422. t.imonospace = 0xff49;
  26423. t.increment = 0x2206;
  26424. t.infinity = 0x221e;
  26425. t.iniarmenian = 0x056b;
  26426. t.integral = 0x222b;
  26427. t.integralbottom = 0x2321;
  26428. t.integralbt = 0x2321;
  26429. t.integralex = 0xf8f5;
  26430. t.integraltop = 0x2320;
  26431. t.integraltp = 0x2320;
  26432. t.intersection = 0x2229;
  26433. t.intisquare = 0x3305;
  26434. t.invbullet = 0x25d8;
  26435. t.invcircle = 0x25d9;
  26436. t.invsmileface = 0x263b;
  26437. t.iocyrillic = 0x0451;
  26438. t.iogonek = 0x012f;
  26439. t.iota = 0x03b9;
  26440. t.iotadieresis = 0x03ca;
  26441. t.iotadieresistonos = 0x0390;
  26442. t.iotalatin = 0x0269;
  26443. t.iotatonos = 0x03af;
  26444. t.iparen = 0x24a4;
  26445. t.irigurmukhi = 0x0a72;
  26446. t.ismallhiragana = 0x3043;
  26447. t.ismallkatakana = 0x30a3;
  26448. t.ismallkatakanahalfwidth = 0xff68;
  26449. t.issharbengali = 0x09fa;
  26450. t.istroke = 0x0268;
  26451. t.isuperior = 0xf6ed;
  26452. t.iterationhiragana = 0x309d;
  26453. t.iterationkatakana = 0x30fd;
  26454. t.itilde = 0x0129;
  26455. t.itildebelow = 0x1e2d;
  26456. t.iubopomofo = 0x3129;
  26457. t.iucyrillic = 0x044e;
  26458. t.ivowelsignbengali = 0x09bf;
  26459. t.ivowelsigndeva = 0x093f;
  26460. t.ivowelsigngujarati = 0x0abf;
  26461. t.izhitsacyrillic = 0x0475;
  26462. t.izhitsadblgravecyrillic = 0x0477;
  26463. t.j = 0x006a;
  26464. t.jaarmenian = 0x0571;
  26465. t.jabengali = 0x099c;
  26466. t.jadeva = 0x091c;
  26467. t.jagujarati = 0x0a9c;
  26468. t.jagurmukhi = 0x0a1c;
  26469. t.jbopomofo = 0x3110;
  26470. t.jcaron = 0x01f0;
  26471. t.jcircle = 0x24d9;
  26472. t.jcircumflex = 0x0135;
  26473. t.jcrossedtail = 0x029d;
  26474. t.jdotlessstroke = 0x025f;
  26475. t.jecyrillic = 0x0458;
  26476. t.jeemarabic = 0x062c;
  26477. t.jeemfinalarabic = 0xfe9e;
  26478. t.jeeminitialarabic = 0xfe9f;
  26479. t.jeemmedialarabic = 0xfea0;
  26480. t.jeharabic = 0x0698;
  26481. t.jehfinalarabic = 0xfb8b;
  26482. t.jhabengali = 0x099d;
  26483. t.jhadeva = 0x091d;
  26484. t.jhagujarati = 0x0a9d;
  26485. t.jhagurmukhi = 0x0a1d;
  26486. t.jheharmenian = 0x057b;
  26487. t.jis = 0x3004;
  26488. t.jmonospace = 0xff4a;
  26489. t.jparen = 0x24a5;
  26490. t.jsuperior = 0x02b2;
  26491. t.k = 0x006b;
  26492. t.kabashkircyrillic = 0x04a1;
  26493. t.kabengali = 0x0995;
  26494. t.kacute = 0x1e31;
  26495. t.kacyrillic = 0x043a;
  26496. t.kadescendercyrillic = 0x049b;
  26497. t.kadeva = 0x0915;
  26498. t.kaf = 0x05db;
  26499. t.kafarabic = 0x0643;
  26500. t.kafdagesh = 0xfb3b;
  26501. t.kafdageshhebrew = 0xfb3b;
  26502. t.kaffinalarabic = 0xfeda;
  26503. t.kafhebrew = 0x05db;
  26504. t.kafinitialarabic = 0xfedb;
  26505. t.kafmedialarabic = 0xfedc;
  26506. t.kafrafehebrew = 0xfb4d;
  26507. t.kagujarati = 0x0a95;
  26508. t.kagurmukhi = 0x0a15;
  26509. t.kahiragana = 0x304b;
  26510. t.kahookcyrillic = 0x04c4;
  26511. t.kakatakana = 0x30ab;
  26512. t.kakatakanahalfwidth = 0xff76;
  26513. t.kappa = 0x03ba;
  26514. t.kappasymbolgreek = 0x03f0;
  26515. t.kapyeounmieumkorean = 0x3171;
  26516. t.kapyeounphieuphkorean = 0x3184;
  26517. t.kapyeounpieupkorean = 0x3178;
  26518. t.kapyeounssangpieupkorean = 0x3179;
  26519. t.karoriisquare = 0x330d;
  26520. t.kashidaautoarabic = 0x0640;
  26521. t.kashidaautonosidebearingarabic = 0x0640;
  26522. t.kasmallkatakana = 0x30f5;
  26523. t.kasquare = 0x3384;
  26524. t.kasraarabic = 0x0650;
  26525. t.kasratanarabic = 0x064d;
  26526. t.kastrokecyrillic = 0x049f;
  26527. t.katahiraprolongmarkhalfwidth = 0xff70;
  26528. t.kaverticalstrokecyrillic = 0x049d;
  26529. t.kbopomofo = 0x310e;
  26530. t.kcalsquare = 0x3389;
  26531. t.kcaron = 0x01e9;
  26532. t.kcedilla = 0x0137;
  26533. t.kcircle = 0x24da;
  26534. t.kcommaaccent = 0x0137;
  26535. t.kdotbelow = 0x1e33;
  26536. t.keharmenian = 0x0584;
  26537. t.kehiragana = 0x3051;
  26538. t.kekatakana = 0x30b1;
  26539. t.kekatakanahalfwidth = 0xff79;
  26540. t.kenarmenian = 0x056f;
  26541. t.kesmallkatakana = 0x30f6;
  26542. t.kgreenlandic = 0x0138;
  26543. t.khabengali = 0x0996;
  26544. t.khacyrillic = 0x0445;
  26545. t.khadeva = 0x0916;
  26546. t.khagujarati = 0x0a96;
  26547. t.khagurmukhi = 0x0a16;
  26548. t.khaharabic = 0x062e;
  26549. t.khahfinalarabic = 0xfea6;
  26550. t.khahinitialarabic = 0xfea7;
  26551. t.khahmedialarabic = 0xfea8;
  26552. t.kheicoptic = 0x03e7;
  26553. t.khhadeva = 0x0959;
  26554. t.khhagurmukhi = 0x0a59;
  26555. t.khieukhacirclekorean = 0x3278;
  26556. t.khieukhaparenkorean = 0x3218;
  26557. t.khieukhcirclekorean = 0x326a;
  26558. t.khieukhkorean = 0x314b;
  26559. t.khieukhparenkorean = 0x320a;
  26560. t.khokhaithai = 0x0e02;
  26561. t.khokhonthai = 0x0e05;
  26562. t.khokhuatthai = 0x0e03;
  26563. t.khokhwaithai = 0x0e04;
  26564. t.khomutthai = 0x0e5b;
  26565. t.khook = 0x0199;
  26566. t.khorakhangthai = 0x0e06;
  26567. t.khzsquare = 0x3391;
  26568. t.kihiragana = 0x304d;
  26569. t.kikatakana = 0x30ad;
  26570. t.kikatakanahalfwidth = 0xff77;
  26571. t.kiroguramusquare = 0x3315;
  26572. t.kiromeetorusquare = 0x3316;
  26573. t.kirosquare = 0x3314;
  26574. t.kiyeokacirclekorean = 0x326e;
  26575. t.kiyeokaparenkorean = 0x320e;
  26576. t.kiyeokcirclekorean = 0x3260;
  26577. t.kiyeokkorean = 0x3131;
  26578. t.kiyeokparenkorean = 0x3200;
  26579. t.kiyeoksioskorean = 0x3133;
  26580. t.kjecyrillic = 0x045c;
  26581. t.klinebelow = 0x1e35;
  26582. t.klsquare = 0x3398;
  26583. t.kmcubedsquare = 0x33a6;
  26584. t.kmonospace = 0xff4b;
  26585. t.kmsquaredsquare = 0x33a2;
  26586. t.kohiragana = 0x3053;
  26587. t.kohmsquare = 0x33c0;
  26588. t.kokaithai = 0x0e01;
  26589. t.kokatakana = 0x30b3;
  26590. t.kokatakanahalfwidth = 0xff7a;
  26591. t.kooposquare = 0x331e;
  26592. t.koppacyrillic = 0x0481;
  26593. t.koreanstandardsymbol = 0x327f;
  26594. t.koroniscmb = 0x0343;
  26595. t.kparen = 0x24a6;
  26596. t.kpasquare = 0x33aa;
  26597. t.ksicyrillic = 0x046f;
  26598. t.ktsquare = 0x33cf;
  26599. t.kturned = 0x029e;
  26600. t.kuhiragana = 0x304f;
  26601. t.kukatakana = 0x30af;
  26602. t.kukatakanahalfwidth = 0xff78;
  26603. t.kvsquare = 0x33b8;
  26604. t.kwsquare = 0x33be;
  26605. t.l = 0x006c;
  26606. t.labengali = 0x09b2;
  26607. t.lacute = 0x013a;
  26608. t.ladeva = 0x0932;
  26609. t.lagujarati = 0x0ab2;
  26610. t.lagurmukhi = 0x0a32;
  26611. t.lakkhangyaothai = 0x0e45;
  26612. t.lamaleffinalarabic = 0xfefc;
  26613. t.lamalefhamzaabovefinalarabic = 0xfef8;
  26614. t.lamalefhamzaaboveisolatedarabic = 0xfef7;
  26615. t.lamalefhamzabelowfinalarabic = 0xfefa;
  26616. t.lamalefhamzabelowisolatedarabic = 0xfef9;
  26617. t.lamalefisolatedarabic = 0xfefb;
  26618. t.lamalefmaddaabovefinalarabic = 0xfef6;
  26619. t.lamalefmaddaaboveisolatedarabic = 0xfef5;
  26620. t.lamarabic = 0x0644;
  26621. t.lambda = 0x03bb;
  26622. t.lambdastroke = 0x019b;
  26623. t.lamed = 0x05dc;
  26624. t.lameddagesh = 0xfb3c;
  26625. t.lameddageshhebrew = 0xfb3c;
  26626. t.lamedhebrew = 0x05dc;
  26627. t.lamfinalarabic = 0xfede;
  26628. t.lamhahinitialarabic = 0xfcca;
  26629. t.laminitialarabic = 0xfedf;
  26630. t.lamjeeminitialarabic = 0xfcc9;
  26631. t.lamkhahinitialarabic = 0xfccb;
  26632. t.lamlamhehisolatedarabic = 0xfdf2;
  26633. t.lammedialarabic = 0xfee0;
  26634. t.lammeemhahinitialarabic = 0xfd88;
  26635. t.lammeeminitialarabic = 0xfccc;
  26636. t.largecircle = 0x25ef;
  26637. t.lbar = 0x019a;
  26638. t.lbelt = 0x026c;
  26639. t.lbopomofo = 0x310c;
  26640. t.lcaron = 0x013e;
  26641. t.lcedilla = 0x013c;
  26642. t.lcircle = 0x24db;
  26643. t.lcircumflexbelow = 0x1e3d;
  26644. t.lcommaaccent = 0x013c;
  26645. t.ldot = 0x0140;
  26646. t.ldotaccent = 0x0140;
  26647. t.ldotbelow = 0x1e37;
  26648. t.ldotbelowmacron = 0x1e39;
  26649. t.leftangleabovecmb = 0x031a;
  26650. t.lefttackbelowcmb = 0x0318;
  26651. t.less = 0x003c;
  26652. t.lessequal = 0x2264;
  26653. t.lessequalorgreater = 0x22da;
  26654. t.lessmonospace = 0xff1c;
  26655. t.lessorequivalent = 0x2272;
  26656. t.lessorgreater = 0x2276;
  26657. t.lessoverequal = 0x2266;
  26658. t.lesssmall = 0xfe64;
  26659. t.lezh = 0x026e;
  26660. t.lfblock = 0x258c;
  26661. t.lhookretroflex = 0x026d;
  26662. t.lira = 0x20a4;
  26663. t.liwnarmenian = 0x056c;
  26664. t.lj = 0x01c9;
  26665. t.ljecyrillic = 0x0459;
  26666. t.ll = 0xf6c0;
  26667. t.lladeva = 0x0933;
  26668. t.llagujarati = 0x0ab3;
  26669. t.llinebelow = 0x1e3b;
  26670. t.llladeva = 0x0934;
  26671. t.llvocalicbengali = 0x09e1;
  26672. t.llvocalicdeva = 0x0961;
  26673. t.llvocalicvowelsignbengali = 0x09e3;
  26674. t.llvocalicvowelsigndeva = 0x0963;
  26675. t.lmiddletilde = 0x026b;
  26676. t.lmonospace = 0xff4c;
  26677. t.lmsquare = 0x33d0;
  26678. t.lochulathai = 0x0e2c;
  26679. t.logicaland = 0x2227;
  26680. t.logicalnot = 0x00ac;
  26681. t.logicalnotreversed = 0x2310;
  26682. t.logicalor = 0x2228;
  26683. t.lolingthai = 0x0e25;
  26684. t.longs = 0x017f;
  26685. t.lowlinecenterline = 0xfe4e;
  26686. t.lowlinecmb = 0x0332;
  26687. t.lowlinedashed = 0xfe4d;
  26688. t.lozenge = 0x25ca;
  26689. t.lparen = 0x24a7;
  26690. t.lslash = 0x0142;
  26691. t.lsquare = 0x2113;
  26692. t.lsuperior = 0xf6ee;
  26693. t.ltshade = 0x2591;
  26694. t.luthai = 0x0e26;
  26695. t.lvocalicbengali = 0x098c;
  26696. t.lvocalicdeva = 0x090c;
  26697. t.lvocalicvowelsignbengali = 0x09e2;
  26698. t.lvocalicvowelsigndeva = 0x0962;
  26699. t.lxsquare = 0x33d3;
  26700. t.m = 0x006d;
  26701. t.mabengali = 0x09ae;
  26702. t.macron = 0x00af;
  26703. t.macronbelowcmb = 0x0331;
  26704. t.macroncmb = 0x0304;
  26705. t.macronlowmod = 0x02cd;
  26706. t.macronmonospace = 0xffe3;
  26707. t.macute = 0x1e3f;
  26708. t.madeva = 0x092e;
  26709. t.magujarati = 0x0aae;
  26710. t.magurmukhi = 0x0a2e;
  26711. t.mahapakhhebrew = 0x05a4;
  26712. t.mahapakhlefthebrew = 0x05a4;
  26713. t.mahiragana = 0x307e;
  26714. t.maichattawalowleftthai = 0xf895;
  26715. t.maichattawalowrightthai = 0xf894;
  26716. t.maichattawathai = 0x0e4b;
  26717. t.maichattawaupperleftthai = 0xf893;
  26718. t.maieklowleftthai = 0xf88c;
  26719. t.maieklowrightthai = 0xf88b;
  26720. t.maiekthai = 0x0e48;
  26721. t.maiekupperleftthai = 0xf88a;
  26722. t.maihanakatleftthai = 0xf884;
  26723. t.maihanakatthai = 0x0e31;
  26724. t.maitaikhuleftthai = 0xf889;
  26725. t.maitaikhuthai = 0x0e47;
  26726. t.maitholowleftthai = 0xf88f;
  26727. t.maitholowrightthai = 0xf88e;
  26728. t.maithothai = 0x0e49;
  26729. t.maithoupperleftthai = 0xf88d;
  26730. t.maitrilowleftthai = 0xf892;
  26731. t.maitrilowrightthai = 0xf891;
  26732. t.maitrithai = 0x0e4a;
  26733. t.maitriupperleftthai = 0xf890;
  26734. t.maiyamokthai = 0x0e46;
  26735. t.makatakana = 0x30de;
  26736. t.makatakanahalfwidth = 0xff8f;
  26737. t.male = 0x2642;
  26738. t.mansyonsquare = 0x3347;
  26739. t.maqafhebrew = 0x05be;
  26740. t.mars = 0x2642;
  26741. t.masoracirclehebrew = 0x05af;
  26742. t.masquare = 0x3383;
  26743. t.mbopomofo = 0x3107;
  26744. t.mbsquare = 0x33d4;
  26745. t.mcircle = 0x24dc;
  26746. t.mcubedsquare = 0x33a5;
  26747. t.mdotaccent = 0x1e41;
  26748. t.mdotbelow = 0x1e43;
  26749. t.meemarabic = 0x0645;
  26750. t.meemfinalarabic = 0xfee2;
  26751. t.meeminitialarabic = 0xfee3;
  26752. t.meemmedialarabic = 0xfee4;
  26753. t.meemmeeminitialarabic = 0xfcd1;
  26754. t.meemmeemisolatedarabic = 0xfc48;
  26755. t.meetorusquare = 0x334d;
  26756. t.mehiragana = 0x3081;
  26757. t.meizierasquare = 0x337e;
  26758. t.mekatakana = 0x30e1;
  26759. t.mekatakanahalfwidth = 0xff92;
  26760. t.mem = 0x05de;
  26761. t.memdagesh = 0xfb3e;
  26762. t.memdageshhebrew = 0xfb3e;
  26763. t.memhebrew = 0x05de;
  26764. t.menarmenian = 0x0574;
  26765. t.merkhahebrew = 0x05a5;
  26766. t.merkhakefulahebrew = 0x05a6;
  26767. t.merkhakefulalefthebrew = 0x05a6;
  26768. t.merkhalefthebrew = 0x05a5;
  26769. t.mhook = 0x0271;
  26770. t.mhzsquare = 0x3392;
  26771. t.middledotkatakanahalfwidth = 0xff65;
  26772. t.middot = 0x00b7;
  26773. t.mieumacirclekorean = 0x3272;
  26774. t.mieumaparenkorean = 0x3212;
  26775. t.mieumcirclekorean = 0x3264;
  26776. t.mieumkorean = 0x3141;
  26777. t.mieumpansioskorean = 0x3170;
  26778. t.mieumparenkorean = 0x3204;
  26779. t.mieumpieupkorean = 0x316e;
  26780. t.mieumsioskorean = 0x316f;
  26781. t.mihiragana = 0x307f;
  26782. t.mikatakana = 0x30df;
  26783. t.mikatakanahalfwidth = 0xff90;
  26784. t.minus = 0x2212;
  26785. t.minusbelowcmb = 0x0320;
  26786. t.minuscircle = 0x2296;
  26787. t.minusmod = 0x02d7;
  26788. t.minusplus = 0x2213;
  26789. t.minute = 0x2032;
  26790. t.miribaarusquare = 0x334a;
  26791. t.mirisquare = 0x3349;
  26792. t.mlonglegturned = 0x0270;
  26793. t.mlsquare = 0x3396;
  26794. t.mmcubedsquare = 0x33a3;
  26795. t.mmonospace = 0xff4d;
  26796. t.mmsquaredsquare = 0x339f;
  26797. t.mohiragana = 0x3082;
  26798. t.mohmsquare = 0x33c1;
  26799. t.mokatakana = 0x30e2;
  26800. t.mokatakanahalfwidth = 0xff93;
  26801. t.molsquare = 0x33d6;
  26802. t.momathai = 0x0e21;
  26803. t.moverssquare = 0x33a7;
  26804. t.moverssquaredsquare = 0x33a8;
  26805. t.mparen = 0x24a8;
  26806. t.mpasquare = 0x33ab;
  26807. t.mssquare = 0x33b3;
  26808. t.msuperior = 0xf6ef;
  26809. t.mturned = 0x026f;
  26810. t.mu = 0x00b5;
  26811. t.mu1 = 0x00b5;
  26812. t.muasquare = 0x3382;
  26813. t.muchgreater = 0x226b;
  26814. t.muchless = 0x226a;
  26815. t.mufsquare = 0x338c;
  26816. t.mugreek = 0x03bc;
  26817. t.mugsquare = 0x338d;
  26818. t.muhiragana = 0x3080;
  26819. t.mukatakana = 0x30e0;
  26820. t.mukatakanahalfwidth = 0xff91;
  26821. t.mulsquare = 0x3395;
  26822. t.multiply = 0x00d7;
  26823. t.mumsquare = 0x339b;
  26824. t.munahhebrew = 0x05a3;
  26825. t.munahlefthebrew = 0x05a3;
  26826. t.musicalnote = 0x266a;
  26827. t.musicalnotedbl = 0x266b;
  26828. t.musicflatsign = 0x266d;
  26829. t.musicsharpsign = 0x266f;
  26830. t.mussquare = 0x33b2;
  26831. t.muvsquare = 0x33b6;
  26832. t.muwsquare = 0x33bc;
  26833. t.mvmegasquare = 0x33b9;
  26834. t.mvsquare = 0x33b7;
  26835. t.mwmegasquare = 0x33bf;
  26836. t.mwsquare = 0x33bd;
  26837. t.n = 0x006e;
  26838. t.nabengali = 0x09a8;
  26839. t.nabla = 0x2207;
  26840. t.nacute = 0x0144;
  26841. t.nadeva = 0x0928;
  26842. t.nagujarati = 0x0aa8;
  26843. t.nagurmukhi = 0x0a28;
  26844. t.nahiragana = 0x306a;
  26845. t.nakatakana = 0x30ca;
  26846. t.nakatakanahalfwidth = 0xff85;
  26847. t.napostrophe = 0x0149;
  26848. t.nasquare = 0x3381;
  26849. t.nbopomofo = 0x310b;
  26850. t.nbspace = 0x00a0;
  26851. t.ncaron = 0x0148;
  26852. t.ncedilla = 0x0146;
  26853. t.ncircle = 0x24dd;
  26854. t.ncircumflexbelow = 0x1e4b;
  26855. t.ncommaaccent = 0x0146;
  26856. t.ndotaccent = 0x1e45;
  26857. t.ndotbelow = 0x1e47;
  26858. t.nehiragana = 0x306d;
  26859. t.nekatakana = 0x30cd;
  26860. t.nekatakanahalfwidth = 0xff88;
  26861. t.newsheqelsign = 0x20aa;
  26862. t.nfsquare = 0x338b;
  26863. t.ngabengali = 0x0999;
  26864. t.ngadeva = 0x0919;
  26865. t.ngagujarati = 0x0a99;
  26866. t.ngagurmukhi = 0x0a19;
  26867. t.ngonguthai = 0x0e07;
  26868. t.nhiragana = 0x3093;
  26869. t.nhookleft = 0x0272;
  26870. t.nhookretroflex = 0x0273;
  26871. t.nieunacirclekorean = 0x326f;
  26872. t.nieunaparenkorean = 0x320f;
  26873. t.nieuncieuckorean = 0x3135;
  26874. t.nieuncirclekorean = 0x3261;
  26875. t.nieunhieuhkorean = 0x3136;
  26876. t.nieunkorean = 0x3134;
  26877. t.nieunpansioskorean = 0x3168;
  26878. t.nieunparenkorean = 0x3201;
  26879. t.nieunsioskorean = 0x3167;
  26880. t.nieuntikeutkorean = 0x3166;
  26881. t.nihiragana = 0x306b;
  26882. t.nikatakana = 0x30cb;
  26883. t.nikatakanahalfwidth = 0xff86;
  26884. t.nikhahitleftthai = 0xf899;
  26885. t.nikhahitthai = 0x0e4d;
  26886. t.nine = 0x0039;
  26887. t.ninearabic = 0x0669;
  26888. t.ninebengali = 0x09ef;
  26889. t.ninecircle = 0x2468;
  26890. t.ninecircleinversesansserif = 0x2792;
  26891. t.ninedeva = 0x096f;
  26892. t.ninegujarati = 0x0aef;
  26893. t.ninegurmukhi = 0x0a6f;
  26894. t.ninehackarabic = 0x0669;
  26895. t.ninehangzhou = 0x3029;
  26896. t.nineideographicparen = 0x3228;
  26897. t.nineinferior = 0x2089;
  26898. t.ninemonospace = 0xff19;
  26899. t.nineoldstyle = 0xf739;
  26900. t.nineparen = 0x247c;
  26901. t.nineperiod = 0x2490;
  26902. t.ninepersian = 0x06f9;
  26903. t.nineroman = 0x2178;
  26904. t.ninesuperior = 0x2079;
  26905. t.nineteencircle = 0x2472;
  26906. t.nineteenparen = 0x2486;
  26907. t.nineteenperiod = 0x249a;
  26908. t.ninethai = 0x0e59;
  26909. t.nj = 0x01cc;
  26910. t.njecyrillic = 0x045a;
  26911. t.nkatakana = 0x30f3;
  26912. t.nkatakanahalfwidth = 0xff9d;
  26913. t.nlegrightlong = 0x019e;
  26914. t.nlinebelow = 0x1e49;
  26915. t.nmonospace = 0xff4e;
  26916. t.nmsquare = 0x339a;
  26917. t.nnabengali = 0x09a3;
  26918. t.nnadeva = 0x0923;
  26919. t.nnagujarati = 0x0aa3;
  26920. t.nnagurmukhi = 0x0a23;
  26921. t.nnnadeva = 0x0929;
  26922. t.nohiragana = 0x306e;
  26923. t.nokatakana = 0x30ce;
  26924. t.nokatakanahalfwidth = 0xff89;
  26925. t.nonbreakingspace = 0x00a0;
  26926. t.nonenthai = 0x0e13;
  26927. t.nonuthai = 0x0e19;
  26928. t.noonarabic = 0x0646;
  26929. t.noonfinalarabic = 0xfee6;
  26930. t.noonghunnaarabic = 0x06ba;
  26931. t.noonghunnafinalarabic = 0xfb9f;
  26932. t.nooninitialarabic = 0xfee7;
  26933. t.noonjeeminitialarabic = 0xfcd2;
  26934. t.noonjeemisolatedarabic = 0xfc4b;
  26935. t.noonmedialarabic = 0xfee8;
  26936. t.noonmeeminitialarabic = 0xfcd5;
  26937. t.noonmeemisolatedarabic = 0xfc4e;
  26938. t.noonnoonfinalarabic = 0xfc8d;
  26939. t.notcontains = 0x220c;
  26940. t.notelement = 0x2209;
  26941. t.notelementof = 0x2209;
  26942. t.notequal = 0x2260;
  26943. t.notgreater = 0x226f;
  26944. t.notgreaternorequal = 0x2271;
  26945. t.notgreaternorless = 0x2279;
  26946. t.notidentical = 0x2262;
  26947. t.notless = 0x226e;
  26948. t.notlessnorequal = 0x2270;
  26949. t.notparallel = 0x2226;
  26950. t.notprecedes = 0x2280;
  26951. t.notsubset = 0x2284;
  26952. t.notsucceeds = 0x2281;
  26953. t.notsuperset = 0x2285;
  26954. t.nowarmenian = 0x0576;
  26955. t.nparen = 0x24a9;
  26956. t.nssquare = 0x33b1;
  26957. t.nsuperior = 0x207f;
  26958. t.ntilde = 0x00f1;
  26959. t.nu = 0x03bd;
  26960. t.nuhiragana = 0x306c;
  26961. t.nukatakana = 0x30cc;
  26962. t.nukatakanahalfwidth = 0xff87;
  26963. t.nuktabengali = 0x09bc;
  26964. t.nuktadeva = 0x093c;
  26965. t.nuktagujarati = 0x0abc;
  26966. t.nuktagurmukhi = 0x0a3c;
  26967. t.numbersign = 0x0023;
  26968. t.numbersignmonospace = 0xff03;
  26969. t.numbersignsmall = 0xfe5f;
  26970. t.numeralsigngreek = 0x0374;
  26971. t.numeralsignlowergreek = 0x0375;
  26972. t.numero = 0x2116;
  26973. t.nun = 0x05e0;
  26974. t.nundagesh = 0xfb40;
  26975. t.nundageshhebrew = 0xfb40;
  26976. t.nunhebrew = 0x05e0;
  26977. t.nvsquare = 0x33b5;
  26978. t.nwsquare = 0x33bb;
  26979. t.nyabengali = 0x099e;
  26980. t.nyadeva = 0x091e;
  26981. t.nyagujarati = 0x0a9e;
  26982. t.nyagurmukhi = 0x0a1e;
  26983. t.o = 0x006f;
  26984. t.oacute = 0x00f3;
  26985. t.oangthai = 0x0e2d;
  26986. t.obarred = 0x0275;
  26987. t.obarredcyrillic = 0x04e9;
  26988. t.obarreddieresiscyrillic = 0x04eb;
  26989. t.obengali = 0x0993;
  26990. t.obopomofo = 0x311b;
  26991. t.obreve = 0x014f;
  26992. t.ocandradeva = 0x0911;
  26993. t.ocandragujarati = 0x0a91;
  26994. t.ocandravowelsigndeva = 0x0949;
  26995. t.ocandravowelsigngujarati = 0x0ac9;
  26996. t.ocaron = 0x01d2;
  26997. t.ocircle = 0x24de;
  26998. t.ocircumflex = 0x00f4;
  26999. t.ocircumflexacute = 0x1ed1;
  27000. t.ocircumflexdotbelow = 0x1ed9;
  27001. t.ocircumflexgrave = 0x1ed3;
  27002. t.ocircumflexhookabove = 0x1ed5;
  27003. t.ocircumflextilde = 0x1ed7;
  27004. t.ocyrillic = 0x043e;
  27005. t.odblacute = 0x0151;
  27006. t.odblgrave = 0x020d;
  27007. t.odeva = 0x0913;
  27008. t.odieresis = 0x00f6;
  27009. t.odieresiscyrillic = 0x04e7;
  27010. t.odotbelow = 0x1ecd;
  27011. t.oe = 0x0153;
  27012. t.oekorean = 0x315a;
  27013. t.ogonek = 0x02db;
  27014. t.ogonekcmb = 0x0328;
  27015. t.ograve = 0x00f2;
  27016. t.ogujarati = 0x0a93;
  27017. t.oharmenian = 0x0585;
  27018. t.ohiragana = 0x304a;
  27019. t.ohookabove = 0x1ecf;
  27020. t.ohorn = 0x01a1;
  27021. t.ohornacute = 0x1edb;
  27022. t.ohorndotbelow = 0x1ee3;
  27023. t.ohorngrave = 0x1edd;
  27024. t.ohornhookabove = 0x1edf;
  27025. t.ohorntilde = 0x1ee1;
  27026. t.ohungarumlaut = 0x0151;
  27027. t.oi = 0x01a3;
  27028. t.oinvertedbreve = 0x020f;
  27029. t.okatakana = 0x30aa;
  27030. t.okatakanahalfwidth = 0xff75;
  27031. t.okorean = 0x3157;
  27032. t.olehebrew = 0x05ab;
  27033. t.omacron = 0x014d;
  27034. t.omacronacute = 0x1e53;
  27035. t.omacrongrave = 0x1e51;
  27036. t.omdeva = 0x0950;
  27037. t.omega = 0x03c9;
  27038. t.omega1 = 0x03d6;
  27039. t.omegacyrillic = 0x0461;
  27040. t.omegalatinclosed = 0x0277;
  27041. t.omegaroundcyrillic = 0x047b;
  27042. t.omegatitlocyrillic = 0x047d;
  27043. t.omegatonos = 0x03ce;
  27044. t.omgujarati = 0x0ad0;
  27045. t.omicron = 0x03bf;
  27046. t.omicrontonos = 0x03cc;
  27047. t.omonospace = 0xff4f;
  27048. t.one = 0x0031;
  27049. t.onearabic = 0x0661;
  27050. t.onebengali = 0x09e7;
  27051. t.onecircle = 0x2460;
  27052. t.onecircleinversesansserif = 0x278a;
  27053. t.onedeva = 0x0967;
  27054. t.onedotenleader = 0x2024;
  27055. t.oneeighth = 0x215b;
  27056. t.onefitted = 0xf6dc;
  27057. t.onegujarati = 0x0ae7;
  27058. t.onegurmukhi = 0x0a67;
  27059. t.onehackarabic = 0x0661;
  27060. t.onehalf = 0x00bd;
  27061. t.onehangzhou = 0x3021;
  27062. t.oneideographicparen = 0x3220;
  27063. t.oneinferior = 0x2081;
  27064. t.onemonospace = 0xff11;
  27065. t.onenumeratorbengali = 0x09f4;
  27066. t.oneoldstyle = 0xf731;
  27067. t.oneparen = 0x2474;
  27068. t.oneperiod = 0x2488;
  27069. t.onepersian = 0x06f1;
  27070. t.onequarter = 0x00bc;
  27071. t.oneroman = 0x2170;
  27072. t.onesuperior = 0x00b9;
  27073. t.onethai = 0x0e51;
  27074. t.onethird = 0x2153;
  27075. t.oogonek = 0x01eb;
  27076. t.oogonekmacron = 0x01ed;
  27077. t.oogurmukhi = 0x0a13;
  27078. t.oomatragurmukhi = 0x0a4b;
  27079. t.oopen = 0x0254;
  27080. t.oparen = 0x24aa;
  27081. t.openbullet = 0x25e6;
  27082. t.option = 0x2325;
  27083. t.ordfeminine = 0x00aa;
  27084. t.ordmasculine = 0x00ba;
  27085. t.orthogonal = 0x221f;
  27086. t.oshortdeva = 0x0912;
  27087. t.oshortvowelsigndeva = 0x094a;
  27088. t.oslash = 0x00f8;
  27089. t.oslashacute = 0x01ff;
  27090. t.osmallhiragana = 0x3049;
  27091. t.osmallkatakana = 0x30a9;
  27092. t.osmallkatakanahalfwidth = 0xff6b;
  27093. t.ostrokeacute = 0x01ff;
  27094. t.osuperior = 0xf6f0;
  27095. t.otcyrillic = 0x047f;
  27096. t.otilde = 0x00f5;
  27097. t.otildeacute = 0x1e4d;
  27098. t.otildedieresis = 0x1e4f;
  27099. t.oubopomofo = 0x3121;
  27100. t.overline = 0x203e;
  27101. t.overlinecenterline = 0xfe4a;
  27102. t.overlinecmb = 0x0305;
  27103. t.overlinedashed = 0xfe49;
  27104. t.overlinedblwavy = 0xfe4c;
  27105. t.overlinewavy = 0xfe4b;
  27106. t.overscore = 0x00af;
  27107. t.ovowelsignbengali = 0x09cb;
  27108. t.ovowelsigndeva = 0x094b;
  27109. t.ovowelsigngujarati = 0x0acb;
  27110. t.p = 0x0070;
  27111. t.paampssquare = 0x3380;
  27112. t.paasentosquare = 0x332b;
  27113. t.pabengali = 0x09aa;
  27114. t.pacute = 0x1e55;
  27115. t.padeva = 0x092a;
  27116. t.pagedown = 0x21df;
  27117. t.pageup = 0x21de;
  27118. t.pagujarati = 0x0aaa;
  27119. t.pagurmukhi = 0x0a2a;
  27120. t.pahiragana = 0x3071;
  27121. t.paiyannoithai = 0x0e2f;
  27122. t.pakatakana = 0x30d1;
  27123. t.palatalizationcyrilliccmb = 0x0484;
  27124. t.palochkacyrillic = 0x04c0;
  27125. t.pansioskorean = 0x317f;
  27126. t.paragraph = 0x00b6;
  27127. t.parallel = 0x2225;
  27128. t.parenleft = 0x0028;
  27129. t.parenleftaltonearabic = 0xfd3e;
  27130. t.parenleftbt = 0xf8ed;
  27131. t.parenleftex = 0xf8ec;
  27132. t.parenleftinferior = 0x208d;
  27133. t.parenleftmonospace = 0xff08;
  27134. t.parenleftsmall = 0xfe59;
  27135. t.parenleftsuperior = 0x207d;
  27136. t.parenlefttp = 0xf8eb;
  27137. t.parenleftvertical = 0xfe35;
  27138. t.parenright = 0x0029;
  27139. t.parenrightaltonearabic = 0xfd3f;
  27140. t.parenrightbt = 0xf8f8;
  27141. t.parenrightex = 0xf8f7;
  27142. t.parenrightinferior = 0x208e;
  27143. t.parenrightmonospace = 0xff09;
  27144. t.parenrightsmall = 0xfe5a;
  27145. t.parenrightsuperior = 0x207e;
  27146. t.parenrighttp = 0xf8f6;
  27147. t.parenrightvertical = 0xfe36;
  27148. t.partialdiff = 0x2202;
  27149. t.paseqhebrew = 0x05c0;
  27150. t.pashtahebrew = 0x0599;
  27151. t.pasquare = 0x33a9;
  27152. t.patah = 0x05b7;
  27153. t.patah11 = 0x05b7;
  27154. t.patah1d = 0x05b7;
  27155. t.patah2a = 0x05b7;
  27156. t.patahhebrew = 0x05b7;
  27157. t.patahnarrowhebrew = 0x05b7;
  27158. t.patahquarterhebrew = 0x05b7;
  27159. t.patahwidehebrew = 0x05b7;
  27160. t.pazerhebrew = 0x05a1;
  27161. t.pbopomofo = 0x3106;
  27162. t.pcircle = 0x24df;
  27163. t.pdotaccent = 0x1e57;
  27164. t.pe = 0x05e4;
  27165. t.pecyrillic = 0x043f;
  27166. t.pedagesh = 0xfb44;
  27167. t.pedageshhebrew = 0xfb44;
  27168. t.peezisquare = 0x333b;
  27169. t.pefinaldageshhebrew = 0xfb43;
  27170. t.peharabic = 0x067e;
  27171. t.peharmenian = 0x057a;
  27172. t.pehebrew = 0x05e4;
  27173. t.pehfinalarabic = 0xfb57;
  27174. t.pehinitialarabic = 0xfb58;
  27175. t.pehiragana = 0x307a;
  27176. t.pehmedialarabic = 0xfb59;
  27177. t.pekatakana = 0x30da;
  27178. t.pemiddlehookcyrillic = 0x04a7;
  27179. t.perafehebrew = 0xfb4e;
  27180. t.percent = 0x0025;
  27181. t.percentarabic = 0x066a;
  27182. t.percentmonospace = 0xff05;
  27183. t.percentsmall = 0xfe6a;
  27184. t.period = 0x002e;
  27185. t.periodarmenian = 0x0589;
  27186. t.periodcentered = 0x00b7;
  27187. t.periodhalfwidth = 0xff61;
  27188. t.periodinferior = 0xf6e7;
  27189. t.periodmonospace = 0xff0e;
  27190. t.periodsmall = 0xfe52;
  27191. t.periodsuperior = 0xf6e8;
  27192. t.perispomenigreekcmb = 0x0342;
  27193. t.perpendicular = 0x22a5;
  27194. t.perthousand = 0x2030;
  27195. t.peseta = 0x20a7;
  27196. t.pfsquare = 0x338a;
  27197. t.phabengali = 0x09ab;
  27198. t.phadeva = 0x092b;
  27199. t.phagujarati = 0x0aab;
  27200. t.phagurmukhi = 0x0a2b;
  27201. t.phi = 0x03c6;
  27202. t.phi1 = 0x03d5;
  27203. t.phieuphacirclekorean = 0x327a;
  27204. t.phieuphaparenkorean = 0x321a;
  27205. t.phieuphcirclekorean = 0x326c;
  27206. t.phieuphkorean = 0x314d;
  27207. t.phieuphparenkorean = 0x320c;
  27208. t.philatin = 0x0278;
  27209. t.phinthuthai = 0x0e3a;
  27210. t.phisymbolgreek = 0x03d5;
  27211. t.phook = 0x01a5;
  27212. t.phophanthai = 0x0e1e;
  27213. t.phophungthai = 0x0e1c;
  27214. t.phosamphaothai = 0x0e20;
  27215. t.pi = 0x03c0;
  27216. t.pieupacirclekorean = 0x3273;
  27217. t.pieupaparenkorean = 0x3213;
  27218. t.pieupcieuckorean = 0x3176;
  27219. t.pieupcirclekorean = 0x3265;
  27220. t.pieupkiyeokkorean = 0x3172;
  27221. t.pieupkorean = 0x3142;
  27222. t.pieupparenkorean = 0x3205;
  27223. t.pieupsioskiyeokkorean = 0x3174;
  27224. t.pieupsioskorean = 0x3144;
  27225. t.pieupsiostikeutkorean = 0x3175;
  27226. t.pieupthieuthkorean = 0x3177;
  27227. t.pieuptikeutkorean = 0x3173;
  27228. t.pihiragana = 0x3074;
  27229. t.pikatakana = 0x30d4;
  27230. t.pisymbolgreek = 0x03d6;
  27231. t.piwrarmenian = 0x0583;
  27232. t.plus = 0x002b;
  27233. t.plusbelowcmb = 0x031f;
  27234. t.pluscircle = 0x2295;
  27235. t.plusminus = 0x00b1;
  27236. t.plusmod = 0x02d6;
  27237. t.plusmonospace = 0xff0b;
  27238. t.plussmall = 0xfe62;
  27239. t.plussuperior = 0x207a;
  27240. t.pmonospace = 0xff50;
  27241. t.pmsquare = 0x33d8;
  27242. t.pohiragana = 0x307d;
  27243. t.pointingindexdownwhite = 0x261f;
  27244. t.pointingindexleftwhite = 0x261c;
  27245. t.pointingindexrightwhite = 0x261e;
  27246. t.pointingindexupwhite = 0x261d;
  27247. t.pokatakana = 0x30dd;
  27248. t.poplathai = 0x0e1b;
  27249. t.postalmark = 0x3012;
  27250. t.postalmarkface = 0x3020;
  27251. t.pparen = 0x24ab;
  27252. t.precedes = 0x227a;
  27253. t.prescription = 0x211e;
  27254. t.primemod = 0x02b9;
  27255. t.primereversed = 0x2035;
  27256. t.product = 0x220f;
  27257. t.projective = 0x2305;
  27258. t.prolongedkana = 0x30fc;
  27259. t.propellor = 0x2318;
  27260. t.propersubset = 0x2282;
  27261. t.propersuperset = 0x2283;
  27262. t.proportion = 0x2237;
  27263. t.proportional = 0x221d;
  27264. t.psi = 0x03c8;
  27265. t.psicyrillic = 0x0471;
  27266. t.psilipneumatacyrilliccmb = 0x0486;
  27267. t.pssquare = 0x33b0;
  27268. t.puhiragana = 0x3077;
  27269. t.pukatakana = 0x30d7;
  27270. t.pvsquare = 0x33b4;
  27271. t.pwsquare = 0x33ba;
  27272. t.q = 0x0071;
  27273. t.qadeva = 0x0958;
  27274. t.qadmahebrew = 0x05a8;
  27275. t.qafarabic = 0x0642;
  27276. t.qaffinalarabic = 0xfed6;
  27277. t.qafinitialarabic = 0xfed7;
  27278. t.qafmedialarabic = 0xfed8;
  27279. t.qamats = 0x05b8;
  27280. t.qamats10 = 0x05b8;
  27281. t.qamats1a = 0x05b8;
  27282. t.qamats1c = 0x05b8;
  27283. t.qamats27 = 0x05b8;
  27284. t.qamats29 = 0x05b8;
  27285. t.qamats33 = 0x05b8;
  27286. t.qamatsde = 0x05b8;
  27287. t.qamatshebrew = 0x05b8;
  27288. t.qamatsnarrowhebrew = 0x05b8;
  27289. t.qamatsqatanhebrew = 0x05b8;
  27290. t.qamatsqatannarrowhebrew = 0x05b8;
  27291. t.qamatsqatanquarterhebrew = 0x05b8;
  27292. t.qamatsqatanwidehebrew = 0x05b8;
  27293. t.qamatsquarterhebrew = 0x05b8;
  27294. t.qamatswidehebrew = 0x05b8;
  27295. t.qarneyparahebrew = 0x059f;
  27296. t.qbopomofo = 0x3111;
  27297. t.qcircle = 0x24e0;
  27298. t.qhook = 0x02a0;
  27299. t.qmonospace = 0xff51;
  27300. t.qof = 0x05e7;
  27301. t.qofdagesh = 0xfb47;
  27302. t.qofdageshhebrew = 0xfb47;
  27303. t.qofhebrew = 0x05e7;
  27304. t.qparen = 0x24ac;
  27305. t.quarternote = 0x2669;
  27306. t.qubuts = 0x05bb;
  27307. t.qubuts18 = 0x05bb;
  27308. t.qubuts25 = 0x05bb;
  27309. t.qubuts31 = 0x05bb;
  27310. t.qubutshebrew = 0x05bb;
  27311. t.qubutsnarrowhebrew = 0x05bb;
  27312. t.qubutsquarterhebrew = 0x05bb;
  27313. t.qubutswidehebrew = 0x05bb;
  27314. t.question = 0x003f;
  27315. t.questionarabic = 0x061f;
  27316. t.questionarmenian = 0x055e;
  27317. t.questiondown = 0x00bf;
  27318. t.questiondownsmall = 0xf7bf;
  27319. t.questiongreek = 0x037e;
  27320. t.questionmonospace = 0xff1f;
  27321. t.questionsmall = 0xf73f;
  27322. t.quotedbl = 0x0022;
  27323. t.quotedblbase = 0x201e;
  27324. t.quotedblleft = 0x201c;
  27325. t.quotedblmonospace = 0xff02;
  27326. t.quotedblprime = 0x301e;
  27327. t.quotedblprimereversed = 0x301d;
  27328. t.quotedblright = 0x201d;
  27329. t.quoteleft = 0x2018;
  27330. t.quoteleftreversed = 0x201b;
  27331. t.quotereversed = 0x201b;
  27332. t.quoteright = 0x2019;
  27333. t.quoterightn = 0x0149;
  27334. t.quotesinglbase = 0x201a;
  27335. t.quotesingle = 0x0027;
  27336. t.quotesinglemonospace = 0xff07;
  27337. t.r = 0x0072;
  27338. t.raarmenian = 0x057c;
  27339. t.rabengali = 0x09b0;
  27340. t.racute = 0x0155;
  27341. t.radeva = 0x0930;
  27342. t.radical = 0x221a;
  27343. t.radicalex = 0xf8e5;
  27344. t.radoverssquare = 0x33ae;
  27345. t.radoverssquaredsquare = 0x33af;
  27346. t.radsquare = 0x33ad;
  27347. t.rafe = 0x05bf;
  27348. t.rafehebrew = 0x05bf;
  27349. t.ragujarati = 0x0ab0;
  27350. t.ragurmukhi = 0x0a30;
  27351. t.rahiragana = 0x3089;
  27352. t.rakatakana = 0x30e9;
  27353. t.rakatakanahalfwidth = 0xff97;
  27354. t.ralowerdiagonalbengali = 0x09f1;
  27355. t.ramiddlediagonalbengali = 0x09f0;
  27356. t.ramshorn = 0x0264;
  27357. t.ratio = 0x2236;
  27358. t.rbopomofo = 0x3116;
  27359. t.rcaron = 0x0159;
  27360. t.rcedilla = 0x0157;
  27361. t.rcircle = 0x24e1;
  27362. t.rcommaaccent = 0x0157;
  27363. t.rdblgrave = 0x0211;
  27364. t.rdotaccent = 0x1e59;
  27365. t.rdotbelow = 0x1e5b;
  27366. t.rdotbelowmacron = 0x1e5d;
  27367. t.referencemark = 0x203b;
  27368. t.reflexsubset = 0x2286;
  27369. t.reflexsuperset = 0x2287;
  27370. t.registered = 0x00ae;
  27371. t.registersans = 0xf8e8;
  27372. t.registerserif = 0xf6da;
  27373. t.reharabic = 0x0631;
  27374. t.reharmenian = 0x0580;
  27375. t.rehfinalarabic = 0xfeae;
  27376. t.rehiragana = 0x308c;
  27377. t.rekatakana = 0x30ec;
  27378. t.rekatakanahalfwidth = 0xff9a;
  27379. t.resh = 0x05e8;
  27380. t.reshdageshhebrew = 0xfb48;
  27381. t.reshhebrew = 0x05e8;
  27382. t.reversedtilde = 0x223d;
  27383. t.reviahebrew = 0x0597;
  27384. t.reviamugrashhebrew = 0x0597;
  27385. t.revlogicalnot = 0x2310;
  27386. t.rfishhook = 0x027e;
  27387. t.rfishhookreversed = 0x027f;
  27388. t.rhabengali = 0x09dd;
  27389. t.rhadeva = 0x095d;
  27390. t.rho = 0x03c1;
  27391. t.rhook = 0x027d;
  27392. t.rhookturned = 0x027b;
  27393. t.rhookturnedsuperior = 0x02b5;
  27394. t.rhosymbolgreek = 0x03f1;
  27395. t.rhotichookmod = 0x02de;
  27396. t.rieulacirclekorean = 0x3271;
  27397. t.rieulaparenkorean = 0x3211;
  27398. t.rieulcirclekorean = 0x3263;
  27399. t.rieulhieuhkorean = 0x3140;
  27400. t.rieulkiyeokkorean = 0x313a;
  27401. t.rieulkiyeoksioskorean = 0x3169;
  27402. t.rieulkorean = 0x3139;
  27403. t.rieulmieumkorean = 0x313b;
  27404. t.rieulpansioskorean = 0x316c;
  27405. t.rieulparenkorean = 0x3203;
  27406. t.rieulphieuphkorean = 0x313f;
  27407. t.rieulpieupkorean = 0x313c;
  27408. t.rieulpieupsioskorean = 0x316b;
  27409. t.rieulsioskorean = 0x313d;
  27410. t.rieulthieuthkorean = 0x313e;
  27411. t.rieultikeutkorean = 0x316a;
  27412. t.rieulyeorinhieuhkorean = 0x316d;
  27413. t.rightangle = 0x221f;
  27414. t.righttackbelowcmb = 0x0319;
  27415. t.righttriangle = 0x22bf;
  27416. t.rihiragana = 0x308a;
  27417. t.rikatakana = 0x30ea;
  27418. t.rikatakanahalfwidth = 0xff98;
  27419. t.ring = 0x02da;
  27420. t.ringbelowcmb = 0x0325;
  27421. t.ringcmb = 0x030a;
  27422. t.ringhalfleft = 0x02bf;
  27423. t.ringhalfleftarmenian = 0x0559;
  27424. t.ringhalfleftbelowcmb = 0x031c;
  27425. t.ringhalfleftcentered = 0x02d3;
  27426. t.ringhalfright = 0x02be;
  27427. t.ringhalfrightbelowcmb = 0x0339;
  27428. t.ringhalfrightcentered = 0x02d2;
  27429. t.rinvertedbreve = 0x0213;
  27430. t.rittorusquare = 0x3351;
  27431. t.rlinebelow = 0x1e5f;
  27432. t.rlongleg = 0x027c;
  27433. t.rlonglegturned = 0x027a;
  27434. t.rmonospace = 0xff52;
  27435. t.rohiragana = 0x308d;
  27436. t.rokatakana = 0x30ed;
  27437. t.rokatakanahalfwidth = 0xff9b;
  27438. t.roruathai = 0x0e23;
  27439. t.rparen = 0x24ad;
  27440. t.rrabengali = 0x09dc;
  27441. t.rradeva = 0x0931;
  27442. t.rragurmukhi = 0x0a5c;
  27443. t.rreharabic = 0x0691;
  27444. t.rrehfinalarabic = 0xfb8d;
  27445. t.rrvocalicbengali = 0x09e0;
  27446. t.rrvocalicdeva = 0x0960;
  27447. t.rrvocalicgujarati = 0x0ae0;
  27448. t.rrvocalicvowelsignbengali = 0x09c4;
  27449. t.rrvocalicvowelsigndeva = 0x0944;
  27450. t.rrvocalicvowelsigngujarati = 0x0ac4;
  27451. t.rsuperior = 0xf6f1;
  27452. t.rtblock = 0x2590;
  27453. t.rturned = 0x0279;
  27454. t.rturnedsuperior = 0x02b4;
  27455. t.ruhiragana = 0x308b;
  27456. t.rukatakana = 0x30eb;
  27457. t.rukatakanahalfwidth = 0xff99;
  27458. t.rupeemarkbengali = 0x09f2;
  27459. t.rupeesignbengali = 0x09f3;
  27460. t.rupiah = 0xf6dd;
  27461. t.ruthai = 0x0e24;
  27462. t.rvocalicbengali = 0x098b;
  27463. t.rvocalicdeva = 0x090b;
  27464. t.rvocalicgujarati = 0x0a8b;
  27465. t.rvocalicvowelsignbengali = 0x09c3;
  27466. t.rvocalicvowelsigndeva = 0x0943;
  27467. t.rvocalicvowelsigngujarati = 0x0ac3;
  27468. t.s = 0x0073;
  27469. t.sabengali = 0x09b8;
  27470. t.sacute = 0x015b;
  27471. t.sacutedotaccent = 0x1e65;
  27472. t.sadarabic = 0x0635;
  27473. t.sadeva = 0x0938;
  27474. t.sadfinalarabic = 0xfeba;
  27475. t.sadinitialarabic = 0xfebb;
  27476. t.sadmedialarabic = 0xfebc;
  27477. t.sagujarati = 0x0ab8;
  27478. t.sagurmukhi = 0x0a38;
  27479. t.sahiragana = 0x3055;
  27480. t.sakatakana = 0x30b5;
  27481. t.sakatakanahalfwidth = 0xff7b;
  27482. t.sallallahoualayhewasallamarabic = 0xfdfa;
  27483. t.samekh = 0x05e1;
  27484. t.samekhdagesh = 0xfb41;
  27485. t.samekhdageshhebrew = 0xfb41;
  27486. t.samekhhebrew = 0x05e1;
  27487. t.saraaathai = 0x0e32;
  27488. t.saraaethai = 0x0e41;
  27489. t.saraaimaimalaithai = 0x0e44;
  27490. t.saraaimaimuanthai = 0x0e43;
  27491. t.saraamthai = 0x0e33;
  27492. t.saraathai = 0x0e30;
  27493. t.saraethai = 0x0e40;
  27494. t.saraiileftthai = 0xf886;
  27495. t.saraiithai = 0x0e35;
  27496. t.saraileftthai = 0xf885;
  27497. t.saraithai = 0x0e34;
  27498. t.saraothai = 0x0e42;
  27499. t.saraueeleftthai = 0xf888;
  27500. t.saraueethai = 0x0e37;
  27501. t.saraueleftthai = 0xf887;
  27502. t.sarauethai = 0x0e36;
  27503. t.sarauthai = 0x0e38;
  27504. t.sarauuthai = 0x0e39;
  27505. t.sbopomofo = 0x3119;
  27506. t.scaron = 0x0161;
  27507. t.scarondotaccent = 0x1e67;
  27508. t.scedilla = 0x015f;
  27509. t.schwa = 0x0259;
  27510. t.schwacyrillic = 0x04d9;
  27511. t.schwadieresiscyrillic = 0x04db;
  27512. t.schwahook = 0x025a;
  27513. t.scircle = 0x24e2;
  27514. t.scircumflex = 0x015d;
  27515. t.scommaaccent = 0x0219;
  27516. t.sdotaccent = 0x1e61;
  27517. t.sdotbelow = 0x1e63;
  27518. t.sdotbelowdotaccent = 0x1e69;
  27519. t.seagullbelowcmb = 0x033c;
  27520. t.second = 0x2033;
  27521. t.secondtonechinese = 0x02ca;
  27522. t.section = 0x00a7;
  27523. t.seenarabic = 0x0633;
  27524. t.seenfinalarabic = 0xfeb2;
  27525. t.seeninitialarabic = 0xfeb3;
  27526. t.seenmedialarabic = 0xfeb4;
  27527. t.segol = 0x05b6;
  27528. t.segol13 = 0x05b6;
  27529. t.segol1f = 0x05b6;
  27530. t.segol2c = 0x05b6;
  27531. t.segolhebrew = 0x05b6;
  27532. t.segolnarrowhebrew = 0x05b6;
  27533. t.segolquarterhebrew = 0x05b6;
  27534. t.segoltahebrew = 0x0592;
  27535. t.segolwidehebrew = 0x05b6;
  27536. t.seharmenian = 0x057d;
  27537. t.sehiragana = 0x305b;
  27538. t.sekatakana = 0x30bb;
  27539. t.sekatakanahalfwidth = 0xff7e;
  27540. t.semicolon = 0x003b;
  27541. t.semicolonarabic = 0x061b;
  27542. t.semicolonmonospace = 0xff1b;
  27543. t.semicolonsmall = 0xfe54;
  27544. t.semivoicedmarkkana = 0x309c;
  27545. t.semivoicedmarkkanahalfwidth = 0xff9f;
  27546. t.sentisquare = 0x3322;
  27547. t.sentosquare = 0x3323;
  27548. t.seven = 0x0037;
  27549. t.sevenarabic = 0x0667;
  27550. t.sevenbengali = 0x09ed;
  27551. t.sevencircle = 0x2466;
  27552. t.sevencircleinversesansserif = 0x2790;
  27553. t.sevendeva = 0x096d;
  27554. t.seveneighths = 0x215e;
  27555. t.sevengujarati = 0x0aed;
  27556. t.sevengurmukhi = 0x0a6d;
  27557. t.sevenhackarabic = 0x0667;
  27558. t.sevenhangzhou = 0x3027;
  27559. t.sevenideographicparen = 0x3226;
  27560. t.seveninferior = 0x2087;
  27561. t.sevenmonospace = 0xff17;
  27562. t.sevenoldstyle = 0xf737;
  27563. t.sevenparen = 0x247a;
  27564. t.sevenperiod = 0x248e;
  27565. t.sevenpersian = 0x06f7;
  27566. t.sevenroman = 0x2176;
  27567. t.sevensuperior = 0x2077;
  27568. t.seventeencircle = 0x2470;
  27569. t.seventeenparen = 0x2484;
  27570. t.seventeenperiod = 0x2498;
  27571. t.seventhai = 0x0e57;
  27572. t.sfthyphen = 0x00ad;
  27573. t.shaarmenian = 0x0577;
  27574. t.shabengali = 0x09b6;
  27575. t.shacyrillic = 0x0448;
  27576. t.shaddaarabic = 0x0651;
  27577. t.shaddadammaarabic = 0xfc61;
  27578. t.shaddadammatanarabic = 0xfc5e;
  27579. t.shaddafathaarabic = 0xfc60;
  27580. t.shaddakasraarabic = 0xfc62;
  27581. t.shaddakasratanarabic = 0xfc5f;
  27582. t.shade = 0x2592;
  27583. t.shadedark = 0x2593;
  27584. t.shadelight = 0x2591;
  27585. t.shademedium = 0x2592;
  27586. t.shadeva = 0x0936;
  27587. t.shagujarati = 0x0ab6;
  27588. t.shagurmukhi = 0x0a36;
  27589. t.shalshelethebrew = 0x0593;
  27590. t.shbopomofo = 0x3115;
  27591. t.shchacyrillic = 0x0449;
  27592. t.sheenarabic = 0x0634;
  27593. t.sheenfinalarabic = 0xfeb6;
  27594. t.sheeninitialarabic = 0xfeb7;
  27595. t.sheenmedialarabic = 0xfeb8;
  27596. t.sheicoptic = 0x03e3;
  27597. t.sheqel = 0x20aa;
  27598. t.sheqelhebrew = 0x20aa;
  27599. t.sheva = 0x05b0;
  27600. t.sheva115 = 0x05b0;
  27601. t.sheva15 = 0x05b0;
  27602. t.sheva22 = 0x05b0;
  27603. t.sheva2e = 0x05b0;
  27604. t.shevahebrew = 0x05b0;
  27605. t.shevanarrowhebrew = 0x05b0;
  27606. t.shevaquarterhebrew = 0x05b0;
  27607. t.shevawidehebrew = 0x05b0;
  27608. t.shhacyrillic = 0x04bb;
  27609. t.shimacoptic = 0x03ed;
  27610. t.shin = 0x05e9;
  27611. t.shindagesh = 0xfb49;
  27612. t.shindageshhebrew = 0xfb49;
  27613. t.shindageshshindot = 0xfb2c;
  27614. t.shindageshshindothebrew = 0xfb2c;
  27615. t.shindageshsindot = 0xfb2d;
  27616. t.shindageshsindothebrew = 0xfb2d;
  27617. t.shindothebrew = 0x05c1;
  27618. t.shinhebrew = 0x05e9;
  27619. t.shinshindot = 0xfb2a;
  27620. t.shinshindothebrew = 0xfb2a;
  27621. t.shinsindot = 0xfb2b;
  27622. t.shinsindothebrew = 0xfb2b;
  27623. t.shook = 0x0282;
  27624. t.sigma = 0x03c3;
  27625. t.sigma1 = 0x03c2;
  27626. t.sigmafinal = 0x03c2;
  27627. t.sigmalunatesymbolgreek = 0x03f2;
  27628. t.sihiragana = 0x3057;
  27629. t.sikatakana = 0x30b7;
  27630. t.sikatakanahalfwidth = 0xff7c;
  27631. t.siluqhebrew = 0x05bd;
  27632. t.siluqlefthebrew = 0x05bd;
  27633. t.similar = 0x223c;
  27634. t.sindothebrew = 0x05c2;
  27635. t.siosacirclekorean = 0x3274;
  27636. t.siosaparenkorean = 0x3214;
  27637. t.sioscieuckorean = 0x317e;
  27638. t.sioscirclekorean = 0x3266;
  27639. t.sioskiyeokkorean = 0x317a;
  27640. t.sioskorean = 0x3145;
  27641. t.siosnieunkorean = 0x317b;
  27642. t.siosparenkorean = 0x3206;
  27643. t.siospieupkorean = 0x317d;
  27644. t.siostikeutkorean = 0x317c;
  27645. t.six = 0x0036;
  27646. t.sixarabic = 0x0666;
  27647. t.sixbengali = 0x09ec;
  27648. t.sixcircle = 0x2465;
  27649. t.sixcircleinversesansserif = 0x278f;
  27650. t.sixdeva = 0x096c;
  27651. t.sixgujarati = 0x0aec;
  27652. t.sixgurmukhi = 0x0a6c;
  27653. t.sixhackarabic = 0x0666;
  27654. t.sixhangzhou = 0x3026;
  27655. t.sixideographicparen = 0x3225;
  27656. t.sixinferior = 0x2086;
  27657. t.sixmonospace = 0xff16;
  27658. t.sixoldstyle = 0xf736;
  27659. t.sixparen = 0x2479;
  27660. t.sixperiod = 0x248d;
  27661. t.sixpersian = 0x06f6;
  27662. t.sixroman = 0x2175;
  27663. t.sixsuperior = 0x2076;
  27664. t.sixteencircle = 0x246f;
  27665. t.sixteencurrencydenominatorbengali = 0x09f9;
  27666. t.sixteenparen = 0x2483;
  27667. t.sixteenperiod = 0x2497;
  27668. t.sixthai = 0x0e56;
  27669. t.slash = 0x002f;
  27670. t.slashmonospace = 0xff0f;
  27671. t.slong = 0x017f;
  27672. t.slongdotaccent = 0x1e9b;
  27673. t.smileface = 0x263a;
  27674. t.smonospace = 0xff53;
  27675. t.sofpasuqhebrew = 0x05c3;
  27676. t.softhyphen = 0x00ad;
  27677. t.softsigncyrillic = 0x044c;
  27678. t.sohiragana = 0x305d;
  27679. t.sokatakana = 0x30bd;
  27680. t.sokatakanahalfwidth = 0xff7f;
  27681. t.soliduslongoverlaycmb = 0x0338;
  27682. t.solidusshortoverlaycmb = 0x0337;
  27683. t.sorusithai = 0x0e29;
  27684. t.sosalathai = 0x0e28;
  27685. t.sosothai = 0x0e0b;
  27686. t.sosuathai = 0x0e2a;
  27687. t.space = 0x0020;
  27688. t.spacehackarabic = 0x0020;
  27689. t.spade = 0x2660;
  27690. t.spadesuitblack = 0x2660;
  27691. t.spadesuitwhite = 0x2664;
  27692. t.sparen = 0x24ae;
  27693. t.squarebelowcmb = 0x033b;
  27694. t.squarecc = 0x33c4;
  27695. t.squarecm = 0x339d;
  27696. t.squarediagonalcrosshatchfill = 0x25a9;
  27697. t.squarehorizontalfill = 0x25a4;
  27698. t.squarekg = 0x338f;
  27699. t.squarekm = 0x339e;
  27700. t.squarekmcapital = 0x33ce;
  27701. t.squareln = 0x33d1;
  27702. t.squarelog = 0x33d2;
  27703. t.squaremg = 0x338e;
  27704. t.squaremil = 0x33d5;
  27705. t.squaremm = 0x339c;
  27706. t.squaremsquared = 0x33a1;
  27707. t.squareorthogonalcrosshatchfill = 0x25a6;
  27708. t.squareupperlefttolowerrightfill = 0x25a7;
  27709. t.squareupperrighttolowerleftfill = 0x25a8;
  27710. t.squareverticalfill = 0x25a5;
  27711. t.squarewhitewithsmallblack = 0x25a3;
  27712. t.srsquare = 0x33db;
  27713. t.ssabengali = 0x09b7;
  27714. t.ssadeva = 0x0937;
  27715. t.ssagujarati = 0x0ab7;
  27716. t.ssangcieuckorean = 0x3149;
  27717. t.ssanghieuhkorean = 0x3185;
  27718. t.ssangieungkorean = 0x3180;
  27719. t.ssangkiyeokkorean = 0x3132;
  27720. t.ssangnieunkorean = 0x3165;
  27721. t.ssangpieupkorean = 0x3143;
  27722. t.ssangsioskorean = 0x3146;
  27723. t.ssangtikeutkorean = 0x3138;
  27724. t.ssuperior = 0xf6f2;
  27725. t.sterling = 0x00a3;
  27726. t.sterlingmonospace = 0xffe1;
  27727. t.strokelongoverlaycmb = 0x0336;
  27728. t.strokeshortoverlaycmb = 0x0335;
  27729. t.subset = 0x2282;
  27730. t.subsetnotequal = 0x228a;
  27731. t.subsetorequal = 0x2286;
  27732. t.succeeds = 0x227b;
  27733. t.suchthat = 0x220b;
  27734. t.suhiragana = 0x3059;
  27735. t.sukatakana = 0x30b9;
  27736. t.sukatakanahalfwidth = 0xff7d;
  27737. t.sukunarabic = 0x0652;
  27738. t.summation = 0x2211;
  27739. t.sun = 0x263c;
  27740. t.superset = 0x2283;
  27741. t.supersetnotequal = 0x228b;
  27742. t.supersetorequal = 0x2287;
  27743. t.svsquare = 0x33dc;
  27744. t.syouwaerasquare = 0x337c;
  27745. t.t = 0x0074;
  27746. t.tabengali = 0x09a4;
  27747. t.tackdown = 0x22a4;
  27748. t.tackleft = 0x22a3;
  27749. t.tadeva = 0x0924;
  27750. t.tagujarati = 0x0aa4;
  27751. t.tagurmukhi = 0x0a24;
  27752. t.taharabic = 0x0637;
  27753. t.tahfinalarabic = 0xfec2;
  27754. t.tahinitialarabic = 0xfec3;
  27755. t.tahiragana = 0x305f;
  27756. t.tahmedialarabic = 0xfec4;
  27757. t.taisyouerasquare = 0x337d;
  27758. t.takatakana = 0x30bf;
  27759. t.takatakanahalfwidth = 0xff80;
  27760. t.tatweelarabic = 0x0640;
  27761. t.tau = 0x03c4;
  27762. t.tav = 0x05ea;
  27763. t.tavdages = 0xfb4a;
  27764. t.tavdagesh = 0xfb4a;
  27765. t.tavdageshhebrew = 0xfb4a;
  27766. t.tavhebrew = 0x05ea;
  27767. t.tbar = 0x0167;
  27768. t.tbopomofo = 0x310a;
  27769. t.tcaron = 0x0165;
  27770. t.tccurl = 0x02a8;
  27771. t.tcedilla = 0x0163;
  27772. t.tcheharabic = 0x0686;
  27773. t.tchehfinalarabic = 0xfb7b;
  27774. t.tchehinitialarabic = 0xfb7c;
  27775. t.tchehmedialarabic = 0xfb7d;
  27776. t.tcircle = 0x24e3;
  27777. t.tcircumflexbelow = 0x1e71;
  27778. t.tcommaaccent = 0x0163;
  27779. t.tdieresis = 0x1e97;
  27780. t.tdotaccent = 0x1e6b;
  27781. t.tdotbelow = 0x1e6d;
  27782. t.tecyrillic = 0x0442;
  27783. t.tedescendercyrillic = 0x04ad;
  27784. t.teharabic = 0x062a;
  27785. t.tehfinalarabic = 0xfe96;
  27786. t.tehhahinitialarabic = 0xfca2;
  27787. t.tehhahisolatedarabic = 0xfc0c;
  27788. t.tehinitialarabic = 0xfe97;
  27789. t.tehiragana = 0x3066;
  27790. t.tehjeeminitialarabic = 0xfca1;
  27791. t.tehjeemisolatedarabic = 0xfc0b;
  27792. t.tehmarbutaarabic = 0x0629;
  27793. t.tehmarbutafinalarabic = 0xfe94;
  27794. t.tehmedialarabic = 0xfe98;
  27795. t.tehmeeminitialarabic = 0xfca4;
  27796. t.tehmeemisolatedarabic = 0xfc0e;
  27797. t.tehnoonfinalarabic = 0xfc73;
  27798. t.tekatakana = 0x30c6;
  27799. t.tekatakanahalfwidth = 0xff83;
  27800. t.telephone = 0x2121;
  27801. t.telephoneblack = 0x260e;
  27802. t.telishagedolahebrew = 0x05a0;
  27803. t.telishaqetanahebrew = 0x05a9;
  27804. t.tencircle = 0x2469;
  27805. t.tenideographicparen = 0x3229;
  27806. t.tenparen = 0x247d;
  27807. t.tenperiod = 0x2491;
  27808. t.tenroman = 0x2179;
  27809. t.tesh = 0x02a7;
  27810. t.tet = 0x05d8;
  27811. t.tetdagesh = 0xfb38;
  27812. t.tetdageshhebrew = 0xfb38;
  27813. t.tethebrew = 0x05d8;
  27814. t.tetsecyrillic = 0x04b5;
  27815. t.tevirhebrew = 0x059b;
  27816. t.tevirlefthebrew = 0x059b;
  27817. t.thabengali = 0x09a5;
  27818. t.thadeva = 0x0925;
  27819. t.thagujarati = 0x0aa5;
  27820. t.thagurmukhi = 0x0a25;
  27821. t.thalarabic = 0x0630;
  27822. t.thalfinalarabic = 0xfeac;
  27823. t.thanthakhatlowleftthai = 0xf898;
  27824. t.thanthakhatlowrightthai = 0xf897;
  27825. t.thanthakhatthai = 0x0e4c;
  27826. t.thanthakhatupperleftthai = 0xf896;
  27827. t.theharabic = 0x062b;
  27828. t.thehfinalarabic = 0xfe9a;
  27829. t.thehinitialarabic = 0xfe9b;
  27830. t.thehmedialarabic = 0xfe9c;
  27831. t.thereexists = 0x2203;
  27832. t.therefore = 0x2234;
  27833. t.theta = 0x03b8;
  27834. t.theta1 = 0x03d1;
  27835. t.thetasymbolgreek = 0x03d1;
  27836. t.thieuthacirclekorean = 0x3279;
  27837. t.thieuthaparenkorean = 0x3219;
  27838. t.thieuthcirclekorean = 0x326b;
  27839. t.thieuthkorean = 0x314c;
  27840. t.thieuthparenkorean = 0x320b;
  27841. t.thirteencircle = 0x246c;
  27842. t.thirteenparen = 0x2480;
  27843. t.thirteenperiod = 0x2494;
  27844. t.thonangmonthothai = 0x0e11;
  27845. t.thook = 0x01ad;
  27846. t.thophuthaothai = 0x0e12;
  27847. t.thorn = 0x00fe;
  27848. t.thothahanthai = 0x0e17;
  27849. t.thothanthai = 0x0e10;
  27850. t.thothongthai = 0x0e18;
  27851. t.thothungthai = 0x0e16;
  27852. t.thousandcyrillic = 0x0482;
  27853. t.thousandsseparatorarabic = 0x066c;
  27854. t.thousandsseparatorpersian = 0x066c;
  27855. t.three = 0x0033;
  27856. t.threearabic = 0x0663;
  27857. t.threebengali = 0x09e9;
  27858. t.threecircle = 0x2462;
  27859. t.threecircleinversesansserif = 0x278c;
  27860. t.threedeva = 0x0969;
  27861. t.threeeighths = 0x215c;
  27862. t.threegujarati = 0x0ae9;
  27863. t.threegurmukhi = 0x0a69;
  27864. t.threehackarabic = 0x0663;
  27865. t.threehangzhou = 0x3023;
  27866. t.threeideographicparen = 0x3222;
  27867. t.threeinferior = 0x2083;
  27868. t.threemonospace = 0xff13;
  27869. t.threenumeratorbengali = 0x09f6;
  27870. t.threeoldstyle = 0xf733;
  27871. t.threeparen = 0x2476;
  27872. t.threeperiod = 0x248a;
  27873. t.threepersian = 0x06f3;
  27874. t.threequarters = 0x00be;
  27875. t.threequartersemdash = 0xf6de;
  27876. t.threeroman = 0x2172;
  27877. t.threesuperior = 0x00b3;
  27878. t.threethai = 0x0e53;
  27879. t.thzsquare = 0x3394;
  27880. t.tihiragana = 0x3061;
  27881. t.tikatakana = 0x30c1;
  27882. t.tikatakanahalfwidth = 0xff81;
  27883. t.tikeutacirclekorean = 0x3270;
  27884. t.tikeutaparenkorean = 0x3210;
  27885. t.tikeutcirclekorean = 0x3262;
  27886. t.tikeutkorean = 0x3137;
  27887. t.tikeutparenkorean = 0x3202;
  27888. t.tilde = 0x02dc;
  27889. t.tildebelowcmb = 0x0330;
  27890. t.tildecmb = 0x0303;
  27891. t.tildecomb = 0x0303;
  27892. t.tildedoublecmb = 0x0360;
  27893. t.tildeoperator = 0x223c;
  27894. t.tildeoverlaycmb = 0x0334;
  27895. t.tildeverticalcmb = 0x033e;
  27896. t.timescircle = 0x2297;
  27897. t.tipehahebrew = 0x0596;
  27898. t.tipehalefthebrew = 0x0596;
  27899. t.tippigurmukhi = 0x0a70;
  27900. t.titlocyrilliccmb = 0x0483;
  27901. t.tiwnarmenian = 0x057f;
  27902. t.tlinebelow = 0x1e6f;
  27903. t.tmonospace = 0xff54;
  27904. t.toarmenian = 0x0569;
  27905. t.tohiragana = 0x3068;
  27906. t.tokatakana = 0x30c8;
  27907. t.tokatakanahalfwidth = 0xff84;
  27908. t.tonebarextrahighmod = 0x02e5;
  27909. t.tonebarextralowmod = 0x02e9;
  27910. t.tonebarhighmod = 0x02e6;
  27911. t.tonebarlowmod = 0x02e8;
  27912. t.tonebarmidmod = 0x02e7;
  27913. t.tonefive = 0x01bd;
  27914. t.tonesix = 0x0185;
  27915. t.tonetwo = 0x01a8;
  27916. t.tonos = 0x0384;
  27917. t.tonsquare = 0x3327;
  27918. t.topatakthai = 0x0e0f;
  27919. t.tortoiseshellbracketleft = 0x3014;
  27920. t.tortoiseshellbracketleftsmall = 0xfe5d;
  27921. t.tortoiseshellbracketleftvertical = 0xfe39;
  27922. t.tortoiseshellbracketright = 0x3015;
  27923. t.tortoiseshellbracketrightsmall = 0xfe5e;
  27924. t.tortoiseshellbracketrightvertical = 0xfe3a;
  27925. t.totaothai = 0x0e15;
  27926. t.tpalatalhook = 0x01ab;
  27927. t.tparen = 0x24af;
  27928. t.trademark = 0x2122;
  27929. t.trademarksans = 0xf8ea;
  27930. t.trademarkserif = 0xf6db;
  27931. t.tretroflexhook = 0x0288;
  27932. t.triagdn = 0x25bc;
  27933. t.triaglf = 0x25c4;
  27934. t.triagrt = 0x25ba;
  27935. t.triagup = 0x25b2;
  27936. t.ts = 0x02a6;
  27937. t.tsadi = 0x05e6;
  27938. t.tsadidagesh = 0xfb46;
  27939. t.tsadidageshhebrew = 0xfb46;
  27940. t.tsadihebrew = 0x05e6;
  27941. t.tsecyrillic = 0x0446;
  27942. t.tsere = 0x05b5;
  27943. t.tsere12 = 0x05b5;
  27944. t.tsere1e = 0x05b5;
  27945. t.tsere2b = 0x05b5;
  27946. t.tserehebrew = 0x05b5;
  27947. t.tserenarrowhebrew = 0x05b5;
  27948. t.tserequarterhebrew = 0x05b5;
  27949. t.tserewidehebrew = 0x05b5;
  27950. t.tshecyrillic = 0x045b;
  27951. t.tsuperior = 0xf6f3;
  27952. t.ttabengali = 0x099f;
  27953. t.ttadeva = 0x091f;
  27954. t.ttagujarati = 0x0a9f;
  27955. t.ttagurmukhi = 0x0a1f;
  27956. t.tteharabic = 0x0679;
  27957. t.ttehfinalarabic = 0xfb67;
  27958. t.ttehinitialarabic = 0xfb68;
  27959. t.ttehmedialarabic = 0xfb69;
  27960. t.tthabengali = 0x09a0;
  27961. t.tthadeva = 0x0920;
  27962. t.tthagujarati = 0x0aa0;
  27963. t.tthagurmukhi = 0x0a20;
  27964. t.tturned = 0x0287;
  27965. t.tuhiragana = 0x3064;
  27966. t.tukatakana = 0x30c4;
  27967. t.tukatakanahalfwidth = 0xff82;
  27968. t.tusmallhiragana = 0x3063;
  27969. t.tusmallkatakana = 0x30c3;
  27970. t.tusmallkatakanahalfwidth = 0xff6f;
  27971. t.twelvecircle = 0x246b;
  27972. t.twelveparen = 0x247f;
  27973. t.twelveperiod = 0x2493;
  27974. t.twelveroman = 0x217b;
  27975. t.twentycircle = 0x2473;
  27976. t.twentyhangzhou = 0x5344;
  27977. t.twentyparen = 0x2487;
  27978. t.twentyperiod = 0x249b;
  27979. t.two = 0x0032;
  27980. t.twoarabic = 0x0662;
  27981. t.twobengali = 0x09e8;
  27982. t.twocircle = 0x2461;
  27983. t.twocircleinversesansserif = 0x278b;
  27984. t.twodeva = 0x0968;
  27985. t.twodotenleader = 0x2025;
  27986. t.twodotleader = 0x2025;
  27987. t.twodotleadervertical = 0xfe30;
  27988. t.twogujarati = 0x0ae8;
  27989. t.twogurmukhi = 0x0a68;
  27990. t.twohackarabic = 0x0662;
  27991. t.twohangzhou = 0x3022;
  27992. t.twoideographicparen = 0x3221;
  27993. t.twoinferior = 0x2082;
  27994. t.twomonospace = 0xff12;
  27995. t.twonumeratorbengali = 0x09f5;
  27996. t.twooldstyle = 0xf732;
  27997. t.twoparen = 0x2475;
  27998. t.twoperiod = 0x2489;
  27999. t.twopersian = 0x06f2;
  28000. t.tworoman = 0x2171;
  28001. t.twostroke = 0x01bb;
  28002. t.twosuperior = 0x00b2;
  28003. t.twothai = 0x0e52;
  28004. t.twothirds = 0x2154;
  28005. t.u = 0x0075;
  28006. t.uacute = 0x00fa;
  28007. t.ubar = 0x0289;
  28008. t.ubengali = 0x0989;
  28009. t.ubopomofo = 0x3128;
  28010. t.ubreve = 0x016d;
  28011. t.ucaron = 0x01d4;
  28012. t.ucircle = 0x24e4;
  28013. t.ucircumflex = 0x00fb;
  28014. t.ucircumflexbelow = 0x1e77;
  28015. t.ucyrillic = 0x0443;
  28016. t.udattadeva = 0x0951;
  28017. t.udblacute = 0x0171;
  28018. t.udblgrave = 0x0215;
  28019. t.udeva = 0x0909;
  28020. t.udieresis = 0x00fc;
  28021. t.udieresisacute = 0x01d8;
  28022. t.udieresisbelow = 0x1e73;
  28023. t.udieresiscaron = 0x01da;
  28024. t.udieresiscyrillic = 0x04f1;
  28025. t.udieresisgrave = 0x01dc;
  28026. t.udieresismacron = 0x01d6;
  28027. t.udotbelow = 0x1ee5;
  28028. t.ugrave = 0x00f9;
  28029. t.ugujarati = 0x0a89;
  28030. t.ugurmukhi = 0x0a09;
  28031. t.uhiragana = 0x3046;
  28032. t.uhookabove = 0x1ee7;
  28033. t.uhorn = 0x01b0;
  28034. t.uhornacute = 0x1ee9;
  28035. t.uhorndotbelow = 0x1ef1;
  28036. t.uhorngrave = 0x1eeb;
  28037. t.uhornhookabove = 0x1eed;
  28038. t.uhorntilde = 0x1eef;
  28039. t.uhungarumlaut = 0x0171;
  28040. t.uhungarumlautcyrillic = 0x04f3;
  28041. t.uinvertedbreve = 0x0217;
  28042. t.ukatakana = 0x30a6;
  28043. t.ukatakanahalfwidth = 0xff73;
  28044. t.ukcyrillic = 0x0479;
  28045. t.ukorean = 0x315c;
  28046. t.umacron = 0x016b;
  28047. t.umacroncyrillic = 0x04ef;
  28048. t.umacrondieresis = 0x1e7b;
  28049. t.umatragurmukhi = 0x0a41;
  28050. t.umonospace = 0xff55;
  28051. t.underscore = 0x005f;
  28052. t.underscoredbl = 0x2017;
  28053. t.underscoremonospace = 0xff3f;
  28054. t.underscorevertical = 0xfe33;
  28055. t.underscorewavy = 0xfe4f;
  28056. t.union = 0x222a;
  28057. t.universal = 0x2200;
  28058. t.uogonek = 0x0173;
  28059. t.uparen = 0x24b0;
  28060. t.upblock = 0x2580;
  28061. t.upperdothebrew = 0x05c4;
  28062. t.upsilon = 0x03c5;
  28063. t.upsilondieresis = 0x03cb;
  28064. t.upsilondieresistonos = 0x03b0;
  28065. t.upsilonlatin = 0x028a;
  28066. t.upsilontonos = 0x03cd;
  28067. t.uptackbelowcmb = 0x031d;
  28068. t.uptackmod = 0x02d4;
  28069. t.uragurmukhi = 0x0a73;
  28070. t.uring = 0x016f;
  28071. t.ushortcyrillic = 0x045e;
  28072. t.usmallhiragana = 0x3045;
  28073. t.usmallkatakana = 0x30a5;
  28074. t.usmallkatakanahalfwidth = 0xff69;
  28075. t.ustraightcyrillic = 0x04af;
  28076. t.ustraightstrokecyrillic = 0x04b1;
  28077. t.utilde = 0x0169;
  28078. t.utildeacute = 0x1e79;
  28079. t.utildebelow = 0x1e75;
  28080. t.uubengali = 0x098a;
  28081. t.uudeva = 0x090a;
  28082. t.uugujarati = 0x0a8a;
  28083. t.uugurmukhi = 0x0a0a;
  28084. t.uumatragurmukhi = 0x0a42;
  28085. t.uuvowelsignbengali = 0x09c2;
  28086. t.uuvowelsigndeva = 0x0942;
  28087. t.uuvowelsigngujarati = 0x0ac2;
  28088. t.uvowelsignbengali = 0x09c1;
  28089. t.uvowelsigndeva = 0x0941;
  28090. t.uvowelsigngujarati = 0x0ac1;
  28091. t.v = 0x0076;
  28092. t.vadeva = 0x0935;
  28093. t.vagujarati = 0x0ab5;
  28094. t.vagurmukhi = 0x0a35;
  28095. t.vakatakana = 0x30f7;
  28096. t.vav = 0x05d5;
  28097. t.vavdagesh = 0xfb35;
  28098. t.vavdagesh65 = 0xfb35;
  28099. t.vavdageshhebrew = 0xfb35;
  28100. t.vavhebrew = 0x05d5;
  28101. t.vavholam = 0xfb4b;
  28102. t.vavholamhebrew = 0xfb4b;
  28103. t.vavvavhebrew = 0x05f0;
  28104. t.vavyodhebrew = 0x05f1;
  28105. t.vcircle = 0x24e5;
  28106. t.vdotbelow = 0x1e7f;
  28107. t.vecyrillic = 0x0432;
  28108. t.veharabic = 0x06a4;
  28109. t.vehfinalarabic = 0xfb6b;
  28110. t.vehinitialarabic = 0xfb6c;
  28111. t.vehmedialarabic = 0xfb6d;
  28112. t.vekatakana = 0x30f9;
  28113. t.venus = 0x2640;
  28114. t.verticalbar = 0x007c;
  28115. t.verticallineabovecmb = 0x030d;
  28116. t.verticallinebelowcmb = 0x0329;
  28117. t.verticallinelowmod = 0x02cc;
  28118. t.verticallinemod = 0x02c8;
  28119. t.vewarmenian = 0x057e;
  28120. t.vhook = 0x028b;
  28121. t.vikatakana = 0x30f8;
  28122. t.viramabengali = 0x09cd;
  28123. t.viramadeva = 0x094d;
  28124. t.viramagujarati = 0x0acd;
  28125. t.visargabengali = 0x0983;
  28126. t.visargadeva = 0x0903;
  28127. t.visargagujarati = 0x0a83;
  28128. t.vmonospace = 0xff56;
  28129. t.voarmenian = 0x0578;
  28130. t.voicediterationhiragana = 0x309e;
  28131. t.voicediterationkatakana = 0x30fe;
  28132. t.voicedmarkkana = 0x309b;
  28133. t.voicedmarkkanahalfwidth = 0xff9e;
  28134. t.vokatakana = 0x30fa;
  28135. t.vparen = 0x24b1;
  28136. t.vtilde = 0x1e7d;
  28137. t.vturned = 0x028c;
  28138. t.vuhiragana = 0x3094;
  28139. t.vukatakana = 0x30f4;
  28140. t.w = 0x0077;
  28141. t.wacute = 0x1e83;
  28142. t.waekorean = 0x3159;
  28143. t.wahiragana = 0x308f;
  28144. t.wakatakana = 0x30ef;
  28145. t.wakatakanahalfwidth = 0xff9c;
  28146. t.wakorean = 0x3158;
  28147. t.wasmallhiragana = 0x308e;
  28148. t.wasmallkatakana = 0x30ee;
  28149. t.wattosquare = 0x3357;
  28150. t.wavedash = 0x301c;
  28151. t.wavyunderscorevertical = 0xfe34;
  28152. t.wawarabic = 0x0648;
  28153. t.wawfinalarabic = 0xfeee;
  28154. t.wawhamzaabovearabic = 0x0624;
  28155. t.wawhamzaabovefinalarabic = 0xfe86;
  28156. t.wbsquare = 0x33dd;
  28157. t.wcircle = 0x24e6;
  28158. t.wcircumflex = 0x0175;
  28159. t.wdieresis = 0x1e85;
  28160. t.wdotaccent = 0x1e87;
  28161. t.wdotbelow = 0x1e89;
  28162. t.wehiragana = 0x3091;
  28163. t.weierstrass = 0x2118;
  28164. t.wekatakana = 0x30f1;
  28165. t.wekorean = 0x315e;
  28166. t.weokorean = 0x315d;
  28167. t.wgrave = 0x1e81;
  28168. t.whitebullet = 0x25e6;
  28169. t.whitecircle = 0x25cb;
  28170. t.whitecircleinverse = 0x25d9;
  28171. t.whitecornerbracketleft = 0x300e;
  28172. t.whitecornerbracketleftvertical = 0xfe43;
  28173. t.whitecornerbracketright = 0x300f;
  28174. t.whitecornerbracketrightvertical = 0xfe44;
  28175. t.whitediamond = 0x25c7;
  28176. t.whitediamondcontainingblacksmalldiamond = 0x25c8;
  28177. t.whitedownpointingsmalltriangle = 0x25bf;
  28178. t.whitedownpointingtriangle = 0x25bd;
  28179. t.whiteleftpointingsmalltriangle = 0x25c3;
  28180. t.whiteleftpointingtriangle = 0x25c1;
  28181. t.whitelenticularbracketleft = 0x3016;
  28182. t.whitelenticularbracketright = 0x3017;
  28183. t.whiterightpointingsmalltriangle = 0x25b9;
  28184. t.whiterightpointingtriangle = 0x25b7;
  28185. t.whitesmallsquare = 0x25ab;
  28186. t.whitesmilingface = 0x263a;
  28187. t.whitesquare = 0x25a1;
  28188. t.whitestar = 0x2606;
  28189. t.whitetelephone = 0x260f;
  28190. t.whitetortoiseshellbracketleft = 0x3018;
  28191. t.whitetortoiseshellbracketright = 0x3019;
  28192. t.whiteuppointingsmalltriangle = 0x25b5;
  28193. t.whiteuppointingtriangle = 0x25b3;
  28194. t.wihiragana = 0x3090;
  28195. t.wikatakana = 0x30f0;
  28196. t.wikorean = 0x315f;
  28197. t.wmonospace = 0xff57;
  28198. t.wohiragana = 0x3092;
  28199. t.wokatakana = 0x30f2;
  28200. t.wokatakanahalfwidth = 0xff66;
  28201. t.won = 0x20a9;
  28202. t.wonmonospace = 0xffe6;
  28203. t.wowaenthai = 0x0e27;
  28204. t.wparen = 0x24b2;
  28205. t.wring = 0x1e98;
  28206. t.wsuperior = 0x02b7;
  28207. t.wturned = 0x028d;
  28208. t.wynn = 0x01bf;
  28209. t.x = 0x0078;
  28210. t.xabovecmb = 0x033d;
  28211. t.xbopomofo = 0x3112;
  28212. t.xcircle = 0x24e7;
  28213. t.xdieresis = 0x1e8d;
  28214. t.xdotaccent = 0x1e8b;
  28215. t.xeharmenian = 0x056d;
  28216. t.xi = 0x03be;
  28217. t.xmonospace = 0xff58;
  28218. t.xparen = 0x24b3;
  28219. t.xsuperior = 0x02e3;
  28220. t.y = 0x0079;
  28221. t.yaadosquare = 0x334e;
  28222. t.yabengali = 0x09af;
  28223. t.yacute = 0x00fd;
  28224. t.yadeva = 0x092f;
  28225. t.yaekorean = 0x3152;
  28226. t.yagujarati = 0x0aaf;
  28227. t.yagurmukhi = 0x0a2f;
  28228. t.yahiragana = 0x3084;
  28229. t.yakatakana = 0x30e4;
  28230. t.yakatakanahalfwidth = 0xff94;
  28231. t.yakorean = 0x3151;
  28232. t.yamakkanthai = 0x0e4e;
  28233. t.yasmallhiragana = 0x3083;
  28234. t.yasmallkatakana = 0x30e3;
  28235. t.yasmallkatakanahalfwidth = 0xff6c;
  28236. t.yatcyrillic = 0x0463;
  28237. t.ycircle = 0x24e8;
  28238. t.ycircumflex = 0x0177;
  28239. t.ydieresis = 0x00ff;
  28240. t.ydotaccent = 0x1e8f;
  28241. t.ydotbelow = 0x1ef5;
  28242. t.yeharabic = 0x064a;
  28243. t.yehbarreearabic = 0x06d2;
  28244. t.yehbarreefinalarabic = 0xfbaf;
  28245. t.yehfinalarabic = 0xfef2;
  28246. t.yehhamzaabovearabic = 0x0626;
  28247. t.yehhamzaabovefinalarabic = 0xfe8a;
  28248. t.yehhamzaaboveinitialarabic = 0xfe8b;
  28249. t.yehhamzaabovemedialarabic = 0xfe8c;
  28250. t.yehinitialarabic = 0xfef3;
  28251. t.yehmedialarabic = 0xfef4;
  28252. t.yehmeeminitialarabic = 0xfcdd;
  28253. t.yehmeemisolatedarabic = 0xfc58;
  28254. t.yehnoonfinalarabic = 0xfc94;
  28255. t.yehthreedotsbelowarabic = 0x06d1;
  28256. t.yekorean = 0x3156;
  28257. t.yen = 0x00a5;
  28258. t.yenmonospace = 0xffe5;
  28259. t.yeokorean = 0x3155;
  28260. t.yeorinhieuhkorean = 0x3186;
  28261. t.yerahbenyomohebrew = 0x05aa;
  28262. t.yerahbenyomolefthebrew = 0x05aa;
  28263. t.yericyrillic = 0x044b;
  28264. t.yerudieresiscyrillic = 0x04f9;
  28265. t.yesieungkorean = 0x3181;
  28266. t.yesieungpansioskorean = 0x3183;
  28267. t.yesieungsioskorean = 0x3182;
  28268. t.yetivhebrew = 0x059a;
  28269. t.ygrave = 0x1ef3;
  28270. t.yhook = 0x01b4;
  28271. t.yhookabove = 0x1ef7;
  28272. t.yiarmenian = 0x0575;
  28273. t.yicyrillic = 0x0457;
  28274. t.yikorean = 0x3162;
  28275. t.yinyang = 0x262f;
  28276. t.yiwnarmenian = 0x0582;
  28277. t.ymonospace = 0xff59;
  28278. t.yod = 0x05d9;
  28279. t.yoddagesh = 0xfb39;
  28280. t.yoddageshhebrew = 0xfb39;
  28281. t.yodhebrew = 0x05d9;
  28282. t.yodyodhebrew = 0x05f2;
  28283. t.yodyodpatahhebrew = 0xfb1f;
  28284. t.yohiragana = 0x3088;
  28285. t.yoikorean = 0x3189;
  28286. t.yokatakana = 0x30e8;
  28287. t.yokatakanahalfwidth = 0xff96;
  28288. t.yokorean = 0x315b;
  28289. t.yosmallhiragana = 0x3087;
  28290. t.yosmallkatakana = 0x30e7;
  28291. t.yosmallkatakanahalfwidth = 0xff6e;
  28292. t.yotgreek = 0x03f3;
  28293. t.yoyaekorean = 0x3188;
  28294. t.yoyakorean = 0x3187;
  28295. t.yoyakthai = 0x0e22;
  28296. t.yoyingthai = 0x0e0d;
  28297. t.yparen = 0x24b4;
  28298. t.ypogegrammeni = 0x037a;
  28299. t.ypogegrammenigreekcmb = 0x0345;
  28300. t.yr = 0x01a6;
  28301. t.yring = 0x1e99;
  28302. t.ysuperior = 0x02b8;
  28303. t.ytilde = 0x1ef9;
  28304. t.yturned = 0x028e;
  28305. t.yuhiragana = 0x3086;
  28306. t.yuikorean = 0x318c;
  28307. t.yukatakana = 0x30e6;
  28308. t.yukatakanahalfwidth = 0xff95;
  28309. t.yukorean = 0x3160;
  28310. t.yusbigcyrillic = 0x046b;
  28311. t.yusbigiotifiedcyrillic = 0x046d;
  28312. t.yuslittlecyrillic = 0x0467;
  28313. t.yuslittleiotifiedcyrillic = 0x0469;
  28314. t.yusmallhiragana = 0x3085;
  28315. t.yusmallkatakana = 0x30e5;
  28316. t.yusmallkatakanahalfwidth = 0xff6d;
  28317. t.yuyekorean = 0x318b;
  28318. t.yuyeokorean = 0x318a;
  28319. t.yyabengali = 0x09df;
  28320. t.yyadeva = 0x095f;
  28321. t.z = 0x007a;
  28322. t.zaarmenian = 0x0566;
  28323. t.zacute = 0x017a;
  28324. t.zadeva = 0x095b;
  28325. t.zagurmukhi = 0x0a5b;
  28326. t.zaharabic = 0x0638;
  28327. t.zahfinalarabic = 0xfec6;
  28328. t.zahinitialarabic = 0xfec7;
  28329. t.zahiragana = 0x3056;
  28330. t.zahmedialarabic = 0xfec8;
  28331. t.zainarabic = 0x0632;
  28332. t.zainfinalarabic = 0xfeb0;
  28333. t.zakatakana = 0x30b6;
  28334. t.zaqefgadolhebrew = 0x0595;
  28335. t.zaqefqatanhebrew = 0x0594;
  28336. t.zarqahebrew = 0x0598;
  28337. t.zayin = 0x05d6;
  28338. t.zayindagesh = 0xfb36;
  28339. t.zayindageshhebrew = 0xfb36;
  28340. t.zayinhebrew = 0x05d6;
  28341. t.zbopomofo = 0x3117;
  28342. t.zcaron = 0x017e;
  28343. t.zcircle = 0x24e9;
  28344. t.zcircumflex = 0x1e91;
  28345. t.zcurl = 0x0291;
  28346. t.zdot = 0x017c;
  28347. t.zdotaccent = 0x017c;
  28348. t.zdotbelow = 0x1e93;
  28349. t.zecyrillic = 0x0437;
  28350. t.zedescendercyrillic = 0x0499;
  28351. t.zedieresiscyrillic = 0x04df;
  28352. t.zehiragana = 0x305c;
  28353. t.zekatakana = 0x30bc;
  28354. t.zero = 0x0030;
  28355. t.zeroarabic = 0x0660;
  28356. t.zerobengali = 0x09e6;
  28357. t.zerodeva = 0x0966;
  28358. t.zerogujarati = 0x0ae6;
  28359. t.zerogurmukhi = 0x0a66;
  28360. t.zerohackarabic = 0x0660;
  28361. t.zeroinferior = 0x2080;
  28362. t.zeromonospace = 0xff10;
  28363. t.zerooldstyle = 0xf730;
  28364. t.zeropersian = 0x06f0;
  28365. t.zerosuperior = 0x2070;
  28366. t.zerothai = 0x0e50;
  28367. t.zerowidthjoiner = 0xfeff;
  28368. t.zerowidthnonjoiner = 0x200c;
  28369. t.zerowidthspace = 0x200b;
  28370. t.zeta = 0x03b6;
  28371. t.zhbopomofo = 0x3113;
  28372. t.zhearmenian = 0x056a;
  28373. t.zhebrevecyrillic = 0x04c2;
  28374. t.zhecyrillic = 0x0436;
  28375. t.zhedescendercyrillic = 0x0497;
  28376. t.zhedieresiscyrillic = 0x04dd;
  28377. t.zihiragana = 0x3058;
  28378. t.zikatakana = 0x30b8;
  28379. t.zinorhebrew = 0x05ae;
  28380. t.zlinebelow = 0x1e95;
  28381. t.zmonospace = 0xff5a;
  28382. t.zohiragana = 0x305e;
  28383. t.zokatakana = 0x30be;
  28384. t.zparen = 0x24b5;
  28385. t.zretroflexhook = 0x0290;
  28386. t.zstroke = 0x01b6;
  28387. t.zuhiragana = 0x305a;
  28388. t.zukatakana = 0x30ba;
  28389. t[".notdef"] = 0x0000;
  28390. t.angbracketleftbig = 0x2329;
  28391. t.angbracketleftBig = 0x2329;
  28392. t.angbracketleftbigg = 0x2329;
  28393. t.angbracketleftBigg = 0x2329;
  28394. t.angbracketrightBig = 0x232a;
  28395. t.angbracketrightbig = 0x232a;
  28396. t.angbracketrightBigg = 0x232a;
  28397. t.angbracketrightbigg = 0x232a;
  28398. t.arrowhookleft = 0x21aa;
  28399. t.arrowhookright = 0x21a9;
  28400. t.arrowlefttophalf = 0x21bc;
  28401. t.arrowleftbothalf = 0x21bd;
  28402. t.arrownortheast = 0x2197;
  28403. t.arrownorthwest = 0x2196;
  28404. t.arrowrighttophalf = 0x21c0;
  28405. t.arrowrightbothalf = 0x21c1;
  28406. t.arrowsoutheast = 0x2198;
  28407. t.arrowsouthwest = 0x2199;
  28408. t.backslashbig = 0x2216;
  28409. t.backslashBig = 0x2216;
  28410. t.backslashBigg = 0x2216;
  28411. t.backslashbigg = 0x2216;
  28412. t.bardbl = 0x2016;
  28413. t.bracehtipdownleft = 0xfe37;
  28414. t.bracehtipdownright = 0xfe37;
  28415. t.bracehtipupleft = 0xfe38;
  28416. t.bracehtipupright = 0xfe38;
  28417. t.braceleftBig = 0x007b;
  28418. t.braceleftbig = 0x007b;
  28419. t.braceleftbigg = 0x007b;
  28420. t.braceleftBigg = 0x007b;
  28421. t.bracerightBig = 0x007d;
  28422. t.bracerightbig = 0x007d;
  28423. t.bracerightbigg = 0x007d;
  28424. t.bracerightBigg = 0x007d;
  28425. t.bracketleftbig = 0x005b;
  28426. t.bracketleftBig = 0x005b;
  28427. t.bracketleftbigg = 0x005b;
  28428. t.bracketleftBigg = 0x005b;
  28429. t.bracketrightBig = 0x005d;
  28430. t.bracketrightbig = 0x005d;
  28431. t.bracketrightbigg = 0x005d;
  28432. t.bracketrightBigg = 0x005d;
  28433. t.ceilingleftbig = 0x2308;
  28434. t.ceilingleftBig = 0x2308;
  28435. t.ceilingleftBigg = 0x2308;
  28436. t.ceilingleftbigg = 0x2308;
  28437. t.ceilingrightbig = 0x2309;
  28438. t.ceilingrightBig = 0x2309;
  28439. t.ceilingrightbigg = 0x2309;
  28440. t.ceilingrightBigg = 0x2309;
  28441. t.circledotdisplay = 0x2299;
  28442. t.circledottext = 0x2299;
  28443. t.circlemultiplydisplay = 0x2297;
  28444. t.circlemultiplytext = 0x2297;
  28445. t.circleplusdisplay = 0x2295;
  28446. t.circleplustext = 0x2295;
  28447. t.contintegraldisplay = 0x222e;
  28448. t.contintegraltext = 0x222e;
  28449. t.coproductdisplay = 0x2210;
  28450. t.coproducttext = 0x2210;
  28451. t.floorleftBig = 0x230a;
  28452. t.floorleftbig = 0x230a;
  28453. t.floorleftbigg = 0x230a;
  28454. t.floorleftBigg = 0x230a;
  28455. t.floorrightbig = 0x230b;
  28456. t.floorrightBig = 0x230b;
  28457. t.floorrightBigg = 0x230b;
  28458. t.floorrightbigg = 0x230b;
  28459. t.hatwide = 0x0302;
  28460. t.hatwider = 0x0302;
  28461. t.hatwidest = 0x0302;
  28462. t.intercal = 0x1d40;
  28463. t.integraldisplay = 0x222b;
  28464. t.integraltext = 0x222b;
  28465. t.intersectiondisplay = 0x22c2;
  28466. t.intersectiontext = 0x22c2;
  28467. t.logicalanddisplay = 0x2227;
  28468. t.logicalandtext = 0x2227;
  28469. t.logicalordisplay = 0x2228;
  28470. t.logicalortext = 0x2228;
  28471. t.parenleftBig = 0x0028;
  28472. t.parenleftbig = 0x0028;
  28473. t.parenleftBigg = 0x0028;
  28474. t.parenleftbigg = 0x0028;
  28475. t.parenrightBig = 0x0029;
  28476. t.parenrightbig = 0x0029;
  28477. t.parenrightBigg = 0x0029;
  28478. t.parenrightbigg = 0x0029;
  28479. t.prime = 0x2032;
  28480. t.productdisplay = 0x220f;
  28481. t.producttext = 0x220f;
  28482. t.radicalbig = 0x221a;
  28483. t.radicalBig = 0x221a;
  28484. t.radicalBigg = 0x221a;
  28485. t.radicalbigg = 0x221a;
  28486. t.radicalbt = 0x221a;
  28487. t.radicaltp = 0x221a;
  28488. t.radicalvertex = 0x221a;
  28489. t.slashbig = 0x002f;
  28490. t.slashBig = 0x002f;
  28491. t.slashBigg = 0x002f;
  28492. t.slashbigg = 0x002f;
  28493. t.summationdisplay = 0x2211;
  28494. t.summationtext = 0x2211;
  28495. t.tildewide = 0x02dc;
  28496. t.tildewider = 0x02dc;
  28497. t.tildewidest = 0x02dc;
  28498. t.uniondisplay = 0x22c3;
  28499. t.unionmultidisplay = 0x228e;
  28500. t.unionmultitext = 0x228e;
  28501. t.unionsqdisplay = 0x2294;
  28502. t.unionsqtext = 0x2294;
  28503. t.uniontext = 0x22c3;
  28504. t.vextenddouble = 0x2225;
  28505. t.vextendsingle = 0x2223;
  28506. });
  28507. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  28508. t.space = 0x0020;
  28509. t.a1 = 0x2701;
  28510. t.a2 = 0x2702;
  28511. t.a202 = 0x2703;
  28512. t.a3 = 0x2704;
  28513. t.a4 = 0x260e;
  28514. t.a5 = 0x2706;
  28515. t.a119 = 0x2707;
  28516. t.a118 = 0x2708;
  28517. t.a117 = 0x2709;
  28518. t.a11 = 0x261b;
  28519. t.a12 = 0x261e;
  28520. t.a13 = 0x270c;
  28521. t.a14 = 0x270d;
  28522. t.a15 = 0x270e;
  28523. t.a16 = 0x270f;
  28524. t.a105 = 0x2710;
  28525. t.a17 = 0x2711;
  28526. t.a18 = 0x2712;
  28527. t.a19 = 0x2713;
  28528. t.a20 = 0x2714;
  28529. t.a21 = 0x2715;
  28530. t.a22 = 0x2716;
  28531. t.a23 = 0x2717;
  28532. t.a24 = 0x2718;
  28533. t.a25 = 0x2719;
  28534. t.a26 = 0x271a;
  28535. t.a27 = 0x271b;
  28536. t.a28 = 0x271c;
  28537. t.a6 = 0x271d;
  28538. t.a7 = 0x271e;
  28539. t.a8 = 0x271f;
  28540. t.a9 = 0x2720;
  28541. t.a10 = 0x2721;
  28542. t.a29 = 0x2722;
  28543. t.a30 = 0x2723;
  28544. t.a31 = 0x2724;
  28545. t.a32 = 0x2725;
  28546. t.a33 = 0x2726;
  28547. t.a34 = 0x2727;
  28548. t.a35 = 0x2605;
  28549. t.a36 = 0x2729;
  28550. t.a37 = 0x272a;
  28551. t.a38 = 0x272b;
  28552. t.a39 = 0x272c;
  28553. t.a40 = 0x272d;
  28554. t.a41 = 0x272e;
  28555. t.a42 = 0x272f;
  28556. t.a43 = 0x2730;
  28557. t.a44 = 0x2731;
  28558. t.a45 = 0x2732;
  28559. t.a46 = 0x2733;
  28560. t.a47 = 0x2734;
  28561. t.a48 = 0x2735;
  28562. t.a49 = 0x2736;
  28563. t.a50 = 0x2737;
  28564. t.a51 = 0x2738;
  28565. t.a52 = 0x2739;
  28566. t.a53 = 0x273a;
  28567. t.a54 = 0x273b;
  28568. t.a55 = 0x273c;
  28569. t.a56 = 0x273d;
  28570. t.a57 = 0x273e;
  28571. t.a58 = 0x273f;
  28572. t.a59 = 0x2740;
  28573. t.a60 = 0x2741;
  28574. t.a61 = 0x2742;
  28575. t.a62 = 0x2743;
  28576. t.a63 = 0x2744;
  28577. t.a64 = 0x2745;
  28578. t.a65 = 0x2746;
  28579. t.a66 = 0x2747;
  28580. t.a67 = 0x2748;
  28581. t.a68 = 0x2749;
  28582. t.a69 = 0x274a;
  28583. t.a70 = 0x274b;
  28584. t.a71 = 0x25cf;
  28585. t.a72 = 0x274d;
  28586. t.a73 = 0x25a0;
  28587. t.a74 = 0x274f;
  28588. t.a203 = 0x2750;
  28589. t.a75 = 0x2751;
  28590. t.a204 = 0x2752;
  28591. t.a76 = 0x25b2;
  28592. t.a77 = 0x25bc;
  28593. t.a78 = 0x25c6;
  28594. t.a79 = 0x2756;
  28595. t.a81 = 0x25d7;
  28596. t.a82 = 0x2758;
  28597. t.a83 = 0x2759;
  28598. t.a84 = 0x275a;
  28599. t.a97 = 0x275b;
  28600. t.a98 = 0x275c;
  28601. t.a99 = 0x275d;
  28602. t.a100 = 0x275e;
  28603. t.a101 = 0x2761;
  28604. t.a102 = 0x2762;
  28605. t.a103 = 0x2763;
  28606. t.a104 = 0x2764;
  28607. t.a106 = 0x2765;
  28608. t.a107 = 0x2766;
  28609. t.a108 = 0x2767;
  28610. t.a112 = 0x2663;
  28611. t.a111 = 0x2666;
  28612. t.a110 = 0x2665;
  28613. t.a109 = 0x2660;
  28614. t.a120 = 0x2460;
  28615. t.a121 = 0x2461;
  28616. t.a122 = 0x2462;
  28617. t.a123 = 0x2463;
  28618. t.a124 = 0x2464;
  28619. t.a125 = 0x2465;
  28620. t.a126 = 0x2466;
  28621. t.a127 = 0x2467;
  28622. t.a128 = 0x2468;
  28623. t.a129 = 0x2469;
  28624. t.a130 = 0x2776;
  28625. t.a131 = 0x2777;
  28626. t.a132 = 0x2778;
  28627. t.a133 = 0x2779;
  28628. t.a134 = 0x277a;
  28629. t.a135 = 0x277b;
  28630. t.a136 = 0x277c;
  28631. t.a137 = 0x277d;
  28632. t.a138 = 0x277e;
  28633. t.a139 = 0x277f;
  28634. t.a140 = 0x2780;
  28635. t.a141 = 0x2781;
  28636. t.a142 = 0x2782;
  28637. t.a143 = 0x2783;
  28638. t.a144 = 0x2784;
  28639. t.a145 = 0x2785;
  28640. t.a146 = 0x2786;
  28641. t.a147 = 0x2787;
  28642. t.a148 = 0x2788;
  28643. t.a149 = 0x2789;
  28644. t.a150 = 0x278a;
  28645. t.a151 = 0x278b;
  28646. t.a152 = 0x278c;
  28647. t.a153 = 0x278d;
  28648. t.a154 = 0x278e;
  28649. t.a155 = 0x278f;
  28650. t.a156 = 0x2790;
  28651. t.a157 = 0x2791;
  28652. t.a158 = 0x2792;
  28653. t.a159 = 0x2793;
  28654. t.a160 = 0x2794;
  28655. t.a161 = 0x2192;
  28656. t.a163 = 0x2194;
  28657. t.a164 = 0x2195;
  28658. t.a196 = 0x2798;
  28659. t.a165 = 0x2799;
  28660. t.a192 = 0x279a;
  28661. t.a166 = 0x279b;
  28662. t.a167 = 0x279c;
  28663. t.a168 = 0x279d;
  28664. t.a169 = 0x279e;
  28665. t.a170 = 0x279f;
  28666. t.a171 = 0x27a0;
  28667. t.a172 = 0x27a1;
  28668. t.a173 = 0x27a2;
  28669. t.a162 = 0x27a3;
  28670. t.a174 = 0x27a4;
  28671. t.a175 = 0x27a5;
  28672. t.a176 = 0x27a6;
  28673. t.a177 = 0x27a7;
  28674. t.a178 = 0x27a8;
  28675. t.a179 = 0x27a9;
  28676. t.a193 = 0x27aa;
  28677. t.a180 = 0x27ab;
  28678. t.a199 = 0x27ac;
  28679. t.a181 = 0x27ad;
  28680. t.a200 = 0x27ae;
  28681. t.a182 = 0x27af;
  28682. t.a201 = 0x27b1;
  28683. t.a183 = 0x27b2;
  28684. t.a184 = 0x27b3;
  28685. t.a197 = 0x27b4;
  28686. t.a185 = 0x27b5;
  28687. t.a194 = 0x27b6;
  28688. t.a198 = 0x27b7;
  28689. t.a186 = 0x27b8;
  28690. t.a195 = 0x27b9;
  28691. t.a187 = 0x27ba;
  28692. t.a188 = 0x27bb;
  28693. t.a189 = 0x27bc;
  28694. t.a190 = 0x27bd;
  28695. t.a191 = 0x27be;
  28696. t.a89 = 0x2768;
  28697. t.a90 = 0x2769;
  28698. t.a93 = 0x276a;
  28699. t.a94 = 0x276b;
  28700. t.a91 = 0x276c;
  28701. t.a92 = 0x276d;
  28702. t.a205 = 0x276e;
  28703. t.a85 = 0x276f;
  28704. t.a206 = 0x2770;
  28705. t.a86 = 0x2771;
  28706. t.a87 = 0x2772;
  28707. t.a88 = 0x2773;
  28708. t.a95 = 0x2774;
  28709. t.a96 = 0x2775;
  28710. t[".notdef"] = 0x0000;
  28711. });
  28712. exports.getGlyphsUnicode = getGlyphsUnicode;
  28713. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  28714. /***/ }),
  28715. /* 34 */
  28716. /***/ (function(module, exports, __w_pdfjs_require__) {
  28717. "use strict";
  28718. Object.defineProperty(exports, "__esModule", {
  28719. value: true
  28720. });
  28721. exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0;
  28722. var _core_utils = __w_pdfjs_require__(8);
  28723. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  28724. t.ArialNarrow = "Helvetica";
  28725. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  28726. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  28727. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  28728. t.ArialBlack = "Helvetica";
  28729. t["ArialBlack-Bold"] = "Helvetica-Bold";
  28730. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  28731. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  28732. t["Arial-Black"] = "Helvetica";
  28733. t["Arial-Black-Bold"] = "Helvetica-Bold";
  28734. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  28735. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  28736. t.Arial = "Helvetica";
  28737. t["Arial-Bold"] = "Helvetica-Bold";
  28738. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  28739. t["Arial-Italic"] = "Helvetica-Oblique";
  28740. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  28741. t["Arial-BoldMT"] = "Helvetica-Bold";
  28742. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  28743. t.ArialMT = "Helvetica";
  28744. t["Courier-Bold"] = "Courier-Bold";
  28745. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  28746. t["Courier-Italic"] = "Courier-Oblique";
  28747. t.CourierNew = "Courier";
  28748. t["CourierNew-Bold"] = "Courier-Bold";
  28749. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  28750. t["CourierNew-Italic"] = "Courier-Oblique";
  28751. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  28752. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  28753. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  28754. t.CourierNewPSMT = "Courier";
  28755. t.Helvetica = "Helvetica";
  28756. t["Helvetica-Bold"] = "Helvetica-Bold";
  28757. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  28758. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  28759. t["Helvetica-Italic"] = "Helvetica-Oblique";
  28760. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  28761. t["Symbol-Bold"] = "Symbol";
  28762. t["Symbol-BoldItalic"] = "Symbol";
  28763. t["Symbol-Italic"] = "Symbol";
  28764. t.TimesNewRoman = "Times-Roman";
  28765. t["TimesNewRoman-Bold"] = "Times-Bold";
  28766. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  28767. t["TimesNewRoman-Italic"] = "Times-Italic";
  28768. t.TimesNewRomanPS = "Times-Roman";
  28769. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  28770. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  28771. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  28772. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  28773. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  28774. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  28775. t.TimesNewRomanPSMT = "Times-Roman";
  28776. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  28777. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  28778. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  28779. });
  28780. exports.getStdFontMap = getStdFontMap;
  28781. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  28782. t.Calibri = "Helvetica";
  28783. t["Calibri-Bold"] = "Helvetica-Bold";
  28784. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  28785. t["Calibri-Italic"] = "Helvetica-Oblique";
  28786. t.CenturyGothic = "Helvetica";
  28787. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  28788. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  28789. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  28790. t.ComicSansMS = "Comic Sans MS";
  28791. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  28792. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  28793. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  28794. t.LucidaConsole = "Courier";
  28795. t["LucidaConsole-Bold"] = "Courier-Bold";
  28796. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  28797. t["LucidaConsole-Italic"] = "Courier-Oblique";
  28798. t["LucidaSans-Demi"] = "Helvetica-Bold";
  28799. t["MS-Gothic"] = "MS Gothic";
  28800. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  28801. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  28802. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  28803. t["MS-Mincho"] = "MS Mincho";
  28804. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  28805. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  28806. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  28807. t["MS-PGothic"] = "MS PGothic";
  28808. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  28809. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  28810. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  28811. t["MS-PMincho"] = "MS PMincho";
  28812. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  28813. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  28814. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  28815. t.NuptialScript = "Times-Italic";
  28816. t.SegoeUISymbol = "Helvetica";
  28817. t.Wingdings = "ZapfDingbats";
  28818. t["Wingdings-Regular"] = "ZapfDingbats";
  28819. });
  28820. exports.getNonStdFontMap = getNonStdFontMap;
  28821. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  28822. t["Adobe Jenson"] = true;
  28823. t["Adobe Text"] = true;
  28824. t.Albertus = true;
  28825. t.Aldus = true;
  28826. t.Alexandria = true;
  28827. t.Algerian = true;
  28828. t["American Typewriter"] = true;
  28829. t.Antiqua = true;
  28830. t.Apex = true;
  28831. t.Arno = true;
  28832. t.Aster = true;
  28833. t.Aurora = true;
  28834. t.Baskerville = true;
  28835. t.Bell = true;
  28836. t.Bembo = true;
  28837. t["Bembo Schoolbook"] = true;
  28838. t.Benguiat = true;
  28839. t["Berkeley Old Style"] = true;
  28840. t["Bernhard Modern"] = true;
  28841. t["Berthold City"] = true;
  28842. t.Bodoni = true;
  28843. t["Bauer Bodoni"] = true;
  28844. t["Book Antiqua"] = true;
  28845. t.Bookman = true;
  28846. t["Bordeaux Roman"] = true;
  28847. t["Californian FB"] = true;
  28848. t.Calisto = true;
  28849. t.Calvert = true;
  28850. t.Capitals = true;
  28851. t.Cambria = true;
  28852. t.Cartier = true;
  28853. t.Caslon = true;
  28854. t.Catull = true;
  28855. t.Centaur = true;
  28856. t["Century Old Style"] = true;
  28857. t["Century Schoolbook"] = true;
  28858. t.Chaparral = true;
  28859. t["Charis SIL"] = true;
  28860. t.Cheltenham = true;
  28861. t["Cholla Slab"] = true;
  28862. t.Clarendon = true;
  28863. t.Clearface = true;
  28864. t.Cochin = true;
  28865. t.Colonna = true;
  28866. t["Computer Modern"] = true;
  28867. t["Concrete Roman"] = true;
  28868. t.Constantia = true;
  28869. t["Cooper Black"] = true;
  28870. t.Corona = true;
  28871. t.Ecotype = true;
  28872. t.Egyptienne = true;
  28873. t.Elephant = true;
  28874. t.Excelsior = true;
  28875. t.Fairfield = true;
  28876. t["FF Scala"] = true;
  28877. t.Folkard = true;
  28878. t.Footlight = true;
  28879. t.FreeSerif = true;
  28880. t["Friz Quadrata"] = true;
  28881. t.Garamond = true;
  28882. t.Gentium = true;
  28883. t.Georgia = true;
  28884. t.Gloucester = true;
  28885. t["Goudy Old Style"] = true;
  28886. t["Goudy Schoolbook"] = true;
  28887. t["Goudy Pro Font"] = true;
  28888. t.Granjon = true;
  28889. t["Guardian Egyptian"] = true;
  28890. t.Heather = true;
  28891. t.Hercules = true;
  28892. t["High Tower Text"] = true;
  28893. t.Hiroshige = true;
  28894. t["Hoefler Text"] = true;
  28895. t["Humana Serif"] = true;
  28896. t.Imprint = true;
  28897. t["Ionic No. 5"] = true;
  28898. t.Janson = true;
  28899. t.Joanna = true;
  28900. t.Korinna = true;
  28901. t.Lexicon = true;
  28902. t["Liberation Serif"] = true;
  28903. t["Linux Libertine"] = true;
  28904. t.Literaturnaya = true;
  28905. t.Lucida = true;
  28906. t["Lucida Bright"] = true;
  28907. t.Melior = true;
  28908. t.Memphis = true;
  28909. t.Miller = true;
  28910. t.Minion = true;
  28911. t.Modern = true;
  28912. t["Mona Lisa"] = true;
  28913. t["Mrs Eaves"] = true;
  28914. t["MS Serif"] = true;
  28915. t["Museo Slab"] = true;
  28916. t["New York"] = true;
  28917. t["Nimbus Roman"] = true;
  28918. t["NPS Rawlinson Roadway"] = true;
  28919. t.NuptialScript = true;
  28920. t.Palatino = true;
  28921. t.Perpetua = true;
  28922. t.Plantin = true;
  28923. t["Plantin Schoolbook"] = true;
  28924. t.Playbill = true;
  28925. t["Poor Richard"] = true;
  28926. t["Rawlinson Roadway"] = true;
  28927. t.Renault = true;
  28928. t.Requiem = true;
  28929. t.Rockwell = true;
  28930. t.Roman = true;
  28931. t["Rotis Serif"] = true;
  28932. t.Sabon = true;
  28933. t.Scala = true;
  28934. t.Seagull = true;
  28935. t.Sistina = true;
  28936. t.Souvenir = true;
  28937. t.STIX = true;
  28938. t["Stone Informal"] = true;
  28939. t["Stone Serif"] = true;
  28940. t.Sylfaen = true;
  28941. t.Times = true;
  28942. t.Trajan = true;
  28943. t["Trinité"] = true;
  28944. t["Trump Mediaeval"] = true;
  28945. t.Utopia = true;
  28946. t["Vale Type"] = true;
  28947. t["Bitstream Vera"] = true;
  28948. t["Vera Serif"] = true;
  28949. t.Versailles = true;
  28950. t.Wanted = true;
  28951. t.Weiss = true;
  28952. t["Wide Latin"] = true;
  28953. t.Windsor = true;
  28954. t.XITS = true;
  28955. });
  28956. exports.getSerifFonts = getSerifFonts;
  28957. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  28958. t.Dingbats = true;
  28959. t.Symbol = true;
  28960. t.ZapfDingbats = true;
  28961. });
  28962. exports.getSymbolsFonts = getSymbolsFonts;
  28963. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  28964. t[2] = 10;
  28965. t[3] = 32;
  28966. t[4] = 33;
  28967. t[5] = 34;
  28968. t[6] = 35;
  28969. t[7] = 36;
  28970. t[8] = 37;
  28971. t[9] = 38;
  28972. t[10] = 39;
  28973. t[11] = 40;
  28974. t[12] = 41;
  28975. t[13] = 42;
  28976. t[14] = 43;
  28977. t[15] = 44;
  28978. t[16] = 45;
  28979. t[17] = 46;
  28980. t[18] = 47;
  28981. t[19] = 48;
  28982. t[20] = 49;
  28983. t[21] = 50;
  28984. t[22] = 51;
  28985. t[23] = 52;
  28986. t[24] = 53;
  28987. t[25] = 54;
  28988. t[26] = 55;
  28989. t[27] = 56;
  28990. t[28] = 57;
  28991. t[29] = 58;
  28992. t[30] = 894;
  28993. t[31] = 60;
  28994. t[32] = 61;
  28995. t[33] = 62;
  28996. t[34] = 63;
  28997. t[35] = 64;
  28998. t[36] = 65;
  28999. t[37] = 66;
  29000. t[38] = 67;
  29001. t[39] = 68;
  29002. t[40] = 69;
  29003. t[41] = 70;
  29004. t[42] = 71;
  29005. t[43] = 72;
  29006. t[44] = 73;
  29007. t[45] = 74;
  29008. t[46] = 75;
  29009. t[47] = 76;
  29010. t[48] = 77;
  29011. t[49] = 78;
  29012. t[50] = 79;
  29013. t[51] = 80;
  29014. t[52] = 81;
  29015. t[53] = 82;
  29016. t[54] = 83;
  29017. t[55] = 84;
  29018. t[56] = 85;
  29019. t[57] = 86;
  29020. t[58] = 87;
  29021. t[59] = 88;
  29022. t[60] = 89;
  29023. t[61] = 90;
  29024. t[62] = 91;
  29025. t[63] = 92;
  29026. t[64] = 93;
  29027. t[65] = 94;
  29028. t[66] = 95;
  29029. t[67] = 96;
  29030. t[68] = 97;
  29031. t[69] = 98;
  29032. t[70] = 99;
  29033. t[71] = 100;
  29034. t[72] = 101;
  29035. t[73] = 102;
  29036. t[74] = 103;
  29037. t[75] = 104;
  29038. t[76] = 105;
  29039. t[77] = 106;
  29040. t[78] = 107;
  29041. t[79] = 108;
  29042. t[80] = 109;
  29043. t[81] = 110;
  29044. t[82] = 111;
  29045. t[83] = 112;
  29046. t[84] = 113;
  29047. t[85] = 114;
  29048. t[86] = 115;
  29049. t[87] = 116;
  29050. t[88] = 117;
  29051. t[89] = 118;
  29052. t[90] = 119;
  29053. t[91] = 120;
  29054. t[92] = 121;
  29055. t[93] = 122;
  29056. t[94] = 123;
  29057. t[95] = 124;
  29058. t[96] = 125;
  29059. t[97] = 126;
  29060. t[98] = 196;
  29061. t[99] = 197;
  29062. t[100] = 199;
  29063. t[101] = 201;
  29064. t[102] = 209;
  29065. t[103] = 214;
  29066. t[104] = 220;
  29067. t[105] = 225;
  29068. t[106] = 224;
  29069. t[107] = 226;
  29070. t[108] = 228;
  29071. t[109] = 227;
  29072. t[110] = 229;
  29073. t[111] = 231;
  29074. t[112] = 233;
  29075. t[113] = 232;
  29076. t[114] = 234;
  29077. t[115] = 235;
  29078. t[116] = 237;
  29079. t[117] = 236;
  29080. t[118] = 238;
  29081. t[119] = 239;
  29082. t[120] = 241;
  29083. t[121] = 243;
  29084. t[122] = 242;
  29085. t[123] = 244;
  29086. t[124] = 246;
  29087. t[125] = 245;
  29088. t[126] = 250;
  29089. t[127] = 249;
  29090. t[128] = 251;
  29091. t[129] = 252;
  29092. t[130] = 8224;
  29093. t[131] = 176;
  29094. t[132] = 162;
  29095. t[133] = 163;
  29096. t[134] = 167;
  29097. t[135] = 8226;
  29098. t[136] = 182;
  29099. t[137] = 223;
  29100. t[138] = 174;
  29101. t[139] = 169;
  29102. t[140] = 8482;
  29103. t[141] = 180;
  29104. t[142] = 168;
  29105. t[143] = 8800;
  29106. t[144] = 198;
  29107. t[145] = 216;
  29108. t[146] = 8734;
  29109. t[147] = 177;
  29110. t[148] = 8804;
  29111. t[149] = 8805;
  29112. t[150] = 165;
  29113. t[151] = 181;
  29114. t[152] = 8706;
  29115. t[153] = 8721;
  29116. t[154] = 8719;
  29117. t[156] = 8747;
  29118. t[157] = 170;
  29119. t[158] = 186;
  29120. t[159] = 8486;
  29121. t[160] = 230;
  29122. t[161] = 248;
  29123. t[162] = 191;
  29124. t[163] = 161;
  29125. t[164] = 172;
  29126. t[165] = 8730;
  29127. t[166] = 402;
  29128. t[167] = 8776;
  29129. t[168] = 8710;
  29130. t[169] = 171;
  29131. t[170] = 187;
  29132. t[171] = 8230;
  29133. t[210] = 218;
  29134. t[223] = 711;
  29135. t[224] = 321;
  29136. t[225] = 322;
  29137. t[227] = 353;
  29138. t[229] = 382;
  29139. t[234] = 253;
  29140. t[252] = 263;
  29141. t[253] = 268;
  29142. t[254] = 269;
  29143. t[258] = 258;
  29144. t[260] = 260;
  29145. t[261] = 261;
  29146. t[265] = 280;
  29147. t[266] = 281;
  29148. t[268] = 283;
  29149. t[269] = 313;
  29150. t[275] = 323;
  29151. t[276] = 324;
  29152. t[278] = 328;
  29153. t[284] = 345;
  29154. t[285] = 346;
  29155. t[286] = 347;
  29156. t[292] = 367;
  29157. t[295] = 377;
  29158. t[296] = 378;
  29159. t[298] = 380;
  29160. t[305] = 963;
  29161. t[306] = 964;
  29162. t[307] = 966;
  29163. t[308] = 8215;
  29164. t[309] = 8252;
  29165. t[310] = 8319;
  29166. t[311] = 8359;
  29167. t[312] = 8592;
  29168. t[313] = 8593;
  29169. t[337] = 9552;
  29170. t[493] = 1039;
  29171. t[494] = 1040;
  29172. t[705] = 1524;
  29173. t[706] = 8362;
  29174. t[710] = 64288;
  29175. t[711] = 64298;
  29176. t[759] = 1617;
  29177. t[761] = 1776;
  29178. t[763] = 1778;
  29179. t[775] = 1652;
  29180. t[777] = 1764;
  29181. t[778] = 1780;
  29182. t[779] = 1781;
  29183. t[780] = 1782;
  29184. t[782] = 771;
  29185. t[783] = 64726;
  29186. t[786] = 8363;
  29187. t[788] = 8532;
  29188. t[790] = 768;
  29189. t[791] = 769;
  29190. t[792] = 768;
  29191. t[795] = 803;
  29192. t[797] = 64336;
  29193. t[798] = 64337;
  29194. t[799] = 64342;
  29195. t[800] = 64343;
  29196. t[801] = 64344;
  29197. t[802] = 64345;
  29198. t[803] = 64362;
  29199. t[804] = 64363;
  29200. t[805] = 64364;
  29201. t[2424] = 7821;
  29202. t[2425] = 7822;
  29203. t[2426] = 7823;
  29204. t[2427] = 7824;
  29205. t[2428] = 7825;
  29206. t[2429] = 7826;
  29207. t[2430] = 7827;
  29208. t[2433] = 7682;
  29209. t[2678] = 8045;
  29210. t[2679] = 8046;
  29211. t[2830] = 1552;
  29212. t[2838] = 686;
  29213. t[2840] = 751;
  29214. t[2842] = 753;
  29215. t[2843] = 754;
  29216. t[2844] = 755;
  29217. t[2846] = 757;
  29218. t[2856] = 767;
  29219. t[2857] = 848;
  29220. t[2858] = 849;
  29221. t[2862] = 853;
  29222. t[2863] = 854;
  29223. t[2864] = 855;
  29224. t[2865] = 861;
  29225. t[2866] = 862;
  29226. t[2906] = 7460;
  29227. t[2908] = 7462;
  29228. t[2909] = 7463;
  29229. t[2910] = 7464;
  29230. t[2912] = 7466;
  29231. t[2913] = 7467;
  29232. t[2914] = 7468;
  29233. t[2916] = 7470;
  29234. t[2917] = 7471;
  29235. t[2918] = 7472;
  29236. t[2920] = 7474;
  29237. t[2921] = 7475;
  29238. t[2922] = 7476;
  29239. t[2924] = 7478;
  29240. t[2925] = 7479;
  29241. t[2926] = 7480;
  29242. t[2928] = 7482;
  29243. t[2929] = 7483;
  29244. t[2930] = 7484;
  29245. t[2932] = 7486;
  29246. t[2933] = 7487;
  29247. t[2934] = 7488;
  29248. t[2936] = 7490;
  29249. t[2937] = 7491;
  29250. t[2938] = 7492;
  29251. t[2940] = 7494;
  29252. t[2941] = 7495;
  29253. t[2942] = 7496;
  29254. t[2944] = 7498;
  29255. t[2946] = 7500;
  29256. t[2948] = 7502;
  29257. t[2950] = 7504;
  29258. t[2951] = 7505;
  29259. t[2952] = 7506;
  29260. t[2954] = 7508;
  29261. t[2955] = 7509;
  29262. t[2956] = 7510;
  29263. t[2958] = 7512;
  29264. t[2959] = 7513;
  29265. t[2960] = 7514;
  29266. t[2962] = 7516;
  29267. t[2963] = 7517;
  29268. t[2964] = 7518;
  29269. t[2966] = 7520;
  29270. t[2967] = 7521;
  29271. t[2968] = 7522;
  29272. t[2970] = 7524;
  29273. t[2971] = 7525;
  29274. t[2972] = 7526;
  29275. t[2974] = 7528;
  29276. t[2975] = 7529;
  29277. t[2976] = 7530;
  29278. t[2978] = 1537;
  29279. t[2979] = 1538;
  29280. t[2980] = 1539;
  29281. t[2982] = 1549;
  29282. t[2983] = 1551;
  29283. t[2984] = 1552;
  29284. t[2986] = 1554;
  29285. t[2987] = 1555;
  29286. t[2988] = 1556;
  29287. t[2990] = 1623;
  29288. t[2991] = 1624;
  29289. t[2995] = 1775;
  29290. t[2999] = 1791;
  29291. t[3002] = 64290;
  29292. t[3003] = 64291;
  29293. t[3004] = 64292;
  29294. t[3006] = 64294;
  29295. t[3007] = 64295;
  29296. t[3008] = 64296;
  29297. t[3011] = 1900;
  29298. t[3014] = 8223;
  29299. t[3015] = 8244;
  29300. t[3017] = 7532;
  29301. t[3018] = 7533;
  29302. t[3019] = 7534;
  29303. t[3075] = 7590;
  29304. t[3076] = 7591;
  29305. t[3079] = 7594;
  29306. t[3080] = 7595;
  29307. t[3083] = 7598;
  29308. t[3084] = 7599;
  29309. t[3087] = 7602;
  29310. t[3088] = 7603;
  29311. t[3091] = 7606;
  29312. t[3092] = 7607;
  29313. t[3095] = 7610;
  29314. t[3096] = 7611;
  29315. t[3099] = 7614;
  29316. t[3100] = 7615;
  29317. t[3103] = 7618;
  29318. t[3104] = 7619;
  29319. t[3107] = 8337;
  29320. t[3108] = 8338;
  29321. t[3116] = 1884;
  29322. t[3119] = 1885;
  29323. t[3120] = 1885;
  29324. t[3123] = 1886;
  29325. t[3124] = 1886;
  29326. t[3127] = 1887;
  29327. t[3128] = 1887;
  29328. t[3131] = 1888;
  29329. t[3132] = 1888;
  29330. t[3135] = 1889;
  29331. t[3136] = 1889;
  29332. t[3139] = 1890;
  29333. t[3140] = 1890;
  29334. t[3143] = 1891;
  29335. t[3144] = 1891;
  29336. t[3147] = 1892;
  29337. t[3148] = 1892;
  29338. t[3153] = 580;
  29339. t[3154] = 581;
  29340. t[3157] = 584;
  29341. t[3158] = 585;
  29342. t[3161] = 588;
  29343. t[3162] = 589;
  29344. t[3165] = 891;
  29345. t[3166] = 892;
  29346. t[3169] = 1274;
  29347. t[3170] = 1275;
  29348. t[3173] = 1278;
  29349. t[3174] = 1279;
  29350. t[3181] = 7622;
  29351. t[3182] = 7623;
  29352. t[3282] = 11799;
  29353. t[3316] = 578;
  29354. t[3379] = 42785;
  29355. t[3393] = 1159;
  29356. t[3416] = 8377;
  29357. });
  29358. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  29359. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  29360. t[227] = 322;
  29361. t[264] = 261;
  29362. t[291] = 346;
  29363. });
  29364. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  29365. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  29366. t[1] = 32;
  29367. t[4] = 65;
  29368. t[17] = 66;
  29369. t[18] = 67;
  29370. t[24] = 68;
  29371. t[28] = 69;
  29372. t[38] = 70;
  29373. t[39] = 71;
  29374. t[44] = 72;
  29375. t[47] = 73;
  29376. t[58] = 74;
  29377. t[60] = 75;
  29378. t[62] = 76;
  29379. t[68] = 77;
  29380. t[69] = 78;
  29381. t[75] = 79;
  29382. t[87] = 80;
  29383. t[89] = 81;
  29384. t[90] = 82;
  29385. t[94] = 83;
  29386. t[100] = 84;
  29387. t[104] = 85;
  29388. t[115] = 86;
  29389. t[116] = 87;
  29390. t[121] = 88;
  29391. t[122] = 89;
  29392. t[127] = 90;
  29393. t[258] = 97;
  29394. t[268] = 261;
  29395. t[271] = 98;
  29396. t[272] = 99;
  29397. t[273] = 263;
  29398. t[282] = 100;
  29399. t[286] = 101;
  29400. t[295] = 281;
  29401. t[296] = 102;
  29402. t[336] = 103;
  29403. t[346] = 104;
  29404. t[349] = 105;
  29405. t[361] = 106;
  29406. t[364] = 107;
  29407. t[367] = 108;
  29408. t[371] = 322;
  29409. t[373] = 109;
  29410. t[374] = 110;
  29411. t[381] = 111;
  29412. t[383] = 243;
  29413. t[393] = 112;
  29414. t[395] = 113;
  29415. t[396] = 114;
  29416. t[400] = 115;
  29417. t[401] = 347;
  29418. t[410] = 116;
  29419. t[437] = 117;
  29420. t[448] = 118;
  29421. t[449] = 119;
  29422. t[454] = 120;
  29423. t[455] = 121;
  29424. t[460] = 122;
  29425. t[463] = 380;
  29426. t[853] = 44;
  29427. t[855] = 58;
  29428. t[856] = 46;
  29429. t[876] = 47;
  29430. t[878] = 45;
  29431. t[882] = 45;
  29432. t[894] = 40;
  29433. t[895] = 41;
  29434. t[896] = 91;
  29435. t[897] = 93;
  29436. t[923] = 64;
  29437. t[1004] = 48;
  29438. t[1005] = 49;
  29439. t[1006] = 50;
  29440. t[1007] = 51;
  29441. t[1008] = 52;
  29442. t[1009] = 53;
  29443. t[1010] = 54;
  29444. t[1011] = 55;
  29445. t[1012] = 56;
  29446. t[1013] = 57;
  29447. t[1081] = 37;
  29448. t[1085] = 43;
  29449. t[1086] = 45;
  29450. });
  29451. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  29452. /***/ }),
  29453. /* 35 */
  29454. /***/ (function(module, exports, __w_pdfjs_require__) {
  29455. var getLookupTableFactory = __w_pdfjs_require__(8).getLookupTableFactory;
  29456. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  29457. t[63721] = 0x00a9;
  29458. t[63193] = 0x00a9;
  29459. t[63720] = 0x00ae;
  29460. t[63194] = 0x00ae;
  29461. t[63722] = 0x2122;
  29462. t[63195] = 0x2122;
  29463. t[63729] = 0x23a7;
  29464. t[63730] = 0x23a8;
  29465. t[63731] = 0x23a9;
  29466. t[63740] = 0x23ab;
  29467. t[63741] = 0x23ac;
  29468. t[63742] = 0x23ad;
  29469. t[63726] = 0x23a1;
  29470. t[63727] = 0x23a2;
  29471. t[63728] = 0x23a3;
  29472. t[63737] = 0x23a4;
  29473. t[63738] = 0x23a5;
  29474. t[63739] = 0x23a6;
  29475. t[63723] = 0x239b;
  29476. t[63724] = 0x239c;
  29477. t[63725] = 0x239d;
  29478. t[63734] = 0x239e;
  29479. t[63735] = 0x239f;
  29480. t[63736] = 0x23a0;
  29481. });
  29482. function mapSpecialUnicodeValues(code) {
  29483. if (code >= 0xfff0 && code <= 0xffff) {
  29484. return 0;
  29485. } else if (code >= 0xf600 && code <= 0xf8ff) {
  29486. return getSpecialPUASymbols()[code] || code;
  29487. } else if (code === 0x00ad) {
  29488. return 0x002d;
  29489. }
  29490. return code;
  29491. }
  29492. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  29493. var unicode = glyphsUnicodeMap[name];
  29494. if (unicode !== undefined) {
  29495. return unicode;
  29496. }
  29497. if (!name) {
  29498. return -1;
  29499. }
  29500. if (name[0] === "u") {
  29501. var nameLen = name.length, hexStr;
  29502. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  29503. hexStr = name.substring(3);
  29504. } else if (nameLen >= 5 && nameLen <= 7) {
  29505. hexStr = name.substring(1);
  29506. } else {
  29507. return -1;
  29508. }
  29509. if (hexStr === hexStr.toUpperCase()) {
  29510. unicode = parseInt(hexStr, 16);
  29511. if (unicode >= 0) {
  29512. return unicode;
  29513. }
  29514. }
  29515. }
  29516. return -1;
  29517. }
  29518. var UnicodeRanges = [
  29519. {
  29520. begin: 0x0000,
  29521. end: 0x007f
  29522. },
  29523. {
  29524. begin: 0x0080,
  29525. end: 0x00ff
  29526. },
  29527. {
  29528. begin: 0x0100,
  29529. end: 0x017f
  29530. },
  29531. {
  29532. begin: 0x0180,
  29533. end: 0x024f
  29534. },
  29535. {
  29536. begin: 0x0250,
  29537. end: 0x02af
  29538. },
  29539. {
  29540. begin: 0x02b0,
  29541. end: 0x02ff
  29542. },
  29543. {
  29544. begin: 0x0300,
  29545. end: 0x036f
  29546. },
  29547. {
  29548. begin: 0x0370,
  29549. end: 0x03ff
  29550. },
  29551. {
  29552. begin: 0x2c80,
  29553. end: 0x2cff
  29554. },
  29555. {
  29556. begin: 0x0400,
  29557. end: 0x04ff
  29558. },
  29559. {
  29560. begin: 0x0530,
  29561. end: 0x058f
  29562. },
  29563. {
  29564. begin: 0x0590,
  29565. end: 0x05ff
  29566. },
  29567. {
  29568. begin: 0xa500,
  29569. end: 0xa63f
  29570. },
  29571. {
  29572. begin: 0x0600,
  29573. end: 0x06ff
  29574. },
  29575. {
  29576. begin: 0x07c0,
  29577. end: 0x07ff
  29578. },
  29579. {
  29580. begin: 0x0900,
  29581. end: 0x097f
  29582. },
  29583. {
  29584. begin: 0x0980,
  29585. end: 0x09ff
  29586. },
  29587. {
  29588. begin: 0x0a00,
  29589. end: 0x0a7f
  29590. },
  29591. {
  29592. begin: 0x0a80,
  29593. end: 0x0aff
  29594. },
  29595. {
  29596. begin: 0x0b00,
  29597. end: 0x0b7f
  29598. },
  29599. {
  29600. begin: 0x0b80,
  29601. end: 0x0bff
  29602. },
  29603. {
  29604. begin: 0x0c00,
  29605. end: 0x0c7f
  29606. },
  29607. {
  29608. begin: 0x0c80,
  29609. end: 0x0cff
  29610. },
  29611. {
  29612. begin: 0x0d00,
  29613. end: 0x0d7f
  29614. },
  29615. {
  29616. begin: 0x0e00,
  29617. end: 0x0e7f
  29618. },
  29619. {
  29620. begin: 0x0e80,
  29621. end: 0x0eff
  29622. },
  29623. {
  29624. begin: 0x10a0,
  29625. end: 0x10ff
  29626. },
  29627. {
  29628. begin: 0x1b00,
  29629. end: 0x1b7f
  29630. },
  29631. {
  29632. begin: 0x1100,
  29633. end: 0x11ff
  29634. },
  29635. {
  29636. begin: 0x1e00,
  29637. end: 0x1eff
  29638. },
  29639. {
  29640. begin: 0x1f00,
  29641. end: 0x1fff
  29642. },
  29643. {
  29644. begin: 0x2000,
  29645. end: 0x206f
  29646. },
  29647. {
  29648. begin: 0x2070,
  29649. end: 0x209f
  29650. },
  29651. {
  29652. begin: 0x20a0,
  29653. end: 0x20cf
  29654. },
  29655. {
  29656. begin: 0x20d0,
  29657. end: 0x20ff
  29658. },
  29659. {
  29660. begin: 0x2100,
  29661. end: 0x214f
  29662. },
  29663. {
  29664. begin: 0x2150,
  29665. end: 0x218f
  29666. },
  29667. {
  29668. begin: 0x2190,
  29669. end: 0x21ff
  29670. },
  29671. {
  29672. begin: 0x2200,
  29673. end: 0x22ff
  29674. },
  29675. {
  29676. begin: 0x2300,
  29677. end: 0x23ff
  29678. },
  29679. {
  29680. begin: 0x2400,
  29681. end: 0x243f
  29682. },
  29683. {
  29684. begin: 0x2440,
  29685. end: 0x245f
  29686. },
  29687. {
  29688. begin: 0x2460,
  29689. end: 0x24ff
  29690. },
  29691. {
  29692. begin: 0x2500,
  29693. end: 0x257f
  29694. },
  29695. {
  29696. begin: 0x2580,
  29697. end: 0x259f
  29698. },
  29699. {
  29700. begin: 0x25a0,
  29701. end: 0x25ff
  29702. },
  29703. {
  29704. begin: 0x2600,
  29705. end: 0x26ff
  29706. },
  29707. {
  29708. begin: 0x2700,
  29709. end: 0x27bf
  29710. },
  29711. {
  29712. begin: 0x3000,
  29713. end: 0x303f
  29714. },
  29715. {
  29716. begin: 0x3040,
  29717. end: 0x309f
  29718. },
  29719. {
  29720. begin: 0x30a0,
  29721. end: 0x30ff
  29722. },
  29723. {
  29724. begin: 0x3100,
  29725. end: 0x312f
  29726. },
  29727. {
  29728. begin: 0x3130,
  29729. end: 0x318f
  29730. },
  29731. {
  29732. begin: 0xa840,
  29733. end: 0xa87f
  29734. },
  29735. {
  29736. begin: 0x3200,
  29737. end: 0x32ff
  29738. },
  29739. {
  29740. begin: 0x3300,
  29741. end: 0x33ff
  29742. },
  29743. {
  29744. begin: 0xac00,
  29745. end: 0xd7af
  29746. },
  29747. {
  29748. begin: 0xd800,
  29749. end: 0xdfff
  29750. },
  29751. {
  29752. begin: 0x10900,
  29753. end: 0x1091f
  29754. },
  29755. {
  29756. begin: 0x4e00,
  29757. end: 0x9fff
  29758. },
  29759. {
  29760. begin: 0xe000,
  29761. end: 0xf8ff
  29762. },
  29763. {
  29764. begin: 0x31c0,
  29765. end: 0x31ef
  29766. },
  29767. {
  29768. begin: 0xfb00,
  29769. end: 0xfb4f
  29770. },
  29771. {
  29772. begin: 0xfb50,
  29773. end: 0xfdff
  29774. },
  29775. {
  29776. begin: 0xfe20,
  29777. end: 0xfe2f
  29778. },
  29779. {
  29780. begin: 0xfe10,
  29781. end: 0xfe1f
  29782. },
  29783. {
  29784. begin: 0xfe50,
  29785. end: 0xfe6f
  29786. },
  29787. {
  29788. begin: 0xfe70,
  29789. end: 0xfeff
  29790. },
  29791. {
  29792. begin: 0xff00,
  29793. end: 0xffef
  29794. },
  29795. {
  29796. begin: 0xfff0,
  29797. end: 0xffff
  29798. },
  29799. {
  29800. begin: 0x0f00,
  29801. end: 0x0fff
  29802. },
  29803. {
  29804. begin: 0x0700,
  29805. end: 0x074f
  29806. },
  29807. {
  29808. begin: 0x0780,
  29809. end: 0x07bf
  29810. },
  29811. {
  29812. begin: 0x0d80,
  29813. end: 0x0dff
  29814. },
  29815. {
  29816. begin: 0x1000,
  29817. end: 0x109f
  29818. },
  29819. {
  29820. begin: 0x1200,
  29821. end: 0x137f
  29822. },
  29823. {
  29824. begin: 0x13a0,
  29825. end: 0x13ff
  29826. },
  29827. {
  29828. begin: 0x1400,
  29829. end: 0x167f
  29830. },
  29831. {
  29832. begin: 0x1680,
  29833. end: 0x169f
  29834. },
  29835. {
  29836. begin: 0x16a0,
  29837. end: 0x16ff
  29838. },
  29839. {
  29840. begin: 0x1780,
  29841. end: 0x17ff
  29842. },
  29843. {
  29844. begin: 0x1800,
  29845. end: 0x18af
  29846. },
  29847. {
  29848. begin: 0x2800,
  29849. end: 0x28ff
  29850. },
  29851. {
  29852. begin: 0xa000,
  29853. end: 0xa48f
  29854. },
  29855. {
  29856. begin: 0x1700,
  29857. end: 0x171f
  29858. },
  29859. {
  29860. begin: 0x10300,
  29861. end: 0x1032f
  29862. },
  29863. {
  29864. begin: 0x10330,
  29865. end: 0x1034f
  29866. },
  29867. {
  29868. begin: 0x10400,
  29869. end: 0x1044f
  29870. },
  29871. {
  29872. begin: 0x1d000,
  29873. end: 0x1d0ff
  29874. },
  29875. {
  29876. begin: 0x1d400,
  29877. end: 0x1d7ff
  29878. },
  29879. {
  29880. begin: 0xff000,
  29881. end: 0xffffd
  29882. },
  29883. {
  29884. begin: 0xfe00,
  29885. end: 0xfe0f
  29886. },
  29887. {
  29888. begin: 0xe0000,
  29889. end: 0xe007f
  29890. },
  29891. {
  29892. begin: 0x1900,
  29893. end: 0x194f
  29894. },
  29895. {
  29896. begin: 0x1950,
  29897. end: 0x197f
  29898. },
  29899. {
  29900. begin: 0x1980,
  29901. end: 0x19df
  29902. },
  29903. {
  29904. begin: 0x1a00,
  29905. end: 0x1a1f
  29906. },
  29907. {
  29908. begin: 0x2c00,
  29909. end: 0x2c5f
  29910. },
  29911. {
  29912. begin: 0x2d30,
  29913. end: 0x2d7f
  29914. },
  29915. {
  29916. begin: 0x4dc0,
  29917. end: 0x4dff
  29918. },
  29919. {
  29920. begin: 0xa800,
  29921. end: 0xa82f
  29922. },
  29923. {
  29924. begin: 0x10000,
  29925. end: 0x1007f
  29926. },
  29927. {
  29928. begin: 0x10140,
  29929. end: 0x1018f
  29930. },
  29931. {
  29932. begin: 0x10380,
  29933. end: 0x1039f
  29934. },
  29935. {
  29936. begin: 0x103a0,
  29937. end: 0x103df
  29938. },
  29939. {
  29940. begin: 0x10450,
  29941. end: 0x1047f
  29942. },
  29943. {
  29944. begin: 0x10480,
  29945. end: 0x104af
  29946. },
  29947. {
  29948. begin: 0x10800,
  29949. end: 0x1083f
  29950. },
  29951. {
  29952. begin: 0x10a00,
  29953. end: 0x10a5f
  29954. },
  29955. {
  29956. begin: 0x1d300,
  29957. end: 0x1d35f
  29958. },
  29959. {
  29960. begin: 0x12000,
  29961. end: 0x123ff
  29962. },
  29963. {
  29964. begin: 0x1d360,
  29965. end: 0x1d37f
  29966. },
  29967. {
  29968. begin: 0x1b80,
  29969. end: 0x1bbf
  29970. },
  29971. {
  29972. begin: 0x1c00,
  29973. end: 0x1c4f
  29974. },
  29975. {
  29976. begin: 0x1c50,
  29977. end: 0x1c7f
  29978. },
  29979. {
  29980. begin: 0xa880,
  29981. end: 0xa8df
  29982. },
  29983. {
  29984. begin: 0xa900,
  29985. end: 0xa92f
  29986. },
  29987. {
  29988. begin: 0xa930,
  29989. end: 0xa95f
  29990. },
  29991. {
  29992. begin: 0xaa00,
  29993. end: 0xaa5f
  29994. },
  29995. {
  29996. begin: 0x10190,
  29997. end: 0x101cf
  29998. },
  29999. {
  30000. begin: 0x101d0,
  30001. end: 0x101ff
  30002. },
  30003. {
  30004. begin: 0x102a0,
  30005. end: 0x102df
  30006. },
  30007. {
  30008. begin: 0x1f030,
  30009. end: 0x1f09f
  30010. }
  30011. ];
  30012. function getUnicodeRangeFor(value) {
  30013. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  30014. var range = UnicodeRanges[i];
  30015. if (value >= range.begin && value < range.end) {
  30016. return i;
  30017. }
  30018. }
  30019. return -1;
  30020. }
  30021. function isRTLRangeFor(value) {
  30022. var range = UnicodeRanges[13];
  30023. if (value >= range.begin && value < range.end) {
  30024. return true;
  30025. }
  30026. range = UnicodeRanges[11];
  30027. if (value >= range.begin && value < range.end) {
  30028. return true;
  30029. }
  30030. return false;
  30031. }
  30032. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  30033. t["\u00A8"] = "\u0020\u0308";
  30034. t["\u00AF"] = "\u0020\u0304";
  30035. t["\u00B4"] = "\u0020\u0301";
  30036. t["\u00B5"] = "\u03BC";
  30037. t["\u00B8"] = "\u0020\u0327";
  30038. t["\u0132"] = "\u0049\u004A";
  30039. t["\u0133"] = "\u0069\u006A";
  30040. t["\u013F"] = "\u004C\u00B7";
  30041. t["\u0140"] = "\u006C\u00B7";
  30042. t["\u0149"] = "\u02BC\u006E";
  30043. t["\u017F"] = "\u0073";
  30044. t["\u01C4"] = "\u0044\u017D";
  30045. t["\u01C5"] = "\u0044\u017E";
  30046. t["\u01C6"] = "\u0064\u017E";
  30047. t["\u01C7"] = "\u004C\u004A";
  30048. t["\u01C8"] = "\u004C\u006A";
  30049. t["\u01C9"] = "\u006C\u006A";
  30050. t["\u01CA"] = "\u004E\u004A";
  30051. t["\u01CB"] = "\u004E\u006A";
  30052. t["\u01CC"] = "\u006E\u006A";
  30053. t["\u01F1"] = "\u0044\u005A";
  30054. t["\u01F2"] = "\u0044\u007A";
  30055. t["\u01F3"] = "\u0064\u007A";
  30056. t["\u02D8"] = "\u0020\u0306";
  30057. t["\u02D9"] = "\u0020\u0307";
  30058. t["\u02DA"] = "\u0020\u030A";
  30059. t["\u02DB"] = "\u0020\u0328";
  30060. t["\u02DC"] = "\u0020\u0303";
  30061. t["\u02DD"] = "\u0020\u030B";
  30062. t["\u037A"] = "\u0020\u0345";
  30063. t["\u0384"] = "\u0020\u0301";
  30064. t["\u03D0"] = "\u03B2";
  30065. t["\u03D1"] = "\u03B8";
  30066. t["\u03D2"] = "\u03A5";
  30067. t["\u03D5"] = "\u03C6";
  30068. t["\u03D6"] = "\u03C0";
  30069. t["\u03F0"] = "\u03BA";
  30070. t["\u03F1"] = "\u03C1";
  30071. t["\u03F2"] = "\u03C2";
  30072. t["\u03F4"] = "\u0398";
  30073. t["\u03F5"] = "\u03B5";
  30074. t["\u03F9"] = "\u03A3";
  30075. t["\u0587"] = "\u0565\u0582";
  30076. t["\u0675"] = "\u0627\u0674";
  30077. t["\u0676"] = "\u0648\u0674";
  30078. t["\u0677"] = "\u06C7\u0674";
  30079. t["\u0678"] = "\u064A\u0674";
  30080. t["\u0E33"] = "\u0E4D\u0E32";
  30081. t["\u0EB3"] = "\u0ECD\u0EB2";
  30082. t["\u0EDC"] = "\u0EAB\u0E99";
  30083. t["\u0EDD"] = "\u0EAB\u0EA1";
  30084. t["\u0F77"] = "\u0FB2\u0F81";
  30085. t["\u0F79"] = "\u0FB3\u0F81";
  30086. t["\u1E9A"] = "\u0061\u02BE";
  30087. t["\u1FBD"] = "\u0020\u0313";
  30088. t["\u1FBF"] = "\u0020\u0313";
  30089. t["\u1FC0"] = "\u0020\u0342";
  30090. t["\u1FFE"] = "\u0020\u0314";
  30091. t["\u2002"] = "\u0020";
  30092. t["\u2003"] = "\u0020";
  30093. t["\u2004"] = "\u0020";
  30094. t["\u2005"] = "\u0020";
  30095. t["\u2006"] = "\u0020";
  30096. t["\u2008"] = "\u0020";
  30097. t["\u2009"] = "\u0020";
  30098. t["\u200A"] = "\u0020";
  30099. t["\u2017"] = "\u0020\u0333";
  30100. t["\u2024"] = "\u002E";
  30101. t["\u2025"] = "\u002E\u002E";
  30102. t["\u2026"] = "\u002E\u002E\u002E";
  30103. t["\u2033"] = "\u2032\u2032";
  30104. t["\u2034"] = "\u2032\u2032\u2032";
  30105. t["\u2036"] = "\u2035\u2035";
  30106. t["\u2037"] = "\u2035\u2035\u2035";
  30107. t["\u203C"] = "\u0021\u0021";
  30108. t["\u203E"] = "\u0020\u0305";
  30109. t["\u2047"] = "\u003F\u003F";
  30110. t["\u2048"] = "\u003F\u0021";
  30111. t["\u2049"] = "\u0021\u003F";
  30112. t["\u2057"] = "\u2032\u2032\u2032\u2032";
  30113. t["\u205F"] = "\u0020";
  30114. t["\u20A8"] = "\u0052\u0073";
  30115. t["\u2100"] = "\u0061\u002F\u0063";
  30116. t["\u2101"] = "\u0061\u002F\u0073";
  30117. t["\u2103"] = "\u00B0\u0043";
  30118. t["\u2105"] = "\u0063\u002F\u006F";
  30119. t["\u2106"] = "\u0063\u002F\u0075";
  30120. t["\u2107"] = "\u0190";
  30121. t["\u2109"] = "\u00B0\u0046";
  30122. t["\u2116"] = "\u004E\u006F";
  30123. t["\u2121"] = "\u0054\u0045\u004C";
  30124. t["\u2135"] = "\u05D0";
  30125. t["\u2136"] = "\u05D1";
  30126. t["\u2137"] = "\u05D2";
  30127. t["\u2138"] = "\u05D3";
  30128. t["\u213B"] = "\u0046\u0041\u0058";
  30129. t["\u2160"] = "\u0049";
  30130. t["\u2161"] = "\u0049\u0049";
  30131. t["\u2162"] = "\u0049\u0049\u0049";
  30132. t["\u2163"] = "\u0049\u0056";
  30133. t["\u2164"] = "\u0056";
  30134. t["\u2165"] = "\u0056\u0049";
  30135. t["\u2166"] = "\u0056\u0049\u0049";
  30136. t["\u2167"] = "\u0056\u0049\u0049\u0049";
  30137. t["\u2168"] = "\u0049\u0058";
  30138. t["\u2169"] = "\u0058";
  30139. t["\u216A"] = "\u0058\u0049";
  30140. t["\u216B"] = "\u0058\u0049\u0049";
  30141. t["\u216C"] = "\u004C";
  30142. t["\u216D"] = "\u0043";
  30143. t["\u216E"] = "\u0044";
  30144. t["\u216F"] = "\u004D";
  30145. t["\u2170"] = "\u0069";
  30146. t["\u2171"] = "\u0069\u0069";
  30147. t["\u2172"] = "\u0069\u0069\u0069";
  30148. t["\u2173"] = "\u0069\u0076";
  30149. t["\u2174"] = "\u0076";
  30150. t["\u2175"] = "\u0076\u0069";
  30151. t["\u2176"] = "\u0076\u0069\u0069";
  30152. t["\u2177"] = "\u0076\u0069\u0069\u0069";
  30153. t["\u2178"] = "\u0069\u0078";
  30154. t["\u2179"] = "\u0078";
  30155. t["\u217A"] = "\u0078\u0069";
  30156. t["\u217B"] = "\u0078\u0069\u0069";
  30157. t["\u217C"] = "\u006C";
  30158. t["\u217D"] = "\u0063";
  30159. t["\u217E"] = "\u0064";
  30160. t["\u217F"] = "\u006D";
  30161. t["\u222C"] = "\u222B\u222B";
  30162. t["\u222D"] = "\u222B\u222B\u222B";
  30163. t["\u222F"] = "\u222E\u222E";
  30164. t["\u2230"] = "\u222E\u222E\u222E";
  30165. t["\u2474"] = "\u0028\u0031\u0029";
  30166. t["\u2475"] = "\u0028\u0032\u0029";
  30167. t["\u2476"] = "\u0028\u0033\u0029";
  30168. t["\u2477"] = "\u0028\u0034\u0029";
  30169. t["\u2478"] = "\u0028\u0035\u0029";
  30170. t["\u2479"] = "\u0028\u0036\u0029";
  30171. t["\u247A"] = "\u0028\u0037\u0029";
  30172. t["\u247B"] = "\u0028\u0038\u0029";
  30173. t["\u247C"] = "\u0028\u0039\u0029";
  30174. t["\u247D"] = "\u0028\u0031\u0030\u0029";
  30175. t["\u247E"] = "\u0028\u0031\u0031\u0029";
  30176. t["\u247F"] = "\u0028\u0031\u0032\u0029";
  30177. t["\u2480"] = "\u0028\u0031\u0033\u0029";
  30178. t["\u2481"] = "\u0028\u0031\u0034\u0029";
  30179. t["\u2482"] = "\u0028\u0031\u0035\u0029";
  30180. t["\u2483"] = "\u0028\u0031\u0036\u0029";
  30181. t["\u2484"] = "\u0028\u0031\u0037\u0029";
  30182. t["\u2485"] = "\u0028\u0031\u0038\u0029";
  30183. t["\u2486"] = "\u0028\u0031\u0039\u0029";
  30184. t["\u2487"] = "\u0028\u0032\u0030\u0029";
  30185. t["\u2488"] = "\u0031\u002E";
  30186. t["\u2489"] = "\u0032\u002E";
  30187. t["\u248A"] = "\u0033\u002E";
  30188. t["\u248B"] = "\u0034\u002E";
  30189. t["\u248C"] = "\u0035\u002E";
  30190. t["\u248D"] = "\u0036\u002E";
  30191. t["\u248E"] = "\u0037\u002E";
  30192. t["\u248F"] = "\u0038\u002E";
  30193. t["\u2490"] = "\u0039\u002E";
  30194. t["\u2491"] = "\u0031\u0030\u002E";
  30195. t["\u2492"] = "\u0031\u0031\u002E";
  30196. t["\u2493"] = "\u0031\u0032\u002E";
  30197. t["\u2494"] = "\u0031\u0033\u002E";
  30198. t["\u2495"] = "\u0031\u0034\u002E";
  30199. t["\u2496"] = "\u0031\u0035\u002E";
  30200. t["\u2497"] = "\u0031\u0036\u002E";
  30201. t["\u2498"] = "\u0031\u0037\u002E";
  30202. t["\u2499"] = "\u0031\u0038\u002E";
  30203. t["\u249A"] = "\u0031\u0039\u002E";
  30204. t["\u249B"] = "\u0032\u0030\u002E";
  30205. t["\u249C"] = "\u0028\u0061\u0029";
  30206. t["\u249D"] = "\u0028\u0062\u0029";
  30207. t["\u249E"] = "\u0028\u0063\u0029";
  30208. t["\u249F"] = "\u0028\u0064\u0029";
  30209. t["\u24A0"] = "\u0028\u0065\u0029";
  30210. t["\u24A1"] = "\u0028\u0066\u0029";
  30211. t["\u24A2"] = "\u0028\u0067\u0029";
  30212. t["\u24A3"] = "\u0028\u0068\u0029";
  30213. t["\u24A4"] = "\u0028\u0069\u0029";
  30214. t["\u24A5"] = "\u0028\u006A\u0029";
  30215. t["\u24A6"] = "\u0028\u006B\u0029";
  30216. t["\u24A7"] = "\u0028\u006C\u0029";
  30217. t["\u24A8"] = "\u0028\u006D\u0029";
  30218. t["\u24A9"] = "\u0028\u006E\u0029";
  30219. t["\u24AA"] = "\u0028\u006F\u0029";
  30220. t["\u24AB"] = "\u0028\u0070\u0029";
  30221. t["\u24AC"] = "\u0028\u0071\u0029";
  30222. t["\u24AD"] = "\u0028\u0072\u0029";
  30223. t["\u24AE"] = "\u0028\u0073\u0029";
  30224. t["\u24AF"] = "\u0028\u0074\u0029";
  30225. t["\u24B0"] = "\u0028\u0075\u0029";
  30226. t["\u24B1"] = "\u0028\u0076\u0029";
  30227. t["\u24B2"] = "\u0028\u0077\u0029";
  30228. t["\u24B3"] = "\u0028\u0078\u0029";
  30229. t["\u24B4"] = "\u0028\u0079\u0029";
  30230. t["\u24B5"] = "\u0028\u007A\u0029";
  30231. t["\u2A0C"] = "\u222B\u222B\u222B\u222B";
  30232. t["\u2A74"] = "\u003A\u003A\u003D";
  30233. t["\u2A75"] = "\u003D\u003D";
  30234. t["\u2A76"] = "\u003D\u003D\u003D";
  30235. t["\u2E9F"] = "\u6BCD";
  30236. t["\u2EF3"] = "\u9F9F";
  30237. t["\u2F00"] = "\u4E00";
  30238. t["\u2F01"] = "\u4E28";
  30239. t["\u2F02"] = "\u4E36";
  30240. t["\u2F03"] = "\u4E3F";
  30241. t["\u2F04"] = "\u4E59";
  30242. t["\u2F05"] = "\u4E85";
  30243. t["\u2F06"] = "\u4E8C";
  30244. t["\u2F07"] = "\u4EA0";
  30245. t["\u2F08"] = "\u4EBA";
  30246. t["\u2F09"] = "\u513F";
  30247. t["\u2F0A"] = "\u5165";
  30248. t["\u2F0B"] = "\u516B";
  30249. t["\u2F0C"] = "\u5182";
  30250. t["\u2F0D"] = "\u5196";
  30251. t["\u2F0E"] = "\u51AB";
  30252. t["\u2F0F"] = "\u51E0";
  30253. t["\u2F10"] = "\u51F5";
  30254. t["\u2F11"] = "\u5200";
  30255. t["\u2F12"] = "\u529B";
  30256. t["\u2F13"] = "\u52F9";
  30257. t["\u2F14"] = "\u5315";
  30258. t["\u2F15"] = "\u531A";
  30259. t["\u2F16"] = "\u5338";
  30260. t["\u2F17"] = "\u5341";
  30261. t["\u2F18"] = "\u535C";
  30262. t["\u2F19"] = "\u5369";
  30263. t["\u2F1A"] = "\u5382";
  30264. t["\u2F1B"] = "\u53B6";
  30265. t["\u2F1C"] = "\u53C8";
  30266. t["\u2F1D"] = "\u53E3";
  30267. t["\u2F1E"] = "\u56D7";
  30268. t["\u2F1F"] = "\u571F";
  30269. t["\u2F20"] = "\u58EB";
  30270. t["\u2F21"] = "\u5902";
  30271. t["\u2F22"] = "\u590A";
  30272. t["\u2F23"] = "\u5915";
  30273. t["\u2F24"] = "\u5927";
  30274. t["\u2F25"] = "\u5973";
  30275. t["\u2F26"] = "\u5B50";
  30276. t["\u2F27"] = "\u5B80";
  30277. t["\u2F28"] = "\u5BF8";
  30278. t["\u2F29"] = "\u5C0F";
  30279. t["\u2F2A"] = "\u5C22";
  30280. t["\u2F2B"] = "\u5C38";
  30281. t["\u2F2C"] = "\u5C6E";
  30282. t["\u2F2D"] = "\u5C71";
  30283. t["\u2F2E"] = "\u5DDB";
  30284. t["\u2F2F"] = "\u5DE5";
  30285. t["\u2F30"] = "\u5DF1";
  30286. t["\u2F31"] = "\u5DFE";
  30287. t["\u2F32"] = "\u5E72";
  30288. t["\u2F33"] = "\u5E7A";
  30289. t["\u2F34"] = "\u5E7F";
  30290. t["\u2F35"] = "\u5EF4";
  30291. t["\u2F36"] = "\u5EFE";
  30292. t["\u2F37"] = "\u5F0B";
  30293. t["\u2F38"] = "\u5F13";
  30294. t["\u2F39"] = "\u5F50";
  30295. t["\u2F3A"] = "\u5F61";
  30296. t["\u2F3B"] = "\u5F73";
  30297. t["\u2F3C"] = "\u5FC3";
  30298. t["\u2F3D"] = "\u6208";
  30299. t["\u2F3E"] = "\u6236";
  30300. t["\u2F3F"] = "\u624B";
  30301. t["\u2F40"] = "\u652F";
  30302. t["\u2F41"] = "\u6534";
  30303. t["\u2F42"] = "\u6587";
  30304. t["\u2F43"] = "\u6597";
  30305. t["\u2F44"] = "\u65A4";
  30306. t["\u2F45"] = "\u65B9";
  30307. t["\u2F46"] = "\u65E0";
  30308. t["\u2F47"] = "\u65E5";
  30309. t["\u2F48"] = "\u66F0";
  30310. t["\u2F49"] = "\u6708";
  30311. t["\u2F4A"] = "\u6728";
  30312. t["\u2F4B"] = "\u6B20";
  30313. t["\u2F4C"] = "\u6B62";
  30314. t["\u2F4D"] = "\u6B79";
  30315. t["\u2F4E"] = "\u6BB3";
  30316. t["\u2F4F"] = "\u6BCB";
  30317. t["\u2F50"] = "\u6BD4";
  30318. t["\u2F51"] = "\u6BDB";
  30319. t["\u2F52"] = "\u6C0F";
  30320. t["\u2F53"] = "\u6C14";
  30321. t["\u2F54"] = "\u6C34";
  30322. t["\u2F55"] = "\u706B";
  30323. t["\u2F56"] = "\u722A";
  30324. t["\u2F57"] = "\u7236";
  30325. t["\u2F58"] = "\u723B";
  30326. t["\u2F59"] = "\u723F";
  30327. t["\u2F5A"] = "\u7247";
  30328. t["\u2F5B"] = "\u7259";
  30329. t["\u2F5C"] = "\u725B";
  30330. t["\u2F5D"] = "\u72AC";
  30331. t["\u2F5E"] = "\u7384";
  30332. t["\u2F5F"] = "\u7389";
  30333. t["\u2F60"] = "\u74DC";
  30334. t["\u2F61"] = "\u74E6";
  30335. t["\u2F62"] = "\u7518";
  30336. t["\u2F63"] = "\u751F";
  30337. t["\u2F64"] = "\u7528";
  30338. t["\u2F65"] = "\u7530";
  30339. t["\u2F66"] = "\u758B";
  30340. t["\u2F67"] = "\u7592";
  30341. t["\u2F68"] = "\u7676";
  30342. t["\u2F69"] = "\u767D";
  30343. t["\u2F6A"] = "\u76AE";
  30344. t["\u2F6B"] = "\u76BF";
  30345. t["\u2F6C"] = "\u76EE";
  30346. t["\u2F6D"] = "\u77DB";
  30347. t["\u2F6E"] = "\u77E2";
  30348. t["\u2F6F"] = "\u77F3";
  30349. t["\u2F70"] = "\u793A";
  30350. t["\u2F71"] = "\u79B8";
  30351. t["\u2F72"] = "\u79BE";
  30352. t["\u2F73"] = "\u7A74";
  30353. t["\u2F74"] = "\u7ACB";
  30354. t["\u2F75"] = "\u7AF9";
  30355. t["\u2F76"] = "\u7C73";
  30356. t["\u2F77"] = "\u7CF8";
  30357. t["\u2F78"] = "\u7F36";
  30358. t["\u2F79"] = "\u7F51";
  30359. t["\u2F7A"] = "\u7F8A";
  30360. t["\u2F7B"] = "\u7FBD";
  30361. t["\u2F7C"] = "\u8001";
  30362. t["\u2F7D"] = "\u800C";
  30363. t["\u2F7E"] = "\u8012";
  30364. t["\u2F7F"] = "\u8033";
  30365. t["\u2F80"] = "\u807F";
  30366. t["\u2F81"] = "\u8089";
  30367. t["\u2F82"] = "\u81E3";
  30368. t["\u2F83"] = "\u81EA";
  30369. t["\u2F84"] = "\u81F3";
  30370. t["\u2F85"] = "\u81FC";
  30371. t["\u2F86"] = "\u820C";
  30372. t["\u2F87"] = "\u821B";
  30373. t["\u2F88"] = "\u821F";
  30374. t["\u2F89"] = "\u826E";
  30375. t["\u2F8A"] = "\u8272";
  30376. t["\u2F8B"] = "\u8278";
  30377. t["\u2F8C"] = "\u864D";
  30378. t["\u2F8D"] = "\u866B";
  30379. t["\u2F8E"] = "\u8840";
  30380. t["\u2F8F"] = "\u884C";
  30381. t["\u2F90"] = "\u8863";
  30382. t["\u2F91"] = "\u897E";
  30383. t["\u2F92"] = "\u898B";
  30384. t["\u2F93"] = "\u89D2";
  30385. t["\u2F94"] = "\u8A00";
  30386. t["\u2F95"] = "\u8C37";
  30387. t["\u2F96"] = "\u8C46";
  30388. t["\u2F97"] = "\u8C55";
  30389. t["\u2F98"] = "\u8C78";
  30390. t["\u2F99"] = "\u8C9D";
  30391. t["\u2F9A"] = "\u8D64";
  30392. t["\u2F9B"] = "\u8D70";
  30393. t["\u2F9C"] = "\u8DB3";
  30394. t["\u2F9D"] = "\u8EAB";
  30395. t["\u2F9E"] = "\u8ECA";
  30396. t["\u2F9F"] = "\u8F9B";
  30397. t["\u2FA0"] = "\u8FB0";
  30398. t["\u2FA1"] = "\u8FB5";
  30399. t["\u2FA2"] = "\u9091";
  30400. t["\u2FA3"] = "\u9149";
  30401. t["\u2FA4"] = "\u91C6";
  30402. t["\u2FA5"] = "\u91CC";
  30403. t["\u2FA6"] = "\u91D1";
  30404. t["\u2FA7"] = "\u9577";
  30405. t["\u2FA8"] = "\u9580";
  30406. t["\u2FA9"] = "\u961C";
  30407. t["\u2FAA"] = "\u96B6";
  30408. t["\u2FAB"] = "\u96B9";
  30409. t["\u2FAC"] = "\u96E8";
  30410. t["\u2FAD"] = "\u9751";
  30411. t["\u2FAE"] = "\u975E";
  30412. t["\u2FAF"] = "\u9762";
  30413. t["\u2FB0"] = "\u9769";
  30414. t["\u2FB1"] = "\u97CB";
  30415. t["\u2FB2"] = "\u97ED";
  30416. t["\u2FB3"] = "\u97F3";
  30417. t["\u2FB4"] = "\u9801";
  30418. t["\u2FB5"] = "\u98A8";
  30419. t["\u2FB6"] = "\u98DB";
  30420. t["\u2FB7"] = "\u98DF";
  30421. t["\u2FB8"] = "\u9996";
  30422. t["\u2FB9"] = "\u9999";
  30423. t["\u2FBA"] = "\u99AC";
  30424. t["\u2FBB"] = "\u9AA8";
  30425. t["\u2FBC"] = "\u9AD8";
  30426. t["\u2FBD"] = "\u9ADF";
  30427. t["\u2FBE"] = "\u9B25";
  30428. t["\u2FBF"] = "\u9B2F";
  30429. t["\u2FC0"] = "\u9B32";
  30430. t["\u2FC1"] = "\u9B3C";
  30431. t["\u2FC2"] = "\u9B5A";
  30432. t["\u2FC3"] = "\u9CE5";
  30433. t["\u2FC4"] = "\u9E75";
  30434. t["\u2FC5"] = "\u9E7F";
  30435. t["\u2FC6"] = "\u9EA5";
  30436. t["\u2FC7"] = "\u9EBB";
  30437. t["\u2FC8"] = "\u9EC3";
  30438. t["\u2FC9"] = "\u9ECD";
  30439. t["\u2FCA"] = "\u9ED1";
  30440. t["\u2FCB"] = "\u9EF9";
  30441. t["\u2FCC"] = "\u9EFD";
  30442. t["\u2FCD"] = "\u9F0E";
  30443. t["\u2FCE"] = "\u9F13";
  30444. t["\u2FCF"] = "\u9F20";
  30445. t["\u2FD0"] = "\u9F3B";
  30446. t["\u2FD1"] = "\u9F4A";
  30447. t["\u2FD2"] = "\u9F52";
  30448. t["\u2FD3"] = "\u9F8D";
  30449. t["\u2FD4"] = "\u9F9C";
  30450. t["\u2FD5"] = "\u9FA0";
  30451. t["\u3036"] = "\u3012";
  30452. t["\u3038"] = "\u5341";
  30453. t["\u3039"] = "\u5344";
  30454. t["\u303A"] = "\u5345";
  30455. t["\u309B"] = "\u0020\u3099";
  30456. t["\u309C"] = "\u0020\u309A";
  30457. t["\u3131"] = "\u1100";
  30458. t["\u3132"] = "\u1101";
  30459. t["\u3133"] = "\u11AA";
  30460. t["\u3134"] = "\u1102";
  30461. t["\u3135"] = "\u11AC";
  30462. t["\u3136"] = "\u11AD";
  30463. t["\u3137"] = "\u1103";
  30464. t["\u3138"] = "\u1104";
  30465. t["\u3139"] = "\u1105";
  30466. t["\u313A"] = "\u11B0";
  30467. t["\u313B"] = "\u11B1";
  30468. t["\u313C"] = "\u11B2";
  30469. t["\u313D"] = "\u11B3";
  30470. t["\u313E"] = "\u11B4";
  30471. t["\u313F"] = "\u11B5";
  30472. t["\u3140"] = "\u111A";
  30473. t["\u3141"] = "\u1106";
  30474. t["\u3142"] = "\u1107";
  30475. t["\u3143"] = "\u1108";
  30476. t["\u3144"] = "\u1121";
  30477. t["\u3145"] = "\u1109";
  30478. t["\u3146"] = "\u110A";
  30479. t["\u3147"] = "\u110B";
  30480. t["\u3148"] = "\u110C";
  30481. t["\u3149"] = "\u110D";
  30482. t["\u314A"] = "\u110E";
  30483. t["\u314B"] = "\u110F";
  30484. t["\u314C"] = "\u1110";
  30485. t["\u314D"] = "\u1111";
  30486. t["\u314E"] = "\u1112";
  30487. t["\u314F"] = "\u1161";
  30488. t["\u3150"] = "\u1162";
  30489. t["\u3151"] = "\u1163";
  30490. t["\u3152"] = "\u1164";
  30491. t["\u3153"] = "\u1165";
  30492. t["\u3154"] = "\u1166";
  30493. t["\u3155"] = "\u1167";
  30494. t["\u3156"] = "\u1168";
  30495. t["\u3157"] = "\u1169";
  30496. t["\u3158"] = "\u116A";
  30497. t["\u3159"] = "\u116B";
  30498. t["\u315A"] = "\u116C";
  30499. t["\u315B"] = "\u116D";
  30500. t["\u315C"] = "\u116E";
  30501. t["\u315D"] = "\u116F";
  30502. t["\u315E"] = "\u1170";
  30503. t["\u315F"] = "\u1171";
  30504. t["\u3160"] = "\u1172";
  30505. t["\u3161"] = "\u1173";
  30506. t["\u3162"] = "\u1174";
  30507. t["\u3163"] = "\u1175";
  30508. t["\u3164"] = "\u1160";
  30509. t["\u3165"] = "\u1114";
  30510. t["\u3166"] = "\u1115";
  30511. t["\u3167"] = "\u11C7";
  30512. t["\u3168"] = "\u11C8";
  30513. t["\u3169"] = "\u11CC";
  30514. t["\u316A"] = "\u11CE";
  30515. t["\u316B"] = "\u11D3";
  30516. t["\u316C"] = "\u11D7";
  30517. t["\u316D"] = "\u11D9";
  30518. t["\u316E"] = "\u111C";
  30519. t["\u316F"] = "\u11DD";
  30520. t["\u3170"] = "\u11DF";
  30521. t["\u3171"] = "\u111D";
  30522. t["\u3172"] = "\u111E";
  30523. t["\u3173"] = "\u1120";
  30524. t["\u3174"] = "\u1122";
  30525. t["\u3175"] = "\u1123";
  30526. t["\u3176"] = "\u1127";
  30527. t["\u3177"] = "\u1129";
  30528. t["\u3178"] = "\u112B";
  30529. t["\u3179"] = "\u112C";
  30530. t["\u317A"] = "\u112D";
  30531. t["\u317B"] = "\u112E";
  30532. t["\u317C"] = "\u112F";
  30533. t["\u317D"] = "\u1132";
  30534. t["\u317E"] = "\u1136";
  30535. t["\u317F"] = "\u1140";
  30536. t["\u3180"] = "\u1147";
  30537. t["\u3181"] = "\u114C";
  30538. t["\u3182"] = "\u11F1";
  30539. t["\u3183"] = "\u11F2";
  30540. t["\u3184"] = "\u1157";
  30541. t["\u3185"] = "\u1158";
  30542. t["\u3186"] = "\u1159";
  30543. t["\u3187"] = "\u1184";
  30544. t["\u3188"] = "\u1185";
  30545. t["\u3189"] = "\u1188";
  30546. t["\u318A"] = "\u1191";
  30547. t["\u318B"] = "\u1192";
  30548. t["\u318C"] = "\u1194";
  30549. t["\u318D"] = "\u119E";
  30550. t["\u318E"] = "\u11A1";
  30551. t["\u3200"] = "\u0028\u1100\u0029";
  30552. t["\u3201"] = "\u0028\u1102\u0029";
  30553. t["\u3202"] = "\u0028\u1103\u0029";
  30554. t["\u3203"] = "\u0028\u1105\u0029";
  30555. t["\u3204"] = "\u0028\u1106\u0029";
  30556. t["\u3205"] = "\u0028\u1107\u0029";
  30557. t["\u3206"] = "\u0028\u1109\u0029";
  30558. t["\u3207"] = "\u0028\u110B\u0029";
  30559. t["\u3208"] = "\u0028\u110C\u0029";
  30560. t["\u3209"] = "\u0028\u110E\u0029";
  30561. t["\u320A"] = "\u0028\u110F\u0029";
  30562. t["\u320B"] = "\u0028\u1110\u0029";
  30563. t["\u320C"] = "\u0028\u1111\u0029";
  30564. t["\u320D"] = "\u0028\u1112\u0029";
  30565. t["\u320E"] = "\u0028\u1100\u1161\u0029";
  30566. t["\u320F"] = "\u0028\u1102\u1161\u0029";
  30567. t["\u3210"] = "\u0028\u1103\u1161\u0029";
  30568. t["\u3211"] = "\u0028\u1105\u1161\u0029";
  30569. t["\u3212"] = "\u0028\u1106\u1161\u0029";
  30570. t["\u3213"] = "\u0028\u1107\u1161\u0029";
  30571. t["\u3214"] = "\u0028\u1109\u1161\u0029";
  30572. t["\u3215"] = "\u0028\u110B\u1161\u0029";
  30573. t["\u3216"] = "\u0028\u110C\u1161\u0029";
  30574. t["\u3217"] = "\u0028\u110E\u1161\u0029";
  30575. t["\u3218"] = "\u0028\u110F\u1161\u0029";
  30576. t["\u3219"] = "\u0028\u1110\u1161\u0029";
  30577. t["\u321A"] = "\u0028\u1111\u1161\u0029";
  30578. t["\u321B"] = "\u0028\u1112\u1161\u0029";
  30579. t["\u321C"] = "\u0028\u110C\u116E\u0029";
  30580. t["\u321D"] = "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029";
  30581. t["\u321E"] = "\u0028\u110B\u1169\u1112\u116E\u0029";
  30582. t["\u3220"] = "\u0028\u4E00\u0029";
  30583. t["\u3221"] = "\u0028\u4E8C\u0029";
  30584. t["\u3222"] = "\u0028\u4E09\u0029";
  30585. t["\u3223"] = "\u0028\u56DB\u0029";
  30586. t["\u3224"] = "\u0028\u4E94\u0029";
  30587. t["\u3225"] = "\u0028\u516D\u0029";
  30588. t["\u3226"] = "\u0028\u4E03\u0029";
  30589. t["\u3227"] = "\u0028\u516B\u0029";
  30590. t["\u3228"] = "\u0028\u4E5D\u0029";
  30591. t["\u3229"] = "\u0028\u5341\u0029";
  30592. t["\u322A"] = "\u0028\u6708\u0029";
  30593. t["\u322B"] = "\u0028\u706B\u0029";
  30594. t["\u322C"] = "\u0028\u6C34\u0029";
  30595. t["\u322D"] = "\u0028\u6728\u0029";
  30596. t["\u322E"] = "\u0028\u91D1\u0029";
  30597. t["\u322F"] = "\u0028\u571F\u0029";
  30598. t["\u3230"] = "\u0028\u65E5\u0029";
  30599. t["\u3231"] = "\u0028\u682A\u0029";
  30600. t["\u3232"] = "\u0028\u6709\u0029";
  30601. t["\u3233"] = "\u0028\u793E\u0029";
  30602. t["\u3234"] = "\u0028\u540D\u0029";
  30603. t["\u3235"] = "\u0028\u7279\u0029";
  30604. t["\u3236"] = "\u0028\u8CA1\u0029";
  30605. t["\u3237"] = "\u0028\u795D\u0029";
  30606. t["\u3238"] = "\u0028\u52B4\u0029";
  30607. t["\u3239"] = "\u0028\u4EE3\u0029";
  30608. t["\u323A"] = "\u0028\u547C\u0029";
  30609. t["\u323B"] = "\u0028\u5B66\u0029";
  30610. t["\u323C"] = "\u0028\u76E3\u0029";
  30611. t["\u323D"] = "\u0028\u4F01\u0029";
  30612. t["\u323E"] = "\u0028\u8CC7\u0029";
  30613. t["\u323F"] = "\u0028\u5354\u0029";
  30614. t["\u3240"] = "\u0028\u796D\u0029";
  30615. t["\u3241"] = "\u0028\u4F11\u0029";
  30616. t["\u3242"] = "\u0028\u81EA\u0029";
  30617. t["\u3243"] = "\u0028\u81F3\u0029";
  30618. t["\u32C0"] = "\u0031\u6708";
  30619. t["\u32C1"] = "\u0032\u6708";
  30620. t["\u32C2"] = "\u0033\u6708";
  30621. t["\u32C3"] = "\u0034\u6708";
  30622. t["\u32C4"] = "\u0035\u6708";
  30623. t["\u32C5"] = "\u0036\u6708";
  30624. t["\u32C6"] = "\u0037\u6708";
  30625. t["\u32C7"] = "\u0038\u6708";
  30626. t["\u32C8"] = "\u0039\u6708";
  30627. t["\u32C9"] = "\u0031\u0030\u6708";
  30628. t["\u32CA"] = "\u0031\u0031\u6708";
  30629. t["\u32CB"] = "\u0031\u0032\u6708";
  30630. t["\u3358"] = "\u0030\u70B9";
  30631. t["\u3359"] = "\u0031\u70B9";
  30632. t["\u335A"] = "\u0032\u70B9";
  30633. t["\u335B"] = "\u0033\u70B9";
  30634. t["\u335C"] = "\u0034\u70B9";
  30635. t["\u335D"] = "\u0035\u70B9";
  30636. t["\u335E"] = "\u0036\u70B9";
  30637. t["\u335F"] = "\u0037\u70B9";
  30638. t["\u3360"] = "\u0038\u70B9";
  30639. t["\u3361"] = "\u0039\u70B9";
  30640. t["\u3362"] = "\u0031\u0030\u70B9";
  30641. t["\u3363"] = "\u0031\u0031\u70B9";
  30642. t["\u3364"] = "\u0031\u0032\u70B9";
  30643. t["\u3365"] = "\u0031\u0033\u70B9";
  30644. t["\u3366"] = "\u0031\u0034\u70B9";
  30645. t["\u3367"] = "\u0031\u0035\u70B9";
  30646. t["\u3368"] = "\u0031\u0036\u70B9";
  30647. t["\u3369"] = "\u0031\u0037\u70B9";
  30648. t["\u336A"] = "\u0031\u0038\u70B9";
  30649. t["\u336B"] = "\u0031\u0039\u70B9";
  30650. t["\u336C"] = "\u0032\u0030\u70B9";
  30651. t["\u336D"] = "\u0032\u0031\u70B9";
  30652. t["\u336E"] = "\u0032\u0032\u70B9";
  30653. t["\u336F"] = "\u0032\u0033\u70B9";
  30654. t["\u3370"] = "\u0032\u0034\u70B9";
  30655. t["\u33E0"] = "\u0031\u65E5";
  30656. t["\u33E1"] = "\u0032\u65E5";
  30657. t["\u33E2"] = "\u0033\u65E5";
  30658. t["\u33E3"] = "\u0034\u65E5";
  30659. t["\u33E4"] = "\u0035\u65E5";
  30660. t["\u33E5"] = "\u0036\u65E5";
  30661. t["\u33E6"] = "\u0037\u65E5";
  30662. t["\u33E7"] = "\u0038\u65E5";
  30663. t["\u33E8"] = "\u0039\u65E5";
  30664. t["\u33E9"] = "\u0031\u0030\u65E5";
  30665. t["\u33EA"] = "\u0031\u0031\u65E5";
  30666. t["\u33EB"] = "\u0031\u0032\u65E5";
  30667. t["\u33EC"] = "\u0031\u0033\u65E5";
  30668. t["\u33ED"] = "\u0031\u0034\u65E5";
  30669. t["\u33EE"] = "\u0031\u0035\u65E5";
  30670. t["\u33EF"] = "\u0031\u0036\u65E5";
  30671. t["\u33F0"] = "\u0031\u0037\u65E5";
  30672. t["\u33F1"] = "\u0031\u0038\u65E5";
  30673. t["\u33F2"] = "\u0031\u0039\u65E5";
  30674. t["\u33F3"] = "\u0032\u0030\u65E5";
  30675. t["\u33F4"] = "\u0032\u0031\u65E5";
  30676. t["\u33F5"] = "\u0032\u0032\u65E5";
  30677. t["\u33F6"] = "\u0032\u0033\u65E5";
  30678. t["\u33F7"] = "\u0032\u0034\u65E5";
  30679. t["\u33F8"] = "\u0032\u0035\u65E5";
  30680. t["\u33F9"] = "\u0032\u0036\u65E5";
  30681. t["\u33FA"] = "\u0032\u0037\u65E5";
  30682. t["\u33FB"] = "\u0032\u0038\u65E5";
  30683. t["\u33FC"] = "\u0032\u0039\u65E5";
  30684. t["\u33FD"] = "\u0033\u0030\u65E5";
  30685. t["\u33FE"] = "\u0033\u0031\u65E5";
  30686. t["\uFB00"] = "\u0066\u0066";
  30687. t["\uFB01"] = "\u0066\u0069";
  30688. t["\uFB02"] = "\u0066\u006C";
  30689. t["\uFB03"] = "\u0066\u0066\u0069";
  30690. t["\uFB04"] = "\u0066\u0066\u006C";
  30691. t["\uFB05"] = "\u017F\u0074";
  30692. t["\uFB06"] = "\u0073\u0074";
  30693. t["\uFB13"] = "\u0574\u0576";
  30694. t["\uFB14"] = "\u0574\u0565";
  30695. t["\uFB15"] = "\u0574\u056B";
  30696. t["\uFB16"] = "\u057E\u0576";
  30697. t["\uFB17"] = "\u0574\u056D";
  30698. t["\uFB4F"] = "\u05D0\u05DC";
  30699. t["\uFB50"] = "\u0671";
  30700. t["\uFB51"] = "\u0671";
  30701. t["\uFB52"] = "\u067B";
  30702. t["\uFB53"] = "\u067B";
  30703. t["\uFB54"] = "\u067B";
  30704. t["\uFB55"] = "\u067B";
  30705. t["\uFB56"] = "\u067E";
  30706. t["\uFB57"] = "\u067E";
  30707. t["\uFB58"] = "\u067E";
  30708. t["\uFB59"] = "\u067E";
  30709. t["\uFB5A"] = "\u0680";
  30710. t["\uFB5B"] = "\u0680";
  30711. t["\uFB5C"] = "\u0680";
  30712. t["\uFB5D"] = "\u0680";
  30713. t["\uFB5E"] = "\u067A";
  30714. t["\uFB5F"] = "\u067A";
  30715. t["\uFB60"] = "\u067A";
  30716. t["\uFB61"] = "\u067A";
  30717. t["\uFB62"] = "\u067F";
  30718. t["\uFB63"] = "\u067F";
  30719. t["\uFB64"] = "\u067F";
  30720. t["\uFB65"] = "\u067F";
  30721. t["\uFB66"] = "\u0679";
  30722. t["\uFB67"] = "\u0679";
  30723. t["\uFB68"] = "\u0679";
  30724. t["\uFB69"] = "\u0679";
  30725. t["\uFB6A"] = "\u06A4";
  30726. t["\uFB6B"] = "\u06A4";
  30727. t["\uFB6C"] = "\u06A4";
  30728. t["\uFB6D"] = "\u06A4";
  30729. t["\uFB6E"] = "\u06A6";
  30730. t["\uFB6F"] = "\u06A6";
  30731. t["\uFB70"] = "\u06A6";
  30732. t["\uFB71"] = "\u06A6";
  30733. t["\uFB72"] = "\u0684";
  30734. t["\uFB73"] = "\u0684";
  30735. t["\uFB74"] = "\u0684";
  30736. t["\uFB75"] = "\u0684";
  30737. t["\uFB76"] = "\u0683";
  30738. t["\uFB77"] = "\u0683";
  30739. t["\uFB78"] = "\u0683";
  30740. t["\uFB79"] = "\u0683";
  30741. t["\uFB7A"] = "\u0686";
  30742. t["\uFB7B"] = "\u0686";
  30743. t["\uFB7C"] = "\u0686";
  30744. t["\uFB7D"] = "\u0686";
  30745. t["\uFB7E"] = "\u0687";
  30746. t["\uFB7F"] = "\u0687";
  30747. t["\uFB80"] = "\u0687";
  30748. t["\uFB81"] = "\u0687";
  30749. t["\uFB82"] = "\u068D";
  30750. t["\uFB83"] = "\u068D";
  30751. t["\uFB84"] = "\u068C";
  30752. t["\uFB85"] = "\u068C";
  30753. t["\uFB86"] = "\u068E";
  30754. t["\uFB87"] = "\u068E";
  30755. t["\uFB88"] = "\u0688";
  30756. t["\uFB89"] = "\u0688";
  30757. t["\uFB8A"] = "\u0698";
  30758. t["\uFB8B"] = "\u0698";
  30759. t["\uFB8C"] = "\u0691";
  30760. t["\uFB8D"] = "\u0691";
  30761. t["\uFB8E"] = "\u06A9";
  30762. t["\uFB8F"] = "\u06A9";
  30763. t["\uFB90"] = "\u06A9";
  30764. t["\uFB91"] = "\u06A9";
  30765. t["\uFB92"] = "\u06AF";
  30766. t["\uFB93"] = "\u06AF";
  30767. t["\uFB94"] = "\u06AF";
  30768. t["\uFB95"] = "\u06AF";
  30769. t["\uFB96"] = "\u06B3";
  30770. t["\uFB97"] = "\u06B3";
  30771. t["\uFB98"] = "\u06B3";
  30772. t["\uFB99"] = "\u06B3";
  30773. t["\uFB9A"] = "\u06B1";
  30774. t["\uFB9B"] = "\u06B1";
  30775. t["\uFB9C"] = "\u06B1";
  30776. t["\uFB9D"] = "\u06B1";
  30777. t["\uFB9E"] = "\u06BA";
  30778. t["\uFB9F"] = "\u06BA";
  30779. t["\uFBA0"] = "\u06BB";
  30780. t["\uFBA1"] = "\u06BB";
  30781. t["\uFBA2"] = "\u06BB";
  30782. t["\uFBA3"] = "\u06BB";
  30783. t["\uFBA4"] = "\u06C0";
  30784. t["\uFBA5"] = "\u06C0";
  30785. t["\uFBA6"] = "\u06C1";
  30786. t["\uFBA7"] = "\u06C1";
  30787. t["\uFBA8"] = "\u06C1";
  30788. t["\uFBA9"] = "\u06C1";
  30789. t["\uFBAA"] = "\u06BE";
  30790. t["\uFBAB"] = "\u06BE";
  30791. t["\uFBAC"] = "\u06BE";
  30792. t["\uFBAD"] = "\u06BE";
  30793. t["\uFBAE"] = "\u06D2";
  30794. t["\uFBAF"] = "\u06D2";
  30795. t["\uFBB0"] = "\u06D3";
  30796. t["\uFBB1"] = "\u06D3";
  30797. t["\uFBD3"] = "\u06AD";
  30798. t["\uFBD4"] = "\u06AD";
  30799. t["\uFBD5"] = "\u06AD";
  30800. t["\uFBD6"] = "\u06AD";
  30801. t["\uFBD7"] = "\u06C7";
  30802. t["\uFBD8"] = "\u06C7";
  30803. t["\uFBD9"] = "\u06C6";
  30804. t["\uFBDA"] = "\u06C6";
  30805. t["\uFBDB"] = "\u06C8";
  30806. t["\uFBDC"] = "\u06C8";
  30807. t["\uFBDD"] = "\u0677";
  30808. t["\uFBDE"] = "\u06CB";
  30809. t["\uFBDF"] = "\u06CB";
  30810. t["\uFBE0"] = "\u06C5";
  30811. t["\uFBE1"] = "\u06C5";
  30812. t["\uFBE2"] = "\u06C9";
  30813. t["\uFBE3"] = "\u06C9";
  30814. t["\uFBE4"] = "\u06D0";
  30815. t["\uFBE5"] = "\u06D0";
  30816. t["\uFBE6"] = "\u06D0";
  30817. t["\uFBE7"] = "\u06D0";
  30818. t["\uFBE8"] = "\u0649";
  30819. t["\uFBE9"] = "\u0649";
  30820. t["\uFBEA"] = "\u0626\u0627";
  30821. t["\uFBEB"] = "\u0626\u0627";
  30822. t["\uFBEC"] = "\u0626\u06D5";
  30823. t["\uFBED"] = "\u0626\u06D5";
  30824. t["\uFBEE"] = "\u0626\u0648";
  30825. t["\uFBEF"] = "\u0626\u0648";
  30826. t["\uFBF0"] = "\u0626\u06C7";
  30827. t["\uFBF1"] = "\u0626\u06C7";
  30828. t["\uFBF2"] = "\u0626\u06C6";
  30829. t["\uFBF3"] = "\u0626\u06C6";
  30830. t["\uFBF4"] = "\u0626\u06C8";
  30831. t["\uFBF5"] = "\u0626\u06C8";
  30832. t["\uFBF6"] = "\u0626\u06D0";
  30833. t["\uFBF7"] = "\u0626\u06D0";
  30834. t["\uFBF8"] = "\u0626\u06D0";
  30835. t["\uFBF9"] = "\u0626\u0649";
  30836. t["\uFBFA"] = "\u0626\u0649";
  30837. t["\uFBFB"] = "\u0626\u0649";
  30838. t["\uFBFC"] = "\u06CC";
  30839. t["\uFBFD"] = "\u06CC";
  30840. t["\uFBFE"] = "\u06CC";
  30841. t["\uFBFF"] = "\u06CC";
  30842. t["\uFC00"] = "\u0626\u062C";
  30843. t["\uFC01"] = "\u0626\u062D";
  30844. t["\uFC02"] = "\u0626\u0645";
  30845. t["\uFC03"] = "\u0626\u0649";
  30846. t["\uFC04"] = "\u0626\u064A";
  30847. t["\uFC05"] = "\u0628\u062C";
  30848. t["\uFC06"] = "\u0628\u062D";
  30849. t["\uFC07"] = "\u0628\u062E";
  30850. t["\uFC08"] = "\u0628\u0645";
  30851. t["\uFC09"] = "\u0628\u0649";
  30852. t["\uFC0A"] = "\u0628\u064A";
  30853. t["\uFC0B"] = "\u062A\u062C";
  30854. t["\uFC0C"] = "\u062A\u062D";
  30855. t["\uFC0D"] = "\u062A\u062E";
  30856. t["\uFC0E"] = "\u062A\u0645";
  30857. t["\uFC0F"] = "\u062A\u0649";
  30858. t["\uFC10"] = "\u062A\u064A";
  30859. t["\uFC11"] = "\u062B\u062C";
  30860. t["\uFC12"] = "\u062B\u0645";
  30861. t["\uFC13"] = "\u062B\u0649";
  30862. t["\uFC14"] = "\u062B\u064A";
  30863. t["\uFC15"] = "\u062C\u062D";
  30864. t["\uFC16"] = "\u062C\u0645";
  30865. t["\uFC17"] = "\u062D\u062C";
  30866. t["\uFC18"] = "\u062D\u0645";
  30867. t["\uFC19"] = "\u062E\u062C";
  30868. t["\uFC1A"] = "\u062E\u062D";
  30869. t["\uFC1B"] = "\u062E\u0645";
  30870. t["\uFC1C"] = "\u0633\u062C";
  30871. t["\uFC1D"] = "\u0633\u062D";
  30872. t["\uFC1E"] = "\u0633\u062E";
  30873. t["\uFC1F"] = "\u0633\u0645";
  30874. t["\uFC20"] = "\u0635\u062D";
  30875. t["\uFC21"] = "\u0635\u0645";
  30876. t["\uFC22"] = "\u0636\u062C";
  30877. t["\uFC23"] = "\u0636\u062D";
  30878. t["\uFC24"] = "\u0636\u062E";
  30879. t["\uFC25"] = "\u0636\u0645";
  30880. t["\uFC26"] = "\u0637\u062D";
  30881. t["\uFC27"] = "\u0637\u0645";
  30882. t["\uFC28"] = "\u0638\u0645";
  30883. t["\uFC29"] = "\u0639\u062C";
  30884. t["\uFC2A"] = "\u0639\u0645";
  30885. t["\uFC2B"] = "\u063A\u062C";
  30886. t["\uFC2C"] = "\u063A\u0645";
  30887. t["\uFC2D"] = "\u0641\u062C";
  30888. t["\uFC2E"] = "\u0641\u062D";
  30889. t["\uFC2F"] = "\u0641\u062E";
  30890. t["\uFC30"] = "\u0641\u0645";
  30891. t["\uFC31"] = "\u0641\u0649";
  30892. t["\uFC32"] = "\u0641\u064A";
  30893. t["\uFC33"] = "\u0642\u062D";
  30894. t["\uFC34"] = "\u0642\u0645";
  30895. t["\uFC35"] = "\u0642\u0649";
  30896. t["\uFC36"] = "\u0642\u064A";
  30897. t["\uFC37"] = "\u0643\u0627";
  30898. t["\uFC38"] = "\u0643\u062C";
  30899. t["\uFC39"] = "\u0643\u062D";
  30900. t["\uFC3A"] = "\u0643\u062E";
  30901. t["\uFC3B"] = "\u0643\u0644";
  30902. t["\uFC3C"] = "\u0643\u0645";
  30903. t["\uFC3D"] = "\u0643\u0649";
  30904. t["\uFC3E"] = "\u0643\u064A";
  30905. t["\uFC3F"] = "\u0644\u062C";
  30906. t["\uFC40"] = "\u0644\u062D";
  30907. t["\uFC41"] = "\u0644\u062E";
  30908. t["\uFC42"] = "\u0644\u0645";
  30909. t["\uFC43"] = "\u0644\u0649";
  30910. t["\uFC44"] = "\u0644\u064A";
  30911. t["\uFC45"] = "\u0645\u062C";
  30912. t["\uFC46"] = "\u0645\u062D";
  30913. t["\uFC47"] = "\u0645\u062E";
  30914. t["\uFC48"] = "\u0645\u0645";
  30915. t["\uFC49"] = "\u0645\u0649";
  30916. t["\uFC4A"] = "\u0645\u064A";
  30917. t["\uFC4B"] = "\u0646\u062C";
  30918. t["\uFC4C"] = "\u0646\u062D";
  30919. t["\uFC4D"] = "\u0646\u062E";
  30920. t["\uFC4E"] = "\u0646\u0645";
  30921. t["\uFC4F"] = "\u0646\u0649";
  30922. t["\uFC50"] = "\u0646\u064A";
  30923. t["\uFC51"] = "\u0647\u062C";
  30924. t["\uFC52"] = "\u0647\u0645";
  30925. t["\uFC53"] = "\u0647\u0649";
  30926. t["\uFC54"] = "\u0647\u064A";
  30927. t["\uFC55"] = "\u064A\u062C";
  30928. t["\uFC56"] = "\u064A\u062D";
  30929. t["\uFC57"] = "\u064A\u062E";
  30930. t["\uFC58"] = "\u064A\u0645";
  30931. t["\uFC59"] = "\u064A\u0649";
  30932. t["\uFC5A"] = "\u064A\u064A";
  30933. t["\uFC5B"] = "\u0630\u0670";
  30934. t["\uFC5C"] = "\u0631\u0670";
  30935. t["\uFC5D"] = "\u0649\u0670";
  30936. t["\uFC5E"] = "\u0020\u064C\u0651";
  30937. t["\uFC5F"] = "\u0020\u064D\u0651";
  30938. t["\uFC60"] = "\u0020\u064E\u0651";
  30939. t["\uFC61"] = "\u0020\u064F\u0651";
  30940. t["\uFC62"] = "\u0020\u0650\u0651";
  30941. t["\uFC63"] = "\u0020\u0651\u0670";
  30942. t["\uFC64"] = "\u0626\u0631";
  30943. t["\uFC65"] = "\u0626\u0632";
  30944. t["\uFC66"] = "\u0626\u0645";
  30945. t["\uFC67"] = "\u0626\u0646";
  30946. t["\uFC68"] = "\u0626\u0649";
  30947. t["\uFC69"] = "\u0626\u064A";
  30948. t["\uFC6A"] = "\u0628\u0631";
  30949. t["\uFC6B"] = "\u0628\u0632";
  30950. t["\uFC6C"] = "\u0628\u0645";
  30951. t["\uFC6D"] = "\u0628\u0646";
  30952. t["\uFC6E"] = "\u0628\u0649";
  30953. t["\uFC6F"] = "\u0628\u064A";
  30954. t["\uFC70"] = "\u062A\u0631";
  30955. t["\uFC71"] = "\u062A\u0632";
  30956. t["\uFC72"] = "\u062A\u0645";
  30957. t["\uFC73"] = "\u062A\u0646";
  30958. t["\uFC74"] = "\u062A\u0649";
  30959. t["\uFC75"] = "\u062A\u064A";
  30960. t["\uFC76"] = "\u062B\u0631";
  30961. t["\uFC77"] = "\u062B\u0632";
  30962. t["\uFC78"] = "\u062B\u0645";
  30963. t["\uFC79"] = "\u062B\u0646";
  30964. t["\uFC7A"] = "\u062B\u0649";
  30965. t["\uFC7B"] = "\u062B\u064A";
  30966. t["\uFC7C"] = "\u0641\u0649";
  30967. t["\uFC7D"] = "\u0641\u064A";
  30968. t["\uFC7E"] = "\u0642\u0649";
  30969. t["\uFC7F"] = "\u0642\u064A";
  30970. t["\uFC80"] = "\u0643\u0627";
  30971. t["\uFC81"] = "\u0643\u0644";
  30972. t["\uFC82"] = "\u0643\u0645";
  30973. t["\uFC83"] = "\u0643\u0649";
  30974. t["\uFC84"] = "\u0643\u064A";
  30975. t["\uFC85"] = "\u0644\u0645";
  30976. t["\uFC86"] = "\u0644\u0649";
  30977. t["\uFC87"] = "\u0644\u064A";
  30978. t["\uFC88"] = "\u0645\u0627";
  30979. t["\uFC89"] = "\u0645\u0645";
  30980. t["\uFC8A"] = "\u0646\u0631";
  30981. t["\uFC8B"] = "\u0646\u0632";
  30982. t["\uFC8C"] = "\u0646\u0645";
  30983. t["\uFC8D"] = "\u0646\u0646";
  30984. t["\uFC8E"] = "\u0646\u0649";
  30985. t["\uFC8F"] = "\u0646\u064A";
  30986. t["\uFC90"] = "\u0649\u0670";
  30987. t["\uFC91"] = "\u064A\u0631";
  30988. t["\uFC92"] = "\u064A\u0632";
  30989. t["\uFC93"] = "\u064A\u0645";
  30990. t["\uFC94"] = "\u064A\u0646";
  30991. t["\uFC95"] = "\u064A\u0649";
  30992. t["\uFC96"] = "\u064A\u064A";
  30993. t["\uFC97"] = "\u0626\u062C";
  30994. t["\uFC98"] = "\u0626\u062D";
  30995. t["\uFC99"] = "\u0626\u062E";
  30996. t["\uFC9A"] = "\u0626\u0645";
  30997. t["\uFC9B"] = "\u0626\u0647";
  30998. t["\uFC9C"] = "\u0628\u062C";
  30999. t["\uFC9D"] = "\u0628\u062D";
  31000. t["\uFC9E"] = "\u0628\u062E";
  31001. t["\uFC9F"] = "\u0628\u0645";
  31002. t["\uFCA0"] = "\u0628\u0647";
  31003. t["\uFCA1"] = "\u062A\u062C";
  31004. t["\uFCA2"] = "\u062A\u062D";
  31005. t["\uFCA3"] = "\u062A\u062E";
  31006. t["\uFCA4"] = "\u062A\u0645";
  31007. t["\uFCA5"] = "\u062A\u0647";
  31008. t["\uFCA6"] = "\u062B\u0645";
  31009. t["\uFCA7"] = "\u062C\u062D";
  31010. t["\uFCA8"] = "\u062C\u0645";
  31011. t["\uFCA9"] = "\u062D\u062C";
  31012. t["\uFCAA"] = "\u062D\u0645";
  31013. t["\uFCAB"] = "\u062E\u062C";
  31014. t["\uFCAC"] = "\u062E\u0645";
  31015. t["\uFCAD"] = "\u0633\u062C";
  31016. t["\uFCAE"] = "\u0633\u062D";
  31017. t["\uFCAF"] = "\u0633\u062E";
  31018. t["\uFCB0"] = "\u0633\u0645";
  31019. t["\uFCB1"] = "\u0635\u062D";
  31020. t["\uFCB2"] = "\u0635\u062E";
  31021. t["\uFCB3"] = "\u0635\u0645";
  31022. t["\uFCB4"] = "\u0636\u062C";
  31023. t["\uFCB5"] = "\u0636\u062D";
  31024. t["\uFCB6"] = "\u0636\u062E";
  31025. t["\uFCB7"] = "\u0636\u0645";
  31026. t["\uFCB8"] = "\u0637\u062D";
  31027. t["\uFCB9"] = "\u0638\u0645";
  31028. t["\uFCBA"] = "\u0639\u062C";
  31029. t["\uFCBB"] = "\u0639\u0645";
  31030. t["\uFCBC"] = "\u063A\u062C";
  31031. t["\uFCBD"] = "\u063A\u0645";
  31032. t["\uFCBE"] = "\u0641\u062C";
  31033. t["\uFCBF"] = "\u0641\u062D";
  31034. t["\uFCC0"] = "\u0641\u062E";
  31035. t["\uFCC1"] = "\u0641\u0645";
  31036. t["\uFCC2"] = "\u0642\u062D";
  31037. t["\uFCC3"] = "\u0642\u0645";
  31038. t["\uFCC4"] = "\u0643\u062C";
  31039. t["\uFCC5"] = "\u0643\u062D";
  31040. t["\uFCC6"] = "\u0643\u062E";
  31041. t["\uFCC7"] = "\u0643\u0644";
  31042. t["\uFCC8"] = "\u0643\u0645";
  31043. t["\uFCC9"] = "\u0644\u062C";
  31044. t["\uFCCA"] = "\u0644\u062D";
  31045. t["\uFCCB"] = "\u0644\u062E";
  31046. t["\uFCCC"] = "\u0644\u0645";
  31047. t["\uFCCD"] = "\u0644\u0647";
  31048. t["\uFCCE"] = "\u0645\u062C";
  31049. t["\uFCCF"] = "\u0645\u062D";
  31050. t["\uFCD0"] = "\u0645\u062E";
  31051. t["\uFCD1"] = "\u0645\u0645";
  31052. t["\uFCD2"] = "\u0646\u062C";
  31053. t["\uFCD3"] = "\u0646\u062D";
  31054. t["\uFCD4"] = "\u0646\u062E";
  31055. t["\uFCD5"] = "\u0646\u0645";
  31056. t["\uFCD6"] = "\u0646\u0647";
  31057. t["\uFCD7"] = "\u0647\u062C";
  31058. t["\uFCD8"] = "\u0647\u0645";
  31059. t["\uFCD9"] = "\u0647\u0670";
  31060. t["\uFCDA"] = "\u064A\u062C";
  31061. t["\uFCDB"] = "\u064A\u062D";
  31062. t["\uFCDC"] = "\u064A\u062E";
  31063. t["\uFCDD"] = "\u064A\u0645";
  31064. t["\uFCDE"] = "\u064A\u0647";
  31065. t["\uFCDF"] = "\u0626\u0645";
  31066. t["\uFCE0"] = "\u0626\u0647";
  31067. t["\uFCE1"] = "\u0628\u0645";
  31068. t["\uFCE2"] = "\u0628\u0647";
  31069. t["\uFCE3"] = "\u062A\u0645";
  31070. t["\uFCE4"] = "\u062A\u0647";
  31071. t["\uFCE5"] = "\u062B\u0645";
  31072. t["\uFCE6"] = "\u062B\u0647";
  31073. t["\uFCE7"] = "\u0633\u0645";
  31074. t["\uFCE8"] = "\u0633\u0647";
  31075. t["\uFCE9"] = "\u0634\u0645";
  31076. t["\uFCEA"] = "\u0634\u0647";
  31077. t["\uFCEB"] = "\u0643\u0644";
  31078. t["\uFCEC"] = "\u0643\u0645";
  31079. t["\uFCED"] = "\u0644\u0645";
  31080. t["\uFCEE"] = "\u0646\u0645";
  31081. t["\uFCEF"] = "\u0646\u0647";
  31082. t["\uFCF0"] = "\u064A\u0645";
  31083. t["\uFCF1"] = "\u064A\u0647";
  31084. t["\uFCF2"] = "\u0640\u064E\u0651";
  31085. t["\uFCF3"] = "\u0640\u064F\u0651";
  31086. t["\uFCF4"] = "\u0640\u0650\u0651";
  31087. t["\uFCF5"] = "\u0637\u0649";
  31088. t["\uFCF6"] = "\u0637\u064A";
  31089. t["\uFCF7"] = "\u0639\u0649";
  31090. t["\uFCF8"] = "\u0639\u064A";
  31091. t["\uFCF9"] = "\u063A\u0649";
  31092. t["\uFCFA"] = "\u063A\u064A";
  31093. t["\uFCFB"] = "\u0633\u0649";
  31094. t["\uFCFC"] = "\u0633\u064A";
  31095. t["\uFCFD"] = "\u0634\u0649";
  31096. t["\uFCFE"] = "\u0634\u064A";
  31097. t["\uFCFF"] = "\u062D\u0649";
  31098. t["\uFD00"] = "\u062D\u064A";
  31099. t["\uFD01"] = "\u062C\u0649";
  31100. t["\uFD02"] = "\u062C\u064A";
  31101. t["\uFD03"] = "\u062E\u0649";
  31102. t["\uFD04"] = "\u062E\u064A";
  31103. t["\uFD05"] = "\u0635\u0649";
  31104. t["\uFD06"] = "\u0635\u064A";
  31105. t["\uFD07"] = "\u0636\u0649";
  31106. t["\uFD08"] = "\u0636\u064A";
  31107. t["\uFD09"] = "\u0634\u062C";
  31108. t["\uFD0A"] = "\u0634\u062D";
  31109. t["\uFD0B"] = "\u0634\u062E";
  31110. t["\uFD0C"] = "\u0634\u0645";
  31111. t["\uFD0D"] = "\u0634\u0631";
  31112. t["\uFD0E"] = "\u0633\u0631";
  31113. t["\uFD0F"] = "\u0635\u0631";
  31114. t["\uFD10"] = "\u0636\u0631";
  31115. t["\uFD11"] = "\u0637\u0649";
  31116. t["\uFD12"] = "\u0637\u064A";
  31117. t["\uFD13"] = "\u0639\u0649";
  31118. t["\uFD14"] = "\u0639\u064A";
  31119. t["\uFD15"] = "\u063A\u0649";
  31120. t["\uFD16"] = "\u063A\u064A";
  31121. t["\uFD17"] = "\u0633\u0649";
  31122. t["\uFD18"] = "\u0633\u064A";
  31123. t["\uFD19"] = "\u0634\u0649";
  31124. t["\uFD1A"] = "\u0634\u064A";
  31125. t["\uFD1B"] = "\u062D\u0649";
  31126. t["\uFD1C"] = "\u062D\u064A";
  31127. t["\uFD1D"] = "\u062C\u0649";
  31128. t["\uFD1E"] = "\u062C\u064A";
  31129. t["\uFD1F"] = "\u062E\u0649";
  31130. t["\uFD20"] = "\u062E\u064A";
  31131. t["\uFD21"] = "\u0635\u0649";
  31132. t["\uFD22"] = "\u0635\u064A";
  31133. t["\uFD23"] = "\u0636\u0649";
  31134. t["\uFD24"] = "\u0636\u064A";
  31135. t["\uFD25"] = "\u0634\u062C";
  31136. t["\uFD26"] = "\u0634\u062D";
  31137. t["\uFD27"] = "\u0634\u062E";
  31138. t["\uFD28"] = "\u0634\u0645";
  31139. t["\uFD29"] = "\u0634\u0631";
  31140. t["\uFD2A"] = "\u0633\u0631";
  31141. t["\uFD2B"] = "\u0635\u0631";
  31142. t["\uFD2C"] = "\u0636\u0631";
  31143. t["\uFD2D"] = "\u0634\u062C";
  31144. t["\uFD2E"] = "\u0634\u062D";
  31145. t["\uFD2F"] = "\u0634\u062E";
  31146. t["\uFD30"] = "\u0634\u0645";
  31147. t["\uFD31"] = "\u0633\u0647";
  31148. t["\uFD32"] = "\u0634\u0647";
  31149. t["\uFD33"] = "\u0637\u0645";
  31150. t["\uFD34"] = "\u0633\u062C";
  31151. t["\uFD35"] = "\u0633\u062D";
  31152. t["\uFD36"] = "\u0633\u062E";
  31153. t["\uFD37"] = "\u0634\u062C";
  31154. t["\uFD38"] = "\u0634\u062D";
  31155. t["\uFD39"] = "\u0634\u062E";
  31156. t["\uFD3A"] = "\u0637\u0645";
  31157. t["\uFD3B"] = "\u0638\u0645";
  31158. t["\uFD3C"] = "\u0627\u064B";
  31159. t["\uFD3D"] = "\u0627\u064B";
  31160. t["\uFD50"] = "\u062A\u062C\u0645";
  31161. t["\uFD51"] = "\u062A\u062D\u062C";
  31162. t["\uFD52"] = "\u062A\u062D\u062C";
  31163. t["\uFD53"] = "\u062A\u062D\u0645";
  31164. t["\uFD54"] = "\u062A\u062E\u0645";
  31165. t["\uFD55"] = "\u062A\u0645\u062C";
  31166. t["\uFD56"] = "\u062A\u0645\u062D";
  31167. t["\uFD57"] = "\u062A\u0645\u062E";
  31168. t["\uFD58"] = "\u062C\u0645\u062D";
  31169. t["\uFD59"] = "\u062C\u0645\u062D";
  31170. t["\uFD5A"] = "\u062D\u0645\u064A";
  31171. t["\uFD5B"] = "\u062D\u0645\u0649";
  31172. t["\uFD5C"] = "\u0633\u062D\u062C";
  31173. t["\uFD5D"] = "\u0633\u062C\u062D";
  31174. t["\uFD5E"] = "\u0633\u062C\u0649";
  31175. t["\uFD5F"] = "\u0633\u0645\u062D";
  31176. t["\uFD60"] = "\u0633\u0645\u062D";
  31177. t["\uFD61"] = "\u0633\u0645\u062C";
  31178. t["\uFD62"] = "\u0633\u0645\u0645";
  31179. t["\uFD63"] = "\u0633\u0645\u0645";
  31180. t["\uFD64"] = "\u0635\u062D\u062D";
  31181. t["\uFD65"] = "\u0635\u062D\u062D";
  31182. t["\uFD66"] = "\u0635\u0645\u0645";
  31183. t["\uFD67"] = "\u0634\u062D\u0645";
  31184. t["\uFD68"] = "\u0634\u062D\u0645";
  31185. t["\uFD69"] = "\u0634\u062C\u064A";
  31186. t["\uFD6A"] = "\u0634\u0645\u062E";
  31187. t["\uFD6B"] = "\u0634\u0645\u062E";
  31188. t["\uFD6C"] = "\u0634\u0645\u0645";
  31189. t["\uFD6D"] = "\u0634\u0645\u0645";
  31190. t["\uFD6E"] = "\u0636\u062D\u0649";
  31191. t["\uFD6F"] = "\u0636\u062E\u0645";
  31192. t["\uFD70"] = "\u0636\u062E\u0645";
  31193. t["\uFD71"] = "\u0637\u0645\u062D";
  31194. t["\uFD72"] = "\u0637\u0645\u062D";
  31195. t["\uFD73"] = "\u0637\u0645\u0645";
  31196. t["\uFD74"] = "\u0637\u0645\u064A";
  31197. t["\uFD75"] = "\u0639\u062C\u0645";
  31198. t["\uFD76"] = "\u0639\u0645\u0645";
  31199. t["\uFD77"] = "\u0639\u0645\u0645";
  31200. t["\uFD78"] = "\u0639\u0645\u0649";
  31201. t["\uFD79"] = "\u063A\u0645\u0645";
  31202. t["\uFD7A"] = "\u063A\u0645\u064A";
  31203. t["\uFD7B"] = "\u063A\u0645\u0649";
  31204. t["\uFD7C"] = "\u0641\u062E\u0645";
  31205. t["\uFD7D"] = "\u0641\u062E\u0645";
  31206. t["\uFD7E"] = "\u0642\u0645\u062D";
  31207. t["\uFD7F"] = "\u0642\u0645\u0645";
  31208. t["\uFD80"] = "\u0644\u062D\u0645";
  31209. t["\uFD81"] = "\u0644\u062D\u064A";
  31210. t["\uFD82"] = "\u0644\u062D\u0649";
  31211. t["\uFD83"] = "\u0644\u062C\u062C";
  31212. t["\uFD84"] = "\u0644\u062C\u062C";
  31213. t["\uFD85"] = "\u0644\u062E\u0645";
  31214. t["\uFD86"] = "\u0644\u062E\u0645";
  31215. t["\uFD87"] = "\u0644\u0645\u062D";
  31216. t["\uFD88"] = "\u0644\u0645\u062D";
  31217. t["\uFD89"] = "\u0645\u062D\u062C";
  31218. t["\uFD8A"] = "\u0645\u062D\u0645";
  31219. t["\uFD8B"] = "\u0645\u062D\u064A";
  31220. t["\uFD8C"] = "\u0645\u062C\u062D";
  31221. t["\uFD8D"] = "\u0645\u062C\u0645";
  31222. t["\uFD8E"] = "\u0645\u062E\u062C";
  31223. t["\uFD8F"] = "\u0645\u062E\u0645";
  31224. t["\uFD92"] = "\u0645\u062C\u062E";
  31225. t["\uFD93"] = "\u0647\u0645\u062C";
  31226. t["\uFD94"] = "\u0647\u0645\u0645";
  31227. t["\uFD95"] = "\u0646\u062D\u0645";
  31228. t["\uFD96"] = "\u0646\u062D\u0649";
  31229. t["\uFD97"] = "\u0646\u062C\u0645";
  31230. t["\uFD98"] = "\u0646\u062C\u0645";
  31231. t["\uFD99"] = "\u0646\u062C\u0649";
  31232. t["\uFD9A"] = "\u0646\u0645\u064A";
  31233. t["\uFD9B"] = "\u0646\u0645\u0649";
  31234. t["\uFD9C"] = "\u064A\u0645\u0645";
  31235. t["\uFD9D"] = "\u064A\u0645\u0645";
  31236. t["\uFD9E"] = "\u0628\u062E\u064A";
  31237. t["\uFD9F"] = "\u062A\u062C\u064A";
  31238. t["\uFDA0"] = "\u062A\u062C\u0649";
  31239. t["\uFDA1"] = "\u062A\u062E\u064A";
  31240. t["\uFDA2"] = "\u062A\u062E\u0649";
  31241. t["\uFDA3"] = "\u062A\u0645\u064A";
  31242. t["\uFDA4"] = "\u062A\u0645\u0649";
  31243. t["\uFDA5"] = "\u062C\u0645\u064A";
  31244. t["\uFDA6"] = "\u062C\u062D\u0649";
  31245. t["\uFDA7"] = "\u062C\u0645\u0649";
  31246. t["\uFDA8"] = "\u0633\u062E\u0649";
  31247. t["\uFDA9"] = "\u0635\u062D\u064A";
  31248. t["\uFDAA"] = "\u0634\u062D\u064A";
  31249. t["\uFDAB"] = "\u0636\u062D\u064A";
  31250. t["\uFDAC"] = "\u0644\u062C\u064A";
  31251. t["\uFDAD"] = "\u0644\u0645\u064A";
  31252. t["\uFDAE"] = "\u064A\u062D\u064A";
  31253. t["\uFDAF"] = "\u064A\u062C\u064A";
  31254. t["\uFDB0"] = "\u064A\u0645\u064A";
  31255. t["\uFDB1"] = "\u0645\u0645\u064A";
  31256. t["\uFDB2"] = "\u0642\u0645\u064A";
  31257. t["\uFDB3"] = "\u0646\u062D\u064A";
  31258. t["\uFDB4"] = "\u0642\u0645\u062D";
  31259. t["\uFDB5"] = "\u0644\u062D\u0645";
  31260. t["\uFDB6"] = "\u0639\u0645\u064A";
  31261. t["\uFDB7"] = "\u0643\u0645\u064A";
  31262. t["\uFDB8"] = "\u0646\u062C\u062D";
  31263. t["\uFDB9"] = "\u0645\u062E\u064A";
  31264. t["\uFDBA"] = "\u0644\u062C\u0645";
  31265. t["\uFDBB"] = "\u0643\u0645\u0645";
  31266. t["\uFDBC"] = "\u0644\u062C\u0645";
  31267. t["\uFDBD"] = "\u0646\u062C\u062D";
  31268. t["\uFDBE"] = "\u062C\u062D\u064A";
  31269. t["\uFDBF"] = "\u062D\u062C\u064A";
  31270. t["\uFDC0"] = "\u0645\u062C\u064A";
  31271. t["\uFDC1"] = "\u0641\u0645\u064A";
  31272. t["\uFDC2"] = "\u0628\u062D\u064A";
  31273. t["\uFDC3"] = "\u0643\u0645\u0645";
  31274. t["\uFDC4"] = "\u0639\u062C\u0645";
  31275. t["\uFDC5"] = "\u0635\u0645\u0645";
  31276. t["\uFDC6"] = "\u0633\u062E\u064A";
  31277. t["\uFDC7"] = "\u0646\u062C\u064A";
  31278. t["\uFE49"] = "\u203E";
  31279. t["\uFE4A"] = "\u203E";
  31280. t["\uFE4B"] = "\u203E";
  31281. t["\uFE4C"] = "\u203E";
  31282. t["\uFE4D"] = "\u005F";
  31283. t["\uFE4E"] = "\u005F";
  31284. t["\uFE4F"] = "\u005F";
  31285. t["\uFE80"] = "\u0621";
  31286. t["\uFE81"] = "\u0622";
  31287. t["\uFE82"] = "\u0622";
  31288. t["\uFE83"] = "\u0623";
  31289. t["\uFE84"] = "\u0623";
  31290. t["\uFE85"] = "\u0624";
  31291. t["\uFE86"] = "\u0624";
  31292. t["\uFE87"] = "\u0625";
  31293. t["\uFE88"] = "\u0625";
  31294. t["\uFE89"] = "\u0626";
  31295. t["\uFE8A"] = "\u0626";
  31296. t["\uFE8B"] = "\u0626";
  31297. t["\uFE8C"] = "\u0626";
  31298. t["\uFE8D"] = "\u0627";
  31299. t["\uFE8E"] = "\u0627";
  31300. t["\uFE8F"] = "\u0628";
  31301. t["\uFE90"] = "\u0628";
  31302. t["\uFE91"] = "\u0628";
  31303. t["\uFE92"] = "\u0628";
  31304. t["\uFE93"] = "\u0629";
  31305. t["\uFE94"] = "\u0629";
  31306. t["\uFE95"] = "\u062A";
  31307. t["\uFE96"] = "\u062A";
  31308. t["\uFE97"] = "\u062A";
  31309. t["\uFE98"] = "\u062A";
  31310. t["\uFE99"] = "\u062B";
  31311. t["\uFE9A"] = "\u062B";
  31312. t["\uFE9B"] = "\u062B";
  31313. t["\uFE9C"] = "\u062B";
  31314. t["\uFE9D"] = "\u062C";
  31315. t["\uFE9E"] = "\u062C";
  31316. t["\uFE9F"] = "\u062C";
  31317. t["\uFEA0"] = "\u062C";
  31318. t["\uFEA1"] = "\u062D";
  31319. t["\uFEA2"] = "\u062D";
  31320. t["\uFEA3"] = "\u062D";
  31321. t["\uFEA4"] = "\u062D";
  31322. t["\uFEA5"] = "\u062E";
  31323. t["\uFEA6"] = "\u062E";
  31324. t["\uFEA7"] = "\u062E";
  31325. t["\uFEA8"] = "\u062E";
  31326. t["\uFEA9"] = "\u062F";
  31327. t["\uFEAA"] = "\u062F";
  31328. t["\uFEAB"] = "\u0630";
  31329. t["\uFEAC"] = "\u0630";
  31330. t["\uFEAD"] = "\u0631";
  31331. t["\uFEAE"] = "\u0631";
  31332. t["\uFEAF"] = "\u0632";
  31333. t["\uFEB0"] = "\u0632";
  31334. t["\uFEB1"] = "\u0633";
  31335. t["\uFEB2"] = "\u0633";
  31336. t["\uFEB3"] = "\u0633";
  31337. t["\uFEB4"] = "\u0633";
  31338. t["\uFEB5"] = "\u0634";
  31339. t["\uFEB6"] = "\u0634";
  31340. t["\uFEB7"] = "\u0634";
  31341. t["\uFEB8"] = "\u0634";
  31342. t["\uFEB9"] = "\u0635";
  31343. t["\uFEBA"] = "\u0635";
  31344. t["\uFEBB"] = "\u0635";
  31345. t["\uFEBC"] = "\u0635";
  31346. t["\uFEBD"] = "\u0636";
  31347. t["\uFEBE"] = "\u0636";
  31348. t["\uFEBF"] = "\u0636";
  31349. t["\uFEC0"] = "\u0636";
  31350. t["\uFEC1"] = "\u0637";
  31351. t["\uFEC2"] = "\u0637";
  31352. t["\uFEC3"] = "\u0637";
  31353. t["\uFEC4"] = "\u0637";
  31354. t["\uFEC5"] = "\u0638";
  31355. t["\uFEC6"] = "\u0638";
  31356. t["\uFEC7"] = "\u0638";
  31357. t["\uFEC8"] = "\u0638";
  31358. t["\uFEC9"] = "\u0639";
  31359. t["\uFECA"] = "\u0639";
  31360. t["\uFECB"] = "\u0639";
  31361. t["\uFECC"] = "\u0639";
  31362. t["\uFECD"] = "\u063A";
  31363. t["\uFECE"] = "\u063A";
  31364. t["\uFECF"] = "\u063A";
  31365. t["\uFED0"] = "\u063A";
  31366. t["\uFED1"] = "\u0641";
  31367. t["\uFED2"] = "\u0641";
  31368. t["\uFED3"] = "\u0641";
  31369. t["\uFED4"] = "\u0641";
  31370. t["\uFED5"] = "\u0642";
  31371. t["\uFED6"] = "\u0642";
  31372. t["\uFED7"] = "\u0642";
  31373. t["\uFED8"] = "\u0642";
  31374. t["\uFED9"] = "\u0643";
  31375. t["\uFEDA"] = "\u0643";
  31376. t["\uFEDB"] = "\u0643";
  31377. t["\uFEDC"] = "\u0643";
  31378. t["\uFEDD"] = "\u0644";
  31379. t["\uFEDE"] = "\u0644";
  31380. t["\uFEDF"] = "\u0644";
  31381. t["\uFEE0"] = "\u0644";
  31382. t["\uFEE1"] = "\u0645";
  31383. t["\uFEE2"] = "\u0645";
  31384. t["\uFEE3"] = "\u0645";
  31385. t["\uFEE4"] = "\u0645";
  31386. t["\uFEE5"] = "\u0646";
  31387. t["\uFEE6"] = "\u0646";
  31388. t["\uFEE7"] = "\u0646";
  31389. t["\uFEE8"] = "\u0646";
  31390. t["\uFEE9"] = "\u0647";
  31391. t["\uFEEA"] = "\u0647";
  31392. t["\uFEEB"] = "\u0647";
  31393. t["\uFEEC"] = "\u0647";
  31394. t["\uFEED"] = "\u0648";
  31395. t["\uFEEE"] = "\u0648";
  31396. t["\uFEEF"] = "\u0649";
  31397. t["\uFEF0"] = "\u0649";
  31398. t["\uFEF1"] = "\u064A";
  31399. t["\uFEF2"] = "\u064A";
  31400. t["\uFEF3"] = "\u064A";
  31401. t["\uFEF4"] = "\u064A";
  31402. t["\uFEF5"] = "\u0644\u0622";
  31403. t["\uFEF6"] = "\u0644\u0622";
  31404. t["\uFEF7"] = "\u0644\u0623";
  31405. t["\uFEF8"] = "\u0644\u0623";
  31406. t["\uFEF9"] = "\u0644\u0625";
  31407. t["\uFEFA"] = "\u0644\u0625";
  31408. t["\uFEFB"] = "\u0644\u0627";
  31409. t["\uFEFC"] = "\u0644\u0627";
  31410. });
  31411. function reverseIfRtl(chars) {
  31412. var charsLength = chars.length;
  31413. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  31414. return chars;
  31415. }
  31416. var s = "";
  31417. for (var ii = charsLength - 1; ii >= 0; ii--) {
  31418. s += chars[ii];
  31419. }
  31420. return s;
  31421. }
  31422. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  31423. exports.reverseIfRtl = reverseIfRtl;
  31424. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  31425. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  31426. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  31427. /***/ }),
  31428. /* 36 */
  31429. /***/ (function(module, exports, __w_pdfjs_require__) {
  31430. "use strict";
  31431. Object.defineProperty(exports, "__esModule", {
  31432. value: true
  31433. });
  31434. exports.FontRendererFactory = void 0;
  31435. var _util = __w_pdfjs_require__(2);
  31436. var _cff_parser = __w_pdfjs_require__(30);
  31437. var _glyphlist = __w_pdfjs_require__(33);
  31438. var _encodings = __w_pdfjs_require__(32);
  31439. var _stream = __w_pdfjs_require__(12);
  31440. var FontRendererFactory = function FontRendererFactoryClosure() {
  31441. function getLong(data, offset) {
  31442. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  31443. }
  31444. function getUshort(data, offset) {
  31445. return data[offset] << 8 | data[offset + 1];
  31446. }
  31447. function getSubroutineBias(subrs) {
  31448. const numSubrs = subrs.length;
  31449. let bias = 32768;
  31450. if (numSubrs < 1240) {
  31451. bias = 107;
  31452. } else if (numSubrs < 33900) {
  31453. bias = 1131;
  31454. }
  31455. return bias;
  31456. }
  31457. function parseCmap(data, start, end) {
  31458. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  31459. var format = getUshort(data, start + offset);
  31460. var ranges, p, i;
  31461. if (format === 4) {
  31462. getUshort(data, start + offset + 2);
  31463. var segCount = getUshort(data, start + offset + 6) >> 1;
  31464. p = start + offset + 14;
  31465. ranges = [];
  31466. for (i = 0; i < segCount; i++, p += 2) {
  31467. ranges[i] = {
  31468. end: getUshort(data, p)
  31469. };
  31470. }
  31471. p += 2;
  31472. for (i = 0; i < segCount; i++, p += 2) {
  31473. ranges[i].start = getUshort(data, p);
  31474. }
  31475. for (i = 0; i < segCount; i++, p += 2) {
  31476. ranges[i].idDelta = getUshort(data, p);
  31477. }
  31478. for (i = 0; i < segCount; i++, p += 2) {
  31479. var idOffset = getUshort(data, p);
  31480. if (idOffset === 0) {
  31481. continue;
  31482. }
  31483. ranges[i].ids = [];
  31484. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  31485. ranges[i].ids[j] = getUshort(data, p + idOffset);
  31486. idOffset += 2;
  31487. }
  31488. }
  31489. return ranges;
  31490. } else if (format === 12) {
  31491. getLong(data, start + offset + 4);
  31492. var groups = getLong(data, start + offset + 12);
  31493. p = start + offset + 16;
  31494. ranges = [];
  31495. for (i = 0; i < groups; i++) {
  31496. ranges.push({
  31497. start: getLong(data, p),
  31498. end: getLong(data, p + 4),
  31499. idDelta: getLong(data, p + 8) - getLong(data, p)
  31500. });
  31501. p += 12;
  31502. }
  31503. return ranges;
  31504. }
  31505. throw new _util.FormatError(`unsupported cmap: ${format}`);
  31506. }
  31507. function parseCff(data, start, end, seacAnalysisEnabled) {
  31508. var properties = {};
  31509. var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  31510. var cff = parser.parse();
  31511. return {
  31512. glyphs: cff.charStrings.objects,
  31513. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  31514. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  31515. isCFFCIDFont: cff.isCIDFont,
  31516. fdSelect: cff.fdSelect,
  31517. fdArray: cff.fdArray
  31518. };
  31519. }
  31520. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  31521. var itemSize, itemDecode;
  31522. if (isGlyphLocationsLong) {
  31523. itemSize = 4;
  31524. itemDecode = function fontItemDecodeLong(data, offset) {
  31525. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  31526. };
  31527. } else {
  31528. itemSize = 2;
  31529. itemDecode = function fontItemDecode(data, offset) {
  31530. return data[offset] << 9 | data[offset + 1] << 1;
  31531. };
  31532. }
  31533. var glyphs = [];
  31534. var startOffset = itemDecode(loca, 0);
  31535. for (var j = itemSize; j < loca.length; j += itemSize) {
  31536. var endOffset = itemDecode(loca, j);
  31537. glyphs.push(glyf.subarray(startOffset, endOffset));
  31538. startOffset = endOffset;
  31539. }
  31540. return glyphs;
  31541. }
  31542. function lookupCmap(ranges, unicode) {
  31543. var code = unicode.codePointAt(0),
  31544. gid = 0;
  31545. var l = 0,
  31546. r = ranges.length - 1;
  31547. while (l < r) {
  31548. var c = l + r + 1 >> 1;
  31549. if (code < ranges[c].start) {
  31550. r = c - 1;
  31551. } else {
  31552. l = c;
  31553. }
  31554. }
  31555. if (ranges[l].start <= code && code <= ranges[l].end) {
  31556. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  31557. }
  31558. return {
  31559. charCode: code,
  31560. glyphId: gid
  31561. };
  31562. }
  31563. function compileGlyf(code, cmds, font) {
  31564. function moveTo(x, y) {
  31565. cmds.push({
  31566. cmd: "moveTo",
  31567. args: [x, y]
  31568. });
  31569. }
  31570. function lineTo(x, y) {
  31571. cmds.push({
  31572. cmd: "lineTo",
  31573. args: [x, y]
  31574. });
  31575. }
  31576. function quadraticCurveTo(xa, ya, x, y) {
  31577. cmds.push({
  31578. cmd: "quadraticCurveTo",
  31579. args: [xa, ya, x, y]
  31580. });
  31581. }
  31582. var i = 0;
  31583. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  31584. var flags;
  31585. var x = 0,
  31586. y = 0;
  31587. i += 10;
  31588. if (numberOfContours < 0) {
  31589. do {
  31590. flags = code[i] << 8 | code[i + 1];
  31591. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  31592. i += 4;
  31593. var arg1, arg2;
  31594. if (flags & 0x01) {
  31595. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  31596. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  31597. i += 4;
  31598. } else {
  31599. arg1 = code[i++];
  31600. arg2 = code[i++];
  31601. }
  31602. if (flags & 0x02) {
  31603. x = arg1;
  31604. y = arg2;
  31605. } else {
  31606. x = 0;
  31607. y = 0;
  31608. }
  31609. var scaleX = 1,
  31610. scaleY = 1,
  31611. scale01 = 0,
  31612. scale10 = 0;
  31613. if (flags & 0x08) {
  31614. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  31615. i += 2;
  31616. } else if (flags & 0x40) {
  31617. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  31618. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  31619. i += 4;
  31620. } else if (flags & 0x80) {
  31621. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  31622. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  31623. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  31624. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  31625. i += 8;
  31626. }
  31627. var subglyph = font.glyphs[glyphIndex];
  31628. if (subglyph) {
  31629. cmds.push({
  31630. cmd: "save"
  31631. });
  31632. cmds.push({
  31633. cmd: "transform",
  31634. args: [scaleX, scale01, scale10, scaleY, x, y]
  31635. });
  31636. compileGlyf(subglyph, cmds, font);
  31637. cmds.push({
  31638. cmd: "restore"
  31639. });
  31640. }
  31641. } while (flags & 0x20);
  31642. } else {
  31643. var endPtsOfContours = [];
  31644. var j, jj;
  31645. for (j = 0; j < numberOfContours; j++) {
  31646. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  31647. i += 2;
  31648. }
  31649. var instructionLength = code[i] << 8 | code[i + 1];
  31650. i += 2 + instructionLength;
  31651. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  31652. var points = [];
  31653. while (points.length < numberOfPoints) {
  31654. flags = code[i++];
  31655. var repeat = 1;
  31656. if (flags & 0x08) {
  31657. repeat += code[i++];
  31658. }
  31659. while (repeat-- > 0) {
  31660. points.push({
  31661. flags
  31662. });
  31663. }
  31664. }
  31665. for (j = 0; j < numberOfPoints; j++) {
  31666. switch (points[j].flags & 0x12) {
  31667. case 0x00:
  31668. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  31669. i += 2;
  31670. break;
  31671. case 0x02:
  31672. x -= code[i++];
  31673. break;
  31674. case 0x12:
  31675. x += code[i++];
  31676. break;
  31677. }
  31678. points[j].x = x;
  31679. }
  31680. for (j = 0; j < numberOfPoints; j++) {
  31681. switch (points[j].flags & 0x24) {
  31682. case 0x00:
  31683. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  31684. i += 2;
  31685. break;
  31686. case 0x04:
  31687. y -= code[i++];
  31688. break;
  31689. case 0x24:
  31690. y += code[i++];
  31691. break;
  31692. }
  31693. points[j].y = y;
  31694. }
  31695. var startPoint = 0;
  31696. for (i = 0; i < numberOfContours; i++) {
  31697. var endPoint = endPtsOfContours[i];
  31698. var contour = points.slice(startPoint, endPoint + 1);
  31699. if (contour[0].flags & 1) {
  31700. contour.push(contour[0]);
  31701. } else if (contour[contour.length - 1].flags & 1) {
  31702. contour.unshift(contour[contour.length - 1]);
  31703. } else {
  31704. var p = {
  31705. flags: 1,
  31706. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  31707. y: (contour[0].y + contour[contour.length - 1].y) / 2
  31708. };
  31709. contour.unshift(p);
  31710. contour.push(p);
  31711. }
  31712. moveTo(contour[0].x, contour[0].y);
  31713. for (j = 1, jj = contour.length; j < jj; j++) {
  31714. if (contour[j].flags & 1) {
  31715. lineTo(contour[j].x, contour[j].y);
  31716. } else if (contour[j + 1].flags & 1) {
  31717. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  31718. j++;
  31719. } else {
  31720. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  31721. }
  31722. }
  31723. startPoint = endPoint + 1;
  31724. }
  31725. }
  31726. }
  31727. function compileCharString(charStringCode, cmds, font, glyphId) {
  31728. function moveTo(x, y) {
  31729. cmds.push({
  31730. cmd: "moveTo",
  31731. args: [x, y]
  31732. });
  31733. }
  31734. function lineTo(x, y) {
  31735. cmds.push({
  31736. cmd: "lineTo",
  31737. args: [x, y]
  31738. });
  31739. }
  31740. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  31741. cmds.push({
  31742. cmd: "bezierCurveTo",
  31743. args: [x1, y1, x2, y2, x, y]
  31744. });
  31745. }
  31746. var stack = [];
  31747. var x = 0,
  31748. y = 0;
  31749. var stems = 0;
  31750. function parse(code) {
  31751. var i = 0;
  31752. while (i < code.length) {
  31753. var stackClean = false;
  31754. var v = code[i++];
  31755. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  31756. switch (v) {
  31757. case 1:
  31758. stems += stack.length >> 1;
  31759. stackClean = true;
  31760. break;
  31761. case 3:
  31762. stems += stack.length >> 1;
  31763. stackClean = true;
  31764. break;
  31765. case 4:
  31766. y += stack.pop();
  31767. moveTo(x, y);
  31768. stackClean = true;
  31769. break;
  31770. case 5:
  31771. while (stack.length > 0) {
  31772. x += stack.shift();
  31773. y += stack.shift();
  31774. lineTo(x, y);
  31775. }
  31776. break;
  31777. case 6:
  31778. while (stack.length > 0) {
  31779. x += stack.shift();
  31780. lineTo(x, y);
  31781. if (stack.length === 0) {
  31782. break;
  31783. }
  31784. y += stack.shift();
  31785. lineTo(x, y);
  31786. }
  31787. break;
  31788. case 7:
  31789. while (stack.length > 0) {
  31790. y += stack.shift();
  31791. lineTo(x, y);
  31792. if (stack.length === 0) {
  31793. break;
  31794. }
  31795. x += stack.shift();
  31796. lineTo(x, y);
  31797. }
  31798. break;
  31799. case 8:
  31800. while (stack.length > 0) {
  31801. xa = x + stack.shift();
  31802. ya = y + stack.shift();
  31803. xb = xa + stack.shift();
  31804. yb = ya + stack.shift();
  31805. x = xb + stack.shift();
  31806. y = yb + stack.shift();
  31807. bezierCurveTo(xa, ya, xb, yb, x, y);
  31808. }
  31809. break;
  31810. case 10:
  31811. n = stack.pop();
  31812. subrCode = null;
  31813. if (font.isCFFCIDFont) {
  31814. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  31815. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  31816. const fontDict = font.fdArray[fdIndex];
  31817. let subrs;
  31818. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  31819. subrs = fontDict.privateDict.subrsIndex.objects;
  31820. }
  31821. if (subrs) {
  31822. n += getSubroutineBias(subrs);
  31823. subrCode = subrs[n];
  31824. }
  31825. } else {
  31826. (0, _util.warn)("Invalid fd index for glyph index.");
  31827. }
  31828. } else {
  31829. subrCode = font.subrs[n + font.subrsBias];
  31830. }
  31831. if (subrCode) {
  31832. parse(subrCode);
  31833. }
  31834. break;
  31835. case 11:
  31836. return;
  31837. case 12:
  31838. v = code[i++];
  31839. switch (v) {
  31840. case 34:
  31841. xa = x + stack.shift();
  31842. xb = xa + stack.shift();
  31843. y1 = y + stack.shift();
  31844. x = xb + stack.shift();
  31845. bezierCurveTo(xa, y, xb, y1, x, y1);
  31846. xa = x + stack.shift();
  31847. xb = xa + stack.shift();
  31848. x = xb + stack.shift();
  31849. bezierCurveTo(xa, y1, xb, y, x, y);
  31850. break;
  31851. case 35:
  31852. xa = x + stack.shift();
  31853. ya = y + stack.shift();
  31854. xb = xa + stack.shift();
  31855. yb = ya + stack.shift();
  31856. x = xb + stack.shift();
  31857. y = yb + stack.shift();
  31858. bezierCurveTo(xa, ya, xb, yb, x, y);
  31859. xa = x + stack.shift();
  31860. ya = y + stack.shift();
  31861. xb = xa + stack.shift();
  31862. yb = ya + stack.shift();
  31863. x = xb + stack.shift();
  31864. y = yb + stack.shift();
  31865. bezierCurveTo(xa, ya, xb, yb, x, y);
  31866. stack.pop();
  31867. break;
  31868. case 36:
  31869. xa = x + stack.shift();
  31870. y1 = y + stack.shift();
  31871. xb = xa + stack.shift();
  31872. y2 = y1 + stack.shift();
  31873. x = xb + stack.shift();
  31874. bezierCurveTo(xa, y1, xb, y2, x, y2);
  31875. xa = x + stack.shift();
  31876. xb = xa + stack.shift();
  31877. y3 = y2 + stack.shift();
  31878. x = xb + stack.shift();
  31879. bezierCurveTo(xa, y2, xb, y3, x, y);
  31880. break;
  31881. case 37:
  31882. var x0 = x,
  31883. y0 = y;
  31884. xa = x + stack.shift();
  31885. ya = y + stack.shift();
  31886. xb = xa + stack.shift();
  31887. yb = ya + stack.shift();
  31888. x = xb + stack.shift();
  31889. y = yb + stack.shift();
  31890. bezierCurveTo(xa, ya, xb, yb, x, y);
  31891. xa = x + stack.shift();
  31892. ya = y + stack.shift();
  31893. xb = xa + stack.shift();
  31894. yb = ya + stack.shift();
  31895. x = xb;
  31896. y = yb;
  31897. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  31898. x += stack.shift();
  31899. } else {
  31900. y += stack.shift();
  31901. }
  31902. bezierCurveTo(xa, ya, xb, yb, x, y);
  31903. break;
  31904. default:
  31905. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  31906. }
  31907. break;
  31908. case 14:
  31909. if (stack.length >= 4) {
  31910. var achar = stack.pop();
  31911. var bchar = stack.pop();
  31912. y = stack.pop();
  31913. x = stack.pop();
  31914. cmds.push({
  31915. cmd: "save"
  31916. });
  31917. cmds.push({
  31918. cmd: "translate",
  31919. args: [x, y]
  31920. });
  31921. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  31922. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  31923. cmds.push({
  31924. cmd: "restore"
  31925. });
  31926. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  31927. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  31928. }
  31929. return;
  31930. case 18:
  31931. stems += stack.length >> 1;
  31932. stackClean = true;
  31933. break;
  31934. case 19:
  31935. stems += stack.length >> 1;
  31936. i += stems + 7 >> 3;
  31937. stackClean = true;
  31938. break;
  31939. case 20:
  31940. stems += stack.length >> 1;
  31941. i += stems + 7 >> 3;
  31942. stackClean = true;
  31943. break;
  31944. case 21:
  31945. y += stack.pop();
  31946. x += stack.pop();
  31947. moveTo(x, y);
  31948. stackClean = true;
  31949. break;
  31950. case 22:
  31951. x += stack.pop();
  31952. moveTo(x, y);
  31953. stackClean = true;
  31954. break;
  31955. case 23:
  31956. stems += stack.length >> 1;
  31957. stackClean = true;
  31958. break;
  31959. case 24:
  31960. while (stack.length > 2) {
  31961. xa = x + stack.shift();
  31962. ya = y + stack.shift();
  31963. xb = xa + stack.shift();
  31964. yb = ya + stack.shift();
  31965. x = xb + stack.shift();
  31966. y = yb + stack.shift();
  31967. bezierCurveTo(xa, ya, xb, yb, x, y);
  31968. }
  31969. x += stack.shift();
  31970. y += stack.shift();
  31971. lineTo(x, y);
  31972. break;
  31973. case 25:
  31974. while (stack.length > 6) {
  31975. x += stack.shift();
  31976. y += stack.shift();
  31977. lineTo(x, y);
  31978. }
  31979. xa = x + stack.shift();
  31980. ya = y + stack.shift();
  31981. xb = xa + stack.shift();
  31982. yb = ya + stack.shift();
  31983. x = xb + stack.shift();
  31984. y = yb + stack.shift();
  31985. bezierCurveTo(xa, ya, xb, yb, x, y);
  31986. break;
  31987. case 26:
  31988. if (stack.length % 2) {
  31989. x += stack.shift();
  31990. }
  31991. while (stack.length > 0) {
  31992. xa = x;
  31993. ya = y + stack.shift();
  31994. xb = xa + stack.shift();
  31995. yb = ya + stack.shift();
  31996. x = xb;
  31997. y = yb + stack.shift();
  31998. bezierCurveTo(xa, ya, xb, yb, x, y);
  31999. }
  32000. break;
  32001. case 27:
  32002. if (stack.length % 2) {
  32003. y += stack.shift();
  32004. }
  32005. while (stack.length > 0) {
  32006. xa = x + stack.shift();
  32007. ya = y;
  32008. xb = xa + stack.shift();
  32009. yb = ya + stack.shift();
  32010. x = xb + stack.shift();
  32011. y = yb;
  32012. bezierCurveTo(xa, ya, xb, yb, x, y);
  32013. }
  32014. break;
  32015. case 28:
  32016. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  32017. i += 2;
  32018. break;
  32019. case 29:
  32020. n = stack.pop() + font.gsubrsBias;
  32021. subrCode = font.gsubrs[n];
  32022. if (subrCode) {
  32023. parse(subrCode);
  32024. }
  32025. break;
  32026. case 30:
  32027. while (stack.length > 0) {
  32028. xa = x;
  32029. ya = y + stack.shift();
  32030. xb = xa + stack.shift();
  32031. yb = ya + stack.shift();
  32032. x = xb + stack.shift();
  32033. y = yb + (stack.length === 1 ? stack.shift() : 0);
  32034. bezierCurveTo(xa, ya, xb, yb, x, y);
  32035. if (stack.length === 0) {
  32036. break;
  32037. }
  32038. xa = x + stack.shift();
  32039. ya = y;
  32040. xb = xa + stack.shift();
  32041. yb = ya + stack.shift();
  32042. y = yb + stack.shift();
  32043. x = xb + (stack.length === 1 ? stack.shift() : 0);
  32044. bezierCurveTo(xa, ya, xb, yb, x, y);
  32045. }
  32046. break;
  32047. case 31:
  32048. while (stack.length > 0) {
  32049. xa = x + stack.shift();
  32050. ya = y;
  32051. xb = xa + stack.shift();
  32052. yb = ya + stack.shift();
  32053. y = yb + stack.shift();
  32054. x = xb + (stack.length === 1 ? stack.shift() : 0);
  32055. bezierCurveTo(xa, ya, xb, yb, x, y);
  32056. if (stack.length === 0) {
  32057. break;
  32058. }
  32059. xa = x;
  32060. ya = y + stack.shift();
  32061. xb = xa + stack.shift();
  32062. yb = ya + stack.shift();
  32063. x = xb + stack.shift();
  32064. y = yb + (stack.length === 1 ? stack.shift() : 0);
  32065. bezierCurveTo(xa, ya, xb, yb, x, y);
  32066. }
  32067. break;
  32068. default:
  32069. if (v < 32) {
  32070. throw new _util.FormatError(`unknown operator: ${v}`);
  32071. }
  32072. if (v < 247) {
  32073. stack.push(v - 139);
  32074. } else if (v < 251) {
  32075. stack.push((v - 247) * 256 + code[i++] + 108);
  32076. } else if (v < 255) {
  32077. stack.push(-(v - 251) * 256 - code[i++] - 108);
  32078. } else {
  32079. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  32080. i += 4;
  32081. }
  32082. break;
  32083. }
  32084. if (stackClean) {
  32085. stack.length = 0;
  32086. }
  32087. }
  32088. }
  32089. parse(charStringCode);
  32090. }
  32091. const NOOP = [];
  32092. class CompiledFont {
  32093. constructor(fontMatrix) {
  32094. if (this.constructor === CompiledFont) {
  32095. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  32096. }
  32097. this.fontMatrix = fontMatrix;
  32098. this.compiledGlyphs = Object.create(null);
  32099. this.compiledCharCodeToGlyphId = Object.create(null);
  32100. }
  32101. getPathJs(unicode) {
  32102. const cmap = lookupCmap(this.cmap, unicode);
  32103. let fn = this.compiledGlyphs[cmap.glyphId];
  32104. if (!fn) {
  32105. fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
  32106. this.compiledGlyphs[cmap.glyphId] = fn;
  32107. }
  32108. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  32109. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  32110. }
  32111. return fn;
  32112. }
  32113. compileGlyph(code, glyphId) {
  32114. if (!code || code.length === 0 || code[0] === 14) {
  32115. return NOOP;
  32116. }
  32117. let fontMatrix = this.fontMatrix;
  32118. if (this.isCFFCIDFont) {
  32119. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  32120. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  32121. const fontDict = this.fdArray[fdIndex];
  32122. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  32123. } else {
  32124. (0, _util.warn)("Invalid fd index for glyph index.");
  32125. }
  32126. }
  32127. const cmds = [];
  32128. cmds.push({
  32129. cmd: "save"
  32130. });
  32131. cmds.push({
  32132. cmd: "transform",
  32133. args: fontMatrix.slice()
  32134. });
  32135. cmds.push({
  32136. cmd: "scale",
  32137. args: ["size", "-size"]
  32138. });
  32139. this.compileGlyphImpl(code, cmds, glyphId);
  32140. cmds.push({
  32141. cmd: "restore"
  32142. });
  32143. return cmds;
  32144. }
  32145. compileGlyphImpl() {
  32146. (0, _util.unreachable)("Children classes should implement this.");
  32147. }
  32148. hasBuiltPath(unicode) {
  32149. const cmap = lookupCmap(this.cmap, unicode);
  32150. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  32151. }
  32152. }
  32153. class TrueTypeCompiled extends CompiledFont {
  32154. constructor(glyphs, cmap, fontMatrix) {
  32155. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  32156. this.glyphs = glyphs;
  32157. this.cmap = cmap;
  32158. }
  32159. compileGlyphImpl(code, cmds) {
  32160. compileGlyf(code, cmds, this);
  32161. }
  32162. }
  32163. class Type2Compiled extends CompiledFont {
  32164. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  32165. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  32166. this.glyphs = cffInfo.glyphs;
  32167. this.gsubrs = cffInfo.gsubrs || [];
  32168. this.subrs = cffInfo.subrs || [];
  32169. this.cmap = cmap;
  32170. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  32171. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  32172. this.subrsBias = getSubroutineBias(this.subrs);
  32173. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  32174. this.fdSelect = cffInfo.fdSelect;
  32175. this.fdArray = cffInfo.fdArray;
  32176. }
  32177. compileGlyphImpl(code, cmds, glyphId) {
  32178. compileCharString(code, cmds, this, glyphId);
  32179. }
  32180. }
  32181. return {
  32182. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  32183. var data = new Uint8Array(font.data);
  32184. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  32185. var numTables = getUshort(data, 4);
  32186. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  32187. var tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  32188. var offset = getLong(data, p + 8);
  32189. var length = getLong(data, p + 12);
  32190. switch (tag) {
  32191. case "cmap":
  32192. cmap = parseCmap(data, offset, offset + length);
  32193. break;
  32194. case "glyf":
  32195. glyf = data.subarray(offset, offset + length);
  32196. break;
  32197. case "loca":
  32198. loca = data.subarray(offset, offset + length);
  32199. break;
  32200. case "head":
  32201. unitsPerEm = getUshort(data, offset + 18);
  32202. indexToLocFormat = getUshort(data, offset + 50);
  32203. break;
  32204. case "CFF ":
  32205. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  32206. break;
  32207. }
  32208. }
  32209. if (glyf) {
  32210. var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  32211. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  32212. }
  32213. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  32214. }
  32215. };
  32216. }();
  32217. exports.FontRendererFactory = FontRendererFactory;
  32218. /***/ }),
  32219. /* 37 */
  32220. /***/ (function(module, exports, __w_pdfjs_require__) {
  32221. "use strict";
  32222. Object.defineProperty(exports, "__esModule", {
  32223. value: true
  32224. });
  32225. exports.Type1Parser = void 0;
  32226. var _encodings = __w_pdfjs_require__(32);
  32227. var _core_utils = __w_pdfjs_require__(8);
  32228. var _stream = __w_pdfjs_require__(12);
  32229. var _util = __w_pdfjs_require__(2);
  32230. var HINTING_ENABLED = false;
  32231. var Type1CharString = function Type1CharStringClosure() {
  32232. var COMMAND_MAP = {
  32233. hstem: [1],
  32234. vstem: [3],
  32235. vmoveto: [4],
  32236. rlineto: [5],
  32237. hlineto: [6],
  32238. vlineto: [7],
  32239. rrcurveto: [8],
  32240. callsubr: [10],
  32241. flex: [12, 35],
  32242. drop: [12, 18],
  32243. endchar: [14],
  32244. rmoveto: [21],
  32245. hmoveto: [22],
  32246. vhcurveto: [30],
  32247. hvcurveto: [31]
  32248. };
  32249. function Type1CharString() {
  32250. this.width = 0;
  32251. this.lsb = 0;
  32252. this.flexing = false;
  32253. this.output = [];
  32254. this.stack = [];
  32255. }
  32256. Type1CharString.prototype = {
  32257. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  32258. var count = encoded.length;
  32259. var error = false;
  32260. var wx, sbx, subrNumber;
  32261. for (var i = 0; i < count; i++) {
  32262. var value = encoded[i];
  32263. if (value < 32) {
  32264. if (value === 12) {
  32265. value = (value << 8) + encoded[++i];
  32266. }
  32267. switch (value) {
  32268. case 1:
  32269. if (!HINTING_ENABLED) {
  32270. this.stack = [];
  32271. break;
  32272. }
  32273. error = this.executeCommand(2, COMMAND_MAP.hstem);
  32274. break;
  32275. case 3:
  32276. if (!HINTING_ENABLED) {
  32277. this.stack = [];
  32278. break;
  32279. }
  32280. error = this.executeCommand(2, COMMAND_MAP.vstem);
  32281. break;
  32282. case 4:
  32283. if (this.flexing) {
  32284. if (this.stack.length < 1) {
  32285. error = true;
  32286. break;
  32287. }
  32288. var dy = this.stack.pop();
  32289. this.stack.push(0, dy);
  32290. break;
  32291. }
  32292. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  32293. break;
  32294. case 5:
  32295. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  32296. break;
  32297. case 6:
  32298. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  32299. break;
  32300. case 7:
  32301. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  32302. break;
  32303. case 8:
  32304. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  32305. break;
  32306. case 9:
  32307. this.stack = [];
  32308. break;
  32309. case 10:
  32310. if (this.stack.length < 1) {
  32311. error = true;
  32312. break;
  32313. }
  32314. subrNumber = this.stack.pop();
  32315. if (!subrs[subrNumber]) {
  32316. error = true;
  32317. break;
  32318. }
  32319. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  32320. break;
  32321. case 11:
  32322. return error;
  32323. case 13:
  32324. if (this.stack.length < 2) {
  32325. error = true;
  32326. break;
  32327. }
  32328. wx = this.stack.pop();
  32329. sbx = this.stack.pop();
  32330. this.lsb = sbx;
  32331. this.width = wx;
  32332. this.stack.push(wx, sbx);
  32333. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  32334. break;
  32335. case 14:
  32336. this.output.push(COMMAND_MAP.endchar[0]);
  32337. break;
  32338. case 21:
  32339. if (this.flexing) {
  32340. break;
  32341. }
  32342. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  32343. break;
  32344. case 22:
  32345. if (this.flexing) {
  32346. this.stack.push(0);
  32347. break;
  32348. }
  32349. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  32350. break;
  32351. case 30:
  32352. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  32353. break;
  32354. case 31:
  32355. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  32356. break;
  32357. case (12 << 8) + 0:
  32358. this.stack = [];
  32359. break;
  32360. case (12 << 8) + 1:
  32361. if (!HINTING_ENABLED) {
  32362. this.stack = [];
  32363. break;
  32364. }
  32365. error = this.executeCommand(2, COMMAND_MAP.vstem);
  32366. break;
  32367. case (12 << 8) + 2:
  32368. if (!HINTING_ENABLED) {
  32369. this.stack = [];
  32370. break;
  32371. }
  32372. error = this.executeCommand(2, COMMAND_MAP.hstem);
  32373. break;
  32374. case (12 << 8) + 6:
  32375. if (seacAnalysisEnabled) {
  32376. this.seac = this.stack.splice(-4, 4);
  32377. error = this.executeCommand(0, COMMAND_MAP.endchar);
  32378. } else {
  32379. error = this.executeCommand(4, COMMAND_MAP.endchar);
  32380. }
  32381. break;
  32382. case (12 << 8) + 7:
  32383. if (this.stack.length < 4) {
  32384. error = true;
  32385. break;
  32386. }
  32387. this.stack.pop();
  32388. wx = this.stack.pop();
  32389. var sby = this.stack.pop();
  32390. sbx = this.stack.pop();
  32391. this.lsb = sbx;
  32392. this.width = wx;
  32393. this.stack.push(wx, sbx, sby);
  32394. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  32395. break;
  32396. case (12 << 8) + 12:
  32397. if (this.stack.length < 2) {
  32398. error = true;
  32399. break;
  32400. }
  32401. var num2 = this.stack.pop();
  32402. var num1 = this.stack.pop();
  32403. this.stack.push(num1 / num2);
  32404. break;
  32405. case (12 << 8) + 16:
  32406. if (this.stack.length < 2) {
  32407. error = true;
  32408. break;
  32409. }
  32410. subrNumber = this.stack.pop();
  32411. var numArgs = this.stack.pop();
  32412. if (subrNumber === 0 && numArgs === 3) {
  32413. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  32414. 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]);
  32415. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  32416. this.flexing = false;
  32417. this.stack.push(flexArgs[15], flexArgs[16]);
  32418. } else if (subrNumber === 1 && numArgs === 0) {
  32419. this.flexing = true;
  32420. }
  32421. break;
  32422. case (12 << 8) + 17:
  32423. break;
  32424. case (12 << 8) + 33:
  32425. this.stack = [];
  32426. break;
  32427. default:
  32428. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  32429. break;
  32430. }
  32431. if (error) {
  32432. break;
  32433. }
  32434. continue;
  32435. } else if (value <= 246) {
  32436. value = value - 139;
  32437. } else if (value <= 250) {
  32438. value = (value - 247) * 256 + encoded[++i] + 108;
  32439. } else if (value <= 254) {
  32440. value = -((value - 251) * 256) - encoded[++i] - 108;
  32441. } else {
  32442. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  32443. }
  32444. this.stack.push(value);
  32445. }
  32446. return error;
  32447. },
  32448. executeCommand(howManyArgs, command, keepStack) {
  32449. var stackLength = this.stack.length;
  32450. if (howManyArgs > stackLength) {
  32451. return true;
  32452. }
  32453. var start = stackLength - howManyArgs;
  32454. for (var i = start; i < stackLength; i++) {
  32455. var value = this.stack[i];
  32456. if (Number.isInteger(value)) {
  32457. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  32458. } else {
  32459. value = 65536 * value | 0;
  32460. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  32461. }
  32462. }
  32463. this.output.push.apply(this.output, command);
  32464. if (keepStack) {
  32465. this.stack.splice(start, howManyArgs);
  32466. } else {
  32467. this.stack.length = 0;
  32468. }
  32469. return false;
  32470. }
  32471. };
  32472. return Type1CharString;
  32473. }();
  32474. var Type1Parser = function Type1ParserClosure() {
  32475. var EEXEC_ENCRYPT_KEY = 55665;
  32476. var CHAR_STRS_ENCRYPT_KEY = 4330;
  32477. function isHexDigit(code) {
  32478. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  32479. }
  32480. function decrypt(data, key, discardNumber) {
  32481. if (discardNumber >= data.length) {
  32482. return new Uint8Array(0);
  32483. }
  32484. var r = key | 0,
  32485. c1 = 52845,
  32486. c2 = 22719,
  32487. i,
  32488. j;
  32489. for (i = 0; i < discardNumber; i++) {
  32490. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  32491. }
  32492. var count = data.length - discardNumber;
  32493. var decrypted = new Uint8Array(count);
  32494. for (i = discardNumber, j = 0; j < count; i++, j++) {
  32495. var value = data[i];
  32496. decrypted[j] = value ^ r >> 8;
  32497. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  32498. }
  32499. return decrypted;
  32500. }
  32501. function decryptAscii(data, key, discardNumber) {
  32502. var r = key | 0,
  32503. c1 = 52845,
  32504. c2 = 22719;
  32505. var count = data.length,
  32506. maybeLength = count >>> 1;
  32507. var decrypted = new Uint8Array(maybeLength);
  32508. var i, j;
  32509. for (i = 0, j = 0; i < count; i++) {
  32510. var digit1 = data[i];
  32511. if (!isHexDigit(digit1)) {
  32512. continue;
  32513. }
  32514. i++;
  32515. var digit2;
  32516. while (i < count && !isHexDigit(digit2 = data[i])) {
  32517. i++;
  32518. }
  32519. if (i < count) {
  32520. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  32521. decrypted[j++] = value ^ r >> 8;
  32522. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  32523. }
  32524. }
  32525. return decrypted.slice(discardNumber, j);
  32526. }
  32527. function isSpecial(c) {
  32528. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  32529. }
  32530. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  32531. if (encrypted) {
  32532. var data = stream.getBytes();
  32533. var 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]));
  32534. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  32535. }
  32536. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  32537. this.stream = stream;
  32538. this.nextChar();
  32539. }
  32540. Type1Parser.prototype = {
  32541. readNumberArray: function Type1Parser_readNumberArray() {
  32542. this.getToken();
  32543. var array = [];
  32544. while (true) {
  32545. var token = this.getToken();
  32546. if (token === null || token === "]" || token === "}") {
  32547. break;
  32548. }
  32549. array.push(parseFloat(token || 0));
  32550. }
  32551. return array;
  32552. },
  32553. readNumber: function Type1Parser_readNumber() {
  32554. var token = this.getToken();
  32555. return parseFloat(token || 0);
  32556. },
  32557. readInt: function Type1Parser_readInt() {
  32558. var token = this.getToken();
  32559. return parseInt(token || 0, 10) | 0;
  32560. },
  32561. readBoolean: function Type1Parser_readBoolean() {
  32562. var token = this.getToken();
  32563. return token === "true" ? 1 : 0;
  32564. },
  32565. nextChar: function Type1_nextChar() {
  32566. return this.currentChar = this.stream.getByte();
  32567. },
  32568. getToken: function Type1Parser_getToken() {
  32569. var comment = false;
  32570. var ch = this.currentChar;
  32571. while (true) {
  32572. if (ch === -1) {
  32573. return null;
  32574. }
  32575. if (comment) {
  32576. if (ch === 0x0a || ch === 0x0d) {
  32577. comment = false;
  32578. }
  32579. } else if (ch === 0x25) {
  32580. comment = true;
  32581. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  32582. break;
  32583. }
  32584. ch = this.nextChar();
  32585. }
  32586. if (isSpecial(ch)) {
  32587. this.nextChar();
  32588. return String.fromCharCode(ch);
  32589. }
  32590. var token = "";
  32591. do {
  32592. token += String.fromCharCode(ch);
  32593. ch = this.nextChar();
  32594. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  32595. return token;
  32596. },
  32597. readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) {
  32598. if (lenIV === -1) {
  32599. return bytes;
  32600. }
  32601. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  32602. },
  32603. extractFontProgram: function Type1Parser_extractFontProgram(properties) {
  32604. var stream = this.stream;
  32605. var subrs = [],
  32606. charstrings = [];
  32607. var privateData = Object.create(null);
  32608. privateData.lenIV = 4;
  32609. var program = {
  32610. subrs: [],
  32611. charstrings: [],
  32612. properties: {
  32613. privateData
  32614. }
  32615. };
  32616. var token, length, data, lenIV, encoded;
  32617. while ((token = this.getToken()) !== null) {
  32618. if (token !== "/") {
  32619. continue;
  32620. }
  32621. token = this.getToken();
  32622. switch (token) {
  32623. case "CharStrings":
  32624. this.getToken();
  32625. this.getToken();
  32626. this.getToken();
  32627. this.getToken();
  32628. while (true) {
  32629. token = this.getToken();
  32630. if (token === null || token === "end") {
  32631. break;
  32632. }
  32633. if (token !== "/") {
  32634. continue;
  32635. }
  32636. var glyph = this.getToken();
  32637. length = this.readInt();
  32638. this.getToken();
  32639. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  32640. lenIV = program.properties.privateData.lenIV;
  32641. encoded = this.readCharStrings(data, lenIV);
  32642. this.nextChar();
  32643. token = this.getToken();
  32644. if (token === "noaccess") {
  32645. this.getToken();
  32646. }
  32647. charstrings.push({
  32648. glyph,
  32649. encoded
  32650. });
  32651. }
  32652. break;
  32653. case "Subrs":
  32654. this.readInt();
  32655. this.getToken();
  32656. while (this.getToken() === "dup") {
  32657. const index = this.readInt();
  32658. length = this.readInt();
  32659. this.getToken();
  32660. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  32661. lenIV = program.properties.privateData.lenIV;
  32662. encoded = this.readCharStrings(data, lenIV);
  32663. this.nextChar();
  32664. token = this.getToken();
  32665. if (token === "noaccess") {
  32666. this.getToken();
  32667. }
  32668. subrs[index] = encoded;
  32669. }
  32670. break;
  32671. case "BlueValues":
  32672. case "OtherBlues":
  32673. case "FamilyBlues":
  32674. case "FamilyOtherBlues":
  32675. var blueArray = this.readNumberArray();
  32676. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  32677. program.properties.privateData[token] = blueArray;
  32678. }
  32679. break;
  32680. case "StemSnapH":
  32681. case "StemSnapV":
  32682. program.properties.privateData[token] = this.readNumberArray();
  32683. break;
  32684. case "StdHW":
  32685. case "StdVW":
  32686. program.properties.privateData[token] = this.readNumberArray()[0];
  32687. break;
  32688. case "BlueShift":
  32689. case "lenIV":
  32690. case "BlueFuzz":
  32691. case "BlueScale":
  32692. case "LanguageGroup":
  32693. case "ExpansionFactor":
  32694. program.properties.privateData[token] = this.readNumber();
  32695. break;
  32696. case "ForceBold":
  32697. program.properties.privateData[token] = this.readBoolean();
  32698. break;
  32699. }
  32700. }
  32701. for (var i = 0; i < charstrings.length; i++) {
  32702. glyph = charstrings[i].glyph;
  32703. encoded = charstrings[i].encoded;
  32704. var charString = new Type1CharString();
  32705. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  32706. var output = charString.output;
  32707. if (error) {
  32708. output = [14];
  32709. }
  32710. const charStringObject = {
  32711. glyphName: glyph,
  32712. charstring: output,
  32713. width: charString.width,
  32714. lsb: charString.lsb,
  32715. seac: charString.seac
  32716. };
  32717. if (glyph === ".notdef") {
  32718. program.charstrings.unshift(charStringObject);
  32719. } else {
  32720. program.charstrings.push(charStringObject);
  32721. }
  32722. if (properties.builtInEncoding) {
  32723. const index = properties.builtInEncoding.indexOf(glyph);
  32724. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  32725. properties.widths[index] = charString.width;
  32726. }
  32727. }
  32728. }
  32729. return program;
  32730. },
  32731. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  32732. var token;
  32733. while ((token = this.getToken()) !== null) {
  32734. if (token !== "/") {
  32735. continue;
  32736. }
  32737. token = this.getToken();
  32738. switch (token) {
  32739. case "FontMatrix":
  32740. var matrix = this.readNumberArray();
  32741. properties.fontMatrix = matrix;
  32742. break;
  32743. case "Encoding":
  32744. var encodingArg = this.getToken();
  32745. var encoding;
  32746. if (!/^\d+$/.test(encodingArg)) {
  32747. encoding = (0, _encodings.getEncoding)(encodingArg);
  32748. } else {
  32749. encoding = [];
  32750. var size = parseInt(encodingArg, 10) | 0;
  32751. this.getToken();
  32752. for (var j = 0; j < size; j++) {
  32753. token = this.getToken();
  32754. while (token !== "dup" && token !== "def") {
  32755. token = this.getToken();
  32756. if (token === null) {
  32757. return;
  32758. }
  32759. }
  32760. if (token === "def") {
  32761. break;
  32762. }
  32763. var index = this.readInt();
  32764. this.getToken();
  32765. var glyph = this.getToken();
  32766. encoding[index] = glyph;
  32767. this.getToken();
  32768. }
  32769. }
  32770. properties.builtInEncoding = encoding;
  32771. break;
  32772. case "FontBBox":
  32773. var fontBBox = this.readNumberArray();
  32774. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  32775. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  32776. properties.ascentScaled = true;
  32777. break;
  32778. }
  32779. }
  32780. }
  32781. };
  32782. return Type1Parser;
  32783. }();
  32784. exports.Type1Parser = Type1Parser;
  32785. /***/ }),
  32786. /* 38 */
  32787. /***/ (function(module, exports, __w_pdfjs_require__) {
  32788. "use strict";
  32789. Object.defineProperty(exports, "__esModule", {
  32790. value: true
  32791. });
  32792. exports.getTilingPatternIR = getTilingPatternIR;
  32793. exports.Pattern = void 0;
  32794. var _util = __w_pdfjs_require__(2);
  32795. var _colorspace = __w_pdfjs_require__(23);
  32796. var _primitives = __w_pdfjs_require__(5);
  32797. var _core_utils = __w_pdfjs_require__(8);
  32798. var ShadingType = {
  32799. FUNCTION_BASED: 1,
  32800. AXIAL: 2,
  32801. RADIAL: 3,
  32802. FREE_FORM_MESH: 4,
  32803. LATTICE_FORM_MESH: 5,
  32804. COONS_PATCH_MESH: 6,
  32805. TENSOR_PATCH_MESH: 7
  32806. };
  32807. var Pattern = function PatternClosure() {
  32808. function Pattern() {
  32809. (0, _util.unreachable)("should not call Pattern constructor");
  32810. }
  32811. Pattern.prototype = {
  32812. getPattern: function Pattern_getPattern(ctx) {
  32813. (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`);
  32814. }
  32815. };
  32816. Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) {
  32817. var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  32818. var type = dict.get("ShadingType");
  32819. try {
  32820. switch (type) {
  32821. case ShadingType.AXIAL:
  32822. case ShadingType.RADIAL:
  32823. return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory);
  32824. case ShadingType.FREE_FORM_MESH:
  32825. case ShadingType.LATTICE_FORM_MESH:
  32826. case ShadingType.COONS_PATCH_MESH:
  32827. case ShadingType.TENSOR_PATCH_MESH:
  32828. return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory);
  32829. default:
  32830. throw new _util.FormatError("Unsupported ShadingType: " + type);
  32831. }
  32832. } catch (ex) {
  32833. if (ex instanceof _core_utils.MissingDataException) {
  32834. throw ex;
  32835. }
  32836. handler.send("UnsupportedFeature", {
  32837. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  32838. });
  32839. (0, _util.warn)(ex);
  32840. return new Shadings.Dummy();
  32841. }
  32842. };
  32843. return Pattern;
  32844. }();
  32845. exports.Pattern = Pattern;
  32846. var Shadings = {};
  32847. Shadings.SMALL_NUMBER = 1e-6;
  32848. Shadings.RadialAxial = function RadialAxialClosure() {
  32849. function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) {
  32850. this.matrix = matrix;
  32851. this.coordsArr = dict.getArray("Coords");
  32852. this.shadingType = dict.get("ShadingType");
  32853. this.type = "Pattern";
  32854. var cs = dict.get("ColorSpace", "CS");
  32855. cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
  32856. this.cs = cs;
  32857. const bbox = dict.getArray("BBox");
  32858. if (Array.isArray(bbox) && bbox.length === 4) {
  32859. this.bbox = _util.Util.normalizeRect(bbox);
  32860. } else {
  32861. this.bbox = null;
  32862. }
  32863. var t0 = 0.0,
  32864. t1 = 1.0;
  32865. if (dict.has("Domain")) {
  32866. var domainArr = dict.getArray("Domain");
  32867. t0 = domainArr[0];
  32868. t1 = domainArr[1];
  32869. }
  32870. var extendStart = false,
  32871. extendEnd = false;
  32872. if (dict.has("Extend")) {
  32873. var extendArr = dict.getArray("Extend");
  32874. extendStart = extendArr[0];
  32875. extendEnd = extendArr[1];
  32876. }
  32877. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  32878. var x1 = this.coordsArr[0];
  32879. var y1 = this.coordsArr[1];
  32880. var r1 = this.coordsArr[2];
  32881. var x2 = this.coordsArr[3];
  32882. var y2 = this.coordsArr[4];
  32883. var r2 = this.coordsArr[5];
  32884. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  32885. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  32886. (0, _util.warn)("Unsupported radial gradient.");
  32887. }
  32888. }
  32889. this.extendStart = extendStart;
  32890. this.extendEnd = extendEnd;
  32891. var fnObj = dict.get("Function");
  32892. var fn = pdfFunctionFactory.createFromArray(fnObj);
  32893. const NUMBER_OF_SAMPLES = 10;
  32894. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  32895. var colorStops = this.colorStops = [];
  32896. if (t0 >= t1 || step <= 0) {
  32897. (0, _util.info)("Bad shading domain.");
  32898. return;
  32899. }
  32900. var color = new Float32Array(cs.numComps),
  32901. ratio = new Float32Array(1);
  32902. var rgbColor;
  32903. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  32904. ratio[0] = t0 + i * step;
  32905. fn(ratio, 0, color, 0);
  32906. rgbColor = cs.getRgb(color, 0);
  32907. var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  32908. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  32909. }
  32910. var background = "transparent";
  32911. if (dict.has("Background")) {
  32912. rgbColor = cs.getRgb(dict.get("Background"), 0);
  32913. background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  32914. }
  32915. if (!extendStart) {
  32916. colorStops.unshift([0, background]);
  32917. colorStops[1][0] += Shadings.SMALL_NUMBER;
  32918. }
  32919. if (!extendEnd) {
  32920. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  32921. colorStops.push([1, background]);
  32922. }
  32923. this.colorStops = colorStops;
  32924. }
  32925. RadialAxial.prototype = {
  32926. getIR: function RadialAxial_getIR() {
  32927. var coordsArr = this.coordsArr;
  32928. var shadingType = this.shadingType;
  32929. var type, p0, p1, r0, r1;
  32930. if (shadingType === ShadingType.AXIAL) {
  32931. p0 = [coordsArr[0], coordsArr[1]];
  32932. p1 = [coordsArr[2], coordsArr[3]];
  32933. r0 = null;
  32934. r1 = null;
  32935. type = "axial";
  32936. } else if (shadingType === ShadingType.RADIAL) {
  32937. p0 = [coordsArr[0], coordsArr[1]];
  32938. p1 = [coordsArr[3], coordsArr[4]];
  32939. r0 = coordsArr[2];
  32940. r1 = coordsArr[5];
  32941. type = "radial";
  32942. } else {
  32943. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  32944. }
  32945. var matrix = this.matrix;
  32946. if (matrix) {
  32947. p0 = _util.Util.applyTransform(p0, matrix);
  32948. p1 = _util.Util.applyTransform(p1, matrix);
  32949. if (shadingType === ShadingType.RADIAL) {
  32950. var scale = _util.Util.singularValueDecompose2dScale(matrix);
  32951. r0 *= scale[0];
  32952. r1 *= scale[1];
  32953. }
  32954. }
  32955. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  32956. }
  32957. };
  32958. return RadialAxial;
  32959. }();
  32960. Shadings.Mesh = function MeshClosure() {
  32961. function MeshStreamReader(stream, context) {
  32962. this.stream = stream;
  32963. this.context = context;
  32964. this.buffer = 0;
  32965. this.bufferLength = 0;
  32966. var numComps = context.numComps;
  32967. this.tmpCompsBuf = new Float32Array(numComps);
  32968. var csNumComps = context.colorSpace.numComps;
  32969. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  32970. }
  32971. MeshStreamReader.prototype = {
  32972. get hasData() {
  32973. if (this.stream.end) {
  32974. return this.stream.pos < this.stream.end;
  32975. }
  32976. if (this.bufferLength > 0) {
  32977. return true;
  32978. }
  32979. var nextByte = this.stream.getByte();
  32980. if (nextByte < 0) {
  32981. return false;
  32982. }
  32983. this.buffer = nextByte;
  32984. this.bufferLength = 8;
  32985. return true;
  32986. },
  32987. readBits: function MeshStreamReader_readBits(n) {
  32988. var buffer = this.buffer;
  32989. var bufferLength = this.bufferLength;
  32990. if (n === 32) {
  32991. if (bufferLength === 0) {
  32992. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  32993. }
  32994. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  32995. var nextByte = this.stream.getByte();
  32996. this.buffer = nextByte & (1 << bufferLength) - 1;
  32997. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  32998. }
  32999. if (n === 8 && bufferLength === 0) {
  33000. return this.stream.getByte();
  33001. }
  33002. while (bufferLength < n) {
  33003. buffer = buffer << 8 | this.stream.getByte();
  33004. bufferLength += 8;
  33005. }
  33006. bufferLength -= n;
  33007. this.bufferLength = bufferLength;
  33008. this.buffer = buffer & (1 << bufferLength) - 1;
  33009. return buffer >> bufferLength;
  33010. },
  33011. align: function MeshStreamReader_align() {
  33012. this.buffer = 0;
  33013. this.bufferLength = 0;
  33014. },
  33015. readFlag: function MeshStreamReader_readFlag() {
  33016. return this.readBits(this.context.bitsPerFlag);
  33017. },
  33018. readCoordinate: function MeshStreamReader_readCoordinate() {
  33019. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  33020. var xi = this.readBits(bitsPerCoordinate);
  33021. var yi = this.readBits(bitsPerCoordinate);
  33022. var decode = this.context.decode;
  33023. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  33024. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  33025. },
  33026. readComponents: function MeshStreamReader_readComponents() {
  33027. var numComps = this.context.numComps;
  33028. var bitsPerComponent = this.context.bitsPerComponent;
  33029. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  33030. var decode = this.context.decode;
  33031. var components = this.tmpCompsBuf;
  33032. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  33033. var ci = this.readBits(bitsPerComponent);
  33034. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  33035. }
  33036. var color = this.tmpCsCompsBuf;
  33037. if (this.context.colorFn) {
  33038. this.context.colorFn(components, 0, color, 0);
  33039. }
  33040. return this.context.colorSpace.getRgb(color, 0);
  33041. }
  33042. };
  33043. function decodeType4Shading(mesh, reader) {
  33044. var coords = mesh.coords;
  33045. var colors = mesh.colors;
  33046. var operators = [];
  33047. var ps = [];
  33048. var verticesLeft = 0;
  33049. while (reader.hasData) {
  33050. var f = reader.readFlag();
  33051. var coord = reader.readCoordinate();
  33052. var color = reader.readComponents();
  33053. if (verticesLeft === 0) {
  33054. if (!(0 <= f && f <= 2)) {
  33055. throw new _util.FormatError("Unknown type4 flag");
  33056. }
  33057. switch (f) {
  33058. case 0:
  33059. verticesLeft = 3;
  33060. break;
  33061. case 1:
  33062. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  33063. verticesLeft = 1;
  33064. break;
  33065. case 2:
  33066. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  33067. verticesLeft = 1;
  33068. break;
  33069. }
  33070. operators.push(f);
  33071. }
  33072. ps.push(coords.length);
  33073. coords.push(coord);
  33074. colors.push(color);
  33075. verticesLeft--;
  33076. reader.align();
  33077. }
  33078. mesh.figures.push({
  33079. type: "triangles",
  33080. coords: new Int32Array(ps),
  33081. colors: new Int32Array(ps)
  33082. });
  33083. }
  33084. function decodeType5Shading(mesh, reader, verticesPerRow) {
  33085. var coords = mesh.coords;
  33086. var colors = mesh.colors;
  33087. var ps = [];
  33088. while (reader.hasData) {
  33089. var coord = reader.readCoordinate();
  33090. var color = reader.readComponents();
  33091. ps.push(coords.length);
  33092. coords.push(coord);
  33093. colors.push(color);
  33094. }
  33095. mesh.figures.push({
  33096. type: "lattice",
  33097. coords: new Int32Array(ps),
  33098. colors: new Int32Array(ps),
  33099. verticesPerRow
  33100. });
  33101. }
  33102. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  33103. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  33104. var TRIANGLE_DENSITY = 20;
  33105. var getB = function getBClosure() {
  33106. function buildB(count) {
  33107. var lut = [];
  33108. for (var i = 0; i <= count; i++) {
  33109. var t = i / count,
  33110. t_ = 1 - t;
  33111. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  33112. }
  33113. return lut;
  33114. }
  33115. var cache = [];
  33116. return function getB(count) {
  33117. if (!cache[count]) {
  33118. cache[count] = buildB(count);
  33119. }
  33120. return cache[count];
  33121. };
  33122. }();
  33123. function buildFigureFromPatch(mesh, index) {
  33124. var figure = mesh.figures[index];
  33125. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  33126. var coords = mesh.coords,
  33127. colors = mesh.colors;
  33128. var pi = figure.coords;
  33129. var ci = figure.colors;
  33130. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  33131. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  33132. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  33133. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  33134. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  33135. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  33136. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  33137. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  33138. var verticesPerRow = splitXBy + 1;
  33139. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  33140. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  33141. var k = 0;
  33142. var cl = new Uint8Array(3),
  33143. cr = new Uint8Array(3);
  33144. var c0 = colors[ci[0]],
  33145. c1 = colors[ci[1]],
  33146. c2 = colors[ci[2]],
  33147. c3 = colors[ci[3]];
  33148. var bRow = getB(splitYBy),
  33149. bCol = getB(splitXBy);
  33150. for (var row = 0; row <= splitYBy; row++) {
  33151. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  33152. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  33153. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  33154. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  33155. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  33156. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  33157. for (var col = 0; col <= splitXBy; col++, k++) {
  33158. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  33159. continue;
  33160. }
  33161. var x = 0,
  33162. y = 0;
  33163. var q = 0;
  33164. for (var i = 0; i <= 3; i++) {
  33165. for (var j = 0; j <= 3; j++, q++) {
  33166. var m = bRow[row][i] * bCol[col][j];
  33167. x += coords[pi[q]][0] * m;
  33168. y += coords[pi[q]][1] * m;
  33169. }
  33170. }
  33171. figureCoords[k] = coords.length;
  33172. coords.push([x, y]);
  33173. figureColors[k] = colors.length;
  33174. var newColor = new Uint8Array(3);
  33175. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  33176. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  33177. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  33178. colors.push(newColor);
  33179. }
  33180. }
  33181. figureCoords[0] = pi[0];
  33182. figureColors[0] = ci[0];
  33183. figureCoords[splitXBy] = pi[3];
  33184. figureColors[splitXBy] = ci[1];
  33185. figureCoords[verticesPerRow * splitYBy] = pi[12];
  33186. figureColors[verticesPerRow * splitYBy] = ci[2];
  33187. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  33188. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  33189. mesh.figures[index] = {
  33190. type: "lattice",
  33191. coords: figureCoords,
  33192. colors: figureColors,
  33193. verticesPerRow
  33194. };
  33195. }
  33196. function decodeType6Shading(mesh, reader) {
  33197. var coords = mesh.coords;
  33198. var colors = mesh.colors;
  33199. var ps = new Int32Array(16);
  33200. var cs = new Int32Array(4);
  33201. while (reader.hasData) {
  33202. var f = reader.readFlag();
  33203. if (!(0 <= f && f <= 3)) {
  33204. throw new _util.FormatError("Unknown type6 flag");
  33205. }
  33206. var i, ii;
  33207. var pi = coords.length;
  33208. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  33209. coords.push(reader.readCoordinate());
  33210. }
  33211. var ci = colors.length;
  33212. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  33213. colors.push(reader.readComponents());
  33214. }
  33215. var tmp1, tmp2, tmp3, tmp4;
  33216. switch (f) {
  33217. case 0:
  33218. ps[12] = pi + 3;
  33219. ps[13] = pi + 4;
  33220. ps[14] = pi + 5;
  33221. ps[15] = pi + 6;
  33222. ps[8] = pi + 2;
  33223. ps[11] = pi + 7;
  33224. ps[4] = pi + 1;
  33225. ps[7] = pi + 8;
  33226. ps[0] = pi;
  33227. ps[1] = pi + 11;
  33228. ps[2] = pi + 10;
  33229. ps[3] = pi + 9;
  33230. cs[2] = ci + 1;
  33231. cs[3] = ci + 2;
  33232. cs[0] = ci;
  33233. cs[1] = ci + 3;
  33234. break;
  33235. case 1:
  33236. tmp1 = ps[12];
  33237. tmp2 = ps[13];
  33238. tmp3 = ps[14];
  33239. tmp4 = ps[15];
  33240. ps[12] = tmp4;
  33241. ps[13] = pi + 0;
  33242. ps[14] = pi + 1;
  33243. ps[15] = pi + 2;
  33244. ps[8] = tmp3;
  33245. ps[11] = pi + 3;
  33246. ps[4] = tmp2;
  33247. ps[7] = pi + 4;
  33248. ps[0] = tmp1;
  33249. ps[1] = pi + 7;
  33250. ps[2] = pi + 6;
  33251. ps[3] = pi + 5;
  33252. tmp1 = cs[2];
  33253. tmp2 = cs[3];
  33254. cs[2] = tmp2;
  33255. cs[3] = ci;
  33256. cs[0] = tmp1;
  33257. cs[1] = ci + 1;
  33258. break;
  33259. case 2:
  33260. tmp1 = ps[15];
  33261. tmp2 = ps[11];
  33262. ps[12] = ps[3];
  33263. ps[13] = pi + 0;
  33264. ps[14] = pi + 1;
  33265. ps[15] = pi + 2;
  33266. ps[8] = ps[7];
  33267. ps[11] = pi + 3;
  33268. ps[4] = tmp2;
  33269. ps[7] = pi + 4;
  33270. ps[0] = tmp1;
  33271. ps[1] = pi + 7;
  33272. ps[2] = pi + 6;
  33273. ps[3] = pi + 5;
  33274. tmp1 = cs[3];
  33275. cs[2] = cs[1];
  33276. cs[3] = ci;
  33277. cs[0] = tmp1;
  33278. cs[1] = ci + 1;
  33279. break;
  33280. case 3:
  33281. ps[12] = ps[0];
  33282. ps[13] = pi + 0;
  33283. ps[14] = pi + 1;
  33284. ps[15] = pi + 2;
  33285. ps[8] = ps[1];
  33286. ps[11] = pi + 3;
  33287. ps[4] = ps[2];
  33288. ps[7] = pi + 4;
  33289. ps[0] = ps[3];
  33290. ps[1] = pi + 7;
  33291. ps[2] = pi + 6;
  33292. ps[3] = pi + 5;
  33293. cs[2] = cs[0];
  33294. cs[3] = ci;
  33295. cs[0] = cs[1];
  33296. cs[1] = ci + 1;
  33297. break;
  33298. }
  33299. ps[5] = coords.length;
  33300. 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]);
  33301. ps[6] = coords.length;
  33302. 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]);
  33303. ps[9] = coords.length;
  33304. 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]);
  33305. ps[10] = coords.length;
  33306. 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]);
  33307. mesh.figures.push({
  33308. type: "patch",
  33309. coords: new Int32Array(ps),
  33310. colors: new Int32Array(cs)
  33311. });
  33312. }
  33313. }
  33314. function decodeType7Shading(mesh, reader) {
  33315. var coords = mesh.coords;
  33316. var colors = mesh.colors;
  33317. var ps = new Int32Array(16);
  33318. var cs = new Int32Array(4);
  33319. while (reader.hasData) {
  33320. var f = reader.readFlag();
  33321. if (!(0 <= f && f <= 3)) {
  33322. throw new _util.FormatError("Unknown type7 flag");
  33323. }
  33324. var i, ii;
  33325. var pi = coords.length;
  33326. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  33327. coords.push(reader.readCoordinate());
  33328. }
  33329. var ci = colors.length;
  33330. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  33331. colors.push(reader.readComponents());
  33332. }
  33333. var tmp1, tmp2, tmp3, tmp4;
  33334. switch (f) {
  33335. case 0:
  33336. ps[12] = pi + 3;
  33337. ps[13] = pi + 4;
  33338. ps[14] = pi + 5;
  33339. ps[15] = pi + 6;
  33340. ps[8] = pi + 2;
  33341. ps[9] = pi + 13;
  33342. ps[10] = pi + 14;
  33343. ps[11] = pi + 7;
  33344. ps[4] = pi + 1;
  33345. ps[5] = pi + 12;
  33346. ps[6] = pi + 15;
  33347. ps[7] = pi + 8;
  33348. ps[0] = pi;
  33349. ps[1] = pi + 11;
  33350. ps[2] = pi + 10;
  33351. ps[3] = pi + 9;
  33352. cs[2] = ci + 1;
  33353. cs[3] = ci + 2;
  33354. cs[0] = ci;
  33355. cs[1] = ci + 3;
  33356. break;
  33357. case 1:
  33358. tmp1 = ps[12];
  33359. tmp2 = ps[13];
  33360. tmp3 = ps[14];
  33361. tmp4 = ps[15];
  33362. ps[12] = tmp4;
  33363. ps[13] = pi + 0;
  33364. ps[14] = pi + 1;
  33365. ps[15] = pi + 2;
  33366. ps[8] = tmp3;
  33367. ps[9] = pi + 9;
  33368. ps[10] = pi + 10;
  33369. ps[11] = pi + 3;
  33370. ps[4] = tmp2;
  33371. ps[5] = pi + 8;
  33372. ps[6] = pi + 11;
  33373. ps[7] = pi + 4;
  33374. ps[0] = tmp1;
  33375. ps[1] = pi + 7;
  33376. ps[2] = pi + 6;
  33377. ps[3] = pi + 5;
  33378. tmp1 = cs[2];
  33379. tmp2 = cs[3];
  33380. cs[2] = tmp2;
  33381. cs[3] = ci;
  33382. cs[0] = tmp1;
  33383. cs[1] = ci + 1;
  33384. break;
  33385. case 2:
  33386. tmp1 = ps[15];
  33387. tmp2 = ps[11];
  33388. ps[12] = ps[3];
  33389. ps[13] = pi + 0;
  33390. ps[14] = pi + 1;
  33391. ps[15] = pi + 2;
  33392. ps[8] = ps[7];
  33393. ps[9] = pi + 9;
  33394. ps[10] = pi + 10;
  33395. ps[11] = pi + 3;
  33396. ps[4] = tmp2;
  33397. ps[5] = pi + 8;
  33398. ps[6] = pi + 11;
  33399. ps[7] = pi + 4;
  33400. ps[0] = tmp1;
  33401. ps[1] = pi + 7;
  33402. ps[2] = pi + 6;
  33403. ps[3] = pi + 5;
  33404. tmp1 = cs[3];
  33405. cs[2] = cs[1];
  33406. cs[3] = ci;
  33407. cs[0] = tmp1;
  33408. cs[1] = ci + 1;
  33409. break;
  33410. case 3:
  33411. ps[12] = ps[0];
  33412. ps[13] = pi + 0;
  33413. ps[14] = pi + 1;
  33414. ps[15] = pi + 2;
  33415. ps[8] = ps[1];
  33416. ps[9] = pi + 9;
  33417. ps[10] = pi + 10;
  33418. ps[11] = pi + 3;
  33419. ps[4] = ps[2];
  33420. ps[5] = pi + 8;
  33421. ps[6] = pi + 11;
  33422. ps[7] = pi + 4;
  33423. ps[0] = ps[3];
  33424. ps[1] = pi + 7;
  33425. ps[2] = pi + 6;
  33426. ps[3] = pi + 5;
  33427. cs[2] = cs[0];
  33428. cs[3] = ci;
  33429. cs[0] = cs[1];
  33430. cs[1] = ci + 1;
  33431. break;
  33432. }
  33433. mesh.figures.push({
  33434. type: "patch",
  33435. coords: new Int32Array(ps),
  33436. colors: new Int32Array(cs)
  33437. });
  33438. }
  33439. }
  33440. function updateBounds(mesh) {
  33441. var minX = mesh.coords[0][0],
  33442. minY = mesh.coords[0][1],
  33443. maxX = minX,
  33444. maxY = minY;
  33445. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  33446. var x = mesh.coords[i][0],
  33447. y = mesh.coords[i][1];
  33448. minX = minX > x ? x : minX;
  33449. minY = minY > y ? y : minY;
  33450. maxX = maxX < x ? x : maxX;
  33451. maxY = maxY < y ? y : maxY;
  33452. }
  33453. mesh.bounds = [minX, minY, maxX, maxY];
  33454. }
  33455. function packData(mesh) {
  33456. var i, ii, j, jj;
  33457. var coords = mesh.coords;
  33458. var coordsPacked = new Float32Array(coords.length * 2);
  33459. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  33460. var xy = coords[i];
  33461. coordsPacked[j++] = xy[0];
  33462. coordsPacked[j++] = xy[1];
  33463. }
  33464. mesh.coords = coordsPacked;
  33465. var colors = mesh.colors;
  33466. var colorsPacked = new Uint8Array(colors.length * 3);
  33467. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  33468. var c = colors[i];
  33469. colorsPacked[j++] = c[0];
  33470. colorsPacked[j++] = c[1];
  33471. colorsPacked[j++] = c[2];
  33472. }
  33473. mesh.colors = colorsPacked;
  33474. var figures = mesh.figures;
  33475. for (i = 0, ii = figures.length; i < ii; i++) {
  33476. var figure = figures[i],
  33477. ps = figure.coords,
  33478. cs = figure.colors;
  33479. for (j = 0, jj = ps.length; j < jj; j++) {
  33480. ps[j] *= 2;
  33481. cs[j] *= 3;
  33482. }
  33483. }
  33484. }
  33485. function Mesh(stream, matrix, xref, res, pdfFunctionFactory) {
  33486. if (!(0, _primitives.isStream)(stream)) {
  33487. throw new _util.FormatError("Mesh data is not a stream");
  33488. }
  33489. var dict = stream.dict;
  33490. this.matrix = matrix;
  33491. this.shadingType = dict.get("ShadingType");
  33492. this.type = "Pattern";
  33493. const bbox = dict.getArray("BBox");
  33494. if (Array.isArray(bbox) && bbox.length === 4) {
  33495. this.bbox = _util.Util.normalizeRect(bbox);
  33496. } else {
  33497. this.bbox = null;
  33498. }
  33499. var cs = dict.get("ColorSpace", "CS");
  33500. cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
  33501. this.cs = cs;
  33502. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  33503. var fnObj = dict.get("Function");
  33504. var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  33505. this.coords = [];
  33506. this.colors = [];
  33507. this.figures = [];
  33508. var decodeContext = {
  33509. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  33510. bitsPerComponent: dict.get("BitsPerComponent"),
  33511. bitsPerFlag: dict.get("BitsPerFlag"),
  33512. decode: dict.getArray("Decode"),
  33513. colorFn: fn,
  33514. colorSpace: cs,
  33515. numComps: fn ? 1 : cs.numComps
  33516. };
  33517. var reader = new MeshStreamReader(stream, decodeContext);
  33518. var patchMesh = false;
  33519. switch (this.shadingType) {
  33520. case ShadingType.FREE_FORM_MESH:
  33521. decodeType4Shading(this, reader);
  33522. break;
  33523. case ShadingType.LATTICE_FORM_MESH:
  33524. var verticesPerRow = dict.get("VerticesPerRow") | 0;
  33525. if (verticesPerRow < 2) {
  33526. throw new _util.FormatError("Invalid VerticesPerRow");
  33527. }
  33528. decodeType5Shading(this, reader, verticesPerRow);
  33529. break;
  33530. case ShadingType.COONS_PATCH_MESH:
  33531. decodeType6Shading(this, reader);
  33532. patchMesh = true;
  33533. break;
  33534. case ShadingType.TENSOR_PATCH_MESH:
  33535. decodeType7Shading(this, reader);
  33536. patchMesh = true;
  33537. break;
  33538. default:
  33539. (0, _util.unreachable)("Unsupported mesh type.");
  33540. break;
  33541. }
  33542. if (patchMesh) {
  33543. updateBounds(this);
  33544. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  33545. buildFigureFromPatch(this, i);
  33546. }
  33547. }
  33548. updateBounds(this);
  33549. packData(this);
  33550. }
  33551. Mesh.prototype = {
  33552. getIR: function Mesh_getIR() {
  33553. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  33554. }
  33555. };
  33556. return Mesh;
  33557. }();
  33558. Shadings.Dummy = function DummyClosure() {
  33559. function Dummy() {
  33560. this.type = "Pattern";
  33561. }
  33562. Dummy.prototype = {
  33563. getIR: function Dummy_getIR() {
  33564. return ["Dummy"];
  33565. }
  33566. };
  33567. return Dummy;
  33568. }();
  33569. function getTilingPatternIR(operatorList, dict, args) {
  33570. const matrix = dict.getArray("Matrix");
  33571. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  33572. const xstep = dict.get("XStep");
  33573. const ystep = dict.get("YStep");
  33574. const paintType = dict.get("PaintType");
  33575. const tilingType = dict.get("TilingType");
  33576. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  33577. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  33578. }
  33579. return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  33580. }
  33581. /***/ }),
  33582. /* 39 */
  33583. /***/ (function(module, exports, __w_pdfjs_require__) {
  33584. "use strict";
  33585. Object.defineProperty(exports, "__esModule", {
  33586. value: true
  33587. });
  33588. exports.bidi = bidi;
  33589. var _util = __w_pdfjs_require__(2);
  33590. var 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"];
  33591. var 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"];
  33592. function isOdd(i) {
  33593. return (i & 1) !== 0;
  33594. }
  33595. function isEven(i) {
  33596. return (i & 1) === 0;
  33597. }
  33598. function findUnequal(arr, start, value) {
  33599. for (var j = start, jj = arr.length; j < jj; ++j) {
  33600. if (arr[j] !== value) {
  33601. return j;
  33602. }
  33603. }
  33604. return j;
  33605. }
  33606. function setValues(arr, start, end, value) {
  33607. for (var j = start; j < end; ++j) {
  33608. arr[j] = value;
  33609. }
  33610. }
  33611. function reverseValues(arr, start, end) {
  33612. for (var i = start, j = end - 1; i < j; ++i, --j) {
  33613. var temp = arr[i];
  33614. arr[i] = arr[j];
  33615. arr[j] = temp;
  33616. }
  33617. }
  33618. function createBidiText(str, isLTR, vertical = false) {
  33619. let dir = "ltr";
  33620. if (vertical) {
  33621. dir = "ttb";
  33622. } else if (!isLTR) {
  33623. dir = "rtl";
  33624. }
  33625. return {
  33626. str,
  33627. dir
  33628. };
  33629. }
  33630. var chars = [];
  33631. var types = [];
  33632. function bidi(str, startLevel, vertical) {
  33633. var isLTR = true;
  33634. var strLength = str.length;
  33635. if (strLength === 0 || vertical) {
  33636. return createBidiText(str, isLTR, vertical);
  33637. }
  33638. chars.length = strLength;
  33639. types.length = strLength;
  33640. var numBidi = 0;
  33641. var i, ii;
  33642. for (i = 0; i < strLength; ++i) {
  33643. chars[i] = str.charAt(i);
  33644. var charCode = str.charCodeAt(i);
  33645. var charType = "L";
  33646. if (charCode <= 0x00ff) {
  33647. charType = baseTypes[charCode];
  33648. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  33649. charType = "R";
  33650. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  33651. charType = arabicTypes[charCode & 0xff];
  33652. if (!charType) {
  33653. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  33654. }
  33655. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  33656. charType = "AL";
  33657. }
  33658. if (charType === "R" || charType === "AL" || charType === "AN") {
  33659. numBidi++;
  33660. }
  33661. types[i] = charType;
  33662. }
  33663. if (numBidi === 0) {
  33664. isLTR = true;
  33665. return createBidiText(str, isLTR);
  33666. }
  33667. if (startLevel === -1) {
  33668. if (numBidi / strLength < 0.3) {
  33669. isLTR = true;
  33670. startLevel = 0;
  33671. } else {
  33672. isLTR = false;
  33673. startLevel = 1;
  33674. }
  33675. }
  33676. var levels = [];
  33677. for (i = 0; i < strLength; ++i) {
  33678. levels[i] = startLevel;
  33679. }
  33680. var e = isOdd(startLevel) ? "R" : "L";
  33681. var sor = e;
  33682. var eor = sor;
  33683. var lastType = sor;
  33684. for (i = 0; i < strLength; ++i) {
  33685. if (types[i] === "NSM") {
  33686. types[i] = lastType;
  33687. } else {
  33688. lastType = types[i];
  33689. }
  33690. }
  33691. lastType = sor;
  33692. var t;
  33693. for (i = 0; i < strLength; ++i) {
  33694. t = types[i];
  33695. if (t === "EN") {
  33696. types[i] = lastType === "AL" ? "AN" : "EN";
  33697. } else if (t === "R" || t === "L" || t === "AL") {
  33698. lastType = t;
  33699. }
  33700. }
  33701. for (i = 0; i < strLength; ++i) {
  33702. t = types[i];
  33703. if (t === "AL") {
  33704. types[i] = "R";
  33705. }
  33706. }
  33707. for (i = 1; i < strLength - 1; ++i) {
  33708. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  33709. types[i] = "EN";
  33710. }
  33711. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  33712. types[i] = types[i - 1];
  33713. }
  33714. }
  33715. for (i = 0; i < strLength; ++i) {
  33716. if (types[i] === "EN") {
  33717. var j;
  33718. for (j = i - 1; j >= 0; --j) {
  33719. if (types[j] !== "ET") {
  33720. break;
  33721. }
  33722. types[j] = "EN";
  33723. }
  33724. for (j = i + 1; j < strLength; ++j) {
  33725. if (types[j] !== "ET") {
  33726. break;
  33727. }
  33728. types[j] = "EN";
  33729. }
  33730. }
  33731. }
  33732. for (i = 0; i < strLength; ++i) {
  33733. t = types[i];
  33734. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  33735. types[i] = "ON";
  33736. }
  33737. }
  33738. lastType = sor;
  33739. for (i = 0; i < strLength; ++i) {
  33740. t = types[i];
  33741. if (t === "EN") {
  33742. types[i] = lastType === "L" ? "L" : "EN";
  33743. } else if (t === "R" || t === "L") {
  33744. lastType = t;
  33745. }
  33746. }
  33747. for (i = 0; i < strLength; ++i) {
  33748. if (types[i] === "ON") {
  33749. var end = findUnequal(types, i + 1, "ON");
  33750. var before = sor;
  33751. if (i > 0) {
  33752. before = types[i - 1];
  33753. }
  33754. var after = eor;
  33755. if (end + 1 < strLength) {
  33756. after = types[end + 1];
  33757. }
  33758. if (before !== "L") {
  33759. before = "R";
  33760. }
  33761. if (after !== "L") {
  33762. after = "R";
  33763. }
  33764. if (before === after) {
  33765. setValues(types, i, end, before);
  33766. }
  33767. i = end - 1;
  33768. }
  33769. }
  33770. for (i = 0; i < strLength; ++i) {
  33771. if (types[i] === "ON") {
  33772. types[i] = e;
  33773. }
  33774. }
  33775. for (i = 0; i < strLength; ++i) {
  33776. t = types[i];
  33777. if (isEven(levels[i])) {
  33778. if (t === "R") {
  33779. levels[i] += 1;
  33780. } else if (t === "AN" || t === "EN") {
  33781. levels[i] += 2;
  33782. }
  33783. } else {
  33784. if (t === "L" || t === "AN" || t === "EN") {
  33785. levels[i] += 1;
  33786. }
  33787. }
  33788. }
  33789. var highestLevel = -1;
  33790. var lowestOddLevel = 99;
  33791. var level;
  33792. for (i = 0, ii = levels.length; i < ii; ++i) {
  33793. level = levels[i];
  33794. if (highestLevel < level) {
  33795. highestLevel = level;
  33796. }
  33797. if (lowestOddLevel > level && isOdd(level)) {
  33798. lowestOddLevel = level;
  33799. }
  33800. }
  33801. for (level = highestLevel; level >= lowestOddLevel; --level) {
  33802. var start = -1;
  33803. for (i = 0, ii = levels.length; i < ii; ++i) {
  33804. if (levels[i] < level) {
  33805. if (start >= 0) {
  33806. reverseValues(chars, start, i);
  33807. start = -1;
  33808. }
  33809. } else if (start < 0) {
  33810. start = i;
  33811. }
  33812. }
  33813. if (start >= 0) {
  33814. reverseValues(chars, start, levels.length);
  33815. }
  33816. }
  33817. for (i = 0, ii = chars.length; i < ii; ++i) {
  33818. var ch = chars[i];
  33819. if (ch === "<" || ch === ">") {
  33820. chars[i] = "";
  33821. }
  33822. }
  33823. return createBidiText(chars.join(""), isLTR);
  33824. }
  33825. /***/ }),
  33826. /* 40 */
  33827. /***/ (function(module, exports, __w_pdfjs_require__) {
  33828. "use strict";
  33829. Object.defineProperty(exports, "__esModule", {
  33830. value: true
  33831. });
  33832. exports.getMetrics = void 0;
  33833. var _core_utils = __w_pdfjs_require__(8);
  33834. var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  33835. t.Courier = 600;
  33836. t["Courier-Bold"] = 600;
  33837. t["Courier-BoldOblique"] = 600;
  33838. t["Courier-Oblique"] = 600;
  33839. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  33840. t.space = 278;
  33841. t.exclam = 278;
  33842. t.quotedbl = 355;
  33843. t.numbersign = 556;
  33844. t.dollar = 556;
  33845. t.percent = 889;
  33846. t.ampersand = 667;
  33847. t.quoteright = 222;
  33848. t.parenleft = 333;
  33849. t.parenright = 333;
  33850. t.asterisk = 389;
  33851. t.plus = 584;
  33852. t.comma = 278;
  33853. t.hyphen = 333;
  33854. t.period = 278;
  33855. t.slash = 278;
  33856. t.zero = 556;
  33857. t.one = 556;
  33858. t.two = 556;
  33859. t.three = 556;
  33860. t.four = 556;
  33861. t.five = 556;
  33862. t.six = 556;
  33863. t.seven = 556;
  33864. t.eight = 556;
  33865. t.nine = 556;
  33866. t.colon = 278;
  33867. t.semicolon = 278;
  33868. t.less = 584;
  33869. t.equal = 584;
  33870. t.greater = 584;
  33871. t.question = 556;
  33872. t.at = 1015;
  33873. t.A = 667;
  33874. t.B = 667;
  33875. t.C = 722;
  33876. t.D = 722;
  33877. t.E = 667;
  33878. t.F = 611;
  33879. t.G = 778;
  33880. t.H = 722;
  33881. t.I = 278;
  33882. t.J = 500;
  33883. t.K = 667;
  33884. t.L = 556;
  33885. t.M = 833;
  33886. t.N = 722;
  33887. t.O = 778;
  33888. t.P = 667;
  33889. t.Q = 778;
  33890. t.R = 722;
  33891. t.S = 667;
  33892. t.T = 611;
  33893. t.U = 722;
  33894. t.V = 667;
  33895. t.W = 944;
  33896. t.X = 667;
  33897. t.Y = 667;
  33898. t.Z = 611;
  33899. t.bracketleft = 278;
  33900. t.backslash = 278;
  33901. t.bracketright = 278;
  33902. t.asciicircum = 469;
  33903. t.underscore = 556;
  33904. t.quoteleft = 222;
  33905. t.a = 556;
  33906. t.b = 556;
  33907. t.c = 500;
  33908. t.d = 556;
  33909. t.e = 556;
  33910. t.f = 278;
  33911. t.g = 556;
  33912. t.h = 556;
  33913. t.i = 222;
  33914. t.j = 222;
  33915. t.k = 500;
  33916. t.l = 222;
  33917. t.m = 833;
  33918. t.n = 556;
  33919. t.o = 556;
  33920. t.p = 556;
  33921. t.q = 556;
  33922. t.r = 333;
  33923. t.s = 500;
  33924. t.t = 278;
  33925. t.u = 556;
  33926. t.v = 500;
  33927. t.w = 722;
  33928. t.x = 500;
  33929. t.y = 500;
  33930. t.z = 500;
  33931. t.braceleft = 334;
  33932. t.bar = 260;
  33933. t.braceright = 334;
  33934. t.asciitilde = 584;
  33935. t.exclamdown = 333;
  33936. t.cent = 556;
  33937. t.sterling = 556;
  33938. t.fraction = 167;
  33939. t.yen = 556;
  33940. t.florin = 556;
  33941. t.section = 556;
  33942. t.currency = 556;
  33943. t.quotesingle = 191;
  33944. t.quotedblleft = 333;
  33945. t.guillemotleft = 556;
  33946. t.guilsinglleft = 333;
  33947. t.guilsinglright = 333;
  33948. t.fi = 500;
  33949. t.fl = 500;
  33950. t.endash = 556;
  33951. t.dagger = 556;
  33952. t.daggerdbl = 556;
  33953. t.periodcentered = 278;
  33954. t.paragraph = 537;
  33955. t.bullet = 350;
  33956. t.quotesinglbase = 222;
  33957. t.quotedblbase = 333;
  33958. t.quotedblright = 333;
  33959. t.guillemotright = 556;
  33960. t.ellipsis = 1000;
  33961. t.perthousand = 1000;
  33962. t.questiondown = 611;
  33963. t.grave = 333;
  33964. t.acute = 333;
  33965. t.circumflex = 333;
  33966. t.tilde = 333;
  33967. t.macron = 333;
  33968. t.breve = 333;
  33969. t.dotaccent = 333;
  33970. t.dieresis = 333;
  33971. t.ring = 333;
  33972. t.cedilla = 333;
  33973. t.hungarumlaut = 333;
  33974. t.ogonek = 333;
  33975. t.caron = 333;
  33976. t.emdash = 1000;
  33977. t.AE = 1000;
  33978. t.ordfeminine = 370;
  33979. t.Lslash = 556;
  33980. t.Oslash = 778;
  33981. t.OE = 1000;
  33982. t.ordmasculine = 365;
  33983. t.ae = 889;
  33984. t.dotlessi = 278;
  33985. t.lslash = 222;
  33986. t.oslash = 611;
  33987. t.oe = 944;
  33988. t.germandbls = 611;
  33989. t.Idieresis = 278;
  33990. t.eacute = 556;
  33991. t.abreve = 556;
  33992. t.uhungarumlaut = 556;
  33993. t.ecaron = 556;
  33994. t.Ydieresis = 667;
  33995. t.divide = 584;
  33996. t.Yacute = 667;
  33997. t.Acircumflex = 667;
  33998. t.aacute = 556;
  33999. t.Ucircumflex = 722;
  34000. t.yacute = 500;
  34001. t.scommaaccent = 500;
  34002. t.ecircumflex = 556;
  34003. t.Uring = 722;
  34004. t.Udieresis = 722;
  34005. t.aogonek = 556;
  34006. t.Uacute = 722;
  34007. t.uogonek = 556;
  34008. t.Edieresis = 667;
  34009. t.Dcroat = 722;
  34010. t.commaaccent = 250;
  34011. t.copyright = 737;
  34012. t.Emacron = 667;
  34013. t.ccaron = 500;
  34014. t.aring = 556;
  34015. t.Ncommaaccent = 722;
  34016. t.lacute = 222;
  34017. t.agrave = 556;
  34018. t.Tcommaaccent = 611;
  34019. t.Cacute = 722;
  34020. t.atilde = 556;
  34021. t.Edotaccent = 667;
  34022. t.scaron = 500;
  34023. t.scedilla = 500;
  34024. t.iacute = 278;
  34025. t.lozenge = 471;
  34026. t.Rcaron = 722;
  34027. t.Gcommaaccent = 778;
  34028. t.ucircumflex = 556;
  34029. t.acircumflex = 556;
  34030. t.Amacron = 667;
  34031. t.rcaron = 333;
  34032. t.ccedilla = 500;
  34033. t.Zdotaccent = 611;
  34034. t.Thorn = 667;
  34035. t.Omacron = 778;
  34036. t.Racute = 722;
  34037. t.Sacute = 667;
  34038. t.dcaron = 643;
  34039. t.Umacron = 722;
  34040. t.uring = 556;
  34041. t.threesuperior = 333;
  34042. t.Ograve = 778;
  34043. t.Agrave = 667;
  34044. t.Abreve = 667;
  34045. t.multiply = 584;
  34046. t.uacute = 556;
  34047. t.Tcaron = 611;
  34048. t.partialdiff = 476;
  34049. t.ydieresis = 500;
  34050. t.Nacute = 722;
  34051. t.icircumflex = 278;
  34052. t.Ecircumflex = 667;
  34053. t.adieresis = 556;
  34054. t.edieresis = 556;
  34055. t.cacute = 500;
  34056. t.nacute = 556;
  34057. t.umacron = 556;
  34058. t.Ncaron = 722;
  34059. t.Iacute = 278;
  34060. t.plusminus = 584;
  34061. t.brokenbar = 260;
  34062. t.registered = 737;
  34063. t.Gbreve = 778;
  34064. t.Idotaccent = 278;
  34065. t.summation = 600;
  34066. t.Egrave = 667;
  34067. t.racute = 333;
  34068. t.omacron = 556;
  34069. t.Zacute = 611;
  34070. t.Zcaron = 611;
  34071. t.greaterequal = 549;
  34072. t.Eth = 722;
  34073. t.Ccedilla = 722;
  34074. t.lcommaaccent = 222;
  34075. t.tcaron = 317;
  34076. t.eogonek = 556;
  34077. t.Uogonek = 722;
  34078. t.Aacute = 667;
  34079. t.Adieresis = 667;
  34080. t.egrave = 556;
  34081. t.zacute = 500;
  34082. t.iogonek = 222;
  34083. t.Oacute = 778;
  34084. t.oacute = 556;
  34085. t.amacron = 556;
  34086. t.sacute = 500;
  34087. t.idieresis = 278;
  34088. t.Ocircumflex = 778;
  34089. t.Ugrave = 722;
  34090. t.Delta = 612;
  34091. t.thorn = 556;
  34092. t.twosuperior = 333;
  34093. t.Odieresis = 778;
  34094. t.mu = 556;
  34095. t.igrave = 278;
  34096. t.ohungarumlaut = 556;
  34097. t.Eogonek = 667;
  34098. t.dcroat = 556;
  34099. t.threequarters = 834;
  34100. t.Scedilla = 667;
  34101. t.lcaron = 299;
  34102. t.Kcommaaccent = 667;
  34103. t.Lacute = 556;
  34104. t.trademark = 1000;
  34105. t.edotaccent = 556;
  34106. t.Igrave = 278;
  34107. t.Imacron = 278;
  34108. t.Lcaron = 556;
  34109. t.onehalf = 834;
  34110. t.lessequal = 549;
  34111. t.ocircumflex = 556;
  34112. t.ntilde = 556;
  34113. t.Uhungarumlaut = 722;
  34114. t.Eacute = 667;
  34115. t.emacron = 556;
  34116. t.gbreve = 556;
  34117. t.onequarter = 834;
  34118. t.Scaron = 667;
  34119. t.Scommaaccent = 667;
  34120. t.Ohungarumlaut = 778;
  34121. t.degree = 400;
  34122. t.ograve = 556;
  34123. t.Ccaron = 722;
  34124. t.ugrave = 556;
  34125. t.radical = 453;
  34126. t.Dcaron = 722;
  34127. t.rcommaaccent = 333;
  34128. t.Ntilde = 722;
  34129. t.otilde = 556;
  34130. t.Rcommaaccent = 722;
  34131. t.Lcommaaccent = 556;
  34132. t.Atilde = 667;
  34133. t.Aogonek = 667;
  34134. t.Aring = 667;
  34135. t.Otilde = 778;
  34136. t.zdotaccent = 500;
  34137. t.Ecaron = 667;
  34138. t.Iogonek = 278;
  34139. t.kcommaaccent = 500;
  34140. t.minus = 584;
  34141. t.Icircumflex = 278;
  34142. t.ncaron = 556;
  34143. t.tcommaaccent = 278;
  34144. t.logicalnot = 584;
  34145. t.odieresis = 556;
  34146. t.udieresis = 556;
  34147. t.notequal = 549;
  34148. t.gcommaaccent = 556;
  34149. t.eth = 556;
  34150. t.zcaron = 500;
  34151. t.ncommaaccent = 556;
  34152. t.onesuperior = 333;
  34153. t.imacron = 278;
  34154. t.Euro = 556;
  34155. });
  34156. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  34157. t.space = 278;
  34158. t.exclam = 333;
  34159. t.quotedbl = 474;
  34160. t.numbersign = 556;
  34161. t.dollar = 556;
  34162. t.percent = 889;
  34163. t.ampersand = 722;
  34164. t.quoteright = 278;
  34165. t.parenleft = 333;
  34166. t.parenright = 333;
  34167. t.asterisk = 389;
  34168. t.plus = 584;
  34169. t.comma = 278;
  34170. t.hyphen = 333;
  34171. t.period = 278;
  34172. t.slash = 278;
  34173. t.zero = 556;
  34174. t.one = 556;
  34175. t.two = 556;
  34176. t.three = 556;
  34177. t.four = 556;
  34178. t.five = 556;
  34179. t.six = 556;
  34180. t.seven = 556;
  34181. t.eight = 556;
  34182. t.nine = 556;
  34183. t.colon = 333;
  34184. t.semicolon = 333;
  34185. t.less = 584;
  34186. t.equal = 584;
  34187. t.greater = 584;
  34188. t.question = 611;
  34189. t.at = 975;
  34190. t.A = 722;
  34191. t.B = 722;
  34192. t.C = 722;
  34193. t.D = 722;
  34194. t.E = 667;
  34195. t.F = 611;
  34196. t.G = 778;
  34197. t.H = 722;
  34198. t.I = 278;
  34199. t.J = 556;
  34200. t.K = 722;
  34201. t.L = 611;
  34202. t.M = 833;
  34203. t.N = 722;
  34204. t.O = 778;
  34205. t.P = 667;
  34206. t.Q = 778;
  34207. t.R = 722;
  34208. t.S = 667;
  34209. t.T = 611;
  34210. t.U = 722;
  34211. t.V = 667;
  34212. t.W = 944;
  34213. t.X = 667;
  34214. t.Y = 667;
  34215. t.Z = 611;
  34216. t.bracketleft = 333;
  34217. t.backslash = 278;
  34218. t.bracketright = 333;
  34219. t.asciicircum = 584;
  34220. t.underscore = 556;
  34221. t.quoteleft = 278;
  34222. t.a = 556;
  34223. t.b = 611;
  34224. t.c = 556;
  34225. t.d = 611;
  34226. t.e = 556;
  34227. t.f = 333;
  34228. t.g = 611;
  34229. t.h = 611;
  34230. t.i = 278;
  34231. t.j = 278;
  34232. t.k = 556;
  34233. t.l = 278;
  34234. t.m = 889;
  34235. t.n = 611;
  34236. t.o = 611;
  34237. t.p = 611;
  34238. t.q = 611;
  34239. t.r = 389;
  34240. t.s = 556;
  34241. t.t = 333;
  34242. t.u = 611;
  34243. t.v = 556;
  34244. t.w = 778;
  34245. t.x = 556;
  34246. t.y = 556;
  34247. t.z = 500;
  34248. t.braceleft = 389;
  34249. t.bar = 280;
  34250. t.braceright = 389;
  34251. t.asciitilde = 584;
  34252. t.exclamdown = 333;
  34253. t.cent = 556;
  34254. t.sterling = 556;
  34255. t.fraction = 167;
  34256. t.yen = 556;
  34257. t.florin = 556;
  34258. t.section = 556;
  34259. t.currency = 556;
  34260. t.quotesingle = 238;
  34261. t.quotedblleft = 500;
  34262. t.guillemotleft = 556;
  34263. t.guilsinglleft = 333;
  34264. t.guilsinglright = 333;
  34265. t.fi = 611;
  34266. t.fl = 611;
  34267. t.endash = 556;
  34268. t.dagger = 556;
  34269. t.daggerdbl = 556;
  34270. t.periodcentered = 278;
  34271. t.paragraph = 556;
  34272. t.bullet = 350;
  34273. t.quotesinglbase = 278;
  34274. t.quotedblbase = 500;
  34275. t.quotedblright = 500;
  34276. t.guillemotright = 556;
  34277. t.ellipsis = 1000;
  34278. t.perthousand = 1000;
  34279. t.questiondown = 611;
  34280. t.grave = 333;
  34281. t.acute = 333;
  34282. t.circumflex = 333;
  34283. t.tilde = 333;
  34284. t.macron = 333;
  34285. t.breve = 333;
  34286. t.dotaccent = 333;
  34287. t.dieresis = 333;
  34288. t.ring = 333;
  34289. t.cedilla = 333;
  34290. t.hungarumlaut = 333;
  34291. t.ogonek = 333;
  34292. t.caron = 333;
  34293. t.emdash = 1000;
  34294. t.AE = 1000;
  34295. t.ordfeminine = 370;
  34296. t.Lslash = 611;
  34297. t.Oslash = 778;
  34298. t.OE = 1000;
  34299. t.ordmasculine = 365;
  34300. t.ae = 889;
  34301. t.dotlessi = 278;
  34302. t.lslash = 278;
  34303. t.oslash = 611;
  34304. t.oe = 944;
  34305. t.germandbls = 611;
  34306. t.Idieresis = 278;
  34307. t.eacute = 556;
  34308. t.abreve = 556;
  34309. t.uhungarumlaut = 611;
  34310. t.ecaron = 556;
  34311. t.Ydieresis = 667;
  34312. t.divide = 584;
  34313. t.Yacute = 667;
  34314. t.Acircumflex = 722;
  34315. t.aacute = 556;
  34316. t.Ucircumflex = 722;
  34317. t.yacute = 556;
  34318. t.scommaaccent = 556;
  34319. t.ecircumflex = 556;
  34320. t.Uring = 722;
  34321. t.Udieresis = 722;
  34322. t.aogonek = 556;
  34323. t.Uacute = 722;
  34324. t.uogonek = 611;
  34325. t.Edieresis = 667;
  34326. t.Dcroat = 722;
  34327. t.commaaccent = 250;
  34328. t.copyright = 737;
  34329. t.Emacron = 667;
  34330. t.ccaron = 556;
  34331. t.aring = 556;
  34332. t.Ncommaaccent = 722;
  34333. t.lacute = 278;
  34334. t.agrave = 556;
  34335. t.Tcommaaccent = 611;
  34336. t.Cacute = 722;
  34337. t.atilde = 556;
  34338. t.Edotaccent = 667;
  34339. t.scaron = 556;
  34340. t.scedilla = 556;
  34341. t.iacute = 278;
  34342. t.lozenge = 494;
  34343. t.Rcaron = 722;
  34344. t.Gcommaaccent = 778;
  34345. t.ucircumflex = 611;
  34346. t.acircumflex = 556;
  34347. t.Amacron = 722;
  34348. t.rcaron = 389;
  34349. t.ccedilla = 556;
  34350. t.Zdotaccent = 611;
  34351. t.Thorn = 667;
  34352. t.Omacron = 778;
  34353. t.Racute = 722;
  34354. t.Sacute = 667;
  34355. t.dcaron = 743;
  34356. t.Umacron = 722;
  34357. t.uring = 611;
  34358. t.threesuperior = 333;
  34359. t.Ograve = 778;
  34360. t.Agrave = 722;
  34361. t.Abreve = 722;
  34362. t.multiply = 584;
  34363. t.uacute = 611;
  34364. t.Tcaron = 611;
  34365. t.partialdiff = 494;
  34366. t.ydieresis = 556;
  34367. t.Nacute = 722;
  34368. t.icircumflex = 278;
  34369. t.Ecircumflex = 667;
  34370. t.adieresis = 556;
  34371. t.edieresis = 556;
  34372. t.cacute = 556;
  34373. t.nacute = 611;
  34374. t.umacron = 611;
  34375. t.Ncaron = 722;
  34376. t.Iacute = 278;
  34377. t.plusminus = 584;
  34378. t.brokenbar = 280;
  34379. t.registered = 737;
  34380. t.Gbreve = 778;
  34381. t.Idotaccent = 278;
  34382. t.summation = 600;
  34383. t.Egrave = 667;
  34384. t.racute = 389;
  34385. t.omacron = 611;
  34386. t.Zacute = 611;
  34387. t.Zcaron = 611;
  34388. t.greaterequal = 549;
  34389. t.Eth = 722;
  34390. t.Ccedilla = 722;
  34391. t.lcommaaccent = 278;
  34392. t.tcaron = 389;
  34393. t.eogonek = 556;
  34394. t.Uogonek = 722;
  34395. t.Aacute = 722;
  34396. t.Adieresis = 722;
  34397. t.egrave = 556;
  34398. t.zacute = 500;
  34399. t.iogonek = 278;
  34400. t.Oacute = 778;
  34401. t.oacute = 611;
  34402. t.amacron = 556;
  34403. t.sacute = 556;
  34404. t.idieresis = 278;
  34405. t.Ocircumflex = 778;
  34406. t.Ugrave = 722;
  34407. t.Delta = 612;
  34408. t.thorn = 611;
  34409. t.twosuperior = 333;
  34410. t.Odieresis = 778;
  34411. t.mu = 611;
  34412. t.igrave = 278;
  34413. t.ohungarumlaut = 611;
  34414. t.Eogonek = 667;
  34415. t.dcroat = 611;
  34416. t.threequarters = 834;
  34417. t.Scedilla = 667;
  34418. t.lcaron = 400;
  34419. t.Kcommaaccent = 722;
  34420. t.Lacute = 611;
  34421. t.trademark = 1000;
  34422. t.edotaccent = 556;
  34423. t.Igrave = 278;
  34424. t.Imacron = 278;
  34425. t.Lcaron = 611;
  34426. t.onehalf = 834;
  34427. t.lessequal = 549;
  34428. t.ocircumflex = 611;
  34429. t.ntilde = 611;
  34430. t.Uhungarumlaut = 722;
  34431. t.Eacute = 667;
  34432. t.emacron = 556;
  34433. t.gbreve = 611;
  34434. t.onequarter = 834;
  34435. t.Scaron = 667;
  34436. t.Scommaaccent = 667;
  34437. t.Ohungarumlaut = 778;
  34438. t.degree = 400;
  34439. t.ograve = 611;
  34440. t.Ccaron = 722;
  34441. t.ugrave = 611;
  34442. t.radical = 549;
  34443. t.Dcaron = 722;
  34444. t.rcommaaccent = 389;
  34445. t.Ntilde = 722;
  34446. t.otilde = 611;
  34447. t.Rcommaaccent = 722;
  34448. t.Lcommaaccent = 611;
  34449. t.Atilde = 722;
  34450. t.Aogonek = 722;
  34451. t.Aring = 722;
  34452. t.Otilde = 778;
  34453. t.zdotaccent = 500;
  34454. t.Ecaron = 667;
  34455. t.Iogonek = 278;
  34456. t.kcommaaccent = 556;
  34457. t.minus = 584;
  34458. t.Icircumflex = 278;
  34459. t.ncaron = 611;
  34460. t.tcommaaccent = 333;
  34461. t.logicalnot = 584;
  34462. t.odieresis = 611;
  34463. t.udieresis = 611;
  34464. t.notequal = 549;
  34465. t.gcommaaccent = 611;
  34466. t.eth = 611;
  34467. t.zcaron = 500;
  34468. t.ncommaaccent = 611;
  34469. t.onesuperior = 333;
  34470. t.imacron = 278;
  34471. t.Euro = 556;
  34472. });
  34473. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  34474. t.space = 278;
  34475. t.exclam = 333;
  34476. t.quotedbl = 474;
  34477. t.numbersign = 556;
  34478. t.dollar = 556;
  34479. t.percent = 889;
  34480. t.ampersand = 722;
  34481. t.quoteright = 278;
  34482. t.parenleft = 333;
  34483. t.parenright = 333;
  34484. t.asterisk = 389;
  34485. t.plus = 584;
  34486. t.comma = 278;
  34487. t.hyphen = 333;
  34488. t.period = 278;
  34489. t.slash = 278;
  34490. t.zero = 556;
  34491. t.one = 556;
  34492. t.two = 556;
  34493. t.three = 556;
  34494. t.four = 556;
  34495. t.five = 556;
  34496. t.six = 556;
  34497. t.seven = 556;
  34498. t.eight = 556;
  34499. t.nine = 556;
  34500. t.colon = 333;
  34501. t.semicolon = 333;
  34502. t.less = 584;
  34503. t.equal = 584;
  34504. t.greater = 584;
  34505. t.question = 611;
  34506. t.at = 975;
  34507. t.A = 722;
  34508. t.B = 722;
  34509. t.C = 722;
  34510. t.D = 722;
  34511. t.E = 667;
  34512. t.F = 611;
  34513. t.G = 778;
  34514. t.H = 722;
  34515. t.I = 278;
  34516. t.J = 556;
  34517. t.K = 722;
  34518. t.L = 611;
  34519. t.M = 833;
  34520. t.N = 722;
  34521. t.O = 778;
  34522. t.P = 667;
  34523. t.Q = 778;
  34524. t.R = 722;
  34525. t.S = 667;
  34526. t.T = 611;
  34527. t.U = 722;
  34528. t.V = 667;
  34529. t.W = 944;
  34530. t.X = 667;
  34531. t.Y = 667;
  34532. t.Z = 611;
  34533. t.bracketleft = 333;
  34534. t.backslash = 278;
  34535. t.bracketright = 333;
  34536. t.asciicircum = 584;
  34537. t.underscore = 556;
  34538. t.quoteleft = 278;
  34539. t.a = 556;
  34540. t.b = 611;
  34541. t.c = 556;
  34542. t.d = 611;
  34543. t.e = 556;
  34544. t.f = 333;
  34545. t.g = 611;
  34546. t.h = 611;
  34547. t.i = 278;
  34548. t.j = 278;
  34549. t.k = 556;
  34550. t.l = 278;
  34551. t.m = 889;
  34552. t.n = 611;
  34553. t.o = 611;
  34554. t.p = 611;
  34555. t.q = 611;
  34556. t.r = 389;
  34557. t.s = 556;
  34558. t.t = 333;
  34559. t.u = 611;
  34560. t.v = 556;
  34561. t.w = 778;
  34562. t.x = 556;
  34563. t.y = 556;
  34564. t.z = 500;
  34565. t.braceleft = 389;
  34566. t.bar = 280;
  34567. t.braceright = 389;
  34568. t.asciitilde = 584;
  34569. t.exclamdown = 333;
  34570. t.cent = 556;
  34571. t.sterling = 556;
  34572. t.fraction = 167;
  34573. t.yen = 556;
  34574. t.florin = 556;
  34575. t.section = 556;
  34576. t.currency = 556;
  34577. t.quotesingle = 238;
  34578. t.quotedblleft = 500;
  34579. t.guillemotleft = 556;
  34580. t.guilsinglleft = 333;
  34581. t.guilsinglright = 333;
  34582. t.fi = 611;
  34583. t.fl = 611;
  34584. t.endash = 556;
  34585. t.dagger = 556;
  34586. t.daggerdbl = 556;
  34587. t.periodcentered = 278;
  34588. t.paragraph = 556;
  34589. t.bullet = 350;
  34590. t.quotesinglbase = 278;
  34591. t.quotedblbase = 500;
  34592. t.quotedblright = 500;
  34593. t.guillemotright = 556;
  34594. t.ellipsis = 1000;
  34595. t.perthousand = 1000;
  34596. t.questiondown = 611;
  34597. t.grave = 333;
  34598. t.acute = 333;
  34599. t.circumflex = 333;
  34600. t.tilde = 333;
  34601. t.macron = 333;
  34602. t.breve = 333;
  34603. t.dotaccent = 333;
  34604. t.dieresis = 333;
  34605. t.ring = 333;
  34606. t.cedilla = 333;
  34607. t.hungarumlaut = 333;
  34608. t.ogonek = 333;
  34609. t.caron = 333;
  34610. t.emdash = 1000;
  34611. t.AE = 1000;
  34612. t.ordfeminine = 370;
  34613. t.Lslash = 611;
  34614. t.Oslash = 778;
  34615. t.OE = 1000;
  34616. t.ordmasculine = 365;
  34617. t.ae = 889;
  34618. t.dotlessi = 278;
  34619. t.lslash = 278;
  34620. t.oslash = 611;
  34621. t.oe = 944;
  34622. t.germandbls = 611;
  34623. t.Idieresis = 278;
  34624. t.eacute = 556;
  34625. t.abreve = 556;
  34626. t.uhungarumlaut = 611;
  34627. t.ecaron = 556;
  34628. t.Ydieresis = 667;
  34629. t.divide = 584;
  34630. t.Yacute = 667;
  34631. t.Acircumflex = 722;
  34632. t.aacute = 556;
  34633. t.Ucircumflex = 722;
  34634. t.yacute = 556;
  34635. t.scommaaccent = 556;
  34636. t.ecircumflex = 556;
  34637. t.Uring = 722;
  34638. t.Udieresis = 722;
  34639. t.aogonek = 556;
  34640. t.Uacute = 722;
  34641. t.uogonek = 611;
  34642. t.Edieresis = 667;
  34643. t.Dcroat = 722;
  34644. t.commaaccent = 250;
  34645. t.copyright = 737;
  34646. t.Emacron = 667;
  34647. t.ccaron = 556;
  34648. t.aring = 556;
  34649. t.Ncommaaccent = 722;
  34650. t.lacute = 278;
  34651. t.agrave = 556;
  34652. t.Tcommaaccent = 611;
  34653. t.Cacute = 722;
  34654. t.atilde = 556;
  34655. t.Edotaccent = 667;
  34656. t.scaron = 556;
  34657. t.scedilla = 556;
  34658. t.iacute = 278;
  34659. t.lozenge = 494;
  34660. t.Rcaron = 722;
  34661. t.Gcommaaccent = 778;
  34662. t.ucircumflex = 611;
  34663. t.acircumflex = 556;
  34664. t.Amacron = 722;
  34665. t.rcaron = 389;
  34666. t.ccedilla = 556;
  34667. t.Zdotaccent = 611;
  34668. t.Thorn = 667;
  34669. t.Omacron = 778;
  34670. t.Racute = 722;
  34671. t.Sacute = 667;
  34672. t.dcaron = 743;
  34673. t.Umacron = 722;
  34674. t.uring = 611;
  34675. t.threesuperior = 333;
  34676. t.Ograve = 778;
  34677. t.Agrave = 722;
  34678. t.Abreve = 722;
  34679. t.multiply = 584;
  34680. t.uacute = 611;
  34681. t.Tcaron = 611;
  34682. t.partialdiff = 494;
  34683. t.ydieresis = 556;
  34684. t.Nacute = 722;
  34685. t.icircumflex = 278;
  34686. t.Ecircumflex = 667;
  34687. t.adieresis = 556;
  34688. t.edieresis = 556;
  34689. t.cacute = 556;
  34690. t.nacute = 611;
  34691. t.umacron = 611;
  34692. t.Ncaron = 722;
  34693. t.Iacute = 278;
  34694. t.plusminus = 584;
  34695. t.brokenbar = 280;
  34696. t.registered = 737;
  34697. t.Gbreve = 778;
  34698. t.Idotaccent = 278;
  34699. t.summation = 600;
  34700. t.Egrave = 667;
  34701. t.racute = 389;
  34702. t.omacron = 611;
  34703. t.Zacute = 611;
  34704. t.Zcaron = 611;
  34705. t.greaterequal = 549;
  34706. t.Eth = 722;
  34707. t.Ccedilla = 722;
  34708. t.lcommaaccent = 278;
  34709. t.tcaron = 389;
  34710. t.eogonek = 556;
  34711. t.Uogonek = 722;
  34712. t.Aacute = 722;
  34713. t.Adieresis = 722;
  34714. t.egrave = 556;
  34715. t.zacute = 500;
  34716. t.iogonek = 278;
  34717. t.Oacute = 778;
  34718. t.oacute = 611;
  34719. t.amacron = 556;
  34720. t.sacute = 556;
  34721. t.idieresis = 278;
  34722. t.Ocircumflex = 778;
  34723. t.Ugrave = 722;
  34724. t.Delta = 612;
  34725. t.thorn = 611;
  34726. t.twosuperior = 333;
  34727. t.Odieresis = 778;
  34728. t.mu = 611;
  34729. t.igrave = 278;
  34730. t.ohungarumlaut = 611;
  34731. t.Eogonek = 667;
  34732. t.dcroat = 611;
  34733. t.threequarters = 834;
  34734. t.Scedilla = 667;
  34735. t.lcaron = 400;
  34736. t.Kcommaaccent = 722;
  34737. t.Lacute = 611;
  34738. t.trademark = 1000;
  34739. t.edotaccent = 556;
  34740. t.Igrave = 278;
  34741. t.Imacron = 278;
  34742. t.Lcaron = 611;
  34743. t.onehalf = 834;
  34744. t.lessequal = 549;
  34745. t.ocircumflex = 611;
  34746. t.ntilde = 611;
  34747. t.Uhungarumlaut = 722;
  34748. t.Eacute = 667;
  34749. t.emacron = 556;
  34750. t.gbreve = 611;
  34751. t.onequarter = 834;
  34752. t.Scaron = 667;
  34753. t.Scommaaccent = 667;
  34754. t.Ohungarumlaut = 778;
  34755. t.degree = 400;
  34756. t.ograve = 611;
  34757. t.Ccaron = 722;
  34758. t.ugrave = 611;
  34759. t.radical = 549;
  34760. t.Dcaron = 722;
  34761. t.rcommaaccent = 389;
  34762. t.Ntilde = 722;
  34763. t.otilde = 611;
  34764. t.Rcommaaccent = 722;
  34765. t.Lcommaaccent = 611;
  34766. t.Atilde = 722;
  34767. t.Aogonek = 722;
  34768. t.Aring = 722;
  34769. t.Otilde = 778;
  34770. t.zdotaccent = 500;
  34771. t.Ecaron = 667;
  34772. t.Iogonek = 278;
  34773. t.kcommaaccent = 556;
  34774. t.minus = 584;
  34775. t.Icircumflex = 278;
  34776. t.ncaron = 611;
  34777. t.tcommaaccent = 333;
  34778. t.logicalnot = 584;
  34779. t.odieresis = 611;
  34780. t.udieresis = 611;
  34781. t.notequal = 549;
  34782. t.gcommaaccent = 611;
  34783. t.eth = 611;
  34784. t.zcaron = 500;
  34785. t.ncommaaccent = 611;
  34786. t.onesuperior = 333;
  34787. t.imacron = 278;
  34788. t.Euro = 556;
  34789. });
  34790. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  34791. t.space = 278;
  34792. t.exclam = 278;
  34793. t.quotedbl = 355;
  34794. t.numbersign = 556;
  34795. t.dollar = 556;
  34796. t.percent = 889;
  34797. t.ampersand = 667;
  34798. t.quoteright = 222;
  34799. t.parenleft = 333;
  34800. t.parenright = 333;
  34801. t.asterisk = 389;
  34802. t.plus = 584;
  34803. t.comma = 278;
  34804. t.hyphen = 333;
  34805. t.period = 278;
  34806. t.slash = 278;
  34807. t.zero = 556;
  34808. t.one = 556;
  34809. t.two = 556;
  34810. t.three = 556;
  34811. t.four = 556;
  34812. t.five = 556;
  34813. t.six = 556;
  34814. t.seven = 556;
  34815. t.eight = 556;
  34816. t.nine = 556;
  34817. t.colon = 278;
  34818. t.semicolon = 278;
  34819. t.less = 584;
  34820. t.equal = 584;
  34821. t.greater = 584;
  34822. t.question = 556;
  34823. t.at = 1015;
  34824. t.A = 667;
  34825. t.B = 667;
  34826. t.C = 722;
  34827. t.D = 722;
  34828. t.E = 667;
  34829. t.F = 611;
  34830. t.G = 778;
  34831. t.H = 722;
  34832. t.I = 278;
  34833. t.J = 500;
  34834. t.K = 667;
  34835. t.L = 556;
  34836. t.M = 833;
  34837. t.N = 722;
  34838. t.O = 778;
  34839. t.P = 667;
  34840. t.Q = 778;
  34841. t.R = 722;
  34842. t.S = 667;
  34843. t.T = 611;
  34844. t.U = 722;
  34845. t.V = 667;
  34846. t.W = 944;
  34847. t.X = 667;
  34848. t.Y = 667;
  34849. t.Z = 611;
  34850. t.bracketleft = 278;
  34851. t.backslash = 278;
  34852. t.bracketright = 278;
  34853. t.asciicircum = 469;
  34854. t.underscore = 556;
  34855. t.quoteleft = 222;
  34856. t.a = 556;
  34857. t.b = 556;
  34858. t.c = 500;
  34859. t.d = 556;
  34860. t.e = 556;
  34861. t.f = 278;
  34862. t.g = 556;
  34863. t.h = 556;
  34864. t.i = 222;
  34865. t.j = 222;
  34866. t.k = 500;
  34867. t.l = 222;
  34868. t.m = 833;
  34869. t.n = 556;
  34870. t.o = 556;
  34871. t.p = 556;
  34872. t.q = 556;
  34873. t.r = 333;
  34874. t.s = 500;
  34875. t.t = 278;
  34876. t.u = 556;
  34877. t.v = 500;
  34878. t.w = 722;
  34879. t.x = 500;
  34880. t.y = 500;
  34881. t.z = 500;
  34882. t.braceleft = 334;
  34883. t.bar = 260;
  34884. t.braceright = 334;
  34885. t.asciitilde = 584;
  34886. t.exclamdown = 333;
  34887. t.cent = 556;
  34888. t.sterling = 556;
  34889. t.fraction = 167;
  34890. t.yen = 556;
  34891. t.florin = 556;
  34892. t.section = 556;
  34893. t.currency = 556;
  34894. t.quotesingle = 191;
  34895. t.quotedblleft = 333;
  34896. t.guillemotleft = 556;
  34897. t.guilsinglleft = 333;
  34898. t.guilsinglright = 333;
  34899. t.fi = 500;
  34900. t.fl = 500;
  34901. t.endash = 556;
  34902. t.dagger = 556;
  34903. t.daggerdbl = 556;
  34904. t.periodcentered = 278;
  34905. t.paragraph = 537;
  34906. t.bullet = 350;
  34907. t.quotesinglbase = 222;
  34908. t.quotedblbase = 333;
  34909. t.quotedblright = 333;
  34910. t.guillemotright = 556;
  34911. t.ellipsis = 1000;
  34912. t.perthousand = 1000;
  34913. t.questiondown = 611;
  34914. t.grave = 333;
  34915. t.acute = 333;
  34916. t.circumflex = 333;
  34917. t.tilde = 333;
  34918. t.macron = 333;
  34919. t.breve = 333;
  34920. t.dotaccent = 333;
  34921. t.dieresis = 333;
  34922. t.ring = 333;
  34923. t.cedilla = 333;
  34924. t.hungarumlaut = 333;
  34925. t.ogonek = 333;
  34926. t.caron = 333;
  34927. t.emdash = 1000;
  34928. t.AE = 1000;
  34929. t.ordfeminine = 370;
  34930. t.Lslash = 556;
  34931. t.Oslash = 778;
  34932. t.OE = 1000;
  34933. t.ordmasculine = 365;
  34934. t.ae = 889;
  34935. t.dotlessi = 278;
  34936. t.lslash = 222;
  34937. t.oslash = 611;
  34938. t.oe = 944;
  34939. t.germandbls = 611;
  34940. t.Idieresis = 278;
  34941. t.eacute = 556;
  34942. t.abreve = 556;
  34943. t.uhungarumlaut = 556;
  34944. t.ecaron = 556;
  34945. t.Ydieresis = 667;
  34946. t.divide = 584;
  34947. t.Yacute = 667;
  34948. t.Acircumflex = 667;
  34949. t.aacute = 556;
  34950. t.Ucircumflex = 722;
  34951. t.yacute = 500;
  34952. t.scommaaccent = 500;
  34953. t.ecircumflex = 556;
  34954. t.Uring = 722;
  34955. t.Udieresis = 722;
  34956. t.aogonek = 556;
  34957. t.Uacute = 722;
  34958. t.uogonek = 556;
  34959. t.Edieresis = 667;
  34960. t.Dcroat = 722;
  34961. t.commaaccent = 250;
  34962. t.copyright = 737;
  34963. t.Emacron = 667;
  34964. t.ccaron = 500;
  34965. t.aring = 556;
  34966. t.Ncommaaccent = 722;
  34967. t.lacute = 222;
  34968. t.agrave = 556;
  34969. t.Tcommaaccent = 611;
  34970. t.Cacute = 722;
  34971. t.atilde = 556;
  34972. t.Edotaccent = 667;
  34973. t.scaron = 500;
  34974. t.scedilla = 500;
  34975. t.iacute = 278;
  34976. t.lozenge = 471;
  34977. t.Rcaron = 722;
  34978. t.Gcommaaccent = 778;
  34979. t.ucircumflex = 556;
  34980. t.acircumflex = 556;
  34981. t.Amacron = 667;
  34982. t.rcaron = 333;
  34983. t.ccedilla = 500;
  34984. t.Zdotaccent = 611;
  34985. t.Thorn = 667;
  34986. t.Omacron = 778;
  34987. t.Racute = 722;
  34988. t.Sacute = 667;
  34989. t.dcaron = 643;
  34990. t.Umacron = 722;
  34991. t.uring = 556;
  34992. t.threesuperior = 333;
  34993. t.Ograve = 778;
  34994. t.Agrave = 667;
  34995. t.Abreve = 667;
  34996. t.multiply = 584;
  34997. t.uacute = 556;
  34998. t.Tcaron = 611;
  34999. t.partialdiff = 476;
  35000. t.ydieresis = 500;
  35001. t.Nacute = 722;
  35002. t.icircumflex = 278;
  35003. t.Ecircumflex = 667;
  35004. t.adieresis = 556;
  35005. t.edieresis = 556;
  35006. t.cacute = 500;
  35007. t.nacute = 556;
  35008. t.umacron = 556;
  35009. t.Ncaron = 722;
  35010. t.Iacute = 278;
  35011. t.plusminus = 584;
  35012. t.brokenbar = 260;
  35013. t.registered = 737;
  35014. t.Gbreve = 778;
  35015. t.Idotaccent = 278;
  35016. t.summation = 600;
  35017. t.Egrave = 667;
  35018. t.racute = 333;
  35019. t.omacron = 556;
  35020. t.Zacute = 611;
  35021. t.Zcaron = 611;
  35022. t.greaterequal = 549;
  35023. t.Eth = 722;
  35024. t.Ccedilla = 722;
  35025. t.lcommaaccent = 222;
  35026. t.tcaron = 317;
  35027. t.eogonek = 556;
  35028. t.Uogonek = 722;
  35029. t.Aacute = 667;
  35030. t.Adieresis = 667;
  35031. t.egrave = 556;
  35032. t.zacute = 500;
  35033. t.iogonek = 222;
  35034. t.Oacute = 778;
  35035. t.oacute = 556;
  35036. t.amacron = 556;
  35037. t.sacute = 500;
  35038. t.idieresis = 278;
  35039. t.Ocircumflex = 778;
  35040. t.Ugrave = 722;
  35041. t.Delta = 612;
  35042. t.thorn = 556;
  35043. t.twosuperior = 333;
  35044. t.Odieresis = 778;
  35045. t.mu = 556;
  35046. t.igrave = 278;
  35047. t.ohungarumlaut = 556;
  35048. t.Eogonek = 667;
  35049. t.dcroat = 556;
  35050. t.threequarters = 834;
  35051. t.Scedilla = 667;
  35052. t.lcaron = 299;
  35053. t.Kcommaaccent = 667;
  35054. t.Lacute = 556;
  35055. t.trademark = 1000;
  35056. t.edotaccent = 556;
  35057. t.Igrave = 278;
  35058. t.Imacron = 278;
  35059. t.Lcaron = 556;
  35060. t.onehalf = 834;
  35061. t.lessequal = 549;
  35062. t.ocircumflex = 556;
  35063. t.ntilde = 556;
  35064. t.Uhungarumlaut = 722;
  35065. t.Eacute = 667;
  35066. t.emacron = 556;
  35067. t.gbreve = 556;
  35068. t.onequarter = 834;
  35069. t.Scaron = 667;
  35070. t.Scommaaccent = 667;
  35071. t.Ohungarumlaut = 778;
  35072. t.degree = 400;
  35073. t.ograve = 556;
  35074. t.Ccaron = 722;
  35075. t.ugrave = 556;
  35076. t.radical = 453;
  35077. t.Dcaron = 722;
  35078. t.rcommaaccent = 333;
  35079. t.Ntilde = 722;
  35080. t.otilde = 556;
  35081. t.Rcommaaccent = 722;
  35082. t.Lcommaaccent = 556;
  35083. t.Atilde = 667;
  35084. t.Aogonek = 667;
  35085. t.Aring = 667;
  35086. t.Otilde = 778;
  35087. t.zdotaccent = 500;
  35088. t.Ecaron = 667;
  35089. t.Iogonek = 278;
  35090. t.kcommaaccent = 500;
  35091. t.minus = 584;
  35092. t.Icircumflex = 278;
  35093. t.ncaron = 556;
  35094. t.tcommaaccent = 278;
  35095. t.logicalnot = 584;
  35096. t.odieresis = 556;
  35097. t.udieresis = 556;
  35098. t.notequal = 549;
  35099. t.gcommaaccent = 556;
  35100. t.eth = 556;
  35101. t.zcaron = 500;
  35102. t.ncommaaccent = 556;
  35103. t.onesuperior = 333;
  35104. t.imacron = 278;
  35105. t.Euro = 556;
  35106. });
  35107. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  35108. t.space = 250;
  35109. t.exclam = 333;
  35110. t.universal = 713;
  35111. t.numbersign = 500;
  35112. t.existential = 549;
  35113. t.percent = 833;
  35114. t.ampersand = 778;
  35115. t.suchthat = 439;
  35116. t.parenleft = 333;
  35117. t.parenright = 333;
  35118. t.asteriskmath = 500;
  35119. t.plus = 549;
  35120. t.comma = 250;
  35121. t.minus = 549;
  35122. t.period = 250;
  35123. t.slash = 278;
  35124. t.zero = 500;
  35125. t.one = 500;
  35126. t.two = 500;
  35127. t.three = 500;
  35128. t.four = 500;
  35129. t.five = 500;
  35130. t.six = 500;
  35131. t.seven = 500;
  35132. t.eight = 500;
  35133. t.nine = 500;
  35134. t.colon = 278;
  35135. t.semicolon = 278;
  35136. t.less = 549;
  35137. t.equal = 549;
  35138. t.greater = 549;
  35139. t.question = 444;
  35140. t.congruent = 549;
  35141. t.Alpha = 722;
  35142. t.Beta = 667;
  35143. t.Chi = 722;
  35144. t.Delta = 612;
  35145. t.Epsilon = 611;
  35146. t.Phi = 763;
  35147. t.Gamma = 603;
  35148. t.Eta = 722;
  35149. t.Iota = 333;
  35150. t.theta1 = 631;
  35151. t.Kappa = 722;
  35152. t.Lambda = 686;
  35153. t.Mu = 889;
  35154. t.Nu = 722;
  35155. t.Omicron = 722;
  35156. t.Pi = 768;
  35157. t.Theta = 741;
  35158. t.Rho = 556;
  35159. t.Sigma = 592;
  35160. t.Tau = 611;
  35161. t.Upsilon = 690;
  35162. t.sigma1 = 439;
  35163. t.Omega = 768;
  35164. t.Xi = 645;
  35165. t.Psi = 795;
  35166. t.Zeta = 611;
  35167. t.bracketleft = 333;
  35168. t.therefore = 863;
  35169. t.bracketright = 333;
  35170. t.perpendicular = 658;
  35171. t.underscore = 500;
  35172. t.radicalex = 500;
  35173. t.alpha = 631;
  35174. t.beta = 549;
  35175. t.chi = 549;
  35176. t.delta = 494;
  35177. t.epsilon = 439;
  35178. t.phi = 521;
  35179. t.gamma = 411;
  35180. t.eta = 603;
  35181. t.iota = 329;
  35182. t.phi1 = 603;
  35183. t.kappa = 549;
  35184. t.lambda = 549;
  35185. t.mu = 576;
  35186. t.nu = 521;
  35187. t.omicron = 549;
  35188. t.pi = 549;
  35189. t.theta = 521;
  35190. t.rho = 549;
  35191. t.sigma = 603;
  35192. t.tau = 439;
  35193. t.upsilon = 576;
  35194. t.omega1 = 713;
  35195. t.omega = 686;
  35196. t.xi = 493;
  35197. t.psi = 686;
  35198. t.zeta = 494;
  35199. t.braceleft = 480;
  35200. t.bar = 200;
  35201. t.braceright = 480;
  35202. t.similar = 549;
  35203. t.Euro = 750;
  35204. t.Upsilon1 = 620;
  35205. t.minute = 247;
  35206. t.lessequal = 549;
  35207. t.fraction = 167;
  35208. t.infinity = 713;
  35209. t.florin = 500;
  35210. t.club = 753;
  35211. t.diamond = 753;
  35212. t.heart = 753;
  35213. t.spade = 753;
  35214. t.arrowboth = 1042;
  35215. t.arrowleft = 987;
  35216. t.arrowup = 603;
  35217. t.arrowright = 987;
  35218. t.arrowdown = 603;
  35219. t.degree = 400;
  35220. t.plusminus = 549;
  35221. t.second = 411;
  35222. t.greaterequal = 549;
  35223. t.multiply = 549;
  35224. t.proportional = 713;
  35225. t.partialdiff = 494;
  35226. t.bullet = 460;
  35227. t.divide = 549;
  35228. t.notequal = 549;
  35229. t.equivalence = 549;
  35230. t.approxequal = 549;
  35231. t.ellipsis = 1000;
  35232. t.arrowvertex = 603;
  35233. t.arrowhorizex = 1000;
  35234. t.carriagereturn = 658;
  35235. t.aleph = 823;
  35236. t.Ifraktur = 686;
  35237. t.Rfraktur = 795;
  35238. t.weierstrass = 987;
  35239. t.circlemultiply = 768;
  35240. t.circleplus = 768;
  35241. t.emptyset = 823;
  35242. t.intersection = 768;
  35243. t.union = 768;
  35244. t.propersuperset = 713;
  35245. t.reflexsuperset = 713;
  35246. t.notsubset = 713;
  35247. t.propersubset = 713;
  35248. t.reflexsubset = 713;
  35249. t.element = 713;
  35250. t.notelement = 713;
  35251. t.angle = 768;
  35252. t.gradient = 713;
  35253. t.registerserif = 790;
  35254. t.copyrightserif = 790;
  35255. t.trademarkserif = 890;
  35256. t.product = 823;
  35257. t.radical = 549;
  35258. t.dotmath = 250;
  35259. t.logicalnot = 713;
  35260. t.logicaland = 603;
  35261. t.logicalor = 603;
  35262. t.arrowdblboth = 1042;
  35263. t.arrowdblleft = 987;
  35264. t.arrowdblup = 603;
  35265. t.arrowdblright = 987;
  35266. t.arrowdbldown = 603;
  35267. t.lozenge = 494;
  35268. t.angleleft = 329;
  35269. t.registersans = 790;
  35270. t.copyrightsans = 790;
  35271. t.trademarksans = 786;
  35272. t.summation = 713;
  35273. t.parenlefttp = 384;
  35274. t.parenleftex = 384;
  35275. t.parenleftbt = 384;
  35276. t.bracketlefttp = 384;
  35277. t.bracketleftex = 384;
  35278. t.bracketleftbt = 384;
  35279. t.bracelefttp = 494;
  35280. t.braceleftmid = 494;
  35281. t.braceleftbt = 494;
  35282. t.braceex = 494;
  35283. t.angleright = 329;
  35284. t.integral = 274;
  35285. t.integraltp = 686;
  35286. t.integralex = 686;
  35287. t.integralbt = 686;
  35288. t.parenrighttp = 384;
  35289. t.parenrightex = 384;
  35290. t.parenrightbt = 384;
  35291. t.bracketrighttp = 384;
  35292. t.bracketrightex = 384;
  35293. t.bracketrightbt = 384;
  35294. t.bracerighttp = 494;
  35295. t.bracerightmid = 494;
  35296. t.bracerightbt = 494;
  35297. t.apple = 790;
  35298. });
  35299. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35300. t.space = 250;
  35301. t.exclam = 333;
  35302. t.quotedbl = 408;
  35303. t.numbersign = 500;
  35304. t.dollar = 500;
  35305. t.percent = 833;
  35306. t.ampersand = 778;
  35307. t.quoteright = 333;
  35308. t.parenleft = 333;
  35309. t.parenright = 333;
  35310. t.asterisk = 500;
  35311. t.plus = 564;
  35312. t.comma = 250;
  35313. t.hyphen = 333;
  35314. t.period = 250;
  35315. t.slash = 278;
  35316. t.zero = 500;
  35317. t.one = 500;
  35318. t.two = 500;
  35319. t.three = 500;
  35320. t.four = 500;
  35321. t.five = 500;
  35322. t.six = 500;
  35323. t.seven = 500;
  35324. t.eight = 500;
  35325. t.nine = 500;
  35326. t.colon = 278;
  35327. t.semicolon = 278;
  35328. t.less = 564;
  35329. t.equal = 564;
  35330. t.greater = 564;
  35331. t.question = 444;
  35332. t.at = 921;
  35333. t.A = 722;
  35334. t.B = 667;
  35335. t.C = 667;
  35336. t.D = 722;
  35337. t.E = 611;
  35338. t.F = 556;
  35339. t.G = 722;
  35340. t.H = 722;
  35341. t.I = 333;
  35342. t.J = 389;
  35343. t.K = 722;
  35344. t.L = 611;
  35345. t.M = 889;
  35346. t.N = 722;
  35347. t.O = 722;
  35348. t.P = 556;
  35349. t.Q = 722;
  35350. t.R = 667;
  35351. t.S = 556;
  35352. t.T = 611;
  35353. t.U = 722;
  35354. t.V = 722;
  35355. t.W = 944;
  35356. t.X = 722;
  35357. t.Y = 722;
  35358. t.Z = 611;
  35359. t.bracketleft = 333;
  35360. t.backslash = 278;
  35361. t.bracketright = 333;
  35362. t.asciicircum = 469;
  35363. t.underscore = 500;
  35364. t.quoteleft = 333;
  35365. t.a = 444;
  35366. t.b = 500;
  35367. t.c = 444;
  35368. t.d = 500;
  35369. t.e = 444;
  35370. t.f = 333;
  35371. t.g = 500;
  35372. t.h = 500;
  35373. t.i = 278;
  35374. t.j = 278;
  35375. t.k = 500;
  35376. t.l = 278;
  35377. t.m = 778;
  35378. t.n = 500;
  35379. t.o = 500;
  35380. t.p = 500;
  35381. t.q = 500;
  35382. t.r = 333;
  35383. t.s = 389;
  35384. t.t = 278;
  35385. t.u = 500;
  35386. t.v = 500;
  35387. t.w = 722;
  35388. t.x = 500;
  35389. t.y = 500;
  35390. t.z = 444;
  35391. t.braceleft = 480;
  35392. t.bar = 200;
  35393. t.braceright = 480;
  35394. t.asciitilde = 541;
  35395. t.exclamdown = 333;
  35396. t.cent = 500;
  35397. t.sterling = 500;
  35398. t.fraction = 167;
  35399. t.yen = 500;
  35400. t.florin = 500;
  35401. t.section = 500;
  35402. t.currency = 500;
  35403. t.quotesingle = 180;
  35404. t.quotedblleft = 444;
  35405. t.guillemotleft = 500;
  35406. t.guilsinglleft = 333;
  35407. t.guilsinglright = 333;
  35408. t.fi = 556;
  35409. t.fl = 556;
  35410. t.endash = 500;
  35411. t.dagger = 500;
  35412. t.daggerdbl = 500;
  35413. t.periodcentered = 250;
  35414. t.paragraph = 453;
  35415. t.bullet = 350;
  35416. t.quotesinglbase = 333;
  35417. t.quotedblbase = 444;
  35418. t.quotedblright = 444;
  35419. t.guillemotright = 500;
  35420. t.ellipsis = 1000;
  35421. t.perthousand = 1000;
  35422. t.questiondown = 444;
  35423. t.grave = 333;
  35424. t.acute = 333;
  35425. t.circumflex = 333;
  35426. t.tilde = 333;
  35427. t.macron = 333;
  35428. t.breve = 333;
  35429. t.dotaccent = 333;
  35430. t.dieresis = 333;
  35431. t.ring = 333;
  35432. t.cedilla = 333;
  35433. t.hungarumlaut = 333;
  35434. t.ogonek = 333;
  35435. t.caron = 333;
  35436. t.emdash = 1000;
  35437. t.AE = 889;
  35438. t.ordfeminine = 276;
  35439. t.Lslash = 611;
  35440. t.Oslash = 722;
  35441. t.OE = 889;
  35442. t.ordmasculine = 310;
  35443. t.ae = 667;
  35444. t.dotlessi = 278;
  35445. t.lslash = 278;
  35446. t.oslash = 500;
  35447. t.oe = 722;
  35448. t.germandbls = 500;
  35449. t.Idieresis = 333;
  35450. t.eacute = 444;
  35451. t.abreve = 444;
  35452. t.uhungarumlaut = 500;
  35453. t.ecaron = 444;
  35454. t.Ydieresis = 722;
  35455. t.divide = 564;
  35456. t.Yacute = 722;
  35457. t.Acircumflex = 722;
  35458. t.aacute = 444;
  35459. t.Ucircumflex = 722;
  35460. t.yacute = 500;
  35461. t.scommaaccent = 389;
  35462. t.ecircumflex = 444;
  35463. t.Uring = 722;
  35464. t.Udieresis = 722;
  35465. t.aogonek = 444;
  35466. t.Uacute = 722;
  35467. t.uogonek = 500;
  35468. t.Edieresis = 611;
  35469. t.Dcroat = 722;
  35470. t.commaaccent = 250;
  35471. t.copyright = 760;
  35472. t.Emacron = 611;
  35473. t.ccaron = 444;
  35474. t.aring = 444;
  35475. t.Ncommaaccent = 722;
  35476. t.lacute = 278;
  35477. t.agrave = 444;
  35478. t.Tcommaaccent = 611;
  35479. t.Cacute = 667;
  35480. t.atilde = 444;
  35481. t.Edotaccent = 611;
  35482. t.scaron = 389;
  35483. t.scedilla = 389;
  35484. t.iacute = 278;
  35485. t.lozenge = 471;
  35486. t.Rcaron = 667;
  35487. t.Gcommaaccent = 722;
  35488. t.ucircumflex = 500;
  35489. t.acircumflex = 444;
  35490. t.Amacron = 722;
  35491. t.rcaron = 333;
  35492. t.ccedilla = 444;
  35493. t.Zdotaccent = 611;
  35494. t.Thorn = 556;
  35495. t.Omacron = 722;
  35496. t.Racute = 667;
  35497. t.Sacute = 556;
  35498. t.dcaron = 588;
  35499. t.Umacron = 722;
  35500. t.uring = 500;
  35501. t.threesuperior = 300;
  35502. t.Ograve = 722;
  35503. t.Agrave = 722;
  35504. t.Abreve = 722;
  35505. t.multiply = 564;
  35506. t.uacute = 500;
  35507. t.Tcaron = 611;
  35508. t.partialdiff = 476;
  35509. t.ydieresis = 500;
  35510. t.Nacute = 722;
  35511. t.icircumflex = 278;
  35512. t.Ecircumflex = 611;
  35513. t.adieresis = 444;
  35514. t.edieresis = 444;
  35515. t.cacute = 444;
  35516. t.nacute = 500;
  35517. t.umacron = 500;
  35518. t.Ncaron = 722;
  35519. t.Iacute = 333;
  35520. t.plusminus = 564;
  35521. t.brokenbar = 200;
  35522. t.registered = 760;
  35523. t.Gbreve = 722;
  35524. t.Idotaccent = 333;
  35525. t.summation = 600;
  35526. t.Egrave = 611;
  35527. t.racute = 333;
  35528. t.omacron = 500;
  35529. t.Zacute = 611;
  35530. t.Zcaron = 611;
  35531. t.greaterequal = 549;
  35532. t.Eth = 722;
  35533. t.Ccedilla = 667;
  35534. t.lcommaaccent = 278;
  35535. t.tcaron = 326;
  35536. t.eogonek = 444;
  35537. t.Uogonek = 722;
  35538. t.Aacute = 722;
  35539. t.Adieresis = 722;
  35540. t.egrave = 444;
  35541. t.zacute = 444;
  35542. t.iogonek = 278;
  35543. t.Oacute = 722;
  35544. t.oacute = 500;
  35545. t.amacron = 444;
  35546. t.sacute = 389;
  35547. t.idieresis = 278;
  35548. t.Ocircumflex = 722;
  35549. t.Ugrave = 722;
  35550. t.Delta = 612;
  35551. t.thorn = 500;
  35552. t.twosuperior = 300;
  35553. t.Odieresis = 722;
  35554. t.mu = 500;
  35555. t.igrave = 278;
  35556. t.ohungarumlaut = 500;
  35557. t.Eogonek = 611;
  35558. t.dcroat = 500;
  35559. t.threequarters = 750;
  35560. t.Scedilla = 556;
  35561. t.lcaron = 344;
  35562. t.Kcommaaccent = 722;
  35563. t.Lacute = 611;
  35564. t.trademark = 980;
  35565. t.edotaccent = 444;
  35566. t.Igrave = 333;
  35567. t.Imacron = 333;
  35568. t.Lcaron = 611;
  35569. t.onehalf = 750;
  35570. t.lessequal = 549;
  35571. t.ocircumflex = 500;
  35572. t.ntilde = 500;
  35573. t.Uhungarumlaut = 722;
  35574. t.Eacute = 611;
  35575. t.emacron = 444;
  35576. t.gbreve = 500;
  35577. t.onequarter = 750;
  35578. t.Scaron = 556;
  35579. t.Scommaaccent = 556;
  35580. t.Ohungarumlaut = 722;
  35581. t.degree = 400;
  35582. t.ograve = 500;
  35583. t.Ccaron = 667;
  35584. t.ugrave = 500;
  35585. t.radical = 453;
  35586. t.Dcaron = 722;
  35587. t.rcommaaccent = 333;
  35588. t.Ntilde = 722;
  35589. t.otilde = 500;
  35590. t.Rcommaaccent = 667;
  35591. t.Lcommaaccent = 611;
  35592. t.Atilde = 722;
  35593. t.Aogonek = 722;
  35594. t.Aring = 722;
  35595. t.Otilde = 722;
  35596. t.zdotaccent = 444;
  35597. t.Ecaron = 611;
  35598. t.Iogonek = 333;
  35599. t.kcommaaccent = 500;
  35600. t.minus = 564;
  35601. t.Icircumflex = 333;
  35602. t.ncaron = 500;
  35603. t.tcommaaccent = 278;
  35604. t.logicalnot = 564;
  35605. t.odieresis = 500;
  35606. t.udieresis = 500;
  35607. t.notequal = 549;
  35608. t.gcommaaccent = 500;
  35609. t.eth = 500;
  35610. t.zcaron = 444;
  35611. t.ncommaaccent = 500;
  35612. t.onesuperior = 300;
  35613. t.imacron = 278;
  35614. t.Euro = 500;
  35615. });
  35616. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35617. t.space = 250;
  35618. t.exclam = 333;
  35619. t.quotedbl = 555;
  35620. t.numbersign = 500;
  35621. t.dollar = 500;
  35622. t.percent = 1000;
  35623. t.ampersand = 833;
  35624. t.quoteright = 333;
  35625. t.parenleft = 333;
  35626. t.parenright = 333;
  35627. t.asterisk = 500;
  35628. t.plus = 570;
  35629. t.comma = 250;
  35630. t.hyphen = 333;
  35631. t.period = 250;
  35632. t.slash = 278;
  35633. t.zero = 500;
  35634. t.one = 500;
  35635. t.two = 500;
  35636. t.three = 500;
  35637. t.four = 500;
  35638. t.five = 500;
  35639. t.six = 500;
  35640. t.seven = 500;
  35641. t.eight = 500;
  35642. t.nine = 500;
  35643. t.colon = 333;
  35644. t.semicolon = 333;
  35645. t.less = 570;
  35646. t.equal = 570;
  35647. t.greater = 570;
  35648. t.question = 500;
  35649. t.at = 930;
  35650. t.A = 722;
  35651. t.B = 667;
  35652. t.C = 722;
  35653. t.D = 722;
  35654. t.E = 667;
  35655. t.F = 611;
  35656. t.G = 778;
  35657. t.H = 778;
  35658. t.I = 389;
  35659. t.J = 500;
  35660. t.K = 778;
  35661. t.L = 667;
  35662. t.M = 944;
  35663. t.N = 722;
  35664. t.O = 778;
  35665. t.P = 611;
  35666. t.Q = 778;
  35667. t.R = 722;
  35668. t.S = 556;
  35669. t.T = 667;
  35670. t.U = 722;
  35671. t.V = 722;
  35672. t.W = 1000;
  35673. t.X = 722;
  35674. t.Y = 722;
  35675. t.Z = 667;
  35676. t.bracketleft = 333;
  35677. t.backslash = 278;
  35678. t.bracketright = 333;
  35679. t.asciicircum = 581;
  35680. t.underscore = 500;
  35681. t.quoteleft = 333;
  35682. t.a = 500;
  35683. t.b = 556;
  35684. t.c = 444;
  35685. t.d = 556;
  35686. t.e = 444;
  35687. t.f = 333;
  35688. t.g = 500;
  35689. t.h = 556;
  35690. t.i = 278;
  35691. t.j = 333;
  35692. t.k = 556;
  35693. t.l = 278;
  35694. t.m = 833;
  35695. t.n = 556;
  35696. t.o = 500;
  35697. t.p = 556;
  35698. t.q = 556;
  35699. t.r = 444;
  35700. t.s = 389;
  35701. t.t = 333;
  35702. t.u = 556;
  35703. t.v = 500;
  35704. t.w = 722;
  35705. t.x = 500;
  35706. t.y = 500;
  35707. t.z = 444;
  35708. t.braceleft = 394;
  35709. t.bar = 220;
  35710. t.braceright = 394;
  35711. t.asciitilde = 520;
  35712. t.exclamdown = 333;
  35713. t.cent = 500;
  35714. t.sterling = 500;
  35715. t.fraction = 167;
  35716. t.yen = 500;
  35717. t.florin = 500;
  35718. t.section = 500;
  35719. t.currency = 500;
  35720. t.quotesingle = 278;
  35721. t.quotedblleft = 500;
  35722. t.guillemotleft = 500;
  35723. t.guilsinglleft = 333;
  35724. t.guilsinglright = 333;
  35725. t.fi = 556;
  35726. t.fl = 556;
  35727. t.endash = 500;
  35728. t.dagger = 500;
  35729. t.daggerdbl = 500;
  35730. t.periodcentered = 250;
  35731. t.paragraph = 540;
  35732. t.bullet = 350;
  35733. t.quotesinglbase = 333;
  35734. t.quotedblbase = 500;
  35735. t.quotedblright = 500;
  35736. t.guillemotright = 500;
  35737. t.ellipsis = 1000;
  35738. t.perthousand = 1000;
  35739. t.questiondown = 500;
  35740. t.grave = 333;
  35741. t.acute = 333;
  35742. t.circumflex = 333;
  35743. t.tilde = 333;
  35744. t.macron = 333;
  35745. t.breve = 333;
  35746. t.dotaccent = 333;
  35747. t.dieresis = 333;
  35748. t.ring = 333;
  35749. t.cedilla = 333;
  35750. t.hungarumlaut = 333;
  35751. t.ogonek = 333;
  35752. t.caron = 333;
  35753. t.emdash = 1000;
  35754. t.AE = 1000;
  35755. t.ordfeminine = 300;
  35756. t.Lslash = 667;
  35757. t.Oslash = 778;
  35758. t.OE = 1000;
  35759. t.ordmasculine = 330;
  35760. t.ae = 722;
  35761. t.dotlessi = 278;
  35762. t.lslash = 278;
  35763. t.oslash = 500;
  35764. t.oe = 722;
  35765. t.germandbls = 556;
  35766. t.Idieresis = 389;
  35767. t.eacute = 444;
  35768. t.abreve = 500;
  35769. t.uhungarumlaut = 556;
  35770. t.ecaron = 444;
  35771. t.Ydieresis = 722;
  35772. t.divide = 570;
  35773. t.Yacute = 722;
  35774. t.Acircumflex = 722;
  35775. t.aacute = 500;
  35776. t.Ucircumflex = 722;
  35777. t.yacute = 500;
  35778. t.scommaaccent = 389;
  35779. t.ecircumflex = 444;
  35780. t.Uring = 722;
  35781. t.Udieresis = 722;
  35782. t.aogonek = 500;
  35783. t.Uacute = 722;
  35784. t.uogonek = 556;
  35785. t.Edieresis = 667;
  35786. t.Dcroat = 722;
  35787. t.commaaccent = 250;
  35788. t.copyright = 747;
  35789. t.Emacron = 667;
  35790. t.ccaron = 444;
  35791. t.aring = 500;
  35792. t.Ncommaaccent = 722;
  35793. t.lacute = 278;
  35794. t.agrave = 500;
  35795. t.Tcommaaccent = 667;
  35796. t.Cacute = 722;
  35797. t.atilde = 500;
  35798. t.Edotaccent = 667;
  35799. t.scaron = 389;
  35800. t.scedilla = 389;
  35801. t.iacute = 278;
  35802. t.lozenge = 494;
  35803. t.Rcaron = 722;
  35804. t.Gcommaaccent = 778;
  35805. t.ucircumflex = 556;
  35806. t.acircumflex = 500;
  35807. t.Amacron = 722;
  35808. t.rcaron = 444;
  35809. t.ccedilla = 444;
  35810. t.Zdotaccent = 667;
  35811. t.Thorn = 611;
  35812. t.Omacron = 778;
  35813. t.Racute = 722;
  35814. t.Sacute = 556;
  35815. t.dcaron = 672;
  35816. t.Umacron = 722;
  35817. t.uring = 556;
  35818. t.threesuperior = 300;
  35819. t.Ograve = 778;
  35820. t.Agrave = 722;
  35821. t.Abreve = 722;
  35822. t.multiply = 570;
  35823. t.uacute = 556;
  35824. t.Tcaron = 667;
  35825. t.partialdiff = 494;
  35826. t.ydieresis = 500;
  35827. t.Nacute = 722;
  35828. t.icircumflex = 278;
  35829. t.Ecircumflex = 667;
  35830. t.adieresis = 500;
  35831. t.edieresis = 444;
  35832. t.cacute = 444;
  35833. t.nacute = 556;
  35834. t.umacron = 556;
  35835. t.Ncaron = 722;
  35836. t.Iacute = 389;
  35837. t.plusminus = 570;
  35838. t.brokenbar = 220;
  35839. t.registered = 747;
  35840. t.Gbreve = 778;
  35841. t.Idotaccent = 389;
  35842. t.summation = 600;
  35843. t.Egrave = 667;
  35844. t.racute = 444;
  35845. t.omacron = 500;
  35846. t.Zacute = 667;
  35847. t.Zcaron = 667;
  35848. t.greaterequal = 549;
  35849. t.Eth = 722;
  35850. t.Ccedilla = 722;
  35851. t.lcommaaccent = 278;
  35852. t.tcaron = 416;
  35853. t.eogonek = 444;
  35854. t.Uogonek = 722;
  35855. t.Aacute = 722;
  35856. t.Adieresis = 722;
  35857. t.egrave = 444;
  35858. t.zacute = 444;
  35859. t.iogonek = 278;
  35860. t.Oacute = 778;
  35861. t.oacute = 500;
  35862. t.amacron = 500;
  35863. t.sacute = 389;
  35864. t.idieresis = 278;
  35865. t.Ocircumflex = 778;
  35866. t.Ugrave = 722;
  35867. t.Delta = 612;
  35868. t.thorn = 556;
  35869. t.twosuperior = 300;
  35870. t.Odieresis = 778;
  35871. t.mu = 556;
  35872. t.igrave = 278;
  35873. t.ohungarumlaut = 500;
  35874. t.Eogonek = 667;
  35875. t.dcroat = 556;
  35876. t.threequarters = 750;
  35877. t.Scedilla = 556;
  35878. t.lcaron = 394;
  35879. t.Kcommaaccent = 778;
  35880. t.Lacute = 667;
  35881. t.trademark = 1000;
  35882. t.edotaccent = 444;
  35883. t.Igrave = 389;
  35884. t.Imacron = 389;
  35885. t.Lcaron = 667;
  35886. t.onehalf = 750;
  35887. t.lessequal = 549;
  35888. t.ocircumflex = 500;
  35889. t.ntilde = 556;
  35890. t.Uhungarumlaut = 722;
  35891. t.Eacute = 667;
  35892. t.emacron = 444;
  35893. t.gbreve = 500;
  35894. t.onequarter = 750;
  35895. t.Scaron = 556;
  35896. t.Scommaaccent = 556;
  35897. t.Ohungarumlaut = 778;
  35898. t.degree = 400;
  35899. t.ograve = 500;
  35900. t.Ccaron = 722;
  35901. t.ugrave = 556;
  35902. t.radical = 549;
  35903. t.Dcaron = 722;
  35904. t.rcommaaccent = 444;
  35905. t.Ntilde = 722;
  35906. t.otilde = 500;
  35907. t.Rcommaaccent = 722;
  35908. t.Lcommaaccent = 667;
  35909. t.Atilde = 722;
  35910. t.Aogonek = 722;
  35911. t.Aring = 722;
  35912. t.Otilde = 778;
  35913. t.zdotaccent = 444;
  35914. t.Ecaron = 667;
  35915. t.Iogonek = 389;
  35916. t.kcommaaccent = 556;
  35917. t.minus = 570;
  35918. t.Icircumflex = 389;
  35919. t.ncaron = 556;
  35920. t.tcommaaccent = 333;
  35921. t.logicalnot = 570;
  35922. t.odieresis = 500;
  35923. t.udieresis = 556;
  35924. t.notequal = 549;
  35925. t.gcommaaccent = 500;
  35926. t.eth = 500;
  35927. t.zcaron = 444;
  35928. t.ncommaaccent = 556;
  35929. t.onesuperior = 300;
  35930. t.imacron = 278;
  35931. t.Euro = 500;
  35932. });
  35933. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  35934. t.space = 250;
  35935. t.exclam = 389;
  35936. t.quotedbl = 555;
  35937. t.numbersign = 500;
  35938. t.dollar = 500;
  35939. t.percent = 833;
  35940. t.ampersand = 778;
  35941. t.quoteright = 333;
  35942. t.parenleft = 333;
  35943. t.parenright = 333;
  35944. t.asterisk = 500;
  35945. t.plus = 570;
  35946. t.comma = 250;
  35947. t.hyphen = 333;
  35948. t.period = 250;
  35949. t.slash = 278;
  35950. t.zero = 500;
  35951. t.one = 500;
  35952. t.two = 500;
  35953. t.three = 500;
  35954. t.four = 500;
  35955. t.five = 500;
  35956. t.six = 500;
  35957. t.seven = 500;
  35958. t.eight = 500;
  35959. t.nine = 500;
  35960. t.colon = 333;
  35961. t.semicolon = 333;
  35962. t.less = 570;
  35963. t.equal = 570;
  35964. t.greater = 570;
  35965. t.question = 500;
  35966. t.at = 832;
  35967. t.A = 667;
  35968. t.B = 667;
  35969. t.C = 667;
  35970. t.D = 722;
  35971. t.E = 667;
  35972. t.F = 667;
  35973. t.G = 722;
  35974. t.H = 778;
  35975. t.I = 389;
  35976. t.J = 500;
  35977. t.K = 667;
  35978. t.L = 611;
  35979. t.M = 889;
  35980. t.N = 722;
  35981. t.O = 722;
  35982. t.P = 611;
  35983. t.Q = 722;
  35984. t.R = 667;
  35985. t.S = 556;
  35986. t.T = 611;
  35987. t.U = 722;
  35988. t.V = 667;
  35989. t.W = 889;
  35990. t.X = 667;
  35991. t.Y = 611;
  35992. t.Z = 611;
  35993. t.bracketleft = 333;
  35994. t.backslash = 278;
  35995. t.bracketright = 333;
  35996. t.asciicircum = 570;
  35997. t.underscore = 500;
  35998. t.quoteleft = 333;
  35999. t.a = 500;
  36000. t.b = 500;
  36001. t.c = 444;
  36002. t.d = 500;
  36003. t.e = 444;
  36004. t.f = 333;
  36005. t.g = 500;
  36006. t.h = 556;
  36007. t.i = 278;
  36008. t.j = 278;
  36009. t.k = 500;
  36010. t.l = 278;
  36011. t.m = 778;
  36012. t.n = 556;
  36013. t.o = 500;
  36014. t.p = 500;
  36015. t.q = 500;
  36016. t.r = 389;
  36017. t.s = 389;
  36018. t.t = 278;
  36019. t.u = 556;
  36020. t.v = 444;
  36021. t.w = 667;
  36022. t.x = 500;
  36023. t.y = 444;
  36024. t.z = 389;
  36025. t.braceleft = 348;
  36026. t.bar = 220;
  36027. t.braceright = 348;
  36028. t.asciitilde = 570;
  36029. t.exclamdown = 389;
  36030. t.cent = 500;
  36031. t.sterling = 500;
  36032. t.fraction = 167;
  36033. t.yen = 500;
  36034. t.florin = 500;
  36035. t.section = 500;
  36036. t.currency = 500;
  36037. t.quotesingle = 278;
  36038. t.quotedblleft = 500;
  36039. t.guillemotleft = 500;
  36040. t.guilsinglleft = 333;
  36041. t.guilsinglright = 333;
  36042. t.fi = 556;
  36043. t.fl = 556;
  36044. t.endash = 500;
  36045. t.dagger = 500;
  36046. t.daggerdbl = 500;
  36047. t.periodcentered = 250;
  36048. t.paragraph = 500;
  36049. t.bullet = 350;
  36050. t.quotesinglbase = 333;
  36051. t.quotedblbase = 500;
  36052. t.quotedblright = 500;
  36053. t.guillemotright = 500;
  36054. t.ellipsis = 1000;
  36055. t.perthousand = 1000;
  36056. t.questiondown = 500;
  36057. t.grave = 333;
  36058. t.acute = 333;
  36059. t.circumflex = 333;
  36060. t.tilde = 333;
  36061. t.macron = 333;
  36062. t.breve = 333;
  36063. t.dotaccent = 333;
  36064. t.dieresis = 333;
  36065. t.ring = 333;
  36066. t.cedilla = 333;
  36067. t.hungarumlaut = 333;
  36068. t.ogonek = 333;
  36069. t.caron = 333;
  36070. t.emdash = 1000;
  36071. t.AE = 944;
  36072. t.ordfeminine = 266;
  36073. t.Lslash = 611;
  36074. t.Oslash = 722;
  36075. t.OE = 944;
  36076. t.ordmasculine = 300;
  36077. t.ae = 722;
  36078. t.dotlessi = 278;
  36079. t.lslash = 278;
  36080. t.oslash = 500;
  36081. t.oe = 722;
  36082. t.germandbls = 500;
  36083. t.Idieresis = 389;
  36084. t.eacute = 444;
  36085. t.abreve = 500;
  36086. t.uhungarumlaut = 556;
  36087. t.ecaron = 444;
  36088. t.Ydieresis = 611;
  36089. t.divide = 570;
  36090. t.Yacute = 611;
  36091. t.Acircumflex = 667;
  36092. t.aacute = 500;
  36093. t.Ucircumflex = 722;
  36094. t.yacute = 444;
  36095. t.scommaaccent = 389;
  36096. t.ecircumflex = 444;
  36097. t.Uring = 722;
  36098. t.Udieresis = 722;
  36099. t.aogonek = 500;
  36100. t.Uacute = 722;
  36101. t.uogonek = 556;
  36102. t.Edieresis = 667;
  36103. t.Dcroat = 722;
  36104. t.commaaccent = 250;
  36105. t.copyright = 747;
  36106. t.Emacron = 667;
  36107. t.ccaron = 444;
  36108. t.aring = 500;
  36109. t.Ncommaaccent = 722;
  36110. t.lacute = 278;
  36111. t.agrave = 500;
  36112. t.Tcommaaccent = 611;
  36113. t.Cacute = 667;
  36114. t.atilde = 500;
  36115. t.Edotaccent = 667;
  36116. t.scaron = 389;
  36117. t.scedilla = 389;
  36118. t.iacute = 278;
  36119. t.lozenge = 494;
  36120. t.Rcaron = 667;
  36121. t.Gcommaaccent = 722;
  36122. t.ucircumflex = 556;
  36123. t.acircumflex = 500;
  36124. t.Amacron = 667;
  36125. t.rcaron = 389;
  36126. t.ccedilla = 444;
  36127. t.Zdotaccent = 611;
  36128. t.Thorn = 611;
  36129. t.Omacron = 722;
  36130. t.Racute = 667;
  36131. t.Sacute = 556;
  36132. t.dcaron = 608;
  36133. t.Umacron = 722;
  36134. t.uring = 556;
  36135. t.threesuperior = 300;
  36136. t.Ograve = 722;
  36137. t.Agrave = 667;
  36138. t.Abreve = 667;
  36139. t.multiply = 570;
  36140. t.uacute = 556;
  36141. t.Tcaron = 611;
  36142. t.partialdiff = 494;
  36143. t.ydieresis = 444;
  36144. t.Nacute = 722;
  36145. t.icircumflex = 278;
  36146. t.Ecircumflex = 667;
  36147. t.adieresis = 500;
  36148. t.edieresis = 444;
  36149. t.cacute = 444;
  36150. t.nacute = 556;
  36151. t.umacron = 556;
  36152. t.Ncaron = 722;
  36153. t.Iacute = 389;
  36154. t.plusminus = 570;
  36155. t.brokenbar = 220;
  36156. t.registered = 747;
  36157. t.Gbreve = 722;
  36158. t.Idotaccent = 389;
  36159. t.summation = 600;
  36160. t.Egrave = 667;
  36161. t.racute = 389;
  36162. t.omacron = 500;
  36163. t.Zacute = 611;
  36164. t.Zcaron = 611;
  36165. t.greaterequal = 549;
  36166. t.Eth = 722;
  36167. t.Ccedilla = 667;
  36168. t.lcommaaccent = 278;
  36169. t.tcaron = 366;
  36170. t.eogonek = 444;
  36171. t.Uogonek = 722;
  36172. t.Aacute = 667;
  36173. t.Adieresis = 667;
  36174. t.egrave = 444;
  36175. t.zacute = 389;
  36176. t.iogonek = 278;
  36177. t.Oacute = 722;
  36178. t.oacute = 500;
  36179. t.amacron = 500;
  36180. t.sacute = 389;
  36181. t.idieresis = 278;
  36182. t.Ocircumflex = 722;
  36183. t.Ugrave = 722;
  36184. t.Delta = 612;
  36185. t.thorn = 500;
  36186. t.twosuperior = 300;
  36187. t.Odieresis = 722;
  36188. t.mu = 576;
  36189. t.igrave = 278;
  36190. t.ohungarumlaut = 500;
  36191. t.Eogonek = 667;
  36192. t.dcroat = 500;
  36193. t.threequarters = 750;
  36194. t.Scedilla = 556;
  36195. t.lcaron = 382;
  36196. t.Kcommaaccent = 667;
  36197. t.Lacute = 611;
  36198. t.trademark = 1000;
  36199. t.edotaccent = 444;
  36200. t.Igrave = 389;
  36201. t.Imacron = 389;
  36202. t.Lcaron = 611;
  36203. t.onehalf = 750;
  36204. t.lessequal = 549;
  36205. t.ocircumflex = 500;
  36206. t.ntilde = 556;
  36207. t.Uhungarumlaut = 722;
  36208. t.Eacute = 667;
  36209. t.emacron = 444;
  36210. t.gbreve = 500;
  36211. t.onequarter = 750;
  36212. t.Scaron = 556;
  36213. t.Scommaaccent = 556;
  36214. t.Ohungarumlaut = 722;
  36215. t.degree = 400;
  36216. t.ograve = 500;
  36217. t.Ccaron = 667;
  36218. t.ugrave = 556;
  36219. t.radical = 549;
  36220. t.Dcaron = 722;
  36221. t.rcommaaccent = 389;
  36222. t.Ntilde = 722;
  36223. t.otilde = 500;
  36224. t.Rcommaaccent = 667;
  36225. t.Lcommaaccent = 611;
  36226. t.Atilde = 667;
  36227. t.Aogonek = 667;
  36228. t.Aring = 667;
  36229. t.Otilde = 722;
  36230. t.zdotaccent = 389;
  36231. t.Ecaron = 667;
  36232. t.Iogonek = 389;
  36233. t.kcommaaccent = 500;
  36234. t.minus = 606;
  36235. t.Icircumflex = 389;
  36236. t.ncaron = 556;
  36237. t.tcommaaccent = 278;
  36238. t.logicalnot = 606;
  36239. t.odieresis = 500;
  36240. t.udieresis = 556;
  36241. t.notequal = 549;
  36242. t.gcommaaccent = 500;
  36243. t.eth = 500;
  36244. t.zcaron = 389;
  36245. t.ncommaaccent = 556;
  36246. t.onesuperior = 300;
  36247. t.imacron = 278;
  36248. t.Euro = 500;
  36249. });
  36250. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  36251. t.space = 250;
  36252. t.exclam = 333;
  36253. t.quotedbl = 420;
  36254. t.numbersign = 500;
  36255. t.dollar = 500;
  36256. t.percent = 833;
  36257. t.ampersand = 778;
  36258. t.quoteright = 333;
  36259. t.parenleft = 333;
  36260. t.parenright = 333;
  36261. t.asterisk = 500;
  36262. t.plus = 675;
  36263. t.comma = 250;
  36264. t.hyphen = 333;
  36265. t.period = 250;
  36266. t.slash = 278;
  36267. t.zero = 500;
  36268. t.one = 500;
  36269. t.two = 500;
  36270. t.three = 500;
  36271. t.four = 500;
  36272. t.five = 500;
  36273. t.six = 500;
  36274. t.seven = 500;
  36275. t.eight = 500;
  36276. t.nine = 500;
  36277. t.colon = 333;
  36278. t.semicolon = 333;
  36279. t.less = 675;
  36280. t.equal = 675;
  36281. t.greater = 675;
  36282. t.question = 500;
  36283. t.at = 920;
  36284. t.A = 611;
  36285. t.B = 611;
  36286. t.C = 667;
  36287. t.D = 722;
  36288. t.E = 611;
  36289. t.F = 611;
  36290. t.G = 722;
  36291. t.H = 722;
  36292. t.I = 333;
  36293. t.J = 444;
  36294. t.K = 667;
  36295. t.L = 556;
  36296. t.M = 833;
  36297. t.N = 667;
  36298. t.O = 722;
  36299. t.P = 611;
  36300. t.Q = 722;
  36301. t.R = 611;
  36302. t.S = 500;
  36303. t.T = 556;
  36304. t.U = 722;
  36305. t.V = 611;
  36306. t.W = 833;
  36307. t.X = 611;
  36308. t.Y = 556;
  36309. t.Z = 556;
  36310. t.bracketleft = 389;
  36311. t.backslash = 278;
  36312. t.bracketright = 389;
  36313. t.asciicircum = 422;
  36314. t.underscore = 500;
  36315. t.quoteleft = 333;
  36316. t.a = 500;
  36317. t.b = 500;
  36318. t.c = 444;
  36319. t.d = 500;
  36320. t.e = 444;
  36321. t.f = 278;
  36322. t.g = 500;
  36323. t.h = 500;
  36324. t.i = 278;
  36325. t.j = 278;
  36326. t.k = 444;
  36327. t.l = 278;
  36328. t.m = 722;
  36329. t.n = 500;
  36330. t.o = 500;
  36331. t.p = 500;
  36332. t.q = 500;
  36333. t.r = 389;
  36334. t.s = 389;
  36335. t.t = 278;
  36336. t.u = 500;
  36337. t.v = 444;
  36338. t.w = 667;
  36339. t.x = 444;
  36340. t.y = 444;
  36341. t.z = 389;
  36342. t.braceleft = 400;
  36343. t.bar = 275;
  36344. t.braceright = 400;
  36345. t.asciitilde = 541;
  36346. t.exclamdown = 389;
  36347. t.cent = 500;
  36348. t.sterling = 500;
  36349. t.fraction = 167;
  36350. t.yen = 500;
  36351. t.florin = 500;
  36352. t.section = 500;
  36353. t.currency = 500;
  36354. t.quotesingle = 214;
  36355. t.quotedblleft = 556;
  36356. t.guillemotleft = 500;
  36357. t.guilsinglleft = 333;
  36358. t.guilsinglright = 333;
  36359. t.fi = 500;
  36360. t.fl = 500;
  36361. t.endash = 500;
  36362. t.dagger = 500;
  36363. t.daggerdbl = 500;
  36364. t.periodcentered = 250;
  36365. t.paragraph = 523;
  36366. t.bullet = 350;
  36367. t.quotesinglbase = 333;
  36368. t.quotedblbase = 556;
  36369. t.quotedblright = 556;
  36370. t.guillemotright = 500;
  36371. t.ellipsis = 889;
  36372. t.perthousand = 1000;
  36373. t.questiondown = 500;
  36374. t.grave = 333;
  36375. t.acute = 333;
  36376. t.circumflex = 333;
  36377. t.tilde = 333;
  36378. t.macron = 333;
  36379. t.breve = 333;
  36380. t.dotaccent = 333;
  36381. t.dieresis = 333;
  36382. t.ring = 333;
  36383. t.cedilla = 333;
  36384. t.hungarumlaut = 333;
  36385. t.ogonek = 333;
  36386. t.caron = 333;
  36387. t.emdash = 889;
  36388. t.AE = 889;
  36389. t.ordfeminine = 276;
  36390. t.Lslash = 556;
  36391. t.Oslash = 722;
  36392. t.OE = 944;
  36393. t.ordmasculine = 310;
  36394. t.ae = 667;
  36395. t.dotlessi = 278;
  36396. t.lslash = 278;
  36397. t.oslash = 500;
  36398. t.oe = 667;
  36399. t.germandbls = 500;
  36400. t.Idieresis = 333;
  36401. t.eacute = 444;
  36402. t.abreve = 500;
  36403. t.uhungarumlaut = 500;
  36404. t.ecaron = 444;
  36405. t.Ydieresis = 556;
  36406. t.divide = 675;
  36407. t.Yacute = 556;
  36408. t.Acircumflex = 611;
  36409. t.aacute = 500;
  36410. t.Ucircumflex = 722;
  36411. t.yacute = 444;
  36412. t.scommaaccent = 389;
  36413. t.ecircumflex = 444;
  36414. t.Uring = 722;
  36415. t.Udieresis = 722;
  36416. t.aogonek = 500;
  36417. t.Uacute = 722;
  36418. t.uogonek = 500;
  36419. t.Edieresis = 611;
  36420. t.Dcroat = 722;
  36421. t.commaaccent = 250;
  36422. t.copyright = 760;
  36423. t.Emacron = 611;
  36424. t.ccaron = 444;
  36425. t.aring = 500;
  36426. t.Ncommaaccent = 667;
  36427. t.lacute = 278;
  36428. t.agrave = 500;
  36429. t.Tcommaaccent = 556;
  36430. t.Cacute = 667;
  36431. t.atilde = 500;
  36432. t.Edotaccent = 611;
  36433. t.scaron = 389;
  36434. t.scedilla = 389;
  36435. t.iacute = 278;
  36436. t.lozenge = 471;
  36437. t.Rcaron = 611;
  36438. t.Gcommaaccent = 722;
  36439. t.ucircumflex = 500;
  36440. t.acircumflex = 500;
  36441. t.Amacron = 611;
  36442. t.rcaron = 389;
  36443. t.ccedilla = 444;
  36444. t.Zdotaccent = 556;
  36445. t.Thorn = 611;
  36446. t.Omacron = 722;
  36447. t.Racute = 611;
  36448. t.Sacute = 500;
  36449. t.dcaron = 544;
  36450. t.Umacron = 722;
  36451. t.uring = 500;
  36452. t.threesuperior = 300;
  36453. t.Ograve = 722;
  36454. t.Agrave = 611;
  36455. t.Abreve = 611;
  36456. t.multiply = 675;
  36457. t.uacute = 500;
  36458. t.Tcaron = 556;
  36459. t.partialdiff = 476;
  36460. t.ydieresis = 444;
  36461. t.Nacute = 667;
  36462. t.icircumflex = 278;
  36463. t.Ecircumflex = 611;
  36464. t.adieresis = 500;
  36465. t.edieresis = 444;
  36466. t.cacute = 444;
  36467. t.nacute = 500;
  36468. t.umacron = 500;
  36469. t.Ncaron = 667;
  36470. t.Iacute = 333;
  36471. t.plusminus = 675;
  36472. t.brokenbar = 275;
  36473. t.registered = 760;
  36474. t.Gbreve = 722;
  36475. t.Idotaccent = 333;
  36476. t.summation = 600;
  36477. t.Egrave = 611;
  36478. t.racute = 389;
  36479. t.omacron = 500;
  36480. t.Zacute = 556;
  36481. t.Zcaron = 556;
  36482. t.greaterequal = 549;
  36483. t.Eth = 722;
  36484. t.Ccedilla = 667;
  36485. t.lcommaaccent = 278;
  36486. t.tcaron = 300;
  36487. t.eogonek = 444;
  36488. t.Uogonek = 722;
  36489. t.Aacute = 611;
  36490. t.Adieresis = 611;
  36491. t.egrave = 444;
  36492. t.zacute = 389;
  36493. t.iogonek = 278;
  36494. t.Oacute = 722;
  36495. t.oacute = 500;
  36496. t.amacron = 500;
  36497. t.sacute = 389;
  36498. t.idieresis = 278;
  36499. t.Ocircumflex = 722;
  36500. t.Ugrave = 722;
  36501. t.Delta = 612;
  36502. t.thorn = 500;
  36503. t.twosuperior = 300;
  36504. t.Odieresis = 722;
  36505. t.mu = 500;
  36506. t.igrave = 278;
  36507. t.ohungarumlaut = 500;
  36508. t.Eogonek = 611;
  36509. t.dcroat = 500;
  36510. t.threequarters = 750;
  36511. t.Scedilla = 500;
  36512. t.lcaron = 300;
  36513. t.Kcommaaccent = 667;
  36514. t.Lacute = 556;
  36515. t.trademark = 980;
  36516. t.edotaccent = 444;
  36517. t.Igrave = 333;
  36518. t.Imacron = 333;
  36519. t.Lcaron = 611;
  36520. t.onehalf = 750;
  36521. t.lessequal = 549;
  36522. t.ocircumflex = 500;
  36523. t.ntilde = 500;
  36524. t.Uhungarumlaut = 722;
  36525. t.Eacute = 611;
  36526. t.emacron = 444;
  36527. t.gbreve = 500;
  36528. t.onequarter = 750;
  36529. t.Scaron = 500;
  36530. t.Scommaaccent = 500;
  36531. t.Ohungarumlaut = 722;
  36532. t.degree = 400;
  36533. t.ograve = 500;
  36534. t.Ccaron = 667;
  36535. t.ugrave = 500;
  36536. t.radical = 453;
  36537. t.Dcaron = 722;
  36538. t.rcommaaccent = 389;
  36539. t.Ntilde = 667;
  36540. t.otilde = 500;
  36541. t.Rcommaaccent = 611;
  36542. t.Lcommaaccent = 556;
  36543. t.Atilde = 611;
  36544. t.Aogonek = 611;
  36545. t.Aring = 611;
  36546. t.Otilde = 722;
  36547. t.zdotaccent = 389;
  36548. t.Ecaron = 611;
  36549. t.Iogonek = 333;
  36550. t.kcommaaccent = 444;
  36551. t.minus = 675;
  36552. t.Icircumflex = 333;
  36553. t.ncaron = 500;
  36554. t.tcommaaccent = 278;
  36555. t.logicalnot = 675;
  36556. t.odieresis = 500;
  36557. t.udieresis = 500;
  36558. t.notequal = 549;
  36559. t.gcommaaccent = 500;
  36560. t.eth = 500;
  36561. t.zcaron = 389;
  36562. t.ncommaaccent = 500;
  36563. t.onesuperior = 300;
  36564. t.imacron = 278;
  36565. t.Euro = 500;
  36566. });
  36567. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  36568. t.space = 278;
  36569. t.a1 = 974;
  36570. t.a2 = 961;
  36571. t.a202 = 974;
  36572. t.a3 = 980;
  36573. t.a4 = 719;
  36574. t.a5 = 789;
  36575. t.a119 = 790;
  36576. t.a118 = 791;
  36577. t.a117 = 690;
  36578. t.a11 = 960;
  36579. t.a12 = 939;
  36580. t.a13 = 549;
  36581. t.a14 = 855;
  36582. t.a15 = 911;
  36583. t.a16 = 933;
  36584. t.a105 = 911;
  36585. t.a17 = 945;
  36586. t.a18 = 974;
  36587. t.a19 = 755;
  36588. t.a20 = 846;
  36589. t.a21 = 762;
  36590. t.a22 = 761;
  36591. t.a23 = 571;
  36592. t.a24 = 677;
  36593. t.a25 = 763;
  36594. t.a26 = 760;
  36595. t.a27 = 759;
  36596. t.a28 = 754;
  36597. t.a6 = 494;
  36598. t.a7 = 552;
  36599. t.a8 = 537;
  36600. t.a9 = 577;
  36601. t.a10 = 692;
  36602. t.a29 = 786;
  36603. t.a30 = 788;
  36604. t.a31 = 788;
  36605. t.a32 = 790;
  36606. t.a33 = 793;
  36607. t.a34 = 794;
  36608. t.a35 = 816;
  36609. t.a36 = 823;
  36610. t.a37 = 789;
  36611. t.a38 = 841;
  36612. t.a39 = 823;
  36613. t.a40 = 833;
  36614. t.a41 = 816;
  36615. t.a42 = 831;
  36616. t.a43 = 923;
  36617. t.a44 = 744;
  36618. t.a45 = 723;
  36619. t.a46 = 749;
  36620. t.a47 = 790;
  36621. t.a48 = 792;
  36622. t.a49 = 695;
  36623. t.a50 = 776;
  36624. t.a51 = 768;
  36625. t.a52 = 792;
  36626. t.a53 = 759;
  36627. t.a54 = 707;
  36628. t.a55 = 708;
  36629. t.a56 = 682;
  36630. t.a57 = 701;
  36631. t.a58 = 826;
  36632. t.a59 = 815;
  36633. t.a60 = 789;
  36634. t.a61 = 789;
  36635. t.a62 = 707;
  36636. t.a63 = 687;
  36637. t.a64 = 696;
  36638. t.a65 = 689;
  36639. t.a66 = 786;
  36640. t.a67 = 787;
  36641. t.a68 = 713;
  36642. t.a69 = 791;
  36643. t.a70 = 785;
  36644. t.a71 = 791;
  36645. t.a72 = 873;
  36646. t.a73 = 761;
  36647. t.a74 = 762;
  36648. t.a203 = 762;
  36649. t.a75 = 759;
  36650. t.a204 = 759;
  36651. t.a76 = 892;
  36652. t.a77 = 892;
  36653. t.a78 = 788;
  36654. t.a79 = 784;
  36655. t.a81 = 438;
  36656. t.a82 = 138;
  36657. t.a83 = 277;
  36658. t.a84 = 415;
  36659. t.a97 = 392;
  36660. t.a98 = 392;
  36661. t.a99 = 668;
  36662. t.a100 = 668;
  36663. t.a89 = 390;
  36664. t.a90 = 390;
  36665. t.a93 = 317;
  36666. t.a94 = 317;
  36667. t.a91 = 276;
  36668. t.a92 = 276;
  36669. t.a205 = 509;
  36670. t.a85 = 509;
  36671. t.a206 = 410;
  36672. t.a86 = 410;
  36673. t.a87 = 234;
  36674. t.a88 = 234;
  36675. t.a95 = 334;
  36676. t.a96 = 334;
  36677. t.a101 = 732;
  36678. t.a102 = 544;
  36679. t.a103 = 544;
  36680. t.a104 = 910;
  36681. t.a106 = 667;
  36682. t.a107 = 760;
  36683. t.a108 = 760;
  36684. t.a112 = 776;
  36685. t.a111 = 595;
  36686. t.a110 = 694;
  36687. t.a109 = 626;
  36688. t.a120 = 788;
  36689. t.a121 = 788;
  36690. t.a122 = 788;
  36691. t.a123 = 788;
  36692. t.a124 = 788;
  36693. t.a125 = 788;
  36694. t.a126 = 788;
  36695. t.a127 = 788;
  36696. t.a128 = 788;
  36697. t.a129 = 788;
  36698. t.a130 = 788;
  36699. t.a131 = 788;
  36700. t.a132 = 788;
  36701. t.a133 = 788;
  36702. t.a134 = 788;
  36703. t.a135 = 788;
  36704. t.a136 = 788;
  36705. t.a137 = 788;
  36706. t.a138 = 788;
  36707. t.a139 = 788;
  36708. t.a140 = 788;
  36709. t.a141 = 788;
  36710. t.a142 = 788;
  36711. t.a143 = 788;
  36712. t.a144 = 788;
  36713. t.a145 = 788;
  36714. t.a146 = 788;
  36715. t.a147 = 788;
  36716. t.a148 = 788;
  36717. t.a149 = 788;
  36718. t.a150 = 788;
  36719. t.a151 = 788;
  36720. t.a152 = 788;
  36721. t.a153 = 788;
  36722. t.a154 = 788;
  36723. t.a155 = 788;
  36724. t.a156 = 788;
  36725. t.a157 = 788;
  36726. t.a158 = 788;
  36727. t.a159 = 788;
  36728. t.a160 = 894;
  36729. t.a161 = 838;
  36730. t.a163 = 1016;
  36731. t.a164 = 458;
  36732. t.a196 = 748;
  36733. t.a165 = 924;
  36734. t.a192 = 748;
  36735. t.a166 = 918;
  36736. t.a167 = 927;
  36737. t.a168 = 928;
  36738. t.a169 = 928;
  36739. t.a170 = 834;
  36740. t.a171 = 873;
  36741. t.a172 = 828;
  36742. t.a173 = 924;
  36743. t.a162 = 924;
  36744. t.a174 = 917;
  36745. t.a175 = 930;
  36746. t.a176 = 931;
  36747. t.a177 = 463;
  36748. t.a178 = 883;
  36749. t.a179 = 836;
  36750. t.a193 = 836;
  36751. t.a180 = 867;
  36752. t.a199 = 867;
  36753. t.a181 = 696;
  36754. t.a200 = 696;
  36755. t.a182 = 874;
  36756. t.a201 = 874;
  36757. t.a183 = 760;
  36758. t.a184 = 946;
  36759. t.a197 = 771;
  36760. t.a185 = 865;
  36761. t.a194 = 771;
  36762. t.a198 = 888;
  36763. t.a186 = 967;
  36764. t.a195 = 888;
  36765. t.a187 = 831;
  36766. t.a188 = 873;
  36767. t.a189 = 927;
  36768. t.a190 = 970;
  36769. t.a191 = 918;
  36770. });
  36771. });
  36772. exports.getMetrics = getMetrics;
  36773. /***/ }),
  36774. /* 41 */
  36775. /***/ (function(module, exports, __w_pdfjs_require__) {
  36776. "use strict";
  36777. Object.defineProperty(exports, "__esModule", {
  36778. value: true
  36779. });
  36780. exports.isPDFFunction = isPDFFunction;
  36781. exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0;
  36782. var _util = __w_pdfjs_require__(2);
  36783. var _primitives = __w_pdfjs_require__(5);
  36784. var _ps_parser = __w_pdfjs_require__(42);
  36785. class PDFFunctionFactory {
  36786. constructor({
  36787. xref,
  36788. isEvalSupported = true
  36789. }) {
  36790. this.xref = xref;
  36791. this.isEvalSupported = isEvalSupported !== false;
  36792. }
  36793. create(fn) {
  36794. return PDFFunction.parse({
  36795. xref: this.xref,
  36796. isEvalSupported: this.isEvalSupported,
  36797. fn
  36798. });
  36799. }
  36800. createFromArray(fnObj) {
  36801. return PDFFunction.parseArray({
  36802. xref: this.xref,
  36803. isEvalSupported: this.isEvalSupported,
  36804. fnObj
  36805. });
  36806. }
  36807. }
  36808. exports.PDFFunctionFactory = PDFFunctionFactory;
  36809. function toNumberArray(arr) {
  36810. if (!Array.isArray(arr)) {
  36811. return null;
  36812. }
  36813. const length = arr.length;
  36814. for (let i = 0; i < length; i++) {
  36815. if (typeof arr[i] !== "number") {
  36816. const result = new Array(length);
  36817. for (let j = 0; j < length; j++) {
  36818. result[j] = +arr[j];
  36819. }
  36820. return result;
  36821. }
  36822. }
  36823. return arr;
  36824. }
  36825. var PDFFunction = function PDFFunctionClosure() {
  36826. const CONSTRUCT_SAMPLED = 0;
  36827. const CONSTRUCT_INTERPOLATED = 2;
  36828. const CONSTRUCT_STICHED = 3;
  36829. const CONSTRUCT_POSTSCRIPT = 4;
  36830. return {
  36831. getSampleArray(size, outputSize, bps, stream) {
  36832. var i, ii;
  36833. var length = 1;
  36834. for (i = 0, ii = size.length; i < ii; i++) {
  36835. length *= size[i];
  36836. }
  36837. length *= outputSize;
  36838. var array = new Array(length);
  36839. var codeSize = 0;
  36840. var codeBuf = 0;
  36841. var sampleMul = 1.0 / (2.0 ** bps - 1);
  36842. var strBytes = stream.getBytes((length * bps + 7) / 8);
  36843. var strIdx = 0;
  36844. for (i = 0; i < length; i++) {
  36845. while (codeSize < bps) {
  36846. codeBuf <<= 8;
  36847. codeBuf |= strBytes[strIdx++];
  36848. codeSize += 8;
  36849. }
  36850. codeSize -= bps;
  36851. array[i] = (codeBuf >> codeSize) * sampleMul;
  36852. codeBuf &= (1 << codeSize) - 1;
  36853. }
  36854. return array;
  36855. },
  36856. getIR({
  36857. xref,
  36858. isEvalSupported,
  36859. fn
  36860. }) {
  36861. var dict = fn.dict;
  36862. if (!dict) {
  36863. dict = fn;
  36864. }
  36865. var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
  36866. var typeNum = dict.get("FunctionType");
  36867. var typeFn = types[typeNum];
  36868. if (!typeFn) {
  36869. throw new _util.FormatError("Unknown type of function");
  36870. }
  36871. return typeFn.call(this, {
  36872. xref,
  36873. isEvalSupported,
  36874. fn,
  36875. dict
  36876. });
  36877. },
  36878. fromIR({
  36879. xref,
  36880. isEvalSupported,
  36881. IR
  36882. }) {
  36883. var type = IR[0];
  36884. switch (type) {
  36885. case CONSTRUCT_SAMPLED:
  36886. return this.constructSampledFromIR({
  36887. xref,
  36888. isEvalSupported,
  36889. IR
  36890. });
  36891. case CONSTRUCT_INTERPOLATED:
  36892. return this.constructInterpolatedFromIR({
  36893. xref,
  36894. isEvalSupported,
  36895. IR
  36896. });
  36897. case CONSTRUCT_STICHED:
  36898. return this.constructStichedFromIR({
  36899. xref,
  36900. isEvalSupported,
  36901. IR
  36902. });
  36903. default:
  36904. return this.constructPostScriptFromIR({
  36905. xref,
  36906. isEvalSupported,
  36907. IR
  36908. });
  36909. }
  36910. },
  36911. parse({
  36912. xref,
  36913. isEvalSupported,
  36914. fn
  36915. }) {
  36916. const IR = this.getIR({
  36917. xref,
  36918. isEvalSupported,
  36919. fn
  36920. });
  36921. return this.fromIR({
  36922. xref,
  36923. isEvalSupported,
  36924. IR
  36925. });
  36926. },
  36927. parseArray({
  36928. xref,
  36929. isEvalSupported,
  36930. fnObj
  36931. }) {
  36932. if (!Array.isArray(fnObj)) {
  36933. return this.parse({
  36934. xref,
  36935. isEvalSupported,
  36936. fn: fnObj
  36937. });
  36938. }
  36939. var fnArray = [];
  36940. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  36941. fnArray.push(this.parse({
  36942. xref,
  36943. isEvalSupported,
  36944. fn: xref.fetchIfRef(fnObj[j])
  36945. }));
  36946. }
  36947. return function (src, srcOffset, dest, destOffset) {
  36948. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  36949. fnArray[i](src, srcOffset, dest, destOffset + i);
  36950. }
  36951. };
  36952. },
  36953. constructSampled({
  36954. xref,
  36955. isEvalSupported,
  36956. fn,
  36957. dict
  36958. }) {
  36959. function toMultiArray(arr) {
  36960. var inputLength = arr.length;
  36961. var out = [];
  36962. var index = 0;
  36963. for (var i = 0; i < inputLength; i += 2) {
  36964. out[index] = [arr[i], arr[i + 1]];
  36965. ++index;
  36966. }
  36967. return out;
  36968. }
  36969. var domain = toNumberArray(dict.getArray("Domain"));
  36970. var range = toNumberArray(dict.getArray("Range"));
  36971. if (!domain || !range) {
  36972. throw new _util.FormatError("No domain or range");
  36973. }
  36974. var inputSize = domain.length / 2;
  36975. var outputSize = range.length / 2;
  36976. domain = toMultiArray(domain);
  36977. range = toMultiArray(range);
  36978. var size = toNumberArray(dict.getArray("Size"));
  36979. var bps = dict.get("BitsPerSample");
  36980. var order = dict.get("Order") || 1;
  36981. if (order !== 1) {
  36982. (0, _util.info)("No support for cubic spline interpolation: " + order);
  36983. }
  36984. var encode = toNumberArray(dict.getArray("Encode"));
  36985. if (!encode) {
  36986. encode = [];
  36987. for (var i = 0; i < inputSize; ++i) {
  36988. encode.push([0, size[i] - 1]);
  36989. }
  36990. } else {
  36991. encode = toMultiArray(encode);
  36992. }
  36993. var decode = toNumberArray(dict.getArray("Decode"));
  36994. if (!decode) {
  36995. decode = range;
  36996. } else {
  36997. decode = toMultiArray(decode);
  36998. }
  36999. var samples = this.getSampleArray(size, outputSize, bps, fn);
  37000. return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
  37001. },
  37002. constructSampledFromIR({
  37003. xref,
  37004. isEvalSupported,
  37005. IR
  37006. }) {
  37007. function interpolate(x, xmin, xmax, ymin, ymax) {
  37008. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  37009. }
  37010. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  37011. var m = IR[1];
  37012. var domain = IR[2];
  37013. var encode = IR[3];
  37014. var decode = IR[4];
  37015. var samples = IR[5];
  37016. var size = IR[6];
  37017. var n = IR[7];
  37018. var range = IR[9];
  37019. var cubeVertices = 1 << m;
  37020. var cubeN = new Float64Array(cubeVertices);
  37021. var cubeVertex = new Uint32Array(cubeVertices);
  37022. var i, j;
  37023. for (j = 0; j < cubeVertices; j++) {
  37024. cubeN[j] = 1;
  37025. }
  37026. var k = n,
  37027. pos = 1;
  37028. for (i = 0; i < m; ++i) {
  37029. var domain_2i = domain[i][0];
  37030. var domain_2i_1 = domain[i][1];
  37031. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  37032. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  37033. var size_i = size[i];
  37034. e = Math.min(Math.max(e, 0), size_i - 1);
  37035. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  37036. var n0 = e0 + 1 - e;
  37037. var n1 = e - e0;
  37038. var offset0 = e0 * k;
  37039. var offset1 = offset0 + k;
  37040. for (j = 0; j < cubeVertices; j++) {
  37041. if (j & pos) {
  37042. cubeN[j] *= n1;
  37043. cubeVertex[j] += offset1;
  37044. } else {
  37045. cubeN[j] *= n0;
  37046. cubeVertex[j] += offset0;
  37047. }
  37048. }
  37049. k *= size_i;
  37050. pos <<= 1;
  37051. }
  37052. for (j = 0; j < n; ++j) {
  37053. var rj = 0;
  37054. for (i = 0; i < cubeVertices; i++) {
  37055. rj += samples[cubeVertex[i] + j] * cubeN[i];
  37056. }
  37057. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  37058. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  37059. }
  37060. };
  37061. },
  37062. constructInterpolated({
  37063. xref,
  37064. isEvalSupported,
  37065. fn,
  37066. dict
  37067. }) {
  37068. var c0 = toNumberArray(dict.getArray("C0")) || [0];
  37069. var c1 = toNumberArray(dict.getArray("C1")) || [1];
  37070. var n = dict.get("N");
  37071. var length = c0.length;
  37072. var diff = [];
  37073. for (var i = 0; i < length; ++i) {
  37074. diff.push(c1[i] - c0[i]);
  37075. }
  37076. return [CONSTRUCT_INTERPOLATED, c0, diff, n];
  37077. },
  37078. constructInterpolatedFromIR({
  37079. xref,
  37080. isEvalSupported,
  37081. IR
  37082. }) {
  37083. var c0 = IR[1];
  37084. var diff = IR[2];
  37085. var n = IR[3];
  37086. var length = diff.length;
  37087. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  37088. var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  37089. for (var j = 0; j < length; ++j) {
  37090. dest[destOffset + j] = c0[j] + x * diff[j];
  37091. }
  37092. };
  37093. },
  37094. constructStiched({
  37095. xref,
  37096. isEvalSupported,
  37097. fn,
  37098. dict
  37099. }) {
  37100. var domain = toNumberArray(dict.getArray("Domain"));
  37101. if (!domain) {
  37102. throw new _util.FormatError("No domain");
  37103. }
  37104. var inputSize = domain.length / 2;
  37105. if (inputSize !== 1) {
  37106. throw new _util.FormatError("Bad domain for stiched function");
  37107. }
  37108. var fnRefs = dict.get("Functions");
  37109. var fns = [];
  37110. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  37111. fns.push(this.parse({
  37112. xref,
  37113. isEvalSupported,
  37114. fn: xref.fetchIfRef(fnRefs[i])
  37115. }));
  37116. }
  37117. var bounds = toNumberArray(dict.getArray("Bounds"));
  37118. var encode = toNumberArray(dict.getArray("Encode"));
  37119. return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
  37120. },
  37121. constructStichedFromIR({
  37122. xref,
  37123. isEvalSupported,
  37124. IR
  37125. }) {
  37126. var domain = IR[1];
  37127. var bounds = IR[2];
  37128. var encode = IR[3];
  37129. var fns = IR[4];
  37130. var tmpBuf = new Float32Array(1);
  37131. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  37132. var clip = function constructStichedFromIRClip(v, min, max) {
  37133. if (v > max) {
  37134. v = max;
  37135. } else if (v < min) {
  37136. v = min;
  37137. }
  37138. return v;
  37139. };
  37140. var v = clip(src[srcOffset], domain[0], domain[1]);
  37141. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  37142. if (v < bounds[i]) {
  37143. break;
  37144. }
  37145. }
  37146. var dmin = domain[0];
  37147. if (i > 0) {
  37148. dmin = bounds[i - 1];
  37149. }
  37150. var dmax = domain[1];
  37151. if (i < bounds.length) {
  37152. dmax = bounds[i];
  37153. }
  37154. var rmin = encode[2 * i];
  37155. var rmax = encode[2 * i + 1];
  37156. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  37157. fns[i](tmpBuf, 0, dest, destOffset);
  37158. };
  37159. },
  37160. constructPostScript({
  37161. xref,
  37162. isEvalSupported,
  37163. fn,
  37164. dict
  37165. }) {
  37166. var domain = toNumberArray(dict.getArray("Domain"));
  37167. var range = toNumberArray(dict.getArray("Range"));
  37168. if (!domain) {
  37169. throw new _util.FormatError("No domain.");
  37170. }
  37171. if (!range) {
  37172. throw new _util.FormatError("No range.");
  37173. }
  37174. var lexer = new _ps_parser.PostScriptLexer(fn);
  37175. var parser = new _ps_parser.PostScriptParser(lexer);
  37176. var code = parser.parse();
  37177. return [CONSTRUCT_POSTSCRIPT, domain, range, code];
  37178. },
  37179. constructPostScriptFromIR({
  37180. xref,
  37181. isEvalSupported,
  37182. IR
  37183. }) {
  37184. var domain = IR[1];
  37185. var range = IR[2];
  37186. var code = IR[3];
  37187. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  37188. const compiled = new PostScriptCompiler().compile(code, domain, range);
  37189. if (compiled) {
  37190. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  37191. }
  37192. }
  37193. (0, _util.info)("Unable to compile PS function");
  37194. var numOutputs = range.length >> 1;
  37195. var numInputs = domain.length >> 1;
  37196. var evaluator = new PostScriptEvaluator(code);
  37197. var cache = Object.create(null);
  37198. var MAX_CACHE_SIZE = 2048 * 4;
  37199. var cache_available = MAX_CACHE_SIZE;
  37200. var tmpBuf = new Float32Array(numInputs);
  37201. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  37202. var i, value;
  37203. var key = "";
  37204. var input = tmpBuf;
  37205. for (i = 0; i < numInputs; i++) {
  37206. value = src[srcOffset + i];
  37207. input[i] = value;
  37208. key += value + "_";
  37209. }
  37210. var cachedValue = cache[key];
  37211. if (cachedValue !== undefined) {
  37212. dest.set(cachedValue, destOffset);
  37213. return;
  37214. }
  37215. var output = new Float32Array(numOutputs);
  37216. var stack = evaluator.execute(input);
  37217. var stackIndex = stack.length - numOutputs;
  37218. for (i = 0; i < numOutputs; i++) {
  37219. value = stack[stackIndex + i];
  37220. var bound = range[i * 2];
  37221. if (value < bound) {
  37222. value = bound;
  37223. } else {
  37224. bound = range[i * 2 + 1];
  37225. if (value > bound) {
  37226. value = bound;
  37227. }
  37228. }
  37229. output[i] = value;
  37230. }
  37231. if (cache_available > 0) {
  37232. cache_available--;
  37233. cache[key] = output;
  37234. }
  37235. dest.set(output, destOffset);
  37236. };
  37237. }
  37238. };
  37239. }();
  37240. function isPDFFunction(v) {
  37241. var fnDict;
  37242. if (typeof v !== "object") {
  37243. return false;
  37244. } else if ((0, _primitives.isDict)(v)) {
  37245. fnDict = v;
  37246. } else if ((0, _primitives.isStream)(v)) {
  37247. fnDict = v.dict;
  37248. } else {
  37249. return false;
  37250. }
  37251. return fnDict.has("FunctionType");
  37252. }
  37253. var PostScriptStack = function PostScriptStackClosure() {
  37254. var MAX_STACK_SIZE = 100;
  37255. function PostScriptStack(initialStack) {
  37256. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  37257. }
  37258. PostScriptStack.prototype = {
  37259. push: function PostScriptStack_push(value) {
  37260. if (this.stack.length >= MAX_STACK_SIZE) {
  37261. throw new Error("PostScript function stack overflow.");
  37262. }
  37263. this.stack.push(value);
  37264. },
  37265. pop: function PostScriptStack_pop() {
  37266. if (this.stack.length <= 0) {
  37267. throw new Error("PostScript function stack underflow.");
  37268. }
  37269. return this.stack.pop();
  37270. },
  37271. copy: function PostScriptStack_copy(n) {
  37272. if (this.stack.length + n >= MAX_STACK_SIZE) {
  37273. throw new Error("PostScript function stack overflow.");
  37274. }
  37275. var stack = this.stack;
  37276. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  37277. stack.push(stack[i]);
  37278. }
  37279. },
  37280. index: function PostScriptStack_index(n) {
  37281. this.push(this.stack[this.stack.length - n - 1]);
  37282. },
  37283. roll: function PostScriptStack_roll(n, p) {
  37284. var stack = this.stack;
  37285. var l = stack.length - n;
  37286. var r = stack.length - 1,
  37287. c = l + (p - Math.floor(p / n) * n),
  37288. i,
  37289. j,
  37290. t;
  37291. for (i = l, j = r; i < j; i++, j--) {
  37292. t = stack[i];
  37293. stack[i] = stack[j];
  37294. stack[j] = t;
  37295. }
  37296. for (i = l, j = c - 1; i < j; i++, j--) {
  37297. t = stack[i];
  37298. stack[i] = stack[j];
  37299. stack[j] = t;
  37300. }
  37301. for (i = c, j = r; i < j; i++, j--) {
  37302. t = stack[i];
  37303. stack[i] = stack[j];
  37304. stack[j] = t;
  37305. }
  37306. }
  37307. };
  37308. return PostScriptStack;
  37309. }();
  37310. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  37311. function PostScriptEvaluator(operators) {
  37312. this.operators = operators;
  37313. }
  37314. PostScriptEvaluator.prototype = {
  37315. execute: function PostScriptEvaluator_execute(initialStack) {
  37316. var stack = new PostScriptStack(initialStack);
  37317. var counter = 0;
  37318. var operators = this.operators;
  37319. var length = operators.length;
  37320. var operator, a, b;
  37321. while (counter < length) {
  37322. operator = operators[counter++];
  37323. if (typeof operator === "number") {
  37324. stack.push(operator);
  37325. continue;
  37326. }
  37327. switch (operator) {
  37328. case "jz":
  37329. b = stack.pop();
  37330. a = stack.pop();
  37331. if (!a) {
  37332. counter = b;
  37333. }
  37334. break;
  37335. case "j":
  37336. a = stack.pop();
  37337. counter = a;
  37338. break;
  37339. case "abs":
  37340. a = stack.pop();
  37341. stack.push(Math.abs(a));
  37342. break;
  37343. case "add":
  37344. b = stack.pop();
  37345. a = stack.pop();
  37346. stack.push(a + b);
  37347. break;
  37348. case "and":
  37349. b = stack.pop();
  37350. a = stack.pop();
  37351. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  37352. stack.push(a && b);
  37353. } else {
  37354. stack.push(a & b);
  37355. }
  37356. break;
  37357. case "atan":
  37358. a = stack.pop();
  37359. stack.push(Math.atan(a));
  37360. break;
  37361. case "bitshift":
  37362. b = stack.pop();
  37363. a = stack.pop();
  37364. if (a > 0) {
  37365. stack.push(a << b);
  37366. } else {
  37367. stack.push(a >> b);
  37368. }
  37369. break;
  37370. case "ceiling":
  37371. a = stack.pop();
  37372. stack.push(Math.ceil(a));
  37373. break;
  37374. case "copy":
  37375. a = stack.pop();
  37376. stack.copy(a);
  37377. break;
  37378. case "cos":
  37379. a = stack.pop();
  37380. stack.push(Math.cos(a));
  37381. break;
  37382. case "cvi":
  37383. a = stack.pop() | 0;
  37384. stack.push(a);
  37385. break;
  37386. case "cvr":
  37387. break;
  37388. case "div":
  37389. b = stack.pop();
  37390. a = stack.pop();
  37391. stack.push(a / b);
  37392. break;
  37393. case "dup":
  37394. stack.copy(1);
  37395. break;
  37396. case "eq":
  37397. b = stack.pop();
  37398. a = stack.pop();
  37399. stack.push(a === b);
  37400. break;
  37401. case "exch":
  37402. stack.roll(2, 1);
  37403. break;
  37404. case "exp":
  37405. b = stack.pop();
  37406. a = stack.pop();
  37407. stack.push(a ** b);
  37408. break;
  37409. case "false":
  37410. stack.push(false);
  37411. break;
  37412. case "floor":
  37413. a = stack.pop();
  37414. stack.push(Math.floor(a));
  37415. break;
  37416. case "ge":
  37417. b = stack.pop();
  37418. a = stack.pop();
  37419. stack.push(a >= b);
  37420. break;
  37421. case "gt":
  37422. b = stack.pop();
  37423. a = stack.pop();
  37424. stack.push(a > b);
  37425. break;
  37426. case "idiv":
  37427. b = stack.pop();
  37428. a = stack.pop();
  37429. stack.push(a / b | 0);
  37430. break;
  37431. case "index":
  37432. a = stack.pop();
  37433. stack.index(a);
  37434. break;
  37435. case "le":
  37436. b = stack.pop();
  37437. a = stack.pop();
  37438. stack.push(a <= b);
  37439. break;
  37440. case "ln":
  37441. a = stack.pop();
  37442. stack.push(Math.log(a));
  37443. break;
  37444. case "log":
  37445. a = stack.pop();
  37446. stack.push(Math.log(a) / Math.LN10);
  37447. break;
  37448. case "lt":
  37449. b = stack.pop();
  37450. a = stack.pop();
  37451. stack.push(a < b);
  37452. break;
  37453. case "mod":
  37454. b = stack.pop();
  37455. a = stack.pop();
  37456. stack.push(a % b);
  37457. break;
  37458. case "mul":
  37459. b = stack.pop();
  37460. a = stack.pop();
  37461. stack.push(a * b);
  37462. break;
  37463. case "ne":
  37464. b = stack.pop();
  37465. a = stack.pop();
  37466. stack.push(a !== b);
  37467. break;
  37468. case "neg":
  37469. a = stack.pop();
  37470. stack.push(-a);
  37471. break;
  37472. case "not":
  37473. a = stack.pop();
  37474. if ((0, _util.isBool)(a)) {
  37475. stack.push(!a);
  37476. } else {
  37477. stack.push(~a);
  37478. }
  37479. break;
  37480. case "or":
  37481. b = stack.pop();
  37482. a = stack.pop();
  37483. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  37484. stack.push(a || b);
  37485. } else {
  37486. stack.push(a | b);
  37487. }
  37488. break;
  37489. case "pop":
  37490. stack.pop();
  37491. break;
  37492. case "roll":
  37493. b = stack.pop();
  37494. a = stack.pop();
  37495. stack.roll(a, b);
  37496. break;
  37497. case "round":
  37498. a = stack.pop();
  37499. stack.push(Math.round(a));
  37500. break;
  37501. case "sin":
  37502. a = stack.pop();
  37503. stack.push(Math.sin(a));
  37504. break;
  37505. case "sqrt":
  37506. a = stack.pop();
  37507. stack.push(Math.sqrt(a));
  37508. break;
  37509. case "sub":
  37510. b = stack.pop();
  37511. a = stack.pop();
  37512. stack.push(a - b);
  37513. break;
  37514. case "true":
  37515. stack.push(true);
  37516. break;
  37517. case "truncate":
  37518. a = stack.pop();
  37519. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  37520. stack.push(a);
  37521. break;
  37522. case "xor":
  37523. b = stack.pop();
  37524. a = stack.pop();
  37525. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  37526. stack.push(a !== b);
  37527. } else {
  37528. stack.push(a ^ b);
  37529. }
  37530. break;
  37531. default:
  37532. throw new _util.FormatError(`Unknown operator ${operator}`);
  37533. }
  37534. }
  37535. return stack.stack;
  37536. }
  37537. };
  37538. return PostScriptEvaluator;
  37539. }();
  37540. exports.PostScriptEvaluator = PostScriptEvaluator;
  37541. var PostScriptCompiler = function PostScriptCompilerClosure() {
  37542. function AstNode(type) {
  37543. this.type = type;
  37544. }
  37545. AstNode.prototype.visit = function (visitor) {
  37546. (0, _util.unreachable)("abstract method");
  37547. };
  37548. function AstArgument(index, min, max) {
  37549. AstNode.call(this, "args");
  37550. this.index = index;
  37551. this.min = min;
  37552. this.max = max;
  37553. }
  37554. AstArgument.prototype = Object.create(AstNode.prototype);
  37555. AstArgument.prototype.visit = function (visitor) {
  37556. visitor.visitArgument(this);
  37557. };
  37558. function AstLiteral(number) {
  37559. AstNode.call(this, "literal");
  37560. this.number = number;
  37561. this.min = number;
  37562. this.max = number;
  37563. }
  37564. AstLiteral.prototype = Object.create(AstNode.prototype);
  37565. AstLiteral.prototype.visit = function (visitor) {
  37566. visitor.visitLiteral(this);
  37567. };
  37568. function AstBinaryOperation(op, arg1, arg2, min, max) {
  37569. AstNode.call(this, "binary");
  37570. this.op = op;
  37571. this.arg1 = arg1;
  37572. this.arg2 = arg2;
  37573. this.min = min;
  37574. this.max = max;
  37575. }
  37576. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  37577. AstBinaryOperation.prototype.visit = function (visitor) {
  37578. visitor.visitBinaryOperation(this);
  37579. };
  37580. function AstMin(arg, max) {
  37581. AstNode.call(this, "max");
  37582. this.arg = arg;
  37583. this.min = arg.min;
  37584. this.max = max;
  37585. }
  37586. AstMin.prototype = Object.create(AstNode.prototype);
  37587. AstMin.prototype.visit = function (visitor) {
  37588. visitor.visitMin(this);
  37589. };
  37590. function AstVariable(index, min, max) {
  37591. AstNode.call(this, "var");
  37592. this.index = index;
  37593. this.min = min;
  37594. this.max = max;
  37595. }
  37596. AstVariable.prototype = Object.create(AstNode.prototype);
  37597. AstVariable.prototype.visit = function (visitor) {
  37598. visitor.visitVariable(this);
  37599. };
  37600. function AstVariableDefinition(variable, arg) {
  37601. AstNode.call(this, "definition");
  37602. this.variable = variable;
  37603. this.arg = arg;
  37604. }
  37605. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  37606. AstVariableDefinition.prototype.visit = function (visitor) {
  37607. visitor.visitVariableDefinition(this);
  37608. };
  37609. function ExpressionBuilderVisitor() {
  37610. this.parts = [];
  37611. }
  37612. ExpressionBuilderVisitor.prototype = {
  37613. visitArgument(arg) {
  37614. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  37615. },
  37616. visitVariable(variable) {
  37617. this.parts.push("v", variable.index);
  37618. },
  37619. visitLiteral(literal) {
  37620. this.parts.push(literal.number);
  37621. },
  37622. visitBinaryOperation(operation) {
  37623. this.parts.push("(");
  37624. operation.arg1.visit(this);
  37625. this.parts.push(" ", operation.op, " ");
  37626. operation.arg2.visit(this);
  37627. this.parts.push(")");
  37628. },
  37629. visitVariableDefinition(definition) {
  37630. this.parts.push("var ");
  37631. definition.variable.visit(this);
  37632. this.parts.push(" = ");
  37633. definition.arg.visit(this);
  37634. this.parts.push(";");
  37635. },
  37636. visitMin(max) {
  37637. this.parts.push("Math.min(");
  37638. max.arg.visit(this);
  37639. this.parts.push(", ", max.max, ")");
  37640. },
  37641. toString() {
  37642. return this.parts.join("");
  37643. }
  37644. };
  37645. function buildAddOperation(num1, num2) {
  37646. if (num2.type === "literal" && num2.number === 0) {
  37647. return num1;
  37648. }
  37649. if (num1.type === "literal" && num1.number === 0) {
  37650. return num2;
  37651. }
  37652. if (num2.type === "literal" && num1.type === "literal") {
  37653. return new AstLiteral(num1.number + num2.number);
  37654. }
  37655. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  37656. }
  37657. function buildMulOperation(num1, num2) {
  37658. if (num2.type === "literal") {
  37659. if (num2.number === 0) {
  37660. return new AstLiteral(0);
  37661. } else if (num2.number === 1) {
  37662. return num1;
  37663. } else if (num1.type === "literal") {
  37664. return new AstLiteral(num1.number * num2.number);
  37665. }
  37666. }
  37667. if (num1.type === "literal") {
  37668. if (num1.number === 0) {
  37669. return new AstLiteral(0);
  37670. } else if (num1.number === 1) {
  37671. return num2;
  37672. }
  37673. }
  37674. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  37675. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  37676. return new AstBinaryOperation("*", num1, num2, min, max);
  37677. }
  37678. function buildSubOperation(num1, num2) {
  37679. if (num2.type === "literal") {
  37680. if (num2.number === 0) {
  37681. return num1;
  37682. } else if (num1.type === "literal") {
  37683. return new AstLiteral(num1.number - num2.number);
  37684. }
  37685. }
  37686. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  37687. return num2.arg2;
  37688. }
  37689. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  37690. }
  37691. function buildMinOperation(num1, max) {
  37692. if (num1.min >= max) {
  37693. return new AstLiteral(max);
  37694. } else if (num1.max <= max) {
  37695. return num1;
  37696. }
  37697. return new AstMin(num1, max);
  37698. }
  37699. function PostScriptCompiler() {}
  37700. PostScriptCompiler.prototype = {
  37701. compile: function PostScriptCompiler_compile(code, domain, range) {
  37702. var stack = [];
  37703. var instructions = [];
  37704. var inputSize = domain.length >> 1,
  37705. outputSize = range.length >> 1;
  37706. var lastRegister = 0;
  37707. var n, j;
  37708. var num1, num2, ast1, ast2, tmpVar, item;
  37709. for (let i = 0; i < inputSize; i++) {
  37710. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  37711. }
  37712. for (let i = 0, ii = code.length; i < ii; i++) {
  37713. item = code[i];
  37714. if (typeof item === "number") {
  37715. stack.push(new AstLiteral(item));
  37716. continue;
  37717. }
  37718. switch (item) {
  37719. case "add":
  37720. if (stack.length < 2) {
  37721. return null;
  37722. }
  37723. num2 = stack.pop();
  37724. num1 = stack.pop();
  37725. stack.push(buildAddOperation(num1, num2));
  37726. break;
  37727. case "cvr":
  37728. if (stack.length < 1) {
  37729. return null;
  37730. }
  37731. break;
  37732. case "mul":
  37733. if (stack.length < 2) {
  37734. return null;
  37735. }
  37736. num2 = stack.pop();
  37737. num1 = stack.pop();
  37738. stack.push(buildMulOperation(num1, num2));
  37739. break;
  37740. case "sub":
  37741. if (stack.length < 2) {
  37742. return null;
  37743. }
  37744. num2 = stack.pop();
  37745. num1 = stack.pop();
  37746. stack.push(buildSubOperation(num1, num2));
  37747. break;
  37748. case "exch":
  37749. if (stack.length < 2) {
  37750. return null;
  37751. }
  37752. ast1 = stack.pop();
  37753. ast2 = stack.pop();
  37754. stack.push(ast1, ast2);
  37755. break;
  37756. case "pop":
  37757. if (stack.length < 1) {
  37758. return null;
  37759. }
  37760. stack.pop();
  37761. break;
  37762. case "index":
  37763. if (stack.length < 1) {
  37764. return null;
  37765. }
  37766. num1 = stack.pop();
  37767. if (num1.type !== "literal") {
  37768. return null;
  37769. }
  37770. n = num1.number;
  37771. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  37772. return null;
  37773. }
  37774. ast1 = stack[stack.length - n - 1];
  37775. if (ast1.type === "literal" || ast1.type === "var") {
  37776. stack.push(ast1);
  37777. break;
  37778. }
  37779. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  37780. stack[stack.length - n - 1] = tmpVar;
  37781. stack.push(tmpVar);
  37782. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  37783. break;
  37784. case "dup":
  37785. if (stack.length < 1) {
  37786. return null;
  37787. }
  37788. 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]) {
  37789. num1 = stack.pop();
  37790. stack.push(buildMinOperation(num1, code[i + 1]));
  37791. i += 6;
  37792. break;
  37793. }
  37794. ast1 = stack[stack.length - 1];
  37795. if (ast1.type === "literal" || ast1.type === "var") {
  37796. stack.push(ast1);
  37797. break;
  37798. }
  37799. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  37800. stack[stack.length - 1] = tmpVar;
  37801. stack.push(tmpVar);
  37802. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  37803. break;
  37804. case "roll":
  37805. if (stack.length < 2) {
  37806. return null;
  37807. }
  37808. num2 = stack.pop();
  37809. num1 = stack.pop();
  37810. if (num2.type !== "literal" || num1.type !== "literal") {
  37811. return null;
  37812. }
  37813. j = num2.number;
  37814. n = num1.number;
  37815. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  37816. return null;
  37817. }
  37818. j = (j % n + n) % n;
  37819. if (j === 0) {
  37820. break;
  37821. }
  37822. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  37823. break;
  37824. default:
  37825. return null;
  37826. }
  37827. }
  37828. if (stack.length !== outputSize) {
  37829. return null;
  37830. }
  37831. var result = [];
  37832. instructions.forEach(function (instruction) {
  37833. var statementBuilder = new ExpressionBuilderVisitor();
  37834. instruction.visit(statementBuilder);
  37835. result.push(statementBuilder.toString());
  37836. });
  37837. stack.forEach(function (expr, i) {
  37838. var statementBuilder = new ExpressionBuilderVisitor();
  37839. expr.visit(statementBuilder);
  37840. var min = range[i * 2],
  37841. max = range[i * 2 + 1];
  37842. var out = [statementBuilder.toString()];
  37843. if (min > expr.min) {
  37844. out.unshift("Math.max(", min, ", ");
  37845. out.push(")");
  37846. }
  37847. if (max < expr.max) {
  37848. out.unshift("Math.min(", max, ", ");
  37849. out.push(")");
  37850. }
  37851. out.unshift("dest[destOffset + ", i, "] = ");
  37852. out.push(";");
  37853. result.push(out.join(""));
  37854. });
  37855. return result.join("\n");
  37856. }
  37857. };
  37858. return PostScriptCompiler;
  37859. }();
  37860. exports.PostScriptCompiler = PostScriptCompiler;
  37861. /***/ }),
  37862. /* 42 */
  37863. /***/ (function(module, exports, __w_pdfjs_require__) {
  37864. "use strict";
  37865. Object.defineProperty(exports, "__esModule", {
  37866. value: true
  37867. });
  37868. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  37869. var _util = __w_pdfjs_require__(2);
  37870. var _primitives = __w_pdfjs_require__(5);
  37871. var _core_utils = __w_pdfjs_require__(8);
  37872. class PostScriptParser {
  37873. constructor(lexer) {
  37874. this.lexer = lexer;
  37875. this.operators = [];
  37876. this.token = null;
  37877. this.prev = null;
  37878. }
  37879. nextToken() {
  37880. this.prev = this.token;
  37881. this.token = this.lexer.getToken();
  37882. }
  37883. accept(type) {
  37884. if (this.token.type === type) {
  37885. this.nextToken();
  37886. return true;
  37887. }
  37888. return false;
  37889. }
  37890. expect(type) {
  37891. if (this.accept(type)) {
  37892. return true;
  37893. }
  37894. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  37895. }
  37896. parse() {
  37897. this.nextToken();
  37898. this.expect(PostScriptTokenTypes.LBRACE);
  37899. this.parseBlock();
  37900. this.expect(PostScriptTokenTypes.RBRACE);
  37901. return this.operators;
  37902. }
  37903. parseBlock() {
  37904. while (true) {
  37905. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  37906. this.operators.push(this.prev.value);
  37907. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  37908. this.operators.push(this.prev.value);
  37909. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  37910. this.parseCondition();
  37911. } else {
  37912. return;
  37913. }
  37914. }
  37915. }
  37916. parseCondition() {
  37917. const conditionLocation = this.operators.length;
  37918. this.operators.push(null, null);
  37919. this.parseBlock();
  37920. this.expect(PostScriptTokenTypes.RBRACE);
  37921. if (this.accept(PostScriptTokenTypes.IF)) {
  37922. this.operators[conditionLocation] = this.operators.length;
  37923. this.operators[conditionLocation + 1] = "jz";
  37924. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  37925. const jumpLocation = this.operators.length;
  37926. this.operators.push(null, null);
  37927. const endOfTrue = this.operators.length;
  37928. this.parseBlock();
  37929. this.expect(PostScriptTokenTypes.RBRACE);
  37930. this.expect(PostScriptTokenTypes.IFELSE);
  37931. this.operators[jumpLocation] = this.operators.length;
  37932. this.operators[jumpLocation + 1] = "j";
  37933. this.operators[conditionLocation] = endOfTrue;
  37934. this.operators[conditionLocation + 1] = "jz";
  37935. } else {
  37936. throw new _util.FormatError("PS Function: error parsing conditional.");
  37937. }
  37938. }
  37939. }
  37940. exports.PostScriptParser = PostScriptParser;
  37941. const PostScriptTokenTypes = {
  37942. LBRACE: 0,
  37943. RBRACE: 1,
  37944. NUMBER: 2,
  37945. OPERATOR: 3,
  37946. IF: 4,
  37947. IFELSE: 5
  37948. };
  37949. const PostScriptToken = function PostScriptTokenClosure() {
  37950. const opCache = Object.create(null);
  37951. class PostScriptToken {
  37952. constructor(type, value) {
  37953. this.type = type;
  37954. this.value = value;
  37955. }
  37956. static getOperator(op) {
  37957. const opValue = opCache[op];
  37958. if (opValue) {
  37959. return opValue;
  37960. }
  37961. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  37962. }
  37963. static get LBRACE() {
  37964. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  37965. }
  37966. static get RBRACE() {
  37967. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  37968. }
  37969. static get IF() {
  37970. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  37971. }
  37972. static get IFELSE() {
  37973. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  37974. }
  37975. }
  37976. return PostScriptToken;
  37977. }();
  37978. class PostScriptLexer {
  37979. constructor(stream) {
  37980. this.stream = stream;
  37981. this.nextChar();
  37982. this.strBuf = [];
  37983. }
  37984. nextChar() {
  37985. return this.currentChar = this.stream.getByte();
  37986. }
  37987. getToken() {
  37988. let comment = false;
  37989. let ch = this.currentChar;
  37990. while (true) {
  37991. if (ch < 0) {
  37992. return _primitives.EOF;
  37993. }
  37994. if (comment) {
  37995. if (ch === 0x0a || ch === 0x0d) {
  37996. comment = false;
  37997. }
  37998. } else if (ch === 0x25) {
  37999. comment = true;
  38000. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  38001. break;
  38002. }
  38003. ch = this.nextChar();
  38004. }
  38005. switch (ch | 0) {
  38006. case 0x30:
  38007. case 0x31:
  38008. case 0x32:
  38009. case 0x33:
  38010. case 0x34:
  38011. case 0x35:
  38012. case 0x36:
  38013. case 0x37:
  38014. case 0x38:
  38015. case 0x39:
  38016. case 0x2b:
  38017. case 0x2d:
  38018. case 0x2e:
  38019. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  38020. case 0x7b:
  38021. this.nextChar();
  38022. return PostScriptToken.LBRACE;
  38023. case 0x7d:
  38024. this.nextChar();
  38025. return PostScriptToken.RBRACE;
  38026. }
  38027. const strBuf = this.strBuf;
  38028. strBuf.length = 0;
  38029. strBuf[0] = String.fromCharCode(ch);
  38030. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  38031. strBuf.push(String.fromCharCode(ch));
  38032. }
  38033. const str = strBuf.join("");
  38034. switch (str.toLowerCase()) {
  38035. case "if":
  38036. return PostScriptToken.IF;
  38037. case "ifelse":
  38038. return PostScriptToken.IFELSE;
  38039. default:
  38040. return PostScriptToken.getOperator(str);
  38041. }
  38042. }
  38043. getNumber() {
  38044. let ch = this.currentChar;
  38045. const strBuf = this.strBuf;
  38046. strBuf.length = 0;
  38047. strBuf[0] = String.fromCharCode(ch);
  38048. while ((ch = this.nextChar()) >= 0) {
  38049. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  38050. strBuf.push(String.fromCharCode(ch));
  38051. } else {
  38052. break;
  38053. }
  38054. }
  38055. const value = parseFloat(strBuf.join(""));
  38056. if (isNaN(value)) {
  38057. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  38058. }
  38059. return value;
  38060. }
  38061. }
  38062. exports.PostScriptLexer = PostScriptLexer;
  38063. /***/ }),
  38064. /* 43 */
  38065. /***/ (function(module, exports, __w_pdfjs_require__) {
  38066. "use strict";
  38067. Object.defineProperty(exports, "__esModule", {
  38068. value: true
  38069. });
  38070. exports.MurmurHash3_64 = void 0;
  38071. var _util = __w_pdfjs_require__(2);
  38072. const SEED = 0xc3d2e1f0;
  38073. const MASK_HIGH = 0xffff0000;
  38074. const MASK_LOW = 0xffff;
  38075. class MurmurHash3_64 {
  38076. constructor(seed) {
  38077. this.h1 = seed ? seed & 0xffffffff : SEED;
  38078. this.h2 = seed ? seed & 0xffffffff : SEED;
  38079. }
  38080. update(input) {
  38081. let data, length;
  38082. if ((0, _util.isString)(input)) {
  38083. data = new Uint8Array(input.length * 2);
  38084. length = 0;
  38085. for (let i = 0, ii = input.length; i < ii; i++) {
  38086. const code = input.charCodeAt(i);
  38087. if (code <= 0xff) {
  38088. data[length++] = code;
  38089. } else {
  38090. data[length++] = code >>> 8;
  38091. data[length++] = code & 0xff;
  38092. }
  38093. }
  38094. } else if ((0, _util.isArrayBuffer)(input)) {
  38095. data = input;
  38096. length = data.byteLength;
  38097. } else {
  38098. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  38099. }
  38100. const blockCounts = length >> 2;
  38101. const tailLength = length - blockCounts * 4;
  38102. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  38103. let k1 = 0,
  38104. k2 = 0;
  38105. let h1 = this.h1,
  38106. h2 = this.h2;
  38107. const C1 = 0xcc9e2d51,
  38108. C2 = 0x1b873593;
  38109. const C1_LOW = C1 & MASK_LOW,
  38110. C2_LOW = C2 & MASK_LOW;
  38111. for (let i = 0; i < blockCounts; i++) {
  38112. if (i & 1) {
  38113. k1 = dataUint32[i];
  38114. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  38115. k1 = k1 << 15 | k1 >>> 17;
  38116. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  38117. h1 ^= k1;
  38118. h1 = h1 << 13 | h1 >>> 19;
  38119. h1 = h1 * 5 + 0xe6546b64;
  38120. } else {
  38121. k2 = dataUint32[i];
  38122. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  38123. k2 = k2 << 15 | k2 >>> 17;
  38124. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  38125. h2 ^= k2;
  38126. h2 = h2 << 13 | h2 >>> 19;
  38127. h2 = h2 * 5 + 0xe6546b64;
  38128. }
  38129. }
  38130. k1 = 0;
  38131. switch (tailLength) {
  38132. case 3:
  38133. k1 ^= data[blockCounts * 4 + 2] << 16;
  38134. case 2:
  38135. k1 ^= data[blockCounts * 4 + 1] << 8;
  38136. case 1:
  38137. k1 ^= data[blockCounts * 4];
  38138. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  38139. k1 = k1 << 15 | k1 >>> 17;
  38140. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  38141. if (blockCounts & 1) {
  38142. h1 ^= k1;
  38143. } else {
  38144. h2 ^= k1;
  38145. }
  38146. }
  38147. this.h1 = h1;
  38148. this.h2 = h2;
  38149. }
  38150. hexdigest() {
  38151. let h1 = this.h1,
  38152. h2 = this.h2;
  38153. h1 ^= h2 >>> 1;
  38154. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  38155. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  38156. h1 ^= h2 >>> 1;
  38157. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  38158. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  38159. h1 ^= h2 >>> 1;
  38160. const hex1 = (h1 >>> 0).toString(16),
  38161. hex2 = (h2 >>> 0).toString(16);
  38162. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  38163. }
  38164. }
  38165. exports.MurmurHash3_64 = MurmurHash3_64;
  38166. /***/ }),
  38167. /* 44 */
  38168. /***/ (function(module, exports, __w_pdfjs_require__) {
  38169. "use strict";
  38170. Object.defineProperty(exports, "__esModule", {
  38171. value: true
  38172. });
  38173. exports.PDFImage = void 0;
  38174. var _util = __w_pdfjs_require__(2);
  38175. var _primitives = __w_pdfjs_require__(5);
  38176. var _colorspace = __w_pdfjs_require__(23);
  38177. var _stream = __w_pdfjs_require__(12);
  38178. var _jpeg_stream = __w_pdfjs_require__(18);
  38179. var _jpx = __w_pdfjs_require__(21);
  38180. var PDFImage = function PDFImageClosure() {
  38181. function decodeAndClamp(value, addend, coefficient, max) {
  38182. value = addend + value * coefficient;
  38183. if (value < 0) {
  38184. value = 0;
  38185. } else if (value > max) {
  38186. value = max;
  38187. }
  38188. return value;
  38189. }
  38190. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  38191. var length = w2 * h2;
  38192. let dest;
  38193. if (bpc <= 8) {
  38194. dest = new Uint8Array(length);
  38195. } else if (bpc <= 16) {
  38196. dest = new Uint16Array(length);
  38197. } else {
  38198. dest = new Uint32Array(length);
  38199. }
  38200. var xRatio = w1 / w2;
  38201. var yRatio = h1 / h2;
  38202. var i,
  38203. j,
  38204. py,
  38205. newIndex = 0,
  38206. oldIndex;
  38207. var xScaled = new Uint16Array(w2);
  38208. var w1Scanline = w1;
  38209. for (i = 0; i < w2; i++) {
  38210. xScaled[i] = Math.floor(i * xRatio);
  38211. }
  38212. for (i = 0; i < h2; i++) {
  38213. py = Math.floor(i * yRatio) * w1Scanline;
  38214. for (j = 0; j < w2; j++) {
  38215. oldIndex = py + xScaled[j];
  38216. dest[newIndex++] = src[oldIndex];
  38217. }
  38218. }
  38219. return dest;
  38220. }
  38221. function PDFImage({
  38222. xref,
  38223. res,
  38224. image,
  38225. isInline = false,
  38226. smask = null,
  38227. mask = null,
  38228. isMask = false,
  38229. pdfFunctionFactory
  38230. }) {
  38231. this.image = image;
  38232. var dict = image.dict;
  38233. const filter = dict.get("Filter");
  38234. if ((0, _primitives.isName)(filter)) {
  38235. switch (filter.name) {
  38236. case "JPXDecode":
  38237. var jpxImage = new _jpx.JpxImage();
  38238. jpxImage.parseImageProperties(image.stream);
  38239. image.stream.reset();
  38240. image.width = jpxImage.width;
  38241. image.height = jpxImage.height;
  38242. image.bitsPerComponent = jpxImage.bitsPerComponent;
  38243. image.numComps = jpxImage.componentsCount;
  38244. break;
  38245. case "JBIG2Decode":
  38246. image.bitsPerComponent = 1;
  38247. image.numComps = 1;
  38248. break;
  38249. }
  38250. }
  38251. let width = dict.get("Width", "W");
  38252. let height = dict.get("Height", "H");
  38253. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  38254. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  38255. width = image.width;
  38256. height = image.height;
  38257. }
  38258. if (width < 1 || height < 1) {
  38259. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  38260. }
  38261. this.width = width;
  38262. this.height = height;
  38263. this.interpolate = dict.get("Interpolate", "I") || false;
  38264. this.imageMask = dict.get("ImageMask", "IM") || false;
  38265. this.matte = dict.get("Matte") || false;
  38266. var bitsPerComponent = image.bitsPerComponent;
  38267. if (!bitsPerComponent) {
  38268. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  38269. if (!bitsPerComponent) {
  38270. if (this.imageMask) {
  38271. bitsPerComponent = 1;
  38272. } else {
  38273. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  38274. }
  38275. }
  38276. }
  38277. this.bpc = bitsPerComponent;
  38278. if (!this.imageMask) {
  38279. var colorSpace = dict.get("ColorSpace", "CS");
  38280. if (!colorSpace) {
  38281. (0, _util.info)("JPX images (which do not require color spaces)");
  38282. switch (image.numComps) {
  38283. case 1:
  38284. colorSpace = _primitives.Name.get("DeviceGray");
  38285. break;
  38286. case 3:
  38287. colorSpace = _primitives.Name.get("DeviceRGB");
  38288. break;
  38289. case 4:
  38290. colorSpace = _primitives.Name.get("DeviceCMYK");
  38291. break;
  38292. default:
  38293. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  38294. }
  38295. }
  38296. const resources = isInline ? res : null;
  38297. this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory);
  38298. this.numComps = this.colorSpace.numComps;
  38299. }
  38300. this.decode = dict.getArray("Decode", "D");
  38301. this.needsDecode = false;
  38302. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  38303. this.needsDecode = true;
  38304. var max = (1 << bitsPerComponent) - 1;
  38305. this.decodeCoefficients = [];
  38306. this.decodeAddends = [];
  38307. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  38308. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  38309. var dmin = this.decode[i];
  38310. var dmax = this.decode[i + 1];
  38311. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  38312. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  38313. }
  38314. }
  38315. if (smask) {
  38316. this.smask = new PDFImage({
  38317. xref,
  38318. res,
  38319. image: smask,
  38320. isInline,
  38321. pdfFunctionFactory
  38322. });
  38323. } else if (mask) {
  38324. if ((0, _primitives.isStream)(mask)) {
  38325. var maskDict = mask.dict,
  38326. imageMask = maskDict.get("ImageMask", "IM");
  38327. if (!imageMask) {
  38328. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  38329. } else {
  38330. this.mask = new PDFImage({
  38331. xref,
  38332. res,
  38333. image: mask,
  38334. isInline,
  38335. isMask: true,
  38336. pdfFunctionFactory
  38337. });
  38338. }
  38339. } else {
  38340. this.mask = mask;
  38341. }
  38342. }
  38343. }
  38344. PDFImage.buildImage = function ({
  38345. xref,
  38346. res,
  38347. image,
  38348. isInline = false,
  38349. pdfFunctionFactory
  38350. }) {
  38351. const imageData = image;
  38352. let smaskData = null;
  38353. let maskData = null;
  38354. const smask = image.dict.get("SMask");
  38355. const mask = image.dict.get("Mask");
  38356. if (smask) {
  38357. smaskData = smask;
  38358. } else if (mask) {
  38359. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  38360. maskData = mask;
  38361. } else {
  38362. (0, _util.warn)("Unsupported mask format.");
  38363. }
  38364. }
  38365. return Promise.resolve(new PDFImage({
  38366. xref,
  38367. res,
  38368. image: imageData,
  38369. isInline,
  38370. smask: smaskData,
  38371. mask: maskData,
  38372. pdfFunctionFactory
  38373. }));
  38374. };
  38375. PDFImage.createMask = function ({
  38376. imgArray,
  38377. width,
  38378. height,
  38379. imageIsFromDecodeStream,
  38380. inverseDecode
  38381. }) {
  38382. var computedLength = (width + 7 >> 3) * height;
  38383. var actualLength = imgArray.byteLength;
  38384. var haveFullData = computedLength === actualLength;
  38385. var data, i;
  38386. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  38387. data = imgArray;
  38388. } else if (!inverseDecode) {
  38389. data = new Uint8ClampedArray(actualLength);
  38390. data.set(imgArray);
  38391. } else {
  38392. data = new Uint8ClampedArray(computedLength);
  38393. data.set(imgArray);
  38394. for (i = actualLength; i < computedLength; i++) {
  38395. data[i] = 0xff;
  38396. }
  38397. }
  38398. if (inverseDecode) {
  38399. for (i = 0; i < actualLength; i++) {
  38400. data[i] ^= 0xff;
  38401. }
  38402. }
  38403. return {
  38404. data,
  38405. width,
  38406. height
  38407. };
  38408. };
  38409. PDFImage.prototype = {
  38410. get drawWidth() {
  38411. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  38412. },
  38413. get drawHeight() {
  38414. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  38415. },
  38416. decodeBuffer(buffer) {
  38417. var bpc = this.bpc;
  38418. var numComps = this.numComps;
  38419. var decodeAddends = this.decodeAddends;
  38420. var decodeCoefficients = this.decodeCoefficients;
  38421. var max = (1 << bpc) - 1;
  38422. var i, ii;
  38423. if (bpc === 1) {
  38424. for (i = 0, ii = buffer.length; i < ii; i++) {
  38425. buffer[i] = +!buffer[i];
  38426. }
  38427. return;
  38428. }
  38429. var index = 0;
  38430. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  38431. for (var j = 0; j < numComps; j++) {
  38432. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  38433. index++;
  38434. }
  38435. }
  38436. },
  38437. getComponents(buffer) {
  38438. var bpc = this.bpc;
  38439. if (bpc === 8) {
  38440. return buffer;
  38441. }
  38442. var width = this.width;
  38443. var height = this.height;
  38444. var numComps = this.numComps;
  38445. var length = width * height * numComps;
  38446. var bufferPos = 0;
  38447. let output;
  38448. if (bpc <= 8) {
  38449. output = new Uint8Array(length);
  38450. } else if (bpc <= 16) {
  38451. output = new Uint16Array(length);
  38452. } else {
  38453. output = new Uint32Array(length);
  38454. }
  38455. var rowComps = width * numComps;
  38456. var max = (1 << bpc) - 1;
  38457. var i = 0,
  38458. ii,
  38459. buf;
  38460. if (bpc === 1) {
  38461. var mask, loop1End, loop2End;
  38462. for (var j = 0; j < height; j++) {
  38463. loop1End = i + (rowComps & ~7);
  38464. loop2End = i + rowComps;
  38465. while (i < loop1End) {
  38466. buf = buffer[bufferPos++];
  38467. output[i] = buf >> 7 & 1;
  38468. output[i + 1] = buf >> 6 & 1;
  38469. output[i + 2] = buf >> 5 & 1;
  38470. output[i + 3] = buf >> 4 & 1;
  38471. output[i + 4] = buf >> 3 & 1;
  38472. output[i + 5] = buf >> 2 & 1;
  38473. output[i + 6] = buf >> 1 & 1;
  38474. output[i + 7] = buf & 1;
  38475. i += 8;
  38476. }
  38477. if (i < loop2End) {
  38478. buf = buffer[bufferPos++];
  38479. mask = 128;
  38480. while (i < loop2End) {
  38481. output[i++] = +!!(buf & mask);
  38482. mask >>= 1;
  38483. }
  38484. }
  38485. }
  38486. } else {
  38487. var bits = 0;
  38488. buf = 0;
  38489. for (i = 0, ii = length; i < ii; ++i) {
  38490. if (i % rowComps === 0) {
  38491. buf = 0;
  38492. bits = 0;
  38493. }
  38494. while (bits < bpc) {
  38495. buf = buf << 8 | buffer[bufferPos++];
  38496. bits += 8;
  38497. }
  38498. var remainingBits = bits - bpc;
  38499. let value = buf >> remainingBits;
  38500. if (value < 0) {
  38501. value = 0;
  38502. } else if (value > max) {
  38503. value = max;
  38504. }
  38505. output[i] = value;
  38506. buf = buf & (1 << remainingBits) - 1;
  38507. bits = remainingBits;
  38508. }
  38509. }
  38510. return output;
  38511. },
  38512. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  38513. var smask = this.smask;
  38514. var mask = this.mask;
  38515. var alphaBuf, sw, sh, i, ii, j;
  38516. if (smask) {
  38517. sw = smask.width;
  38518. sh = smask.height;
  38519. alphaBuf = new Uint8ClampedArray(sw * sh);
  38520. smask.fillGrayBuffer(alphaBuf);
  38521. if (sw !== width || sh !== height) {
  38522. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  38523. }
  38524. } else if (mask) {
  38525. if (mask instanceof PDFImage) {
  38526. sw = mask.width;
  38527. sh = mask.height;
  38528. alphaBuf = new Uint8ClampedArray(sw * sh);
  38529. mask.numComps = 1;
  38530. mask.fillGrayBuffer(alphaBuf);
  38531. for (i = 0, ii = sw * sh; i < ii; ++i) {
  38532. alphaBuf[i] = 255 - alphaBuf[i];
  38533. }
  38534. if (sw !== width || sh !== height) {
  38535. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  38536. }
  38537. } else if (Array.isArray(mask)) {
  38538. alphaBuf = new Uint8ClampedArray(width * height);
  38539. var numComps = this.numComps;
  38540. for (i = 0, ii = width * height; i < ii; ++i) {
  38541. var opacity = 0;
  38542. var imageOffset = i * numComps;
  38543. for (j = 0; j < numComps; ++j) {
  38544. var color = image[imageOffset + j];
  38545. var maskOffset = j * 2;
  38546. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  38547. opacity = 255;
  38548. break;
  38549. }
  38550. }
  38551. alphaBuf[i] = opacity;
  38552. }
  38553. } else {
  38554. throw new _util.FormatError("Unknown mask format.");
  38555. }
  38556. }
  38557. if (alphaBuf) {
  38558. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  38559. rgbaBuf[j] = alphaBuf[i];
  38560. }
  38561. } else {
  38562. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  38563. rgbaBuf[j] = 255;
  38564. }
  38565. }
  38566. },
  38567. undoPreblend(buffer, width, height) {
  38568. var matte = this.smask && this.smask.matte;
  38569. if (!matte) {
  38570. return;
  38571. }
  38572. var matteRgb = this.colorSpace.getRgb(matte, 0);
  38573. var matteR = matteRgb[0];
  38574. var matteG = matteRgb[1];
  38575. var matteB = matteRgb[2];
  38576. var length = width * height * 4;
  38577. for (var i = 0; i < length; i += 4) {
  38578. var alpha = buffer[i + 3];
  38579. if (alpha === 0) {
  38580. buffer[i] = 255;
  38581. buffer[i + 1] = 255;
  38582. buffer[i + 2] = 255;
  38583. continue;
  38584. }
  38585. var k = 255 / alpha;
  38586. buffer[i] = (buffer[i] - matteR) * k + matteR;
  38587. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  38588. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  38589. }
  38590. },
  38591. createImageData(forceRGBA = false) {
  38592. var drawWidth = this.drawWidth;
  38593. var drawHeight = this.drawHeight;
  38594. var imgData = {
  38595. width: drawWidth,
  38596. height: drawHeight,
  38597. kind: 0,
  38598. data: null
  38599. };
  38600. var numComps = this.numComps;
  38601. var originalWidth = this.width;
  38602. var originalHeight = this.height;
  38603. var bpc = this.bpc;
  38604. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  38605. var imgArray;
  38606. if (!forceRGBA) {
  38607. var kind;
  38608. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  38609. kind = _util.ImageKind.GRAYSCALE_1BPP;
  38610. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  38611. kind = _util.ImageKind.RGB_24BPP;
  38612. }
  38613. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  38614. imgData.kind = kind;
  38615. imgArray = this.getImageBytes(originalHeight * rowBytes);
  38616. if (this.image instanceof _stream.DecodeStream) {
  38617. imgData.data = imgArray;
  38618. } else {
  38619. var newArray = new Uint8ClampedArray(imgArray.length);
  38620. newArray.set(imgArray);
  38621. imgData.data = newArray;
  38622. }
  38623. if (this.needsDecode) {
  38624. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  38625. var buffer = imgData.data;
  38626. for (var i = 0, ii = buffer.length; i < ii; i++) {
  38627. buffer[i] ^= 0xff;
  38628. }
  38629. }
  38630. return imgData;
  38631. }
  38632. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  38633. let imageLength = originalHeight * rowBytes;
  38634. switch (this.colorSpace.name) {
  38635. case "DeviceGray":
  38636. imageLength *= 3;
  38637. case "DeviceRGB":
  38638. case "DeviceCMYK":
  38639. imgData.kind = _util.ImageKind.RGB_24BPP;
  38640. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  38641. return imgData;
  38642. }
  38643. }
  38644. }
  38645. imgArray = this.getImageBytes(originalHeight * rowBytes);
  38646. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  38647. var comps = this.getComponents(imgArray);
  38648. var alpha01, maybeUndoPreblend;
  38649. if (!forceRGBA && !this.smask && !this.mask) {
  38650. imgData.kind = _util.ImageKind.RGB_24BPP;
  38651. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  38652. alpha01 = 0;
  38653. maybeUndoPreblend = false;
  38654. } else {
  38655. imgData.kind = _util.ImageKind.RGBA_32BPP;
  38656. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  38657. alpha01 = 1;
  38658. maybeUndoPreblend = true;
  38659. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  38660. }
  38661. if (this.needsDecode) {
  38662. this.decodeBuffer(comps);
  38663. }
  38664. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  38665. if (maybeUndoPreblend) {
  38666. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  38667. }
  38668. return imgData;
  38669. },
  38670. fillGrayBuffer(buffer) {
  38671. var numComps = this.numComps;
  38672. if (numComps !== 1) {
  38673. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  38674. }
  38675. var width = this.width;
  38676. var height = this.height;
  38677. var bpc = this.bpc;
  38678. var rowBytes = width * numComps * bpc + 7 >> 3;
  38679. var imgArray = this.getImageBytes(height * rowBytes);
  38680. var comps = this.getComponents(imgArray);
  38681. var i, length;
  38682. if (bpc === 1) {
  38683. length = width * height;
  38684. if (this.needsDecode) {
  38685. for (i = 0; i < length; ++i) {
  38686. buffer[i] = comps[i] - 1 & 255;
  38687. }
  38688. } else {
  38689. for (i = 0; i < length; ++i) {
  38690. buffer[i] = -comps[i] & 255;
  38691. }
  38692. }
  38693. return;
  38694. }
  38695. if (this.needsDecode) {
  38696. this.decodeBuffer(comps);
  38697. }
  38698. length = width * height;
  38699. var scale = 255 / ((1 << bpc) - 1);
  38700. for (i = 0; i < length; ++i) {
  38701. buffer[i] = scale * comps[i];
  38702. }
  38703. },
  38704. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  38705. this.image.reset();
  38706. this.image.drawWidth = drawWidth || this.width;
  38707. this.image.drawHeight = drawHeight || this.height;
  38708. this.image.forceRGB = !!forceRGB;
  38709. return this.image.getBytes(length, true);
  38710. }
  38711. };
  38712. return PDFImage;
  38713. }();
  38714. exports.PDFImage = PDFImage;
  38715. /***/ }),
  38716. /* 45 */
  38717. /***/ (function(module, exports, __w_pdfjs_require__) {
  38718. "use strict";
  38719. Object.defineProperty(exports, "__esModule", {
  38720. value: true
  38721. });
  38722. exports.MessageHandler = void 0;
  38723. var _util = __w_pdfjs_require__(2);
  38724. const CallbackKind = {
  38725. UNKNOWN: 0,
  38726. DATA: 1,
  38727. ERROR: 2
  38728. };
  38729. const StreamKind = {
  38730. UNKNOWN: 0,
  38731. CANCEL: 1,
  38732. CANCEL_COMPLETE: 2,
  38733. CLOSE: 3,
  38734. ENQUEUE: 4,
  38735. ERROR: 5,
  38736. PULL: 6,
  38737. PULL_COMPLETE: 7,
  38738. START_COMPLETE: 8
  38739. };
  38740. function wrapReason(reason) {
  38741. if (typeof reason !== "object" || reason === null) {
  38742. return reason;
  38743. }
  38744. switch (reason.name) {
  38745. case "AbortException":
  38746. return new _util.AbortException(reason.message);
  38747. case "MissingPDFException":
  38748. return new _util.MissingPDFException(reason.message);
  38749. case "UnexpectedResponseException":
  38750. return new _util.UnexpectedResponseException(reason.message, reason.status);
  38751. case "UnknownErrorException":
  38752. return new _util.UnknownErrorException(reason.message, reason.details);
  38753. default:
  38754. return new _util.UnknownErrorException(reason.message, reason.toString());
  38755. }
  38756. }
  38757. class MessageHandler {
  38758. constructor(sourceName, targetName, comObj) {
  38759. this.sourceName = sourceName;
  38760. this.targetName = targetName;
  38761. this.comObj = comObj;
  38762. this.callbackId = 1;
  38763. this.streamId = 1;
  38764. this.postMessageTransfers = true;
  38765. this.streamSinks = Object.create(null);
  38766. this.streamControllers = Object.create(null);
  38767. this.callbackCapabilities = Object.create(null);
  38768. this.actionHandler = Object.create(null);
  38769. this._onComObjOnMessage = event => {
  38770. const data = event.data;
  38771. if (data.targetName !== this.sourceName) {
  38772. return;
  38773. }
  38774. if (data.stream) {
  38775. this._processStreamMessage(data);
  38776. return;
  38777. }
  38778. if (data.callback) {
  38779. const callbackId = data.callbackId;
  38780. const capability = this.callbackCapabilities[callbackId];
  38781. if (!capability) {
  38782. throw new Error(`Cannot resolve callback ${callbackId}`);
  38783. }
  38784. delete this.callbackCapabilities[callbackId];
  38785. if (data.callback === CallbackKind.DATA) {
  38786. capability.resolve(data.data);
  38787. } else if (data.callback === CallbackKind.ERROR) {
  38788. capability.reject(wrapReason(data.reason));
  38789. } else {
  38790. throw new Error("Unexpected callback case");
  38791. }
  38792. return;
  38793. }
  38794. const action = this.actionHandler[data.action];
  38795. if (!action) {
  38796. throw new Error(`Unknown action from worker: ${data.action}`);
  38797. }
  38798. if (data.callbackId) {
  38799. const cbSourceName = this.sourceName;
  38800. const cbTargetName = data.sourceName;
  38801. new Promise(function (resolve) {
  38802. resolve(action(data.data));
  38803. }).then(function (result) {
  38804. comObj.postMessage({
  38805. sourceName: cbSourceName,
  38806. targetName: cbTargetName,
  38807. callback: CallbackKind.DATA,
  38808. callbackId: data.callbackId,
  38809. data: result
  38810. });
  38811. }, function (reason) {
  38812. comObj.postMessage({
  38813. sourceName: cbSourceName,
  38814. targetName: cbTargetName,
  38815. callback: CallbackKind.ERROR,
  38816. callbackId: data.callbackId,
  38817. reason: wrapReason(reason)
  38818. });
  38819. });
  38820. return;
  38821. }
  38822. if (data.streamId) {
  38823. this._createStreamSink(data);
  38824. return;
  38825. }
  38826. action(data.data);
  38827. };
  38828. comObj.addEventListener("message", this._onComObjOnMessage);
  38829. }
  38830. on(actionName, handler) {
  38831. const ah = this.actionHandler;
  38832. if (ah[actionName]) {
  38833. throw new Error(`There is already an actionName called "${actionName}"`);
  38834. }
  38835. ah[actionName] = handler;
  38836. }
  38837. send(actionName, data, transfers) {
  38838. this._postMessage({
  38839. sourceName: this.sourceName,
  38840. targetName: this.targetName,
  38841. action: actionName,
  38842. data
  38843. }, transfers);
  38844. }
  38845. sendWithPromise(actionName, data, transfers) {
  38846. const callbackId = this.callbackId++;
  38847. const capability = (0, _util.createPromiseCapability)();
  38848. this.callbackCapabilities[callbackId] = capability;
  38849. try {
  38850. this._postMessage({
  38851. sourceName: this.sourceName,
  38852. targetName: this.targetName,
  38853. action: actionName,
  38854. callbackId,
  38855. data
  38856. }, transfers);
  38857. } catch (ex) {
  38858. capability.reject(ex);
  38859. }
  38860. return capability.promise;
  38861. }
  38862. sendWithStream(actionName, data, queueingStrategy, transfers) {
  38863. const streamId = this.streamId++;
  38864. const sourceName = this.sourceName;
  38865. const targetName = this.targetName;
  38866. const comObj = this.comObj;
  38867. return new ReadableStream({
  38868. start: controller => {
  38869. const startCapability = (0, _util.createPromiseCapability)();
  38870. this.streamControllers[streamId] = {
  38871. controller,
  38872. startCall: startCapability,
  38873. pullCall: null,
  38874. cancelCall: null,
  38875. isClosed: false
  38876. };
  38877. this._postMessage({
  38878. sourceName,
  38879. targetName,
  38880. action: actionName,
  38881. streamId,
  38882. data,
  38883. desiredSize: controller.desiredSize
  38884. }, transfers);
  38885. return startCapability.promise;
  38886. },
  38887. pull: controller => {
  38888. const pullCapability = (0, _util.createPromiseCapability)();
  38889. this.streamControllers[streamId].pullCall = pullCapability;
  38890. comObj.postMessage({
  38891. sourceName,
  38892. targetName,
  38893. stream: StreamKind.PULL,
  38894. streamId,
  38895. desiredSize: controller.desiredSize
  38896. });
  38897. return pullCapability.promise;
  38898. },
  38899. cancel: reason => {
  38900. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  38901. const cancelCapability = (0, _util.createPromiseCapability)();
  38902. this.streamControllers[streamId].cancelCall = cancelCapability;
  38903. this.streamControllers[streamId].isClosed = true;
  38904. comObj.postMessage({
  38905. sourceName,
  38906. targetName,
  38907. stream: StreamKind.CANCEL,
  38908. streamId,
  38909. reason: wrapReason(reason)
  38910. });
  38911. return cancelCapability.promise;
  38912. }
  38913. }, queueingStrategy);
  38914. }
  38915. _createStreamSink(data) {
  38916. const self = this;
  38917. const action = this.actionHandler[data.action];
  38918. const streamId = data.streamId;
  38919. const sourceName = this.sourceName;
  38920. const targetName = data.sourceName;
  38921. const comObj = this.comObj;
  38922. const streamSink = {
  38923. enqueue(chunk, size = 1, transfers) {
  38924. if (this.isCancelled) {
  38925. return;
  38926. }
  38927. const lastDesiredSize = this.desiredSize;
  38928. this.desiredSize -= size;
  38929. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  38930. this.sinkCapability = (0, _util.createPromiseCapability)();
  38931. this.ready = this.sinkCapability.promise;
  38932. }
  38933. self._postMessage({
  38934. sourceName,
  38935. targetName,
  38936. stream: StreamKind.ENQUEUE,
  38937. streamId,
  38938. chunk
  38939. }, transfers);
  38940. },
  38941. close() {
  38942. if (this.isCancelled) {
  38943. return;
  38944. }
  38945. this.isCancelled = true;
  38946. comObj.postMessage({
  38947. sourceName,
  38948. targetName,
  38949. stream: StreamKind.CLOSE,
  38950. streamId
  38951. });
  38952. delete self.streamSinks[streamId];
  38953. },
  38954. error(reason) {
  38955. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  38956. if (this.isCancelled) {
  38957. return;
  38958. }
  38959. this.isCancelled = true;
  38960. comObj.postMessage({
  38961. sourceName,
  38962. targetName,
  38963. stream: StreamKind.ERROR,
  38964. streamId,
  38965. reason: wrapReason(reason)
  38966. });
  38967. },
  38968. sinkCapability: (0, _util.createPromiseCapability)(),
  38969. onPull: null,
  38970. onCancel: null,
  38971. isCancelled: false,
  38972. desiredSize: data.desiredSize,
  38973. ready: null
  38974. };
  38975. streamSink.sinkCapability.resolve();
  38976. streamSink.ready = streamSink.sinkCapability.promise;
  38977. this.streamSinks[streamId] = streamSink;
  38978. new Promise(function (resolve) {
  38979. resolve(action(data.data, streamSink));
  38980. }).then(function () {
  38981. comObj.postMessage({
  38982. sourceName,
  38983. targetName,
  38984. stream: StreamKind.START_COMPLETE,
  38985. streamId,
  38986. success: true
  38987. });
  38988. }, function (reason) {
  38989. comObj.postMessage({
  38990. sourceName,
  38991. targetName,
  38992. stream: StreamKind.START_COMPLETE,
  38993. streamId,
  38994. reason: wrapReason(reason)
  38995. });
  38996. });
  38997. }
  38998. _processStreamMessage(data) {
  38999. const streamId = data.streamId;
  39000. const sourceName = this.sourceName;
  39001. const targetName = data.sourceName;
  39002. const comObj = this.comObj;
  39003. switch (data.stream) {
  39004. case StreamKind.START_COMPLETE:
  39005. if (data.success) {
  39006. this.streamControllers[streamId].startCall.resolve();
  39007. } else {
  39008. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  39009. }
  39010. break;
  39011. case StreamKind.PULL_COMPLETE:
  39012. if (data.success) {
  39013. this.streamControllers[streamId].pullCall.resolve();
  39014. } else {
  39015. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  39016. }
  39017. break;
  39018. case StreamKind.PULL:
  39019. if (!this.streamSinks[streamId]) {
  39020. comObj.postMessage({
  39021. sourceName,
  39022. targetName,
  39023. stream: StreamKind.PULL_COMPLETE,
  39024. streamId,
  39025. success: true
  39026. });
  39027. break;
  39028. }
  39029. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  39030. this.streamSinks[streamId].sinkCapability.resolve();
  39031. }
  39032. this.streamSinks[streamId].desiredSize = data.desiredSize;
  39033. const {
  39034. onPull
  39035. } = this.streamSinks[data.streamId];
  39036. new Promise(function (resolve) {
  39037. resolve(onPull && onPull());
  39038. }).then(function () {
  39039. comObj.postMessage({
  39040. sourceName,
  39041. targetName,
  39042. stream: StreamKind.PULL_COMPLETE,
  39043. streamId,
  39044. success: true
  39045. });
  39046. }, function (reason) {
  39047. comObj.postMessage({
  39048. sourceName,
  39049. targetName,
  39050. stream: StreamKind.PULL_COMPLETE,
  39051. streamId,
  39052. reason: wrapReason(reason)
  39053. });
  39054. });
  39055. break;
  39056. case StreamKind.ENQUEUE:
  39057. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  39058. if (this.streamControllers[streamId].isClosed) {
  39059. break;
  39060. }
  39061. this.streamControllers[streamId].controller.enqueue(data.chunk);
  39062. break;
  39063. case StreamKind.CLOSE:
  39064. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  39065. if (this.streamControllers[streamId].isClosed) {
  39066. break;
  39067. }
  39068. this.streamControllers[streamId].isClosed = true;
  39069. this.streamControllers[streamId].controller.close();
  39070. this._deleteStreamController(streamId);
  39071. break;
  39072. case StreamKind.ERROR:
  39073. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  39074. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  39075. this._deleteStreamController(streamId);
  39076. break;
  39077. case StreamKind.CANCEL_COMPLETE:
  39078. if (data.success) {
  39079. this.streamControllers[streamId].cancelCall.resolve();
  39080. } else {
  39081. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  39082. }
  39083. this._deleteStreamController(streamId);
  39084. break;
  39085. case StreamKind.CANCEL:
  39086. if (!this.streamSinks[streamId]) {
  39087. break;
  39088. }
  39089. const {
  39090. onCancel
  39091. } = this.streamSinks[data.streamId];
  39092. new Promise(function (resolve) {
  39093. resolve(onCancel && onCancel(wrapReason(data.reason)));
  39094. }).then(function () {
  39095. comObj.postMessage({
  39096. sourceName,
  39097. targetName,
  39098. stream: StreamKind.CANCEL_COMPLETE,
  39099. streamId,
  39100. success: true
  39101. });
  39102. }, function (reason) {
  39103. comObj.postMessage({
  39104. sourceName,
  39105. targetName,
  39106. stream: StreamKind.CANCEL_COMPLETE,
  39107. streamId,
  39108. reason: wrapReason(reason)
  39109. });
  39110. });
  39111. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  39112. this.streamSinks[streamId].isCancelled = true;
  39113. delete this.streamSinks[streamId];
  39114. break;
  39115. default:
  39116. throw new Error("Unexpected stream case");
  39117. }
  39118. }
  39119. async _deleteStreamController(streamId) {
  39120. await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  39121. return capability && capability.promise;
  39122. }));
  39123. delete this.streamControllers[streamId];
  39124. }
  39125. _postMessage(message, transfers) {
  39126. if (transfers && this.postMessageTransfers) {
  39127. this.comObj.postMessage(message, transfers);
  39128. } else {
  39129. this.comObj.postMessage(message);
  39130. }
  39131. }
  39132. destroy() {
  39133. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  39134. }
  39135. }
  39136. exports.MessageHandler = MessageHandler;
  39137. /***/ }),
  39138. /* 46 */
  39139. /***/ (function(module, exports, __w_pdfjs_require__) {
  39140. "use strict";
  39141. Object.defineProperty(exports, "__esModule", {
  39142. value: true
  39143. });
  39144. exports.PDFWorkerStream = void 0;
  39145. var _util = __w_pdfjs_require__(2);
  39146. class PDFWorkerStream {
  39147. constructor(msgHandler) {
  39148. this._msgHandler = msgHandler;
  39149. this._contentLength = null;
  39150. this._fullRequestReader = null;
  39151. this._rangeRequestReaders = [];
  39152. }
  39153. getFullReader() {
  39154. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  39155. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  39156. return this._fullRequestReader;
  39157. }
  39158. getRangeReader(begin, end) {
  39159. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  39160. this._rangeRequestReaders.push(reader);
  39161. return reader;
  39162. }
  39163. cancelAllRequests(reason) {
  39164. if (this._fullRequestReader) {
  39165. this._fullRequestReader.cancel(reason);
  39166. }
  39167. const readers = this._rangeRequestReaders.slice(0);
  39168. readers.forEach(function (reader) {
  39169. reader.cancel(reason);
  39170. });
  39171. }
  39172. }
  39173. exports.PDFWorkerStream = PDFWorkerStream;
  39174. class PDFWorkerStreamReader {
  39175. constructor(msgHandler) {
  39176. this._msgHandler = msgHandler;
  39177. this.onProgress = null;
  39178. this._contentLength = null;
  39179. this._isRangeSupported = false;
  39180. this._isStreamingSupported = false;
  39181. const readableStream = this._msgHandler.sendWithStream("GetReader");
  39182. this._reader = readableStream.getReader();
  39183. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  39184. this._isStreamingSupported = data.isStreamingSupported;
  39185. this._isRangeSupported = data.isRangeSupported;
  39186. this._contentLength = data.contentLength;
  39187. });
  39188. }
  39189. get headersReady() {
  39190. return this._headersReady;
  39191. }
  39192. get contentLength() {
  39193. return this._contentLength;
  39194. }
  39195. get isStreamingSupported() {
  39196. return this._isStreamingSupported;
  39197. }
  39198. get isRangeSupported() {
  39199. return this._isRangeSupported;
  39200. }
  39201. async read() {
  39202. const {
  39203. value,
  39204. done
  39205. } = await this._reader.read();
  39206. if (done) {
  39207. return {
  39208. value: undefined,
  39209. done: true
  39210. };
  39211. }
  39212. return {
  39213. value: value.buffer,
  39214. done: false
  39215. };
  39216. }
  39217. cancel(reason) {
  39218. this._reader.cancel(reason);
  39219. }
  39220. }
  39221. class PDFWorkerStreamRangeReader {
  39222. constructor(begin, end, msgHandler) {
  39223. this._msgHandler = msgHandler;
  39224. this.onProgress = null;
  39225. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  39226. begin,
  39227. end
  39228. });
  39229. this._reader = readableStream.getReader();
  39230. }
  39231. get isStreamingSupported() {
  39232. return false;
  39233. }
  39234. async read() {
  39235. const {
  39236. value,
  39237. done
  39238. } = await this._reader.read();
  39239. if (done) {
  39240. return {
  39241. value: undefined,
  39242. done: true
  39243. };
  39244. }
  39245. return {
  39246. value: value.buffer,
  39247. done: false
  39248. };
  39249. }
  39250. cancel(reason) {
  39251. this._reader.cancel(reason);
  39252. }
  39253. }
  39254. /***/ })
  39255. /******/ ]);
  39256. });
  39257. //# sourceMappingURL=pdf.worker.js.map