pdf.worker.js 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548
  1. /* Copyright 2017 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. (function webpackUniversalModuleDefinition(root, factory) {
  16. if(typeof exports === 'object' && typeof module === 'object')
  17. module.exports = factory();
  18. else if(typeof define === 'function' && define.amd)
  19. define("pdfjs-dist/build/pdf.worker", [], factory);
  20. else if(typeof exports === 'object')
  21. exports["pdfjs-dist/build/pdf.worker"] = factory();
  22. else
  23. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsDistBuildPdfWorker = factory();
  24. })(this, function() {
  25. return /******/ (function(modules) { // webpackBootstrap
  26. /******/ // The module cache
  27. /******/ var installedModules = {};
  28. /******/
  29. /******/ // The require function
  30. /******/ function __w_pdfjs_require__(moduleId) {
  31. /******/
  32. /******/ // Check if module is in cache
  33. /******/ if(installedModules[moduleId]) {
  34. /******/ return installedModules[moduleId].exports;
  35. /******/ }
  36. /******/ // Create a new module (and put it into the cache)
  37. /******/ var module = installedModules[moduleId] = {
  38. /******/ i: moduleId,
  39. /******/ l: false,
  40. /******/ exports: {}
  41. /******/ };
  42. /******/
  43. /******/ // Execute the module function
  44. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  45. /******/
  46. /******/ // Flag the module as loaded
  47. /******/ module.l = true;
  48. /******/
  49. /******/ // Return the exports of the module
  50. /******/ return module.exports;
  51. /******/ }
  52. /******/
  53. /******/
  54. /******/ // expose the modules object (__webpack_modules__)
  55. /******/ __w_pdfjs_require__.m = modules;
  56. /******/
  57. /******/ // expose the module cache
  58. /******/ __w_pdfjs_require__.c = installedModules;
  59. /******/
  60. /******/ // identity function for calling harmony imports with the correct context
  61. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  62. /******/
  63. /******/ // define getter function for harmony exports
  64. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  65. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  66. /******/ Object.defineProperty(exports, name, {
  67. /******/ configurable: false,
  68. /******/ enumerable: true,
  69. /******/ get: getter
  70. /******/ });
  71. /******/ }
  72. /******/ };
  73. /******/
  74. /******/ // getDefaultExport function for compatibility with non-harmony modules
  75. /******/ __w_pdfjs_require__.n = function(module) {
  76. /******/ var getter = module && module.__esModule ?
  77. /******/ function getDefault() { return module['default']; } :
  78. /******/ function getModuleExports() { return module; };
  79. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  80. /******/ return getter;
  81. /******/ };
  82. /******/
  83. /******/ // Object.prototype.hasOwnProperty.call
  84. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  85. /******/
  86. /******/ // __webpack_public_path__
  87. /******/ __w_pdfjs_require__.p = "";
  88. /******/
  89. /******/ // Load entry module and return exports
  90. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 36);
  91. /******/ })
  92. /************************************************************************/
  93. /******/ ([
  94. /* 0 */
  95. /***/ (function(module, exports, __w_pdfjs_require__) {
  96. "use strict";
  97. /* WEBPACK VAR INJECTION */(function(global) {
  98. Object.defineProperty(exports, "__esModule", {
  99. value: true
  100. });
  101. exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isInt = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.isArray = exports.info = exports.globalScope = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.error = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.StatTimer = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
  102. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  103. __w_pdfjs_require__(37);
  104. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : undefined;
  105. var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  106. var NativeImageDecoding = {
  107. NONE: 'none',
  108. DECODE: 'decode',
  109. DISPLAY: 'display'
  110. };
  111. var TextRenderingMode = {
  112. FILL: 0,
  113. STROKE: 1,
  114. FILL_STROKE: 2,
  115. INVISIBLE: 3,
  116. FILL_ADD_TO_PATH: 4,
  117. STROKE_ADD_TO_PATH: 5,
  118. FILL_STROKE_ADD_TO_PATH: 6,
  119. ADD_TO_PATH: 7,
  120. FILL_STROKE_MASK: 3,
  121. ADD_TO_PATH_FLAG: 4
  122. };
  123. var ImageKind = {
  124. GRAYSCALE_1BPP: 1,
  125. RGB_24BPP: 2,
  126. RGBA_32BPP: 3
  127. };
  128. var AnnotationType = {
  129. TEXT: 1,
  130. LINK: 2,
  131. FREETEXT: 3,
  132. LINE: 4,
  133. SQUARE: 5,
  134. CIRCLE: 6,
  135. POLYGON: 7,
  136. POLYLINE: 8,
  137. HIGHLIGHT: 9,
  138. UNDERLINE: 10,
  139. SQUIGGLY: 11,
  140. STRIKEOUT: 12,
  141. STAMP: 13,
  142. CARET: 14,
  143. INK: 15,
  144. POPUP: 16,
  145. FILEATTACHMENT: 17,
  146. SOUND: 18,
  147. MOVIE: 19,
  148. WIDGET: 20,
  149. SCREEN: 21,
  150. PRINTERMARK: 22,
  151. TRAPNET: 23,
  152. WATERMARK: 24,
  153. THREED: 25,
  154. REDACT: 26
  155. };
  156. var AnnotationFlag = {
  157. INVISIBLE: 0x01,
  158. HIDDEN: 0x02,
  159. PRINT: 0x04,
  160. NOZOOM: 0x08,
  161. NOROTATE: 0x10,
  162. NOVIEW: 0x20,
  163. READONLY: 0x40,
  164. LOCKED: 0x80,
  165. TOGGLENOVIEW: 0x100,
  166. LOCKEDCONTENTS: 0x200
  167. };
  168. var AnnotationFieldFlag = {
  169. READONLY: 0x0000001,
  170. REQUIRED: 0x0000002,
  171. NOEXPORT: 0x0000004,
  172. MULTILINE: 0x0001000,
  173. PASSWORD: 0x0002000,
  174. NOTOGGLETOOFF: 0x0004000,
  175. RADIO: 0x0008000,
  176. PUSHBUTTON: 0x0010000,
  177. COMBO: 0x0020000,
  178. EDIT: 0x0040000,
  179. SORT: 0x0080000,
  180. FILESELECT: 0x0100000,
  181. MULTISELECT: 0x0200000,
  182. DONOTSPELLCHECK: 0x0400000,
  183. DONOTSCROLL: 0x0800000,
  184. COMB: 0x1000000,
  185. RICHTEXT: 0x2000000,
  186. RADIOSINUNISON: 0x2000000,
  187. COMMITONSELCHANGE: 0x4000000
  188. };
  189. var AnnotationBorderStyleType = {
  190. SOLID: 1,
  191. DASHED: 2,
  192. BEVELED: 3,
  193. INSET: 4,
  194. UNDERLINE: 5
  195. };
  196. var StreamType = {
  197. UNKNOWN: 0,
  198. FLATE: 1,
  199. LZW: 2,
  200. DCT: 3,
  201. JPX: 4,
  202. JBIG: 5,
  203. A85: 6,
  204. AHX: 7,
  205. CCF: 8,
  206. RL: 9
  207. };
  208. var FontType = {
  209. UNKNOWN: 0,
  210. TYPE1: 1,
  211. TYPE1C: 2,
  212. CIDFONTTYPE0: 3,
  213. CIDFONTTYPE0C: 4,
  214. TRUETYPE: 5,
  215. CIDFONTTYPE2: 6,
  216. TYPE3: 7,
  217. OPENTYPE: 8,
  218. TYPE0: 9,
  219. MMTYPE1: 10
  220. };
  221. var VERBOSITY_LEVELS = {
  222. errors: 0,
  223. warnings: 1,
  224. infos: 5
  225. };
  226. var CMapCompressionType = {
  227. NONE: 0,
  228. BINARY: 1,
  229. STREAM: 2
  230. };
  231. var OPS = {
  232. dependency: 1,
  233. setLineWidth: 2,
  234. setLineCap: 3,
  235. setLineJoin: 4,
  236. setMiterLimit: 5,
  237. setDash: 6,
  238. setRenderingIntent: 7,
  239. setFlatness: 8,
  240. setGState: 9,
  241. save: 10,
  242. restore: 11,
  243. transform: 12,
  244. moveTo: 13,
  245. lineTo: 14,
  246. curveTo: 15,
  247. curveTo2: 16,
  248. curveTo3: 17,
  249. closePath: 18,
  250. rectangle: 19,
  251. stroke: 20,
  252. closeStroke: 21,
  253. fill: 22,
  254. eoFill: 23,
  255. fillStroke: 24,
  256. eoFillStroke: 25,
  257. closeFillStroke: 26,
  258. closeEOFillStroke: 27,
  259. endPath: 28,
  260. clip: 29,
  261. eoClip: 30,
  262. beginText: 31,
  263. endText: 32,
  264. setCharSpacing: 33,
  265. setWordSpacing: 34,
  266. setHScale: 35,
  267. setLeading: 36,
  268. setFont: 37,
  269. setTextRenderingMode: 38,
  270. setTextRise: 39,
  271. moveText: 40,
  272. setLeadingMoveText: 41,
  273. setTextMatrix: 42,
  274. nextLine: 43,
  275. showText: 44,
  276. showSpacedText: 45,
  277. nextLineShowText: 46,
  278. nextLineSetSpacingShowText: 47,
  279. setCharWidth: 48,
  280. setCharWidthAndBounds: 49,
  281. setStrokeColorSpace: 50,
  282. setFillColorSpace: 51,
  283. setStrokeColor: 52,
  284. setStrokeColorN: 53,
  285. setFillColor: 54,
  286. setFillColorN: 55,
  287. setStrokeGray: 56,
  288. setFillGray: 57,
  289. setStrokeRGBColor: 58,
  290. setFillRGBColor: 59,
  291. setStrokeCMYKColor: 60,
  292. setFillCMYKColor: 61,
  293. shadingFill: 62,
  294. beginInlineImage: 63,
  295. beginImageData: 64,
  296. endInlineImage: 65,
  297. paintXObject: 66,
  298. markPoint: 67,
  299. markPointProps: 68,
  300. beginMarkedContent: 69,
  301. beginMarkedContentProps: 70,
  302. endMarkedContent: 71,
  303. beginCompat: 72,
  304. endCompat: 73,
  305. paintFormXObjectBegin: 74,
  306. paintFormXObjectEnd: 75,
  307. beginGroup: 76,
  308. endGroup: 77,
  309. beginAnnotations: 78,
  310. endAnnotations: 79,
  311. beginAnnotation: 80,
  312. endAnnotation: 81,
  313. paintJpegXObject: 82,
  314. paintImageMaskXObject: 83,
  315. paintImageMaskXObjectGroup: 84,
  316. paintImageXObject: 85,
  317. paintInlineImageXObject: 86,
  318. paintInlineImageXObjectGroup: 87,
  319. paintImageXObjectRepeat: 88,
  320. paintImageMaskXObjectRepeat: 89,
  321. paintSolidColorImageMask: 90,
  322. constructPath: 91
  323. };
  324. var verbosity = VERBOSITY_LEVELS.warnings;
  325. function setVerbosityLevel(level) {
  326. verbosity = level;
  327. }
  328. function getVerbosityLevel() {
  329. return verbosity;
  330. }
  331. function info(msg) {
  332. if (verbosity >= VERBOSITY_LEVELS.infos) {
  333. console.log('Info: ' + msg);
  334. }
  335. }
  336. function warn(msg) {
  337. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  338. console.log('Warning: ' + msg);
  339. }
  340. }
  341. function deprecated(details) {
  342. console.log('Deprecated API usage: ' + details);
  343. }
  344. function error(msg) {
  345. if (verbosity >= VERBOSITY_LEVELS.errors) {
  346. console.log('Error: ' + msg);
  347. console.log(backtrace());
  348. }
  349. throw new Error(msg);
  350. }
  351. function backtrace() {
  352. try {
  353. throw new Error();
  354. } catch (e) {
  355. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  356. }
  357. }
  358. function assert(cond, msg) {
  359. if (!cond) {
  360. error(msg);
  361. }
  362. }
  363. var UNSUPPORTED_FEATURES = {
  364. unknown: 'unknown',
  365. forms: 'forms',
  366. javaScript: 'javaScript',
  367. smask: 'smask',
  368. shadingPattern: 'shadingPattern',
  369. font: 'font'
  370. };
  371. function isSameOrigin(baseUrl, otherUrl) {
  372. try {
  373. var base = new URL(baseUrl);
  374. if (!base.origin || base.origin === 'null') {
  375. return false;
  376. }
  377. } catch (e) {
  378. return false;
  379. }
  380. var other = new URL(otherUrl, base);
  381. return base.origin === other.origin;
  382. }
  383. function isValidProtocol(url) {
  384. if (!url) {
  385. return false;
  386. }
  387. switch (url.protocol) {
  388. case 'http:':
  389. case 'https:':
  390. case 'ftp:':
  391. case 'mailto:':
  392. case 'tel:':
  393. return true;
  394. default:
  395. return false;
  396. }
  397. }
  398. function createValidAbsoluteUrl(url, baseUrl) {
  399. if (!url) {
  400. return null;
  401. }
  402. try {
  403. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  404. if (isValidProtocol(absoluteUrl)) {
  405. return absoluteUrl;
  406. }
  407. } catch (ex) {}
  408. return null;
  409. }
  410. function shadow(obj, prop, value) {
  411. Object.defineProperty(obj, prop, {
  412. value: value,
  413. enumerable: true,
  414. configurable: true,
  415. writable: false
  416. });
  417. return value;
  418. }
  419. function getLookupTableFactory(initializer) {
  420. var lookup;
  421. return function () {
  422. if (initializer) {
  423. lookup = Object.create(null);
  424. initializer(lookup);
  425. initializer = null;
  426. }
  427. return lookup;
  428. };
  429. }
  430. var PasswordResponses = {
  431. NEED_PASSWORD: 1,
  432. INCORRECT_PASSWORD: 2
  433. };
  434. var PasswordException = function PasswordExceptionClosure() {
  435. function PasswordException(msg, code) {
  436. this.name = 'PasswordException';
  437. this.message = msg;
  438. this.code = code;
  439. }
  440. PasswordException.prototype = new Error();
  441. PasswordException.constructor = PasswordException;
  442. return PasswordException;
  443. }();
  444. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  445. function UnknownErrorException(msg, details) {
  446. this.name = 'UnknownErrorException';
  447. this.message = msg;
  448. this.details = details;
  449. }
  450. UnknownErrorException.prototype = new Error();
  451. UnknownErrorException.constructor = UnknownErrorException;
  452. return UnknownErrorException;
  453. }();
  454. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  455. function InvalidPDFException(msg) {
  456. this.name = 'InvalidPDFException';
  457. this.message = msg;
  458. }
  459. InvalidPDFException.prototype = new Error();
  460. InvalidPDFException.constructor = InvalidPDFException;
  461. return InvalidPDFException;
  462. }();
  463. var MissingPDFException = function MissingPDFExceptionClosure() {
  464. function MissingPDFException(msg) {
  465. this.name = 'MissingPDFException';
  466. this.message = msg;
  467. }
  468. MissingPDFException.prototype = new Error();
  469. MissingPDFException.constructor = MissingPDFException;
  470. return MissingPDFException;
  471. }();
  472. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  473. function UnexpectedResponseException(msg, status) {
  474. this.name = 'UnexpectedResponseException';
  475. this.message = msg;
  476. this.status = status;
  477. }
  478. UnexpectedResponseException.prototype = new Error();
  479. UnexpectedResponseException.constructor = UnexpectedResponseException;
  480. return UnexpectedResponseException;
  481. }();
  482. var NotImplementedException = function NotImplementedExceptionClosure() {
  483. function NotImplementedException(msg) {
  484. this.message = msg;
  485. }
  486. NotImplementedException.prototype = new Error();
  487. NotImplementedException.prototype.name = 'NotImplementedException';
  488. NotImplementedException.constructor = NotImplementedException;
  489. return NotImplementedException;
  490. }();
  491. var MissingDataException = function MissingDataExceptionClosure() {
  492. function MissingDataException(begin, end) {
  493. this.begin = begin;
  494. this.end = end;
  495. this.message = 'Missing data [' + begin + ', ' + end + ')';
  496. }
  497. MissingDataException.prototype = new Error();
  498. MissingDataException.prototype.name = 'MissingDataException';
  499. MissingDataException.constructor = MissingDataException;
  500. return MissingDataException;
  501. }();
  502. var XRefParseException = function XRefParseExceptionClosure() {
  503. function XRefParseException(msg) {
  504. this.message = msg;
  505. }
  506. XRefParseException.prototype = new Error();
  507. XRefParseException.prototype.name = 'XRefParseException';
  508. XRefParseException.constructor = XRefParseException;
  509. return XRefParseException;
  510. }();
  511. var NullCharactersRegExp = /\x00/g;
  512. function removeNullCharacters(str) {
  513. if (typeof str !== 'string') {
  514. warn('The argument for removeNullCharacters must be a string.');
  515. return str;
  516. }
  517. return str.replace(NullCharactersRegExp, '');
  518. }
  519. function bytesToString(bytes) {
  520. assert(bytes !== null && (typeof bytes === 'undefined' ? 'undefined' : _typeof(bytes)) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  521. var length = bytes.length;
  522. var MAX_ARGUMENT_COUNT = 8192;
  523. if (length < MAX_ARGUMENT_COUNT) {
  524. return String.fromCharCode.apply(null, bytes);
  525. }
  526. var strBuf = [];
  527. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  528. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  529. var chunk = bytes.subarray(i, chunkEnd);
  530. strBuf.push(String.fromCharCode.apply(null, chunk));
  531. }
  532. return strBuf.join('');
  533. }
  534. function stringToBytes(str) {
  535. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  536. var length = str.length;
  537. var bytes = new Uint8Array(length);
  538. for (var i = 0; i < length; ++i) {
  539. bytes[i] = str.charCodeAt(i) & 0xFF;
  540. }
  541. return bytes;
  542. }
  543. function arrayByteLength(arr) {
  544. if (arr.length !== undefined) {
  545. return arr.length;
  546. }
  547. assert(arr.byteLength !== undefined);
  548. return arr.byteLength;
  549. }
  550. function arraysToBytes(arr) {
  551. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  552. return arr[0];
  553. }
  554. var resultLength = 0;
  555. var i,
  556. ii = arr.length;
  557. var item, itemLength;
  558. for (i = 0; i < ii; i++) {
  559. item = arr[i];
  560. itemLength = arrayByteLength(item);
  561. resultLength += itemLength;
  562. }
  563. var pos = 0;
  564. var data = new Uint8Array(resultLength);
  565. for (i = 0; i < ii; i++) {
  566. item = arr[i];
  567. if (!(item instanceof Uint8Array)) {
  568. if (typeof item === 'string') {
  569. item = stringToBytes(item);
  570. } else {
  571. item = new Uint8Array(item);
  572. }
  573. }
  574. itemLength = item.byteLength;
  575. data.set(item, pos);
  576. pos += itemLength;
  577. }
  578. return data;
  579. }
  580. function string32(value) {
  581. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  582. }
  583. function log2(x) {
  584. var n = 1,
  585. i = 0;
  586. while (x > n) {
  587. n <<= 1;
  588. i++;
  589. }
  590. return i;
  591. }
  592. function readInt8(data, start) {
  593. return data[start] << 24 >> 24;
  594. }
  595. function readUint16(data, offset) {
  596. return data[offset] << 8 | data[offset + 1];
  597. }
  598. function readUint32(data, offset) {
  599. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  600. }
  601. function isLittleEndian() {
  602. var buffer8 = new Uint8Array(4);
  603. buffer8[0] = 1;
  604. var view32 = new Uint32Array(buffer8.buffer, 0, 1);
  605. return view32[0] === 1;
  606. }
  607. function isEvalSupported() {
  608. try {
  609. new Function('');
  610. return true;
  611. } catch (e) {
  612. return false;
  613. }
  614. }
  615. var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  616. var Util = function UtilClosure() {
  617. function Util() {}
  618. var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
  619. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  620. rgbBuf[1] = r;
  621. rgbBuf[3] = g;
  622. rgbBuf[5] = b;
  623. return rgbBuf.join('');
  624. };
  625. Util.transform = function Util_transform(m1, m2) {
  626. 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]];
  627. };
  628. Util.applyTransform = function Util_applyTransform(p, m) {
  629. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  630. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  631. return [xt, yt];
  632. };
  633. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  634. var d = m[0] * m[3] - m[1] * m[2];
  635. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  636. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  637. return [xt, yt];
  638. };
  639. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  640. var p1 = Util.applyTransform(r, m);
  641. var p2 = Util.applyTransform(r.slice(2, 4), m);
  642. var p3 = Util.applyTransform([r[0], r[3]], m);
  643. var p4 = Util.applyTransform([r[2], r[1]], m);
  644. 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])];
  645. };
  646. Util.inverseTransform = function Util_inverseTransform(m) {
  647. var d = m[0] * m[3] - m[1] * m[2];
  648. 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];
  649. };
  650. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  651. 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]];
  652. };
  653. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  654. var transpose = [m[0], m[2], m[1], m[3]];
  655. var a = m[0] * transpose[0] + m[1] * transpose[2];
  656. var b = m[0] * transpose[1] + m[1] * transpose[3];
  657. var c = m[2] * transpose[0] + m[3] * transpose[2];
  658. var d = m[2] * transpose[1] + m[3] * transpose[3];
  659. var first = (a + d) / 2;
  660. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  661. var sx = first + second || 1;
  662. var sy = first - second || 1;
  663. return [Math.sqrt(sx), Math.sqrt(sy)];
  664. };
  665. Util.normalizeRect = function Util_normalizeRect(rect) {
  666. var r = rect.slice(0);
  667. if (rect[0] > rect[2]) {
  668. r[0] = rect[2];
  669. r[2] = rect[0];
  670. }
  671. if (rect[1] > rect[3]) {
  672. r[1] = rect[3];
  673. r[3] = rect[1];
  674. }
  675. return r;
  676. };
  677. Util.intersect = function Util_intersect(rect1, rect2) {
  678. function compare(a, b) {
  679. return a - b;
  680. }
  681. var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
  682. orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
  683. result = [];
  684. rect1 = Util.normalizeRect(rect1);
  685. rect2 = Util.normalizeRect(rect2);
  686. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  687. result[0] = orderedX[1];
  688. result[2] = orderedX[2];
  689. } else {
  690. return false;
  691. }
  692. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  693. result[1] = orderedY[1];
  694. result[3] = orderedY[2];
  695. } else {
  696. return false;
  697. }
  698. return result;
  699. };
  700. Util.sign = function Util_sign(num) {
  701. return num < 0 ? -1 : 1;
  702. };
  703. var 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'];
  704. Util.toRoman = function Util_toRoman(number, lowerCase) {
  705. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  706. var pos,
  707. romanBuf = [];
  708. while (number >= 1000) {
  709. number -= 1000;
  710. romanBuf.push('M');
  711. }
  712. pos = number / 100 | 0;
  713. number %= 100;
  714. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  715. pos = number / 10 | 0;
  716. number %= 10;
  717. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  718. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  719. var romanStr = romanBuf.join('');
  720. return lowerCase ? romanStr.toLowerCase() : romanStr;
  721. };
  722. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  723. Array.prototype.push.apply(arr1, arr2);
  724. };
  725. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  726. Array.prototype.unshift.apply(arr1, arr2);
  727. };
  728. Util.extendObj = function extendObj(obj1, obj2) {
  729. for (var key in obj2) {
  730. obj1[key] = obj2[key];
  731. }
  732. };
  733. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  734. while (dict && !dict.has(name)) {
  735. dict = dict.get('Parent');
  736. }
  737. if (!dict) {
  738. return null;
  739. }
  740. return getArray ? dict.getArray(name) : dict.get(name);
  741. };
  742. Util.inherit = function Util_inherit(sub, base, prototype) {
  743. sub.prototype = Object.create(base.prototype);
  744. sub.prototype.constructor = sub;
  745. for (var prop in prototype) {
  746. sub.prototype[prop] = prototype[prop];
  747. }
  748. };
  749. Util.loadScript = function Util_loadScript(src, callback) {
  750. var script = document.createElement('script');
  751. var loaded = false;
  752. script.setAttribute('src', src);
  753. if (callback) {
  754. script.onload = function () {
  755. if (!loaded) {
  756. callback();
  757. }
  758. loaded = true;
  759. };
  760. }
  761. document.getElementsByTagName('head')[0].appendChild(script);
  762. };
  763. return Util;
  764. }();
  765. var PageViewport = function PageViewportClosure() {
  766. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  767. this.viewBox = viewBox;
  768. this.scale = scale;
  769. this.rotation = rotation;
  770. this.offsetX = offsetX;
  771. this.offsetY = offsetY;
  772. var centerX = (viewBox[2] + viewBox[0]) / 2;
  773. var centerY = (viewBox[3] + viewBox[1]) / 2;
  774. var rotateA, rotateB, rotateC, rotateD;
  775. rotation = rotation % 360;
  776. rotation = rotation < 0 ? rotation + 360 : rotation;
  777. switch (rotation) {
  778. case 180:
  779. rotateA = -1;
  780. rotateB = 0;
  781. rotateC = 0;
  782. rotateD = 1;
  783. break;
  784. case 90:
  785. rotateA = 0;
  786. rotateB = 1;
  787. rotateC = 1;
  788. rotateD = 0;
  789. break;
  790. case 270:
  791. rotateA = 0;
  792. rotateB = -1;
  793. rotateC = -1;
  794. rotateD = 0;
  795. break;
  796. default:
  797. rotateA = 1;
  798. rotateB = 0;
  799. rotateC = 0;
  800. rotateD = -1;
  801. break;
  802. }
  803. if (dontFlip) {
  804. rotateC = -rotateC;
  805. rotateD = -rotateD;
  806. }
  807. var offsetCanvasX, offsetCanvasY;
  808. var width, height;
  809. if (rotateA === 0) {
  810. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  811. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  812. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  813. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  814. } else {
  815. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  816. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  817. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  818. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  819. }
  820. this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
  821. this.width = width;
  822. this.height = height;
  823. this.fontScale = scale;
  824. }
  825. PageViewport.prototype = {
  826. clone: function PageViewPort_clone(args) {
  827. args = args || {};
  828. var scale = 'scale' in args ? args.scale : this.scale;
  829. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  830. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  831. },
  832. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  833. return Util.applyTransform([x, y], this.transform);
  834. },
  835. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  836. var tl = Util.applyTransform([rect[0], rect[1]], this.transform);
  837. var br = Util.applyTransform([rect[2], rect[3]], this.transform);
  838. return [tl[0], tl[1], br[0], br[1]];
  839. },
  840. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  841. return Util.applyInverseTransform([x, y], this.transform);
  842. }
  843. };
  844. return PageViewport;
  845. }();
  846. var 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];
  847. function stringToPDFString(str) {
  848. var i,
  849. n = str.length,
  850. strBuf = [];
  851. if (str[0] === '\xFE' && str[1] === '\xFF') {
  852. for (i = 2; i < n; i += 2) {
  853. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  854. }
  855. } else {
  856. for (i = 0; i < n; ++i) {
  857. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  858. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  859. }
  860. }
  861. return strBuf.join('');
  862. }
  863. function stringToUTF8String(str) {
  864. return decodeURIComponent(escape(str));
  865. }
  866. function utf8StringToString(str) {
  867. return unescape(encodeURIComponent(str));
  868. }
  869. function isEmptyObj(obj) {
  870. for (var key in obj) {
  871. return false;
  872. }
  873. return true;
  874. }
  875. function isBool(v) {
  876. return typeof v === 'boolean';
  877. }
  878. function isInt(v) {
  879. return typeof v === 'number' && (v | 0) === v;
  880. }
  881. function isNum(v) {
  882. return typeof v === 'number';
  883. }
  884. function isString(v) {
  885. return typeof v === 'string';
  886. }
  887. function isArray(v) {
  888. return v instanceof Array;
  889. }
  890. function isArrayBuffer(v) {
  891. return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.byteLength !== undefined;
  892. }
  893. function isSpace(ch) {
  894. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  895. }
  896. function isNodeJS() {
  897. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  898. return (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && process + '' === '[object process]';
  899. }
  900. return false;
  901. }
  902. function createPromiseCapability() {
  903. var capability = {};
  904. capability.promise = new Promise(function (resolve, reject) {
  905. capability.resolve = resolve;
  906. capability.reject = reject;
  907. });
  908. return capability;
  909. }
  910. var StatTimer = function StatTimerClosure() {
  911. function rpad(str, pad, length) {
  912. while (str.length < length) {
  913. str += pad;
  914. }
  915. return str;
  916. }
  917. function StatTimer() {
  918. this.started = Object.create(null);
  919. this.times = [];
  920. this.enabled = true;
  921. }
  922. StatTimer.prototype = {
  923. time: function StatTimer_time(name) {
  924. if (!this.enabled) {
  925. return;
  926. }
  927. if (name in this.started) {
  928. warn('Timer is already running for ' + name);
  929. }
  930. this.started[name] = Date.now();
  931. },
  932. timeEnd: function StatTimer_timeEnd(name) {
  933. if (!this.enabled) {
  934. return;
  935. }
  936. if (!(name in this.started)) {
  937. warn('Timer has not been started for ' + name);
  938. }
  939. this.times.push({
  940. 'name': name,
  941. 'start': this.started[name],
  942. 'end': Date.now()
  943. });
  944. delete this.started[name];
  945. },
  946. toString: function StatTimer_toString() {
  947. var i, ii;
  948. var times = this.times;
  949. var out = '';
  950. var longest = 0;
  951. for (i = 0, ii = times.length; i < ii; ++i) {
  952. var name = times[i]['name'];
  953. if (name.length > longest) {
  954. longest = name.length;
  955. }
  956. }
  957. for (i = 0, ii = times.length; i < ii; ++i) {
  958. var span = times[i];
  959. var duration = span.end - span.start;
  960. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  961. }
  962. return out;
  963. }
  964. };
  965. return StatTimer;
  966. }();
  967. var createBlob = function createBlob(data, contentType) {
  968. if (typeof Blob !== 'undefined') {
  969. return new Blob([data], { type: contentType });
  970. }
  971. throw new Error('The "Blob" constructor is not supported.');
  972. };
  973. var createObjectURL = function createObjectURLClosure() {
  974. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  975. return function createObjectURL(data, contentType) {
  976. var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  977. if (!forceDataSchema && URL.createObjectURL) {
  978. var blob = createBlob(data, contentType);
  979. return URL.createObjectURL(blob);
  980. }
  981. var buffer = 'data:' + contentType + ';base64,';
  982. for (var i = 0, ii = data.length; i < ii; i += 3) {
  983. var b1 = data[i] & 0xFF;
  984. var b2 = data[i + 1] & 0xFF;
  985. var b3 = data[i + 2] & 0xFF;
  986. var d1 = b1 >> 2,
  987. d2 = (b1 & 3) << 4 | b2 >> 4;
  988. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  989. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  990. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  991. }
  992. return buffer;
  993. };
  994. }();
  995. function MessageHandler(sourceName, targetName, comObj) {
  996. var _this = this;
  997. this.sourceName = sourceName;
  998. this.targetName = targetName;
  999. this.comObj = comObj;
  1000. this.callbackIndex = 1;
  1001. this.postMessageTransfers = true;
  1002. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1003. var ah = this.actionHandler = Object.create(null);
  1004. this._onComObjOnMessage = function (event) {
  1005. var data = event.data;
  1006. if (data.targetName !== _this.sourceName) {
  1007. return;
  1008. }
  1009. if (data.isReply) {
  1010. var callbackId = data.callbackId;
  1011. if (data.callbackId in callbacksCapabilities) {
  1012. var callback = callbacksCapabilities[callbackId];
  1013. delete callbacksCapabilities[callbackId];
  1014. if ('error' in data) {
  1015. callback.reject(data.error);
  1016. } else {
  1017. callback.resolve(data.data);
  1018. }
  1019. } else {
  1020. error('Cannot resolve callback ' + callbackId);
  1021. }
  1022. } else if (data.action in ah) {
  1023. var action = ah[data.action];
  1024. if (data.callbackId) {
  1025. var sourceName = _this.sourceName;
  1026. var targetName = data.sourceName;
  1027. Promise.resolve().then(function () {
  1028. return action[0].call(action[1], data.data);
  1029. }).then(function (result) {
  1030. comObj.postMessage({
  1031. sourceName: sourceName,
  1032. targetName: targetName,
  1033. isReply: true,
  1034. callbackId: data.callbackId,
  1035. data: result
  1036. });
  1037. }, function (reason) {
  1038. if (reason instanceof Error) {
  1039. reason = reason + '';
  1040. }
  1041. comObj.postMessage({
  1042. sourceName: sourceName,
  1043. targetName: targetName,
  1044. isReply: true,
  1045. callbackId: data.callbackId,
  1046. error: reason
  1047. });
  1048. });
  1049. } else {
  1050. action[0].call(action[1], data.data);
  1051. }
  1052. } else {
  1053. error('Unknown action from worker: ' + data.action);
  1054. }
  1055. };
  1056. comObj.addEventListener('message', this._onComObjOnMessage);
  1057. }
  1058. MessageHandler.prototype = {
  1059. on: function on(actionName, handler, scope) {
  1060. var ah = this.actionHandler;
  1061. if (ah[actionName]) {
  1062. error('There is already an actionName called "' + actionName + '"');
  1063. }
  1064. ah[actionName] = [handler, scope];
  1065. },
  1066. send: function send(actionName, data, transfers) {
  1067. var message = {
  1068. sourceName: this.sourceName,
  1069. targetName: this.targetName,
  1070. action: actionName,
  1071. data: data
  1072. };
  1073. this.postMessage(message, transfers);
  1074. },
  1075. sendWithPromise: function sendWithPromise(actionName, data, transfers) {
  1076. var callbackId = this.callbackIndex++;
  1077. var message = {
  1078. sourceName: this.sourceName,
  1079. targetName: this.targetName,
  1080. action: actionName,
  1081. data: data,
  1082. callbackId: callbackId
  1083. };
  1084. var capability = createPromiseCapability();
  1085. this.callbacksCapabilities[callbackId] = capability;
  1086. try {
  1087. this.postMessage(message, transfers);
  1088. } catch (e) {
  1089. capability.reject(e);
  1090. }
  1091. return capability.promise;
  1092. },
  1093. postMessage: function postMessage(message, transfers) {
  1094. if (transfers && this.postMessageTransfers) {
  1095. this.comObj.postMessage(message, transfers);
  1096. } else {
  1097. this.comObj.postMessage(message);
  1098. }
  1099. },
  1100. destroy: function destroy() {
  1101. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1102. }
  1103. };
  1104. function loadJpegStream(id, imageUrl, objs) {
  1105. var img = new Image();
  1106. img.onload = function loadJpegStream_onloadClosure() {
  1107. objs.resolve(id, img);
  1108. };
  1109. img.onerror = function loadJpegStream_onerrorClosure() {
  1110. objs.resolve(id, null);
  1111. warn('Error during JPEG image loading');
  1112. };
  1113. img.src = imageUrl;
  1114. }
  1115. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1116. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1117. exports.OPS = OPS;
  1118. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  1119. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1120. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1121. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1122. exports.AnnotationFlag = AnnotationFlag;
  1123. exports.AnnotationType = AnnotationType;
  1124. exports.FontType = FontType;
  1125. exports.ImageKind = ImageKind;
  1126. exports.CMapCompressionType = CMapCompressionType;
  1127. exports.InvalidPDFException = InvalidPDFException;
  1128. exports.MessageHandler = MessageHandler;
  1129. exports.MissingDataException = MissingDataException;
  1130. exports.MissingPDFException = MissingPDFException;
  1131. exports.NativeImageDecoding = NativeImageDecoding;
  1132. exports.NotImplementedException = NotImplementedException;
  1133. exports.PageViewport = PageViewport;
  1134. exports.PasswordException = PasswordException;
  1135. exports.PasswordResponses = PasswordResponses;
  1136. exports.StatTimer = StatTimer;
  1137. exports.StreamType = StreamType;
  1138. exports.TextRenderingMode = TextRenderingMode;
  1139. exports.UnexpectedResponseException = UnexpectedResponseException;
  1140. exports.UnknownErrorException = UnknownErrorException;
  1141. exports.Util = Util;
  1142. exports.XRefParseException = XRefParseException;
  1143. exports.arrayByteLength = arrayByteLength;
  1144. exports.arraysToBytes = arraysToBytes;
  1145. exports.assert = assert;
  1146. exports.bytesToString = bytesToString;
  1147. exports.createBlob = createBlob;
  1148. exports.createPromiseCapability = createPromiseCapability;
  1149. exports.createObjectURL = createObjectURL;
  1150. exports.deprecated = deprecated;
  1151. exports.error = error;
  1152. exports.getLookupTableFactory = getLookupTableFactory;
  1153. exports.getVerbosityLevel = getVerbosityLevel;
  1154. exports.globalScope = globalScope;
  1155. exports.info = info;
  1156. exports.isArray = isArray;
  1157. exports.isArrayBuffer = isArrayBuffer;
  1158. exports.isBool = isBool;
  1159. exports.isEmptyObj = isEmptyObj;
  1160. exports.isInt = isInt;
  1161. exports.isNum = isNum;
  1162. exports.isString = isString;
  1163. exports.isSpace = isSpace;
  1164. exports.isNodeJS = isNodeJS;
  1165. exports.isSameOrigin = isSameOrigin;
  1166. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1167. exports.isLittleEndian = isLittleEndian;
  1168. exports.isEvalSupported = isEvalSupported;
  1169. exports.loadJpegStream = loadJpegStream;
  1170. exports.log2 = log2;
  1171. exports.readInt8 = readInt8;
  1172. exports.readUint16 = readUint16;
  1173. exports.readUint32 = readUint32;
  1174. exports.removeNullCharacters = removeNullCharacters;
  1175. exports.setVerbosityLevel = setVerbosityLevel;
  1176. exports.shadow = shadow;
  1177. exports.string32 = string32;
  1178. exports.stringToBytes = stringToBytes;
  1179. exports.stringToPDFString = stringToPDFString;
  1180. exports.stringToUTF8String = stringToUTF8String;
  1181. exports.utf8StringToString = utf8StringToString;
  1182. exports.warn = warn;
  1183. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  1184. /***/ }),
  1185. /* 1 */
  1186. /***/ (function(module, exports, __w_pdfjs_require__) {
  1187. "use strict";
  1188. Object.defineProperty(exports, "__esModule", {
  1189. value: true
  1190. });
  1191. exports.isStream = exports.isRefsEqual = exports.isRef = exports.isName = exports.isDict = exports.isCmd = exports.isEOF = exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = undefined;
  1192. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1193. var _util = __w_pdfjs_require__(0);
  1194. var EOF = {};
  1195. var Name = function NameClosure() {
  1196. function Name(name) {
  1197. this.name = name;
  1198. }
  1199. Name.prototype = {};
  1200. var nameCache = Object.create(null);
  1201. Name.get = function Name_get(name) {
  1202. var nameValue = nameCache[name];
  1203. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1204. };
  1205. return Name;
  1206. }();
  1207. var Cmd = function CmdClosure() {
  1208. function Cmd(cmd) {
  1209. this.cmd = cmd;
  1210. }
  1211. Cmd.prototype = {};
  1212. var cmdCache = Object.create(null);
  1213. Cmd.get = function Cmd_get(cmd) {
  1214. var cmdValue = cmdCache[cmd];
  1215. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1216. };
  1217. return Cmd;
  1218. }();
  1219. var Dict = function DictClosure() {
  1220. var nonSerializable = function nonSerializableClosure() {
  1221. return nonSerializable;
  1222. };
  1223. function Dict(xref) {
  1224. this.map = Object.create(null);
  1225. this.xref = xref;
  1226. this.objId = null;
  1227. this.suppressEncryption = false;
  1228. this.__nonSerializable__ = nonSerializable;
  1229. }
  1230. Dict.prototype = {
  1231. assignXref: function Dict_assignXref(newXref) {
  1232. this.xref = newXref;
  1233. },
  1234. get: function Dict_get(key1, key2, key3) {
  1235. var value;
  1236. var xref = this.xref,
  1237. suppressEncryption = this.suppressEncryption;
  1238. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1239. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1240. }
  1241. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1242. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1243. }
  1244. value = this.map[key3] || null;
  1245. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1246. },
  1247. getAsync: function Dict_getAsync(key1, key2, key3) {
  1248. var value;
  1249. var xref = this.xref,
  1250. suppressEncryption = this.suppressEncryption;
  1251. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1252. if (xref) {
  1253. return xref.fetchIfRefAsync(value, suppressEncryption);
  1254. }
  1255. return Promise.resolve(value);
  1256. }
  1257. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1258. if (xref) {
  1259. return xref.fetchIfRefAsync(value, suppressEncryption);
  1260. }
  1261. return Promise.resolve(value);
  1262. }
  1263. value = this.map[key3] || null;
  1264. if (xref) {
  1265. return xref.fetchIfRefAsync(value, suppressEncryption);
  1266. }
  1267. return Promise.resolve(value);
  1268. },
  1269. getArray: function Dict_getArray(key1, key2, key3) {
  1270. var value = this.get(key1, key2, key3);
  1271. var xref = this.xref,
  1272. suppressEncryption = this.suppressEncryption;
  1273. if (!(0, _util.isArray)(value) || !xref) {
  1274. return value;
  1275. }
  1276. value = value.slice();
  1277. for (var i = 0, ii = value.length; i < ii; i++) {
  1278. if (!isRef(value[i])) {
  1279. continue;
  1280. }
  1281. value[i] = xref.fetch(value[i], suppressEncryption);
  1282. }
  1283. return value;
  1284. },
  1285. getRaw: function Dict_getRaw(key) {
  1286. return this.map[key];
  1287. },
  1288. getKeys: function Dict_getKeys() {
  1289. return Object.keys(this.map);
  1290. },
  1291. set: function Dict_set(key, value) {
  1292. this.map[key] = value;
  1293. },
  1294. has: function Dict_has(key) {
  1295. return key in this.map;
  1296. },
  1297. forEach: function Dict_forEach(callback) {
  1298. for (var key in this.map) {
  1299. callback(key, this.get(key));
  1300. }
  1301. }
  1302. };
  1303. Dict.empty = new Dict(null);
  1304. Dict.merge = function Dict_merge(xref, dictArray) {
  1305. var mergedDict = new Dict(xref);
  1306. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  1307. var dict = dictArray[i];
  1308. if (!isDict(dict)) {
  1309. continue;
  1310. }
  1311. for (var keyName in dict.map) {
  1312. if (mergedDict.map[keyName]) {
  1313. continue;
  1314. }
  1315. mergedDict.map[keyName] = dict.map[keyName];
  1316. }
  1317. }
  1318. return mergedDict;
  1319. };
  1320. return Dict;
  1321. }();
  1322. var Ref = function RefClosure() {
  1323. function Ref(num, gen) {
  1324. this.num = num;
  1325. this.gen = gen;
  1326. }
  1327. Ref.prototype = {
  1328. toString: function Ref_toString() {
  1329. var str = this.num + 'R';
  1330. if (this.gen !== 0) {
  1331. str += this.gen;
  1332. }
  1333. return str;
  1334. }
  1335. };
  1336. return Ref;
  1337. }();
  1338. var RefSet = function RefSetClosure() {
  1339. function RefSet() {
  1340. this.dict = Object.create(null);
  1341. }
  1342. RefSet.prototype = {
  1343. has: function RefSet_has(ref) {
  1344. return ref.toString() in this.dict;
  1345. },
  1346. put: function RefSet_put(ref) {
  1347. this.dict[ref.toString()] = true;
  1348. },
  1349. remove: function RefSet_remove(ref) {
  1350. delete this.dict[ref.toString()];
  1351. }
  1352. };
  1353. return RefSet;
  1354. }();
  1355. var RefSetCache = function RefSetCacheClosure() {
  1356. function RefSetCache() {
  1357. this.dict = Object.create(null);
  1358. }
  1359. RefSetCache.prototype = {
  1360. get: function RefSetCache_get(ref) {
  1361. return this.dict[ref.toString()];
  1362. },
  1363. has: function RefSetCache_has(ref) {
  1364. return ref.toString() in this.dict;
  1365. },
  1366. put: function RefSetCache_put(ref, obj) {
  1367. this.dict[ref.toString()] = obj;
  1368. },
  1369. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1370. this.dict[ref.toString()] = this.get(aliasRef);
  1371. },
  1372. forEach: function RefSetCache_forEach(fn, thisArg) {
  1373. for (var i in this.dict) {
  1374. fn.call(thisArg, this.dict[i]);
  1375. }
  1376. },
  1377. clear: function RefSetCache_clear() {
  1378. this.dict = Object.create(null);
  1379. }
  1380. };
  1381. return RefSetCache;
  1382. }();
  1383. function isEOF(v) {
  1384. return v === EOF;
  1385. }
  1386. function isName(v, name) {
  1387. return v instanceof Name && (name === undefined || v.name === name);
  1388. }
  1389. function isCmd(v, cmd) {
  1390. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1391. }
  1392. function isDict(v, type) {
  1393. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  1394. }
  1395. function isRef(v) {
  1396. return v instanceof Ref;
  1397. }
  1398. function isRefsEqual(v1, v2) {
  1399. return v1.num === v2.num && v1.gen === v2.gen;
  1400. }
  1401. function isStream(v) {
  1402. return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.getBytes !== undefined;
  1403. }
  1404. exports.EOF = EOF;
  1405. exports.Cmd = Cmd;
  1406. exports.Dict = Dict;
  1407. exports.Name = Name;
  1408. exports.Ref = Ref;
  1409. exports.RefSet = RefSet;
  1410. exports.RefSetCache = RefSetCache;
  1411. exports.isEOF = isEOF;
  1412. exports.isCmd = isCmd;
  1413. exports.isDict = isDict;
  1414. exports.isName = isName;
  1415. exports.isRef = isRef;
  1416. exports.isRefsEqual = isRefsEqual;
  1417. exports.isStream = isStream;
  1418. /***/ }),
  1419. /* 2 */
  1420. /***/ (function(module, exports, __w_pdfjs_require__) {
  1421. "use strict";
  1422. Object.defineProperty(exports, "__esModule", {
  1423. value: true
  1424. });
  1425. exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.JpxStream = exports.JpegStream = exports.Jbig2Stream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.CCITTFaxStream = exports.AsciiHexStream = exports.Ascii85Stream = undefined;
  1426. var _util = __w_pdfjs_require__(0);
  1427. var _primitives = __w_pdfjs_require__(1);
  1428. var _jbig = __w_pdfjs_require__(28);
  1429. var _jpg = __w_pdfjs_require__(29);
  1430. var _jpx = __w_pdfjs_require__(15);
  1431. var Stream = function StreamClosure() {
  1432. function Stream(arrayBuffer, start, length, dict) {
  1433. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1434. this.start = start || 0;
  1435. this.pos = this.start;
  1436. this.end = start + length || this.bytes.length;
  1437. this.dict = dict;
  1438. }
  1439. Stream.prototype = {
  1440. get length() {
  1441. return this.end - this.start;
  1442. },
  1443. get isEmpty() {
  1444. return this.length === 0;
  1445. },
  1446. getByte: function Stream_getByte() {
  1447. if (this.pos >= this.end) {
  1448. return -1;
  1449. }
  1450. return this.bytes[this.pos++];
  1451. },
  1452. getUint16: function Stream_getUint16() {
  1453. var b0 = this.getByte();
  1454. var b1 = this.getByte();
  1455. if (b0 === -1 || b1 === -1) {
  1456. return -1;
  1457. }
  1458. return (b0 << 8) + b1;
  1459. },
  1460. getInt32: function Stream_getInt32() {
  1461. var b0 = this.getByte();
  1462. var b1 = this.getByte();
  1463. var b2 = this.getByte();
  1464. var b3 = this.getByte();
  1465. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1466. },
  1467. getBytes: function Stream_getBytes(length) {
  1468. var bytes = this.bytes;
  1469. var pos = this.pos;
  1470. var strEnd = this.end;
  1471. if (!length) {
  1472. return bytes.subarray(pos, strEnd);
  1473. }
  1474. var end = pos + length;
  1475. if (end > strEnd) {
  1476. end = strEnd;
  1477. }
  1478. this.pos = end;
  1479. return bytes.subarray(pos, end);
  1480. },
  1481. peekByte: function Stream_peekByte() {
  1482. var peekedByte = this.getByte();
  1483. this.pos--;
  1484. return peekedByte;
  1485. },
  1486. peekBytes: function Stream_peekBytes(length) {
  1487. var bytes = this.getBytes(length);
  1488. this.pos -= bytes.length;
  1489. return bytes;
  1490. },
  1491. skip: function Stream_skip(n) {
  1492. if (!n) {
  1493. n = 1;
  1494. }
  1495. this.pos += n;
  1496. },
  1497. reset: function Stream_reset() {
  1498. this.pos = this.start;
  1499. },
  1500. moveStart: function Stream_moveStart() {
  1501. this.start = this.pos;
  1502. },
  1503. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  1504. return new Stream(this.bytes.buffer, start, length, dict);
  1505. }
  1506. };
  1507. return Stream;
  1508. }();
  1509. var StringStream = function StringStreamClosure() {
  1510. function StringStream(str) {
  1511. var length = str.length;
  1512. var bytes = new Uint8Array(length);
  1513. for (var n = 0; n < length; ++n) {
  1514. bytes[n] = str.charCodeAt(n);
  1515. }
  1516. Stream.call(this, bytes);
  1517. }
  1518. StringStream.prototype = Stream.prototype;
  1519. return StringStream;
  1520. }();
  1521. var DecodeStream = function DecodeStreamClosure() {
  1522. var emptyBuffer = new Uint8Array(0);
  1523. function DecodeStream(maybeMinBufferLength) {
  1524. this.pos = 0;
  1525. this.bufferLength = 0;
  1526. this.eof = false;
  1527. this.buffer = emptyBuffer;
  1528. this.minBufferLength = 512;
  1529. if (maybeMinBufferLength) {
  1530. while (this.minBufferLength < maybeMinBufferLength) {
  1531. this.minBufferLength *= 2;
  1532. }
  1533. }
  1534. }
  1535. DecodeStream.prototype = {
  1536. get isEmpty() {
  1537. while (!this.eof && this.bufferLength === 0) {
  1538. this.readBlock();
  1539. }
  1540. return this.bufferLength === 0;
  1541. },
  1542. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  1543. var buffer = this.buffer;
  1544. if (requested <= buffer.byteLength) {
  1545. return buffer;
  1546. }
  1547. var size = this.minBufferLength;
  1548. while (size < requested) {
  1549. size *= 2;
  1550. }
  1551. var buffer2 = new Uint8Array(size);
  1552. buffer2.set(buffer);
  1553. return this.buffer = buffer2;
  1554. },
  1555. getByte: function DecodeStream_getByte() {
  1556. var pos = this.pos;
  1557. while (this.bufferLength <= pos) {
  1558. if (this.eof) {
  1559. return -1;
  1560. }
  1561. this.readBlock();
  1562. }
  1563. return this.buffer[this.pos++];
  1564. },
  1565. getUint16: function DecodeStream_getUint16() {
  1566. var b0 = this.getByte();
  1567. var b1 = this.getByte();
  1568. if (b0 === -1 || b1 === -1) {
  1569. return -1;
  1570. }
  1571. return (b0 << 8) + b1;
  1572. },
  1573. getInt32: function DecodeStream_getInt32() {
  1574. var b0 = this.getByte();
  1575. var b1 = this.getByte();
  1576. var b2 = this.getByte();
  1577. var b3 = this.getByte();
  1578. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1579. },
  1580. getBytes: function DecodeStream_getBytes(length) {
  1581. var end,
  1582. pos = this.pos;
  1583. if (length) {
  1584. this.ensureBuffer(pos + length);
  1585. end = pos + length;
  1586. while (!this.eof && this.bufferLength < end) {
  1587. this.readBlock();
  1588. }
  1589. var bufEnd = this.bufferLength;
  1590. if (end > bufEnd) {
  1591. end = bufEnd;
  1592. }
  1593. } else {
  1594. while (!this.eof) {
  1595. this.readBlock();
  1596. }
  1597. end = this.bufferLength;
  1598. }
  1599. this.pos = end;
  1600. return this.buffer.subarray(pos, end);
  1601. },
  1602. peekByte: function DecodeStream_peekByte() {
  1603. var peekedByte = this.getByte();
  1604. this.pos--;
  1605. return peekedByte;
  1606. },
  1607. peekBytes: function DecodeStream_peekBytes(length) {
  1608. var bytes = this.getBytes(length);
  1609. this.pos -= bytes.length;
  1610. return bytes;
  1611. },
  1612. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  1613. var end = start + length;
  1614. while (this.bufferLength <= end && !this.eof) {
  1615. this.readBlock();
  1616. }
  1617. return new Stream(this.buffer, start, length, dict);
  1618. },
  1619. skip: function DecodeStream_skip(n) {
  1620. if (!n) {
  1621. n = 1;
  1622. }
  1623. this.pos += n;
  1624. },
  1625. reset: function DecodeStream_reset() {
  1626. this.pos = 0;
  1627. },
  1628. getBaseStreams: function DecodeStream_getBaseStreams() {
  1629. if (this.str && this.str.getBaseStreams) {
  1630. return this.str.getBaseStreams();
  1631. }
  1632. return [];
  1633. }
  1634. };
  1635. return DecodeStream;
  1636. }();
  1637. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  1638. function StreamsSequenceStream(streams) {
  1639. this.streams = streams;
  1640. DecodeStream.call(this, null);
  1641. }
  1642. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  1643. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  1644. var streams = this.streams;
  1645. if (streams.length === 0) {
  1646. this.eof = true;
  1647. return;
  1648. }
  1649. var stream = streams.shift();
  1650. var chunk = stream.getBytes();
  1651. var bufferLength = this.bufferLength;
  1652. var newLength = bufferLength + chunk.length;
  1653. var buffer = this.ensureBuffer(newLength);
  1654. buffer.set(chunk, bufferLength);
  1655. this.bufferLength = newLength;
  1656. };
  1657. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  1658. var baseStreams = [];
  1659. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  1660. var stream = this.streams[i];
  1661. if (stream.getBaseStreams) {
  1662. _util.Util.appendToArray(baseStreams, stream.getBaseStreams());
  1663. }
  1664. }
  1665. return baseStreams;
  1666. };
  1667. return StreamsSequenceStream;
  1668. }();
  1669. var FlateStream = function FlateStreamClosure() {
  1670. var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  1671. 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]);
  1672. 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]);
  1673. 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];
  1674. 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];
  1675. function FlateStream(str, maybeLength) {
  1676. this.str = str;
  1677. this.dict = str.dict;
  1678. var cmf = str.getByte();
  1679. var flg = str.getByte();
  1680. if (cmf === -1 || flg === -1) {
  1681. (0, _util.error)('Invalid header in flate stream: ' + cmf + ', ' + flg);
  1682. }
  1683. if ((cmf & 0x0f) !== 0x08) {
  1684. (0, _util.error)('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  1685. }
  1686. if (((cmf << 8) + flg) % 31 !== 0) {
  1687. (0, _util.error)('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  1688. }
  1689. if (flg & 0x20) {
  1690. (0, _util.error)('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  1691. }
  1692. this.codeSize = 0;
  1693. this.codeBuf = 0;
  1694. DecodeStream.call(this, maybeLength);
  1695. }
  1696. FlateStream.prototype = Object.create(DecodeStream.prototype);
  1697. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  1698. var str = this.str;
  1699. var codeSize = this.codeSize;
  1700. var codeBuf = this.codeBuf;
  1701. var b;
  1702. while (codeSize < bits) {
  1703. if ((b = str.getByte()) === -1) {
  1704. (0, _util.error)('Bad encoding in flate stream');
  1705. }
  1706. codeBuf |= b << codeSize;
  1707. codeSize += 8;
  1708. }
  1709. b = codeBuf & (1 << bits) - 1;
  1710. this.codeBuf = codeBuf >> bits;
  1711. this.codeSize = codeSize -= bits;
  1712. return b;
  1713. };
  1714. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  1715. var str = this.str;
  1716. var codes = table[0];
  1717. var maxLen = table[1];
  1718. var codeSize = this.codeSize;
  1719. var codeBuf = this.codeBuf;
  1720. var b;
  1721. while (codeSize < maxLen) {
  1722. if ((b = str.getByte()) === -1) {
  1723. break;
  1724. }
  1725. codeBuf |= b << codeSize;
  1726. codeSize += 8;
  1727. }
  1728. var code = codes[codeBuf & (1 << maxLen) - 1];
  1729. var codeLen = code >> 16;
  1730. var codeVal = code & 0xffff;
  1731. if (codeLen < 1 || codeSize < codeLen) {
  1732. (0, _util.error)('Bad encoding in flate stream');
  1733. }
  1734. this.codeBuf = codeBuf >> codeLen;
  1735. this.codeSize = codeSize - codeLen;
  1736. return codeVal;
  1737. };
  1738. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  1739. var n = lengths.length;
  1740. var maxLen = 0;
  1741. var i;
  1742. for (i = 0; i < n; ++i) {
  1743. if (lengths[i] > maxLen) {
  1744. maxLen = lengths[i];
  1745. }
  1746. }
  1747. var size = 1 << maxLen;
  1748. var codes = new Int32Array(size);
  1749. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  1750. for (var val = 0; val < n; ++val) {
  1751. if (lengths[val] === len) {
  1752. var code2 = 0;
  1753. var t = code;
  1754. for (i = 0; i < len; ++i) {
  1755. code2 = code2 << 1 | t & 1;
  1756. t >>= 1;
  1757. }
  1758. for (i = code2; i < size; i += skip) {
  1759. codes[i] = len << 16 | val;
  1760. }
  1761. ++code;
  1762. }
  1763. }
  1764. }
  1765. return [codes, maxLen];
  1766. };
  1767. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  1768. var buffer, len;
  1769. var str = this.str;
  1770. var hdr = this.getBits(3);
  1771. if (hdr & 1) {
  1772. this.eof = true;
  1773. }
  1774. hdr >>= 1;
  1775. if (hdr === 0) {
  1776. var b;
  1777. if ((b = str.getByte()) === -1) {
  1778. (0, _util.error)('Bad block header in flate stream');
  1779. }
  1780. var blockLen = b;
  1781. if ((b = str.getByte()) === -1) {
  1782. (0, _util.error)('Bad block header in flate stream');
  1783. }
  1784. blockLen |= b << 8;
  1785. if ((b = str.getByte()) === -1) {
  1786. (0, _util.error)('Bad block header in flate stream');
  1787. }
  1788. var check = b;
  1789. if ((b = str.getByte()) === -1) {
  1790. (0, _util.error)('Bad block header in flate stream');
  1791. }
  1792. check |= b << 8;
  1793. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  1794. (0, _util.error)('Bad uncompressed block length in flate stream');
  1795. }
  1796. this.codeBuf = 0;
  1797. this.codeSize = 0;
  1798. var bufferLength = this.bufferLength;
  1799. buffer = this.ensureBuffer(bufferLength + blockLen);
  1800. var end = bufferLength + blockLen;
  1801. this.bufferLength = end;
  1802. if (blockLen === 0) {
  1803. if (str.peekByte() === -1) {
  1804. this.eof = true;
  1805. }
  1806. } else {
  1807. for (var n = bufferLength; n < end; ++n) {
  1808. if ((b = str.getByte()) === -1) {
  1809. this.eof = true;
  1810. break;
  1811. }
  1812. buffer[n] = b;
  1813. }
  1814. }
  1815. return;
  1816. }
  1817. var litCodeTable;
  1818. var distCodeTable;
  1819. if (hdr === 1) {
  1820. litCodeTable = fixedLitCodeTab;
  1821. distCodeTable = fixedDistCodeTab;
  1822. } else if (hdr === 2) {
  1823. var numLitCodes = this.getBits(5) + 257;
  1824. var numDistCodes = this.getBits(5) + 1;
  1825. var numCodeLenCodes = this.getBits(4) + 4;
  1826. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  1827. var i;
  1828. for (i = 0; i < numCodeLenCodes; ++i) {
  1829. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  1830. }
  1831. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  1832. len = 0;
  1833. i = 0;
  1834. var codes = numLitCodes + numDistCodes;
  1835. var codeLengths = new Uint8Array(codes);
  1836. var bitsLength, bitsOffset, what;
  1837. while (i < codes) {
  1838. var code = this.getCode(codeLenCodeTab);
  1839. if (code === 16) {
  1840. bitsLength = 2;
  1841. bitsOffset = 3;
  1842. what = len;
  1843. } else if (code === 17) {
  1844. bitsLength = 3;
  1845. bitsOffset = 3;
  1846. what = len = 0;
  1847. } else if (code === 18) {
  1848. bitsLength = 7;
  1849. bitsOffset = 11;
  1850. what = len = 0;
  1851. } else {
  1852. codeLengths[i++] = len = code;
  1853. continue;
  1854. }
  1855. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  1856. while (repeatLength-- > 0) {
  1857. codeLengths[i++] = what;
  1858. }
  1859. }
  1860. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  1861. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  1862. } else {
  1863. (0, _util.error)('Unknown block type in flate stream');
  1864. }
  1865. buffer = this.buffer;
  1866. var limit = buffer ? buffer.length : 0;
  1867. var pos = this.bufferLength;
  1868. while (true) {
  1869. var code1 = this.getCode(litCodeTable);
  1870. if (code1 < 256) {
  1871. if (pos + 1 >= limit) {
  1872. buffer = this.ensureBuffer(pos + 1);
  1873. limit = buffer.length;
  1874. }
  1875. buffer[pos++] = code1;
  1876. continue;
  1877. }
  1878. if (code1 === 256) {
  1879. this.bufferLength = pos;
  1880. return;
  1881. }
  1882. code1 -= 257;
  1883. code1 = lengthDecode[code1];
  1884. var code2 = code1 >> 16;
  1885. if (code2 > 0) {
  1886. code2 = this.getBits(code2);
  1887. }
  1888. len = (code1 & 0xffff) + code2;
  1889. code1 = this.getCode(distCodeTable);
  1890. code1 = distDecode[code1];
  1891. code2 = code1 >> 16;
  1892. if (code2 > 0) {
  1893. code2 = this.getBits(code2);
  1894. }
  1895. var dist = (code1 & 0xffff) + code2;
  1896. if (pos + len >= limit) {
  1897. buffer = this.ensureBuffer(pos + len);
  1898. limit = buffer.length;
  1899. }
  1900. for (var k = 0; k < len; ++k, ++pos) {
  1901. buffer[pos] = buffer[pos - dist];
  1902. }
  1903. }
  1904. };
  1905. return FlateStream;
  1906. }();
  1907. var PredictorStream = function PredictorStreamClosure() {
  1908. function PredictorStream(str, maybeLength, params) {
  1909. if (!(0, _primitives.isDict)(params)) {
  1910. return str;
  1911. }
  1912. var predictor = this.predictor = params.get('Predictor') || 1;
  1913. if (predictor <= 1) {
  1914. return str;
  1915. }
  1916. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  1917. (0, _util.error)('Unsupported predictor: ' + predictor);
  1918. }
  1919. if (predictor === 2) {
  1920. this.readBlock = this.readBlockTiff;
  1921. } else {
  1922. this.readBlock = this.readBlockPng;
  1923. }
  1924. this.str = str;
  1925. this.dict = str.dict;
  1926. var colors = this.colors = params.get('Colors') || 1;
  1927. var bits = this.bits = params.get('BitsPerComponent') || 8;
  1928. var columns = this.columns = params.get('Columns') || 1;
  1929. this.pixBytes = colors * bits + 7 >> 3;
  1930. this.rowBytes = columns * colors * bits + 7 >> 3;
  1931. DecodeStream.call(this, maybeLength);
  1932. return this;
  1933. }
  1934. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  1935. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  1936. var rowBytes = this.rowBytes;
  1937. var bufferLength = this.bufferLength;
  1938. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  1939. var bits = this.bits;
  1940. var colors = this.colors;
  1941. var rawBytes = this.str.getBytes(rowBytes);
  1942. this.eof = !rawBytes.length;
  1943. if (this.eof) {
  1944. return;
  1945. }
  1946. var inbuf = 0,
  1947. outbuf = 0;
  1948. var inbits = 0,
  1949. outbits = 0;
  1950. var pos = bufferLength;
  1951. var i;
  1952. if (bits === 1 && colors === 1) {
  1953. for (i = 0; i < rowBytes; ++i) {
  1954. var c = rawBytes[i] ^ inbuf;
  1955. c ^= c >> 1;
  1956. c ^= c >> 2;
  1957. c ^= c >> 4;
  1958. inbuf = (c & 1) << 7;
  1959. buffer[pos++] = c;
  1960. }
  1961. } else if (bits === 8) {
  1962. for (i = 0; i < colors; ++i) {
  1963. buffer[pos++] = rawBytes[i];
  1964. }
  1965. for (; i < rowBytes; ++i) {
  1966. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  1967. pos++;
  1968. }
  1969. } else {
  1970. var compArray = new Uint8Array(colors + 1);
  1971. var bitMask = (1 << bits) - 1;
  1972. var j = 0,
  1973. k = bufferLength;
  1974. var columns = this.columns;
  1975. for (i = 0; i < columns; ++i) {
  1976. for (var kk = 0; kk < colors; ++kk) {
  1977. if (inbits < bits) {
  1978. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  1979. inbits += 8;
  1980. }
  1981. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  1982. inbits -= bits;
  1983. outbuf = outbuf << bits | compArray[kk];
  1984. outbits += bits;
  1985. if (outbits >= 8) {
  1986. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  1987. outbits -= 8;
  1988. }
  1989. }
  1990. }
  1991. if (outbits > 0) {
  1992. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  1993. }
  1994. }
  1995. this.bufferLength += rowBytes;
  1996. };
  1997. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  1998. var rowBytes = this.rowBytes;
  1999. var pixBytes = this.pixBytes;
  2000. var predictor = this.str.getByte();
  2001. var rawBytes = this.str.getBytes(rowBytes);
  2002. this.eof = !rawBytes.length;
  2003. if (this.eof) {
  2004. return;
  2005. }
  2006. var bufferLength = this.bufferLength;
  2007. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2008. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  2009. if (prevRow.length === 0) {
  2010. prevRow = new Uint8Array(rowBytes);
  2011. }
  2012. var i,
  2013. j = bufferLength,
  2014. up,
  2015. c;
  2016. switch (predictor) {
  2017. case 0:
  2018. for (i = 0; i < rowBytes; ++i) {
  2019. buffer[j++] = rawBytes[i];
  2020. }
  2021. break;
  2022. case 1:
  2023. for (i = 0; i < pixBytes; ++i) {
  2024. buffer[j++] = rawBytes[i];
  2025. }
  2026. for (; i < rowBytes; ++i) {
  2027. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  2028. j++;
  2029. }
  2030. break;
  2031. case 2:
  2032. for (i = 0; i < rowBytes; ++i) {
  2033. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  2034. }
  2035. break;
  2036. case 3:
  2037. for (i = 0; i < pixBytes; ++i) {
  2038. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  2039. }
  2040. for (; i < rowBytes; ++i) {
  2041. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  2042. j++;
  2043. }
  2044. break;
  2045. case 4:
  2046. for (i = 0; i < pixBytes; ++i) {
  2047. up = prevRow[i];
  2048. c = rawBytes[i];
  2049. buffer[j++] = up + c;
  2050. }
  2051. for (; i < rowBytes; ++i) {
  2052. up = prevRow[i];
  2053. var upLeft = prevRow[i - pixBytes];
  2054. var left = buffer[j - pixBytes];
  2055. var p = left + up - upLeft;
  2056. var pa = p - left;
  2057. if (pa < 0) {
  2058. pa = -pa;
  2059. }
  2060. var pb = p - up;
  2061. if (pb < 0) {
  2062. pb = -pb;
  2063. }
  2064. var pc = p - upLeft;
  2065. if (pc < 0) {
  2066. pc = -pc;
  2067. }
  2068. c = rawBytes[i];
  2069. if (pa <= pb && pa <= pc) {
  2070. buffer[j++] = left + c;
  2071. } else if (pb <= pc) {
  2072. buffer[j++] = up + c;
  2073. } else {
  2074. buffer[j++] = upLeft + c;
  2075. }
  2076. }
  2077. break;
  2078. default:
  2079. (0, _util.error)('Unsupported predictor: ' + predictor);
  2080. }
  2081. this.bufferLength += rowBytes;
  2082. };
  2083. return PredictorStream;
  2084. }();
  2085. var JpegStream = function JpegStreamClosure() {
  2086. function JpegStream(stream, maybeLength, dict, params) {
  2087. var ch;
  2088. while ((ch = stream.getByte()) !== -1) {
  2089. if (ch === 0xFF) {
  2090. stream.skip(-1);
  2091. break;
  2092. }
  2093. }
  2094. this.stream = stream;
  2095. this.maybeLength = maybeLength;
  2096. this.dict = dict;
  2097. this.params = params;
  2098. DecodeStream.call(this, maybeLength);
  2099. }
  2100. JpegStream.prototype = Object.create(DecodeStream.prototype);
  2101. Object.defineProperty(JpegStream.prototype, 'bytes', {
  2102. get: function JpegStream_bytes() {
  2103. return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
  2104. },
  2105. configurable: true
  2106. });
  2107. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  2108. if (this.bufferLength) {
  2109. return;
  2110. }
  2111. var jpegImage = new _jpg.JpegImage();
  2112. var decodeArr = this.dict.getArray('Decode', 'D');
  2113. if (this.forceRGB && (0, _util.isArray)(decodeArr)) {
  2114. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  2115. var decodeArrLength = decodeArr.length;
  2116. var transform = new Int32Array(decodeArrLength);
  2117. var transformNeeded = false;
  2118. var maxValue = (1 << bitsPerComponent) - 1;
  2119. for (var i = 0; i < decodeArrLength; i += 2) {
  2120. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  2121. transform[i + 1] = decodeArr[i] * maxValue | 0;
  2122. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  2123. transformNeeded = true;
  2124. }
  2125. }
  2126. if (transformNeeded) {
  2127. jpegImage.decodeTransform = transform;
  2128. }
  2129. }
  2130. if ((0, _primitives.isDict)(this.params)) {
  2131. var colorTransform = this.params.get('ColorTransform');
  2132. if ((0, _util.isInt)(colorTransform)) {
  2133. jpegImage.colorTransform = colorTransform;
  2134. }
  2135. }
  2136. jpegImage.parse(this.bytes);
  2137. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  2138. this.buffer = data;
  2139. this.bufferLength = data.length;
  2140. this.eof = true;
  2141. };
  2142. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  2143. this.ensureBuffer();
  2144. return this.buffer;
  2145. };
  2146. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  2147. return (0, _util.createObjectURL)(this.bytes, 'image/jpeg', forceDataSchema);
  2148. };
  2149. return JpegStream;
  2150. }();
  2151. var JpxStream = function JpxStreamClosure() {
  2152. function JpxStream(stream, maybeLength, dict, params) {
  2153. this.stream = stream;
  2154. this.maybeLength = maybeLength;
  2155. this.dict = dict;
  2156. this.params = params;
  2157. DecodeStream.call(this, maybeLength);
  2158. }
  2159. JpxStream.prototype = Object.create(DecodeStream.prototype);
  2160. Object.defineProperty(JpxStream.prototype, 'bytes', {
  2161. get: function JpxStream_bytes() {
  2162. return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
  2163. },
  2164. configurable: true
  2165. });
  2166. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  2167. if (this.bufferLength) {
  2168. return;
  2169. }
  2170. var jpxImage = new _jpx.JpxImage();
  2171. jpxImage.parse(this.bytes);
  2172. var width = jpxImage.width;
  2173. var height = jpxImage.height;
  2174. var componentsCount = jpxImage.componentsCount;
  2175. var tileCount = jpxImage.tiles.length;
  2176. if (tileCount === 1) {
  2177. this.buffer = jpxImage.tiles[0].items;
  2178. } else {
  2179. var data = new Uint8Array(width * height * componentsCount);
  2180. for (var k = 0; k < tileCount; k++) {
  2181. var tileComponents = jpxImage.tiles[k];
  2182. var tileWidth = tileComponents.width;
  2183. var tileHeight = tileComponents.height;
  2184. var tileLeft = tileComponents.left;
  2185. var tileTop = tileComponents.top;
  2186. var src = tileComponents.items;
  2187. var srcPosition = 0;
  2188. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  2189. var imgRowSize = width * componentsCount;
  2190. var tileRowSize = tileWidth * componentsCount;
  2191. for (var j = 0; j < tileHeight; j++) {
  2192. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  2193. data.set(rowBytes, dataPosition);
  2194. srcPosition += tileRowSize;
  2195. dataPosition += imgRowSize;
  2196. }
  2197. }
  2198. this.buffer = data;
  2199. }
  2200. this.bufferLength = this.buffer.length;
  2201. this.eof = true;
  2202. };
  2203. return JpxStream;
  2204. }();
  2205. var Jbig2Stream = function Jbig2StreamClosure() {
  2206. function Jbig2Stream(stream, maybeLength, dict, params) {
  2207. this.stream = stream;
  2208. this.maybeLength = maybeLength;
  2209. this.dict = dict;
  2210. this.params = params;
  2211. DecodeStream.call(this, maybeLength);
  2212. }
  2213. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  2214. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  2215. get: function Jbig2Stream_bytes() {
  2216. return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
  2217. },
  2218. configurable: true
  2219. });
  2220. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  2221. if (this.bufferLength) {
  2222. return;
  2223. }
  2224. var jbig2Image = new _jbig.Jbig2Image();
  2225. var chunks = [];
  2226. if ((0, _primitives.isDict)(this.params)) {
  2227. var globalsStream = this.params.get('JBIG2Globals');
  2228. if ((0, _primitives.isStream)(globalsStream)) {
  2229. var globals = globalsStream.getBytes();
  2230. chunks.push({
  2231. data: globals,
  2232. start: 0,
  2233. end: globals.length
  2234. });
  2235. }
  2236. }
  2237. chunks.push({
  2238. data: this.bytes,
  2239. start: 0,
  2240. end: this.bytes.length
  2241. });
  2242. var data = jbig2Image.parseChunks(chunks);
  2243. var dataLength = data.length;
  2244. for (var i = 0; i < dataLength; i++) {
  2245. data[i] ^= 0xFF;
  2246. }
  2247. this.buffer = data;
  2248. this.bufferLength = dataLength;
  2249. this.eof = true;
  2250. };
  2251. return Jbig2Stream;
  2252. }();
  2253. var DecryptStream = function DecryptStreamClosure() {
  2254. function DecryptStream(str, maybeLength, decrypt) {
  2255. this.str = str;
  2256. this.dict = str.dict;
  2257. this.decrypt = decrypt;
  2258. this.nextChunk = null;
  2259. this.initialized = false;
  2260. DecodeStream.call(this, maybeLength);
  2261. }
  2262. var chunkSize = 512;
  2263. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  2264. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  2265. var chunk;
  2266. if (this.initialized) {
  2267. chunk = this.nextChunk;
  2268. } else {
  2269. chunk = this.str.getBytes(chunkSize);
  2270. this.initialized = true;
  2271. }
  2272. if (!chunk || chunk.length === 0) {
  2273. this.eof = true;
  2274. return;
  2275. }
  2276. this.nextChunk = this.str.getBytes(chunkSize);
  2277. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  2278. var decrypt = this.decrypt;
  2279. chunk = decrypt(chunk, !hasMoreData);
  2280. var bufferLength = this.bufferLength;
  2281. var i,
  2282. n = chunk.length;
  2283. var buffer = this.ensureBuffer(bufferLength + n);
  2284. for (i = 0; i < n; i++) {
  2285. buffer[bufferLength++] = chunk[i];
  2286. }
  2287. this.bufferLength = bufferLength;
  2288. };
  2289. return DecryptStream;
  2290. }();
  2291. var Ascii85Stream = function Ascii85StreamClosure() {
  2292. function Ascii85Stream(str, maybeLength) {
  2293. this.str = str;
  2294. this.dict = str.dict;
  2295. this.input = new Uint8Array(5);
  2296. if (maybeLength) {
  2297. maybeLength = 0.8 * maybeLength;
  2298. }
  2299. DecodeStream.call(this, maybeLength);
  2300. }
  2301. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  2302. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  2303. var TILDA_CHAR = 0x7E;
  2304. var Z_LOWER_CHAR = 0x7A;
  2305. var EOF = -1;
  2306. var str = this.str;
  2307. var c = str.getByte();
  2308. while ((0, _util.isSpace)(c)) {
  2309. c = str.getByte();
  2310. }
  2311. if (c === EOF || c === TILDA_CHAR) {
  2312. this.eof = true;
  2313. return;
  2314. }
  2315. var bufferLength = this.bufferLength,
  2316. buffer;
  2317. var i;
  2318. if (c === Z_LOWER_CHAR) {
  2319. buffer = this.ensureBuffer(bufferLength + 4);
  2320. for (i = 0; i < 4; ++i) {
  2321. buffer[bufferLength + i] = 0;
  2322. }
  2323. this.bufferLength += 4;
  2324. } else {
  2325. var input = this.input;
  2326. input[0] = c;
  2327. for (i = 1; i < 5; ++i) {
  2328. c = str.getByte();
  2329. while ((0, _util.isSpace)(c)) {
  2330. c = str.getByte();
  2331. }
  2332. input[i] = c;
  2333. if (c === EOF || c === TILDA_CHAR) {
  2334. break;
  2335. }
  2336. }
  2337. buffer = this.ensureBuffer(bufferLength + i - 1);
  2338. this.bufferLength += i - 1;
  2339. if (i < 5) {
  2340. for (; i < 5; ++i) {
  2341. input[i] = 0x21 + 84;
  2342. }
  2343. this.eof = true;
  2344. }
  2345. var t = 0;
  2346. for (i = 0; i < 5; ++i) {
  2347. t = t * 85 + (input[i] - 0x21);
  2348. }
  2349. for (i = 3; i >= 0; --i) {
  2350. buffer[bufferLength + i] = t & 0xFF;
  2351. t >>= 8;
  2352. }
  2353. }
  2354. };
  2355. return Ascii85Stream;
  2356. }();
  2357. var AsciiHexStream = function AsciiHexStreamClosure() {
  2358. function AsciiHexStream(str, maybeLength) {
  2359. this.str = str;
  2360. this.dict = str.dict;
  2361. this.firstDigit = -1;
  2362. if (maybeLength) {
  2363. maybeLength = 0.5 * maybeLength;
  2364. }
  2365. DecodeStream.call(this, maybeLength);
  2366. }
  2367. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  2368. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  2369. var UPSTREAM_BLOCK_SIZE = 8000;
  2370. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  2371. if (!bytes.length) {
  2372. this.eof = true;
  2373. return;
  2374. }
  2375. var maxDecodeLength = bytes.length + 1 >> 1;
  2376. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  2377. var bufferLength = this.bufferLength;
  2378. var firstDigit = this.firstDigit;
  2379. for (var i = 0, ii = bytes.length; i < ii; i++) {
  2380. var ch = bytes[i],
  2381. digit;
  2382. if (ch >= 0x30 && ch <= 0x39) {
  2383. digit = ch & 0x0F;
  2384. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  2385. digit = (ch & 0x0F) + 9;
  2386. } else if (ch === 0x3E) {
  2387. this.eof = true;
  2388. break;
  2389. } else {
  2390. continue;
  2391. }
  2392. if (firstDigit < 0) {
  2393. firstDigit = digit;
  2394. } else {
  2395. buffer[bufferLength++] = firstDigit << 4 | digit;
  2396. firstDigit = -1;
  2397. }
  2398. }
  2399. if (firstDigit >= 0 && this.eof) {
  2400. buffer[bufferLength++] = firstDigit << 4;
  2401. firstDigit = -1;
  2402. }
  2403. this.firstDigit = firstDigit;
  2404. this.bufferLength = bufferLength;
  2405. };
  2406. return AsciiHexStream;
  2407. }();
  2408. var RunLengthStream = function RunLengthStreamClosure() {
  2409. function RunLengthStream(str, maybeLength) {
  2410. this.str = str;
  2411. this.dict = str.dict;
  2412. DecodeStream.call(this, maybeLength);
  2413. }
  2414. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  2415. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  2416. var repeatHeader = this.str.getBytes(2);
  2417. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  2418. this.eof = true;
  2419. return;
  2420. }
  2421. var buffer;
  2422. var bufferLength = this.bufferLength;
  2423. var n = repeatHeader[0];
  2424. if (n < 128) {
  2425. buffer = this.ensureBuffer(bufferLength + n + 1);
  2426. buffer[bufferLength++] = repeatHeader[1];
  2427. if (n > 0) {
  2428. var source = this.str.getBytes(n);
  2429. buffer.set(source, bufferLength);
  2430. bufferLength += n;
  2431. }
  2432. } else {
  2433. n = 257 - n;
  2434. var b = repeatHeader[1];
  2435. buffer = this.ensureBuffer(bufferLength + n + 1);
  2436. for (var i = 0; i < n; i++) {
  2437. buffer[bufferLength++] = b;
  2438. }
  2439. }
  2440. this.bufferLength = bufferLength;
  2441. };
  2442. return RunLengthStream;
  2443. }();
  2444. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  2445. var ccittEOL = -2;
  2446. var ccittEOF = -1;
  2447. var twoDimPass = 0;
  2448. var twoDimHoriz = 1;
  2449. var twoDimVert0 = 2;
  2450. var twoDimVertR1 = 3;
  2451. var twoDimVertL1 = 4;
  2452. var twoDimVertR2 = 5;
  2453. var twoDimVertL2 = 6;
  2454. var twoDimVertR3 = 7;
  2455. var twoDimVertL3 = 8;
  2456. var 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]];
  2457. var 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]];
  2458. var 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]];
  2459. var 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]];
  2460. var 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]];
  2461. var 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]];
  2462. function CCITTFaxStream(str, maybeLength, params) {
  2463. this.str = str;
  2464. this.dict = str.dict;
  2465. params = params || _primitives.Dict.empty;
  2466. this.encoding = params.get('K') || 0;
  2467. this.eoline = params.get('EndOfLine') || false;
  2468. this.byteAlign = params.get('EncodedByteAlign') || false;
  2469. this.columns = params.get('Columns') || 1728;
  2470. this.rows = params.get('Rows') || 0;
  2471. var eoblock = params.get('EndOfBlock');
  2472. if (eoblock === null || eoblock === undefined) {
  2473. eoblock = true;
  2474. }
  2475. this.eoblock = eoblock;
  2476. this.black = params.get('BlackIs1') || false;
  2477. this.codingLine = new Uint32Array(this.columns + 1);
  2478. this.refLine = new Uint32Array(this.columns + 2);
  2479. this.codingLine[0] = this.columns;
  2480. this.codingPos = 0;
  2481. this.row = 0;
  2482. this.nextLine2D = this.encoding < 0;
  2483. this.inputBits = 0;
  2484. this.inputBuf = 0;
  2485. this.outputBits = 0;
  2486. var code1;
  2487. while ((code1 = this.lookBits(12)) === 0) {
  2488. this.eatBits(1);
  2489. }
  2490. if (code1 === 1) {
  2491. this.eatBits(12);
  2492. }
  2493. if (this.encoding > 0) {
  2494. this.nextLine2D = !this.lookBits(1);
  2495. this.eatBits(1);
  2496. }
  2497. DecodeStream.call(this, maybeLength);
  2498. }
  2499. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  2500. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  2501. while (!this.eof) {
  2502. var c = this.lookChar();
  2503. this.ensureBuffer(this.bufferLength + 1);
  2504. this.buffer[this.bufferLength++] = c;
  2505. }
  2506. };
  2507. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  2508. var codingLine = this.codingLine;
  2509. var codingPos = this.codingPos;
  2510. if (a1 > codingLine[codingPos]) {
  2511. if (a1 > this.columns) {
  2512. (0, _util.info)('row is wrong length');
  2513. this.err = true;
  2514. a1 = this.columns;
  2515. }
  2516. if (codingPos & 1 ^ blackPixels) {
  2517. ++codingPos;
  2518. }
  2519. codingLine[codingPos] = a1;
  2520. }
  2521. this.codingPos = codingPos;
  2522. };
  2523. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  2524. var codingLine = this.codingLine;
  2525. var codingPos = this.codingPos;
  2526. if (a1 > codingLine[codingPos]) {
  2527. if (a1 > this.columns) {
  2528. (0, _util.info)('row is wrong length');
  2529. this.err = true;
  2530. a1 = this.columns;
  2531. }
  2532. if (codingPos & 1 ^ blackPixels) {
  2533. ++codingPos;
  2534. }
  2535. codingLine[codingPos] = a1;
  2536. } else if (a1 < codingLine[codingPos]) {
  2537. if (a1 < 0) {
  2538. (0, _util.info)('invalid code');
  2539. this.err = true;
  2540. a1 = 0;
  2541. }
  2542. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  2543. --codingPos;
  2544. }
  2545. codingLine[codingPos] = a1;
  2546. }
  2547. this.codingPos = codingPos;
  2548. };
  2549. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  2550. var refLine = this.refLine;
  2551. var codingLine = this.codingLine;
  2552. var columns = this.columns;
  2553. var refPos, blackPixels, bits, i;
  2554. if (this.outputBits === 0) {
  2555. if (this.eof) {
  2556. return null;
  2557. }
  2558. this.err = false;
  2559. var code1, code2, code3;
  2560. if (this.nextLine2D) {
  2561. for (i = 0; codingLine[i] < columns; ++i) {
  2562. refLine[i] = codingLine[i];
  2563. }
  2564. refLine[i++] = columns;
  2565. refLine[i] = columns;
  2566. codingLine[0] = 0;
  2567. this.codingPos = 0;
  2568. refPos = 0;
  2569. blackPixels = 0;
  2570. while (codingLine[this.codingPos] < columns) {
  2571. code1 = this.getTwoDimCode();
  2572. switch (code1) {
  2573. case twoDimPass:
  2574. this.addPixels(refLine[refPos + 1], blackPixels);
  2575. if (refLine[refPos + 1] < columns) {
  2576. refPos += 2;
  2577. }
  2578. break;
  2579. case twoDimHoriz:
  2580. code1 = code2 = 0;
  2581. if (blackPixels) {
  2582. do {
  2583. code1 += code3 = this.getBlackCode();
  2584. } while (code3 >= 64);
  2585. do {
  2586. code2 += code3 = this.getWhiteCode();
  2587. } while (code3 >= 64);
  2588. } else {
  2589. do {
  2590. code1 += code3 = this.getWhiteCode();
  2591. } while (code3 >= 64);
  2592. do {
  2593. code2 += code3 = this.getBlackCode();
  2594. } while (code3 >= 64);
  2595. }
  2596. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  2597. if (codingLine[this.codingPos] < columns) {
  2598. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  2599. }
  2600. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2601. refPos += 2;
  2602. }
  2603. break;
  2604. case twoDimVertR3:
  2605. this.addPixels(refLine[refPos] + 3, blackPixels);
  2606. blackPixels ^= 1;
  2607. if (codingLine[this.codingPos] < columns) {
  2608. ++refPos;
  2609. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2610. refPos += 2;
  2611. }
  2612. }
  2613. break;
  2614. case twoDimVertR2:
  2615. this.addPixels(refLine[refPos] + 2, blackPixels);
  2616. blackPixels ^= 1;
  2617. if (codingLine[this.codingPos] < columns) {
  2618. ++refPos;
  2619. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2620. refPos += 2;
  2621. }
  2622. }
  2623. break;
  2624. case twoDimVertR1:
  2625. this.addPixels(refLine[refPos] + 1, blackPixels);
  2626. blackPixels ^= 1;
  2627. if (codingLine[this.codingPos] < columns) {
  2628. ++refPos;
  2629. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2630. refPos += 2;
  2631. }
  2632. }
  2633. break;
  2634. case twoDimVert0:
  2635. this.addPixels(refLine[refPos], blackPixels);
  2636. blackPixels ^= 1;
  2637. if (codingLine[this.codingPos] < columns) {
  2638. ++refPos;
  2639. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2640. refPos += 2;
  2641. }
  2642. }
  2643. break;
  2644. case twoDimVertL3:
  2645. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  2646. blackPixels ^= 1;
  2647. if (codingLine[this.codingPos] < columns) {
  2648. if (refPos > 0) {
  2649. --refPos;
  2650. } else {
  2651. ++refPos;
  2652. }
  2653. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2654. refPos += 2;
  2655. }
  2656. }
  2657. break;
  2658. case twoDimVertL2:
  2659. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  2660. blackPixels ^= 1;
  2661. if (codingLine[this.codingPos] < columns) {
  2662. if (refPos > 0) {
  2663. --refPos;
  2664. } else {
  2665. ++refPos;
  2666. }
  2667. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2668. refPos += 2;
  2669. }
  2670. }
  2671. break;
  2672. case twoDimVertL1:
  2673. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  2674. blackPixels ^= 1;
  2675. if (codingLine[this.codingPos] < columns) {
  2676. if (refPos > 0) {
  2677. --refPos;
  2678. } else {
  2679. ++refPos;
  2680. }
  2681. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  2682. refPos += 2;
  2683. }
  2684. }
  2685. break;
  2686. case ccittEOF:
  2687. this.addPixels(columns, 0);
  2688. this.eof = true;
  2689. break;
  2690. default:
  2691. (0, _util.info)('bad 2d code');
  2692. this.addPixels(columns, 0);
  2693. this.err = true;
  2694. }
  2695. }
  2696. } else {
  2697. codingLine[0] = 0;
  2698. this.codingPos = 0;
  2699. blackPixels = 0;
  2700. while (codingLine[this.codingPos] < columns) {
  2701. code1 = 0;
  2702. if (blackPixels) {
  2703. do {
  2704. code1 += code3 = this.getBlackCode();
  2705. } while (code3 >= 64);
  2706. } else {
  2707. do {
  2708. code1 += code3 = this.getWhiteCode();
  2709. } while (code3 >= 64);
  2710. }
  2711. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  2712. blackPixels ^= 1;
  2713. }
  2714. }
  2715. var gotEOL = false;
  2716. if (this.byteAlign) {
  2717. this.inputBits &= ~7;
  2718. }
  2719. if (!this.eoblock && this.row === this.rows - 1) {
  2720. this.eof = true;
  2721. } else {
  2722. code1 = this.lookBits(12);
  2723. if (this.eoline) {
  2724. while (code1 !== ccittEOF && code1 !== 1) {
  2725. this.eatBits(1);
  2726. code1 = this.lookBits(12);
  2727. }
  2728. } else {
  2729. while (code1 === 0) {
  2730. this.eatBits(1);
  2731. code1 = this.lookBits(12);
  2732. }
  2733. }
  2734. if (code1 === 1) {
  2735. this.eatBits(12);
  2736. gotEOL = true;
  2737. } else if (code1 === ccittEOF) {
  2738. this.eof = true;
  2739. }
  2740. }
  2741. if (!this.eof && this.encoding > 0) {
  2742. this.nextLine2D = !this.lookBits(1);
  2743. this.eatBits(1);
  2744. }
  2745. if (this.eoblock && gotEOL && this.byteAlign) {
  2746. code1 = this.lookBits(12);
  2747. if (code1 === 1) {
  2748. this.eatBits(12);
  2749. if (this.encoding > 0) {
  2750. this.lookBits(1);
  2751. this.eatBits(1);
  2752. }
  2753. if (this.encoding >= 0) {
  2754. for (i = 0; i < 4; ++i) {
  2755. code1 = this.lookBits(12);
  2756. if (code1 !== 1) {
  2757. (0, _util.info)('bad rtc code: ' + code1);
  2758. }
  2759. this.eatBits(12);
  2760. if (this.encoding > 0) {
  2761. this.lookBits(1);
  2762. this.eatBits(1);
  2763. }
  2764. }
  2765. }
  2766. this.eof = true;
  2767. }
  2768. } else if (this.err && this.eoline) {
  2769. while (true) {
  2770. code1 = this.lookBits(13);
  2771. if (code1 === ccittEOF) {
  2772. this.eof = true;
  2773. return null;
  2774. }
  2775. if (code1 >> 1 === 1) {
  2776. break;
  2777. }
  2778. this.eatBits(1);
  2779. }
  2780. this.eatBits(12);
  2781. if (this.encoding > 0) {
  2782. this.eatBits(1);
  2783. this.nextLine2D = !(code1 & 1);
  2784. }
  2785. }
  2786. if (codingLine[0] > 0) {
  2787. this.outputBits = codingLine[this.codingPos = 0];
  2788. } else {
  2789. this.outputBits = codingLine[this.codingPos = 1];
  2790. }
  2791. this.row++;
  2792. }
  2793. var c;
  2794. if (this.outputBits >= 8) {
  2795. c = this.codingPos & 1 ? 0 : 0xFF;
  2796. this.outputBits -= 8;
  2797. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  2798. this.codingPos++;
  2799. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  2800. }
  2801. } else {
  2802. bits = 8;
  2803. c = 0;
  2804. do {
  2805. if (this.outputBits > bits) {
  2806. c <<= bits;
  2807. if (!(this.codingPos & 1)) {
  2808. c |= 0xFF >> 8 - bits;
  2809. }
  2810. this.outputBits -= bits;
  2811. bits = 0;
  2812. } else {
  2813. c <<= this.outputBits;
  2814. if (!(this.codingPos & 1)) {
  2815. c |= 0xFF >> 8 - this.outputBits;
  2816. }
  2817. bits -= this.outputBits;
  2818. this.outputBits = 0;
  2819. if (codingLine[this.codingPos] < columns) {
  2820. this.codingPos++;
  2821. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  2822. } else if (bits > 0) {
  2823. c <<= bits;
  2824. bits = 0;
  2825. }
  2826. }
  2827. } while (bits);
  2828. }
  2829. if (this.black) {
  2830. c ^= 0xFF;
  2831. }
  2832. return c;
  2833. };
  2834. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  2835. var limitValue = limit || 0;
  2836. for (var i = start; i <= end; ++i) {
  2837. var code = this.lookBits(i);
  2838. if (code === ccittEOF) {
  2839. return [true, 1, false];
  2840. }
  2841. if (i < end) {
  2842. code <<= end - i;
  2843. }
  2844. if (!limitValue || code >= limitValue) {
  2845. var p = table[code - limitValue];
  2846. if (p[0] === i) {
  2847. this.eatBits(i);
  2848. return [true, p[1], true];
  2849. }
  2850. }
  2851. }
  2852. return [false, 0, false];
  2853. };
  2854. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  2855. var code = 0;
  2856. var p;
  2857. if (this.eoblock) {
  2858. code = this.lookBits(7);
  2859. p = twoDimTable[code];
  2860. if (p && p[0] > 0) {
  2861. this.eatBits(p[0]);
  2862. return p[1];
  2863. }
  2864. } else {
  2865. var result = this.findTableCode(1, 7, twoDimTable);
  2866. if (result[0] && result[2]) {
  2867. return result[1];
  2868. }
  2869. }
  2870. (0, _util.info)('Bad two dim code');
  2871. return ccittEOF;
  2872. };
  2873. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  2874. var code = 0;
  2875. var p;
  2876. if (this.eoblock) {
  2877. code = this.lookBits(12);
  2878. if (code === ccittEOF) {
  2879. return 1;
  2880. }
  2881. if (code >> 5 === 0) {
  2882. p = whiteTable1[code];
  2883. } else {
  2884. p = whiteTable2[code >> 3];
  2885. }
  2886. if (p[0] > 0) {
  2887. this.eatBits(p[0]);
  2888. return p[1];
  2889. }
  2890. } else {
  2891. var result = this.findTableCode(1, 9, whiteTable2);
  2892. if (result[0]) {
  2893. return result[1];
  2894. }
  2895. result = this.findTableCode(11, 12, whiteTable1);
  2896. if (result[0]) {
  2897. return result[1];
  2898. }
  2899. }
  2900. (0, _util.info)('bad white code');
  2901. this.eatBits(1);
  2902. return 1;
  2903. };
  2904. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  2905. var code, p;
  2906. if (this.eoblock) {
  2907. code = this.lookBits(13);
  2908. if (code === ccittEOF) {
  2909. return 1;
  2910. }
  2911. if (code >> 7 === 0) {
  2912. p = blackTable1[code];
  2913. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  2914. p = blackTable2[(code >> 1) - 64];
  2915. } else {
  2916. p = blackTable3[code >> 7];
  2917. }
  2918. if (p[0] > 0) {
  2919. this.eatBits(p[0]);
  2920. return p[1];
  2921. }
  2922. } else {
  2923. var result = this.findTableCode(2, 6, blackTable3);
  2924. if (result[0]) {
  2925. return result[1];
  2926. }
  2927. result = this.findTableCode(7, 12, blackTable2, 64);
  2928. if (result[0]) {
  2929. return result[1];
  2930. }
  2931. result = this.findTableCode(10, 13, blackTable1);
  2932. if (result[0]) {
  2933. return result[1];
  2934. }
  2935. }
  2936. (0, _util.info)('bad black code');
  2937. this.eatBits(1);
  2938. return 1;
  2939. };
  2940. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  2941. var c;
  2942. while (this.inputBits < n) {
  2943. if ((c = this.str.getByte()) === -1) {
  2944. if (this.inputBits === 0) {
  2945. return ccittEOF;
  2946. }
  2947. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  2948. }
  2949. this.inputBuf = this.inputBuf << 8 | c;
  2950. this.inputBits += 8;
  2951. }
  2952. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  2953. };
  2954. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  2955. if ((this.inputBits -= n) < 0) {
  2956. this.inputBits = 0;
  2957. }
  2958. };
  2959. return CCITTFaxStream;
  2960. }();
  2961. var LZWStream = function LZWStreamClosure() {
  2962. function LZWStream(str, maybeLength, earlyChange) {
  2963. this.str = str;
  2964. this.dict = str.dict;
  2965. this.cachedData = 0;
  2966. this.bitsCached = 0;
  2967. var maxLzwDictionarySize = 4096;
  2968. var lzwState = {
  2969. earlyChange: earlyChange,
  2970. codeLength: 9,
  2971. nextCode: 258,
  2972. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  2973. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  2974. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  2975. currentSequence: new Uint8Array(maxLzwDictionarySize),
  2976. currentSequenceLength: 0
  2977. };
  2978. for (var i = 0; i < 256; ++i) {
  2979. lzwState.dictionaryValues[i] = i;
  2980. lzwState.dictionaryLengths[i] = 1;
  2981. }
  2982. this.lzwState = lzwState;
  2983. DecodeStream.call(this, maybeLength);
  2984. }
  2985. LZWStream.prototype = Object.create(DecodeStream.prototype);
  2986. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  2987. var bitsCached = this.bitsCached;
  2988. var cachedData = this.cachedData;
  2989. while (bitsCached < n) {
  2990. var c = this.str.getByte();
  2991. if (c === -1) {
  2992. this.eof = true;
  2993. return null;
  2994. }
  2995. cachedData = cachedData << 8 | c;
  2996. bitsCached += 8;
  2997. }
  2998. this.bitsCached = bitsCached -= n;
  2999. this.cachedData = cachedData;
  3000. this.lastCode = null;
  3001. return cachedData >>> bitsCached & (1 << n) - 1;
  3002. };
  3003. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  3004. var blockSize = 512;
  3005. var estimatedDecodedSize = blockSize * 2,
  3006. decodedSizeDelta = blockSize;
  3007. var i, j, q;
  3008. var lzwState = this.lzwState;
  3009. if (!lzwState) {
  3010. return;
  3011. }
  3012. var earlyChange = lzwState.earlyChange;
  3013. var nextCode = lzwState.nextCode;
  3014. var dictionaryValues = lzwState.dictionaryValues;
  3015. var dictionaryLengths = lzwState.dictionaryLengths;
  3016. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  3017. var codeLength = lzwState.codeLength;
  3018. var prevCode = lzwState.prevCode;
  3019. var currentSequence = lzwState.currentSequence;
  3020. var currentSequenceLength = lzwState.currentSequenceLength;
  3021. var decodedLength = 0;
  3022. var currentBufferLength = this.bufferLength;
  3023. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  3024. for (i = 0; i < blockSize; i++) {
  3025. var code = this.readBits(codeLength);
  3026. var hasPrev = currentSequenceLength > 0;
  3027. if (code < 256) {
  3028. currentSequence[0] = code;
  3029. currentSequenceLength = 1;
  3030. } else if (code >= 258) {
  3031. if (code < nextCode) {
  3032. currentSequenceLength = dictionaryLengths[code];
  3033. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  3034. currentSequence[j] = dictionaryValues[q];
  3035. q = dictionaryPrevCodes[q];
  3036. }
  3037. } else {
  3038. currentSequence[currentSequenceLength++] = currentSequence[0];
  3039. }
  3040. } else if (code === 256) {
  3041. codeLength = 9;
  3042. nextCode = 258;
  3043. currentSequenceLength = 0;
  3044. continue;
  3045. } else {
  3046. this.eof = true;
  3047. delete this.lzwState;
  3048. break;
  3049. }
  3050. if (hasPrev) {
  3051. dictionaryPrevCodes[nextCode] = prevCode;
  3052. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  3053. dictionaryValues[nextCode] = currentSequence[0];
  3054. nextCode++;
  3055. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  3056. }
  3057. prevCode = code;
  3058. decodedLength += currentSequenceLength;
  3059. if (estimatedDecodedSize < decodedLength) {
  3060. do {
  3061. estimatedDecodedSize += decodedSizeDelta;
  3062. } while (estimatedDecodedSize < decodedLength);
  3063. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  3064. }
  3065. for (j = 0; j < currentSequenceLength; j++) {
  3066. buffer[currentBufferLength++] = currentSequence[j];
  3067. }
  3068. }
  3069. lzwState.nextCode = nextCode;
  3070. lzwState.codeLength = codeLength;
  3071. lzwState.prevCode = prevCode;
  3072. lzwState.currentSequenceLength = currentSequenceLength;
  3073. this.bufferLength = currentBufferLength;
  3074. };
  3075. return LZWStream;
  3076. }();
  3077. var NullStream = function NullStreamClosure() {
  3078. function NullStream() {
  3079. Stream.call(this, new Uint8Array(0));
  3080. }
  3081. NullStream.prototype = Stream.prototype;
  3082. return NullStream;
  3083. }();
  3084. exports.Ascii85Stream = Ascii85Stream;
  3085. exports.AsciiHexStream = AsciiHexStream;
  3086. exports.CCITTFaxStream = CCITTFaxStream;
  3087. exports.DecryptStream = DecryptStream;
  3088. exports.DecodeStream = DecodeStream;
  3089. exports.FlateStream = FlateStream;
  3090. exports.Jbig2Stream = Jbig2Stream;
  3091. exports.JpegStream = JpegStream;
  3092. exports.JpxStream = JpxStream;
  3093. exports.NullStream = NullStream;
  3094. exports.PredictorStream = PredictorStream;
  3095. exports.RunLengthStream = RunLengthStream;
  3096. exports.Stream = Stream;
  3097. exports.StreamsSequenceStream = StreamsSequenceStream;
  3098. exports.StringStream = StringStream;
  3099. exports.LZWStream = LZWStream;
  3100. /***/ }),
  3101. /* 3 */
  3102. /***/ (function(module, exports, __w_pdfjs_require__) {
  3103. "use strict";
  3104. Object.defineProperty(exports, "__esModule", {
  3105. value: true
  3106. });
  3107. exports.ColorSpace = undefined;
  3108. var _util = __w_pdfjs_require__(0);
  3109. var _primitives = __w_pdfjs_require__(1);
  3110. var _function = __w_pdfjs_require__(6);
  3111. var ColorSpace = function ColorSpaceClosure() {
  3112. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  3113. var COMPONENTS = 3;
  3114. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  3115. var xRatio = w1 / w2;
  3116. var yRatio = h1 / h2;
  3117. var i,
  3118. j,
  3119. py,
  3120. newIndex = 0,
  3121. oldIndex;
  3122. var xScaled = new Uint16Array(w2);
  3123. var w1Scanline = w1 * COMPONENTS;
  3124. for (i = 0; i < w2; i++) {
  3125. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  3126. }
  3127. for (i = 0; i < h2; i++) {
  3128. py = Math.floor(i * yRatio) * w1Scanline;
  3129. for (j = 0; j < w2; j++) {
  3130. oldIndex = py + xScaled[j];
  3131. dest[newIndex++] = src[oldIndex++];
  3132. dest[newIndex++] = src[oldIndex++];
  3133. dest[newIndex++] = src[oldIndex++];
  3134. newIndex += alpha01;
  3135. }
  3136. }
  3137. }
  3138. function ColorSpace() {
  3139. (0, _util.error)('should not call ColorSpace constructor');
  3140. }
  3141. ColorSpace.prototype = {
  3142. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  3143. var rgb = new Uint8Array(3);
  3144. this.getRgbItem(src, srcOffset, rgb, 0);
  3145. return rgb;
  3146. },
  3147. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  3148. (0, _util.error)('Should not call ColorSpace.getRgbItem');
  3149. },
  3150. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3151. (0, _util.error)('Should not call ColorSpace.getRgbBuffer');
  3152. },
  3153. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  3154. (0, _util.error)('Should not call ColorSpace.getOutputLength');
  3155. },
  3156. isPassthrough: function ColorSpace_isPassthrough(bits) {
  3157. return false;
  3158. },
  3159. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  3160. var count = originalWidth * originalHeight;
  3161. var rgbBuf = null;
  3162. var numComponentColors = 1 << bpc;
  3163. var needsResizing = originalHeight !== height || originalWidth !== width;
  3164. var i, ii;
  3165. if (this.isPassthrough(bpc)) {
  3166. rgbBuf = comps;
  3167. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  3168. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  3169. var key;
  3170. for (i = 0; i < numComponentColors; i++) {
  3171. allColors[i] = i;
  3172. }
  3173. var colorMap = new Uint8Array(numComponentColors * 3);
  3174. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  3175. var destPos, rgbPos;
  3176. if (!needsResizing) {
  3177. destPos = 0;
  3178. for (i = 0; i < count; ++i) {
  3179. key = comps[i] * 3;
  3180. dest[destPos++] = colorMap[key];
  3181. dest[destPos++] = colorMap[key + 1];
  3182. dest[destPos++] = colorMap[key + 2];
  3183. destPos += alpha01;
  3184. }
  3185. } else {
  3186. rgbBuf = new Uint8Array(count * 3);
  3187. rgbPos = 0;
  3188. for (i = 0; i < count; ++i) {
  3189. key = comps[i] * 3;
  3190. rgbBuf[rgbPos++] = colorMap[key];
  3191. rgbBuf[rgbPos++] = colorMap[key + 1];
  3192. rgbBuf[rgbPos++] = colorMap[key + 2];
  3193. }
  3194. }
  3195. } else {
  3196. if (!needsResizing) {
  3197. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  3198. } else {
  3199. rgbBuf = new Uint8Array(count * 3);
  3200. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  3201. }
  3202. }
  3203. if (rgbBuf) {
  3204. if (needsResizing) {
  3205. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  3206. } else {
  3207. rgbPos = 0;
  3208. destPos = 0;
  3209. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  3210. dest[destPos++] = rgbBuf[rgbPos++];
  3211. dest[destPos++] = rgbBuf[rgbPos++];
  3212. dest[destPos++] = rgbBuf[rgbPos++];
  3213. destPos += alpha01;
  3214. }
  3215. }
  3216. }
  3217. },
  3218. usesZeroToOneRange: true
  3219. };
  3220. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  3221. var IR = ColorSpace.parseToIR(cs, xref, res);
  3222. if (IR instanceof AlternateCS) {
  3223. return IR;
  3224. }
  3225. return ColorSpace.fromIR(IR);
  3226. };
  3227. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  3228. var name = (0, _util.isArray)(IR) ? IR[0] : IR;
  3229. var whitePoint, blackPoint, gamma;
  3230. switch (name) {
  3231. case 'DeviceGrayCS':
  3232. return this.singletons.gray;
  3233. case 'DeviceRgbCS':
  3234. return this.singletons.rgb;
  3235. case 'DeviceCmykCS':
  3236. return this.singletons.cmyk;
  3237. case 'CalGrayCS':
  3238. whitePoint = IR[1];
  3239. blackPoint = IR[2];
  3240. gamma = IR[3];
  3241. return new CalGrayCS(whitePoint, blackPoint, gamma);
  3242. case 'CalRGBCS':
  3243. whitePoint = IR[1];
  3244. blackPoint = IR[2];
  3245. gamma = IR[3];
  3246. var matrix = IR[4];
  3247. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  3248. case 'PatternCS':
  3249. var basePatternCS = IR[1];
  3250. if (basePatternCS) {
  3251. basePatternCS = ColorSpace.fromIR(basePatternCS);
  3252. }
  3253. return new PatternCS(basePatternCS);
  3254. case 'IndexedCS':
  3255. var baseIndexedCS = IR[1];
  3256. var hiVal = IR[2];
  3257. var lookup = IR[3];
  3258. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  3259. case 'AlternateCS':
  3260. var numComps = IR[1];
  3261. var alt = IR[2];
  3262. var tintFnIR = IR[3];
  3263. return new AlternateCS(numComps, ColorSpace.fromIR(alt), _function.PDFFunction.fromIR(tintFnIR));
  3264. case 'LabCS':
  3265. whitePoint = IR[1];
  3266. blackPoint = IR[2];
  3267. var range = IR[3];
  3268. return new LabCS(whitePoint, blackPoint, range);
  3269. default:
  3270. (0, _util.error)('Unknown name ' + name);
  3271. }
  3272. return null;
  3273. };
  3274. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  3275. if ((0, _primitives.isName)(cs)) {
  3276. var colorSpaces = res.get('ColorSpace');
  3277. if ((0, _primitives.isDict)(colorSpaces)) {
  3278. var refcs = colorSpaces.get(cs.name);
  3279. if (refcs) {
  3280. cs = refcs;
  3281. }
  3282. }
  3283. }
  3284. cs = xref.fetchIfRef(cs);
  3285. if ((0, _primitives.isName)(cs)) {
  3286. switch (cs.name) {
  3287. case 'DeviceGray':
  3288. case 'G':
  3289. return 'DeviceGrayCS';
  3290. case 'DeviceRGB':
  3291. case 'RGB':
  3292. return 'DeviceRgbCS';
  3293. case 'DeviceCMYK':
  3294. case 'CMYK':
  3295. return 'DeviceCmykCS';
  3296. case 'Pattern':
  3297. return ['PatternCS', null];
  3298. default:
  3299. (0, _util.error)('unrecognized colorspace ' + cs.name);
  3300. }
  3301. } else if ((0, _util.isArray)(cs)) {
  3302. var mode = xref.fetchIfRef(cs[0]).name;
  3303. var numComps, params, alt, whitePoint, blackPoint, gamma;
  3304. switch (mode) {
  3305. case 'DeviceGray':
  3306. case 'G':
  3307. return 'DeviceGrayCS';
  3308. case 'DeviceRGB':
  3309. case 'RGB':
  3310. return 'DeviceRgbCS';
  3311. case 'DeviceCMYK':
  3312. case 'CMYK':
  3313. return 'DeviceCmykCS';
  3314. case 'CalGray':
  3315. params = xref.fetchIfRef(cs[1]);
  3316. whitePoint = params.getArray('WhitePoint');
  3317. blackPoint = params.getArray('BlackPoint');
  3318. gamma = params.get('Gamma');
  3319. return ['CalGrayCS', whitePoint, blackPoint, gamma];
  3320. case 'CalRGB':
  3321. params = xref.fetchIfRef(cs[1]);
  3322. whitePoint = params.getArray('WhitePoint');
  3323. blackPoint = params.getArray('BlackPoint');
  3324. gamma = params.getArray('Gamma');
  3325. var matrix = params.getArray('Matrix');
  3326. return ['CalRGBCS', whitePoint, blackPoint, gamma, matrix];
  3327. case 'ICCBased':
  3328. var stream = xref.fetchIfRef(cs[1]);
  3329. var dict = stream.dict;
  3330. numComps = dict.get('N');
  3331. alt = dict.get('Alternate');
  3332. if (alt) {
  3333. var altIR = ColorSpace.parseToIR(alt, xref, res);
  3334. var altCS = ColorSpace.fromIR(altIR);
  3335. if (altCS.numComps === numComps) {
  3336. return altIR;
  3337. }
  3338. (0, _util.warn)('ICCBased color space: Ignoring incorrect /Alternate entry.');
  3339. }
  3340. if (numComps === 1) {
  3341. return 'DeviceGrayCS';
  3342. } else if (numComps === 3) {
  3343. return 'DeviceRgbCS';
  3344. } else if (numComps === 4) {
  3345. return 'DeviceCmykCS';
  3346. }
  3347. break;
  3348. case 'Pattern':
  3349. var basePatternCS = cs[1] || null;
  3350. if (basePatternCS) {
  3351. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  3352. }
  3353. return ['PatternCS', basePatternCS];
  3354. case 'Indexed':
  3355. case 'I':
  3356. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  3357. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  3358. var lookup = xref.fetchIfRef(cs[3]);
  3359. if ((0, _primitives.isStream)(lookup)) {
  3360. lookup = lookup.getBytes();
  3361. }
  3362. return ['IndexedCS', baseIndexedCS, hiVal, lookup];
  3363. case 'Separation':
  3364. case 'DeviceN':
  3365. var name = xref.fetchIfRef(cs[1]);
  3366. numComps = (0, _util.isArray)(name) ? name.length : 1;
  3367. alt = ColorSpace.parseToIR(cs[2], xref, res);
  3368. var tintFnIR = _function.PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  3369. return ['AlternateCS', numComps, alt, tintFnIR];
  3370. case 'Lab':
  3371. params = xref.fetchIfRef(cs[1]);
  3372. whitePoint = params.getArray('WhitePoint');
  3373. blackPoint = params.getArray('BlackPoint');
  3374. var range = params.getArray('Range');
  3375. return ['LabCS', whitePoint, blackPoint, range];
  3376. default:
  3377. (0, _util.error)('unimplemented color space object "' + mode + '"');
  3378. }
  3379. } else {
  3380. (0, _util.error)('unrecognized color space object: "' + cs + '"');
  3381. }
  3382. return null;
  3383. };
  3384. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  3385. if (!(0, _util.isArray)(decode)) {
  3386. return true;
  3387. }
  3388. if (n * 2 !== decode.length) {
  3389. (0, _util.warn)('The decode map is not the correct length');
  3390. return true;
  3391. }
  3392. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  3393. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  3394. return false;
  3395. }
  3396. }
  3397. return true;
  3398. };
  3399. ColorSpace.singletons = {
  3400. get gray() {
  3401. return (0, _util.shadow)(this, 'gray', new DeviceGrayCS());
  3402. },
  3403. get rgb() {
  3404. return (0, _util.shadow)(this, 'rgb', new DeviceRgbCS());
  3405. },
  3406. get cmyk() {
  3407. return (0, _util.shadow)(this, 'cmyk', new DeviceCmykCS());
  3408. }
  3409. };
  3410. return ColorSpace;
  3411. }();
  3412. var AlternateCS = function AlternateCSClosure() {
  3413. function AlternateCS(numComps, base, tintFn) {
  3414. this.name = 'Alternate';
  3415. this.numComps = numComps;
  3416. this.defaultColor = new Float32Array(numComps);
  3417. for (var i = 0; i < numComps; ++i) {
  3418. this.defaultColor[i] = 1;
  3419. }
  3420. this.base = base;
  3421. this.tintFn = tintFn;
  3422. this.tmpBuf = new Float32Array(base.numComps);
  3423. }
  3424. AlternateCS.prototype = {
  3425. getRgb: ColorSpace.prototype.getRgb,
  3426. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3427. var tmpBuf = this.tmpBuf;
  3428. this.tintFn(src, srcOffset, tmpBuf, 0);
  3429. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  3430. },
  3431. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3432. var tintFn = this.tintFn;
  3433. var base = this.base;
  3434. var scale = 1 / ((1 << bits) - 1);
  3435. var baseNumComps = base.numComps;
  3436. var usesZeroToOneRange = base.usesZeroToOneRange;
  3437. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  3438. var pos = isPassthrough ? destOffset : 0;
  3439. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  3440. var numComps = this.numComps;
  3441. var scaled = new Float32Array(numComps);
  3442. var tinted = new Float32Array(baseNumComps);
  3443. var i, j;
  3444. for (i = 0; i < count; i++) {
  3445. for (j = 0; j < numComps; j++) {
  3446. scaled[j] = src[srcOffset++] * scale;
  3447. }
  3448. tintFn(scaled, 0, tinted, 0);
  3449. if (usesZeroToOneRange) {
  3450. for (j = 0; j < baseNumComps; j++) {
  3451. baseBuf[pos++] = tinted[j] * 255;
  3452. }
  3453. } else {
  3454. base.getRgbItem(tinted, 0, baseBuf, pos);
  3455. pos += baseNumComps;
  3456. }
  3457. }
  3458. if (!isPassthrough) {
  3459. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  3460. }
  3461. },
  3462. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  3463. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  3464. },
  3465. isPassthrough: ColorSpace.prototype.isPassthrough,
  3466. fillRgb: ColorSpace.prototype.fillRgb,
  3467. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  3468. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  3469. },
  3470. usesZeroToOneRange: true
  3471. };
  3472. return AlternateCS;
  3473. }();
  3474. var PatternCS = function PatternCSClosure() {
  3475. function PatternCS(baseCS) {
  3476. this.name = 'Pattern';
  3477. this.base = baseCS;
  3478. }
  3479. PatternCS.prototype = {};
  3480. return PatternCS;
  3481. }();
  3482. var IndexedCS = function IndexedCSClosure() {
  3483. function IndexedCS(base, highVal, lookup) {
  3484. this.name = 'Indexed';
  3485. this.numComps = 1;
  3486. this.defaultColor = new Uint8Array(this.numComps);
  3487. this.base = base;
  3488. this.highVal = highVal;
  3489. var baseNumComps = base.numComps;
  3490. var length = baseNumComps * highVal;
  3491. if ((0, _primitives.isStream)(lookup)) {
  3492. this.lookup = new Uint8Array(length);
  3493. var bytes = lookup.getBytes(length);
  3494. this.lookup.set(bytes);
  3495. } else if ((0, _util.isString)(lookup)) {
  3496. this.lookup = new Uint8Array(length);
  3497. for (var i = 0; i < length; ++i) {
  3498. this.lookup[i] = lookup.charCodeAt(i);
  3499. }
  3500. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  3501. this.lookup = lookup;
  3502. } else {
  3503. (0, _util.error)('Unrecognized lookup table: ' + lookup);
  3504. }
  3505. }
  3506. IndexedCS.prototype = {
  3507. getRgb: ColorSpace.prototype.getRgb,
  3508. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3509. var numComps = this.base.numComps;
  3510. var start = src[srcOffset] * numComps;
  3511. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  3512. },
  3513. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3514. var base = this.base;
  3515. var numComps = base.numComps;
  3516. var outputDelta = base.getOutputLength(numComps, alpha01);
  3517. var lookup = this.lookup;
  3518. for (var i = 0; i < count; ++i) {
  3519. var lookupPos = src[srcOffset++] * numComps;
  3520. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  3521. destOffset += outputDelta;
  3522. }
  3523. },
  3524. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  3525. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  3526. },
  3527. isPassthrough: ColorSpace.prototype.isPassthrough,
  3528. fillRgb: ColorSpace.prototype.fillRgb,
  3529. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  3530. return true;
  3531. },
  3532. usesZeroToOneRange: true
  3533. };
  3534. return IndexedCS;
  3535. }();
  3536. var DeviceGrayCS = function DeviceGrayCSClosure() {
  3537. function DeviceGrayCS() {
  3538. this.name = 'DeviceGray';
  3539. this.numComps = 1;
  3540. this.defaultColor = new Float32Array(this.numComps);
  3541. }
  3542. DeviceGrayCS.prototype = {
  3543. getRgb: ColorSpace.prototype.getRgb,
  3544. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3545. var c = src[srcOffset] * 255 | 0;
  3546. c = c < 0 ? 0 : c > 255 ? 255 : c;
  3547. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  3548. },
  3549. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3550. var scale = 255 / ((1 << bits) - 1);
  3551. var j = srcOffset,
  3552. q = destOffset;
  3553. for (var i = 0; i < count; ++i) {
  3554. var c = scale * src[j++] | 0;
  3555. dest[q++] = c;
  3556. dest[q++] = c;
  3557. dest[q++] = c;
  3558. q += alpha01;
  3559. }
  3560. },
  3561. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  3562. return inputLength * (3 + alpha01);
  3563. },
  3564. isPassthrough: ColorSpace.prototype.isPassthrough,
  3565. fillRgb: ColorSpace.prototype.fillRgb,
  3566. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  3567. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  3568. },
  3569. usesZeroToOneRange: true
  3570. };
  3571. return DeviceGrayCS;
  3572. }();
  3573. var DeviceRgbCS = function DeviceRgbCSClosure() {
  3574. function DeviceRgbCS() {
  3575. this.name = 'DeviceRGB';
  3576. this.numComps = 3;
  3577. this.defaultColor = new Float32Array(this.numComps);
  3578. }
  3579. DeviceRgbCS.prototype = {
  3580. getRgb: ColorSpace.prototype.getRgb,
  3581. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3582. var r = src[srcOffset] * 255 | 0;
  3583. var g = src[srcOffset + 1] * 255 | 0;
  3584. var b = src[srcOffset + 2] * 255 | 0;
  3585. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  3586. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  3587. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  3588. },
  3589. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3590. if (bits === 8 && alpha01 === 0) {
  3591. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  3592. return;
  3593. }
  3594. var scale = 255 / ((1 << bits) - 1);
  3595. var j = srcOffset,
  3596. q = destOffset;
  3597. for (var i = 0; i < count; ++i) {
  3598. dest[q++] = scale * src[j++] | 0;
  3599. dest[q++] = scale * src[j++] | 0;
  3600. dest[q++] = scale * src[j++] | 0;
  3601. q += alpha01;
  3602. }
  3603. },
  3604. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  3605. return inputLength * (3 + alpha01) / 3 | 0;
  3606. },
  3607. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  3608. return bits === 8;
  3609. },
  3610. fillRgb: ColorSpace.prototype.fillRgb,
  3611. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  3612. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  3613. },
  3614. usesZeroToOneRange: true
  3615. };
  3616. return DeviceRgbCS;
  3617. }();
  3618. var DeviceCmykCS = function DeviceCmykCSClosure() {
  3619. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  3620. var c = src[srcOffset + 0] * srcScale;
  3621. var m = src[srcOffset + 1] * srcScale;
  3622. var y = src[srcOffset + 2] * srcScale;
  3623. var k = src[srcOffset + 3] * srcScale;
  3624. var r = 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) + 255 | 0;
  3625. var g = 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) + 255 | 0;
  3626. var b = 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) + 255 | 0;
  3627. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  3628. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  3629. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  3630. }
  3631. function DeviceCmykCS() {
  3632. this.name = 'DeviceCMYK';
  3633. this.numComps = 4;
  3634. this.defaultColor = new Float32Array(this.numComps);
  3635. this.defaultColor[3] = 1;
  3636. }
  3637. DeviceCmykCS.prototype = {
  3638. getRgb: ColorSpace.prototype.getRgb,
  3639. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3640. convertToRgb(src, srcOffset, 1, dest, destOffset);
  3641. },
  3642. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3643. var scale = 1 / ((1 << bits) - 1);
  3644. for (var i = 0; i < count; i++) {
  3645. convertToRgb(src, srcOffset, scale, dest, destOffset);
  3646. srcOffset += 4;
  3647. destOffset += 3 + alpha01;
  3648. }
  3649. },
  3650. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  3651. return inputLength / 4 * (3 + alpha01) | 0;
  3652. },
  3653. isPassthrough: ColorSpace.prototype.isPassthrough,
  3654. fillRgb: ColorSpace.prototype.fillRgb,
  3655. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  3656. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  3657. },
  3658. usesZeroToOneRange: true
  3659. };
  3660. return DeviceCmykCS;
  3661. }();
  3662. var CalGrayCS = function CalGrayCSClosure() {
  3663. function CalGrayCS(whitePoint, blackPoint, gamma) {
  3664. this.name = 'CalGray';
  3665. this.numComps = 1;
  3666. this.defaultColor = new Float32Array(this.numComps);
  3667. if (!whitePoint) {
  3668. (0, _util.error)('WhitePoint missing - required for color space CalGray');
  3669. }
  3670. blackPoint = blackPoint || [0, 0, 0];
  3671. gamma = gamma || 1;
  3672. this.XW = whitePoint[0];
  3673. this.YW = whitePoint[1];
  3674. this.ZW = whitePoint[2];
  3675. this.XB = blackPoint[0];
  3676. this.YB = blackPoint[1];
  3677. this.ZB = blackPoint[2];
  3678. this.G = gamma;
  3679. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  3680. (0, _util.error)('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  3681. }
  3682. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  3683. (0, _util.info)('Invalid BlackPoint for ' + this.name + ', falling back to default');
  3684. this.XB = this.YB = this.ZB = 0;
  3685. }
  3686. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  3687. (0, _util.warn)(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  3688. }
  3689. if (this.G < 1) {
  3690. (0, _util.info)('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  3691. this.G = 1;
  3692. }
  3693. }
  3694. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  3695. var A = src[srcOffset] * scale;
  3696. var AG = Math.pow(A, cs.G);
  3697. var L = cs.YW * AG;
  3698. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  3699. dest[destOffset] = val;
  3700. dest[destOffset + 1] = val;
  3701. dest[destOffset + 2] = val;
  3702. }
  3703. CalGrayCS.prototype = {
  3704. getRgb: ColorSpace.prototype.getRgb,
  3705. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3706. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  3707. },
  3708. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3709. var scale = 1 / ((1 << bits) - 1);
  3710. for (var i = 0; i < count; ++i) {
  3711. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  3712. srcOffset += 1;
  3713. destOffset += 3 + alpha01;
  3714. }
  3715. },
  3716. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  3717. return inputLength * (3 + alpha01);
  3718. },
  3719. isPassthrough: ColorSpace.prototype.isPassthrough,
  3720. fillRgb: ColorSpace.prototype.fillRgb,
  3721. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  3722. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  3723. },
  3724. usesZeroToOneRange: true
  3725. };
  3726. return CalGrayCS;
  3727. }();
  3728. var CalRGBCS = function CalRGBCSClosure() {
  3729. var BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  3730. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  3731. var 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]);
  3732. var FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  3733. var tempNormalizeMatrix = new Float32Array(3);
  3734. var tempConvertMatrix1 = new Float32Array(3);
  3735. var tempConvertMatrix2 = new Float32Array(3);
  3736. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  3737. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  3738. this.name = 'CalRGB';
  3739. this.numComps = 3;
  3740. this.defaultColor = new Float32Array(this.numComps);
  3741. if (!whitePoint) {
  3742. (0, _util.error)('WhitePoint missing - required for color space CalRGB');
  3743. }
  3744. blackPoint = blackPoint || new Float32Array(3);
  3745. gamma = gamma || new Float32Array([1, 1, 1]);
  3746. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  3747. var XW = whitePoint[0];
  3748. var YW = whitePoint[1];
  3749. var ZW = whitePoint[2];
  3750. this.whitePoint = whitePoint;
  3751. var XB = blackPoint[0];
  3752. var YB = blackPoint[1];
  3753. var ZB = blackPoint[2];
  3754. this.blackPoint = blackPoint;
  3755. this.GR = gamma[0];
  3756. this.GG = gamma[1];
  3757. this.GB = gamma[2];
  3758. this.MXA = matrix[0];
  3759. this.MYA = matrix[1];
  3760. this.MZA = matrix[2];
  3761. this.MXB = matrix[3];
  3762. this.MYB = matrix[4];
  3763. this.MZB = matrix[5];
  3764. this.MXC = matrix[6];
  3765. this.MYC = matrix[7];
  3766. this.MZC = matrix[8];
  3767. if (XW < 0 || ZW < 0 || YW !== 1) {
  3768. (0, _util.error)('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  3769. }
  3770. if (XB < 0 || YB < 0 || ZB < 0) {
  3771. (0, _util.info)('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  3772. this.blackPoint = new Float32Array(3);
  3773. }
  3774. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  3775. (0, _util.info)('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  3776. this.GR = this.GG = this.GB = 1;
  3777. }
  3778. if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) {
  3779. (0, _util.info)('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default');
  3780. this.MXA = this.MYB = this.MZC = 1;
  3781. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  3782. }
  3783. }
  3784. function matrixProduct(a, b, result) {
  3785. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  3786. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  3787. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  3788. }
  3789. function convertToFlat(sourceWhitePoint, LMS, result) {
  3790. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  3791. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  3792. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  3793. }
  3794. function convertToD65(sourceWhitePoint, LMS, result) {
  3795. var D65X = 0.95047;
  3796. var D65Y = 1;
  3797. var D65Z = 1.08883;
  3798. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  3799. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  3800. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  3801. }
  3802. function sRGBTransferFunction(color) {
  3803. if (color <= 0.0031308) {
  3804. return adjustToRange(0, 1, 12.92 * color);
  3805. }
  3806. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  3807. }
  3808. function adjustToRange(min, max, value) {
  3809. return Math.max(min, Math.min(max, value));
  3810. }
  3811. function decodeL(L) {
  3812. if (L < 0) {
  3813. return -decodeL(-L);
  3814. }
  3815. if (L > 8.0) {
  3816. return Math.pow((L + 16) / 116, 3);
  3817. }
  3818. return L * DECODE_L_CONSTANT;
  3819. }
  3820. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  3821. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  3822. result[0] = XYZ_Flat[0];
  3823. result[1] = XYZ_Flat[1];
  3824. result[2] = XYZ_Flat[2];
  3825. return;
  3826. }
  3827. var zeroDecodeL = decodeL(0);
  3828. var X_DST = zeroDecodeL;
  3829. var X_SRC = decodeL(sourceBlackPoint[0]);
  3830. var Y_DST = zeroDecodeL;
  3831. var Y_SRC = decodeL(sourceBlackPoint[1]);
  3832. var Z_DST = zeroDecodeL;
  3833. var Z_SRC = decodeL(sourceBlackPoint[2]);
  3834. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  3835. var X_Offset = 1 - X_Scale;
  3836. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  3837. var Y_Offset = 1 - Y_Scale;
  3838. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  3839. var Z_Offset = 1 - Z_Scale;
  3840. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  3841. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  3842. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  3843. }
  3844. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  3845. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  3846. result[0] = XYZ_In[0];
  3847. result[1] = XYZ_In[1];
  3848. result[2] = XYZ_In[2];
  3849. return;
  3850. }
  3851. var LMS = result;
  3852. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  3853. var LMS_Flat = tempNormalizeMatrix;
  3854. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  3855. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  3856. }
  3857. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  3858. var LMS = result;
  3859. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  3860. var LMS_D65 = tempNormalizeMatrix;
  3861. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  3862. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  3863. }
  3864. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  3865. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  3866. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  3867. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  3868. var AGR = Math.pow(A, cs.GR);
  3869. var BGG = Math.pow(B, cs.GG);
  3870. var CGB = Math.pow(C, cs.GB);
  3871. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  3872. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  3873. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  3874. var XYZ = tempConvertMatrix1;
  3875. XYZ[0] = X;
  3876. XYZ[1] = Y;
  3877. XYZ[2] = Z;
  3878. var XYZ_Flat = tempConvertMatrix2;
  3879. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  3880. var XYZ_Black = tempConvertMatrix1;
  3881. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  3882. var XYZ_D65 = tempConvertMatrix2;
  3883. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  3884. var SRGB = tempConvertMatrix1;
  3885. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  3886. var sR = sRGBTransferFunction(SRGB[0]);
  3887. var sG = sRGBTransferFunction(SRGB[1]);
  3888. var sB = sRGBTransferFunction(SRGB[2]);
  3889. dest[destOffset] = Math.round(sR * 255);
  3890. dest[destOffset + 1] = Math.round(sG * 255);
  3891. dest[destOffset + 2] = Math.round(sB * 255);
  3892. }
  3893. CalRGBCS.prototype = {
  3894. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  3895. var rgb = new Uint8Array(3);
  3896. this.getRgbItem(src, srcOffset, rgb, 0);
  3897. return rgb;
  3898. },
  3899. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  3900. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  3901. },
  3902. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  3903. var scale = 1 / ((1 << bits) - 1);
  3904. for (var i = 0; i < count; ++i) {
  3905. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  3906. srcOffset += 3;
  3907. destOffset += 3 + alpha01;
  3908. }
  3909. },
  3910. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  3911. return inputLength * (3 + alpha01) / 3 | 0;
  3912. },
  3913. isPassthrough: ColorSpace.prototype.isPassthrough,
  3914. fillRgb: ColorSpace.prototype.fillRgb,
  3915. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  3916. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  3917. },
  3918. usesZeroToOneRange: true
  3919. };
  3920. return CalRGBCS;
  3921. }();
  3922. var LabCS = function LabCSClosure() {
  3923. function LabCS(whitePoint, blackPoint, range) {
  3924. this.name = 'Lab';
  3925. this.numComps = 3;
  3926. this.defaultColor = new Float32Array(this.numComps);
  3927. if (!whitePoint) {
  3928. (0, _util.error)('WhitePoint missing - required for color space Lab');
  3929. }
  3930. blackPoint = blackPoint || [0, 0, 0];
  3931. range = range || [-100, 100, -100, 100];
  3932. this.XW = whitePoint[0];
  3933. this.YW = whitePoint[1];
  3934. this.ZW = whitePoint[2];
  3935. this.amin = range[0];
  3936. this.amax = range[1];
  3937. this.bmin = range[2];
  3938. this.bmax = range[3];
  3939. this.XB = blackPoint[0];
  3940. this.YB = blackPoint[1];
  3941. this.ZB = blackPoint[2];
  3942. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  3943. (0, _util.error)('Invalid WhitePoint components, no fallback available');
  3944. }
  3945. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  3946. (0, _util.info)('Invalid BlackPoint, falling back to default');
  3947. this.XB = this.YB = this.ZB = 0;
  3948. }
  3949. if (this.amin > this.amax || this.bmin > this.bmax) {
  3950. (0, _util.info)('Invalid Range, falling back to defaults');
  3951. this.amin = -100;
  3952. this.amax = 100;
  3953. this.bmin = -100;
  3954. this.bmax = 100;
  3955. }
  3956. }
  3957. function fn_g(x) {
  3958. var result;
  3959. if (x >= 6 / 29) {
  3960. result = x * x * x;
  3961. } else {
  3962. result = 108 / 841 * (x - 4 / 29);
  3963. }
  3964. return result;
  3965. }
  3966. function decode(value, high1, low2, high2) {
  3967. return low2 + value * (high2 - low2) / high1;
  3968. }
  3969. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  3970. var Ls = src[srcOffset];
  3971. var as = src[srcOffset + 1];
  3972. var bs = src[srcOffset + 2];
  3973. if (maxVal !== false) {
  3974. Ls = decode(Ls, maxVal, 0, 100);
  3975. as = decode(as, maxVal, cs.amin, cs.amax);
  3976. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  3977. }
  3978. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  3979. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  3980. var M = (Ls + 16) / 116;
  3981. var L = M + as / 500;
  3982. var N = M - bs / 200;
  3983. var X = cs.XW * fn_g(L);
  3984. var Y = cs.YW * fn_g(M);
  3985. var Z = cs.ZW * fn_g(N);
  3986. var r, g, b;
  3987. if (cs.ZW < 1) {
  3988. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  3989. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  3990. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  3991. } else {
  3992. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  3993. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  3994. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  3995. }
  3996. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  3997. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  3998. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  3999. }
  4000. LabCS.prototype = {
  4001. getRgb: ColorSpace.prototype.getRgb,
  4002. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  4003. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  4004. },
  4005. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  4006. var maxVal = (1 << bits) - 1;
  4007. for (var i = 0; i < count; i++) {
  4008. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  4009. srcOffset += 3;
  4010. destOffset += 3 + alpha01;
  4011. }
  4012. },
  4013. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  4014. return inputLength * (3 + alpha01) / 3 | 0;
  4015. },
  4016. isPassthrough: ColorSpace.prototype.isPassthrough,
  4017. fillRgb: ColorSpace.prototype.fillRgb,
  4018. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  4019. return true;
  4020. },
  4021. usesZeroToOneRange: false
  4022. };
  4023. return LabCS;
  4024. }();
  4025. exports.ColorSpace = ColorSpace;
  4026. /***/ }),
  4027. /* 4 */
  4028. /***/ (function(module, exports, __w_pdfjs_require__) {
  4029. "use strict";
  4030. Object.defineProperty(exports, "__esModule", {
  4031. value: true
  4032. });
  4033. var 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'];
  4034. var 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'];
  4035. var 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'];
  4036. var 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'];
  4037. var 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'];
  4038. var 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'];
  4039. var 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'];
  4040. function getEncoding(encodingName) {
  4041. switch (encodingName) {
  4042. case 'WinAnsiEncoding':
  4043. return WinAnsiEncoding;
  4044. case 'StandardEncoding':
  4045. return StandardEncoding;
  4046. case 'MacRomanEncoding':
  4047. return MacRomanEncoding;
  4048. case 'SymbolSetEncoding':
  4049. return SymbolSetEncoding;
  4050. case 'ZapfDingbatsEncoding':
  4051. return ZapfDingbatsEncoding;
  4052. case 'ExpertEncoding':
  4053. return ExpertEncoding;
  4054. case 'MacExpertEncoding':
  4055. return MacExpertEncoding;
  4056. default:
  4057. return null;
  4058. }
  4059. }
  4060. exports.WinAnsiEncoding = WinAnsiEncoding;
  4061. exports.StandardEncoding = StandardEncoding;
  4062. exports.MacRomanEncoding = MacRomanEncoding;
  4063. exports.SymbolSetEncoding = SymbolSetEncoding;
  4064. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4065. exports.ExpertEncoding = ExpertEncoding;
  4066. exports.getEncoding = getEncoding;
  4067. /***/ }),
  4068. /* 5 */
  4069. /***/ (function(module, exports, __w_pdfjs_require__) {
  4070. "use strict";
  4071. Object.defineProperty(exports, "__esModule", {
  4072. value: true
  4073. });
  4074. exports.Parser = exports.Linearization = exports.Lexer = undefined;
  4075. var _stream = __w_pdfjs_require__(2);
  4076. var _util = __w_pdfjs_require__(0);
  4077. var _primitives = __w_pdfjs_require__(1);
  4078. var MAX_LENGTH_TO_CACHE = 1000;
  4079. var Parser = function ParserClosure() {
  4080. function Parser(lexer, allowStreams, xref, recoveryMode) {
  4081. this.lexer = lexer;
  4082. this.allowStreams = allowStreams;
  4083. this.xref = xref;
  4084. this.recoveryMode = recoveryMode || false;
  4085. this.imageCache = Object.create(null);
  4086. this.refill();
  4087. }
  4088. Parser.prototype = {
  4089. refill: function Parser_refill() {
  4090. this.buf1 = this.lexer.getObj();
  4091. this.buf2 = this.lexer.getObj();
  4092. },
  4093. shift: function Parser_shift() {
  4094. if ((0, _primitives.isCmd)(this.buf2, 'ID')) {
  4095. this.buf1 = this.buf2;
  4096. this.buf2 = null;
  4097. } else {
  4098. this.buf1 = this.buf2;
  4099. this.buf2 = this.lexer.getObj();
  4100. }
  4101. },
  4102. tryShift: function Parser_tryShift() {
  4103. try {
  4104. this.shift();
  4105. return true;
  4106. } catch (e) {
  4107. if (e instanceof _util.MissingDataException) {
  4108. throw e;
  4109. }
  4110. return false;
  4111. }
  4112. },
  4113. getObj: function Parser_getObj(cipherTransform) {
  4114. var buf1 = this.buf1;
  4115. this.shift();
  4116. if (buf1 instanceof _primitives.Cmd) {
  4117. switch (buf1.cmd) {
  4118. case 'BI':
  4119. return this.makeInlineImage(cipherTransform);
  4120. case '[':
  4121. var array = [];
  4122. while (!(0, _primitives.isCmd)(this.buf1, ']') && !(0, _primitives.isEOF)(this.buf1)) {
  4123. array.push(this.getObj(cipherTransform));
  4124. }
  4125. if ((0, _primitives.isEOF)(this.buf1)) {
  4126. if (!this.recoveryMode) {
  4127. (0, _util.error)('End of file inside array');
  4128. }
  4129. return array;
  4130. }
  4131. this.shift();
  4132. return array;
  4133. case '<<':
  4134. var dict = new _primitives.Dict(this.xref);
  4135. while (!(0, _primitives.isCmd)(this.buf1, '>>') && !(0, _primitives.isEOF)(this.buf1)) {
  4136. if (!(0, _primitives.isName)(this.buf1)) {
  4137. (0, _util.info)('Malformed dictionary: key must be a name object');
  4138. this.shift();
  4139. continue;
  4140. }
  4141. var key = this.buf1.name;
  4142. this.shift();
  4143. if ((0, _primitives.isEOF)(this.buf1)) {
  4144. break;
  4145. }
  4146. dict.set(key, this.getObj(cipherTransform));
  4147. }
  4148. if ((0, _primitives.isEOF)(this.buf1)) {
  4149. if (!this.recoveryMode) {
  4150. (0, _util.error)('End of file inside dictionary');
  4151. }
  4152. return dict;
  4153. }
  4154. if ((0, _primitives.isCmd)(this.buf2, 'stream')) {
  4155. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  4156. }
  4157. this.shift();
  4158. return dict;
  4159. default:
  4160. return buf1;
  4161. }
  4162. }
  4163. if ((0, _util.isInt)(buf1)) {
  4164. var num = buf1;
  4165. if ((0, _util.isInt)(this.buf1) && (0, _primitives.isCmd)(this.buf2, 'R')) {
  4166. var ref = new _primitives.Ref(num, this.buf1);
  4167. this.shift();
  4168. this.shift();
  4169. return ref;
  4170. }
  4171. return num;
  4172. }
  4173. if ((0, _util.isString)(buf1)) {
  4174. var str = buf1;
  4175. if (cipherTransform) {
  4176. str = cipherTransform.decryptString(str);
  4177. }
  4178. return str;
  4179. }
  4180. return buf1;
  4181. },
  4182. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  4183. var E = 0x45,
  4184. I = 0x49,
  4185. SPACE = 0x20,
  4186. LF = 0xA,
  4187. CR = 0xD;
  4188. var startPos = stream.pos,
  4189. state = 0,
  4190. ch,
  4191. i,
  4192. n,
  4193. followingBytes;
  4194. while ((ch = stream.getByte()) !== -1) {
  4195. if (state === 0) {
  4196. state = ch === E ? 1 : 0;
  4197. } else if (state === 1) {
  4198. state = ch === I ? 2 : 0;
  4199. } else {
  4200. (0, _util.assert)(state === 2);
  4201. if (ch === SPACE || ch === LF || ch === CR) {
  4202. n = 5;
  4203. followingBytes = stream.peekBytes(n);
  4204. for (i = 0; i < n; i++) {
  4205. ch = followingBytes[i];
  4206. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  4207. state = 0;
  4208. break;
  4209. }
  4210. }
  4211. if (state === 2) {
  4212. break;
  4213. }
  4214. } else {
  4215. state = 0;
  4216. }
  4217. }
  4218. }
  4219. return stream.pos - 4 - startPos;
  4220. },
  4221. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  4222. var startPos = stream.pos,
  4223. foundEOI = false,
  4224. b,
  4225. markerLength,
  4226. length;
  4227. while ((b = stream.getByte()) !== -1) {
  4228. if (b !== 0xFF) {
  4229. continue;
  4230. }
  4231. switch (stream.getByte()) {
  4232. case 0x00:
  4233. break;
  4234. case 0xFF:
  4235. stream.skip(-1);
  4236. break;
  4237. case 0xD9:
  4238. foundEOI = true;
  4239. break;
  4240. case 0xC0:
  4241. case 0xC1:
  4242. case 0xC2:
  4243. case 0xC3:
  4244. case 0xC5:
  4245. case 0xC6:
  4246. case 0xC7:
  4247. case 0xC9:
  4248. case 0xCA:
  4249. case 0xCB:
  4250. case 0xCD:
  4251. case 0xCE:
  4252. case 0xCF:
  4253. case 0xC4:
  4254. case 0xCC:
  4255. case 0xDA:
  4256. case 0xDB:
  4257. case 0xDC:
  4258. case 0xDD:
  4259. case 0xDE:
  4260. case 0xDF:
  4261. case 0xE0:
  4262. case 0xE1:
  4263. case 0xE2:
  4264. case 0xE3:
  4265. case 0xE4:
  4266. case 0xE5:
  4267. case 0xE6:
  4268. case 0xE7:
  4269. case 0xE8:
  4270. case 0xE9:
  4271. case 0xEA:
  4272. case 0xEB:
  4273. case 0xEC:
  4274. case 0xED:
  4275. case 0xEE:
  4276. case 0xEF:
  4277. case 0xFE:
  4278. markerLength = stream.getUint16();
  4279. if (markerLength > 2) {
  4280. stream.skip(markerLength - 2);
  4281. } else {
  4282. stream.skip(-2);
  4283. }
  4284. break;
  4285. }
  4286. if (foundEOI) {
  4287. break;
  4288. }
  4289. }
  4290. length = stream.pos - startPos;
  4291. if (b === -1) {
  4292. (0, _util.warn)('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  4293. stream.skip(-length);
  4294. return this.findDefaultInlineStreamEnd(stream);
  4295. }
  4296. this.inlineStreamSkipEI(stream);
  4297. return length;
  4298. },
  4299. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  4300. var TILDE = 0x7E,
  4301. GT = 0x3E;
  4302. var startPos = stream.pos,
  4303. ch,
  4304. length;
  4305. while ((ch = stream.getByte()) !== -1) {
  4306. if (ch === TILDE && stream.peekByte() === GT) {
  4307. stream.skip();
  4308. break;
  4309. }
  4310. }
  4311. length = stream.pos - startPos;
  4312. if (ch === -1) {
  4313. (0, _util.warn)('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  4314. stream.skip(-length);
  4315. return this.findDefaultInlineStreamEnd(stream);
  4316. }
  4317. this.inlineStreamSkipEI(stream);
  4318. return length;
  4319. },
  4320. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  4321. var GT = 0x3E;
  4322. var startPos = stream.pos,
  4323. ch,
  4324. length;
  4325. while ((ch = stream.getByte()) !== -1) {
  4326. if (ch === GT) {
  4327. break;
  4328. }
  4329. }
  4330. length = stream.pos - startPos;
  4331. if (ch === -1) {
  4332. (0, _util.warn)('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  4333. stream.skip(-length);
  4334. return this.findDefaultInlineStreamEnd(stream);
  4335. }
  4336. this.inlineStreamSkipEI(stream);
  4337. return length;
  4338. },
  4339. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  4340. var E = 0x45,
  4341. I = 0x49;
  4342. var state = 0,
  4343. ch;
  4344. while ((ch = stream.getByte()) !== -1) {
  4345. if (state === 0) {
  4346. state = ch === E ? 1 : 0;
  4347. } else if (state === 1) {
  4348. state = ch === I ? 2 : 0;
  4349. } else if (state === 2) {
  4350. break;
  4351. }
  4352. }
  4353. },
  4354. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  4355. var lexer = this.lexer;
  4356. var stream = lexer.stream;
  4357. var dict = new _primitives.Dict(this.xref);
  4358. while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) {
  4359. if (!(0, _primitives.isName)(this.buf1)) {
  4360. (0, _util.error)('Dictionary key must be a name object');
  4361. }
  4362. var key = this.buf1.name;
  4363. this.shift();
  4364. if ((0, _primitives.isEOF)(this.buf1)) {
  4365. break;
  4366. }
  4367. dict.set(key, this.getObj(cipherTransform));
  4368. }
  4369. var filter = dict.get('Filter', 'F'),
  4370. filterName;
  4371. if ((0, _primitives.isName)(filter)) {
  4372. filterName = filter.name;
  4373. } else if ((0, _util.isArray)(filter)) {
  4374. var filterZero = this.xref.fetchIfRef(filter[0]);
  4375. if ((0, _primitives.isName)(filterZero)) {
  4376. filterName = filterZero.name;
  4377. }
  4378. }
  4379. var startPos = stream.pos,
  4380. length,
  4381. i,
  4382. ii;
  4383. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  4384. length = this.findDCTDecodeInlineStreamEnd(stream);
  4385. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  4386. length = this.findASCII85DecodeInlineStreamEnd(stream);
  4387. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  4388. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  4389. } else {
  4390. length = this.findDefaultInlineStreamEnd(stream);
  4391. }
  4392. var imageStream = stream.makeSubStream(startPos, length, dict);
  4393. var adler32;
  4394. if (length < MAX_LENGTH_TO_CACHE) {
  4395. var imageBytes = imageStream.getBytes();
  4396. imageStream.reset();
  4397. var a = 1;
  4398. var b = 0;
  4399. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  4400. a += imageBytes[i] & 0xff;
  4401. b += a;
  4402. }
  4403. adler32 = b % 65521 << 16 | a % 65521;
  4404. if (this.imageCache.adler32 === adler32) {
  4405. this.buf2 = _primitives.Cmd.get('EI');
  4406. this.shift();
  4407. this.imageCache[adler32].reset();
  4408. return this.imageCache[adler32];
  4409. }
  4410. }
  4411. if (cipherTransform) {
  4412. imageStream = cipherTransform.createStream(imageStream, length);
  4413. }
  4414. imageStream = this.filter(imageStream, dict, length);
  4415. imageStream.dict = dict;
  4416. if (adler32 !== undefined) {
  4417. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  4418. this.imageCache[adler32] = imageStream;
  4419. }
  4420. this.buf2 = _primitives.Cmd.get('EI');
  4421. this.shift();
  4422. return imageStream;
  4423. },
  4424. makeStream: function Parser_makeStream(dict, cipherTransform) {
  4425. var lexer = this.lexer;
  4426. var stream = lexer.stream;
  4427. lexer.skipToNextLine();
  4428. var pos = stream.pos - 1;
  4429. var length = dict.get('Length');
  4430. if (!(0, _util.isInt)(length)) {
  4431. (0, _util.info)('Bad ' + length + ' attribute in stream');
  4432. length = 0;
  4433. }
  4434. stream.pos = pos + length;
  4435. lexer.nextChar();
  4436. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, 'endstream')) {
  4437. this.shift();
  4438. } else {
  4439. stream.pos = pos;
  4440. var SCAN_BLOCK_SIZE = 2048;
  4441. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  4442. var ENDSTREAM_SIGNATURE = [0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D];
  4443. var skipped = 0,
  4444. found = false,
  4445. i,
  4446. j;
  4447. while (stream.pos < stream.end) {
  4448. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  4449. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  4450. if (scanLength <= 0) {
  4451. break;
  4452. }
  4453. found = false;
  4454. i = 0;
  4455. while (i < scanLength) {
  4456. j = 0;
  4457. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  4458. j++;
  4459. }
  4460. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  4461. found = true;
  4462. break;
  4463. }
  4464. i++;
  4465. }
  4466. if (found) {
  4467. skipped += i;
  4468. stream.pos += i;
  4469. break;
  4470. }
  4471. skipped += scanLength;
  4472. stream.pos += scanLength;
  4473. }
  4474. if (!found) {
  4475. (0, _util.error)('Missing endstream');
  4476. }
  4477. length = skipped;
  4478. lexer.nextChar();
  4479. this.shift();
  4480. this.shift();
  4481. }
  4482. this.shift();
  4483. stream = stream.makeSubStream(pos, length, dict);
  4484. if (cipherTransform) {
  4485. stream = cipherTransform.createStream(stream, length);
  4486. }
  4487. stream = this.filter(stream, dict, length);
  4488. stream.dict = dict;
  4489. return stream;
  4490. },
  4491. filter: function Parser_filter(stream, dict, length) {
  4492. var filter = dict.get('Filter', 'F');
  4493. var params = dict.get('DecodeParms', 'DP');
  4494. if ((0, _primitives.isName)(filter)) {
  4495. if ((0, _util.isArray)(params)) {
  4496. params = this.xref.fetchIfRef(params[0]);
  4497. }
  4498. return this.makeFilter(stream, filter.name, length, params);
  4499. }
  4500. var maybeLength = length;
  4501. if ((0, _util.isArray)(filter)) {
  4502. var filterArray = filter;
  4503. var paramsArray = params;
  4504. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  4505. filter = this.xref.fetchIfRef(filterArray[i]);
  4506. if (!(0, _primitives.isName)(filter)) {
  4507. (0, _util.error)('Bad filter name: ' + filter);
  4508. }
  4509. params = null;
  4510. if ((0, _util.isArray)(paramsArray) && i in paramsArray) {
  4511. params = this.xref.fetchIfRef(paramsArray[i]);
  4512. }
  4513. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  4514. maybeLength = null;
  4515. }
  4516. }
  4517. return stream;
  4518. },
  4519. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  4520. if (maybeLength === 0) {
  4521. (0, _util.warn)('Empty "' + name + '" stream.');
  4522. return new _stream.NullStream(stream);
  4523. }
  4524. try {
  4525. var xrefStreamStats = this.xref.stats.streamTypes;
  4526. if (name === 'FlateDecode' || name === 'Fl') {
  4527. xrefStreamStats[_util.StreamType.FLATE] = true;
  4528. if (params) {
  4529. return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
  4530. }
  4531. return new _stream.FlateStream(stream, maybeLength);
  4532. }
  4533. if (name === 'LZWDecode' || name === 'LZW') {
  4534. xrefStreamStats[_util.StreamType.LZW] = true;
  4535. var earlyChange = 1;
  4536. if (params) {
  4537. if (params.has('EarlyChange')) {
  4538. earlyChange = params.get('EarlyChange');
  4539. }
  4540. return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  4541. }
  4542. return new _stream.LZWStream(stream, maybeLength, earlyChange);
  4543. }
  4544. if (name === 'DCTDecode' || name === 'DCT') {
  4545. xrefStreamStats[_util.StreamType.DCT] = true;
  4546. return new _stream.JpegStream(stream, maybeLength, stream.dict, params);
  4547. }
  4548. if (name === 'JPXDecode' || name === 'JPX') {
  4549. xrefStreamStats[_util.StreamType.JPX] = true;
  4550. return new _stream.JpxStream(stream, maybeLength, stream.dict, params);
  4551. }
  4552. if (name === 'ASCII85Decode' || name === 'A85') {
  4553. xrefStreamStats[_util.StreamType.A85] = true;
  4554. return new _stream.Ascii85Stream(stream, maybeLength);
  4555. }
  4556. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  4557. xrefStreamStats[_util.StreamType.AHX] = true;
  4558. return new _stream.AsciiHexStream(stream, maybeLength);
  4559. }
  4560. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  4561. xrefStreamStats[_util.StreamType.CCF] = true;
  4562. return new _stream.CCITTFaxStream(stream, maybeLength, params);
  4563. }
  4564. if (name === 'RunLengthDecode' || name === 'RL') {
  4565. xrefStreamStats[_util.StreamType.RL] = true;
  4566. return new _stream.RunLengthStream(stream, maybeLength);
  4567. }
  4568. if (name === 'JBIG2Decode') {
  4569. xrefStreamStats[_util.StreamType.JBIG] = true;
  4570. return new _stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
  4571. }
  4572. (0, _util.warn)('filter "' + name + '" not supported yet');
  4573. return stream;
  4574. } catch (ex) {
  4575. if (ex instanceof _util.MissingDataException) {
  4576. throw ex;
  4577. }
  4578. (0, _util.warn)('Invalid stream: \"' + ex + '\"');
  4579. return new _stream.NullStream(stream);
  4580. }
  4581. }
  4582. };
  4583. return Parser;
  4584. }();
  4585. var Lexer = function LexerClosure() {
  4586. function Lexer(stream, knownCommands) {
  4587. this.stream = stream;
  4588. this.nextChar();
  4589. this.strBuf = [];
  4590. this.knownCommands = knownCommands;
  4591. }
  4592. var 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];
  4593. function toHexDigit(ch) {
  4594. if (ch >= 0x30 && ch <= 0x39) {
  4595. return ch & 0x0F;
  4596. }
  4597. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  4598. return (ch & 0x0F) + 9;
  4599. }
  4600. return -1;
  4601. }
  4602. Lexer.prototype = {
  4603. nextChar: function Lexer_nextChar() {
  4604. return this.currentChar = this.stream.getByte();
  4605. },
  4606. peekChar: function Lexer_peekChar() {
  4607. return this.stream.peekByte();
  4608. },
  4609. getNumber: function Lexer_getNumber() {
  4610. var ch = this.currentChar;
  4611. var eNotation = false;
  4612. var divideBy = 0;
  4613. var sign = 1;
  4614. if (ch === 0x2D) {
  4615. sign = -1;
  4616. ch = this.nextChar();
  4617. if (ch === 0x2D) {
  4618. ch = this.nextChar();
  4619. }
  4620. } else if (ch === 0x2B) {
  4621. ch = this.nextChar();
  4622. }
  4623. if (ch === 0x2E) {
  4624. divideBy = 10;
  4625. ch = this.nextChar();
  4626. }
  4627. if (ch === 0x0A || ch === 0x0D) {
  4628. do {
  4629. ch = this.nextChar();
  4630. } while (ch === 0x0A || ch === 0x0D);
  4631. }
  4632. if (ch < 0x30 || ch > 0x39) {
  4633. (0, _util.error)('Invalid number: ' + String.fromCharCode(ch) + ' (charCode ' + ch + ')');
  4634. }
  4635. var baseValue = ch - 0x30;
  4636. var powerValue = 0;
  4637. var powerValueSign = 1;
  4638. while ((ch = this.nextChar()) >= 0) {
  4639. if (0x30 <= ch && ch <= 0x39) {
  4640. var currentDigit = ch - 0x30;
  4641. if (eNotation) {
  4642. powerValue = powerValue * 10 + currentDigit;
  4643. } else {
  4644. if (divideBy !== 0) {
  4645. divideBy *= 10;
  4646. }
  4647. baseValue = baseValue * 10 + currentDigit;
  4648. }
  4649. } else if (ch === 0x2E) {
  4650. if (divideBy === 0) {
  4651. divideBy = 1;
  4652. } else {
  4653. break;
  4654. }
  4655. } else if (ch === 0x2D) {
  4656. (0, _util.warn)('Badly formatted number');
  4657. } else if (ch === 0x45 || ch === 0x65) {
  4658. ch = this.peekChar();
  4659. if (ch === 0x2B || ch === 0x2D) {
  4660. powerValueSign = ch === 0x2D ? -1 : 1;
  4661. this.nextChar();
  4662. } else if (ch < 0x30 || ch > 0x39) {
  4663. break;
  4664. }
  4665. eNotation = true;
  4666. } else {
  4667. break;
  4668. }
  4669. }
  4670. if (divideBy !== 0) {
  4671. baseValue /= divideBy;
  4672. }
  4673. if (eNotation) {
  4674. baseValue *= Math.pow(10, powerValueSign * powerValue);
  4675. }
  4676. return sign * baseValue;
  4677. },
  4678. getString: function Lexer_getString() {
  4679. var numParen = 1;
  4680. var done = false;
  4681. var strBuf = this.strBuf;
  4682. strBuf.length = 0;
  4683. var ch = this.nextChar();
  4684. while (true) {
  4685. var charBuffered = false;
  4686. switch (ch | 0) {
  4687. case -1:
  4688. (0, _util.warn)('Unterminated string');
  4689. done = true;
  4690. break;
  4691. case 0x28:
  4692. ++numParen;
  4693. strBuf.push('(');
  4694. break;
  4695. case 0x29:
  4696. if (--numParen === 0) {
  4697. this.nextChar();
  4698. done = true;
  4699. } else {
  4700. strBuf.push(')');
  4701. }
  4702. break;
  4703. case 0x5C:
  4704. ch = this.nextChar();
  4705. switch (ch) {
  4706. case -1:
  4707. (0, _util.warn)('Unterminated string');
  4708. done = true;
  4709. break;
  4710. case 0x6E:
  4711. strBuf.push('\n');
  4712. break;
  4713. case 0x72:
  4714. strBuf.push('\r');
  4715. break;
  4716. case 0x74:
  4717. strBuf.push('\t');
  4718. break;
  4719. case 0x62:
  4720. strBuf.push('\b');
  4721. break;
  4722. case 0x66:
  4723. strBuf.push('\f');
  4724. break;
  4725. case 0x5C:
  4726. case 0x28:
  4727. case 0x29:
  4728. strBuf.push(String.fromCharCode(ch));
  4729. break;
  4730. case 0x30:
  4731. case 0x31:
  4732. case 0x32:
  4733. case 0x33:
  4734. case 0x34:
  4735. case 0x35:
  4736. case 0x36:
  4737. case 0x37:
  4738. var x = ch & 0x0F;
  4739. ch = this.nextChar();
  4740. charBuffered = true;
  4741. if (ch >= 0x30 && ch <= 0x37) {
  4742. x = (x << 3) + (ch & 0x0F);
  4743. ch = this.nextChar();
  4744. if (ch >= 0x30 && ch <= 0x37) {
  4745. charBuffered = false;
  4746. x = (x << 3) + (ch & 0x0F);
  4747. }
  4748. }
  4749. strBuf.push(String.fromCharCode(x));
  4750. break;
  4751. case 0x0D:
  4752. if (this.peekChar() === 0x0A) {
  4753. this.nextChar();
  4754. }
  4755. break;
  4756. case 0x0A:
  4757. break;
  4758. default:
  4759. strBuf.push(String.fromCharCode(ch));
  4760. break;
  4761. }
  4762. break;
  4763. default:
  4764. strBuf.push(String.fromCharCode(ch));
  4765. break;
  4766. }
  4767. if (done) {
  4768. break;
  4769. }
  4770. if (!charBuffered) {
  4771. ch = this.nextChar();
  4772. }
  4773. }
  4774. return strBuf.join('');
  4775. },
  4776. getName: function Lexer_getName() {
  4777. var ch, previousCh;
  4778. var strBuf = this.strBuf;
  4779. strBuf.length = 0;
  4780. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  4781. if (ch === 0x23) {
  4782. ch = this.nextChar();
  4783. if (specialChars[ch]) {
  4784. (0, _util.warn)('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  4785. strBuf.push('#');
  4786. break;
  4787. }
  4788. var x = toHexDigit(ch);
  4789. if (x !== -1) {
  4790. previousCh = ch;
  4791. ch = this.nextChar();
  4792. var x2 = toHexDigit(ch);
  4793. if (x2 === -1) {
  4794. (0, _util.warn)('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  4795. strBuf.push('#', String.fromCharCode(previousCh));
  4796. if (specialChars[ch]) {
  4797. break;
  4798. }
  4799. strBuf.push(String.fromCharCode(ch));
  4800. continue;
  4801. }
  4802. strBuf.push(String.fromCharCode(x << 4 | x2));
  4803. } else {
  4804. strBuf.push('#', String.fromCharCode(ch));
  4805. }
  4806. } else {
  4807. strBuf.push(String.fromCharCode(ch));
  4808. }
  4809. }
  4810. if (strBuf.length > 127) {
  4811. (0, _util.warn)('name token is longer than allowed by the spec: ' + strBuf.length);
  4812. }
  4813. return _primitives.Name.get(strBuf.join(''));
  4814. },
  4815. getHexString: function Lexer_getHexString() {
  4816. var strBuf = this.strBuf;
  4817. strBuf.length = 0;
  4818. var ch = this.currentChar;
  4819. var isFirstHex = true;
  4820. var firstDigit;
  4821. var secondDigit;
  4822. while (true) {
  4823. if (ch < 0) {
  4824. (0, _util.warn)('Unterminated hex string');
  4825. break;
  4826. } else if (ch === 0x3E) {
  4827. this.nextChar();
  4828. break;
  4829. } else if (specialChars[ch] === 1) {
  4830. ch = this.nextChar();
  4831. continue;
  4832. } else {
  4833. if (isFirstHex) {
  4834. firstDigit = toHexDigit(ch);
  4835. if (firstDigit === -1) {
  4836. (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string');
  4837. ch = this.nextChar();
  4838. continue;
  4839. }
  4840. } else {
  4841. secondDigit = toHexDigit(ch);
  4842. if (secondDigit === -1) {
  4843. (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string');
  4844. ch = this.nextChar();
  4845. continue;
  4846. }
  4847. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  4848. }
  4849. isFirstHex = !isFirstHex;
  4850. ch = this.nextChar();
  4851. }
  4852. }
  4853. return strBuf.join('');
  4854. },
  4855. getObj: function Lexer_getObj() {
  4856. var comment = false;
  4857. var ch = this.currentChar;
  4858. while (true) {
  4859. if (ch < 0) {
  4860. return _primitives.EOF;
  4861. }
  4862. if (comment) {
  4863. if (ch === 0x0A || ch === 0x0D) {
  4864. comment = false;
  4865. }
  4866. } else if (ch === 0x25) {
  4867. comment = true;
  4868. } else if (specialChars[ch] !== 1) {
  4869. break;
  4870. }
  4871. ch = this.nextChar();
  4872. }
  4873. switch (ch | 0) {
  4874. case 0x30:
  4875. case 0x31:
  4876. case 0x32:
  4877. case 0x33:
  4878. case 0x34:
  4879. case 0x35:
  4880. case 0x36:
  4881. case 0x37:
  4882. case 0x38:
  4883. case 0x39:
  4884. case 0x2B:
  4885. case 0x2D:
  4886. case 0x2E:
  4887. return this.getNumber();
  4888. case 0x28:
  4889. return this.getString();
  4890. case 0x2F:
  4891. return this.getName();
  4892. case 0x5B:
  4893. this.nextChar();
  4894. return _primitives.Cmd.get('[');
  4895. case 0x5D:
  4896. this.nextChar();
  4897. return _primitives.Cmd.get(']');
  4898. case 0x3C:
  4899. ch = this.nextChar();
  4900. if (ch === 0x3C) {
  4901. this.nextChar();
  4902. return _primitives.Cmd.get('<<');
  4903. }
  4904. return this.getHexString();
  4905. case 0x3E:
  4906. ch = this.nextChar();
  4907. if (ch === 0x3E) {
  4908. this.nextChar();
  4909. return _primitives.Cmd.get('>>');
  4910. }
  4911. return _primitives.Cmd.get('>');
  4912. case 0x7B:
  4913. this.nextChar();
  4914. return _primitives.Cmd.get('{');
  4915. case 0x7D:
  4916. this.nextChar();
  4917. return _primitives.Cmd.get('}');
  4918. case 0x29:
  4919. this.nextChar();
  4920. (0, _util.error)('Illegal character: ' + ch);
  4921. break;
  4922. }
  4923. var str = String.fromCharCode(ch);
  4924. var knownCommands = this.knownCommands;
  4925. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  4926. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  4927. var possibleCommand = str + String.fromCharCode(ch);
  4928. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  4929. break;
  4930. }
  4931. if (str.length === 128) {
  4932. (0, _util.error)('Command token too long: ' + str.length);
  4933. }
  4934. str = possibleCommand;
  4935. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  4936. }
  4937. if (str === 'true') {
  4938. return true;
  4939. }
  4940. if (str === 'false') {
  4941. return false;
  4942. }
  4943. if (str === 'null') {
  4944. return null;
  4945. }
  4946. return _primitives.Cmd.get(str);
  4947. },
  4948. skipToNextLine: function Lexer_skipToNextLine() {
  4949. var ch = this.currentChar;
  4950. while (ch >= 0) {
  4951. if (ch === 0x0D) {
  4952. ch = this.nextChar();
  4953. if (ch === 0x0A) {
  4954. this.nextChar();
  4955. }
  4956. break;
  4957. } else if (ch === 0x0A) {
  4958. this.nextChar();
  4959. break;
  4960. }
  4961. ch = this.nextChar();
  4962. }
  4963. }
  4964. };
  4965. return Lexer;
  4966. }();
  4967. var Linearization = {
  4968. create: function LinearizationCreate(stream) {
  4969. function getInt(name, allowZeroValue) {
  4970. var obj = linDict.get(name);
  4971. if ((0, _util.isInt)(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  4972. return obj;
  4973. }
  4974. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  4975. }
  4976. function getHints() {
  4977. var hints = linDict.get('H'),
  4978. hintsLength,
  4979. item;
  4980. if ((0, _util.isArray)(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  4981. for (var index = 0; index < hintsLength; index++) {
  4982. if (!((0, _util.isInt)(item = hints[index]) && item > 0)) {
  4983. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  4984. }
  4985. }
  4986. return hints;
  4987. }
  4988. throw new Error('Hint array in the linearization dictionary is invalid.');
  4989. }
  4990. var parser = new Parser(new Lexer(stream), false, null);
  4991. var obj1 = parser.getObj();
  4992. var obj2 = parser.getObj();
  4993. var obj3 = parser.getObj();
  4994. var linDict = parser.getObj();
  4995. var obj, length;
  4996. if (!((0, _util.isInt)(obj1) && (0, _util.isInt)(obj2) && (0, _primitives.isCmd)(obj3, 'obj') && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get('Linearized')) && obj > 0)) {
  4997. return null;
  4998. } else if ((length = getInt('L')) !== stream.length) {
  4999. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  5000. }
  5001. return {
  5002. length: length,
  5003. hints: getHints(),
  5004. objectNumberFirst: getInt('O'),
  5005. endFirst: getInt('E'),
  5006. numPages: getInt('N'),
  5007. mainXRefEntriesOffset: getInt('T'),
  5008. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  5009. };
  5010. }
  5011. };
  5012. exports.Lexer = Lexer;
  5013. exports.Linearization = Linearization;
  5014. exports.Parser = Parser;
  5015. /***/ }),
  5016. /* 6 */
  5017. /***/ (function(module, exports, __w_pdfjs_require__) {
  5018. "use strict";
  5019. Object.defineProperty(exports, "__esModule", {
  5020. value: true
  5021. });
  5022. exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunction = exports.isPDFFunction = undefined;
  5023. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  5024. var _util = __w_pdfjs_require__(0);
  5025. var _primitives = __w_pdfjs_require__(1);
  5026. var _ps_parser = __w_pdfjs_require__(34);
  5027. var PDFFunction = function PDFFunctionClosure() {
  5028. var CONSTRUCT_SAMPLED = 0;
  5029. var CONSTRUCT_INTERPOLATED = 2;
  5030. var CONSTRUCT_STICHED = 3;
  5031. var CONSTRUCT_POSTSCRIPT = 4;
  5032. return {
  5033. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  5034. var i, ii;
  5035. var length = 1;
  5036. for (i = 0, ii = size.length; i < ii; i++) {
  5037. length *= size[i];
  5038. }
  5039. length *= outputSize;
  5040. var array = new Array(length);
  5041. var codeSize = 0;
  5042. var codeBuf = 0;
  5043. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  5044. var strBytes = str.getBytes((length * bps + 7) / 8);
  5045. var strIdx = 0;
  5046. for (i = 0; i < length; i++) {
  5047. while (codeSize < bps) {
  5048. codeBuf <<= 8;
  5049. codeBuf |= strBytes[strIdx++];
  5050. codeSize += 8;
  5051. }
  5052. codeSize -= bps;
  5053. array[i] = (codeBuf >> codeSize) * sampleMul;
  5054. codeBuf &= (1 << codeSize) - 1;
  5055. }
  5056. return array;
  5057. },
  5058. getIR: function PDFFunction_getIR(xref, fn) {
  5059. var dict = fn.dict;
  5060. if (!dict) {
  5061. dict = fn;
  5062. }
  5063. var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
  5064. var typeNum = dict.get('FunctionType');
  5065. var typeFn = types[typeNum];
  5066. if (!typeFn) {
  5067. (0, _util.error)('Unknown type of function');
  5068. }
  5069. return typeFn.call(this, fn, dict, xref);
  5070. },
  5071. fromIR: function PDFFunction_fromIR(IR) {
  5072. var type = IR[0];
  5073. switch (type) {
  5074. case CONSTRUCT_SAMPLED:
  5075. return this.constructSampledFromIR(IR);
  5076. case CONSTRUCT_INTERPOLATED:
  5077. return this.constructInterpolatedFromIR(IR);
  5078. case CONSTRUCT_STICHED:
  5079. return this.constructStichedFromIR(IR);
  5080. default:
  5081. return this.constructPostScriptFromIR(IR);
  5082. }
  5083. },
  5084. parse: function PDFFunction_parse(xref, fn) {
  5085. var IR = this.getIR(xref, fn);
  5086. return this.fromIR(IR);
  5087. },
  5088. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  5089. if (!(0, _util.isArray)(fnObj)) {
  5090. return this.parse(xref, fnObj);
  5091. }
  5092. var fnArray = [];
  5093. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  5094. var obj = xref.fetchIfRef(fnObj[j]);
  5095. fnArray.push(PDFFunction.parse(xref, obj));
  5096. }
  5097. return function (src, srcOffset, dest, destOffset) {
  5098. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  5099. fnArray[i](src, srcOffset, dest, destOffset + i);
  5100. }
  5101. };
  5102. },
  5103. constructSampled: function PDFFunction_constructSampled(str, dict) {
  5104. function toMultiArray(arr) {
  5105. var inputLength = arr.length;
  5106. var out = [];
  5107. var index = 0;
  5108. for (var i = 0; i < inputLength; i += 2) {
  5109. out[index] = [arr[i], arr[i + 1]];
  5110. ++index;
  5111. }
  5112. return out;
  5113. }
  5114. var domain = dict.getArray('Domain');
  5115. var range = dict.getArray('Range');
  5116. if (!domain || !range) {
  5117. (0, _util.error)('No domain or range');
  5118. }
  5119. var inputSize = domain.length / 2;
  5120. var outputSize = range.length / 2;
  5121. domain = toMultiArray(domain);
  5122. range = toMultiArray(range);
  5123. var size = dict.get('Size');
  5124. var bps = dict.get('BitsPerSample');
  5125. var order = dict.get('Order') || 1;
  5126. if (order !== 1) {
  5127. (0, _util.info)('No support for cubic spline interpolation: ' + order);
  5128. }
  5129. var encode = dict.getArray('Encode');
  5130. if (!encode) {
  5131. encode = [];
  5132. for (var i = 0; i < inputSize; ++i) {
  5133. encode.push(0);
  5134. encode.push(size[i] - 1);
  5135. }
  5136. }
  5137. encode = toMultiArray(encode);
  5138. var decode = dict.getArray('Decode');
  5139. if (!decode) {
  5140. decode = range;
  5141. } else {
  5142. decode = toMultiArray(decode);
  5143. }
  5144. var samples = this.getSampleArray(size, outputSize, bps, str);
  5145. return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, Math.pow(2, bps) - 1, range];
  5146. },
  5147. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  5148. function interpolate(x, xmin, xmax, ymin, ymax) {
  5149. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  5150. }
  5151. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  5152. var m = IR[1];
  5153. var domain = IR[2];
  5154. var encode = IR[3];
  5155. var decode = IR[4];
  5156. var samples = IR[5];
  5157. var size = IR[6];
  5158. var n = IR[7];
  5159. var range = IR[9];
  5160. var cubeVertices = 1 << m;
  5161. var cubeN = new Float64Array(cubeVertices);
  5162. var cubeVertex = new Uint32Array(cubeVertices);
  5163. var i, j;
  5164. for (j = 0; j < cubeVertices; j++) {
  5165. cubeN[j] = 1;
  5166. }
  5167. var k = n,
  5168. pos = 1;
  5169. for (i = 0; i < m; ++i) {
  5170. var domain_2i = domain[i][0];
  5171. var domain_2i_1 = domain[i][1];
  5172. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  5173. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  5174. var size_i = size[i];
  5175. e = Math.min(Math.max(e, 0), size_i - 1);
  5176. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  5177. var n0 = e0 + 1 - e;
  5178. var n1 = e - e0;
  5179. var offset0 = e0 * k;
  5180. var offset1 = offset0 + k;
  5181. for (j = 0; j < cubeVertices; j++) {
  5182. if (j & pos) {
  5183. cubeN[j] *= n1;
  5184. cubeVertex[j] += offset1;
  5185. } else {
  5186. cubeN[j] *= n0;
  5187. cubeVertex[j] += offset0;
  5188. }
  5189. }
  5190. k *= size_i;
  5191. pos <<= 1;
  5192. }
  5193. for (j = 0; j < n; ++j) {
  5194. var rj = 0;
  5195. for (i = 0; i < cubeVertices; i++) {
  5196. rj += samples[cubeVertex[i] + j] * cubeN[i];
  5197. }
  5198. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  5199. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  5200. }
  5201. };
  5202. },
  5203. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  5204. var c0 = dict.getArray('C0') || [0];
  5205. var c1 = dict.getArray('C1') || [1];
  5206. var n = dict.get('N');
  5207. if (!(0, _util.isArray)(c0) || !(0, _util.isArray)(c1)) {
  5208. (0, _util.error)('Illegal dictionary for interpolated function');
  5209. }
  5210. var length = c0.length;
  5211. var diff = [];
  5212. for (var i = 0; i < length; ++i) {
  5213. diff.push(c1[i] - c0[i]);
  5214. }
  5215. return [CONSTRUCT_INTERPOLATED, c0, diff, n];
  5216. },
  5217. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  5218. var c0 = IR[1];
  5219. var diff = IR[2];
  5220. var n = IR[3];
  5221. var length = diff.length;
  5222. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  5223. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  5224. for (var j = 0; j < length; ++j) {
  5225. dest[destOffset + j] = c0[j] + x * diff[j];
  5226. }
  5227. };
  5228. },
  5229. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  5230. var domain = dict.getArray('Domain');
  5231. if (!domain) {
  5232. (0, _util.error)('No domain');
  5233. }
  5234. var inputSize = domain.length / 2;
  5235. if (inputSize !== 1) {
  5236. (0, _util.error)('Bad domain for stiched function');
  5237. }
  5238. var fnRefs = dict.get('Functions');
  5239. var fns = [];
  5240. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  5241. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  5242. }
  5243. var bounds = dict.getArray('Bounds');
  5244. var encode = dict.getArray('Encode');
  5245. return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
  5246. },
  5247. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  5248. var domain = IR[1];
  5249. var bounds = IR[2];
  5250. var encode = IR[3];
  5251. var fnsIR = IR[4];
  5252. var fns = [];
  5253. var tmpBuf = new Float32Array(1);
  5254. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  5255. fns.push(PDFFunction.fromIR(fnsIR[i]));
  5256. }
  5257. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  5258. var clip = function constructStichedFromIRClip(v, min, max) {
  5259. if (v > max) {
  5260. v = max;
  5261. } else if (v < min) {
  5262. v = min;
  5263. }
  5264. return v;
  5265. };
  5266. var v = clip(src[srcOffset], domain[0], domain[1]);
  5267. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  5268. if (v < bounds[i]) {
  5269. break;
  5270. }
  5271. }
  5272. var dmin = domain[0];
  5273. if (i > 0) {
  5274. dmin = bounds[i - 1];
  5275. }
  5276. var dmax = domain[1];
  5277. if (i < bounds.length) {
  5278. dmax = bounds[i];
  5279. }
  5280. var rmin = encode[2 * i];
  5281. var rmax = encode[2 * i + 1];
  5282. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  5283. fns[i](tmpBuf, 0, dest, destOffset);
  5284. };
  5285. },
  5286. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  5287. var domain = dict.getArray('Domain');
  5288. var range = dict.getArray('Range');
  5289. if (!domain) {
  5290. (0, _util.error)('No domain.');
  5291. }
  5292. if (!range) {
  5293. (0, _util.error)('No range.');
  5294. }
  5295. var lexer = new _ps_parser.PostScriptLexer(fn);
  5296. var parser = new _ps_parser.PostScriptParser(lexer);
  5297. var code = parser.parse();
  5298. return [CONSTRUCT_POSTSCRIPT, domain, range, code];
  5299. },
  5300. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  5301. var domain = IR[1];
  5302. var range = IR[2];
  5303. var code = IR[3];
  5304. var compiled = new PostScriptCompiler().compile(code, domain, range);
  5305. if (compiled) {
  5306. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  5307. }
  5308. (0, _util.info)('Unable to compile PS function');
  5309. var numOutputs = range.length >> 1;
  5310. var numInputs = domain.length >> 1;
  5311. var evaluator = new PostScriptEvaluator(code);
  5312. var cache = Object.create(null);
  5313. var MAX_CACHE_SIZE = 2048 * 4;
  5314. var cache_available = MAX_CACHE_SIZE;
  5315. var tmpBuf = new Float32Array(numInputs);
  5316. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  5317. var i, value;
  5318. var key = '';
  5319. var input = tmpBuf;
  5320. for (i = 0; i < numInputs; i++) {
  5321. value = src[srcOffset + i];
  5322. input[i] = value;
  5323. key += value + '_';
  5324. }
  5325. var cachedValue = cache[key];
  5326. if (cachedValue !== undefined) {
  5327. dest.set(cachedValue, destOffset);
  5328. return;
  5329. }
  5330. var output = new Float32Array(numOutputs);
  5331. var stack = evaluator.execute(input);
  5332. var stackIndex = stack.length - numOutputs;
  5333. for (i = 0; i < numOutputs; i++) {
  5334. value = stack[stackIndex + i];
  5335. var bound = range[i * 2];
  5336. if (value < bound) {
  5337. value = bound;
  5338. } else {
  5339. bound = range[i * 2 + 1];
  5340. if (value > bound) {
  5341. value = bound;
  5342. }
  5343. }
  5344. output[i] = value;
  5345. }
  5346. if (cache_available > 0) {
  5347. cache_available--;
  5348. cache[key] = output;
  5349. }
  5350. dest.set(output, destOffset);
  5351. };
  5352. }
  5353. };
  5354. }();
  5355. function isPDFFunction(v) {
  5356. var fnDict;
  5357. if ((typeof v === 'undefined' ? 'undefined' : _typeof(v)) !== 'object') {
  5358. return false;
  5359. } else if ((0, _primitives.isDict)(v)) {
  5360. fnDict = v;
  5361. } else if ((0, _primitives.isStream)(v)) {
  5362. fnDict = v.dict;
  5363. } else {
  5364. return false;
  5365. }
  5366. return fnDict.has('FunctionType');
  5367. }
  5368. var PostScriptStack = function PostScriptStackClosure() {
  5369. var MAX_STACK_SIZE = 100;
  5370. function PostScriptStack(initialStack) {
  5371. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  5372. }
  5373. PostScriptStack.prototype = {
  5374. push: function PostScriptStack_push(value) {
  5375. if (this.stack.length >= MAX_STACK_SIZE) {
  5376. (0, _util.error)('PostScript function stack overflow.');
  5377. }
  5378. this.stack.push(value);
  5379. },
  5380. pop: function PostScriptStack_pop() {
  5381. if (this.stack.length <= 0) {
  5382. (0, _util.error)('PostScript function stack underflow.');
  5383. }
  5384. return this.stack.pop();
  5385. },
  5386. copy: function PostScriptStack_copy(n) {
  5387. if (this.stack.length + n >= MAX_STACK_SIZE) {
  5388. (0, _util.error)('PostScript function stack overflow.');
  5389. }
  5390. var stack = this.stack;
  5391. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  5392. stack.push(stack[i]);
  5393. }
  5394. },
  5395. index: function PostScriptStack_index(n) {
  5396. this.push(this.stack[this.stack.length - n - 1]);
  5397. },
  5398. roll: function PostScriptStack_roll(n, p) {
  5399. var stack = this.stack;
  5400. var l = stack.length - n;
  5401. var r = stack.length - 1,
  5402. c = l + (p - Math.floor(p / n) * n),
  5403. i,
  5404. j,
  5405. t;
  5406. for (i = l, j = r; i < j; i++, j--) {
  5407. t = stack[i];
  5408. stack[i] = stack[j];
  5409. stack[j] = t;
  5410. }
  5411. for (i = l, j = c - 1; i < j; i++, j--) {
  5412. t = stack[i];
  5413. stack[i] = stack[j];
  5414. stack[j] = t;
  5415. }
  5416. for (i = c, j = r; i < j; i++, j--) {
  5417. t = stack[i];
  5418. stack[i] = stack[j];
  5419. stack[j] = t;
  5420. }
  5421. }
  5422. };
  5423. return PostScriptStack;
  5424. }();
  5425. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  5426. function PostScriptEvaluator(operators) {
  5427. this.operators = operators;
  5428. }
  5429. PostScriptEvaluator.prototype = {
  5430. execute: function PostScriptEvaluator_execute(initialStack) {
  5431. var stack = new PostScriptStack(initialStack);
  5432. var counter = 0;
  5433. var operators = this.operators;
  5434. var length = operators.length;
  5435. var operator, a, b;
  5436. while (counter < length) {
  5437. operator = operators[counter++];
  5438. if (typeof operator === 'number') {
  5439. stack.push(operator);
  5440. continue;
  5441. }
  5442. switch (operator) {
  5443. case 'jz':
  5444. b = stack.pop();
  5445. a = stack.pop();
  5446. if (!a) {
  5447. counter = b;
  5448. }
  5449. break;
  5450. case 'j':
  5451. a = stack.pop();
  5452. counter = a;
  5453. break;
  5454. case 'abs':
  5455. a = stack.pop();
  5456. stack.push(Math.abs(a));
  5457. break;
  5458. case 'add':
  5459. b = stack.pop();
  5460. a = stack.pop();
  5461. stack.push(a + b);
  5462. break;
  5463. case 'and':
  5464. b = stack.pop();
  5465. a = stack.pop();
  5466. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  5467. stack.push(a && b);
  5468. } else {
  5469. stack.push(a & b);
  5470. }
  5471. break;
  5472. case 'atan':
  5473. a = stack.pop();
  5474. stack.push(Math.atan(a));
  5475. break;
  5476. case 'bitshift':
  5477. b = stack.pop();
  5478. a = stack.pop();
  5479. if (a > 0) {
  5480. stack.push(a << b);
  5481. } else {
  5482. stack.push(a >> b);
  5483. }
  5484. break;
  5485. case 'ceiling':
  5486. a = stack.pop();
  5487. stack.push(Math.ceil(a));
  5488. break;
  5489. case 'copy':
  5490. a = stack.pop();
  5491. stack.copy(a);
  5492. break;
  5493. case 'cos':
  5494. a = stack.pop();
  5495. stack.push(Math.cos(a));
  5496. break;
  5497. case 'cvi':
  5498. a = stack.pop() | 0;
  5499. stack.push(a);
  5500. break;
  5501. case 'cvr':
  5502. break;
  5503. case 'div':
  5504. b = stack.pop();
  5505. a = stack.pop();
  5506. stack.push(a / b);
  5507. break;
  5508. case 'dup':
  5509. stack.copy(1);
  5510. break;
  5511. case 'eq':
  5512. b = stack.pop();
  5513. a = stack.pop();
  5514. stack.push(a === b);
  5515. break;
  5516. case 'exch':
  5517. stack.roll(2, 1);
  5518. break;
  5519. case 'exp':
  5520. b = stack.pop();
  5521. a = stack.pop();
  5522. stack.push(Math.pow(a, b));
  5523. break;
  5524. case 'false':
  5525. stack.push(false);
  5526. break;
  5527. case 'floor':
  5528. a = stack.pop();
  5529. stack.push(Math.floor(a));
  5530. break;
  5531. case 'ge':
  5532. b = stack.pop();
  5533. a = stack.pop();
  5534. stack.push(a >= b);
  5535. break;
  5536. case 'gt':
  5537. b = stack.pop();
  5538. a = stack.pop();
  5539. stack.push(a > b);
  5540. break;
  5541. case 'idiv':
  5542. b = stack.pop();
  5543. a = stack.pop();
  5544. stack.push(a / b | 0);
  5545. break;
  5546. case 'index':
  5547. a = stack.pop();
  5548. stack.index(a);
  5549. break;
  5550. case 'le':
  5551. b = stack.pop();
  5552. a = stack.pop();
  5553. stack.push(a <= b);
  5554. break;
  5555. case 'ln':
  5556. a = stack.pop();
  5557. stack.push(Math.log(a));
  5558. break;
  5559. case 'log':
  5560. a = stack.pop();
  5561. stack.push(Math.log(a) / Math.LN10);
  5562. break;
  5563. case 'lt':
  5564. b = stack.pop();
  5565. a = stack.pop();
  5566. stack.push(a < b);
  5567. break;
  5568. case 'mod':
  5569. b = stack.pop();
  5570. a = stack.pop();
  5571. stack.push(a % b);
  5572. break;
  5573. case 'mul':
  5574. b = stack.pop();
  5575. a = stack.pop();
  5576. stack.push(a * b);
  5577. break;
  5578. case 'ne':
  5579. b = stack.pop();
  5580. a = stack.pop();
  5581. stack.push(a !== b);
  5582. break;
  5583. case 'neg':
  5584. a = stack.pop();
  5585. stack.push(-a);
  5586. break;
  5587. case 'not':
  5588. a = stack.pop();
  5589. if ((0, _util.isBool)(a)) {
  5590. stack.push(!a);
  5591. } else {
  5592. stack.push(~a);
  5593. }
  5594. break;
  5595. case 'or':
  5596. b = stack.pop();
  5597. a = stack.pop();
  5598. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  5599. stack.push(a || b);
  5600. } else {
  5601. stack.push(a | b);
  5602. }
  5603. break;
  5604. case 'pop':
  5605. stack.pop();
  5606. break;
  5607. case 'roll':
  5608. b = stack.pop();
  5609. a = stack.pop();
  5610. stack.roll(a, b);
  5611. break;
  5612. case 'round':
  5613. a = stack.pop();
  5614. stack.push(Math.round(a));
  5615. break;
  5616. case 'sin':
  5617. a = stack.pop();
  5618. stack.push(Math.sin(a));
  5619. break;
  5620. case 'sqrt':
  5621. a = stack.pop();
  5622. stack.push(Math.sqrt(a));
  5623. break;
  5624. case 'sub':
  5625. b = stack.pop();
  5626. a = stack.pop();
  5627. stack.push(a - b);
  5628. break;
  5629. case 'true':
  5630. stack.push(true);
  5631. break;
  5632. case 'truncate':
  5633. a = stack.pop();
  5634. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  5635. stack.push(a);
  5636. break;
  5637. case 'xor':
  5638. b = stack.pop();
  5639. a = stack.pop();
  5640. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  5641. stack.push(a !== b);
  5642. } else {
  5643. stack.push(a ^ b);
  5644. }
  5645. break;
  5646. default:
  5647. (0, _util.error)('Unknown operator ' + operator);
  5648. break;
  5649. }
  5650. }
  5651. return stack.stack;
  5652. }
  5653. };
  5654. return PostScriptEvaluator;
  5655. }();
  5656. var PostScriptCompiler = function PostScriptCompilerClosure() {
  5657. function AstNode(type) {
  5658. this.type = type;
  5659. }
  5660. AstNode.prototype.visit = function (visitor) {
  5661. throw new Error('abstract method');
  5662. };
  5663. function AstArgument(index, min, max) {
  5664. AstNode.call(this, 'args');
  5665. this.index = index;
  5666. this.min = min;
  5667. this.max = max;
  5668. }
  5669. AstArgument.prototype = Object.create(AstNode.prototype);
  5670. AstArgument.prototype.visit = function (visitor) {
  5671. visitor.visitArgument(this);
  5672. };
  5673. function AstLiteral(number) {
  5674. AstNode.call(this, 'literal');
  5675. this.number = number;
  5676. this.min = number;
  5677. this.max = number;
  5678. }
  5679. AstLiteral.prototype = Object.create(AstNode.prototype);
  5680. AstLiteral.prototype.visit = function (visitor) {
  5681. visitor.visitLiteral(this);
  5682. };
  5683. function AstBinaryOperation(op, arg1, arg2, min, max) {
  5684. AstNode.call(this, 'binary');
  5685. this.op = op;
  5686. this.arg1 = arg1;
  5687. this.arg2 = arg2;
  5688. this.min = min;
  5689. this.max = max;
  5690. }
  5691. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  5692. AstBinaryOperation.prototype.visit = function (visitor) {
  5693. visitor.visitBinaryOperation(this);
  5694. };
  5695. function AstMin(arg, max) {
  5696. AstNode.call(this, 'max');
  5697. this.arg = arg;
  5698. this.min = arg.min;
  5699. this.max = max;
  5700. }
  5701. AstMin.prototype = Object.create(AstNode.prototype);
  5702. AstMin.prototype.visit = function (visitor) {
  5703. visitor.visitMin(this);
  5704. };
  5705. function AstVariable(index, min, max) {
  5706. AstNode.call(this, 'var');
  5707. this.index = index;
  5708. this.min = min;
  5709. this.max = max;
  5710. }
  5711. AstVariable.prototype = Object.create(AstNode.prototype);
  5712. AstVariable.prototype.visit = function (visitor) {
  5713. visitor.visitVariable(this);
  5714. };
  5715. function AstVariableDefinition(variable, arg) {
  5716. AstNode.call(this, 'definition');
  5717. this.variable = variable;
  5718. this.arg = arg;
  5719. }
  5720. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  5721. AstVariableDefinition.prototype.visit = function (visitor) {
  5722. visitor.visitVariableDefinition(this);
  5723. };
  5724. function ExpressionBuilderVisitor() {
  5725. this.parts = [];
  5726. }
  5727. ExpressionBuilderVisitor.prototype = {
  5728. visitArgument: function visitArgument(arg) {
  5729. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  5730. },
  5731. visitVariable: function visitVariable(variable) {
  5732. this.parts.push('v', variable.index);
  5733. },
  5734. visitLiteral: function visitLiteral(literal) {
  5735. this.parts.push(literal.number);
  5736. },
  5737. visitBinaryOperation: function visitBinaryOperation(operation) {
  5738. this.parts.push('(');
  5739. operation.arg1.visit(this);
  5740. this.parts.push(' ', operation.op, ' ');
  5741. operation.arg2.visit(this);
  5742. this.parts.push(')');
  5743. },
  5744. visitVariableDefinition: function visitVariableDefinition(definition) {
  5745. this.parts.push('var ');
  5746. definition.variable.visit(this);
  5747. this.parts.push(' = ');
  5748. definition.arg.visit(this);
  5749. this.parts.push(';');
  5750. },
  5751. visitMin: function visitMin(max) {
  5752. this.parts.push('Math.min(');
  5753. max.arg.visit(this);
  5754. this.parts.push(', ', max.max, ')');
  5755. },
  5756. toString: function toString() {
  5757. return this.parts.join('');
  5758. }
  5759. };
  5760. function buildAddOperation(num1, num2) {
  5761. if (num2.type === 'literal' && num2.number === 0) {
  5762. return num1;
  5763. }
  5764. if (num1.type === 'literal' && num1.number === 0) {
  5765. return num2;
  5766. }
  5767. if (num2.type === 'literal' && num1.type === 'literal') {
  5768. return new AstLiteral(num1.number + num2.number);
  5769. }
  5770. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  5771. }
  5772. function buildMulOperation(num1, num2) {
  5773. if (num2.type === 'literal') {
  5774. if (num2.number === 0) {
  5775. return new AstLiteral(0);
  5776. } else if (num2.number === 1) {
  5777. return num1;
  5778. } else if (num1.type === 'literal') {
  5779. return new AstLiteral(num1.number * num2.number);
  5780. }
  5781. }
  5782. if (num1.type === 'literal') {
  5783. if (num1.number === 0) {
  5784. return new AstLiteral(0);
  5785. } else if (num1.number === 1) {
  5786. return num2;
  5787. }
  5788. }
  5789. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  5790. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  5791. return new AstBinaryOperation('*', num1, num2, min, max);
  5792. }
  5793. function buildSubOperation(num1, num2) {
  5794. if (num2.type === 'literal') {
  5795. if (num2.number === 0) {
  5796. return num1;
  5797. } else if (num1.type === 'literal') {
  5798. return new AstLiteral(num1.number - num2.number);
  5799. }
  5800. }
  5801. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  5802. return num2.arg2;
  5803. }
  5804. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  5805. }
  5806. function buildMinOperation(num1, max) {
  5807. if (num1.min >= max) {
  5808. return new AstLiteral(max);
  5809. } else if (num1.max <= max) {
  5810. return num1;
  5811. }
  5812. return new AstMin(num1, max);
  5813. }
  5814. function PostScriptCompiler() {}
  5815. PostScriptCompiler.prototype = {
  5816. compile: function PostScriptCompiler_compile(code, domain, range) {
  5817. var stack = [];
  5818. var i, ii;
  5819. var instructions = [];
  5820. var inputSize = domain.length >> 1,
  5821. outputSize = range.length >> 1;
  5822. var lastRegister = 0;
  5823. var n, j;
  5824. var num1, num2, ast1, ast2, tmpVar, item;
  5825. for (i = 0; i < inputSize; i++) {
  5826. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  5827. }
  5828. for (i = 0, ii = code.length; i < ii; i++) {
  5829. item = code[i];
  5830. if (typeof item === 'number') {
  5831. stack.push(new AstLiteral(item));
  5832. continue;
  5833. }
  5834. switch (item) {
  5835. case 'add':
  5836. if (stack.length < 2) {
  5837. return null;
  5838. }
  5839. num2 = stack.pop();
  5840. num1 = stack.pop();
  5841. stack.push(buildAddOperation(num1, num2));
  5842. break;
  5843. case 'cvr':
  5844. if (stack.length < 1) {
  5845. return null;
  5846. }
  5847. break;
  5848. case 'mul':
  5849. if (stack.length < 2) {
  5850. return null;
  5851. }
  5852. num2 = stack.pop();
  5853. num1 = stack.pop();
  5854. stack.push(buildMulOperation(num1, num2));
  5855. break;
  5856. case 'sub':
  5857. if (stack.length < 2) {
  5858. return null;
  5859. }
  5860. num2 = stack.pop();
  5861. num1 = stack.pop();
  5862. stack.push(buildSubOperation(num1, num2));
  5863. break;
  5864. case 'exch':
  5865. if (stack.length < 2) {
  5866. return null;
  5867. }
  5868. ast1 = stack.pop();
  5869. ast2 = stack.pop();
  5870. stack.push(ast1, ast2);
  5871. break;
  5872. case 'pop':
  5873. if (stack.length < 1) {
  5874. return null;
  5875. }
  5876. stack.pop();
  5877. break;
  5878. case 'index':
  5879. if (stack.length < 1) {
  5880. return null;
  5881. }
  5882. num1 = stack.pop();
  5883. if (num1.type !== 'literal') {
  5884. return null;
  5885. }
  5886. n = num1.number;
  5887. if (n < 0 || (n | 0) !== n || stack.length < n) {
  5888. return null;
  5889. }
  5890. ast1 = stack[stack.length - n - 1];
  5891. if (ast1.type === 'literal' || ast1.type === 'var') {
  5892. stack.push(ast1);
  5893. break;
  5894. }
  5895. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  5896. stack[stack.length - n - 1] = tmpVar;
  5897. stack.push(tmpVar);
  5898. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  5899. break;
  5900. case 'dup':
  5901. if (stack.length < 1) {
  5902. return null;
  5903. }
  5904. 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]) {
  5905. num1 = stack.pop();
  5906. stack.push(buildMinOperation(num1, code[i + 1]));
  5907. i += 6;
  5908. break;
  5909. }
  5910. ast1 = stack[stack.length - 1];
  5911. if (ast1.type === 'literal' || ast1.type === 'var') {
  5912. stack.push(ast1);
  5913. break;
  5914. }
  5915. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  5916. stack[stack.length - 1] = tmpVar;
  5917. stack.push(tmpVar);
  5918. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  5919. break;
  5920. case 'roll':
  5921. if (stack.length < 2) {
  5922. return null;
  5923. }
  5924. num2 = stack.pop();
  5925. num1 = stack.pop();
  5926. if (num2.type !== 'literal' || num1.type !== 'literal') {
  5927. return null;
  5928. }
  5929. j = num2.number;
  5930. n = num1.number;
  5931. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  5932. return null;
  5933. }
  5934. j = (j % n + n) % n;
  5935. if (j === 0) {
  5936. break;
  5937. }
  5938. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  5939. break;
  5940. default:
  5941. return null;
  5942. }
  5943. }
  5944. if (stack.length !== outputSize) {
  5945. return null;
  5946. }
  5947. var result = [];
  5948. instructions.forEach(function (instruction) {
  5949. var statementBuilder = new ExpressionBuilderVisitor();
  5950. instruction.visit(statementBuilder);
  5951. result.push(statementBuilder.toString());
  5952. });
  5953. stack.forEach(function (expr, i) {
  5954. var statementBuilder = new ExpressionBuilderVisitor();
  5955. expr.visit(statementBuilder);
  5956. var min = range[i * 2],
  5957. max = range[i * 2 + 1];
  5958. var out = [statementBuilder.toString()];
  5959. if (min > expr.min) {
  5960. out.unshift('Math.max(', min, ', ');
  5961. out.push(')');
  5962. }
  5963. if (max < expr.max) {
  5964. out.unshift('Math.min(', max, ', ');
  5965. out.push(')');
  5966. }
  5967. out.unshift('dest[destOffset + ', i, '] = ');
  5968. out.push(';');
  5969. result.push(out.join(''));
  5970. });
  5971. return result.join('\n');
  5972. }
  5973. };
  5974. return PostScriptCompiler;
  5975. }();
  5976. exports.isPDFFunction = isPDFFunction;
  5977. exports.PDFFunction = PDFFunction;
  5978. exports.PostScriptEvaluator = PostScriptEvaluator;
  5979. exports.PostScriptCompiler = PostScriptCompiler;
  5980. /***/ }),
  5981. /* 7 */
  5982. /***/ (function(module, exports, __w_pdfjs_require__) {
  5983. "use strict";
  5984. var getLookupTableFactory = __w_pdfjs_require__(0).getLookupTableFactory;
  5985. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  5986. t['A'] = 0x0041;
  5987. t['AE'] = 0x00C6;
  5988. t['AEacute'] = 0x01FC;
  5989. t['AEmacron'] = 0x01E2;
  5990. t['AEsmall'] = 0xF7E6;
  5991. t['Aacute'] = 0x00C1;
  5992. t['Aacutesmall'] = 0xF7E1;
  5993. t['Abreve'] = 0x0102;
  5994. t['Abreveacute'] = 0x1EAE;
  5995. t['Abrevecyrillic'] = 0x04D0;
  5996. t['Abrevedotbelow'] = 0x1EB6;
  5997. t['Abrevegrave'] = 0x1EB0;
  5998. t['Abrevehookabove'] = 0x1EB2;
  5999. t['Abrevetilde'] = 0x1EB4;
  6000. t['Acaron'] = 0x01CD;
  6001. t['Acircle'] = 0x24B6;
  6002. t['Acircumflex'] = 0x00C2;
  6003. t['Acircumflexacute'] = 0x1EA4;
  6004. t['Acircumflexdotbelow'] = 0x1EAC;
  6005. t['Acircumflexgrave'] = 0x1EA6;
  6006. t['Acircumflexhookabove'] = 0x1EA8;
  6007. t['Acircumflexsmall'] = 0xF7E2;
  6008. t['Acircumflextilde'] = 0x1EAA;
  6009. t['Acute'] = 0xF6C9;
  6010. t['Acutesmall'] = 0xF7B4;
  6011. t['Acyrillic'] = 0x0410;
  6012. t['Adblgrave'] = 0x0200;
  6013. t['Adieresis'] = 0x00C4;
  6014. t['Adieresiscyrillic'] = 0x04D2;
  6015. t['Adieresismacron'] = 0x01DE;
  6016. t['Adieresissmall'] = 0xF7E4;
  6017. t['Adotbelow'] = 0x1EA0;
  6018. t['Adotmacron'] = 0x01E0;
  6019. t['Agrave'] = 0x00C0;
  6020. t['Agravesmall'] = 0xF7E0;
  6021. t['Ahookabove'] = 0x1EA2;
  6022. t['Aiecyrillic'] = 0x04D4;
  6023. t['Ainvertedbreve'] = 0x0202;
  6024. t['Alpha'] = 0x0391;
  6025. t['Alphatonos'] = 0x0386;
  6026. t['Amacron'] = 0x0100;
  6027. t['Amonospace'] = 0xFF21;
  6028. t['Aogonek'] = 0x0104;
  6029. t['Aring'] = 0x00C5;
  6030. t['Aringacute'] = 0x01FA;
  6031. t['Aringbelow'] = 0x1E00;
  6032. t['Aringsmall'] = 0xF7E5;
  6033. t['Asmall'] = 0xF761;
  6034. t['Atilde'] = 0x00C3;
  6035. t['Atildesmall'] = 0xF7E3;
  6036. t['Aybarmenian'] = 0x0531;
  6037. t['B'] = 0x0042;
  6038. t['Bcircle'] = 0x24B7;
  6039. t['Bdotaccent'] = 0x1E02;
  6040. t['Bdotbelow'] = 0x1E04;
  6041. t['Becyrillic'] = 0x0411;
  6042. t['Benarmenian'] = 0x0532;
  6043. t['Beta'] = 0x0392;
  6044. t['Bhook'] = 0x0181;
  6045. t['Blinebelow'] = 0x1E06;
  6046. t['Bmonospace'] = 0xFF22;
  6047. t['Brevesmall'] = 0xF6F4;
  6048. t['Bsmall'] = 0xF762;
  6049. t['Btopbar'] = 0x0182;
  6050. t['C'] = 0x0043;
  6051. t['Caarmenian'] = 0x053E;
  6052. t['Cacute'] = 0x0106;
  6053. t['Caron'] = 0xF6CA;
  6054. t['Caronsmall'] = 0xF6F5;
  6055. t['Ccaron'] = 0x010C;
  6056. t['Ccedilla'] = 0x00C7;
  6057. t['Ccedillaacute'] = 0x1E08;
  6058. t['Ccedillasmall'] = 0xF7E7;
  6059. t['Ccircle'] = 0x24B8;
  6060. t['Ccircumflex'] = 0x0108;
  6061. t['Cdot'] = 0x010A;
  6062. t['Cdotaccent'] = 0x010A;
  6063. t['Cedillasmall'] = 0xF7B8;
  6064. t['Chaarmenian'] = 0x0549;
  6065. t['Cheabkhasiancyrillic'] = 0x04BC;
  6066. t['Checyrillic'] = 0x0427;
  6067. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  6068. t['Chedescendercyrillic'] = 0x04B6;
  6069. t['Chedieresiscyrillic'] = 0x04F4;
  6070. t['Cheharmenian'] = 0x0543;
  6071. t['Chekhakassiancyrillic'] = 0x04CB;
  6072. t['Cheverticalstrokecyrillic'] = 0x04B8;
  6073. t['Chi'] = 0x03A7;
  6074. t['Chook'] = 0x0187;
  6075. t['Circumflexsmall'] = 0xF6F6;
  6076. t['Cmonospace'] = 0xFF23;
  6077. t['Coarmenian'] = 0x0551;
  6078. t['Csmall'] = 0xF763;
  6079. t['D'] = 0x0044;
  6080. t['DZ'] = 0x01F1;
  6081. t['DZcaron'] = 0x01C4;
  6082. t['Daarmenian'] = 0x0534;
  6083. t['Dafrican'] = 0x0189;
  6084. t['Dcaron'] = 0x010E;
  6085. t['Dcedilla'] = 0x1E10;
  6086. t['Dcircle'] = 0x24B9;
  6087. t['Dcircumflexbelow'] = 0x1E12;
  6088. t['Dcroat'] = 0x0110;
  6089. t['Ddotaccent'] = 0x1E0A;
  6090. t['Ddotbelow'] = 0x1E0C;
  6091. t['Decyrillic'] = 0x0414;
  6092. t['Deicoptic'] = 0x03EE;
  6093. t['Delta'] = 0x2206;
  6094. t['Deltagreek'] = 0x0394;
  6095. t['Dhook'] = 0x018A;
  6096. t['Dieresis'] = 0xF6CB;
  6097. t['DieresisAcute'] = 0xF6CC;
  6098. t['DieresisGrave'] = 0xF6CD;
  6099. t['Dieresissmall'] = 0xF7A8;
  6100. t['Digammagreek'] = 0x03DC;
  6101. t['Djecyrillic'] = 0x0402;
  6102. t['Dlinebelow'] = 0x1E0E;
  6103. t['Dmonospace'] = 0xFF24;
  6104. t['Dotaccentsmall'] = 0xF6F7;
  6105. t['Dslash'] = 0x0110;
  6106. t['Dsmall'] = 0xF764;
  6107. t['Dtopbar'] = 0x018B;
  6108. t['Dz'] = 0x01F2;
  6109. t['Dzcaron'] = 0x01C5;
  6110. t['Dzeabkhasiancyrillic'] = 0x04E0;
  6111. t['Dzecyrillic'] = 0x0405;
  6112. t['Dzhecyrillic'] = 0x040F;
  6113. t['E'] = 0x0045;
  6114. t['Eacute'] = 0x00C9;
  6115. t['Eacutesmall'] = 0xF7E9;
  6116. t['Ebreve'] = 0x0114;
  6117. t['Ecaron'] = 0x011A;
  6118. t['Ecedillabreve'] = 0x1E1C;
  6119. t['Echarmenian'] = 0x0535;
  6120. t['Ecircle'] = 0x24BA;
  6121. t['Ecircumflex'] = 0x00CA;
  6122. t['Ecircumflexacute'] = 0x1EBE;
  6123. t['Ecircumflexbelow'] = 0x1E18;
  6124. t['Ecircumflexdotbelow'] = 0x1EC6;
  6125. t['Ecircumflexgrave'] = 0x1EC0;
  6126. t['Ecircumflexhookabove'] = 0x1EC2;
  6127. t['Ecircumflexsmall'] = 0xF7EA;
  6128. t['Ecircumflextilde'] = 0x1EC4;
  6129. t['Ecyrillic'] = 0x0404;
  6130. t['Edblgrave'] = 0x0204;
  6131. t['Edieresis'] = 0x00CB;
  6132. t['Edieresissmall'] = 0xF7EB;
  6133. t['Edot'] = 0x0116;
  6134. t['Edotaccent'] = 0x0116;
  6135. t['Edotbelow'] = 0x1EB8;
  6136. t['Efcyrillic'] = 0x0424;
  6137. t['Egrave'] = 0x00C8;
  6138. t['Egravesmall'] = 0xF7E8;
  6139. t['Eharmenian'] = 0x0537;
  6140. t['Ehookabove'] = 0x1EBA;
  6141. t['Eightroman'] = 0x2167;
  6142. t['Einvertedbreve'] = 0x0206;
  6143. t['Eiotifiedcyrillic'] = 0x0464;
  6144. t['Elcyrillic'] = 0x041B;
  6145. t['Elevenroman'] = 0x216A;
  6146. t['Emacron'] = 0x0112;
  6147. t['Emacronacute'] = 0x1E16;
  6148. t['Emacrongrave'] = 0x1E14;
  6149. t['Emcyrillic'] = 0x041C;
  6150. t['Emonospace'] = 0xFF25;
  6151. t['Encyrillic'] = 0x041D;
  6152. t['Endescendercyrillic'] = 0x04A2;
  6153. t['Eng'] = 0x014A;
  6154. t['Enghecyrillic'] = 0x04A4;
  6155. t['Enhookcyrillic'] = 0x04C7;
  6156. t['Eogonek'] = 0x0118;
  6157. t['Eopen'] = 0x0190;
  6158. t['Epsilon'] = 0x0395;
  6159. t['Epsilontonos'] = 0x0388;
  6160. t['Ercyrillic'] = 0x0420;
  6161. t['Ereversed'] = 0x018E;
  6162. t['Ereversedcyrillic'] = 0x042D;
  6163. t['Escyrillic'] = 0x0421;
  6164. t['Esdescendercyrillic'] = 0x04AA;
  6165. t['Esh'] = 0x01A9;
  6166. t['Esmall'] = 0xF765;
  6167. t['Eta'] = 0x0397;
  6168. t['Etarmenian'] = 0x0538;
  6169. t['Etatonos'] = 0x0389;
  6170. t['Eth'] = 0x00D0;
  6171. t['Ethsmall'] = 0xF7F0;
  6172. t['Etilde'] = 0x1EBC;
  6173. t['Etildebelow'] = 0x1E1A;
  6174. t['Euro'] = 0x20AC;
  6175. t['Ezh'] = 0x01B7;
  6176. t['Ezhcaron'] = 0x01EE;
  6177. t['Ezhreversed'] = 0x01B8;
  6178. t['F'] = 0x0046;
  6179. t['Fcircle'] = 0x24BB;
  6180. t['Fdotaccent'] = 0x1E1E;
  6181. t['Feharmenian'] = 0x0556;
  6182. t['Feicoptic'] = 0x03E4;
  6183. t['Fhook'] = 0x0191;
  6184. t['Fitacyrillic'] = 0x0472;
  6185. t['Fiveroman'] = 0x2164;
  6186. t['Fmonospace'] = 0xFF26;
  6187. t['Fourroman'] = 0x2163;
  6188. t['Fsmall'] = 0xF766;
  6189. t['G'] = 0x0047;
  6190. t['GBsquare'] = 0x3387;
  6191. t['Gacute'] = 0x01F4;
  6192. t['Gamma'] = 0x0393;
  6193. t['Gammaafrican'] = 0x0194;
  6194. t['Gangiacoptic'] = 0x03EA;
  6195. t['Gbreve'] = 0x011E;
  6196. t['Gcaron'] = 0x01E6;
  6197. t['Gcedilla'] = 0x0122;
  6198. t['Gcircle'] = 0x24BC;
  6199. t['Gcircumflex'] = 0x011C;
  6200. t['Gcommaaccent'] = 0x0122;
  6201. t['Gdot'] = 0x0120;
  6202. t['Gdotaccent'] = 0x0120;
  6203. t['Gecyrillic'] = 0x0413;
  6204. t['Ghadarmenian'] = 0x0542;
  6205. t['Ghemiddlehookcyrillic'] = 0x0494;
  6206. t['Ghestrokecyrillic'] = 0x0492;
  6207. t['Gheupturncyrillic'] = 0x0490;
  6208. t['Ghook'] = 0x0193;
  6209. t['Gimarmenian'] = 0x0533;
  6210. t['Gjecyrillic'] = 0x0403;
  6211. t['Gmacron'] = 0x1E20;
  6212. t['Gmonospace'] = 0xFF27;
  6213. t['Grave'] = 0xF6CE;
  6214. t['Gravesmall'] = 0xF760;
  6215. t['Gsmall'] = 0xF767;
  6216. t['Gsmallhook'] = 0x029B;
  6217. t['Gstroke'] = 0x01E4;
  6218. t['H'] = 0x0048;
  6219. t['H18533'] = 0x25CF;
  6220. t['H18543'] = 0x25AA;
  6221. t['H18551'] = 0x25AB;
  6222. t['H22073'] = 0x25A1;
  6223. t['HPsquare'] = 0x33CB;
  6224. t['Haabkhasiancyrillic'] = 0x04A8;
  6225. t['Hadescendercyrillic'] = 0x04B2;
  6226. t['Hardsigncyrillic'] = 0x042A;
  6227. t['Hbar'] = 0x0126;
  6228. t['Hbrevebelow'] = 0x1E2A;
  6229. t['Hcedilla'] = 0x1E28;
  6230. t['Hcircle'] = 0x24BD;
  6231. t['Hcircumflex'] = 0x0124;
  6232. t['Hdieresis'] = 0x1E26;
  6233. t['Hdotaccent'] = 0x1E22;
  6234. t['Hdotbelow'] = 0x1E24;
  6235. t['Hmonospace'] = 0xFF28;
  6236. t['Hoarmenian'] = 0x0540;
  6237. t['Horicoptic'] = 0x03E8;
  6238. t['Hsmall'] = 0xF768;
  6239. t['Hungarumlaut'] = 0xF6CF;
  6240. t['Hungarumlautsmall'] = 0xF6F8;
  6241. t['Hzsquare'] = 0x3390;
  6242. t['I'] = 0x0049;
  6243. t['IAcyrillic'] = 0x042F;
  6244. t['IJ'] = 0x0132;
  6245. t['IUcyrillic'] = 0x042E;
  6246. t['Iacute'] = 0x00CD;
  6247. t['Iacutesmall'] = 0xF7ED;
  6248. t['Ibreve'] = 0x012C;
  6249. t['Icaron'] = 0x01CF;
  6250. t['Icircle'] = 0x24BE;
  6251. t['Icircumflex'] = 0x00CE;
  6252. t['Icircumflexsmall'] = 0xF7EE;
  6253. t['Icyrillic'] = 0x0406;
  6254. t['Idblgrave'] = 0x0208;
  6255. t['Idieresis'] = 0x00CF;
  6256. t['Idieresisacute'] = 0x1E2E;
  6257. t['Idieresiscyrillic'] = 0x04E4;
  6258. t['Idieresissmall'] = 0xF7EF;
  6259. t['Idot'] = 0x0130;
  6260. t['Idotaccent'] = 0x0130;
  6261. t['Idotbelow'] = 0x1ECA;
  6262. t['Iebrevecyrillic'] = 0x04D6;
  6263. t['Iecyrillic'] = 0x0415;
  6264. t['Ifraktur'] = 0x2111;
  6265. t['Igrave'] = 0x00CC;
  6266. t['Igravesmall'] = 0xF7EC;
  6267. t['Ihookabove'] = 0x1EC8;
  6268. t['Iicyrillic'] = 0x0418;
  6269. t['Iinvertedbreve'] = 0x020A;
  6270. t['Iishortcyrillic'] = 0x0419;
  6271. t['Imacron'] = 0x012A;
  6272. t['Imacroncyrillic'] = 0x04E2;
  6273. t['Imonospace'] = 0xFF29;
  6274. t['Iniarmenian'] = 0x053B;
  6275. t['Iocyrillic'] = 0x0401;
  6276. t['Iogonek'] = 0x012E;
  6277. t['Iota'] = 0x0399;
  6278. t['Iotaafrican'] = 0x0196;
  6279. t['Iotadieresis'] = 0x03AA;
  6280. t['Iotatonos'] = 0x038A;
  6281. t['Ismall'] = 0xF769;
  6282. t['Istroke'] = 0x0197;
  6283. t['Itilde'] = 0x0128;
  6284. t['Itildebelow'] = 0x1E2C;
  6285. t['Izhitsacyrillic'] = 0x0474;
  6286. t['Izhitsadblgravecyrillic'] = 0x0476;
  6287. t['J'] = 0x004A;
  6288. t['Jaarmenian'] = 0x0541;
  6289. t['Jcircle'] = 0x24BF;
  6290. t['Jcircumflex'] = 0x0134;
  6291. t['Jecyrillic'] = 0x0408;
  6292. t['Jheharmenian'] = 0x054B;
  6293. t['Jmonospace'] = 0xFF2A;
  6294. t['Jsmall'] = 0xF76A;
  6295. t['K'] = 0x004B;
  6296. t['KBsquare'] = 0x3385;
  6297. t['KKsquare'] = 0x33CD;
  6298. t['Kabashkircyrillic'] = 0x04A0;
  6299. t['Kacute'] = 0x1E30;
  6300. t['Kacyrillic'] = 0x041A;
  6301. t['Kadescendercyrillic'] = 0x049A;
  6302. t['Kahookcyrillic'] = 0x04C3;
  6303. t['Kappa'] = 0x039A;
  6304. t['Kastrokecyrillic'] = 0x049E;
  6305. t['Kaverticalstrokecyrillic'] = 0x049C;
  6306. t['Kcaron'] = 0x01E8;
  6307. t['Kcedilla'] = 0x0136;
  6308. t['Kcircle'] = 0x24C0;
  6309. t['Kcommaaccent'] = 0x0136;
  6310. t['Kdotbelow'] = 0x1E32;
  6311. t['Keharmenian'] = 0x0554;
  6312. t['Kenarmenian'] = 0x053F;
  6313. t['Khacyrillic'] = 0x0425;
  6314. t['Kheicoptic'] = 0x03E6;
  6315. t['Khook'] = 0x0198;
  6316. t['Kjecyrillic'] = 0x040C;
  6317. t['Klinebelow'] = 0x1E34;
  6318. t['Kmonospace'] = 0xFF2B;
  6319. t['Koppacyrillic'] = 0x0480;
  6320. t['Koppagreek'] = 0x03DE;
  6321. t['Ksicyrillic'] = 0x046E;
  6322. t['Ksmall'] = 0xF76B;
  6323. t['L'] = 0x004C;
  6324. t['LJ'] = 0x01C7;
  6325. t['LL'] = 0xF6BF;
  6326. t['Lacute'] = 0x0139;
  6327. t['Lambda'] = 0x039B;
  6328. t['Lcaron'] = 0x013D;
  6329. t['Lcedilla'] = 0x013B;
  6330. t['Lcircle'] = 0x24C1;
  6331. t['Lcircumflexbelow'] = 0x1E3C;
  6332. t['Lcommaaccent'] = 0x013B;
  6333. t['Ldot'] = 0x013F;
  6334. t['Ldotaccent'] = 0x013F;
  6335. t['Ldotbelow'] = 0x1E36;
  6336. t['Ldotbelowmacron'] = 0x1E38;
  6337. t['Liwnarmenian'] = 0x053C;
  6338. t['Lj'] = 0x01C8;
  6339. t['Ljecyrillic'] = 0x0409;
  6340. t['Llinebelow'] = 0x1E3A;
  6341. t['Lmonospace'] = 0xFF2C;
  6342. t['Lslash'] = 0x0141;
  6343. t['Lslashsmall'] = 0xF6F9;
  6344. t['Lsmall'] = 0xF76C;
  6345. t['M'] = 0x004D;
  6346. t['MBsquare'] = 0x3386;
  6347. t['Macron'] = 0xF6D0;
  6348. t['Macronsmall'] = 0xF7AF;
  6349. t['Macute'] = 0x1E3E;
  6350. t['Mcircle'] = 0x24C2;
  6351. t['Mdotaccent'] = 0x1E40;
  6352. t['Mdotbelow'] = 0x1E42;
  6353. t['Menarmenian'] = 0x0544;
  6354. t['Mmonospace'] = 0xFF2D;
  6355. t['Msmall'] = 0xF76D;
  6356. t['Mturned'] = 0x019C;
  6357. t['Mu'] = 0x039C;
  6358. t['N'] = 0x004E;
  6359. t['NJ'] = 0x01CA;
  6360. t['Nacute'] = 0x0143;
  6361. t['Ncaron'] = 0x0147;
  6362. t['Ncedilla'] = 0x0145;
  6363. t['Ncircle'] = 0x24C3;
  6364. t['Ncircumflexbelow'] = 0x1E4A;
  6365. t['Ncommaaccent'] = 0x0145;
  6366. t['Ndotaccent'] = 0x1E44;
  6367. t['Ndotbelow'] = 0x1E46;
  6368. t['Nhookleft'] = 0x019D;
  6369. t['Nineroman'] = 0x2168;
  6370. t['Nj'] = 0x01CB;
  6371. t['Njecyrillic'] = 0x040A;
  6372. t['Nlinebelow'] = 0x1E48;
  6373. t['Nmonospace'] = 0xFF2E;
  6374. t['Nowarmenian'] = 0x0546;
  6375. t['Nsmall'] = 0xF76E;
  6376. t['Ntilde'] = 0x00D1;
  6377. t['Ntildesmall'] = 0xF7F1;
  6378. t['Nu'] = 0x039D;
  6379. t['O'] = 0x004F;
  6380. t['OE'] = 0x0152;
  6381. t['OEsmall'] = 0xF6FA;
  6382. t['Oacute'] = 0x00D3;
  6383. t['Oacutesmall'] = 0xF7F3;
  6384. t['Obarredcyrillic'] = 0x04E8;
  6385. t['Obarreddieresiscyrillic'] = 0x04EA;
  6386. t['Obreve'] = 0x014E;
  6387. t['Ocaron'] = 0x01D1;
  6388. t['Ocenteredtilde'] = 0x019F;
  6389. t['Ocircle'] = 0x24C4;
  6390. t['Ocircumflex'] = 0x00D4;
  6391. t['Ocircumflexacute'] = 0x1ED0;
  6392. t['Ocircumflexdotbelow'] = 0x1ED8;
  6393. t['Ocircumflexgrave'] = 0x1ED2;
  6394. t['Ocircumflexhookabove'] = 0x1ED4;
  6395. t['Ocircumflexsmall'] = 0xF7F4;
  6396. t['Ocircumflextilde'] = 0x1ED6;
  6397. t['Ocyrillic'] = 0x041E;
  6398. t['Odblacute'] = 0x0150;
  6399. t['Odblgrave'] = 0x020C;
  6400. t['Odieresis'] = 0x00D6;
  6401. t['Odieresiscyrillic'] = 0x04E6;
  6402. t['Odieresissmall'] = 0xF7F6;
  6403. t['Odotbelow'] = 0x1ECC;
  6404. t['Ogoneksmall'] = 0xF6FB;
  6405. t['Ograve'] = 0x00D2;
  6406. t['Ogravesmall'] = 0xF7F2;
  6407. t['Oharmenian'] = 0x0555;
  6408. t['Ohm'] = 0x2126;
  6409. t['Ohookabove'] = 0x1ECE;
  6410. t['Ohorn'] = 0x01A0;
  6411. t['Ohornacute'] = 0x1EDA;
  6412. t['Ohorndotbelow'] = 0x1EE2;
  6413. t['Ohorngrave'] = 0x1EDC;
  6414. t['Ohornhookabove'] = 0x1EDE;
  6415. t['Ohorntilde'] = 0x1EE0;
  6416. t['Ohungarumlaut'] = 0x0150;
  6417. t['Oi'] = 0x01A2;
  6418. t['Oinvertedbreve'] = 0x020E;
  6419. t['Omacron'] = 0x014C;
  6420. t['Omacronacute'] = 0x1E52;
  6421. t['Omacrongrave'] = 0x1E50;
  6422. t['Omega'] = 0x2126;
  6423. t['Omegacyrillic'] = 0x0460;
  6424. t['Omegagreek'] = 0x03A9;
  6425. t['Omegaroundcyrillic'] = 0x047A;
  6426. t['Omegatitlocyrillic'] = 0x047C;
  6427. t['Omegatonos'] = 0x038F;
  6428. t['Omicron'] = 0x039F;
  6429. t['Omicrontonos'] = 0x038C;
  6430. t['Omonospace'] = 0xFF2F;
  6431. t['Oneroman'] = 0x2160;
  6432. t['Oogonek'] = 0x01EA;
  6433. t['Oogonekmacron'] = 0x01EC;
  6434. t['Oopen'] = 0x0186;
  6435. t['Oslash'] = 0x00D8;
  6436. t['Oslashacute'] = 0x01FE;
  6437. t['Oslashsmall'] = 0xF7F8;
  6438. t['Osmall'] = 0xF76F;
  6439. t['Ostrokeacute'] = 0x01FE;
  6440. t['Otcyrillic'] = 0x047E;
  6441. t['Otilde'] = 0x00D5;
  6442. t['Otildeacute'] = 0x1E4C;
  6443. t['Otildedieresis'] = 0x1E4E;
  6444. t['Otildesmall'] = 0xF7F5;
  6445. t['P'] = 0x0050;
  6446. t['Pacute'] = 0x1E54;
  6447. t['Pcircle'] = 0x24C5;
  6448. t['Pdotaccent'] = 0x1E56;
  6449. t['Pecyrillic'] = 0x041F;
  6450. t['Peharmenian'] = 0x054A;
  6451. t['Pemiddlehookcyrillic'] = 0x04A6;
  6452. t['Phi'] = 0x03A6;
  6453. t['Phook'] = 0x01A4;
  6454. t['Pi'] = 0x03A0;
  6455. t['Piwrarmenian'] = 0x0553;
  6456. t['Pmonospace'] = 0xFF30;
  6457. t['Psi'] = 0x03A8;
  6458. t['Psicyrillic'] = 0x0470;
  6459. t['Psmall'] = 0xF770;
  6460. t['Q'] = 0x0051;
  6461. t['Qcircle'] = 0x24C6;
  6462. t['Qmonospace'] = 0xFF31;
  6463. t['Qsmall'] = 0xF771;
  6464. t['R'] = 0x0052;
  6465. t['Raarmenian'] = 0x054C;
  6466. t['Racute'] = 0x0154;
  6467. t['Rcaron'] = 0x0158;
  6468. t['Rcedilla'] = 0x0156;
  6469. t['Rcircle'] = 0x24C7;
  6470. t['Rcommaaccent'] = 0x0156;
  6471. t['Rdblgrave'] = 0x0210;
  6472. t['Rdotaccent'] = 0x1E58;
  6473. t['Rdotbelow'] = 0x1E5A;
  6474. t['Rdotbelowmacron'] = 0x1E5C;
  6475. t['Reharmenian'] = 0x0550;
  6476. t['Rfraktur'] = 0x211C;
  6477. t['Rho'] = 0x03A1;
  6478. t['Ringsmall'] = 0xF6FC;
  6479. t['Rinvertedbreve'] = 0x0212;
  6480. t['Rlinebelow'] = 0x1E5E;
  6481. t['Rmonospace'] = 0xFF32;
  6482. t['Rsmall'] = 0xF772;
  6483. t['Rsmallinverted'] = 0x0281;
  6484. t['Rsmallinvertedsuperior'] = 0x02B6;
  6485. t['S'] = 0x0053;
  6486. t['SF010000'] = 0x250C;
  6487. t['SF020000'] = 0x2514;
  6488. t['SF030000'] = 0x2510;
  6489. t['SF040000'] = 0x2518;
  6490. t['SF050000'] = 0x253C;
  6491. t['SF060000'] = 0x252C;
  6492. t['SF070000'] = 0x2534;
  6493. t['SF080000'] = 0x251C;
  6494. t['SF090000'] = 0x2524;
  6495. t['SF100000'] = 0x2500;
  6496. t['SF110000'] = 0x2502;
  6497. t['SF190000'] = 0x2561;
  6498. t['SF200000'] = 0x2562;
  6499. t['SF210000'] = 0x2556;
  6500. t['SF220000'] = 0x2555;
  6501. t['SF230000'] = 0x2563;
  6502. t['SF240000'] = 0x2551;
  6503. t['SF250000'] = 0x2557;
  6504. t['SF260000'] = 0x255D;
  6505. t['SF270000'] = 0x255C;
  6506. t['SF280000'] = 0x255B;
  6507. t['SF360000'] = 0x255E;
  6508. t['SF370000'] = 0x255F;
  6509. t['SF380000'] = 0x255A;
  6510. t['SF390000'] = 0x2554;
  6511. t['SF400000'] = 0x2569;
  6512. t['SF410000'] = 0x2566;
  6513. t['SF420000'] = 0x2560;
  6514. t['SF430000'] = 0x2550;
  6515. t['SF440000'] = 0x256C;
  6516. t['SF450000'] = 0x2567;
  6517. t['SF460000'] = 0x2568;
  6518. t['SF470000'] = 0x2564;
  6519. t['SF480000'] = 0x2565;
  6520. t['SF490000'] = 0x2559;
  6521. t['SF500000'] = 0x2558;
  6522. t['SF510000'] = 0x2552;
  6523. t['SF520000'] = 0x2553;
  6524. t['SF530000'] = 0x256B;
  6525. t['SF540000'] = 0x256A;
  6526. t['Sacute'] = 0x015A;
  6527. t['Sacutedotaccent'] = 0x1E64;
  6528. t['Sampigreek'] = 0x03E0;
  6529. t['Scaron'] = 0x0160;
  6530. t['Scarondotaccent'] = 0x1E66;
  6531. t['Scaronsmall'] = 0xF6FD;
  6532. t['Scedilla'] = 0x015E;
  6533. t['Schwa'] = 0x018F;
  6534. t['Schwacyrillic'] = 0x04D8;
  6535. t['Schwadieresiscyrillic'] = 0x04DA;
  6536. t['Scircle'] = 0x24C8;
  6537. t['Scircumflex'] = 0x015C;
  6538. t['Scommaaccent'] = 0x0218;
  6539. t['Sdotaccent'] = 0x1E60;
  6540. t['Sdotbelow'] = 0x1E62;
  6541. t['Sdotbelowdotaccent'] = 0x1E68;
  6542. t['Seharmenian'] = 0x054D;
  6543. t['Sevenroman'] = 0x2166;
  6544. t['Shaarmenian'] = 0x0547;
  6545. t['Shacyrillic'] = 0x0428;
  6546. t['Shchacyrillic'] = 0x0429;
  6547. t['Sheicoptic'] = 0x03E2;
  6548. t['Shhacyrillic'] = 0x04BA;
  6549. t['Shimacoptic'] = 0x03EC;
  6550. t['Sigma'] = 0x03A3;
  6551. t['Sixroman'] = 0x2165;
  6552. t['Smonospace'] = 0xFF33;
  6553. t['Softsigncyrillic'] = 0x042C;
  6554. t['Ssmall'] = 0xF773;
  6555. t['Stigmagreek'] = 0x03DA;
  6556. t['T'] = 0x0054;
  6557. t['Tau'] = 0x03A4;
  6558. t['Tbar'] = 0x0166;
  6559. t['Tcaron'] = 0x0164;
  6560. t['Tcedilla'] = 0x0162;
  6561. t['Tcircle'] = 0x24C9;
  6562. t['Tcircumflexbelow'] = 0x1E70;
  6563. t['Tcommaaccent'] = 0x0162;
  6564. t['Tdotaccent'] = 0x1E6A;
  6565. t['Tdotbelow'] = 0x1E6C;
  6566. t['Tecyrillic'] = 0x0422;
  6567. t['Tedescendercyrillic'] = 0x04AC;
  6568. t['Tenroman'] = 0x2169;
  6569. t['Tetsecyrillic'] = 0x04B4;
  6570. t['Theta'] = 0x0398;
  6571. t['Thook'] = 0x01AC;
  6572. t['Thorn'] = 0x00DE;
  6573. t['Thornsmall'] = 0xF7FE;
  6574. t['Threeroman'] = 0x2162;
  6575. t['Tildesmall'] = 0xF6FE;
  6576. t['Tiwnarmenian'] = 0x054F;
  6577. t['Tlinebelow'] = 0x1E6E;
  6578. t['Tmonospace'] = 0xFF34;
  6579. t['Toarmenian'] = 0x0539;
  6580. t['Tonefive'] = 0x01BC;
  6581. t['Tonesix'] = 0x0184;
  6582. t['Tonetwo'] = 0x01A7;
  6583. t['Tretroflexhook'] = 0x01AE;
  6584. t['Tsecyrillic'] = 0x0426;
  6585. t['Tshecyrillic'] = 0x040B;
  6586. t['Tsmall'] = 0xF774;
  6587. t['Twelveroman'] = 0x216B;
  6588. t['Tworoman'] = 0x2161;
  6589. t['U'] = 0x0055;
  6590. t['Uacute'] = 0x00DA;
  6591. t['Uacutesmall'] = 0xF7FA;
  6592. t['Ubreve'] = 0x016C;
  6593. t['Ucaron'] = 0x01D3;
  6594. t['Ucircle'] = 0x24CA;
  6595. t['Ucircumflex'] = 0x00DB;
  6596. t['Ucircumflexbelow'] = 0x1E76;
  6597. t['Ucircumflexsmall'] = 0xF7FB;
  6598. t['Ucyrillic'] = 0x0423;
  6599. t['Udblacute'] = 0x0170;
  6600. t['Udblgrave'] = 0x0214;
  6601. t['Udieresis'] = 0x00DC;
  6602. t['Udieresisacute'] = 0x01D7;
  6603. t['Udieresisbelow'] = 0x1E72;
  6604. t['Udieresiscaron'] = 0x01D9;
  6605. t['Udieresiscyrillic'] = 0x04F0;
  6606. t['Udieresisgrave'] = 0x01DB;
  6607. t['Udieresismacron'] = 0x01D5;
  6608. t['Udieresissmall'] = 0xF7FC;
  6609. t['Udotbelow'] = 0x1EE4;
  6610. t['Ugrave'] = 0x00D9;
  6611. t['Ugravesmall'] = 0xF7F9;
  6612. t['Uhookabove'] = 0x1EE6;
  6613. t['Uhorn'] = 0x01AF;
  6614. t['Uhornacute'] = 0x1EE8;
  6615. t['Uhorndotbelow'] = 0x1EF0;
  6616. t['Uhorngrave'] = 0x1EEA;
  6617. t['Uhornhookabove'] = 0x1EEC;
  6618. t['Uhorntilde'] = 0x1EEE;
  6619. t['Uhungarumlaut'] = 0x0170;
  6620. t['Uhungarumlautcyrillic'] = 0x04F2;
  6621. t['Uinvertedbreve'] = 0x0216;
  6622. t['Ukcyrillic'] = 0x0478;
  6623. t['Umacron'] = 0x016A;
  6624. t['Umacroncyrillic'] = 0x04EE;
  6625. t['Umacrondieresis'] = 0x1E7A;
  6626. t['Umonospace'] = 0xFF35;
  6627. t['Uogonek'] = 0x0172;
  6628. t['Upsilon'] = 0x03A5;
  6629. t['Upsilon1'] = 0x03D2;
  6630. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  6631. t['Upsilonafrican'] = 0x01B1;
  6632. t['Upsilondieresis'] = 0x03AB;
  6633. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  6634. t['Upsilonhooksymbol'] = 0x03D2;
  6635. t['Upsilontonos'] = 0x038E;
  6636. t['Uring'] = 0x016E;
  6637. t['Ushortcyrillic'] = 0x040E;
  6638. t['Usmall'] = 0xF775;
  6639. t['Ustraightcyrillic'] = 0x04AE;
  6640. t['Ustraightstrokecyrillic'] = 0x04B0;
  6641. t['Utilde'] = 0x0168;
  6642. t['Utildeacute'] = 0x1E78;
  6643. t['Utildebelow'] = 0x1E74;
  6644. t['V'] = 0x0056;
  6645. t['Vcircle'] = 0x24CB;
  6646. t['Vdotbelow'] = 0x1E7E;
  6647. t['Vecyrillic'] = 0x0412;
  6648. t['Vewarmenian'] = 0x054E;
  6649. t['Vhook'] = 0x01B2;
  6650. t['Vmonospace'] = 0xFF36;
  6651. t['Voarmenian'] = 0x0548;
  6652. t['Vsmall'] = 0xF776;
  6653. t['Vtilde'] = 0x1E7C;
  6654. t['W'] = 0x0057;
  6655. t['Wacute'] = 0x1E82;
  6656. t['Wcircle'] = 0x24CC;
  6657. t['Wcircumflex'] = 0x0174;
  6658. t['Wdieresis'] = 0x1E84;
  6659. t['Wdotaccent'] = 0x1E86;
  6660. t['Wdotbelow'] = 0x1E88;
  6661. t['Wgrave'] = 0x1E80;
  6662. t['Wmonospace'] = 0xFF37;
  6663. t['Wsmall'] = 0xF777;
  6664. t['X'] = 0x0058;
  6665. t['Xcircle'] = 0x24CD;
  6666. t['Xdieresis'] = 0x1E8C;
  6667. t['Xdotaccent'] = 0x1E8A;
  6668. t['Xeharmenian'] = 0x053D;
  6669. t['Xi'] = 0x039E;
  6670. t['Xmonospace'] = 0xFF38;
  6671. t['Xsmall'] = 0xF778;
  6672. t['Y'] = 0x0059;
  6673. t['Yacute'] = 0x00DD;
  6674. t['Yacutesmall'] = 0xF7FD;
  6675. t['Yatcyrillic'] = 0x0462;
  6676. t['Ycircle'] = 0x24CE;
  6677. t['Ycircumflex'] = 0x0176;
  6678. t['Ydieresis'] = 0x0178;
  6679. t['Ydieresissmall'] = 0xF7FF;
  6680. t['Ydotaccent'] = 0x1E8E;
  6681. t['Ydotbelow'] = 0x1EF4;
  6682. t['Yericyrillic'] = 0x042B;
  6683. t['Yerudieresiscyrillic'] = 0x04F8;
  6684. t['Ygrave'] = 0x1EF2;
  6685. t['Yhook'] = 0x01B3;
  6686. t['Yhookabove'] = 0x1EF6;
  6687. t['Yiarmenian'] = 0x0545;
  6688. t['Yicyrillic'] = 0x0407;
  6689. t['Yiwnarmenian'] = 0x0552;
  6690. t['Ymonospace'] = 0xFF39;
  6691. t['Ysmall'] = 0xF779;
  6692. t['Ytilde'] = 0x1EF8;
  6693. t['Yusbigcyrillic'] = 0x046A;
  6694. t['Yusbigiotifiedcyrillic'] = 0x046C;
  6695. t['Yuslittlecyrillic'] = 0x0466;
  6696. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  6697. t['Z'] = 0x005A;
  6698. t['Zaarmenian'] = 0x0536;
  6699. t['Zacute'] = 0x0179;
  6700. t['Zcaron'] = 0x017D;
  6701. t['Zcaronsmall'] = 0xF6FF;
  6702. t['Zcircle'] = 0x24CF;
  6703. t['Zcircumflex'] = 0x1E90;
  6704. t['Zdot'] = 0x017B;
  6705. t['Zdotaccent'] = 0x017B;
  6706. t['Zdotbelow'] = 0x1E92;
  6707. t['Zecyrillic'] = 0x0417;
  6708. t['Zedescendercyrillic'] = 0x0498;
  6709. t['Zedieresiscyrillic'] = 0x04DE;
  6710. t['Zeta'] = 0x0396;
  6711. t['Zhearmenian'] = 0x053A;
  6712. t['Zhebrevecyrillic'] = 0x04C1;
  6713. t['Zhecyrillic'] = 0x0416;
  6714. t['Zhedescendercyrillic'] = 0x0496;
  6715. t['Zhedieresiscyrillic'] = 0x04DC;
  6716. t['Zlinebelow'] = 0x1E94;
  6717. t['Zmonospace'] = 0xFF3A;
  6718. t['Zsmall'] = 0xF77A;
  6719. t['Zstroke'] = 0x01B5;
  6720. t['a'] = 0x0061;
  6721. t['aabengali'] = 0x0986;
  6722. t['aacute'] = 0x00E1;
  6723. t['aadeva'] = 0x0906;
  6724. t['aagujarati'] = 0x0A86;
  6725. t['aagurmukhi'] = 0x0A06;
  6726. t['aamatragurmukhi'] = 0x0A3E;
  6727. t['aarusquare'] = 0x3303;
  6728. t['aavowelsignbengali'] = 0x09BE;
  6729. t['aavowelsigndeva'] = 0x093E;
  6730. t['aavowelsigngujarati'] = 0x0ABE;
  6731. t['abbreviationmarkarmenian'] = 0x055F;
  6732. t['abbreviationsigndeva'] = 0x0970;
  6733. t['abengali'] = 0x0985;
  6734. t['abopomofo'] = 0x311A;
  6735. t['abreve'] = 0x0103;
  6736. t['abreveacute'] = 0x1EAF;
  6737. t['abrevecyrillic'] = 0x04D1;
  6738. t['abrevedotbelow'] = 0x1EB7;
  6739. t['abrevegrave'] = 0x1EB1;
  6740. t['abrevehookabove'] = 0x1EB3;
  6741. t['abrevetilde'] = 0x1EB5;
  6742. t['acaron'] = 0x01CE;
  6743. t['acircle'] = 0x24D0;
  6744. t['acircumflex'] = 0x00E2;
  6745. t['acircumflexacute'] = 0x1EA5;
  6746. t['acircumflexdotbelow'] = 0x1EAD;
  6747. t['acircumflexgrave'] = 0x1EA7;
  6748. t['acircumflexhookabove'] = 0x1EA9;
  6749. t['acircumflextilde'] = 0x1EAB;
  6750. t['acute'] = 0x00B4;
  6751. t['acutebelowcmb'] = 0x0317;
  6752. t['acutecmb'] = 0x0301;
  6753. t['acutecomb'] = 0x0301;
  6754. t['acutedeva'] = 0x0954;
  6755. t['acutelowmod'] = 0x02CF;
  6756. t['acutetonecmb'] = 0x0341;
  6757. t['acyrillic'] = 0x0430;
  6758. t['adblgrave'] = 0x0201;
  6759. t['addakgurmukhi'] = 0x0A71;
  6760. t['adeva'] = 0x0905;
  6761. t['adieresis'] = 0x00E4;
  6762. t['adieresiscyrillic'] = 0x04D3;
  6763. t['adieresismacron'] = 0x01DF;
  6764. t['adotbelow'] = 0x1EA1;
  6765. t['adotmacron'] = 0x01E1;
  6766. t['ae'] = 0x00E6;
  6767. t['aeacute'] = 0x01FD;
  6768. t['aekorean'] = 0x3150;
  6769. t['aemacron'] = 0x01E3;
  6770. t['afii00208'] = 0x2015;
  6771. t['afii08941'] = 0x20A4;
  6772. t['afii10017'] = 0x0410;
  6773. t['afii10018'] = 0x0411;
  6774. t['afii10019'] = 0x0412;
  6775. t['afii10020'] = 0x0413;
  6776. t['afii10021'] = 0x0414;
  6777. t['afii10022'] = 0x0415;
  6778. t['afii10023'] = 0x0401;
  6779. t['afii10024'] = 0x0416;
  6780. t['afii10025'] = 0x0417;
  6781. t['afii10026'] = 0x0418;
  6782. t['afii10027'] = 0x0419;
  6783. t['afii10028'] = 0x041A;
  6784. t['afii10029'] = 0x041B;
  6785. t['afii10030'] = 0x041C;
  6786. t['afii10031'] = 0x041D;
  6787. t['afii10032'] = 0x041E;
  6788. t['afii10033'] = 0x041F;
  6789. t['afii10034'] = 0x0420;
  6790. t['afii10035'] = 0x0421;
  6791. t['afii10036'] = 0x0422;
  6792. t['afii10037'] = 0x0423;
  6793. t['afii10038'] = 0x0424;
  6794. t['afii10039'] = 0x0425;
  6795. t['afii10040'] = 0x0426;
  6796. t['afii10041'] = 0x0427;
  6797. t['afii10042'] = 0x0428;
  6798. t['afii10043'] = 0x0429;
  6799. t['afii10044'] = 0x042A;
  6800. t['afii10045'] = 0x042B;
  6801. t['afii10046'] = 0x042C;
  6802. t['afii10047'] = 0x042D;
  6803. t['afii10048'] = 0x042E;
  6804. t['afii10049'] = 0x042F;
  6805. t['afii10050'] = 0x0490;
  6806. t['afii10051'] = 0x0402;
  6807. t['afii10052'] = 0x0403;
  6808. t['afii10053'] = 0x0404;
  6809. t['afii10054'] = 0x0405;
  6810. t['afii10055'] = 0x0406;
  6811. t['afii10056'] = 0x0407;
  6812. t['afii10057'] = 0x0408;
  6813. t['afii10058'] = 0x0409;
  6814. t['afii10059'] = 0x040A;
  6815. t['afii10060'] = 0x040B;
  6816. t['afii10061'] = 0x040C;
  6817. t['afii10062'] = 0x040E;
  6818. t['afii10063'] = 0xF6C4;
  6819. t['afii10064'] = 0xF6C5;
  6820. t['afii10065'] = 0x0430;
  6821. t['afii10066'] = 0x0431;
  6822. t['afii10067'] = 0x0432;
  6823. t['afii10068'] = 0x0433;
  6824. t['afii10069'] = 0x0434;
  6825. t['afii10070'] = 0x0435;
  6826. t['afii10071'] = 0x0451;
  6827. t['afii10072'] = 0x0436;
  6828. t['afii10073'] = 0x0437;
  6829. t['afii10074'] = 0x0438;
  6830. t['afii10075'] = 0x0439;
  6831. t['afii10076'] = 0x043A;
  6832. t['afii10077'] = 0x043B;
  6833. t['afii10078'] = 0x043C;
  6834. t['afii10079'] = 0x043D;
  6835. t['afii10080'] = 0x043E;
  6836. t['afii10081'] = 0x043F;
  6837. t['afii10082'] = 0x0440;
  6838. t['afii10083'] = 0x0441;
  6839. t['afii10084'] = 0x0442;
  6840. t['afii10085'] = 0x0443;
  6841. t['afii10086'] = 0x0444;
  6842. t['afii10087'] = 0x0445;
  6843. t['afii10088'] = 0x0446;
  6844. t['afii10089'] = 0x0447;
  6845. t['afii10090'] = 0x0448;
  6846. t['afii10091'] = 0x0449;
  6847. t['afii10092'] = 0x044A;
  6848. t['afii10093'] = 0x044B;
  6849. t['afii10094'] = 0x044C;
  6850. t['afii10095'] = 0x044D;
  6851. t['afii10096'] = 0x044E;
  6852. t['afii10097'] = 0x044F;
  6853. t['afii10098'] = 0x0491;
  6854. t['afii10099'] = 0x0452;
  6855. t['afii10100'] = 0x0453;
  6856. t['afii10101'] = 0x0454;
  6857. t['afii10102'] = 0x0455;
  6858. t['afii10103'] = 0x0456;
  6859. t['afii10104'] = 0x0457;
  6860. t['afii10105'] = 0x0458;
  6861. t['afii10106'] = 0x0459;
  6862. t['afii10107'] = 0x045A;
  6863. t['afii10108'] = 0x045B;
  6864. t['afii10109'] = 0x045C;
  6865. t['afii10110'] = 0x045E;
  6866. t['afii10145'] = 0x040F;
  6867. t['afii10146'] = 0x0462;
  6868. t['afii10147'] = 0x0472;
  6869. t['afii10148'] = 0x0474;
  6870. t['afii10192'] = 0xF6C6;
  6871. t['afii10193'] = 0x045F;
  6872. t['afii10194'] = 0x0463;
  6873. t['afii10195'] = 0x0473;
  6874. t['afii10196'] = 0x0475;
  6875. t['afii10831'] = 0xF6C7;
  6876. t['afii10832'] = 0xF6C8;
  6877. t['afii10846'] = 0x04D9;
  6878. t['afii299'] = 0x200E;
  6879. t['afii300'] = 0x200F;
  6880. t['afii301'] = 0x200D;
  6881. t['afii57381'] = 0x066A;
  6882. t['afii57388'] = 0x060C;
  6883. t['afii57392'] = 0x0660;
  6884. t['afii57393'] = 0x0661;
  6885. t['afii57394'] = 0x0662;
  6886. t['afii57395'] = 0x0663;
  6887. t['afii57396'] = 0x0664;
  6888. t['afii57397'] = 0x0665;
  6889. t['afii57398'] = 0x0666;
  6890. t['afii57399'] = 0x0667;
  6891. t['afii57400'] = 0x0668;
  6892. t['afii57401'] = 0x0669;
  6893. t['afii57403'] = 0x061B;
  6894. t['afii57407'] = 0x061F;
  6895. t['afii57409'] = 0x0621;
  6896. t['afii57410'] = 0x0622;
  6897. t['afii57411'] = 0x0623;
  6898. t['afii57412'] = 0x0624;
  6899. t['afii57413'] = 0x0625;
  6900. t['afii57414'] = 0x0626;
  6901. t['afii57415'] = 0x0627;
  6902. t['afii57416'] = 0x0628;
  6903. t['afii57417'] = 0x0629;
  6904. t['afii57418'] = 0x062A;
  6905. t['afii57419'] = 0x062B;
  6906. t['afii57420'] = 0x062C;
  6907. t['afii57421'] = 0x062D;
  6908. t['afii57422'] = 0x062E;
  6909. t['afii57423'] = 0x062F;
  6910. t['afii57424'] = 0x0630;
  6911. t['afii57425'] = 0x0631;
  6912. t['afii57426'] = 0x0632;
  6913. t['afii57427'] = 0x0633;
  6914. t['afii57428'] = 0x0634;
  6915. t['afii57429'] = 0x0635;
  6916. t['afii57430'] = 0x0636;
  6917. t['afii57431'] = 0x0637;
  6918. t['afii57432'] = 0x0638;
  6919. t['afii57433'] = 0x0639;
  6920. t['afii57434'] = 0x063A;
  6921. t['afii57440'] = 0x0640;
  6922. t['afii57441'] = 0x0641;
  6923. t['afii57442'] = 0x0642;
  6924. t['afii57443'] = 0x0643;
  6925. t['afii57444'] = 0x0644;
  6926. t['afii57445'] = 0x0645;
  6927. t['afii57446'] = 0x0646;
  6928. t['afii57448'] = 0x0648;
  6929. t['afii57449'] = 0x0649;
  6930. t['afii57450'] = 0x064A;
  6931. t['afii57451'] = 0x064B;
  6932. t['afii57452'] = 0x064C;
  6933. t['afii57453'] = 0x064D;
  6934. t['afii57454'] = 0x064E;
  6935. t['afii57455'] = 0x064F;
  6936. t['afii57456'] = 0x0650;
  6937. t['afii57457'] = 0x0651;
  6938. t['afii57458'] = 0x0652;
  6939. t['afii57470'] = 0x0647;
  6940. t['afii57505'] = 0x06A4;
  6941. t['afii57506'] = 0x067E;
  6942. t['afii57507'] = 0x0686;
  6943. t['afii57508'] = 0x0698;
  6944. t['afii57509'] = 0x06AF;
  6945. t['afii57511'] = 0x0679;
  6946. t['afii57512'] = 0x0688;
  6947. t['afii57513'] = 0x0691;
  6948. t['afii57514'] = 0x06BA;
  6949. t['afii57519'] = 0x06D2;
  6950. t['afii57534'] = 0x06D5;
  6951. t['afii57636'] = 0x20AA;
  6952. t['afii57645'] = 0x05BE;
  6953. t['afii57658'] = 0x05C3;
  6954. t['afii57664'] = 0x05D0;
  6955. t['afii57665'] = 0x05D1;
  6956. t['afii57666'] = 0x05D2;
  6957. t['afii57667'] = 0x05D3;
  6958. t['afii57668'] = 0x05D4;
  6959. t['afii57669'] = 0x05D5;
  6960. t['afii57670'] = 0x05D6;
  6961. t['afii57671'] = 0x05D7;
  6962. t['afii57672'] = 0x05D8;
  6963. t['afii57673'] = 0x05D9;
  6964. t['afii57674'] = 0x05DA;
  6965. t['afii57675'] = 0x05DB;
  6966. t['afii57676'] = 0x05DC;
  6967. t['afii57677'] = 0x05DD;
  6968. t['afii57678'] = 0x05DE;
  6969. t['afii57679'] = 0x05DF;
  6970. t['afii57680'] = 0x05E0;
  6971. t['afii57681'] = 0x05E1;
  6972. t['afii57682'] = 0x05E2;
  6973. t['afii57683'] = 0x05E3;
  6974. t['afii57684'] = 0x05E4;
  6975. t['afii57685'] = 0x05E5;
  6976. t['afii57686'] = 0x05E6;
  6977. t['afii57687'] = 0x05E7;
  6978. t['afii57688'] = 0x05E8;
  6979. t['afii57689'] = 0x05E9;
  6980. t['afii57690'] = 0x05EA;
  6981. t['afii57694'] = 0xFB2A;
  6982. t['afii57695'] = 0xFB2B;
  6983. t['afii57700'] = 0xFB4B;
  6984. t['afii57705'] = 0xFB1F;
  6985. t['afii57716'] = 0x05F0;
  6986. t['afii57717'] = 0x05F1;
  6987. t['afii57718'] = 0x05F2;
  6988. t['afii57723'] = 0xFB35;
  6989. t['afii57793'] = 0x05B4;
  6990. t['afii57794'] = 0x05B5;
  6991. t['afii57795'] = 0x05B6;
  6992. t['afii57796'] = 0x05BB;
  6993. t['afii57797'] = 0x05B8;
  6994. t['afii57798'] = 0x05B7;
  6995. t['afii57799'] = 0x05B0;
  6996. t['afii57800'] = 0x05B2;
  6997. t['afii57801'] = 0x05B1;
  6998. t['afii57802'] = 0x05B3;
  6999. t['afii57803'] = 0x05C2;
  7000. t['afii57804'] = 0x05C1;
  7001. t['afii57806'] = 0x05B9;
  7002. t['afii57807'] = 0x05BC;
  7003. t['afii57839'] = 0x05BD;
  7004. t['afii57841'] = 0x05BF;
  7005. t['afii57842'] = 0x05C0;
  7006. t['afii57929'] = 0x02BC;
  7007. t['afii61248'] = 0x2105;
  7008. t['afii61289'] = 0x2113;
  7009. t['afii61352'] = 0x2116;
  7010. t['afii61573'] = 0x202C;
  7011. t['afii61574'] = 0x202D;
  7012. t['afii61575'] = 0x202E;
  7013. t['afii61664'] = 0x200C;
  7014. t['afii63167'] = 0x066D;
  7015. t['afii64937'] = 0x02BD;
  7016. t['agrave'] = 0x00E0;
  7017. t['agujarati'] = 0x0A85;
  7018. t['agurmukhi'] = 0x0A05;
  7019. t['ahiragana'] = 0x3042;
  7020. t['ahookabove'] = 0x1EA3;
  7021. t['aibengali'] = 0x0990;
  7022. t['aibopomofo'] = 0x311E;
  7023. t['aideva'] = 0x0910;
  7024. t['aiecyrillic'] = 0x04D5;
  7025. t['aigujarati'] = 0x0A90;
  7026. t['aigurmukhi'] = 0x0A10;
  7027. t['aimatragurmukhi'] = 0x0A48;
  7028. t['ainarabic'] = 0x0639;
  7029. t['ainfinalarabic'] = 0xFECA;
  7030. t['aininitialarabic'] = 0xFECB;
  7031. t['ainmedialarabic'] = 0xFECC;
  7032. t['ainvertedbreve'] = 0x0203;
  7033. t['aivowelsignbengali'] = 0x09C8;
  7034. t['aivowelsigndeva'] = 0x0948;
  7035. t['aivowelsigngujarati'] = 0x0AC8;
  7036. t['akatakana'] = 0x30A2;
  7037. t['akatakanahalfwidth'] = 0xFF71;
  7038. t['akorean'] = 0x314F;
  7039. t['alef'] = 0x05D0;
  7040. t['alefarabic'] = 0x0627;
  7041. t['alefdageshhebrew'] = 0xFB30;
  7042. t['aleffinalarabic'] = 0xFE8E;
  7043. t['alefhamzaabovearabic'] = 0x0623;
  7044. t['alefhamzaabovefinalarabic'] = 0xFE84;
  7045. t['alefhamzabelowarabic'] = 0x0625;
  7046. t['alefhamzabelowfinalarabic'] = 0xFE88;
  7047. t['alefhebrew'] = 0x05D0;
  7048. t['aleflamedhebrew'] = 0xFB4F;
  7049. t['alefmaddaabovearabic'] = 0x0622;
  7050. t['alefmaddaabovefinalarabic'] = 0xFE82;
  7051. t['alefmaksuraarabic'] = 0x0649;
  7052. t['alefmaksurafinalarabic'] = 0xFEF0;
  7053. t['alefmaksurainitialarabic'] = 0xFEF3;
  7054. t['alefmaksuramedialarabic'] = 0xFEF4;
  7055. t['alefpatahhebrew'] = 0xFB2E;
  7056. t['alefqamatshebrew'] = 0xFB2F;
  7057. t['aleph'] = 0x2135;
  7058. t['allequal'] = 0x224C;
  7059. t['alpha'] = 0x03B1;
  7060. t['alphatonos'] = 0x03AC;
  7061. t['amacron'] = 0x0101;
  7062. t['amonospace'] = 0xFF41;
  7063. t['ampersand'] = 0x0026;
  7064. t['ampersandmonospace'] = 0xFF06;
  7065. t['ampersandsmall'] = 0xF726;
  7066. t['amsquare'] = 0x33C2;
  7067. t['anbopomofo'] = 0x3122;
  7068. t['angbopomofo'] = 0x3124;
  7069. t['angbracketleft'] = 0x3008;
  7070. t['angbracketright'] = 0x3009;
  7071. t['angkhankhuthai'] = 0x0E5A;
  7072. t['angle'] = 0x2220;
  7073. t['anglebracketleft'] = 0x3008;
  7074. t['anglebracketleftvertical'] = 0xFE3F;
  7075. t['anglebracketright'] = 0x3009;
  7076. t['anglebracketrightvertical'] = 0xFE40;
  7077. t['angleleft'] = 0x2329;
  7078. t['angleright'] = 0x232A;
  7079. t['angstrom'] = 0x212B;
  7080. t['anoteleia'] = 0x0387;
  7081. t['anudattadeva'] = 0x0952;
  7082. t['anusvarabengali'] = 0x0982;
  7083. t['anusvaradeva'] = 0x0902;
  7084. t['anusvaragujarati'] = 0x0A82;
  7085. t['aogonek'] = 0x0105;
  7086. t['apaatosquare'] = 0x3300;
  7087. t['aparen'] = 0x249C;
  7088. t['apostrophearmenian'] = 0x055A;
  7089. t['apostrophemod'] = 0x02BC;
  7090. t['apple'] = 0xF8FF;
  7091. t['approaches'] = 0x2250;
  7092. t['approxequal'] = 0x2248;
  7093. t['approxequalorimage'] = 0x2252;
  7094. t['approximatelyequal'] = 0x2245;
  7095. t['araeaekorean'] = 0x318E;
  7096. t['araeakorean'] = 0x318D;
  7097. t['arc'] = 0x2312;
  7098. t['arighthalfring'] = 0x1E9A;
  7099. t['aring'] = 0x00E5;
  7100. t['aringacute'] = 0x01FB;
  7101. t['aringbelow'] = 0x1E01;
  7102. t['arrowboth'] = 0x2194;
  7103. t['arrowdashdown'] = 0x21E3;
  7104. t['arrowdashleft'] = 0x21E0;
  7105. t['arrowdashright'] = 0x21E2;
  7106. t['arrowdashup'] = 0x21E1;
  7107. t['arrowdblboth'] = 0x21D4;
  7108. t['arrowdbldown'] = 0x21D3;
  7109. t['arrowdblleft'] = 0x21D0;
  7110. t['arrowdblright'] = 0x21D2;
  7111. t['arrowdblup'] = 0x21D1;
  7112. t['arrowdown'] = 0x2193;
  7113. t['arrowdownleft'] = 0x2199;
  7114. t['arrowdownright'] = 0x2198;
  7115. t['arrowdownwhite'] = 0x21E9;
  7116. t['arrowheaddownmod'] = 0x02C5;
  7117. t['arrowheadleftmod'] = 0x02C2;
  7118. t['arrowheadrightmod'] = 0x02C3;
  7119. t['arrowheadupmod'] = 0x02C4;
  7120. t['arrowhorizex'] = 0xF8E7;
  7121. t['arrowleft'] = 0x2190;
  7122. t['arrowleftdbl'] = 0x21D0;
  7123. t['arrowleftdblstroke'] = 0x21CD;
  7124. t['arrowleftoverright'] = 0x21C6;
  7125. t['arrowleftwhite'] = 0x21E6;
  7126. t['arrowright'] = 0x2192;
  7127. t['arrowrightdblstroke'] = 0x21CF;
  7128. t['arrowrightheavy'] = 0x279E;
  7129. t['arrowrightoverleft'] = 0x21C4;
  7130. t['arrowrightwhite'] = 0x21E8;
  7131. t['arrowtableft'] = 0x21E4;
  7132. t['arrowtabright'] = 0x21E5;
  7133. t['arrowup'] = 0x2191;
  7134. t['arrowupdn'] = 0x2195;
  7135. t['arrowupdnbse'] = 0x21A8;
  7136. t['arrowupdownbase'] = 0x21A8;
  7137. t['arrowupleft'] = 0x2196;
  7138. t['arrowupleftofdown'] = 0x21C5;
  7139. t['arrowupright'] = 0x2197;
  7140. t['arrowupwhite'] = 0x21E7;
  7141. t['arrowvertex'] = 0xF8E6;
  7142. t['asciicircum'] = 0x005E;
  7143. t['asciicircummonospace'] = 0xFF3E;
  7144. t['asciitilde'] = 0x007E;
  7145. t['asciitildemonospace'] = 0xFF5E;
  7146. t['ascript'] = 0x0251;
  7147. t['ascriptturned'] = 0x0252;
  7148. t['asmallhiragana'] = 0x3041;
  7149. t['asmallkatakana'] = 0x30A1;
  7150. t['asmallkatakanahalfwidth'] = 0xFF67;
  7151. t['asterisk'] = 0x002A;
  7152. t['asteriskaltonearabic'] = 0x066D;
  7153. t['asteriskarabic'] = 0x066D;
  7154. t['asteriskmath'] = 0x2217;
  7155. t['asteriskmonospace'] = 0xFF0A;
  7156. t['asterisksmall'] = 0xFE61;
  7157. t['asterism'] = 0x2042;
  7158. t['asuperior'] = 0xF6E9;
  7159. t['asymptoticallyequal'] = 0x2243;
  7160. t['at'] = 0x0040;
  7161. t['atilde'] = 0x00E3;
  7162. t['atmonospace'] = 0xFF20;
  7163. t['atsmall'] = 0xFE6B;
  7164. t['aturned'] = 0x0250;
  7165. t['aubengali'] = 0x0994;
  7166. t['aubopomofo'] = 0x3120;
  7167. t['audeva'] = 0x0914;
  7168. t['augujarati'] = 0x0A94;
  7169. t['augurmukhi'] = 0x0A14;
  7170. t['aulengthmarkbengali'] = 0x09D7;
  7171. t['aumatragurmukhi'] = 0x0A4C;
  7172. t['auvowelsignbengali'] = 0x09CC;
  7173. t['auvowelsigndeva'] = 0x094C;
  7174. t['auvowelsigngujarati'] = 0x0ACC;
  7175. t['avagrahadeva'] = 0x093D;
  7176. t['aybarmenian'] = 0x0561;
  7177. t['ayin'] = 0x05E2;
  7178. t['ayinaltonehebrew'] = 0xFB20;
  7179. t['ayinhebrew'] = 0x05E2;
  7180. t['b'] = 0x0062;
  7181. t['babengali'] = 0x09AC;
  7182. t['backslash'] = 0x005C;
  7183. t['backslashmonospace'] = 0xFF3C;
  7184. t['badeva'] = 0x092C;
  7185. t['bagujarati'] = 0x0AAC;
  7186. t['bagurmukhi'] = 0x0A2C;
  7187. t['bahiragana'] = 0x3070;
  7188. t['bahtthai'] = 0x0E3F;
  7189. t['bakatakana'] = 0x30D0;
  7190. t['bar'] = 0x007C;
  7191. t['barmonospace'] = 0xFF5C;
  7192. t['bbopomofo'] = 0x3105;
  7193. t['bcircle'] = 0x24D1;
  7194. t['bdotaccent'] = 0x1E03;
  7195. t['bdotbelow'] = 0x1E05;
  7196. t['beamedsixteenthnotes'] = 0x266C;
  7197. t['because'] = 0x2235;
  7198. t['becyrillic'] = 0x0431;
  7199. t['beharabic'] = 0x0628;
  7200. t['behfinalarabic'] = 0xFE90;
  7201. t['behinitialarabic'] = 0xFE91;
  7202. t['behiragana'] = 0x3079;
  7203. t['behmedialarabic'] = 0xFE92;
  7204. t['behmeeminitialarabic'] = 0xFC9F;
  7205. t['behmeemisolatedarabic'] = 0xFC08;
  7206. t['behnoonfinalarabic'] = 0xFC6D;
  7207. t['bekatakana'] = 0x30D9;
  7208. t['benarmenian'] = 0x0562;
  7209. t['bet'] = 0x05D1;
  7210. t['beta'] = 0x03B2;
  7211. t['betasymbolgreek'] = 0x03D0;
  7212. t['betdagesh'] = 0xFB31;
  7213. t['betdageshhebrew'] = 0xFB31;
  7214. t['bethebrew'] = 0x05D1;
  7215. t['betrafehebrew'] = 0xFB4C;
  7216. t['bhabengali'] = 0x09AD;
  7217. t['bhadeva'] = 0x092D;
  7218. t['bhagujarati'] = 0x0AAD;
  7219. t['bhagurmukhi'] = 0x0A2D;
  7220. t['bhook'] = 0x0253;
  7221. t['bihiragana'] = 0x3073;
  7222. t['bikatakana'] = 0x30D3;
  7223. t['bilabialclick'] = 0x0298;
  7224. t['bindigurmukhi'] = 0x0A02;
  7225. t['birusquare'] = 0x3331;
  7226. t['blackcircle'] = 0x25CF;
  7227. t['blackdiamond'] = 0x25C6;
  7228. t['blackdownpointingtriangle'] = 0x25BC;
  7229. t['blackleftpointingpointer'] = 0x25C4;
  7230. t['blackleftpointingtriangle'] = 0x25C0;
  7231. t['blacklenticularbracketleft'] = 0x3010;
  7232. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  7233. t['blacklenticularbracketright'] = 0x3011;
  7234. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  7235. t['blacklowerlefttriangle'] = 0x25E3;
  7236. t['blacklowerrighttriangle'] = 0x25E2;
  7237. t['blackrectangle'] = 0x25AC;
  7238. t['blackrightpointingpointer'] = 0x25BA;
  7239. t['blackrightpointingtriangle'] = 0x25B6;
  7240. t['blacksmallsquare'] = 0x25AA;
  7241. t['blacksmilingface'] = 0x263B;
  7242. t['blacksquare'] = 0x25A0;
  7243. t['blackstar'] = 0x2605;
  7244. t['blackupperlefttriangle'] = 0x25E4;
  7245. t['blackupperrighttriangle'] = 0x25E5;
  7246. t['blackuppointingsmalltriangle'] = 0x25B4;
  7247. t['blackuppointingtriangle'] = 0x25B2;
  7248. t['blank'] = 0x2423;
  7249. t['blinebelow'] = 0x1E07;
  7250. t['block'] = 0x2588;
  7251. t['bmonospace'] = 0xFF42;
  7252. t['bobaimaithai'] = 0x0E1A;
  7253. t['bohiragana'] = 0x307C;
  7254. t['bokatakana'] = 0x30DC;
  7255. t['bparen'] = 0x249D;
  7256. t['bqsquare'] = 0x33C3;
  7257. t['braceex'] = 0xF8F4;
  7258. t['braceleft'] = 0x007B;
  7259. t['braceleftbt'] = 0xF8F3;
  7260. t['braceleftmid'] = 0xF8F2;
  7261. t['braceleftmonospace'] = 0xFF5B;
  7262. t['braceleftsmall'] = 0xFE5B;
  7263. t['bracelefttp'] = 0xF8F1;
  7264. t['braceleftvertical'] = 0xFE37;
  7265. t['braceright'] = 0x007D;
  7266. t['bracerightbt'] = 0xF8FE;
  7267. t['bracerightmid'] = 0xF8FD;
  7268. t['bracerightmonospace'] = 0xFF5D;
  7269. t['bracerightsmall'] = 0xFE5C;
  7270. t['bracerighttp'] = 0xF8FC;
  7271. t['bracerightvertical'] = 0xFE38;
  7272. t['bracketleft'] = 0x005B;
  7273. t['bracketleftbt'] = 0xF8F0;
  7274. t['bracketleftex'] = 0xF8EF;
  7275. t['bracketleftmonospace'] = 0xFF3B;
  7276. t['bracketlefttp'] = 0xF8EE;
  7277. t['bracketright'] = 0x005D;
  7278. t['bracketrightbt'] = 0xF8FB;
  7279. t['bracketrightex'] = 0xF8FA;
  7280. t['bracketrightmonospace'] = 0xFF3D;
  7281. t['bracketrighttp'] = 0xF8F9;
  7282. t['breve'] = 0x02D8;
  7283. t['brevebelowcmb'] = 0x032E;
  7284. t['brevecmb'] = 0x0306;
  7285. t['breveinvertedbelowcmb'] = 0x032F;
  7286. t['breveinvertedcmb'] = 0x0311;
  7287. t['breveinverteddoublecmb'] = 0x0361;
  7288. t['bridgebelowcmb'] = 0x032A;
  7289. t['bridgeinvertedbelowcmb'] = 0x033A;
  7290. t['brokenbar'] = 0x00A6;
  7291. t['bstroke'] = 0x0180;
  7292. t['bsuperior'] = 0xF6EA;
  7293. t['btopbar'] = 0x0183;
  7294. t['buhiragana'] = 0x3076;
  7295. t['bukatakana'] = 0x30D6;
  7296. t['bullet'] = 0x2022;
  7297. t['bulletinverse'] = 0x25D8;
  7298. t['bulletoperator'] = 0x2219;
  7299. t['bullseye'] = 0x25CE;
  7300. t['c'] = 0x0063;
  7301. t['caarmenian'] = 0x056E;
  7302. t['cabengali'] = 0x099A;
  7303. t['cacute'] = 0x0107;
  7304. t['cadeva'] = 0x091A;
  7305. t['cagujarati'] = 0x0A9A;
  7306. t['cagurmukhi'] = 0x0A1A;
  7307. t['calsquare'] = 0x3388;
  7308. t['candrabindubengali'] = 0x0981;
  7309. t['candrabinducmb'] = 0x0310;
  7310. t['candrabindudeva'] = 0x0901;
  7311. t['candrabindugujarati'] = 0x0A81;
  7312. t['capslock'] = 0x21EA;
  7313. t['careof'] = 0x2105;
  7314. t['caron'] = 0x02C7;
  7315. t['caronbelowcmb'] = 0x032C;
  7316. t['caroncmb'] = 0x030C;
  7317. t['carriagereturn'] = 0x21B5;
  7318. t['cbopomofo'] = 0x3118;
  7319. t['ccaron'] = 0x010D;
  7320. t['ccedilla'] = 0x00E7;
  7321. t['ccedillaacute'] = 0x1E09;
  7322. t['ccircle'] = 0x24D2;
  7323. t['ccircumflex'] = 0x0109;
  7324. t['ccurl'] = 0x0255;
  7325. t['cdot'] = 0x010B;
  7326. t['cdotaccent'] = 0x010B;
  7327. t['cdsquare'] = 0x33C5;
  7328. t['cedilla'] = 0x00B8;
  7329. t['cedillacmb'] = 0x0327;
  7330. t['cent'] = 0x00A2;
  7331. t['centigrade'] = 0x2103;
  7332. t['centinferior'] = 0xF6DF;
  7333. t['centmonospace'] = 0xFFE0;
  7334. t['centoldstyle'] = 0xF7A2;
  7335. t['centsuperior'] = 0xF6E0;
  7336. t['chaarmenian'] = 0x0579;
  7337. t['chabengali'] = 0x099B;
  7338. t['chadeva'] = 0x091B;
  7339. t['chagujarati'] = 0x0A9B;
  7340. t['chagurmukhi'] = 0x0A1B;
  7341. t['chbopomofo'] = 0x3114;
  7342. t['cheabkhasiancyrillic'] = 0x04BD;
  7343. t['checkmark'] = 0x2713;
  7344. t['checyrillic'] = 0x0447;
  7345. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  7346. t['chedescendercyrillic'] = 0x04B7;
  7347. t['chedieresiscyrillic'] = 0x04F5;
  7348. t['cheharmenian'] = 0x0573;
  7349. t['chekhakassiancyrillic'] = 0x04CC;
  7350. t['cheverticalstrokecyrillic'] = 0x04B9;
  7351. t['chi'] = 0x03C7;
  7352. t['chieuchacirclekorean'] = 0x3277;
  7353. t['chieuchaparenkorean'] = 0x3217;
  7354. t['chieuchcirclekorean'] = 0x3269;
  7355. t['chieuchkorean'] = 0x314A;
  7356. t['chieuchparenkorean'] = 0x3209;
  7357. t['chochangthai'] = 0x0E0A;
  7358. t['chochanthai'] = 0x0E08;
  7359. t['chochingthai'] = 0x0E09;
  7360. t['chochoethai'] = 0x0E0C;
  7361. t['chook'] = 0x0188;
  7362. t['cieucacirclekorean'] = 0x3276;
  7363. t['cieucaparenkorean'] = 0x3216;
  7364. t['cieuccirclekorean'] = 0x3268;
  7365. t['cieuckorean'] = 0x3148;
  7366. t['cieucparenkorean'] = 0x3208;
  7367. t['cieucuparenkorean'] = 0x321C;
  7368. t['circle'] = 0x25CB;
  7369. t['circlecopyrt'] = 0x00A9;
  7370. t['circlemultiply'] = 0x2297;
  7371. t['circleot'] = 0x2299;
  7372. t['circleplus'] = 0x2295;
  7373. t['circlepostalmark'] = 0x3036;
  7374. t['circlewithlefthalfblack'] = 0x25D0;
  7375. t['circlewithrighthalfblack'] = 0x25D1;
  7376. t['circumflex'] = 0x02C6;
  7377. t['circumflexbelowcmb'] = 0x032D;
  7378. t['circumflexcmb'] = 0x0302;
  7379. t['clear'] = 0x2327;
  7380. t['clickalveolar'] = 0x01C2;
  7381. t['clickdental'] = 0x01C0;
  7382. t['clicklateral'] = 0x01C1;
  7383. t['clickretroflex'] = 0x01C3;
  7384. t['club'] = 0x2663;
  7385. t['clubsuitblack'] = 0x2663;
  7386. t['clubsuitwhite'] = 0x2667;
  7387. t['cmcubedsquare'] = 0x33A4;
  7388. t['cmonospace'] = 0xFF43;
  7389. t['cmsquaredsquare'] = 0x33A0;
  7390. t['coarmenian'] = 0x0581;
  7391. t['colon'] = 0x003A;
  7392. t['colonmonetary'] = 0x20A1;
  7393. t['colonmonospace'] = 0xFF1A;
  7394. t['colonsign'] = 0x20A1;
  7395. t['colonsmall'] = 0xFE55;
  7396. t['colontriangularhalfmod'] = 0x02D1;
  7397. t['colontriangularmod'] = 0x02D0;
  7398. t['comma'] = 0x002C;
  7399. t['commaabovecmb'] = 0x0313;
  7400. t['commaaboverightcmb'] = 0x0315;
  7401. t['commaaccent'] = 0xF6C3;
  7402. t['commaarabic'] = 0x060C;
  7403. t['commaarmenian'] = 0x055D;
  7404. t['commainferior'] = 0xF6E1;
  7405. t['commamonospace'] = 0xFF0C;
  7406. t['commareversedabovecmb'] = 0x0314;
  7407. t['commareversedmod'] = 0x02BD;
  7408. t['commasmall'] = 0xFE50;
  7409. t['commasuperior'] = 0xF6E2;
  7410. t['commaturnedabovecmb'] = 0x0312;
  7411. t['commaturnedmod'] = 0x02BB;
  7412. t['compass'] = 0x263C;
  7413. t['congruent'] = 0x2245;
  7414. t['contourintegral'] = 0x222E;
  7415. t['control'] = 0x2303;
  7416. t['controlACK'] = 0x0006;
  7417. t['controlBEL'] = 0x0007;
  7418. t['controlBS'] = 0x0008;
  7419. t['controlCAN'] = 0x0018;
  7420. t['controlCR'] = 0x000D;
  7421. t['controlDC1'] = 0x0011;
  7422. t['controlDC2'] = 0x0012;
  7423. t['controlDC3'] = 0x0013;
  7424. t['controlDC4'] = 0x0014;
  7425. t['controlDEL'] = 0x007F;
  7426. t['controlDLE'] = 0x0010;
  7427. t['controlEM'] = 0x0019;
  7428. t['controlENQ'] = 0x0005;
  7429. t['controlEOT'] = 0x0004;
  7430. t['controlESC'] = 0x001B;
  7431. t['controlETB'] = 0x0017;
  7432. t['controlETX'] = 0x0003;
  7433. t['controlFF'] = 0x000C;
  7434. t['controlFS'] = 0x001C;
  7435. t['controlGS'] = 0x001D;
  7436. t['controlHT'] = 0x0009;
  7437. t['controlLF'] = 0x000A;
  7438. t['controlNAK'] = 0x0015;
  7439. t['controlNULL'] = 0x0000;
  7440. t['controlRS'] = 0x001E;
  7441. t['controlSI'] = 0x000F;
  7442. t['controlSO'] = 0x000E;
  7443. t['controlSOT'] = 0x0002;
  7444. t['controlSTX'] = 0x0001;
  7445. t['controlSUB'] = 0x001A;
  7446. t['controlSYN'] = 0x0016;
  7447. t['controlUS'] = 0x001F;
  7448. t['controlVT'] = 0x000B;
  7449. t['copyright'] = 0x00A9;
  7450. t['copyrightsans'] = 0xF8E9;
  7451. t['copyrightserif'] = 0xF6D9;
  7452. t['cornerbracketleft'] = 0x300C;
  7453. t['cornerbracketlefthalfwidth'] = 0xFF62;
  7454. t['cornerbracketleftvertical'] = 0xFE41;
  7455. t['cornerbracketright'] = 0x300D;
  7456. t['cornerbracketrighthalfwidth'] = 0xFF63;
  7457. t['cornerbracketrightvertical'] = 0xFE42;
  7458. t['corporationsquare'] = 0x337F;
  7459. t['cosquare'] = 0x33C7;
  7460. t['coverkgsquare'] = 0x33C6;
  7461. t['cparen'] = 0x249E;
  7462. t['cruzeiro'] = 0x20A2;
  7463. t['cstretched'] = 0x0297;
  7464. t['curlyand'] = 0x22CF;
  7465. t['curlyor'] = 0x22CE;
  7466. t['currency'] = 0x00A4;
  7467. t['cyrBreve'] = 0xF6D1;
  7468. t['cyrFlex'] = 0xF6D2;
  7469. t['cyrbreve'] = 0xF6D4;
  7470. t['cyrflex'] = 0xF6D5;
  7471. t['d'] = 0x0064;
  7472. t['daarmenian'] = 0x0564;
  7473. t['dabengali'] = 0x09A6;
  7474. t['dadarabic'] = 0x0636;
  7475. t['dadeva'] = 0x0926;
  7476. t['dadfinalarabic'] = 0xFEBE;
  7477. t['dadinitialarabic'] = 0xFEBF;
  7478. t['dadmedialarabic'] = 0xFEC0;
  7479. t['dagesh'] = 0x05BC;
  7480. t['dageshhebrew'] = 0x05BC;
  7481. t['dagger'] = 0x2020;
  7482. t['daggerdbl'] = 0x2021;
  7483. t['dagujarati'] = 0x0AA6;
  7484. t['dagurmukhi'] = 0x0A26;
  7485. t['dahiragana'] = 0x3060;
  7486. t['dakatakana'] = 0x30C0;
  7487. t['dalarabic'] = 0x062F;
  7488. t['dalet'] = 0x05D3;
  7489. t['daletdagesh'] = 0xFB33;
  7490. t['daletdageshhebrew'] = 0xFB33;
  7491. t['dalethebrew'] = 0x05D3;
  7492. t['dalfinalarabic'] = 0xFEAA;
  7493. t['dammaarabic'] = 0x064F;
  7494. t['dammalowarabic'] = 0x064F;
  7495. t['dammatanaltonearabic'] = 0x064C;
  7496. t['dammatanarabic'] = 0x064C;
  7497. t['danda'] = 0x0964;
  7498. t['dargahebrew'] = 0x05A7;
  7499. t['dargalefthebrew'] = 0x05A7;
  7500. t['dasiapneumatacyrilliccmb'] = 0x0485;
  7501. t['dblGrave'] = 0xF6D3;
  7502. t['dblanglebracketleft'] = 0x300A;
  7503. t['dblanglebracketleftvertical'] = 0xFE3D;
  7504. t['dblanglebracketright'] = 0x300B;
  7505. t['dblanglebracketrightvertical'] = 0xFE3E;
  7506. t['dblarchinvertedbelowcmb'] = 0x032B;
  7507. t['dblarrowleft'] = 0x21D4;
  7508. t['dblarrowright'] = 0x21D2;
  7509. t['dbldanda'] = 0x0965;
  7510. t['dblgrave'] = 0xF6D6;
  7511. t['dblgravecmb'] = 0x030F;
  7512. t['dblintegral'] = 0x222C;
  7513. t['dbllowline'] = 0x2017;
  7514. t['dbllowlinecmb'] = 0x0333;
  7515. t['dbloverlinecmb'] = 0x033F;
  7516. t['dblprimemod'] = 0x02BA;
  7517. t['dblverticalbar'] = 0x2016;
  7518. t['dblverticallineabovecmb'] = 0x030E;
  7519. t['dbopomofo'] = 0x3109;
  7520. t['dbsquare'] = 0x33C8;
  7521. t['dcaron'] = 0x010F;
  7522. t['dcedilla'] = 0x1E11;
  7523. t['dcircle'] = 0x24D3;
  7524. t['dcircumflexbelow'] = 0x1E13;
  7525. t['dcroat'] = 0x0111;
  7526. t['ddabengali'] = 0x09A1;
  7527. t['ddadeva'] = 0x0921;
  7528. t['ddagujarati'] = 0x0AA1;
  7529. t['ddagurmukhi'] = 0x0A21;
  7530. t['ddalarabic'] = 0x0688;
  7531. t['ddalfinalarabic'] = 0xFB89;
  7532. t['dddhadeva'] = 0x095C;
  7533. t['ddhabengali'] = 0x09A2;
  7534. t['ddhadeva'] = 0x0922;
  7535. t['ddhagujarati'] = 0x0AA2;
  7536. t['ddhagurmukhi'] = 0x0A22;
  7537. t['ddotaccent'] = 0x1E0B;
  7538. t['ddotbelow'] = 0x1E0D;
  7539. t['decimalseparatorarabic'] = 0x066B;
  7540. t['decimalseparatorpersian'] = 0x066B;
  7541. t['decyrillic'] = 0x0434;
  7542. t['degree'] = 0x00B0;
  7543. t['dehihebrew'] = 0x05AD;
  7544. t['dehiragana'] = 0x3067;
  7545. t['deicoptic'] = 0x03EF;
  7546. t['dekatakana'] = 0x30C7;
  7547. t['deleteleft'] = 0x232B;
  7548. t['deleteright'] = 0x2326;
  7549. t['delta'] = 0x03B4;
  7550. t['deltaturned'] = 0x018D;
  7551. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  7552. t['dezh'] = 0x02A4;
  7553. t['dhabengali'] = 0x09A7;
  7554. t['dhadeva'] = 0x0927;
  7555. t['dhagujarati'] = 0x0AA7;
  7556. t['dhagurmukhi'] = 0x0A27;
  7557. t['dhook'] = 0x0257;
  7558. t['dialytikatonos'] = 0x0385;
  7559. t['dialytikatonoscmb'] = 0x0344;
  7560. t['diamond'] = 0x2666;
  7561. t['diamondsuitwhite'] = 0x2662;
  7562. t['dieresis'] = 0x00A8;
  7563. t['dieresisacute'] = 0xF6D7;
  7564. t['dieresisbelowcmb'] = 0x0324;
  7565. t['dieresiscmb'] = 0x0308;
  7566. t['dieresisgrave'] = 0xF6D8;
  7567. t['dieresistonos'] = 0x0385;
  7568. t['dihiragana'] = 0x3062;
  7569. t['dikatakana'] = 0x30C2;
  7570. t['dittomark'] = 0x3003;
  7571. t['divide'] = 0x00F7;
  7572. t['divides'] = 0x2223;
  7573. t['divisionslash'] = 0x2215;
  7574. t['djecyrillic'] = 0x0452;
  7575. t['dkshade'] = 0x2593;
  7576. t['dlinebelow'] = 0x1E0F;
  7577. t['dlsquare'] = 0x3397;
  7578. t['dmacron'] = 0x0111;
  7579. t['dmonospace'] = 0xFF44;
  7580. t['dnblock'] = 0x2584;
  7581. t['dochadathai'] = 0x0E0E;
  7582. t['dodekthai'] = 0x0E14;
  7583. t['dohiragana'] = 0x3069;
  7584. t['dokatakana'] = 0x30C9;
  7585. t['dollar'] = 0x0024;
  7586. t['dollarinferior'] = 0xF6E3;
  7587. t['dollarmonospace'] = 0xFF04;
  7588. t['dollaroldstyle'] = 0xF724;
  7589. t['dollarsmall'] = 0xFE69;
  7590. t['dollarsuperior'] = 0xF6E4;
  7591. t['dong'] = 0x20AB;
  7592. t['dorusquare'] = 0x3326;
  7593. t['dotaccent'] = 0x02D9;
  7594. t['dotaccentcmb'] = 0x0307;
  7595. t['dotbelowcmb'] = 0x0323;
  7596. t['dotbelowcomb'] = 0x0323;
  7597. t['dotkatakana'] = 0x30FB;
  7598. t['dotlessi'] = 0x0131;
  7599. t['dotlessj'] = 0xF6BE;
  7600. t['dotlessjstrokehook'] = 0x0284;
  7601. t['dotmath'] = 0x22C5;
  7602. t['dottedcircle'] = 0x25CC;
  7603. t['doubleyodpatah'] = 0xFB1F;
  7604. t['doubleyodpatahhebrew'] = 0xFB1F;
  7605. t['downtackbelowcmb'] = 0x031E;
  7606. t['downtackmod'] = 0x02D5;
  7607. t['dparen'] = 0x249F;
  7608. t['dsuperior'] = 0xF6EB;
  7609. t['dtail'] = 0x0256;
  7610. t['dtopbar'] = 0x018C;
  7611. t['duhiragana'] = 0x3065;
  7612. t['dukatakana'] = 0x30C5;
  7613. t['dz'] = 0x01F3;
  7614. t['dzaltone'] = 0x02A3;
  7615. t['dzcaron'] = 0x01C6;
  7616. t['dzcurl'] = 0x02A5;
  7617. t['dzeabkhasiancyrillic'] = 0x04E1;
  7618. t['dzecyrillic'] = 0x0455;
  7619. t['dzhecyrillic'] = 0x045F;
  7620. t['e'] = 0x0065;
  7621. t['eacute'] = 0x00E9;
  7622. t['earth'] = 0x2641;
  7623. t['ebengali'] = 0x098F;
  7624. t['ebopomofo'] = 0x311C;
  7625. t['ebreve'] = 0x0115;
  7626. t['ecandradeva'] = 0x090D;
  7627. t['ecandragujarati'] = 0x0A8D;
  7628. t['ecandravowelsigndeva'] = 0x0945;
  7629. t['ecandravowelsigngujarati'] = 0x0AC5;
  7630. t['ecaron'] = 0x011B;
  7631. t['ecedillabreve'] = 0x1E1D;
  7632. t['echarmenian'] = 0x0565;
  7633. t['echyiwnarmenian'] = 0x0587;
  7634. t['ecircle'] = 0x24D4;
  7635. t['ecircumflex'] = 0x00EA;
  7636. t['ecircumflexacute'] = 0x1EBF;
  7637. t['ecircumflexbelow'] = 0x1E19;
  7638. t['ecircumflexdotbelow'] = 0x1EC7;
  7639. t['ecircumflexgrave'] = 0x1EC1;
  7640. t['ecircumflexhookabove'] = 0x1EC3;
  7641. t['ecircumflextilde'] = 0x1EC5;
  7642. t['ecyrillic'] = 0x0454;
  7643. t['edblgrave'] = 0x0205;
  7644. t['edeva'] = 0x090F;
  7645. t['edieresis'] = 0x00EB;
  7646. t['edot'] = 0x0117;
  7647. t['edotaccent'] = 0x0117;
  7648. t['edotbelow'] = 0x1EB9;
  7649. t['eegurmukhi'] = 0x0A0F;
  7650. t['eematragurmukhi'] = 0x0A47;
  7651. t['efcyrillic'] = 0x0444;
  7652. t['egrave'] = 0x00E8;
  7653. t['egujarati'] = 0x0A8F;
  7654. t['eharmenian'] = 0x0567;
  7655. t['ehbopomofo'] = 0x311D;
  7656. t['ehiragana'] = 0x3048;
  7657. t['ehookabove'] = 0x1EBB;
  7658. t['eibopomofo'] = 0x311F;
  7659. t['eight'] = 0x0038;
  7660. t['eightarabic'] = 0x0668;
  7661. t['eightbengali'] = 0x09EE;
  7662. t['eightcircle'] = 0x2467;
  7663. t['eightcircleinversesansserif'] = 0x2791;
  7664. t['eightdeva'] = 0x096E;
  7665. t['eighteencircle'] = 0x2471;
  7666. t['eighteenparen'] = 0x2485;
  7667. t['eighteenperiod'] = 0x2499;
  7668. t['eightgujarati'] = 0x0AEE;
  7669. t['eightgurmukhi'] = 0x0A6E;
  7670. t['eighthackarabic'] = 0x0668;
  7671. t['eighthangzhou'] = 0x3028;
  7672. t['eighthnotebeamed'] = 0x266B;
  7673. t['eightideographicparen'] = 0x3227;
  7674. t['eightinferior'] = 0x2088;
  7675. t['eightmonospace'] = 0xFF18;
  7676. t['eightoldstyle'] = 0xF738;
  7677. t['eightparen'] = 0x247B;
  7678. t['eightperiod'] = 0x248F;
  7679. t['eightpersian'] = 0x06F8;
  7680. t['eightroman'] = 0x2177;
  7681. t['eightsuperior'] = 0x2078;
  7682. t['eightthai'] = 0x0E58;
  7683. t['einvertedbreve'] = 0x0207;
  7684. t['eiotifiedcyrillic'] = 0x0465;
  7685. t['ekatakana'] = 0x30A8;
  7686. t['ekatakanahalfwidth'] = 0xFF74;
  7687. t['ekonkargurmukhi'] = 0x0A74;
  7688. t['ekorean'] = 0x3154;
  7689. t['elcyrillic'] = 0x043B;
  7690. t['element'] = 0x2208;
  7691. t['elevencircle'] = 0x246A;
  7692. t['elevenparen'] = 0x247E;
  7693. t['elevenperiod'] = 0x2492;
  7694. t['elevenroman'] = 0x217A;
  7695. t['ellipsis'] = 0x2026;
  7696. t['ellipsisvertical'] = 0x22EE;
  7697. t['emacron'] = 0x0113;
  7698. t['emacronacute'] = 0x1E17;
  7699. t['emacrongrave'] = 0x1E15;
  7700. t['emcyrillic'] = 0x043C;
  7701. t['emdash'] = 0x2014;
  7702. t['emdashvertical'] = 0xFE31;
  7703. t['emonospace'] = 0xFF45;
  7704. t['emphasismarkarmenian'] = 0x055B;
  7705. t['emptyset'] = 0x2205;
  7706. t['enbopomofo'] = 0x3123;
  7707. t['encyrillic'] = 0x043D;
  7708. t['endash'] = 0x2013;
  7709. t['endashvertical'] = 0xFE32;
  7710. t['endescendercyrillic'] = 0x04A3;
  7711. t['eng'] = 0x014B;
  7712. t['engbopomofo'] = 0x3125;
  7713. t['enghecyrillic'] = 0x04A5;
  7714. t['enhookcyrillic'] = 0x04C8;
  7715. t['enspace'] = 0x2002;
  7716. t['eogonek'] = 0x0119;
  7717. t['eokorean'] = 0x3153;
  7718. t['eopen'] = 0x025B;
  7719. t['eopenclosed'] = 0x029A;
  7720. t['eopenreversed'] = 0x025C;
  7721. t['eopenreversedclosed'] = 0x025E;
  7722. t['eopenreversedhook'] = 0x025D;
  7723. t['eparen'] = 0x24A0;
  7724. t['epsilon'] = 0x03B5;
  7725. t['epsilontonos'] = 0x03AD;
  7726. t['equal'] = 0x003D;
  7727. t['equalmonospace'] = 0xFF1D;
  7728. t['equalsmall'] = 0xFE66;
  7729. t['equalsuperior'] = 0x207C;
  7730. t['equivalence'] = 0x2261;
  7731. t['erbopomofo'] = 0x3126;
  7732. t['ercyrillic'] = 0x0440;
  7733. t['ereversed'] = 0x0258;
  7734. t['ereversedcyrillic'] = 0x044D;
  7735. t['escyrillic'] = 0x0441;
  7736. t['esdescendercyrillic'] = 0x04AB;
  7737. t['esh'] = 0x0283;
  7738. t['eshcurl'] = 0x0286;
  7739. t['eshortdeva'] = 0x090E;
  7740. t['eshortvowelsigndeva'] = 0x0946;
  7741. t['eshreversedloop'] = 0x01AA;
  7742. t['eshsquatreversed'] = 0x0285;
  7743. t['esmallhiragana'] = 0x3047;
  7744. t['esmallkatakana'] = 0x30A7;
  7745. t['esmallkatakanahalfwidth'] = 0xFF6A;
  7746. t['estimated'] = 0x212E;
  7747. t['esuperior'] = 0xF6EC;
  7748. t['eta'] = 0x03B7;
  7749. t['etarmenian'] = 0x0568;
  7750. t['etatonos'] = 0x03AE;
  7751. t['eth'] = 0x00F0;
  7752. t['etilde'] = 0x1EBD;
  7753. t['etildebelow'] = 0x1E1B;
  7754. t['etnahtafoukhhebrew'] = 0x0591;
  7755. t['etnahtafoukhlefthebrew'] = 0x0591;
  7756. t['etnahtahebrew'] = 0x0591;
  7757. t['etnahtalefthebrew'] = 0x0591;
  7758. t['eturned'] = 0x01DD;
  7759. t['eukorean'] = 0x3161;
  7760. t['euro'] = 0x20AC;
  7761. t['evowelsignbengali'] = 0x09C7;
  7762. t['evowelsigndeva'] = 0x0947;
  7763. t['evowelsigngujarati'] = 0x0AC7;
  7764. t['exclam'] = 0x0021;
  7765. t['exclamarmenian'] = 0x055C;
  7766. t['exclamdbl'] = 0x203C;
  7767. t['exclamdown'] = 0x00A1;
  7768. t['exclamdownsmall'] = 0xF7A1;
  7769. t['exclammonospace'] = 0xFF01;
  7770. t['exclamsmall'] = 0xF721;
  7771. t['existential'] = 0x2203;
  7772. t['ezh'] = 0x0292;
  7773. t['ezhcaron'] = 0x01EF;
  7774. t['ezhcurl'] = 0x0293;
  7775. t['ezhreversed'] = 0x01B9;
  7776. t['ezhtail'] = 0x01BA;
  7777. t['f'] = 0x0066;
  7778. t['fadeva'] = 0x095E;
  7779. t['fagurmukhi'] = 0x0A5E;
  7780. t['fahrenheit'] = 0x2109;
  7781. t['fathaarabic'] = 0x064E;
  7782. t['fathalowarabic'] = 0x064E;
  7783. t['fathatanarabic'] = 0x064B;
  7784. t['fbopomofo'] = 0x3108;
  7785. t['fcircle'] = 0x24D5;
  7786. t['fdotaccent'] = 0x1E1F;
  7787. t['feharabic'] = 0x0641;
  7788. t['feharmenian'] = 0x0586;
  7789. t['fehfinalarabic'] = 0xFED2;
  7790. t['fehinitialarabic'] = 0xFED3;
  7791. t['fehmedialarabic'] = 0xFED4;
  7792. t['feicoptic'] = 0x03E5;
  7793. t['female'] = 0x2640;
  7794. t['ff'] = 0xFB00;
  7795. t['ffi'] = 0xFB03;
  7796. t['ffl'] = 0xFB04;
  7797. t['fi'] = 0xFB01;
  7798. t['fifteencircle'] = 0x246E;
  7799. t['fifteenparen'] = 0x2482;
  7800. t['fifteenperiod'] = 0x2496;
  7801. t['figuredash'] = 0x2012;
  7802. t['filledbox'] = 0x25A0;
  7803. t['filledrect'] = 0x25AC;
  7804. t['finalkaf'] = 0x05DA;
  7805. t['finalkafdagesh'] = 0xFB3A;
  7806. t['finalkafdageshhebrew'] = 0xFB3A;
  7807. t['finalkafhebrew'] = 0x05DA;
  7808. t['finalmem'] = 0x05DD;
  7809. t['finalmemhebrew'] = 0x05DD;
  7810. t['finalnun'] = 0x05DF;
  7811. t['finalnunhebrew'] = 0x05DF;
  7812. t['finalpe'] = 0x05E3;
  7813. t['finalpehebrew'] = 0x05E3;
  7814. t['finaltsadi'] = 0x05E5;
  7815. t['finaltsadihebrew'] = 0x05E5;
  7816. t['firsttonechinese'] = 0x02C9;
  7817. t['fisheye'] = 0x25C9;
  7818. t['fitacyrillic'] = 0x0473;
  7819. t['five'] = 0x0035;
  7820. t['fivearabic'] = 0x0665;
  7821. t['fivebengali'] = 0x09EB;
  7822. t['fivecircle'] = 0x2464;
  7823. t['fivecircleinversesansserif'] = 0x278E;
  7824. t['fivedeva'] = 0x096B;
  7825. t['fiveeighths'] = 0x215D;
  7826. t['fivegujarati'] = 0x0AEB;
  7827. t['fivegurmukhi'] = 0x0A6B;
  7828. t['fivehackarabic'] = 0x0665;
  7829. t['fivehangzhou'] = 0x3025;
  7830. t['fiveideographicparen'] = 0x3224;
  7831. t['fiveinferior'] = 0x2085;
  7832. t['fivemonospace'] = 0xFF15;
  7833. t['fiveoldstyle'] = 0xF735;
  7834. t['fiveparen'] = 0x2478;
  7835. t['fiveperiod'] = 0x248C;
  7836. t['fivepersian'] = 0x06F5;
  7837. t['fiveroman'] = 0x2174;
  7838. t['fivesuperior'] = 0x2075;
  7839. t['fivethai'] = 0x0E55;
  7840. t['fl'] = 0xFB02;
  7841. t['florin'] = 0x0192;
  7842. t['fmonospace'] = 0xFF46;
  7843. t['fmsquare'] = 0x3399;
  7844. t['fofanthai'] = 0x0E1F;
  7845. t['fofathai'] = 0x0E1D;
  7846. t['fongmanthai'] = 0x0E4F;
  7847. t['forall'] = 0x2200;
  7848. t['four'] = 0x0034;
  7849. t['fourarabic'] = 0x0664;
  7850. t['fourbengali'] = 0x09EA;
  7851. t['fourcircle'] = 0x2463;
  7852. t['fourcircleinversesansserif'] = 0x278D;
  7853. t['fourdeva'] = 0x096A;
  7854. t['fourgujarati'] = 0x0AEA;
  7855. t['fourgurmukhi'] = 0x0A6A;
  7856. t['fourhackarabic'] = 0x0664;
  7857. t['fourhangzhou'] = 0x3024;
  7858. t['fourideographicparen'] = 0x3223;
  7859. t['fourinferior'] = 0x2084;
  7860. t['fourmonospace'] = 0xFF14;
  7861. t['fournumeratorbengali'] = 0x09F7;
  7862. t['fouroldstyle'] = 0xF734;
  7863. t['fourparen'] = 0x2477;
  7864. t['fourperiod'] = 0x248B;
  7865. t['fourpersian'] = 0x06F4;
  7866. t['fourroman'] = 0x2173;
  7867. t['foursuperior'] = 0x2074;
  7868. t['fourteencircle'] = 0x246D;
  7869. t['fourteenparen'] = 0x2481;
  7870. t['fourteenperiod'] = 0x2495;
  7871. t['fourthai'] = 0x0E54;
  7872. t['fourthtonechinese'] = 0x02CB;
  7873. t['fparen'] = 0x24A1;
  7874. t['fraction'] = 0x2044;
  7875. t['franc'] = 0x20A3;
  7876. t['g'] = 0x0067;
  7877. t['gabengali'] = 0x0997;
  7878. t['gacute'] = 0x01F5;
  7879. t['gadeva'] = 0x0917;
  7880. t['gafarabic'] = 0x06AF;
  7881. t['gaffinalarabic'] = 0xFB93;
  7882. t['gafinitialarabic'] = 0xFB94;
  7883. t['gafmedialarabic'] = 0xFB95;
  7884. t['gagujarati'] = 0x0A97;
  7885. t['gagurmukhi'] = 0x0A17;
  7886. t['gahiragana'] = 0x304C;
  7887. t['gakatakana'] = 0x30AC;
  7888. t['gamma'] = 0x03B3;
  7889. t['gammalatinsmall'] = 0x0263;
  7890. t['gammasuperior'] = 0x02E0;
  7891. t['gangiacoptic'] = 0x03EB;
  7892. t['gbopomofo'] = 0x310D;
  7893. t['gbreve'] = 0x011F;
  7894. t['gcaron'] = 0x01E7;
  7895. t['gcedilla'] = 0x0123;
  7896. t['gcircle'] = 0x24D6;
  7897. t['gcircumflex'] = 0x011D;
  7898. t['gcommaaccent'] = 0x0123;
  7899. t['gdot'] = 0x0121;
  7900. t['gdotaccent'] = 0x0121;
  7901. t['gecyrillic'] = 0x0433;
  7902. t['gehiragana'] = 0x3052;
  7903. t['gekatakana'] = 0x30B2;
  7904. t['geometricallyequal'] = 0x2251;
  7905. t['gereshaccenthebrew'] = 0x059C;
  7906. t['gereshhebrew'] = 0x05F3;
  7907. t['gereshmuqdamhebrew'] = 0x059D;
  7908. t['germandbls'] = 0x00DF;
  7909. t['gershayimaccenthebrew'] = 0x059E;
  7910. t['gershayimhebrew'] = 0x05F4;
  7911. t['getamark'] = 0x3013;
  7912. t['ghabengali'] = 0x0998;
  7913. t['ghadarmenian'] = 0x0572;
  7914. t['ghadeva'] = 0x0918;
  7915. t['ghagujarati'] = 0x0A98;
  7916. t['ghagurmukhi'] = 0x0A18;
  7917. t['ghainarabic'] = 0x063A;
  7918. t['ghainfinalarabic'] = 0xFECE;
  7919. t['ghaininitialarabic'] = 0xFECF;
  7920. t['ghainmedialarabic'] = 0xFED0;
  7921. t['ghemiddlehookcyrillic'] = 0x0495;
  7922. t['ghestrokecyrillic'] = 0x0493;
  7923. t['gheupturncyrillic'] = 0x0491;
  7924. t['ghhadeva'] = 0x095A;
  7925. t['ghhagurmukhi'] = 0x0A5A;
  7926. t['ghook'] = 0x0260;
  7927. t['ghzsquare'] = 0x3393;
  7928. t['gihiragana'] = 0x304E;
  7929. t['gikatakana'] = 0x30AE;
  7930. t['gimarmenian'] = 0x0563;
  7931. t['gimel'] = 0x05D2;
  7932. t['gimeldagesh'] = 0xFB32;
  7933. t['gimeldageshhebrew'] = 0xFB32;
  7934. t['gimelhebrew'] = 0x05D2;
  7935. t['gjecyrillic'] = 0x0453;
  7936. t['glottalinvertedstroke'] = 0x01BE;
  7937. t['glottalstop'] = 0x0294;
  7938. t['glottalstopinverted'] = 0x0296;
  7939. t['glottalstopmod'] = 0x02C0;
  7940. t['glottalstopreversed'] = 0x0295;
  7941. t['glottalstopreversedmod'] = 0x02C1;
  7942. t['glottalstopreversedsuperior'] = 0x02E4;
  7943. t['glottalstopstroke'] = 0x02A1;
  7944. t['glottalstopstrokereversed'] = 0x02A2;
  7945. t['gmacron'] = 0x1E21;
  7946. t['gmonospace'] = 0xFF47;
  7947. t['gohiragana'] = 0x3054;
  7948. t['gokatakana'] = 0x30B4;
  7949. t['gparen'] = 0x24A2;
  7950. t['gpasquare'] = 0x33AC;
  7951. t['gradient'] = 0x2207;
  7952. t['grave'] = 0x0060;
  7953. t['gravebelowcmb'] = 0x0316;
  7954. t['gravecmb'] = 0x0300;
  7955. t['gravecomb'] = 0x0300;
  7956. t['gravedeva'] = 0x0953;
  7957. t['gravelowmod'] = 0x02CE;
  7958. t['gravemonospace'] = 0xFF40;
  7959. t['gravetonecmb'] = 0x0340;
  7960. t['greater'] = 0x003E;
  7961. t['greaterequal'] = 0x2265;
  7962. t['greaterequalorless'] = 0x22DB;
  7963. t['greatermonospace'] = 0xFF1E;
  7964. t['greaterorequivalent'] = 0x2273;
  7965. t['greaterorless'] = 0x2277;
  7966. t['greateroverequal'] = 0x2267;
  7967. t['greatersmall'] = 0xFE65;
  7968. t['gscript'] = 0x0261;
  7969. t['gstroke'] = 0x01E5;
  7970. t['guhiragana'] = 0x3050;
  7971. t['guillemotleft'] = 0x00AB;
  7972. t['guillemotright'] = 0x00BB;
  7973. t['guilsinglleft'] = 0x2039;
  7974. t['guilsinglright'] = 0x203A;
  7975. t['gukatakana'] = 0x30B0;
  7976. t['guramusquare'] = 0x3318;
  7977. t['gysquare'] = 0x33C9;
  7978. t['h'] = 0x0068;
  7979. t['haabkhasiancyrillic'] = 0x04A9;
  7980. t['haaltonearabic'] = 0x06C1;
  7981. t['habengali'] = 0x09B9;
  7982. t['hadescendercyrillic'] = 0x04B3;
  7983. t['hadeva'] = 0x0939;
  7984. t['hagujarati'] = 0x0AB9;
  7985. t['hagurmukhi'] = 0x0A39;
  7986. t['haharabic'] = 0x062D;
  7987. t['hahfinalarabic'] = 0xFEA2;
  7988. t['hahinitialarabic'] = 0xFEA3;
  7989. t['hahiragana'] = 0x306F;
  7990. t['hahmedialarabic'] = 0xFEA4;
  7991. t['haitusquare'] = 0x332A;
  7992. t['hakatakana'] = 0x30CF;
  7993. t['hakatakanahalfwidth'] = 0xFF8A;
  7994. t['halantgurmukhi'] = 0x0A4D;
  7995. t['hamzaarabic'] = 0x0621;
  7996. t['hamzalowarabic'] = 0x0621;
  7997. t['hangulfiller'] = 0x3164;
  7998. t['hardsigncyrillic'] = 0x044A;
  7999. t['harpoonleftbarbup'] = 0x21BC;
  8000. t['harpoonrightbarbup'] = 0x21C0;
  8001. t['hasquare'] = 0x33CA;
  8002. t['hatafpatah'] = 0x05B2;
  8003. t['hatafpatah16'] = 0x05B2;
  8004. t['hatafpatah23'] = 0x05B2;
  8005. t['hatafpatah2f'] = 0x05B2;
  8006. t['hatafpatahhebrew'] = 0x05B2;
  8007. t['hatafpatahnarrowhebrew'] = 0x05B2;
  8008. t['hatafpatahquarterhebrew'] = 0x05B2;
  8009. t['hatafpatahwidehebrew'] = 0x05B2;
  8010. t['hatafqamats'] = 0x05B3;
  8011. t['hatafqamats1b'] = 0x05B3;
  8012. t['hatafqamats28'] = 0x05B3;
  8013. t['hatafqamats34'] = 0x05B3;
  8014. t['hatafqamatshebrew'] = 0x05B3;
  8015. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  8016. t['hatafqamatsquarterhebrew'] = 0x05B3;
  8017. t['hatafqamatswidehebrew'] = 0x05B3;
  8018. t['hatafsegol'] = 0x05B1;
  8019. t['hatafsegol17'] = 0x05B1;
  8020. t['hatafsegol24'] = 0x05B1;
  8021. t['hatafsegol30'] = 0x05B1;
  8022. t['hatafsegolhebrew'] = 0x05B1;
  8023. t['hatafsegolnarrowhebrew'] = 0x05B1;
  8024. t['hatafsegolquarterhebrew'] = 0x05B1;
  8025. t['hatafsegolwidehebrew'] = 0x05B1;
  8026. t['hbar'] = 0x0127;
  8027. t['hbopomofo'] = 0x310F;
  8028. t['hbrevebelow'] = 0x1E2B;
  8029. t['hcedilla'] = 0x1E29;
  8030. t['hcircle'] = 0x24D7;
  8031. t['hcircumflex'] = 0x0125;
  8032. t['hdieresis'] = 0x1E27;
  8033. t['hdotaccent'] = 0x1E23;
  8034. t['hdotbelow'] = 0x1E25;
  8035. t['he'] = 0x05D4;
  8036. t['heart'] = 0x2665;
  8037. t['heartsuitblack'] = 0x2665;
  8038. t['heartsuitwhite'] = 0x2661;
  8039. t['hedagesh'] = 0xFB34;
  8040. t['hedageshhebrew'] = 0xFB34;
  8041. t['hehaltonearabic'] = 0x06C1;
  8042. t['heharabic'] = 0x0647;
  8043. t['hehebrew'] = 0x05D4;
  8044. t['hehfinalaltonearabic'] = 0xFBA7;
  8045. t['hehfinalalttwoarabic'] = 0xFEEA;
  8046. t['hehfinalarabic'] = 0xFEEA;
  8047. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  8048. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  8049. t['hehinitialaltonearabic'] = 0xFBA8;
  8050. t['hehinitialarabic'] = 0xFEEB;
  8051. t['hehiragana'] = 0x3078;
  8052. t['hehmedialaltonearabic'] = 0xFBA9;
  8053. t['hehmedialarabic'] = 0xFEEC;
  8054. t['heiseierasquare'] = 0x337B;
  8055. t['hekatakana'] = 0x30D8;
  8056. t['hekatakanahalfwidth'] = 0xFF8D;
  8057. t['hekutaarusquare'] = 0x3336;
  8058. t['henghook'] = 0x0267;
  8059. t['herutusquare'] = 0x3339;
  8060. t['het'] = 0x05D7;
  8061. t['hethebrew'] = 0x05D7;
  8062. t['hhook'] = 0x0266;
  8063. t['hhooksuperior'] = 0x02B1;
  8064. t['hieuhacirclekorean'] = 0x327B;
  8065. t['hieuhaparenkorean'] = 0x321B;
  8066. t['hieuhcirclekorean'] = 0x326D;
  8067. t['hieuhkorean'] = 0x314E;
  8068. t['hieuhparenkorean'] = 0x320D;
  8069. t['hihiragana'] = 0x3072;
  8070. t['hikatakana'] = 0x30D2;
  8071. t['hikatakanahalfwidth'] = 0xFF8B;
  8072. t['hiriq'] = 0x05B4;
  8073. t['hiriq14'] = 0x05B4;
  8074. t['hiriq21'] = 0x05B4;
  8075. t['hiriq2d'] = 0x05B4;
  8076. t['hiriqhebrew'] = 0x05B4;
  8077. t['hiriqnarrowhebrew'] = 0x05B4;
  8078. t['hiriqquarterhebrew'] = 0x05B4;
  8079. t['hiriqwidehebrew'] = 0x05B4;
  8080. t['hlinebelow'] = 0x1E96;
  8081. t['hmonospace'] = 0xFF48;
  8082. t['hoarmenian'] = 0x0570;
  8083. t['hohipthai'] = 0x0E2B;
  8084. t['hohiragana'] = 0x307B;
  8085. t['hokatakana'] = 0x30DB;
  8086. t['hokatakanahalfwidth'] = 0xFF8E;
  8087. t['holam'] = 0x05B9;
  8088. t['holam19'] = 0x05B9;
  8089. t['holam26'] = 0x05B9;
  8090. t['holam32'] = 0x05B9;
  8091. t['holamhebrew'] = 0x05B9;
  8092. t['holamnarrowhebrew'] = 0x05B9;
  8093. t['holamquarterhebrew'] = 0x05B9;
  8094. t['holamwidehebrew'] = 0x05B9;
  8095. t['honokhukthai'] = 0x0E2E;
  8096. t['hookabovecomb'] = 0x0309;
  8097. t['hookcmb'] = 0x0309;
  8098. t['hookpalatalizedbelowcmb'] = 0x0321;
  8099. t['hookretroflexbelowcmb'] = 0x0322;
  8100. t['hoonsquare'] = 0x3342;
  8101. t['horicoptic'] = 0x03E9;
  8102. t['horizontalbar'] = 0x2015;
  8103. t['horncmb'] = 0x031B;
  8104. t['hotsprings'] = 0x2668;
  8105. t['house'] = 0x2302;
  8106. t['hparen'] = 0x24A3;
  8107. t['hsuperior'] = 0x02B0;
  8108. t['hturned'] = 0x0265;
  8109. t['huhiragana'] = 0x3075;
  8110. t['huiitosquare'] = 0x3333;
  8111. t['hukatakana'] = 0x30D5;
  8112. t['hukatakanahalfwidth'] = 0xFF8C;
  8113. t['hungarumlaut'] = 0x02DD;
  8114. t['hungarumlautcmb'] = 0x030B;
  8115. t['hv'] = 0x0195;
  8116. t['hyphen'] = 0x002D;
  8117. t['hypheninferior'] = 0xF6E5;
  8118. t['hyphenmonospace'] = 0xFF0D;
  8119. t['hyphensmall'] = 0xFE63;
  8120. t['hyphensuperior'] = 0xF6E6;
  8121. t['hyphentwo'] = 0x2010;
  8122. t['i'] = 0x0069;
  8123. t['iacute'] = 0x00ED;
  8124. t['iacyrillic'] = 0x044F;
  8125. t['ibengali'] = 0x0987;
  8126. t['ibopomofo'] = 0x3127;
  8127. t['ibreve'] = 0x012D;
  8128. t['icaron'] = 0x01D0;
  8129. t['icircle'] = 0x24D8;
  8130. t['icircumflex'] = 0x00EE;
  8131. t['icyrillic'] = 0x0456;
  8132. t['idblgrave'] = 0x0209;
  8133. t['ideographearthcircle'] = 0x328F;
  8134. t['ideographfirecircle'] = 0x328B;
  8135. t['ideographicallianceparen'] = 0x323F;
  8136. t['ideographiccallparen'] = 0x323A;
  8137. t['ideographiccentrecircle'] = 0x32A5;
  8138. t['ideographicclose'] = 0x3006;
  8139. t['ideographiccomma'] = 0x3001;
  8140. t['ideographiccommaleft'] = 0xFF64;
  8141. t['ideographiccongratulationparen'] = 0x3237;
  8142. t['ideographiccorrectcircle'] = 0x32A3;
  8143. t['ideographicearthparen'] = 0x322F;
  8144. t['ideographicenterpriseparen'] = 0x323D;
  8145. t['ideographicexcellentcircle'] = 0x329D;
  8146. t['ideographicfestivalparen'] = 0x3240;
  8147. t['ideographicfinancialcircle'] = 0x3296;
  8148. t['ideographicfinancialparen'] = 0x3236;
  8149. t['ideographicfireparen'] = 0x322B;
  8150. t['ideographichaveparen'] = 0x3232;
  8151. t['ideographichighcircle'] = 0x32A4;
  8152. t['ideographiciterationmark'] = 0x3005;
  8153. t['ideographiclaborcircle'] = 0x3298;
  8154. t['ideographiclaborparen'] = 0x3238;
  8155. t['ideographicleftcircle'] = 0x32A7;
  8156. t['ideographiclowcircle'] = 0x32A6;
  8157. t['ideographicmedicinecircle'] = 0x32A9;
  8158. t['ideographicmetalparen'] = 0x322E;
  8159. t['ideographicmoonparen'] = 0x322A;
  8160. t['ideographicnameparen'] = 0x3234;
  8161. t['ideographicperiod'] = 0x3002;
  8162. t['ideographicprintcircle'] = 0x329E;
  8163. t['ideographicreachparen'] = 0x3243;
  8164. t['ideographicrepresentparen'] = 0x3239;
  8165. t['ideographicresourceparen'] = 0x323E;
  8166. t['ideographicrightcircle'] = 0x32A8;
  8167. t['ideographicsecretcircle'] = 0x3299;
  8168. t['ideographicselfparen'] = 0x3242;
  8169. t['ideographicsocietyparen'] = 0x3233;
  8170. t['ideographicspace'] = 0x3000;
  8171. t['ideographicspecialparen'] = 0x3235;
  8172. t['ideographicstockparen'] = 0x3231;
  8173. t['ideographicstudyparen'] = 0x323B;
  8174. t['ideographicsunparen'] = 0x3230;
  8175. t['ideographicsuperviseparen'] = 0x323C;
  8176. t['ideographicwaterparen'] = 0x322C;
  8177. t['ideographicwoodparen'] = 0x322D;
  8178. t['ideographiczero'] = 0x3007;
  8179. t['ideographmetalcircle'] = 0x328E;
  8180. t['ideographmooncircle'] = 0x328A;
  8181. t['ideographnamecircle'] = 0x3294;
  8182. t['ideographsuncircle'] = 0x3290;
  8183. t['ideographwatercircle'] = 0x328C;
  8184. t['ideographwoodcircle'] = 0x328D;
  8185. t['ideva'] = 0x0907;
  8186. t['idieresis'] = 0x00EF;
  8187. t['idieresisacute'] = 0x1E2F;
  8188. t['idieresiscyrillic'] = 0x04E5;
  8189. t['idotbelow'] = 0x1ECB;
  8190. t['iebrevecyrillic'] = 0x04D7;
  8191. t['iecyrillic'] = 0x0435;
  8192. t['ieungacirclekorean'] = 0x3275;
  8193. t['ieungaparenkorean'] = 0x3215;
  8194. t['ieungcirclekorean'] = 0x3267;
  8195. t['ieungkorean'] = 0x3147;
  8196. t['ieungparenkorean'] = 0x3207;
  8197. t['igrave'] = 0x00EC;
  8198. t['igujarati'] = 0x0A87;
  8199. t['igurmukhi'] = 0x0A07;
  8200. t['ihiragana'] = 0x3044;
  8201. t['ihookabove'] = 0x1EC9;
  8202. t['iibengali'] = 0x0988;
  8203. t['iicyrillic'] = 0x0438;
  8204. t['iideva'] = 0x0908;
  8205. t['iigujarati'] = 0x0A88;
  8206. t['iigurmukhi'] = 0x0A08;
  8207. t['iimatragurmukhi'] = 0x0A40;
  8208. t['iinvertedbreve'] = 0x020B;
  8209. t['iishortcyrillic'] = 0x0439;
  8210. t['iivowelsignbengali'] = 0x09C0;
  8211. t['iivowelsigndeva'] = 0x0940;
  8212. t['iivowelsigngujarati'] = 0x0AC0;
  8213. t['ij'] = 0x0133;
  8214. t['ikatakana'] = 0x30A4;
  8215. t['ikatakanahalfwidth'] = 0xFF72;
  8216. t['ikorean'] = 0x3163;
  8217. t['ilde'] = 0x02DC;
  8218. t['iluyhebrew'] = 0x05AC;
  8219. t['imacron'] = 0x012B;
  8220. t['imacroncyrillic'] = 0x04E3;
  8221. t['imageorapproximatelyequal'] = 0x2253;
  8222. t['imatragurmukhi'] = 0x0A3F;
  8223. t['imonospace'] = 0xFF49;
  8224. t['increment'] = 0x2206;
  8225. t['infinity'] = 0x221E;
  8226. t['iniarmenian'] = 0x056B;
  8227. t['integral'] = 0x222B;
  8228. t['integralbottom'] = 0x2321;
  8229. t['integralbt'] = 0x2321;
  8230. t['integralex'] = 0xF8F5;
  8231. t['integraltop'] = 0x2320;
  8232. t['integraltp'] = 0x2320;
  8233. t['intersection'] = 0x2229;
  8234. t['intisquare'] = 0x3305;
  8235. t['invbullet'] = 0x25D8;
  8236. t['invcircle'] = 0x25D9;
  8237. t['invsmileface'] = 0x263B;
  8238. t['iocyrillic'] = 0x0451;
  8239. t['iogonek'] = 0x012F;
  8240. t['iota'] = 0x03B9;
  8241. t['iotadieresis'] = 0x03CA;
  8242. t['iotadieresistonos'] = 0x0390;
  8243. t['iotalatin'] = 0x0269;
  8244. t['iotatonos'] = 0x03AF;
  8245. t['iparen'] = 0x24A4;
  8246. t['irigurmukhi'] = 0x0A72;
  8247. t['ismallhiragana'] = 0x3043;
  8248. t['ismallkatakana'] = 0x30A3;
  8249. t['ismallkatakanahalfwidth'] = 0xFF68;
  8250. t['issharbengali'] = 0x09FA;
  8251. t['istroke'] = 0x0268;
  8252. t['isuperior'] = 0xF6ED;
  8253. t['iterationhiragana'] = 0x309D;
  8254. t['iterationkatakana'] = 0x30FD;
  8255. t['itilde'] = 0x0129;
  8256. t['itildebelow'] = 0x1E2D;
  8257. t['iubopomofo'] = 0x3129;
  8258. t['iucyrillic'] = 0x044E;
  8259. t['ivowelsignbengali'] = 0x09BF;
  8260. t['ivowelsigndeva'] = 0x093F;
  8261. t['ivowelsigngujarati'] = 0x0ABF;
  8262. t['izhitsacyrillic'] = 0x0475;
  8263. t['izhitsadblgravecyrillic'] = 0x0477;
  8264. t['j'] = 0x006A;
  8265. t['jaarmenian'] = 0x0571;
  8266. t['jabengali'] = 0x099C;
  8267. t['jadeva'] = 0x091C;
  8268. t['jagujarati'] = 0x0A9C;
  8269. t['jagurmukhi'] = 0x0A1C;
  8270. t['jbopomofo'] = 0x3110;
  8271. t['jcaron'] = 0x01F0;
  8272. t['jcircle'] = 0x24D9;
  8273. t['jcircumflex'] = 0x0135;
  8274. t['jcrossedtail'] = 0x029D;
  8275. t['jdotlessstroke'] = 0x025F;
  8276. t['jecyrillic'] = 0x0458;
  8277. t['jeemarabic'] = 0x062C;
  8278. t['jeemfinalarabic'] = 0xFE9E;
  8279. t['jeeminitialarabic'] = 0xFE9F;
  8280. t['jeemmedialarabic'] = 0xFEA0;
  8281. t['jeharabic'] = 0x0698;
  8282. t['jehfinalarabic'] = 0xFB8B;
  8283. t['jhabengali'] = 0x099D;
  8284. t['jhadeva'] = 0x091D;
  8285. t['jhagujarati'] = 0x0A9D;
  8286. t['jhagurmukhi'] = 0x0A1D;
  8287. t['jheharmenian'] = 0x057B;
  8288. t['jis'] = 0x3004;
  8289. t['jmonospace'] = 0xFF4A;
  8290. t['jparen'] = 0x24A5;
  8291. t['jsuperior'] = 0x02B2;
  8292. t['k'] = 0x006B;
  8293. t['kabashkircyrillic'] = 0x04A1;
  8294. t['kabengali'] = 0x0995;
  8295. t['kacute'] = 0x1E31;
  8296. t['kacyrillic'] = 0x043A;
  8297. t['kadescendercyrillic'] = 0x049B;
  8298. t['kadeva'] = 0x0915;
  8299. t['kaf'] = 0x05DB;
  8300. t['kafarabic'] = 0x0643;
  8301. t['kafdagesh'] = 0xFB3B;
  8302. t['kafdageshhebrew'] = 0xFB3B;
  8303. t['kaffinalarabic'] = 0xFEDA;
  8304. t['kafhebrew'] = 0x05DB;
  8305. t['kafinitialarabic'] = 0xFEDB;
  8306. t['kafmedialarabic'] = 0xFEDC;
  8307. t['kafrafehebrew'] = 0xFB4D;
  8308. t['kagujarati'] = 0x0A95;
  8309. t['kagurmukhi'] = 0x0A15;
  8310. t['kahiragana'] = 0x304B;
  8311. t['kahookcyrillic'] = 0x04C4;
  8312. t['kakatakana'] = 0x30AB;
  8313. t['kakatakanahalfwidth'] = 0xFF76;
  8314. t['kappa'] = 0x03BA;
  8315. t['kappasymbolgreek'] = 0x03F0;
  8316. t['kapyeounmieumkorean'] = 0x3171;
  8317. t['kapyeounphieuphkorean'] = 0x3184;
  8318. t['kapyeounpieupkorean'] = 0x3178;
  8319. t['kapyeounssangpieupkorean'] = 0x3179;
  8320. t['karoriisquare'] = 0x330D;
  8321. t['kashidaautoarabic'] = 0x0640;
  8322. t['kashidaautonosidebearingarabic'] = 0x0640;
  8323. t['kasmallkatakana'] = 0x30F5;
  8324. t['kasquare'] = 0x3384;
  8325. t['kasraarabic'] = 0x0650;
  8326. t['kasratanarabic'] = 0x064D;
  8327. t['kastrokecyrillic'] = 0x049F;
  8328. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  8329. t['kaverticalstrokecyrillic'] = 0x049D;
  8330. t['kbopomofo'] = 0x310E;
  8331. t['kcalsquare'] = 0x3389;
  8332. t['kcaron'] = 0x01E9;
  8333. t['kcedilla'] = 0x0137;
  8334. t['kcircle'] = 0x24DA;
  8335. t['kcommaaccent'] = 0x0137;
  8336. t['kdotbelow'] = 0x1E33;
  8337. t['keharmenian'] = 0x0584;
  8338. t['kehiragana'] = 0x3051;
  8339. t['kekatakana'] = 0x30B1;
  8340. t['kekatakanahalfwidth'] = 0xFF79;
  8341. t['kenarmenian'] = 0x056F;
  8342. t['kesmallkatakana'] = 0x30F6;
  8343. t['kgreenlandic'] = 0x0138;
  8344. t['khabengali'] = 0x0996;
  8345. t['khacyrillic'] = 0x0445;
  8346. t['khadeva'] = 0x0916;
  8347. t['khagujarati'] = 0x0A96;
  8348. t['khagurmukhi'] = 0x0A16;
  8349. t['khaharabic'] = 0x062E;
  8350. t['khahfinalarabic'] = 0xFEA6;
  8351. t['khahinitialarabic'] = 0xFEA7;
  8352. t['khahmedialarabic'] = 0xFEA8;
  8353. t['kheicoptic'] = 0x03E7;
  8354. t['khhadeva'] = 0x0959;
  8355. t['khhagurmukhi'] = 0x0A59;
  8356. t['khieukhacirclekorean'] = 0x3278;
  8357. t['khieukhaparenkorean'] = 0x3218;
  8358. t['khieukhcirclekorean'] = 0x326A;
  8359. t['khieukhkorean'] = 0x314B;
  8360. t['khieukhparenkorean'] = 0x320A;
  8361. t['khokhaithai'] = 0x0E02;
  8362. t['khokhonthai'] = 0x0E05;
  8363. t['khokhuatthai'] = 0x0E03;
  8364. t['khokhwaithai'] = 0x0E04;
  8365. t['khomutthai'] = 0x0E5B;
  8366. t['khook'] = 0x0199;
  8367. t['khorakhangthai'] = 0x0E06;
  8368. t['khzsquare'] = 0x3391;
  8369. t['kihiragana'] = 0x304D;
  8370. t['kikatakana'] = 0x30AD;
  8371. t['kikatakanahalfwidth'] = 0xFF77;
  8372. t['kiroguramusquare'] = 0x3315;
  8373. t['kiromeetorusquare'] = 0x3316;
  8374. t['kirosquare'] = 0x3314;
  8375. t['kiyeokacirclekorean'] = 0x326E;
  8376. t['kiyeokaparenkorean'] = 0x320E;
  8377. t['kiyeokcirclekorean'] = 0x3260;
  8378. t['kiyeokkorean'] = 0x3131;
  8379. t['kiyeokparenkorean'] = 0x3200;
  8380. t['kiyeoksioskorean'] = 0x3133;
  8381. t['kjecyrillic'] = 0x045C;
  8382. t['klinebelow'] = 0x1E35;
  8383. t['klsquare'] = 0x3398;
  8384. t['kmcubedsquare'] = 0x33A6;
  8385. t['kmonospace'] = 0xFF4B;
  8386. t['kmsquaredsquare'] = 0x33A2;
  8387. t['kohiragana'] = 0x3053;
  8388. t['kohmsquare'] = 0x33C0;
  8389. t['kokaithai'] = 0x0E01;
  8390. t['kokatakana'] = 0x30B3;
  8391. t['kokatakanahalfwidth'] = 0xFF7A;
  8392. t['kooposquare'] = 0x331E;
  8393. t['koppacyrillic'] = 0x0481;
  8394. t['koreanstandardsymbol'] = 0x327F;
  8395. t['koroniscmb'] = 0x0343;
  8396. t['kparen'] = 0x24A6;
  8397. t['kpasquare'] = 0x33AA;
  8398. t['ksicyrillic'] = 0x046F;
  8399. t['ktsquare'] = 0x33CF;
  8400. t['kturned'] = 0x029E;
  8401. t['kuhiragana'] = 0x304F;
  8402. t['kukatakana'] = 0x30AF;
  8403. t['kukatakanahalfwidth'] = 0xFF78;
  8404. t['kvsquare'] = 0x33B8;
  8405. t['kwsquare'] = 0x33BE;
  8406. t['l'] = 0x006C;
  8407. t['labengali'] = 0x09B2;
  8408. t['lacute'] = 0x013A;
  8409. t['ladeva'] = 0x0932;
  8410. t['lagujarati'] = 0x0AB2;
  8411. t['lagurmukhi'] = 0x0A32;
  8412. t['lakkhangyaothai'] = 0x0E45;
  8413. t['lamaleffinalarabic'] = 0xFEFC;
  8414. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  8415. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  8416. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  8417. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  8418. t['lamalefisolatedarabic'] = 0xFEFB;
  8419. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  8420. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  8421. t['lamarabic'] = 0x0644;
  8422. t['lambda'] = 0x03BB;
  8423. t['lambdastroke'] = 0x019B;
  8424. t['lamed'] = 0x05DC;
  8425. t['lameddagesh'] = 0xFB3C;
  8426. t['lameddageshhebrew'] = 0xFB3C;
  8427. t['lamedhebrew'] = 0x05DC;
  8428. t['lamfinalarabic'] = 0xFEDE;
  8429. t['lamhahinitialarabic'] = 0xFCCA;
  8430. t['laminitialarabic'] = 0xFEDF;
  8431. t['lamjeeminitialarabic'] = 0xFCC9;
  8432. t['lamkhahinitialarabic'] = 0xFCCB;
  8433. t['lamlamhehisolatedarabic'] = 0xFDF2;
  8434. t['lammedialarabic'] = 0xFEE0;
  8435. t['lammeemhahinitialarabic'] = 0xFD88;
  8436. t['lammeeminitialarabic'] = 0xFCCC;
  8437. t['largecircle'] = 0x25EF;
  8438. t['lbar'] = 0x019A;
  8439. t['lbelt'] = 0x026C;
  8440. t['lbopomofo'] = 0x310C;
  8441. t['lcaron'] = 0x013E;
  8442. t['lcedilla'] = 0x013C;
  8443. t['lcircle'] = 0x24DB;
  8444. t['lcircumflexbelow'] = 0x1E3D;
  8445. t['lcommaaccent'] = 0x013C;
  8446. t['ldot'] = 0x0140;
  8447. t['ldotaccent'] = 0x0140;
  8448. t['ldotbelow'] = 0x1E37;
  8449. t['ldotbelowmacron'] = 0x1E39;
  8450. t['leftangleabovecmb'] = 0x031A;
  8451. t['lefttackbelowcmb'] = 0x0318;
  8452. t['less'] = 0x003C;
  8453. t['lessequal'] = 0x2264;
  8454. t['lessequalorgreater'] = 0x22DA;
  8455. t['lessmonospace'] = 0xFF1C;
  8456. t['lessorequivalent'] = 0x2272;
  8457. t['lessorgreater'] = 0x2276;
  8458. t['lessoverequal'] = 0x2266;
  8459. t['lesssmall'] = 0xFE64;
  8460. t['lezh'] = 0x026E;
  8461. t['lfblock'] = 0x258C;
  8462. t['lhookretroflex'] = 0x026D;
  8463. t['lira'] = 0x20A4;
  8464. t['liwnarmenian'] = 0x056C;
  8465. t['lj'] = 0x01C9;
  8466. t['ljecyrillic'] = 0x0459;
  8467. t['ll'] = 0xF6C0;
  8468. t['lladeva'] = 0x0933;
  8469. t['llagujarati'] = 0x0AB3;
  8470. t['llinebelow'] = 0x1E3B;
  8471. t['llladeva'] = 0x0934;
  8472. t['llvocalicbengali'] = 0x09E1;
  8473. t['llvocalicdeva'] = 0x0961;
  8474. t['llvocalicvowelsignbengali'] = 0x09E3;
  8475. t['llvocalicvowelsigndeva'] = 0x0963;
  8476. t['lmiddletilde'] = 0x026B;
  8477. t['lmonospace'] = 0xFF4C;
  8478. t['lmsquare'] = 0x33D0;
  8479. t['lochulathai'] = 0x0E2C;
  8480. t['logicaland'] = 0x2227;
  8481. t['logicalnot'] = 0x00AC;
  8482. t['logicalnotreversed'] = 0x2310;
  8483. t['logicalor'] = 0x2228;
  8484. t['lolingthai'] = 0x0E25;
  8485. t['longs'] = 0x017F;
  8486. t['lowlinecenterline'] = 0xFE4E;
  8487. t['lowlinecmb'] = 0x0332;
  8488. t['lowlinedashed'] = 0xFE4D;
  8489. t['lozenge'] = 0x25CA;
  8490. t['lparen'] = 0x24A7;
  8491. t['lslash'] = 0x0142;
  8492. t['lsquare'] = 0x2113;
  8493. t['lsuperior'] = 0xF6EE;
  8494. t['ltshade'] = 0x2591;
  8495. t['luthai'] = 0x0E26;
  8496. t['lvocalicbengali'] = 0x098C;
  8497. t['lvocalicdeva'] = 0x090C;
  8498. t['lvocalicvowelsignbengali'] = 0x09E2;
  8499. t['lvocalicvowelsigndeva'] = 0x0962;
  8500. t['lxsquare'] = 0x33D3;
  8501. t['m'] = 0x006D;
  8502. t['mabengali'] = 0x09AE;
  8503. t['macron'] = 0x00AF;
  8504. t['macronbelowcmb'] = 0x0331;
  8505. t['macroncmb'] = 0x0304;
  8506. t['macronlowmod'] = 0x02CD;
  8507. t['macronmonospace'] = 0xFFE3;
  8508. t['macute'] = 0x1E3F;
  8509. t['madeva'] = 0x092E;
  8510. t['magujarati'] = 0x0AAE;
  8511. t['magurmukhi'] = 0x0A2E;
  8512. t['mahapakhhebrew'] = 0x05A4;
  8513. t['mahapakhlefthebrew'] = 0x05A4;
  8514. t['mahiragana'] = 0x307E;
  8515. t['maichattawalowleftthai'] = 0xF895;
  8516. t['maichattawalowrightthai'] = 0xF894;
  8517. t['maichattawathai'] = 0x0E4B;
  8518. t['maichattawaupperleftthai'] = 0xF893;
  8519. t['maieklowleftthai'] = 0xF88C;
  8520. t['maieklowrightthai'] = 0xF88B;
  8521. t['maiekthai'] = 0x0E48;
  8522. t['maiekupperleftthai'] = 0xF88A;
  8523. t['maihanakatleftthai'] = 0xF884;
  8524. t['maihanakatthai'] = 0x0E31;
  8525. t['maitaikhuleftthai'] = 0xF889;
  8526. t['maitaikhuthai'] = 0x0E47;
  8527. t['maitholowleftthai'] = 0xF88F;
  8528. t['maitholowrightthai'] = 0xF88E;
  8529. t['maithothai'] = 0x0E49;
  8530. t['maithoupperleftthai'] = 0xF88D;
  8531. t['maitrilowleftthai'] = 0xF892;
  8532. t['maitrilowrightthai'] = 0xF891;
  8533. t['maitrithai'] = 0x0E4A;
  8534. t['maitriupperleftthai'] = 0xF890;
  8535. t['maiyamokthai'] = 0x0E46;
  8536. t['makatakana'] = 0x30DE;
  8537. t['makatakanahalfwidth'] = 0xFF8F;
  8538. t['male'] = 0x2642;
  8539. t['mansyonsquare'] = 0x3347;
  8540. t['maqafhebrew'] = 0x05BE;
  8541. t['mars'] = 0x2642;
  8542. t['masoracirclehebrew'] = 0x05AF;
  8543. t['masquare'] = 0x3383;
  8544. t['mbopomofo'] = 0x3107;
  8545. t['mbsquare'] = 0x33D4;
  8546. t['mcircle'] = 0x24DC;
  8547. t['mcubedsquare'] = 0x33A5;
  8548. t['mdotaccent'] = 0x1E41;
  8549. t['mdotbelow'] = 0x1E43;
  8550. t['meemarabic'] = 0x0645;
  8551. t['meemfinalarabic'] = 0xFEE2;
  8552. t['meeminitialarabic'] = 0xFEE3;
  8553. t['meemmedialarabic'] = 0xFEE4;
  8554. t['meemmeeminitialarabic'] = 0xFCD1;
  8555. t['meemmeemisolatedarabic'] = 0xFC48;
  8556. t['meetorusquare'] = 0x334D;
  8557. t['mehiragana'] = 0x3081;
  8558. t['meizierasquare'] = 0x337E;
  8559. t['mekatakana'] = 0x30E1;
  8560. t['mekatakanahalfwidth'] = 0xFF92;
  8561. t['mem'] = 0x05DE;
  8562. t['memdagesh'] = 0xFB3E;
  8563. t['memdageshhebrew'] = 0xFB3E;
  8564. t['memhebrew'] = 0x05DE;
  8565. t['menarmenian'] = 0x0574;
  8566. t['merkhahebrew'] = 0x05A5;
  8567. t['merkhakefulahebrew'] = 0x05A6;
  8568. t['merkhakefulalefthebrew'] = 0x05A6;
  8569. t['merkhalefthebrew'] = 0x05A5;
  8570. t['mhook'] = 0x0271;
  8571. t['mhzsquare'] = 0x3392;
  8572. t['middledotkatakanahalfwidth'] = 0xFF65;
  8573. t['middot'] = 0x00B7;
  8574. t['mieumacirclekorean'] = 0x3272;
  8575. t['mieumaparenkorean'] = 0x3212;
  8576. t['mieumcirclekorean'] = 0x3264;
  8577. t['mieumkorean'] = 0x3141;
  8578. t['mieumpansioskorean'] = 0x3170;
  8579. t['mieumparenkorean'] = 0x3204;
  8580. t['mieumpieupkorean'] = 0x316E;
  8581. t['mieumsioskorean'] = 0x316F;
  8582. t['mihiragana'] = 0x307F;
  8583. t['mikatakana'] = 0x30DF;
  8584. t['mikatakanahalfwidth'] = 0xFF90;
  8585. t['minus'] = 0x2212;
  8586. t['minusbelowcmb'] = 0x0320;
  8587. t['minuscircle'] = 0x2296;
  8588. t['minusmod'] = 0x02D7;
  8589. t['minusplus'] = 0x2213;
  8590. t['minute'] = 0x2032;
  8591. t['miribaarusquare'] = 0x334A;
  8592. t['mirisquare'] = 0x3349;
  8593. t['mlonglegturned'] = 0x0270;
  8594. t['mlsquare'] = 0x3396;
  8595. t['mmcubedsquare'] = 0x33A3;
  8596. t['mmonospace'] = 0xFF4D;
  8597. t['mmsquaredsquare'] = 0x339F;
  8598. t['mohiragana'] = 0x3082;
  8599. t['mohmsquare'] = 0x33C1;
  8600. t['mokatakana'] = 0x30E2;
  8601. t['mokatakanahalfwidth'] = 0xFF93;
  8602. t['molsquare'] = 0x33D6;
  8603. t['momathai'] = 0x0E21;
  8604. t['moverssquare'] = 0x33A7;
  8605. t['moverssquaredsquare'] = 0x33A8;
  8606. t['mparen'] = 0x24A8;
  8607. t['mpasquare'] = 0x33AB;
  8608. t['mssquare'] = 0x33B3;
  8609. t['msuperior'] = 0xF6EF;
  8610. t['mturned'] = 0x026F;
  8611. t['mu'] = 0x00B5;
  8612. t['mu1'] = 0x00B5;
  8613. t['muasquare'] = 0x3382;
  8614. t['muchgreater'] = 0x226B;
  8615. t['muchless'] = 0x226A;
  8616. t['mufsquare'] = 0x338C;
  8617. t['mugreek'] = 0x03BC;
  8618. t['mugsquare'] = 0x338D;
  8619. t['muhiragana'] = 0x3080;
  8620. t['mukatakana'] = 0x30E0;
  8621. t['mukatakanahalfwidth'] = 0xFF91;
  8622. t['mulsquare'] = 0x3395;
  8623. t['multiply'] = 0x00D7;
  8624. t['mumsquare'] = 0x339B;
  8625. t['munahhebrew'] = 0x05A3;
  8626. t['munahlefthebrew'] = 0x05A3;
  8627. t['musicalnote'] = 0x266A;
  8628. t['musicalnotedbl'] = 0x266B;
  8629. t['musicflatsign'] = 0x266D;
  8630. t['musicsharpsign'] = 0x266F;
  8631. t['mussquare'] = 0x33B2;
  8632. t['muvsquare'] = 0x33B6;
  8633. t['muwsquare'] = 0x33BC;
  8634. t['mvmegasquare'] = 0x33B9;
  8635. t['mvsquare'] = 0x33B7;
  8636. t['mwmegasquare'] = 0x33BF;
  8637. t['mwsquare'] = 0x33BD;
  8638. t['n'] = 0x006E;
  8639. t['nabengali'] = 0x09A8;
  8640. t['nabla'] = 0x2207;
  8641. t['nacute'] = 0x0144;
  8642. t['nadeva'] = 0x0928;
  8643. t['nagujarati'] = 0x0AA8;
  8644. t['nagurmukhi'] = 0x0A28;
  8645. t['nahiragana'] = 0x306A;
  8646. t['nakatakana'] = 0x30CA;
  8647. t['nakatakanahalfwidth'] = 0xFF85;
  8648. t['napostrophe'] = 0x0149;
  8649. t['nasquare'] = 0x3381;
  8650. t['nbopomofo'] = 0x310B;
  8651. t['nbspace'] = 0x00A0;
  8652. t['ncaron'] = 0x0148;
  8653. t['ncedilla'] = 0x0146;
  8654. t['ncircle'] = 0x24DD;
  8655. t['ncircumflexbelow'] = 0x1E4B;
  8656. t['ncommaaccent'] = 0x0146;
  8657. t['ndotaccent'] = 0x1E45;
  8658. t['ndotbelow'] = 0x1E47;
  8659. t['nehiragana'] = 0x306D;
  8660. t['nekatakana'] = 0x30CD;
  8661. t['nekatakanahalfwidth'] = 0xFF88;
  8662. t['newsheqelsign'] = 0x20AA;
  8663. t['nfsquare'] = 0x338B;
  8664. t['ngabengali'] = 0x0999;
  8665. t['ngadeva'] = 0x0919;
  8666. t['ngagujarati'] = 0x0A99;
  8667. t['ngagurmukhi'] = 0x0A19;
  8668. t['ngonguthai'] = 0x0E07;
  8669. t['nhiragana'] = 0x3093;
  8670. t['nhookleft'] = 0x0272;
  8671. t['nhookretroflex'] = 0x0273;
  8672. t['nieunacirclekorean'] = 0x326F;
  8673. t['nieunaparenkorean'] = 0x320F;
  8674. t['nieuncieuckorean'] = 0x3135;
  8675. t['nieuncirclekorean'] = 0x3261;
  8676. t['nieunhieuhkorean'] = 0x3136;
  8677. t['nieunkorean'] = 0x3134;
  8678. t['nieunpansioskorean'] = 0x3168;
  8679. t['nieunparenkorean'] = 0x3201;
  8680. t['nieunsioskorean'] = 0x3167;
  8681. t['nieuntikeutkorean'] = 0x3166;
  8682. t['nihiragana'] = 0x306B;
  8683. t['nikatakana'] = 0x30CB;
  8684. t['nikatakanahalfwidth'] = 0xFF86;
  8685. t['nikhahitleftthai'] = 0xF899;
  8686. t['nikhahitthai'] = 0x0E4D;
  8687. t['nine'] = 0x0039;
  8688. t['ninearabic'] = 0x0669;
  8689. t['ninebengali'] = 0x09EF;
  8690. t['ninecircle'] = 0x2468;
  8691. t['ninecircleinversesansserif'] = 0x2792;
  8692. t['ninedeva'] = 0x096F;
  8693. t['ninegujarati'] = 0x0AEF;
  8694. t['ninegurmukhi'] = 0x0A6F;
  8695. t['ninehackarabic'] = 0x0669;
  8696. t['ninehangzhou'] = 0x3029;
  8697. t['nineideographicparen'] = 0x3228;
  8698. t['nineinferior'] = 0x2089;
  8699. t['ninemonospace'] = 0xFF19;
  8700. t['nineoldstyle'] = 0xF739;
  8701. t['nineparen'] = 0x247C;
  8702. t['nineperiod'] = 0x2490;
  8703. t['ninepersian'] = 0x06F9;
  8704. t['nineroman'] = 0x2178;
  8705. t['ninesuperior'] = 0x2079;
  8706. t['nineteencircle'] = 0x2472;
  8707. t['nineteenparen'] = 0x2486;
  8708. t['nineteenperiod'] = 0x249A;
  8709. t['ninethai'] = 0x0E59;
  8710. t['nj'] = 0x01CC;
  8711. t['njecyrillic'] = 0x045A;
  8712. t['nkatakana'] = 0x30F3;
  8713. t['nkatakanahalfwidth'] = 0xFF9D;
  8714. t['nlegrightlong'] = 0x019E;
  8715. t['nlinebelow'] = 0x1E49;
  8716. t['nmonospace'] = 0xFF4E;
  8717. t['nmsquare'] = 0x339A;
  8718. t['nnabengali'] = 0x09A3;
  8719. t['nnadeva'] = 0x0923;
  8720. t['nnagujarati'] = 0x0AA3;
  8721. t['nnagurmukhi'] = 0x0A23;
  8722. t['nnnadeva'] = 0x0929;
  8723. t['nohiragana'] = 0x306E;
  8724. t['nokatakana'] = 0x30CE;
  8725. t['nokatakanahalfwidth'] = 0xFF89;
  8726. t['nonbreakingspace'] = 0x00A0;
  8727. t['nonenthai'] = 0x0E13;
  8728. t['nonuthai'] = 0x0E19;
  8729. t['noonarabic'] = 0x0646;
  8730. t['noonfinalarabic'] = 0xFEE6;
  8731. t['noonghunnaarabic'] = 0x06BA;
  8732. t['noonghunnafinalarabic'] = 0xFB9F;
  8733. t['nooninitialarabic'] = 0xFEE7;
  8734. t['noonjeeminitialarabic'] = 0xFCD2;
  8735. t['noonjeemisolatedarabic'] = 0xFC4B;
  8736. t['noonmedialarabic'] = 0xFEE8;
  8737. t['noonmeeminitialarabic'] = 0xFCD5;
  8738. t['noonmeemisolatedarabic'] = 0xFC4E;
  8739. t['noonnoonfinalarabic'] = 0xFC8D;
  8740. t['notcontains'] = 0x220C;
  8741. t['notelement'] = 0x2209;
  8742. t['notelementof'] = 0x2209;
  8743. t['notequal'] = 0x2260;
  8744. t['notgreater'] = 0x226F;
  8745. t['notgreaternorequal'] = 0x2271;
  8746. t['notgreaternorless'] = 0x2279;
  8747. t['notidentical'] = 0x2262;
  8748. t['notless'] = 0x226E;
  8749. t['notlessnorequal'] = 0x2270;
  8750. t['notparallel'] = 0x2226;
  8751. t['notprecedes'] = 0x2280;
  8752. t['notsubset'] = 0x2284;
  8753. t['notsucceeds'] = 0x2281;
  8754. t['notsuperset'] = 0x2285;
  8755. t['nowarmenian'] = 0x0576;
  8756. t['nparen'] = 0x24A9;
  8757. t['nssquare'] = 0x33B1;
  8758. t['nsuperior'] = 0x207F;
  8759. t['ntilde'] = 0x00F1;
  8760. t['nu'] = 0x03BD;
  8761. t['nuhiragana'] = 0x306C;
  8762. t['nukatakana'] = 0x30CC;
  8763. t['nukatakanahalfwidth'] = 0xFF87;
  8764. t['nuktabengali'] = 0x09BC;
  8765. t['nuktadeva'] = 0x093C;
  8766. t['nuktagujarati'] = 0x0ABC;
  8767. t['nuktagurmukhi'] = 0x0A3C;
  8768. t['numbersign'] = 0x0023;
  8769. t['numbersignmonospace'] = 0xFF03;
  8770. t['numbersignsmall'] = 0xFE5F;
  8771. t['numeralsigngreek'] = 0x0374;
  8772. t['numeralsignlowergreek'] = 0x0375;
  8773. t['numero'] = 0x2116;
  8774. t['nun'] = 0x05E0;
  8775. t['nundagesh'] = 0xFB40;
  8776. t['nundageshhebrew'] = 0xFB40;
  8777. t['nunhebrew'] = 0x05E0;
  8778. t['nvsquare'] = 0x33B5;
  8779. t['nwsquare'] = 0x33BB;
  8780. t['nyabengali'] = 0x099E;
  8781. t['nyadeva'] = 0x091E;
  8782. t['nyagujarati'] = 0x0A9E;
  8783. t['nyagurmukhi'] = 0x0A1E;
  8784. t['o'] = 0x006F;
  8785. t['oacute'] = 0x00F3;
  8786. t['oangthai'] = 0x0E2D;
  8787. t['obarred'] = 0x0275;
  8788. t['obarredcyrillic'] = 0x04E9;
  8789. t['obarreddieresiscyrillic'] = 0x04EB;
  8790. t['obengali'] = 0x0993;
  8791. t['obopomofo'] = 0x311B;
  8792. t['obreve'] = 0x014F;
  8793. t['ocandradeva'] = 0x0911;
  8794. t['ocandragujarati'] = 0x0A91;
  8795. t['ocandravowelsigndeva'] = 0x0949;
  8796. t['ocandravowelsigngujarati'] = 0x0AC9;
  8797. t['ocaron'] = 0x01D2;
  8798. t['ocircle'] = 0x24DE;
  8799. t['ocircumflex'] = 0x00F4;
  8800. t['ocircumflexacute'] = 0x1ED1;
  8801. t['ocircumflexdotbelow'] = 0x1ED9;
  8802. t['ocircumflexgrave'] = 0x1ED3;
  8803. t['ocircumflexhookabove'] = 0x1ED5;
  8804. t['ocircumflextilde'] = 0x1ED7;
  8805. t['ocyrillic'] = 0x043E;
  8806. t['odblacute'] = 0x0151;
  8807. t['odblgrave'] = 0x020D;
  8808. t['odeva'] = 0x0913;
  8809. t['odieresis'] = 0x00F6;
  8810. t['odieresiscyrillic'] = 0x04E7;
  8811. t['odotbelow'] = 0x1ECD;
  8812. t['oe'] = 0x0153;
  8813. t['oekorean'] = 0x315A;
  8814. t['ogonek'] = 0x02DB;
  8815. t['ogonekcmb'] = 0x0328;
  8816. t['ograve'] = 0x00F2;
  8817. t['ogujarati'] = 0x0A93;
  8818. t['oharmenian'] = 0x0585;
  8819. t['ohiragana'] = 0x304A;
  8820. t['ohookabove'] = 0x1ECF;
  8821. t['ohorn'] = 0x01A1;
  8822. t['ohornacute'] = 0x1EDB;
  8823. t['ohorndotbelow'] = 0x1EE3;
  8824. t['ohorngrave'] = 0x1EDD;
  8825. t['ohornhookabove'] = 0x1EDF;
  8826. t['ohorntilde'] = 0x1EE1;
  8827. t['ohungarumlaut'] = 0x0151;
  8828. t['oi'] = 0x01A3;
  8829. t['oinvertedbreve'] = 0x020F;
  8830. t['okatakana'] = 0x30AA;
  8831. t['okatakanahalfwidth'] = 0xFF75;
  8832. t['okorean'] = 0x3157;
  8833. t['olehebrew'] = 0x05AB;
  8834. t['omacron'] = 0x014D;
  8835. t['omacronacute'] = 0x1E53;
  8836. t['omacrongrave'] = 0x1E51;
  8837. t['omdeva'] = 0x0950;
  8838. t['omega'] = 0x03C9;
  8839. t['omega1'] = 0x03D6;
  8840. t['omegacyrillic'] = 0x0461;
  8841. t['omegalatinclosed'] = 0x0277;
  8842. t['omegaroundcyrillic'] = 0x047B;
  8843. t['omegatitlocyrillic'] = 0x047D;
  8844. t['omegatonos'] = 0x03CE;
  8845. t['omgujarati'] = 0x0AD0;
  8846. t['omicron'] = 0x03BF;
  8847. t['omicrontonos'] = 0x03CC;
  8848. t['omonospace'] = 0xFF4F;
  8849. t['one'] = 0x0031;
  8850. t['onearabic'] = 0x0661;
  8851. t['onebengali'] = 0x09E7;
  8852. t['onecircle'] = 0x2460;
  8853. t['onecircleinversesansserif'] = 0x278A;
  8854. t['onedeva'] = 0x0967;
  8855. t['onedotenleader'] = 0x2024;
  8856. t['oneeighth'] = 0x215B;
  8857. t['onefitted'] = 0xF6DC;
  8858. t['onegujarati'] = 0x0AE7;
  8859. t['onegurmukhi'] = 0x0A67;
  8860. t['onehackarabic'] = 0x0661;
  8861. t['onehalf'] = 0x00BD;
  8862. t['onehangzhou'] = 0x3021;
  8863. t['oneideographicparen'] = 0x3220;
  8864. t['oneinferior'] = 0x2081;
  8865. t['onemonospace'] = 0xFF11;
  8866. t['onenumeratorbengali'] = 0x09F4;
  8867. t['oneoldstyle'] = 0xF731;
  8868. t['oneparen'] = 0x2474;
  8869. t['oneperiod'] = 0x2488;
  8870. t['onepersian'] = 0x06F1;
  8871. t['onequarter'] = 0x00BC;
  8872. t['oneroman'] = 0x2170;
  8873. t['onesuperior'] = 0x00B9;
  8874. t['onethai'] = 0x0E51;
  8875. t['onethird'] = 0x2153;
  8876. t['oogonek'] = 0x01EB;
  8877. t['oogonekmacron'] = 0x01ED;
  8878. t['oogurmukhi'] = 0x0A13;
  8879. t['oomatragurmukhi'] = 0x0A4B;
  8880. t['oopen'] = 0x0254;
  8881. t['oparen'] = 0x24AA;
  8882. t['openbullet'] = 0x25E6;
  8883. t['option'] = 0x2325;
  8884. t['ordfeminine'] = 0x00AA;
  8885. t['ordmasculine'] = 0x00BA;
  8886. t['orthogonal'] = 0x221F;
  8887. t['oshortdeva'] = 0x0912;
  8888. t['oshortvowelsigndeva'] = 0x094A;
  8889. t['oslash'] = 0x00F8;
  8890. t['oslashacute'] = 0x01FF;
  8891. t['osmallhiragana'] = 0x3049;
  8892. t['osmallkatakana'] = 0x30A9;
  8893. t['osmallkatakanahalfwidth'] = 0xFF6B;
  8894. t['ostrokeacute'] = 0x01FF;
  8895. t['osuperior'] = 0xF6F0;
  8896. t['otcyrillic'] = 0x047F;
  8897. t['otilde'] = 0x00F5;
  8898. t['otildeacute'] = 0x1E4D;
  8899. t['otildedieresis'] = 0x1E4F;
  8900. t['oubopomofo'] = 0x3121;
  8901. t['overline'] = 0x203E;
  8902. t['overlinecenterline'] = 0xFE4A;
  8903. t['overlinecmb'] = 0x0305;
  8904. t['overlinedashed'] = 0xFE49;
  8905. t['overlinedblwavy'] = 0xFE4C;
  8906. t['overlinewavy'] = 0xFE4B;
  8907. t['overscore'] = 0x00AF;
  8908. t['ovowelsignbengali'] = 0x09CB;
  8909. t['ovowelsigndeva'] = 0x094B;
  8910. t['ovowelsigngujarati'] = 0x0ACB;
  8911. t['p'] = 0x0070;
  8912. t['paampssquare'] = 0x3380;
  8913. t['paasentosquare'] = 0x332B;
  8914. t['pabengali'] = 0x09AA;
  8915. t['pacute'] = 0x1E55;
  8916. t['padeva'] = 0x092A;
  8917. t['pagedown'] = 0x21DF;
  8918. t['pageup'] = 0x21DE;
  8919. t['pagujarati'] = 0x0AAA;
  8920. t['pagurmukhi'] = 0x0A2A;
  8921. t['pahiragana'] = 0x3071;
  8922. t['paiyannoithai'] = 0x0E2F;
  8923. t['pakatakana'] = 0x30D1;
  8924. t['palatalizationcyrilliccmb'] = 0x0484;
  8925. t['palochkacyrillic'] = 0x04C0;
  8926. t['pansioskorean'] = 0x317F;
  8927. t['paragraph'] = 0x00B6;
  8928. t['parallel'] = 0x2225;
  8929. t['parenleft'] = 0x0028;
  8930. t['parenleftaltonearabic'] = 0xFD3E;
  8931. t['parenleftbt'] = 0xF8ED;
  8932. t['parenleftex'] = 0xF8EC;
  8933. t['parenleftinferior'] = 0x208D;
  8934. t['parenleftmonospace'] = 0xFF08;
  8935. t['parenleftsmall'] = 0xFE59;
  8936. t['parenleftsuperior'] = 0x207D;
  8937. t['parenlefttp'] = 0xF8EB;
  8938. t['parenleftvertical'] = 0xFE35;
  8939. t['parenright'] = 0x0029;
  8940. t['parenrightaltonearabic'] = 0xFD3F;
  8941. t['parenrightbt'] = 0xF8F8;
  8942. t['parenrightex'] = 0xF8F7;
  8943. t['parenrightinferior'] = 0x208E;
  8944. t['parenrightmonospace'] = 0xFF09;
  8945. t['parenrightsmall'] = 0xFE5A;
  8946. t['parenrightsuperior'] = 0x207E;
  8947. t['parenrighttp'] = 0xF8F6;
  8948. t['parenrightvertical'] = 0xFE36;
  8949. t['partialdiff'] = 0x2202;
  8950. t['paseqhebrew'] = 0x05C0;
  8951. t['pashtahebrew'] = 0x0599;
  8952. t['pasquare'] = 0x33A9;
  8953. t['patah'] = 0x05B7;
  8954. t['patah11'] = 0x05B7;
  8955. t['patah1d'] = 0x05B7;
  8956. t['patah2a'] = 0x05B7;
  8957. t['patahhebrew'] = 0x05B7;
  8958. t['patahnarrowhebrew'] = 0x05B7;
  8959. t['patahquarterhebrew'] = 0x05B7;
  8960. t['patahwidehebrew'] = 0x05B7;
  8961. t['pazerhebrew'] = 0x05A1;
  8962. t['pbopomofo'] = 0x3106;
  8963. t['pcircle'] = 0x24DF;
  8964. t['pdotaccent'] = 0x1E57;
  8965. t['pe'] = 0x05E4;
  8966. t['pecyrillic'] = 0x043F;
  8967. t['pedagesh'] = 0xFB44;
  8968. t['pedageshhebrew'] = 0xFB44;
  8969. t['peezisquare'] = 0x333B;
  8970. t['pefinaldageshhebrew'] = 0xFB43;
  8971. t['peharabic'] = 0x067E;
  8972. t['peharmenian'] = 0x057A;
  8973. t['pehebrew'] = 0x05E4;
  8974. t['pehfinalarabic'] = 0xFB57;
  8975. t['pehinitialarabic'] = 0xFB58;
  8976. t['pehiragana'] = 0x307A;
  8977. t['pehmedialarabic'] = 0xFB59;
  8978. t['pekatakana'] = 0x30DA;
  8979. t['pemiddlehookcyrillic'] = 0x04A7;
  8980. t['perafehebrew'] = 0xFB4E;
  8981. t['percent'] = 0x0025;
  8982. t['percentarabic'] = 0x066A;
  8983. t['percentmonospace'] = 0xFF05;
  8984. t['percentsmall'] = 0xFE6A;
  8985. t['period'] = 0x002E;
  8986. t['periodarmenian'] = 0x0589;
  8987. t['periodcentered'] = 0x00B7;
  8988. t['periodhalfwidth'] = 0xFF61;
  8989. t['periodinferior'] = 0xF6E7;
  8990. t['periodmonospace'] = 0xFF0E;
  8991. t['periodsmall'] = 0xFE52;
  8992. t['periodsuperior'] = 0xF6E8;
  8993. t['perispomenigreekcmb'] = 0x0342;
  8994. t['perpendicular'] = 0x22A5;
  8995. t['perthousand'] = 0x2030;
  8996. t['peseta'] = 0x20A7;
  8997. t['pfsquare'] = 0x338A;
  8998. t['phabengali'] = 0x09AB;
  8999. t['phadeva'] = 0x092B;
  9000. t['phagujarati'] = 0x0AAB;
  9001. t['phagurmukhi'] = 0x0A2B;
  9002. t['phi'] = 0x03C6;
  9003. t['phi1'] = 0x03D5;
  9004. t['phieuphacirclekorean'] = 0x327A;
  9005. t['phieuphaparenkorean'] = 0x321A;
  9006. t['phieuphcirclekorean'] = 0x326C;
  9007. t['phieuphkorean'] = 0x314D;
  9008. t['phieuphparenkorean'] = 0x320C;
  9009. t['philatin'] = 0x0278;
  9010. t['phinthuthai'] = 0x0E3A;
  9011. t['phisymbolgreek'] = 0x03D5;
  9012. t['phook'] = 0x01A5;
  9013. t['phophanthai'] = 0x0E1E;
  9014. t['phophungthai'] = 0x0E1C;
  9015. t['phosamphaothai'] = 0x0E20;
  9016. t['pi'] = 0x03C0;
  9017. t['pieupacirclekorean'] = 0x3273;
  9018. t['pieupaparenkorean'] = 0x3213;
  9019. t['pieupcieuckorean'] = 0x3176;
  9020. t['pieupcirclekorean'] = 0x3265;
  9021. t['pieupkiyeokkorean'] = 0x3172;
  9022. t['pieupkorean'] = 0x3142;
  9023. t['pieupparenkorean'] = 0x3205;
  9024. t['pieupsioskiyeokkorean'] = 0x3174;
  9025. t['pieupsioskorean'] = 0x3144;
  9026. t['pieupsiostikeutkorean'] = 0x3175;
  9027. t['pieupthieuthkorean'] = 0x3177;
  9028. t['pieuptikeutkorean'] = 0x3173;
  9029. t['pihiragana'] = 0x3074;
  9030. t['pikatakana'] = 0x30D4;
  9031. t['pisymbolgreek'] = 0x03D6;
  9032. t['piwrarmenian'] = 0x0583;
  9033. t['plus'] = 0x002B;
  9034. t['plusbelowcmb'] = 0x031F;
  9035. t['pluscircle'] = 0x2295;
  9036. t['plusminus'] = 0x00B1;
  9037. t['plusmod'] = 0x02D6;
  9038. t['plusmonospace'] = 0xFF0B;
  9039. t['plussmall'] = 0xFE62;
  9040. t['plussuperior'] = 0x207A;
  9041. t['pmonospace'] = 0xFF50;
  9042. t['pmsquare'] = 0x33D8;
  9043. t['pohiragana'] = 0x307D;
  9044. t['pointingindexdownwhite'] = 0x261F;
  9045. t['pointingindexleftwhite'] = 0x261C;
  9046. t['pointingindexrightwhite'] = 0x261E;
  9047. t['pointingindexupwhite'] = 0x261D;
  9048. t['pokatakana'] = 0x30DD;
  9049. t['poplathai'] = 0x0E1B;
  9050. t['postalmark'] = 0x3012;
  9051. t['postalmarkface'] = 0x3020;
  9052. t['pparen'] = 0x24AB;
  9053. t['precedes'] = 0x227A;
  9054. t['prescription'] = 0x211E;
  9055. t['primemod'] = 0x02B9;
  9056. t['primereversed'] = 0x2035;
  9057. t['product'] = 0x220F;
  9058. t['projective'] = 0x2305;
  9059. t['prolongedkana'] = 0x30FC;
  9060. t['propellor'] = 0x2318;
  9061. t['propersubset'] = 0x2282;
  9062. t['propersuperset'] = 0x2283;
  9063. t['proportion'] = 0x2237;
  9064. t['proportional'] = 0x221D;
  9065. t['psi'] = 0x03C8;
  9066. t['psicyrillic'] = 0x0471;
  9067. t['psilipneumatacyrilliccmb'] = 0x0486;
  9068. t['pssquare'] = 0x33B0;
  9069. t['puhiragana'] = 0x3077;
  9070. t['pukatakana'] = 0x30D7;
  9071. t['pvsquare'] = 0x33B4;
  9072. t['pwsquare'] = 0x33BA;
  9073. t['q'] = 0x0071;
  9074. t['qadeva'] = 0x0958;
  9075. t['qadmahebrew'] = 0x05A8;
  9076. t['qafarabic'] = 0x0642;
  9077. t['qaffinalarabic'] = 0xFED6;
  9078. t['qafinitialarabic'] = 0xFED7;
  9079. t['qafmedialarabic'] = 0xFED8;
  9080. t['qamats'] = 0x05B8;
  9081. t['qamats10'] = 0x05B8;
  9082. t['qamats1a'] = 0x05B8;
  9083. t['qamats1c'] = 0x05B8;
  9084. t['qamats27'] = 0x05B8;
  9085. t['qamats29'] = 0x05B8;
  9086. t['qamats33'] = 0x05B8;
  9087. t['qamatsde'] = 0x05B8;
  9088. t['qamatshebrew'] = 0x05B8;
  9089. t['qamatsnarrowhebrew'] = 0x05B8;
  9090. t['qamatsqatanhebrew'] = 0x05B8;
  9091. t['qamatsqatannarrowhebrew'] = 0x05B8;
  9092. t['qamatsqatanquarterhebrew'] = 0x05B8;
  9093. t['qamatsqatanwidehebrew'] = 0x05B8;
  9094. t['qamatsquarterhebrew'] = 0x05B8;
  9095. t['qamatswidehebrew'] = 0x05B8;
  9096. t['qarneyparahebrew'] = 0x059F;
  9097. t['qbopomofo'] = 0x3111;
  9098. t['qcircle'] = 0x24E0;
  9099. t['qhook'] = 0x02A0;
  9100. t['qmonospace'] = 0xFF51;
  9101. t['qof'] = 0x05E7;
  9102. t['qofdagesh'] = 0xFB47;
  9103. t['qofdageshhebrew'] = 0xFB47;
  9104. t['qofhebrew'] = 0x05E7;
  9105. t['qparen'] = 0x24AC;
  9106. t['quarternote'] = 0x2669;
  9107. t['qubuts'] = 0x05BB;
  9108. t['qubuts18'] = 0x05BB;
  9109. t['qubuts25'] = 0x05BB;
  9110. t['qubuts31'] = 0x05BB;
  9111. t['qubutshebrew'] = 0x05BB;
  9112. t['qubutsnarrowhebrew'] = 0x05BB;
  9113. t['qubutsquarterhebrew'] = 0x05BB;
  9114. t['qubutswidehebrew'] = 0x05BB;
  9115. t['question'] = 0x003F;
  9116. t['questionarabic'] = 0x061F;
  9117. t['questionarmenian'] = 0x055E;
  9118. t['questiondown'] = 0x00BF;
  9119. t['questiondownsmall'] = 0xF7BF;
  9120. t['questiongreek'] = 0x037E;
  9121. t['questionmonospace'] = 0xFF1F;
  9122. t['questionsmall'] = 0xF73F;
  9123. t['quotedbl'] = 0x0022;
  9124. t['quotedblbase'] = 0x201E;
  9125. t['quotedblleft'] = 0x201C;
  9126. t['quotedblmonospace'] = 0xFF02;
  9127. t['quotedblprime'] = 0x301E;
  9128. t['quotedblprimereversed'] = 0x301D;
  9129. t['quotedblright'] = 0x201D;
  9130. t['quoteleft'] = 0x2018;
  9131. t['quoteleftreversed'] = 0x201B;
  9132. t['quotereversed'] = 0x201B;
  9133. t['quoteright'] = 0x2019;
  9134. t['quoterightn'] = 0x0149;
  9135. t['quotesinglbase'] = 0x201A;
  9136. t['quotesingle'] = 0x0027;
  9137. t['quotesinglemonospace'] = 0xFF07;
  9138. t['r'] = 0x0072;
  9139. t['raarmenian'] = 0x057C;
  9140. t['rabengali'] = 0x09B0;
  9141. t['racute'] = 0x0155;
  9142. t['radeva'] = 0x0930;
  9143. t['radical'] = 0x221A;
  9144. t['radicalex'] = 0xF8E5;
  9145. t['radoverssquare'] = 0x33AE;
  9146. t['radoverssquaredsquare'] = 0x33AF;
  9147. t['radsquare'] = 0x33AD;
  9148. t['rafe'] = 0x05BF;
  9149. t['rafehebrew'] = 0x05BF;
  9150. t['ragujarati'] = 0x0AB0;
  9151. t['ragurmukhi'] = 0x0A30;
  9152. t['rahiragana'] = 0x3089;
  9153. t['rakatakana'] = 0x30E9;
  9154. t['rakatakanahalfwidth'] = 0xFF97;
  9155. t['ralowerdiagonalbengali'] = 0x09F1;
  9156. t['ramiddlediagonalbengali'] = 0x09F0;
  9157. t['ramshorn'] = 0x0264;
  9158. t['ratio'] = 0x2236;
  9159. t['rbopomofo'] = 0x3116;
  9160. t['rcaron'] = 0x0159;
  9161. t['rcedilla'] = 0x0157;
  9162. t['rcircle'] = 0x24E1;
  9163. t['rcommaaccent'] = 0x0157;
  9164. t['rdblgrave'] = 0x0211;
  9165. t['rdotaccent'] = 0x1E59;
  9166. t['rdotbelow'] = 0x1E5B;
  9167. t['rdotbelowmacron'] = 0x1E5D;
  9168. t['referencemark'] = 0x203B;
  9169. t['reflexsubset'] = 0x2286;
  9170. t['reflexsuperset'] = 0x2287;
  9171. t['registered'] = 0x00AE;
  9172. t['registersans'] = 0xF8E8;
  9173. t['registerserif'] = 0xF6DA;
  9174. t['reharabic'] = 0x0631;
  9175. t['reharmenian'] = 0x0580;
  9176. t['rehfinalarabic'] = 0xFEAE;
  9177. t['rehiragana'] = 0x308C;
  9178. t['rekatakana'] = 0x30EC;
  9179. t['rekatakanahalfwidth'] = 0xFF9A;
  9180. t['resh'] = 0x05E8;
  9181. t['reshdageshhebrew'] = 0xFB48;
  9182. t['reshhebrew'] = 0x05E8;
  9183. t['reversedtilde'] = 0x223D;
  9184. t['reviahebrew'] = 0x0597;
  9185. t['reviamugrashhebrew'] = 0x0597;
  9186. t['revlogicalnot'] = 0x2310;
  9187. t['rfishhook'] = 0x027E;
  9188. t['rfishhookreversed'] = 0x027F;
  9189. t['rhabengali'] = 0x09DD;
  9190. t['rhadeva'] = 0x095D;
  9191. t['rho'] = 0x03C1;
  9192. t['rhook'] = 0x027D;
  9193. t['rhookturned'] = 0x027B;
  9194. t['rhookturnedsuperior'] = 0x02B5;
  9195. t['rhosymbolgreek'] = 0x03F1;
  9196. t['rhotichookmod'] = 0x02DE;
  9197. t['rieulacirclekorean'] = 0x3271;
  9198. t['rieulaparenkorean'] = 0x3211;
  9199. t['rieulcirclekorean'] = 0x3263;
  9200. t['rieulhieuhkorean'] = 0x3140;
  9201. t['rieulkiyeokkorean'] = 0x313A;
  9202. t['rieulkiyeoksioskorean'] = 0x3169;
  9203. t['rieulkorean'] = 0x3139;
  9204. t['rieulmieumkorean'] = 0x313B;
  9205. t['rieulpansioskorean'] = 0x316C;
  9206. t['rieulparenkorean'] = 0x3203;
  9207. t['rieulphieuphkorean'] = 0x313F;
  9208. t['rieulpieupkorean'] = 0x313C;
  9209. t['rieulpieupsioskorean'] = 0x316B;
  9210. t['rieulsioskorean'] = 0x313D;
  9211. t['rieulthieuthkorean'] = 0x313E;
  9212. t['rieultikeutkorean'] = 0x316A;
  9213. t['rieulyeorinhieuhkorean'] = 0x316D;
  9214. t['rightangle'] = 0x221F;
  9215. t['righttackbelowcmb'] = 0x0319;
  9216. t['righttriangle'] = 0x22BF;
  9217. t['rihiragana'] = 0x308A;
  9218. t['rikatakana'] = 0x30EA;
  9219. t['rikatakanahalfwidth'] = 0xFF98;
  9220. t['ring'] = 0x02DA;
  9221. t['ringbelowcmb'] = 0x0325;
  9222. t['ringcmb'] = 0x030A;
  9223. t['ringhalfleft'] = 0x02BF;
  9224. t['ringhalfleftarmenian'] = 0x0559;
  9225. t['ringhalfleftbelowcmb'] = 0x031C;
  9226. t['ringhalfleftcentered'] = 0x02D3;
  9227. t['ringhalfright'] = 0x02BE;
  9228. t['ringhalfrightbelowcmb'] = 0x0339;
  9229. t['ringhalfrightcentered'] = 0x02D2;
  9230. t['rinvertedbreve'] = 0x0213;
  9231. t['rittorusquare'] = 0x3351;
  9232. t['rlinebelow'] = 0x1E5F;
  9233. t['rlongleg'] = 0x027C;
  9234. t['rlonglegturned'] = 0x027A;
  9235. t['rmonospace'] = 0xFF52;
  9236. t['rohiragana'] = 0x308D;
  9237. t['rokatakana'] = 0x30ED;
  9238. t['rokatakanahalfwidth'] = 0xFF9B;
  9239. t['roruathai'] = 0x0E23;
  9240. t['rparen'] = 0x24AD;
  9241. t['rrabengali'] = 0x09DC;
  9242. t['rradeva'] = 0x0931;
  9243. t['rragurmukhi'] = 0x0A5C;
  9244. t['rreharabic'] = 0x0691;
  9245. t['rrehfinalarabic'] = 0xFB8D;
  9246. t['rrvocalicbengali'] = 0x09E0;
  9247. t['rrvocalicdeva'] = 0x0960;
  9248. t['rrvocalicgujarati'] = 0x0AE0;
  9249. t['rrvocalicvowelsignbengali'] = 0x09C4;
  9250. t['rrvocalicvowelsigndeva'] = 0x0944;
  9251. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  9252. t['rsuperior'] = 0xF6F1;
  9253. t['rtblock'] = 0x2590;
  9254. t['rturned'] = 0x0279;
  9255. t['rturnedsuperior'] = 0x02B4;
  9256. t['ruhiragana'] = 0x308B;
  9257. t['rukatakana'] = 0x30EB;
  9258. t['rukatakanahalfwidth'] = 0xFF99;
  9259. t['rupeemarkbengali'] = 0x09F2;
  9260. t['rupeesignbengali'] = 0x09F3;
  9261. t['rupiah'] = 0xF6DD;
  9262. t['ruthai'] = 0x0E24;
  9263. t['rvocalicbengali'] = 0x098B;
  9264. t['rvocalicdeva'] = 0x090B;
  9265. t['rvocalicgujarati'] = 0x0A8B;
  9266. t['rvocalicvowelsignbengali'] = 0x09C3;
  9267. t['rvocalicvowelsigndeva'] = 0x0943;
  9268. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  9269. t['s'] = 0x0073;
  9270. t['sabengali'] = 0x09B8;
  9271. t['sacute'] = 0x015B;
  9272. t['sacutedotaccent'] = 0x1E65;
  9273. t['sadarabic'] = 0x0635;
  9274. t['sadeva'] = 0x0938;
  9275. t['sadfinalarabic'] = 0xFEBA;
  9276. t['sadinitialarabic'] = 0xFEBB;
  9277. t['sadmedialarabic'] = 0xFEBC;
  9278. t['sagujarati'] = 0x0AB8;
  9279. t['sagurmukhi'] = 0x0A38;
  9280. t['sahiragana'] = 0x3055;
  9281. t['sakatakana'] = 0x30B5;
  9282. t['sakatakanahalfwidth'] = 0xFF7B;
  9283. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  9284. t['samekh'] = 0x05E1;
  9285. t['samekhdagesh'] = 0xFB41;
  9286. t['samekhdageshhebrew'] = 0xFB41;
  9287. t['samekhhebrew'] = 0x05E1;
  9288. t['saraaathai'] = 0x0E32;
  9289. t['saraaethai'] = 0x0E41;
  9290. t['saraaimaimalaithai'] = 0x0E44;
  9291. t['saraaimaimuanthai'] = 0x0E43;
  9292. t['saraamthai'] = 0x0E33;
  9293. t['saraathai'] = 0x0E30;
  9294. t['saraethai'] = 0x0E40;
  9295. t['saraiileftthai'] = 0xF886;
  9296. t['saraiithai'] = 0x0E35;
  9297. t['saraileftthai'] = 0xF885;
  9298. t['saraithai'] = 0x0E34;
  9299. t['saraothai'] = 0x0E42;
  9300. t['saraueeleftthai'] = 0xF888;
  9301. t['saraueethai'] = 0x0E37;
  9302. t['saraueleftthai'] = 0xF887;
  9303. t['sarauethai'] = 0x0E36;
  9304. t['sarauthai'] = 0x0E38;
  9305. t['sarauuthai'] = 0x0E39;
  9306. t['sbopomofo'] = 0x3119;
  9307. t['scaron'] = 0x0161;
  9308. t['scarondotaccent'] = 0x1E67;
  9309. t['scedilla'] = 0x015F;
  9310. t['schwa'] = 0x0259;
  9311. t['schwacyrillic'] = 0x04D9;
  9312. t['schwadieresiscyrillic'] = 0x04DB;
  9313. t['schwahook'] = 0x025A;
  9314. t['scircle'] = 0x24E2;
  9315. t['scircumflex'] = 0x015D;
  9316. t['scommaaccent'] = 0x0219;
  9317. t['sdotaccent'] = 0x1E61;
  9318. t['sdotbelow'] = 0x1E63;
  9319. t['sdotbelowdotaccent'] = 0x1E69;
  9320. t['seagullbelowcmb'] = 0x033C;
  9321. t['second'] = 0x2033;
  9322. t['secondtonechinese'] = 0x02CA;
  9323. t['section'] = 0x00A7;
  9324. t['seenarabic'] = 0x0633;
  9325. t['seenfinalarabic'] = 0xFEB2;
  9326. t['seeninitialarabic'] = 0xFEB3;
  9327. t['seenmedialarabic'] = 0xFEB4;
  9328. t['segol'] = 0x05B6;
  9329. t['segol13'] = 0x05B6;
  9330. t['segol1f'] = 0x05B6;
  9331. t['segol2c'] = 0x05B6;
  9332. t['segolhebrew'] = 0x05B6;
  9333. t['segolnarrowhebrew'] = 0x05B6;
  9334. t['segolquarterhebrew'] = 0x05B6;
  9335. t['segoltahebrew'] = 0x0592;
  9336. t['segolwidehebrew'] = 0x05B6;
  9337. t['seharmenian'] = 0x057D;
  9338. t['sehiragana'] = 0x305B;
  9339. t['sekatakana'] = 0x30BB;
  9340. t['sekatakanahalfwidth'] = 0xFF7E;
  9341. t['semicolon'] = 0x003B;
  9342. t['semicolonarabic'] = 0x061B;
  9343. t['semicolonmonospace'] = 0xFF1B;
  9344. t['semicolonsmall'] = 0xFE54;
  9345. t['semivoicedmarkkana'] = 0x309C;
  9346. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  9347. t['sentisquare'] = 0x3322;
  9348. t['sentosquare'] = 0x3323;
  9349. t['seven'] = 0x0037;
  9350. t['sevenarabic'] = 0x0667;
  9351. t['sevenbengali'] = 0x09ED;
  9352. t['sevencircle'] = 0x2466;
  9353. t['sevencircleinversesansserif'] = 0x2790;
  9354. t['sevendeva'] = 0x096D;
  9355. t['seveneighths'] = 0x215E;
  9356. t['sevengujarati'] = 0x0AED;
  9357. t['sevengurmukhi'] = 0x0A6D;
  9358. t['sevenhackarabic'] = 0x0667;
  9359. t['sevenhangzhou'] = 0x3027;
  9360. t['sevenideographicparen'] = 0x3226;
  9361. t['seveninferior'] = 0x2087;
  9362. t['sevenmonospace'] = 0xFF17;
  9363. t['sevenoldstyle'] = 0xF737;
  9364. t['sevenparen'] = 0x247A;
  9365. t['sevenperiod'] = 0x248E;
  9366. t['sevenpersian'] = 0x06F7;
  9367. t['sevenroman'] = 0x2176;
  9368. t['sevensuperior'] = 0x2077;
  9369. t['seventeencircle'] = 0x2470;
  9370. t['seventeenparen'] = 0x2484;
  9371. t['seventeenperiod'] = 0x2498;
  9372. t['seventhai'] = 0x0E57;
  9373. t['sfthyphen'] = 0x00AD;
  9374. t['shaarmenian'] = 0x0577;
  9375. t['shabengali'] = 0x09B6;
  9376. t['shacyrillic'] = 0x0448;
  9377. t['shaddaarabic'] = 0x0651;
  9378. t['shaddadammaarabic'] = 0xFC61;
  9379. t['shaddadammatanarabic'] = 0xFC5E;
  9380. t['shaddafathaarabic'] = 0xFC60;
  9381. t['shaddakasraarabic'] = 0xFC62;
  9382. t['shaddakasratanarabic'] = 0xFC5F;
  9383. t['shade'] = 0x2592;
  9384. t['shadedark'] = 0x2593;
  9385. t['shadelight'] = 0x2591;
  9386. t['shademedium'] = 0x2592;
  9387. t['shadeva'] = 0x0936;
  9388. t['shagujarati'] = 0x0AB6;
  9389. t['shagurmukhi'] = 0x0A36;
  9390. t['shalshelethebrew'] = 0x0593;
  9391. t['shbopomofo'] = 0x3115;
  9392. t['shchacyrillic'] = 0x0449;
  9393. t['sheenarabic'] = 0x0634;
  9394. t['sheenfinalarabic'] = 0xFEB6;
  9395. t['sheeninitialarabic'] = 0xFEB7;
  9396. t['sheenmedialarabic'] = 0xFEB8;
  9397. t['sheicoptic'] = 0x03E3;
  9398. t['sheqel'] = 0x20AA;
  9399. t['sheqelhebrew'] = 0x20AA;
  9400. t['sheva'] = 0x05B0;
  9401. t['sheva115'] = 0x05B0;
  9402. t['sheva15'] = 0x05B0;
  9403. t['sheva22'] = 0x05B0;
  9404. t['sheva2e'] = 0x05B0;
  9405. t['shevahebrew'] = 0x05B0;
  9406. t['shevanarrowhebrew'] = 0x05B0;
  9407. t['shevaquarterhebrew'] = 0x05B0;
  9408. t['shevawidehebrew'] = 0x05B0;
  9409. t['shhacyrillic'] = 0x04BB;
  9410. t['shimacoptic'] = 0x03ED;
  9411. t['shin'] = 0x05E9;
  9412. t['shindagesh'] = 0xFB49;
  9413. t['shindageshhebrew'] = 0xFB49;
  9414. t['shindageshshindot'] = 0xFB2C;
  9415. t['shindageshshindothebrew'] = 0xFB2C;
  9416. t['shindageshsindot'] = 0xFB2D;
  9417. t['shindageshsindothebrew'] = 0xFB2D;
  9418. t['shindothebrew'] = 0x05C1;
  9419. t['shinhebrew'] = 0x05E9;
  9420. t['shinshindot'] = 0xFB2A;
  9421. t['shinshindothebrew'] = 0xFB2A;
  9422. t['shinsindot'] = 0xFB2B;
  9423. t['shinsindothebrew'] = 0xFB2B;
  9424. t['shook'] = 0x0282;
  9425. t['sigma'] = 0x03C3;
  9426. t['sigma1'] = 0x03C2;
  9427. t['sigmafinal'] = 0x03C2;
  9428. t['sigmalunatesymbolgreek'] = 0x03F2;
  9429. t['sihiragana'] = 0x3057;
  9430. t['sikatakana'] = 0x30B7;
  9431. t['sikatakanahalfwidth'] = 0xFF7C;
  9432. t['siluqhebrew'] = 0x05BD;
  9433. t['siluqlefthebrew'] = 0x05BD;
  9434. t['similar'] = 0x223C;
  9435. t['sindothebrew'] = 0x05C2;
  9436. t['siosacirclekorean'] = 0x3274;
  9437. t['siosaparenkorean'] = 0x3214;
  9438. t['sioscieuckorean'] = 0x317E;
  9439. t['sioscirclekorean'] = 0x3266;
  9440. t['sioskiyeokkorean'] = 0x317A;
  9441. t['sioskorean'] = 0x3145;
  9442. t['siosnieunkorean'] = 0x317B;
  9443. t['siosparenkorean'] = 0x3206;
  9444. t['siospieupkorean'] = 0x317D;
  9445. t['siostikeutkorean'] = 0x317C;
  9446. t['six'] = 0x0036;
  9447. t['sixarabic'] = 0x0666;
  9448. t['sixbengali'] = 0x09EC;
  9449. t['sixcircle'] = 0x2465;
  9450. t['sixcircleinversesansserif'] = 0x278F;
  9451. t['sixdeva'] = 0x096C;
  9452. t['sixgujarati'] = 0x0AEC;
  9453. t['sixgurmukhi'] = 0x0A6C;
  9454. t['sixhackarabic'] = 0x0666;
  9455. t['sixhangzhou'] = 0x3026;
  9456. t['sixideographicparen'] = 0x3225;
  9457. t['sixinferior'] = 0x2086;
  9458. t['sixmonospace'] = 0xFF16;
  9459. t['sixoldstyle'] = 0xF736;
  9460. t['sixparen'] = 0x2479;
  9461. t['sixperiod'] = 0x248D;
  9462. t['sixpersian'] = 0x06F6;
  9463. t['sixroman'] = 0x2175;
  9464. t['sixsuperior'] = 0x2076;
  9465. t['sixteencircle'] = 0x246F;
  9466. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  9467. t['sixteenparen'] = 0x2483;
  9468. t['sixteenperiod'] = 0x2497;
  9469. t['sixthai'] = 0x0E56;
  9470. t['slash'] = 0x002F;
  9471. t['slashmonospace'] = 0xFF0F;
  9472. t['slong'] = 0x017F;
  9473. t['slongdotaccent'] = 0x1E9B;
  9474. t['smileface'] = 0x263A;
  9475. t['smonospace'] = 0xFF53;
  9476. t['sofpasuqhebrew'] = 0x05C3;
  9477. t['softhyphen'] = 0x00AD;
  9478. t['softsigncyrillic'] = 0x044C;
  9479. t['sohiragana'] = 0x305D;
  9480. t['sokatakana'] = 0x30BD;
  9481. t['sokatakanahalfwidth'] = 0xFF7F;
  9482. t['soliduslongoverlaycmb'] = 0x0338;
  9483. t['solidusshortoverlaycmb'] = 0x0337;
  9484. t['sorusithai'] = 0x0E29;
  9485. t['sosalathai'] = 0x0E28;
  9486. t['sosothai'] = 0x0E0B;
  9487. t['sosuathai'] = 0x0E2A;
  9488. t['space'] = 0x0020;
  9489. t['spacehackarabic'] = 0x0020;
  9490. t['spade'] = 0x2660;
  9491. t['spadesuitblack'] = 0x2660;
  9492. t['spadesuitwhite'] = 0x2664;
  9493. t['sparen'] = 0x24AE;
  9494. t['squarebelowcmb'] = 0x033B;
  9495. t['squarecc'] = 0x33C4;
  9496. t['squarecm'] = 0x339D;
  9497. t['squarediagonalcrosshatchfill'] = 0x25A9;
  9498. t['squarehorizontalfill'] = 0x25A4;
  9499. t['squarekg'] = 0x338F;
  9500. t['squarekm'] = 0x339E;
  9501. t['squarekmcapital'] = 0x33CE;
  9502. t['squareln'] = 0x33D1;
  9503. t['squarelog'] = 0x33D2;
  9504. t['squaremg'] = 0x338E;
  9505. t['squaremil'] = 0x33D5;
  9506. t['squaremm'] = 0x339C;
  9507. t['squaremsquared'] = 0x33A1;
  9508. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  9509. t['squareupperlefttolowerrightfill'] = 0x25A7;
  9510. t['squareupperrighttolowerleftfill'] = 0x25A8;
  9511. t['squareverticalfill'] = 0x25A5;
  9512. t['squarewhitewithsmallblack'] = 0x25A3;
  9513. t['srsquare'] = 0x33DB;
  9514. t['ssabengali'] = 0x09B7;
  9515. t['ssadeva'] = 0x0937;
  9516. t['ssagujarati'] = 0x0AB7;
  9517. t['ssangcieuckorean'] = 0x3149;
  9518. t['ssanghieuhkorean'] = 0x3185;
  9519. t['ssangieungkorean'] = 0x3180;
  9520. t['ssangkiyeokkorean'] = 0x3132;
  9521. t['ssangnieunkorean'] = 0x3165;
  9522. t['ssangpieupkorean'] = 0x3143;
  9523. t['ssangsioskorean'] = 0x3146;
  9524. t['ssangtikeutkorean'] = 0x3138;
  9525. t['ssuperior'] = 0xF6F2;
  9526. t['sterling'] = 0x00A3;
  9527. t['sterlingmonospace'] = 0xFFE1;
  9528. t['strokelongoverlaycmb'] = 0x0336;
  9529. t['strokeshortoverlaycmb'] = 0x0335;
  9530. t['subset'] = 0x2282;
  9531. t['subsetnotequal'] = 0x228A;
  9532. t['subsetorequal'] = 0x2286;
  9533. t['succeeds'] = 0x227B;
  9534. t['suchthat'] = 0x220B;
  9535. t['suhiragana'] = 0x3059;
  9536. t['sukatakana'] = 0x30B9;
  9537. t['sukatakanahalfwidth'] = 0xFF7D;
  9538. t['sukunarabic'] = 0x0652;
  9539. t['summation'] = 0x2211;
  9540. t['sun'] = 0x263C;
  9541. t['superset'] = 0x2283;
  9542. t['supersetnotequal'] = 0x228B;
  9543. t['supersetorequal'] = 0x2287;
  9544. t['svsquare'] = 0x33DC;
  9545. t['syouwaerasquare'] = 0x337C;
  9546. t['t'] = 0x0074;
  9547. t['tabengali'] = 0x09A4;
  9548. t['tackdown'] = 0x22A4;
  9549. t['tackleft'] = 0x22A3;
  9550. t['tadeva'] = 0x0924;
  9551. t['tagujarati'] = 0x0AA4;
  9552. t['tagurmukhi'] = 0x0A24;
  9553. t['taharabic'] = 0x0637;
  9554. t['tahfinalarabic'] = 0xFEC2;
  9555. t['tahinitialarabic'] = 0xFEC3;
  9556. t['tahiragana'] = 0x305F;
  9557. t['tahmedialarabic'] = 0xFEC4;
  9558. t['taisyouerasquare'] = 0x337D;
  9559. t['takatakana'] = 0x30BF;
  9560. t['takatakanahalfwidth'] = 0xFF80;
  9561. t['tatweelarabic'] = 0x0640;
  9562. t['tau'] = 0x03C4;
  9563. t['tav'] = 0x05EA;
  9564. t['tavdages'] = 0xFB4A;
  9565. t['tavdagesh'] = 0xFB4A;
  9566. t['tavdageshhebrew'] = 0xFB4A;
  9567. t['tavhebrew'] = 0x05EA;
  9568. t['tbar'] = 0x0167;
  9569. t['tbopomofo'] = 0x310A;
  9570. t['tcaron'] = 0x0165;
  9571. t['tccurl'] = 0x02A8;
  9572. t['tcedilla'] = 0x0163;
  9573. t['tcheharabic'] = 0x0686;
  9574. t['tchehfinalarabic'] = 0xFB7B;
  9575. t['tchehinitialarabic'] = 0xFB7C;
  9576. t['tchehmedialarabic'] = 0xFB7D;
  9577. t['tcircle'] = 0x24E3;
  9578. t['tcircumflexbelow'] = 0x1E71;
  9579. t['tcommaaccent'] = 0x0163;
  9580. t['tdieresis'] = 0x1E97;
  9581. t['tdotaccent'] = 0x1E6B;
  9582. t['tdotbelow'] = 0x1E6D;
  9583. t['tecyrillic'] = 0x0442;
  9584. t['tedescendercyrillic'] = 0x04AD;
  9585. t['teharabic'] = 0x062A;
  9586. t['tehfinalarabic'] = 0xFE96;
  9587. t['tehhahinitialarabic'] = 0xFCA2;
  9588. t['tehhahisolatedarabic'] = 0xFC0C;
  9589. t['tehinitialarabic'] = 0xFE97;
  9590. t['tehiragana'] = 0x3066;
  9591. t['tehjeeminitialarabic'] = 0xFCA1;
  9592. t['tehjeemisolatedarabic'] = 0xFC0B;
  9593. t['tehmarbutaarabic'] = 0x0629;
  9594. t['tehmarbutafinalarabic'] = 0xFE94;
  9595. t['tehmedialarabic'] = 0xFE98;
  9596. t['tehmeeminitialarabic'] = 0xFCA4;
  9597. t['tehmeemisolatedarabic'] = 0xFC0E;
  9598. t['tehnoonfinalarabic'] = 0xFC73;
  9599. t['tekatakana'] = 0x30C6;
  9600. t['tekatakanahalfwidth'] = 0xFF83;
  9601. t['telephone'] = 0x2121;
  9602. t['telephoneblack'] = 0x260E;
  9603. t['telishagedolahebrew'] = 0x05A0;
  9604. t['telishaqetanahebrew'] = 0x05A9;
  9605. t['tencircle'] = 0x2469;
  9606. t['tenideographicparen'] = 0x3229;
  9607. t['tenparen'] = 0x247D;
  9608. t['tenperiod'] = 0x2491;
  9609. t['tenroman'] = 0x2179;
  9610. t['tesh'] = 0x02A7;
  9611. t['tet'] = 0x05D8;
  9612. t['tetdagesh'] = 0xFB38;
  9613. t['tetdageshhebrew'] = 0xFB38;
  9614. t['tethebrew'] = 0x05D8;
  9615. t['tetsecyrillic'] = 0x04B5;
  9616. t['tevirhebrew'] = 0x059B;
  9617. t['tevirlefthebrew'] = 0x059B;
  9618. t['thabengali'] = 0x09A5;
  9619. t['thadeva'] = 0x0925;
  9620. t['thagujarati'] = 0x0AA5;
  9621. t['thagurmukhi'] = 0x0A25;
  9622. t['thalarabic'] = 0x0630;
  9623. t['thalfinalarabic'] = 0xFEAC;
  9624. t['thanthakhatlowleftthai'] = 0xF898;
  9625. t['thanthakhatlowrightthai'] = 0xF897;
  9626. t['thanthakhatthai'] = 0x0E4C;
  9627. t['thanthakhatupperleftthai'] = 0xF896;
  9628. t['theharabic'] = 0x062B;
  9629. t['thehfinalarabic'] = 0xFE9A;
  9630. t['thehinitialarabic'] = 0xFE9B;
  9631. t['thehmedialarabic'] = 0xFE9C;
  9632. t['thereexists'] = 0x2203;
  9633. t['therefore'] = 0x2234;
  9634. t['theta'] = 0x03B8;
  9635. t['theta1'] = 0x03D1;
  9636. t['thetasymbolgreek'] = 0x03D1;
  9637. t['thieuthacirclekorean'] = 0x3279;
  9638. t['thieuthaparenkorean'] = 0x3219;
  9639. t['thieuthcirclekorean'] = 0x326B;
  9640. t['thieuthkorean'] = 0x314C;
  9641. t['thieuthparenkorean'] = 0x320B;
  9642. t['thirteencircle'] = 0x246C;
  9643. t['thirteenparen'] = 0x2480;
  9644. t['thirteenperiod'] = 0x2494;
  9645. t['thonangmonthothai'] = 0x0E11;
  9646. t['thook'] = 0x01AD;
  9647. t['thophuthaothai'] = 0x0E12;
  9648. t['thorn'] = 0x00FE;
  9649. t['thothahanthai'] = 0x0E17;
  9650. t['thothanthai'] = 0x0E10;
  9651. t['thothongthai'] = 0x0E18;
  9652. t['thothungthai'] = 0x0E16;
  9653. t['thousandcyrillic'] = 0x0482;
  9654. t['thousandsseparatorarabic'] = 0x066C;
  9655. t['thousandsseparatorpersian'] = 0x066C;
  9656. t['three'] = 0x0033;
  9657. t['threearabic'] = 0x0663;
  9658. t['threebengali'] = 0x09E9;
  9659. t['threecircle'] = 0x2462;
  9660. t['threecircleinversesansserif'] = 0x278C;
  9661. t['threedeva'] = 0x0969;
  9662. t['threeeighths'] = 0x215C;
  9663. t['threegujarati'] = 0x0AE9;
  9664. t['threegurmukhi'] = 0x0A69;
  9665. t['threehackarabic'] = 0x0663;
  9666. t['threehangzhou'] = 0x3023;
  9667. t['threeideographicparen'] = 0x3222;
  9668. t['threeinferior'] = 0x2083;
  9669. t['threemonospace'] = 0xFF13;
  9670. t['threenumeratorbengali'] = 0x09F6;
  9671. t['threeoldstyle'] = 0xF733;
  9672. t['threeparen'] = 0x2476;
  9673. t['threeperiod'] = 0x248A;
  9674. t['threepersian'] = 0x06F3;
  9675. t['threequarters'] = 0x00BE;
  9676. t['threequartersemdash'] = 0xF6DE;
  9677. t['threeroman'] = 0x2172;
  9678. t['threesuperior'] = 0x00B3;
  9679. t['threethai'] = 0x0E53;
  9680. t['thzsquare'] = 0x3394;
  9681. t['tihiragana'] = 0x3061;
  9682. t['tikatakana'] = 0x30C1;
  9683. t['tikatakanahalfwidth'] = 0xFF81;
  9684. t['tikeutacirclekorean'] = 0x3270;
  9685. t['tikeutaparenkorean'] = 0x3210;
  9686. t['tikeutcirclekorean'] = 0x3262;
  9687. t['tikeutkorean'] = 0x3137;
  9688. t['tikeutparenkorean'] = 0x3202;
  9689. t['tilde'] = 0x02DC;
  9690. t['tildebelowcmb'] = 0x0330;
  9691. t['tildecmb'] = 0x0303;
  9692. t['tildecomb'] = 0x0303;
  9693. t['tildedoublecmb'] = 0x0360;
  9694. t['tildeoperator'] = 0x223C;
  9695. t['tildeoverlaycmb'] = 0x0334;
  9696. t['tildeverticalcmb'] = 0x033E;
  9697. t['timescircle'] = 0x2297;
  9698. t['tipehahebrew'] = 0x0596;
  9699. t['tipehalefthebrew'] = 0x0596;
  9700. t['tippigurmukhi'] = 0x0A70;
  9701. t['titlocyrilliccmb'] = 0x0483;
  9702. t['tiwnarmenian'] = 0x057F;
  9703. t['tlinebelow'] = 0x1E6F;
  9704. t['tmonospace'] = 0xFF54;
  9705. t['toarmenian'] = 0x0569;
  9706. t['tohiragana'] = 0x3068;
  9707. t['tokatakana'] = 0x30C8;
  9708. t['tokatakanahalfwidth'] = 0xFF84;
  9709. t['tonebarextrahighmod'] = 0x02E5;
  9710. t['tonebarextralowmod'] = 0x02E9;
  9711. t['tonebarhighmod'] = 0x02E6;
  9712. t['tonebarlowmod'] = 0x02E8;
  9713. t['tonebarmidmod'] = 0x02E7;
  9714. t['tonefive'] = 0x01BD;
  9715. t['tonesix'] = 0x0185;
  9716. t['tonetwo'] = 0x01A8;
  9717. t['tonos'] = 0x0384;
  9718. t['tonsquare'] = 0x3327;
  9719. t['topatakthai'] = 0x0E0F;
  9720. t['tortoiseshellbracketleft'] = 0x3014;
  9721. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  9722. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  9723. t['tortoiseshellbracketright'] = 0x3015;
  9724. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  9725. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  9726. t['totaothai'] = 0x0E15;
  9727. t['tpalatalhook'] = 0x01AB;
  9728. t['tparen'] = 0x24AF;
  9729. t['trademark'] = 0x2122;
  9730. t['trademarksans'] = 0xF8EA;
  9731. t['trademarkserif'] = 0xF6DB;
  9732. t['tretroflexhook'] = 0x0288;
  9733. t['triagdn'] = 0x25BC;
  9734. t['triaglf'] = 0x25C4;
  9735. t['triagrt'] = 0x25BA;
  9736. t['triagup'] = 0x25B2;
  9737. t['ts'] = 0x02A6;
  9738. t['tsadi'] = 0x05E6;
  9739. t['tsadidagesh'] = 0xFB46;
  9740. t['tsadidageshhebrew'] = 0xFB46;
  9741. t['tsadihebrew'] = 0x05E6;
  9742. t['tsecyrillic'] = 0x0446;
  9743. t['tsere'] = 0x05B5;
  9744. t['tsere12'] = 0x05B5;
  9745. t['tsere1e'] = 0x05B5;
  9746. t['tsere2b'] = 0x05B5;
  9747. t['tserehebrew'] = 0x05B5;
  9748. t['tserenarrowhebrew'] = 0x05B5;
  9749. t['tserequarterhebrew'] = 0x05B5;
  9750. t['tserewidehebrew'] = 0x05B5;
  9751. t['tshecyrillic'] = 0x045B;
  9752. t['tsuperior'] = 0xF6F3;
  9753. t['ttabengali'] = 0x099F;
  9754. t['ttadeva'] = 0x091F;
  9755. t['ttagujarati'] = 0x0A9F;
  9756. t['ttagurmukhi'] = 0x0A1F;
  9757. t['tteharabic'] = 0x0679;
  9758. t['ttehfinalarabic'] = 0xFB67;
  9759. t['ttehinitialarabic'] = 0xFB68;
  9760. t['ttehmedialarabic'] = 0xFB69;
  9761. t['tthabengali'] = 0x09A0;
  9762. t['tthadeva'] = 0x0920;
  9763. t['tthagujarati'] = 0x0AA0;
  9764. t['tthagurmukhi'] = 0x0A20;
  9765. t['tturned'] = 0x0287;
  9766. t['tuhiragana'] = 0x3064;
  9767. t['tukatakana'] = 0x30C4;
  9768. t['tukatakanahalfwidth'] = 0xFF82;
  9769. t['tusmallhiragana'] = 0x3063;
  9770. t['tusmallkatakana'] = 0x30C3;
  9771. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  9772. t['twelvecircle'] = 0x246B;
  9773. t['twelveparen'] = 0x247F;
  9774. t['twelveperiod'] = 0x2493;
  9775. t['twelveroman'] = 0x217B;
  9776. t['twentycircle'] = 0x2473;
  9777. t['twentyhangzhou'] = 0x5344;
  9778. t['twentyparen'] = 0x2487;
  9779. t['twentyperiod'] = 0x249B;
  9780. t['two'] = 0x0032;
  9781. t['twoarabic'] = 0x0662;
  9782. t['twobengali'] = 0x09E8;
  9783. t['twocircle'] = 0x2461;
  9784. t['twocircleinversesansserif'] = 0x278B;
  9785. t['twodeva'] = 0x0968;
  9786. t['twodotenleader'] = 0x2025;
  9787. t['twodotleader'] = 0x2025;
  9788. t['twodotleadervertical'] = 0xFE30;
  9789. t['twogujarati'] = 0x0AE8;
  9790. t['twogurmukhi'] = 0x0A68;
  9791. t['twohackarabic'] = 0x0662;
  9792. t['twohangzhou'] = 0x3022;
  9793. t['twoideographicparen'] = 0x3221;
  9794. t['twoinferior'] = 0x2082;
  9795. t['twomonospace'] = 0xFF12;
  9796. t['twonumeratorbengali'] = 0x09F5;
  9797. t['twooldstyle'] = 0xF732;
  9798. t['twoparen'] = 0x2475;
  9799. t['twoperiod'] = 0x2489;
  9800. t['twopersian'] = 0x06F2;
  9801. t['tworoman'] = 0x2171;
  9802. t['twostroke'] = 0x01BB;
  9803. t['twosuperior'] = 0x00B2;
  9804. t['twothai'] = 0x0E52;
  9805. t['twothirds'] = 0x2154;
  9806. t['u'] = 0x0075;
  9807. t['uacute'] = 0x00FA;
  9808. t['ubar'] = 0x0289;
  9809. t['ubengali'] = 0x0989;
  9810. t['ubopomofo'] = 0x3128;
  9811. t['ubreve'] = 0x016D;
  9812. t['ucaron'] = 0x01D4;
  9813. t['ucircle'] = 0x24E4;
  9814. t['ucircumflex'] = 0x00FB;
  9815. t['ucircumflexbelow'] = 0x1E77;
  9816. t['ucyrillic'] = 0x0443;
  9817. t['udattadeva'] = 0x0951;
  9818. t['udblacute'] = 0x0171;
  9819. t['udblgrave'] = 0x0215;
  9820. t['udeva'] = 0x0909;
  9821. t['udieresis'] = 0x00FC;
  9822. t['udieresisacute'] = 0x01D8;
  9823. t['udieresisbelow'] = 0x1E73;
  9824. t['udieresiscaron'] = 0x01DA;
  9825. t['udieresiscyrillic'] = 0x04F1;
  9826. t['udieresisgrave'] = 0x01DC;
  9827. t['udieresismacron'] = 0x01D6;
  9828. t['udotbelow'] = 0x1EE5;
  9829. t['ugrave'] = 0x00F9;
  9830. t['ugujarati'] = 0x0A89;
  9831. t['ugurmukhi'] = 0x0A09;
  9832. t['uhiragana'] = 0x3046;
  9833. t['uhookabove'] = 0x1EE7;
  9834. t['uhorn'] = 0x01B0;
  9835. t['uhornacute'] = 0x1EE9;
  9836. t['uhorndotbelow'] = 0x1EF1;
  9837. t['uhorngrave'] = 0x1EEB;
  9838. t['uhornhookabove'] = 0x1EED;
  9839. t['uhorntilde'] = 0x1EEF;
  9840. t['uhungarumlaut'] = 0x0171;
  9841. t['uhungarumlautcyrillic'] = 0x04F3;
  9842. t['uinvertedbreve'] = 0x0217;
  9843. t['ukatakana'] = 0x30A6;
  9844. t['ukatakanahalfwidth'] = 0xFF73;
  9845. t['ukcyrillic'] = 0x0479;
  9846. t['ukorean'] = 0x315C;
  9847. t['umacron'] = 0x016B;
  9848. t['umacroncyrillic'] = 0x04EF;
  9849. t['umacrondieresis'] = 0x1E7B;
  9850. t['umatragurmukhi'] = 0x0A41;
  9851. t['umonospace'] = 0xFF55;
  9852. t['underscore'] = 0x005F;
  9853. t['underscoredbl'] = 0x2017;
  9854. t['underscoremonospace'] = 0xFF3F;
  9855. t['underscorevertical'] = 0xFE33;
  9856. t['underscorewavy'] = 0xFE4F;
  9857. t['union'] = 0x222A;
  9858. t['universal'] = 0x2200;
  9859. t['uogonek'] = 0x0173;
  9860. t['uparen'] = 0x24B0;
  9861. t['upblock'] = 0x2580;
  9862. t['upperdothebrew'] = 0x05C4;
  9863. t['upsilon'] = 0x03C5;
  9864. t['upsilondieresis'] = 0x03CB;
  9865. t['upsilondieresistonos'] = 0x03B0;
  9866. t['upsilonlatin'] = 0x028A;
  9867. t['upsilontonos'] = 0x03CD;
  9868. t['uptackbelowcmb'] = 0x031D;
  9869. t['uptackmod'] = 0x02D4;
  9870. t['uragurmukhi'] = 0x0A73;
  9871. t['uring'] = 0x016F;
  9872. t['ushortcyrillic'] = 0x045E;
  9873. t['usmallhiragana'] = 0x3045;
  9874. t['usmallkatakana'] = 0x30A5;
  9875. t['usmallkatakanahalfwidth'] = 0xFF69;
  9876. t['ustraightcyrillic'] = 0x04AF;
  9877. t['ustraightstrokecyrillic'] = 0x04B1;
  9878. t['utilde'] = 0x0169;
  9879. t['utildeacute'] = 0x1E79;
  9880. t['utildebelow'] = 0x1E75;
  9881. t['uubengali'] = 0x098A;
  9882. t['uudeva'] = 0x090A;
  9883. t['uugujarati'] = 0x0A8A;
  9884. t['uugurmukhi'] = 0x0A0A;
  9885. t['uumatragurmukhi'] = 0x0A42;
  9886. t['uuvowelsignbengali'] = 0x09C2;
  9887. t['uuvowelsigndeva'] = 0x0942;
  9888. t['uuvowelsigngujarati'] = 0x0AC2;
  9889. t['uvowelsignbengali'] = 0x09C1;
  9890. t['uvowelsigndeva'] = 0x0941;
  9891. t['uvowelsigngujarati'] = 0x0AC1;
  9892. t['v'] = 0x0076;
  9893. t['vadeva'] = 0x0935;
  9894. t['vagujarati'] = 0x0AB5;
  9895. t['vagurmukhi'] = 0x0A35;
  9896. t['vakatakana'] = 0x30F7;
  9897. t['vav'] = 0x05D5;
  9898. t['vavdagesh'] = 0xFB35;
  9899. t['vavdagesh65'] = 0xFB35;
  9900. t['vavdageshhebrew'] = 0xFB35;
  9901. t['vavhebrew'] = 0x05D5;
  9902. t['vavholam'] = 0xFB4B;
  9903. t['vavholamhebrew'] = 0xFB4B;
  9904. t['vavvavhebrew'] = 0x05F0;
  9905. t['vavyodhebrew'] = 0x05F1;
  9906. t['vcircle'] = 0x24E5;
  9907. t['vdotbelow'] = 0x1E7F;
  9908. t['vecyrillic'] = 0x0432;
  9909. t['veharabic'] = 0x06A4;
  9910. t['vehfinalarabic'] = 0xFB6B;
  9911. t['vehinitialarabic'] = 0xFB6C;
  9912. t['vehmedialarabic'] = 0xFB6D;
  9913. t['vekatakana'] = 0x30F9;
  9914. t['venus'] = 0x2640;
  9915. t['verticalbar'] = 0x007C;
  9916. t['verticallineabovecmb'] = 0x030D;
  9917. t['verticallinebelowcmb'] = 0x0329;
  9918. t['verticallinelowmod'] = 0x02CC;
  9919. t['verticallinemod'] = 0x02C8;
  9920. t['vewarmenian'] = 0x057E;
  9921. t['vhook'] = 0x028B;
  9922. t['vikatakana'] = 0x30F8;
  9923. t['viramabengali'] = 0x09CD;
  9924. t['viramadeva'] = 0x094D;
  9925. t['viramagujarati'] = 0x0ACD;
  9926. t['visargabengali'] = 0x0983;
  9927. t['visargadeva'] = 0x0903;
  9928. t['visargagujarati'] = 0x0A83;
  9929. t['vmonospace'] = 0xFF56;
  9930. t['voarmenian'] = 0x0578;
  9931. t['voicediterationhiragana'] = 0x309E;
  9932. t['voicediterationkatakana'] = 0x30FE;
  9933. t['voicedmarkkana'] = 0x309B;
  9934. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  9935. t['vokatakana'] = 0x30FA;
  9936. t['vparen'] = 0x24B1;
  9937. t['vtilde'] = 0x1E7D;
  9938. t['vturned'] = 0x028C;
  9939. t['vuhiragana'] = 0x3094;
  9940. t['vukatakana'] = 0x30F4;
  9941. t['w'] = 0x0077;
  9942. t['wacute'] = 0x1E83;
  9943. t['waekorean'] = 0x3159;
  9944. t['wahiragana'] = 0x308F;
  9945. t['wakatakana'] = 0x30EF;
  9946. t['wakatakanahalfwidth'] = 0xFF9C;
  9947. t['wakorean'] = 0x3158;
  9948. t['wasmallhiragana'] = 0x308E;
  9949. t['wasmallkatakana'] = 0x30EE;
  9950. t['wattosquare'] = 0x3357;
  9951. t['wavedash'] = 0x301C;
  9952. t['wavyunderscorevertical'] = 0xFE34;
  9953. t['wawarabic'] = 0x0648;
  9954. t['wawfinalarabic'] = 0xFEEE;
  9955. t['wawhamzaabovearabic'] = 0x0624;
  9956. t['wawhamzaabovefinalarabic'] = 0xFE86;
  9957. t['wbsquare'] = 0x33DD;
  9958. t['wcircle'] = 0x24E6;
  9959. t['wcircumflex'] = 0x0175;
  9960. t['wdieresis'] = 0x1E85;
  9961. t['wdotaccent'] = 0x1E87;
  9962. t['wdotbelow'] = 0x1E89;
  9963. t['wehiragana'] = 0x3091;
  9964. t['weierstrass'] = 0x2118;
  9965. t['wekatakana'] = 0x30F1;
  9966. t['wekorean'] = 0x315E;
  9967. t['weokorean'] = 0x315D;
  9968. t['wgrave'] = 0x1E81;
  9969. t['whitebullet'] = 0x25E6;
  9970. t['whitecircle'] = 0x25CB;
  9971. t['whitecircleinverse'] = 0x25D9;
  9972. t['whitecornerbracketleft'] = 0x300E;
  9973. t['whitecornerbracketleftvertical'] = 0xFE43;
  9974. t['whitecornerbracketright'] = 0x300F;
  9975. t['whitecornerbracketrightvertical'] = 0xFE44;
  9976. t['whitediamond'] = 0x25C7;
  9977. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  9978. t['whitedownpointingsmalltriangle'] = 0x25BF;
  9979. t['whitedownpointingtriangle'] = 0x25BD;
  9980. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  9981. t['whiteleftpointingtriangle'] = 0x25C1;
  9982. t['whitelenticularbracketleft'] = 0x3016;
  9983. t['whitelenticularbracketright'] = 0x3017;
  9984. t['whiterightpointingsmalltriangle'] = 0x25B9;
  9985. t['whiterightpointingtriangle'] = 0x25B7;
  9986. t['whitesmallsquare'] = 0x25AB;
  9987. t['whitesmilingface'] = 0x263A;
  9988. t['whitesquare'] = 0x25A1;
  9989. t['whitestar'] = 0x2606;
  9990. t['whitetelephone'] = 0x260F;
  9991. t['whitetortoiseshellbracketleft'] = 0x3018;
  9992. t['whitetortoiseshellbracketright'] = 0x3019;
  9993. t['whiteuppointingsmalltriangle'] = 0x25B5;
  9994. t['whiteuppointingtriangle'] = 0x25B3;
  9995. t['wihiragana'] = 0x3090;
  9996. t['wikatakana'] = 0x30F0;
  9997. t['wikorean'] = 0x315F;
  9998. t['wmonospace'] = 0xFF57;
  9999. t['wohiragana'] = 0x3092;
  10000. t['wokatakana'] = 0x30F2;
  10001. t['wokatakanahalfwidth'] = 0xFF66;
  10002. t['won'] = 0x20A9;
  10003. t['wonmonospace'] = 0xFFE6;
  10004. t['wowaenthai'] = 0x0E27;
  10005. t['wparen'] = 0x24B2;
  10006. t['wring'] = 0x1E98;
  10007. t['wsuperior'] = 0x02B7;
  10008. t['wturned'] = 0x028D;
  10009. t['wynn'] = 0x01BF;
  10010. t['x'] = 0x0078;
  10011. t['xabovecmb'] = 0x033D;
  10012. t['xbopomofo'] = 0x3112;
  10013. t['xcircle'] = 0x24E7;
  10014. t['xdieresis'] = 0x1E8D;
  10015. t['xdotaccent'] = 0x1E8B;
  10016. t['xeharmenian'] = 0x056D;
  10017. t['xi'] = 0x03BE;
  10018. t['xmonospace'] = 0xFF58;
  10019. t['xparen'] = 0x24B3;
  10020. t['xsuperior'] = 0x02E3;
  10021. t['y'] = 0x0079;
  10022. t['yaadosquare'] = 0x334E;
  10023. t['yabengali'] = 0x09AF;
  10024. t['yacute'] = 0x00FD;
  10025. t['yadeva'] = 0x092F;
  10026. t['yaekorean'] = 0x3152;
  10027. t['yagujarati'] = 0x0AAF;
  10028. t['yagurmukhi'] = 0x0A2F;
  10029. t['yahiragana'] = 0x3084;
  10030. t['yakatakana'] = 0x30E4;
  10031. t['yakatakanahalfwidth'] = 0xFF94;
  10032. t['yakorean'] = 0x3151;
  10033. t['yamakkanthai'] = 0x0E4E;
  10034. t['yasmallhiragana'] = 0x3083;
  10035. t['yasmallkatakana'] = 0x30E3;
  10036. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  10037. t['yatcyrillic'] = 0x0463;
  10038. t['ycircle'] = 0x24E8;
  10039. t['ycircumflex'] = 0x0177;
  10040. t['ydieresis'] = 0x00FF;
  10041. t['ydotaccent'] = 0x1E8F;
  10042. t['ydotbelow'] = 0x1EF5;
  10043. t['yeharabic'] = 0x064A;
  10044. t['yehbarreearabic'] = 0x06D2;
  10045. t['yehbarreefinalarabic'] = 0xFBAF;
  10046. t['yehfinalarabic'] = 0xFEF2;
  10047. t['yehhamzaabovearabic'] = 0x0626;
  10048. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  10049. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  10050. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  10051. t['yehinitialarabic'] = 0xFEF3;
  10052. t['yehmedialarabic'] = 0xFEF4;
  10053. t['yehmeeminitialarabic'] = 0xFCDD;
  10054. t['yehmeemisolatedarabic'] = 0xFC58;
  10055. t['yehnoonfinalarabic'] = 0xFC94;
  10056. t['yehthreedotsbelowarabic'] = 0x06D1;
  10057. t['yekorean'] = 0x3156;
  10058. t['yen'] = 0x00A5;
  10059. t['yenmonospace'] = 0xFFE5;
  10060. t['yeokorean'] = 0x3155;
  10061. t['yeorinhieuhkorean'] = 0x3186;
  10062. t['yerahbenyomohebrew'] = 0x05AA;
  10063. t['yerahbenyomolefthebrew'] = 0x05AA;
  10064. t['yericyrillic'] = 0x044B;
  10065. t['yerudieresiscyrillic'] = 0x04F9;
  10066. t['yesieungkorean'] = 0x3181;
  10067. t['yesieungpansioskorean'] = 0x3183;
  10068. t['yesieungsioskorean'] = 0x3182;
  10069. t['yetivhebrew'] = 0x059A;
  10070. t['ygrave'] = 0x1EF3;
  10071. t['yhook'] = 0x01B4;
  10072. t['yhookabove'] = 0x1EF7;
  10073. t['yiarmenian'] = 0x0575;
  10074. t['yicyrillic'] = 0x0457;
  10075. t['yikorean'] = 0x3162;
  10076. t['yinyang'] = 0x262F;
  10077. t['yiwnarmenian'] = 0x0582;
  10078. t['ymonospace'] = 0xFF59;
  10079. t['yod'] = 0x05D9;
  10080. t['yoddagesh'] = 0xFB39;
  10081. t['yoddageshhebrew'] = 0xFB39;
  10082. t['yodhebrew'] = 0x05D9;
  10083. t['yodyodhebrew'] = 0x05F2;
  10084. t['yodyodpatahhebrew'] = 0xFB1F;
  10085. t['yohiragana'] = 0x3088;
  10086. t['yoikorean'] = 0x3189;
  10087. t['yokatakana'] = 0x30E8;
  10088. t['yokatakanahalfwidth'] = 0xFF96;
  10089. t['yokorean'] = 0x315B;
  10090. t['yosmallhiragana'] = 0x3087;
  10091. t['yosmallkatakana'] = 0x30E7;
  10092. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  10093. t['yotgreek'] = 0x03F3;
  10094. t['yoyaekorean'] = 0x3188;
  10095. t['yoyakorean'] = 0x3187;
  10096. t['yoyakthai'] = 0x0E22;
  10097. t['yoyingthai'] = 0x0E0D;
  10098. t['yparen'] = 0x24B4;
  10099. t['ypogegrammeni'] = 0x037A;
  10100. t['ypogegrammenigreekcmb'] = 0x0345;
  10101. t['yr'] = 0x01A6;
  10102. t['yring'] = 0x1E99;
  10103. t['ysuperior'] = 0x02B8;
  10104. t['ytilde'] = 0x1EF9;
  10105. t['yturned'] = 0x028E;
  10106. t['yuhiragana'] = 0x3086;
  10107. t['yuikorean'] = 0x318C;
  10108. t['yukatakana'] = 0x30E6;
  10109. t['yukatakanahalfwidth'] = 0xFF95;
  10110. t['yukorean'] = 0x3160;
  10111. t['yusbigcyrillic'] = 0x046B;
  10112. t['yusbigiotifiedcyrillic'] = 0x046D;
  10113. t['yuslittlecyrillic'] = 0x0467;
  10114. t['yuslittleiotifiedcyrillic'] = 0x0469;
  10115. t['yusmallhiragana'] = 0x3085;
  10116. t['yusmallkatakana'] = 0x30E5;
  10117. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  10118. t['yuyekorean'] = 0x318B;
  10119. t['yuyeokorean'] = 0x318A;
  10120. t['yyabengali'] = 0x09DF;
  10121. t['yyadeva'] = 0x095F;
  10122. t['z'] = 0x007A;
  10123. t['zaarmenian'] = 0x0566;
  10124. t['zacute'] = 0x017A;
  10125. t['zadeva'] = 0x095B;
  10126. t['zagurmukhi'] = 0x0A5B;
  10127. t['zaharabic'] = 0x0638;
  10128. t['zahfinalarabic'] = 0xFEC6;
  10129. t['zahinitialarabic'] = 0xFEC7;
  10130. t['zahiragana'] = 0x3056;
  10131. t['zahmedialarabic'] = 0xFEC8;
  10132. t['zainarabic'] = 0x0632;
  10133. t['zainfinalarabic'] = 0xFEB0;
  10134. t['zakatakana'] = 0x30B6;
  10135. t['zaqefgadolhebrew'] = 0x0595;
  10136. t['zaqefqatanhebrew'] = 0x0594;
  10137. t['zarqahebrew'] = 0x0598;
  10138. t['zayin'] = 0x05D6;
  10139. t['zayindagesh'] = 0xFB36;
  10140. t['zayindageshhebrew'] = 0xFB36;
  10141. t['zayinhebrew'] = 0x05D6;
  10142. t['zbopomofo'] = 0x3117;
  10143. t['zcaron'] = 0x017E;
  10144. t['zcircle'] = 0x24E9;
  10145. t['zcircumflex'] = 0x1E91;
  10146. t['zcurl'] = 0x0291;
  10147. t['zdot'] = 0x017C;
  10148. t['zdotaccent'] = 0x017C;
  10149. t['zdotbelow'] = 0x1E93;
  10150. t['zecyrillic'] = 0x0437;
  10151. t['zedescendercyrillic'] = 0x0499;
  10152. t['zedieresiscyrillic'] = 0x04DF;
  10153. t['zehiragana'] = 0x305C;
  10154. t['zekatakana'] = 0x30BC;
  10155. t['zero'] = 0x0030;
  10156. t['zeroarabic'] = 0x0660;
  10157. t['zerobengali'] = 0x09E6;
  10158. t['zerodeva'] = 0x0966;
  10159. t['zerogujarati'] = 0x0AE6;
  10160. t['zerogurmukhi'] = 0x0A66;
  10161. t['zerohackarabic'] = 0x0660;
  10162. t['zeroinferior'] = 0x2080;
  10163. t['zeromonospace'] = 0xFF10;
  10164. t['zerooldstyle'] = 0xF730;
  10165. t['zeropersian'] = 0x06F0;
  10166. t['zerosuperior'] = 0x2070;
  10167. t['zerothai'] = 0x0E50;
  10168. t['zerowidthjoiner'] = 0xFEFF;
  10169. t['zerowidthnonjoiner'] = 0x200C;
  10170. t['zerowidthspace'] = 0x200B;
  10171. t['zeta'] = 0x03B6;
  10172. t['zhbopomofo'] = 0x3113;
  10173. t['zhearmenian'] = 0x056A;
  10174. t['zhebrevecyrillic'] = 0x04C2;
  10175. t['zhecyrillic'] = 0x0436;
  10176. t['zhedescendercyrillic'] = 0x0497;
  10177. t['zhedieresiscyrillic'] = 0x04DD;
  10178. t['zihiragana'] = 0x3058;
  10179. t['zikatakana'] = 0x30B8;
  10180. t['zinorhebrew'] = 0x05AE;
  10181. t['zlinebelow'] = 0x1E95;
  10182. t['zmonospace'] = 0xFF5A;
  10183. t['zohiragana'] = 0x305E;
  10184. t['zokatakana'] = 0x30BE;
  10185. t['zparen'] = 0x24B5;
  10186. t['zretroflexhook'] = 0x0290;
  10187. t['zstroke'] = 0x01B6;
  10188. t['zuhiragana'] = 0x305A;
  10189. t['zukatakana'] = 0x30BA;
  10190. t['.notdef'] = 0x0000;
  10191. t['angbracketleftbig'] = 0x2329;
  10192. t['angbracketleftBig'] = 0x2329;
  10193. t['angbracketleftbigg'] = 0x2329;
  10194. t['angbracketleftBigg'] = 0x2329;
  10195. t['angbracketrightBig'] = 0x232A;
  10196. t['angbracketrightbig'] = 0x232A;
  10197. t['angbracketrightBigg'] = 0x232A;
  10198. t['angbracketrightbigg'] = 0x232A;
  10199. t['arrowhookleft'] = 0x21AA;
  10200. t['arrowhookright'] = 0x21A9;
  10201. t['arrowlefttophalf'] = 0x21BC;
  10202. t['arrowleftbothalf'] = 0x21BD;
  10203. t['arrownortheast'] = 0x2197;
  10204. t['arrownorthwest'] = 0x2196;
  10205. t['arrowrighttophalf'] = 0x21C0;
  10206. t['arrowrightbothalf'] = 0x21C1;
  10207. t['arrowsoutheast'] = 0x2198;
  10208. t['arrowsouthwest'] = 0x2199;
  10209. t['backslashbig'] = 0x2216;
  10210. t['backslashBig'] = 0x2216;
  10211. t['backslashBigg'] = 0x2216;
  10212. t['backslashbigg'] = 0x2216;
  10213. t['bardbl'] = 0x2016;
  10214. t['bracehtipdownleft'] = 0xFE37;
  10215. t['bracehtipdownright'] = 0xFE37;
  10216. t['bracehtipupleft'] = 0xFE38;
  10217. t['bracehtipupright'] = 0xFE38;
  10218. t['braceleftBig'] = 0x007B;
  10219. t['braceleftbig'] = 0x007B;
  10220. t['braceleftbigg'] = 0x007B;
  10221. t['braceleftBigg'] = 0x007B;
  10222. t['bracerightBig'] = 0x007D;
  10223. t['bracerightbig'] = 0x007D;
  10224. t['bracerightbigg'] = 0x007D;
  10225. t['bracerightBigg'] = 0x007D;
  10226. t['bracketleftbig'] = 0x005B;
  10227. t['bracketleftBig'] = 0x005B;
  10228. t['bracketleftbigg'] = 0x005B;
  10229. t['bracketleftBigg'] = 0x005B;
  10230. t['bracketrightBig'] = 0x005D;
  10231. t['bracketrightbig'] = 0x005D;
  10232. t['bracketrightbigg'] = 0x005D;
  10233. t['bracketrightBigg'] = 0x005D;
  10234. t['ceilingleftbig'] = 0x2308;
  10235. t['ceilingleftBig'] = 0x2308;
  10236. t['ceilingleftBigg'] = 0x2308;
  10237. t['ceilingleftbigg'] = 0x2308;
  10238. t['ceilingrightbig'] = 0x2309;
  10239. t['ceilingrightBig'] = 0x2309;
  10240. t['ceilingrightbigg'] = 0x2309;
  10241. t['ceilingrightBigg'] = 0x2309;
  10242. t['circledotdisplay'] = 0x2299;
  10243. t['circledottext'] = 0x2299;
  10244. t['circlemultiplydisplay'] = 0x2297;
  10245. t['circlemultiplytext'] = 0x2297;
  10246. t['circleplusdisplay'] = 0x2295;
  10247. t['circleplustext'] = 0x2295;
  10248. t['contintegraldisplay'] = 0x222E;
  10249. t['contintegraltext'] = 0x222E;
  10250. t['coproductdisplay'] = 0x2210;
  10251. t['coproducttext'] = 0x2210;
  10252. t['floorleftBig'] = 0x230A;
  10253. t['floorleftbig'] = 0x230A;
  10254. t['floorleftbigg'] = 0x230A;
  10255. t['floorleftBigg'] = 0x230A;
  10256. t['floorrightbig'] = 0x230B;
  10257. t['floorrightBig'] = 0x230B;
  10258. t['floorrightBigg'] = 0x230B;
  10259. t['floorrightbigg'] = 0x230B;
  10260. t['hatwide'] = 0x0302;
  10261. t['hatwider'] = 0x0302;
  10262. t['hatwidest'] = 0x0302;
  10263. t['intercal'] = 0x1D40;
  10264. t['integraldisplay'] = 0x222B;
  10265. t['integraltext'] = 0x222B;
  10266. t['intersectiondisplay'] = 0x22C2;
  10267. t['intersectiontext'] = 0x22C2;
  10268. t['logicalanddisplay'] = 0x2227;
  10269. t['logicalandtext'] = 0x2227;
  10270. t['logicalordisplay'] = 0x2228;
  10271. t['logicalortext'] = 0x2228;
  10272. t['parenleftBig'] = 0x0028;
  10273. t['parenleftbig'] = 0x0028;
  10274. t['parenleftBigg'] = 0x0028;
  10275. t['parenleftbigg'] = 0x0028;
  10276. t['parenrightBig'] = 0x0029;
  10277. t['parenrightbig'] = 0x0029;
  10278. t['parenrightBigg'] = 0x0029;
  10279. t['parenrightbigg'] = 0x0029;
  10280. t['prime'] = 0x2032;
  10281. t['productdisplay'] = 0x220F;
  10282. t['producttext'] = 0x220F;
  10283. t['radicalbig'] = 0x221A;
  10284. t['radicalBig'] = 0x221A;
  10285. t['radicalBigg'] = 0x221A;
  10286. t['radicalbigg'] = 0x221A;
  10287. t['radicalbt'] = 0x221A;
  10288. t['radicaltp'] = 0x221A;
  10289. t['radicalvertex'] = 0x221A;
  10290. t['slashbig'] = 0x002F;
  10291. t['slashBig'] = 0x002F;
  10292. t['slashBigg'] = 0x002F;
  10293. t['slashbigg'] = 0x002F;
  10294. t['summationdisplay'] = 0x2211;
  10295. t['summationtext'] = 0x2211;
  10296. t['tildewide'] = 0x02DC;
  10297. t['tildewider'] = 0x02DC;
  10298. t['tildewidest'] = 0x02DC;
  10299. t['uniondisplay'] = 0x22C3;
  10300. t['unionmultidisplay'] = 0x228E;
  10301. t['unionmultitext'] = 0x228E;
  10302. t['unionsqdisplay'] = 0x2294;
  10303. t['unionsqtext'] = 0x2294;
  10304. t['uniontext'] = 0x22C3;
  10305. t['vextenddouble'] = 0x2225;
  10306. t['vextendsingle'] = 0x2223;
  10307. });
  10308. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  10309. t['space'] = 0x0020;
  10310. t['a1'] = 0x2701;
  10311. t['a2'] = 0x2702;
  10312. t['a202'] = 0x2703;
  10313. t['a3'] = 0x2704;
  10314. t['a4'] = 0x260E;
  10315. t['a5'] = 0x2706;
  10316. t['a119'] = 0x2707;
  10317. t['a118'] = 0x2708;
  10318. t['a117'] = 0x2709;
  10319. t['a11'] = 0x261B;
  10320. t['a12'] = 0x261E;
  10321. t['a13'] = 0x270C;
  10322. t['a14'] = 0x270D;
  10323. t['a15'] = 0x270E;
  10324. t['a16'] = 0x270F;
  10325. t['a105'] = 0x2710;
  10326. t['a17'] = 0x2711;
  10327. t['a18'] = 0x2712;
  10328. t['a19'] = 0x2713;
  10329. t['a20'] = 0x2714;
  10330. t['a21'] = 0x2715;
  10331. t['a22'] = 0x2716;
  10332. t['a23'] = 0x2717;
  10333. t['a24'] = 0x2718;
  10334. t['a25'] = 0x2719;
  10335. t['a26'] = 0x271A;
  10336. t['a27'] = 0x271B;
  10337. t['a28'] = 0x271C;
  10338. t['a6'] = 0x271D;
  10339. t['a7'] = 0x271E;
  10340. t['a8'] = 0x271F;
  10341. t['a9'] = 0x2720;
  10342. t['a10'] = 0x2721;
  10343. t['a29'] = 0x2722;
  10344. t['a30'] = 0x2723;
  10345. t['a31'] = 0x2724;
  10346. t['a32'] = 0x2725;
  10347. t['a33'] = 0x2726;
  10348. t['a34'] = 0x2727;
  10349. t['a35'] = 0x2605;
  10350. t['a36'] = 0x2729;
  10351. t['a37'] = 0x272A;
  10352. t['a38'] = 0x272B;
  10353. t['a39'] = 0x272C;
  10354. t['a40'] = 0x272D;
  10355. t['a41'] = 0x272E;
  10356. t['a42'] = 0x272F;
  10357. t['a43'] = 0x2730;
  10358. t['a44'] = 0x2731;
  10359. t['a45'] = 0x2732;
  10360. t['a46'] = 0x2733;
  10361. t['a47'] = 0x2734;
  10362. t['a48'] = 0x2735;
  10363. t['a49'] = 0x2736;
  10364. t['a50'] = 0x2737;
  10365. t['a51'] = 0x2738;
  10366. t['a52'] = 0x2739;
  10367. t['a53'] = 0x273A;
  10368. t['a54'] = 0x273B;
  10369. t['a55'] = 0x273C;
  10370. t['a56'] = 0x273D;
  10371. t['a57'] = 0x273E;
  10372. t['a58'] = 0x273F;
  10373. t['a59'] = 0x2740;
  10374. t['a60'] = 0x2741;
  10375. t['a61'] = 0x2742;
  10376. t['a62'] = 0x2743;
  10377. t['a63'] = 0x2744;
  10378. t['a64'] = 0x2745;
  10379. t['a65'] = 0x2746;
  10380. t['a66'] = 0x2747;
  10381. t['a67'] = 0x2748;
  10382. t['a68'] = 0x2749;
  10383. t['a69'] = 0x274A;
  10384. t['a70'] = 0x274B;
  10385. t['a71'] = 0x25CF;
  10386. t['a72'] = 0x274D;
  10387. t['a73'] = 0x25A0;
  10388. t['a74'] = 0x274F;
  10389. t['a203'] = 0x2750;
  10390. t['a75'] = 0x2751;
  10391. t['a204'] = 0x2752;
  10392. t['a76'] = 0x25B2;
  10393. t['a77'] = 0x25BC;
  10394. t['a78'] = 0x25C6;
  10395. t['a79'] = 0x2756;
  10396. t['a81'] = 0x25D7;
  10397. t['a82'] = 0x2758;
  10398. t['a83'] = 0x2759;
  10399. t['a84'] = 0x275A;
  10400. t['a97'] = 0x275B;
  10401. t['a98'] = 0x275C;
  10402. t['a99'] = 0x275D;
  10403. t['a100'] = 0x275E;
  10404. t['a101'] = 0x2761;
  10405. t['a102'] = 0x2762;
  10406. t['a103'] = 0x2763;
  10407. t['a104'] = 0x2764;
  10408. t['a106'] = 0x2765;
  10409. t['a107'] = 0x2766;
  10410. t['a108'] = 0x2767;
  10411. t['a112'] = 0x2663;
  10412. t['a111'] = 0x2666;
  10413. t['a110'] = 0x2665;
  10414. t['a109'] = 0x2660;
  10415. t['a120'] = 0x2460;
  10416. t['a121'] = 0x2461;
  10417. t['a122'] = 0x2462;
  10418. t['a123'] = 0x2463;
  10419. t['a124'] = 0x2464;
  10420. t['a125'] = 0x2465;
  10421. t['a126'] = 0x2466;
  10422. t['a127'] = 0x2467;
  10423. t['a128'] = 0x2468;
  10424. t['a129'] = 0x2469;
  10425. t['a130'] = 0x2776;
  10426. t['a131'] = 0x2777;
  10427. t['a132'] = 0x2778;
  10428. t['a133'] = 0x2779;
  10429. t['a134'] = 0x277A;
  10430. t['a135'] = 0x277B;
  10431. t['a136'] = 0x277C;
  10432. t['a137'] = 0x277D;
  10433. t['a138'] = 0x277E;
  10434. t['a139'] = 0x277F;
  10435. t['a140'] = 0x2780;
  10436. t['a141'] = 0x2781;
  10437. t['a142'] = 0x2782;
  10438. t['a143'] = 0x2783;
  10439. t['a144'] = 0x2784;
  10440. t['a145'] = 0x2785;
  10441. t['a146'] = 0x2786;
  10442. t['a147'] = 0x2787;
  10443. t['a148'] = 0x2788;
  10444. t['a149'] = 0x2789;
  10445. t['a150'] = 0x278A;
  10446. t['a151'] = 0x278B;
  10447. t['a152'] = 0x278C;
  10448. t['a153'] = 0x278D;
  10449. t['a154'] = 0x278E;
  10450. t['a155'] = 0x278F;
  10451. t['a156'] = 0x2790;
  10452. t['a157'] = 0x2791;
  10453. t['a158'] = 0x2792;
  10454. t['a159'] = 0x2793;
  10455. t['a160'] = 0x2794;
  10456. t['a161'] = 0x2192;
  10457. t['a163'] = 0x2194;
  10458. t['a164'] = 0x2195;
  10459. t['a196'] = 0x2798;
  10460. t['a165'] = 0x2799;
  10461. t['a192'] = 0x279A;
  10462. t['a166'] = 0x279B;
  10463. t['a167'] = 0x279C;
  10464. t['a168'] = 0x279D;
  10465. t['a169'] = 0x279E;
  10466. t['a170'] = 0x279F;
  10467. t['a171'] = 0x27A0;
  10468. t['a172'] = 0x27A1;
  10469. t['a173'] = 0x27A2;
  10470. t['a162'] = 0x27A3;
  10471. t['a174'] = 0x27A4;
  10472. t['a175'] = 0x27A5;
  10473. t['a176'] = 0x27A6;
  10474. t['a177'] = 0x27A7;
  10475. t['a178'] = 0x27A8;
  10476. t['a179'] = 0x27A9;
  10477. t['a193'] = 0x27AA;
  10478. t['a180'] = 0x27AB;
  10479. t['a199'] = 0x27AC;
  10480. t['a181'] = 0x27AD;
  10481. t['a200'] = 0x27AE;
  10482. t['a182'] = 0x27AF;
  10483. t['a201'] = 0x27B1;
  10484. t['a183'] = 0x27B2;
  10485. t['a184'] = 0x27B3;
  10486. t['a197'] = 0x27B4;
  10487. t['a185'] = 0x27B5;
  10488. t['a194'] = 0x27B6;
  10489. t['a198'] = 0x27B7;
  10490. t['a186'] = 0x27B8;
  10491. t['a195'] = 0x27B9;
  10492. t['a187'] = 0x27BA;
  10493. t['a188'] = 0x27BB;
  10494. t['a189'] = 0x27BC;
  10495. t['a190'] = 0x27BD;
  10496. t['a191'] = 0x27BE;
  10497. t['a89'] = 0x2768;
  10498. t['a90'] = 0x2769;
  10499. t['a93'] = 0x276A;
  10500. t['a94'] = 0x276B;
  10501. t['a91'] = 0x276C;
  10502. t['a92'] = 0x276D;
  10503. t['a205'] = 0x276E;
  10504. t['a85'] = 0x276F;
  10505. t['a206'] = 0x2770;
  10506. t['a86'] = 0x2771;
  10507. t['a87'] = 0x2772;
  10508. t['a88'] = 0x2773;
  10509. t['a95'] = 0x2774;
  10510. t['a96'] = 0x2775;
  10511. t['.notdef'] = 0x0000;
  10512. });
  10513. exports.getGlyphsUnicode = getGlyphsUnicode;
  10514. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  10515. /***/ }),
  10516. /* 8 */
  10517. /***/ (function(module, exports, __w_pdfjs_require__) {
  10518. "use strict";
  10519. Object.defineProperty(exports, "__esModule", {
  10520. value: true
  10521. });
  10522. exports.WorkerMessageHandler = exports.WorkerTask = exports.setPDFNetworkStreamClass = undefined;
  10523. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  10524. var _util = __w_pdfjs_require__(0);
  10525. var _pdf_manager = __w_pdfjs_require__(33);
  10526. var _primitives = __w_pdfjs_require__(1);
  10527. var WorkerTask = function WorkerTaskClosure() {
  10528. function WorkerTask(name) {
  10529. this.name = name;
  10530. this.terminated = false;
  10531. this._capability = (0, _util.createPromiseCapability)();
  10532. }
  10533. WorkerTask.prototype = {
  10534. get finished() {
  10535. return this._capability.promise;
  10536. },
  10537. finish: function finish() {
  10538. this._capability.resolve();
  10539. },
  10540. terminate: function terminate() {
  10541. this.terminated = true;
  10542. },
  10543. ensureNotTerminated: function ensureNotTerminated() {
  10544. if (this.terminated) {
  10545. throw new Error('Worker task was terminated');
  10546. }
  10547. }
  10548. };
  10549. return WorkerTask;
  10550. }();
  10551. ;
  10552. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  10553. function PDFWorkerStream(params, msgHandler) {
  10554. this._queuedChunks = [];
  10555. var initialData = params.initialData;
  10556. if (initialData && initialData.length > 0) {
  10557. this._queuedChunks.push(initialData);
  10558. }
  10559. this._msgHandler = msgHandler;
  10560. this._isRangeSupported = !params.disableRange;
  10561. this._isStreamingSupported = !params.disableStream;
  10562. this._contentLength = params.length;
  10563. this._fullRequestReader = null;
  10564. this._rangeReaders = [];
  10565. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  10566. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  10567. }
  10568. PDFWorkerStream.prototype = {
  10569. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  10570. if (args.begin === undefined) {
  10571. if (this._fullRequestReader) {
  10572. this._fullRequestReader._enqueue(args.chunk);
  10573. } else {
  10574. this._queuedChunks.push(args.chunk);
  10575. }
  10576. } else {
  10577. var found = this._rangeReaders.some(function (rangeReader) {
  10578. if (rangeReader._begin !== args.begin) {
  10579. return false;
  10580. }
  10581. rangeReader._enqueue(args.chunk);
  10582. return true;
  10583. });
  10584. (0, _util.assert)(found);
  10585. }
  10586. },
  10587. _onProgress: function PDFWorkerStream_onProgress(evt) {
  10588. if (this._rangeReaders.length > 0) {
  10589. var firstReader = this._rangeReaders[0];
  10590. if (firstReader.onProgress) {
  10591. firstReader.onProgress({ loaded: evt.loaded });
  10592. }
  10593. }
  10594. },
  10595. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  10596. var i = this._rangeReaders.indexOf(reader);
  10597. if (i >= 0) {
  10598. this._rangeReaders.splice(i, 1);
  10599. }
  10600. },
  10601. getFullReader: function PDFWorkerStream_getFullReader() {
  10602. (0, _util.assert)(!this._fullRequestReader);
  10603. var queuedChunks = this._queuedChunks;
  10604. this._queuedChunks = null;
  10605. return new PDFWorkerStreamReader(this, queuedChunks);
  10606. },
  10607. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  10608. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  10609. this._msgHandler.send('RequestDataRange', {
  10610. begin: begin,
  10611. end: end
  10612. });
  10613. this._rangeReaders.push(reader);
  10614. return reader;
  10615. },
  10616. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  10617. if (this._fullRequestReader) {
  10618. this._fullRequestReader.cancel(reason);
  10619. }
  10620. var readers = this._rangeReaders.slice(0);
  10621. readers.forEach(function (rangeReader) {
  10622. rangeReader.cancel(reason);
  10623. });
  10624. }
  10625. };
  10626. function PDFWorkerStreamReader(stream, queuedChunks) {
  10627. this._stream = stream;
  10628. this._done = false;
  10629. this._queuedChunks = queuedChunks || [];
  10630. this._requests = [];
  10631. this._headersReady = Promise.resolve();
  10632. stream._fullRequestReader = this;
  10633. this.onProgress = null;
  10634. }
  10635. PDFWorkerStreamReader.prototype = {
  10636. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  10637. if (this._done) {
  10638. return;
  10639. }
  10640. if (this._requests.length > 0) {
  10641. var requestCapability = this._requests.shift();
  10642. requestCapability.resolve({
  10643. value: chunk,
  10644. done: false
  10645. });
  10646. return;
  10647. }
  10648. this._queuedChunks.push(chunk);
  10649. },
  10650. get headersReady() {
  10651. return this._headersReady;
  10652. },
  10653. get isRangeSupported() {
  10654. return this._stream._isRangeSupported;
  10655. },
  10656. get isStreamingSupported() {
  10657. return this._stream._isStreamingSupported;
  10658. },
  10659. get contentLength() {
  10660. return this._stream._contentLength;
  10661. },
  10662. read: function PDFWorkerStreamReader_read() {
  10663. if (this._queuedChunks.length > 0) {
  10664. var chunk = this._queuedChunks.shift();
  10665. return Promise.resolve({
  10666. value: chunk,
  10667. done: false
  10668. });
  10669. }
  10670. if (this._done) {
  10671. return Promise.resolve({
  10672. value: undefined,
  10673. done: true
  10674. });
  10675. }
  10676. var requestCapability = (0, _util.createPromiseCapability)();
  10677. this._requests.push(requestCapability);
  10678. return requestCapability.promise;
  10679. },
  10680. cancel: function PDFWorkerStreamReader_cancel(reason) {
  10681. this._done = true;
  10682. this._requests.forEach(function (requestCapability) {
  10683. requestCapability.resolve({
  10684. value: undefined,
  10685. done: true
  10686. });
  10687. });
  10688. this._requests = [];
  10689. }
  10690. };
  10691. function PDFWorkerStreamRangeReader(stream, begin, end) {
  10692. this._stream = stream;
  10693. this._begin = begin;
  10694. this._end = end;
  10695. this._queuedChunk = null;
  10696. this._requests = [];
  10697. this._done = false;
  10698. this.onProgress = null;
  10699. }
  10700. PDFWorkerStreamRangeReader.prototype = {
  10701. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  10702. if (this._done) {
  10703. return;
  10704. }
  10705. if (this._requests.length === 0) {
  10706. this._queuedChunk = chunk;
  10707. } else {
  10708. var requestsCapability = this._requests.shift();
  10709. requestsCapability.resolve({
  10710. value: chunk,
  10711. done: false
  10712. });
  10713. this._requests.forEach(function (requestCapability) {
  10714. requestCapability.resolve({
  10715. value: undefined,
  10716. done: true
  10717. });
  10718. });
  10719. this._requests = [];
  10720. }
  10721. this._done = true;
  10722. this._stream._removeRangeReader(this);
  10723. },
  10724. get isStreamingSupported() {
  10725. return false;
  10726. },
  10727. read: function PDFWorkerStreamRangeReader_read() {
  10728. if (this._queuedChunk) {
  10729. return Promise.resolve({
  10730. value: this._queuedChunk,
  10731. done: false
  10732. });
  10733. }
  10734. if (this._done) {
  10735. return Promise.resolve({
  10736. value: undefined,
  10737. done: true
  10738. });
  10739. }
  10740. var requestCapability = (0, _util.createPromiseCapability)();
  10741. this._requests.push(requestCapability);
  10742. return requestCapability.promise;
  10743. },
  10744. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  10745. this._done = true;
  10746. this._requests.forEach(function (requestCapability) {
  10747. requestCapability.resolve({
  10748. value: undefined,
  10749. done: true
  10750. });
  10751. });
  10752. this._requests = [];
  10753. this._stream._removeRangeReader(this);
  10754. }
  10755. };
  10756. return PDFWorkerStream;
  10757. }();
  10758. var PDFNetworkStream;
  10759. function setPDFNetworkStreamClass(cls) {
  10760. PDFNetworkStream = cls;
  10761. }
  10762. var WorkerMessageHandler = {
  10763. setup: function setup(handler, port) {
  10764. var testMessageProcessed = false;
  10765. handler.on('test', function wphSetupTest(data) {
  10766. if (testMessageProcessed) {
  10767. return;
  10768. }
  10769. testMessageProcessed = true;
  10770. if (!(data instanceof Uint8Array)) {
  10771. handler.send('test', 'main', false);
  10772. return;
  10773. }
  10774. var supportTransfers = data[0] === 255;
  10775. handler.postMessageTransfers = supportTransfers;
  10776. var xhr = new XMLHttpRequest();
  10777. var responseExists = 'response' in xhr;
  10778. try {
  10779. xhr.responseType;
  10780. } catch (e) {
  10781. responseExists = false;
  10782. }
  10783. if (!responseExists) {
  10784. handler.send('test', false);
  10785. return;
  10786. }
  10787. handler.send('test', {
  10788. supportTypedArray: true,
  10789. supportTransfers: supportTransfers
  10790. });
  10791. });
  10792. handler.on('configure', function wphConfigure(data) {
  10793. (0, _util.setVerbosityLevel)(data.verbosity);
  10794. });
  10795. handler.on('GetDocRequest', function wphSetupDoc(data) {
  10796. return WorkerMessageHandler.createDocumentHandler(data, port);
  10797. });
  10798. },
  10799. createDocumentHandler: function createDocumentHandler(docParams, port) {
  10800. var pdfManager;
  10801. var terminated = false;
  10802. var cancelXHRs = null;
  10803. var WorkerTasks = [];
  10804. var docId = docParams.docId;
  10805. var docBaseUrl = docParams.docBaseUrl;
  10806. var workerHandlerName = docParams.docId + '_worker';
  10807. var handler = new _util.MessageHandler(workerHandlerName, docId, port);
  10808. handler.postMessageTransfers = docParams.postMessageTransfers;
  10809. function ensureNotTerminated() {
  10810. if (terminated) {
  10811. throw new Error('Worker was terminated');
  10812. }
  10813. }
  10814. function startWorkerTask(task) {
  10815. WorkerTasks.push(task);
  10816. }
  10817. function finishWorkerTask(task) {
  10818. task.finish();
  10819. var i = WorkerTasks.indexOf(task);
  10820. WorkerTasks.splice(i, 1);
  10821. }
  10822. function loadDocument(recoveryMode) {
  10823. var loadDocumentCapability = (0, _util.createPromiseCapability)();
  10824. var parseSuccess = function parseSuccess() {
  10825. var numPagesPromise = pdfManager.ensureDoc('numPages');
  10826. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  10827. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  10828. Promise.all([numPagesPromise, fingerprintPromise, encryptedPromise]).then(function onDocReady(results) {
  10829. var doc = {
  10830. numPages: results[0],
  10831. fingerprint: results[1],
  10832. encrypted: !!results[2]
  10833. };
  10834. loadDocumentCapability.resolve(doc);
  10835. }, parseFailure);
  10836. };
  10837. var parseFailure = function parseFailure(e) {
  10838. loadDocumentCapability.reject(e);
  10839. };
  10840. pdfManager.ensureDoc('checkHeader', []).then(function () {
  10841. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  10842. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  10843. }, parseFailure);
  10844. }, parseFailure);
  10845. return loadDocumentCapability.promise;
  10846. }
  10847. function getPdfManager(data, evaluatorOptions) {
  10848. var pdfManagerCapability = (0, _util.createPromiseCapability)();
  10849. var pdfManager;
  10850. var source = data.source;
  10851. if (source.data) {
  10852. try {
  10853. pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  10854. pdfManagerCapability.resolve(pdfManager);
  10855. } catch (ex) {
  10856. pdfManagerCapability.reject(ex);
  10857. }
  10858. return pdfManagerCapability.promise;
  10859. }
  10860. var pdfStream;
  10861. try {
  10862. if (source.chunkedViewerLoading) {
  10863. pdfStream = new PDFWorkerStream(source, handler);
  10864. } else {
  10865. (0, _util.assert)(PDFNetworkStream, './network module is not loaded');
  10866. pdfStream = new PDFNetworkStream(data);
  10867. }
  10868. } catch (ex) {
  10869. pdfManagerCapability.reject(ex);
  10870. return pdfManagerCapability.promise;
  10871. }
  10872. var fullRequest = pdfStream.getFullReader();
  10873. fullRequest.headersReady.then(function () {
  10874. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  10875. fullRequest.onProgress = function (evt) {
  10876. handler.send('DocProgress', {
  10877. loaded: evt.loaded,
  10878. total: evt.total
  10879. });
  10880. };
  10881. }
  10882. if (!fullRequest.isRangeSupported) {
  10883. return;
  10884. }
  10885. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  10886. pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  10887. msgHandler: handler,
  10888. url: source.url,
  10889. password: source.password,
  10890. length: fullRequest.contentLength,
  10891. disableAutoFetch: disableAutoFetch,
  10892. rangeChunkSize: source.rangeChunkSize
  10893. }, evaluatorOptions, docBaseUrl);
  10894. pdfManagerCapability.resolve(pdfManager);
  10895. cancelXHRs = null;
  10896. }).catch(function (reason) {
  10897. pdfManagerCapability.reject(reason);
  10898. cancelXHRs = null;
  10899. });
  10900. var cachedChunks = [],
  10901. loaded = 0;
  10902. var flushChunks = function flushChunks() {
  10903. var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  10904. if (source.length && pdfFile.length !== source.length) {
  10905. (0, _util.warn)('reported HTTP length is different from actual');
  10906. }
  10907. try {
  10908. pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  10909. pdfManagerCapability.resolve(pdfManager);
  10910. } catch (ex) {
  10911. pdfManagerCapability.reject(ex);
  10912. }
  10913. cachedChunks = [];
  10914. };
  10915. var readPromise = new Promise(function (resolve, reject) {
  10916. var readChunk = function readChunk(chunk) {
  10917. try {
  10918. ensureNotTerminated();
  10919. if (chunk.done) {
  10920. if (!pdfManager) {
  10921. flushChunks();
  10922. }
  10923. cancelXHRs = null;
  10924. return;
  10925. }
  10926. var data = chunk.value;
  10927. loaded += (0, _util.arrayByteLength)(data);
  10928. if (!fullRequest.isStreamingSupported) {
  10929. handler.send('DocProgress', {
  10930. loaded: loaded,
  10931. total: Math.max(loaded, fullRequest.contentLength || 0)
  10932. });
  10933. }
  10934. if (pdfManager) {
  10935. pdfManager.sendProgressiveData(data);
  10936. } else {
  10937. cachedChunks.push(data);
  10938. }
  10939. fullRequest.read().then(readChunk, reject);
  10940. } catch (e) {
  10941. reject(e);
  10942. }
  10943. };
  10944. fullRequest.read().then(readChunk, reject);
  10945. });
  10946. readPromise.catch(function (e) {
  10947. pdfManagerCapability.reject(e);
  10948. cancelXHRs = null;
  10949. });
  10950. cancelXHRs = function cancelXHRs() {
  10951. pdfStream.cancelAllRequests('abort');
  10952. };
  10953. return pdfManagerCapability.promise;
  10954. }
  10955. function setupDoc(data) {
  10956. function onSuccess(doc) {
  10957. ensureNotTerminated();
  10958. handler.send('GetDoc', { pdfInfo: doc });
  10959. }
  10960. function onFailure(e) {
  10961. if (e instanceof _util.PasswordException) {
  10962. var task = new WorkerTask('PasswordException: response ' + e.code);
  10963. startWorkerTask(task);
  10964. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  10965. finishWorkerTask(task);
  10966. pdfManager.updatePassword(data.password);
  10967. pdfManagerReady();
  10968. }).catch(function (ex) {
  10969. finishWorkerTask(task);
  10970. handler.send('PasswordException', ex);
  10971. }.bind(null, e));
  10972. } else if (e instanceof _util.InvalidPDFException) {
  10973. handler.send('InvalidPDF', e);
  10974. } else if (e instanceof _util.MissingPDFException) {
  10975. handler.send('MissingPDF', e);
  10976. } else if (e instanceof _util.UnexpectedResponseException) {
  10977. handler.send('UnexpectedResponse', e);
  10978. } else {
  10979. handler.send('UnknownError', new _util.UnknownErrorException(e.message, e.toString()));
  10980. }
  10981. }
  10982. function pdfManagerReady() {
  10983. ensureNotTerminated();
  10984. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  10985. ensureNotTerminated();
  10986. if (!(ex instanceof _util.XRefParseException)) {
  10987. onFailure(ex);
  10988. return;
  10989. }
  10990. pdfManager.requestLoadedStream();
  10991. pdfManager.onLoadedStream().then(function () {
  10992. ensureNotTerminated();
  10993. loadDocument(true).then(onSuccess, onFailure);
  10994. });
  10995. }, onFailure);
  10996. }
  10997. ensureNotTerminated();
  10998. var evaluatorOptions = {
  10999. forceDataSchema: data.disableCreateObjectURL,
  11000. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  11001. disableFontFace: data.disableFontFace,
  11002. nativeImageDecoderSupport: data.nativeImageDecoderSupport,
  11003. ignoreErrors: data.ignoreErrors
  11004. };
  11005. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  11006. if (terminated) {
  11007. newPdfManager.terminate();
  11008. throw new Error('Worker was terminated');
  11009. }
  11010. pdfManager = newPdfManager;
  11011. handler.send('PDFManagerReady', null);
  11012. pdfManager.onLoadedStream().then(function (stream) {
  11013. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  11014. });
  11015. }).then(pdfManagerReady, onFailure);
  11016. }
  11017. handler.on('GetPage', function wphSetupGetPage(data) {
  11018. return pdfManager.getPage(data.pageIndex).then(function (page) {
  11019. var rotatePromise = pdfManager.ensure(page, 'rotate');
  11020. var refPromise = pdfManager.ensure(page, 'ref');
  11021. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  11022. var viewPromise = pdfManager.ensure(page, 'view');
  11023. return Promise.all([rotatePromise, refPromise, userUnitPromise, viewPromise]).then(function (results) {
  11024. return {
  11025. rotate: results[0],
  11026. ref: results[1],
  11027. userUnit: results[2],
  11028. view: results[3]
  11029. };
  11030. });
  11031. });
  11032. });
  11033. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  11034. var ref = new _primitives.Ref(data.ref.num, data.ref.gen);
  11035. var catalog = pdfManager.pdfDocument.catalog;
  11036. return catalog.getPageIndex(ref);
  11037. });
  11038. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  11039. return pdfManager.ensureCatalog('destinations');
  11040. });
  11041. handler.on('GetDestination', function wphSetupGetDestination(data) {
  11042. return pdfManager.ensureCatalog('getDestination', [data.id]);
  11043. });
  11044. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  11045. return pdfManager.ensureCatalog('pageLabels');
  11046. });
  11047. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  11048. return pdfManager.ensureCatalog('attachments');
  11049. });
  11050. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  11051. return pdfManager.ensureCatalog('javaScript');
  11052. });
  11053. handler.on('GetOutline', function wphSetupGetOutline(data) {
  11054. return pdfManager.ensureCatalog('documentOutline');
  11055. });
  11056. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  11057. return Promise.all([pdfManager.ensureDoc('documentInfo'), pdfManager.ensureCatalog('metadata')]);
  11058. });
  11059. handler.on('GetData', function wphSetupGetData(data) {
  11060. pdfManager.requestLoadedStream();
  11061. return pdfManager.onLoadedStream().then(function (stream) {
  11062. return stream.bytes;
  11063. });
  11064. });
  11065. handler.on('GetStats', function wphSetupGetStats(data) {
  11066. return pdfManager.pdfDocument.xref.stats;
  11067. });
  11068. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  11069. return pdfManager.getPage(data.pageIndex).then(function (page) {
  11070. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  11071. });
  11072. });
  11073. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  11074. var pageIndex = data.pageIndex;
  11075. pdfManager.getPage(pageIndex).then(function (page) {
  11076. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  11077. startWorkerTask(task);
  11078. var pageNum = pageIndex + 1;
  11079. var start = Date.now();
  11080. page.getOperatorList({
  11081. handler: handler,
  11082. task: task,
  11083. intent: data.intent,
  11084. renderInteractiveForms: data.renderInteractiveForms
  11085. }).then(function (operatorList) {
  11086. finishWorkerTask(task);
  11087. (0, _util.info)('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  11088. }, function (e) {
  11089. finishWorkerTask(task);
  11090. if (task.terminated) {
  11091. return;
  11092. }
  11093. handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
  11094. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  11095. var wrappedException;
  11096. if (typeof e === 'string') {
  11097. wrappedException = {
  11098. message: e,
  11099. stack: minimumStackMessage
  11100. };
  11101. } else if ((typeof e === 'undefined' ? 'undefined' : _typeof(e)) === 'object') {
  11102. wrappedException = {
  11103. message: e.message || e.toString(),
  11104. stack: e.stack || minimumStackMessage
  11105. };
  11106. } else {
  11107. wrappedException = {
  11108. message: 'Unknown exception type: ' + (typeof e === 'undefined' ? 'undefined' : _typeof(e)),
  11109. stack: minimumStackMessage
  11110. };
  11111. }
  11112. handler.send('PageError', {
  11113. pageNum: pageNum,
  11114. error: wrappedException,
  11115. intent: data.intent
  11116. });
  11117. });
  11118. });
  11119. }, this);
  11120. handler.on('GetTextContent', function wphExtractText(data) {
  11121. var pageIndex = data.pageIndex;
  11122. return pdfManager.getPage(pageIndex).then(function (page) {
  11123. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  11124. startWorkerTask(task);
  11125. var pageNum = pageIndex + 1;
  11126. var start = Date.now();
  11127. return page.extractTextContent({
  11128. handler: handler,
  11129. task: task,
  11130. normalizeWhitespace: data.normalizeWhitespace,
  11131. combineTextItems: data.combineTextItems
  11132. }).then(function (textContent) {
  11133. finishWorkerTask(task);
  11134. (0, _util.info)('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  11135. return textContent;
  11136. }, function (reason) {
  11137. finishWorkerTask(task);
  11138. if (task.terminated) {
  11139. return;
  11140. }
  11141. throw reason;
  11142. });
  11143. });
  11144. });
  11145. handler.on('Cleanup', function wphCleanup(data) {
  11146. return pdfManager.cleanup();
  11147. });
  11148. handler.on('Terminate', function wphTerminate(data) {
  11149. terminated = true;
  11150. if (pdfManager) {
  11151. pdfManager.terminate();
  11152. pdfManager = null;
  11153. }
  11154. if (cancelXHRs) {
  11155. cancelXHRs();
  11156. }
  11157. var waitOn = [];
  11158. WorkerTasks.forEach(function (task) {
  11159. waitOn.push(task.finished);
  11160. task.terminate();
  11161. });
  11162. return Promise.all(waitOn).then(function () {
  11163. handler.destroy();
  11164. handler = null;
  11165. });
  11166. });
  11167. handler.on('Ready', function wphReady(data) {
  11168. setupDoc(docParams);
  11169. docParams = null;
  11170. });
  11171. return workerHandlerName;
  11172. },
  11173. initializeFromPort: function initializeFromPort(port) {
  11174. var handler = new _util.MessageHandler('worker', 'main', port);
  11175. WorkerMessageHandler.setup(handler, port);
  11176. handler.send('ready', null);
  11177. }
  11178. };
  11179. function isMessagePort(maybePort) {
  11180. return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort;
  11181. }
  11182. if (typeof window === 'undefined' && !(0, _util.isNodeJS)() && typeof self !== 'undefined' && isMessagePort(self)) {
  11183. WorkerMessageHandler.initializeFromPort(self);
  11184. }
  11185. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  11186. exports.WorkerTask = WorkerTask;
  11187. exports.WorkerMessageHandler = WorkerMessageHandler;
  11188. /***/ }),
  11189. /* 9 */
  11190. /***/ (function(module, exports, __w_pdfjs_require__) {
  11191. "use strict";
  11192. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  11193. var g;
  11194. g = function () {
  11195. return this;
  11196. }();
  11197. try {
  11198. g = g || Function("return this")() || (1, eval)("this");
  11199. } catch (e) {
  11200. if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
  11201. }
  11202. module.exports = g;
  11203. /***/ }),
  11204. /* 10 */
  11205. /***/ (function(module, exports, __w_pdfjs_require__) {
  11206. "use strict";
  11207. Object.defineProperty(exports, "__esModule", {
  11208. value: true
  11209. });
  11210. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  11211. var QeTable = [{
  11212. qe: 0x5601,
  11213. nmps: 1,
  11214. nlps: 1,
  11215. switchFlag: 1
  11216. }, {
  11217. qe: 0x3401,
  11218. nmps: 2,
  11219. nlps: 6,
  11220. switchFlag: 0
  11221. }, {
  11222. qe: 0x1801,
  11223. nmps: 3,
  11224. nlps: 9,
  11225. switchFlag: 0
  11226. }, {
  11227. qe: 0x0AC1,
  11228. nmps: 4,
  11229. nlps: 12,
  11230. switchFlag: 0
  11231. }, {
  11232. qe: 0x0521,
  11233. nmps: 5,
  11234. nlps: 29,
  11235. switchFlag: 0
  11236. }, {
  11237. qe: 0x0221,
  11238. nmps: 38,
  11239. nlps: 33,
  11240. switchFlag: 0
  11241. }, {
  11242. qe: 0x5601,
  11243. nmps: 7,
  11244. nlps: 6,
  11245. switchFlag: 1
  11246. }, {
  11247. qe: 0x5401,
  11248. nmps: 8,
  11249. nlps: 14,
  11250. switchFlag: 0
  11251. }, {
  11252. qe: 0x4801,
  11253. nmps: 9,
  11254. nlps: 14,
  11255. switchFlag: 0
  11256. }, {
  11257. qe: 0x3801,
  11258. nmps: 10,
  11259. nlps: 14,
  11260. switchFlag: 0
  11261. }, {
  11262. qe: 0x3001,
  11263. nmps: 11,
  11264. nlps: 17,
  11265. switchFlag: 0
  11266. }, {
  11267. qe: 0x2401,
  11268. nmps: 12,
  11269. nlps: 18,
  11270. switchFlag: 0
  11271. }, {
  11272. qe: 0x1C01,
  11273. nmps: 13,
  11274. nlps: 20,
  11275. switchFlag: 0
  11276. }, {
  11277. qe: 0x1601,
  11278. nmps: 29,
  11279. nlps: 21,
  11280. switchFlag: 0
  11281. }, {
  11282. qe: 0x5601,
  11283. nmps: 15,
  11284. nlps: 14,
  11285. switchFlag: 1
  11286. }, {
  11287. qe: 0x5401,
  11288. nmps: 16,
  11289. nlps: 14,
  11290. switchFlag: 0
  11291. }, {
  11292. qe: 0x5101,
  11293. nmps: 17,
  11294. nlps: 15,
  11295. switchFlag: 0
  11296. }, {
  11297. qe: 0x4801,
  11298. nmps: 18,
  11299. nlps: 16,
  11300. switchFlag: 0
  11301. }, {
  11302. qe: 0x3801,
  11303. nmps: 19,
  11304. nlps: 17,
  11305. switchFlag: 0
  11306. }, {
  11307. qe: 0x3401,
  11308. nmps: 20,
  11309. nlps: 18,
  11310. switchFlag: 0
  11311. }, {
  11312. qe: 0x3001,
  11313. nmps: 21,
  11314. nlps: 19,
  11315. switchFlag: 0
  11316. }, {
  11317. qe: 0x2801,
  11318. nmps: 22,
  11319. nlps: 19,
  11320. switchFlag: 0
  11321. }, {
  11322. qe: 0x2401,
  11323. nmps: 23,
  11324. nlps: 20,
  11325. switchFlag: 0
  11326. }, {
  11327. qe: 0x2201,
  11328. nmps: 24,
  11329. nlps: 21,
  11330. switchFlag: 0
  11331. }, {
  11332. qe: 0x1C01,
  11333. nmps: 25,
  11334. nlps: 22,
  11335. switchFlag: 0
  11336. }, {
  11337. qe: 0x1801,
  11338. nmps: 26,
  11339. nlps: 23,
  11340. switchFlag: 0
  11341. }, {
  11342. qe: 0x1601,
  11343. nmps: 27,
  11344. nlps: 24,
  11345. switchFlag: 0
  11346. }, {
  11347. qe: 0x1401,
  11348. nmps: 28,
  11349. nlps: 25,
  11350. switchFlag: 0
  11351. }, {
  11352. qe: 0x1201,
  11353. nmps: 29,
  11354. nlps: 26,
  11355. switchFlag: 0
  11356. }, {
  11357. qe: 0x1101,
  11358. nmps: 30,
  11359. nlps: 27,
  11360. switchFlag: 0
  11361. }, {
  11362. qe: 0x0AC1,
  11363. nmps: 31,
  11364. nlps: 28,
  11365. switchFlag: 0
  11366. }, {
  11367. qe: 0x09C1,
  11368. nmps: 32,
  11369. nlps: 29,
  11370. switchFlag: 0
  11371. }, {
  11372. qe: 0x08A1,
  11373. nmps: 33,
  11374. nlps: 30,
  11375. switchFlag: 0
  11376. }, {
  11377. qe: 0x0521,
  11378. nmps: 34,
  11379. nlps: 31,
  11380. switchFlag: 0
  11381. }, {
  11382. qe: 0x0441,
  11383. nmps: 35,
  11384. nlps: 32,
  11385. switchFlag: 0
  11386. }, {
  11387. qe: 0x02A1,
  11388. nmps: 36,
  11389. nlps: 33,
  11390. switchFlag: 0
  11391. }, {
  11392. qe: 0x0221,
  11393. nmps: 37,
  11394. nlps: 34,
  11395. switchFlag: 0
  11396. }, {
  11397. qe: 0x0141,
  11398. nmps: 38,
  11399. nlps: 35,
  11400. switchFlag: 0
  11401. }, {
  11402. qe: 0x0111,
  11403. nmps: 39,
  11404. nlps: 36,
  11405. switchFlag: 0
  11406. }, {
  11407. qe: 0x0085,
  11408. nmps: 40,
  11409. nlps: 37,
  11410. switchFlag: 0
  11411. }, {
  11412. qe: 0x0049,
  11413. nmps: 41,
  11414. nlps: 38,
  11415. switchFlag: 0
  11416. }, {
  11417. qe: 0x0025,
  11418. nmps: 42,
  11419. nlps: 39,
  11420. switchFlag: 0
  11421. }, {
  11422. qe: 0x0015,
  11423. nmps: 43,
  11424. nlps: 40,
  11425. switchFlag: 0
  11426. }, {
  11427. qe: 0x0009,
  11428. nmps: 44,
  11429. nlps: 41,
  11430. switchFlag: 0
  11431. }, {
  11432. qe: 0x0005,
  11433. nmps: 45,
  11434. nlps: 42,
  11435. switchFlag: 0
  11436. }, {
  11437. qe: 0x0001,
  11438. nmps: 45,
  11439. nlps: 43,
  11440. switchFlag: 0
  11441. }, {
  11442. qe: 0x5601,
  11443. nmps: 46,
  11444. nlps: 46,
  11445. switchFlag: 0
  11446. }];
  11447. function ArithmeticDecoder(data, start, end) {
  11448. this.data = data;
  11449. this.bp = start;
  11450. this.dataEnd = end;
  11451. this.chigh = data[start];
  11452. this.clow = 0;
  11453. this.byteIn();
  11454. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  11455. this.clow = this.clow << 7 & 0xFFFF;
  11456. this.ct -= 7;
  11457. this.a = 0x8000;
  11458. }
  11459. ArithmeticDecoder.prototype = {
  11460. byteIn: function ArithmeticDecoder_byteIn() {
  11461. var data = this.data;
  11462. var bp = this.bp;
  11463. if (data[bp] === 0xFF) {
  11464. var b1 = data[bp + 1];
  11465. if (b1 > 0x8F) {
  11466. this.clow += 0xFF00;
  11467. this.ct = 8;
  11468. } else {
  11469. bp++;
  11470. this.clow += data[bp] << 9;
  11471. this.ct = 7;
  11472. this.bp = bp;
  11473. }
  11474. } else {
  11475. bp++;
  11476. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  11477. this.ct = 8;
  11478. this.bp = bp;
  11479. }
  11480. if (this.clow > 0xFFFF) {
  11481. this.chigh += this.clow >> 16;
  11482. this.clow &= 0xFFFF;
  11483. }
  11484. },
  11485. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  11486. var cx_index = contexts[pos] >> 1,
  11487. cx_mps = contexts[pos] & 1;
  11488. var qeTableIcx = QeTable[cx_index];
  11489. var qeIcx = qeTableIcx.qe;
  11490. var d;
  11491. var a = this.a - qeIcx;
  11492. if (this.chigh < qeIcx) {
  11493. if (a < qeIcx) {
  11494. a = qeIcx;
  11495. d = cx_mps;
  11496. cx_index = qeTableIcx.nmps;
  11497. } else {
  11498. a = qeIcx;
  11499. d = 1 ^ cx_mps;
  11500. if (qeTableIcx.switchFlag === 1) {
  11501. cx_mps = d;
  11502. }
  11503. cx_index = qeTableIcx.nlps;
  11504. }
  11505. } else {
  11506. this.chigh -= qeIcx;
  11507. if ((a & 0x8000) !== 0) {
  11508. this.a = a;
  11509. return cx_mps;
  11510. }
  11511. if (a < qeIcx) {
  11512. d = 1 ^ cx_mps;
  11513. if (qeTableIcx.switchFlag === 1) {
  11514. cx_mps = d;
  11515. }
  11516. cx_index = qeTableIcx.nlps;
  11517. } else {
  11518. d = cx_mps;
  11519. cx_index = qeTableIcx.nmps;
  11520. }
  11521. }
  11522. do {
  11523. if (this.ct === 0) {
  11524. this.byteIn();
  11525. }
  11526. a <<= 1;
  11527. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  11528. this.clow = this.clow << 1 & 0xFFFF;
  11529. this.ct--;
  11530. } while ((a & 0x8000) === 0);
  11531. this.a = a;
  11532. contexts[pos] = cx_index << 1 | cx_mps;
  11533. return d;
  11534. }
  11535. };
  11536. return ArithmeticDecoder;
  11537. }();
  11538. exports.ArithmeticDecoder = ArithmeticDecoder;
  11539. /***/ }),
  11540. /* 11 */
  11541. /***/ (function(module, exports, __w_pdfjs_require__) {
  11542. "use strict";
  11543. Object.defineProperty(exports, "__esModule", {
  11544. value: true
  11545. });
  11546. exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = undefined;
  11547. var _util = __w_pdfjs_require__(0);
  11548. var _charsets = __w_pdfjs_require__(22);
  11549. var _encodings = __w_pdfjs_require__(4);
  11550. var MAX_SUBR_NESTING = 10;
  11551. 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'];
  11552. var CFFParser = function CFFParserClosure() {
  11553. var CharstringValidationData = [null, {
  11554. id: 'hstem',
  11555. min: 2,
  11556. stackClearing: true,
  11557. stem: true
  11558. }, null, {
  11559. id: 'vstem',
  11560. min: 2,
  11561. stackClearing: true,
  11562. stem: true
  11563. }, {
  11564. id: 'vmoveto',
  11565. min: 1,
  11566. stackClearing: true
  11567. }, {
  11568. id: 'rlineto',
  11569. min: 2,
  11570. resetStack: true
  11571. }, {
  11572. id: 'hlineto',
  11573. min: 1,
  11574. resetStack: true
  11575. }, {
  11576. id: 'vlineto',
  11577. min: 1,
  11578. resetStack: true
  11579. }, {
  11580. id: 'rrcurveto',
  11581. min: 6,
  11582. resetStack: true
  11583. }, null, {
  11584. id: 'callsubr',
  11585. min: 1,
  11586. undefStack: true
  11587. }, {
  11588. id: 'return',
  11589. min: 0,
  11590. undefStack: true
  11591. }, null, null, {
  11592. id: 'endchar',
  11593. min: 0,
  11594. stackClearing: true
  11595. }, null, null, null, {
  11596. id: 'hstemhm',
  11597. min: 2,
  11598. stackClearing: true,
  11599. stem: true
  11600. }, {
  11601. id: 'hintmask',
  11602. min: 0,
  11603. stackClearing: true
  11604. }, {
  11605. id: 'cntrmask',
  11606. min: 0,
  11607. stackClearing: true
  11608. }, {
  11609. id: 'rmoveto',
  11610. min: 2,
  11611. stackClearing: true
  11612. }, {
  11613. id: 'hmoveto',
  11614. min: 1,
  11615. stackClearing: true
  11616. }, {
  11617. id: 'vstemhm',
  11618. min: 2,
  11619. stackClearing: true,
  11620. stem: true
  11621. }, {
  11622. id: 'rcurveline',
  11623. min: 8,
  11624. resetStack: true
  11625. }, {
  11626. id: 'rlinecurve',
  11627. min: 8,
  11628. resetStack: true
  11629. }, {
  11630. id: 'vvcurveto',
  11631. min: 4,
  11632. resetStack: true
  11633. }, {
  11634. id: 'hhcurveto',
  11635. min: 4,
  11636. resetStack: true
  11637. }, null, {
  11638. id: 'callgsubr',
  11639. min: 1,
  11640. undefStack: true
  11641. }, {
  11642. id: 'vhcurveto',
  11643. min: 4,
  11644. resetStack: true
  11645. }, {
  11646. id: 'hvcurveto',
  11647. min: 4,
  11648. resetStack: true
  11649. }];
  11650. var CharstringValidationData12 = [null, null, null, {
  11651. id: 'and',
  11652. min: 2,
  11653. stackDelta: -1
  11654. }, {
  11655. id: 'or',
  11656. min: 2,
  11657. stackDelta: -1
  11658. }, {
  11659. id: 'not',
  11660. min: 1,
  11661. stackDelta: 0
  11662. }, null, null, null, {
  11663. id: 'abs',
  11664. min: 1,
  11665. stackDelta: 0
  11666. }, {
  11667. id: 'add',
  11668. min: 2,
  11669. stackDelta: -1,
  11670. stackFn: function stack_div(stack, index) {
  11671. stack[index - 2] = stack[index - 2] + stack[index - 1];
  11672. }
  11673. }, {
  11674. id: 'sub',
  11675. min: 2,
  11676. stackDelta: -1,
  11677. stackFn: function stack_div(stack, index) {
  11678. stack[index - 2] = stack[index - 2] - stack[index - 1];
  11679. }
  11680. }, {
  11681. id: 'div',
  11682. min: 2,
  11683. stackDelta: -1,
  11684. stackFn: function stack_div(stack, index) {
  11685. stack[index - 2] = stack[index - 2] / stack[index - 1];
  11686. }
  11687. }, null, {
  11688. id: 'neg',
  11689. min: 1,
  11690. stackDelta: 0,
  11691. stackFn: function stack_div(stack, index) {
  11692. stack[index - 1] = -stack[index - 1];
  11693. }
  11694. }, {
  11695. id: 'eq',
  11696. min: 2,
  11697. stackDelta: -1
  11698. }, null, null, {
  11699. id: 'drop',
  11700. min: 1,
  11701. stackDelta: -1
  11702. }, null, {
  11703. id: 'put',
  11704. min: 2,
  11705. stackDelta: -2
  11706. }, {
  11707. id: 'get',
  11708. min: 1,
  11709. stackDelta: 0
  11710. }, {
  11711. id: 'ifelse',
  11712. min: 4,
  11713. stackDelta: -3
  11714. }, {
  11715. id: 'random',
  11716. min: 0,
  11717. stackDelta: 1
  11718. }, {
  11719. id: 'mul',
  11720. min: 2,
  11721. stackDelta: -1,
  11722. stackFn: function stack_div(stack, index) {
  11723. stack[index - 2] = stack[index - 2] * stack[index - 1];
  11724. }
  11725. }, null, {
  11726. id: 'sqrt',
  11727. min: 1,
  11728. stackDelta: 0
  11729. }, {
  11730. id: 'dup',
  11731. min: 1,
  11732. stackDelta: 1
  11733. }, {
  11734. id: 'exch',
  11735. min: 2,
  11736. stackDelta: 0
  11737. }, {
  11738. id: 'index',
  11739. min: 2,
  11740. stackDelta: 0
  11741. }, {
  11742. id: 'roll',
  11743. min: 3,
  11744. stackDelta: -2
  11745. }, null, null, null, {
  11746. id: 'hflex',
  11747. min: 7,
  11748. resetStack: true
  11749. }, {
  11750. id: 'flex',
  11751. min: 13,
  11752. resetStack: true
  11753. }, {
  11754. id: 'hflex1',
  11755. min: 9,
  11756. resetStack: true
  11757. }, {
  11758. id: 'flex1',
  11759. min: 11,
  11760. resetStack: true
  11761. }];
  11762. function CFFParser(file, properties, seacAnalysisEnabled) {
  11763. this.bytes = file.getBytes();
  11764. this.properties = properties;
  11765. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  11766. }
  11767. CFFParser.prototype = {
  11768. parse: function CFFParser_parse() {
  11769. var properties = this.properties;
  11770. var cff = new CFF();
  11771. this.cff = cff;
  11772. var header = this.parseHeader();
  11773. var nameIndex = this.parseIndex(header.endPos);
  11774. var topDictIndex = this.parseIndex(nameIndex.endPos);
  11775. var stringIndex = this.parseIndex(topDictIndex.endPos);
  11776. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  11777. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  11778. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  11779. cff.header = header.obj;
  11780. cff.names = this.parseNameIndex(nameIndex.obj);
  11781. cff.strings = this.parseStringIndex(stringIndex.obj);
  11782. cff.topDict = topDict;
  11783. cff.globalSubrIndex = globalSubrIndex.obj;
  11784. this.parsePrivateDict(cff.topDict);
  11785. cff.isCIDFont = topDict.hasName('ROS');
  11786. var charStringOffset = topDict.getByName('CharStrings');
  11787. var charStringIndex = this.parseIndex(charStringOffset).obj;
  11788. var fontMatrix = topDict.getByName('FontMatrix');
  11789. if (fontMatrix) {
  11790. properties.fontMatrix = fontMatrix;
  11791. }
  11792. var fontBBox = topDict.getByName('FontBBox');
  11793. if (fontBBox) {
  11794. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  11795. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  11796. properties.ascentScaled = true;
  11797. }
  11798. var charset, encoding;
  11799. if (cff.isCIDFont) {
  11800. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  11801. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  11802. var dictRaw = fdArrayIndex.get(i);
  11803. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  11804. this.parsePrivateDict(fontDict);
  11805. cff.fdArray.push(fontDict);
  11806. }
  11807. encoding = null;
  11808. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  11809. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  11810. } else {
  11811. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  11812. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  11813. }
  11814. cff.charset = charset;
  11815. cff.encoding = encoding;
  11816. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  11817. cff.charStrings = charStringsAndSeacs.charStrings;
  11818. cff.seacs = charStringsAndSeacs.seacs;
  11819. cff.widths = charStringsAndSeacs.widths;
  11820. return cff;
  11821. },
  11822. parseHeader: function CFFParser_parseHeader() {
  11823. var bytes = this.bytes;
  11824. var bytesLength = bytes.length;
  11825. var offset = 0;
  11826. while (offset < bytesLength && bytes[offset] !== 1) {
  11827. ++offset;
  11828. }
  11829. if (offset >= bytesLength) {
  11830. (0, _util.error)('Invalid CFF header');
  11831. } else if (offset !== 0) {
  11832. (0, _util.info)('cff data is shifted');
  11833. bytes = bytes.subarray(offset);
  11834. this.bytes = bytes;
  11835. }
  11836. var major = bytes[0];
  11837. var minor = bytes[1];
  11838. var hdrSize = bytes[2];
  11839. var offSize = bytes[3];
  11840. var header = new CFFHeader(major, minor, hdrSize, offSize);
  11841. return {
  11842. obj: header,
  11843. endPos: hdrSize
  11844. };
  11845. },
  11846. parseDict: function CFFParser_parseDict(dict) {
  11847. var pos = 0;
  11848. function parseOperand() {
  11849. var value = dict[pos++];
  11850. if (value === 30) {
  11851. return parseFloatOperand();
  11852. } else if (value === 28) {
  11853. value = dict[pos++];
  11854. value = (value << 24 | dict[pos++] << 16) >> 16;
  11855. return value;
  11856. } else if (value === 29) {
  11857. value = dict[pos++];
  11858. value = value << 8 | dict[pos++];
  11859. value = value << 8 | dict[pos++];
  11860. value = value << 8 | dict[pos++];
  11861. return value;
  11862. } else if (value >= 32 && value <= 246) {
  11863. return value - 139;
  11864. } else if (value >= 247 && value <= 250) {
  11865. return (value - 247) * 256 + dict[pos++] + 108;
  11866. } else if (value >= 251 && value <= 254) {
  11867. return -((value - 251) * 256) - dict[pos++] - 108;
  11868. }
  11869. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  11870. return NaN;
  11871. }
  11872. function parseFloatOperand() {
  11873. var str = '';
  11874. var eof = 15;
  11875. var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-'];
  11876. var length = dict.length;
  11877. while (pos < length) {
  11878. var b = dict[pos++];
  11879. var b1 = b >> 4;
  11880. var b2 = b & 15;
  11881. if (b1 === eof) {
  11882. break;
  11883. }
  11884. str += lookup[b1];
  11885. if (b2 === eof) {
  11886. break;
  11887. }
  11888. str += lookup[b2];
  11889. }
  11890. return parseFloat(str);
  11891. }
  11892. var operands = [];
  11893. var entries = [];
  11894. pos = 0;
  11895. var end = dict.length;
  11896. while (pos < end) {
  11897. var b = dict[pos];
  11898. if (b <= 21) {
  11899. if (b === 12) {
  11900. b = b << 8 | dict[++pos];
  11901. }
  11902. entries.push([b, operands]);
  11903. operands = [];
  11904. ++pos;
  11905. } else {
  11906. operands.push(parseOperand());
  11907. }
  11908. }
  11909. return entries;
  11910. },
  11911. parseIndex: function CFFParser_parseIndex(pos) {
  11912. var cffIndex = new CFFIndex();
  11913. var bytes = this.bytes;
  11914. var count = bytes[pos++] << 8 | bytes[pos++];
  11915. var offsets = [];
  11916. var end = pos;
  11917. var i, ii;
  11918. if (count !== 0) {
  11919. var offsetSize = bytes[pos++];
  11920. var startPos = pos + (count + 1) * offsetSize - 1;
  11921. for (i = 0, ii = count + 1; i < ii; ++i) {
  11922. var offset = 0;
  11923. for (var j = 0; j < offsetSize; ++j) {
  11924. offset <<= 8;
  11925. offset += bytes[pos++];
  11926. }
  11927. offsets.push(startPos + offset);
  11928. }
  11929. end = offsets[count];
  11930. }
  11931. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  11932. var offsetStart = offsets[i];
  11933. var offsetEnd = offsets[i + 1];
  11934. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  11935. }
  11936. return {
  11937. obj: cffIndex,
  11938. endPos: end
  11939. };
  11940. },
  11941. parseNameIndex: function CFFParser_parseNameIndex(index) {
  11942. var names = [];
  11943. for (var i = 0, ii = index.count; i < ii; ++i) {
  11944. var name = index.get(i);
  11945. var length = Math.min(name.length, 127);
  11946. var data = [];
  11947. for (var j = 0; j < length; ++j) {
  11948. var c = name[j];
  11949. if (j === 0 && c === 0) {
  11950. data[j] = c;
  11951. continue;
  11952. }
  11953. if (c < 33 || c > 126 || c === 91 || c === 93 || c === 40 || c === 41 || c === 123 || c === 125 || c === 60 || c === 62 || c === 47 || c === 37 || c === 35) {
  11954. data[j] = 95;
  11955. continue;
  11956. }
  11957. data[j] = c;
  11958. }
  11959. names.push((0, _util.bytesToString)(data));
  11960. }
  11961. return names;
  11962. },
  11963. parseStringIndex: function CFFParser_parseStringIndex(index) {
  11964. var strings = new CFFStrings();
  11965. for (var i = 0, ii = index.count; i < ii; ++i) {
  11966. var data = index.get(i);
  11967. strings.add((0, _util.bytesToString)(data));
  11968. }
  11969. return strings;
  11970. },
  11971. createDict: function CFFParser_createDict(Type, dict, strings) {
  11972. var cffDict = new Type(strings);
  11973. for (var i = 0, ii = dict.length; i < ii; ++i) {
  11974. var pair = dict[i];
  11975. var key = pair[0];
  11976. var value = pair[1];
  11977. cffDict.setByKey(key, value);
  11978. }
  11979. return cffDict;
  11980. },
  11981. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  11982. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  11983. return false;
  11984. }
  11985. var stackSize = state.stackSize;
  11986. var stack = state.stack;
  11987. var length = data.length;
  11988. for (var j = 0; j < length;) {
  11989. var value = data[j++];
  11990. var validationCommand = null;
  11991. if (value === 12) {
  11992. var q = data[j++];
  11993. if (q === 0) {
  11994. data[j - 2] = 139;
  11995. data[j - 1] = 22;
  11996. stackSize = 0;
  11997. } else {
  11998. validationCommand = CharstringValidationData12[q];
  11999. }
  12000. } else if (value === 28) {
  12001. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  12002. j += 2;
  12003. stackSize++;
  12004. } else if (value === 14) {
  12005. if (stackSize >= 4) {
  12006. stackSize -= 4;
  12007. if (this.seacAnalysisEnabled) {
  12008. state.seac = stack.slice(stackSize, stackSize + 4);
  12009. return false;
  12010. }
  12011. }
  12012. validationCommand = CharstringValidationData[value];
  12013. } else if (value >= 32 && value <= 246) {
  12014. stack[stackSize] = value - 139;
  12015. stackSize++;
  12016. } else if (value >= 247 && value <= 254) {
  12017. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  12018. j++;
  12019. stackSize++;
  12020. } else if (value === 255) {
  12021. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  12022. j += 4;
  12023. stackSize++;
  12024. } else if (value === 19 || value === 20) {
  12025. state.hints += stackSize >> 1;
  12026. j += state.hints + 7 >> 3;
  12027. stackSize %= 2;
  12028. validationCommand = CharstringValidationData[value];
  12029. } else if (value === 10 || value === 29) {
  12030. var subrsIndex;
  12031. if (value === 10) {
  12032. subrsIndex = localSubrIndex;
  12033. } else {
  12034. subrsIndex = globalSubrIndex;
  12035. }
  12036. if (!subrsIndex) {
  12037. validationCommand = CharstringValidationData[value];
  12038. (0, _util.warn)('Missing subrsIndex for ' + validationCommand.id);
  12039. return false;
  12040. }
  12041. var bias = 32768;
  12042. if (subrsIndex.count < 1240) {
  12043. bias = 107;
  12044. } else if (subrsIndex.count < 33900) {
  12045. bias = 1131;
  12046. }
  12047. var subrNumber = stack[--stackSize] + bias;
  12048. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  12049. validationCommand = CharstringValidationData[value];
  12050. (0, _util.warn)('Out of bounds subrIndex for ' + validationCommand.id);
  12051. return false;
  12052. }
  12053. state.stackSize = stackSize;
  12054. state.callDepth++;
  12055. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  12056. if (!valid) {
  12057. return false;
  12058. }
  12059. state.callDepth--;
  12060. stackSize = state.stackSize;
  12061. continue;
  12062. } else if (value === 11) {
  12063. state.stackSize = stackSize;
  12064. return true;
  12065. } else {
  12066. validationCommand = CharstringValidationData[value];
  12067. }
  12068. if (validationCommand) {
  12069. if (validationCommand.stem) {
  12070. state.hints += stackSize >> 1;
  12071. }
  12072. if ('min' in validationCommand) {
  12073. if (!state.undefStack && stackSize < validationCommand.min) {
  12074. (0, _util.warn)('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  12075. return false;
  12076. }
  12077. }
  12078. if (state.firstStackClearing && validationCommand.stackClearing) {
  12079. state.firstStackClearing = false;
  12080. stackSize -= validationCommand.min;
  12081. if (stackSize >= 2 && validationCommand.stem) {
  12082. stackSize %= 2;
  12083. } else if (stackSize > 1) {
  12084. (0, _util.warn)('Found too many parameters for stack-clearing command');
  12085. }
  12086. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  12087. state.width = stack[stackSize - 1];
  12088. }
  12089. }
  12090. if ('stackDelta' in validationCommand) {
  12091. if ('stackFn' in validationCommand) {
  12092. validationCommand.stackFn(stack, stackSize);
  12093. }
  12094. stackSize += validationCommand.stackDelta;
  12095. } else if (validationCommand.stackClearing) {
  12096. stackSize = 0;
  12097. } else if (validationCommand.resetStack) {
  12098. stackSize = 0;
  12099. state.undefStack = false;
  12100. } else if (validationCommand.undefStack) {
  12101. stackSize = 0;
  12102. state.undefStack = true;
  12103. state.firstStackClearing = false;
  12104. }
  12105. }
  12106. }
  12107. state.stackSize = stackSize;
  12108. return true;
  12109. },
  12110. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  12111. var seacs = [];
  12112. var widths = [];
  12113. var count = charStrings.count;
  12114. for (var i = 0; i < count; i++) {
  12115. var charstring = charStrings.get(i);
  12116. var state = {
  12117. callDepth: 0,
  12118. stackSize: 0,
  12119. stack: [],
  12120. undefStack: true,
  12121. hints: 0,
  12122. firstStackClearing: true,
  12123. seac: null,
  12124. width: null
  12125. };
  12126. var valid = true;
  12127. var localSubrToUse = null;
  12128. if (fdSelect && fdArray.length) {
  12129. var fdIndex = fdSelect.getFDIndex(i);
  12130. if (fdIndex === -1) {
  12131. (0, _util.warn)('Glyph index is not in fd select.');
  12132. valid = false;
  12133. }
  12134. if (fdIndex >= fdArray.length) {
  12135. (0, _util.warn)('Invalid fd index for glyph index.');
  12136. valid = false;
  12137. }
  12138. if (valid) {
  12139. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  12140. }
  12141. } else if (localSubrIndex) {
  12142. localSubrToUse = localSubrIndex;
  12143. }
  12144. if (valid) {
  12145. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  12146. }
  12147. if (state.width !== null) {
  12148. widths[i] = state.width;
  12149. }
  12150. if (state.seac !== null) {
  12151. seacs[i] = state.seac;
  12152. }
  12153. if (!valid) {
  12154. charStrings.set(i, new Uint8Array([14]));
  12155. }
  12156. }
  12157. return {
  12158. charStrings: charStrings,
  12159. seacs: seacs,
  12160. widths: widths
  12161. };
  12162. },
  12163. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  12164. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  12165. parentDict.setByKey(18, [0, 0]);
  12166. parentDict.privateDict = privateDict;
  12167. },
  12168. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  12169. if (!parentDict.hasName('Private')) {
  12170. this.emptyPrivateDictionary(parentDict);
  12171. return;
  12172. }
  12173. var privateOffset = parentDict.getByName('Private');
  12174. if (!(0, _util.isArray)(privateOffset) || privateOffset.length !== 2) {
  12175. parentDict.removeByName('Private');
  12176. return;
  12177. }
  12178. var size = privateOffset[0];
  12179. var offset = privateOffset[1];
  12180. if (size === 0 || offset >= this.bytes.length) {
  12181. this.emptyPrivateDictionary(parentDict);
  12182. return;
  12183. }
  12184. var privateDictEnd = offset + size;
  12185. var dictData = this.bytes.subarray(offset, privateDictEnd);
  12186. var dict = this.parseDict(dictData);
  12187. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  12188. parentDict.privateDict = privateDict;
  12189. if (!privateDict.getByName('Subrs')) {
  12190. return;
  12191. }
  12192. var subrsOffset = privateDict.getByName('Subrs');
  12193. var relativeOffset = offset + subrsOffset;
  12194. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  12195. this.emptyPrivateDictionary(parentDict);
  12196. return;
  12197. }
  12198. var subrsIndex = this.parseIndex(relativeOffset);
  12199. privateDict.subrsIndex = subrsIndex.obj;
  12200. },
  12201. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  12202. if (pos === 0) {
  12203. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  12204. } else if (pos === 1) {
  12205. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  12206. } else if (pos === 2) {
  12207. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  12208. }
  12209. var bytes = this.bytes;
  12210. var start = pos;
  12211. var format = bytes[pos++];
  12212. var charset = ['.notdef'];
  12213. var id, count, i;
  12214. length -= 1;
  12215. switch (format) {
  12216. case 0:
  12217. for (i = 0; i < length; i++) {
  12218. id = bytes[pos++] << 8 | bytes[pos++];
  12219. charset.push(cid ? id : strings.get(id));
  12220. }
  12221. break;
  12222. case 1:
  12223. while (charset.length <= length) {
  12224. id = bytes[pos++] << 8 | bytes[pos++];
  12225. count = bytes[pos++];
  12226. for (i = 0; i <= count; i++) {
  12227. charset.push(cid ? id++ : strings.get(id++));
  12228. }
  12229. }
  12230. break;
  12231. case 2:
  12232. while (charset.length <= length) {
  12233. id = bytes[pos++] << 8 | bytes[pos++];
  12234. count = bytes[pos++] << 8 | bytes[pos++];
  12235. for (i = 0; i <= count; i++) {
  12236. charset.push(cid ? id++ : strings.get(id++));
  12237. }
  12238. }
  12239. break;
  12240. default:
  12241. (0, _util.error)('Unknown charset format');
  12242. }
  12243. var end = pos;
  12244. var raw = bytes.subarray(start, end);
  12245. return new CFFCharset(false, format, charset, raw);
  12246. },
  12247. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  12248. var encoding = Object.create(null);
  12249. var bytes = this.bytes;
  12250. var predefined = false;
  12251. var format, i, ii;
  12252. var raw = null;
  12253. function readSupplement() {
  12254. var supplementsCount = bytes[pos++];
  12255. for (i = 0; i < supplementsCount; i++) {
  12256. var code = bytes[pos++];
  12257. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  12258. encoding[code] = charset.indexOf(strings.get(sid));
  12259. }
  12260. }
  12261. if (pos === 0 || pos === 1) {
  12262. predefined = true;
  12263. format = pos;
  12264. var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  12265. for (i = 0, ii = charset.length; i < ii; i++) {
  12266. var index = baseEncoding.indexOf(charset[i]);
  12267. if (index !== -1) {
  12268. encoding[index] = i;
  12269. }
  12270. }
  12271. } else {
  12272. var dataStart = pos;
  12273. format = bytes[pos++];
  12274. switch (format & 0x7f) {
  12275. case 0:
  12276. var glyphsCount = bytes[pos++];
  12277. for (i = 1; i <= glyphsCount; i++) {
  12278. encoding[bytes[pos++]] = i;
  12279. }
  12280. break;
  12281. case 1:
  12282. var rangesCount = bytes[pos++];
  12283. var gid = 1;
  12284. for (i = 0; i < rangesCount; i++) {
  12285. var start = bytes[pos++];
  12286. var left = bytes[pos++];
  12287. for (var j = start; j <= start + left; j++) {
  12288. encoding[j] = gid++;
  12289. }
  12290. }
  12291. break;
  12292. default:
  12293. (0, _util.error)('Unknown encoding format: ' + format + ' in CFF');
  12294. break;
  12295. }
  12296. var dataEnd = pos;
  12297. if (format & 0x80) {
  12298. bytes[dataStart] &= 0x7f;
  12299. readSupplement();
  12300. }
  12301. raw = bytes.subarray(dataStart, dataEnd);
  12302. }
  12303. format = format & 0x7f;
  12304. return new CFFEncoding(predefined, format, encoding, raw);
  12305. },
  12306. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  12307. var start = pos;
  12308. var bytes = this.bytes;
  12309. var format = bytes[pos++];
  12310. var fdSelect = [],
  12311. rawBytes;
  12312. var i,
  12313. invalidFirstGID = false;
  12314. switch (format) {
  12315. case 0:
  12316. for (i = 0; i < length; ++i) {
  12317. var id = bytes[pos++];
  12318. fdSelect.push(id);
  12319. }
  12320. rawBytes = bytes.subarray(start, pos);
  12321. break;
  12322. case 3:
  12323. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  12324. for (i = 0; i < rangesCount; ++i) {
  12325. var first = bytes[pos++] << 8 | bytes[pos++];
  12326. if (i === 0 && first !== 0) {
  12327. (0, _util.warn)('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  12328. invalidFirstGID = true;
  12329. first = 0;
  12330. }
  12331. var fdIndex = bytes[pos++];
  12332. var next = bytes[pos] << 8 | bytes[pos + 1];
  12333. for (var j = first; j < next; ++j) {
  12334. fdSelect.push(fdIndex);
  12335. }
  12336. }
  12337. pos += 2;
  12338. rawBytes = bytes.subarray(start, pos);
  12339. if (invalidFirstGID) {
  12340. rawBytes[3] = rawBytes[4] = 0;
  12341. }
  12342. break;
  12343. default:
  12344. (0, _util.error)('parseFDSelect: Unknown format "' + format + '".');
  12345. break;
  12346. }
  12347. (0, _util.assert)(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  12348. return new CFFFDSelect(fdSelect, rawBytes);
  12349. }
  12350. };
  12351. return CFFParser;
  12352. }();
  12353. var CFF = function CFFClosure() {
  12354. function CFF() {
  12355. this.header = null;
  12356. this.names = [];
  12357. this.topDict = null;
  12358. this.strings = new CFFStrings();
  12359. this.globalSubrIndex = null;
  12360. this.encoding = null;
  12361. this.charset = null;
  12362. this.charStrings = null;
  12363. this.fdArray = [];
  12364. this.fdSelect = null;
  12365. this.isCIDFont = false;
  12366. }
  12367. return CFF;
  12368. }();
  12369. var CFFHeader = function CFFHeaderClosure() {
  12370. function CFFHeader(major, minor, hdrSize, offSize) {
  12371. this.major = major;
  12372. this.minor = minor;
  12373. this.hdrSize = hdrSize;
  12374. this.offSize = offSize;
  12375. }
  12376. return CFFHeader;
  12377. }();
  12378. var CFFStrings = function CFFStringsClosure() {
  12379. function CFFStrings() {
  12380. this.strings = [];
  12381. }
  12382. CFFStrings.prototype = {
  12383. get: function CFFStrings_get(index) {
  12384. if (index >= 0 && index <= 390) {
  12385. return CFFStandardStrings[index];
  12386. }
  12387. if (index - 391 <= this.strings.length) {
  12388. return this.strings[index - 391];
  12389. }
  12390. return CFFStandardStrings[0];
  12391. },
  12392. add: function CFFStrings_add(value) {
  12393. this.strings.push(value);
  12394. },
  12395. get count() {
  12396. return this.strings.length;
  12397. }
  12398. };
  12399. return CFFStrings;
  12400. }();
  12401. var CFFIndex = function CFFIndexClosure() {
  12402. function CFFIndex() {
  12403. this.objects = [];
  12404. this.length = 0;
  12405. }
  12406. CFFIndex.prototype = {
  12407. add: function CFFIndex_add(data) {
  12408. this.length += data.length;
  12409. this.objects.push(data);
  12410. },
  12411. set: function CFFIndex_set(index, data) {
  12412. this.length += data.length - this.objects[index].length;
  12413. this.objects[index] = data;
  12414. },
  12415. get: function CFFIndex_get(index) {
  12416. return this.objects[index];
  12417. },
  12418. get count() {
  12419. return this.objects.length;
  12420. }
  12421. };
  12422. return CFFIndex;
  12423. }();
  12424. var CFFDict = function CFFDictClosure() {
  12425. function CFFDict(tables, strings) {
  12426. this.keyToNameMap = tables.keyToNameMap;
  12427. this.nameToKeyMap = tables.nameToKeyMap;
  12428. this.defaults = tables.defaults;
  12429. this.types = tables.types;
  12430. this.opcodes = tables.opcodes;
  12431. this.order = tables.order;
  12432. this.strings = strings;
  12433. this.values = Object.create(null);
  12434. }
  12435. CFFDict.prototype = {
  12436. setByKey: function CFFDict_setByKey(key, value) {
  12437. if (!(key in this.keyToNameMap)) {
  12438. return false;
  12439. }
  12440. var valueLength = value.length;
  12441. if (valueLength === 0) {
  12442. return true;
  12443. }
  12444. for (var i = 0; i < valueLength; i++) {
  12445. if (isNaN(value[i])) {
  12446. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  12447. return true;
  12448. }
  12449. }
  12450. var type = this.types[key];
  12451. if (type === 'num' || type === 'sid' || type === 'offset') {
  12452. value = value[0];
  12453. }
  12454. this.values[key] = value;
  12455. return true;
  12456. },
  12457. setByName: function CFFDict_setByName(name, value) {
  12458. if (!(name in this.nameToKeyMap)) {
  12459. (0, _util.error)('Invalid dictionary name "' + name + '"');
  12460. }
  12461. this.values[this.nameToKeyMap[name]] = value;
  12462. },
  12463. hasName: function CFFDict_hasName(name) {
  12464. return this.nameToKeyMap[name] in this.values;
  12465. },
  12466. getByName: function CFFDict_getByName(name) {
  12467. if (!(name in this.nameToKeyMap)) {
  12468. (0, _util.error)('Invalid dictionary name "' + name + '"');
  12469. }
  12470. var key = this.nameToKeyMap[name];
  12471. if (!(key in this.values)) {
  12472. return this.defaults[key];
  12473. }
  12474. return this.values[key];
  12475. },
  12476. removeByName: function CFFDict_removeByName(name) {
  12477. delete this.values[this.nameToKeyMap[name]];
  12478. }
  12479. };
  12480. CFFDict.createTables = function CFFDict_createTables(layout) {
  12481. var tables = {
  12482. keyToNameMap: {},
  12483. nameToKeyMap: {},
  12484. defaults: {},
  12485. types: {},
  12486. opcodes: {},
  12487. order: []
  12488. };
  12489. for (var i = 0, ii = layout.length; i < ii; ++i) {
  12490. var entry = layout[i];
  12491. var key = (0, _util.isArray)(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  12492. tables.keyToNameMap[key] = entry[1];
  12493. tables.nameToKeyMap[entry[1]] = key;
  12494. tables.types[key] = entry[2];
  12495. tables.defaults[key] = entry[3];
  12496. tables.opcodes[key] = (0, _util.isArray)(entry[0]) ? entry[0] : [entry[0]];
  12497. tables.order.push(key);
  12498. }
  12499. return tables;
  12500. };
  12501. return CFFDict;
  12502. }();
  12503. var CFFTopDict = function CFFTopDictClosure() {
  12504. 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]];
  12505. var tables = null;
  12506. function CFFTopDict(strings) {
  12507. if (tables === null) {
  12508. tables = CFFDict.createTables(layout);
  12509. }
  12510. CFFDict.call(this, tables, strings);
  12511. this.privateDict = null;
  12512. }
  12513. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  12514. return CFFTopDict;
  12515. }();
  12516. var CFFPrivateDict = function CFFPrivateDictClosure() {
  12517. 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]];
  12518. var tables = null;
  12519. function CFFPrivateDict(strings) {
  12520. if (tables === null) {
  12521. tables = CFFDict.createTables(layout);
  12522. }
  12523. CFFDict.call(this, tables, strings);
  12524. this.subrsIndex = null;
  12525. }
  12526. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  12527. return CFFPrivateDict;
  12528. }();
  12529. var CFFCharsetPredefinedTypes = {
  12530. ISO_ADOBE: 0,
  12531. EXPERT: 1,
  12532. EXPERT_SUBSET: 2
  12533. };
  12534. var CFFCharset = function CFFCharsetClosure() {
  12535. function CFFCharset(predefined, format, charset, raw) {
  12536. this.predefined = predefined;
  12537. this.format = format;
  12538. this.charset = charset;
  12539. this.raw = raw;
  12540. }
  12541. return CFFCharset;
  12542. }();
  12543. var CFFEncoding = function CFFEncodingClosure() {
  12544. function CFFEncoding(predefined, format, encoding, raw) {
  12545. this.predefined = predefined;
  12546. this.format = format;
  12547. this.encoding = encoding;
  12548. this.raw = raw;
  12549. }
  12550. return CFFEncoding;
  12551. }();
  12552. var CFFFDSelect = function CFFFDSelectClosure() {
  12553. function CFFFDSelect(fdSelect, raw) {
  12554. this.fdSelect = fdSelect;
  12555. this.raw = raw;
  12556. }
  12557. CFFFDSelect.prototype = {
  12558. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  12559. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  12560. return -1;
  12561. }
  12562. return this.fdSelect[glyphIndex];
  12563. }
  12564. };
  12565. return CFFFDSelect;
  12566. }();
  12567. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  12568. function CFFOffsetTracker() {
  12569. this.offsets = Object.create(null);
  12570. }
  12571. CFFOffsetTracker.prototype = {
  12572. isTracking: function CFFOffsetTracker_isTracking(key) {
  12573. return key in this.offsets;
  12574. },
  12575. track: function CFFOffsetTracker_track(key, location) {
  12576. if (key in this.offsets) {
  12577. (0, _util.error)('Already tracking location of ' + key);
  12578. }
  12579. this.offsets[key] = location;
  12580. },
  12581. offset: function CFFOffsetTracker_offset(value) {
  12582. for (var key in this.offsets) {
  12583. this.offsets[key] += value;
  12584. }
  12585. },
  12586. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  12587. if (!(key in this.offsets)) {
  12588. (0, _util.error)('Not tracking location of ' + key);
  12589. }
  12590. var data = output.data;
  12591. var dataOffset = this.offsets[key];
  12592. var size = 5;
  12593. for (var i = 0, ii = values.length; i < ii; ++i) {
  12594. var offset0 = i * size + dataOffset;
  12595. var offset1 = offset0 + 1;
  12596. var offset2 = offset0 + 2;
  12597. var offset3 = offset0 + 3;
  12598. var offset4 = offset0 + 4;
  12599. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  12600. (0, _util.error)('writing to an offset that is not empty');
  12601. }
  12602. var value = values[i];
  12603. data[offset0] = 0x1d;
  12604. data[offset1] = value >> 24 & 0xFF;
  12605. data[offset2] = value >> 16 & 0xFF;
  12606. data[offset3] = value >> 8 & 0xFF;
  12607. data[offset4] = value & 0xFF;
  12608. }
  12609. }
  12610. };
  12611. return CFFOffsetTracker;
  12612. }();
  12613. var CFFCompiler = function CFFCompilerClosure() {
  12614. function CFFCompiler(cff) {
  12615. this.cff = cff;
  12616. }
  12617. CFFCompiler.prototype = {
  12618. compile: function CFFCompiler_compile() {
  12619. var cff = this.cff;
  12620. var output = {
  12621. data: [],
  12622. length: 0,
  12623. add: function CFFCompiler_add(data) {
  12624. this.data = this.data.concat(data);
  12625. this.length = this.data.length;
  12626. }
  12627. };
  12628. var header = this.compileHeader(cff.header);
  12629. output.add(header);
  12630. var nameIndex = this.compileNameIndex(cff.names);
  12631. output.add(nameIndex);
  12632. if (cff.isCIDFont) {
  12633. if (cff.topDict.hasName('FontMatrix')) {
  12634. var base = cff.topDict.getByName('FontMatrix');
  12635. cff.topDict.removeByName('FontMatrix');
  12636. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  12637. var subDict = cff.fdArray[i];
  12638. var matrix = base.slice(0);
  12639. if (subDict.hasName('FontMatrix')) {
  12640. matrix = _util.Util.transform(matrix, subDict.getByName('FontMatrix'));
  12641. }
  12642. subDict.setByName('FontMatrix', matrix);
  12643. }
  12644. }
  12645. }
  12646. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  12647. output.add(compiled.output);
  12648. var topDictTracker = compiled.trackers[0];
  12649. var stringIndex = this.compileStringIndex(cff.strings.strings);
  12650. output.add(stringIndex);
  12651. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  12652. output.add(globalSubrIndex);
  12653. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  12654. if (cff.encoding.predefined) {
  12655. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  12656. } else {
  12657. var encoding = this.compileEncoding(cff.encoding);
  12658. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  12659. output.add(encoding);
  12660. }
  12661. }
  12662. if (cff.charset && cff.topDict.hasName('charset')) {
  12663. if (cff.charset.predefined) {
  12664. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  12665. } else {
  12666. var charset = this.compileCharset(cff.charset);
  12667. topDictTracker.setEntryLocation('charset', [output.length], output);
  12668. output.add(charset);
  12669. }
  12670. }
  12671. var charStrings = this.compileCharStrings(cff.charStrings);
  12672. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  12673. output.add(charStrings);
  12674. if (cff.isCIDFont) {
  12675. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  12676. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  12677. output.add(fdSelect);
  12678. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  12679. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  12680. output.add(compiled.output);
  12681. var fontDictTrackers = compiled.trackers;
  12682. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  12683. }
  12684. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  12685. output.add([0]);
  12686. return output.data;
  12687. },
  12688. encodeNumber: function CFFCompiler_encodeNumber(value) {
  12689. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  12690. return this.encodeInteger(value);
  12691. }
  12692. return this.encodeFloat(value);
  12693. },
  12694. encodeFloat: function CFFCompiler_encodeFloat(num) {
  12695. var value = num.toString();
  12696. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  12697. if (m) {
  12698. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  12699. value = (Math.round(num * epsilon) / epsilon).toString();
  12700. }
  12701. var nibbles = '';
  12702. var i, ii;
  12703. for (i = 0, ii = value.length; i < ii; ++i) {
  12704. var a = value[i];
  12705. if (a === 'e') {
  12706. nibbles += value[++i] === '-' ? 'c' : 'b';
  12707. } else if (a === '.') {
  12708. nibbles += 'a';
  12709. } else if (a === '-') {
  12710. nibbles += 'e';
  12711. } else {
  12712. nibbles += a;
  12713. }
  12714. }
  12715. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  12716. var out = [30];
  12717. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  12718. out.push(parseInt(nibbles.substr(i, 2), 16));
  12719. }
  12720. return out;
  12721. },
  12722. encodeInteger: function CFFCompiler_encodeInteger(value) {
  12723. var code;
  12724. if (value >= -107 && value <= 107) {
  12725. code = [value + 139];
  12726. } else if (value >= 108 && value <= 1131) {
  12727. value = value - 108;
  12728. code = [(value >> 8) + 247, value & 0xFF];
  12729. } else if (value >= -1131 && value <= -108) {
  12730. value = -value - 108;
  12731. code = [(value >> 8) + 251, value & 0xFF];
  12732. } else if (value >= -32768 && value <= 32767) {
  12733. code = [0x1c, value >> 8 & 0xFF, value & 0xFF];
  12734. } else {
  12735. code = [0x1d, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF];
  12736. }
  12737. return code;
  12738. },
  12739. compileHeader: function CFFCompiler_compileHeader(header) {
  12740. return [header.major, header.minor, header.hdrSize, header.offSize];
  12741. },
  12742. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  12743. var nameIndex = new CFFIndex();
  12744. for (var i = 0, ii = names.length; i < ii; ++i) {
  12745. nameIndex.add((0, _util.stringToBytes)(names[i]));
  12746. }
  12747. return this.compileIndex(nameIndex);
  12748. },
  12749. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  12750. var fontDictTrackers = [];
  12751. var fdArrayIndex = new CFFIndex();
  12752. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  12753. var fontDict = dicts[i];
  12754. if (removeCidKeys) {
  12755. fontDict.removeByName('CIDFontVersion');
  12756. fontDict.removeByName('CIDFontRevision');
  12757. fontDict.removeByName('CIDFontType');
  12758. fontDict.removeByName('CIDCount');
  12759. fontDict.removeByName('UIDBase');
  12760. }
  12761. var fontDictTracker = new CFFOffsetTracker();
  12762. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  12763. fontDictTrackers.push(fontDictTracker);
  12764. fdArrayIndex.add(fontDictData);
  12765. fontDictTracker.offset(length);
  12766. }
  12767. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  12768. return {
  12769. trackers: fontDictTrackers,
  12770. output: fdArrayIndex
  12771. };
  12772. },
  12773. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  12774. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  12775. var fontDict = dicts[i];
  12776. (0, _util.assert)(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  12777. var privateDict = fontDict.privateDict;
  12778. var privateDictTracker = new CFFOffsetTracker();
  12779. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  12780. var outputLength = output.length;
  12781. privateDictTracker.offset(outputLength);
  12782. if (!privateDictData.length) {
  12783. outputLength = 0;
  12784. }
  12785. trackers[i].setEntryLocation('Private', [privateDictData.length, outputLength], output);
  12786. output.add(privateDictData);
  12787. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  12788. var subrs = this.compileIndex(privateDict.subrsIndex);
  12789. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  12790. output.add(subrs);
  12791. }
  12792. }
  12793. },
  12794. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  12795. var out = [];
  12796. var order = dict.order;
  12797. for (var i = 0; i < order.length; ++i) {
  12798. var key = order[i];
  12799. if (!(key in dict.values)) {
  12800. continue;
  12801. }
  12802. var values = dict.values[key];
  12803. var types = dict.types[key];
  12804. if (!(0, _util.isArray)(types)) {
  12805. types = [types];
  12806. }
  12807. if (!(0, _util.isArray)(values)) {
  12808. values = [values];
  12809. }
  12810. if (values.length === 0) {
  12811. continue;
  12812. }
  12813. for (var j = 0, jj = types.length; j < jj; ++j) {
  12814. var type = types[j];
  12815. var value = values[j];
  12816. switch (type) {
  12817. case 'num':
  12818. case 'sid':
  12819. out = out.concat(this.encodeNumber(value));
  12820. break;
  12821. case 'offset':
  12822. var name = dict.keyToNameMap[key];
  12823. if (!offsetTracker.isTracking(name)) {
  12824. offsetTracker.track(name, out.length);
  12825. }
  12826. out = out.concat([0x1d, 0, 0, 0, 0]);
  12827. break;
  12828. case 'array':
  12829. case 'delta':
  12830. out = out.concat(this.encodeNumber(value));
  12831. for (var k = 1, kk = values.length; k < kk; ++k) {
  12832. out = out.concat(this.encodeNumber(values[k]));
  12833. }
  12834. break;
  12835. default:
  12836. (0, _util.error)('Unknown data type of ' + type);
  12837. break;
  12838. }
  12839. }
  12840. out = out.concat(dict.opcodes[key]);
  12841. }
  12842. return out;
  12843. },
  12844. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  12845. var stringIndex = new CFFIndex();
  12846. for (var i = 0, ii = strings.length; i < ii; ++i) {
  12847. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  12848. }
  12849. return this.compileIndex(stringIndex);
  12850. },
  12851. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  12852. var globalSubrIndex = this.cff.globalSubrIndex;
  12853. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  12854. },
  12855. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  12856. return this.compileIndex(charStrings);
  12857. },
  12858. compileCharset: function CFFCompiler_compileCharset(charset) {
  12859. return this.compileTypedArray(charset.raw);
  12860. },
  12861. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  12862. return this.compileTypedArray(encoding.raw);
  12863. },
  12864. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  12865. return this.compileTypedArray(fdSelect);
  12866. },
  12867. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  12868. var out = [];
  12869. for (var i = 0, ii = data.length; i < ii; ++i) {
  12870. out[i] = data[i];
  12871. }
  12872. return out;
  12873. },
  12874. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  12875. trackers = trackers || [];
  12876. var objects = index.objects;
  12877. var count = objects.length;
  12878. if (count === 0) {
  12879. return [0, 0, 0];
  12880. }
  12881. var data = [count >> 8 & 0xFF, count & 0xff];
  12882. var lastOffset = 1,
  12883. i;
  12884. for (i = 0; i < count; ++i) {
  12885. lastOffset += objects[i].length;
  12886. }
  12887. var offsetSize;
  12888. if (lastOffset < 0x100) {
  12889. offsetSize = 1;
  12890. } else if (lastOffset < 0x10000) {
  12891. offsetSize = 2;
  12892. } else if (lastOffset < 0x1000000) {
  12893. offsetSize = 3;
  12894. } else {
  12895. offsetSize = 4;
  12896. }
  12897. data.push(offsetSize);
  12898. var relativeOffset = 1;
  12899. for (i = 0; i < count + 1; i++) {
  12900. if (offsetSize === 1) {
  12901. data.push(relativeOffset & 0xFF);
  12902. } else if (offsetSize === 2) {
  12903. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  12904. } else if (offsetSize === 3) {
  12905. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  12906. } else {
  12907. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  12908. }
  12909. if (objects[i]) {
  12910. relativeOffset += objects[i].length;
  12911. }
  12912. }
  12913. for (i = 0; i < count; i++) {
  12914. if (trackers[i]) {
  12915. trackers[i].offset(data.length);
  12916. }
  12917. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  12918. data.push(objects[i][j]);
  12919. }
  12920. }
  12921. return data;
  12922. }
  12923. };
  12924. return CFFCompiler;
  12925. }();
  12926. exports.CFFStandardStrings = CFFStandardStrings;
  12927. exports.CFFParser = CFFParser;
  12928. exports.CFF = CFF;
  12929. exports.CFFHeader = CFFHeader;
  12930. exports.CFFStrings = CFFStrings;
  12931. exports.CFFIndex = CFFIndex;
  12932. exports.CFFCharset = CFFCharset;
  12933. exports.CFFTopDict = CFFTopDict;
  12934. exports.CFFPrivateDict = CFFPrivateDict;
  12935. exports.CFFCompiler = CFFCompiler;
  12936. /***/ }),
  12937. /* 12 */
  12938. /***/ (function(module, exports, __w_pdfjs_require__) {
  12939. "use strict";
  12940. Object.defineProperty(exports, "__esModule", {
  12941. value: true
  12942. });
  12943. exports.ChunkedStreamManager = exports.ChunkedStream = undefined;
  12944. var _util = __w_pdfjs_require__(0);
  12945. var ChunkedStream = function ChunkedStreamClosure() {
  12946. function ChunkedStream(length, chunkSize, manager) {
  12947. this.bytes = new Uint8Array(length);
  12948. this.start = 0;
  12949. this.pos = 0;
  12950. this.end = length;
  12951. this.chunkSize = chunkSize;
  12952. this.loadedChunks = [];
  12953. this.numChunksLoaded = 0;
  12954. this.numChunks = Math.ceil(length / chunkSize);
  12955. this.manager = manager;
  12956. this.progressiveDataLength = 0;
  12957. this.lastSuccessfulEnsureByteChunk = -1;
  12958. }
  12959. ChunkedStream.prototype = {
  12960. getMissingChunks: function ChunkedStream_getMissingChunks() {
  12961. var chunks = [];
  12962. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  12963. if (!this.loadedChunks[chunk]) {
  12964. chunks.push(chunk);
  12965. }
  12966. }
  12967. return chunks;
  12968. },
  12969. getBaseStreams: function ChunkedStream_getBaseStreams() {
  12970. return [this];
  12971. },
  12972. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  12973. return this.numChunksLoaded === this.numChunks;
  12974. },
  12975. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  12976. var end = begin + chunk.byteLength;
  12977. (0, _util.assert)(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  12978. var length = this.bytes.length;
  12979. (0, _util.assert)(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  12980. this.bytes.set(new Uint8Array(chunk), begin);
  12981. var chunkSize = this.chunkSize;
  12982. var beginChunk = Math.floor(begin / chunkSize);
  12983. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  12984. var curChunk;
  12985. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  12986. if (!this.loadedChunks[curChunk]) {
  12987. this.loadedChunks[curChunk] = true;
  12988. ++this.numChunksLoaded;
  12989. }
  12990. }
  12991. },
  12992. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  12993. var position = this.progressiveDataLength;
  12994. var beginChunk = Math.floor(position / this.chunkSize);
  12995. this.bytes.set(new Uint8Array(data), position);
  12996. position += data.byteLength;
  12997. this.progressiveDataLength = position;
  12998. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  12999. var curChunk;
  13000. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  13001. if (!this.loadedChunks[curChunk]) {
  13002. this.loadedChunks[curChunk] = true;
  13003. ++this.numChunksLoaded;
  13004. }
  13005. }
  13006. },
  13007. ensureByte: function ChunkedStream_ensureByte(pos) {
  13008. var chunk = Math.floor(pos / this.chunkSize);
  13009. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  13010. return;
  13011. }
  13012. if (!this.loadedChunks[chunk]) {
  13013. throw new _util.MissingDataException(pos, pos + 1);
  13014. }
  13015. this.lastSuccessfulEnsureByteChunk = chunk;
  13016. },
  13017. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  13018. if (begin >= end) {
  13019. return;
  13020. }
  13021. if (end <= this.progressiveDataLength) {
  13022. return;
  13023. }
  13024. var chunkSize = this.chunkSize;
  13025. var beginChunk = Math.floor(begin / chunkSize);
  13026. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  13027. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  13028. if (!this.loadedChunks[chunk]) {
  13029. throw new _util.MissingDataException(begin, end);
  13030. }
  13031. }
  13032. },
  13033. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  13034. var chunk,
  13035. numChunks = this.numChunks;
  13036. for (var i = 0; i < numChunks; ++i) {
  13037. chunk = (beginChunk + i) % numChunks;
  13038. if (!this.loadedChunks[chunk]) {
  13039. return chunk;
  13040. }
  13041. }
  13042. return null;
  13043. },
  13044. hasChunk: function ChunkedStream_hasChunk(chunk) {
  13045. return !!this.loadedChunks[chunk];
  13046. },
  13047. get length() {
  13048. return this.end - this.start;
  13049. },
  13050. get isEmpty() {
  13051. return this.length === 0;
  13052. },
  13053. getByte: function ChunkedStream_getByte() {
  13054. var pos = this.pos;
  13055. if (pos >= this.end) {
  13056. return -1;
  13057. }
  13058. this.ensureByte(pos);
  13059. return this.bytes[this.pos++];
  13060. },
  13061. getUint16: function ChunkedStream_getUint16() {
  13062. var b0 = this.getByte();
  13063. var b1 = this.getByte();
  13064. if (b0 === -1 || b1 === -1) {
  13065. return -1;
  13066. }
  13067. return (b0 << 8) + b1;
  13068. },
  13069. getInt32: function ChunkedStream_getInt32() {
  13070. var b0 = this.getByte();
  13071. var b1 = this.getByte();
  13072. var b2 = this.getByte();
  13073. var b3 = this.getByte();
  13074. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  13075. },
  13076. getBytes: function ChunkedStream_getBytes(length) {
  13077. var bytes = this.bytes;
  13078. var pos = this.pos;
  13079. var strEnd = this.end;
  13080. if (!length) {
  13081. this.ensureRange(pos, strEnd);
  13082. return bytes.subarray(pos, strEnd);
  13083. }
  13084. var end = pos + length;
  13085. if (end > strEnd) {
  13086. end = strEnd;
  13087. }
  13088. this.ensureRange(pos, end);
  13089. this.pos = end;
  13090. return bytes.subarray(pos, end);
  13091. },
  13092. peekByte: function ChunkedStream_peekByte() {
  13093. var peekedByte = this.getByte();
  13094. this.pos--;
  13095. return peekedByte;
  13096. },
  13097. peekBytes: function ChunkedStream_peekBytes(length) {
  13098. var bytes = this.getBytes(length);
  13099. this.pos -= bytes.length;
  13100. return bytes;
  13101. },
  13102. getByteRange: function ChunkedStream_getBytes(begin, end) {
  13103. this.ensureRange(begin, end);
  13104. return this.bytes.subarray(begin, end);
  13105. },
  13106. skip: function ChunkedStream_skip(n) {
  13107. if (!n) {
  13108. n = 1;
  13109. }
  13110. this.pos += n;
  13111. },
  13112. reset: function ChunkedStream_reset() {
  13113. this.pos = this.start;
  13114. },
  13115. moveStart: function ChunkedStream_moveStart() {
  13116. this.start = this.pos;
  13117. },
  13118. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  13119. this.ensureRange(start, start + length);
  13120. function ChunkedStreamSubstream() {}
  13121. ChunkedStreamSubstream.prototype = Object.create(this);
  13122. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  13123. var chunkSize = this.chunkSize;
  13124. var beginChunk = Math.floor(this.start / chunkSize);
  13125. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  13126. var missingChunks = [];
  13127. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  13128. if (!this.loadedChunks[chunk]) {
  13129. missingChunks.push(chunk);
  13130. }
  13131. }
  13132. return missingChunks;
  13133. };
  13134. var subStream = new ChunkedStreamSubstream();
  13135. subStream.pos = subStream.start = start;
  13136. subStream.end = start + length || this.end;
  13137. subStream.dict = dict;
  13138. return subStream;
  13139. }
  13140. };
  13141. return ChunkedStream;
  13142. }();
  13143. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  13144. function ChunkedStreamManager(pdfNetworkStream, args) {
  13145. var chunkSize = args.rangeChunkSize;
  13146. var length = args.length;
  13147. this.stream = new ChunkedStream(length, chunkSize, this);
  13148. this.length = length;
  13149. this.chunkSize = chunkSize;
  13150. this.pdfNetworkStream = pdfNetworkStream;
  13151. this.url = args.url;
  13152. this.disableAutoFetch = args.disableAutoFetch;
  13153. this.msgHandler = args.msgHandler;
  13154. this.currRequestId = 0;
  13155. this.chunksNeededByRequest = Object.create(null);
  13156. this.requestsByChunk = Object.create(null);
  13157. this.promisesByRequest = Object.create(null);
  13158. this.progressiveDataLength = 0;
  13159. this.aborted = false;
  13160. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  13161. }
  13162. ChunkedStreamManager.prototype = {
  13163. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  13164. return this._loadedStreamCapability.promise;
  13165. },
  13166. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  13167. var _this = this;
  13168. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  13169. if (!rangeReader.isStreamingSupported) {
  13170. rangeReader.onProgress = this.onProgress.bind(this);
  13171. }
  13172. var chunks = [],
  13173. loaded = 0;
  13174. var manager = this;
  13175. var promise = new Promise(function (resolve, reject) {
  13176. var readChunk = function readChunk(chunk) {
  13177. try {
  13178. if (!chunk.done) {
  13179. var data = chunk.value;
  13180. chunks.push(data);
  13181. loaded += (0, _util.arrayByteLength)(data);
  13182. if (rangeReader.isStreamingSupported) {
  13183. manager.onProgress({ loaded: loaded });
  13184. }
  13185. rangeReader.read().then(readChunk, reject);
  13186. return;
  13187. }
  13188. var chunkData = (0, _util.arraysToBytes)(chunks);
  13189. chunks = null;
  13190. resolve(chunkData);
  13191. } catch (e) {
  13192. reject(e);
  13193. }
  13194. };
  13195. rangeReader.read().then(readChunk, reject);
  13196. });
  13197. promise.then(function (data) {
  13198. if (_this.aborted) {
  13199. return;
  13200. }
  13201. _this.onReceiveData({
  13202. chunk: data,
  13203. begin: begin
  13204. });
  13205. });
  13206. },
  13207. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  13208. var missingChunks = this.stream.getMissingChunks();
  13209. this._requestChunks(missingChunks);
  13210. return this._loadedStreamCapability.promise;
  13211. },
  13212. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  13213. var requestId = this.currRequestId++;
  13214. var i, ii;
  13215. var chunksNeeded = Object.create(null);
  13216. this.chunksNeededByRequest[requestId] = chunksNeeded;
  13217. for (i = 0, ii = chunks.length; i < ii; i++) {
  13218. if (!this.stream.hasChunk(chunks[i])) {
  13219. chunksNeeded[chunks[i]] = true;
  13220. }
  13221. }
  13222. if ((0, _util.isEmptyObj)(chunksNeeded)) {
  13223. return Promise.resolve();
  13224. }
  13225. var capability = (0, _util.createPromiseCapability)();
  13226. this.promisesByRequest[requestId] = capability;
  13227. var chunksToRequest = [];
  13228. for (var chunk in chunksNeeded) {
  13229. chunk = chunk | 0;
  13230. if (!(chunk in this.requestsByChunk)) {
  13231. this.requestsByChunk[chunk] = [];
  13232. chunksToRequest.push(chunk);
  13233. }
  13234. this.requestsByChunk[chunk].push(requestId);
  13235. }
  13236. if (!chunksToRequest.length) {
  13237. return capability.promise;
  13238. }
  13239. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  13240. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  13241. var groupedChunk = groupedChunksToRequest[i];
  13242. var begin = groupedChunk.beginChunk * this.chunkSize;
  13243. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  13244. this.sendRequest(begin, end);
  13245. }
  13246. return capability.promise;
  13247. },
  13248. getStream: function ChunkedStreamManager_getStream() {
  13249. return this.stream;
  13250. },
  13251. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  13252. end = Math.min(end, this.length);
  13253. var beginChunk = this.getBeginChunk(begin);
  13254. var endChunk = this.getEndChunk(end);
  13255. var chunks = [];
  13256. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  13257. chunks.push(chunk);
  13258. }
  13259. return this._requestChunks(chunks);
  13260. },
  13261. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  13262. ranges = ranges || [];
  13263. var chunksToRequest = [];
  13264. for (var i = 0; i < ranges.length; i++) {
  13265. var beginChunk = this.getBeginChunk(ranges[i].begin);
  13266. var endChunk = this.getEndChunk(ranges[i].end);
  13267. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  13268. if (chunksToRequest.indexOf(chunk) < 0) {
  13269. chunksToRequest.push(chunk);
  13270. }
  13271. }
  13272. }
  13273. chunksToRequest.sort(function (a, b) {
  13274. return a - b;
  13275. });
  13276. return this._requestChunks(chunksToRequest);
  13277. },
  13278. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  13279. var groupedChunks = [];
  13280. var beginChunk = -1;
  13281. var prevChunk = -1;
  13282. for (var i = 0; i < chunks.length; ++i) {
  13283. var chunk = chunks[i];
  13284. if (beginChunk < 0) {
  13285. beginChunk = chunk;
  13286. }
  13287. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  13288. groupedChunks.push({
  13289. beginChunk: beginChunk,
  13290. endChunk: prevChunk + 1
  13291. });
  13292. beginChunk = chunk;
  13293. }
  13294. if (i + 1 === chunks.length) {
  13295. groupedChunks.push({
  13296. beginChunk: beginChunk,
  13297. endChunk: chunk + 1
  13298. });
  13299. }
  13300. prevChunk = chunk;
  13301. }
  13302. return groupedChunks;
  13303. },
  13304. onProgress: function ChunkedStreamManager_onProgress(args) {
  13305. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  13306. this.msgHandler.send('DocProgress', {
  13307. loaded: bytesLoaded,
  13308. total: this.length
  13309. });
  13310. },
  13311. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  13312. var chunk = args.chunk;
  13313. var isProgressive = args.begin === undefined;
  13314. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  13315. var end = begin + chunk.byteLength;
  13316. var beginChunk = Math.floor(begin / this.chunkSize);
  13317. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  13318. if (isProgressive) {
  13319. this.stream.onReceiveProgressiveData(chunk);
  13320. this.progressiveDataLength = end;
  13321. } else {
  13322. this.stream.onReceiveData(begin, chunk);
  13323. }
  13324. if (this.stream.allChunksLoaded()) {
  13325. this._loadedStreamCapability.resolve(this.stream);
  13326. }
  13327. var loadedRequests = [];
  13328. var i, requestId;
  13329. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  13330. var requestIds = this.requestsByChunk[chunk] || [];
  13331. delete this.requestsByChunk[chunk];
  13332. for (i = 0; i < requestIds.length; ++i) {
  13333. requestId = requestIds[i];
  13334. var chunksNeeded = this.chunksNeededByRequest[requestId];
  13335. if (chunk in chunksNeeded) {
  13336. delete chunksNeeded[chunk];
  13337. }
  13338. if (!(0, _util.isEmptyObj)(chunksNeeded)) {
  13339. continue;
  13340. }
  13341. loadedRequests.push(requestId);
  13342. }
  13343. }
  13344. if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
  13345. var nextEmptyChunk;
  13346. if (this.stream.numChunksLoaded === 1) {
  13347. var lastChunk = this.stream.numChunks - 1;
  13348. if (!this.stream.hasChunk(lastChunk)) {
  13349. nextEmptyChunk = lastChunk;
  13350. }
  13351. } else {
  13352. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  13353. }
  13354. if ((0, _util.isInt)(nextEmptyChunk)) {
  13355. this._requestChunks([nextEmptyChunk]);
  13356. }
  13357. }
  13358. for (i = 0; i < loadedRequests.length; ++i) {
  13359. requestId = loadedRequests[i];
  13360. var capability = this.promisesByRequest[requestId];
  13361. delete this.promisesByRequest[requestId];
  13362. capability.resolve();
  13363. }
  13364. this.msgHandler.send('DocProgress', {
  13365. loaded: this.stream.numChunksLoaded * this.chunkSize,
  13366. total: this.length
  13367. });
  13368. },
  13369. onError: function ChunkedStreamManager_onError(err) {
  13370. this._loadedStreamCapability.reject(err);
  13371. },
  13372. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  13373. var chunk = Math.floor(begin / this.chunkSize);
  13374. return chunk;
  13375. },
  13376. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  13377. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  13378. return chunk;
  13379. },
  13380. abort: function ChunkedStreamManager_abort() {
  13381. this.aborted = true;
  13382. if (this.pdfNetworkStream) {
  13383. this.pdfNetworkStream.cancelAllRequests('abort');
  13384. }
  13385. for (var requestId in this.promisesByRequest) {
  13386. var capability = this.promisesByRequest[requestId];
  13387. capability.reject(new Error('Request was aborted'));
  13388. }
  13389. }
  13390. };
  13391. return ChunkedStreamManager;
  13392. }();
  13393. exports.ChunkedStream = ChunkedStream;
  13394. exports.ChunkedStreamManager = ChunkedStreamManager;
  13395. /***/ }),
  13396. /* 13 */
  13397. /***/ (function(module, exports, __w_pdfjs_require__) {
  13398. "use strict";
  13399. Object.defineProperty(exports, "__esModule", {
  13400. value: true
  13401. });
  13402. exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = undefined;
  13403. var _util = __w_pdfjs_require__(0);
  13404. var _primitives = __w_pdfjs_require__(1);
  13405. var _stream = __w_pdfjs_require__(2);
  13406. var ARCFourCipher = function ARCFourCipherClosure() {
  13407. function ARCFourCipher(key) {
  13408. this.a = 0;
  13409. this.b = 0;
  13410. var s = new Uint8Array(256);
  13411. var i,
  13412. j = 0,
  13413. tmp,
  13414. keyLength = key.length;
  13415. for (i = 0; i < 256; ++i) {
  13416. s[i] = i;
  13417. }
  13418. for (i = 0; i < 256; ++i) {
  13419. tmp = s[i];
  13420. j = j + tmp + key[i % keyLength] & 0xFF;
  13421. s[i] = s[j];
  13422. s[j] = tmp;
  13423. }
  13424. this.s = s;
  13425. }
  13426. ARCFourCipher.prototype = {
  13427. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  13428. var i,
  13429. n = data.length,
  13430. tmp,
  13431. tmp2;
  13432. var a = this.a,
  13433. b = this.b,
  13434. s = this.s;
  13435. var output = new Uint8Array(n);
  13436. for (i = 0; i < n; ++i) {
  13437. a = a + 1 & 0xFF;
  13438. tmp = s[a];
  13439. b = b + tmp & 0xFF;
  13440. tmp2 = s[b];
  13441. s[a] = tmp2;
  13442. s[b] = tmp;
  13443. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  13444. }
  13445. this.a = a;
  13446. this.b = b;
  13447. return output;
  13448. }
  13449. };
  13450. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  13451. return ARCFourCipher;
  13452. }();
  13453. var calculateMD5 = function calculateMD5Closure() {
  13454. 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]);
  13455. 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]);
  13456. function hash(data, offset, length) {
  13457. var h0 = 1732584193,
  13458. h1 = -271733879,
  13459. h2 = -1732584194,
  13460. h3 = 271733878;
  13461. var paddedLength = length + 72 & ~63;
  13462. var padded = new Uint8Array(paddedLength);
  13463. var i, j, n;
  13464. for (i = 0; i < length; ++i) {
  13465. padded[i] = data[offset++];
  13466. }
  13467. padded[i++] = 0x80;
  13468. n = paddedLength - 8;
  13469. while (i < n) {
  13470. padded[i++] = 0;
  13471. }
  13472. padded[i++] = length << 3 & 0xFF;
  13473. padded[i++] = length >> 5 & 0xFF;
  13474. padded[i++] = length >> 13 & 0xFF;
  13475. padded[i++] = length >> 21 & 0xFF;
  13476. padded[i++] = length >>> 29 & 0xFF;
  13477. padded[i++] = 0;
  13478. padded[i++] = 0;
  13479. padded[i++] = 0;
  13480. var w = new Int32Array(16);
  13481. for (i = 0; i < paddedLength;) {
  13482. for (j = 0; j < 16; ++j, i += 4) {
  13483. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  13484. }
  13485. var a = h0,
  13486. b = h1,
  13487. c = h2,
  13488. d = h3,
  13489. f,
  13490. g;
  13491. for (j = 0; j < 64; ++j) {
  13492. if (j < 16) {
  13493. f = b & c | ~b & d;
  13494. g = j;
  13495. } else if (j < 32) {
  13496. f = d & b | ~d & c;
  13497. g = 5 * j + 1 & 15;
  13498. } else if (j < 48) {
  13499. f = b ^ c ^ d;
  13500. g = 3 * j + 5 & 15;
  13501. } else {
  13502. f = c ^ (b | ~d);
  13503. g = 7 * j & 15;
  13504. }
  13505. var tmp = d,
  13506. rotateArg = a + f + k[j] + w[g] | 0,
  13507. rotate = r[j];
  13508. d = c;
  13509. c = b;
  13510. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  13511. a = tmp;
  13512. }
  13513. h0 = h0 + a | 0;
  13514. h1 = h1 + b | 0;
  13515. h2 = h2 + c | 0;
  13516. h3 = h3 + d | 0;
  13517. }
  13518. 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]);
  13519. }
  13520. return hash;
  13521. }();
  13522. var Word64 = function Word64Closure() {
  13523. function Word64(highInteger, lowInteger) {
  13524. this.high = highInteger | 0;
  13525. this.low = lowInteger | 0;
  13526. }
  13527. Word64.prototype = {
  13528. and: function Word64_and(word) {
  13529. this.high &= word.high;
  13530. this.low &= word.low;
  13531. },
  13532. xor: function Word64_xor(word) {
  13533. this.high ^= word.high;
  13534. this.low ^= word.low;
  13535. },
  13536. or: function Word64_or(word) {
  13537. this.high |= word.high;
  13538. this.low |= word.low;
  13539. },
  13540. shiftRight: function Word64_shiftRight(places) {
  13541. if (places >= 32) {
  13542. this.low = this.high >>> places - 32 | 0;
  13543. this.high = 0;
  13544. } else {
  13545. this.low = this.low >>> places | this.high << 32 - places;
  13546. this.high = this.high >>> places | 0;
  13547. }
  13548. },
  13549. shiftLeft: function Word64_shiftLeft(places) {
  13550. if (places >= 32) {
  13551. this.high = this.low << places - 32;
  13552. this.low = 0;
  13553. } else {
  13554. this.high = this.high << places | this.low >>> 32 - places;
  13555. this.low = this.low << places;
  13556. }
  13557. },
  13558. rotateRight: function Word64_rotateRight(places) {
  13559. var low, high;
  13560. if (places & 32) {
  13561. high = this.low;
  13562. low = this.high;
  13563. } else {
  13564. low = this.low;
  13565. high = this.high;
  13566. }
  13567. places &= 31;
  13568. this.low = low >>> places | high << 32 - places;
  13569. this.high = high >>> places | low << 32 - places;
  13570. },
  13571. not: function Word64_not() {
  13572. this.high = ~this.high;
  13573. this.low = ~this.low;
  13574. },
  13575. add: function Word64_add(word) {
  13576. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  13577. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  13578. if (lowAdd > 0xFFFFFFFF) {
  13579. highAdd += 1;
  13580. }
  13581. this.low = lowAdd | 0;
  13582. this.high = highAdd | 0;
  13583. },
  13584. copyTo: function Word64_copyTo(bytes, offset) {
  13585. bytes[offset] = this.high >>> 24 & 0xFF;
  13586. bytes[offset + 1] = this.high >> 16 & 0xFF;
  13587. bytes[offset + 2] = this.high >> 8 & 0xFF;
  13588. bytes[offset + 3] = this.high & 0xFF;
  13589. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  13590. bytes[offset + 5] = this.low >> 16 & 0xFF;
  13591. bytes[offset + 6] = this.low >> 8 & 0xFF;
  13592. bytes[offset + 7] = this.low & 0xFF;
  13593. },
  13594. assign: function Word64_assign(word) {
  13595. this.high = word.high;
  13596. this.low = word.low;
  13597. }
  13598. };
  13599. return Word64;
  13600. }();
  13601. var calculateSHA256 = function calculateSHA256Closure() {
  13602. function rotr(x, n) {
  13603. return x >>> n | x << 32 - n;
  13604. }
  13605. function ch(x, y, z) {
  13606. return x & y ^ ~x & z;
  13607. }
  13608. function maj(x, y, z) {
  13609. return x & y ^ x & z ^ y & z;
  13610. }
  13611. function sigma(x) {
  13612. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  13613. }
  13614. function sigmaPrime(x) {
  13615. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  13616. }
  13617. function littleSigma(x) {
  13618. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  13619. }
  13620. function littleSigmaPrime(x) {
  13621. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  13622. }
  13623. 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];
  13624. function hash(data, offset, length) {
  13625. var h0 = 0x6a09e667,
  13626. h1 = 0xbb67ae85,
  13627. h2 = 0x3c6ef372,
  13628. h3 = 0xa54ff53a,
  13629. h4 = 0x510e527f,
  13630. h5 = 0x9b05688c,
  13631. h6 = 0x1f83d9ab,
  13632. h7 = 0x5be0cd19;
  13633. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  13634. var padded = new Uint8Array(paddedLength);
  13635. var i, j, n;
  13636. for (i = 0; i < length; ++i) {
  13637. padded[i] = data[offset++];
  13638. }
  13639. padded[i++] = 0x80;
  13640. n = paddedLength - 8;
  13641. while (i < n) {
  13642. padded[i++] = 0;
  13643. }
  13644. padded[i++] = 0;
  13645. padded[i++] = 0;
  13646. padded[i++] = 0;
  13647. padded[i++] = length >>> 29 & 0xFF;
  13648. padded[i++] = length >> 21 & 0xFF;
  13649. padded[i++] = length >> 13 & 0xFF;
  13650. padded[i++] = length >> 5 & 0xFF;
  13651. padded[i++] = length << 3 & 0xFF;
  13652. var w = new Uint32Array(64);
  13653. for (i = 0; i < paddedLength;) {
  13654. for (j = 0; j < 16; ++j) {
  13655. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13656. i += 4;
  13657. }
  13658. for (j = 16; j < 64; ++j) {
  13659. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  13660. }
  13661. var a = h0,
  13662. b = h1,
  13663. c = h2,
  13664. d = h3,
  13665. e = h4,
  13666. f = h5,
  13667. g = h6,
  13668. h = h7,
  13669. t1,
  13670. t2;
  13671. for (j = 0; j < 64; ++j) {
  13672. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  13673. t2 = sigma(a) + maj(a, b, c);
  13674. h = g;
  13675. g = f;
  13676. f = e;
  13677. e = d + t1 | 0;
  13678. d = c;
  13679. c = b;
  13680. b = a;
  13681. a = t1 + t2 | 0;
  13682. }
  13683. h0 = h0 + a | 0;
  13684. h1 = h1 + b | 0;
  13685. h2 = h2 + c | 0;
  13686. h3 = h3 + d | 0;
  13687. h4 = h4 + e | 0;
  13688. h5 = h5 + f | 0;
  13689. h6 = h6 + g | 0;
  13690. h7 = h7 + h | 0;
  13691. }
  13692. 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]);
  13693. }
  13694. return hash;
  13695. }();
  13696. var calculateSHA512 = function calculateSHA512Closure() {
  13697. function ch(result, x, y, z, tmp) {
  13698. result.assign(x);
  13699. result.and(y);
  13700. tmp.assign(x);
  13701. tmp.not();
  13702. tmp.and(z);
  13703. result.xor(tmp);
  13704. }
  13705. function maj(result, x, y, z, tmp) {
  13706. result.assign(x);
  13707. result.and(y);
  13708. tmp.assign(x);
  13709. tmp.and(z);
  13710. result.xor(tmp);
  13711. tmp.assign(y);
  13712. tmp.and(z);
  13713. result.xor(tmp);
  13714. }
  13715. function sigma(result, x, tmp) {
  13716. result.assign(x);
  13717. result.rotateRight(28);
  13718. tmp.assign(x);
  13719. tmp.rotateRight(34);
  13720. result.xor(tmp);
  13721. tmp.assign(x);
  13722. tmp.rotateRight(39);
  13723. result.xor(tmp);
  13724. }
  13725. function sigmaPrime(result, x, tmp) {
  13726. result.assign(x);
  13727. result.rotateRight(14);
  13728. tmp.assign(x);
  13729. tmp.rotateRight(18);
  13730. result.xor(tmp);
  13731. tmp.assign(x);
  13732. tmp.rotateRight(41);
  13733. result.xor(tmp);
  13734. }
  13735. function littleSigma(result, x, tmp) {
  13736. result.assign(x);
  13737. result.rotateRight(1);
  13738. tmp.assign(x);
  13739. tmp.rotateRight(8);
  13740. result.xor(tmp);
  13741. tmp.assign(x);
  13742. tmp.shiftRight(7);
  13743. result.xor(tmp);
  13744. }
  13745. function littleSigmaPrime(result, x, tmp) {
  13746. result.assign(x);
  13747. result.rotateRight(19);
  13748. tmp.assign(x);
  13749. tmp.rotateRight(61);
  13750. result.xor(tmp);
  13751. tmp.assign(x);
  13752. tmp.shiftRight(6);
  13753. result.xor(tmp);
  13754. }
  13755. 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)];
  13756. function hash(data, offset, length, mode384) {
  13757. mode384 = !!mode384;
  13758. var h0, h1, h2, h3, h4, h5, h6, h7;
  13759. if (!mode384) {
  13760. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  13761. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  13762. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  13763. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  13764. h4 = new Word64(0x510e527f, 0xade682d1);
  13765. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  13766. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  13767. h7 = new Word64(0x5be0cd19, 0x137e2179);
  13768. } else {
  13769. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  13770. h1 = new Word64(0x629a292a, 0x367cd507);
  13771. h2 = new Word64(0x9159015a, 0x3070dd17);
  13772. h3 = new Word64(0x152fecd8, 0xf70e5939);
  13773. h4 = new Word64(0x67332667, 0xffc00b31);
  13774. h5 = new Word64(0x8eb44a87, 0x68581511);
  13775. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  13776. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  13777. }
  13778. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  13779. var padded = new Uint8Array(paddedLength);
  13780. var i, j, n;
  13781. for (i = 0; i < length; ++i) {
  13782. padded[i] = data[offset++];
  13783. }
  13784. padded[i++] = 0x80;
  13785. n = paddedLength - 16;
  13786. while (i < n) {
  13787. padded[i++] = 0;
  13788. }
  13789. padded[i++] = 0;
  13790. padded[i++] = 0;
  13791. padded[i++] = 0;
  13792. padded[i++] = 0;
  13793. padded[i++] = 0;
  13794. padded[i++] = 0;
  13795. padded[i++] = 0;
  13796. padded[i++] = 0;
  13797. padded[i++] = 0;
  13798. padded[i++] = 0;
  13799. padded[i++] = 0;
  13800. padded[i++] = length >>> 29 & 0xFF;
  13801. padded[i++] = length >> 21 & 0xFF;
  13802. padded[i++] = length >> 13 & 0xFF;
  13803. padded[i++] = length >> 5 & 0xFF;
  13804. padded[i++] = length << 3 & 0xFF;
  13805. var w = new Array(80);
  13806. for (i = 0; i < 80; i++) {
  13807. w[i] = new Word64(0, 0);
  13808. }
  13809. var a = new Word64(0, 0),
  13810. b = new Word64(0, 0),
  13811. c = new Word64(0, 0);
  13812. var d = new Word64(0, 0),
  13813. e = new Word64(0, 0),
  13814. f = new Word64(0, 0);
  13815. var g = new Word64(0, 0),
  13816. h = new Word64(0, 0);
  13817. var t1 = new Word64(0, 0),
  13818. t2 = new Word64(0, 0);
  13819. var tmp1 = new Word64(0, 0),
  13820. tmp2 = new Word64(0, 0),
  13821. tmp3;
  13822. for (i = 0; i < paddedLength;) {
  13823. for (j = 0; j < 16; ++j) {
  13824. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13825. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  13826. i += 8;
  13827. }
  13828. for (j = 16; j < 80; ++j) {
  13829. tmp3 = w[j];
  13830. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  13831. tmp3.add(w[j - 7]);
  13832. littleSigma(tmp1, w[j - 15], tmp2);
  13833. tmp3.add(tmp1);
  13834. tmp3.add(w[j - 16]);
  13835. }
  13836. a.assign(h0);
  13837. b.assign(h1);
  13838. c.assign(h2);
  13839. d.assign(h3);
  13840. e.assign(h4);
  13841. f.assign(h5);
  13842. g.assign(h6);
  13843. h.assign(h7);
  13844. for (j = 0; j < 80; ++j) {
  13845. t1.assign(h);
  13846. sigmaPrime(tmp1, e, tmp2);
  13847. t1.add(tmp1);
  13848. ch(tmp1, e, f, g, tmp2);
  13849. t1.add(tmp1);
  13850. t1.add(k[j]);
  13851. t1.add(w[j]);
  13852. sigma(t2, a, tmp2);
  13853. maj(tmp1, a, b, c, tmp2);
  13854. t2.add(tmp1);
  13855. tmp3 = h;
  13856. h = g;
  13857. g = f;
  13858. f = e;
  13859. d.add(t1);
  13860. e = d;
  13861. d = c;
  13862. c = b;
  13863. b = a;
  13864. tmp3.assign(t1);
  13865. tmp3.add(t2);
  13866. a = tmp3;
  13867. }
  13868. h0.add(a);
  13869. h1.add(b);
  13870. h2.add(c);
  13871. h3.add(d);
  13872. h4.add(e);
  13873. h5.add(f);
  13874. h6.add(g);
  13875. h7.add(h);
  13876. }
  13877. var result;
  13878. if (!mode384) {
  13879. result = new Uint8Array(64);
  13880. h0.copyTo(result, 0);
  13881. h1.copyTo(result, 8);
  13882. h2.copyTo(result, 16);
  13883. h3.copyTo(result, 24);
  13884. h4.copyTo(result, 32);
  13885. h5.copyTo(result, 40);
  13886. h6.copyTo(result, 48);
  13887. h7.copyTo(result, 56);
  13888. } else {
  13889. result = new Uint8Array(48);
  13890. h0.copyTo(result, 0);
  13891. h1.copyTo(result, 8);
  13892. h2.copyTo(result, 16);
  13893. h3.copyTo(result, 24);
  13894. h4.copyTo(result, 32);
  13895. h5.copyTo(result, 40);
  13896. }
  13897. return result;
  13898. }
  13899. return hash;
  13900. }();
  13901. var calculateSHA384 = function calculateSHA384Closure() {
  13902. function hash(data, offset, length) {
  13903. return calculateSHA512(data, offset, length, true);
  13904. }
  13905. return hash;
  13906. }();
  13907. var NullCipher = function NullCipherClosure() {
  13908. function NullCipher() {}
  13909. NullCipher.prototype = {
  13910. decryptBlock: function NullCipher_decryptBlock(data) {
  13911. return data;
  13912. }
  13913. };
  13914. return NullCipher;
  13915. }();
  13916. var AES128Cipher = function AES128CipherClosure() {
  13917. var 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]);
  13918. var 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]);
  13919. var 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]);
  13920. var mixCol = new Uint8Array(256);
  13921. for (var i = 0; i < 256; i++) {
  13922. if (i < 128) {
  13923. mixCol[i] = i << 1;
  13924. } else {
  13925. mixCol[i] = i << 1 ^ 0x1b;
  13926. }
  13927. }
  13928. var 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]);
  13929. function expandKey128(cipherKey) {
  13930. var b = 176,
  13931. result = new Uint8Array(b);
  13932. result.set(cipherKey);
  13933. for (var j = 16, i = 1; j < b; ++i) {
  13934. var t1 = result[j - 3],
  13935. t2 = result[j - 2],
  13936. t3 = result[j - 1],
  13937. t4 = result[j - 4];
  13938. t1 = s[t1];
  13939. t2 = s[t2];
  13940. t3 = s[t3];
  13941. t4 = s[t4];
  13942. t1 = t1 ^ rcon[i];
  13943. for (var n = 0; n < 4; ++n) {
  13944. result[j] = t1 ^= result[j - 16];
  13945. j++;
  13946. result[j] = t2 ^= result[j - 16];
  13947. j++;
  13948. result[j] = t3 ^= result[j - 16];
  13949. j++;
  13950. result[j] = t4 ^= result[j - 16];
  13951. j++;
  13952. }
  13953. }
  13954. return result;
  13955. }
  13956. function decrypt128(input, key) {
  13957. var state = new Uint8Array(16);
  13958. state.set(input);
  13959. var i, j, k;
  13960. var t, u, v;
  13961. for (j = 0, k = 160; j < 16; ++j, ++k) {
  13962. state[j] ^= key[k];
  13963. }
  13964. for (i = 9; i >= 1; --i) {
  13965. t = state[13];
  13966. state[13] = state[9];
  13967. state[9] = state[5];
  13968. state[5] = state[1];
  13969. state[1] = t;
  13970. t = state[14];
  13971. u = state[10];
  13972. state[14] = state[6];
  13973. state[10] = state[2];
  13974. state[6] = t;
  13975. state[2] = u;
  13976. t = state[15];
  13977. u = state[11];
  13978. v = state[7];
  13979. state[15] = state[3];
  13980. state[11] = t;
  13981. state[7] = u;
  13982. state[3] = v;
  13983. for (j = 0; j < 16; ++j) {
  13984. state[j] = inv_s[state[j]];
  13985. }
  13986. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  13987. state[j] ^= key[k];
  13988. }
  13989. for (j = 0; j < 16; j += 4) {
  13990. var s0 = mix[state[j]],
  13991. s1 = mix[state[j + 1]],
  13992. s2 = mix[state[j + 2]],
  13993. s3 = mix[state[j + 3]];
  13994. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  13995. state[j] = t >>> 24 & 0xFF;
  13996. state[j + 1] = t >> 16 & 0xFF;
  13997. state[j + 2] = t >> 8 & 0xFF;
  13998. state[j + 3] = t & 0xFF;
  13999. }
  14000. }
  14001. t = state[13];
  14002. state[13] = state[9];
  14003. state[9] = state[5];
  14004. state[5] = state[1];
  14005. state[1] = t;
  14006. t = state[14];
  14007. u = state[10];
  14008. state[14] = state[6];
  14009. state[10] = state[2];
  14010. state[6] = t;
  14011. state[2] = u;
  14012. t = state[15];
  14013. u = state[11];
  14014. v = state[7];
  14015. state[15] = state[3];
  14016. state[11] = t;
  14017. state[7] = u;
  14018. state[3] = v;
  14019. for (j = 0; j < 16; ++j) {
  14020. state[j] = inv_s[state[j]];
  14021. state[j] ^= key[j];
  14022. }
  14023. return state;
  14024. }
  14025. function encrypt128(input, key) {
  14026. var t, u, v, k;
  14027. var state = new Uint8Array(16);
  14028. state.set(input);
  14029. for (j = 0; j < 16; ++j) {
  14030. state[j] ^= key[j];
  14031. }
  14032. for (i = 1; i < 10; i++) {
  14033. for (j = 0; j < 16; ++j) {
  14034. state[j] = s[state[j]];
  14035. }
  14036. v = state[1];
  14037. state[1] = state[5];
  14038. state[5] = state[9];
  14039. state[9] = state[13];
  14040. state[13] = v;
  14041. v = state[2];
  14042. u = state[6];
  14043. state[2] = state[10];
  14044. state[6] = state[14];
  14045. state[10] = v;
  14046. state[14] = u;
  14047. v = state[3];
  14048. u = state[7];
  14049. t = state[11];
  14050. state[3] = state[15];
  14051. state[7] = v;
  14052. state[11] = u;
  14053. state[15] = t;
  14054. for (var j = 0; j < 16; j += 4) {
  14055. var s0 = state[j + 0],
  14056. s1 = state[j + 1];
  14057. var s2 = state[j + 2],
  14058. s3 = state[j + 3];
  14059. t = s0 ^ s1 ^ s2 ^ s3;
  14060. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  14061. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  14062. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  14063. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  14064. }
  14065. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  14066. state[j] ^= key[k];
  14067. }
  14068. }
  14069. for (j = 0; j < 16; ++j) {
  14070. state[j] = s[state[j]];
  14071. }
  14072. v = state[1];
  14073. state[1] = state[5];
  14074. state[5] = state[9];
  14075. state[9] = state[13];
  14076. state[13] = v;
  14077. v = state[2];
  14078. u = state[6];
  14079. state[2] = state[10];
  14080. state[6] = state[14];
  14081. state[10] = v;
  14082. state[14] = u;
  14083. v = state[3];
  14084. u = state[7];
  14085. t = state[11];
  14086. state[3] = state[15];
  14087. state[7] = v;
  14088. state[11] = u;
  14089. state[15] = t;
  14090. for (j = 0, k = 160; j < 16; ++j, ++k) {
  14091. state[j] ^= key[k];
  14092. }
  14093. return state;
  14094. }
  14095. function AES128Cipher(key) {
  14096. this.key = expandKey128(key);
  14097. this.buffer = new Uint8Array(16);
  14098. this.bufferPosition = 0;
  14099. }
  14100. function decryptBlock2(data, finalize) {
  14101. var i,
  14102. j,
  14103. ii,
  14104. sourceLength = data.length,
  14105. buffer = this.buffer,
  14106. bufferLength = this.bufferPosition,
  14107. result = [],
  14108. iv = this.iv;
  14109. for (i = 0; i < sourceLength; ++i) {
  14110. buffer[bufferLength] = data[i];
  14111. ++bufferLength;
  14112. if (bufferLength < 16) {
  14113. continue;
  14114. }
  14115. var plain = decrypt128(buffer, this.key);
  14116. for (j = 0; j < 16; ++j) {
  14117. plain[j] ^= iv[j];
  14118. }
  14119. iv = buffer;
  14120. result.push(plain);
  14121. buffer = new Uint8Array(16);
  14122. bufferLength = 0;
  14123. }
  14124. this.buffer = buffer;
  14125. this.bufferLength = bufferLength;
  14126. this.iv = iv;
  14127. if (result.length === 0) {
  14128. return new Uint8Array([]);
  14129. }
  14130. var outputLength = 16 * result.length;
  14131. if (finalize) {
  14132. var lastBlock = result[result.length - 1];
  14133. var psLen = lastBlock[15];
  14134. if (psLen <= 16) {
  14135. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  14136. if (lastBlock[i] !== psLen) {
  14137. psLen = 0;
  14138. break;
  14139. }
  14140. }
  14141. outputLength -= psLen;
  14142. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  14143. }
  14144. }
  14145. var output = new Uint8Array(outputLength);
  14146. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14147. output.set(result[i], j);
  14148. }
  14149. return output;
  14150. }
  14151. AES128Cipher.prototype = {
  14152. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  14153. var i,
  14154. sourceLength = data.length;
  14155. var buffer = this.buffer,
  14156. bufferLength = this.bufferPosition;
  14157. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  14158. buffer[bufferLength] = data[i];
  14159. }
  14160. if (bufferLength < 16) {
  14161. this.bufferLength = bufferLength;
  14162. return new Uint8Array([]);
  14163. }
  14164. this.iv = buffer;
  14165. this.buffer = new Uint8Array(16);
  14166. this.bufferLength = 0;
  14167. this.decryptBlock = decryptBlock2;
  14168. return this.decryptBlock(data.subarray(16), finalize);
  14169. },
  14170. encrypt: function AES128Cipher_encrypt(data, iv) {
  14171. var i,
  14172. j,
  14173. ii,
  14174. sourceLength = data.length,
  14175. buffer = this.buffer,
  14176. bufferLength = this.bufferPosition,
  14177. result = [];
  14178. if (!iv) {
  14179. iv = new Uint8Array(16);
  14180. }
  14181. for (i = 0; i < sourceLength; ++i) {
  14182. buffer[bufferLength] = data[i];
  14183. ++bufferLength;
  14184. if (bufferLength < 16) {
  14185. continue;
  14186. }
  14187. for (j = 0; j < 16; ++j) {
  14188. buffer[j] ^= iv[j];
  14189. }
  14190. var cipher = encrypt128(buffer, this.key);
  14191. iv = cipher;
  14192. result.push(cipher);
  14193. buffer = new Uint8Array(16);
  14194. bufferLength = 0;
  14195. }
  14196. this.buffer = buffer;
  14197. this.bufferLength = bufferLength;
  14198. this.iv = iv;
  14199. if (result.length === 0) {
  14200. return new Uint8Array([]);
  14201. }
  14202. var outputLength = 16 * result.length;
  14203. var output = new Uint8Array(outputLength);
  14204. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14205. output.set(result[i], j);
  14206. }
  14207. return output;
  14208. }
  14209. };
  14210. return AES128Cipher;
  14211. }();
  14212. var AES256Cipher = function AES256CipherClosure() {
  14213. var 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]);
  14214. var 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]);
  14215. var mixCol = new Uint8Array(256);
  14216. for (var i = 0; i < 256; i++) {
  14217. if (i < 128) {
  14218. mixCol[i] = i << 1;
  14219. } else {
  14220. mixCol[i] = i << 1 ^ 0x1b;
  14221. }
  14222. }
  14223. var 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]);
  14224. function expandKey256(cipherKey) {
  14225. var b = 240,
  14226. result = new Uint8Array(b);
  14227. var r = 1;
  14228. result.set(cipherKey);
  14229. for (var j = 32, i = 1; j < b; ++i) {
  14230. if (j % 32 === 16) {
  14231. t1 = s[t1];
  14232. t2 = s[t2];
  14233. t3 = s[t3];
  14234. t4 = s[t4];
  14235. } else if (j % 32 === 0) {
  14236. var t1 = result[j - 3],
  14237. t2 = result[j - 2],
  14238. t3 = result[j - 1],
  14239. t4 = result[j - 4];
  14240. t1 = s[t1];
  14241. t2 = s[t2];
  14242. t3 = s[t3];
  14243. t4 = s[t4];
  14244. t1 = t1 ^ r;
  14245. if ((r <<= 1) >= 256) {
  14246. r = (r ^ 0x1b) & 0xFF;
  14247. }
  14248. }
  14249. for (var n = 0; n < 4; ++n) {
  14250. result[j] = t1 ^= result[j - 32];
  14251. j++;
  14252. result[j] = t2 ^= result[j - 32];
  14253. j++;
  14254. result[j] = t3 ^= result[j - 32];
  14255. j++;
  14256. result[j] = t4 ^= result[j - 32];
  14257. j++;
  14258. }
  14259. }
  14260. return result;
  14261. }
  14262. function decrypt256(input, key) {
  14263. var state = new Uint8Array(16);
  14264. state.set(input);
  14265. var i, j, k;
  14266. var t, u, v;
  14267. for (j = 0, k = 224; j < 16; ++j, ++k) {
  14268. state[j] ^= key[k];
  14269. }
  14270. for (i = 13; i >= 1; --i) {
  14271. t = state[13];
  14272. state[13] = state[9];
  14273. state[9] = state[5];
  14274. state[5] = state[1];
  14275. state[1] = t;
  14276. t = state[14];
  14277. u = state[10];
  14278. state[14] = state[6];
  14279. state[10] = state[2];
  14280. state[6] = t;
  14281. state[2] = u;
  14282. t = state[15];
  14283. u = state[11];
  14284. v = state[7];
  14285. state[15] = state[3];
  14286. state[11] = t;
  14287. state[7] = u;
  14288. state[3] = v;
  14289. for (j = 0; j < 16; ++j) {
  14290. state[j] = inv_s[state[j]];
  14291. }
  14292. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  14293. state[j] ^= key[k];
  14294. }
  14295. for (j = 0; j < 16; j += 4) {
  14296. var s0 = mix[state[j]],
  14297. s1 = mix[state[j + 1]],
  14298. s2 = mix[state[j + 2]],
  14299. s3 = mix[state[j + 3]];
  14300. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  14301. state[j] = t >>> 24 & 0xFF;
  14302. state[j + 1] = t >> 16 & 0xFF;
  14303. state[j + 2] = t >> 8 & 0xFF;
  14304. state[j + 3] = t & 0xFF;
  14305. }
  14306. }
  14307. t = state[13];
  14308. state[13] = state[9];
  14309. state[9] = state[5];
  14310. state[5] = state[1];
  14311. state[1] = t;
  14312. t = state[14];
  14313. u = state[10];
  14314. state[14] = state[6];
  14315. state[10] = state[2];
  14316. state[6] = t;
  14317. state[2] = u;
  14318. t = state[15];
  14319. u = state[11];
  14320. v = state[7];
  14321. state[15] = state[3];
  14322. state[11] = t;
  14323. state[7] = u;
  14324. state[3] = v;
  14325. for (j = 0; j < 16; ++j) {
  14326. state[j] = inv_s[state[j]];
  14327. state[j] ^= key[j];
  14328. }
  14329. return state;
  14330. }
  14331. function encrypt256(input, key) {
  14332. var t, u, v, k;
  14333. var state = new Uint8Array(16);
  14334. state.set(input);
  14335. for (j = 0; j < 16; ++j) {
  14336. state[j] ^= key[j];
  14337. }
  14338. for (i = 1; i < 14; i++) {
  14339. for (j = 0; j < 16; ++j) {
  14340. state[j] = s[state[j]];
  14341. }
  14342. v = state[1];
  14343. state[1] = state[5];
  14344. state[5] = state[9];
  14345. state[9] = state[13];
  14346. state[13] = v;
  14347. v = state[2];
  14348. u = state[6];
  14349. state[2] = state[10];
  14350. state[6] = state[14];
  14351. state[10] = v;
  14352. state[14] = u;
  14353. v = state[3];
  14354. u = state[7];
  14355. t = state[11];
  14356. state[3] = state[15];
  14357. state[7] = v;
  14358. state[11] = u;
  14359. state[15] = t;
  14360. for (var j = 0; j < 16; j += 4) {
  14361. var s0 = state[j + 0],
  14362. s1 = state[j + 1];
  14363. var s2 = state[j + 2],
  14364. s3 = state[j + 3];
  14365. t = s0 ^ s1 ^ s2 ^ s3;
  14366. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  14367. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  14368. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  14369. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  14370. }
  14371. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  14372. state[j] ^= key[k];
  14373. }
  14374. }
  14375. for (j = 0; j < 16; ++j) {
  14376. state[j] = s[state[j]];
  14377. }
  14378. v = state[1];
  14379. state[1] = state[5];
  14380. state[5] = state[9];
  14381. state[9] = state[13];
  14382. state[13] = v;
  14383. v = state[2];
  14384. u = state[6];
  14385. state[2] = state[10];
  14386. state[6] = state[14];
  14387. state[10] = v;
  14388. state[14] = u;
  14389. v = state[3];
  14390. u = state[7];
  14391. t = state[11];
  14392. state[3] = state[15];
  14393. state[7] = v;
  14394. state[11] = u;
  14395. state[15] = t;
  14396. for (j = 0, k = 224; j < 16; ++j, ++k) {
  14397. state[j] ^= key[k];
  14398. }
  14399. return state;
  14400. }
  14401. function AES256Cipher(key) {
  14402. this.key = expandKey256(key);
  14403. this.buffer = new Uint8Array(16);
  14404. this.bufferPosition = 0;
  14405. }
  14406. function decryptBlock2(data, finalize) {
  14407. var i,
  14408. j,
  14409. ii,
  14410. sourceLength = data.length,
  14411. buffer = this.buffer,
  14412. bufferLength = this.bufferPosition,
  14413. result = [],
  14414. iv = this.iv;
  14415. for (i = 0; i < sourceLength; ++i) {
  14416. buffer[bufferLength] = data[i];
  14417. ++bufferLength;
  14418. if (bufferLength < 16) {
  14419. continue;
  14420. }
  14421. var plain = decrypt256(buffer, this.key);
  14422. for (j = 0; j < 16; ++j) {
  14423. plain[j] ^= iv[j];
  14424. }
  14425. iv = buffer;
  14426. result.push(plain);
  14427. buffer = new Uint8Array(16);
  14428. bufferLength = 0;
  14429. }
  14430. this.buffer = buffer;
  14431. this.bufferLength = bufferLength;
  14432. this.iv = iv;
  14433. if (result.length === 0) {
  14434. return new Uint8Array([]);
  14435. }
  14436. var outputLength = 16 * result.length;
  14437. if (finalize) {
  14438. var lastBlock = result[result.length - 1];
  14439. var psLen = lastBlock[15];
  14440. if (psLen <= 16) {
  14441. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  14442. if (lastBlock[i] !== psLen) {
  14443. psLen = 0;
  14444. break;
  14445. }
  14446. }
  14447. outputLength -= psLen;
  14448. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  14449. }
  14450. }
  14451. var output = new Uint8Array(outputLength);
  14452. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14453. output.set(result[i], j);
  14454. }
  14455. return output;
  14456. }
  14457. AES256Cipher.prototype = {
  14458. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  14459. var i,
  14460. sourceLength = data.length;
  14461. var buffer = this.buffer,
  14462. bufferLength = this.bufferPosition;
  14463. if (iv) {
  14464. this.iv = iv;
  14465. } else {
  14466. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  14467. buffer[bufferLength] = data[i];
  14468. }
  14469. if (bufferLength < 16) {
  14470. this.bufferLength = bufferLength;
  14471. return new Uint8Array([]);
  14472. }
  14473. this.iv = buffer;
  14474. data = data.subarray(16);
  14475. }
  14476. this.buffer = new Uint8Array(16);
  14477. this.bufferLength = 0;
  14478. this.decryptBlock = decryptBlock2;
  14479. return this.decryptBlock(data, finalize);
  14480. },
  14481. encrypt: function AES256Cipher_encrypt(data, iv) {
  14482. var i,
  14483. j,
  14484. ii,
  14485. sourceLength = data.length,
  14486. buffer = this.buffer,
  14487. bufferLength = this.bufferPosition,
  14488. result = [];
  14489. if (!iv) {
  14490. iv = new Uint8Array(16);
  14491. }
  14492. for (i = 0; i < sourceLength; ++i) {
  14493. buffer[bufferLength] = data[i];
  14494. ++bufferLength;
  14495. if (bufferLength < 16) {
  14496. continue;
  14497. }
  14498. for (j = 0; j < 16; ++j) {
  14499. buffer[j] ^= iv[j];
  14500. }
  14501. var cipher = encrypt256(buffer, this.key);
  14502. this.iv = cipher;
  14503. result.push(cipher);
  14504. buffer = new Uint8Array(16);
  14505. bufferLength = 0;
  14506. }
  14507. this.buffer = buffer;
  14508. this.bufferLength = bufferLength;
  14509. this.iv = iv;
  14510. if (result.length === 0) {
  14511. return new Uint8Array([]);
  14512. }
  14513. var outputLength = 16 * result.length;
  14514. var output = new Uint8Array(outputLength);
  14515. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14516. output.set(result[i], j);
  14517. }
  14518. return output;
  14519. }
  14520. };
  14521. return AES256Cipher;
  14522. }();
  14523. var PDF17 = function PDF17Closure() {
  14524. function compareByteArrays(array1, array2) {
  14525. if (array1.length !== array2.length) {
  14526. return false;
  14527. }
  14528. for (var i = 0; i < array1.length; i++) {
  14529. if (array1[i] !== array2[i]) {
  14530. return false;
  14531. }
  14532. }
  14533. return true;
  14534. }
  14535. function PDF17() {}
  14536. PDF17.prototype = {
  14537. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  14538. var hashData = new Uint8Array(password.length + 56);
  14539. hashData.set(password, 0);
  14540. hashData.set(ownerValidationSalt, password.length);
  14541. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  14542. var result = calculateSHA256(hashData, 0, hashData.length);
  14543. return compareByteArrays(result, ownerPassword);
  14544. },
  14545. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  14546. var hashData = new Uint8Array(password.length + 8);
  14547. hashData.set(password, 0);
  14548. hashData.set(userValidationSalt, password.length);
  14549. var result = calculateSHA256(hashData, 0, hashData.length);
  14550. return compareByteArrays(result, userPassword);
  14551. },
  14552. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  14553. var hashData = new Uint8Array(password.length + 56);
  14554. hashData.set(password, 0);
  14555. hashData.set(ownerKeySalt, password.length);
  14556. hashData.set(userBytes, password.length + ownerKeySalt.length);
  14557. var key = calculateSHA256(hashData, 0, hashData.length);
  14558. var cipher = new AES256Cipher(key);
  14559. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  14560. },
  14561. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  14562. var hashData = new Uint8Array(password.length + 8);
  14563. hashData.set(password, 0);
  14564. hashData.set(userKeySalt, password.length);
  14565. var key = calculateSHA256(hashData, 0, hashData.length);
  14566. var cipher = new AES256Cipher(key);
  14567. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  14568. }
  14569. };
  14570. return PDF17;
  14571. }();
  14572. var PDF20 = function PDF20Closure() {
  14573. function concatArrays(array1, array2) {
  14574. var t = new Uint8Array(array1.length + array2.length);
  14575. t.set(array1, 0);
  14576. t.set(array2, array1.length);
  14577. return t;
  14578. }
  14579. function calculatePDF20Hash(password, input, userBytes) {
  14580. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  14581. var e = [0];
  14582. var i = 0;
  14583. while (i < 64 || e[e.length - 1] > i - 32) {
  14584. var arrayLength = password.length + k.length + userBytes.length;
  14585. var k1 = new Uint8Array(arrayLength * 64);
  14586. var array = concatArrays(password, k);
  14587. array = concatArrays(array, userBytes);
  14588. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  14589. k1.set(array, pos);
  14590. }
  14591. var cipher = new AES128Cipher(k.subarray(0, 16));
  14592. e = cipher.encrypt(k1, k.subarray(16, 32));
  14593. var remainder = 0;
  14594. for (var z = 0; z < 16; z++) {
  14595. remainder *= 256 % 3;
  14596. remainder %= 3;
  14597. remainder += (e[z] >>> 0) % 3;
  14598. remainder %= 3;
  14599. }
  14600. if (remainder === 0) {
  14601. k = calculateSHA256(e, 0, e.length);
  14602. } else if (remainder === 1) {
  14603. k = calculateSHA384(e, 0, e.length);
  14604. } else if (remainder === 2) {
  14605. k = calculateSHA512(e, 0, e.length);
  14606. }
  14607. i++;
  14608. }
  14609. return k.subarray(0, 32);
  14610. }
  14611. function PDF20() {}
  14612. function compareByteArrays(array1, array2) {
  14613. if (array1.length !== array2.length) {
  14614. return false;
  14615. }
  14616. for (var i = 0; i < array1.length; i++) {
  14617. if (array1[i] !== array2[i]) {
  14618. return false;
  14619. }
  14620. }
  14621. return true;
  14622. }
  14623. PDF20.prototype = {
  14624. hash: function PDF20_hash(password, concatBytes, userBytes) {
  14625. return calculatePDF20Hash(password, concatBytes, userBytes);
  14626. },
  14627. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  14628. var hashData = new Uint8Array(password.length + 56);
  14629. hashData.set(password, 0);
  14630. hashData.set(ownerValidationSalt, password.length);
  14631. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  14632. var result = calculatePDF20Hash(password, hashData, userBytes);
  14633. return compareByteArrays(result, ownerPassword);
  14634. },
  14635. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  14636. var hashData = new Uint8Array(password.length + 8);
  14637. hashData.set(password, 0);
  14638. hashData.set(userValidationSalt, password.length);
  14639. var result = calculatePDF20Hash(password, hashData, []);
  14640. return compareByteArrays(result, userPassword);
  14641. },
  14642. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  14643. var hashData = new Uint8Array(password.length + 56);
  14644. hashData.set(password, 0);
  14645. hashData.set(ownerKeySalt, password.length);
  14646. hashData.set(userBytes, password.length + ownerKeySalt.length);
  14647. var key = calculatePDF20Hash(password, hashData, userBytes);
  14648. var cipher = new AES256Cipher(key);
  14649. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  14650. },
  14651. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  14652. var hashData = new Uint8Array(password.length + 8);
  14653. hashData.set(password, 0);
  14654. hashData.set(userKeySalt, password.length);
  14655. var key = calculatePDF20Hash(password, hashData, []);
  14656. var cipher = new AES256Cipher(key);
  14657. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  14658. }
  14659. };
  14660. return PDF20;
  14661. }();
  14662. var CipherTransform = function CipherTransformClosure() {
  14663. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  14664. this.StringCipherConstructor = stringCipherConstructor;
  14665. this.StreamCipherConstructor = streamCipherConstructor;
  14666. }
  14667. CipherTransform.prototype = {
  14668. createStream: function CipherTransform_createStream(stream, length) {
  14669. var cipher = new this.StreamCipherConstructor();
  14670. return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  14671. return cipher.decryptBlock(data, finalize);
  14672. });
  14673. },
  14674. decryptString: function CipherTransform_decryptString(s) {
  14675. var cipher = new this.StringCipherConstructor();
  14676. var data = (0, _util.stringToBytes)(s);
  14677. data = cipher.decryptBlock(data, true);
  14678. return (0, _util.bytesToString)(data);
  14679. }
  14680. };
  14681. return CipherTransform;
  14682. }();
  14683. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  14684. 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]);
  14685. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  14686. if (password) {
  14687. var passwordLength = Math.min(127, password.length);
  14688. password = password.subarray(0, passwordLength);
  14689. } else {
  14690. password = [];
  14691. }
  14692. var pdfAlgorithm;
  14693. if (revision === 6) {
  14694. pdfAlgorithm = new PDF20();
  14695. } else {
  14696. pdfAlgorithm = new PDF17();
  14697. }
  14698. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  14699. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  14700. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  14701. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  14702. }
  14703. return null;
  14704. }
  14705. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  14706. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  14707. var hashData = new Uint8Array(hashDataSize),
  14708. i = 0,
  14709. j,
  14710. n;
  14711. if (password) {
  14712. n = Math.min(32, password.length);
  14713. for (; i < n; ++i) {
  14714. hashData[i] = password[i];
  14715. }
  14716. }
  14717. j = 0;
  14718. while (i < 32) {
  14719. hashData[i++] = defaultPasswordBytes[j++];
  14720. }
  14721. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  14722. hashData[i++] = ownerPassword[j];
  14723. }
  14724. hashData[i++] = flags & 0xFF;
  14725. hashData[i++] = flags >> 8 & 0xFF;
  14726. hashData[i++] = flags >> 16 & 0xFF;
  14727. hashData[i++] = flags >>> 24 & 0xFF;
  14728. for (j = 0, n = fileId.length; j < n; ++j) {
  14729. hashData[i++] = fileId[j];
  14730. }
  14731. if (revision >= 4 && !encryptMetadata) {
  14732. hashData[i++] = 0xFF;
  14733. hashData[i++] = 0xFF;
  14734. hashData[i++] = 0xFF;
  14735. hashData[i++] = 0xFF;
  14736. }
  14737. var hash = calculateMD5(hashData, 0, i);
  14738. var keyLengthInBytes = keyLength >> 3;
  14739. if (revision >= 3) {
  14740. for (j = 0; j < 50; ++j) {
  14741. hash = calculateMD5(hash, 0, keyLengthInBytes);
  14742. }
  14743. }
  14744. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  14745. var cipher, checkData;
  14746. if (revision >= 3) {
  14747. for (i = 0; i < 32; ++i) {
  14748. hashData[i] = defaultPasswordBytes[i];
  14749. }
  14750. for (j = 0, n = fileId.length; j < n; ++j) {
  14751. hashData[i++] = fileId[j];
  14752. }
  14753. cipher = new ARCFourCipher(encryptionKey);
  14754. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  14755. n = encryptionKey.length;
  14756. var derivedKey = new Uint8Array(n),
  14757. k;
  14758. for (j = 1; j <= 19; ++j) {
  14759. for (k = 0; k < n; ++k) {
  14760. derivedKey[k] = encryptionKey[k] ^ j;
  14761. }
  14762. cipher = new ARCFourCipher(derivedKey);
  14763. checkData = cipher.encryptBlock(checkData);
  14764. }
  14765. for (j = 0, n = checkData.length; j < n; ++j) {
  14766. if (userPassword[j] !== checkData[j]) {
  14767. return null;
  14768. }
  14769. }
  14770. } else {
  14771. cipher = new ARCFourCipher(encryptionKey);
  14772. checkData = cipher.encryptBlock(defaultPasswordBytes);
  14773. for (j = 0, n = checkData.length; j < n; ++j) {
  14774. if (userPassword[j] !== checkData[j]) {
  14775. return null;
  14776. }
  14777. }
  14778. }
  14779. return encryptionKey;
  14780. }
  14781. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  14782. var hashData = new Uint8Array(32),
  14783. i = 0,
  14784. j,
  14785. n;
  14786. n = Math.min(32, password.length);
  14787. for (; i < n; ++i) {
  14788. hashData[i] = password[i];
  14789. }
  14790. j = 0;
  14791. while (i < 32) {
  14792. hashData[i++] = defaultPasswordBytes[j++];
  14793. }
  14794. var hash = calculateMD5(hashData, 0, i);
  14795. var keyLengthInBytes = keyLength >> 3;
  14796. if (revision >= 3) {
  14797. for (j = 0; j < 50; ++j) {
  14798. hash = calculateMD5(hash, 0, hash.length);
  14799. }
  14800. }
  14801. var cipher, userPassword;
  14802. if (revision >= 3) {
  14803. userPassword = ownerPassword;
  14804. var derivedKey = new Uint8Array(keyLengthInBytes),
  14805. k;
  14806. for (j = 19; j >= 0; j--) {
  14807. for (k = 0; k < keyLengthInBytes; ++k) {
  14808. derivedKey[k] = hash[k] ^ j;
  14809. }
  14810. cipher = new ARCFourCipher(derivedKey);
  14811. userPassword = cipher.encryptBlock(userPassword);
  14812. }
  14813. } else {
  14814. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  14815. userPassword = cipher.encryptBlock(ownerPassword);
  14816. }
  14817. return userPassword;
  14818. }
  14819. var identityName = _primitives.Name.get('Identity');
  14820. function CipherTransformFactory(dict, fileId, password) {
  14821. var filter = dict.get('Filter');
  14822. if (!(0, _primitives.isName)(filter, 'Standard')) {
  14823. (0, _util.error)('unknown encryption method');
  14824. }
  14825. this.dict = dict;
  14826. var algorithm = dict.get('V');
  14827. if (!(0, _util.isInt)(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  14828. (0, _util.error)('unsupported encryption algorithm');
  14829. }
  14830. this.algorithm = algorithm;
  14831. var keyLength = dict.get('Length');
  14832. if (!keyLength) {
  14833. if (algorithm <= 3) {
  14834. keyLength = 40;
  14835. } else {
  14836. var cfDict = dict.get('CF');
  14837. var streamCryptoName = dict.get('StmF');
  14838. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  14839. cfDict.suppressEncryption = true;
  14840. var handlerDict = cfDict.get(streamCryptoName.name);
  14841. keyLength = handlerDict && handlerDict.get('Length') || 128;
  14842. if (keyLength < 40) {
  14843. keyLength <<= 3;
  14844. }
  14845. }
  14846. }
  14847. }
  14848. if (!(0, _util.isInt)(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  14849. (0, _util.error)('invalid key length');
  14850. }
  14851. var ownerPassword = (0, _util.stringToBytes)(dict.get('O')).subarray(0, 32);
  14852. var userPassword = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 32);
  14853. var flags = dict.get('P');
  14854. var revision = dict.get('R');
  14855. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  14856. this.encryptMetadata = encryptMetadata;
  14857. var fileIdBytes = (0, _util.stringToBytes)(fileId);
  14858. var passwordBytes;
  14859. if (password) {
  14860. if (revision === 6) {
  14861. try {
  14862. password = (0, _util.utf8StringToString)(password);
  14863. } catch (ex) {
  14864. (0, _util.warn)('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  14865. }
  14866. }
  14867. passwordBytes = (0, _util.stringToBytes)(password);
  14868. }
  14869. var encryptionKey;
  14870. if (algorithm !== 5) {
  14871. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  14872. } else {
  14873. var ownerValidationSalt = (0, _util.stringToBytes)(dict.get('O')).subarray(32, 40);
  14874. var ownerKeySalt = (0, _util.stringToBytes)(dict.get('O')).subarray(40, 48);
  14875. var uBytes = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 48);
  14876. var userValidationSalt = (0, _util.stringToBytes)(dict.get('U')).subarray(32, 40);
  14877. var userKeySalt = (0, _util.stringToBytes)(dict.get('U')).subarray(40, 48);
  14878. var ownerEncryption = (0, _util.stringToBytes)(dict.get('OE'));
  14879. var userEncryption = (0, _util.stringToBytes)(dict.get('UE'));
  14880. var perms = (0, _util.stringToBytes)(dict.get('Perms'));
  14881. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  14882. }
  14883. if (!encryptionKey && !password) {
  14884. throw new _util.PasswordException('No password given', _util.PasswordResponses.NEED_PASSWORD);
  14885. } else if (!encryptionKey && password) {
  14886. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  14887. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  14888. }
  14889. if (!encryptionKey) {
  14890. throw new _util.PasswordException('Incorrect Password', _util.PasswordResponses.INCORRECT_PASSWORD);
  14891. }
  14892. this.encryptionKey = encryptionKey;
  14893. if (algorithm >= 4) {
  14894. var cf = dict.get('CF');
  14895. if ((0, _primitives.isDict)(cf)) {
  14896. cf.suppressEncryption = true;
  14897. }
  14898. this.cf = cf;
  14899. this.stmf = dict.get('StmF') || identityName;
  14900. this.strf = dict.get('StrF') || identityName;
  14901. this.eff = dict.get('EFF') || this.stmf;
  14902. }
  14903. }
  14904. function buildObjectKey(num, gen, encryptionKey, isAes) {
  14905. var key = new Uint8Array(encryptionKey.length + 9),
  14906. i,
  14907. n;
  14908. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  14909. key[i] = encryptionKey[i];
  14910. }
  14911. key[i++] = num & 0xFF;
  14912. key[i++] = num >> 8 & 0xFF;
  14913. key[i++] = num >> 16 & 0xFF;
  14914. key[i++] = gen & 0xFF;
  14915. key[i++] = gen >> 8 & 0xFF;
  14916. if (isAes) {
  14917. key[i++] = 0x73;
  14918. key[i++] = 0x41;
  14919. key[i++] = 0x6C;
  14920. key[i++] = 0x54;
  14921. }
  14922. var hash = calculateMD5(key, 0, i);
  14923. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  14924. }
  14925. function buildCipherConstructor(cf, name, num, gen, key) {
  14926. (0, _util.assert)((0, _primitives.isName)(name), 'Invalid crypt filter name.');
  14927. var cryptFilter = cf.get(name.name);
  14928. var cfm;
  14929. if (cryptFilter !== null && cryptFilter !== undefined) {
  14930. cfm = cryptFilter.get('CFM');
  14931. }
  14932. if (!cfm || cfm.name === 'None') {
  14933. return function cipherTransformFactoryBuildCipherConstructorNone() {
  14934. return new NullCipher();
  14935. };
  14936. }
  14937. if (cfm.name === 'V2') {
  14938. return function cipherTransformFactoryBuildCipherConstructorV2() {
  14939. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  14940. };
  14941. }
  14942. if (cfm.name === 'AESV2') {
  14943. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  14944. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  14945. };
  14946. }
  14947. if (cfm.name === 'AESV3') {
  14948. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  14949. return new AES256Cipher(key);
  14950. };
  14951. }
  14952. (0, _util.error)('Unknown crypto method');
  14953. }
  14954. CipherTransformFactory.prototype = {
  14955. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  14956. if (this.algorithm === 4 || this.algorithm === 5) {
  14957. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  14958. }
  14959. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  14960. var cipherConstructor = function buildCipherCipherConstructor() {
  14961. return new ARCFourCipher(key);
  14962. };
  14963. return new CipherTransform(cipherConstructor, cipherConstructor);
  14964. }
  14965. };
  14966. return CipherTransformFactory;
  14967. }();
  14968. exports.AES128Cipher = AES128Cipher;
  14969. exports.AES256Cipher = AES256Cipher;
  14970. exports.ARCFourCipher = ARCFourCipher;
  14971. exports.CipherTransformFactory = CipherTransformFactory;
  14972. exports.PDF17 = PDF17;
  14973. exports.PDF20 = PDF20;
  14974. exports.calculateMD5 = calculateMD5;
  14975. exports.calculateSHA256 = calculateSHA256;
  14976. exports.calculateSHA384 = calculateSHA384;
  14977. exports.calculateSHA512 = calculateSHA512;
  14978. /***/ }),
  14979. /* 14 */
  14980. /***/ (function(module, exports, __w_pdfjs_require__) {
  14981. "use strict";
  14982. Object.defineProperty(exports, "__esModule", {
  14983. value: true
  14984. });
  14985. exports.PartialEvaluator = exports.OperatorList = undefined;
  14986. var _util = __w_pdfjs_require__(0);
  14987. var _cmap = __w_pdfjs_require__(23);
  14988. var _stream = __w_pdfjs_require__(2);
  14989. var _primitives = __w_pdfjs_require__(1);
  14990. var _fonts = __w_pdfjs_require__(26);
  14991. var _encodings = __w_pdfjs_require__(4);
  14992. var _unicode = __w_pdfjs_require__(18);
  14993. var _standard_fonts = __w_pdfjs_require__(17);
  14994. var _pattern = __w_pdfjs_require__(32);
  14995. var _function = __w_pdfjs_require__(6);
  14996. var _parser = __w_pdfjs_require__(5);
  14997. var _bidi = __w_pdfjs_require__(21);
  14998. var _colorspace = __w_pdfjs_require__(3);
  14999. var _glyphlist = __w_pdfjs_require__(7);
  15000. var _metrics = __w_pdfjs_require__(30);
  15001. var _murmurhash = __w_pdfjs_require__(31);
  15002. var _image = __w_pdfjs_require__(27);
  15003. var PartialEvaluator = function PartialEvaluatorClosure() {
  15004. var DefaultPartialEvaluatorOptions = {
  15005. forceDataSchema: false,
  15006. maxImageSize: -1,
  15007. disableFontFace: false,
  15008. nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE,
  15009. ignoreErrors: false
  15010. };
  15011. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  15012. this.xref = xref;
  15013. this.resources = resources;
  15014. this.handler = handler;
  15015. this.forceDataSchema = forceDataSchema;
  15016. }
  15017. NativeImageDecoder.prototype = {
  15018. canDecode: function canDecode(image) {
  15019. return image instanceof _stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  15020. },
  15021. decode: function decode(image) {
  15022. var dict = image.dict;
  15023. var colorSpace = dict.get('ColorSpace', 'CS');
  15024. colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources);
  15025. var numComps = colorSpace.numComps;
  15026. var decodePromise = this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), numComps]);
  15027. return decodePromise.then(function (message) {
  15028. var data = message.data;
  15029. return new _stream.Stream(data, 0, data.length, image.dict);
  15030. });
  15031. }
  15032. };
  15033. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  15034. var dict = image.dict;
  15035. if (dict.has('DecodeParms') || dict.has('DP')) {
  15036. return false;
  15037. }
  15038. var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  15039. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  15040. };
  15041. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  15042. var dict = image.dict;
  15043. if (dict.has('DecodeParms') || dict.has('DP')) {
  15044. return false;
  15045. }
  15046. var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  15047. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  15048. };
  15049. function PartialEvaluator(_ref) {
  15050. var _this = this;
  15051. var pdfManager = _ref.pdfManager,
  15052. xref = _ref.xref,
  15053. handler = _ref.handler,
  15054. pageIndex = _ref.pageIndex,
  15055. idFactory = _ref.idFactory,
  15056. fontCache = _ref.fontCache,
  15057. builtInCMapCache = _ref.builtInCMapCache,
  15058. _ref$options = _ref.options,
  15059. options = _ref$options === undefined ? null : _ref$options;
  15060. this.pdfManager = pdfManager;
  15061. this.xref = xref;
  15062. this.handler = handler;
  15063. this.pageIndex = pageIndex;
  15064. this.idFactory = idFactory;
  15065. this.fontCache = fontCache;
  15066. this.builtInCMapCache = builtInCMapCache;
  15067. this.options = options || DefaultPartialEvaluatorOptions;
  15068. this.fetchBuiltInCMap = function (name) {
  15069. var cachedCMap = _this.builtInCMapCache[name];
  15070. if (cachedCMap) {
  15071. return Promise.resolve(cachedCMap);
  15072. }
  15073. return _this.handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  15074. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  15075. _this.builtInCMapCache[name] = data;
  15076. }
  15077. return data;
  15078. });
  15079. };
  15080. }
  15081. var TIME_SLOT_DURATION_MS = 20;
  15082. var CHECK_TIME_EVERY = 100;
  15083. function TimeSlotManager() {
  15084. this.reset();
  15085. }
  15086. TimeSlotManager.prototype = {
  15087. check: function TimeSlotManager_check() {
  15088. if (++this.checked < CHECK_TIME_EVERY) {
  15089. return false;
  15090. }
  15091. this.checked = 0;
  15092. return this.endTime <= Date.now();
  15093. },
  15094. reset: function TimeSlotManager_reset() {
  15095. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  15096. this.checked = 0;
  15097. }
  15098. };
  15099. function normalizeBlendMode(value) {
  15100. if (!(0, _primitives.isName)(value)) {
  15101. return 'source-over';
  15102. }
  15103. switch (value.name) {
  15104. case 'Normal':
  15105. case 'Compatible':
  15106. return 'source-over';
  15107. case 'Multiply':
  15108. return 'multiply';
  15109. case 'Screen':
  15110. return 'screen';
  15111. case 'Overlay':
  15112. return 'overlay';
  15113. case 'Darken':
  15114. return 'darken';
  15115. case 'Lighten':
  15116. return 'lighten';
  15117. case 'ColorDodge':
  15118. return 'color-dodge';
  15119. case 'ColorBurn':
  15120. return 'color-burn';
  15121. case 'HardLight':
  15122. return 'hard-light';
  15123. case 'SoftLight':
  15124. return 'soft-light';
  15125. case 'Difference':
  15126. return 'difference';
  15127. case 'Exclusion':
  15128. return 'exclusion';
  15129. case 'Hue':
  15130. return 'hue';
  15131. case 'Saturation':
  15132. return 'saturation';
  15133. case 'Color':
  15134. return 'color';
  15135. case 'Luminosity':
  15136. return 'luminosity';
  15137. }
  15138. (0, _util.warn)('Unsupported blend mode: ' + value.name);
  15139. return 'source-over';
  15140. }
  15141. var deferred = Promise.resolve();
  15142. var TILING_PATTERN = 1,
  15143. SHADING_PATTERN = 2;
  15144. PartialEvaluator.prototype = {
  15145. clone: function clone() {
  15146. var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DefaultPartialEvaluatorOptions;
  15147. var newEvaluator = Object.create(this);
  15148. newEvaluator.options = newOptions;
  15149. return newEvaluator;
  15150. },
  15151. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  15152. if (!(0, _primitives.isDict)(resources)) {
  15153. return false;
  15154. }
  15155. var processed = Object.create(null);
  15156. if (resources.objId) {
  15157. processed[resources.objId] = true;
  15158. }
  15159. var nodes = [resources],
  15160. xref = this.xref;
  15161. while (nodes.length) {
  15162. var key, i, ii;
  15163. var node = nodes.shift();
  15164. var graphicStates = node.get('ExtGState');
  15165. if ((0, _primitives.isDict)(graphicStates)) {
  15166. var graphicStatesKeys = graphicStates.getKeys();
  15167. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  15168. key = graphicStatesKeys[i];
  15169. var graphicState = graphicStates.get(key);
  15170. var bm = graphicState.get('BM');
  15171. if ((0, _primitives.isName)(bm) && bm.name !== 'Normal') {
  15172. return true;
  15173. }
  15174. }
  15175. }
  15176. var xObjects = node.get('XObject');
  15177. if (!(0, _primitives.isDict)(xObjects)) {
  15178. continue;
  15179. }
  15180. var xObjectsKeys = xObjects.getKeys();
  15181. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  15182. key = xObjectsKeys[i];
  15183. var xObject = xObjects.getRaw(key);
  15184. if ((0, _primitives.isRef)(xObject)) {
  15185. if (processed[xObject.toString()]) {
  15186. continue;
  15187. }
  15188. xObject = xref.fetch(xObject);
  15189. }
  15190. if (!(0, _primitives.isStream)(xObject)) {
  15191. continue;
  15192. }
  15193. if (xObject.dict.objId) {
  15194. if (processed[xObject.dict.objId]) {
  15195. continue;
  15196. }
  15197. processed[xObject.dict.objId] = true;
  15198. }
  15199. var xResources = xObject.dict.get('Resources');
  15200. if ((0, _primitives.isDict)(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  15201. nodes.push(xResources);
  15202. if (xResources.objId) {
  15203. processed[xResources.objId] = true;
  15204. }
  15205. }
  15206. }
  15207. }
  15208. return false;
  15209. },
  15210. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  15211. var dict = xobj.dict;
  15212. var matrix = dict.getArray('Matrix');
  15213. var bbox = dict.getArray('BBox');
  15214. var group = dict.get('Group');
  15215. if (group) {
  15216. var groupOptions = {
  15217. matrix: matrix,
  15218. bbox: bbox,
  15219. smask: smask,
  15220. isolated: false,
  15221. knockout: false
  15222. };
  15223. var groupSubtype = group.get('S');
  15224. var colorSpace;
  15225. if ((0, _primitives.isName)(groupSubtype, 'Transparency')) {
  15226. groupOptions.isolated = group.get('I') || false;
  15227. groupOptions.knockout = group.get('K') || false;
  15228. colorSpace = group.has('CS') ? _colorspace.ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  15229. }
  15230. if (smask && smask.backdrop) {
  15231. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  15232. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  15233. }
  15234. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  15235. }
  15236. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  15237. return this.getOperatorList({
  15238. stream: xobj,
  15239. task: task,
  15240. resources: dict.get('Resources') || resources,
  15241. operatorList: operatorList,
  15242. initialState: initialState
  15243. }).then(function () {
  15244. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  15245. if (group) {
  15246. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  15247. }
  15248. });
  15249. },
  15250. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  15251. var _this2 = this;
  15252. var dict = image.dict;
  15253. var w = dict.get('Width', 'W');
  15254. var h = dict.get('Height', 'H');
  15255. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  15256. (0, _util.warn)('Image dimensions are missing, or not numbers.');
  15257. return;
  15258. }
  15259. var maxImageSize = this.options.maxImageSize;
  15260. if (maxImageSize !== -1 && w * h > maxImageSize) {
  15261. (0, _util.warn)('Image exceeded maximum allowed size and was removed.');
  15262. return;
  15263. }
  15264. var imageMask = dict.get('ImageMask', 'IM') || false;
  15265. var imgData, args;
  15266. if (imageMask) {
  15267. var width = dict.get('Width', 'W');
  15268. var height = dict.get('Height', 'H');
  15269. var bitStrideLength = width + 7 >> 3;
  15270. var imgArray = image.getBytes(bitStrideLength * height);
  15271. var decode = dict.getArray('Decode', 'D');
  15272. var inverseDecode = !!decode && decode[0] > 0;
  15273. imgData = _image.PDFImage.createMask(imgArray, width, height, image instanceof _stream.DecodeStream, inverseDecode);
  15274. imgData.cached = true;
  15275. args = [imgData];
  15276. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  15277. if (cacheKey) {
  15278. imageCache[cacheKey] = {
  15279. fn: _util.OPS.paintImageMaskXObject,
  15280. args: args
  15281. };
  15282. }
  15283. return;
  15284. }
  15285. var softMask = dict.get('SMask', 'SM') || false;
  15286. var mask = dict.get('Mask') || false;
  15287. var SMALL_IMAGE_DIMENSIONS = 200;
  15288. if (inline && !softMask && !mask && !(image instanceof _stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  15289. var imageObj = new _image.PDFImage(this.xref, resources, image, inline, null, null);
  15290. imgData = imageObj.createImageData(true);
  15291. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  15292. return;
  15293. }
  15294. var nativeImageDecoderSupport = this.options.nativeImageDecoderSupport;
  15295. var objId = 'img_' + this.idFactory.createObjId();
  15296. operatorList.addDependency(objId);
  15297. args = [objId, w, h];
  15298. if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _stream.JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  15299. operatorList.addOp(_util.OPS.paintJpegXObject, args);
  15300. this.handler.send('obj', [objId, this.pageIndex, 'JpegStream', image.getIR(this.options.forceDataSchema)]);
  15301. if (cacheKey) {
  15302. imageCache[cacheKey] = {
  15303. fn: _util.OPS.paintJpegXObject,
  15304. args: args
  15305. };
  15306. }
  15307. return;
  15308. }
  15309. var nativeImageDecoder = null;
  15310. if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _stream.JpegStream || mask instanceof _stream.JpegStream || softMask instanceof _stream.JpegStream)) {
  15311. nativeImageDecoder = new NativeImageDecoder(this.xref, resources, this.handler, this.options.forceDataSchema);
  15312. }
  15313. _image.PDFImage.buildImage(this.handler, this.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  15314. var imgData = imageObj.createImageData(false);
  15315. _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', imgData], [imgData.data.buffer]);
  15316. }).catch(function (reason) {
  15317. (0, _util.warn)('Unable to decode image: ' + reason);
  15318. _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', null]);
  15319. });
  15320. operatorList.addOp(_util.OPS.paintImageXObject, args);
  15321. if (cacheKey) {
  15322. imageCache[cacheKey] = {
  15323. fn: _util.OPS.paintImageXObject,
  15324. args: args
  15325. };
  15326. }
  15327. },
  15328. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  15329. var smaskContent = smask.get('G');
  15330. var smaskOptions = {
  15331. subtype: smask.get('S').name,
  15332. backdrop: smask.get('BC')
  15333. };
  15334. var transferObj = smask.get('TR');
  15335. if ((0, _function.isPDFFunction)(transferObj)) {
  15336. var transferFn = _function.PDFFunction.parse(this.xref, transferObj);
  15337. var transferMap = new Uint8Array(256);
  15338. var tmp = new Float32Array(1);
  15339. for (var i = 0; i < 256; i++) {
  15340. tmp[0] = i / 255;
  15341. transferFn(tmp, 0, tmp, 0);
  15342. transferMap[i] = tmp[0] * 255 | 0;
  15343. }
  15344. smaskOptions.transferMap = transferMap;
  15345. }
  15346. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  15347. },
  15348. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  15349. var tilingOpList = new OperatorList();
  15350. var resourcesArray = [patternDict.get('Resources'), resources];
  15351. var patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
  15352. return this.getOperatorList({
  15353. stream: pattern,
  15354. task: task,
  15355. resources: patternResources,
  15356. operatorList: tilingOpList
  15357. }).then(function () {
  15358. operatorList.addDependencies(tilingOpList.dependencies);
  15359. operatorList.addOp(fn, (0, _pattern.getTilingPatternIR)({
  15360. fnArray: tilingOpList.fnArray,
  15361. argsArray: tilingOpList.argsArray
  15362. }, patternDict, args));
  15363. });
  15364. },
  15365. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  15366. var _this3 = this;
  15367. var fontName;
  15368. if (fontArgs) {
  15369. fontArgs = fontArgs.slice();
  15370. fontName = fontArgs[0].name;
  15371. }
  15372. return this.loadFont(fontName, fontRef, resources).then(function (translated) {
  15373. if (!translated.font.isType3Font) {
  15374. return translated;
  15375. }
  15376. return translated.loadType3Data(_this3, resources, operatorList, task).then(function () {
  15377. return translated;
  15378. }).catch(function (reason) {
  15379. _this3.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font });
  15380. return new TranslatedFont('g_font_error', new _fonts.ErrorFont('Type3 font load error: ' + reason), translated.font);
  15381. });
  15382. }).then(function (translated) {
  15383. state.font = translated.font;
  15384. translated.send(_this3.handler);
  15385. return translated.loadedName;
  15386. });
  15387. },
  15388. handleText: function PartialEvaluator_handleText(chars, state) {
  15389. var _this4 = this;
  15390. var font = state.font;
  15391. var glyphs = font.charsToGlyphs(chars);
  15392. var isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  15393. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  15394. var buildPath = function buildPath(fontChar) {
  15395. if (!font.renderer.hasBuiltPath(fontChar)) {
  15396. var path = font.renderer.getPathJs(fontChar);
  15397. _this4.handler.send('commonobj', [font.loadedName + '_path_' + fontChar, 'FontPath', path]);
  15398. }
  15399. };
  15400. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  15401. var glyph = glyphs[i];
  15402. buildPath(glyph.fontChar);
  15403. var accent = glyph.accent;
  15404. if (accent && accent.fontChar) {
  15405. buildPath(accent.fontChar);
  15406. }
  15407. }
  15408. }
  15409. return glyphs;
  15410. },
  15411. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
  15412. var _this5 = this;
  15413. var gStateObj = [];
  15414. var gStateKeys = gState.getKeys();
  15415. var promise = Promise.resolve();
  15416. var _loop = function _loop() {
  15417. var key = gStateKeys[i];
  15418. var value = gState.get(key);
  15419. switch (key) {
  15420. case 'Type':
  15421. break;
  15422. case 'LW':
  15423. case 'LC':
  15424. case 'LJ':
  15425. case 'ML':
  15426. case 'D':
  15427. case 'RI':
  15428. case 'FL':
  15429. case 'CA':
  15430. case 'ca':
  15431. gStateObj.push([key, value]);
  15432. break;
  15433. case 'Font':
  15434. promise = promise.then(function () {
  15435. return _this5.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  15436. operatorList.addDependency(loadedName);
  15437. gStateObj.push([key, [loadedName, value[1]]]);
  15438. });
  15439. });
  15440. break;
  15441. case 'BM':
  15442. gStateObj.push([key, normalizeBlendMode(value)]);
  15443. break;
  15444. case 'SMask':
  15445. if ((0, _primitives.isName)(value, 'None')) {
  15446. gStateObj.push([key, false]);
  15447. break;
  15448. }
  15449. if ((0, _primitives.isDict)(value)) {
  15450. promise = promise.then(function () {
  15451. return _this5.handleSMask(value, resources, operatorList, task, stateManager);
  15452. });
  15453. gStateObj.push([key, true]);
  15454. } else {
  15455. (0, _util.warn)('Unsupported SMask type');
  15456. }
  15457. break;
  15458. case 'OP':
  15459. case 'op':
  15460. case 'OPM':
  15461. case 'BG':
  15462. case 'BG2':
  15463. case 'UCR':
  15464. case 'UCR2':
  15465. case 'TR':
  15466. case 'TR2':
  15467. case 'HT':
  15468. case 'SM':
  15469. case 'SA':
  15470. case 'AIS':
  15471. case 'TK':
  15472. (0, _util.info)('graphic state operator ' + key);
  15473. break;
  15474. default:
  15475. (0, _util.info)('Unknown graphic state operator ' + key);
  15476. break;
  15477. }
  15478. };
  15479. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  15480. _loop();
  15481. }
  15482. return promise.then(function () {
  15483. if (gStateObj.length > 0) {
  15484. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  15485. }
  15486. });
  15487. },
  15488. loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {
  15489. var _this6 = this;
  15490. function errorFont() {
  15491. return Promise.resolve(new TranslatedFont('g_font_error', new _fonts.ErrorFont('Font ' + fontName + ' is not available'), font));
  15492. }
  15493. var fontRef,
  15494. xref = this.xref;
  15495. if (font) {
  15496. (0, _util.assert)((0, _primitives.isRef)(font));
  15497. fontRef = font;
  15498. } else {
  15499. var fontRes = resources.get('Font');
  15500. if (fontRes) {
  15501. fontRef = fontRes.getRaw(fontName);
  15502. } else {
  15503. (0, _util.warn)('fontRes not available');
  15504. return errorFont();
  15505. }
  15506. }
  15507. if (!fontRef) {
  15508. (0, _util.warn)('fontRef not available');
  15509. return errorFont();
  15510. }
  15511. if (this.fontCache.has(fontRef)) {
  15512. return this.fontCache.get(fontRef);
  15513. }
  15514. font = xref.fetchIfRef(fontRef);
  15515. if (!(0, _primitives.isDict)(font)) {
  15516. return errorFont();
  15517. }
  15518. if (font.translated) {
  15519. return font.translated;
  15520. }
  15521. var fontCapability = (0, _util.createPromiseCapability)();
  15522. var preEvaluatedFont = this.preEvaluateFont(font);
  15523. var descriptor = preEvaluatedFont.descriptor;
  15524. var fontRefIsRef = (0, _primitives.isRef)(fontRef),
  15525. fontID;
  15526. if (fontRefIsRef) {
  15527. fontID = fontRef.toString();
  15528. }
  15529. if ((0, _primitives.isDict)(descriptor)) {
  15530. if (!descriptor.fontAliases) {
  15531. descriptor.fontAliases = Object.create(null);
  15532. }
  15533. var fontAliases = descriptor.fontAliases;
  15534. var hash = preEvaluatedFont.hash;
  15535. if (fontAliases[hash]) {
  15536. var aliasFontRef = fontAliases[hash].aliasRef;
  15537. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  15538. this.fontCache.putAlias(fontRef, aliasFontRef);
  15539. return this.fontCache.get(fontRef);
  15540. }
  15541. } else {
  15542. fontAliases[hash] = { fontID: _fonts.Font.getFontID() };
  15543. }
  15544. if (fontRefIsRef) {
  15545. fontAliases[hash].aliasRef = fontRef;
  15546. }
  15547. fontID = fontAliases[hash].fontID;
  15548. }
  15549. if (fontRefIsRef) {
  15550. this.fontCache.put(fontRef, fontCapability.promise);
  15551. } else {
  15552. if (!fontID) {
  15553. fontID = this.idFactory.createObjId();
  15554. }
  15555. this.fontCache.put('id_' + fontID, fontCapability.promise);
  15556. }
  15557. (0, _util.assert)(fontID, 'The "fontID" must be defined.');
  15558. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  15559. font.translated = fontCapability.promise;
  15560. var translatedPromise;
  15561. try {
  15562. translatedPromise = this.translateFont(preEvaluatedFont);
  15563. } catch (e) {
  15564. translatedPromise = Promise.reject(e);
  15565. }
  15566. translatedPromise.then(function (translatedFont) {
  15567. if (translatedFont.fontType !== undefined) {
  15568. var xrefFontStats = xref.stats.fontTypes;
  15569. xrefFontStats[translatedFont.fontType] = true;
  15570. }
  15571. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  15572. }).catch(function (reason) {
  15573. _this6.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font });
  15574. try {
  15575. var descriptor = preEvaluatedFont.descriptor;
  15576. var fontFile3 = descriptor && descriptor.get('FontFile3');
  15577. var subtype = fontFile3 && fontFile3.get('Subtype');
  15578. var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  15579. var xrefFontStats = xref.stats.fontTypes;
  15580. xrefFontStats[fontType] = true;
  15581. } catch (ex) {}
  15582. fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font));
  15583. });
  15584. return fontCapability.promise;
  15585. },
  15586. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  15587. var lastIndex = operatorList.length - 1;
  15588. if (!args) {
  15589. args = [];
  15590. }
  15591. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  15592. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  15593. } else {
  15594. var opArgs = operatorList.argsArray[lastIndex];
  15595. opArgs[0].push(fn);
  15596. Array.prototype.push.apply(opArgs[1], args);
  15597. }
  15598. },
  15599. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task) {
  15600. var patternName = args[args.length - 1];
  15601. var pattern;
  15602. if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) {
  15603. var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  15604. var typeNum = dict.get('PatternType');
  15605. if (typeNum === TILING_PATTERN) {
  15606. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  15607. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  15608. } else if (typeNum === SHADING_PATTERN) {
  15609. var shading = dict.get('Shading');
  15610. var matrix = dict.getArray('Matrix');
  15611. pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler);
  15612. operatorList.addOp(fn, pattern.getIR());
  15613. return Promise.resolve();
  15614. }
  15615. return Promise.reject(new Error('Unknown PatternType: ' + typeNum));
  15616. }
  15617. operatorList.addOp(fn, args);
  15618. return Promise.resolve();
  15619. },
  15620. getOperatorList: function getOperatorList(_ref2) {
  15621. var _this7 = this;
  15622. var stream = _ref2.stream,
  15623. task = _ref2.task,
  15624. resources = _ref2.resources,
  15625. operatorList = _ref2.operatorList,
  15626. _ref2$initialState = _ref2.initialState,
  15627. initialState = _ref2$initialState === undefined ? null : _ref2$initialState;
  15628. resources = resources || _primitives.Dict.empty;
  15629. initialState = initialState || new EvalState();
  15630. (0, _util.assert)(operatorList, 'getOperatorList: missing "operatorList" parameter');
  15631. var self = this;
  15632. var xref = this.xref;
  15633. var imageCache = Object.create(null);
  15634. var xobjs = resources.get('XObject') || _primitives.Dict.empty;
  15635. var patterns = resources.get('Pattern') || _primitives.Dict.empty;
  15636. var stateManager = new StateManager(initialState);
  15637. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  15638. var timeSlotManager = new TimeSlotManager();
  15639. function closePendingRestoreOPS(argument) {
  15640. for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  15641. operatorList.addOp(_util.OPS.restore, []);
  15642. }
  15643. }
  15644. return new Promise(function promiseBody(resolve, reject) {
  15645. var next = function next(promise) {
  15646. promise.then(function () {
  15647. try {
  15648. promiseBody(resolve, reject);
  15649. } catch (ex) {
  15650. reject(ex);
  15651. }
  15652. }, reject);
  15653. };
  15654. task.ensureNotTerminated();
  15655. timeSlotManager.reset();
  15656. var stop,
  15657. operation = {},
  15658. i,
  15659. ii,
  15660. cs;
  15661. while (!(stop = timeSlotManager.check())) {
  15662. operation.args = null;
  15663. if (!preprocessor.read(operation)) {
  15664. break;
  15665. }
  15666. var args = operation.args;
  15667. var fn = operation.fn;
  15668. switch (fn | 0) {
  15669. case _util.OPS.paintXObject:
  15670. if (args[0].code) {
  15671. break;
  15672. }
  15673. var name = args[0].name;
  15674. if (!name) {
  15675. (0, _util.warn)('XObject must be referred to by name.');
  15676. continue;
  15677. }
  15678. if (imageCache[name] !== undefined) {
  15679. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  15680. args = null;
  15681. continue;
  15682. }
  15683. var xobj = xobjs.get(name);
  15684. if (xobj) {
  15685. (0, _util.assert)((0, _primitives.isStream)(xobj), 'XObject should be a stream');
  15686. var type = xobj.dict.get('Subtype');
  15687. (0, _util.assert)((0, _primitives.isName)(type), 'XObject should have a Name subtype');
  15688. if (type.name === 'Form') {
  15689. stateManager.save();
  15690. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  15691. stateManager.restore();
  15692. }));
  15693. return;
  15694. } else if (type.name === 'Image') {
  15695. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  15696. args = null;
  15697. continue;
  15698. } else if (type.name === 'PS') {
  15699. (0, _util.info)('Ignored XObject subtype PS');
  15700. continue;
  15701. } else {
  15702. (0, _util.error)('Unhandled XObject subtype ' + type.name);
  15703. }
  15704. }
  15705. break;
  15706. case _util.OPS.setFont:
  15707. var fontSize = args[1];
  15708. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  15709. operatorList.addDependency(loadedName);
  15710. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  15711. }));
  15712. return;
  15713. case _util.OPS.endInlineImage:
  15714. var cacheKey = args[0].cacheKey;
  15715. if (cacheKey) {
  15716. var cacheEntry = imageCache[cacheKey];
  15717. if (cacheEntry !== undefined) {
  15718. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  15719. args = null;
  15720. continue;
  15721. }
  15722. }
  15723. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  15724. args = null;
  15725. continue;
  15726. case _util.OPS.showText:
  15727. args[0] = self.handleText(args[0], stateManager.state);
  15728. break;
  15729. case _util.OPS.showSpacedText:
  15730. var arr = args[0];
  15731. var combinedGlyphs = [];
  15732. var arrLength = arr.length;
  15733. var state = stateManager.state;
  15734. for (i = 0; i < arrLength; ++i) {
  15735. var arrItem = arr[i];
  15736. if ((0, _util.isString)(arrItem)) {
  15737. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  15738. } else if ((0, _util.isNum)(arrItem)) {
  15739. combinedGlyphs.push(arrItem);
  15740. }
  15741. }
  15742. args[0] = combinedGlyphs;
  15743. fn = _util.OPS.showText;
  15744. break;
  15745. case _util.OPS.nextLineShowText:
  15746. operatorList.addOp(_util.OPS.nextLine);
  15747. args[0] = self.handleText(args[0], stateManager.state);
  15748. fn = _util.OPS.showText;
  15749. break;
  15750. case _util.OPS.nextLineSetSpacingShowText:
  15751. operatorList.addOp(_util.OPS.nextLine);
  15752. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  15753. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  15754. args[0] = self.handleText(args[0], stateManager.state);
  15755. fn = _util.OPS.showText;
  15756. break;
  15757. case _util.OPS.setTextRenderingMode:
  15758. stateManager.state.textRenderingMode = args[0];
  15759. break;
  15760. case _util.OPS.setFillColorSpace:
  15761. stateManager.state.fillColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources);
  15762. continue;
  15763. case _util.OPS.setStrokeColorSpace:
  15764. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources);
  15765. continue;
  15766. case _util.OPS.setFillColor:
  15767. cs = stateManager.state.fillColorSpace;
  15768. args = cs.getRgb(args, 0);
  15769. fn = _util.OPS.setFillRGBColor;
  15770. break;
  15771. case _util.OPS.setStrokeColor:
  15772. cs = stateManager.state.strokeColorSpace;
  15773. args = cs.getRgb(args, 0);
  15774. fn = _util.OPS.setStrokeRGBColor;
  15775. break;
  15776. case _util.OPS.setFillGray:
  15777. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  15778. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  15779. fn = _util.OPS.setFillRGBColor;
  15780. break;
  15781. case _util.OPS.setStrokeGray:
  15782. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  15783. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  15784. fn = _util.OPS.setStrokeRGBColor;
  15785. break;
  15786. case _util.OPS.setFillCMYKColor:
  15787. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  15788. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  15789. fn = _util.OPS.setFillRGBColor;
  15790. break;
  15791. case _util.OPS.setStrokeCMYKColor:
  15792. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  15793. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  15794. fn = _util.OPS.setStrokeRGBColor;
  15795. break;
  15796. case _util.OPS.setFillRGBColor:
  15797. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  15798. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  15799. break;
  15800. case _util.OPS.setStrokeRGBColor:
  15801. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  15802. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  15803. break;
  15804. case _util.OPS.setFillColorN:
  15805. cs = stateManager.state.fillColorSpace;
  15806. if (cs.name === 'Pattern') {
  15807. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task));
  15808. return;
  15809. }
  15810. args = cs.getRgb(args, 0);
  15811. fn = _util.OPS.setFillRGBColor;
  15812. break;
  15813. case _util.OPS.setStrokeColorN:
  15814. cs = stateManager.state.strokeColorSpace;
  15815. if (cs.name === 'Pattern') {
  15816. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task));
  15817. return;
  15818. }
  15819. args = cs.getRgb(args, 0);
  15820. fn = _util.OPS.setStrokeRGBColor;
  15821. break;
  15822. case _util.OPS.shadingFill:
  15823. var shadingRes = resources.get('Shading');
  15824. (0, _util.assert)(shadingRes, 'No shading resource found');
  15825. var shading = shadingRes.get(args[0].name);
  15826. (0, _util.assert)(shading, 'No shading object found');
  15827. var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler);
  15828. var patternIR = shadingFill.getIR();
  15829. args = [patternIR];
  15830. fn = _util.OPS.shadingFill;
  15831. break;
  15832. case _util.OPS.setGState:
  15833. var dictName = args[0];
  15834. var extGState = resources.get('ExtGState');
  15835. if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) {
  15836. break;
  15837. }
  15838. var gState = extGState.get(dictName.name);
  15839. next(self.setGState(resources, gState, operatorList, task, stateManager));
  15840. return;
  15841. case _util.OPS.moveTo:
  15842. case _util.OPS.lineTo:
  15843. case _util.OPS.curveTo:
  15844. case _util.OPS.curveTo2:
  15845. case _util.OPS.curveTo3:
  15846. case _util.OPS.closePath:
  15847. self.buildPath(operatorList, fn, args);
  15848. continue;
  15849. case _util.OPS.rectangle:
  15850. self.buildPath(operatorList, fn, args);
  15851. continue;
  15852. case _util.OPS.markPoint:
  15853. case _util.OPS.markPointProps:
  15854. case _util.OPS.beginMarkedContent:
  15855. case _util.OPS.beginMarkedContentProps:
  15856. case _util.OPS.endMarkedContent:
  15857. case _util.OPS.beginCompat:
  15858. case _util.OPS.endCompat:
  15859. continue;
  15860. default:
  15861. if (args !== null) {
  15862. for (i = 0, ii = args.length; i < ii; i++) {
  15863. if (args[i] instanceof _primitives.Dict) {
  15864. break;
  15865. }
  15866. }
  15867. if (i < ii) {
  15868. (0, _util.warn)('getOperatorList - ignoring operator: ' + fn);
  15869. continue;
  15870. }
  15871. }
  15872. }
  15873. operatorList.addOp(fn, args);
  15874. }
  15875. if (stop) {
  15876. next(deferred);
  15877. return;
  15878. }
  15879. closePendingRestoreOPS();
  15880. resolve();
  15881. }).catch(function (reason) {
  15882. if (_this7.options.ignoreErrors) {
  15883. _this7.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown });
  15884. (0, _util.warn)('getOperatorList - ignoring errors during task: ' + task.name);
  15885. closePendingRestoreOPS();
  15886. return;
  15887. }
  15888. throw reason;
  15889. });
  15890. },
  15891. getTextContent: function getTextContent(_ref3) {
  15892. var _this8 = this;
  15893. var stream = _ref3.stream,
  15894. task = _ref3.task,
  15895. resources = _ref3.resources,
  15896. _ref3$stateManager = _ref3.stateManager,
  15897. stateManager = _ref3$stateManager === undefined ? null : _ref3$stateManager,
  15898. _ref3$normalizeWhites = _ref3.normalizeWhitespace,
  15899. normalizeWhitespace = _ref3$normalizeWhites === undefined ? false : _ref3$normalizeWhites,
  15900. _ref3$combineTextItem = _ref3.combineTextItems,
  15901. combineTextItems = _ref3$combineTextItem === undefined ? false : _ref3$combineTextItem;
  15902. resources = resources || _primitives.Dict.empty;
  15903. stateManager = stateManager || new StateManager(new TextState());
  15904. var WhitespaceRegexp = /\s/g;
  15905. var textContent = {
  15906. items: [],
  15907. styles: Object.create(null)
  15908. };
  15909. var textContentItem = {
  15910. initialized: false,
  15911. str: [],
  15912. width: 0,
  15913. height: 0,
  15914. vertical: false,
  15915. lastAdvanceWidth: 0,
  15916. lastAdvanceHeight: 0,
  15917. textAdvanceScale: 0,
  15918. spaceWidth: 0,
  15919. fakeSpaceMin: Infinity,
  15920. fakeMultiSpaceMin: Infinity,
  15921. fakeMultiSpaceMax: -0,
  15922. textRunBreakAllowed: false,
  15923. transform: null,
  15924. fontName: null
  15925. };
  15926. var SPACE_FACTOR = 0.3;
  15927. var MULTI_SPACE_FACTOR = 1.5;
  15928. var MULTI_SPACE_FACTOR_MAX = 4;
  15929. var self = this;
  15930. var xref = this.xref;
  15931. var xobjs = null;
  15932. var xobjsCache = Object.create(null);
  15933. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  15934. var textState;
  15935. function ensureTextContentItem() {
  15936. if (textContentItem.initialized) {
  15937. return textContentItem;
  15938. }
  15939. var font = textState.font;
  15940. if (!(font.loadedName in textContent.styles)) {
  15941. textContent.styles[font.loadedName] = {
  15942. fontFamily: font.fallbackName,
  15943. ascent: font.ascent,
  15944. descent: font.descent,
  15945. vertical: font.vertical
  15946. };
  15947. }
  15948. textContentItem.fontName = font.loadedName;
  15949. var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  15950. if (font.isType3Font && textState.fontMatrix !== _util.FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  15951. var glyphHeight = font.bbox[3] - font.bbox[1];
  15952. if (glyphHeight > 0) {
  15953. glyphHeight = glyphHeight * textState.fontMatrix[3];
  15954. tsm[3] *= glyphHeight;
  15955. }
  15956. }
  15957. var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  15958. textContentItem.transform = trm;
  15959. if (!font.vertical) {
  15960. textContentItem.width = 0;
  15961. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  15962. textContentItem.vertical = false;
  15963. } else {
  15964. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  15965. textContentItem.height = 0;
  15966. textContentItem.vertical = true;
  15967. }
  15968. var a = textState.textLineMatrix[0];
  15969. var b = textState.textLineMatrix[1];
  15970. var scaleLineX = Math.sqrt(a * a + b * b);
  15971. a = textState.ctm[0];
  15972. b = textState.ctm[1];
  15973. var scaleCtmX = Math.sqrt(a * a + b * b);
  15974. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  15975. textContentItem.lastAdvanceWidth = 0;
  15976. textContentItem.lastAdvanceHeight = 0;
  15977. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  15978. if (spaceWidth) {
  15979. textContentItem.spaceWidth = spaceWidth;
  15980. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  15981. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  15982. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  15983. textContentItem.textRunBreakAllowed = !font.isMonospace;
  15984. } else {
  15985. textContentItem.spaceWidth = 0;
  15986. textContentItem.fakeSpaceMin = Infinity;
  15987. textContentItem.fakeMultiSpaceMin = Infinity;
  15988. textContentItem.fakeMultiSpaceMax = 0;
  15989. textContentItem.textRunBreakAllowed = false;
  15990. }
  15991. textContentItem.initialized = true;
  15992. return textContentItem;
  15993. }
  15994. function replaceWhitespace(str) {
  15995. var i = 0,
  15996. ii = str.length,
  15997. code;
  15998. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  15999. i++;
  16000. }
  16001. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  16002. }
  16003. function runBidiTransform(textChunk) {
  16004. var str = textChunk.str.join('');
  16005. var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
  16006. return {
  16007. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  16008. dir: bidiResult.dir,
  16009. width: textChunk.width,
  16010. height: textChunk.height,
  16011. transform: textChunk.transform,
  16012. fontName: textChunk.fontName
  16013. };
  16014. }
  16015. function handleSetFont(fontName, fontRef) {
  16016. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  16017. textState.font = translated.font;
  16018. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  16019. });
  16020. }
  16021. function buildTextContentItem(chars) {
  16022. var font = textState.font;
  16023. var textChunk = ensureTextContentItem();
  16024. var width = 0;
  16025. var height = 0;
  16026. var glyphs = font.charsToGlyphs(chars);
  16027. for (var i = 0; i < glyphs.length; i++) {
  16028. var glyph = glyphs[i];
  16029. var glyphWidth = null;
  16030. if (font.vertical && glyph.vmetric) {
  16031. glyphWidth = glyph.vmetric[0];
  16032. } else {
  16033. glyphWidth = glyph.width;
  16034. }
  16035. var glyphUnicode = glyph.unicode;
  16036. var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  16037. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  16038. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  16039. }
  16040. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  16041. var charSpacing = textState.charSpacing;
  16042. if (glyph.isSpace) {
  16043. var wordSpacing = textState.wordSpacing;
  16044. charSpacing += wordSpacing;
  16045. if (wordSpacing > 0) {
  16046. addFakeSpaces(wordSpacing, textChunk.str);
  16047. }
  16048. }
  16049. var tx = 0;
  16050. var ty = 0;
  16051. if (!font.vertical) {
  16052. var w0 = glyphWidth * textState.fontMatrix[0];
  16053. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  16054. width += tx;
  16055. } else {
  16056. var w1 = glyphWidth * textState.fontMatrix[0];
  16057. ty = w1 * textState.fontSize + charSpacing;
  16058. height += ty;
  16059. }
  16060. textState.translateTextMatrix(tx, ty);
  16061. textChunk.str.push(glyphUnicode);
  16062. }
  16063. if (!font.vertical) {
  16064. textChunk.lastAdvanceWidth = width;
  16065. textChunk.width += width;
  16066. } else {
  16067. textChunk.lastAdvanceHeight = height;
  16068. textChunk.height += Math.abs(height);
  16069. }
  16070. return textChunk;
  16071. }
  16072. function addFakeSpaces(width, strBuf) {
  16073. if (width < textContentItem.fakeSpaceMin) {
  16074. return;
  16075. }
  16076. if (width < textContentItem.fakeMultiSpaceMin) {
  16077. strBuf.push(' ');
  16078. return;
  16079. }
  16080. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  16081. while (fakeSpaces-- > 0) {
  16082. strBuf.push(' ');
  16083. }
  16084. }
  16085. function flushTextContentItem() {
  16086. if (!textContentItem.initialized) {
  16087. return;
  16088. }
  16089. textContentItem.width *= textContentItem.textAdvanceScale;
  16090. textContentItem.height *= textContentItem.textAdvanceScale;
  16091. textContent.items.push(runBidiTransform(textContentItem));
  16092. textContentItem.initialized = false;
  16093. textContentItem.str.length = 0;
  16094. }
  16095. var timeSlotManager = new TimeSlotManager();
  16096. return new Promise(function promiseBody(resolve, reject) {
  16097. var next = function next(promise) {
  16098. promise.then(function () {
  16099. try {
  16100. promiseBody(resolve, reject);
  16101. } catch (ex) {
  16102. reject(ex);
  16103. }
  16104. }, reject);
  16105. };
  16106. task.ensureNotTerminated();
  16107. timeSlotManager.reset();
  16108. var stop,
  16109. operation = {},
  16110. args = [];
  16111. while (!(stop = timeSlotManager.check())) {
  16112. args.length = 0;
  16113. operation.args = args;
  16114. if (!preprocessor.read(operation)) {
  16115. break;
  16116. }
  16117. textState = stateManager.state;
  16118. var fn = operation.fn;
  16119. args = operation.args;
  16120. var advance, diff;
  16121. switch (fn | 0) {
  16122. case _util.OPS.setFont:
  16123. var fontNameArg = args[0].name,
  16124. fontSizeArg = args[1];
  16125. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  16126. break;
  16127. }
  16128. flushTextContentItem();
  16129. textState.fontName = fontNameArg;
  16130. textState.fontSize = fontSizeArg;
  16131. next(handleSetFont(fontNameArg, null));
  16132. return;
  16133. case _util.OPS.setTextRise:
  16134. flushTextContentItem();
  16135. textState.textRise = args[0];
  16136. break;
  16137. case _util.OPS.setHScale:
  16138. flushTextContentItem();
  16139. textState.textHScale = args[0] / 100;
  16140. break;
  16141. case _util.OPS.setLeading:
  16142. flushTextContentItem();
  16143. textState.leading = args[0];
  16144. break;
  16145. case _util.OPS.moveText:
  16146. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  16147. advance = args[0] - args[1];
  16148. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  16149. textState.translateTextLineMatrix(args[0], args[1]);
  16150. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  16151. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  16152. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  16153. addFakeSpaces(diff, textContentItem.str);
  16154. break;
  16155. }
  16156. flushTextContentItem();
  16157. textState.translateTextLineMatrix(args[0], args[1]);
  16158. textState.textMatrix = textState.textLineMatrix.slice();
  16159. break;
  16160. case _util.OPS.setLeadingMoveText:
  16161. flushTextContentItem();
  16162. textState.leading = -args[1];
  16163. textState.translateTextLineMatrix(args[0], args[1]);
  16164. textState.textMatrix = textState.textLineMatrix.slice();
  16165. break;
  16166. case _util.OPS.nextLine:
  16167. flushTextContentItem();
  16168. textState.carriageReturn();
  16169. break;
  16170. case _util.OPS.setTextMatrix:
  16171. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  16172. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  16173. textState.translateTextLineMatrix(advance.width, advance.height);
  16174. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  16175. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  16176. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  16177. addFakeSpaces(diff, textContentItem.str);
  16178. break;
  16179. }
  16180. flushTextContentItem();
  16181. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  16182. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  16183. break;
  16184. case _util.OPS.setCharSpacing:
  16185. textState.charSpacing = args[0];
  16186. break;
  16187. case _util.OPS.setWordSpacing:
  16188. textState.wordSpacing = args[0];
  16189. break;
  16190. case _util.OPS.beginText:
  16191. flushTextContentItem();
  16192. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  16193. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  16194. break;
  16195. case _util.OPS.showSpacedText:
  16196. var items = args[0];
  16197. var offset;
  16198. for (var j = 0, jj = items.length; j < jj; j++) {
  16199. if (typeof items[j] === 'string') {
  16200. buildTextContentItem(items[j]);
  16201. } else if ((0, _util.isNum)(items[j])) {
  16202. ensureTextContentItem();
  16203. advance = items[j] * textState.fontSize / 1000;
  16204. var breakTextRun = false;
  16205. if (textState.font.vertical) {
  16206. offset = advance;
  16207. textState.translateTextMatrix(0, offset);
  16208. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  16209. if (!breakTextRun) {
  16210. textContentItem.height += offset;
  16211. }
  16212. } else {
  16213. advance = -advance;
  16214. offset = advance * textState.textHScale;
  16215. textState.translateTextMatrix(offset, 0);
  16216. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  16217. if (!breakTextRun) {
  16218. textContentItem.width += offset;
  16219. }
  16220. }
  16221. if (breakTextRun) {
  16222. flushTextContentItem();
  16223. } else if (advance > 0) {
  16224. addFakeSpaces(advance, textContentItem.str);
  16225. }
  16226. }
  16227. }
  16228. break;
  16229. case _util.OPS.showText:
  16230. buildTextContentItem(args[0]);
  16231. break;
  16232. case _util.OPS.nextLineShowText:
  16233. flushTextContentItem();
  16234. textState.carriageReturn();
  16235. buildTextContentItem(args[0]);
  16236. break;
  16237. case _util.OPS.nextLineSetSpacingShowText:
  16238. flushTextContentItem();
  16239. textState.wordSpacing = args[0];
  16240. textState.charSpacing = args[1];
  16241. textState.carriageReturn();
  16242. buildTextContentItem(args[2]);
  16243. break;
  16244. case _util.OPS.paintXObject:
  16245. flushTextContentItem();
  16246. if (args[0].code) {
  16247. break;
  16248. }
  16249. if (!xobjs) {
  16250. xobjs = resources.get('XObject') || _primitives.Dict.empty;
  16251. }
  16252. var name = args[0].name;
  16253. if (xobjsCache.key === name) {
  16254. if (xobjsCache.texts) {
  16255. _util.Util.appendToArray(textContent.items, xobjsCache.texts.items);
  16256. _util.Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  16257. }
  16258. break;
  16259. }
  16260. var xobj = xobjs.get(name);
  16261. if (!xobj) {
  16262. break;
  16263. }
  16264. (0, _util.assert)((0, _primitives.isStream)(xobj), 'XObject should be a stream');
  16265. var type = xobj.dict.get('Subtype');
  16266. (0, _util.assert)((0, _primitives.isName)(type), 'XObject should have a Name subtype');
  16267. if (type.name !== 'Form') {
  16268. xobjsCache.key = name;
  16269. xobjsCache.texts = null;
  16270. break;
  16271. }
  16272. var currentState = stateManager.state.clone();
  16273. var xObjStateManager = new StateManager(currentState);
  16274. var matrix = xobj.dict.getArray('Matrix');
  16275. if ((0, _util.isArray)(matrix) && matrix.length === 6) {
  16276. xObjStateManager.transform(matrix);
  16277. }
  16278. next(self.getTextContent({
  16279. stream: xobj,
  16280. task: task,
  16281. resources: xobj.dict.get('Resources') || resources,
  16282. stateManager: xObjStateManager,
  16283. normalizeWhitespace: normalizeWhitespace,
  16284. combineTextItems: combineTextItems
  16285. }).then(function (formTextContent) {
  16286. _util.Util.appendToArray(textContent.items, formTextContent.items);
  16287. _util.Util.extendObj(textContent.styles, formTextContent.styles);
  16288. xobjsCache.key = name;
  16289. xobjsCache.texts = formTextContent;
  16290. }));
  16291. return;
  16292. case _util.OPS.setGState:
  16293. flushTextContentItem();
  16294. var dictName = args[0];
  16295. var extGState = resources.get('ExtGState');
  16296. if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
  16297. break;
  16298. }
  16299. var gState = extGState.get(dictName.name);
  16300. if (!(0, _primitives.isDict)(gState)) {
  16301. break;
  16302. }
  16303. var gStateFont = gState.get('Font');
  16304. if (gStateFont) {
  16305. textState.fontName = null;
  16306. textState.fontSize = gStateFont[1];
  16307. next(handleSetFont(null, gStateFont[0]));
  16308. return;
  16309. }
  16310. break;
  16311. }
  16312. }
  16313. if (stop) {
  16314. next(deferred);
  16315. return;
  16316. }
  16317. flushTextContentItem();
  16318. resolve(textContent);
  16319. }).catch(function (reason) {
  16320. if (_this8.options.ignoreErrors) {
  16321. (0, _util.warn)('getTextContent - ignoring errors during task: ' + task.name);
  16322. flushTextContentItem();
  16323. return textContent;
  16324. }
  16325. throw reason;
  16326. });
  16327. },
  16328. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
  16329. var _this9 = this;
  16330. var xref = this.xref;
  16331. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  16332. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  16333. if (properties.composite) {
  16334. var cidSystemInfo = dict.get('CIDSystemInfo');
  16335. if ((0, _primitives.isDict)(cidSystemInfo)) {
  16336. properties.cidSystemInfo = {
  16337. registry: cidSystemInfo.get('Registry'),
  16338. ordering: cidSystemInfo.get('Ordering'),
  16339. supplement: cidSystemInfo.get('Supplement')
  16340. };
  16341. }
  16342. var cidToGidMap = dict.get('CIDToGIDMap');
  16343. if ((0, _primitives.isStream)(cidToGidMap)) {
  16344. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  16345. }
  16346. }
  16347. var differences = [];
  16348. var baseEncodingName = null;
  16349. var encoding;
  16350. if (dict.has('Encoding')) {
  16351. encoding = dict.get('Encoding');
  16352. if ((0, _primitives.isDict)(encoding)) {
  16353. baseEncodingName = encoding.get('BaseEncoding');
  16354. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  16355. if (encoding.has('Differences')) {
  16356. var diffEncoding = encoding.get('Differences');
  16357. var index = 0;
  16358. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  16359. var data = xref.fetchIfRef(diffEncoding[j]);
  16360. if ((0, _util.isNum)(data)) {
  16361. index = data;
  16362. } else if ((0, _primitives.isName)(data)) {
  16363. differences[index++] = data.name;
  16364. } else {
  16365. (0, _util.error)('Invalid entry in \'Differences\' array: ' + data);
  16366. }
  16367. }
  16368. }
  16369. } else if ((0, _primitives.isName)(encoding)) {
  16370. baseEncodingName = encoding.name;
  16371. } else {
  16372. (0, _util.error)('Encoding is not a Name nor a Dict');
  16373. }
  16374. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  16375. baseEncodingName = null;
  16376. }
  16377. }
  16378. if (baseEncodingName) {
  16379. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
  16380. } else {
  16381. var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
  16382. var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
  16383. encoding = _encodings.StandardEncoding;
  16384. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  16385. encoding = _encodings.WinAnsiEncoding;
  16386. }
  16387. if (isSymbolicFont) {
  16388. encoding = _encodings.MacRomanEncoding;
  16389. if (!properties.file) {
  16390. if (/Symbol/i.test(properties.name)) {
  16391. encoding = _encodings.SymbolSetEncoding;
  16392. } else if (/Dingbats/i.test(properties.name)) {
  16393. encoding = _encodings.ZapfDingbatsEncoding;
  16394. }
  16395. }
  16396. }
  16397. properties.defaultEncoding = encoding;
  16398. }
  16399. properties.differences = differences;
  16400. properties.baseEncodingName = baseEncodingName;
  16401. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  16402. properties.dict = dict;
  16403. return toUnicodePromise.then(function (toUnicode) {
  16404. properties.toUnicode = toUnicode;
  16405. return _this9.buildToUnicode(properties);
  16406. }).then(function (toUnicode) {
  16407. properties.toUnicode = toUnicode;
  16408. return properties;
  16409. });
  16410. },
  16411. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  16412. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  16413. if (properties.hasIncludedToUnicodeMap) {
  16414. return Promise.resolve(properties.toUnicode);
  16415. }
  16416. var toUnicode, charcode, glyphName;
  16417. if (!properties.composite) {
  16418. toUnicode = [];
  16419. var encoding = properties.defaultEncoding.slice();
  16420. var baseEncodingName = properties.baseEncodingName;
  16421. var differences = properties.differences;
  16422. for (charcode in differences) {
  16423. glyphName = differences[charcode];
  16424. if (glyphName === '.notdef') {
  16425. continue;
  16426. }
  16427. encoding[charcode] = glyphName;
  16428. }
  16429. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  16430. for (charcode in encoding) {
  16431. glyphName = encoding[charcode];
  16432. if (glyphName === '') {
  16433. continue;
  16434. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  16435. var code = 0;
  16436. switch (glyphName[0]) {
  16437. case 'G':
  16438. if (glyphName.length === 3) {
  16439. code = parseInt(glyphName.substr(1), 16);
  16440. }
  16441. break;
  16442. case 'g':
  16443. if (glyphName.length === 5) {
  16444. code = parseInt(glyphName.substr(1), 16);
  16445. }
  16446. break;
  16447. case 'C':
  16448. case 'c':
  16449. if (glyphName.length >= 3) {
  16450. code = +glyphName.substr(1);
  16451. }
  16452. break;
  16453. default:
  16454. var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  16455. if (unicode !== -1) {
  16456. code = unicode;
  16457. }
  16458. }
  16459. if (code) {
  16460. if (baseEncodingName && code === +charcode) {
  16461. var baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  16462. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  16463. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  16464. continue;
  16465. }
  16466. }
  16467. toUnicode[charcode] = String.fromCharCode(code);
  16468. }
  16469. continue;
  16470. }
  16471. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  16472. }
  16473. return Promise.resolve(new _fonts.ToUnicodeMap(toUnicode));
  16474. }
  16475. 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'))) {
  16476. var registry = properties.cidSystemInfo.registry;
  16477. var ordering = properties.cidSystemInfo.ordering;
  16478. var ucs2CMapName = _primitives.Name.get(registry + '-' + ordering + '-UCS2');
  16479. return _cmap.CMapFactory.create({
  16480. encoding: ucs2CMapName,
  16481. fetchBuiltInCMap: this.fetchBuiltInCMap,
  16482. useCMap: null
  16483. }).then(function (ucs2CMap) {
  16484. var cMap = properties.cMap;
  16485. toUnicode = [];
  16486. cMap.forEach(function (charcode, cid) {
  16487. (0, _util.assert)(cid <= 0xffff, 'Max size of CID is 65,535');
  16488. var ucs2 = ucs2CMap.lookup(cid);
  16489. if (ucs2) {
  16490. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  16491. }
  16492. });
  16493. return new _fonts.ToUnicodeMap(toUnicode);
  16494. });
  16495. }
  16496. return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  16497. },
  16498. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  16499. var cmapObj = toUnicode;
  16500. if ((0, _primitives.isName)(cmapObj)) {
  16501. return _cmap.CMapFactory.create({
  16502. encoding: cmapObj,
  16503. fetchBuiltInCMap: this.fetchBuiltInCMap,
  16504. useCMap: null
  16505. }).then(function (cmap) {
  16506. if (cmap instanceof _cmap.IdentityCMap) {
  16507. return new _fonts.IdentityToUnicodeMap(0, 0xFFFF);
  16508. }
  16509. return new _fonts.ToUnicodeMap(cmap.getMap());
  16510. });
  16511. } else if ((0, _primitives.isStream)(cmapObj)) {
  16512. return _cmap.CMapFactory.create({
  16513. encoding: cmapObj,
  16514. fetchBuiltInCMap: this.fetchBuiltInCMap,
  16515. useCMap: null
  16516. }).then(function (cmap) {
  16517. if (cmap instanceof _cmap.IdentityCMap) {
  16518. return new _fonts.IdentityToUnicodeMap(0, 0xFFFF);
  16519. }
  16520. var map = new Array(cmap.length);
  16521. cmap.forEach(function (charCode, token) {
  16522. var str = [];
  16523. for (var k = 0; k < token.length; k += 2) {
  16524. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  16525. if ((w1 & 0xF800) !== 0xD800) {
  16526. str.push(w1);
  16527. continue;
  16528. }
  16529. k += 2;
  16530. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  16531. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  16532. }
  16533. map[charCode] = String.fromCharCode.apply(String, str);
  16534. });
  16535. return new _fonts.ToUnicodeMap(map);
  16536. });
  16537. }
  16538. return Promise.resolve(null);
  16539. },
  16540. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  16541. var glyphsData = cidToGidStream.getBytes();
  16542. var result = [];
  16543. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  16544. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  16545. if (glyphID === 0) {
  16546. continue;
  16547. }
  16548. var code = j >> 1;
  16549. result[code] = glyphID;
  16550. }
  16551. return result;
  16552. },
  16553. extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
  16554. var xref = this.xref;
  16555. var glyphsWidths = [];
  16556. var defaultWidth = 0;
  16557. var glyphsVMetrics = [];
  16558. var defaultVMetrics;
  16559. var i, ii, j, jj, start, code, widths;
  16560. if (properties.composite) {
  16561. defaultWidth = dict.get('DW') || 1000;
  16562. widths = dict.get('W');
  16563. if (widths) {
  16564. for (i = 0, ii = widths.length; i < ii; i++) {
  16565. start = xref.fetchIfRef(widths[i++]);
  16566. code = xref.fetchIfRef(widths[i]);
  16567. if ((0, _util.isArray)(code)) {
  16568. for (j = 0, jj = code.length; j < jj; j++) {
  16569. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  16570. }
  16571. } else {
  16572. var width = xref.fetchIfRef(widths[++i]);
  16573. for (j = start; j <= code; j++) {
  16574. glyphsWidths[j] = width;
  16575. }
  16576. }
  16577. }
  16578. }
  16579. if (properties.vertical) {
  16580. var vmetrics = dict.getArray('DW2') || [880, -1000];
  16581. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  16582. vmetrics = dict.get('W2');
  16583. if (vmetrics) {
  16584. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  16585. start = xref.fetchIfRef(vmetrics[i++]);
  16586. code = xref.fetchIfRef(vmetrics[i]);
  16587. if ((0, _util.isArray)(code)) {
  16588. for (j = 0, jj = code.length; j < jj; j++) {
  16589. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  16590. }
  16591. } else {
  16592. var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  16593. for (j = start; j <= code; j++) {
  16594. glyphsVMetrics[j] = vmetric;
  16595. }
  16596. }
  16597. }
  16598. }
  16599. }
  16600. } else {
  16601. var firstChar = properties.firstChar;
  16602. widths = dict.get('Widths');
  16603. if (widths) {
  16604. j = firstChar;
  16605. for (i = 0, ii = widths.length; i < ii; i++) {
  16606. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  16607. }
  16608. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  16609. } else {
  16610. var baseFontName = dict.get('BaseFont');
  16611. if ((0, _primitives.isName)(baseFontName)) {
  16612. var metrics = this.getBaseFontMetrics(baseFontName.name);
  16613. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  16614. defaultWidth = metrics.defaultWidth;
  16615. }
  16616. }
  16617. }
  16618. var isMonospace = true;
  16619. var firstWidth = defaultWidth;
  16620. for (var glyph in glyphsWidths) {
  16621. var glyphWidth = glyphsWidths[glyph];
  16622. if (!glyphWidth) {
  16623. continue;
  16624. }
  16625. if (!firstWidth) {
  16626. firstWidth = glyphWidth;
  16627. continue;
  16628. }
  16629. if (firstWidth !== glyphWidth) {
  16630. isMonospace = false;
  16631. break;
  16632. }
  16633. }
  16634. if (isMonospace) {
  16635. properties.flags |= _fonts.FontFlags.FixedPitch;
  16636. }
  16637. properties.defaultWidth = defaultWidth;
  16638. properties.widths = glyphsWidths;
  16639. properties.defaultVMetrics = defaultVMetrics;
  16640. properties.vmetrics = glyphsVMetrics;
  16641. },
  16642. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  16643. var fontNameWoStyle = baseFontName.split('-')[0];
  16644. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  16645. },
  16646. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  16647. var defaultWidth = 0;
  16648. var widths = [];
  16649. var monospace = false;
  16650. var stdFontMap = (0, _standard_fonts.getStdFontMap)();
  16651. var lookupName = stdFontMap[name] || name;
  16652. var Metrics = (0, _metrics.getMetrics)();
  16653. if (!(lookupName in Metrics)) {
  16654. if (this.isSerifFont(name)) {
  16655. lookupName = 'Times-Roman';
  16656. } else {
  16657. lookupName = 'Helvetica';
  16658. }
  16659. }
  16660. var glyphWidths = Metrics[lookupName];
  16661. if ((0, _util.isNum)(glyphWidths)) {
  16662. defaultWidth = glyphWidths;
  16663. monospace = true;
  16664. } else {
  16665. widths = glyphWidths();
  16666. }
  16667. return {
  16668. defaultWidth: defaultWidth,
  16669. monospace: monospace,
  16670. widths: widths
  16671. };
  16672. },
  16673. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  16674. var widths = Object.create(null);
  16675. var differences = properties.differences;
  16676. var encoding = properties.defaultEncoding;
  16677. for (var charCode = 0; charCode < 256; charCode++) {
  16678. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  16679. widths[charCode] = widthsByGlyphName[differences[charCode]];
  16680. continue;
  16681. }
  16682. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  16683. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  16684. continue;
  16685. }
  16686. }
  16687. return widths;
  16688. },
  16689. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) {
  16690. var baseDict = dict;
  16691. var type = dict.get('Subtype');
  16692. (0, _util.assert)((0, _primitives.isName)(type), 'invalid font Subtype');
  16693. var composite = false;
  16694. var uint8array;
  16695. if (type.name === 'Type0') {
  16696. var df = dict.get('DescendantFonts');
  16697. (0, _util.assert)(df, 'Descendant fonts are not specified');
  16698. dict = (0, _util.isArray)(df) ? this.xref.fetchIfRef(df[0]) : df;
  16699. type = dict.get('Subtype');
  16700. (0, _util.assert)((0, _primitives.isName)(type), 'invalid font Subtype');
  16701. composite = true;
  16702. }
  16703. var descriptor = dict.get('FontDescriptor');
  16704. if (descriptor) {
  16705. var hash = new _murmurhash.MurmurHash3_64();
  16706. var encoding = baseDict.getRaw('Encoding');
  16707. if ((0, _primitives.isName)(encoding)) {
  16708. hash.update(encoding.name);
  16709. } else if ((0, _primitives.isRef)(encoding)) {
  16710. hash.update(encoding.toString());
  16711. } else if ((0, _primitives.isDict)(encoding)) {
  16712. var keys = encoding.getKeys();
  16713. for (var i = 0, ii = keys.length; i < ii; i++) {
  16714. var entry = encoding.getRaw(keys[i]);
  16715. if ((0, _primitives.isName)(entry)) {
  16716. hash.update(entry.name);
  16717. } else if ((0, _primitives.isRef)(entry)) {
  16718. hash.update(entry.toString());
  16719. } else if ((0, _util.isArray)(entry)) {
  16720. var diffLength = entry.length,
  16721. diffBuf = new Array(diffLength);
  16722. for (var j = 0; j < diffLength; j++) {
  16723. var diffEntry = entry[j];
  16724. if ((0, _primitives.isName)(diffEntry)) {
  16725. diffBuf[j] = diffEntry.name;
  16726. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  16727. diffBuf[j] = diffEntry.toString();
  16728. }
  16729. }
  16730. hash.update(diffBuf.join());
  16731. }
  16732. }
  16733. }
  16734. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  16735. if ((0, _primitives.isStream)(toUnicode)) {
  16736. var stream = toUnicode.str || toUnicode;
  16737. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  16738. hash.update(uint8array);
  16739. } else if ((0, _primitives.isName)(toUnicode)) {
  16740. hash.update(toUnicode.name);
  16741. }
  16742. var widths = dict.get('Widths') || baseDict.get('Widths');
  16743. if (widths) {
  16744. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  16745. hash.update(uint8array);
  16746. }
  16747. }
  16748. return {
  16749. descriptor: descriptor,
  16750. dict: dict,
  16751. baseDict: baseDict,
  16752. composite: composite,
  16753. type: type.name,
  16754. hash: hash ? hash.hexdigest() : ''
  16755. };
  16756. },
  16757. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) {
  16758. var _this10 = this;
  16759. var baseDict = preEvaluatedFont.baseDict;
  16760. var dict = preEvaluatedFont.dict;
  16761. var composite = preEvaluatedFont.composite;
  16762. var descriptor = preEvaluatedFont.descriptor;
  16763. var type = preEvaluatedFont.type;
  16764. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  16765. var properties;
  16766. if (!descriptor) {
  16767. if (type === 'Type3') {
  16768. descriptor = new _primitives.Dict(null);
  16769. descriptor.set('FontName', _primitives.Name.get(type));
  16770. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  16771. } else {
  16772. var baseFontName = dict.get('BaseFont');
  16773. (0, _util.assert)((0, _primitives.isName)(baseFontName), 'Base font is not specified');
  16774. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  16775. var metrics = this.getBaseFontMetrics(baseFontName);
  16776. var fontNameWoStyle = baseFontName.split('-')[0];
  16777. 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);
  16778. properties = {
  16779. type: type,
  16780. name: baseFontName,
  16781. widths: metrics.widths,
  16782. defaultWidth: metrics.defaultWidth,
  16783. flags: flags,
  16784. firstChar: 0,
  16785. lastChar: maxCharIndex
  16786. };
  16787. return this.extractDataStructures(dict, dict, properties).then(function (properties) {
  16788. properties.widths = _this10.buildCharCodeToWidth(metrics.widths, properties);
  16789. return new _fonts.Font(baseFontName, null, properties);
  16790. });
  16791. }
  16792. }
  16793. var firstChar = dict.get('FirstChar') || 0;
  16794. var lastChar = dict.get('LastChar') || maxCharIndex;
  16795. var fontName = descriptor.get('FontName');
  16796. var baseFont = dict.get('BaseFont');
  16797. if ((0, _util.isString)(fontName)) {
  16798. fontName = _primitives.Name.get(fontName);
  16799. }
  16800. if ((0, _util.isString)(baseFont)) {
  16801. baseFont = _primitives.Name.get(baseFont);
  16802. }
  16803. if (type !== 'Type3') {
  16804. var fontNameStr = fontName && fontName.name;
  16805. var baseFontStr = baseFont && baseFont.name;
  16806. if (fontNameStr !== baseFontStr) {
  16807. (0, _util.info)('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  16808. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  16809. fontName = baseFont;
  16810. }
  16811. }
  16812. }
  16813. fontName = fontName || baseFont;
  16814. (0, _util.assert)((0, _primitives.isName)(fontName), 'invalid font name');
  16815. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  16816. if (fontFile) {
  16817. if (fontFile.dict) {
  16818. var subtype = fontFile.dict.get('Subtype');
  16819. if (subtype) {
  16820. subtype = subtype.name;
  16821. }
  16822. var length1 = fontFile.dict.get('Length1');
  16823. var length2 = fontFile.dict.get('Length2');
  16824. var length3 = fontFile.dict.get('Length3');
  16825. }
  16826. }
  16827. properties = {
  16828. type: type,
  16829. name: fontName.name,
  16830. subtype: subtype,
  16831. file: fontFile,
  16832. length1: length1,
  16833. length2: length2,
  16834. length3: length3,
  16835. loadedName: baseDict.loadedName,
  16836. composite: composite,
  16837. wideChars: composite,
  16838. fixedPitch: false,
  16839. fontMatrix: dict.getArray('FontMatrix') || _util.FONT_IDENTITY_MATRIX,
  16840. firstChar: firstChar || 0,
  16841. lastChar: lastChar || maxCharIndex,
  16842. bbox: descriptor.getArray('FontBBox'),
  16843. ascent: descriptor.get('Ascent'),
  16844. descent: descriptor.get('Descent'),
  16845. xHeight: descriptor.get('XHeight'),
  16846. capHeight: descriptor.get('CapHeight'),
  16847. flags: descriptor.get('Flags'),
  16848. italicAngle: descriptor.get('ItalicAngle'),
  16849. coded: false
  16850. };
  16851. var cMapPromise;
  16852. if (composite) {
  16853. var cidEncoding = baseDict.get('Encoding');
  16854. if ((0, _primitives.isName)(cidEncoding)) {
  16855. properties.cidEncoding = cidEncoding.name;
  16856. }
  16857. cMapPromise = _cmap.CMapFactory.create({
  16858. encoding: cidEncoding,
  16859. fetchBuiltInCMap: this.fetchBuiltInCMap,
  16860. useCMap: null
  16861. }).then(function (cMap) {
  16862. properties.cMap = cMap;
  16863. properties.vertical = properties.cMap.vertical;
  16864. });
  16865. } else {
  16866. cMapPromise = Promise.resolve(undefined);
  16867. }
  16868. return cMapPromise.then(function () {
  16869. return _this10.extractDataStructures(dict, baseDict, properties);
  16870. }).then(function (properties) {
  16871. _this10.extractWidths(dict, descriptor, properties);
  16872. if (type === 'Type3') {
  16873. properties.isType3Font = true;
  16874. }
  16875. return new _fonts.Font(fontName.name, fontFile, properties);
  16876. });
  16877. }
  16878. };
  16879. return PartialEvaluator;
  16880. }();
  16881. var TranslatedFont = function TranslatedFontClosure() {
  16882. function TranslatedFont(loadedName, font, dict) {
  16883. this.loadedName = loadedName;
  16884. this.font = font;
  16885. this.dict = dict;
  16886. this.type3Loaded = null;
  16887. this.sent = false;
  16888. }
  16889. TranslatedFont.prototype = {
  16890. send: function send(handler) {
  16891. if (this.sent) {
  16892. return;
  16893. }
  16894. var fontData = this.font.exportData();
  16895. handler.send('commonobj', [this.loadedName, 'Font', fontData]);
  16896. this.sent = true;
  16897. },
  16898. loadType3Data: function loadType3Data(evaluator, resources, parentOperatorList, task) {
  16899. (0, _util.assert)(this.font.isType3Font);
  16900. if (this.type3Loaded) {
  16901. return this.type3Loaded;
  16902. }
  16903. var type3Options = Object.create(evaluator.options);
  16904. type3Options.ignoreErrors = false;
  16905. var type3Evaluator = evaluator.clone(type3Options);
  16906. var translatedFont = this.font;
  16907. var loadCharProcsPromise = Promise.resolve();
  16908. var charProcs = this.dict.get('CharProcs');
  16909. var fontResources = this.dict.get('Resources') || resources;
  16910. var charProcKeys = charProcs.getKeys();
  16911. var charProcOperatorList = Object.create(null);
  16912. var _loop2 = function _loop2() {
  16913. var key = charProcKeys[i];
  16914. loadCharProcsPromise = loadCharProcsPromise.then(function () {
  16915. var glyphStream = charProcs.get(key);
  16916. var operatorList = new OperatorList();
  16917. return type3Evaluator.getOperatorList({
  16918. stream: glyphStream,
  16919. task: task,
  16920. resources: fontResources,
  16921. operatorList: operatorList
  16922. }).then(function () {
  16923. charProcOperatorList[key] = operatorList.getIR();
  16924. parentOperatorList.addDependencies(operatorList.dependencies);
  16925. }).catch(function (reason) {
  16926. (0, _util.warn)('Type3 font resource "' + key + '" is not available.');
  16927. var operatorList = new OperatorList();
  16928. charProcOperatorList[key] = operatorList.getIR();
  16929. });
  16930. });
  16931. };
  16932. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  16933. _loop2();
  16934. }
  16935. this.type3Loaded = loadCharProcsPromise.then(function () {
  16936. translatedFont.charProcOperatorList = charProcOperatorList;
  16937. });
  16938. return this.type3Loaded;
  16939. }
  16940. };
  16941. return TranslatedFont;
  16942. }();
  16943. var OperatorList = function OperatorListClosure() {
  16944. var CHUNK_SIZE = 1000;
  16945. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  16946. function getTransfers(queue) {
  16947. var transfers = [];
  16948. var fnArray = queue.fnArray,
  16949. argsArray = queue.argsArray;
  16950. for (var i = 0, ii = queue.length; i < ii; i++) {
  16951. switch (fnArray[i]) {
  16952. case _util.OPS.paintInlineImageXObject:
  16953. case _util.OPS.paintInlineImageXObjectGroup:
  16954. case _util.OPS.paintImageMaskXObject:
  16955. var arg = argsArray[i][0];
  16956. if (!arg.cached) {
  16957. transfers.push(arg.data.buffer);
  16958. }
  16959. break;
  16960. }
  16961. }
  16962. return transfers;
  16963. }
  16964. function OperatorList(intent, messageHandler, pageIndex) {
  16965. this.messageHandler = messageHandler;
  16966. this.fnArray = [];
  16967. this.argsArray = [];
  16968. this.dependencies = Object.create(null);
  16969. this._totalLength = 0;
  16970. this.pageIndex = pageIndex;
  16971. this.intent = intent;
  16972. }
  16973. OperatorList.prototype = {
  16974. get length() {
  16975. return this.argsArray.length;
  16976. },
  16977. get totalLength() {
  16978. return this._totalLength + this.length;
  16979. },
  16980. addOp: function addOp(fn, args) {
  16981. this.fnArray.push(fn);
  16982. this.argsArray.push(args);
  16983. if (this.messageHandler) {
  16984. if (this.fnArray.length >= CHUNK_SIZE) {
  16985. this.flush();
  16986. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  16987. this.flush();
  16988. }
  16989. }
  16990. },
  16991. addDependency: function addDependency(dependency) {
  16992. if (dependency in this.dependencies) {
  16993. return;
  16994. }
  16995. this.dependencies[dependency] = true;
  16996. this.addOp(_util.OPS.dependency, [dependency]);
  16997. },
  16998. addDependencies: function addDependencies(dependencies) {
  16999. for (var key in dependencies) {
  17000. this.addDependency(key);
  17001. }
  17002. },
  17003. addOpList: function addOpList(opList) {
  17004. _util.Util.extendObj(this.dependencies, opList.dependencies);
  17005. for (var i = 0, ii = opList.length; i < ii; i++) {
  17006. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  17007. }
  17008. },
  17009. getIR: function getIR() {
  17010. return {
  17011. fnArray: this.fnArray,
  17012. argsArray: this.argsArray,
  17013. length: this.length
  17014. };
  17015. },
  17016. flush: function flush(lastChunk) {
  17017. if (this.intent !== 'oplist') {
  17018. new QueueOptimizer().optimize(this);
  17019. }
  17020. var transfers = getTransfers(this);
  17021. var length = this.length;
  17022. this._totalLength += length;
  17023. this.messageHandler.send('RenderPageChunk', {
  17024. operatorList: {
  17025. fnArray: this.fnArray,
  17026. argsArray: this.argsArray,
  17027. lastChunk: lastChunk,
  17028. length: length
  17029. },
  17030. pageIndex: this.pageIndex,
  17031. intent: this.intent
  17032. }, transfers);
  17033. this.dependencies = Object.create(null);
  17034. this.fnArray.length = 0;
  17035. this.argsArray.length = 0;
  17036. }
  17037. };
  17038. return OperatorList;
  17039. }();
  17040. var StateManager = function StateManagerClosure() {
  17041. function StateManager(initialState) {
  17042. this.state = initialState;
  17043. this.stateStack = [];
  17044. }
  17045. StateManager.prototype = {
  17046. save: function save() {
  17047. var old = this.state;
  17048. this.stateStack.push(this.state);
  17049. this.state = old.clone();
  17050. },
  17051. restore: function restore() {
  17052. var prev = this.stateStack.pop();
  17053. if (prev) {
  17054. this.state = prev;
  17055. }
  17056. },
  17057. transform: function transform(args) {
  17058. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  17059. }
  17060. };
  17061. return StateManager;
  17062. }();
  17063. var TextState = function TextStateClosure() {
  17064. function TextState() {
  17065. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  17066. this.fontName = null;
  17067. this.fontSize = 0;
  17068. this.font = null;
  17069. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  17070. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  17071. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  17072. this.charSpacing = 0;
  17073. this.wordSpacing = 0;
  17074. this.leading = 0;
  17075. this.textHScale = 1;
  17076. this.textRise = 0;
  17077. }
  17078. TextState.prototype = {
  17079. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  17080. var m = this.textMatrix;
  17081. m[0] = a;
  17082. m[1] = b;
  17083. m[2] = c;
  17084. m[3] = d;
  17085. m[4] = e;
  17086. m[5] = f;
  17087. },
  17088. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  17089. var m = this.textLineMatrix;
  17090. m[0] = a;
  17091. m[1] = b;
  17092. m[2] = c;
  17093. m[3] = d;
  17094. m[4] = e;
  17095. m[5] = f;
  17096. },
  17097. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  17098. var m = this.textMatrix;
  17099. m[4] = m[0] * x + m[2] * y + m[4];
  17100. m[5] = m[1] * x + m[3] * y + m[5];
  17101. },
  17102. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  17103. var m = this.textLineMatrix;
  17104. m[4] = m[0] * x + m[2] * y + m[4];
  17105. m[5] = m[1] * x + m[3] * y + m[5];
  17106. },
  17107. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  17108. var font = this.font;
  17109. if (!font) {
  17110. return null;
  17111. }
  17112. var m = this.textLineMatrix;
  17113. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  17114. return null;
  17115. }
  17116. var txDiff = e - m[4],
  17117. tyDiff = f - m[5];
  17118. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  17119. return null;
  17120. }
  17121. var tx,
  17122. ty,
  17123. denominator = a * d - b * c;
  17124. if (font.vertical) {
  17125. tx = -tyDiff * c / denominator;
  17126. ty = tyDiff * a / denominator;
  17127. } else {
  17128. tx = txDiff * d / denominator;
  17129. ty = -txDiff * b / denominator;
  17130. }
  17131. return {
  17132. width: tx,
  17133. height: ty,
  17134. value: font.vertical ? ty : tx
  17135. };
  17136. },
  17137. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  17138. var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
  17139. return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
  17140. },
  17141. carriageReturn: function TextState_carriageReturn() {
  17142. this.translateTextLineMatrix(0, -this.leading);
  17143. this.textMatrix = this.textLineMatrix.slice();
  17144. },
  17145. clone: function TextState_clone() {
  17146. var clone = Object.create(this);
  17147. clone.textMatrix = this.textMatrix.slice();
  17148. clone.textLineMatrix = this.textLineMatrix.slice();
  17149. clone.fontMatrix = this.fontMatrix.slice();
  17150. return clone;
  17151. }
  17152. };
  17153. return TextState;
  17154. }();
  17155. var EvalState = function EvalStateClosure() {
  17156. function EvalState() {
  17157. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  17158. this.font = null;
  17159. this.textRenderingMode = _util.TextRenderingMode.FILL;
  17160. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  17161. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  17162. }
  17163. EvalState.prototype = {
  17164. clone: function CanvasExtraState_clone() {
  17165. return Object.create(this);
  17166. }
  17167. };
  17168. return EvalState;
  17169. }();
  17170. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  17171. var getOPMap = (0, _util.getLookupTableFactory)(function (t) {
  17172. t['w'] = {
  17173. id: _util.OPS.setLineWidth,
  17174. numArgs: 1,
  17175. variableArgs: false
  17176. };
  17177. t['J'] = {
  17178. id: _util.OPS.setLineCap,
  17179. numArgs: 1,
  17180. variableArgs: false
  17181. };
  17182. t['j'] = {
  17183. id: _util.OPS.setLineJoin,
  17184. numArgs: 1,
  17185. variableArgs: false
  17186. };
  17187. t['M'] = {
  17188. id: _util.OPS.setMiterLimit,
  17189. numArgs: 1,
  17190. variableArgs: false
  17191. };
  17192. t['d'] = {
  17193. id: _util.OPS.setDash,
  17194. numArgs: 2,
  17195. variableArgs: false
  17196. };
  17197. t['ri'] = {
  17198. id: _util.OPS.setRenderingIntent,
  17199. numArgs: 1,
  17200. variableArgs: false
  17201. };
  17202. t['i'] = {
  17203. id: _util.OPS.setFlatness,
  17204. numArgs: 1,
  17205. variableArgs: false
  17206. };
  17207. t['gs'] = {
  17208. id: _util.OPS.setGState,
  17209. numArgs: 1,
  17210. variableArgs: false
  17211. };
  17212. t['q'] = {
  17213. id: _util.OPS.save,
  17214. numArgs: 0,
  17215. variableArgs: false
  17216. };
  17217. t['Q'] = {
  17218. id: _util.OPS.restore,
  17219. numArgs: 0,
  17220. variableArgs: false
  17221. };
  17222. t['cm'] = {
  17223. id: _util.OPS.transform,
  17224. numArgs: 6,
  17225. variableArgs: false
  17226. };
  17227. t['m'] = {
  17228. id: _util.OPS.moveTo,
  17229. numArgs: 2,
  17230. variableArgs: false
  17231. };
  17232. t['l'] = {
  17233. id: _util.OPS.lineTo,
  17234. numArgs: 2,
  17235. variableArgs: false
  17236. };
  17237. t['c'] = {
  17238. id: _util.OPS.curveTo,
  17239. numArgs: 6,
  17240. variableArgs: false
  17241. };
  17242. t['v'] = {
  17243. id: _util.OPS.curveTo2,
  17244. numArgs: 4,
  17245. variableArgs: false
  17246. };
  17247. t['y'] = {
  17248. id: _util.OPS.curveTo3,
  17249. numArgs: 4,
  17250. variableArgs: false
  17251. };
  17252. t['h'] = {
  17253. id: _util.OPS.closePath,
  17254. numArgs: 0,
  17255. variableArgs: false
  17256. };
  17257. t['re'] = {
  17258. id: _util.OPS.rectangle,
  17259. numArgs: 4,
  17260. variableArgs: false
  17261. };
  17262. t['S'] = {
  17263. id: _util.OPS.stroke,
  17264. numArgs: 0,
  17265. variableArgs: false
  17266. };
  17267. t['s'] = {
  17268. id: _util.OPS.closeStroke,
  17269. numArgs: 0,
  17270. variableArgs: false
  17271. };
  17272. t['f'] = {
  17273. id: _util.OPS.fill,
  17274. numArgs: 0,
  17275. variableArgs: false
  17276. };
  17277. t['F'] = {
  17278. id: _util.OPS.fill,
  17279. numArgs: 0,
  17280. variableArgs: false
  17281. };
  17282. t['f*'] = {
  17283. id: _util.OPS.eoFill,
  17284. numArgs: 0,
  17285. variableArgs: false
  17286. };
  17287. t['B'] = {
  17288. id: _util.OPS.fillStroke,
  17289. numArgs: 0,
  17290. variableArgs: false
  17291. };
  17292. t['B*'] = {
  17293. id: _util.OPS.eoFillStroke,
  17294. numArgs: 0,
  17295. variableArgs: false
  17296. };
  17297. t['b'] = {
  17298. id: _util.OPS.closeFillStroke,
  17299. numArgs: 0,
  17300. variableArgs: false
  17301. };
  17302. t['b*'] = {
  17303. id: _util.OPS.closeEOFillStroke,
  17304. numArgs: 0,
  17305. variableArgs: false
  17306. };
  17307. t['n'] = {
  17308. id: _util.OPS.endPath,
  17309. numArgs: 0,
  17310. variableArgs: false
  17311. };
  17312. t['W'] = {
  17313. id: _util.OPS.clip,
  17314. numArgs: 0,
  17315. variableArgs: false
  17316. };
  17317. t['W*'] = {
  17318. id: _util.OPS.eoClip,
  17319. numArgs: 0,
  17320. variableArgs: false
  17321. };
  17322. t['BT'] = {
  17323. id: _util.OPS.beginText,
  17324. numArgs: 0,
  17325. variableArgs: false
  17326. };
  17327. t['ET'] = {
  17328. id: _util.OPS.endText,
  17329. numArgs: 0,
  17330. variableArgs: false
  17331. };
  17332. t['Tc'] = {
  17333. id: _util.OPS.setCharSpacing,
  17334. numArgs: 1,
  17335. variableArgs: false
  17336. };
  17337. t['Tw'] = {
  17338. id: _util.OPS.setWordSpacing,
  17339. numArgs: 1,
  17340. variableArgs: false
  17341. };
  17342. t['Tz'] = {
  17343. id: _util.OPS.setHScale,
  17344. numArgs: 1,
  17345. variableArgs: false
  17346. };
  17347. t['TL'] = {
  17348. id: _util.OPS.setLeading,
  17349. numArgs: 1,
  17350. variableArgs: false
  17351. };
  17352. t['Tf'] = {
  17353. id: _util.OPS.setFont,
  17354. numArgs: 2,
  17355. variableArgs: false
  17356. };
  17357. t['Tr'] = {
  17358. id: _util.OPS.setTextRenderingMode,
  17359. numArgs: 1,
  17360. variableArgs: false
  17361. };
  17362. t['Ts'] = {
  17363. id: _util.OPS.setTextRise,
  17364. numArgs: 1,
  17365. variableArgs: false
  17366. };
  17367. t['Td'] = {
  17368. id: _util.OPS.moveText,
  17369. numArgs: 2,
  17370. variableArgs: false
  17371. };
  17372. t['TD'] = {
  17373. id: _util.OPS.setLeadingMoveText,
  17374. numArgs: 2,
  17375. variableArgs: false
  17376. };
  17377. t['Tm'] = {
  17378. id: _util.OPS.setTextMatrix,
  17379. numArgs: 6,
  17380. variableArgs: false
  17381. };
  17382. t['T*'] = {
  17383. id: _util.OPS.nextLine,
  17384. numArgs: 0,
  17385. variableArgs: false
  17386. };
  17387. t['Tj'] = {
  17388. id: _util.OPS.showText,
  17389. numArgs: 1,
  17390. variableArgs: false
  17391. };
  17392. t['TJ'] = {
  17393. id: _util.OPS.showSpacedText,
  17394. numArgs: 1,
  17395. variableArgs: false
  17396. };
  17397. t['\''] = {
  17398. id: _util.OPS.nextLineShowText,
  17399. numArgs: 1,
  17400. variableArgs: false
  17401. };
  17402. t['"'] = {
  17403. id: _util.OPS.nextLineSetSpacingShowText,
  17404. numArgs: 3,
  17405. variableArgs: false
  17406. };
  17407. t['d0'] = {
  17408. id: _util.OPS.setCharWidth,
  17409. numArgs: 2,
  17410. variableArgs: false
  17411. };
  17412. t['d1'] = {
  17413. id: _util.OPS.setCharWidthAndBounds,
  17414. numArgs: 6,
  17415. variableArgs: false
  17416. };
  17417. t['CS'] = {
  17418. id: _util.OPS.setStrokeColorSpace,
  17419. numArgs: 1,
  17420. variableArgs: false
  17421. };
  17422. t['cs'] = {
  17423. id: _util.OPS.setFillColorSpace,
  17424. numArgs: 1,
  17425. variableArgs: false
  17426. };
  17427. t['SC'] = {
  17428. id: _util.OPS.setStrokeColor,
  17429. numArgs: 4,
  17430. variableArgs: true
  17431. };
  17432. t['SCN'] = {
  17433. id: _util.OPS.setStrokeColorN,
  17434. numArgs: 33,
  17435. variableArgs: true
  17436. };
  17437. t['sc'] = {
  17438. id: _util.OPS.setFillColor,
  17439. numArgs: 4,
  17440. variableArgs: true
  17441. };
  17442. t['scn'] = {
  17443. id: _util.OPS.setFillColorN,
  17444. numArgs: 33,
  17445. variableArgs: true
  17446. };
  17447. t['G'] = {
  17448. id: _util.OPS.setStrokeGray,
  17449. numArgs: 1,
  17450. variableArgs: false
  17451. };
  17452. t['g'] = {
  17453. id: _util.OPS.setFillGray,
  17454. numArgs: 1,
  17455. variableArgs: false
  17456. };
  17457. t['RG'] = {
  17458. id: _util.OPS.setStrokeRGBColor,
  17459. numArgs: 3,
  17460. variableArgs: false
  17461. };
  17462. t['rg'] = {
  17463. id: _util.OPS.setFillRGBColor,
  17464. numArgs: 3,
  17465. variableArgs: false
  17466. };
  17467. t['K'] = {
  17468. id: _util.OPS.setStrokeCMYKColor,
  17469. numArgs: 4,
  17470. variableArgs: false
  17471. };
  17472. t['k'] = {
  17473. id: _util.OPS.setFillCMYKColor,
  17474. numArgs: 4,
  17475. variableArgs: false
  17476. };
  17477. t['sh'] = {
  17478. id: _util.OPS.shadingFill,
  17479. numArgs: 1,
  17480. variableArgs: false
  17481. };
  17482. t['BI'] = {
  17483. id: _util.OPS.beginInlineImage,
  17484. numArgs: 0,
  17485. variableArgs: false
  17486. };
  17487. t['ID'] = {
  17488. id: _util.OPS.beginImageData,
  17489. numArgs: 0,
  17490. variableArgs: false
  17491. };
  17492. t['EI'] = {
  17493. id: _util.OPS.endInlineImage,
  17494. numArgs: 1,
  17495. variableArgs: false
  17496. };
  17497. t['Do'] = {
  17498. id: _util.OPS.paintXObject,
  17499. numArgs: 1,
  17500. variableArgs: false
  17501. };
  17502. t['MP'] = {
  17503. id: _util.OPS.markPoint,
  17504. numArgs: 1,
  17505. variableArgs: false
  17506. };
  17507. t['DP'] = {
  17508. id: _util.OPS.markPointProps,
  17509. numArgs: 2,
  17510. variableArgs: false
  17511. };
  17512. t['BMC'] = {
  17513. id: _util.OPS.beginMarkedContent,
  17514. numArgs: 1,
  17515. variableArgs: false
  17516. };
  17517. t['BDC'] = {
  17518. id: _util.OPS.beginMarkedContentProps,
  17519. numArgs: 2,
  17520. variableArgs: false
  17521. };
  17522. t['EMC'] = {
  17523. id: _util.OPS.endMarkedContent,
  17524. numArgs: 0,
  17525. variableArgs: false
  17526. };
  17527. t['BX'] = {
  17528. id: _util.OPS.beginCompat,
  17529. numArgs: 0,
  17530. variableArgs: false
  17531. };
  17532. t['EX'] = {
  17533. id: _util.OPS.endCompat,
  17534. numArgs: 0,
  17535. variableArgs: false
  17536. };
  17537. t['BM'] = null;
  17538. t['BD'] = null;
  17539. t['true'] = null;
  17540. t['fa'] = null;
  17541. t['fal'] = null;
  17542. t['fals'] = null;
  17543. t['false'] = null;
  17544. t['nu'] = null;
  17545. t['nul'] = null;
  17546. t['null'] = null;
  17547. });
  17548. function EvaluatorPreprocessor(stream, xref, stateManager) {
  17549. this.opMap = getOPMap();
  17550. this.parser = new _parser.Parser(new _parser.Lexer(stream, this.opMap), false, xref);
  17551. this.stateManager = stateManager;
  17552. this.nonProcessedArgs = [];
  17553. }
  17554. EvaluatorPreprocessor.prototype = {
  17555. get savedStatesDepth() {
  17556. return this.stateManager.stateStack.length;
  17557. },
  17558. read: function EvaluatorPreprocessor_read(operation) {
  17559. var args = operation.args;
  17560. while (true) {
  17561. var obj = this.parser.getObj();
  17562. if ((0, _primitives.isCmd)(obj)) {
  17563. var cmd = obj.cmd;
  17564. var opSpec = this.opMap[cmd];
  17565. if (!opSpec) {
  17566. (0, _util.warn)('Unknown command "' + cmd + '"');
  17567. continue;
  17568. }
  17569. var fn = opSpec.id;
  17570. var numArgs = opSpec.numArgs;
  17571. var argsLength = args !== null ? args.length : 0;
  17572. if (!opSpec.variableArgs) {
  17573. if (argsLength !== numArgs) {
  17574. var nonProcessedArgs = this.nonProcessedArgs;
  17575. while (argsLength > numArgs) {
  17576. nonProcessedArgs.push(args.shift());
  17577. argsLength--;
  17578. }
  17579. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  17580. if (args === null) {
  17581. args = [];
  17582. }
  17583. args.unshift(nonProcessedArgs.pop());
  17584. argsLength++;
  17585. }
  17586. }
  17587. if (argsLength < numArgs) {
  17588. (0, _util.warn)('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  17589. if (args !== null) {
  17590. args.length = 0;
  17591. }
  17592. continue;
  17593. }
  17594. } else if (argsLength > numArgs) {
  17595. (0, _util.info)('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  17596. }
  17597. this.preprocessCommand(fn, args);
  17598. operation.fn = fn;
  17599. operation.args = args;
  17600. return true;
  17601. }
  17602. if ((0, _primitives.isEOF)(obj)) {
  17603. return false;
  17604. }
  17605. if (obj !== null) {
  17606. if (args === null) {
  17607. args = [];
  17608. }
  17609. args.push(obj);
  17610. (0, _util.assert)(args.length <= 33, 'Too many arguments');
  17611. }
  17612. }
  17613. },
  17614. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  17615. switch (fn | 0) {
  17616. case _util.OPS.save:
  17617. this.stateManager.save();
  17618. break;
  17619. case _util.OPS.restore:
  17620. this.stateManager.restore();
  17621. break;
  17622. case _util.OPS.transform:
  17623. this.stateManager.transform(args);
  17624. break;
  17625. }
  17626. }
  17627. };
  17628. return EvaluatorPreprocessor;
  17629. }();
  17630. var QueueOptimizer = function QueueOptimizerClosure() {
  17631. function addState(parentState, pattern, fn) {
  17632. var state = parentState;
  17633. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  17634. var item = pattern[i];
  17635. state = state[item] || (state[item] = []);
  17636. }
  17637. state[pattern[pattern.length - 1]] = fn;
  17638. }
  17639. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  17640. var iFirstPIMXO = iFirstSave + 2;
  17641. for (var i = 0; i < count; i++) {
  17642. var arg = argsArray[iFirstPIMXO + 4 * i];
  17643. var imageMask = arg.length === 1 && arg[0];
  17644. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  17645. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  17646. continue;
  17647. }
  17648. break;
  17649. }
  17650. return count - i;
  17651. }
  17652. var InitialState = [];
  17653. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], function foundInlineImageGroup(context) {
  17654. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  17655. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  17656. var MAX_WIDTH = 1000;
  17657. var IMAGE_PADDING = 1;
  17658. var fnArray = context.fnArray,
  17659. argsArray = context.argsArray;
  17660. var curr = context.iCurr;
  17661. var iFirstSave = curr - 3;
  17662. var iFirstTransform = curr - 2;
  17663. var iFirstPIIXO = curr - 1;
  17664. var i = iFirstSave + 4;
  17665. var ii = fnArray.length;
  17666. while (i + 3 < ii) {
  17667. if (fnArray[i] !== _util.OPS.save || fnArray[i + 1] !== _util.OPS.transform || fnArray[i + 2] !== _util.OPS.paintInlineImageXObject || fnArray[i + 3] !== _util.OPS.restore) {
  17668. break;
  17669. }
  17670. i += 4;
  17671. }
  17672. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  17673. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  17674. return i;
  17675. }
  17676. var maxX = 0;
  17677. var map = [],
  17678. maxLineHeight = 0;
  17679. var currentX = IMAGE_PADDING,
  17680. currentY = IMAGE_PADDING;
  17681. var q;
  17682. for (q = 0; q < count; q++) {
  17683. var transform = argsArray[iFirstTransform + (q << 2)];
  17684. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  17685. if (currentX + img.width > MAX_WIDTH) {
  17686. maxX = Math.max(maxX, currentX);
  17687. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  17688. currentX = 0;
  17689. maxLineHeight = 0;
  17690. }
  17691. map.push({
  17692. transform: transform,
  17693. x: currentX,
  17694. y: currentY,
  17695. w: img.width,
  17696. h: img.height
  17697. });
  17698. currentX += img.width + 2 * IMAGE_PADDING;
  17699. maxLineHeight = Math.max(maxLineHeight, img.height);
  17700. }
  17701. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  17702. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  17703. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  17704. var imgRowSize = imgWidth << 2;
  17705. for (q = 0; q < count; q++) {
  17706. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  17707. var rowSize = map[q].w << 2;
  17708. var dataOffset = 0;
  17709. var offset = map[q].x + map[q].y * imgWidth << 2;
  17710. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  17711. for (var k = 0, kk = map[q].h; k < kk; k++) {
  17712. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  17713. dataOffset += rowSize;
  17714. offset += imgRowSize;
  17715. }
  17716. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  17717. while (offset >= 0) {
  17718. data[offset - 4] = data[offset];
  17719. data[offset - 3] = data[offset + 1];
  17720. data[offset - 2] = data[offset + 2];
  17721. data[offset - 1] = data[offset + 3];
  17722. data[offset + rowSize] = data[offset + rowSize - 4];
  17723. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  17724. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  17725. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  17726. offset -= imgRowSize;
  17727. }
  17728. }
  17729. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  17730. argsArray.splice(iFirstSave, count * 4, [{
  17731. width: imgWidth,
  17732. height: imgHeight,
  17733. kind: _util.ImageKind.RGBA_32BPP,
  17734. data: imgData
  17735. }, map]);
  17736. return iFirstSave + 1;
  17737. });
  17738. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], function foundImageMaskGroup(context) {
  17739. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  17740. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  17741. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  17742. var fnArray = context.fnArray,
  17743. argsArray = context.argsArray;
  17744. var curr = context.iCurr;
  17745. var iFirstSave = curr - 3;
  17746. var iFirstTransform = curr - 2;
  17747. var iFirstPIMXO = curr - 1;
  17748. var i = iFirstSave + 4;
  17749. var ii = fnArray.length;
  17750. while (i + 3 < ii) {
  17751. if (fnArray[i] !== _util.OPS.save || fnArray[i + 1] !== _util.OPS.transform || fnArray[i + 2] !== _util.OPS.paintImageMaskXObject || fnArray[i + 3] !== _util.OPS.restore) {
  17752. break;
  17753. }
  17754. i += 4;
  17755. }
  17756. var count = (i - iFirstSave) / 4;
  17757. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  17758. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  17759. return i;
  17760. }
  17761. var q;
  17762. var isSameImage = false;
  17763. var iTransform, transformArgs;
  17764. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  17765. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  17766. isSameImage = true;
  17767. var firstTransformArg0 = argsArray[iFirstTransform][0];
  17768. var firstTransformArg3 = argsArray[iFirstTransform][3];
  17769. iTransform = iFirstTransform + 4;
  17770. var iPIMXO = iFirstPIMXO + 4;
  17771. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  17772. transformArgs = argsArray[iTransform];
  17773. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  17774. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  17775. isSameImage = false;
  17776. } else {
  17777. count = q;
  17778. }
  17779. break;
  17780. }
  17781. }
  17782. }
  17783. if (isSameImage) {
  17784. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  17785. var positions = new Float32Array(count * 2);
  17786. iTransform = iFirstTransform;
  17787. for (q = 0; q < count; q++, iTransform += 4) {
  17788. transformArgs = argsArray[iTransform];
  17789. positions[q << 1] = transformArgs[4];
  17790. positions[(q << 1) + 1] = transformArgs[5];
  17791. }
  17792. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  17793. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]);
  17794. } else {
  17795. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  17796. var images = [];
  17797. for (q = 0; q < count; q++) {
  17798. transformArgs = argsArray[iFirstTransform + (q << 2)];
  17799. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  17800. images.push({
  17801. data: maskParams.data,
  17802. width: maskParams.width,
  17803. height: maskParams.height,
  17804. transform: transformArgs
  17805. });
  17806. }
  17807. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  17808. argsArray.splice(iFirstSave, count * 4, [images]);
  17809. }
  17810. return iFirstSave + 1;
  17811. });
  17812. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  17813. var MIN_IMAGES_IN_BLOCK = 3;
  17814. var MAX_IMAGES_IN_BLOCK = 1000;
  17815. var fnArray = context.fnArray,
  17816. argsArray = context.argsArray;
  17817. var curr = context.iCurr;
  17818. var iFirstSave = curr - 3;
  17819. var iFirstTransform = curr - 2;
  17820. var iFirstPIXO = curr - 1;
  17821. var iFirstRestore = curr;
  17822. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  17823. return iFirstRestore + 1;
  17824. }
  17825. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  17826. var firstTransformArg0 = argsArray[iFirstTransform][0];
  17827. var firstTransformArg3 = argsArray[iFirstTransform][3];
  17828. var i = iFirstSave + 4;
  17829. var ii = fnArray.length;
  17830. while (i + 3 < ii) {
  17831. if (fnArray[i] !== _util.OPS.save || fnArray[i + 1] !== _util.OPS.transform || fnArray[i + 2] !== _util.OPS.paintImageXObject || fnArray[i + 3] !== _util.OPS.restore) {
  17832. break;
  17833. }
  17834. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  17835. break;
  17836. }
  17837. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  17838. break;
  17839. }
  17840. i += 4;
  17841. }
  17842. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  17843. if (count < MIN_IMAGES_IN_BLOCK) {
  17844. return i;
  17845. }
  17846. var positions = new Float32Array(count * 2);
  17847. var iTransform = iFirstTransform;
  17848. for (var q = 0; q < count; q++, iTransform += 4) {
  17849. var transformArgs = argsArray[iTransform];
  17850. positions[q << 1] = transformArgs[4];
  17851. positions[(q << 1) + 1] = transformArgs[5];
  17852. }
  17853. var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  17854. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  17855. argsArray.splice(iFirstSave, count * 4, args);
  17856. return iFirstSave + 1;
  17857. });
  17858. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], function (context) {
  17859. var MIN_CHARS_IN_BLOCK = 3;
  17860. var MAX_CHARS_IN_BLOCK = 1000;
  17861. var fnArray = context.fnArray,
  17862. argsArray = context.argsArray;
  17863. var curr = context.iCurr;
  17864. var iFirstBeginText = curr - 4;
  17865. var iFirstSetFont = curr - 3;
  17866. var iFirstSetTextMatrix = curr - 2;
  17867. var iFirstShowText = curr - 1;
  17868. var iFirstEndText = curr;
  17869. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  17870. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  17871. var i = iFirstBeginText + 5;
  17872. var ii = fnArray.length;
  17873. while (i + 4 < ii) {
  17874. if (fnArray[i] !== _util.OPS.beginText || fnArray[i + 1] !== _util.OPS.setFont || fnArray[i + 2] !== _util.OPS.setTextMatrix || fnArray[i + 3] !== _util.OPS.showText || fnArray[i + 4] !== _util.OPS.endText) {
  17875. break;
  17876. }
  17877. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  17878. break;
  17879. }
  17880. i += 5;
  17881. }
  17882. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  17883. if (count < MIN_CHARS_IN_BLOCK) {
  17884. return i;
  17885. }
  17886. var iFirst = iFirstBeginText;
  17887. 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) {
  17888. count++;
  17889. iFirst -= 5;
  17890. }
  17891. var iEndText = iFirst + 4;
  17892. for (var q = 1; q < count; q++) {
  17893. fnArray.splice(iEndText, 3);
  17894. argsArray.splice(iEndText, 3);
  17895. iEndText += 2;
  17896. }
  17897. return iEndText + 1;
  17898. });
  17899. function QueueOptimizer() {}
  17900. QueueOptimizer.prototype = {
  17901. optimize: function QueueOptimizer_optimize(queue) {
  17902. var fnArray = queue.fnArray,
  17903. argsArray = queue.argsArray;
  17904. var context = {
  17905. iCurr: 0,
  17906. fnArray: fnArray,
  17907. argsArray: argsArray
  17908. };
  17909. var state;
  17910. var i = 0,
  17911. ii = fnArray.length;
  17912. while (i < ii) {
  17913. state = (state || InitialState)[fnArray[i]];
  17914. if (typeof state === 'function') {
  17915. context.iCurr = i;
  17916. i = state(context);
  17917. state = undefined;
  17918. ii = context.fnArray.length;
  17919. } else {
  17920. i++;
  17921. }
  17922. }
  17923. }
  17924. };
  17925. return QueueOptimizer;
  17926. }();
  17927. exports.OperatorList = OperatorList;
  17928. exports.PartialEvaluator = PartialEvaluator;
  17929. /***/ }),
  17930. /* 15 */
  17931. /***/ (function(module, exports, __w_pdfjs_require__) {
  17932. "use strict";
  17933. Object.defineProperty(exports, "__esModule", {
  17934. value: true
  17935. });
  17936. exports.JpxImage = undefined;
  17937. var _util = __w_pdfjs_require__(0);
  17938. var _arithmetic_decoder = __w_pdfjs_require__(10);
  17939. var JpxImage = function JpxImageClosure() {
  17940. var SubbandsGainLog2 = {
  17941. 'LL': 0,
  17942. 'LH': 1,
  17943. 'HL': 1,
  17944. 'HH': 2
  17945. };
  17946. function JpxImage() {
  17947. this.failOnCorruptedImage = false;
  17948. }
  17949. JpxImage.prototype = {
  17950. parse: function JpxImage_parse(data) {
  17951. var head = (0, _util.readUint16)(data, 0);
  17952. if (head === 0xFF4F) {
  17953. this.parseCodestream(data, 0, data.length);
  17954. return;
  17955. }
  17956. var position = 0,
  17957. length = data.length;
  17958. while (position < length) {
  17959. var headerSize = 8;
  17960. var lbox = (0, _util.readUint32)(data, position);
  17961. var tbox = (0, _util.readUint32)(data, position + 4);
  17962. position += headerSize;
  17963. if (lbox === 1) {
  17964. lbox = (0, _util.readUint32)(data, position) * 4294967296 + (0, _util.readUint32)(data, position + 4);
  17965. position += 8;
  17966. headerSize += 8;
  17967. }
  17968. if (lbox === 0) {
  17969. lbox = length - position + headerSize;
  17970. }
  17971. if (lbox < headerSize) {
  17972. (0, _util.error)('JPX Error: Invalid box field size');
  17973. }
  17974. var dataLength = lbox - headerSize;
  17975. var jumpDataLength = true;
  17976. switch (tbox) {
  17977. case 0x6A703268:
  17978. jumpDataLength = false;
  17979. break;
  17980. case 0x636F6C72:
  17981. var method = data[position];
  17982. if (method === 1) {
  17983. var colorspace = (0, _util.readUint32)(data, position + 3);
  17984. switch (colorspace) {
  17985. case 16:
  17986. case 17:
  17987. case 18:
  17988. break;
  17989. default:
  17990. (0, _util.warn)('Unknown colorspace ' + colorspace);
  17991. break;
  17992. }
  17993. } else if (method === 2) {
  17994. (0, _util.info)('ICC profile not supported');
  17995. }
  17996. break;
  17997. case 0x6A703263:
  17998. this.parseCodestream(data, position, position + dataLength);
  17999. break;
  18000. case 0x6A502020:
  18001. if ((0, _util.readUint32)(data, position) !== 0x0d0a870a) {
  18002. (0, _util.warn)('Invalid JP2 signature');
  18003. }
  18004. break;
  18005. case 0x6A501A1A:
  18006. case 0x66747970:
  18007. case 0x72726571:
  18008. case 0x72657320:
  18009. case 0x69686472:
  18010. break;
  18011. default:
  18012. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  18013. (0, _util.warn)('Unsupported header type ' + tbox + ' (' + headerType + ')');
  18014. break;
  18015. }
  18016. if (jumpDataLength) {
  18017. position += dataLength;
  18018. }
  18019. }
  18020. },
  18021. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  18022. var newByte = stream.getByte();
  18023. while (newByte >= 0) {
  18024. var oldByte = newByte;
  18025. newByte = stream.getByte();
  18026. var code = oldByte << 8 | newByte;
  18027. if (code === 0xFF51) {
  18028. stream.skip(4);
  18029. var Xsiz = stream.getInt32() >>> 0;
  18030. var Ysiz = stream.getInt32() >>> 0;
  18031. var XOsiz = stream.getInt32() >>> 0;
  18032. var YOsiz = stream.getInt32() >>> 0;
  18033. stream.skip(16);
  18034. var Csiz = stream.getUint16();
  18035. this.width = Xsiz - XOsiz;
  18036. this.height = Ysiz - YOsiz;
  18037. this.componentsCount = Csiz;
  18038. this.bitsPerComponent = 8;
  18039. return;
  18040. }
  18041. }
  18042. (0, _util.error)('JPX Error: No size marker found in JPX stream');
  18043. },
  18044. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  18045. var context = {};
  18046. var doNotRecover = false;
  18047. try {
  18048. var position = start;
  18049. while (position + 1 < end) {
  18050. var code = (0, _util.readUint16)(data, position);
  18051. position += 2;
  18052. var length = 0,
  18053. j,
  18054. sqcd,
  18055. spqcds,
  18056. spqcdSize,
  18057. scalarExpounded,
  18058. tile;
  18059. switch (code) {
  18060. case 0xFF4F:
  18061. context.mainHeader = true;
  18062. break;
  18063. case 0xFFD9:
  18064. break;
  18065. case 0xFF51:
  18066. length = (0, _util.readUint16)(data, position);
  18067. var siz = {};
  18068. siz.Xsiz = (0, _util.readUint32)(data, position + 4);
  18069. siz.Ysiz = (0, _util.readUint32)(data, position + 8);
  18070. siz.XOsiz = (0, _util.readUint32)(data, position + 12);
  18071. siz.YOsiz = (0, _util.readUint32)(data, position + 16);
  18072. siz.XTsiz = (0, _util.readUint32)(data, position + 20);
  18073. siz.YTsiz = (0, _util.readUint32)(data, position + 24);
  18074. siz.XTOsiz = (0, _util.readUint32)(data, position + 28);
  18075. siz.YTOsiz = (0, _util.readUint32)(data, position + 32);
  18076. var componentsCount = (0, _util.readUint16)(data, position + 36);
  18077. siz.Csiz = componentsCount;
  18078. var components = [];
  18079. j = position + 38;
  18080. for (var i = 0; i < componentsCount; i++) {
  18081. var component = {
  18082. precision: (data[j] & 0x7F) + 1,
  18083. isSigned: !!(data[j] & 0x80),
  18084. XRsiz: data[j + 1],
  18085. YRsiz: data[j + 1]
  18086. };
  18087. calculateComponentDimensions(component, siz);
  18088. components.push(component);
  18089. }
  18090. context.SIZ = siz;
  18091. context.components = components;
  18092. calculateTileGrids(context, components);
  18093. context.QCC = [];
  18094. context.COC = [];
  18095. break;
  18096. case 0xFF5C:
  18097. length = (0, _util.readUint16)(data, position);
  18098. var qcd = {};
  18099. j = position + 2;
  18100. sqcd = data[j++];
  18101. switch (sqcd & 0x1F) {
  18102. case 0:
  18103. spqcdSize = 8;
  18104. scalarExpounded = true;
  18105. break;
  18106. case 1:
  18107. spqcdSize = 16;
  18108. scalarExpounded = false;
  18109. break;
  18110. case 2:
  18111. spqcdSize = 16;
  18112. scalarExpounded = true;
  18113. break;
  18114. default:
  18115. throw new Error('Invalid SQcd value ' + sqcd);
  18116. }
  18117. qcd.noQuantization = spqcdSize === 8;
  18118. qcd.scalarExpounded = scalarExpounded;
  18119. qcd.guardBits = sqcd >> 5;
  18120. spqcds = [];
  18121. while (j < length + position) {
  18122. var spqcd = {};
  18123. if (spqcdSize === 8) {
  18124. spqcd.epsilon = data[j++] >> 3;
  18125. spqcd.mu = 0;
  18126. } else {
  18127. spqcd.epsilon = data[j] >> 3;
  18128. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18129. j += 2;
  18130. }
  18131. spqcds.push(spqcd);
  18132. }
  18133. qcd.SPqcds = spqcds;
  18134. if (context.mainHeader) {
  18135. context.QCD = qcd;
  18136. } else {
  18137. context.currentTile.QCD = qcd;
  18138. context.currentTile.QCC = [];
  18139. }
  18140. break;
  18141. case 0xFF5D:
  18142. length = (0, _util.readUint16)(data, position);
  18143. var qcc = {};
  18144. j = position + 2;
  18145. var cqcc;
  18146. if (context.SIZ.Csiz < 257) {
  18147. cqcc = data[j++];
  18148. } else {
  18149. cqcc = (0, _util.readUint16)(data, j);
  18150. j += 2;
  18151. }
  18152. sqcd = data[j++];
  18153. switch (sqcd & 0x1F) {
  18154. case 0:
  18155. spqcdSize = 8;
  18156. scalarExpounded = true;
  18157. break;
  18158. case 1:
  18159. spqcdSize = 16;
  18160. scalarExpounded = false;
  18161. break;
  18162. case 2:
  18163. spqcdSize = 16;
  18164. scalarExpounded = true;
  18165. break;
  18166. default:
  18167. throw new Error('Invalid SQcd value ' + sqcd);
  18168. }
  18169. qcc.noQuantization = spqcdSize === 8;
  18170. qcc.scalarExpounded = scalarExpounded;
  18171. qcc.guardBits = sqcd >> 5;
  18172. spqcds = [];
  18173. while (j < length + position) {
  18174. spqcd = {};
  18175. if (spqcdSize === 8) {
  18176. spqcd.epsilon = data[j++] >> 3;
  18177. spqcd.mu = 0;
  18178. } else {
  18179. spqcd.epsilon = data[j] >> 3;
  18180. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  18181. j += 2;
  18182. }
  18183. spqcds.push(spqcd);
  18184. }
  18185. qcc.SPqcds = spqcds;
  18186. if (context.mainHeader) {
  18187. context.QCC[cqcc] = qcc;
  18188. } else {
  18189. context.currentTile.QCC[cqcc] = qcc;
  18190. }
  18191. break;
  18192. case 0xFF52:
  18193. length = (0, _util.readUint16)(data, position);
  18194. var cod = {};
  18195. j = position + 2;
  18196. var scod = data[j++];
  18197. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  18198. cod.sopMarkerUsed = !!(scod & 2);
  18199. cod.ephMarkerUsed = !!(scod & 4);
  18200. cod.progressionOrder = data[j++];
  18201. cod.layersCount = (0, _util.readUint16)(data, j);
  18202. j += 2;
  18203. cod.multipleComponentTransform = data[j++];
  18204. cod.decompositionLevelsCount = data[j++];
  18205. cod.xcb = (data[j++] & 0xF) + 2;
  18206. cod.ycb = (data[j++] & 0xF) + 2;
  18207. var blockStyle = data[j++];
  18208. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  18209. cod.resetContextProbabilities = !!(blockStyle & 2);
  18210. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  18211. cod.verticalyStripe = !!(blockStyle & 8);
  18212. cod.predictableTermination = !!(blockStyle & 16);
  18213. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  18214. cod.reversibleTransformation = data[j++];
  18215. if (cod.entropyCoderWithCustomPrecincts) {
  18216. var precinctsSizes = [];
  18217. while (j < length + position) {
  18218. var precinctsSize = data[j++];
  18219. precinctsSizes.push({
  18220. PPx: precinctsSize & 0xF,
  18221. PPy: precinctsSize >> 4
  18222. });
  18223. }
  18224. cod.precinctsSizes = precinctsSizes;
  18225. }
  18226. var unsupported = [];
  18227. if (cod.selectiveArithmeticCodingBypass) {
  18228. unsupported.push('selectiveArithmeticCodingBypass');
  18229. }
  18230. if (cod.resetContextProbabilities) {
  18231. unsupported.push('resetContextProbabilities');
  18232. }
  18233. if (cod.terminationOnEachCodingPass) {
  18234. unsupported.push('terminationOnEachCodingPass');
  18235. }
  18236. if (cod.verticalyStripe) {
  18237. unsupported.push('verticalyStripe');
  18238. }
  18239. if (cod.predictableTermination) {
  18240. unsupported.push('predictableTermination');
  18241. }
  18242. if (unsupported.length > 0) {
  18243. doNotRecover = true;
  18244. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  18245. }
  18246. if (context.mainHeader) {
  18247. context.COD = cod;
  18248. } else {
  18249. context.currentTile.COD = cod;
  18250. context.currentTile.COC = [];
  18251. }
  18252. break;
  18253. case 0xFF90:
  18254. length = (0, _util.readUint16)(data, position);
  18255. tile = {};
  18256. tile.index = (0, _util.readUint16)(data, position + 2);
  18257. tile.length = (0, _util.readUint32)(data, position + 4);
  18258. tile.dataEnd = tile.length + position - 2;
  18259. tile.partIndex = data[position + 8];
  18260. tile.partsCount = data[position + 9];
  18261. context.mainHeader = false;
  18262. if (tile.partIndex === 0) {
  18263. tile.COD = context.COD;
  18264. tile.COC = context.COC.slice(0);
  18265. tile.QCD = context.QCD;
  18266. tile.QCC = context.QCC.slice(0);
  18267. }
  18268. context.currentTile = tile;
  18269. break;
  18270. case 0xFF93:
  18271. tile = context.currentTile;
  18272. if (tile.partIndex === 0) {
  18273. initializeTile(context, tile.index);
  18274. buildPackets(context);
  18275. }
  18276. length = tile.dataEnd - position;
  18277. parseTilePackets(context, data, position, length);
  18278. break;
  18279. case 0xFF55:
  18280. case 0xFF57:
  18281. case 0xFF58:
  18282. case 0xFF64:
  18283. length = (0, _util.readUint16)(data, position);
  18284. break;
  18285. case 0xFF53:
  18286. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  18287. default:
  18288. throw new Error('Unknown codestream code: ' + code.toString(16));
  18289. }
  18290. position += length;
  18291. }
  18292. } catch (e) {
  18293. if (doNotRecover || this.failOnCorruptedImage) {
  18294. (0, _util.error)('JPX Error: ' + e.message);
  18295. } else {
  18296. (0, _util.warn)('JPX: Trying to recover from: ' + e.message);
  18297. }
  18298. }
  18299. this.tiles = transformComponents(context);
  18300. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  18301. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  18302. this.componentsCount = context.SIZ.Csiz;
  18303. }
  18304. };
  18305. function calculateComponentDimensions(component, siz) {
  18306. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  18307. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  18308. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  18309. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  18310. component.width = component.x1 - component.x0;
  18311. component.height = component.y1 - component.y0;
  18312. }
  18313. function calculateTileGrids(context, components) {
  18314. var siz = context.SIZ;
  18315. var tile,
  18316. tiles = [];
  18317. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  18318. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  18319. for (var q = 0; q < numYtiles; q++) {
  18320. for (var p = 0; p < numXtiles; p++) {
  18321. tile = {};
  18322. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  18323. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  18324. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  18325. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  18326. tile.width = tile.tx1 - tile.tx0;
  18327. tile.height = tile.ty1 - tile.ty0;
  18328. tile.components = [];
  18329. tiles.push(tile);
  18330. }
  18331. }
  18332. context.tiles = tiles;
  18333. var componentsCount = siz.Csiz;
  18334. for (var i = 0, ii = componentsCount; i < ii; i++) {
  18335. var component = components[i];
  18336. for (var j = 0, jj = tiles.length; j < jj; j++) {
  18337. var tileComponent = {};
  18338. tile = tiles[j];
  18339. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  18340. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  18341. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  18342. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  18343. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  18344. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  18345. tile.components[i] = tileComponent;
  18346. }
  18347. }
  18348. }
  18349. function getBlocksDimensions(context, component, r) {
  18350. var codOrCoc = component.codingStyleParameters;
  18351. var result = {};
  18352. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  18353. result.PPx = 15;
  18354. result.PPy = 15;
  18355. } else {
  18356. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  18357. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  18358. }
  18359. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  18360. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  18361. return result;
  18362. }
  18363. function buildPrecincts(context, resolution, dimensions) {
  18364. var precinctWidth = 1 << dimensions.PPx;
  18365. var precinctHeight = 1 << dimensions.PPy;
  18366. var isZeroRes = resolution.resLevel === 0;
  18367. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  18368. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  18369. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  18370. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  18371. var numprecincts = numprecinctswide * numprecinctshigh;
  18372. resolution.precinctParameters = {
  18373. precinctWidth: precinctWidth,
  18374. precinctHeight: precinctHeight,
  18375. numprecinctswide: numprecinctswide,
  18376. numprecinctshigh: numprecinctshigh,
  18377. numprecincts: numprecincts,
  18378. precinctWidthInSubband: precinctWidthInSubband,
  18379. precinctHeightInSubband: precinctHeightInSubband
  18380. };
  18381. }
  18382. function buildCodeblocks(context, subband, dimensions) {
  18383. var xcb_ = dimensions.xcb_;
  18384. var ycb_ = dimensions.ycb_;
  18385. var codeblockWidth = 1 << xcb_;
  18386. var codeblockHeight = 1 << ycb_;
  18387. var cbx0 = subband.tbx0 >> xcb_;
  18388. var cby0 = subband.tby0 >> ycb_;
  18389. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  18390. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  18391. var precinctParameters = subband.resolution.precinctParameters;
  18392. var codeblocks = [];
  18393. var precincts = [];
  18394. var i, j, codeblock, precinctNumber;
  18395. for (j = cby0; j < cby1; j++) {
  18396. for (i = cbx0; i < cbx1; i++) {
  18397. codeblock = {
  18398. cbx: i,
  18399. cby: j,
  18400. tbx0: codeblockWidth * i,
  18401. tby0: codeblockHeight * j,
  18402. tbx1: codeblockWidth * (i + 1),
  18403. tby1: codeblockHeight * (j + 1)
  18404. };
  18405. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  18406. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  18407. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  18408. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  18409. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  18410. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  18411. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  18412. codeblock.precinctNumber = precinctNumber;
  18413. codeblock.subbandType = subband.type;
  18414. codeblock.Lblock = 3;
  18415. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  18416. continue;
  18417. }
  18418. codeblocks.push(codeblock);
  18419. var precinct = precincts[precinctNumber];
  18420. if (precinct !== undefined) {
  18421. if (i < precinct.cbxMin) {
  18422. precinct.cbxMin = i;
  18423. } else if (i > precinct.cbxMax) {
  18424. precinct.cbxMax = i;
  18425. }
  18426. if (j < precinct.cbyMin) {
  18427. precinct.cbxMin = j;
  18428. } else if (j > precinct.cbyMax) {
  18429. precinct.cbyMax = j;
  18430. }
  18431. } else {
  18432. precincts[precinctNumber] = precinct = {
  18433. cbxMin: i,
  18434. cbyMin: j,
  18435. cbxMax: i,
  18436. cbyMax: j
  18437. };
  18438. }
  18439. codeblock.precinct = precinct;
  18440. }
  18441. }
  18442. subband.codeblockParameters = {
  18443. codeblockWidth: xcb_,
  18444. codeblockHeight: ycb_,
  18445. numcodeblockwide: cbx1 - cbx0 + 1,
  18446. numcodeblockhigh: cby1 - cby0 + 1
  18447. };
  18448. subband.codeblocks = codeblocks;
  18449. subband.precincts = precincts;
  18450. }
  18451. function createPacket(resolution, precinctNumber, layerNumber) {
  18452. var precinctCodeblocks = [];
  18453. var subbands = resolution.subbands;
  18454. for (var i = 0, ii = subbands.length; i < ii; i++) {
  18455. var subband = subbands[i];
  18456. var codeblocks = subband.codeblocks;
  18457. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  18458. var codeblock = codeblocks[j];
  18459. if (codeblock.precinctNumber !== precinctNumber) {
  18460. continue;
  18461. }
  18462. precinctCodeblocks.push(codeblock);
  18463. }
  18464. }
  18465. return {
  18466. layerNumber: layerNumber,
  18467. codeblocks: precinctCodeblocks
  18468. };
  18469. }
  18470. function LayerResolutionComponentPositionIterator(context) {
  18471. var siz = context.SIZ;
  18472. var tileIndex = context.currentTile.index;
  18473. var tile = context.tiles[tileIndex];
  18474. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  18475. var componentsCount = siz.Csiz;
  18476. var maxDecompositionLevelsCount = 0;
  18477. for (var q = 0; q < componentsCount; q++) {
  18478. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18479. }
  18480. var l = 0,
  18481. r = 0,
  18482. i = 0,
  18483. k = 0;
  18484. this.nextPacket = function JpxImage_nextPacket() {
  18485. for (; l < layersCount; l++) {
  18486. for (; r <= maxDecompositionLevelsCount; r++) {
  18487. for (; i < componentsCount; i++) {
  18488. var component = tile.components[i];
  18489. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18490. continue;
  18491. }
  18492. var resolution = component.resolutions[r];
  18493. var numprecincts = resolution.precinctParameters.numprecincts;
  18494. for (; k < numprecincts;) {
  18495. var packet = createPacket(resolution, k, l);
  18496. k++;
  18497. return packet;
  18498. }
  18499. k = 0;
  18500. }
  18501. i = 0;
  18502. }
  18503. r = 0;
  18504. }
  18505. (0, _util.error)('JPX Error: Out of packets');
  18506. };
  18507. }
  18508. function ResolutionLayerComponentPositionIterator(context) {
  18509. var siz = context.SIZ;
  18510. var tileIndex = context.currentTile.index;
  18511. var tile = context.tiles[tileIndex];
  18512. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  18513. var componentsCount = siz.Csiz;
  18514. var maxDecompositionLevelsCount = 0;
  18515. for (var q = 0; q < componentsCount; q++) {
  18516. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  18517. }
  18518. var r = 0,
  18519. l = 0,
  18520. i = 0,
  18521. k = 0;
  18522. this.nextPacket = function JpxImage_nextPacket() {
  18523. for (; r <= maxDecompositionLevelsCount; r++) {
  18524. for (; l < layersCount; l++) {
  18525. for (; i < componentsCount; i++) {
  18526. var component = tile.components[i];
  18527. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18528. continue;
  18529. }
  18530. var resolution = component.resolutions[r];
  18531. var numprecincts = resolution.precinctParameters.numprecincts;
  18532. for (; k < numprecincts;) {
  18533. var packet = createPacket(resolution, k, l);
  18534. k++;
  18535. return packet;
  18536. }
  18537. k = 0;
  18538. }
  18539. i = 0;
  18540. }
  18541. l = 0;
  18542. }
  18543. (0, _util.error)('JPX Error: Out of packets');
  18544. };
  18545. }
  18546. function ResolutionPositionComponentLayerIterator(context) {
  18547. var siz = context.SIZ;
  18548. var tileIndex = context.currentTile.index;
  18549. var tile = context.tiles[tileIndex];
  18550. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  18551. var componentsCount = siz.Csiz;
  18552. var l, r, c, p;
  18553. var maxDecompositionLevelsCount = 0;
  18554. for (c = 0; c < componentsCount; c++) {
  18555. var component = tile.components[c];
  18556. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  18557. }
  18558. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  18559. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  18560. var maxNumPrecincts = 0;
  18561. for (c = 0; c < componentsCount; ++c) {
  18562. var resolutions = tile.components[c].resolutions;
  18563. if (r < resolutions.length) {
  18564. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  18565. }
  18566. }
  18567. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  18568. }
  18569. l = 0;
  18570. r = 0;
  18571. c = 0;
  18572. p = 0;
  18573. this.nextPacket = function JpxImage_nextPacket() {
  18574. for (; r <= maxDecompositionLevelsCount; r++) {
  18575. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  18576. for (; c < componentsCount; c++) {
  18577. var component = tile.components[c];
  18578. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  18579. continue;
  18580. }
  18581. var resolution = component.resolutions[r];
  18582. var numprecincts = resolution.precinctParameters.numprecincts;
  18583. if (p >= numprecincts) {
  18584. continue;
  18585. }
  18586. for (; l < layersCount;) {
  18587. var packet = createPacket(resolution, p, l);
  18588. l++;
  18589. return packet;
  18590. }
  18591. l = 0;
  18592. }
  18593. c = 0;
  18594. }
  18595. p = 0;
  18596. }
  18597. (0, _util.error)('JPX Error: Out of packets');
  18598. };
  18599. }
  18600. function PositionComponentResolutionLayerIterator(context) {
  18601. var siz = context.SIZ;
  18602. var tileIndex = context.currentTile.index;
  18603. var tile = context.tiles[tileIndex];
  18604. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  18605. var componentsCount = siz.Csiz;
  18606. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  18607. var precinctsIterationSizes = precinctsSizes;
  18608. var l = 0,
  18609. r = 0,
  18610. c = 0,
  18611. px = 0,
  18612. py = 0;
  18613. this.nextPacket = function JpxImage_nextPacket() {
  18614. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18615. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18616. for (; c < componentsCount; c++) {
  18617. var component = tile.components[c];
  18618. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18619. for (; r <= decompositionLevelsCount; r++) {
  18620. var resolution = component.resolutions[r];
  18621. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  18622. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18623. if (k === null) {
  18624. continue;
  18625. }
  18626. for (; l < layersCount;) {
  18627. var packet = createPacket(resolution, k, l);
  18628. l++;
  18629. return packet;
  18630. }
  18631. l = 0;
  18632. }
  18633. r = 0;
  18634. }
  18635. c = 0;
  18636. }
  18637. px = 0;
  18638. }
  18639. (0, _util.error)('JPX Error: Out of packets');
  18640. };
  18641. }
  18642. function ComponentPositionResolutionLayerIterator(context) {
  18643. var siz = context.SIZ;
  18644. var tileIndex = context.currentTile.index;
  18645. var tile = context.tiles[tileIndex];
  18646. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  18647. var componentsCount = siz.Csiz;
  18648. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  18649. var l = 0,
  18650. r = 0,
  18651. c = 0,
  18652. px = 0,
  18653. py = 0;
  18654. this.nextPacket = function JpxImage_nextPacket() {
  18655. for (; c < componentsCount; ++c) {
  18656. var component = tile.components[c];
  18657. var precinctsIterationSizes = precinctsSizes.components[c];
  18658. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18659. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  18660. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  18661. for (; r <= decompositionLevelsCount; r++) {
  18662. var resolution = component.resolutions[r];
  18663. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  18664. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  18665. if (k === null) {
  18666. continue;
  18667. }
  18668. for (; l < layersCount;) {
  18669. var packet = createPacket(resolution, k, l);
  18670. l++;
  18671. return packet;
  18672. }
  18673. l = 0;
  18674. }
  18675. r = 0;
  18676. }
  18677. px = 0;
  18678. }
  18679. py = 0;
  18680. }
  18681. (0, _util.error)('JPX Error: Out of packets');
  18682. };
  18683. }
  18684. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  18685. var posX = pxIndex * precinctIterationSizes.minWidth;
  18686. var posY = pyIndex * precinctIterationSizes.minHeight;
  18687. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  18688. return null;
  18689. }
  18690. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  18691. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  18692. }
  18693. function getPrecinctSizesInImageScale(tile) {
  18694. var componentsCount = tile.components.length;
  18695. var minWidth = Number.MAX_VALUE;
  18696. var minHeight = Number.MAX_VALUE;
  18697. var maxNumWide = 0;
  18698. var maxNumHigh = 0;
  18699. var sizePerComponent = new Array(componentsCount);
  18700. for (var c = 0; c < componentsCount; c++) {
  18701. var component = tile.components[c];
  18702. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18703. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  18704. var minWidthCurrentComponent = Number.MAX_VALUE;
  18705. var minHeightCurrentComponent = Number.MAX_VALUE;
  18706. var maxNumWideCurrentComponent = 0;
  18707. var maxNumHighCurrentComponent = 0;
  18708. var scale = 1;
  18709. for (var r = decompositionLevelsCount; r >= 0; --r) {
  18710. var resolution = component.resolutions[r];
  18711. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  18712. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  18713. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  18714. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  18715. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  18716. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  18717. sizePerResolution[r] = {
  18718. width: widthCurrentResolution,
  18719. height: heightCurrentResolution
  18720. };
  18721. scale <<= 1;
  18722. }
  18723. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  18724. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  18725. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  18726. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  18727. sizePerComponent[c] = {
  18728. resolutions: sizePerResolution,
  18729. minWidth: minWidthCurrentComponent,
  18730. minHeight: minHeightCurrentComponent,
  18731. maxNumWide: maxNumWideCurrentComponent,
  18732. maxNumHigh: maxNumHighCurrentComponent
  18733. };
  18734. }
  18735. return {
  18736. components: sizePerComponent,
  18737. minWidth: minWidth,
  18738. minHeight: minHeight,
  18739. maxNumWide: maxNumWide,
  18740. maxNumHigh: maxNumHigh
  18741. };
  18742. }
  18743. function buildPackets(context) {
  18744. var siz = context.SIZ;
  18745. var tileIndex = context.currentTile.index;
  18746. var tile = context.tiles[tileIndex];
  18747. var componentsCount = siz.Csiz;
  18748. for (var c = 0; c < componentsCount; c++) {
  18749. var component = tile.components[c];
  18750. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  18751. var resolutions = [];
  18752. var subbands = [];
  18753. for (var r = 0; r <= decompositionLevelsCount; r++) {
  18754. var blocksDimensions = getBlocksDimensions(context, component, r);
  18755. var resolution = {};
  18756. var scale = 1 << decompositionLevelsCount - r;
  18757. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  18758. resolution.try0 = Math.ceil(component.tcy0 / scale);
  18759. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  18760. resolution.try1 = Math.ceil(component.tcy1 / scale);
  18761. resolution.resLevel = r;
  18762. buildPrecincts(context, resolution, blocksDimensions);
  18763. resolutions.push(resolution);
  18764. var subband;
  18765. if (r === 0) {
  18766. subband = {};
  18767. subband.type = 'LL';
  18768. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  18769. subband.tby0 = Math.ceil(component.tcy0 / scale);
  18770. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  18771. subband.tby1 = Math.ceil(component.tcy1 / scale);
  18772. subband.resolution = resolution;
  18773. buildCodeblocks(context, subband, blocksDimensions);
  18774. subbands.push(subband);
  18775. resolution.subbands = [subband];
  18776. } else {
  18777. var bscale = 1 << decompositionLevelsCount - r + 1;
  18778. var resolutionSubbands = [];
  18779. subband = {};
  18780. subband.type = 'HL';
  18781. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  18782. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  18783. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  18784. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  18785. subband.resolution = resolution;
  18786. buildCodeblocks(context, subband, blocksDimensions);
  18787. subbands.push(subband);
  18788. resolutionSubbands.push(subband);
  18789. subband = {};
  18790. subband.type = 'LH';
  18791. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  18792. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  18793. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  18794. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  18795. subband.resolution = resolution;
  18796. buildCodeblocks(context, subband, blocksDimensions);
  18797. subbands.push(subband);
  18798. resolutionSubbands.push(subband);
  18799. subband = {};
  18800. subband.type = 'HH';
  18801. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  18802. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  18803. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  18804. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  18805. subband.resolution = resolution;
  18806. buildCodeblocks(context, subband, blocksDimensions);
  18807. subbands.push(subband);
  18808. resolutionSubbands.push(subband);
  18809. resolution.subbands = resolutionSubbands;
  18810. }
  18811. }
  18812. component.resolutions = resolutions;
  18813. component.subbands = subbands;
  18814. }
  18815. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  18816. switch (progressionOrder) {
  18817. case 0:
  18818. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  18819. break;
  18820. case 1:
  18821. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  18822. break;
  18823. case 2:
  18824. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  18825. break;
  18826. case 3:
  18827. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  18828. break;
  18829. case 4:
  18830. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  18831. break;
  18832. default:
  18833. (0, _util.error)('JPX Error: Unsupported progression order ' + progressionOrder);
  18834. }
  18835. }
  18836. function parseTilePackets(context, data, offset, dataLength) {
  18837. var position = 0;
  18838. var buffer,
  18839. bufferSize = 0,
  18840. skipNextBit = false;
  18841. function readBits(count) {
  18842. while (bufferSize < count) {
  18843. var b = data[offset + position];
  18844. position++;
  18845. if (skipNextBit) {
  18846. buffer = buffer << 7 | b;
  18847. bufferSize += 7;
  18848. skipNextBit = false;
  18849. } else {
  18850. buffer = buffer << 8 | b;
  18851. bufferSize += 8;
  18852. }
  18853. if (b === 0xFF) {
  18854. skipNextBit = true;
  18855. }
  18856. }
  18857. bufferSize -= count;
  18858. return buffer >>> bufferSize & (1 << count) - 1;
  18859. }
  18860. function skipMarkerIfEqual(value) {
  18861. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  18862. skipBytes(1);
  18863. return true;
  18864. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  18865. skipBytes(2);
  18866. return true;
  18867. }
  18868. return false;
  18869. }
  18870. function skipBytes(count) {
  18871. position += count;
  18872. }
  18873. function alignToByte() {
  18874. bufferSize = 0;
  18875. if (skipNextBit) {
  18876. position++;
  18877. skipNextBit = false;
  18878. }
  18879. }
  18880. function readCodingpasses() {
  18881. if (readBits(1) === 0) {
  18882. return 1;
  18883. }
  18884. if (readBits(1) === 0) {
  18885. return 2;
  18886. }
  18887. var value = readBits(2);
  18888. if (value < 3) {
  18889. return value + 3;
  18890. }
  18891. value = readBits(5);
  18892. if (value < 31) {
  18893. return value + 6;
  18894. }
  18895. value = readBits(7);
  18896. return value + 37;
  18897. }
  18898. var tileIndex = context.currentTile.index;
  18899. var tile = context.tiles[tileIndex];
  18900. var sopMarkerUsed = context.COD.sopMarkerUsed;
  18901. var ephMarkerUsed = context.COD.ephMarkerUsed;
  18902. var packetsIterator = tile.packetsIterator;
  18903. while (position < dataLength) {
  18904. alignToByte();
  18905. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  18906. skipBytes(4);
  18907. }
  18908. var packet = packetsIterator.nextPacket();
  18909. if (!readBits(1)) {
  18910. continue;
  18911. }
  18912. var layerNumber = packet.layerNumber;
  18913. var queue = [],
  18914. codeblock;
  18915. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  18916. codeblock = packet.codeblocks[i];
  18917. var precinct = codeblock.precinct;
  18918. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  18919. var codeblockRow = codeblock.cby - precinct.cbyMin;
  18920. var codeblockIncluded = false;
  18921. var firstTimeInclusion = false;
  18922. var valueReady;
  18923. if (codeblock['included'] !== undefined) {
  18924. codeblockIncluded = !!readBits(1);
  18925. } else {
  18926. precinct = codeblock.precinct;
  18927. var inclusionTree, zeroBitPlanesTree;
  18928. if (precinct['inclusionTree'] !== undefined) {
  18929. inclusionTree = precinct.inclusionTree;
  18930. } else {
  18931. var width = precinct.cbxMax - precinct.cbxMin + 1;
  18932. var height = precinct.cbyMax - precinct.cbyMin + 1;
  18933. inclusionTree = new InclusionTree(width, height, layerNumber);
  18934. zeroBitPlanesTree = new TagTree(width, height);
  18935. precinct.inclusionTree = inclusionTree;
  18936. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  18937. }
  18938. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  18939. while (true) {
  18940. if (readBits(1)) {
  18941. valueReady = !inclusionTree.nextLevel();
  18942. if (valueReady) {
  18943. codeblock.included = true;
  18944. codeblockIncluded = firstTimeInclusion = true;
  18945. break;
  18946. }
  18947. } else {
  18948. inclusionTree.incrementValue(layerNumber);
  18949. break;
  18950. }
  18951. }
  18952. }
  18953. }
  18954. if (!codeblockIncluded) {
  18955. continue;
  18956. }
  18957. if (firstTimeInclusion) {
  18958. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  18959. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  18960. while (true) {
  18961. if (readBits(1)) {
  18962. valueReady = !zeroBitPlanesTree.nextLevel();
  18963. if (valueReady) {
  18964. break;
  18965. }
  18966. } else {
  18967. zeroBitPlanesTree.incrementValue();
  18968. }
  18969. }
  18970. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  18971. }
  18972. var codingpasses = readCodingpasses();
  18973. while (readBits(1)) {
  18974. codeblock.Lblock++;
  18975. }
  18976. var codingpassesLog2 = (0, _util.log2)(codingpasses);
  18977. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  18978. var codedDataLength = readBits(bits);
  18979. queue.push({
  18980. codeblock: codeblock,
  18981. codingpasses: codingpasses,
  18982. dataLength: codedDataLength
  18983. });
  18984. }
  18985. alignToByte();
  18986. if (ephMarkerUsed) {
  18987. skipMarkerIfEqual(0x92);
  18988. }
  18989. while (queue.length > 0) {
  18990. var packetItem = queue.shift();
  18991. codeblock = packetItem.codeblock;
  18992. if (codeblock['data'] === undefined) {
  18993. codeblock.data = [];
  18994. }
  18995. codeblock.data.push({
  18996. data: data,
  18997. start: offset + position,
  18998. end: offset + position + packetItem.dataLength,
  18999. codingpasses: packetItem.codingpasses
  19000. });
  19001. position += packetItem.dataLength;
  19002. }
  19003. }
  19004. return position;
  19005. }
  19006. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  19007. var x0 = subband.tbx0;
  19008. var y0 = subband.tby0;
  19009. var width = subband.tbx1 - subband.tbx0;
  19010. var codeblocks = subband.codeblocks;
  19011. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  19012. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  19013. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  19014. var codeblock = codeblocks[i];
  19015. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  19016. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  19017. if (blockWidth === 0 || blockHeight === 0) {
  19018. continue;
  19019. }
  19020. if (codeblock['data'] === undefined) {
  19021. continue;
  19022. }
  19023. var bitModel, currentCodingpassType;
  19024. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  19025. currentCodingpassType = 2;
  19026. var data = codeblock.data,
  19027. totalLength = 0,
  19028. codingpasses = 0;
  19029. var j, jj, dataItem;
  19030. for (j = 0, jj = data.length; j < jj; j++) {
  19031. dataItem = data[j];
  19032. totalLength += dataItem.end - dataItem.start;
  19033. codingpasses += dataItem.codingpasses;
  19034. }
  19035. var encodedData = new Uint8Array(totalLength);
  19036. var position = 0;
  19037. for (j = 0, jj = data.length; j < jj; j++) {
  19038. dataItem = data[j];
  19039. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  19040. encodedData.set(chunk, position);
  19041. position += chunk.length;
  19042. }
  19043. var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  19044. bitModel.setDecoder(decoder);
  19045. for (j = 0; j < codingpasses; j++) {
  19046. switch (currentCodingpassType) {
  19047. case 0:
  19048. bitModel.runSignificancePropagationPass();
  19049. break;
  19050. case 1:
  19051. bitModel.runMagnitudeRefinementPass();
  19052. break;
  19053. case 2:
  19054. bitModel.runCleanupPass();
  19055. if (segmentationSymbolUsed) {
  19056. bitModel.checkSegmentationSymbol();
  19057. }
  19058. break;
  19059. }
  19060. currentCodingpassType = (currentCodingpassType + 1) % 3;
  19061. }
  19062. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  19063. var sign = bitModel.coefficentsSign;
  19064. var magnitude = bitModel.coefficentsMagnitude;
  19065. var bitsDecoded = bitModel.bitsDecoded;
  19066. var magnitudeCorrection = reversible ? 0 : 0.5;
  19067. var k, n, nb;
  19068. position = 0;
  19069. var interleave = subband.type !== 'LL';
  19070. for (j = 0; j < blockHeight; j++) {
  19071. var row = offset / width | 0;
  19072. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  19073. for (k = 0; k < blockWidth; k++) {
  19074. n = magnitude[position];
  19075. if (n !== 0) {
  19076. n = (n + magnitudeCorrection) * delta;
  19077. if (sign[position] !== 0) {
  19078. n = -n;
  19079. }
  19080. nb = bitsDecoded[position];
  19081. var pos = interleave ? levelOffset + (offset << 1) : offset;
  19082. if (reversible && nb >= mb) {
  19083. coefficients[pos] = n;
  19084. } else {
  19085. coefficients[pos] = n * (1 << mb - nb);
  19086. }
  19087. }
  19088. offset++;
  19089. position++;
  19090. }
  19091. offset += width - blockWidth;
  19092. }
  19093. }
  19094. }
  19095. function transformTile(context, tile, c) {
  19096. var component = tile.components[c];
  19097. var codingStyleParameters = component.codingStyleParameters;
  19098. var quantizationParameters = component.quantizationParameters;
  19099. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  19100. var spqcds = quantizationParameters.SPqcds;
  19101. var scalarExpounded = quantizationParameters.scalarExpounded;
  19102. var guardBits = quantizationParameters.guardBits;
  19103. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  19104. var precision = context.components[c].precision;
  19105. var reversible = codingStyleParameters.reversibleTransformation;
  19106. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  19107. var subbandCoefficients = [];
  19108. var b = 0;
  19109. for (var i = 0; i <= decompositionLevelsCount; i++) {
  19110. var resolution = component.resolutions[i];
  19111. var width = resolution.trx1 - resolution.trx0;
  19112. var height = resolution.try1 - resolution.try0;
  19113. var coefficients = new Float32Array(width * height);
  19114. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  19115. var mu, epsilon;
  19116. if (!scalarExpounded) {
  19117. mu = spqcds[0].mu;
  19118. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  19119. } else {
  19120. mu = spqcds[b].mu;
  19121. epsilon = spqcds[b].epsilon;
  19122. b++;
  19123. }
  19124. var subband = resolution.subbands[j];
  19125. var gainLog2 = SubbandsGainLog2[subband.type];
  19126. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  19127. var mb = guardBits + epsilon - 1;
  19128. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  19129. }
  19130. subbandCoefficients.push({
  19131. width: width,
  19132. height: height,
  19133. items: coefficients
  19134. });
  19135. }
  19136. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  19137. return {
  19138. left: component.tcx0,
  19139. top: component.tcy0,
  19140. width: result.width,
  19141. height: result.height,
  19142. items: result.items
  19143. };
  19144. }
  19145. function transformComponents(context) {
  19146. var siz = context.SIZ;
  19147. var components = context.components;
  19148. var componentsCount = siz.Csiz;
  19149. var resultImages = [];
  19150. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  19151. var tile = context.tiles[i];
  19152. var transformedTiles = [];
  19153. var c;
  19154. for (c = 0; c < componentsCount; c++) {
  19155. transformedTiles[c] = transformTile(context, tile, c);
  19156. }
  19157. var tile0 = transformedTiles[0];
  19158. var out = new Uint8Array(tile0.items.length * componentsCount);
  19159. var result = {
  19160. left: tile0.left,
  19161. top: tile0.top,
  19162. width: tile0.width,
  19163. height: tile0.height,
  19164. items: out
  19165. };
  19166. var shift, offset, max, min, maxK;
  19167. var pos = 0,
  19168. j,
  19169. jj,
  19170. y0,
  19171. y1,
  19172. y2,
  19173. r,
  19174. g,
  19175. b,
  19176. k,
  19177. val;
  19178. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  19179. var fourComponents = componentsCount === 4;
  19180. var y0items = transformedTiles[0].items;
  19181. var y1items = transformedTiles[1].items;
  19182. var y2items = transformedTiles[2].items;
  19183. var y3items = fourComponents ? transformedTiles[3].items : null;
  19184. shift = components[0].precision - 8;
  19185. offset = (128 << shift) + 0.5;
  19186. max = 255 * (1 << shift);
  19187. maxK = max * 0.5;
  19188. min = -maxK;
  19189. var component0 = tile.components[0];
  19190. var alpha01 = componentsCount - 3;
  19191. jj = y0items.length;
  19192. if (!component0.codingStyleParameters.reversibleTransformation) {
  19193. for (j = 0; j < jj; j++, pos += alpha01) {
  19194. y0 = y0items[j] + offset;
  19195. y1 = y1items[j];
  19196. y2 = y2items[j];
  19197. r = y0 + 1.402 * y2;
  19198. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  19199. b = y0 + 1.772 * y1;
  19200. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  19201. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  19202. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  19203. }
  19204. } else {
  19205. for (j = 0; j < jj; j++, pos += alpha01) {
  19206. y0 = y0items[j] + offset;
  19207. y1 = y1items[j];
  19208. y2 = y2items[j];
  19209. g = y0 - (y2 + y1 >> 2);
  19210. r = g + y2;
  19211. b = g + y1;
  19212. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  19213. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  19214. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  19215. }
  19216. }
  19217. if (fourComponents) {
  19218. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  19219. k = y3items[j];
  19220. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  19221. }
  19222. }
  19223. } else {
  19224. for (c = 0; c < componentsCount; c++) {
  19225. var items = transformedTiles[c].items;
  19226. shift = components[c].precision - 8;
  19227. offset = (128 << shift) + 0.5;
  19228. max = 127.5 * (1 << shift);
  19229. min = -max;
  19230. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  19231. val = items[j];
  19232. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  19233. pos += componentsCount;
  19234. }
  19235. }
  19236. }
  19237. resultImages.push(result);
  19238. }
  19239. return resultImages;
  19240. }
  19241. function initializeTile(context, tileIndex) {
  19242. var siz = context.SIZ;
  19243. var componentsCount = siz.Csiz;
  19244. var tile = context.tiles[tileIndex];
  19245. for (var c = 0; c < componentsCount; c++) {
  19246. var component = tile.components[c];
  19247. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  19248. component.quantizationParameters = qcdOrQcc;
  19249. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  19250. component.codingStyleParameters = codOrCoc;
  19251. }
  19252. tile.codingStyleDefaultParameters = context.currentTile.COD;
  19253. }
  19254. var TagTree = function TagTreeClosure() {
  19255. function TagTree(width, height) {
  19256. var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1;
  19257. this.levels = [];
  19258. for (var i = 0; i < levelsLength; i++) {
  19259. var level = {
  19260. width: width,
  19261. height: height,
  19262. items: []
  19263. };
  19264. this.levels.push(level);
  19265. width = Math.ceil(width / 2);
  19266. height = Math.ceil(height / 2);
  19267. }
  19268. }
  19269. TagTree.prototype = {
  19270. reset: function TagTree_reset(i, j) {
  19271. var currentLevel = 0,
  19272. value = 0,
  19273. level;
  19274. while (currentLevel < this.levels.length) {
  19275. level = this.levels[currentLevel];
  19276. var index = i + j * level.width;
  19277. if (level.items[index] !== undefined) {
  19278. value = level.items[index];
  19279. break;
  19280. }
  19281. level.index = index;
  19282. i >>= 1;
  19283. j >>= 1;
  19284. currentLevel++;
  19285. }
  19286. currentLevel--;
  19287. level = this.levels[currentLevel];
  19288. level.items[level.index] = value;
  19289. this.currentLevel = currentLevel;
  19290. delete this.value;
  19291. },
  19292. incrementValue: function TagTree_incrementValue() {
  19293. var level = this.levels[this.currentLevel];
  19294. level.items[level.index]++;
  19295. },
  19296. nextLevel: function TagTree_nextLevel() {
  19297. var currentLevel = this.currentLevel;
  19298. var level = this.levels[currentLevel];
  19299. var value = level.items[level.index];
  19300. currentLevel--;
  19301. if (currentLevel < 0) {
  19302. this.value = value;
  19303. return false;
  19304. }
  19305. this.currentLevel = currentLevel;
  19306. level = this.levels[currentLevel];
  19307. level.items[level.index] = value;
  19308. return true;
  19309. }
  19310. };
  19311. return TagTree;
  19312. }();
  19313. var InclusionTree = function InclusionTreeClosure() {
  19314. function InclusionTree(width, height, defaultValue) {
  19315. var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1;
  19316. this.levels = [];
  19317. for (var i = 0; i < levelsLength; i++) {
  19318. var items = new Uint8Array(width * height);
  19319. for (var j = 0, jj = items.length; j < jj; j++) {
  19320. items[j] = defaultValue;
  19321. }
  19322. var level = {
  19323. width: width,
  19324. height: height,
  19325. items: items
  19326. };
  19327. this.levels.push(level);
  19328. width = Math.ceil(width / 2);
  19329. height = Math.ceil(height / 2);
  19330. }
  19331. }
  19332. InclusionTree.prototype = {
  19333. reset: function InclusionTree_reset(i, j, stopValue) {
  19334. var currentLevel = 0;
  19335. while (currentLevel < this.levels.length) {
  19336. var level = this.levels[currentLevel];
  19337. var index = i + j * level.width;
  19338. level.index = index;
  19339. var value = level.items[index];
  19340. if (value === 0xFF) {
  19341. break;
  19342. }
  19343. if (value > stopValue) {
  19344. this.currentLevel = currentLevel;
  19345. this.propagateValues();
  19346. return false;
  19347. }
  19348. i >>= 1;
  19349. j >>= 1;
  19350. currentLevel++;
  19351. }
  19352. this.currentLevel = currentLevel - 1;
  19353. return true;
  19354. },
  19355. incrementValue: function InclusionTree_incrementValue(stopValue) {
  19356. var level = this.levels[this.currentLevel];
  19357. level.items[level.index] = stopValue + 1;
  19358. this.propagateValues();
  19359. },
  19360. propagateValues: function InclusionTree_propagateValues() {
  19361. var levelIndex = this.currentLevel;
  19362. var level = this.levels[levelIndex];
  19363. var currentValue = level.items[level.index];
  19364. while (--levelIndex >= 0) {
  19365. level = this.levels[levelIndex];
  19366. level.items[level.index] = currentValue;
  19367. }
  19368. },
  19369. nextLevel: function InclusionTree_nextLevel() {
  19370. var currentLevel = this.currentLevel;
  19371. var level = this.levels[currentLevel];
  19372. var value = level.items[level.index];
  19373. level.items[level.index] = 0xFF;
  19374. currentLevel--;
  19375. if (currentLevel < 0) {
  19376. return false;
  19377. }
  19378. this.currentLevel = currentLevel;
  19379. level = this.levels[currentLevel];
  19380. level.items[level.index] = value;
  19381. return true;
  19382. }
  19383. };
  19384. return InclusionTree;
  19385. }();
  19386. var BitModel = function BitModelClosure() {
  19387. var UNIFORM_CONTEXT = 17;
  19388. var RUNLENGTH_CONTEXT = 18;
  19389. 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]);
  19390. 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]);
  19391. 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]);
  19392. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  19393. this.width = width;
  19394. this.height = height;
  19395. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  19396. var coefficientCount = width * height;
  19397. this.neighborsSignificance = new Uint8Array(coefficientCount);
  19398. this.coefficentsSign = new Uint8Array(coefficientCount);
  19399. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  19400. this.processingFlags = new Uint8Array(coefficientCount);
  19401. var bitsDecoded = new Uint8Array(coefficientCount);
  19402. if (zeroBitPlanes !== 0) {
  19403. for (var i = 0; i < coefficientCount; i++) {
  19404. bitsDecoded[i] = zeroBitPlanes;
  19405. }
  19406. }
  19407. this.bitsDecoded = bitsDecoded;
  19408. this.reset();
  19409. }
  19410. BitModel.prototype = {
  19411. setDecoder: function BitModel_setDecoder(decoder) {
  19412. this.decoder = decoder;
  19413. },
  19414. reset: function BitModel_reset() {
  19415. this.contexts = new Int8Array(19);
  19416. this.contexts[0] = 4 << 1 | 0;
  19417. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  19418. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  19419. },
  19420. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  19421. var neighborsSignificance = this.neighborsSignificance;
  19422. var width = this.width,
  19423. height = this.height;
  19424. var left = column > 0;
  19425. var right = column + 1 < width;
  19426. var i;
  19427. if (row > 0) {
  19428. i = index - width;
  19429. if (left) {
  19430. neighborsSignificance[i - 1] += 0x10;
  19431. }
  19432. if (right) {
  19433. neighborsSignificance[i + 1] += 0x10;
  19434. }
  19435. neighborsSignificance[i] += 0x04;
  19436. }
  19437. if (row + 1 < height) {
  19438. i = index + width;
  19439. if (left) {
  19440. neighborsSignificance[i - 1] += 0x10;
  19441. }
  19442. if (right) {
  19443. neighborsSignificance[i + 1] += 0x10;
  19444. }
  19445. neighborsSignificance[i] += 0x04;
  19446. }
  19447. if (left) {
  19448. neighborsSignificance[index - 1] += 0x01;
  19449. }
  19450. if (right) {
  19451. neighborsSignificance[index + 1] += 0x01;
  19452. }
  19453. neighborsSignificance[index] |= 0x80;
  19454. },
  19455. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  19456. var decoder = this.decoder;
  19457. var width = this.width,
  19458. height = this.height;
  19459. var coefficentsMagnitude = this.coefficentsMagnitude;
  19460. var coefficentsSign = this.coefficentsSign;
  19461. var neighborsSignificance = this.neighborsSignificance;
  19462. var processingFlags = this.processingFlags;
  19463. var contexts = this.contexts;
  19464. var labels = this.contextLabelTable;
  19465. var bitsDecoded = this.bitsDecoded;
  19466. var processedInverseMask = ~1;
  19467. var processedMask = 1;
  19468. var firstMagnitudeBitMask = 2;
  19469. for (var i0 = 0; i0 < height; i0 += 4) {
  19470. for (var j = 0; j < width; j++) {
  19471. var index = i0 * width + j;
  19472. for (var i1 = 0; i1 < 4; i1++, index += width) {
  19473. var i = i0 + i1;
  19474. if (i >= height) {
  19475. break;
  19476. }
  19477. processingFlags[index] &= processedInverseMask;
  19478. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  19479. continue;
  19480. }
  19481. var contextLabel = labels[neighborsSignificance[index]];
  19482. var decision = decoder.readBit(contexts, contextLabel);
  19483. if (decision) {
  19484. var sign = this.decodeSignBit(i, j, index);
  19485. coefficentsSign[index] = sign;
  19486. coefficentsMagnitude[index] = 1;
  19487. this.setNeighborsSignificance(i, j, index);
  19488. processingFlags[index] |= firstMagnitudeBitMask;
  19489. }
  19490. bitsDecoded[index]++;
  19491. processingFlags[index] |= processedMask;
  19492. }
  19493. }
  19494. }
  19495. },
  19496. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  19497. var width = this.width,
  19498. height = this.height;
  19499. var coefficentsMagnitude = this.coefficentsMagnitude;
  19500. var coefficentsSign = this.coefficentsSign;
  19501. var contribution, sign0, sign1, significance1;
  19502. var contextLabel, decoded;
  19503. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  19504. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  19505. sign1 = coefficentsSign[index + 1];
  19506. if (significance1) {
  19507. sign0 = coefficentsSign[index - 1];
  19508. contribution = 1 - sign1 - sign0;
  19509. } else {
  19510. contribution = 1 - sign1 - sign1;
  19511. }
  19512. } else if (significance1) {
  19513. sign0 = coefficentsSign[index - 1];
  19514. contribution = 1 - sign0 - sign0;
  19515. } else {
  19516. contribution = 0;
  19517. }
  19518. var horizontalContribution = 3 * contribution;
  19519. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  19520. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  19521. sign1 = coefficentsSign[index + width];
  19522. if (significance1) {
  19523. sign0 = coefficentsSign[index - width];
  19524. contribution = 1 - sign1 - sign0 + horizontalContribution;
  19525. } else {
  19526. contribution = 1 - sign1 - sign1 + horizontalContribution;
  19527. }
  19528. } else if (significance1) {
  19529. sign0 = coefficentsSign[index - width];
  19530. contribution = 1 - sign0 - sign0 + horizontalContribution;
  19531. } else {
  19532. contribution = horizontalContribution;
  19533. }
  19534. if (contribution >= 0) {
  19535. contextLabel = 9 + contribution;
  19536. decoded = this.decoder.readBit(this.contexts, contextLabel);
  19537. } else {
  19538. contextLabel = 9 - contribution;
  19539. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  19540. }
  19541. return decoded;
  19542. },
  19543. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  19544. var decoder = this.decoder;
  19545. var width = this.width,
  19546. height = this.height;
  19547. var coefficentsMagnitude = this.coefficentsMagnitude;
  19548. var neighborsSignificance = this.neighborsSignificance;
  19549. var contexts = this.contexts;
  19550. var bitsDecoded = this.bitsDecoded;
  19551. var processingFlags = this.processingFlags;
  19552. var processedMask = 1;
  19553. var firstMagnitudeBitMask = 2;
  19554. var length = width * height;
  19555. var width4 = width * 4;
  19556. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  19557. indexNext = Math.min(length, index0 + width4);
  19558. for (var j = 0; j < width; j++) {
  19559. for (var index = index0 + j; index < indexNext; index += width) {
  19560. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19561. continue;
  19562. }
  19563. var contextLabel = 16;
  19564. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  19565. processingFlags[index] ^= firstMagnitudeBitMask;
  19566. var significance = neighborsSignificance[index] & 127;
  19567. contextLabel = significance === 0 ? 15 : 14;
  19568. }
  19569. var bit = decoder.readBit(contexts, contextLabel);
  19570. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  19571. bitsDecoded[index]++;
  19572. processingFlags[index] |= processedMask;
  19573. }
  19574. }
  19575. }
  19576. },
  19577. runCleanupPass: function BitModel_runCleanupPass() {
  19578. var decoder = this.decoder;
  19579. var width = this.width,
  19580. height = this.height;
  19581. var neighborsSignificance = this.neighborsSignificance;
  19582. var coefficentsMagnitude = this.coefficentsMagnitude;
  19583. var coefficentsSign = this.coefficentsSign;
  19584. var contexts = this.contexts;
  19585. var labels = this.contextLabelTable;
  19586. var bitsDecoded = this.bitsDecoded;
  19587. var processingFlags = this.processingFlags;
  19588. var processedMask = 1;
  19589. var firstMagnitudeBitMask = 2;
  19590. var oneRowDown = width;
  19591. var twoRowsDown = width * 2;
  19592. var threeRowsDown = width * 3;
  19593. var iNext;
  19594. for (var i0 = 0; i0 < height; i0 = iNext) {
  19595. iNext = Math.min(i0 + 4, height);
  19596. var indexBase = i0 * width;
  19597. var checkAllEmpty = i0 + 3 < height;
  19598. for (var j = 0; j < width; j++) {
  19599. var index0 = indexBase + j;
  19600. 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;
  19601. var i1 = 0,
  19602. index = index0;
  19603. var i = i0,
  19604. sign;
  19605. if (allEmpty) {
  19606. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  19607. if (!hasSignificantCoefficent) {
  19608. bitsDecoded[index0]++;
  19609. bitsDecoded[index0 + oneRowDown]++;
  19610. bitsDecoded[index0 + twoRowsDown]++;
  19611. bitsDecoded[index0 + threeRowsDown]++;
  19612. continue;
  19613. }
  19614. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  19615. if (i1 !== 0) {
  19616. i = i0 + i1;
  19617. index += i1 * width;
  19618. }
  19619. sign = this.decodeSignBit(i, j, index);
  19620. coefficentsSign[index] = sign;
  19621. coefficentsMagnitude[index] = 1;
  19622. this.setNeighborsSignificance(i, j, index);
  19623. processingFlags[index] |= firstMagnitudeBitMask;
  19624. index = index0;
  19625. for (var i2 = i0; i2 <= i; i2++, index += width) {
  19626. bitsDecoded[index]++;
  19627. }
  19628. i1++;
  19629. }
  19630. for (i = i0 + i1; i < iNext; i++, index += width) {
  19631. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  19632. continue;
  19633. }
  19634. var contextLabel = labels[neighborsSignificance[index]];
  19635. var decision = decoder.readBit(contexts, contextLabel);
  19636. if (decision === 1) {
  19637. sign = this.decodeSignBit(i, j, index);
  19638. coefficentsSign[index] = sign;
  19639. coefficentsMagnitude[index] = 1;
  19640. this.setNeighborsSignificance(i, j, index);
  19641. processingFlags[index] |= firstMagnitudeBitMask;
  19642. }
  19643. bitsDecoded[index]++;
  19644. }
  19645. }
  19646. }
  19647. },
  19648. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  19649. var decoder = this.decoder;
  19650. var contexts = this.contexts;
  19651. 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);
  19652. if (symbol !== 0xA) {
  19653. (0, _util.error)('JPX Error: Invalid segmentation symbol');
  19654. }
  19655. }
  19656. };
  19657. return BitModel;
  19658. }();
  19659. var Transform = function TransformClosure() {
  19660. function Transform() {}
  19661. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  19662. var ll = subbands[0];
  19663. for (var i = 1, ii = subbands.length; i < ii; i++) {
  19664. ll = this.iterate(ll, subbands[i], u0, v0);
  19665. }
  19666. return ll;
  19667. };
  19668. Transform.prototype.extend = function extend(buffer, offset, size) {
  19669. var i1 = offset - 1,
  19670. j1 = offset + 1;
  19671. var i2 = offset + size - 2,
  19672. j2 = offset + size;
  19673. buffer[i1--] = buffer[j1++];
  19674. buffer[j2++] = buffer[i2--];
  19675. buffer[i1--] = buffer[j1++];
  19676. buffer[j2++] = buffer[i2--];
  19677. buffer[i1--] = buffer[j1++];
  19678. buffer[j2++] = buffer[i2--];
  19679. buffer[i1] = buffer[j1];
  19680. buffer[j2] = buffer[i2];
  19681. };
  19682. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  19683. var llWidth = ll.width,
  19684. llHeight = ll.height,
  19685. llItems = ll.items;
  19686. var width = hl_lh_hh.width;
  19687. var height = hl_lh_hh.height;
  19688. var items = hl_lh_hh.items;
  19689. var i, j, k, l, u, v;
  19690. for (k = 0, i = 0; i < llHeight; i++) {
  19691. l = i * 2 * width;
  19692. for (j = 0; j < llWidth; j++, k++, l += 2) {
  19693. items[l] = llItems[k];
  19694. }
  19695. }
  19696. llItems = ll.items = null;
  19697. var bufferPadding = 4;
  19698. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  19699. if (width === 1) {
  19700. if ((u0 & 1) !== 0) {
  19701. for (v = 0, k = 0; v < height; v++, k += width) {
  19702. items[k] *= 0.5;
  19703. }
  19704. }
  19705. } else {
  19706. for (v = 0, k = 0; v < height; v++, k += width) {
  19707. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  19708. this.extend(rowBuffer, bufferPadding, width);
  19709. this.filter(rowBuffer, bufferPadding, width);
  19710. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  19711. }
  19712. }
  19713. var numBuffers = 16;
  19714. var colBuffers = [];
  19715. for (i = 0; i < numBuffers; i++) {
  19716. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  19717. }
  19718. var b,
  19719. currentBuffer = 0;
  19720. ll = bufferPadding + height;
  19721. if (height === 1) {
  19722. if ((v0 & 1) !== 0) {
  19723. for (u = 0; u < width; u++) {
  19724. items[u] *= 0.5;
  19725. }
  19726. }
  19727. } else {
  19728. for (u = 0; u < width; u++) {
  19729. if (currentBuffer === 0) {
  19730. numBuffers = Math.min(width - u, numBuffers);
  19731. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  19732. for (b = 0; b < numBuffers; b++) {
  19733. colBuffers[b][l] = items[k + b];
  19734. }
  19735. }
  19736. currentBuffer = numBuffers;
  19737. }
  19738. currentBuffer--;
  19739. var buffer = colBuffers[currentBuffer];
  19740. this.extend(buffer, bufferPadding, height);
  19741. this.filter(buffer, bufferPadding, height);
  19742. if (currentBuffer === 0) {
  19743. k = u - numBuffers + 1;
  19744. for (l = bufferPadding; l < ll; k += width, l++) {
  19745. for (b = 0; b < numBuffers; b++) {
  19746. items[k + b] = colBuffers[b][l];
  19747. }
  19748. }
  19749. }
  19750. }
  19751. }
  19752. return {
  19753. width: width,
  19754. height: height,
  19755. items: items
  19756. };
  19757. };
  19758. return Transform;
  19759. }();
  19760. var IrreversibleTransform = function IrreversibleTransformClosure() {
  19761. function IrreversibleTransform() {
  19762. Transform.call(this);
  19763. }
  19764. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  19765. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  19766. var len = length >> 1;
  19767. offset = offset | 0;
  19768. var j, n, current, next;
  19769. var alpha = -1.586134342059924;
  19770. var beta = -0.052980118572961;
  19771. var gamma = 0.882911075530934;
  19772. var delta = 0.443506852043971;
  19773. var K = 1.230174104914001;
  19774. var K_ = 1 / K;
  19775. j = offset - 3;
  19776. for (n = len + 4; n--; j += 2) {
  19777. x[j] *= K_;
  19778. }
  19779. j = offset - 2;
  19780. current = delta * x[j - 1];
  19781. for (n = len + 3; n--; j += 2) {
  19782. next = delta * x[j + 1];
  19783. x[j] = K * x[j] - current - next;
  19784. if (n--) {
  19785. j += 2;
  19786. current = delta * x[j + 1];
  19787. x[j] = K * x[j] - current - next;
  19788. } else {
  19789. break;
  19790. }
  19791. }
  19792. j = offset - 1;
  19793. current = gamma * x[j - 1];
  19794. for (n = len + 2; n--; j += 2) {
  19795. next = gamma * x[j + 1];
  19796. x[j] -= current + next;
  19797. if (n--) {
  19798. j += 2;
  19799. current = gamma * x[j + 1];
  19800. x[j] -= current + next;
  19801. } else {
  19802. break;
  19803. }
  19804. }
  19805. j = offset;
  19806. current = beta * x[j - 1];
  19807. for (n = len + 1; n--; j += 2) {
  19808. next = beta * x[j + 1];
  19809. x[j] -= current + next;
  19810. if (n--) {
  19811. j += 2;
  19812. current = beta * x[j + 1];
  19813. x[j] -= current + next;
  19814. } else {
  19815. break;
  19816. }
  19817. }
  19818. if (len !== 0) {
  19819. j = offset + 1;
  19820. current = alpha * x[j - 1];
  19821. for (n = len; n--; j += 2) {
  19822. next = alpha * x[j + 1];
  19823. x[j] -= current + next;
  19824. if (n--) {
  19825. j += 2;
  19826. current = alpha * x[j + 1];
  19827. x[j] -= current + next;
  19828. } else {
  19829. break;
  19830. }
  19831. }
  19832. }
  19833. };
  19834. return IrreversibleTransform;
  19835. }();
  19836. var ReversibleTransform = function ReversibleTransformClosure() {
  19837. function ReversibleTransform() {
  19838. Transform.call(this);
  19839. }
  19840. ReversibleTransform.prototype = Object.create(Transform.prototype);
  19841. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  19842. var len = length >> 1;
  19843. offset = offset | 0;
  19844. var j, n;
  19845. for (j = offset, n = len + 1; n--; j += 2) {
  19846. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  19847. }
  19848. for (j = offset + 1, n = len; n--; j += 2) {
  19849. x[j] += x[j - 1] + x[j + 1] >> 1;
  19850. }
  19851. };
  19852. return ReversibleTransform;
  19853. }();
  19854. return JpxImage;
  19855. }();
  19856. exports.JpxImage = JpxImage;
  19857. /***/ }),
  19858. /* 16 */
  19859. /***/ (function(module, exports, __w_pdfjs_require__) {
  19860. "use strict";
  19861. Object.defineProperty(exports, "__esModule", {
  19862. value: true
  19863. });
  19864. exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = undefined;
  19865. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  19866. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  19867. var _util = __w_pdfjs_require__(0);
  19868. var _primitives = __w_pdfjs_require__(1);
  19869. var _parser = __w_pdfjs_require__(5);
  19870. var _chunked_stream = __w_pdfjs_require__(12);
  19871. var _crypto = __w_pdfjs_require__(13);
  19872. var _colorspace = __w_pdfjs_require__(3);
  19873. var Catalog = function CatalogClosure() {
  19874. function Catalog(pdfManager, xref, pageFactory) {
  19875. this.pdfManager = pdfManager;
  19876. this.xref = xref;
  19877. this.catDict = xref.getCatalogObj();
  19878. (0, _util.assert)((0, _primitives.isDict)(this.catDict), 'catalog object is not a dictionary');
  19879. this.fontCache = new _primitives.RefSetCache();
  19880. this.builtInCMapCache = Object.create(null);
  19881. this.pageKidsCountCache = new _primitives.RefSetCache();
  19882. this.pageFactory = pageFactory;
  19883. this.pagePromises = [];
  19884. }
  19885. Catalog.prototype = {
  19886. get metadata() {
  19887. var streamRef = this.catDict.getRaw('Metadata');
  19888. if (!(0, _primitives.isRef)(streamRef)) {
  19889. return (0, _util.shadow)(this, 'metadata', null);
  19890. }
  19891. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  19892. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  19893. var metadata;
  19894. if (stream && (0, _primitives.isDict)(stream.dict)) {
  19895. var type = stream.dict.get('Type');
  19896. var subtype = stream.dict.get('Subtype');
  19897. if ((0, _primitives.isName)(type, 'Metadata') && (0, _primitives.isName)(subtype, 'XML')) {
  19898. try {
  19899. metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
  19900. } catch (e) {
  19901. if (e instanceof _util.MissingDataException) {
  19902. throw e;
  19903. }
  19904. (0, _util.info)('Skipping invalid metadata.');
  19905. }
  19906. }
  19907. }
  19908. return (0, _util.shadow)(this, 'metadata', metadata);
  19909. },
  19910. get toplevelPagesDict() {
  19911. var pagesObj = this.catDict.get('Pages');
  19912. (0, _util.assert)((0, _primitives.isDict)(pagesObj), 'invalid top-level pages dictionary');
  19913. return (0, _util.shadow)(this, 'toplevelPagesDict', pagesObj);
  19914. },
  19915. get documentOutline() {
  19916. var obj = null;
  19917. try {
  19918. obj = this.readDocumentOutline();
  19919. } catch (ex) {
  19920. if (ex instanceof _util.MissingDataException) {
  19921. throw ex;
  19922. }
  19923. (0, _util.warn)('Unable to read document outline');
  19924. }
  19925. return (0, _util.shadow)(this, 'documentOutline', obj);
  19926. },
  19927. readDocumentOutline: function Catalog_readDocumentOutline() {
  19928. var obj = this.catDict.get('Outlines');
  19929. if (!(0, _primitives.isDict)(obj)) {
  19930. return null;
  19931. }
  19932. obj = obj.getRaw('First');
  19933. if (!(0, _primitives.isRef)(obj)) {
  19934. return null;
  19935. }
  19936. var root = { items: [] };
  19937. var queue = [{
  19938. obj: obj,
  19939. parent: root
  19940. }];
  19941. var processed = new _primitives.RefSet();
  19942. processed.put(obj);
  19943. var xref = this.xref,
  19944. blackColor = new Uint8Array(3);
  19945. while (queue.length > 0) {
  19946. var i = queue.shift();
  19947. var outlineDict = xref.fetchIfRef(i.obj);
  19948. if (outlineDict === null) {
  19949. continue;
  19950. }
  19951. (0, _util.assert)(outlineDict.has('Title'), 'Invalid outline item');
  19952. var data = {
  19953. url: null,
  19954. dest: null
  19955. };
  19956. Catalog.parseDestDictionary({
  19957. destDict: outlineDict,
  19958. resultObj: data,
  19959. docBaseUrl: this.pdfManager.docBaseUrl
  19960. });
  19961. var title = outlineDict.get('Title');
  19962. var flags = outlineDict.get('F') || 0;
  19963. var color = outlineDict.getArray('C'),
  19964. rgbColor = blackColor;
  19965. if ((0, _util.isArray)(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  19966. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  19967. }
  19968. var outlineItem = {
  19969. dest: data.dest,
  19970. url: data.url,
  19971. unsafeUrl: data.unsafeUrl,
  19972. newWindow: data.newWindow,
  19973. title: (0, _util.stringToPDFString)(title),
  19974. color: rgbColor,
  19975. count: outlineDict.get('Count'),
  19976. bold: !!(flags & 2),
  19977. italic: !!(flags & 1),
  19978. items: []
  19979. };
  19980. i.parent.items.push(outlineItem);
  19981. obj = outlineDict.getRaw('First');
  19982. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  19983. queue.push({
  19984. obj: obj,
  19985. parent: outlineItem
  19986. });
  19987. processed.put(obj);
  19988. }
  19989. obj = outlineDict.getRaw('Next');
  19990. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  19991. queue.push({
  19992. obj: obj,
  19993. parent: i.parent
  19994. });
  19995. processed.put(obj);
  19996. }
  19997. }
  19998. return root.items.length > 0 ? root.items : null;
  19999. },
  20000. get numPages() {
  20001. var obj = this.toplevelPagesDict.get('Count');
  20002. (0, _util.assert)((0, _util.isInt)(obj), 'page count in top level pages object is not an integer');
  20003. return (0, _util.shadow)(this, 'num', obj);
  20004. },
  20005. get destinations() {
  20006. function fetchDestination(dest) {
  20007. return (0, _primitives.isDict)(dest) ? dest.get('D') : dest;
  20008. }
  20009. var xref = this.xref;
  20010. var dests = {},
  20011. nameTreeRef,
  20012. nameDictionaryRef;
  20013. var obj = this.catDict.get('Names');
  20014. if (obj && obj.has('Dests')) {
  20015. nameTreeRef = obj.getRaw('Dests');
  20016. } else if (this.catDict.has('Dests')) {
  20017. nameDictionaryRef = this.catDict.get('Dests');
  20018. }
  20019. if (nameDictionaryRef) {
  20020. obj = nameDictionaryRef;
  20021. obj.forEach(function catalogForEach(key, value) {
  20022. if (!value) {
  20023. return;
  20024. }
  20025. dests[key] = fetchDestination(value);
  20026. });
  20027. }
  20028. if (nameTreeRef) {
  20029. var nameTree = new NameTree(nameTreeRef, xref);
  20030. var names = nameTree.getAll();
  20031. for (var name in names) {
  20032. dests[name] = fetchDestination(names[name]);
  20033. }
  20034. }
  20035. return (0, _util.shadow)(this, 'destinations', dests);
  20036. },
  20037. getDestination: function Catalog_getDestination(destinationId) {
  20038. function fetchDestination(dest) {
  20039. return (0, _primitives.isDict)(dest) ? dest.get('D') : dest;
  20040. }
  20041. var xref = this.xref;
  20042. var dest = null,
  20043. nameTreeRef,
  20044. nameDictionaryRef;
  20045. var obj = this.catDict.get('Names');
  20046. if (obj && obj.has('Dests')) {
  20047. nameTreeRef = obj.getRaw('Dests');
  20048. } else if (this.catDict.has('Dests')) {
  20049. nameDictionaryRef = this.catDict.get('Dests');
  20050. }
  20051. if (nameDictionaryRef) {
  20052. var value = nameDictionaryRef.get(destinationId);
  20053. if (value) {
  20054. dest = fetchDestination(value);
  20055. }
  20056. }
  20057. if (nameTreeRef) {
  20058. var nameTree = new NameTree(nameTreeRef, xref);
  20059. dest = fetchDestination(nameTree.get(destinationId));
  20060. }
  20061. return dest;
  20062. },
  20063. get pageLabels() {
  20064. var obj = null;
  20065. try {
  20066. obj = this.readPageLabels();
  20067. } catch (ex) {
  20068. if (ex instanceof _util.MissingDataException) {
  20069. throw ex;
  20070. }
  20071. (0, _util.warn)('Unable to read page labels.');
  20072. }
  20073. return (0, _util.shadow)(this, 'pageLabels', obj);
  20074. },
  20075. readPageLabels: function Catalog_readPageLabels() {
  20076. var obj = this.catDict.getRaw('PageLabels');
  20077. if (!obj) {
  20078. return null;
  20079. }
  20080. var pageLabels = new Array(this.numPages);
  20081. var style = null;
  20082. var prefix = '';
  20083. var numberTree = new NumberTree(obj, this.xref);
  20084. var nums = numberTree.getAll();
  20085. var currentLabel = '',
  20086. currentIndex = 1;
  20087. for (var i = 0, ii = this.numPages; i < ii; i++) {
  20088. if (i in nums) {
  20089. var labelDict = nums[i];
  20090. (0, _util.assert)((0, _primitives.isDict)(labelDict), 'The PageLabel is not a dictionary.');
  20091. var type = labelDict.get('Type');
  20092. (0, _util.assert)(!type || (0, _primitives.isName)(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  20093. var s = labelDict.get('S');
  20094. (0, _util.assert)(!s || (0, _primitives.isName)(s), 'Invalid style in PageLabel dictionary.');
  20095. style = s ? s.name : null;
  20096. var p = labelDict.get('P');
  20097. (0, _util.assert)(!p || (0, _util.isString)(p), 'Invalid prefix in PageLabel dictionary.');
  20098. prefix = p ? (0, _util.stringToPDFString)(p) : '';
  20099. var st = labelDict.get('St');
  20100. (0, _util.assert)(!st || (0, _util.isInt)(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  20101. currentIndex = st || 1;
  20102. }
  20103. switch (style) {
  20104. case 'D':
  20105. currentLabel = currentIndex;
  20106. break;
  20107. case 'R':
  20108. case 'r':
  20109. currentLabel = _util.Util.toRoman(currentIndex, style === 'r');
  20110. break;
  20111. case 'A':
  20112. case 'a':
  20113. var LIMIT = 26;
  20114. var A_UPPER_CASE = 0x41,
  20115. A_LOWER_CASE = 0x61;
  20116. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  20117. var letterIndex = currentIndex - 1;
  20118. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  20119. var charBuf = [];
  20120. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  20121. charBuf.push(character);
  20122. }
  20123. currentLabel = charBuf.join('');
  20124. break;
  20125. default:
  20126. (0, _util.assert)(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  20127. }
  20128. pageLabels[i] = prefix + currentLabel;
  20129. currentLabel = '';
  20130. currentIndex++;
  20131. }
  20132. return pageLabels;
  20133. },
  20134. get attachments() {
  20135. var xref = this.xref;
  20136. var attachments = null,
  20137. nameTreeRef;
  20138. var obj = this.catDict.get('Names');
  20139. if (obj) {
  20140. nameTreeRef = obj.getRaw('EmbeddedFiles');
  20141. }
  20142. if (nameTreeRef) {
  20143. var nameTree = new NameTree(nameTreeRef, xref);
  20144. var names = nameTree.getAll();
  20145. for (var name in names) {
  20146. var fs = new FileSpec(names[name], xref);
  20147. if (!attachments) {
  20148. attachments = Object.create(null);
  20149. }
  20150. attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
  20151. }
  20152. }
  20153. return (0, _util.shadow)(this, 'attachments', attachments);
  20154. },
  20155. get javaScript() {
  20156. var xref = this.xref;
  20157. var obj = this.catDict.get('Names');
  20158. var javaScript = [];
  20159. function appendIfJavaScriptDict(jsDict) {
  20160. var type = jsDict.get('S');
  20161. if (!(0, _primitives.isName)(type, 'JavaScript')) {
  20162. return;
  20163. }
  20164. var js = jsDict.get('JS');
  20165. if ((0, _primitives.isStream)(js)) {
  20166. js = (0, _util.bytesToString)(js.getBytes());
  20167. } else if (!(0, _util.isString)(js)) {
  20168. return;
  20169. }
  20170. javaScript.push((0, _util.stringToPDFString)(js));
  20171. }
  20172. if (obj && obj.has('JavaScript')) {
  20173. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  20174. var names = nameTree.getAll();
  20175. for (var name in names) {
  20176. var jsDict = names[name];
  20177. if ((0, _primitives.isDict)(jsDict)) {
  20178. appendIfJavaScriptDict(jsDict);
  20179. }
  20180. }
  20181. }
  20182. var openactionDict = this.catDict.get('OpenAction');
  20183. if ((0, _primitives.isDict)(openactionDict, 'Action')) {
  20184. var actionType = openactionDict.get('S');
  20185. if ((0, _primitives.isName)(actionType, 'Named')) {
  20186. var action = openactionDict.get('N');
  20187. if ((0, _primitives.isName)(action, 'Print')) {
  20188. javaScript.push('print({});');
  20189. }
  20190. } else {
  20191. appendIfJavaScriptDict(openactionDict);
  20192. }
  20193. }
  20194. return (0, _util.shadow)(this, 'javaScript', javaScript);
  20195. },
  20196. cleanup: function Catalog_cleanup() {
  20197. var _this = this;
  20198. this.pageKidsCountCache.clear();
  20199. var promises = [];
  20200. this.fontCache.forEach(function (promise) {
  20201. promises.push(promise);
  20202. });
  20203. return Promise.all(promises).then(function (translatedFonts) {
  20204. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  20205. var font = translatedFonts[i].dict;
  20206. delete font.translated;
  20207. }
  20208. _this.fontCache.clear();
  20209. _this.builtInCMapCache = Object.create(null);
  20210. });
  20211. },
  20212. getPage: function Catalog_getPage(pageIndex) {
  20213. var _this2 = this;
  20214. if (!(pageIndex in this.pagePromises)) {
  20215. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (_ref) {
  20216. var _ref2 = _slicedToArray(_ref, 2),
  20217. dict = _ref2[0],
  20218. ref = _ref2[1];
  20219. return _this2.pageFactory.createPage(pageIndex, dict, ref, _this2.fontCache, _this2.builtInCMapCache);
  20220. });
  20221. }
  20222. return this.pagePromises[pageIndex];
  20223. },
  20224. getPageDict: function Catalog_getPageDict(pageIndex) {
  20225. var capability = (0, _util.createPromiseCapability)();
  20226. var nodesToVisit = [this.catDict.getRaw('Pages')];
  20227. var count,
  20228. currentPageIndex = 0;
  20229. var xref = this.xref,
  20230. pageKidsCountCache = this.pageKidsCountCache;
  20231. function next() {
  20232. while (nodesToVisit.length) {
  20233. var currentNode = nodesToVisit.pop();
  20234. if ((0, _primitives.isRef)(currentNode)) {
  20235. count = pageKidsCountCache.get(currentNode);
  20236. if (count > 0 && currentPageIndex + count < pageIndex) {
  20237. currentPageIndex += count;
  20238. continue;
  20239. }
  20240. xref.fetchAsync(currentNode).then(function (obj) {
  20241. if ((0, _primitives.isDict)(obj, 'Page') || (0, _primitives.isDict)(obj) && !obj.has('Kids')) {
  20242. if (pageIndex === currentPageIndex) {
  20243. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  20244. pageKidsCountCache.put(currentNode, 1);
  20245. }
  20246. capability.resolve([obj, currentNode]);
  20247. } else {
  20248. currentPageIndex++;
  20249. next();
  20250. }
  20251. return;
  20252. }
  20253. nodesToVisit.push(obj);
  20254. next();
  20255. }, capability.reject);
  20256. return;
  20257. }
  20258. (0, _util.assert)((0, _primitives.isDict)(currentNode), 'page dictionary kid reference points to wrong type of object');
  20259. count = currentNode.get('Count');
  20260. var objId = currentNode.objId;
  20261. if (objId && !pageKidsCountCache.has(objId)) {
  20262. pageKidsCountCache.put(objId, count);
  20263. }
  20264. if (currentPageIndex + count <= pageIndex) {
  20265. currentPageIndex += count;
  20266. continue;
  20267. }
  20268. var kids = currentNode.get('Kids');
  20269. (0, _util.assert)((0, _util.isArray)(kids), 'page dictionary kids object is not an array');
  20270. for (var last = kids.length - 1; last >= 0; last--) {
  20271. nodesToVisit.push(kids[last]);
  20272. }
  20273. }
  20274. capability.reject('Page index ' + pageIndex + ' not found.');
  20275. }
  20276. next();
  20277. return capability.promise;
  20278. },
  20279. getPageIndex: function Catalog_getPageIndex(pageRef) {
  20280. var xref = this.xref;
  20281. function pagesBeforeRef(kidRef) {
  20282. var total = 0;
  20283. var parentRef;
  20284. return xref.fetchAsync(kidRef).then(function (node) {
  20285. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, 'Page') && !((0, _primitives.isDict)(node) && !node.has('Type') && node.has('Contents'))) {
  20286. throw new Error('The reference does not point to a /Page Dict.');
  20287. }
  20288. if (!node) {
  20289. return null;
  20290. }
  20291. (0, _util.assert)((0, _primitives.isDict)(node), 'node must be a Dict.');
  20292. parentRef = node.getRaw('Parent');
  20293. return node.getAsync('Parent');
  20294. }).then(function (parent) {
  20295. if (!parent) {
  20296. return null;
  20297. }
  20298. (0, _util.assert)((0, _primitives.isDict)(parent), 'parent must be a Dict.');
  20299. return parent.getAsync('Kids');
  20300. }).then(function (kids) {
  20301. if (!kids) {
  20302. return null;
  20303. }
  20304. var kidPromises = [];
  20305. var found = false;
  20306. for (var i = 0; i < kids.length; i++) {
  20307. var kid = kids[i];
  20308. (0, _util.assert)((0, _primitives.isRef)(kid), 'kid must be a Ref.');
  20309. if (kid.num === kidRef.num) {
  20310. found = true;
  20311. break;
  20312. }
  20313. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  20314. if (kid.has('Count')) {
  20315. var count = kid.get('Count');
  20316. total += count;
  20317. } else {
  20318. total++;
  20319. }
  20320. }));
  20321. }
  20322. if (!found) {
  20323. (0, _util.error)('kid ref not found in parents kids');
  20324. }
  20325. return Promise.all(kidPromises).then(function () {
  20326. return [total, parentRef];
  20327. });
  20328. });
  20329. }
  20330. var total = 0;
  20331. function next(ref) {
  20332. return pagesBeforeRef(ref).then(function (args) {
  20333. if (!args) {
  20334. return total;
  20335. }
  20336. var count = args[0];
  20337. var parentRef = args[1];
  20338. total += count;
  20339. return next(parentRef);
  20340. });
  20341. }
  20342. return next(pageRef);
  20343. }
  20344. };
  20345. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  20346. function addDefaultProtocolToUrl(url) {
  20347. if (url.indexOf('www.') === 0) {
  20348. return 'http://' + url;
  20349. }
  20350. return url;
  20351. }
  20352. function tryConvertUrlEncoding(url) {
  20353. try {
  20354. return (0, _util.stringToUTF8String)(url);
  20355. } catch (e) {
  20356. return url;
  20357. }
  20358. }
  20359. var destDict = params.destDict;
  20360. if (!(0, _primitives.isDict)(destDict)) {
  20361. (0, _util.warn)('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  20362. return;
  20363. }
  20364. var resultObj = params.resultObj;
  20365. if ((typeof resultObj === 'undefined' ? 'undefined' : _typeof(resultObj)) !== 'object') {
  20366. (0, _util.warn)('Catalog_parseDestDictionary: "resultObj" must be an object.');
  20367. return;
  20368. }
  20369. var docBaseUrl = params.docBaseUrl || null;
  20370. var action = destDict.get('A'),
  20371. url,
  20372. dest;
  20373. if ((0, _primitives.isDict)(action)) {
  20374. var linkType = action.get('S').name;
  20375. switch (linkType) {
  20376. case 'URI':
  20377. url = action.get('URI');
  20378. if ((0, _primitives.isName)(url)) {
  20379. url = '/' + url.name;
  20380. } else if ((0, _util.isString)(url)) {
  20381. url = addDefaultProtocolToUrl(url);
  20382. }
  20383. break;
  20384. case 'GoTo':
  20385. dest = action.get('D');
  20386. break;
  20387. case 'Launch':
  20388. case 'GoToR':
  20389. var urlDict = action.get('F');
  20390. if ((0, _primitives.isDict)(urlDict)) {
  20391. url = urlDict.get('F') || null;
  20392. } else if ((0, _util.isString)(urlDict)) {
  20393. url = urlDict;
  20394. }
  20395. var remoteDest = action.get('D');
  20396. if (remoteDest) {
  20397. if ((0, _primitives.isName)(remoteDest)) {
  20398. remoteDest = remoteDest.name;
  20399. }
  20400. if ((0, _util.isString)(url)) {
  20401. var baseUrl = url.split('#')[0];
  20402. if ((0, _util.isString)(remoteDest)) {
  20403. url = baseUrl + '#' + remoteDest;
  20404. } else if ((0, _util.isArray)(remoteDest)) {
  20405. url = baseUrl + '#' + JSON.stringify(remoteDest);
  20406. }
  20407. }
  20408. }
  20409. var newWindow = action.get('NewWindow');
  20410. if ((0, _util.isBool)(newWindow)) {
  20411. resultObj.newWindow = newWindow;
  20412. }
  20413. break;
  20414. case 'Named':
  20415. var namedAction = action.get('N');
  20416. if ((0, _primitives.isName)(namedAction)) {
  20417. resultObj.action = namedAction.name;
  20418. }
  20419. break;
  20420. case 'JavaScript':
  20421. var jsAction = action.get('JS'),
  20422. js;
  20423. if ((0, _primitives.isStream)(jsAction)) {
  20424. js = (0, _util.bytesToString)(jsAction.getBytes());
  20425. } else if ((0, _util.isString)(jsAction)) {
  20426. js = jsAction;
  20427. }
  20428. if (js) {
  20429. var URL_OPEN_METHODS = ['app.launchURL', 'window.open'];
  20430. var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
  20431. var jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  20432. if (jsUrl && jsUrl[2]) {
  20433. url = jsUrl[2];
  20434. if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
  20435. resultObj.newWindow = true;
  20436. }
  20437. break;
  20438. }
  20439. }
  20440. default:
  20441. (0, _util.warn)('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  20442. break;
  20443. }
  20444. } else if (destDict.has('Dest')) {
  20445. dest = destDict.get('Dest');
  20446. }
  20447. if ((0, _util.isString)(url)) {
  20448. url = tryConvertUrlEncoding(url);
  20449. var absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  20450. if (absoluteUrl) {
  20451. resultObj.url = absoluteUrl.href;
  20452. }
  20453. resultObj.unsafeUrl = url;
  20454. }
  20455. if (dest) {
  20456. if ((0, _primitives.isName)(dest)) {
  20457. dest = dest.name;
  20458. }
  20459. if ((0, _util.isString)(dest) || (0, _util.isArray)(dest)) {
  20460. resultObj.dest = dest;
  20461. }
  20462. }
  20463. };
  20464. return Catalog;
  20465. }();
  20466. var XRef = function XRefClosure() {
  20467. function XRef(stream, pdfManager) {
  20468. this.stream = stream;
  20469. this.pdfManager = pdfManager;
  20470. this.entries = [];
  20471. this.xrefstms = Object.create(null);
  20472. this.cache = [];
  20473. this.stats = {
  20474. streamTypes: [],
  20475. fontTypes: []
  20476. };
  20477. }
  20478. XRef.prototype = {
  20479. setStartXRef: function XRef_setStartXRef(startXRef) {
  20480. this.startXRefQueue = [startXRef];
  20481. },
  20482. parse: function XRef_parse(recoveryMode) {
  20483. var trailerDict;
  20484. if (!recoveryMode) {
  20485. trailerDict = this.readXRef();
  20486. } else {
  20487. (0, _util.warn)('Indexing all PDF objects');
  20488. trailerDict = this.indexObjects();
  20489. }
  20490. trailerDict.assignXref(this);
  20491. this.trailer = trailerDict;
  20492. var encrypt = trailerDict.get('Encrypt');
  20493. if ((0, _primitives.isDict)(encrypt)) {
  20494. var ids = trailerDict.get('ID');
  20495. var fileId = ids && ids.length ? ids[0] : '';
  20496. encrypt.suppressEncryption = true;
  20497. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  20498. }
  20499. if (!(this.root = trailerDict.get('Root'))) {
  20500. (0, _util.error)('Invalid root reference');
  20501. }
  20502. },
  20503. processXRefTable: function XRef_processXRefTable(parser) {
  20504. if (!('tableState' in this)) {
  20505. this.tableState = {
  20506. entryNum: 0,
  20507. streamPos: parser.lexer.stream.pos,
  20508. parserBuf1: parser.buf1,
  20509. parserBuf2: parser.buf2
  20510. };
  20511. }
  20512. var obj = this.readXRefTable(parser);
  20513. if (!(0, _primitives.isCmd)(obj, 'trailer')) {
  20514. (0, _util.error)('Invalid XRef table: could not find trailer dictionary');
  20515. }
  20516. var dict = parser.getObj();
  20517. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  20518. dict = dict.dict;
  20519. }
  20520. if (!(0, _primitives.isDict)(dict)) {
  20521. (0, _util.error)('Invalid XRef table: could not parse trailer dictionary');
  20522. }
  20523. delete this.tableState;
  20524. return dict;
  20525. },
  20526. readXRefTable: function XRef_readXRefTable(parser) {
  20527. var stream = parser.lexer.stream;
  20528. var tableState = this.tableState;
  20529. stream.pos = tableState.streamPos;
  20530. parser.buf1 = tableState.parserBuf1;
  20531. parser.buf2 = tableState.parserBuf2;
  20532. var obj;
  20533. while (true) {
  20534. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  20535. if ((0, _primitives.isCmd)(obj = parser.getObj(), 'trailer')) {
  20536. break;
  20537. }
  20538. tableState.firstEntryNum = obj;
  20539. tableState.entryCount = parser.getObj();
  20540. }
  20541. var first = tableState.firstEntryNum;
  20542. var count = tableState.entryCount;
  20543. if (!(0, _util.isInt)(first) || !(0, _util.isInt)(count)) {
  20544. (0, _util.error)('Invalid XRef table: wrong types in subsection header');
  20545. }
  20546. for (var i = tableState.entryNum; i < count; i++) {
  20547. tableState.streamPos = stream.pos;
  20548. tableState.entryNum = i;
  20549. tableState.parserBuf1 = parser.buf1;
  20550. tableState.parserBuf2 = parser.buf2;
  20551. var entry = {};
  20552. entry.offset = parser.getObj();
  20553. entry.gen = parser.getObj();
  20554. var type = parser.getObj();
  20555. if ((0, _primitives.isCmd)(type, 'f')) {
  20556. entry.free = true;
  20557. } else if ((0, _primitives.isCmd)(type, 'n')) {
  20558. entry.uncompressed = true;
  20559. }
  20560. if (!(0, _util.isInt)(entry.offset) || !(0, _util.isInt)(entry.gen) || !(entry.free || entry.uncompressed)) {
  20561. (0, _util.error)('Invalid entry in XRef subsection: ' + first + ', ' + count);
  20562. }
  20563. if (i === 0 && entry.free && first === 1) {
  20564. first = 0;
  20565. }
  20566. if (!this.entries[i + first]) {
  20567. this.entries[i + first] = entry;
  20568. }
  20569. }
  20570. tableState.entryNum = 0;
  20571. tableState.streamPos = stream.pos;
  20572. tableState.parserBuf1 = parser.buf1;
  20573. tableState.parserBuf2 = parser.buf2;
  20574. delete tableState.firstEntryNum;
  20575. delete tableState.entryCount;
  20576. }
  20577. if (this.entries[0] && !this.entries[0].free) {
  20578. (0, _util.error)('Invalid XRef table: unexpected first object');
  20579. }
  20580. return obj;
  20581. },
  20582. processXRefStream: function XRef_processXRefStream(stream) {
  20583. if (!('streamState' in this)) {
  20584. var streamParameters = stream.dict;
  20585. var byteWidths = streamParameters.get('W');
  20586. var range = streamParameters.get('Index');
  20587. if (!range) {
  20588. range = [0, streamParameters.get('Size')];
  20589. }
  20590. this.streamState = {
  20591. entryRanges: range,
  20592. byteWidths: byteWidths,
  20593. entryNum: 0,
  20594. streamPos: stream.pos
  20595. };
  20596. }
  20597. this.readXRefStream(stream);
  20598. delete this.streamState;
  20599. return stream.dict;
  20600. },
  20601. readXRefStream: function XRef_readXRefStream(stream) {
  20602. var i, j;
  20603. var streamState = this.streamState;
  20604. stream.pos = streamState.streamPos;
  20605. var byteWidths = streamState.byteWidths;
  20606. var typeFieldWidth = byteWidths[0];
  20607. var offsetFieldWidth = byteWidths[1];
  20608. var generationFieldWidth = byteWidths[2];
  20609. var entryRanges = streamState.entryRanges;
  20610. while (entryRanges.length > 0) {
  20611. var first = entryRanges[0];
  20612. var n = entryRanges[1];
  20613. if (!(0, _util.isInt)(first) || !(0, _util.isInt)(n)) {
  20614. (0, _util.error)('Invalid XRef range fields: ' + first + ', ' + n);
  20615. }
  20616. if (!(0, _util.isInt)(typeFieldWidth) || !(0, _util.isInt)(offsetFieldWidth) || !(0, _util.isInt)(generationFieldWidth)) {
  20617. (0, _util.error)('Invalid XRef entry fields length: ' + first + ', ' + n);
  20618. }
  20619. for (i = streamState.entryNum; i < n; ++i) {
  20620. streamState.entryNum = i;
  20621. streamState.streamPos = stream.pos;
  20622. var type = 0,
  20623. offset = 0,
  20624. generation = 0;
  20625. for (j = 0; j < typeFieldWidth; ++j) {
  20626. type = type << 8 | stream.getByte();
  20627. }
  20628. if (typeFieldWidth === 0) {
  20629. type = 1;
  20630. }
  20631. for (j = 0; j < offsetFieldWidth; ++j) {
  20632. offset = offset << 8 | stream.getByte();
  20633. }
  20634. for (j = 0; j < generationFieldWidth; ++j) {
  20635. generation = generation << 8 | stream.getByte();
  20636. }
  20637. var entry = {};
  20638. entry.offset = offset;
  20639. entry.gen = generation;
  20640. switch (type) {
  20641. case 0:
  20642. entry.free = true;
  20643. break;
  20644. case 1:
  20645. entry.uncompressed = true;
  20646. break;
  20647. case 2:
  20648. break;
  20649. default:
  20650. (0, _util.error)('Invalid XRef entry type: ' + type);
  20651. }
  20652. if (!this.entries[first + i]) {
  20653. this.entries[first + i] = entry;
  20654. }
  20655. }
  20656. streamState.entryNum = 0;
  20657. streamState.streamPos = stream.pos;
  20658. entryRanges.splice(0, 2);
  20659. }
  20660. },
  20661. indexObjects: function XRef_indexObjects() {
  20662. var TAB = 0x9,
  20663. LF = 0xA,
  20664. CR = 0xD,
  20665. SPACE = 0x20;
  20666. var PERCENT = 0x25,
  20667. LT = 0x3C;
  20668. function readToken(data, offset) {
  20669. var token = '',
  20670. ch = data[offset];
  20671. while (ch !== LF && ch !== CR && ch !== LT) {
  20672. if (++offset >= data.length) {
  20673. break;
  20674. }
  20675. token += String.fromCharCode(ch);
  20676. ch = data[offset];
  20677. }
  20678. return token;
  20679. }
  20680. function skipUntil(data, offset, what) {
  20681. var length = what.length,
  20682. dataLength = data.length;
  20683. var skipped = 0;
  20684. while (offset < dataLength) {
  20685. var i = 0;
  20686. while (i < length && data[offset + i] === what[i]) {
  20687. ++i;
  20688. }
  20689. if (i >= length) {
  20690. break;
  20691. }
  20692. offset++;
  20693. skipped++;
  20694. }
  20695. return skipped;
  20696. }
  20697. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  20698. var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  20699. var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  20700. var endobjBytes = new Uint8Array([101, 110, 100, 111, 98, 106]);
  20701. var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  20702. this.entries.length = 0;
  20703. var stream = this.stream;
  20704. stream.pos = 0;
  20705. var buffer = stream.getBytes();
  20706. var position = stream.start,
  20707. length = buffer.length;
  20708. var trailers = [],
  20709. xrefStms = [];
  20710. while (position < length) {
  20711. var ch = buffer[position];
  20712. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  20713. ++position;
  20714. continue;
  20715. }
  20716. if (ch === PERCENT) {
  20717. do {
  20718. ++position;
  20719. if (position >= length) {
  20720. break;
  20721. }
  20722. ch = buffer[position];
  20723. } while (ch !== LF && ch !== CR);
  20724. continue;
  20725. }
  20726. var token = readToken(buffer, position);
  20727. var m;
  20728. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  20729. position += skipUntil(buffer, position, trailerBytes);
  20730. trailers.push(position);
  20731. position += skipUntil(buffer, position, startxrefBytes);
  20732. } else if (m = objRegExp.exec(token)) {
  20733. if (typeof this.entries[m[1]] === 'undefined') {
  20734. this.entries[m[1]] = {
  20735. offset: position - stream.start,
  20736. gen: m[2] | 0,
  20737. uncompressed: true
  20738. };
  20739. }
  20740. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  20741. var content = buffer.subarray(position, position + contentLength);
  20742. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  20743. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  20744. xrefStms.push(position - stream.start);
  20745. this.xrefstms[position - stream.start] = 1;
  20746. }
  20747. position += contentLength;
  20748. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  20749. trailers.push(position);
  20750. position += skipUntil(buffer, position, startxrefBytes);
  20751. } else {
  20752. position += token.length + 1;
  20753. }
  20754. }
  20755. var i, ii;
  20756. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  20757. this.startXRefQueue.push(xrefStms[i]);
  20758. this.readXRef(true);
  20759. }
  20760. var dict;
  20761. for (i = 0, ii = trailers.length; i < ii; ++i) {
  20762. stream.pos = trailers[i];
  20763. var parser = new _parser.Parser(new _parser.Lexer(stream), true, this, true);
  20764. var obj = parser.getObj();
  20765. if (!(0, _primitives.isCmd)(obj, 'trailer')) {
  20766. continue;
  20767. }
  20768. dict = parser.getObj();
  20769. if (!(0, _primitives.isDict)(dict)) {
  20770. continue;
  20771. }
  20772. if (dict.has('ID')) {
  20773. return dict;
  20774. }
  20775. }
  20776. if (dict) {
  20777. return dict;
  20778. }
  20779. throw new _util.InvalidPDFException('Invalid PDF structure');
  20780. },
  20781. readXRef: function XRef_readXRef(recoveryMode) {
  20782. var stream = this.stream;
  20783. try {
  20784. while (this.startXRefQueue.length) {
  20785. var startXRef = this.startXRefQueue[0];
  20786. stream.pos = startXRef + stream.start;
  20787. var parser = new _parser.Parser(new _parser.Lexer(stream), true, this);
  20788. var obj = parser.getObj();
  20789. var dict;
  20790. if ((0, _primitives.isCmd)(obj, 'xref')) {
  20791. dict = this.processXRefTable(parser);
  20792. if (!this.topDict) {
  20793. this.topDict = dict;
  20794. }
  20795. obj = dict.get('XRefStm');
  20796. if ((0, _util.isInt)(obj)) {
  20797. var pos = obj;
  20798. if (!(pos in this.xrefstms)) {
  20799. this.xrefstms[pos] = 1;
  20800. this.startXRefQueue.push(pos);
  20801. }
  20802. }
  20803. } else if ((0, _util.isInt)(obj)) {
  20804. if (!(0, _util.isInt)(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), 'obj') || !(0, _primitives.isStream)(obj = parser.getObj())) {
  20805. (0, _util.error)('Invalid XRef stream');
  20806. }
  20807. dict = this.processXRefStream(obj);
  20808. if (!this.topDict) {
  20809. this.topDict = dict;
  20810. }
  20811. if (!dict) {
  20812. (0, _util.error)('Failed to read XRef stream');
  20813. }
  20814. } else {
  20815. (0, _util.error)('Invalid XRef stream header');
  20816. }
  20817. obj = dict.get('Prev');
  20818. if ((0, _util.isInt)(obj)) {
  20819. this.startXRefQueue.push(obj);
  20820. } else if ((0, _primitives.isRef)(obj)) {
  20821. this.startXRefQueue.push(obj.num);
  20822. }
  20823. this.startXRefQueue.shift();
  20824. }
  20825. return this.topDict;
  20826. } catch (e) {
  20827. if (e instanceof _util.MissingDataException) {
  20828. throw e;
  20829. }
  20830. (0, _util.info)('(while reading XRef): ' + e);
  20831. }
  20832. if (recoveryMode) {
  20833. return;
  20834. }
  20835. throw new _util.XRefParseException();
  20836. },
  20837. getEntry: function XRef_getEntry(i) {
  20838. var xrefEntry = this.entries[i];
  20839. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  20840. return xrefEntry;
  20841. }
  20842. return null;
  20843. },
  20844. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  20845. if (!(0, _primitives.isRef)(obj)) {
  20846. return obj;
  20847. }
  20848. return this.fetch(obj, suppressEncryption);
  20849. },
  20850. fetch: function XRef_fetch(ref, suppressEncryption) {
  20851. (0, _util.assert)((0, _primitives.isRef)(ref), 'ref object is not a reference');
  20852. var num = ref.num;
  20853. if (num in this.cache) {
  20854. var cacheEntry = this.cache[num];
  20855. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  20856. cacheEntry.objId = ref.toString();
  20857. }
  20858. return cacheEntry;
  20859. }
  20860. var xrefEntry = this.getEntry(num);
  20861. if (xrefEntry === null) {
  20862. return this.cache[num] = null;
  20863. }
  20864. if (xrefEntry.uncompressed) {
  20865. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  20866. } else {
  20867. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  20868. }
  20869. if ((0, _primitives.isDict)(xrefEntry)) {
  20870. xrefEntry.objId = ref.toString();
  20871. } else if ((0, _primitives.isStream)(xrefEntry)) {
  20872. xrefEntry.dict.objId = ref.toString();
  20873. }
  20874. return xrefEntry;
  20875. },
  20876. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  20877. var gen = ref.gen;
  20878. var num = ref.num;
  20879. if (xrefEntry.gen !== gen) {
  20880. (0, _util.error)('inconsistent generation in XRef');
  20881. }
  20882. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  20883. var parser = new _parser.Parser(new _parser.Lexer(stream), true, this);
  20884. var obj1 = parser.getObj();
  20885. var obj2 = parser.getObj();
  20886. var obj3 = parser.getObj();
  20887. if (!(0, _util.isInt)(obj1) || parseInt(obj1, 10) !== num || !(0, _util.isInt)(obj2) || parseInt(obj2, 10) !== gen || !(0, _primitives.isCmd)(obj3)) {
  20888. (0, _util.error)('bad XRef entry');
  20889. }
  20890. if (!(0, _primitives.isCmd)(obj3, 'obj')) {
  20891. if (obj3.cmd.indexOf('obj') === 0) {
  20892. num = parseInt(obj3.cmd.substring(3), 10);
  20893. if (!isNaN(num)) {
  20894. return num;
  20895. }
  20896. }
  20897. (0, _util.error)('bad XRef entry');
  20898. }
  20899. if (this.encrypt && !suppressEncryption) {
  20900. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  20901. } else {
  20902. xrefEntry = parser.getObj();
  20903. }
  20904. if (!(0, _primitives.isStream)(xrefEntry)) {
  20905. this.cache[num] = xrefEntry;
  20906. }
  20907. return xrefEntry;
  20908. },
  20909. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  20910. var tableOffset = xrefEntry.offset;
  20911. var stream = this.fetch(new _primitives.Ref(tableOffset, 0));
  20912. if (!(0, _primitives.isStream)(stream)) {
  20913. (0, _util.error)('bad ObjStm stream');
  20914. }
  20915. var first = stream.dict.get('First');
  20916. var n = stream.dict.get('N');
  20917. if (!(0, _util.isInt)(first) || !(0, _util.isInt)(n)) {
  20918. (0, _util.error)('invalid first and n parameters for ObjStm stream');
  20919. }
  20920. var parser = new _parser.Parser(new _parser.Lexer(stream), false, this);
  20921. parser.allowStreams = true;
  20922. var i,
  20923. entries = [],
  20924. num,
  20925. nums = [];
  20926. for (i = 0; i < n; ++i) {
  20927. num = parser.getObj();
  20928. if (!(0, _util.isInt)(num)) {
  20929. (0, _util.error)('invalid object number in the ObjStm stream: ' + num);
  20930. }
  20931. nums.push(num);
  20932. var offset = parser.getObj();
  20933. if (!(0, _util.isInt)(offset)) {
  20934. (0, _util.error)('invalid object offset in the ObjStm stream: ' + offset);
  20935. }
  20936. }
  20937. for (i = 0; i < n; ++i) {
  20938. entries.push(parser.getObj());
  20939. if ((0, _primitives.isCmd)(parser.buf1, 'endobj')) {
  20940. parser.shift();
  20941. }
  20942. num = nums[i];
  20943. var entry = this.entries[num];
  20944. if (entry && entry.offset === tableOffset && entry.gen === i) {
  20945. this.cache[num] = entries[i];
  20946. }
  20947. }
  20948. xrefEntry = entries[xrefEntry.gen];
  20949. if (xrefEntry === undefined) {
  20950. (0, _util.error)('bad XRef entry for compressed object');
  20951. }
  20952. return xrefEntry;
  20953. },
  20954. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  20955. if (!(0, _primitives.isRef)(obj)) {
  20956. return Promise.resolve(obj);
  20957. }
  20958. return this.fetchAsync(obj, suppressEncryption);
  20959. },
  20960. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  20961. var streamManager = this.stream.manager;
  20962. var xref = this;
  20963. return new Promise(function tryFetch(resolve, reject) {
  20964. try {
  20965. resolve(xref.fetch(ref, suppressEncryption));
  20966. } catch (e) {
  20967. if (e instanceof _util.MissingDataException) {
  20968. streamManager.requestRange(e.begin, e.end).then(function () {
  20969. tryFetch(resolve, reject);
  20970. }, reject);
  20971. return;
  20972. }
  20973. reject(e);
  20974. }
  20975. });
  20976. },
  20977. getCatalogObj: function XRef_getCatalogObj() {
  20978. return this.root;
  20979. }
  20980. };
  20981. return XRef;
  20982. }();
  20983. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  20984. function NameOrNumberTree(root, xref) {
  20985. throw new Error('Cannot initialize NameOrNumberTree.');
  20986. }
  20987. NameOrNumberTree.prototype = {
  20988. getAll: function NameOrNumberTree_getAll() {
  20989. var dict = Object.create(null);
  20990. if (!this.root) {
  20991. return dict;
  20992. }
  20993. var xref = this.xref;
  20994. var processed = new _primitives.RefSet();
  20995. processed.put(this.root);
  20996. var queue = [this.root];
  20997. while (queue.length > 0) {
  20998. var i, n;
  20999. var obj = xref.fetchIfRef(queue.shift());
  21000. if (!(0, _primitives.isDict)(obj)) {
  21001. continue;
  21002. }
  21003. if (obj.has('Kids')) {
  21004. var kids = obj.get('Kids');
  21005. for (i = 0, n = kids.length; i < n; i++) {
  21006. var kid = kids[i];
  21007. (0, _util.assert)(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  21008. queue.push(kid);
  21009. processed.put(kid);
  21010. }
  21011. continue;
  21012. }
  21013. var entries = obj.get(this._type);
  21014. if ((0, _util.isArray)(entries)) {
  21015. for (i = 0, n = entries.length; i < n; i += 2) {
  21016. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  21017. }
  21018. }
  21019. }
  21020. return dict;
  21021. },
  21022. get: function NameOrNumberTree_get(key) {
  21023. if (!this.root) {
  21024. return null;
  21025. }
  21026. var xref = this.xref;
  21027. var kidsOrEntries = xref.fetchIfRef(this.root);
  21028. var loopCount = 0;
  21029. var MAX_LEVELS = 10;
  21030. var l, r, m;
  21031. while (kidsOrEntries.has('Kids')) {
  21032. if (++loopCount > MAX_LEVELS) {
  21033. (0, _util.warn)('Search depth limit reached for "' + this._type + '" tree.');
  21034. return null;
  21035. }
  21036. var kids = kidsOrEntries.get('Kids');
  21037. if (!(0, _util.isArray)(kids)) {
  21038. return null;
  21039. }
  21040. l = 0;
  21041. r = kids.length - 1;
  21042. while (l <= r) {
  21043. m = l + r >> 1;
  21044. var kid = xref.fetchIfRef(kids[m]);
  21045. var limits = kid.get('Limits');
  21046. if (key < xref.fetchIfRef(limits[0])) {
  21047. r = m - 1;
  21048. } else if (key > xref.fetchIfRef(limits[1])) {
  21049. l = m + 1;
  21050. } else {
  21051. kidsOrEntries = xref.fetchIfRef(kids[m]);
  21052. break;
  21053. }
  21054. }
  21055. if (l > r) {
  21056. return null;
  21057. }
  21058. }
  21059. var entries = kidsOrEntries.get(this._type);
  21060. if ((0, _util.isArray)(entries)) {
  21061. l = 0;
  21062. r = entries.length - 2;
  21063. while (l <= r) {
  21064. m = l + r & ~1;
  21065. var currentKey = xref.fetchIfRef(entries[m]);
  21066. if (key < currentKey) {
  21067. r = m - 2;
  21068. } else if (key > currentKey) {
  21069. l = m + 2;
  21070. } else {
  21071. return xref.fetchIfRef(entries[m + 1]);
  21072. }
  21073. }
  21074. }
  21075. return null;
  21076. }
  21077. };
  21078. return NameOrNumberTree;
  21079. }();
  21080. var NameTree = function NameTreeClosure() {
  21081. function NameTree(root, xref) {
  21082. this.root = root;
  21083. this.xref = xref;
  21084. this._type = 'Names';
  21085. }
  21086. _util.Util.inherit(NameTree, NameOrNumberTree, {});
  21087. return NameTree;
  21088. }();
  21089. var NumberTree = function NumberTreeClosure() {
  21090. function NumberTree(root, xref) {
  21091. this.root = root;
  21092. this.xref = xref;
  21093. this._type = 'Nums';
  21094. }
  21095. _util.Util.inherit(NumberTree, NameOrNumberTree, {});
  21096. return NumberTree;
  21097. }();
  21098. var FileSpec = function FileSpecClosure() {
  21099. function FileSpec(root, xref) {
  21100. if (!root || !(0, _primitives.isDict)(root)) {
  21101. return;
  21102. }
  21103. this.xref = xref;
  21104. this.root = root;
  21105. if (root.has('FS')) {
  21106. this.fs = root.get('FS');
  21107. }
  21108. this.description = root.has('Desc') ? (0, _util.stringToPDFString)(root.get('Desc')) : '';
  21109. if (root.has('RF')) {
  21110. (0, _util.warn)('Related file specifications are not supported');
  21111. }
  21112. this.contentAvailable = true;
  21113. if (!root.has('EF')) {
  21114. this.contentAvailable = false;
  21115. (0, _util.warn)('Non-embedded file specifications are not supported');
  21116. }
  21117. }
  21118. function pickPlatformItem(dict) {
  21119. if (dict.has('UF')) {
  21120. return dict.get('UF');
  21121. } else if (dict.has('F')) {
  21122. return dict.get('F');
  21123. } else if (dict.has('Unix')) {
  21124. return dict.get('Unix');
  21125. } else if (dict.has('Mac')) {
  21126. return dict.get('Mac');
  21127. } else if (dict.has('DOS')) {
  21128. return dict.get('DOS');
  21129. }
  21130. return null;
  21131. }
  21132. FileSpec.prototype = {
  21133. get filename() {
  21134. if (!this._filename && this.root) {
  21135. var filename = pickPlatformItem(this.root) || 'unnamed';
  21136. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  21137. }
  21138. return this._filename;
  21139. },
  21140. get content() {
  21141. if (!this.contentAvailable) {
  21142. return null;
  21143. }
  21144. if (!this.contentRef && this.root) {
  21145. this.contentRef = pickPlatformItem(this.root.get('EF'));
  21146. }
  21147. var content = null;
  21148. if (this.contentRef) {
  21149. var xref = this.xref;
  21150. var fileObj = xref.fetchIfRef(this.contentRef);
  21151. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  21152. content = fileObj.getBytes();
  21153. } else {
  21154. (0, _util.warn)('Embedded file specification points to non-existing/invalid ' + 'content');
  21155. }
  21156. } else {
  21157. (0, _util.warn)('Embedded file specification does not have a content');
  21158. }
  21159. return content;
  21160. },
  21161. get serializable() {
  21162. return {
  21163. filename: this.filename,
  21164. content: this.content
  21165. };
  21166. }
  21167. };
  21168. return FileSpec;
  21169. }();
  21170. var ObjectLoader = function () {
  21171. function mayHaveChildren(value) {
  21172. return (0, _primitives.isRef)(value) || (0, _primitives.isDict)(value) || (0, _util.isArray)(value) || (0, _primitives.isStream)(value);
  21173. }
  21174. function addChildren(node, nodesToVisit) {
  21175. var value;
  21176. if ((0, _primitives.isDict)(node) || (0, _primitives.isStream)(node)) {
  21177. var map;
  21178. if ((0, _primitives.isDict)(node)) {
  21179. map = node.map;
  21180. } else {
  21181. map = node.dict.map;
  21182. }
  21183. for (var key in map) {
  21184. value = map[key];
  21185. if (mayHaveChildren(value)) {
  21186. nodesToVisit.push(value);
  21187. }
  21188. }
  21189. } else if ((0, _util.isArray)(node)) {
  21190. for (var i = 0, ii = node.length; i < ii; i++) {
  21191. value = node[i];
  21192. if (mayHaveChildren(value)) {
  21193. nodesToVisit.push(value);
  21194. }
  21195. }
  21196. }
  21197. }
  21198. function ObjectLoader(obj, keys, xref) {
  21199. this.obj = obj;
  21200. this.keys = keys;
  21201. this.xref = xref;
  21202. this.refSet = null;
  21203. this.capability = null;
  21204. }
  21205. ObjectLoader.prototype = {
  21206. load: function ObjectLoader_load() {
  21207. var keys = this.keys;
  21208. this.capability = (0, _util.createPromiseCapability)();
  21209. if (!(this.xref.stream instanceof _chunked_stream.ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  21210. this.capability.resolve();
  21211. return this.capability.promise;
  21212. }
  21213. this.refSet = new _primitives.RefSet();
  21214. var nodesToVisit = [];
  21215. for (var i = 0; i < keys.length; i++) {
  21216. nodesToVisit.push(this.obj[keys[i]]);
  21217. }
  21218. this._walk(nodesToVisit);
  21219. return this.capability.promise;
  21220. },
  21221. _walk: function ObjectLoader_walk(nodesToVisit) {
  21222. var _this3 = this;
  21223. var nodesToRevisit = [];
  21224. var pendingRequests = [];
  21225. while (nodesToVisit.length) {
  21226. var currentNode = nodesToVisit.pop();
  21227. if ((0, _primitives.isRef)(currentNode)) {
  21228. if (this.refSet.has(currentNode)) {
  21229. continue;
  21230. }
  21231. try {
  21232. var ref = currentNode;
  21233. this.refSet.put(ref);
  21234. currentNode = this.xref.fetch(currentNode);
  21235. } catch (e) {
  21236. if (!(e instanceof _util.MissingDataException)) {
  21237. throw e;
  21238. }
  21239. nodesToRevisit.push(currentNode);
  21240. pendingRequests.push({
  21241. begin: e.begin,
  21242. end: e.end
  21243. });
  21244. }
  21245. }
  21246. if (currentNode && currentNode.getBaseStreams) {
  21247. var baseStreams = currentNode.getBaseStreams();
  21248. var foundMissingData = false;
  21249. for (var i = 0; i < baseStreams.length; i++) {
  21250. var stream = baseStreams[i];
  21251. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  21252. foundMissingData = true;
  21253. pendingRequests.push({
  21254. begin: stream.start,
  21255. end: stream.end
  21256. });
  21257. }
  21258. }
  21259. if (foundMissingData) {
  21260. nodesToRevisit.push(currentNode);
  21261. }
  21262. }
  21263. addChildren(currentNode, nodesToVisit);
  21264. }
  21265. if (pendingRequests.length) {
  21266. this.xref.stream.manager.requestRanges(pendingRequests).then(function () {
  21267. nodesToVisit = nodesToRevisit;
  21268. for (var i = 0; i < nodesToRevisit.length; i++) {
  21269. var node = nodesToRevisit[i];
  21270. if ((0, _primitives.isRef)(node)) {
  21271. _this3.refSet.remove(node);
  21272. }
  21273. }
  21274. _this3._walk(nodesToVisit);
  21275. }, this.capability.reject);
  21276. return;
  21277. }
  21278. this.refSet = null;
  21279. this.capability.resolve();
  21280. }
  21281. };
  21282. return ObjectLoader;
  21283. }();
  21284. exports.Catalog = Catalog;
  21285. exports.ObjectLoader = ObjectLoader;
  21286. exports.XRef = XRef;
  21287. exports.FileSpec = FileSpec;
  21288. /***/ }),
  21289. /* 17 */
  21290. /***/ (function(module, exports, __w_pdfjs_require__) {
  21291. "use strict";
  21292. Object.defineProperty(exports, "__esModule", {
  21293. value: true
  21294. });
  21295. exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = undefined;
  21296. var _util = __w_pdfjs_require__(0);
  21297. var getStdFontMap = (0, _util.getLookupTableFactory)(function (t) {
  21298. t['ArialNarrow'] = 'Helvetica';
  21299. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  21300. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  21301. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  21302. t['ArialBlack'] = 'Helvetica';
  21303. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  21304. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  21305. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  21306. t['Arial-Black'] = 'Helvetica';
  21307. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  21308. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  21309. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  21310. t['Arial'] = 'Helvetica';
  21311. t['Arial-Bold'] = 'Helvetica-Bold';
  21312. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  21313. t['Arial-Italic'] = 'Helvetica-Oblique';
  21314. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  21315. t['Arial-BoldMT'] = 'Helvetica-Bold';
  21316. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  21317. t['ArialMT'] = 'Helvetica';
  21318. t['Courier-Bold'] = 'Courier-Bold';
  21319. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  21320. t['Courier-Italic'] = 'Courier-Oblique';
  21321. t['CourierNew'] = 'Courier';
  21322. t['CourierNew-Bold'] = 'Courier-Bold';
  21323. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  21324. t['CourierNew-Italic'] = 'Courier-Oblique';
  21325. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  21326. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  21327. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  21328. t['CourierNewPSMT'] = 'Courier';
  21329. t['Helvetica'] = 'Helvetica';
  21330. t['Helvetica-Bold'] = 'Helvetica-Bold';
  21331. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  21332. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  21333. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  21334. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  21335. t['Symbol-Bold'] = 'Symbol';
  21336. t['Symbol-BoldItalic'] = 'Symbol';
  21337. t['Symbol-Italic'] = 'Symbol';
  21338. t['TimesNewRoman'] = 'Times-Roman';
  21339. t['TimesNewRoman-Bold'] = 'Times-Bold';
  21340. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  21341. t['TimesNewRoman-Italic'] = 'Times-Italic';
  21342. t['TimesNewRomanPS'] = 'Times-Roman';
  21343. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  21344. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  21345. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  21346. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  21347. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  21348. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  21349. t['TimesNewRomanPSMT'] = 'Times-Roman';
  21350. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  21351. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  21352. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  21353. });
  21354. var getNonStdFontMap = (0, _util.getLookupTableFactory)(function (t) {
  21355. t['CenturyGothic'] = 'Helvetica';
  21356. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  21357. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  21358. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  21359. t['ComicSansMS'] = 'Comic Sans MS';
  21360. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  21361. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  21362. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  21363. t['LucidaConsole'] = 'Courier';
  21364. t['LucidaConsole-Bold'] = 'Courier-Bold';
  21365. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  21366. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  21367. t['MS-Gothic'] = 'MS Gothic';
  21368. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  21369. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  21370. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  21371. t['MS-Mincho'] = 'MS Mincho';
  21372. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  21373. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  21374. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  21375. t['MS-PGothic'] = 'MS PGothic';
  21376. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  21377. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  21378. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  21379. t['MS-PMincho'] = 'MS PMincho';
  21380. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  21381. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  21382. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  21383. t['NuptialScript'] = 'Times-Italic';
  21384. t['Wingdings'] = 'ZapfDingbats';
  21385. });
  21386. var getSerifFonts = (0, _util.getLookupTableFactory)(function (t) {
  21387. t['Adobe Jenson'] = true;
  21388. t['Adobe Text'] = true;
  21389. t['Albertus'] = true;
  21390. t['Aldus'] = true;
  21391. t['Alexandria'] = true;
  21392. t['Algerian'] = true;
  21393. t['American Typewriter'] = true;
  21394. t['Antiqua'] = true;
  21395. t['Apex'] = true;
  21396. t['Arno'] = true;
  21397. t['Aster'] = true;
  21398. t['Aurora'] = true;
  21399. t['Baskerville'] = true;
  21400. t['Bell'] = true;
  21401. t['Bembo'] = true;
  21402. t['Bembo Schoolbook'] = true;
  21403. t['Benguiat'] = true;
  21404. t['Berkeley Old Style'] = true;
  21405. t['Bernhard Modern'] = true;
  21406. t['Berthold City'] = true;
  21407. t['Bodoni'] = true;
  21408. t['Bauer Bodoni'] = true;
  21409. t['Book Antiqua'] = true;
  21410. t['Bookman'] = true;
  21411. t['Bordeaux Roman'] = true;
  21412. t['Californian FB'] = true;
  21413. t['Calisto'] = true;
  21414. t['Calvert'] = true;
  21415. t['Capitals'] = true;
  21416. t['Cambria'] = true;
  21417. t['Cartier'] = true;
  21418. t['Caslon'] = true;
  21419. t['Catull'] = true;
  21420. t['Centaur'] = true;
  21421. t['Century Old Style'] = true;
  21422. t['Century Schoolbook'] = true;
  21423. t['Chaparral'] = true;
  21424. t['Charis SIL'] = true;
  21425. t['Cheltenham'] = true;
  21426. t['Cholla Slab'] = true;
  21427. t['Clarendon'] = true;
  21428. t['Clearface'] = true;
  21429. t['Cochin'] = true;
  21430. t['Colonna'] = true;
  21431. t['Computer Modern'] = true;
  21432. t['Concrete Roman'] = true;
  21433. t['Constantia'] = true;
  21434. t['Cooper Black'] = true;
  21435. t['Corona'] = true;
  21436. t['Ecotype'] = true;
  21437. t['Egyptienne'] = true;
  21438. t['Elephant'] = true;
  21439. t['Excelsior'] = true;
  21440. t['Fairfield'] = true;
  21441. t['FF Scala'] = true;
  21442. t['Folkard'] = true;
  21443. t['Footlight'] = true;
  21444. t['FreeSerif'] = true;
  21445. t['Friz Quadrata'] = true;
  21446. t['Garamond'] = true;
  21447. t['Gentium'] = true;
  21448. t['Georgia'] = true;
  21449. t['Gloucester'] = true;
  21450. t['Goudy Old Style'] = true;
  21451. t['Goudy Schoolbook'] = true;
  21452. t['Goudy Pro Font'] = true;
  21453. t['Granjon'] = true;
  21454. t['Guardian Egyptian'] = true;
  21455. t['Heather'] = true;
  21456. t['Hercules'] = true;
  21457. t['High Tower Text'] = true;
  21458. t['Hiroshige'] = true;
  21459. t['Hoefler Text'] = true;
  21460. t['Humana Serif'] = true;
  21461. t['Imprint'] = true;
  21462. t['Ionic No. 5'] = true;
  21463. t['Janson'] = true;
  21464. t['Joanna'] = true;
  21465. t['Korinna'] = true;
  21466. t['Lexicon'] = true;
  21467. t['Liberation Serif'] = true;
  21468. t['Linux Libertine'] = true;
  21469. t['Literaturnaya'] = true;
  21470. t['Lucida'] = true;
  21471. t['Lucida Bright'] = true;
  21472. t['Melior'] = true;
  21473. t['Memphis'] = true;
  21474. t['Miller'] = true;
  21475. t['Minion'] = true;
  21476. t['Modern'] = true;
  21477. t['Mona Lisa'] = true;
  21478. t['Mrs Eaves'] = true;
  21479. t['MS Serif'] = true;
  21480. t['Museo Slab'] = true;
  21481. t['New York'] = true;
  21482. t['Nimbus Roman'] = true;
  21483. t['NPS Rawlinson Roadway'] = true;
  21484. t['NuptialScript'] = true;
  21485. t['Palatino'] = true;
  21486. t['Perpetua'] = true;
  21487. t['Plantin'] = true;
  21488. t['Plantin Schoolbook'] = true;
  21489. t['Playbill'] = true;
  21490. t['Poor Richard'] = true;
  21491. t['Rawlinson Roadway'] = true;
  21492. t['Renault'] = true;
  21493. t['Requiem'] = true;
  21494. t['Rockwell'] = true;
  21495. t['Roman'] = true;
  21496. t['Rotis Serif'] = true;
  21497. t['Sabon'] = true;
  21498. t['Scala'] = true;
  21499. t['Seagull'] = true;
  21500. t['Sistina'] = true;
  21501. t['Souvenir'] = true;
  21502. t['STIX'] = true;
  21503. t['Stone Informal'] = true;
  21504. t['Stone Serif'] = true;
  21505. t['Sylfaen'] = true;
  21506. t['Times'] = true;
  21507. t['Trajan'] = true;
  21508. t['Trinité'] = true;
  21509. t['Trump Mediaeval'] = true;
  21510. t['Utopia'] = true;
  21511. t['Vale Type'] = true;
  21512. t['Bitstream Vera'] = true;
  21513. t['Vera Serif'] = true;
  21514. t['Versailles'] = true;
  21515. t['Wanted'] = true;
  21516. t['Weiss'] = true;
  21517. t['Wide Latin'] = true;
  21518. t['Windsor'] = true;
  21519. t['XITS'] = true;
  21520. });
  21521. var getSymbolsFonts = (0, _util.getLookupTableFactory)(function (t) {
  21522. t['Dingbats'] = true;
  21523. t['Symbol'] = true;
  21524. t['ZapfDingbats'] = true;
  21525. });
  21526. var getGlyphMapForStandardFonts = (0, _util.getLookupTableFactory)(function (t) {
  21527. t[2] = 10;
  21528. t[3] = 32;
  21529. t[4] = 33;
  21530. t[5] = 34;
  21531. t[6] = 35;
  21532. t[7] = 36;
  21533. t[8] = 37;
  21534. t[9] = 38;
  21535. t[10] = 39;
  21536. t[11] = 40;
  21537. t[12] = 41;
  21538. t[13] = 42;
  21539. t[14] = 43;
  21540. t[15] = 44;
  21541. t[16] = 45;
  21542. t[17] = 46;
  21543. t[18] = 47;
  21544. t[19] = 48;
  21545. t[20] = 49;
  21546. t[21] = 50;
  21547. t[22] = 51;
  21548. t[23] = 52;
  21549. t[24] = 53;
  21550. t[25] = 54;
  21551. t[26] = 55;
  21552. t[27] = 56;
  21553. t[28] = 57;
  21554. t[29] = 58;
  21555. t[30] = 894;
  21556. t[31] = 60;
  21557. t[32] = 61;
  21558. t[33] = 62;
  21559. t[34] = 63;
  21560. t[35] = 64;
  21561. t[36] = 65;
  21562. t[37] = 66;
  21563. t[38] = 67;
  21564. t[39] = 68;
  21565. t[40] = 69;
  21566. t[41] = 70;
  21567. t[42] = 71;
  21568. t[43] = 72;
  21569. t[44] = 73;
  21570. t[45] = 74;
  21571. t[46] = 75;
  21572. t[47] = 76;
  21573. t[48] = 77;
  21574. t[49] = 78;
  21575. t[50] = 79;
  21576. t[51] = 80;
  21577. t[52] = 81;
  21578. t[53] = 82;
  21579. t[54] = 83;
  21580. t[55] = 84;
  21581. t[56] = 85;
  21582. t[57] = 86;
  21583. t[58] = 87;
  21584. t[59] = 88;
  21585. t[60] = 89;
  21586. t[61] = 90;
  21587. t[62] = 91;
  21588. t[63] = 92;
  21589. t[64] = 93;
  21590. t[65] = 94;
  21591. t[66] = 95;
  21592. t[67] = 96;
  21593. t[68] = 97;
  21594. t[69] = 98;
  21595. t[70] = 99;
  21596. t[71] = 100;
  21597. t[72] = 101;
  21598. t[73] = 102;
  21599. t[74] = 103;
  21600. t[75] = 104;
  21601. t[76] = 105;
  21602. t[77] = 106;
  21603. t[78] = 107;
  21604. t[79] = 108;
  21605. t[80] = 109;
  21606. t[81] = 110;
  21607. t[82] = 111;
  21608. t[83] = 112;
  21609. t[84] = 113;
  21610. t[85] = 114;
  21611. t[86] = 115;
  21612. t[87] = 116;
  21613. t[88] = 117;
  21614. t[89] = 118;
  21615. t[90] = 119;
  21616. t[91] = 120;
  21617. t[92] = 121;
  21618. t[93] = 122;
  21619. t[94] = 123;
  21620. t[95] = 124;
  21621. t[96] = 125;
  21622. t[97] = 126;
  21623. t[98] = 196;
  21624. t[99] = 197;
  21625. t[100] = 199;
  21626. t[101] = 201;
  21627. t[102] = 209;
  21628. t[103] = 214;
  21629. t[104] = 220;
  21630. t[105] = 225;
  21631. t[106] = 224;
  21632. t[107] = 226;
  21633. t[108] = 228;
  21634. t[109] = 227;
  21635. t[110] = 229;
  21636. t[111] = 231;
  21637. t[112] = 233;
  21638. t[113] = 232;
  21639. t[114] = 234;
  21640. t[115] = 235;
  21641. t[116] = 237;
  21642. t[117] = 236;
  21643. t[118] = 238;
  21644. t[119] = 239;
  21645. t[120] = 241;
  21646. t[121] = 243;
  21647. t[122] = 242;
  21648. t[123] = 244;
  21649. t[124] = 246;
  21650. t[125] = 245;
  21651. t[126] = 250;
  21652. t[127] = 249;
  21653. t[128] = 251;
  21654. t[129] = 252;
  21655. t[130] = 8224;
  21656. t[131] = 176;
  21657. t[132] = 162;
  21658. t[133] = 163;
  21659. t[134] = 167;
  21660. t[135] = 8226;
  21661. t[136] = 182;
  21662. t[137] = 223;
  21663. t[138] = 174;
  21664. t[139] = 169;
  21665. t[140] = 8482;
  21666. t[141] = 180;
  21667. t[142] = 168;
  21668. t[143] = 8800;
  21669. t[144] = 198;
  21670. t[145] = 216;
  21671. t[146] = 8734;
  21672. t[147] = 177;
  21673. t[148] = 8804;
  21674. t[149] = 8805;
  21675. t[150] = 165;
  21676. t[151] = 181;
  21677. t[152] = 8706;
  21678. t[153] = 8721;
  21679. t[154] = 8719;
  21680. t[156] = 8747;
  21681. t[157] = 170;
  21682. t[158] = 186;
  21683. t[159] = 8486;
  21684. t[160] = 230;
  21685. t[161] = 248;
  21686. t[162] = 191;
  21687. t[163] = 161;
  21688. t[164] = 172;
  21689. t[165] = 8730;
  21690. t[166] = 402;
  21691. t[167] = 8776;
  21692. t[168] = 8710;
  21693. t[169] = 171;
  21694. t[170] = 187;
  21695. t[171] = 8230;
  21696. t[210] = 218;
  21697. t[223] = 711;
  21698. t[224] = 321;
  21699. t[225] = 322;
  21700. t[227] = 353;
  21701. t[229] = 382;
  21702. t[234] = 253;
  21703. t[252] = 263;
  21704. t[253] = 268;
  21705. t[254] = 269;
  21706. t[258] = 258;
  21707. t[260] = 260;
  21708. t[261] = 261;
  21709. t[265] = 280;
  21710. t[266] = 281;
  21711. t[268] = 283;
  21712. t[269] = 313;
  21713. t[275] = 323;
  21714. t[276] = 324;
  21715. t[278] = 328;
  21716. t[284] = 345;
  21717. t[285] = 346;
  21718. t[286] = 347;
  21719. t[292] = 367;
  21720. t[295] = 377;
  21721. t[296] = 378;
  21722. t[298] = 380;
  21723. t[305] = 963;
  21724. t[306] = 964;
  21725. t[307] = 966;
  21726. t[308] = 8215;
  21727. t[309] = 8252;
  21728. t[310] = 8319;
  21729. t[311] = 8359;
  21730. t[312] = 8592;
  21731. t[313] = 8593;
  21732. t[337] = 9552;
  21733. t[493] = 1039;
  21734. t[494] = 1040;
  21735. t[705] = 1524;
  21736. t[706] = 8362;
  21737. t[710] = 64288;
  21738. t[711] = 64298;
  21739. t[759] = 1617;
  21740. t[761] = 1776;
  21741. t[763] = 1778;
  21742. t[775] = 1652;
  21743. t[777] = 1764;
  21744. t[778] = 1780;
  21745. t[779] = 1781;
  21746. t[780] = 1782;
  21747. t[782] = 771;
  21748. t[783] = 64726;
  21749. t[786] = 8363;
  21750. t[788] = 8532;
  21751. t[790] = 768;
  21752. t[791] = 769;
  21753. t[792] = 768;
  21754. t[795] = 803;
  21755. t[797] = 64336;
  21756. t[798] = 64337;
  21757. t[799] = 64342;
  21758. t[800] = 64343;
  21759. t[801] = 64344;
  21760. t[802] = 64345;
  21761. t[803] = 64362;
  21762. t[804] = 64363;
  21763. t[805] = 64364;
  21764. t[2424] = 7821;
  21765. t[2425] = 7822;
  21766. t[2426] = 7823;
  21767. t[2427] = 7824;
  21768. t[2428] = 7825;
  21769. t[2429] = 7826;
  21770. t[2430] = 7827;
  21771. t[2433] = 7682;
  21772. t[2678] = 8045;
  21773. t[2679] = 8046;
  21774. t[2830] = 1552;
  21775. t[2838] = 686;
  21776. t[2840] = 751;
  21777. t[2842] = 753;
  21778. t[2843] = 754;
  21779. t[2844] = 755;
  21780. t[2846] = 757;
  21781. t[2856] = 767;
  21782. t[2857] = 848;
  21783. t[2858] = 849;
  21784. t[2862] = 853;
  21785. t[2863] = 854;
  21786. t[2864] = 855;
  21787. t[2865] = 861;
  21788. t[2866] = 862;
  21789. t[2906] = 7460;
  21790. t[2908] = 7462;
  21791. t[2909] = 7463;
  21792. t[2910] = 7464;
  21793. t[2912] = 7466;
  21794. t[2913] = 7467;
  21795. t[2914] = 7468;
  21796. t[2916] = 7470;
  21797. t[2917] = 7471;
  21798. t[2918] = 7472;
  21799. t[2920] = 7474;
  21800. t[2921] = 7475;
  21801. t[2922] = 7476;
  21802. t[2924] = 7478;
  21803. t[2925] = 7479;
  21804. t[2926] = 7480;
  21805. t[2928] = 7482;
  21806. t[2929] = 7483;
  21807. t[2930] = 7484;
  21808. t[2932] = 7486;
  21809. t[2933] = 7487;
  21810. t[2934] = 7488;
  21811. t[2936] = 7490;
  21812. t[2937] = 7491;
  21813. t[2938] = 7492;
  21814. t[2940] = 7494;
  21815. t[2941] = 7495;
  21816. t[2942] = 7496;
  21817. t[2944] = 7498;
  21818. t[2946] = 7500;
  21819. t[2948] = 7502;
  21820. t[2950] = 7504;
  21821. t[2951] = 7505;
  21822. t[2952] = 7506;
  21823. t[2954] = 7508;
  21824. t[2955] = 7509;
  21825. t[2956] = 7510;
  21826. t[2958] = 7512;
  21827. t[2959] = 7513;
  21828. t[2960] = 7514;
  21829. t[2962] = 7516;
  21830. t[2963] = 7517;
  21831. t[2964] = 7518;
  21832. t[2966] = 7520;
  21833. t[2967] = 7521;
  21834. t[2968] = 7522;
  21835. t[2970] = 7524;
  21836. t[2971] = 7525;
  21837. t[2972] = 7526;
  21838. t[2974] = 7528;
  21839. t[2975] = 7529;
  21840. t[2976] = 7530;
  21841. t[2978] = 1537;
  21842. t[2979] = 1538;
  21843. t[2980] = 1539;
  21844. t[2982] = 1549;
  21845. t[2983] = 1551;
  21846. t[2984] = 1552;
  21847. t[2986] = 1554;
  21848. t[2987] = 1555;
  21849. t[2988] = 1556;
  21850. t[2990] = 1623;
  21851. t[2991] = 1624;
  21852. t[2995] = 1775;
  21853. t[2999] = 1791;
  21854. t[3002] = 64290;
  21855. t[3003] = 64291;
  21856. t[3004] = 64292;
  21857. t[3006] = 64294;
  21858. t[3007] = 64295;
  21859. t[3008] = 64296;
  21860. t[3011] = 1900;
  21861. t[3014] = 8223;
  21862. t[3015] = 8244;
  21863. t[3017] = 7532;
  21864. t[3018] = 7533;
  21865. t[3019] = 7534;
  21866. t[3075] = 7590;
  21867. t[3076] = 7591;
  21868. t[3079] = 7594;
  21869. t[3080] = 7595;
  21870. t[3083] = 7598;
  21871. t[3084] = 7599;
  21872. t[3087] = 7602;
  21873. t[3088] = 7603;
  21874. t[3091] = 7606;
  21875. t[3092] = 7607;
  21876. t[3095] = 7610;
  21877. t[3096] = 7611;
  21878. t[3099] = 7614;
  21879. t[3100] = 7615;
  21880. t[3103] = 7618;
  21881. t[3104] = 7619;
  21882. t[3107] = 8337;
  21883. t[3108] = 8338;
  21884. t[3116] = 1884;
  21885. t[3119] = 1885;
  21886. t[3120] = 1885;
  21887. t[3123] = 1886;
  21888. t[3124] = 1886;
  21889. t[3127] = 1887;
  21890. t[3128] = 1887;
  21891. t[3131] = 1888;
  21892. t[3132] = 1888;
  21893. t[3135] = 1889;
  21894. t[3136] = 1889;
  21895. t[3139] = 1890;
  21896. t[3140] = 1890;
  21897. t[3143] = 1891;
  21898. t[3144] = 1891;
  21899. t[3147] = 1892;
  21900. t[3148] = 1892;
  21901. t[3153] = 580;
  21902. t[3154] = 581;
  21903. t[3157] = 584;
  21904. t[3158] = 585;
  21905. t[3161] = 588;
  21906. t[3162] = 589;
  21907. t[3165] = 891;
  21908. t[3166] = 892;
  21909. t[3169] = 1274;
  21910. t[3170] = 1275;
  21911. t[3173] = 1278;
  21912. t[3174] = 1279;
  21913. t[3181] = 7622;
  21914. t[3182] = 7623;
  21915. t[3282] = 11799;
  21916. t[3316] = 578;
  21917. t[3379] = 42785;
  21918. t[3393] = 1159;
  21919. t[3416] = 8377;
  21920. });
  21921. var getSupplementalGlyphMapForArialBlack = (0, _util.getLookupTableFactory)(function (t) {
  21922. t[227] = 322;
  21923. t[264] = 261;
  21924. t[291] = 346;
  21925. });
  21926. exports.getStdFontMap = getStdFontMap;
  21927. exports.getNonStdFontMap = getNonStdFontMap;
  21928. exports.getSerifFonts = getSerifFonts;
  21929. exports.getSymbolsFonts = getSymbolsFonts;
  21930. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  21931. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  21932. /***/ }),
  21933. /* 18 */
  21934. /***/ (function(module, exports, __w_pdfjs_require__) {
  21935. "use strict";
  21936. var getLookupTableFactory = __w_pdfjs_require__(0).getLookupTableFactory;
  21937. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  21938. t[63721] = 0x00A9;
  21939. t[63193] = 0x00A9;
  21940. t[63720] = 0x00AE;
  21941. t[63194] = 0x00AE;
  21942. t[63722] = 0x2122;
  21943. t[63195] = 0x2122;
  21944. t[63729] = 0x23A7;
  21945. t[63730] = 0x23A8;
  21946. t[63731] = 0x23A9;
  21947. t[63740] = 0x23AB;
  21948. t[63741] = 0x23AC;
  21949. t[63742] = 0x23AD;
  21950. t[63726] = 0x23A1;
  21951. t[63727] = 0x23A2;
  21952. t[63728] = 0x23A3;
  21953. t[63737] = 0x23A4;
  21954. t[63738] = 0x23A5;
  21955. t[63739] = 0x23A6;
  21956. t[63723] = 0x239B;
  21957. t[63724] = 0x239C;
  21958. t[63725] = 0x239D;
  21959. t[63734] = 0x239E;
  21960. t[63735] = 0x239F;
  21961. t[63736] = 0x23A0;
  21962. });
  21963. function mapSpecialUnicodeValues(code) {
  21964. if (code >= 0xFFF0 && code <= 0xFFFF) {
  21965. return 0;
  21966. } else if (code >= 0xF600 && code <= 0xF8FF) {
  21967. return getSpecialPUASymbols()[code] || code;
  21968. }
  21969. return code;
  21970. }
  21971. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  21972. var unicode = glyphsUnicodeMap[name];
  21973. if (unicode !== undefined) {
  21974. return unicode;
  21975. }
  21976. if (!name) {
  21977. return -1;
  21978. }
  21979. if (name[0] === 'u') {
  21980. var nameLen = name.length,
  21981. hexStr;
  21982. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  21983. hexStr = name.substr(3);
  21984. } else if (nameLen >= 5 && nameLen <= 7) {
  21985. hexStr = name.substr(1);
  21986. } else {
  21987. return -1;
  21988. }
  21989. if (hexStr === hexStr.toUpperCase()) {
  21990. unicode = parseInt(hexStr, 16);
  21991. if (unicode >= 0) {
  21992. return unicode;
  21993. }
  21994. }
  21995. }
  21996. return -1;
  21997. }
  21998. var UnicodeRanges = [{
  21999. 'begin': 0x0000,
  22000. 'end': 0x007F
  22001. }, {
  22002. 'begin': 0x0080,
  22003. 'end': 0x00FF
  22004. }, {
  22005. 'begin': 0x0100,
  22006. 'end': 0x017F
  22007. }, {
  22008. 'begin': 0x0180,
  22009. 'end': 0x024F
  22010. }, {
  22011. 'begin': 0x0250,
  22012. 'end': 0x02AF
  22013. }, {
  22014. 'begin': 0x02B0,
  22015. 'end': 0x02FF
  22016. }, {
  22017. 'begin': 0x0300,
  22018. 'end': 0x036F
  22019. }, {
  22020. 'begin': 0x0370,
  22021. 'end': 0x03FF
  22022. }, {
  22023. 'begin': 0x2C80,
  22024. 'end': 0x2CFF
  22025. }, {
  22026. 'begin': 0x0400,
  22027. 'end': 0x04FF
  22028. }, {
  22029. 'begin': 0x0530,
  22030. 'end': 0x058F
  22031. }, {
  22032. 'begin': 0x0590,
  22033. 'end': 0x05FF
  22034. }, {
  22035. 'begin': 0xA500,
  22036. 'end': 0xA63F
  22037. }, {
  22038. 'begin': 0x0600,
  22039. 'end': 0x06FF
  22040. }, {
  22041. 'begin': 0x07C0,
  22042. 'end': 0x07FF
  22043. }, {
  22044. 'begin': 0x0900,
  22045. 'end': 0x097F
  22046. }, {
  22047. 'begin': 0x0980,
  22048. 'end': 0x09FF
  22049. }, {
  22050. 'begin': 0x0A00,
  22051. 'end': 0x0A7F
  22052. }, {
  22053. 'begin': 0x0A80,
  22054. 'end': 0x0AFF
  22055. }, {
  22056. 'begin': 0x0B00,
  22057. 'end': 0x0B7F
  22058. }, {
  22059. 'begin': 0x0B80,
  22060. 'end': 0x0BFF
  22061. }, {
  22062. 'begin': 0x0C00,
  22063. 'end': 0x0C7F
  22064. }, {
  22065. 'begin': 0x0C80,
  22066. 'end': 0x0CFF
  22067. }, {
  22068. 'begin': 0x0D00,
  22069. 'end': 0x0D7F
  22070. }, {
  22071. 'begin': 0x0E00,
  22072. 'end': 0x0E7F
  22073. }, {
  22074. 'begin': 0x0E80,
  22075. 'end': 0x0EFF
  22076. }, {
  22077. 'begin': 0x10A0,
  22078. 'end': 0x10FF
  22079. }, {
  22080. 'begin': 0x1B00,
  22081. 'end': 0x1B7F
  22082. }, {
  22083. 'begin': 0x1100,
  22084. 'end': 0x11FF
  22085. }, {
  22086. 'begin': 0x1E00,
  22087. 'end': 0x1EFF
  22088. }, {
  22089. 'begin': 0x1F00,
  22090. 'end': 0x1FFF
  22091. }, {
  22092. 'begin': 0x2000,
  22093. 'end': 0x206F
  22094. }, {
  22095. 'begin': 0x2070,
  22096. 'end': 0x209F
  22097. }, {
  22098. 'begin': 0x20A0,
  22099. 'end': 0x20CF
  22100. }, {
  22101. 'begin': 0x20D0,
  22102. 'end': 0x20FF
  22103. }, {
  22104. 'begin': 0x2100,
  22105. 'end': 0x214F
  22106. }, {
  22107. 'begin': 0x2150,
  22108. 'end': 0x218F
  22109. }, {
  22110. 'begin': 0x2190,
  22111. 'end': 0x21FF
  22112. }, {
  22113. 'begin': 0x2200,
  22114. 'end': 0x22FF
  22115. }, {
  22116. 'begin': 0x2300,
  22117. 'end': 0x23FF
  22118. }, {
  22119. 'begin': 0x2400,
  22120. 'end': 0x243F
  22121. }, {
  22122. 'begin': 0x2440,
  22123. 'end': 0x245F
  22124. }, {
  22125. 'begin': 0x2460,
  22126. 'end': 0x24FF
  22127. }, {
  22128. 'begin': 0x2500,
  22129. 'end': 0x257F
  22130. }, {
  22131. 'begin': 0x2580,
  22132. 'end': 0x259F
  22133. }, {
  22134. 'begin': 0x25A0,
  22135. 'end': 0x25FF
  22136. }, {
  22137. 'begin': 0x2600,
  22138. 'end': 0x26FF
  22139. }, {
  22140. 'begin': 0x2700,
  22141. 'end': 0x27BF
  22142. }, {
  22143. 'begin': 0x3000,
  22144. 'end': 0x303F
  22145. }, {
  22146. 'begin': 0x3040,
  22147. 'end': 0x309F
  22148. }, {
  22149. 'begin': 0x30A0,
  22150. 'end': 0x30FF
  22151. }, {
  22152. 'begin': 0x3100,
  22153. 'end': 0x312F
  22154. }, {
  22155. 'begin': 0x3130,
  22156. 'end': 0x318F
  22157. }, {
  22158. 'begin': 0xA840,
  22159. 'end': 0xA87F
  22160. }, {
  22161. 'begin': 0x3200,
  22162. 'end': 0x32FF
  22163. }, {
  22164. 'begin': 0x3300,
  22165. 'end': 0x33FF
  22166. }, {
  22167. 'begin': 0xAC00,
  22168. 'end': 0xD7AF
  22169. }, {
  22170. 'begin': 0xD800,
  22171. 'end': 0xDFFF
  22172. }, {
  22173. 'begin': 0x10900,
  22174. 'end': 0x1091F
  22175. }, {
  22176. 'begin': 0x4E00,
  22177. 'end': 0x9FFF
  22178. }, {
  22179. 'begin': 0xE000,
  22180. 'end': 0xF8FF
  22181. }, {
  22182. 'begin': 0x31C0,
  22183. 'end': 0x31EF
  22184. }, {
  22185. 'begin': 0xFB00,
  22186. 'end': 0xFB4F
  22187. }, {
  22188. 'begin': 0xFB50,
  22189. 'end': 0xFDFF
  22190. }, {
  22191. 'begin': 0xFE20,
  22192. 'end': 0xFE2F
  22193. }, {
  22194. 'begin': 0xFE10,
  22195. 'end': 0xFE1F
  22196. }, {
  22197. 'begin': 0xFE50,
  22198. 'end': 0xFE6F
  22199. }, {
  22200. 'begin': 0xFE70,
  22201. 'end': 0xFEFF
  22202. }, {
  22203. 'begin': 0xFF00,
  22204. 'end': 0xFFEF
  22205. }, {
  22206. 'begin': 0xFFF0,
  22207. 'end': 0xFFFF
  22208. }, {
  22209. 'begin': 0x0F00,
  22210. 'end': 0x0FFF
  22211. }, {
  22212. 'begin': 0x0700,
  22213. 'end': 0x074F
  22214. }, {
  22215. 'begin': 0x0780,
  22216. 'end': 0x07BF
  22217. }, {
  22218. 'begin': 0x0D80,
  22219. 'end': 0x0DFF
  22220. }, {
  22221. 'begin': 0x1000,
  22222. 'end': 0x109F
  22223. }, {
  22224. 'begin': 0x1200,
  22225. 'end': 0x137F
  22226. }, {
  22227. 'begin': 0x13A0,
  22228. 'end': 0x13FF
  22229. }, {
  22230. 'begin': 0x1400,
  22231. 'end': 0x167F
  22232. }, {
  22233. 'begin': 0x1680,
  22234. 'end': 0x169F
  22235. }, {
  22236. 'begin': 0x16A0,
  22237. 'end': 0x16FF
  22238. }, {
  22239. 'begin': 0x1780,
  22240. 'end': 0x17FF
  22241. }, {
  22242. 'begin': 0x1800,
  22243. 'end': 0x18AF
  22244. }, {
  22245. 'begin': 0x2800,
  22246. 'end': 0x28FF
  22247. }, {
  22248. 'begin': 0xA000,
  22249. 'end': 0xA48F
  22250. }, {
  22251. 'begin': 0x1700,
  22252. 'end': 0x171F
  22253. }, {
  22254. 'begin': 0x10300,
  22255. 'end': 0x1032F
  22256. }, {
  22257. 'begin': 0x10330,
  22258. 'end': 0x1034F
  22259. }, {
  22260. 'begin': 0x10400,
  22261. 'end': 0x1044F
  22262. }, {
  22263. 'begin': 0x1D000,
  22264. 'end': 0x1D0FF
  22265. }, {
  22266. 'begin': 0x1D400,
  22267. 'end': 0x1D7FF
  22268. }, {
  22269. 'begin': 0xFF000,
  22270. 'end': 0xFFFFD
  22271. }, {
  22272. 'begin': 0xFE00,
  22273. 'end': 0xFE0F
  22274. }, {
  22275. 'begin': 0xE0000,
  22276. 'end': 0xE007F
  22277. }, {
  22278. 'begin': 0x1900,
  22279. 'end': 0x194F
  22280. }, {
  22281. 'begin': 0x1950,
  22282. 'end': 0x197F
  22283. }, {
  22284. 'begin': 0x1980,
  22285. 'end': 0x19DF
  22286. }, {
  22287. 'begin': 0x1A00,
  22288. 'end': 0x1A1F
  22289. }, {
  22290. 'begin': 0x2C00,
  22291. 'end': 0x2C5F
  22292. }, {
  22293. 'begin': 0x2D30,
  22294. 'end': 0x2D7F
  22295. }, {
  22296. 'begin': 0x4DC0,
  22297. 'end': 0x4DFF
  22298. }, {
  22299. 'begin': 0xA800,
  22300. 'end': 0xA82F
  22301. }, {
  22302. 'begin': 0x10000,
  22303. 'end': 0x1007F
  22304. }, {
  22305. 'begin': 0x10140,
  22306. 'end': 0x1018F
  22307. }, {
  22308. 'begin': 0x10380,
  22309. 'end': 0x1039F
  22310. }, {
  22311. 'begin': 0x103A0,
  22312. 'end': 0x103DF
  22313. }, {
  22314. 'begin': 0x10450,
  22315. 'end': 0x1047F
  22316. }, {
  22317. 'begin': 0x10480,
  22318. 'end': 0x104AF
  22319. }, {
  22320. 'begin': 0x10800,
  22321. 'end': 0x1083F
  22322. }, {
  22323. 'begin': 0x10A00,
  22324. 'end': 0x10A5F
  22325. }, {
  22326. 'begin': 0x1D300,
  22327. 'end': 0x1D35F
  22328. }, {
  22329. 'begin': 0x12000,
  22330. 'end': 0x123FF
  22331. }, {
  22332. 'begin': 0x1D360,
  22333. 'end': 0x1D37F
  22334. }, {
  22335. 'begin': 0x1B80,
  22336. 'end': 0x1BBF
  22337. }, {
  22338. 'begin': 0x1C00,
  22339. 'end': 0x1C4F
  22340. }, {
  22341. 'begin': 0x1C50,
  22342. 'end': 0x1C7F
  22343. }, {
  22344. 'begin': 0xA880,
  22345. 'end': 0xA8DF
  22346. }, {
  22347. 'begin': 0xA900,
  22348. 'end': 0xA92F
  22349. }, {
  22350. 'begin': 0xA930,
  22351. 'end': 0xA95F
  22352. }, {
  22353. 'begin': 0xAA00,
  22354. 'end': 0xAA5F
  22355. }, {
  22356. 'begin': 0x10190,
  22357. 'end': 0x101CF
  22358. }, {
  22359. 'begin': 0x101D0,
  22360. 'end': 0x101FF
  22361. }, {
  22362. 'begin': 0x102A0,
  22363. 'end': 0x102DF
  22364. }, {
  22365. 'begin': 0x1F030,
  22366. 'end': 0x1F09F
  22367. }];
  22368. function getUnicodeRangeFor(value) {
  22369. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  22370. var range = UnicodeRanges[i];
  22371. if (value >= range.begin && value < range.end) {
  22372. return i;
  22373. }
  22374. }
  22375. return -1;
  22376. }
  22377. function isRTLRangeFor(value) {
  22378. var range = UnicodeRanges[13];
  22379. if (value >= range.begin && value < range.end) {
  22380. return true;
  22381. }
  22382. range = UnicodeRanges[11];
  22383. if (value >= range.begin && value < range.end) {
  22384. return true;
  22385. }
  22386. return false;
  22387. }
  22388. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  22389. t['\xA8'] = ' \u0308';
  22390. t['\xAF'] = ' \u0304';
  22391. t['\xB4'] = ' \u0301';
  22392. t['\xB5'] = '\u03BC';
  22393. t['\xB8'] = ' \u0327';
  22394. t['\u0132'] = 'IJ';
  22395. t['\u0133'] = 'ij';
  22396. t['\u013F'] = 'L\xB7';
  22397. t['\u0140'] = 'l\xB7';
  22398. t['\u0149'] = '\u02BCn';
  22399. t['\u017F'] = 's';
  22400. t['\u01C4'] = 'D\u017D';
  22401. t['\u01C5'] = 'D\u017E';
  22402. t['\u01C6'] = 'd\u017E';
  22403. t['\u01C7'] = 'LJ';
  22404. t['\u01C8'] = 'Lj';
  22405. t['\u01C9'] = 'lj';
  22406. t['\u01CA'] = 'NJ';
  22407. t['\u01CB'] = 'Nj';
  22408. t['\u01CC'] = 'nj';
  22409. t['\u01F1'] = 'DZ';
  22410. t['\u01F2'] = 'Dz';
  22411. t['\u01F3'] = 'dz';
  22412. t['\u02D8'] = ' \u0306';
  22413. t['\u02D9'] = ' \u0307';
  22414. t['\u02DA'] = ' \u030A';
  22415. t['\u02DB'] = ' \u0328';
  22416. t['\u02DC'] = ' \u0303';
  22417. t['\u02DD'] = ' \u030B';
  22418. t['\u037A'] = ' \u0345';
  22419. t['\u0384'] = ' \u0301';
  22420. t['\u03D0'] = '\u03B2';
  22421. t['\u03D1'] = '\u03B8';
  22422. t['\u03D2'] = '\u03A5';
  22423. t['\u03D5'] = '\u03C6';
  22424. t['\u03D6'] = '\u03C0';
  22425. t['\u03F0'] = '\u03BA';
  22426. t['\u03F1'] = '\u03C1';
  22427. t['\u03F2'] = '\u03C2';
  22428. t['\u03F4'] = '\u0398';
  22429. t['\u03F5'] = '\u03B5';
  22430. t['\u03F9'] = '\u03A3';
  22431. t['\u0587'] = '\u0565\u0582';
  22432. t['\u0675'] = '\u0627\u0674';
  22433. t['\u0676'] = '\u0648\u0674';
  22434. t['\u0677'] = '\u06C7\u0674';
  22435. t['\u0678'] = '\u064A\u0674';
  22436. t['\u0E33'] = '\u0E4D\u0E32';
  22437. t['\u0EB3'] = '\u0ECD\u0EB2';
  22438. t['\u0EDC'] = '\u0EAB\u0E99';
  22439. t['\u0EDD'] = '\u0EAB\u0EA1';
  22440. t['\u0F77'] = '\u0FB2\u0F81';
  22441. t['\u0F79'] = '\u0FB3\u0F81';
  22442. t['\u1E9A'] = 'a\u02BE';
  22443. t['\u1FBD'] = ' \u0313';
  22444. t['\u1FBF'] = ' \u0313';
  22445. t['\u1FC0'] = ' \u0342';
  22446. t['\u1FFE'] = ' \u0314';
  22447. t['\u2002'] = ' ';
  22448. t['\u2003'] = ' ';
  22449. t['\u2004'] = ' ';
  22450. t['\u2005'] = ' ';
  22451. t['\u2006'] = ' ';
  22452. t['\u2008'] = ' ';
  22453. t['\u2009'] = ' ';
  22454. t['\u200A'] = ' ';
  22455. t['\u2017'] = ' \u0333';
  22456. t['\u2024'] = '.';
  22457. t['\u2025'] = '..';
  22458. t['\u2026'] = '...';
  22459. t['\u2033'] = '\u2032\u2032';
  22460. t['\u2034'] = '\u2032\u2032\u2032';
  22461. t['\u2036'] = '\u2035\u2035';
  22462. t['\u2037'] = '\u2035\u2035\u2035';
  22463. t['\u203C'] = '!!';
  22464. t['\u203E'] = ' \u0305';
  22465. t['\u2047'] = '??';
  22466. t['\u2048'] = '?!';
  22467. t['\u2049'] = '!?';
  22468. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  22469. t['\u205F'] = ' ';
  22470. t['\u20A8'] = 'Rs';
  22471. t['\u2100'] = 'a/c';
  22472. t['\u2101'] = 'a/s';
  22473. t['\u2103'] = '\xB0C';
  22474. t['\u2105'] = 'c/o';
  22475. t['\u2106'] = 'c/u';
  22476. t['\u2107'] = '\u0190';
  22477. t['\u2109'] = '\xB0F';
  22478. t['\u2116'] = 'No';
  22479. t['\u2121'] = 'TEL';
  22480. t['\u2135'] = '\u05D0';
  22481. t['\u2136'] = '\u05D1';
  22482. t['\u2137'] = '\u05D2';
  22483. t['\u2138'] = '\u05D3';
  22484. t['\u213B'] = 'FAX';
  22485. t['\u2160'] = 'I';
  22486. t['\u2161'] = 'II';
  22487. t['\u2162'] = 'III';
  22488. t['\u2163'] = 'IV';
  22489. t['\u2164'] = 'V';
  22490. t['\u2165'] = 'VI';
  22491. t['\u2166'] = 'VII';
  22492. t['\u2167'] = 'VIII';
  22493. t['\u2168'] = 'IX';
  22494. t['\u2169'] = 'X';
  22495. t['\u216A'] = 'XI';
  22496. t['\u216B'] = 'XII';
  22497. t['\u216C'] = 'L';
  22498. t['\u216D'] = 'C';
  22499. t['\u216E'] = 'D';
  22500. t['\u216F'] = 'M';
  22501. t['\u2170'] = 'i';
  22502. t['\u2171'] = 'ii';
  22503. t['\u2172'] = 'iii';
  22504. t['\u2173'] = 'iv';
  22505. t['\u2174'] = 'v';
  22506. t['\u2175'] = 'vi';
  22507. t['\u2176'] = 'vii';
  22508. t['\u2177'] = 'viii';
  22509. t['\u2178'] = 'ix';
  22510. t['\u2179'] = 'x';
  22511. t['\u217A'] = 'xi';
  22512. t['\u217B'] = 'xii';
  22513. t['\u217C'] = 'l';
  22514. t['\u217D'] = 'c';
  22515. t['\u217E'] = 'd';
  22516. t['\u217F'] = 'm';
  22517. t['\u222C'] = '\u222B\u222B';
  22518. t['\u222D'] = '\u222B\u222B\u222B';
  22519. t['\u222F'] = '\u222E\u222E';
  22520. t['\u2230'] = '\u222E\u222E\u222E';
  22521. t['\u2474'] = '(1)';
  22522. t['\u2475'] = '(2)';
  22523. t['\u2476'] = '(3)';
  22524. t['\u2477'] = '(4)';
  22525. t['\u2478'] = '(5)';
  22526. t['\u2479'] = '(6)';
  22527. t['\u247A'] = '(7)';
  22528. t['\u247B'] = '(8)';
  22529. t['\u247C'] = '(9)';
  22530. t['\u247D'] = '(10)';
  22531. t['\u247E'] = '(11)';
  22532. t['\u247F'] = '(12)';
  22533. t['\u2480'] = '(13)';
  22534. t['\u2481'] = '(14)';
  22535. t['\u2482'] = '(15)';
  22536. t['\u2483'] = '(16)';
  22537. t['\u2484'] = '(17)';
  22538. t['\u2485'] = '(18)';
  22539. t['\u2486'] = '(19)';
  22540. t['\u2487'] = '(20)';
  22541. t['\u2488'] = '1.';
  22542. t['\u2489'] = '2.';
  22543. t['\u248A'] = '3.';
  22544. t['\u248B'] = '4.';
  22545. t['\u248C'] = '5.';
  22546. t['\u248D'] = '6.';
  22547. t['\u248E'] = '7.';
  22548. t['\u248F'] = '8.';
  22549. t['\u2490'] = '9.';
  22550. t['\u2491'] = '10.';
  22551. t['\u2492'] = '11.';
  22552. t['\u2493'] = '12.';
  22553. t['\u2494'] = '13.';
  22554. t['\u2495'] = '14.';
  22555. t['\u2496'] = '15.';
  22556. t['\u2497'] = '16.';
  22557. t['\u2498'] = '17.';
  22558. t['\u2499'] = '18.';
  22559. t['\u249A'] = '19.';
  22560. t['\u249B'] = '20.';
  22561. t['\u249C'] = '(a)';
  22562. t['\u249D'] = '(b)';
  22563. t['\u249E'] = '(c)';
  22564. t['\u249F'] = '(d)';
  22565. t['\u24A0'] = '(e)';
  22566. t['\u24A1'] = '(f)';
  22567. t['\u24A2'] = '(g)';
  22568. t['\u24A3'] = '(h)';
  22569. t['\u24A4'] = '(i)';
  22570. t['\u24A5'] = '(j)';
  22571. t['\u24A6'] = '(k)';
  22572. t['\u24A7'] = '(l)';
  22573. t['\u24A8'] = '(m)';
  22574. t['\u24A9'] = '(n)';
  22575. t['\u24AA'] = '(o)';
  22576. t['\u24AB'] = '(p)';
  22577. t['\u24AC'] = '(q)';
  22578. t['\u24AD'] = '(r)';
  22579. t['\u24AE'] = '(s)';
  22580. t['\u24AF'] = '(t)';
  22581. t['\u24B0'] = '(u)';
  22582. t['\u24B1'] = '(v)';
  22583. t['\u24B2'] = '(w)';
  22584. t['\u24B3'] = '(x)';
  22585. t['\u24B4'] = '(y)';
  22586. t['\u24B5'] = '(z)';
  22587. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  22588. t['\u2A74'] = '::=';
  22589. t['\u2A75'] = '==';
  22590. t['\u2A76'] = '===';
  22591. t['\u2E9F'] = '\u6BCD';
  22592. t['\u2EF3'] = '\u9F9F';
  22593. t['\u2F00'] = '\u4E00';
  22594. t['\u2F01'] = '\u4E28';
  22595. t['\u2F02'] = '\u4E36';
  22596. t['\u2F03'] = '\u4E3F';
  22597. t['\u2F04'] = '\u4E59';
  22598. t['\u2F05'] = '\u4E85';
  22599. t['\u2F06'] = '\u4E8C';
  22600. t['\u2F07'] = '\u4EA0';
  22601. t['\u2F08'] = '\u4EBA';
  22602. t['\u2F09'] = '\u513F';
  22603. t['\u2F0A'] = '\u5165';
  22604. t['\u2F0B'] = '\u516B';
  22605. t['\u2F0C'] = '\u5182';
  22606. t['\u2F0D'] = '\u5196';
  22607. t['\u2F0E'] = '\u51AB';
  22608. t['\u2F0F'] = '\u51E0';
  22609. t['\u2F10'] = '\u51F5';
  22610. t['\u2F11'] = '\u5200';
  22611. t['\u2F12'] = '\u529B';
  22612. t['\u2F13'] = '\u52F9';
  22613. t['\u2F14'] = '\u5315';
  22614. t['\u2F15'] = '\u531A';
  22615. t['\u2F16'] = '\u5338';
  22616. t['\u2F17'] = '\u5341';
  22617. t['\u2F18'] = '\u535C';
  22618. t['\u2F19'] = '\u5369';
  22619. t['\u2F1A'] = '\u5382';
  22620. t['\u2F1B'] = '\u53B6';
  22621. t['\u2F1C'] = '\u53C8';
  22622. t['\u2F1D'] = '\u53E3';
  22623. t['\u2F1E'] = '\u56D7';
  22624. t['\u2F1F'] = '\u571F';
  22625. t['\u2F20'] = '\u58EB';
  22626. t['\u2F21'] = '\u5902';
  22627. t['\u2F22'] = '\u590A';
  22628. t['\u2F23'] = '\u5915';
  22629. t['\u2F24'] = '\u5927';
  22630. t['\u2F25'] = '\u5973';
  22631. t['\u2F26'] = '\u5B50';
  22632. t['\u2F27'] = '\u5B80';
  22633. t['\u2F28'] = '\u5BF8';
  22634. t['\u2F29'] = '\u5C0F';
  22635. t['\u2F2A'] = '\u5C22';
  22636. t['\u2F2B'] = '\u5C38';
  22637. t['\u2F2C'] = '\u5C6E';
  22638. t['\u2F2D'] = '\u5C71';
  22639. t['\u2F2E'] = '\u5DDB';
  22640. t['\u2F2F'] = '\u5DE5';
  22641. t['\u2F30'] = '\u5DF1';
  22642. t['\u2F31'] = '\u5DFE';
  22643. t['\u2F32'] = '\u5E72';
  22644. t['\u2F33'] = '\u5E7A';
  22645. t['\u2F34'] = '\u5E7F';
  22646. t['\u2F35'] = '\u5EF4';
  22647. t['\u2F36'] = '\u5EFE';
  22648. t['\u2F37'] = '\u5F0B';
  22649. t['\u2F38'] = '\u5F13';
  22650. t['\u2F39'] = '\u5F50';
  22651. t['\u2F3A'] = '\u5F61';
  22652. t['\u2F3B'] = '\u5F73';
  22653. t['\u2F3C'] = '\u5FC3';
  22654. t['\u2F3D'] = '\u6208';
  22655. t['\u2F3E'] = '\u6236';
  22656. t['\u2F3F'] = '\u624B';
  22657. t['\u2F40'] = '\u652F';
  22658. t['\u2F41'] = '\u6534';
  22659. t['\u2F42'] = '\u6587';
  22660. t['\u2F43'] = '\u6597';
  22661. t['\u2F44'] = '\u65A4';
  22662. t['\u2F45'] = '\u65B9';
  22663. t['\u2F46'] = '\u65E0';
  22664. t['\u2F47'] = '\u65E5';
  22665. t['\u2F48'] = '\u66F0';
  22666. t['\u2F49'] = '\u6708';
  22667. t['\u2F4A'] = '\u6728';
  22668. t['\u2F4B'] = '\u6B20';
  22669. t['\u2F4C'] = '\u6B62';
  22670. t['\u2F4D'] = '\u6B79';
  22671. t['\u2F4E'] = '\u6BB3';
  22672. t['\u2F4F'] = '\u6BCB';
  22673. t['\u2F50'] = '\u6BD4';
  22674. t['\u2F51'] = '\u6BDB';
  22675. t['\u2F52'] = '\u6C0F';
  22676. t['\u2F53'] = '\u6C14';
  22677. t['\u2F54'] = '\u6C34';
  22678. t['\u2F55'] = '\u706B';
  22679. t['\u2F56'] = '\u722A';
  22680. t['\u2F57'] = '\u7236';
  22681. t['\u2F58'] = '\u723B';
  22682. t['\u2F59'] = '\u723F';
  22683. t['\u2F5A'] = '\u7247';
  22684. t['\u2F5B'] = '\u7259';
  22685. t['\u2F5C'] = '\u725B';
  22686. t['\u2F5D'] = '\u72AC';
  22687. t['\u2F5E'] = '\u7384';
  22688. t['\u2F5F'] = '\u7389';
  22689. t['\u2F60'] = '\u74DC';
  22690. t['\u2F61'] = '\u74E6';
  22691. t['\u2F62'] = '\u7518';
  22692. t['\u2F63'] = '\u751F';
  22693. t['\u2F64'] = '\u7528';
  22694. t['\u2F65'] = '\u7530';
  22695. t['\u2F66'] = '\u758B';
  22696. t['\u2F67'] = '\u7592';
  22697. t['\u2F68'] = '\u7676';
  22698. t['\u2F69'] = '\u767D';
  22699. t['\u2F6A'] = '\u76AE';
  22700. t['\u2F6B'] = '\u76BF';
  22701. t['\u2F6C'] = '\u76EE';
  22702. t['\u2F6D'] = '\u77DB';
  22703. t['\u2F6E'] = '\u77E2';
  22704. t['\u2F6F'] = '\u77F3';
  22705. t['\u2F70'] = '\u793A';
  22706. t['\u2F71'] = '\u79B8';
  22707. t['\u2F72'] = '\u79BE';
  22708. t['\u2F73'] = '\u7A74';
  22709. t['\u2F74'] = '\u7ACB';
  22710. t['\u2F75'] = '\u7AF9';
  22711. t['\u2F76'] = '\u7C73';
  22712. t['\u2F77'] = '\u7CF8';
  22713. t['\u2F78'] = '\u7F36';
  22714. t['\u2F79'] = '\u7F51';
  22715. t['\u2F7A'] = '\u7F8A';
  22716. t['\u2F7B'] = '\u7FBD';
  22717. t['\u2F7C'] = '\u8001';
  22718. t['\u2F7D'] = '\u800C';
  22719. t['\u2F7E'] = '\u8012';
  22720. t['\u2F7F'] = '\u8033';
  22721. t['\u2F80'] = '\u807F';
  22722. t['\u2F81'] = '\u8089';
  22723. t['\u2F82'] = '\u81E3';
  22724. t['\u2F83'] = '\u81EA';
  22725. t['\u2F84'] = '\u81F3';
  22726. t['\u2F85'] = '\u81FC';
  22727. t['\u2F86'] = '\u820C';
  22728. t['\u2F87'] = '\u821B';
  22729. t['\u2F88'] = '\u821F';
  22730. t['\u2F89'] = '\u826E';
  22731. t['\u2F8A'] = '\u8272';
  22732. t['\u2F8B'] = '\u8278';
  22733. t['\u2F8C'] = '\u864D';
  22734. t['\u2F8D'] = '\u866B';
  22735. t['\u2F8E'] = '\u8840';
  22736. t['\u2F8F'] = '\u884C';
  22737. t['\u2F90'] = '\u8863';
  22738. t['\u2F91'] = '\u897E';
  22739. t['\u2F92'] = '\u898B';
  22740. t['\u2F93'] = '\u89D2';
  22741. t['\u2F94'] = '\u8A00';
  22742. t['\u2F95'] = '\u8C37';
  22743. t['\u2F96'] = '\u8C46';
  22744. t['\u2F97'] = '\u8C55';
  22745. t['\u2F98'] = '\u8C78';
  22746. t['\u2F99'] = '\u8C9D';
  22747. t['\u2F9A'] = '\u8D64';
  22748. t['\u2F9B'] = '\u8D70';
  22749. t['\u2F9C'] = '\u8DB3';
  22750. t['\u2F9D'] = '\u8EAB';
  22751. t['\u2F9E'] = '\u8ECA';
  22752. t['\u2F9F'] = '\u8F9B';
  22753. t['\u2FA0'] = '\u8FB0';
  22754. t['\u2FA1'] = '\u8FB5';
  22755. t['\u2FA2'] = '\u9091';
  22756. t['\u2FA3'] = '\u9149';
  22757. t['\u2FA4'] = '\u91C6';
  22758. t['\u2FA5'] = '\u91CC';
  22759. t['\u2FA6'] = '\u91D1';
  22760. t['\u2FA7'] = '\u9577';
  22761. t['\u2FA8'] = '\u9580';
  22762. t['\u2FA9'] = '\u961C';
  22763. t['\u2FAA'] = '\u96B6';
  22764. t['\u2FAB'] = '\u96B9';
  22765. t['\u2FAC'] = '\u96E8';
  22766. t['\u2FAD'] = '\u9751';
  22767. t['\u2FAE'] = '\u975E';
  22768. t['\u2FAF'] = '\u9762';
  22769. t['\u2FB0'] = '\u9769';
  22770. t['\u2FB1'] = '\u97CB';
  22771. t['\u2FB2'] = '\u97ED';
  22772. t['\u2FB3'] = '\u97F3';
  22773. t['\u2FB4'] = '\u9801';
  22774. t['\u2FB5'] = '\u98A8';
  22775. t['\u2FB6'] = '\u98DB';
  22776. t['\u2FB7'] = '\u98DF';
  22777. t['\u2FB8'] = '\u9996';
  22778. t['\u2FB9'] = '\u9999';
  22779. t['\u2FBA'] = '\u99AC';
  22780. t['\u2FBB'] = '\u9AA8';
  22781. t['\u2FBC'] = '\u9AD8';
  22782. t['\u2FBD'] = '\u9ADF';
  22783. t['\u2FBE'] = '\u9B25';
  22784. t['\u2FBF'] = '\u9B2F';
  22785. t['\u2FC0'] = '\u9B32';
  22786. t['\u2FC1'] = '\u9B3C';
  22787. t['\u2FC2'] = '\u9B5A';
  22788. t['\u2FC3'] = '\u9CE5';
  22789. t['\u2FC4'] = '\u9E75';
  22790. t['\u2FC5'] = '\u9E7F';
  22791. t['\u2FC6'] = '\u9EA5';
  22792. t['\u2FC7'] = '\u9EBB';
  22793. t['\u2FC8'] = '\u9EC3';
  22794. t['\u2FC9'] = '\u9ECD';
  22795. t['\u2FCA'] = '\u9ED1';
  22796. t['\u2FCB'] = '\u9EF9';
  22797. t['\u2FCC'] = '\u9EFD';
  22798. t['\u2FCD'] = '\u9F0E';
  22799. t['\u2FCE'] = '\u9F13';
  22800. t['\u2FCF'] = '\u9F20';
  22801. t['\u2FD0'] = '\u9F3B';
  22802. t['\u2FD1'] = '\u9F4A';
  22803. t['\u2FD2'] = '\u9F52';
  22804. t['\u2FD3'] = '\u9F8D';
  22805. t['\u2FD4'] = '\u9F9C';
  22806. t['\u2FD5'] = '\u9FA0';
  22807. t['\u3036'] = '\u3012';
  22808. t['\u3038'] = '\u5341';
  22809. t['\u3039'] = '\u5344';
  22810. t['\u303A'] = '\u5345';
  22811. t['\u309B'] = ' \u3099';
  22812. t['\u309C'] = ' \u309A';
  22813. t['\u3131'] = '\u1100';
  22814. t['\u3132'] = '\u1101';
  22815. t['\u3133'] = '\u11AA';
  22816. t['\u3134'] = '\u1102';
  22817. t['\u3135'] = '\u11AC';
  22818. t['\u3136'] = '\u11AD';
  22819. t['\u3137'] = '\u1103';
  22820. t['\u3138'] = '\u1104';
  22821. t['\u3139'] = '\u1105';
  22822. t['\u313A'] = '\u11B0';
  22823. t['\u313B'] = '\u11B1';
  22824. t['\u313C'] = '\u11B2';
  22825. t['\u313D'] = '\u11B3';
  22826. t['\u313E'] = '\u11B4';
  22827. t['\u313F'] = '\u11B5';
  22828. t['\u3140'] = '\u111A';
  22829. t['\u3141'] = '\u1106';
  22830. t['\u3142'] = '\u1107';
  22831. t['\u3143'] = '\u1108';
  22832. t['\u3144'] = '\u1121';
  22833. t['\u3145'] = '\u1109';
  22834. t['\u3146'] = '\u110A';
  22835. t['\u3147'] = '\u110B';
  22836. t['\u3148'] = '\u110C';
  22837. t['\u3149'] = '\u110D';
  22838. t['\u314A'] = '\u110E';
  22839. t['\u314B'] = '\u110F';
  22840. t['\u314C'] = '\u1110';
  22841. t['\u314D'] = '\u1111';
  22842. t['\u314E'] = '\u1112';
  22843. t['\u314F'] = '\u1161';
  22844. t['\u3150'] = '\u1162';
  22845. t['\u3151'] = '\u1163';
  22846. t['\u3152'] = '\u1164';
  22847. t['\u3153'] = '\u1165';
  22848. t['\u3154'] = '\u1166';
  22849. t['\u3155'] = '\u1167';
  22850. t['\u3156'] = '\u1168';
  22851. t['\u3157'] = '\u1169';
  22852. t['\u3158'] = '\u116A';
  22853. t['\u3159'] = '\u116B';
  22854. t['\u315A'] = '\u116C';
  22855. t['\u315B'] = '\u116D';
  22856. t['\u315C'] = '\u116E';
  22857. t['\u315D'] = '\u116F';
  22858. t['\u315E'] = '\u1170';
  22859. t['\u315F'] = '\u1171';
  22860. t['\u3160'] = '\u1172';
  22861. t['\u3161'] = '\u1173';
  22862. t['\u3162'] = '\u1174';
  22863. t['\u3163'] = '\u1175';
  22864. t['\u3164'] = '\u1160';
  22865. t['\u3165'] = '\u1114';
  22866. t['\u3166'] = '\u1115';
  22867. t['\u3167'] = '\u11C7';
  22868. t['\u3168'] = '\u11C8';
  22869. t['\u3169'] = '\u11CC';
  22870. t['\u316A'] = '\u11CE';
  22871. t['\u316B'] = '\u11D3';
  22872. t['\u316C'] = '\u11D7';
  22873. t['\u316D'] = '\u11D9';
  22874. t['\u316E'] = '\u111C';
  22875. t['\u316F'] = '\u11DD';
  22876. t['\u3170'] = '\u11DF';
  22877. t['\u3171'] = '\u111D';
  22878. t['\u3172'] = '\u111E';
  22879. t['\u3173'] = '\u1120';
  22880. t['\u3174'] = '\u1122';
  22881. t['\u3175'] = '\u1123';
  22882. t['\u3176'] = '\u1127';
  22883. t['\u3177'] = '\u1129';
  22884. t['\u3178'] = '\u112B';
  22885. t['\u3179'] = '\u112C';
  22886. t['\u317A'] = '\u112D';
  22887. t['\u317B'] = '\u112E';
  22888. t['\u317C'] = '\u112F';
  22889. t['\u317D'] = '\u1132';
  22890. t['\u317E'] = '\u1136';
  22891. t['\u317F'] = '\u1140';
  22892. t['\u3180'] = '\u1147';
  22893. t['\u3181'] = '\u114C';
  22894. t['\u3182'] = '\u11F1';
  22895. t['\u3183'] = '\u11F2';
  22896. t['\u3184'] = '\u1157';
  22897. t['\u3185'] = '\u1158';
  22898. t['\u3186'] = '\u1159';
  22899. t['\u3187'] = '\u1184';
  22900. t['\u3188'] = '\u1185';
  22901. t['\u3189'] = '\u1188';
  22902. t['\u318A'] = '\u1191';
  22903. t['\u318B'] = '\u1192';
  22904. t['\u318C'] = '\u1194';
  22905. t['\u318D'] = '\u119E';
  22906. t['\u318E'] = '\u11A1';
  22907. t['\u3200'] = '(\u1100)';
  22908. t['\u3201'] = '(\u1102)';
  22909. t['\u3202'] = '(\u1103)';
  22910. t['\u3203'] = '(\u1105)';
  22911. t['\u3204'] = '(\u1106)';
  22912. t['\u3205'] = '(\u1107)';
  22913. t['\u3206'] = '(\u1109)';
  22914. t['\u3207'] = '(\u110B)';
  22915. t['\u3208'] = '(\u110C)';
  22916. t['\u3209'] = '(\u110E)';
  22917. t['\u320A'] = '(\u110F)';
  22918. t['\u320B'] = '(\u1110)';
  22919. t['\u320C'] = '(\u1111)';
  22920. t['\u320D'] = '(\u1112)';
  22921. t['\u320E'] = '(\u1100\u1161)';
  22922. t['\u320F'] = '(\u1102\u1161)';
  22923. t['\u3210'] = '(\u1103\u1161)';
  22924. t['\u3211'] = '(\u1105\u1161)';
  22925. t['\u3212'] = '(\u1106\u1161)';
  22926. t['\u3213'] = '(\u1107\u1161)';
  22927. t['\u3214'] = '(\u1109\u1161)';
  22928. t['\u3215'] = '(\u110B\u1161)';
  22929. t['\u3216'] = '(\u110C\u1161)';
  22930. t['\u3217'] = '(\u110E\u1161)';
  22931. t['\u3218'] = '(\u110F\u1161)';
  22932. t['\u3219'] = '(\u1110\u1161)';
  22933. t['\u321A'] = '(\u1111\u1161)';
  22934. t['\u321B'] = '(\u1112\u1161)';
  22935. t['\u321C'] = '(\u110C\u116E)';
  22936. t['\u321D'] = '(\u110B\u1169\u110C\u1165\u11AB)';
  22937. t['\u321E'] = '(\u110B\u1169\u1112\u116E)';
  22938. t['\u3220'] = '(\u4E00)';
  22939. t['\u3221'] = '(\u4E8C)';
  22940. t['\u3222'] = '(\u4E09)';
  22941. t['\u3223'] = '(\u56DB)';
  22942. t['\u3224'] = '(\u4E94)';
  22943. t['\u3225'] = '(\u516D)';
  22944. t['\u3226'] = '(\u4E03)';
  22945. t['\u3227'] = '(\u516B)';
  22946. t['\u3228'] = '(\u4E5D)';
  22947. t['\u3229'] = '(\u5341)';
  22948. t['\u322A'] = '(\u6708)';
  22949. t['\u322B'] = '(\u706B)';
  22950. t['\u322C'] = '(\u6C34)';
  22951. t['\u322D'] = '(\u6728)';
  22952. t['\u322E'] = '(\u91D1)';
  22953. t['\u322F'] = '(\u571F)';
  22954. t['\u3230'] = '(\u65E5)';
  22955. t['\u3231'] = '(\u682A)';
  22956. t['\u3232'] = '(\u6709)';
  22957. t['\u3233'] = '(\u793E)';
  22958. t['\u3234'] = '(\u540D)';
  22959. t['\u3235'] = '(\u7279)';
  22960. t['\u3236'] = '(\u8CA1)';
  22961. t['\u3237'] = '(\u795D)';
  22962. t['\u3238'] = '(\u52B4)';
  22963. t['\u3239'] = '(\u4EE3)';
  22964. t['\u323A'] = '(\u547C)';
  22965. t['\u323B'] = '(\u5B66)';
  22966. t['\u323C'] = '(\u76E3)';
  22967. t['\u323D'] = '(\u4F01)';
  22968. t['\u323E'] = '(\u8CC7)';
  22969. t['\u323F'] = '(\u5354)';
  22970. t['\u3240'] = '(\u796D)';
  22971. t['\u3241'] = '(\u4F11)';
  22972. t['\u3242'] = '(\u81EA)';
  22973. t['\u3243'] = '(\u81F3)';
  22974. t['\u32C0'] = '1\u6708';
  22975. t['\u32C1'] = '2\u6708';
  22976. t['\u32C2'] = '3\u6708';
  22977. t['\u32C3'] = '4\u6708';
  22978. t['\u32C4'] = '5\u6708';
  22979. t['\u32C5'] = '6\u6708';
  22980. t['\u32C6'] = '7\u6708';
  22981. t['\u32C7'] = '8\u6708';
  22982. t['\u32C8'] = '9\u6708';
  22983. t['\u32C9'] = '10\u6708';
  22984. t['\u32CA'] = '11\u6708';
  22985. t['\u32CB'] = '12\u6708';
  22986. t['\u3358'] = '0\u70B9';
  22987. t['\u3359'] = '1\u70B9';
  22988. t['\u335A'] = '2\u70B9';
  22989. t['\u335B'] = '3\u70B9';
  22990. t['\u335C'] = '4\u70B9';
  22991. t['\u335D'] = '5\u70B9';
  22992. t['\u335E'] = '6\u70B9';
  22993. t['\u335F'] = '7\u70B9';
  22994. t['\u3360'] = '8\u70B9';
  22995. t['\u3361'] = '9\u70B9';
  22996. t['\u3362'] = '10\u70B9';
  22997. t['\u3363'] = '11\u70B9';
  22998. t['\u3364'] = '12\u70B9';
  22999. t['\u3365'] = '13\u70B9';
  23000. t['\u3366'] = '14\u70B9';
  23001. t['\u3367'] = '15\u70B9';
  23002. t['\u3368'] = '16\u70B9';
  23003. t['\u3369'] = '17\u70B9';
  23004. t['\u336A'] = '18\u70B9';
  23005. t['\u336B'] = '19\u70B9';
  23006. t['\u336C'] = '20\u70B9';
  23007. t['\u336D'] = '21\u70B9';
  23008. t['\u336E'] = '22\u70B9';
  23009. t['\u336F'] = '23\u70B9';
  23010. t['\u3370'] = '24\u70B9';
  23011. t['\u33E0'] = '1\u65E5';
  23012. t['\u33E1'] = '2\u65E5';
  23013. t['\u33E2'] = '3\u65E5';
  23014. t['\u33E3'] = '4\u65E5';
  23015. t['\u33E4'] = '5\u65E5';
  23016. t['\u33E5'] = '6\u65E5';
  23017. t['\u33E6'] = '7\u65E5';
  23018. t['\u33E7'] = '8\u65E5';
  23019. t['\u33E8'] = '9\u65E5';
  23020. t['\u33E9'] = '10\u65E5';
  23021. t['\u33EA'] = '11\u65E5';
  23022. t['\u33EB'] = '12\u65E5';
  23023. t['\u33EC'] = '13\u65E5';
  23024. t['\u33ED'] = '14\u65E5';
  23025. t['\u33EE'] = '15\u65E5';
  23026. t['\u33EF'] = '16\u65E5';
  23027. t['\u33F0'] = '17\u65E5';
  23028. t['\u33F1'] = '18\u65E5';
  23029. t['\u33F2'] = '19\u65E5';
  23030. t['\u33F3'] = '20\u65E5';
  23031. t['\u33F4'] = '21\u65E5';
  23032. t['\u33F5'] = '22\u65E5';
  23033. t['\u33F6'] = '23\u65E5';
  23034. t['\u33F7'] = '24\u65E5';
  23035. t['\u33F8'] = '25\u65E5';
  23036. t['\u33F9'] = '26\u65E5';
  23037. t['\u33FA'] = '27\u65E5';
  23038. t['\u33FB'] = '28\u65E5';
  23039. t['\u33FC'] = '29\u65E5';
  23040. t['\u33FD'] = '30\u65E5';
  23041. t['\u33FE'] = '31\u65E5';
  23042. t['\uFB00'] = 'ff';
  23043. t['\uFB01'] = 'fi';
  23044. t['\uFB02'] = 'fl';
  23045. t['\uFB03'] = 'ffi';
  23046. t['\uFB04'] = 'ffl';
  23047. t['\uFB05'] = '\u017Ft';
  23048. t['\uFB06'] = 'st';
  23049. t['\uFB13'] = '\u0574\u0576';
  23050. t['\uFB14'] = '\u0574\u0565';
  23051. t['\uFB15'] = '\u0574\u056B';
  23052. t['\uFB16'] = '\u057E\u0576';
  23053. t['\uFB17'] = '\u0574\u056D';
  23054. t['\uFB4F'] = '\u05D0\u05DC';
  23055. t['\uFB50'] = '\u0671';
  23056. t['\uFB51'] = '\u0671';
  23057. t['\uFB52'] = '\u067B';
  23058. t['\uFB53'] = '\u067B';
  23059. t['\uFB54'] = '\u067B';
  23060. t['\uFB55'] = '\u067B';
  23061. t['\uFB56'] = '\u067E';
  23062. t['\uFB57'] = '\u067E';
  23063. t['\uFB58'] = '\u067E';
  23064. t['\uFB59'] = '\u067E';
  23065. t['\uFB5A'] = '\u0680';
  23066. t['\uFB5B'] = '\u0680';
  23067. t['\uFB5C'] = '\u0680';
  23068. t['\uFB5D'] = '\u0680';
  23069. t['\uFB5E'] = '\u067A';
  23070. t['\uFB5F'] = '\u067A';
  23071. t['\uFB60'] = '\u067A';
  23072. t['\uFB61'] = '\u067A';
  23073. t['\uFB62'] = '\u067F';
  23074. t['\uFB63'] = '\u067F';
  23075. t['\uFB64'] = '\u067F';
  23076. t['\uFB65'] = '\u067F';
  23077. t['\uFB66'] = '\u0679';
  23078. t['\uFB67'] = '\u0679';
  23079. t['\uFB68'] = '\u0679';
  23080. t['\uFB69'] = '\u0679';
  23081. t['\uFB6A'] = '\u06A4';
  23082. t['\uFB6B'] = '\u06A4';
  23083. t['\uFB6C'] = '\u06A4';
  23084. t['\uFB6D'] = '\u06A4';
  23085. t['\uFB6E'] = '\u06A6';
  23086. t['\uFB6F'] = '\u06A6';
  23087. t['\uFB70'] = '\u06A6';
  23088. t['\uFB71'] = '\u06A6';
  23089. t['\uFB72'] = '\u0684';
  23090. t['\uFB73'] = '\u0684';
  23091. t['\uFB74'] = '\u0684';
  23092. t['\uFB75'] = '\u0684';
  23093. t['\uFB76'] = '\u0683';
  23094. t['\uFB77'] = '\u0683';
  23095. t['\uFB78'] = '\u0683';
  23096. t['\uFB79'] = '\u0683';
  23097. t['\uFB7A'] = '\u0686';
  23098. t['\uFB7B'] = '\u0686';
  23099. t['\uFB7C'] = '\u0686';
  23100. t['\uFB7D'] = '\u0686';
  23101. t['\uFB7E'] = '\u0687';
  23102. t['\uFB7F'] = '\u0687';
  23103. t['\uFB80'] = '\u0687';
  23104. t['\uFB81'] = '\u0687';
  23105. t['\uFB82'] = '\u068D';
  23106. t['\uFB83'] = '\u068D';
  23107. t['\uFB84'] = '\u068C';
  23108. t['\uFB85'] = '\u068C';
  23109. t['\uFB86'] = '\u068E';
  23110. t['\uFB87'] = '\u068E';
  23111. t['\uFB88'] = '\u0688';
  23112. t['\uFB89'] = '\u0688';
  23113. t['\uFB8A'] = '\u0698';
  23114. t['\uFB8B'] = '\u0698';
  23115. t['\uFB8C'] = '\u0691';
  23116. t['\uFB8D'] = '\u0691';
  23117. t['\uFB8E'] = '\u06A9';
  23118. t['\uFB8F'] = '\u06A9';
  23119. t['\uFB90'] = '\u06A9';
  23120. t['\uFB91'] = '\u06A9';
  23121. t['\uFB92'] = '\u06AF';
  23122. t['\uFB93'] = '\u06AF';
  23123. t['\uFB94'] = '\u06AF';
  23124. t['\uFB95'] = '\u06AF';
  23125. t['\uFB96'] = '\u06B3';
  23126. t['\uFB97'] = '\u06B3';
  23127. t['\uFB98'] = '\u06B3';
  23128. t['\uFB99'] = '\u06B3';
  23129. t['\uFB9A'] = '\u06B1';
  23130. t['\uFB9B'] = '\u06B1';
  23131. t['\uFB9C'] = '\u06B1';
  23132. t['\uFB9D'] = '\u06B1';
  23133. t['\uFB9E'] = '\u06BA';
  23134. t['\uFB9F'] = '\u06BA';
  23135. t['\uFBA0'] = '\u06BB';
  23136. t['\uFBA1'] = '\u06BB';
  23137. t['\uFBA2'] = '\u06BB';
  23138. t['\uFBA3'] = '\u06BB';
  23139. t['\uFBA4'] = '\u06C0';
  23140. t['\uFBA5'] = '\u06C0';
  23141. t['\uFBA6'] = '\u06C1';
  23142. t['\uFBA7'] = '\u06C1';
  23143. t['\uFBA8'] = '\u06C1';
  23144. t['\uFBA9'] = '\u06C1';
  23145. t['\uFBAA'] = '\u06BE';
  23146. t['\uFBAB'] = '\u06BE';
  23147. t['\uFBAC'] = '\u06BE';
  23148. t['\uFBAD'] = '\u06BE';
  23149. t['\uFBAE'] = '\u06D2';
  23150. t['\uFBAF'] = '\u06D2';
  23151. t['\uFBB0'] = '\u06D3';
  23152. t['\uFBB1'] = '\u06D3';
  23153. t['\uFBD3'] = '\u06AD';
  23154. t['\uFBD4'] = '\u06AD';
  23155. t['\uFBD5'] = '\u06AD';
  23156. t['\uFBD6'] = '\u06AD';
  23157. t['\uFBD7'] = '\u06C7';
  23158. t['\uFBD8'] = '\u06C7';
  23159. t['\uFBD9'] = '\u06C6';
  23160. t['\uFBDA'] = '\u06C6';
  23161. t['\uFBDB'] = '\u06C8';
  23162. t['\uFBDC'] = '\u06C8';
  23163. t['\uFBDD'] = '\u0677';
  23164. t['\uFBDE'] = '\u06CB';
  23165. t['\uFBDF'] = '\u06CB';
  23166. t['\uFBE0'] = '\u06C5';
  23167. t['\uFBE1'] = '\u06C5';
  23168. t['\uFBE2'] = '\u06C9';
  23169. t['\uFBE3'] = '\u06C9';
  23170. t['\uFBE4'] = '\u06D0';
  23171. t['\uFBE5'] = '\u06D0';
  23172. t['\uFBE6'] = '\u06D0';
  23173. t['\uFBE7'] = '\u06D0';
  23174. t['\uFBE8'] = '\u0649';
  23175. t['\uFBE9'] = '\u0649';
  23176. t['\uFBEA'] = '\u0626\u0627';
  23177. t['\uFBEB'] = '\u0626\u0627';
  23178. t['\uFBEC'] = '\u0626\u06D5';
  23179. t['\uFBED'] = '\u0626\u06D5';
  23180. t['\uFBEE'] = '\u0626\u0648';
  23181. t['\uFBEF'] = '\u0626\u0648';
  23182. t['\uFBF0'] = '\u0626\u06C7';
  23183. t['\uFBF1'] = '\u0626\u06C7';
  23184. t['\uFBF2'] = '\u0626\u06C6';
  23185. t['\uFBF3'] = '\u0626\u06C6';
  23186. t['\uFBF4'] = '\u0626\u06C8';
  23187. t['\uFBF5'] = '\u0626\u06C8';
  23188. t['\uFBF6'] = '\u0626\u06D0';
  23189. t['\uFBF7'] = '\u0626\u06D0';
  23190. t['\uFBF8'] = '\u0626\u06D0';
  23191. t['\uFBF9'] = '\u0626\u0649';
  23192. t['\uFBFA'] = '\u0626\u0649';
  23193. t['\uFBFB'] = '\u0626\u0649';
  23194. t['\uFBFC'] = '\u06CC';
  23195. t['\uFBFD'] = '\u06CC';
  23196. t['\uFBFE'] = '\u06CC';
  23197. t['\uFBFF'] = '\u06CC';
  23198. t['\uFC00'] = '\u0626\u062C';
  23199. t['\uFC01'] = '\u0626\u062D';
  23200. t['\uFC02'] = '\u0626\u0645';
  23201. t['\uFC03'] = '\u0626\u0649';
  23202. t['\uFC04'] = '\u0626\u064A';
  23203. t['\uFC05'] = '\u0628\u062C';
  23204. t['\uFC06'] = '\u0628\u062D';
  23205. t['\uFC07'] = '\u0628\u062E';
  23206. t['\uFC08'] = '\u0628\u0645';
  23207. t['\uFC09'] = '\u0628\u0649';
  23208. t['\uFC0A'] = '\u0628\u064A';
  23209. t['\uFC0B'] = '\u062A\u062C';
  23210. t['\uFC0C'] = '\u062A\u062D';
  23211. t['\uFC0D'] = '\u062A\u062E';
  23212. t['\uFC0E'] = '\u062A\u0645';
  23213. t['\uFC0F'] = '\u062A\u0649';
  23214. t['\uFC10'] = '\u062A\u064A';
  23215. t['\uFC11'] = '\u062B\u062C';
  23216. t['\uFC12'] = '\u062B\u0645';
  23217. t['\uFC13'] = '\u062B\u0649';
  23218. t['\uFC14'] = '\u062B\u064A';
  23219. t['\uFC15'] = '\u062C\u062D';
  23220. t['\uFC16'] = '\u062C\u0645';
  23221. t['\uFC17'] = '\u062D\u062C';
  23222. t['\uFC18'] = '\u062D\u0645';
  23223. t['\uFC19'] = '\u062E\u062C';
  23224. t['\uFC1A'] = '\u062E\u062D';
  23225. t['\uFC1B'] = '\u062E\u0645';
  23226. t['\uFC1C'] = '\u0633\u062C';
  23227. t['\uFC1D'] = '\u0633\u062D';
  23228. t['\uFC1E'] = '\u0633\u062E';
  23229. t['\uFC1F'] = '\u0633\u0645';
  23230. t['\uFC20'] = '\u0635\u062D';
  23231. t['\uFC21'] = '\u0635\u0645';
  23232. t['\uFC22'] = '\u0636\u062C';
  23233. t['\uFC23'] = '\u0636\u062D';
  23234. t['\uFC24'] = '\u0636\u062E';
  23235. t['\uFC25'] = '\u0636\u0645';
  23236. t['\uFC26'] = '\u0637\u062D';
  23237. t['\uFC27'] = '\u0637\u0645';
  23238. t['\uFC28'] = '\u0638\u0645';
  23239. t['\uFC29'] = '\u0639\u062C';
  23240. t['\uFC2A'] = '\u0639\u0645';
  23241. t['\uFC2B'] = '\u063A\u062C';
  23242. t['\uFC2C'] = '\u063A\u0645';
  23243. t['\uFC2D'] = '\u0641\u062C';
  23244. t['\uFC2E'] = '\u0641\u062D';
  23245. t['\uFC2F'] = '\u0641\u062E';
  23246. t['\uFC30'] = '\u0641\u0645';
  23247. t['\uFC31'] = '\u0641\u0649';
  23248. t['\uFC32'] = '\u0641\u064A';
  23249. t['\uFC33'] = '\u0642\u062D';
  23250. t['\uFC34'] = '\u0642\u0645';
  23251. t['\uFC35'] = '\u0642\u0649';
  23252. t['\uFC36'] = '\u0642\u064A';
  23253. t['\uFC37'] = '\u0643\u0627';
  23254. t['\uFC38'] = '\u0643\u062C';
  23255. t['\uFC39'] = '\u0643\u062D';
  23256. t['\uFC3A'] = '\u0643\u062E';
  23257. t['\uFC3B'] = '\u0643\u0644';
  23258. t['\uFC3C'] = '\u0643\u0645';
  23259. t['\uFC3D'] = '\u0643\u0649';
  23260. t['\uFC3E'] = '\u0643\u064A';
  23261. t['\uFC3F'] = '\u0644\u062C';
  23262. t['\uFC40'] = '\u0644\u062D';
  23263. t['\uFC41'] = '\u0644\u062E';
  23264. t['\uFC42'] = '\u0644\u0645';
  23265. t['\uFC43'] = '\u0644\u0649';
  23266. t['\uFC44'] = '\u0644\u064A';
  23267. t['\uFC45'] = '\u0645\u062C';
  23268. t['\uFC46'] = '\u0645\u062D';
  23269. t['\uFC47'] = '\u0645\u062E';
  23270. t['\uFC48'] = '\u0645\u0645';
  23271. t['\uFC49'] = '\u0645\u0649';
  23272. t['\uFC4A'] = '\u0645\u064A';
  23273. t['\uFC4B'] = '\u0646\u062C';
  23274. t['\uFC4C'] = '\u0646\u062D';
  23275. t['\uFC4D'] = '\u0646\u062E';
  23276. t['\uFC4E'] = '\u0646\u0645';
  23277. t['\uFC4F'] = '\u0646\u0649';
  23278. t['\uFC50'] = '\u0646\u064A';
  23279. t['\uFC51'] = '\u0647\u062C';
  23280. t['\uFC52'] = '\u0647\u0645';
  23281. t['\uFC53'] = '\u0647\u0649';
  23282. t['\uFC54'] = '\u0647\u064A';
  23283. t['\uFC55'] = '\u064A\u062C';
  23284. t['\uFC56'] = '\u064A\u062D';
  23285. t['\uFC57'] = '\u064A\u062E';
  23286. t['\uFC58'] = '\u064A\u0645';
  23287. t['\uFC59'] = '\u064A\u0649';
  23288. t['\uFC5A'] = '\u064A\u064A';
  23289. t['\uFC5B'] = '\u0630\u0670';
  23290. t['\uFC5C'] = '\u0631\u0670';
  23291. t['\uFC5D'] = '\u0649\u0670';
  23292. t['\uFC5E'] = ' \u064C\u0651';
  23293. t['\uFC5F'] = ' \u064D\u0651';
  23294. t['\uFC60'] = ' \u064E\u0651';
  23295. t['\uFC61'] = ' \u064F\u0651';
  23296. t['\uFC62'] = ' \u0650\u0651';
  23297. t['\uFC63'] = ' \u0651\u0670';
  23298. t['\uFC64'] = '\u0626\u0631';
  23299. t['\uFC65'] = '\u0626\u0632';
  23300. t['\uFC66'] = '\u0626\u0645';
  23301. t['\uFC67'] = '\u0626\u0646';
  23302. t['\uFC68'] = '\u0626\u0649';
  23303. t['\uFC69'] = '\u0626\u064A';
  23304. t['\uFC6A'] = '\u0628\u0631';
  23305. t['\uFC6B'] = '\u0628\u0632';
  23306. t['\uFC6C'] = '\u0628\u0645';
  23307. t['\uFC6D'] = '\u0628\u0646';
  23308. t['\uFC6E'] = '\u0628\u0649';
  23309. t['\uFC6F'] = '\u0628\u064A';
  23310. t['\uFC70'] = '\u062A\u0631';
  23311. t['\uFC71'] = '\u062A\u0632';
  23312. t['\uFC72'] = '\u062A\u0645';
  23313. t['\uFC73'] = '\u062A\u0646';
  23314. t['\uFC74'] = '\u062A\u0649';
  23315. t['\uFC75'] = '\u062A\u064A';
  23316. t['\uFC76'] = '\u062B\u0631';
  23317. t['\uFC77'] = '\u062B\u0632';
  23318. t['\uFC78'] = '\u062B\u0645';
  23319. t['\uFC79'] = '\u062B\u0646';
  23320. t['\uFC7A'] = '\u062B\u0649';
  23321. t['\uFC7B'] = '\u062B\u064A';
  23322. t['\uFC7C'] = '\u0641\u0649';
  23323. t['\uFC7D'] = '\u0641\u064A';
  23324. t['\uFC7E'] = '\u0642\u0649';
  23325. t['\uFC7F'] = '\u0642\u064A';
  23326. t['\uFC80'] = '\u0643\u0627';
  23327. t['\uFC81'] = '\u0643\u0644';
  23328. t['\uFC82'] = '\u0643\u0645';
  23329. t['\uFC83'] = '\u0643\u0649';
  23330. t['\uFC84'] = '\u0643\u064A';
  23331. t['\uFC85'] = '\u0644\u0645';
  23332. t['\uFC86'] = '\u0644\u0649';
  23333. t['\uFC87'] = '\u0644\u064A';
  23334. t['\uFC88'] = '\u0645\u0627';
  23335. t['\uFC89'] = '\u0645\u0645';
  23336. t['\uFC8A'] = '\u0646\u0631';
  23337. t['\uFC8B'] = '\u0646\u0632';
  23338. t['\uFC8C'] = '\u0646\u0645';
  23339. t['\uFC8D'] = '\u0646\u0646';
  23340. t['\uFC8E'] = '\u0646\u0649';
  23341. t['\uFC8F'] = '\u0646\u064A';
  23342. t['\uFC90'] = '\u0649\u0670';
  23343. t['\uFC91'] = '\u064A\u0631';
  23344. t['\uFC92'] = '\u064A\u0632';
  23345. t['\uFC93'] = '\u064A\u0645';
  23346. t['\uFC94'] = '\u064A\u0646';
  23347. t['\uFC95'] = '\u064A\u0649';
  23348. t['\uFC96'] = '\u064A\u064A';
  23349. t['\uFC97'] = '\u0626\u062C';
  23350. t['\uFC98'] = '\u0626\u062D';
  23351. t['\uFC99'] = '\u0626\u062E';
  23352. t['\uFC9A'] = '\u0626\u0645';
  23353. t['\uFC9B'] = '\u0626\u0647';
  23354. t['\uFC9C'] = '\u0628\u062C';
  23355. t['\uFC9D'] = '\u0628\u062D';
  23356. t['\uFC9E'] = '\u0628\u062E';
  23357. t['\uFC9F'] = '\u0628\u0645';
  23358. t['\uFCA0'] = '\u0628\u0647';
  23359. t['\uFCA1'] = '\u062A\u062C';
  23360. t['\uFCA2'] = '\u062A\u062D';
  23361. t['\uFCA3'] = '\u062A\u062E';
  23362. t['\uFCA4'] = '\u062A\u0645';
  23363. t['\uFCA5'] = '\u062A\u0647';
  23364. t['\uFCA6'] = '\u062B\u0645';
  23365. t['\uFCA7'] = '\u062C\u062D';
  23366. t['\uFCA8'] = '\u062C\u0645';
  23367. t['\uFCA9'] = '\u062D\u062C';
  23368. t['\uFCAA'] = '\u062D\u0645';
  23369. t['\uFCAB'] = '\u062E\u062C';
  23370. t['\uFCAC'] = '\u062E\u0645';
  23371. t['\uFCAD'] = '\u0633\u062C';
  23372. t['\uFCAE'] = '\u0633\u062D';
  23373. t['\uFCAF'] = '\u0633\u062E';
  23374. t['\uFCB0'] = '\u0633\u0645';
  23375. t['\uFCB1'] = '\u0635\u062D';
  23376. t['\uFCB2'] = '\u0635\u062E';
  23377. t['\uFCB3'] = '\u0635\u0645';
  23378. t['\uFCB4'] = '\u0636\u062C';
  23379. t['\uFCB5'] = '\u0636\u062D';
  23380. t['\uFCB6'] = '\u0636\u062E';
  23381. t['\uFCB7'] = '\u0636\u0645';
  23382. t['\uFCB8'] = '\u0637\u062D';
  23383. t['\uFCB9'] = '\u0638\u0645';
  23384. t['\uFCBA'] = '\u0639\u062C';
  23385. t['\uFCBB'] = '\u0639\u0645';
  23386. t['\uFCBC'] = '\u063A\u062C';
  23387. t['\uFCBD'] = '\u063A\u0645';
  23388. t['\uFCBE'] = '\u0641\u062C';
  23389. t['\uFCBF'] = '\u0641\u062D';
  23390. t['\uFCC0'] = '\u0641\u062E';
  23391. t['\uFCC1'] = '\u0641\u0645';
  23392. t['\uFCC2'] = '\u0642\u062D';
  23393. t['\uFCC3'] = '\u0642\u0645';
  23394. t['\uFCC4'] = '\u0643\u062C';
  23395. t['\uFCC5'] = '\u0643\u062D';
  23396. t['\uFCC6'] = '\u0643\u062E';
  23397. t['\uFCC7'] = '\u0643\u0644';
  23398. t['\uFCC8'] = '\u0643\u0645';
  23399. t['\uFCC9'] = '\u0644\u062C';
  23400. t['\uFCCA'] = '\u0644\u062D';
  23401. t['\uFCCB'] = '\u0644\u062E';
  23402. t['\uFCCC'] = '\u0644\u0645';
  23403. t['\uFCCD'] = '\u0644\u0647';
  23404. t['\uFCCE'] = '\u0645\u062C';
  23405. t['\uFCCF'] = '\u0645\u062D';
  23406. t['\uFCD0'] = '\u0645\u062E';
  23407. t['\uFCD1'] = '\u0645\u0645';
  23408. t['\uFCD2'] = '\u0646\u062C';
  23409. t['\uFCD3'] = '\u0646\u062D';
  23410. t['\uFCD4'] = '\u0646\u062E';
  23411. t['\uFCD5'] = '\u0646\u0645';
  23412. t['\uFCD6'] = '\u0646\u0647';
  23413. t['\uFCD7'] = '\u0647\u062C';
  23414. t['\uFCD8'] = '\u0647\u0645';
  23415. t['\uFCD9'] = '\u0647\u0670';
  23416. t['\uFCDA'] = '\u064A\u062C';
  23417. t['\uFCDB'] = '\u064A\u062D';
  23418. t['\uFCDC'] = '\u064A\u062E';
  23419. t['\uFCDD'] = '\u064A\u0645';
  23420. t['\uFCDE'] = '\u064A\u0647';
  23421. t['\uFCDF'] = '\u0626\u0645';
  23422. t['\uFCE0'] = '\u0626\u0647';
  23423. t['\uFCE1'] = '\u0628\u0645';
  23424. t['\uFCE2'] = '\u0628\u0647';
  23425. t['\uFCE3'] = '\u062A\u0645';
  23426. t['\uFCE4'] = '\u062A\u0647';
  23427. t['\uFCE5'] = '\u062B\u0645';
  23428. t['\uFCE6'] = '\u062B\u0647';
  23429. t['\uFCE7'] = '\u0633\u0645';
  23430. t['\uFCE8'] = '\u0633\u0647';
  23431. t['\uFCE9'] = '\u0634\u0645';
  23432. t['\uFCEA'] = '\u0634\u0647';
  23433. t['\uFCEB'] = '\u0643\u0644';
  23434. t['\uFCEC'] = '\u0643\u0645';
  23435. t['\uFCED'] = '\u0644\u0645';
  23436. t['\uFCEE'] = '\u0646\u0645';
  23437. t['\uFCEF'] = '\u0646\u0647';
  23438. t['\uFCF0'] = '\u064A\u0645';
  23439. t['\uFCF1'] = '\u064A\u0647';
  23440. t['\uFCF2'] = '\u0640\u064E\u0651';
  23441. t['\uFCF3'] = '\u0640\u064F\u0651';
  23442. t['\uFCF4'] = '\u0640\u0650\u0651';
  23443. t['\uFCF5'] = '\u0637\u0649';
  23444. t['\uFCF6'] = '\u0637\u064A';
  23445. t['\uFCF7'] = '\u0639\u0649';
  23446. t['\uFCF8'] = '\u0639\u064A';
  23447. t['\uFCF9'] = '\u063A\u0649';
  23448. t['\uFCFA'] = '\u063A\u064A';
  23449. t['\uFCFB'] = '\u0633\u0649';
  23450. t['\uFCFC'] = '\u0633\u064A';
  23451. t['\uFCFD'] = '\u0634\u0649';
  23452. t['\uFCFE'] = '\u0634\u064A';
  23453. t['\uFCFF'] = '\u062D\u0649';
  23454. t['\uFD00'] = '\u062D\u064A';
  23455. t['\uFD01'] = '\u062C\u0649';
  23456. t['\uFD02'] = '\u062C\u064A';
  23457. t['\uFD03'] = '\u062E\u0649';
  23458. t['\uFD04'] = '\u062E\u064A';
  23459. t['\uFD05'] = '\u0635\u0649';
  23460. t['\uFD06'] = '\u0635\u064A';
  23461. t['\uFD07'] = '\u0636\u0649';
  23462. t['\uFD08'] = '\u0636\u064A';
  23463. t['\uFD09'] = '\u0634\u062C';
  23464. t['\uFD0A'] = '\u0634\u062D';
  23465. t['\uFD0B'] = '\u0634\u062E';
  23466. t['\uFD0C'] = '\u0634\u0645';
  23467. t['\uFD0D'] = '\u0634\u0631';
  23468. t['\uFD0E'] = '\u0633\u0631';
  23469. t['\uFD0F'] = '\u0635\u0631';
  23470. t['\uFD10'] = '\u0636\u0631';
  23471. t['\uFD11'] = '\u0637\u0649';
  23472. t['\uFD12'] = '\u0637\u064A';
  23473. t['\uFD13'] = '\u0639\u0649';
  23474. t['\uFD14'] = '\u0639\u064A';
  23475. t['\uFD15'] = '\u063A\u0649';
  23476. t['\uFD16'] = '\u063A\u064A';
  23477. t['\uFD17'] = '\u0633\u0649';
  23478. t['\uFD18'] = '\u0633\u064A';
  23479. t['\uFD19'] = '\u0634\u0649';
  23480. t['\uFD1A'] = '\u0634\u064A';
  23481. t['\uFD1B'] = '\u062D\u0649';
  23482. t['\uFD1C'] = '\u062D\u064A';
  23483. t['\uFD1D'] = '\u062C\u0649';
  23484. t['\uFD1E'] = '\u062C\u064A';
  23485. t['\uFD1F'] = '\u062E\u0649';
  23486. t['\uFD20'] = '\u062E\u064A';
  23487. t['\uFD21'] = '\u0635\u0649';
  23488. t['\uFD22'] = '\u0635\u064A';
  23489. t['\uFD23'] = '\u0636\u0649';
  23490. t['\uFD24'] = '\u0636\u064A';
  23491. t['\uFD25'] = '\u0634\u062C';
  23492. t['\uFD26'] = '\u0634\u062D';
  23493. t['\uFD27'] = '\u0634\u062E';
  23494. t['\uFD28'] = '\u0634\u0645';
  23495. t['\uFD29'] = '\u0634\u0631';
  23496. t['\uFD2A'] = '\u0633\u0631';
  23497. t['\uFD2B'] = '\u0635\u0631';
  23498. t['\uFD2C'] = '\u0636\u0631';
  23499. t['\uFD2D'] = '\u0634\u062C';
  23500. t['\uFD2E'] = '\u0634\u062D';
  23501. t['\uFD2F'] = '\u0634\u062E';
  23502. t['\uFD30'] = '\u0634\u0645';
  23503. t['\uFD31'] = '\u0633\u0647';
  23504. t['\uFD32'] = '\u0634\u0647';
  23505. t['\uFD33'] = '\u0637\u0645';
  23506. t['\uFD34'] = '\u0633\u062C';
  23507. t['\uFD35'] = '\u0633\u062D';
  23508. t['\uFD36'] = '\u0633\u062E';
  23509. t['\uFD37'] = '\u0634\u062C';
  23510. t['\uFD38'] = '\u0634\u062D';
  23511. t['\uFD39'] = '\u0634\u062E';
  23512. t['\uFD3A'] = '\u0637\u0645';
  23513. t['\uFD3B'] = '\u0638\u0645';
  23514. t['\uFD3C'] = '\u0627\u064B';
  23515. t['\uFD3D'] = '\u0627\u064B';
  23516. t['\uFD50'] = '\u062A\u062C\u0645';
  23517. t['\uFD51'] = '\u062A\u062D\u062C';
  23518. t['\uFD52'] = '\u062A\u062D\u062C';
  23519. t['\uFD53'] = '\u062A\u062D\u0645';
  23520. t['\uFD54'] = '\u062A\u062E\u0645';
  23521. t['\uFD55'] = '\u062A\u0645\u062C';
  23522. t['\uFD56'] = '\u062A\u0645\u062D';
  23523. t['\uFD57'] = '\u062A\u0645\u062E';
  23524. t['\uFD58'] = '\u062C\u0645\u062D';
  23525. t['\uFD59'] = '\u062C\u0645\u062D';
  23526. t['\uFD5A'] = '\u062D\u0645\u064A';
  23527. t['\uFD5B'] = '\u062D\u0645\u0649';
  23528. t['\uFD5C'] = '\u0633\u062D\u062C';
  23529. t['\uFD5D'] = '\u0633\u062C\u062D';
  23530. t['\uFD5E'] = '\u0633\u062C\u0649';
  23531. t['\uFD5F'] = '\u0633\u0645\u062D';
  23532. t['\uFD60'] = '\u0633\u0645\u062D';
  23533. t['\uFD61'] = '\u0633\u0645\u062C';
  23534. t['\uFD62'] = '\u0633\u0645\u0645';
  23535. t['\uFD63'] = '\u0633\u0645\u0645';
  23536. t['\uFD64'] = '\u0635\u062D\u062D';
  23537. t['\uFD65'] = '\u0635\u062D\u062D';
  23538. t['\uFD66'] = '\u0635\u0645\u0645';
  23539. t['\uFD67'] = '\u0634\u062D\u0645';
  23540. t['\uFD68'] = '\u0634\u062D\u0645';
  23541. t['\uFD69'] = '\u0634\u062C\u064A';
  23542. t['\uFD6A'] = '\u0634\u0645\u062E';
  23543. t['\uFD6B'] = '\u0634\u0645\u062E';
  23544. t['\uFD6C'] = '\u0634\u0645\u0645';
  23545. t['\uFD6D'] = '\u0634\u0645\u0645';
  23546. t['\uFD6E'] = '\u0636\u062D\u0649';
  23547. t['\uFD6F'] = '\u0636\u062E\u0645';
  23548. t['\uFD70'] = '\u0636\u062E\u0645';
  23549. t['\uFD71'] = '\u0637\u0645\u062D';
  23550. t['\uFD72'] = '\u0637\u0645\u062D';
  23551. t['\uFD73'] = '\u0637\u0645\u0645';
  23552. t['\uFD74'] = '\u0637\u0645\u064A';
  23553. t['\uFD75'] = '\u0639\u062C\u0645';
  23554. t['\uFD76'] = '\u0639\u0645\u0645';
  23555. t['\uFD77'] = '\u0639\u0645\u0645';
  23556. t['\uFD78'] = '\u0639\u0645\u0649';
  23557. t['\uFD79'] = '\u063A\u0645\u0645';
  23558. t['\uFD7A'] = '\u063A\u0645\u064A';
  23559. t['\uFD7B'] = '\u063A\u0645\u0649';
  23560. t['\uFD7C'] = '\u0641\u062E\u0645';
  23561. t['\uFD7D'] = '\u0641\u062E\u0645';
  23562. t['\uFD7E'] = '\u0642\u0645\u062D';
  23563. t['\uFD7F'] = '\u0642\u0645\u0645';
  23564. t['\uFD80'] = '\u0644\u062D\u0645';
  23565. t['\uFD81'] = '\u0644\u062D\u064A';
  23566. t['\uFD82'] = '\u0644\u062D\u0649';
  23567. t['\uFD83'] = '\u0644\u062C\u062C';
  23568. t['\uFD84'] = '\u0644\u062C\u062C';
  23569. t['\uFD85'] = '\u0644\u062E\u0645';
  23570. t['\uFD86'] = '\u0644\u062E\u0645';
  23571. t['\uFD87'] = '\u0644\u0645\u062D';
  23572. t['\uFD88'] = '\u0644\u0645\u062D';
  23573. t['\uFD89'] = '\u0645\u062D\u062C';
  23574. t['\uFD8A'] = '\u0645\u062D\u0645';
  23575. t['\uFD8B'] = '\u0645\u062D\u064A';
  23576. t['\uFD8C'] = '\u0645\u062C\u062D';
  23577. t['\uFD8D'] = '\u0645\u062C\u0645';
  23578. t['\uFD8E'] = '\u0645\u062E\u062C';
  23579. t['\uFD8F'] = '\u0645\u062E\u0645';
  23580. t['\uFD92'] = '\u0645\u062C\u062E';
  23581. t['\uFD93'] = '\u0647\u0645\u062C';
  23582. t['\uFD94'] = '\u0647\u0645\u0645';
  23583. t['\uFD95'] = '\u0646\u062D\u0645';
  23584. t['\uFD96'] = '\u0646\u062D\u0649';
  23585. t['\uFD97'] = '\u0646\u062C\u0645';
  23586. t['\uFD98'] = '\u0646\u062C\u0645';
  23587. t['\uFD99'] = '\u0646\u062C\u0649';
  23588. t['\uFD9A'] = '\u0646\u0645\u064A';
  23589. t['\uFD9B'] = '\u0646\u0645\u0649';
  23590. t['\uFD9C'] = '\u064A\u0645\u0645';
  23591. t['\uFD9D'] = '\u064A\u0645\u0645';
  23592. t['\uFD9E'] = '\u0628\u062E\u064A';
  23593. t['\uFD9F'] = '\u062A\u062C\u064A';
  23594. t['\uFDA0'] = '\u062A\u062C\u0649';
  23595. t['\uFDA1'] = '\u062A\u062E\u064A';
  23596. t['\uFDA2'] = '\u062A\u062E\u0649';
  23597. t['\uFDA3'] = '\u062A\u0645\u064A';
  23598. t['\uFDA4'] = '\u062A\u0645\u0649';
  23599. t['\uFDA5'] = '\u062C\u0645\u064A';
  23600. t['\uFDA6'] = '\u062C\u062D\u0649';
  23601. t['\uFDA7'] = '\u062C\u0645\u0649';
  23602. t['\uFDA8'] = '\u0633\u062E\u0649';
  23603. t['\uFDA9'] = '\u0635\u062D\u064A';
  23604. t['\uFDAA'] = '\u0634\u062D\u064A';
  23605. t['\uFDAB'] = '\u0636\u062D\u064A';
  23606. t['\uFDAC'] = '\u0644\u062C\u064A';
  23607. t['\uFDAD'] = '\u0644\u0645\u064A';
  23608. t['\uFDAE'] = '\u064A\u062D\u064A';
  23609. t['\uFDAF'] = '\u064A\u062C\u064A';
  23610. t['\uFDB0'] = '\u064A\u0645\u064A';
  23611. t['\uFDB1'] = '\u0645\u0645\u064A';
  23612. t['\uFDB2'] = '\u0642\u0645\u064A';
  23613. t['\uFDB3'] = '\u0646\u062D\u064A';
  23614. t['\uFDB4'] = '\u0642\u0645\u062D';
  23615. t['\uFDB5'] = '\u0644\u062D\u0645';
  23616. t['\uFDB6'] = '\u0639\u0645\u064A';
  23617. t['\uFDB7'] = '\u0643\u0645\u064A';
  23618. t['\uFDB8'] = '\u0646\u062C\u062D';
  23619. t['\uFDB9'] = '\u0645\u062E\u064A';
  23620. t['\uFDBA'] = '\u0644\u062C\u0645';
  23621. t['\uFDBB'] = '\u0643\u0645\u0645';
  23622. t['\uFDBC'] = '\u0644\u062C\u0645';
  23623. t['\uFDBD'] = '\u0646\u062C\u062D';
  23624. t['\uFDBE'] = '\u062C\u062D\u064A';
  23625. t['\uFDBF'] = '\u062D\u062C\u064A';
  23626. t['\uFDC0'] = '\u0645\u062C\u064A';
  23627. t['\uFDC1'] = '\u0641\u0645\u064A';
  23628. t['\uFDC2'] = '\u0628\u062D\u064A';
  23629. t['\uFDC3'] = '\u0643\u0645\u0645';
  23630. t['\uFDC4'] = '\u0639\u062C\u0645';
  23631. t['\uFDC5'] = '\u0635\u0645\u0645';
  23632. t['\uFDC6'] = '\u0633\u062E\u064A';
  23633. t['\uFDC7'] = '\u0646\u062C\u064A';
  23634. t['\uFE49'] = '\u203E';
  23635. t['\uFE4A'] = '\u203E';
  23636. t['\uFE4B'] = '\u203E';
  23637. t['\uFE4C'] = '\u203E';
  23638. t['\uFE4D'] = '_';
  23639. t['\uFE4E'] = '_';
  23640. t['\uFE4F'] = '_';
  23641. t['\uFE80'] = '\u0621';
  23642. t['\uFE81'] = '\u0622';
  23643. t['\uFE82'] = '\u0622';
  23644. t['\uFE83'] = '\u0623';
  23645. t['\uFE84'] = '\u0623';
  23646. t['\uFE85'] = '\u0624';
  23647. t['\uFE86'] = '\u0624';
  23648. t['\uFE87'] = '\u0625';
  23649. t['\uFE88'] = '\u0625';
  23650. t['\uFE89'] = '\u0626';
  23651. t['\uFE8A'] = '\u0626';
  23652. t['\uFE8B'] = '\u0626';
  23653. t['\uFE8C'] = '\u0626';
  23654. t['\uFE8D'] = '\u0627';
  23655. t['\uFE8E'] = '\u0627';
  23656. t['\uFE8F'] = '\u0628';
  23657. t['\uFE90'] = '\u0628';
  23658. t['\uFE91'] = '\u0628';
  23659. t['\uFE92'] = '\u0628';
  23660. t['\uFE93'] = '\u0629';
  23661. t['\uFE94'] = '\u0629';
  23662. t['\uFE95'] = '\u062A';
  23663. t['\uFE96'] = '\u062A';
  23664. t['\uFE97'] = '\u062A';
  23665. t['\uFE98'] = '\u062A';
  23666. t['\uFE99'] = '\u062B';
  23667. t['\uFE9A'] = '\u062B';
  23668. t['\uFE9B'] = '\u062B';
  23669. t['\uFE9C'] = '\u062B';
  23670. t['\uFE9D'] = '\u062C';
  23671. t['\uFE9E'] = '\u062C';
  23672. t['\uFE9F'] = '\u062C';
  23673. t['\uFEA0'] = '\u062C';
  23674. t['\uFEA1'] = '\u062D';
  23675. t['\uFEA2'] = '\u062D';
  23676. t['\uFEA3'] = '\u062D';
  23677. t['\uFEA4'] = '\u062D';
  23678. t['\uFEA5'] = '\u062E';
  23679. t['\uFEA6'] = '\u062E';
  23680. t['\uFEA7'] = '\u062E';
  23681. t['\uFEA8'] = '\u062E';
  23682. t['\uFEA9'] = '\u062F';
  23683. t['\uFEAA'] = '\u062F';
  23684. t['\uFEAB'] = '\u0630';
  23685. t['\uFEAC'] = '\u0630';
  23686. t['\uFEAD'] = '\u0631';
  23687. t['\uFEAE'] = '\u0631';
  23688. t['\uFEAF'] = '\u0632';
  23689. t['\uFEB0'] = '\u0632';
  23690. t['\uFEB1'] = '\u0633';
  23691. t['\uFEB2'] = '\u0633';
  23692. t['\uFEB3'] = '\u0633';
  23693. t['\uFEB4'] = '\u0633';
  23694. t['\uFEB5'] = '\u0634';
  23695. t['\uFEB6'] = '\u0634';
  23696. t['\uFEB7'] = '\u0634';
  23697. t['\uFEB8'] = '\u0634';
  23698. t['\uFEB9'] = '\u0635';
  23699. t['\uFEBA'] = '\u0635';
  23700. t['\uFEBB'] = '\u0635';
  23701. t['\uFEBC'] = '\u0635';
  23702. t['\uFEBD'] = '\u0636';
  23703. t['\uFEBE'] = '\u0636';
  23704. t['\uFEBF'] = '\u0636';
  23705. t['\uFEC0'] = '\u0636';
  23706. t['\uFEC1'] = '\u0637';
  23707. t['\uFEC2'] = '\u0637';
  23708. t['\uFEC3'] = '\u0637';
  23709. t['\uFEC4'] = '\u0637';
  23710. t['\uFEC5'] = '\u0638';
  23711. t['\uFEC6'] = '\u0638';
  23712. t['\uFEC7'] = '\u0638';
  23713. t['\uFEC8'] = '\u0638';
  23714. t['\uFEC9'] = '\u0639';
  23715. t['\uFECA'] = '\u0639';
  23716. t['\uFECB'] = '\u0639';
  23717. t['\uFECC'] = '\u0639';
  23718. t['\uFECD'] = '\u063A';
  23719. t['\uFECE'] = '\u063A';
  23720. t['\uFECF'] = '\u063A';
  23721. t['\uFED0'] = '\u063A';
  23722. t['\uFED1'] = '\u0641';
  23723. t['\uFED2'] = '\u0641';
  23724. t['\uFED3'] = '\u0641';
  23725. t['\uFED4'] = '\u0641';
  23726. t['\uFED5'] = '\u0642';
  23727. t['\uFED6'] = '\u0642';
  23728. t['\uFED7'] = '\u0642';
  23729. t['\uFED8'] = '\u0642';
  23730. t['\uFED9'] = '\u0643';
  23731. t['\uFEDA'] = '\u0643';
  23732. t['\uFEDB'] = '\u0643';
  23733. t['\uFEDC'] = '\u0643';
  23734. t['\uFEDD'] = '\u0644';
  23735. t['\uFEDE'] = '\u0644';
  23736. t['\uFEDF'] = '\u0644';
  23737. t['\uFEE0'] = '\u0644';
  23738. t['\uFEE1'] = '\u0645';
  23739. t['\uFEE2'] = '\u0645';
  23740. t['\uFEE3'] = '\u0645';
  23741. t['\uFEE4'] = '\u0645';
  23742. t['\uFEE5'] = '\u0646';
  23743. t['\uFEE6'] = '\u0646';
  23744. t['\uFEE7'] = '\u0646';
  23745. t['\uFEE8'] = '\u0646';
  23746. t['\uFEE9'] = '\u0647';
  23747. t['\uFEEA'] = '\u0647';
  23748. t['\uFEEB'] = '\u0647';
  23749. t['\uFEEC'] = '\u0647';
  23750. t['\uFEED'] = '\u0648';
  23751. t['\uFEEE'] = '\u0648';
  23752. t['\uFEEF'] = '\u0649';
  23753. t['\uFEF0'] = '\u0649';
  23754. t['\uFEF1'] = '\u064A';
  23755. t['\uFEF2'] = '\u064A';
  23756. t['\uFEF3'] = '\u064A';
  23757. t['\uFEF4'] = '\u064A';
  23758. t['\uFEF5'] = '\u0644\u0622';
  23759. t['\uFEF6'] = '\u0644\u0622';
  23760. t['\uFEF7'] = '\u0644\u0623';
  23761. t['\uFEF8'] = '\u0644\u0623';
  23762. t['\uFEF9'] = '\u0644\u0625';
  23763. t['\uFEFA'] = '\u0644\u0625';
  23764. t['\uFEFB'] = '\u0644\u0627';
  23765. t['\uFEFC'] = '\u0644\u0627';
  23766. });
  23767. function reverseIfRtl(chars) {
  23768. var charsLength = chars.length;
  23769. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  23770. return chars;
  23771. }
  23772. var s = '';
  23773. for (var ii = charsLength - 1; ii >= 0; ii--) {
  23774. s += chars[ii];
  23775. }
  23776. return s;
  23777. }
  23778. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  23779. exports.reverseIfRtl = reverseIfRtl;
  23780. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  23781. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  23782. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  23783. /***/ }),
  23784. /* 19 */
  23785. /***/ (function(module, exports, __w_pdfjs_require__) {
  23786. "use strict";
  23787. Object.defineProperty(exports, "__esModule", {
  23788. value: true
  23789. });
  23790. exports.NetworkManager = exports.PDFNetworkStream = undefined;
  23791. var _util = __w_pdfjs_require__(0);
  23792. var _worker = __w_pdfjs_require__(8);
  23793. ;
  23794. var OK_RESPONSE = 200;
  23795. var PARTIAL_CONTENT_RESPONSE = 206;
  23796. function NetworkManager(url, args) {
  23797. this.url = url;
  23798. args = args || {};
  23799. this.isHttp = /^https?:/i.test(url);
  23800. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  23801. this.withCredentials = args.withCredentials || false;
  23802. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  23803. return new XMLHttpRequest();
  23804. };
  23805. this.currXhrId = 0;
  23806. this.pendingRequests = Object.create(null);
  23807. this.loadedRequests = Object.create(null);
  23808. }
  23809. function getArrayBuffer(xhr) {
  23810. var data = xhr.response;
  23811. if (typeof data !== 'string') {
  23812. return data;
  23813. }
  23814. var length = data.length;
  23815. var array = new Uint8Array(length);
  23816. for (var i = 0; i < length; i++) {
  23817. array[i] = data.charCodeAt(i) & 0xFF;
  23818. }
  23819. return array.buffer;
  23820. }
  23821. var supportsMozChunked = function supportsMozChunkedClosure() {
  23822. try {
  23823. var x = new XMLHttpRequest();
  23824. x.open('GET', _util.globalScope.location.href);
  23825. x.responseType = 'moz-chunked-arraybuffer';
  23826. return x.responseType === 'moz-chunked-arraybuffer';
  23827. } catch (e) {
  23828. return false;
  23829. }
  23830. }();
  23831. NetworkManager.prototype = {
  23832. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  23833. var args = {
  23834. begin: begin,
  23835. end: end
  23836. };
  23837. for (var prop in listeners) {
  23838. args[prop] = listeners[prop];
  23839. }
  23840. return this.request(args);
  23841. },
  23842. requestFull: function NetworkManager_requestFull(listeners) {
  23843. return this.request(listeners);
  23844. },
  23845. request: function NetworkManager_request(args) {
  23846. var xhr = this.getXhr();
  23847. var xhrId = this.currXhrId++;
  23848. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  23849. xhr.open('GET', this.url);
  23850. xhr.withCredentials = this.withCredentials;
  23851. for (var property in this.httpHeaders) {
  23852. var value = this.httpHeaders[property];
  23853. if (typeof value === 'undefined') {
  23854. continue;
  23855. }
  23856. xhr.setRequestHeader(property, value);
  23857. }
  23858. if (this.isHttp && 'begin' in args && 'end' in args) {
  23859. var rangeStr = args.begin + '-' + (args.end - 1);
  23860. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  23861. pendingRequest.expectedStatus = 206;
  23862. } else {
  23863. pendingRequest.expectedStatus = 200;
  23864. }
  23865. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  23866. if (useMozChunkedLoading) {
  23867. xhr.responseType = 'moz-chunked-arraybuffer';
  23868. pendingRequest.onProgressiveData = args.onProgressiveData;
  23869. pendingRequest.mozChunked = true;
  23870. } else {
  23871. xhr.responseType = 'arraybuffer';
  23872. }
  23873. if (args.onError) {
  23874. xhr.onerror = function (evt) {
  23875. args.onError(xhr.status);
  23876. };
  23877. }
  23878. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  23879. xhr.onprogress = this.onProgress.bind(this, xhrId);
  23880. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  23881. pendingRequest.onDone = args.onDone;
  23882. pendingRequest.onError = args.onError;
  23883. pendingRequest.onProgress = args.onProgress;
  23884. xhr.send(null);
  23885. return xhrId;
  23886. },
  23887. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  23888. var pendingRequest = this.pendingRequests[xhrId];
  23889. if (!pendingRequest) {
  23890. return;
  23891. }
  23892. if (pendingRequest.mozChunked) {
  23893. var chunk = getArrayBuffer(pendingRequest.xhr);
  23894. pendingRequest.onProgressiveData(chunk);
  23895. }
  23896. var onProgress = pendingRequest.onProgress;
  23897. if (onProgress) {
  23898. onProgress(evt);
  23899. }
  23900. },
  23901. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  23902. var pendingRequest = this.pendingRequests[xhrId];
  23903. if (!pendingRequest) {
  23904. return;
  23905. }
  23906. var xhr = pendingRequest.xhr;
  23907. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  23908. pendingRequest.onHeadersReceived();
  23909. delete pendingRequest.onHeadersReceived;
  23910. }
  23911. if (xhr.readyState !== 4) {
  23912. return;
  23913. }
  23914. if (!(xhrId in this.pendingRequests)) {
  23915. return;
  23916. }
  23917. delete this.pendingRequests[xhrId];
  23918. if (xhr.status === 0 && this.isHttp) {
  23919. if (pendingRequest.onError) {
  23920. pendingRequest.onError(xhr.status);
  23921. }
  23922. return;
  23923. }
  23924. var xhrStatus = xhr.status || OK_RESPONSE;
  23925. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  23926. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  23927. if (pendingRequest.onError) {
  23928. pendingRequest.onError(xhr.status);
  23929. }
  23930. return;
  23931. }
  23932. this.loadedRequests[xhrId] = true;
  23933. var chunk = getArrayBuffer(xhr);
  23934. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  23935. var rangeHeader = xhr.getResponseHeader('Content-Range');
  23936. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  23937. var begin = parseInt(matches[1], 10);
  23938. pendingRequest.onDone({
  23939. begin: begin,
  23940. chunk: chunk
  23941. });
  23942. } else if (pendingRequest.onProgressiveData) {
  23943. pendingRequest.onDone(null);
  23944. } else if (chunk) {
  23945. pendingRequest.onDone({
  23946. begin: 0,
  23947. chunk: chunk
  23948. });
  23949. } else if (pendingRequest.onError) {
  23950. pendingRequest.onError(xhr.status);
  23951. }
  23952. },
  23953. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  23954. for (var xhrId in this.pendingRequests) {
  23955. return true;
  23956. }
  23957. return false;
  23958. },
  23959. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  23960. return this.pendingRequests[xhrId].xhr;
  23961. },
  23962. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  23963. return !!this.pendingRequests[xhrId].onProgressiveData;
  23964. },
  23965. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  23966. return xhrId in this.pendingRequests;
  23967. },
  23968. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  23969. return xhrId in this.loadedRequests;
  23970. },
  23971. abortAllRequests: function NetworkManager_abortAllRequests() {
  23972. for (var xhrId in this.pendingRequests) {
  23973. this.abortRequest(xhrId | 0);
  23974. }
  23975. },
  23976. abortRequest: function NetworkManager_abortRequest(xhrId) {
  23977. var xhr = this.pendingRequests[xhrId].xhr;
  23978. delete this.pendingRequests[xhrId];
  23979. xhr.abort();
  23980. }
  23981. };
  23982. function PDFNetworkStream(options) {
  23983. this._options = options;
  23984. var source = options.source;
  23985. this._manager = new NetworkManager(source.url, {
  23986. httpHeaders: source.httpHeaders,
  23987. withCredentials: source.withCredentials
  23988. });
  23989. this._rangeChunkSize = source.rangeChunkSize;
  23990. this._fullRequestReader = null;
  23991. this._rangeRequestReaders = [];
  23992. }
  23993. PDFNetworkStream.prototype = {
  23994. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  23995. var i = this._rangeRequestReaders.indexOf(reader);
  23996. if (i >= 0) {
  23997. this._rangeRequestReaders.splice(i, 1);
  23998. }
  23999. },
  24000. getFullReader: function PDFNetworkStream_getFullReader() {
  24001. (0, _util.assert)(!this._fullRequestReader);
  24002. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  24003. return this._fullRequestReader;
  24004. },
  24005. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  24006. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  24007. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  24008. this._rangeRequestReaders.push(reader);
  24009. return reader;
  24010. },
  24011. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  24012. if (this._fullRequestReader) {
  24013. this._fullRequestReader.cancel(reason);
  24014. }
  24015. var readers = this._rangeRequestReaders.slice(0);
  24016. readers.forEach(function (reader) {
  24017. reader.cancel(reason);
  24018. });
  24019. }
  24020. };
  24021. function PDFNetworkStreamFullRequestReader(manager, options) {
  24022. this._manager = manager;
  24023. var source = options.source;
  24024. var args = {
  24025. onHeadersReceived: this._onHeadersReceived.bind(this),
  24026. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  24027. onDone: this._onDone.bind(this),
  24028. onError: this._onError.bind(this),
  24029. onProgress: this._onProgress.bind(this)
  24030. };
  24031. this._url = source.url;
  24032. this._fullRequestId = manager.requestFull(args);
  24033. this._headersReceivedCapability = (0, _util.createPromiseCapability)();
  24034. this._disableRange = options.disableRange || false;
  24035. this._contentLength = source.length;
  24036. this._rangeChunkSize = source.rangeChunkSize;
  24037. if (!this._rangeChunkSize && !this._disableRange) {
  24038. this._disableRange = true;
  24039. }
  24040. this._isStreamingSupported = false;
  24041. this._isRangeSupported = false;
  24042. this._cachedChunks = [];
  24043. this._requests = [];
  24044. this._done = false;
  24045. this._storedError = undefined;
  24046. this.onProgress = null;
  24047. }
  24048. PDFNetworkStreamFullRequestReader.prototype = {
  24049. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  24050. if (this._disableRange) {
  24051. return false;
  24052. }
  24053. var networkManager = this._manager;
  24054. if (!networkManager.isHttp) {
  24055. return false;
  24056. }
  24057. var fullRequestXhrId = this._fullRequestId;
  24058. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  24059. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  24060. return false;
  24061. }
  24062. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  24063. if (contentEncoding !== 'identity') {
  24064. return false;
  24065. }
  24066. var length = fullRequestXhr.getResponseHeader('Content-Length');
  24067. length = parseInt(length, 10);
  24068. if (!(0, _util.isInt)(length)) {
  24069. return false;
  24070. }
  24071. this._contentLength = length;
  24072. if (length <= 2 * this._rangeChunkSize) {
  24073. return false;
  24074. }
  24075. return true;
  24076. },
  24077. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  24078. if (this._validateRangeRequestCapabilities()) {
  24079. this._isRangeSupported = true;
  24080. }
  24081. var networkManager = this._manager;
  24082. var fullRequestXhrId = this._fullRequestId;
  24083. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  24084. this._isStreamingSupported = true;
  24085. } else if (this._isRangeSupported) {
  24086. networkManager.abortRequest(fullRequestXhrId);
  24087. }
  24088. this._headersReceivedCapability.resolve();
  24089. },
  24090. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  24091. if (this._requests.length > 0) {
  24092. var requestCapability = this._requests.shift();
  24093. requestCapability.resolve({
  24094. value: chunk,
  24095. done: false
  24096. });
  24097. } else {
  24098. this._cachedChunks.push(chunk);
  24099. }
  24100. },
  24101. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  24102. if (args) {
  24103. this._onProgressiveData(args.chunk);
  24104. }
  24105. this._done = true;
  24106. if (this._cachedChunks.length > 0) {
  24107. return;
  24108. }
  24109. this._requests.forEach(function (requestCapability) {
  24110. requestCapability.resolve({
  24111. value: undefined,
  24112. done: true
  24113. });
  24114. });
  24115. this._requests = [];
  24116. },
  24117. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  24118. var url = this._url;
  24119. var exception;
  24120. if (status === 404 || status === 0 && /^file:/.test(url)) {
  24121. exception = new _util.MissingPDFException('Missing PDF "' + url + '".');
  24122. } else {
  24123. exception = new _util.UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  24124. }
  24125. this._storedError = exception;
  24126. this._headersReceivedCapability.reject(exception);
  24127. this._requests.forEach(function (requestCapability) {
  24128. requestCapability.reject(exception);
  24129. });
  24130. this._requests = [];
  24131. this._cachedChunks = [];
  24132. },
  24133. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  24134. if (this.onProgress) {
  24135. this.onProgress({
  24136. loaded: data.loaded,
  24137. total: data.lengthComputable ? data.total : this._contentLength
  24138. });
  24139. }
  24140. },
  24141. get isRangeSupported() {
  24142. return this._isRangeSupported;
  24143. },
  24144. get isStreamingSupported() {
  24145. return this._isStreamingSupported;
  24146. },
  24147. get contentLength() {
  24148. return this._contentLength;
  24149. },
  24150. get headersReady() {
  24151. return this._headersReceivedCapability.promise;
  24152. },
  24153. read: function PDFNetworkStreamFullRequestReader_read() {
  24154. if (this._storedError) {
  24155. return Promise.reject(this._storedError);
  24156. }
  24157. if (this._cachedChunks.length > 0) {
  24158. var chunk = this._cachedChunks.shift();
  24159. return Promise.resolve(chunk);
  24160. }
  24161. if (this._done) {
  24162. return Promise.resolve({
  24163. value: undefined,
  24164. done: true
  24165. });
  24166. }
  24167. var requestCapability = (0, _util.createPromiseCapability)();
  24168. this._requests.push(requestCapability);
  24169. return requestCapability.promise;
  24170. },
  24171. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  24172. this._done = true;
  24173. this._headersReceivedCapability.reject(reason);
  24174. this._requests.forEach(function (requestCapability) {
  24175. requestCapability.resolve({
  24176. value: undefined,
  24177. done: true
  24178. });
  24179. });
  24180. this._requests = [];
  24181. if (this._manager.isPendingRequest(this._fullRequestId)) {
  24182. this._manager.abortRequest(this._fullRequestId);
  24183. }
  24184. this._fullRequestReader = null;
  24185. }
  24186. };
  24187. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  24188. this._manager = manager;
  24189. var args = {
  24190. onDone: this._onDone.bind(this),
  24191. onProgress: this._onProgress.bind(this)
  24192. };
  24193. this._requestId = manager.requestRange(begin, end, args);
  24194. this._requests = [];
  24195. this._queuedChunk = null;
  24196. this._done = false;
  24197. this.onProgress = null;
  24198. this.onClosed = null;
  24199. }
  24200. PDFNetworkStreamRangeRequestReader.prototype = {
  24201. _close: function PDFNetworkStreamRangeRequestReader_close() {
  24202. if (this.onClosed) {
  24203. this.onClosed(this);
  24204. }
  24205. },
  24206. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  24207. var chunk = data.chunk;
  24208. if (this._requests.length > 0) {
  24209. var requestCapability = this._requests.shift();
  24210. requestCapability.resolve({
  24211. value: chunk,
  24212. done: false
  24213. });
  24214. } else {
  24215. this._queuedChunk = chunk;
  24216. }
  24217. this._done = true;
  24218. this._requests.forEach(function (requestCapability) {
  24219. requestCapability.resolve({
  24220. value: undefined,
  24221. done: true
  24222. });
  24223. });
  24224. this._requests = [];
  24225. this._close();
  24226. },
  24227. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  24228. if (!this.isStreamingSupported && this.onProgress) {
  24229. this.onProgress({ loaded: evt.loaded });
  24230. }
  24231. },
  24232. get isStreamingSupported() {
  24233. return false;
  24234. },
  24235. read: function PDFNetworkStreamRangeRequestReader_read() {
  24236. if (this._queuedChunk !== null) {
  24237. var chunk = this._queuedChunk;
  24238. this._queuedChunk = null;
  24239. return Promise.resolve({
  24240. value: chunk,
  24241. done: false
  24242. });
  24243. }
  24244. if (this._done) {
  24245. return Promise.resolve({
  24246. value: undefined,
  24247. done: true
  24248. });
  24249. }
  24250. var requestCapability = (0, _util.createPromiseCapability)();
  24251. this._requests.push(requestCapability);
  24252. return requestCapability.promise;
  24253. },
  24254. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  24255. this._done = true;
  24256. this._requests.forEach(function (requestCapability) {
  24257. requestCapability.resolve({
  24258. value: undefined,
  24259. done: true
  24260. });
  24261. });
  24262. this._requests = [];
  24263. if (this._manager.isPendingRequest(this._requestId)) {
  24264. this._manager.abortRequest(this._requestId);
  24265. }
  24266. this._close();
  24267. }
  24268. };
  24269. (0, _worker.setPDFNetworkStreamClass)(PDFNetworkStream);
  24270. exports.PDFNetworkStream = PDFNetworkStream;
  24271. exports.NetworkManager = NetworkManager;
  24272. /***/ }),
  24273. /* 20 */
  24274. /***/ (function(module, exports, __w_pdfjs_require__) {
  24275. "use strict";
  24276. Object.defineProperty(exports, "__esModule", {
  24277. value: true
  24278. });
  24279. exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = undefined;
  24280. var _util = __w_pdfjs_require__(0);
  24281. var _obj = __w_pdfjs_require__(16);
  24282. var _primitives = __w_pdfjs_require__(1);
  24283. var _colorspace = __w_pdfjs_require__(3);
  24284. var _evaluator = __w_pdfjs_require__(14);
  24285. var _stream = __w_pdfjs_require__(2);
  24286. function AnnotationFactory() {}
  24287. AnnotationFactory.prototype = {
  24288. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  24289. var dict = xref.fetchIfRef(ref);
  24290. if (!(0, _primitives.isDict)(dict)) {
  24291. return;
  24292. }
  24293. var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  24294. var subtype = dict.get('Subtype');
  24295. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  24296. var parameters = {
  24297. xref: xref,
  24298. dict: dict,
  24299. ref: (0, _primitives.isRef)(ref) ? ref : null,
  24300. subtype: subtype,
  24301. id: id,
  24302. pdfManager: pdfManager
  24303. };
  24304. switch (subtype) {
  24305. case 'Link':
  24306. return new LinkAnnotation(parameters);
  24307. case 'Text':
  24308. return new TextAnnotation(parameters);
  24309. case 'Widget':
  24310. var fieldType = _util.Util.getInheritableProperty(dict, 'FT');
  24311. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  24312. switch (fieldType) {
  24313. case 'Tx':
  24314. return new TextWidgetAnnotation(parameters);
  24315. case 'Btn':
  24316. return new ButtonWidgetAnnotation(parameters);
  24317. case 'Ch':
  24318. return new ChoiceWidgetAnnotation(parameters);
  24319. }
  24320. (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  24321. return new WidgetAnnotation(parameters);
  24322. case 'Popup':
  24323. return new PopupAnnotation(parameters);
  24324. case 'Line':
  24325. return new LineAnnotation(parameters);
  24326. case 'Highlight':
  24327. return new HighlightAnnotation(parameters);
  24328. case 'Underline':
  24329. return new UnderlineAnnotation(parameters);
  24330. case 'Squiggly':
  24331. return new SquigglyAnnotation(parameters);
  24332. case 'StrikeOut':
  24333. return new StrikeOutAnnotation(parameters);
  24334. case 'FileAttachment':
  24335. return new FileAttachmentAnnotation(parameters);
  24336. default:
  24337. if (!subtype) {
  24338. (0, _util.warn)('Annotation is missing the required /Subtype.');
  24339. } else {
  24340. (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  24341. }
  24342. return new Annotation(parameters);
  24343. }
  24344. }
  24345. };
  24346. var Annotation = function AnnotationClosure() {
  24347. function getTransformMatrix(rect, bbox, matrix) {
  24348. var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  24349. var minX = bounds[0];
  24350. var minY = bounds[1];
  24351. var maxX = bounds[2];
  24352. var maxY = bounds[3];
  24353. if (minX === maxX || minY === maxY) {
  24354. return [1, 0, 0, 1, rect[0], rect[1]];
  24355. }
  24356. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  24357. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  24358. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  24359. }
  24360. function Annotation(params) {
  24361. var dict = params.dict;
  24362. this.setFlags(dict.get('F'));
  24363. this.setRectangle(dict.getArray('Rect'));
  24364. this.setColor(dict.getArray('C'));
  24365. this.setBorderStyle(dict);
  24366. this.setAppearance(dict);
  24367. this.data = {};
  24368. this.data.id = params.id;
  24369. this.data.subtype = params.subtype;
  24370. this.data.annotationFlags = this.flags;
  24371. this.data.rect = this.rectangle;
  24372. this.data.color = this.color;
  24373. this.data.borderStyle = this.borderStyle;
  24374. this.data.hasAppearance = !!this.appearance;
  24375. }
  24376. Annotation.prototype = {
  24377. _hasFlag: function Annotation_hasFlag(flags, flag) {
  24378. return !!(flags & flag);
  24379. },
  24380. _isViewable: function Annotation_isViewable(flags) {
  24381. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  24382. },
  24383. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  24384. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
  24385. },
  24386. get viewable() {
  24387. if (this.flags === 0) {
  24388. return true;
  24389. }
  24390. return this._isViewable(this.flags);
  24391. },
  24392. get printable() {
  24393. if (this.flags === 0) {
  24394. return false;
  24395. }
  24396. return this._isPrintable(this.flags);
  24397. },
  24398. setFlags: function Annotation_setFlags(flags) {
  24399. this.flags = (0, _util.isInt)(flags) && flags > 0 ? flags : 0;
  24400. },
  24401. hasFlag: function Annotation_hasFlag(flag) {
  24402. return this._hasFlag(this.flags, flag);
  24403. },
  24404. setRectangle: function Annotation_setRectangle(rectangle) {
  24405. if ((0, _util.isArray)(rectangle) && rectangle.length === 4) {
  24406. this.rectangle = _util.Util.normalizeRect(rectangle);
  24407. } else {
  24408. this.rectangle = [0, 0, 0, 0];
  24409. }
  24410. },
  24411. setColor: function Annotation_setColor(color) {
  24412. var rgbColor = new Uint8Array(3);
  24413. if (!(0, _util.isArray)(color)) {
  24414. this.color = rgbColor;
  24415. return;
  24416. }
  24417. switch (color.length) {
  24418. case 0:
  24419. this.color = null;
  24420. break;
  24421. case 1:
  24422. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  24423. this.color = rgbColor;
  24424. break;
  24425. case 3:
  24426. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  24427. this.color = rgbColor;
  24428. break;
  24429. case 4:
  24430. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  24431. this.color = rgbColor;
  24432. break;
  24433. default:
  24434. this.color = rgbColor;
  24435. break;
  24436. }
  24437. },
  24438. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  24439. this.borderStyle = new AnnotationBorderStyle();
  24440. if (!(0, _primitives.isDict)(borderStyle)) {
  24441. return;
  24442. }
  24443. if (borderStyle.has('BS')) {
  24444. var dict = borderStyle.get('BS');
  24445. var dictType = dict.get('Type');
  24446. if (!dictType || (0, _primitives.isName)(dictType, 'Border')) {
  24447. this.borderStyle.setWidth(dict.get('W'));
  24448. this.borderStyle.setStyle(dict.get('S'));
  24449. this.borderStyle.setDashArray(dict.getArray('D'));
  24450. }
  24451. } else if (borderStyle.has('Border')) {
  24452. var array = borderStyle.getArray('Border');
  24453. if ((0, _util.isArray)(array) && array.length >= 3) {
  24454. this.borderStyle.setHorizontalCornerRadius(array[0]);
  24455. this.borderStyle.setVerticalCornerRadius(array[1]);
  24456. this.borderStyle.setWidth(array[2]);
  24457. if (array.length === 4) {
  24458. this.borderStyle.setDashArray(array[3]);
  24459. }
  24460. }
  24461. } else {
  24462. this.borderStyle.setWidth(0);
  24463. }
  24464. },
  24465. setAppearance: function Annotation_setAppearance(dict) {
  24466. this.appearance = null;
  24467. var appearanceStates = dict.get('AP');
  24468. if (!(0, _primitives.isDict)(appearanceStates)) {
  24469. return;
  24470. }
  24471. var normalAppearanceState = appearanceStates.get('N');
  24472. if ((0, _primitives.isStream)(normalAppearanceState)) {
  24473. this.appearance = normalAppearanceState;
  24474. return;
  24475. }
  24476. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  24477. return;
  24478. }
  24479. var as = dict.get('AS');
  24480. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  24481. return;
  24482. }
  24483. this.appearance = normalAppearanceState.get(as.name);
  24484. },
  24485. _preparePopup: function Annotation_preparePopup(dict) {
  24486. if (!dict.has('C')) {
  24487. this.data.color = null;
  24488. }
  24489. this.data.hasPopup = dict.has('Popup');
  24490. this.data.title = (0, _util.stringToPDFString)(dict.get('T') || '');
  24491. this.data.contents = (0, _util.stringToPDFString)(dict.get('Contents') || '');
  24492. },
  24493. loadResources: function Annotation_loadResources(keys) {
  24494. return this.appearance.dict.getAsync('Resources').then(function (resources) {
  24495. if (!resources) {
  24496. return;
  24497. }
  24498. var objectLoader = new _obj.ObjectLoader(resources.map, keys, resources.xref);
  24499. return objectLoader.load().then(function () {
  24500. return resources;
  24501. });
  24502. });
  24503. },
  24504. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  24505. var _this = this;
  24506. if (!this.appearance) {
  24507. return Promise.resolve(new _evaluator.OperatorList());
  24508. }
  24509. var data = this.data;
  24510. var appearanceDict = this.appearance.dict;
  24511. var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
  24512. var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1];
  24513. var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0];
  24514. var transform = getTransformMatrix(data.rect, bbox, matrix);
  24515. return resourcesPromise.then(function (resources) {
  24516. var opList = new _evaluator.OperatorList();
  24517. opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
  24518. return evaluator.getOperatorList({
  24519. stream: _this.appearance,
  24520. task: task,
  24521. resources: resources,
  24522. operatorList: opList
  24523. }).then(function () {
  24524. opList.addOp(_util.OPS.endAnnotation, []);
  24525. _this.appearance.reset();
  24526. return opList;
  24527. });
  24528. });
  24529. }
  24530. };
  24531. return Annotation;
  24532. }();
  24533. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  24534. function AnnotationBorderStyle() {
  24535. this.width = 1;
  24536. this.style = _util.AnnotationBorderStyleType.SOLID;
  24537. this.dashArray = [3];
  24538. this.horizontalCornerRadius = 0;
  24539. this.verticalCornerRadius = 0;
  24540. }
  24541. AnnotationBorderStyle.prototype = {
  24542. setWidth: function AnnotationBorderStyle_setWidth(width) {
  24543. if (width === (width | 0)) {
  24544. this.width = width;
  24545. }
  24546. },
  24547. setStyle: function AnnotationBorderStyle_setStyle(style) {
  24548. if (!style) {
  24549. return;
  24550. }
  24551. switch (style.name) {
  24552. case 'S':
  24553. this.style = _util.AnnotationBorderStyleType.SOLID;
  24554. break;
  24555. case 'D':
  24556. this.style = _util.AnnotationBorderStyleType.DASHED;
  24557. break;
  24558. case 'B':
  24559. this.style = _util.AnnotationBorderStyleType.BEVELED;
  24560. break;
  24561. case 'I':
  24562. this.style = _util.AnnotationBorderStyleType.INSET;
  24563. break;
  24564. case 'U':
  24565. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  24566. break;
  24567. default:
  24568. break;
  24569. }
  24570. },
  24571. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  24572. if ((0, _util.isArray)(dashArray) && dashArray.length > 0) {
  24573. var isValid = true;
  24574. var allZeros = true;
  24575. for (var i = 0, len = dashArray.length; i < len; i++) {
  24576. var element = dashArray[i];
  24577. var validNumber = +element >= 0;
  24578. if (!validNumber) {
  24579. isValid = false;
  24580. break;
  24581. } else if (element > 0) {
  24582. allZeros = false;
  24583. }
  24584. }
  24585. if (isValid && !allZeros) {
  24586. this.dashArray = dashArray;
  24587. } else {
  24588. this.width = 0;
  24589. }
  24590. } else if (dashArray) {
  24591. this.width = 0;
  24592. }
  24593. },
  24594. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  24595. if (radius === (radius | 0)) {
  24596. this.horizontalCornerRadius = radius;
  24597. }
  24598. },
  24599. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  24600. if (radius === (radius | 0)) {
  24601. this.verticalCornerRadius = radius;
  24602. }
  24603. }
  24604. };
  24605. return AnnotationBorderStyle;
  24606. }();
  24607. var WidgetAnnotation = function WidgetAnnotationClosure() {
  24608. function WidgetAnnotation(params) {
  24609. Annotation.call(this, params);
  24610. var dict = params.dict;
  24611. var data = this.data;
  24612. data.annotationType = _util.AnnotationType.WIDGET;
  24613. data.fieldName = this._constructFieldName(dict);
  24614. data.fieldValue = _util.Util.getInheritableProperty(dict, 'V', true);
  24615. data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || '');
  24616. data.defaultAppearance = _util.Util.getInheritableProperty(dict, 'DA') || '';
  24617. var fieldType = _util.Util.getInheritableProperty(dict, 'FT');
  24618. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  24619. this.fieldResources = _util.Util.getInheritableProperty(dict, 'DR') || _primitives.Dict.empty;
  24620. data.fieldFlags = _util.Util.getInheritableProperty(dict, 'Ff');
  24621. if (!(0, _util.isInt)(data.fieldFlags) || data.fieldFlags < 0) {
  24622. data.fieldFlags = 0;
  24623. }
  24624. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  24625. if (data.fieldType === 'Sig') {
  24626. this.setFlags(_util.AnnotationFlag.HIDDEN);
  24627. }
  24628. }
  24629. _util.Util.inherit(WidgetAnnotation, Annotation, {
  24630. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  24631. if (!dict.has('T') && !dict.has('Parent')) {
  24632. (0, _util.warn)('Unknown field name, falling back to empty field name.');
  24633. return '';
  24634. }
  24635. if (!dict.has('Parent')) {
  24636. return (0, _util.stringToPDFString)(dict.get('T'));
  24637. }
  24638. var fieldName = [];
  24639. if (dict.has('T')) {
  24640. fieldName.unshift((0, _util.stringToPDFString)(dict.get('T')));
  24641. }
  24642. var loopDict = dict;
  24643. while (loopDict.has('Parent')) {
  24644. loopDict = loopDict.get('Parent');
  24645. if (!(0, _primitives.isDict)(loopDict)) {
  24646. break;
  24647. }
  24648. if (loopDict.has('T')) {
  24649. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get('T')));
  24650. }
  24651. }
  24652. return fieldName.join('.');
  24653. },
  24654. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  24655. return !!(this.data.fieldFlags & flag);
  24656. }
  24657. });
  24658. return WidgetAnnotation;
  24659. }();
  24660. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  24661. function TextWidgetAnnotation(params) {
  24662. WidgetAnnotation.call(this, params);
  24663. this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || '');
  24664. var alignment = _util.Util.getInheritableProperty(params.dict, 'Q');
  24665. if (!(0, _util.isInt)(alignment) || alignment < 0 || alignment > 2) {
  24666. alignment = null;
  24667. }
  24668. this.data.textAlignment = alignment;
  24669. var maximumLength = _util.Util.getInheritableProperty(params.dict, 'MaxLen');
  24670. if (!(0, _util.isInt)(maximumLength) || maximumLength < 0) {
  24671. maximumLength = null;
  24672. }
  24673. this.data.maxLen = maximumLength;
  24674. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  24675. 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;
  24676. }
  24677. _util.Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  24678. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  24679. var operatorList = new _evaluator.OperatorList();
  24680. if (renderForms) {
  24681. return Promise.resolve(operatorList);
  24682. }
  24683. if (this.appearance) {
  24684. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  24685. }
  24686. if (!this.data.defaultAppearance) {
  24687. return Promise.resolve(operatorList);
  24688. }
  24689. var stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
  24690. return evaluator.getOperatorList({
  24691. stream: stream,
  24692. task: task,
  24693. resources: this.fieldResources,
  24694. operatorList: operatorList
  24695. }).then(function () {
  24696. return operatorList;
  24697. });
  24698. }
  24699. });
  24700. return TextWidgetAnnotation;
  24701. }();
  24702. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  24703. function ButtonWidgetAnnotation(params) {
  24704. WidgetAnnotation.call(this, params);
  24705. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  24706. if (this.data.checkBox) {
  24707. if (!(0, _primitives.isName)(this.data.fieldValue)) {
  24708. return;
  24709. }
  24710. this.data.fieldValue = this.data.fieldValue.name;
  24711. }
  24712. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  24713. if (this.data.radioButton) {
  24714. this.data.fieldValue = this.data.buttonValue = null;
  24715. var fieldParent = params.dict.get('Parent');
  24716. if ((0, _primitives.isDict)(fieldParent) && fieldParent.has('V')) {
  24717. var fieldParentValue = fieldParent.get('V');
  24718. if ((0, _primitives.isName)(fieldParentValue)) {
  24719. this.data.fieldValue = fieldParentValue.name;
  24720. }
  24721. }
  24722. var appearanceStates = params.dict.get('AP');
  24723. if (!(0, _primitives.isDict)(appearanceStates)) {
  24724. return;
  24725. }
  24726. var normalAppearanceState = appearanceStates.get('N');
  24727. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  24728. return;
  24729. }
  24730. var keys = normalAppearanceState.getKeys();
  24731. for (var i = 0, ii = keys.length; i < ii; i++) {
  24732. if (keys[i] !== 'Off') {
  24733. this.data.buttonValue = keys[i];
  24734. break;
  24735. }
  24736. }
  24737. }
  24738. }
  24739. _util.Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  24740. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  24741. var operatorList = new _evaluator.OperatorList();
  24742. if (renderForms) {
  24743. return Promise.resolve(operatorList);
  24744. }
  24745. if (this.appearance) {
  24746. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  24747. }
  24748. return Promise.resolve(operatorList);
  24749. }
  24750. });
  24751. return ButtonWidgetAnnotation;
  24752. }();
  24753. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  24754. function ChoiceWidgetAnnotation(params) {
  24755. WidgetAnnotation.call(this, params);
  24756. this.data.options = [];
  24757. var options = _util.Util.getInheritableProperty(params.dict, 'Opt');
  24758. if ((0, _util.isArray)(options)) {
  24759. var xref = params.xref;
  24760. for (var i = 0, ii = options.length; i < ii; i++) {
  24761. var option = xref.fetchIfRef(options[i]);
  24762. var isOptionArray = (0, _util.isArray)(option);
  24763. this.data.options[i] = {
  24764. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  24765. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  24766. };
  24767. }
  24768. }
  24769. if (!(0, _util.isArray)(this.data.fieldValue)) {
  24770. this.data.fieldValue = [this.data.fieldValue];
  24771. }
  24772. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  24773. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  24774. }
  24775. _util.Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  24776. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  24777. var operatorList = new _evaluator.OperatorList();
  24778. if (renderForms) {
  24779. return Promise.resolve(operatorList);
  24780. }
  24781. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  24782. }
  24783. });
  24784. return ChoiceWidgetAnnotation;
  24785. }();
  24786. var TextAnnotation = function TextAnnotationClosure() {
  24787. var DEFAULT_ICON_SIZE = 22;
  24788. function TextAnnotation(parameters) {
  24789. Annotation.call(this, parameters);
  24790. this.data.annotationType = _util.AnnotationType.TEXT;
  24791. if (this.data.hasAppearance) {
  24792. this.data.name = 'NoIcon';
  24793. } else {
  24794. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  24795. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  24796. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  24797. }
  24798. this._preparePopup(parameters.dict);
  24799. }
  24800. _util.Util.inherit(TextAnnotation, Annotation, {});
  24801. return TextAnnotation;
  24802. }();
  24803. var LinkAnnotation = function LinkAnnotationClosure() {
  24804. function LinkAnnotation(params) {
  24805. Annotation.call(this, params);
  24806. var data = this.data;
  24807. data.annotationType = _util.AnnotationType.LINK;
  24808. _obj.Catalog.parseDestDictionary({
  24809. destDict: params.dict,
  24810. resultObj: data,
  24811. docBaseUrl: params.pdfManager.docBaseUrl
  24812. });
  24813. }
  24814. _util.Util.inherit(LinkAnnotation, Annotation, {});
  24815. return LinkAnnotation;
  24816. }();
  24817. var PopupAnnotation = function PopupAnnotationClosure() {
  24818. function PopupAnnotation(parameters) {
  24819. Annotation.call(this, parameters);
  24820. this.data.annotationType = _util.AnnotationType.POPUP;
  24821. var dict = parameters.dict;
  24822. var parentItem = dict.get('Parent');
  24823. if (!parentItem) {
  24824. (0, _util.warn)('Popup annotation has a missing or invalid parent annotation.');
  24825. return;
  24826. }
  24827. var parentSubtype = parentItem.get('Subtype');
  24828. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  24829. this.data.parentId = dict.getRaw('Parent').toString();
  24830. this.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
  24831. this.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
  24832. if (!parentItem.has('C')) {
  24833. this.data.color = null;
  24834. } else {
  24835. this.setColor(parentItem.getArray('C'));
  24836. this.data.color = this.color;
  24837. }
  24838. if (!this.viewable) {
  24839. var parentFlags = parentItem.get('F');
  24840. if (this._isViewable(parentFlags)) {
  24841. this.setFlags(parentFlags);
  24842. }
  24843. }
  24844. }
  24845. _util.Util.inherit(PopupAnnotation, Annotation, {});
  24846. return PopupAnnotation;
  24847. }();
  24848. var LineAnnotation = function LineAnnotationClosure() {
  24849. function LineAnnotation(parameters) {
  24850. Annotation.call(this, parameters);
  24851. this.data.annotationType = _util.AnnotationType.LINE;
  24852. var dict = parameters.dict;
  24853. this.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
  24854. this._preparePopup(dict);
  24855. }
  24856. _util.Util.inherit(LineAnnotation, Annotation, {});
  24857. return LineAnnotation;
  24858. }();
  24859. var HighlightAnnotation = function HighlightAnnotationClosure() {
  24860. function HighlightAnnotation(parameters) {
  24861. Annotation.call(this, parameters);
  24862. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  24863. this._preparePopup(parameters.dict);
  24864. }
  24865. _util.Util.inherit(HighlightAnnotation, Annotation, {});
  24866. return HighlightAnnotation;
  24867. }();
  24868. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  24869. function UnderlineAnnotation(parameters) {
  24870. Annotation.call(this, parameters);
  24871. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  24872. this._preparePopup(parameters.dict);
  24873. }
  24874. _util.Util.inherit(UnderlineAnnotation, Annotation, {});
  24875. return UnderlineAnnotation;
  24876. }();
  24877. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  24878. function SquigglyAnnotation(parameters) {
  24879. Annotation.call(this, parameters);
  24880. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  24881. this._preparePopup(parameters.dict);
  24882. }
  24883. _util.Util.inherit(SquigglyAnnotation, Annotation, {});
  24884. return SquigglyAnnotation;
  24885. }();
  24886. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  24887. function StrikeOutAnnotation(parameters) {
  24888. Annotation.call(this, parameters);
  24889. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  24890. this._preparePopup(parameters.dict);
  24891. }
  24892. _util.Util.inherit(StrikeOutAnnotation, Annotation, {});
  24893. return StrikeOutAnnotation;
  24894. }();
  24895. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  24896. function FileAttachmentAnnotation(parameters) {
  24897. Annotation.call(this, parameters);
  24898. var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
  24899. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  24900. this.data.file = file.serializable;
  24901. this._preparePopup(parameters.dict);
  24902. }
  24903. _util.Util.inherit(FileAttachmentAnnotation, Annotation, {});
  24904. return FileAttachmentAnnotation;
  24905. }();
  24906. exports.Annotation = Annotation;
  24907. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  24908. exports.AnnotationFactory = AnnotationFactory;
  24909. /***/ }),
  24910. /* 21 */
  24911. /***/ (function(module, exports, __w_pdfjs_require__) {
  24912. "use strict";
  24913. Object.defineProperty(exports, "__esModule", {
  24914. value: true
  24915. });
  24916. exports.bidi = undefined;
  24917. var _util = __w_pdfjs_require__(0);
  24918. 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'];
  24919. 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'];
  24920. function isOdd(i) {
  24921. return (i & 1) !== 0;
  24922. }
  24923. function isEven(i) {
  24924. return (i & 1) === 0;
  24925. }
  24926. function findUnequal(arr, start, value) {
  24927. for (var j = start, jj = arr.length; j < jj; ++j) {
  24928. if (arr[j] !== value) {
  24929. return j;
  24930. }
  24931. }
  24932. return j;
  24933. }
  24934. function setValues(arr, start, end, value) {
  24935. for (var j = start; j < end; ++j) {
  24936. arr[j] = value;
  24937. }
  24938. }
  24939. function reverseValues(arr, start, end) {
  24940. for (var i = start, j = end - 1; i < j; ++i, --j) {
  24941. var temp = arr[i];
  24942. arr[i] = arr[j];
  24943. arr[j] = temp;
  24944. }
  24945. }
  24946. function createBidiText(str, isLTR, vertical) {
  24947. return {
  24948. str: str,
  24949. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  24950. };
  24951. }
  24952. var chars = [];
  24953. var types = [];
  24954. function bidi(str, startLevel, vertical) {
  24955. var isLTR = true;
  24956. var strLength = str.length;
  24957. if (strLength === 0 || vertical) {
  24958. return createBidiText(str, isLTR, vertical);
  24959. }
  24960. chars.length = strLength;
  24961. types.length = strLength;
  24962. var numBidi = 0;
  24963. var i, ii;
  24964. for (i = 0; i < strLength; ++i) {
  24965. chars[i] = str.charAt(i);
  24966. var charCode = str.charCodeAt(i);
  24967. var charType = 'L';
  24968. if (charCode <= 0x00ff) {
  24969. charType = baseTypes[charCode];
  24970. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  24971. charType = 'R';
  24972. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  24973. charType = arabicTypes[charCode & 0xff];
  24974. if (!charType) {
  24975. (0, _util.warn)('Bidi: invalid Unicode character ' + charCode.toString(16));
  24976. }
  24977. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  24978. charType = 'AL';
  24979. }
  24980. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  24981. numBidi++;
  24982. }
  24983. types[i] = charType;
  24984. }
  24985. if (numBidi === 0) {
  24986. isLTR = true;
  24987. return createBidiText(str, isLTR);
  24988. }
  24989. if (startLevel === -1) {
  24990. if (numBidi / strLength < 0.3) {
  24991. isLTR = true;
  24992. startLevel = 0;
  24993. } else {
  24994. isLTR = false;
  24995. startLevel = 1;
  24996. }
  24997. }
  24998. var levels = [];
  24999. for (i = 0; i < strLength; ++i) {
  25000. levels[i] = startLevel;
  25001. }
  25002. var e = isOdd(startLevel) ? 'R' : 'L';
  25003. var sor = e;
  25004. var eor = sor;
  25005. var lastType = sor;
  25006. for (i = 0; i < strLength; ++i) {
  25007. if (types[i] === 'NSM') {
  25008. types[i] = lastType;
  25009. } else {
  25010. lastType = types[i];
  25011. }
  25012. }
  25013. lastType = sor;
  25014. var t;
  25015. for (i = 0; i < strLength; ++i) {
  25016. t = types[i];
  25017. if (t === 'EN') {
  25018. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  25019. } else if (t === 'R' || t === 'L' || t === 'AL') {
  25020. lastType = t;
  25021. }
  25022. }
  25023. for (i = 0; i < strLength; ++i) {
  25024. t = types[i];
  25025. if (t === 'AL') {
  25026. types[i] = 'R';
  25027. }
  25028. }
  25029. for (i = 1; i < strLength - 1; ++i) {
  25030. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  25031. types[i] = 'EN';
  25032. }
  25033. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  25034. types[i] = types[i - 1];
  25035. }
  25036. }
  25037. for (i = 0; i < strLength; ++i) {
  25038. if (types[i] === 'EN') {
  25039. var j;
  25040. for (j = i - 1; j >= 0; --j) {
  25041. if (types[j] !== 'ET') {
  25042. break;
  25043. }
  25044. types[j] = 'EN';
  25045. }
  25046. for (j = i + 1; j < strLength; ++j) {
  25047. if (types[j] !== 'ET') {
  25048. break;
  25049. }
  25050. types[j] = 'EN';
  25051. }
  25052. }
  25053. }
  25054. for (i = 0; i < strLength; ++i) {
  25055. t = types[i];
  25056. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  25057. types[i] = 'ON';
  25058. }
  25059. }
  25060. lastType = sor;
  25061. for (i = 0; i < strLength; ++i) {
  25062. t = types[i];
  25063. if (t === 'EN') {
  25064. types[i] = lastType === 'L' ? 'L' : 'EN';
  25065. } else if (t === 'R' || t === 'L') {
  25066. lastType = t;
  25067. }
  25068. }
  25069. for (i = 0; i < strLength; ++i) {
  25070. if (types[i] === 'ON') {
  25071. var end = findUnequal(types, i + 1, 'ON');
  25072. var before = sor;
  25073. if (i > 0) {
  25074. before = types[i - 1];
  25075. }
  25076. var after = eor;
  25077. if (end + 1 < strLength) {
  25078. after = types[end + 1];
  25079. }
  25080. if (before !== 'L') {
  25081. before = 'R';
  25082. }
  25083. if (after !== 'L') {
  25084. after = 'R';
  25085. }
  25086. if (before === after) {
  25087. setValues(types, i, end, before);
  25088. }
  25089. i = end - 1;
  25090. }
  25091. }
  25092. for (i = 0; i < strLength; ++i) {
  25093. if (types[i] === 'ON') {
  25094. types[i] = e;
  25095. }
  25096. }
  25097. for (i = 0; i < strLength; ++i) {
  25098. t = types[i];
  25099. if (isEven(levels[i])) {
  25100. if (t === 'R') {
  25101. levels[i] += 1;
  25102. } else if (t === 'AN' || t === 'EN') {
  25103. levels[i] += 2;
  25104. }
  25105. } else {
  25106. if (t === 'L' || t === 'AN' || t === 'EN') {
  25107. levels[i] += 1;
  25108. }
  25109. }
  25110. }
  25111. var highestLevel = -1;
  25112. var lowestOddLevel = 99;
  25113. var level;
  25114. for (i = 0, ii = levels.length; i < ii; ++i) {
  25115. level = levels[i];
  25116. if (highestLevel < level) {
  25117. highestLevel = level;
  25118. }
  25119. if (lowestOddLevel > level && isOdd(level)) {
  25120. lowestOddLevel = level;
  25121. }
  25122. }
  25123. for (level = highestLevel; level >= lowestOddLevel; --level) {
  25124. var start = -1;
  25125. for (i = 0, ii = levels.length; i < ii; ++i) {
  25126. if (levels[i] < level) {
  25127. if (start >= 0) {
  25128. reverseValues(chars, start, i);
  25129. start = -1;
  25130. }
  25131. } else if (start < 0) {
  25132. start = i;
  25133. }
  25134. }
  25135. if (start >= 0) {
  25136. reverseValues(chars, start, levels.length);
  25137. }
  25138. }
  25139. for (i = 0, ii = chars.length; i < ii; ++i) {
  25140. var ch = chars[i];
  25141. if (ch === '<' || ch === '>') {
  25142. chars[i] = '';
  25143. }
  25144. }
  25145. return createBidiText(chars.join(''), isLTR);
  25146. }
  25147. exports.bidi = bidi;
  25148. /***/ }),
  25149. /* 22 */
  25150. /***/ (function(module, exports, __w_pdfjs_require__) {
  25151. "use strict";
  25152. Object.defineProperty(exports, "__esModule", {
  25153. value: true
  25154. });
  25155. var 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'];
  25156. var 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'];
  25157. var 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'];
  25158. exports.ISOAdobeCharset = ISOAdobeCharset;
  25159. exports.ExpertCharset = ExpertCharset;
  25160. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  25161. /***/ }),
  25162. /* 23 */
  25163. /***/ (function(module, exports, __w_pdfjs_require__) {
  25164. "use strict";
  25165. Object.defineProperty(exports, "__esModule", {
  25166. value: true
  25167. });
  25168. exports.CMapFactory = exports.IdentityCMap = exports.CMap = undefined;
  25169. var _util = __w_pdfjs_require__(0);
  25170. var _primitives = __w_pdfjs_require__(1);
  25171. var _parser = __w_pdfjs_require__(5);
  25172. var _stream = __w_pdfjs_require__(2);
  25173. 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'];
  25174. var CMap = function CMapClosure() {
  25175. function CMap(builtInCMap) {
  25176. this.codespaceRanges = [[], [], [], []];
  25177. this.numCodespaceRanges = 0;
  25178. this._map = [];
  25179. this.name = '';
  25180. this.vertical = false;
  25181. this.useCMap = null;
  25182. this.builtInCMap = builtInCMap;
  25183. }
  25184. CMap.prototype = {
  25185. addCodespaceRange: function addCodespaceRange(n, low, high) {
  25186. this.codespaceRanges[n - 1].push(low, high);
  25187. this.numCodespaceRanges++;
  25188. },
  25189. mapCidRange: function mapCidRange(low, high, dstLow) {
  25190. while (low <= high) {
  25191. this._map[low++] = dstLow++;
  25192. }
  25193. },
  25194. mapBfRange: function mapBfRange(low, high, dstLow) {
  25195. var lastByte = dstLow.length - 1;
  25196. while (low <= high) {
  25197. this._map[low++] = dstLow;
  25198. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  25199. }
  25200. },
  25201. mapBfRangeToArray: function mapBfRangeToArray(low, high, array) {
  25202. var i = 0,
  25203. ii = array.length;
  25204. while (low <= high && i < ii) {
  25205. this._map[low] = array[i++];
  25206. ++low;
  25207. }
  25208. },
  25209. mapOne: function mapOne(src, dst) {
  25210. this._map[src] = dst;
  25211. },
  25212. lookup: function lookup(code) {
  25213. return this._map[code];
  25214. },
  25215. contains: function contains(code) {
  25216. return this._map[code] !== undefined;
  25217. },
  25218. forEach: function forEach(callback) {
  25219. var map = this._map;
  25220. var length = map.length;
  25221. if (length <= 0x10000) {
  25222. for (var i = 0; i < length; i++) {
  25223. if (map[i] !== undefined) {
  25224. callback(i, map[i]);
  25225. }
  25226. }
  25227. } else {
  25228. for (var _i in map) {
  25229. callback(_i, map[_i]);
  25230. }
  25231. }
  25232. },
  25233. charCodeOf: function charCodeOf(value) {
  25234. var map = this._map;
  25235. if (map.length <= 0x10000) {
  25236. return map.indexOf(value);
  25237. }
  25238. for (var charCode in map) {
  25239. if (map[charCode] === value) {
  25240. return charCode | 0;
  25241. }
  25242. }
  25243. return -1;
  25244. },
  25245. getMap: function getMap() {
  25246. return this._map;
  25247. },
  25248. readCharCode: function readCharCode(str, offset, out) {
  25249. var c = 0;
  25250. var codespaceRanges = this.codespaceRanges;
  25251. var codespaceRangesLen = this.codespaceRanges.length;
  25252. for (var n = 0; n < codespaceRangesLen; n++) {
  25253. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  25254. var codespaceRange = codespaceRanges[n];
  25255. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  25256. var low = codespaceRange[k++];
  25257. var high = codespaceRange[k++];
  25258. if (c >= low && c <= high) {
  25259. out.charcode = c;
  25260. out.length = n + 1;
  25261. return;
  25262. }
  25263. }
  25264. }
  25265. out.charcode = 0;
  25266. out.length = 1;
  25267. },
  25268. get length() {
  25269. return this._map.length;
  25270. },
  25271. get isIdentityCMap() {
  25272. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  25273. return false;
  25274. }
  25275. if (this._map.length !== 0x10000) {
  25276. return false;
  25277. }
  25278. for (var i = 0; i < 0x10000; i++) {
  25279. if (this._map[i] !== i) {
  25280. return false;
  25281. }
  25282. }
  25283. return true;
  25284. }
  25285. };
  25286. return CMap;
  25287. }();
  25288. var IdentityCMap = function IdentityCMapClosure() {
  25289. function IdentityCMap(vertical, n) {
  25290. CMap.call(this);
  25291. this.vertical = vertical;
  25292. this.addCodespaceRange(n, 0, 0xffff);
  25293. }
  25294. _util.Util.inherit(IdentityCMap, CMap, {});
  25295. IdentityCMap.prototype = {
  25296. addCodespaceRange: CMap.prototype.addCodespaceRange,
  25297. mapCidRange: function mapCidRange(low, high, dstLow) {
  25298. (0, _util.error)('should not call mapCidRange');
  25299. },
  25300. mapBfRange: function mapBfRange(low, high, dstLow) {
  25301. (0, _util.error)('should not call mapBfRange');
  25302. },
  25303. mapBfRangeToArray: function mapBfRangeToArray(low, high, array) {
  25304. (0, _util.error)('should not call mapBfRangeToArray');
  25305. },
  25306. mapOne: function mapOne(src, dst) {
  25307. (0, _util.error)('should not call mapCidOne');
  25308. },
  25309. lookup: function lookup(code) {
  25310. return (0, _util.isInt)(code) && code <= 0xffff ? code : undefined;
  25311. },
  25312. contains: function contains(code) {
  25313. return (0, _util.isInt)(code) && code <= 0xffff;
  25314. },
  25315. forEach: function forEach(callback) {
  25316. for (var i = 0; i <= 0xffff; i++) {
  25317. callback(i, i);
  25318. }
  25319. },
  25320. charCodeOf: function charCodeOf(value) {
  25321. return (0, _util.isInt)(value) && value <= 0xffff ? value : -1;
  25322. },
  25323. getMap: function getMap() {
  25324. var map = new Array(0x10000);
  25325. for (var i = 0; i <= 0xffff; i++) {
  25326. map[i] = i;
  25327. }
  25328. return map;
  25329. },
  25330. readCharCode: CMap.prototype.readCharCode,
  25331. get length() {
  25332. return 0x10000;
  25333. },
  25334. get isIdentityCMap() {
  25335. (0, _util.error)('should not access .isIdentityCMap');
  25336. }
  25337. };
  25338. return IdentityCMap;
  25339. }();
  25340. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  25341. function hexToInt(a, size) {
  25342. var n = 0;
  25343. for (var i = 0; i <= size; i++) {
  25344. n = n << 8 | a[i];
  25345. }
  25346. return n >>> 0;
  25347. }
  25348. function hexToStr(a, size) {
  25349. if (size === 1) {
  25350. return String.fromCharCode(a[0], a[1]);
  25351. }
  25352. if (size === 3) {
  25353. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  25354. }
  25355. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  25356. }
  25357. function addHex(a, b, size) {
  25358. var c = 0;
  25359. for (var i = size; i >= 0; i--) {
  25360. c += a[i] + b[i];
  25361. a[i] = c & 255;
  25362. c >>= 8;
  25363. }
  25364. }
  25365. function incHex(a, size) {
  25366. var c = 1;
  25367. for (var i = size; i >= 0 && c > 0; i--) {
  25368. c += a[i];
  25369. a[i] = c & 255;
  25370. c >>= 8;
  25371. }
  25372. }
  25373. var MAX_NUM_SIZE = 16;
  25374. var MAX_ENCODED_NUM_SIZE = 19;
  25375. function BinaryCMapStream(data) {
  25376. this.buffer = data;
  25377. this.pos = 0;
  25378. this.end = data.length;
  25379. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  25380. }
  25381. BinaryCMapStream.prototype = {
  25382. readByte: function readByte() {
  25383. if (this.pos >= this.end) {
  25384. return -1;
  25385. }
  25386. return this.buffer[this.pos++];
  25387. },
  25388. readNumber: function readNumber() {
  25389. var n = 0;
  25390. var last;
  25391. do {
  25392. var b = this.readByte();
  25393. if (b < 0) {
  25394. (0, _util.error)('unexpected EOF in bcmap');
  25395. }
  25396. last = !(b & 0x80);
  25397. n = n << 7 | b & 0x7F;
  25398. } while (!last);
  25399. return n;
  25400. },
  25401. readSigned: function readSigned() {
  25402. var n = this.readNumber();
  25403. return n & 1 ? ~(n >>> 1) : n >>> 1;
  25404. },
  25405. readHex: function readHex(num, size) {
  25406. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  25407. this.pos += size + 1;
  25408. },
  25409. readHexNumber: function readHexNumber(num, size) {
  25410. var last;
  25411. var stack = this.tmpBuf,
  25412. sp = 0;
  25413. do {
  25414. var b = this.readByte();
  25415. if (b < 0) {
  25416. (0, _util.error)('unexpected EOF in bcmap');
  25417. }
  25418. last = !(b & 0x80);
  25419. stack[sp++] = b & 0x7F;
  25420. } while (!last);
  25421. var i = size,
  25422. buffer = 0,
  25423. bufferSize = 0;
  25424. while (i >= 0) {
  25425. while (bufferSize < 8 && stack.length > 0) {
  25426. buffer = stack[--sp] << bufferSize | buffer;
  25427. bufferSize += 7;
  25428. }
  25429. num[i] = buffer & 255;
  25430. i--;
  25431. buffer >>= 8;
  25432. bufferSize -= 8;
  25433. }
  25434. },
  25435. readHexSigned: function readHexSigned(num, size) {
  25436. this.readHexNumber(num, size);
  25437. var sign = num[size] & 1 ? 255 : 0;
  25438. var c = 0;
  25439. for (var i = 0; i <= size; i++) {
  25440. c = (c & 1) << 8 | num[i];
  25441. num[i] = c >> 1 ^ sign;
  25442. }
  25443. },
  25444. readString: function readString() {
  25445. var len = this.readNumber();
  25446. var s = '';
  25447. for (var i = 0; i < len; i++) {
  25448. s += String.fromCharCode(this.readNumber());
  25449. }
  25450. return s;
  25451. }
  25452. };
  25453. function processBinaryCMap(data, cMap, extend) {
  25454. return new Promise(function (resolve, reject) {
  25455. var stream = new BinaryCMapStream(data);
  25456. var header = stream.readByte();
  25457. cMap.vertical = !!(header & 1);
  25458. var useCMap = null;
  25459. var start = new Uint8Array(MAX_NUM_SIZE);
  25460. var end = new Uint8Array(MAX_NUM_SIZE);
  25461. var char = new Uint8Array(MAX_NUM_SIZE);
  25462. var charCode = new Uint8Array(MAX_NUM_SIZE);
  25463. var tmp = new Uint8Array(MAX_NUM_SIZE);
  25464. var code;
  25465. var b;
  25466. while ((b = stream.readByte()) >= 0) {
  25467. var type = b >> 5;
  25468. if (type === 7) {
  25469. switch (b & 0x1F) {
  25470. case 0:
  25471. stream.readString();
  25472. break;
  25473. case 1:
  25474. useCMap = stream.readString();
  25475. break;
  25476. }
  25477. continue;
  25478. }
  25479. var sequence = !!(b & 0x10);
  25480. var dataSize = b & 15;
  25481. (0, _util.assert)(dataSize + 1 <= MAX_NUM_SIZE);
  25482. var ucs2DataSize = 1;
  25483. var subitemsCount = stream.readNumber();
  25484. var i;
  25485. switch (type) {
  25486. case 0:
  25487. stream.readHex(start, dataSize);
  25488. stream.readHexNumber(end, dataSize);
  25489. addHex(end, start, dataSize);
  25490. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  25491. for (i = 1; i < subitemsCount; i++) {
  25492. incHex(end, dataSize);
  25493. stream.readHexNumber(start, dataSize);
  25494. addHex(start, end, dataSize);
  25495. stream.readHexNumber(end, dataSize);
  25496. addHex(end, start, dataSize);
  25497. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  25498. }
  25499. break;
  25500. case 1:
  25501. stream.readHex(start, dataSize);
  25502. stream.readHexNumber(end, dataSize);
  25503. addHex(end, start, dataSize);
  25504. code = stream.readNumber();
  25505. for (i = 1; i < subitemsCount; i++) {
  25506. incHex(end, dataSize);
  25507. stream.readHexNumber(start, dataSize);
  25508. addHex(start, end, dataSize);
  25509. stream.readHexNumber(end, dataSize);
  25510. addHex(end, start, dataSize);
  25511. code = stream.readNumber();
  25512. }
  25513. break;
  25514. case 2:
  25515. stream.readHex(char, dataSize);
  25516. code = stream.readNumber();
  25517. cMap.mapOne(hexToInt(char, dataSize), code);
  25518. for (i = 1; i < subitemsCount; i++) {
  25519. incHex(char, dataSize);
  25520. if (!sequence) {
  25521. stream.readHexNumber(tmp, dataSize);
  25522. addHex(char, tmp, dataSize);
  25523. }
  25524. code = stream.readSigned() + (code + 1);
  25525. cMap.mapOne(hexToInt(char, dataSize), code);
  25526. }
  25527. break;
  25528. case 3:
  25529. stream.readHex(start, dataSize);
  25530. stream.readHexNumber(end, dataSize);
  25531. addHex(end, start, dataSize);
  25532. code = stream.readNumber();
  25533. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  25534. for (i = 1; i < subitemsCount; i++) {
  25535. incHex(end, dataSize);
  25536. if (!sequence) {
  25537. stream.readHexNumber(start, dataSize);
  25538. addHex(start, end, dataSize);
  25539. } else {
  25540. start.set(end);
  25541. }
  25542. stream.readHexNumber(end, dataSize);
  25543. addHex(end, start, dataSize);
  25544. code = stream.readNumber();
  25545. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  25546. }
  25547. break;
  25548. case 4:
  25549. stream.readHex(char, ucs2DataSize);
  25550. stream.readHex(charCode, dataSize);
  25551. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  25552. for (i = 1; i < subitemsCount; i++) {
  25553. incHex(char, ucs2DataSize);
  25554. if (!sequence) {
  25555. stream.readHexNumber(tmp, ucs2DataSize);
  25556. addHex(char, tmp, ucs2DataSize);
  25557. }
  25558. incHex(charCode, dataSize);
  25559. stream.readHexSigned(tmp, dataSize);
  25560. addHex(charCode, tmp, dataSize);
  25561. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  25562. }
  25563. break;
  25564. case 5:
  25565. stream.readHex(start, ucs2DataSize);
  25566. stream.readHexNumber(end, ucs2DataSize);
  25567. addHex(end, start, ucs2DataSize);
  25568. stream.readHex(charCode, dataSize);
  25569. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  25570. for (i = 1; i < subitemsCount; i++) {
  25571. incHex(end, ucs2DataSize);
  25572. if (!sequence) {
  25573. stream.readHexNumber(start, ucs2DataSize);
  25574. addHex(start, end, ucs2DataSize);
  25575. } else {
  25576. start.set(end);
  25577. }
  25578. stream.readHexNumber(end, ucs2DataSize);
  25579. addHex(end, start, ucs2DataSize);
  25580. stream.readHex(charCode, dataSize);
  25581. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  25582. }
  25583. break;
  25584. default:
  25585. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  25586. return;
  25587. }
  25588. }
  25589. if (useCMap) {
  25590. resolve(extend(useCMap));
  25591. return;
  25592. }
  25593. resolve(cMap);
  25594. });
  25595. }
  25596. function BinaryCMapReader() {}
  25597. BinaryCMapReader.prototype = { process: processBinaryCMap };
  25598. return BinaryCMapReader;
  25599. }();
  25600. var CMapFactory = function CMapFactoryClosure() {
  25601. function strToInt(str) {
  25602. var a = 0;
  25603. for (var i = 0; i < str.length; i++) {
  25604. a = a << 8 | str.charCodeAt(i);
  25605. }
  25606. return a >>> 0;
  25607. }
  25608. function expectString(obj) {
  25609. if (!(0, _util.isString)(obj)) {
  25610. (0, _util.error)('Malformed CMap: expected string.');
  25611. }
  25612. }
  25613. function expectInt(obj) {
  25614. if (!(0, _util.isInt)(obj)) {
  25615. (0, _util.error)('Malformed CMap: expected int.');
  25616. }
  25617. }
  25618. function parseBfChar(cMap, lexer) {
  25619. while (true) {
  25620. var obj = lexer.getObj();
  25621. if ((0, _primitives.isEOF)(obj)) {
  25622. break;
  25623. }
  25624. if ((0, _primitives.isCmd)(obj, 'endbfchar')) {
  25625. return;
  25626. }
  25627. expectString(obj);
  25628. var src = strToInt(obj);
  25629. obj = lexer.getObj();
  25630. expectString(obj);
  25631. var dst = obj;
  25632. cMap.mapOne(src, dst);
  25633. }
  25634. }
  25635. function parseBfRange(cMap, lexer) {
  25636. while (true) {
  25637. var obj = lexer.getObj();
  25638. if ((0, _primitives.isEOF)(obj)) {
  25639. break;
  25640. }
  25641. if ((0, _primitives.isCmd)(obj, 'endbfrange')) {
  25642. return;
  25643. }
  25644. expectString(obj);
  25645. var low = strToInt(obj);
  25646. obj = lexer.getObj();
  25647. expectString(obj);
  25648. var high = strToInt(obj);
  25649. obj = lexer.getObj();
  25650. if ((0, _util.isInt)(obj) || (0, _util.isString)(obj)) {
  25651. var dstLow = (0, _util.isInt)(obj) ? String.fromCharCode(obj) : obj;
  25652. cMap.mapBfRange(low, high, dstLow);
  25653. } else if ((0, _primitives.isCmd)(obj, '[')) {
  25654. obj = lexer.getObj();
  25655. var array = [];
  25656. while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) {
  25657. array.push(obj);
  25658. obj = lexer.getObj();
  25659. }
  25660. cMap.mapBfRangeToArray(low, high, array);
  25661. } else {
  25662. break;
  25663. }
  25664. }
  25665. (0, _util.error)('Invalid bf range.');
  25666. }
  25667. function parseCidChar(cMap, lexer) {
  25668. while (true) {
  25669. var obj = lexer.getObj();
  25670. if ((0, _primitives.isEOF)(obj)) {
  25671. break;
  25672. }
  25673. if ((0, _primitives.isCmd)(obj, 'endcidchar')) {
  25674. return;
  25675. }
  25676. expectString(obj);
  25677. var src = strToInt(obj);
  25678. obj = lexer.getObj();
  25679. expectInt(obj);
  25680. var dst = obj;
  25681. cMap.mapOne(src, dst);
  25682. }
  25683. }
  25684. function parseCidRange(cMap, lexer) {
  25685. while (true) {
  25686. var obj = lexer.getObj();
  25687. if ((0, _primitives.isEOF)(obj)) {
  25688. break;
  25689. }
  25690. if ((0, _primitives.isCmd)(obj, 'endcidrange')) {
  25691. return;
  25692. }
  25693. expectString(obj);
  25694. var low = strToInt(obj);
  25695. obj = lexer.getObj();
  25696. expectString(obj);
  25697. var high = strToInt(obj);
  25698. obj = lexer.getObj();
  25699. expectInt(obj);
  25700. var dstLow = obj;
  25701. cMap.mapCidRange(low, high, dstLow);
  25702. }
  25703. }
  25704. function parseCodespaceRange(cMap, lexer) {
  25705. while (true) {
  25706. var obj = lexer.getObj();
  25707. if ((0, _primitives.isEOF)(obj)) {
  25708. break;
  25709. }
  25710. if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) {
  25711. return;
  25712. }
  25713. if (!(0, _util.isString)(obj)) {
  25714. break;
  25715. }
  25716. var low = strToInt(obj);
  25717. obj = lexer.getObj();
  25718. if (!(0, _util.isString)(obj)) {
  25719. break;
  25720. }
  25721. var high = strToInt(obj);
  25722. cMap.addCodespaceRange(obj.length, low, high);
  25723. }
  25724. (0, _util.error)('Invalid codespace range.');
  25725. }
  25726. function parseWMode(cMap, lexer) {
  25727. var obj = lexer.getObj();
  25728. if ((0, _util.isInt)(obj)) {
  25729. cMap.vertical = !!obj;
  25730. }
  25731. }
  25732. function parseCMapName(cMap, lexer) {
  25733. var obj = lexer.getObj();
  25734. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  25735. cMap.name = obj.name;
  25736. }
  25737. }
  25738. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  25739. var previous;
  25740. var embededUseCMap;
  25741. objLoop: while (true) {
  25742. try {
  25743. var obj = lexer.getObj();
  25744. if ((0, _primitives.isEOF)(obj)) {
  25745. break;
  25746. } else if ((0, _primitives.isName)(obj)) {
  25747. if (obj.name === 'WMode') {
  25748. parseWMode(cMap, lexer);
  25749. } else if (obj.name === 'CMapName') {
  25750. parseCMapName(cMap, lexer);
  25751. }
  25752. previous = obj;
  25753. } else if ((0, _primitives.isCmd)(obj)) {
  25754. switch (obj.cmd) {
  25755. case 'endcmap':
  25756. break objLoop;
  25757. case 'usecmap':
  25758. if ((0, _primitives.isName)(previous)) {
  25759. embededUseCMap = previous.name;
  25760. }
  25761. break;
  25762. case 'begincodespacerange':
  25763. parseCodespaceRange(cMap, lexer);
  25764. break;
  25765. case 'beginbfchar':
  25766. parseBfChar(cMap, lexer);
  25767. break;
  25768. case 'begincidchar':
  25769. parseCidChar(cMap, lexer);
  25770. break;
  25771. case 'beginbfrange':
  25772. parseBfRange(cMap, lexer);
  25773. break;
  25774. case 'begincidrange':
  25775. parseCidRange(cMap, lexer);
  25776. break;
  25777. }
  25778. }
  25779. } catch (ex) {
  25780. if (ex instanceof _util.MissingDataException) {
  25781. throw ex;
  25782. }
  25783. (0, _util.warn)('Invalid cMap data: ' + ex);
  25784. continue;
  25785. }
  25786. }
  25787. if (!useCMap && embededUseCMap) {
  25788. useCMap = embededUseCMap;
  25789. }
  25790. if (useCMap) {
  25791. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  25792. }
  25793. return Promise.resolve(cMap);
  25794. }
  25795. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  25796. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  25797. cMap.useCMap = newCMap;
  25798. if (cMap.numCodespaceRanges === 0) {
  25799. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  25800. for (var i = 0; i < useCodespaceRanges.length; i++) {
  25801. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  25802. }
  25803. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  25804. }
  25805. cMap.useCMap.forEach(function (key, value) {
  25806. if (!cMap.contains(key)) {
  25807. cMap.mapOne(key, cMap.useCMap.lookup(key));
  25808. }
  25809. });
  25810. return cMap;
  25811. });
  25812. }
  25813. function createBuiltInCMap(name, fetchBuiltInCMap) {
  25814. if (name === 'Identity-H') {
  25815. return Promise.resolve(new IdentityCMap(false, 2));
  25816. } else if (name === 'Identity-V') {
  25817. return Promise.resolve(new IdentityCMap(true, 2));
  25818. }
  25819. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  25820. return Promise.reject(new Error('Unknown CMap name: ' + name));
  25821. }
  25822. (0, _util.assert)(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  25823. return fetchBuiltInCMap(name).then(function (data) {
  25824. var cMapData = data.cMapData,
  25825. compressionType = data.compressionType;
  25826. var cMap = new CMap(true);
  25827. if (compressionType === _util.CMapCompressionType.BINARY) {
  25828. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  25829. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  25830. });
  25831. }
  25832. (0, _util.assert)(compressionType === _util.CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  25833. var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  25834. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  25835. });
  25836. }
  25837. return {
  25838. create: function create(params) {
  25839. var encoding = params.encoding;
  25840. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  25841. var useCMap = params.useCMap;
  25842. if ((0, _primitives.isName)(encoding)) {
  25843. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  25844. } else if ((0, _primitives.isStream)(encoding)) {
  25845. var cMap = new CMap();
  25846. var lexer = new _parser.Lexer(encoding);
  25847. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  25848. if (parsedCMap.isIdentityCMap) {
  25849. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  25850. }
  25851. return parsedCMap;
  25852. });
  25853. }
  25854. return Promise.reject(new Error('Encoding required.'));
  25855. }
  25856. };
  25857. }();
  25858. exports.CMap = CMap;
  25859. exports.IdentityCMap = IdentityCMap;
  25860. exports.CMapFactory = CMapFactory;
  25861. /***/ }),
  25862. /* 24 */
  25863. /***/ (function(module, exports, __w_pdfjs_require__) {
  25864. "use strict";
  25865. Object.defineProperty(exports, "__esModule", {
  25866. value: true
  25867. });
  25868. exports.PDFDocument = exports.Page = undefined;
  25869. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  25870. var _util = __w_pdfjs_require__(0);
  25871. var _obj = __w_pdfjs_require__(16);
  25872. var _primitives = __w_pdfjs_require__(1);
  25873. var _stream = __w_pdfjs_require__(2);
  25874. var _evaluator = __w_pdfjs_require__(14);
  25875. var _annotation = __w_pdfjs_require__(20);
  25876. var _crypto = __w_pdfjs_require__(13);
  25877. var _parser = __w_pdfjs_require__(5);
  25878. var Page = function PageClosure() {
  25879. var DEFAULT_USER_UNIT = 1.0;
  25880. var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  25881. function isAnnotationRenderable(annotation, intent) {
  25882. return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
  25883. }
  25884. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  25885. this.pdfManager = pdfManager;
  25886. this.pageIndex = pageIndex;
  25887. this.pageDict = pageDict;
  25888. this.xref = xref;
  25889. this.ref = ref;
  25890. this.fontCache = fontCache;
  25891. this.builtInCMapCache = builtInCMapCache;
  25892. this.evaluatorOptions = pdfManager.evaluatorOptions;
  25893. this.resourcesPromise = null;
  25894. var uniquePrefix = 'p' + this.pageIndex + '_';
  25895. var idCounters = { obj: 0 };
  25896. this.idFactory = {
  25897. createObjId: function createObjId() {
  25898. return uniquePrefix + ++idCounters.obj;
  25899. }
  25900. };
  25901. }
  25902. Page.prototype = {
  25903. getPageProp: function Page_getPageProp(key) {
  25904. return this.pageDict.get(key);
  25905. },
  25906. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  25907. var dict = this.pageDict,
  25908. valueArray = null,
  25909. loopCount = 0;
  25910. var MAX_LOOP_COUNT = 100;
  25911. getArray = getArray || false;
  25912. while (dict) {
  25913. var value = getArray ? dict.getArray(key) : dict.get(key);
  25914. if (value !== undefined) {
  25915. if (!valueArray) {
  25916. valueArray = [];
  25917. }
  25918. valueArray.push(value);
  25919. }
  25920. if (++loopCount > MAX_LOOP_COUNT) {
  25921. (0, _util.warn)('getInheritedPageProp: maximum loop count exceeded for ' + key);
  25922. return valueArray ? valueArray[0] : undefined;
  25923. }
  25924. dict = dict.get('Parent');
  25925. }
  25926. if (!valueArray) {
  25927. return undefined;
  25928. }
  25929. if (valueArray.length === 1 || !(0, _primitives.isDict)(valueArray[0])) {
  25930. return valueArray[0];
  25931. }
  25932. return _primitives.Dict.merge(this.xref, valueArray);
  25933. },
  25934. get content() {
  25935. return this.getPageProp('Contents');
  25936. },
  25937. get resources() {
  25938. return (0, _util.shadow)(this, 'resources', this.getInheritedPageProp('Resources') || _primitives.Dict.empty);
  25939. },
  25940. get mediaBox() {
  25941. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  25942. if (!(0, _util.isArray)(mediaBox) || mediaBox.length !== 4) {
  25943. return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  25944. }
  25945. return (0, _util.shadow)(this, 'mediaBox', mediaBox);
  25946. },
  25947. get cropBox() {
  25948. var cropBox = this.getInheritedPageProp('CropBox', true);
  25949. if (!(0, _util.isArray)(cropBox) || cropBox.length !== 4) {
  25950. return (0, _util.shadow)(this, 'cropBox', this.mediaBox);
  25951. }
  25952. return (0, _util.shadow)(this, 'cropBox', cropBox);
  25953. },
  25954. get userUnit() {
  25955. var obj = this.getPageProp('UserUnit');
  25956. if (!(0, _util.isNum)(obj) || obj <= 0) {
  25957. obj = DEFAULT_USER_UNIT;
  25958. }
  25959. return (0, _util.shadow)(this, 'userUnit', obj);
  25960. },
  25961. get view() {
  25962. var mediaBox = this.mediaBox,
  25963. cropBox = this.cropBox;
  25964. if (mediaBox === cropBox) {
  25965. return (0, _util.shadow)(this, 'view', mediaBox);
  25966. }
  25967. var intersection = _util.Util.intersect(cropBox, mediaBox);
  25968. return (0, _util.shadow)(this, 'view', intersection || mediaBox);
  25969. },
  25970. get rotate() {
  25971. var rotate = this.getInheritedPageProp('Rotate') || 0;
  25972. if (rotate % 90 !== 0) {
  25973. rotate = 0;
  25974. } else if (rotate >= 360) {
  25975. rotate = rotate % 360;
  25976. } else if (rotate < 0) {
  25977. rotate = (rotate % 360 + 360) % 360;
  25978. }
  25979. return (0, _util.shadow)(this, 'rotate', rotate);
  25980. },
  25981. getContentStream: function Page_getContentStream() {
  25982. var content = this.content;
  25983. var stream;
  25984. if ((0, _util.isArray)(content)) {
  25985. var xref = this.xref;
  25986. var i,
  25987. n = content.length;
  25988. var streams = [];
  25989. for (i = 0; i < n; ++i) {
  25990. streams.push(xref.fetchIfRef(content[i]));
  25991. }
  25992. stream = new _stream.StreamsSequenceStream(streams);
  25993. } else if ((0, _primitives.isStream)(content)) {
  25994. stream = content;
  25995. } else {
  25996. stream = new _stream.NullStream();
  25997. }
  25998. return stream;
  25999. },
  26000. loadResources: function Page_loadResources(keys) {
  26001. var _this = this;
  26002. if (!this.resourcesPromise) {
  26003. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  26004. }
  26005. return this.resourcesPromise.then(function () {
  26006. var objectLoader = new _obj.ObjectLoader(_this.resources.map, keys, _this.xref);
  26007. return objectLoader.load();
  26008. });
  26009. },
  26010. getOperatorList: function getOperatorList(_ref) {
  26011. var _this2 = this;
  26012. var handler = _ref.handler,
  26013. task = _ref.task,
  26014. intent = _ref.intent,
  26015. renderInteractiveForms = _ref.renderInteractiveForms;
  26016. var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
  26017. var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
  26018. var partialEvaluator = new _evaluator.PartialEvaluator({
  26019. pdfManager: this.pdfManager,
  26020. xref: this.xref,
  26021. handler: handler,
  26022. pageIndex: this.pageIndex,
  26023. idFactory: this.idFactory,
  26024. fontCache: this.fontCache,
  26025. builtInCMapCache: this.builtInCMapCache,
  26026. options: this.evaluatorOptions
  26027. });
  26028. var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  26029. var pageListPromise = dataPromises.then(function (_ref2) {
  26030. var _ref3 = _slicedToArray(_ref2, 1),
  26031. contentStream = _ref3[0];
  26032. var opList = new _evaluator.OperatorList(intent, handler, _this2.pageIndex);
  26033. handler.send('StartRenderPage', {
  26034. transparency: partialEvaluator.hasBlendModes(_this2.resources),
  26035. pageIndex: _this2.pageIndex,
  26036. intent: intent
  26037. });
  26038. return partialEvaluator.getOperatorList({
  26039. stream: contentStream,
  26040. task: task,
  26041. resources: _this2.resources,
  26042. operatorList: opList
  26043. }).then(function () {
  26044. return opList;
  26045. });
  26046. });
  26047. var annotationsPromise = this.pdfManager.ensure(this, 'annotations');
  26048. return Promise.all([pageListPromise, annotationsPromise]).then(function (_ref4) {
  26049. var _ref5 = _slicedToArray(_ref4, 2),
  26050. pageOpList = _ref5[0],
  26051. annotations = _ref5[1];
  26052. if (annotations.length === 0) {
  26053. pageOpList.flush(true);
  26054. return pageOpList;
  26055. }
  26056. var i,
  26057. ii,
  26058. opListPromises = [];
  26059. for (i = 0, ii = annotations.length; i < ii; i++) {
  26060. if (isAnnotationRenderable(annotations[i], intent)) {
  26061. opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
  26062. }
  26063. }
  26064. return Promise.all(opListPromises).then(function (opLists) {
  26065. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  26066. for (i = 0, ii = opLists.length; i < ii; i++) {
  26067. pageOpList.addOpList(opLists[i]);
  26068. }
  26069. pageOpList.addOp(_util.OPS.endAnnotations, []);
  26070. pageOpList.flush(true);
  26071. return pageOpList;
  26072. });
  26073. });
  26074. },
  26075. extractTextContent: function extractTextContent(_ref6) {
  26076. var _this3 = this;
  26077. var handler = _ref6.handler,
  26078. task = _ref6.task,
  26079. normalizeWhitespace = _ref6.normalizeWhitespace,
  26080. combineTextItems = _ref6.combineTextItems;
  26081. var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
  26082. var resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']);
  26083. var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  26084. return dataPromises.then(function (_ref7) {
  26085. var _ref8 = _slicedToArray(_ref7, 1),
  26086. contentStream = _ref8[0];
  26087. var partialEvaluator = new _evaluator.PartialEvaluator({
  26088. pdfManager: _this3.pdfManager,
  26089. xref: _this3.xref,
  26090. handler: handler,
  26091. pageIndex: _this3.pageIndex,
  26092. idFactory: _this3.idFactory,
  26093. fontCache: _this3.fontCache,
  26094. builtInCMapCache: _this3.builtInCMapCache,
  26095. options: _this3.evaluatorOptions
  26096. });
  26097. return partialEvaluator.getTextContent({
  26098. stream: contentStream,
  26099. task: task,
  26100. resources: _this3.resources,
  26101. normalizeWhitespace: normalizeWhitespace,
  26102. combineTextItems: combineTextItems
  26103. });
  26104. });
  26105. },
  26106. getAnnotationsData: function Page_getAnnotationsData(intent) {
  26107. var annotations = this.annotations;
  26108. var annotationsData = [];
  26109. for (var i = 0, n = annotations.length; i < n; ++i) {
  26110. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  26111. annotationsData.push(annotations[i].data);
  26112. }
  26113. }
  26114. return annotationsData;
  26115. },
  26116. get annotations() {
  26117. var annotations = [];
  26118. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  26119. var annotationFactory = new _annotation.AnnotationFactory();
  26120. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  26121. var annotationRef = annotationRefs[i];
  26122. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  26123. if (annotation) {
  26124. annotations.push(annotation);
  26125. }
  26126. }
  26127. return (0, _util.shadow)(this, 'annotations', annotations);
  26128. }
  26129. };
  26130. return Page;
  26131. }();
  26132. var PDFDocument = function PDFDocumentClosure() {
  26133. var FINGERPRINT_FIRST_BYTES = 1024;
  26134. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  26135. function PDFDocument(pdfManager, arg) {
  26136. var stream;
  26137. if ((0, _primitives.isStream)(arg)) {
  26138. stream = arg;
  26139. } else if ((0, _util.isArrayBuffer)(arg)) {
  26140. stream = new _stream.Stream(arg);
  26141. } else {
  26142. (0, _util.error)('PDFDocument: Unknown argument type');
  26143. }
  26144. (0, _util.assert)(stream.length > 0, 'stream must have data');
  26145. this.pdfManager = pdfManager;
  26146. this.stream = stream;
  26147. this.xref = new _obj.XRef(stream, pdfManager);
  26148. }
  26149. function find(stream, needle, limit, backwards) {
  26150. var pos = stream.pos;
  26151. var end = stream.end;
  26152. var strBuf = [];
  26153. if (pos + limit > end) {
  26154. limit = end - pos;
  26155. }
  26156. for (var n = 0; n < limit; ++n) {
  26157. strBuf.push(String.fromCharCode(stream.getByte()));
  26158. }
  26159. var str = strBuf.join('');
  26160. stream.pos = pos;
  26161. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  26162. if (index === -1) {
  26163. return false;
  26164. }
  26165. stream.pos += index;
  26166. return true;
  26167. }
  26168. var DocumentInfoValidators = {
  26169. get entries() {
  26170. return (0, _util.shadow)(this, 'entries', {
  26171. Title: _util.isString,
  26172. Author: _util.isString,
  26173. Subject: _util.isString,
  26174. Keywords: _util.isString,
  26175. Creator: _util.isString,
  26176. Producer: _util.isString,
  26177. CreationDate: _util.isString,
  26178. ModDate: _util.isString,
  26179. Trapped: _primitives.isName
  26180. });
  26181. }
  26182. };
  26183. PDFDocument.prototype = {
  26184. parse: function PDFDocument_parse(recoveryMode) {
  26185. this.setup(recoveryMode);
  26186. var version = this.catalog.catDict.get('Version');
  26187. if ((0, _primitives.isName)(version)) {
  26188. this.pdfFormatVersion = version.name;
  26189. }
  26190. try {
  26191. this.acroForm = this.catalog.catDict.get('AcroForm');
  26192. if (this.acroForm) {
  26193. this.xfa = this.acroForm.get('XFA');
  26194. var fields = this.acroForm.get('Fields');
  26195. if ((!fields || !(0, _util.isArray)(fields) || fields.length === 0) && !this.xfa) {
  26196. this.acroForm = null;
  26197. }
  26198. }
  26199. } catch (ex) {
  26200. if (ex instanceof _util.MissingDataException) {
  26201. throw ex;
  26202. }
  26203. (0, _util.info)('Something wrong with AcroForm entry');
  26204. this.acroForm = null;
  26205. }
  26206. },
  26207. get linearization() {
  26208. var linearization = null;
  26209. if (this.stream.length) {
  26210. try {
  26211. linearization = _parser.Linearization.create(this.stream);
  26212. } catch (err) {
  26213. if (err instanceof _util.MissingDataException) {
  26214. throw err;
  26215. }
  26216. (0, _util.info)(err);
  26217. }
  26218. }
  26219. return (0, _util.shadow)(this, 'linearization', linearization);
  26220. },
  26221. get startXRef() {
  26222. var stream = this.stream;
  26223. var startXRef = 0;
  26224. var linearization = this.linearization;
  26225. if (linearization) {
  26226. stream.reset();
  26227. if (find(stream, 'endobj', 1024)) {
  26228. startXRef = stream.pos + 6;
  26229. }
  26230. } else {
  26231. var step = 1024;
  26232. var found = false,
  26233. pos = stream.end;
  26234. while (!found && pos > 0) {
  26235. pos -= step - 'startxref'.length;
  26236. if (pos < 0) {
  26237. pos = 0;
  26238. }
  26239. stream.pos = pos;
  26240. found = find(stream, 'startxref', step, true);
  26241. }
  26242. if (found) {
  26243. stream.skip(9);
  26244. var ch;
  26245. do {
  26246. ch = stream.getByte();
  26247. } while ((0, _util.isSpace)(ch));
  26248. var str = '';
  26249. while (ch >= 0x20 && ch <= 0x39) {
  26250. str += String.fromCharCode(ch);
  26251. ch = stream.getByte();
  26252. }
  26253. startXRef = parseInt(str, 10);
  26254. if (isNaN(startXRef)) {
  26255. startXRef = 0;
  26256. }
  26257. }
  26258. }
  26259. return (0, _util.shadow)(this, 'startXRef', startXRef);
  26260. },
  26261. get mainXRefEntriesOffset() {
  26262. var mainXRefEntriesOffset = 0;
  26263. var linearization = this.linearization;
  26264. if (linearization) {
  26265. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  26266. }
  26267. return (0, _util.shadow)(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  26268. },
  26269. checkHeader: function PDFDocument_checkHeader() {
  26270. var stream = this.stream;
  26271. stream.reset();
  26272. if (find(stream, '%PDF-', 1024)) {
  26273. stream.moveStart();
  26274. var MAX_VERSION_LENGTH = 12;
  26275. var version = '',
  26276. ch;
  26277. while ((ch = stream.getByte()) > 0x20) {
  26278. if (version.length >= MAX_VERSION_LENGTH) {
  26279. break;
  26280. }
  26281. version += String.fromCharCode(ch);
  26282. }
  26283. if (!this.pdfFormatVersion) {
  26284. this.pdfFormatVersion = version.substring(5);
  26285. }
  26286. return;
  26287. }
  26288. },
  26289. parseStartXRef: function PDFDocument_parseStartXRef() {
  26290. var startXRef = this.startXRef;
  26291. this.xref.setStartXRef(startXRef);
  26292. },
  26293. setup: function PDFDocument_setup(recoveryMode) {
  26294. var _this4 = this;
  26295. this.xref.parse(recoveryMode);
  26296. var pageFactory = {
  26297. createPage: function createPage(pageIndex, dict, ref, fontCache, builtInCMapCache) {
  26298. return new Page(_this4.pdfManager, _this4.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  26299. }
  26300. };
  26301. this.catalog = new _obj.Catalog(this.pdfManager, this.xref, pageFactory);
  26302. },
  26303. get numPages() {
  26304. var linearization = this.linearization;
  26305. var num = linearization ? linearization.numPages : this.catalog.numPages;
  26306. return (0, _util.shadow)(this, 'numPages', num);
  26307. },
  26308. get documentInfo() {
  26309. var docInfo = {
  26310. PDFFormatVersion: this.pdfFormatVersion,
  26311. IsAcroFormPresent: !!this.acroForm,
  26312. IsXFAPresent: !!this.xfa
  26313. };
  26314. var infoDict;
  26315. try {
  26316. infoDict = this.xref.trailer.get('Info');
  26317. } catch (err) {
  26318. if (err instanceof _util.MissingDataException) {
  26319. throw err;
  26320. }
  26321. (0, _util.info)('The document information dictionary is invalid.');
  26322. }
  26323. if (infoDict) {
  26324. var validEntries = DocumentInfoValidators.entries;
  26325. for (var key in validEntries) {
  26326. if (infoDict.has(key)) {
  26327. var value = infoDict.get(key);
  26328. if (validEntries[key](value)) {
  26329. docInfo[key] = typeof value !== 'string' ? value : (0, _util.stringToPDFString)(value);
  26330. } else {
  26331. (0, _util.info)('Bad value in document info for "' + key + '"');
  26332. }
  26333. }
  26334. }
  26335. }
  26336. return (0, _util.shadow)(this, 'documentInfo', docInfo);
  26337. },
  26338. get fingerprint() {
  26339. var xref = this.xref,
  26340. hash,
  26341. fileID = '';
  26342. var idArray = xref.trailer.get('ID');
  26343. if (idArray && (0, _util.isArray)(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  26344. hash = (0, _util.stringToBytes)(idArray[0]);
  26345. } else {
  26346. if (this.stream.ensureRange) {
  26347. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  26348. }
  26349. hash = (0, _crypto.calculateMD5)(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  26350. }
  26351. for (var i = 0, n = hash.length; i < n; i++) {
  26352. var hex = hash[i].toString(16);
  26353. fileID += hex.length === 1 ? '0' + hex : hex;
  26354. }
  26355. return (0, _util.shadow)(this, 'fingerprint', fileID);
  26356. },
  26357. getPage: function PDFDocument_getPage(pageIndex) {
  26358. return this.catalog.getPage(pageIndex);
  26359. },
  26360. cleanup: function PDFDocument_cleanup() {
  26361. return this.catalog.cleanup();
  26362. }
  26363. };
  26364. return PDFDocument;
  26365. }();
  26366. exports.Page = Page;
  26367. exports.PDFDocument = PDFDocument;
  26368. /***/ }),
  26369. /* 25 */
  26370. /***/ (function(module, exports, __w_pdfjs_require__) {
  26371. "use strict";
  26372. Object.defineProperty(exports, "__esModule", {
  26373. value: true
  26374. });
  26375. exports.FontRendererFactory = undefined;
  26376. var _util = __w_pdfjs_require__(0);
  26377. var _cff_parser = __w_pdfjs_require__(11);
  26378. var _glyphlist = __w_pdfjs_require__(7);
  26379. var _encodings = __w_pdfjs_require__(4);
  26380. var _stream = __w_pdfjs_require__(2);
  26381. var FontRendererFactory = function FontRendererFactoryClosure() {
  26382. function getLong(data, offset) {
  26383. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  26384. }
  26385. function getUshort(data, offset) {
  26386. return data[offset] << 8 | data[offset + 1];
  26387. }
  26388. function parseCmap(data, start, end) {
  26389. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  26390. var format = getUshort(data, start + offset);
  26391. var ranges, p, i;
  26392. if (format === 4) {
  26393. getUshort(data, start + offset + 2);
  26394. var segCount = getUshort(data, start + offset + 6) >> 1;
  26395. p = start + offset + 14;
  26396. ranges = [];
  26397. for (i = 0; i < segCount; i++, p += 2) {
  26398. ranges[i] = { end: getUshort(data, p) };
  26399. }
  26400. p += 2;
  26401. for (i = 0; i < segCount; i++, p += 2) {
  26402. ranges[i].start = getUshort(data, p);
  26403. }
  26404. for (i = 0; i < segCount; i++, p += 2) {
  26405. ranges[i].idDelta = getUshort(data, p);
  26406. }
  26407. for (i = 0; i < segCount; i++, p += 2) {
  26408. var idOffset = getUshort(data, p);
  26409. if (idOffset === 0) {
  26410. continue;
  26411. }
  26412. ranges[i].ids = [];
  26413. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  26414. ranges[i].ids[j] = getUshort(data, p + idOffset);
  26415. idOffset += 2;
  26416. }
  26417. }
  26418. return ranges;
  26419. } else if (format === 12) {
  26420. getLong(data, start + offset + 4);
  26421. var groups = getLong(data, start + offset + 12);
  26422. p = start + offset + 16;
  26423. ranges = [];
  26424. for (i = 0; i < groups; i++) {
  26425. ranges.push({
  26426. start: getLong(data, p),
  26427. end: getLong(data, p + 4),
  26428. idDelta: getLong(data, p + 8) - getLong(data, p)
  26429. });
  26430. p += 12;
  26431. }
  26432. return ranges;
  26433. }
  26434. (0, _util.error)('not supported cmap: ' + format);
  26435. }
  26436. function parseCff(data, start, end, seacAnalysisEnabled) {
  26437. var properties = {};
  26438. var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  26439. var cff = parser.parse();
  26440. return {
  26441. glyphs: cff.charStrings.objects,
  26442. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  26443. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  26444. };
  26445. }
  26446. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  26447. var itemSize, itemDecode;
  26448. if (isGlyphLocationsLong) {
  26449. itemSize = 4;
  26450. itemDecode = function fontItemDecodeLong(data, offset) {
  26451. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  26452. };
  26453. } else {
  26454. itemSize = 2;
  26455. itemDecode = function fontItemDecode(data, offset) {
  26456. return data[offset] << 9 | data[offset + 1] << 1;
  26457. };
  26458. }
  26459. var glyphs = [];
  26460. var startOffset = itemDecode(loca, 0);
  26461. for (var j = itemSize; j < loca.length; j += itemSize) {
  26462. var endOffset = itemDecode(loca, j);
  26463. glyphs.push(glyf.subarray(startOffset, endOffset));
  26464. startOffset = endOffset;
  26465. }
  26466. return glyphs;
  26467. }
  26468. function lookupCmap(ranges, unicode) {
  26469. var code = unicode.charCodeAt(0),
  26470. gid = 0;
  26471. var l = 0,
  26472. r = ranges.length - 1;
  26473. while (l < r) {
  26474. var c = l + r + 1 >> 1;
  26475. if (code < ranges[c].start) {
  26476. r = c - 1;
  26477. } else {
  26478. l = c;
  26479. }
  26480. }
  26481. if (ranges[l].start <= code && code <= ranges[l].end) {
  26482. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  26483. }
  26484. return {
  26485. charCode: code,
  26486. glyphId: gid
  26487. };
  26488. }
  26489. function compileGlyf(code, cmds, font) {
  26490. function moveTo(x, y) {
  26491. cmds.push({
  26492. cmd: 'moveTo',
  26493. args: [x, y]
  26494. });
  26495. }
  26496. function lineTo(x, y) {
  26497. cmds.push({
  26498. cmd: 'lineTo',
  26499. args: [x, y]
  26500. });
  26501. }
  26502. function quadraticCurveTo(xa, ya, x, y) {
  26503. cmds.push({
  26504. cmd: 'quadraticCurveTo',
  26505. args: [xa, ya, x, y]
  26506. });
  26507. }
  26508. var i = 0;
  26509. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  26510. var flags;
  26511. var x = 0,
  26512. y = 0;
  26513. i += 10;
  26514. if (numberOfContours < 0) {
  26515. do {
  26516. flags = code[i] << 8 | code[i + 1];
  26517. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  26518. i += 4;
  26519. var arg1, arg2;
  26520. if (flags & 0x01) {
  26521. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  26522. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  26523. i += 4;
  26524. } else {
  26525. arg1 = code[i++];
  26526. arg2 = code[i++];
  26527. }
  26528. if (flags & 0x02) {
  26529. x = arg1;
  26530. y = arg2;
  26531. } else {
  26532. x = 0;
  26533. y = 0;
  26534. }
  26535. var scaleX = 1,
  26536. scaleY = 1,
  26537. scale01 = 0,
  26538. scale10 = 0;
  26539. if (flags & 0x08) {
  26540. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  26541. i += 2;
  26542. } else if (flags & 0x40) {
  26543. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  26544. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  26545. i += 4;
  26546. } else if (flags & 0x80) {
  26547. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  26548. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  26549. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  26550. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  26551. i += 8;
  26552. }
  26553. var subglyph = font.glyphs[glyphIndex];
  26554. if (subglyph) {
  26555. cmds.push({ cmd: 'save' });
  26556. cmds.push({
  26557. cmd: 'transform',
  26558. args: [scaleX, scale01, scale10, scaleY, x, y]
  26559. });
  26560. compileGlyf(subglyph, cmds, font);
  26561. cmds.push({ cmd: 'restore' });
  26562. }
  26563. } while (flags & 0x20);
  26564. } else {
  26565. var endPtsOfContours = [];
  26566. var j, jj;
  26567. for (j = 0; j < numberOfContours; j++) {
  26568. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  26569. i += 2;
  26570. }
  26571. var instructionLength = code[i] << 8 | code[i + 1];
  26572. i += 2 + instructionLength;
  26573. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  26574. var points = [];
  26575. while (points.length < numberOfPoints) {
  26576. flags = code[i++];
  26577. var repeat = 1;
  26578. if (flags & 0x08) {
  26579. repeat += code[i++];
  26580. }
  26581. while (repeat-- > 0) {
  26582. points.push({ flags: flags });
  26583. }
  26584. }
  26585. for (j = 0; j < numberOfPoints; j++) {
  26586. switch (points[j].flags & 0x12) {
  26587. case 0x00:
  26588. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  26589. i += 2;
  26590. break;
  26591. case 0x02:
  26592. x -= code[i++];
  26593. break;
  26594. case 0x12:
  26595. x += code[i++];
  26596. break;
  26597. }
  26598. points[j].x = x;
  26599. }
  26600. for (j = 0; j < numberOfPoints; j++) {
  26601. switch (points[j].flags & 0x24) {
  26602. case 0x00:
  26603. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  26604. i += 2;
  26605. break;
  26606. case 0x04:
  26607. y -= code[i++];
  26608. break;
  26609. case 0x24:
  26610. y += code[i++];
  26611. break;
  26612. }
  26613. points[j].y = y;
  26614. }
  26615. var startPoint = 0;
  26616. for (i = 0; i < numberOfContours; i++) {
  26617. var endPoint = endPtsOfContours[i];
  26618. var contour = points.slice(startPoint, endPoint + 1);
  26619. if (contour[0].flags & 1) {
  26620. contour.push(contour[0]);
  26621. } else if (contour[contour.length - 1].flags & 1) {
  26622. contour.unshift(contour[contour.length - 1]);
  26623. } else {
  26624. var p = {
  26625. flags: 1,
  26626. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  26627. y: (contour[0].y + contour[contour.length - 1].y) / 2
  26628. };
  26629. contour.unshift(p);
  26630. contour.push(p);
  26631. }
  26632. moveTo(contour[0].x, contour[0].y);
  26633. for (j = 1, jj = contour.length; j < jj; j++) {
  26634. if (contour[j].flags & 1) {
  26635. lineTo(contour[j].x, contour[j].y);
  26636. } else if (contour[j + 1].flags & 1) {
  26637. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  26638. j++;
  26639. } else {
  26640. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  26641. }
  26642. }
  26643. startPoint = endPoint + 1;
  26644. }
  26645. }
  26646. }
  26647. function compileCharString(code, cmds, font) {
  26648. var stack = [];
  26649. var x = 0,
  26650. y = 0;
  26651. var stems = 0;
  26652. function moveTo(x, y) {
  26653. cmds.push({
  26654. cmd: 'moveTo',
  26655. args: [x, y]
  26656. });
  26657. }
  26658. function lineTo(x, y) {
  26659. cmds.push({
  26660. cmd: 'lineTo',
  26661. args: [x, y]
  26662. });
  26663. }
  26664. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  26665. cmds.push({
  26666. cmd: 'bezierCurveTo',
  26667. args: [x1, y1, x2, y2, x, y]
  26668. });
  26669. }
  26670. function parse(code) {
  26671. var i = 0;
  26672. while (i < code.length) {
  26673. var stackClean = false;
  26674. var v = code[i++];
  26675. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  26676. switch (v) {
  26677. case 1:
  26678. stems += stack.length >> 1;
  26679. stackClean = true;
  26680. break;
  26681. case 3:
  26682. stems += stack.length >> 1;
  26683. stackClean = true;
  26684. break;
  26685. case 4:
  26686. y += stack.pop();
  26687. moveTo(x, y);
  26688. stackClean = true;
  26689. break;
  26690. case 5:
  26691. while (stack.length > 0) {
  26692. x += stack.shift();
  26693. y += stack.shift();
  26694. lineTo(x, y);
  26695. }
  26696. break;
  26697. case 6:
  26698. while (stack.length > 0) {
  26699. x += stack.shift();
  26700. lineTo(x, y);
  26701. if (stack.length === 0) {
  26702. break;
  26703. }
  26704. y += stack.shift();
  26705. lineTo(x, y);
  26706. }
  26707. break;
  26708. case 7:
  26709. while (stack.length > 0) {
  26710. y += stack.shift();
  26711. lineTo(x, y);
  26712. if (stack.length === 0) {
  26713. break;
  26714. }
  26715. x += stack.shift();
  26716. lineTo(x, y);
  26717. }
  26718. break;
  26719. case 8:
  26720. while (stack.length > 0) {
  26721. xa = x + stack.shift();
  26722. ya = y + stack.shift();
  26723. xb = xa + stack.shift();
  26724. yb = ya + stack.shift();
  26725. x = xb + stack.shift();
  26726. y = yb + stack.shift();
  26727. bezierCurveTo(xa, ya, xb, yb, x, y);
  26728. }
  26729. break;
  26730. case 10:
  26731. n = stack.pop() + font.subrsBias;
  26732. subrCode = font.subrs[n];
  26733. if (subrCode) {
  26734. parse(subrCode);
  26735. }
  26736. break;
  26737. case 11:
  26738. return;
  26739. case 12:
  26740. v = code[i++];
  26741. switch (v) {
  26742. case 34:
  26743. xa = x + stack.shift();
  26744. xb = xa + stack.shift();
  26745. y1 = y + stack.shift();
  26746. x = xb + stack.shift();
  26747. bezierCurveTo(xa, y, xb, y1, x, y1);
  26748. xa = x + stack.shift();
  26749. xb = xa + stack.shift();
  26750. x = xb + stack.shift();
  26751. bezierCurveTo(xa, y1, xb, y, x, y);
  26752. break;
  26753. case 35:
  26754. xa = x + stack.shift();
  26755. ya = y + stack.shift();
  26756. xb = xa + stack.shift();
  26757. yb = ya + stack.shift();
  26758. x = xb + stack.shift();
  26759. y = yb + stack.shift();
  26760. bezierCurveTo(xa, ya, xb, yb, x, y);
  26761. xa = x + stack.shift();
  26762. ya = y + stack.shift();
  26763. xb = xa + stack.shift();
  26764. yb = ya + stack.shift();
  26765. x = xb + stack.shift();
  26766. y = yb + stack.shift();
  26767. bezierCurveTo(xa, ya, xb, yb, x, y);
  26768. stack.pop();
  26769. break;
  26770. case 36:
  26771. xa = x + stack.shift();
  26772. y1 = y + stack.shift();
  26773. xb = xa + stack.shift();
  26774. y2 = y1 + stack.shift();
  26775. x = xb + stack.shift();
  26776. bezierCurveTo(xa, y1, xb, y2, x, y2);
  26777. xa = x + stack.shift();
  26778. xb = xa + stack.shift();
  26779. y3 = y2 + stack.shift();
  26780. x = xb + stack.shift();
  26781. bezierCurveTo(xa, y2, xb, y3, x, y);
  26782. break;
  26783. case 37:
  26784. var x0 = x,
  26785. y0 = y;
  26786. xa = x + stack.shift();
  26787. ya = y + stack.shift();
  26788. xb = xa + stack.shift();
  26789. yb = ya + stack.shift();
  26790. x = xb + stack.shift();
  26791. y = yb + stack.shift();
  26792. bezierCurveTo(xa, ya, xb, yb, x, y);
  26793. xa = x + stack.shift();
  26794. ya = y + stack.shift();
  26795. xb = xa + stack.shift();
  26796. yb = ya + stack.shift();
  26797. x = xb;
  26798. y = yb;
  26799. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  26800. x += stack.shift();
  26801. } else {
  26802. y += stack.shift();
  26803. }
  26804. bezierCurveTo(xa, ya, xb, yb, x, y);
  26805. break;
  26806. default:
  26807. (0, _util.error)('unknown operator: 12 ' + v);
  26808. }
  26809. break;
  26810. case 14:
  26811. if (stack.length >= 4) {
  26812. var achar = stack.pop();
  26813. var bchar = stack.pop();
  26814. y = stack.pop();
  26815. x = stack.pop();
  26816. cmds.push({ cmd: 'save' });
  26817. cmds.push({
  26818. cmd: 'translate',
  26819. args: [x, y]
  26820. });
  26821. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  26822. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  26823. cmds.push({ cmd: 'restore' });
  26824. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  26825. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  26826. }
  26827. return;
  26828. case 18:
  26829. stems += stack.length >> 1;
  26830. stackClean = true;
  26831. break;
  26832. case 19:
  26833. stems += stack.length >> 1;
  26834. i += stems + 7 >> 3;
  26835. stackClean = true;
  26836. break;
  26837. case 20:
  26838. stems += stack.length >> 1;
  26839. i += stems + 7 >> 3;
  26840. stackClean = true;
  26841. break;
  26842. case 21:
  26843. y += stack.pop();
  26844. x += stack.pop();
  26845. moveTo(x, y);
  26846. stackClean = true;
  26847. break;
  26848. case 22:
  26849. x += stack.pop();
  26850. moveTo(x, y);
  26851. stackClean = true;
  26852. break;
  26853. case 23:
  26854. stems += stack.length >> 1;
  26855. stackClean = true;
  26856. break;
  26857. case 24:
  26858. while (stack.length > 2) {
  26859. xa = x + stack.shift();
  26860. ya = y + stack.shift();
  26861. xb = xa + stack.shift();
  26862. yb = ya + stack.shift();
  26863. x = xb + stack.shift();
  26864. y = yb + stack.shift();
  26865. bezierCurveTo(xa, ya, xb, yb, x, y);
  26866. }
  26867. x += stack.shift();
  26868. y += stack.shift();
  26869. lineTo(x, y);
  26870. break;
  26871. case 25:
  26872. while (stack.length > 6) {
  26873. x += stack.shift();
  26874. y += stack.shift();
  26875. lineTo(x, y);
  26876. }
  26877. xa = x + stack.shift();
  26878. ya = y + stack.shift();
  26879. xb = xa + stack.shift();
  26880. yb = ya + stack.shift();
  26881. x = xb + stack.shift();
  26882. y = yb + stack.shift();
  26883. bezierCurveTo(xa, ya, xb, yb, x, y);
  26884. break;
  26885. case 26:
  26886. if (stack.length % 2) {
  26887. x += stack.shift();
  26888. }
  26889. while (stack.length > 0) {
  26890. xa = x;
  26891. ya = y + stack.shift();
  26892. xb = xa + stack.shift();
  26893. yb = ya + stack.shift();
  26894. x = xb;
  26895. y = yb + stack.shift();
  26896. bezierCurveTo(xa, ya, xb, yb, x, y);
  26897. }
  26898. break;
  26899. case 27:
  26900. if (stack.length % 2) {
  26901. y += stack.shift();
  26902. }
  26903. while (stack.length > 0) {
  26904. xa = x + stack.shift();
  26905. ya = y;
  26906. xb = xa + stack.shift();
  26907. yb = ya + stack.shift();
  26908. x = xb + stack.shift();
  26909. y = yb;
  26910. bezierCurveTo(xa, ya, xb, yb, x, y);
  26911. }
  26912. break;
  26913. case 28:
  26914. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  26915. i += 2;
  26916. break;
  26917. case 29:
  26918. n = stack.pop() + font.gsubrsBias;
  26919. subrCode = font.gsubrs[n];
  26920. if (subrCode) {
  26921. parse(subrCode);
  26922. }
  26923. break;
  26924. case 30:
  26925. while (stack.length > 0) {
  26926. xa = x;
  26927. ya = y + stack.shift();
  26928. xb = xa + stack.shift();
  26929. yb = ya + stack.shift();
  26930. x = xb + stack.shift();
  26931. y = yb + (stack.length === 1 ? stack.shift() : 0);
  26932. bezierCurveTo(xa, ya, xb, yb, x, y);
  26933. if (stack.length === 0) {
  26934. break;
  26935. }
  26936. xa = x + stack.shift();
  26937. ya = y;
  26938. xb = xa + stack.shift();
  26939. yb = ya + stack.shift();
  26940. y = yb + stack.shift();
  26941. x = xb + (stack.length === 1 ? stack.shift() : 0);
  26942. bezierCurveTo(xa, ya, xb, yb, x, y);
  26943. }
  26944. break;
  26945. case 31:
  26946. while (stack.length > 0) {
  26947. xa = x + stack.shift();
  26948. ya = y;
  26949. xb = xa + stack.shift();
  26950. yb = ya + stack.shift();
  26951. y = yb + stack.shift();
  26952. x = xb + (stack.length === 1 ? stack.shift() : 0);
  26953. bezierCurveTo(xa, ya, xb, yb, x, y);
  26954. if (stack.length === 0) {
  26955. break;
  26956. }
  26957. xa = x;
  26958. ya = y + stack.shift();
  26959. xb = xa + stack.shift();
  26960. yb = ya + stack.shift();
  26961. x = xb + stack.shift();
  26962. y = yb + (stack.length === 1 ? stack.shift() : 0);
  26963. bezierCurveTo(xa, ya, xb, yb, x, y);
  26964. }
  26965. break;
  26966. default:
  26967. if (v < 32) {
  26968. (0, _util.error)('unknown operator: ' + v);
  26969. }
  26970. if (v < 247) {
  26971. stack.push(v - 139);
  26972. } else if (v < 251) {
  26973. stack.push((v - 247) * 256 + code[i++] + 108);
  26974. } else if (v < 255) {
  26975. stack.push(-(v - 251) * 256 - code[i++] - 108);
  26976. } else {
  26977. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  26978. i += 4;
  26979. }
  26980. break;
  26981. }
  26982. if (stackClean) {
  26983. stack.length = 0;
  26984. }
  26985. }
  26986. }
  26987. parse(code);
  26988. }
  26989. var noop = '';
  26990. function CompiledFont(fontMatrix) {
  26991. this.compiledGlyphs = Object.create(null);
  26992. this.compiledCharCodeToGlyphId = Object.create(null);
  26993. this.fontMatrix = fontMatrix;
  26994. }
  26995. CompiledFont.prototype = {
  26996. getPathJs: function getPathJs(unicode) {
  26997. var cmap = lookupCmap(this.cmap, unicode);
  26998. var fn = this.compiledGlyphs[cmap.glyphId];
  26999. if (!fn) {
  27000. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  27001. this.compiledGlyphs[cmap.glyphId] = fn;
  27002. }
  27003. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  27004. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  27005. }
  27006. return fn;
  27007. },
  27008. compileGlyph: function compileGlyph(code) {
  27009. if (!code || code.length === 0 || code[0] === 14) {
  27010. return noop;
  27011. }
  27012. var cmds = [];
  27013. cmds.push({ cmd: 'save' });
  27014. cmds.push({
  27015. cmd: 'transform',
  27016. args: this.fontMatrix.slice()
  27017. });
  27018. cmds.push({
  27019. cmd: 'scale',
  27020. args: ['size', '-size']
  27021. });
  27022. this.compileGlyphImpl(code, cmds);
  27023. cmds.push({ cmd: 'restore' });
  27024. return cmds;
  27025. },
  27026. compileGlyphImpl: function compileGlyphImpl() {
  27027. (0, _util.error)('Children classes should implement this.');
  27028. },
  27029. hasBuiltPath: function hasBuiltPath(unicode) {
  27030. var cmap = lookupCmap(this.cmap, unicode);
  27031. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  27032. }
  27033. };
  27034. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  27035. fontMatrix = fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0];
  27036. CompiledFont.call(this, fontMatrix);
  27037. this.glyphs = glyphs;
  27038. this.cmap = cmap;
  27039. }
  27040. _util.Util.inherit(TrueTypeCompiled, CompiledFont, {
  27041. compileGlyphImpl: function compileGlyphImpl(code, cmds) {
  27042. compileGlyf(code, cmds, this);
  27043. }
  27044. });
  27045. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  27046. fontMatrix = fontMatrix || [0.001, 0, 0, 0.001, 0, 0];
  27047. CompiledFont.call(this, fontMatrix);
  27048. this.glyphs = cffInfo.glyphs;
  27049. this.gsubrs = cffInfo.gsubrs || [];
  27050. this.subrs = cffInfo.subrs || [];
  27051. this.cmap = cmap;
  27052. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  27053. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  27054. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  27055. }
  27056. _util.Util.inherit(Type2Compiled, CompiledFont, {
  27057. compileGlyphImpl: function compileGlyphImpl(code, cmds) {
  27058. compileCharString(code, cmds, this);
  27059. }
  27060. });
  27061. return {
  27062. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  27063. var data = new Uint8Array(font.data);
  27064. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  27065. var numTables = getUshort(data, 4);
  27066. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  27067. var tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  27068. var offset = getLong(data, p + 8);
  27069. var length = getLong(data, p + 12);
  27070. switch (tag) {
  27071. case 'cmap':
  27072. cmap = parseCmap(data, offset, offset + length);
  27073. break;
  27074. case 'glyf':
  27075. glyf = data.subarray(offset, offset + length);
  27076. break;
  27077. case 'loca':
  27078. loca = data.subarray(offset, offset + length);
  27079. break;
  27080. case 'head':
  27081. unitsPerEm = getUshort(data, offset + 18);
  27082. indexToLocFormat = getUshort(data, offset + 50);
  27083. break;
  27084. case 'CFF ':
  27085. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  27086. break;
  27087. }
  27088. }
  27089. if (glyf) {
  27090. var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  27091. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  27092. }
  27093. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  27094. }
  27095. };
  27096. }();
  27097. exports.FontRendererFactory = FontRendererFactory;
  27098. /***/ }),
  27099. /* 26 */
  27100. /***/ (function(module, exports, __w_pdfjs_require__) {
  27101. "use strict";
  27102. Object.defineProperty(exports, "__esModule", {
  27103. value: true
  27104. });
  27105. exports.getFontType = exports.ProblematicCharRanges = exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.PRIVATE_USE_OFFSET_END = exports.PRIVATE_USE_OFFSET_START = exports.SEAC_ANALYSIS_ENABLED = undefined;
  27106. var _util = __w_pdfjs_require__(0);
  27107. var _cff_parser = __w_pdfjs_require__(11);
  27108. var _glyphlist = __w_pdfjs_require__(7);
  27109. var _encodings = __w_pdfjs_require__(4);
  27110. var _standard_fonts = __w_pdfjs_require__(17);
  27111. var _unicode = __w_pdfjs_require__(18);
  27112. var _font_renderer = __w_pdfjs_require__(25);
  27113. var _stream = __w_pdfjs_require__(2);
  27114. var _type1_parser = __w_pdfjs_require__(35);
  27115. var PRIVATE_USE_OFFSET_START = 0xE000;
  27116. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  27117. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  27118. var PDF_GLYPH_SPACE_UNITS = 1000;
  27119. var SEAC_ANALYSIS_ENABLED = false;
  27120. var FontFlags = {
  27121. FixedPitch: 1,
  27122. Serif: 2,
  27123. Symbolic: 4,
  27124. Script: 8,
  27125. Nonsymbolic: 32,
  27126. Italic: 64,
  27127. AllCap: 65536,
  27128. SmallCap: 131072,
  27129. ForceBold: 262144
  27130. };
  27131. 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'];
  27132. function adjustWidths(properties) {
  27133. if (!properties.fontMatrix) {
  27134. return;
  27135. }
  27136. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  27137. return;
  27138. }
  27139. var scale = 0.001 / properties.fontMatrix[0];
  27140. var glyphsWidths = properties.widths;
  27141. for (var glyph in glyphsWidths) {
  27142. glyphsWidths[glyph] *= scale;
  27143. }
  27144. properties.defaultWidth *= scale;
  27145. }
  27146. function adjustToUnicode(properties, builtInEncoding) {
  27147. if (properties.hasIncludedToUnicodeMap) {
  27148. return;
  27149. }
  27150. if (properties.hasEncoding) {
  27151. return;
  27152. }
  27153. if (builtInEncoding === properties.defaultEncoding) {
  27154. return;
  27155. }
  27156. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  27157. return;
  27158. }
  27159. var toUnicode = [],
  27160. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27161. for (var charCode in builtInEncoding) {
  27162. var glyphName = builtInEncoding[charCode];
  27163. var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  27164. if (unicode !== -1) {
  27165. toUnicode[charCode] = String.fromCharCode(unicode);
  27166. }
  27167. }
  27168. properties.toUnicode.amend(toUnicode);
  27169. }
  27170. function getFontType(type, subtype) {
  27171. switch (type) {
  27172. case 'Type1':
  27173. return subtype === 'Type1C' ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  27174. case 'CIDFontType0':
  27175. return subtype === 'CIDFontType0C' ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  27176. case 'OpenType':
  27177. return _util.FontType.OPENTYPE;
  27178. case 'TrueType':
  27179. return _util.FontType.TRUETYPE;
  27180. case 'CIDFontType2':
  27181. return _util.FontType.CIDFONTTYPE2;
  27182. case 'MMType1':
  27183. return _util.FontType.MMTYPE1;
  27184. case 'Type0':
  27185. return _util.FontType.TYPE0;
  27186. default:
  27187. return _util.FontType.UNKNOWN;
  27188. }
  27189. }
  27190. function recoverGlyphName(name, glyphsUnicodeMap) {
  27191. if (glyphsUnicodeMap[name] !== undefined) {
  27192. return name;
  27193. }
  27194. var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  27195. if (unicode !== -1) {
  27196. for (var key in glyphsUnicodeMap) {
  27197. if (glyphsUnicodeMap[key] === unicode) {
  27198. return key;
  27199. }
  27200. }
  27201. }
  27202. (0, _util.info)('Unable to recover a standard glyph name for: ' + name);
  27203. return name;
  27204. }
  27205. var Glyph = function GlyphClosure() {
  27206. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  27207. this.fontChar = fontChar;
  27208. this.unicode = unicode;
  27209. this.accent = accent;
  27210. this.width = width;
  27211. this.vmetric = vmetric;
  27212. this.operatorListId = operatorListId;
  27213. this.isSpace = isSpace;
  27214. this.isInFont = isInFont;
  27215. }
  27216. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  27217. 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;
  27218. };
  27219. return Glyph;
  27220. }();
  27221. var ToUnicodeMap = function ToUnicodeMapClosure() {
  27222. function ToUnicodeMap(cmap) {
  27223. this._map = cmap;
  27224. }
  27225. ToUnicodeMap.prototype = {
  27226. get length() {
  27227. return this._map.length;
  27228. },
  27229. forEach: function forEach(callback) {
  27230. for (var charCode in this._map) {
  27231. callback(charCode, this._map[charCode].charCodeAt(0));
  27232. }
  27233. },
  27234. has: function has(i) {
  27235. return this._map[i] !== undefined;
  27236. },
  27237. get: function get(i) {
  27238. return this._map[i];
  27239. },
  27240. charCodeOf: function charCodeOf(value) {
  27241. var map = this._map;
  27242. if (map.length <= 0x10000) {
  27243. return map.indexOf(value);
  27244. }
  27245. for (var charCode in map) {
  27246. if (map[charCode] === value) {
  27247. return charCode | 0;
  27248. }
  27249. }
  27250. return -1;
  27251. },
  27252. amend: function amend(map) {
  27253. for (var charCode in map) {
  27254. this._map[charCode] = map[charCode];
  27255. }
  27256. }
  27257. };
  27258. return ToUnicodeMap;
  27259. }();
  27260. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  27261. function IdentityToUnicodeMap(firstChar, lastChar) {
  27262. this.firstChar = firstChar;
  27263. this.lastChar = lastChar;
  27264. }
  27265. IdentityToUnicodeMap.prototype = {
  27266. get length() {
  27267. return this.lastChar + 1 - this.firstChar;
  27268. },
  27269. forEach: function forEach(callback) {
  27270. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  27271. callback(i, i);
  27272. }
  27273. },
  27274. has: function has(i) {
  27275. return this.firstChar <= i && i <= this.lastChar;
  27276. },
  27277. get: function get(i) {
  27278. if (this.firstChar <= i && i <= this.lastChar) {
  27279. return String.fromCharCode(i);
  27280. }
  27281. return undefined;
  27282. },
  27283. charCodeOf: function charCodeOf(v) {
  27284. return (0, _util.isInt)(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  27285. },
  27286. amend: function amend(map) {
  27287. (0, _util.error)('Should not call amend()');
  27288. }
  27289. };
  27290. return IdentityToUnicodeMap;
  27291. }();
  27292. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  27293. function writeInt16(dest, offset, num) {
  27294. dest[offset] = num >> 8 & 0xFF;
  27295. dest[offset + 1] = num & 0xFF;
  27296. }
  27297. function writeInt32(dest, offset, num) {
  27298. dest[offset] = num >> 24 & 0xFF;
  27299. dest[offset + 1] = num >> 16 & 0xFF;
  27300. dest[offset + 2] = num >> 8 & 0xFF;
  27301. dest[offset + 3] = num & 0xFF;
  27302. }
  27303. function writeData(dest, offset, data) {
  27304. var i, ii;
  27305. if (data instanceof Uint8Array) {
  27306. dest.set(data, offset);
  27307. } else if (typeof data === 'string') {
  27308. for (i = 0, ii = data.length; i < ii; i++) {
  27309. dest[offset++] = data.charCodeAt(i) & 0xFF;
  27310. }
  27311. } else {
  27312. for (i = 0, ii = data.length; i < ii; i++) {
  27313. dest[offset++] = data[i] & 0xFF;
  27314. }
  27315. }
  27316. }
  27317. function OpenTypeFileBuilder(sfnt) {
  27318. this.sfnt = sfnt;
  27319. this.tables = Object.create(null);
  27320. }
  27321. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  27322. var maxPower2 = 1,
  27323. log2 = 0;
  27324. while ((maxPower2 ^ entriesCount) > maxPower2) {
  27325. maxPower2 <<= 1;
  27326. log2++;
  27327. }
  27328. var searchRange = maxPower2 * entrySize;
  27329. return {
  27330. range: searchRange,
  27331. entry: log2,
  27332. rangeShift: entrySize * entriesCount - searchRange
  27333. };
  27334. };
  27335. var OTF_HEADER_SIZE = 12;
  27336. var OTF_TABLE_ENTRY_SIZE = 16;
  27337. OpenTypeFileBuilder.prototype = {
  27338. toArray: function OpenTypeFileBuilder_toArray() {
  27339. var sfnt = this.sfnt;
  27340. var tables = this.tables;
  27341. var tablesNames = Object.keys(tables);
  27342. tablesNames.sort();
  27343. var numTables = tablesNames.length;
  27344. var i, j, jj, table, tableName;
  27345. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  27346. var tableOffsets = [offset];
  27347. for (i = 0; i < numTables; i++) {
  27348. table = tables[tablesNames[i]];
  27349. var paddedLength = (table.length + 3 & ~3) >>> 0;
  27350. offset += paddedLength;
  27351. tableOffsets.push(offset);
  27352. }
  27353. var file = new Uint8Array(offset);
  27354. for (i = 0; i < numTables; i++) {
  27355. table = tables[tablesNames[i]];
  27356. writeData(file, tableOffsets[i], table);
  27357. }
  27358. if (sfnt === 'true') {
  27359. sfnt = (0, _util.string32)(0x00010000);
  27360. }
  27361. file[0] = sfnt.charCodeAt(0) & 0xFF;
  27362. file[1] = sfnt.charCodeAt(1) & 0xFF;
  27363. file[2] = sfnt.charCodeAt(2) & 0xFF;
  27364. file[3] = sfnt.charCodeAt(3) & 0xFF;
  27365. writeInt16(file, 4, numTables);
  27366. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  27367. writeInt16(file, 6, searchParams.range);
  27368. writeInt16(file, 8, searchParams.entry);
  27369. writeInt16(file, 10, searchParams.rangeShift);
  27370. offset = OTF_HEADER_SIZE;
  27371. for (i = 0; i < numTables; i++) {
  27372. tableName = tablesNames[i];
  27373. file[offset] = tableName.charCodeAt(0) & 0xFF;
  27374. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  27375. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  27376. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  27377. var checksum = 0;
  27378. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  27379. var quad = (0, _util.readUint32)(file, j);
  27380. checksum = checksum + quad >>> 0;
  27381. }
  27382. writeInt32(file, offset + 4, checksum);
  27383. writeInt32(file, offset + 8, tableOffsets[i]);
  27384. writeInt32(file, offset + 12, tables[tableName].length);
  27385. offset += OTF_TABLE_ENTRY_SIZE;
  27386. }
  27387. return file;
  27388. },
  27389. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  27390. if (tag in this.tables) {
  27391. throw new Error('Table ' + tag + ' already exists');
  27392. }
  27393. this.tables[tag] = data;
  27394. }
  27395. };
  27396. return OpenTypeFileBuilder;
  27397. }();
  27398. var ProblematicCharRanges = new Int32Array([0x0000, 0x0020, 0x007F, 0x00A1, 0x00AD, 0x00AE, 0x0600, 0x0780, 0x08A0, 0x10A0, 0x1780, 0x1800, 0x1C00, 0x1C50, 0x2000, 0x2010, 0x2011, 0x2012, 0x2028, 0x2030, 0x205F, 0x2070, 0x25CC, 0x25CD, 0x3000, 0x3001, 0x3164, 0x3165, 0xAA60, 0xAA80, 0xFFF0, 0x10000]);
  27399. var Font = function FontClosure() {
  27400. function Font(name, file, properties) {
  27401. var _this = this;
  27402. var charCode, glyphName, unicode;
  27403. this.name = name;
  27404. this.loadedName = properties.loadedName;
  27405. this.isType3Font = properties.isType3Font;
  27406. this.sizes = [];
  27407. this.missingFile = false;
  27408. this.glyphCache = Object.create(null);
  27409. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  27410. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27411. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  27412. var type = properties.type;
  27413. var subtype = properties.subtype;
  27414. this.type = type;
  27415. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  27416. this.differences = properties.differences;
  27417. this.widths = properties.widths;
  27418. this.defaultWidth = properties.defaultWidth;
  27419. this.composite = properties.composite;
  27420. this.wideChars = properties.wideChars;
  27421. this.cMap = properties.cMap;
  27422. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  27423. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  27424. this.fontMatrix = properties.fontMatrix;
  27425. this.bbox = properties.bbox;
  27426. this.toUnicode = properties.toUnicode;
  27427. this.toFontChar = [];
  27428. if (properties.type === 'Type3') {
  27429. for (charCode = 0; charCode < 256; charCode++) {
  27430. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  27431. }
  27432. this.fontType = _util.FontType.TYPE3;
  27433. return;
  27434. }
  27435. this.cidEncoding = properties.cidEncoding;
  27436. this.vertical = properties.vertical;
  27437. if (this.vertical) {
  27438. this.vmetrics = properties.vmetrics;
  27439. this.defaultVMetrics = properties.defaultVMetrics;
  27440. }
  27441. var glyphsUnicodeMap;
  27442. if (!file || file.isEmpty) {
  27443. if (file) {
  27444. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  27445. }
  27446. this.missingFile = true;
  27447. var fontName = name.replace(/[,_]/g, '-');
  27448. var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  27449. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  27450. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  27451. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  27452. this.bold = fontName.search(/bold/gi) !== -1;
  27453. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  27454. this.black = name.search(/Black/g) !== -1;
  27455. this.remeasure = Object.keys(this.widths).length > 0;
  27456. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  27457. var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  27458. var map = [];
  27459. for (charCode in GlyphMapForStandardFonts) {
  27460. map[+charCode] = GlyphMapForStandardFonts[charCode];
  27461. }
  27462. if (/Arial-?Black/i.test(name)) {
  27463. var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  27464. for (charCode in SupplementalGlyphMapForArialBlack) {
  27465. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  27466. }
  27467. }
  27468. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  27469. if (!isIdentityUnicode) {
  27470. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  27471. map[+charCode] = unicodeCharCode;
  27472. });
  27473. }
  27474. this.toFontChar = map;
  27475. this.toUnicode = new ToUnicodeMap(map);
  27476. } else if (/Symbol/i.test(fontName)) {
  27477. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
  27478. } else if (/Dingbats/i.test(fontName)) {
  27479. if (/Wingdings/i.test(name)) {
  27480. (0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  27481. }
  27482. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), properties.differences);
  27483. } else if (isStandardFont) {
  27484. this.toFontChar = buildToFontChar(properties.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), properties.differences);
  27485. } else {
  27486. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  27487. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  27488. if (!_this.composite) {
  27489. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  27490. unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  27491. if (unicode !== -1) {
  27492. unicodeCharCode = unicode;
  27493. }
  27494. }
  27495. _this.toFontChar[charCode] = unicodeCharCode;
  27496. });
  27497. }
  27498. this.loadedName = fontName.split('-')[0];
  27499. this.loading = false;
  27500. this.fontType = getFontType(type, subtype);
  27501. return;
  27502. }
  27503. if (subtype === 'Type1C') {
  27504. if (type !== 'Type1' && type !== 'MMType1') {
  27505. if (isTrueTypeFile(file)) {
  27506. subtype = 'TrueType';
  27507. } else {
  27508. type = 'Type1';
  27509. }
  27510. } else if (isOpenTypeFile(file)) {
  27511. type = subtype = 'OpenType';
  27512. }
  27513. }
  27514. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  27515. type = 'CIDFontType0';
  27516. }
  27517. if (subtype === 'OpenType') {
  27518. type = 'OpenType';
  27519. }
  27520. if (type === 'CIDFontType0') {
  27521. if (isType1File(file)) {
  27522. subtype = 'CIDFontType0';
  27523. } else if (isOpenTypeFile(file)) {
  27524. type = subtype = 'OpenType';
  27525. } else {
  27526. subtype = 'CIDFontType0C';
  27527. }
  27528. }
  27529. var data;
  27530. switch (type) {
  27531. case 'MMType1':
  27532. (0, _util.info)('MMType1 font (' + name + '), falling back to Type1.');
  27533. case 'Type1':
  27534. case 'CIDFontType0':
  27535. this.mimetype = 'font/opentype';
  27536. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  27537. adjustWidths(properties);
  27538. data = this.convert(name, cff, properties);
  27539. break;
  27540. case 'OpenType':
  27541. case 'TrueType':
  27542. case 'CIDFontType2':
  27543. this.mimetype = 'font/opentype';
  27544. data = this.checkAndRepair(name, file, properties);
  27545. if (this.isOpenType) {
  27546. adjustWidths(properties);
  27547. type = 'OpenType';
  27548. }
  27549. break;
  27550. default:
  27551. (0, _util.error)('Font ' + type + ' is not supported');
  27552. break;
  27553. }
  27554. this.data = data;
  27555. this.fontType = getFontType(type, subtype);
  27556. this.fontMatrix = properties.fontMatrix;
  27557. this.widths = properties.widths;
  27558. this.defaultWidth = properties.defaultWidth;
  27559. this.toUnicode = properties.toUnicode;
  27560. this.encoding = properties.baseEncoding;
  27561. this.seacMap = properties.seacMap;
  27562. this.loading = true;
  27563. }
  27564. Font.getFontID = function () {
  27565. var ID = 1;
  27566. return function Font_getFontID() {
  27567. return String(ID++);
  27568. };
  27569. }();
  27570. function int16(b0, b1) {
  27571. return (b0 << 8) + b1;
  27572. }
  27573. function signedInt16(b0, b1) {
  27574. var value = (b0 << 8) + b1;
  27575. return value & 1 << 15 ? value - 0x10000 : value;
  27576. }
  27577. function int32(b0, b1, b2, b3) {
  27578. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  27579. }
  27580. function string16(value) {
  27581. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  27582. }
  27583. function safeString16(value) {
  27584. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  27585. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  27586. }
  27587. function isTrueTypeFile(file) {
  27588. var header = file.peekBytes(4);
  27589. return (0, _util.readUint32)(header, 0) === 0x00010000;
  27590. }
  27591. function isOpenTypeFile(file) {
  27592. var header = file.peekBytes(4);
  27593. return (0, _util.bytesToString)(header) === 'OTTO';
  27594. }
  27595. function isType1File(file) {
  27596. var header = file.peekBytes(2);
  27597. if (header[0] === 0x25 && header[1] === 0x21) {
  27598. return true;
  27599. }
  27600. if (header[0] === 0x80 && header[1] === 0x01) {
  27601. return true;
  27602. }
  27603. return false;
  27604. }
  27605. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  27606. var toFontChar = [],
  27607. unicode;
  27608. for (var i = 0, ii = encoding.length; i < ii; i++) {
  27609. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  27610. if (unicode !== -1) {
  27611. toFontChar[i] = unicode;
  27612. }
  27613. }
  27614. for (var charCode in differences) {
  27615. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  27616. if (unicode !== -1) {
  27617. toFontChar[+charCode] = unicode;
  27618. }
  27619. }
  27620. return toFontChar;
  27621. }
  27622. function isProblematicUnicodeLocation(code) {
  27623. var i = 0,
  27624. j = ProblematicCharRanges.length - 1;
  27625. while (i < j) {
  27626. var c = i + j + 1 >> 1;
  27627. if (code < ProblematicCharRanges[c]) {
  27628. j = c - 1;
  27629. } else {
  27630. i = c;
  27631. }
  27632. }
  27633. return !(i & 1);
  27634. }
  27635. function adjustMapping(charCodeToGlyphId, properties) {
  27636. var toUnicode = properties.toUnicode;
  27637. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  27638. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  27639. var newMap = Object.create(null);
  27640. var toFontChar = [];
  27641. var usedFontCharCodes = [];
  27642. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  27643. for (var originalCharCode in charCodeToGlyphId) {
  27644. originalCharCode |= 0;
  27645. var glyphId = charCodeToGlyphId[originalCharCode];
  27646. var fontCharCode = originalCharCode;
  27647. var hasUnicodeValue = false;
  27648. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  27649. hasUnicodeValue = true;
  27650. var unicode = toUnicode.get(fontCharCode);
  27651. if (unicode.length === 1) {
  27652. fontCharCode = unicode.charCodeAt(0);
  27653. }
  27654. }
  27655. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  27656. do {
  27657. fontCharCode = nextAvailableFontCharCode++;
  27658. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  27659. fontCharCode = 0xF020;
  27660. nextAvailableFontCharCode = fontCharCode + 1;
  27661. }
  27662. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  27663. }
  27664. newMap[fontCharCode] = glyphId;
  27665. toFontChar[originalCharCode] = fontCharCode;
  27666. usedFontCharCodes[fontCharCode] = true;
  27667. }
  27668. return {
  27669. toFontChar: toFontChar,
  27670. charCodeToGlyphId: newMap,
  27671. nextAvailableFontCharCode: nextAvailableFontCharCode
  27672. };
  27673. }
  27674. function getRanges(glyphs, numGlyphs) {
  27675. var codes = [];
  27676. for (var charCode in glyphs) {
  27677. if (glyphs[charCode] >= numGlyphs) {
  27678. continue;
  27679. }
  27680. codes.push({
  27681. fontCharCode: charCode | 0,
  27682. glyphId: glyphs[charCode]
  27683. });
  27684. }
  27685. codes.sort(function fontGetRangesSort(a, b) {
  27686. return a.fontCharCode - b.fontCharCode;
  27687. });
  27688. var ranges = [];
  27689. var length = codes.length;
  27690. for (var n = 0; n < length;) {
  27691. var start = codes[n].fontCharCode;
  27692. var codeIndices = [codes[n].glyphId];
  27693. ++n;
  27694. var end = start;
  27695. while (n < length && end + 1 === codes[n].fontCharCode) {
  27696. codeIndices.push(codes[n].glyphId);
  27697. ++end;
  27698. ++n;
  27699. if (end === 0xFFFF) {
  27700. break;
  27701. }
  27702. }
  27703. ranges.push([start, end, codeIndices]);
  27704. }
  27705. return ranges;
  27706. }
  27707. function createCmapTable(glyphs, numGlyphs) {
  27708. var ranges = getRanges(glyphs, numGlyphs);
  27709. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  27710. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + (0, _util.string32)(4 + numTables * 8);
  27711. var i, ii, j, jj;
  27712. for (i = ranges.length - 1; i >= 0; --i) {
  27713. if (ranges[i][0] <= 0xFFFF) {
  27714. break;
  27715. }
  27716. }
  27717. var bmpLength = i + 1;
  27718. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  27719. ranges[i][1] = 0xFFFE;
  27720. }
  27721. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  27722. var segCount = bmpLength + trailingRangesCount;
  27723. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  27724. var startCount = '';
  27725. var endCount = '';
  27726. var idDeltas = '';
  27727. var idRangeOffsets = '';
  27728. var glyphsIds = '';
  27729. var bias = 0;
  27730. var range, start, end, codes;
  27731. for (i = 0, ii = bmpLength; i < ii; i++) {
  27732. range = ranges[i];
  27733. start = range[0];
  27734. end = range[1];
  27735. startCount += string16(start);
  27736. endCount += string16(end);
  27737. codes = range[2];
  27738. var contiguous = true;
  27739. for (j = 1, jj = codes.length; j < jj; ++j) {
  27740. if (codes[j] !== codes[j - 1] + 1) {
  27741. contiguous = false;
  27742. break;
  27743. }
  27744. }
  27745. if (!contiguous) {
  27746. var offset = (segCount - i) * 2 + bias * 2;
  27747. bias += end - start + 1;
  27748. idDeltas += string16(0);
  27749. idRangeOffsets += string16(offset);
  27750. for (j = 0, jj = codes.length; j < jj; ++j) {
  27751. glyphsIds += string16(codes[j]);
  27752. }
  27753. } else {
  27754. var startCode = codes[0];
  27755. idDeltas += string16(startCode - start & 0xFFFF);
  27756. idRangeOffsets += string16(0);
  27757. }
  27758. }
  27759. if (trailingRangesCount > 0) {
  27760. endCount += '\xFF\xFF';
  27761. startCount += '\xFF\xFF';
  27762. idDeltas += '\x00\x01';
  27763. idRangeOffsets += '\x00\x00';
  27764. }
  27765. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  27766. var format31012 = '';
  27767. var header31012 = '';
  27768. if (numTables > 1) {
  27769. cmap += '\x00\x03' + '\x00\x0A' + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  27770. format31012 = '';
  27771. for (i = 0, ii = ranges.length; i < ii; i++) {
  27772. range = ranges[i];
  27773. start = range[0];
  27774. codes = range[2];
  27775. var code = codes[0];
  27776. for (j = 1, jj = codes.length; j < jj; ++j) {
  27777. if (codes[j] !== codes[j - 1] + 1) {
  27778. end = range[0] + j - 1;
  27779. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  27780. start = end + 1;
  27781. code = codes[j];
  27782. }
  27783. }
  27784. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  27785. }
  27786. header31012 = '\x00\x0C' + '\x00\x00' + (0, _util.string32)(format31012.length + 16) + '\x00\x00\x00\x00' + (0, _util.string32)(format31012.length / 12);
  27787. }
  27788. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  27789. }
  27790. function validateOS2Table(os2) {
  27791. var stream = new _stream.Stream(os2.data);
  27792. var version = stream.getUint16();
  27793. stream.getBytes(60);
  27794. var selection = stream.getUint16();
  27795. if (version < 4 && selection & 0x0300) {
  27796. return false;
  27797. }
  27798. var firstChar = stream.getUint16();
  27799. var lastChar = stream.getUint16();
  27800. if (firstChar > lastChar) {
  27801. return false;
  27802. }
  27803. stream.getBytes(6);
  27804. var usWinAscent = stream.getUint16();
  27805. if (usWinAscent === 0) {
  27806. return false;
  27807. }
  27808. os2.data[8] = os2.data[9] = 0;
  27809. return true;
  27810. }
  27811. function createOS2Table(properties, charstrings, override) {
  27812. override = override || {
  27813. unitsPerEm: 0,
  27814. yMax: 0,
  27815. yMin: 0,
  27816. ascent: 0,
  27817. descent: 0
  27818. };
  27819. var ulUnicodeRange1 = 0;
  27820. var ulUnicodeRange2 = 0;
  27821. var ulUnicodeRange3 = 0;
  27822. var ulUnicodeRange4 = 0;
  27823. var firstCharIndex = null;
  27824. var lastCharIndex = 0;
  27825. if (charstrings) {
  27826. for (var code in charstrings) {
  27827. code |= 0;
  27828. if (firstCharIndex > code || !firstCharIndex) {
  27829. firstCharIndex = code;
  27830. }
  27831. if (lastCharIndex < code) {
  27832. lastCharIndex = code;
  27833. }
  27834. var position = (0, _unicode.getUnicodeRangeFor)(code);
  27835. if (position < 32) {
  27836. ulUnicodeRange1 |= 1 << position;
  27837. } else if (position < 64) {
  27838. ulUnicodeRange2 |= 1 << position - 32;
  27839. } else if (position < 96) {
  27840. ulUnicodeRange3 |= 1 << position - 64;
  27841. } else if (position < 123) {
  27842. ulUnicodeRange4 |= 1 << position - 96;
  27843. } else {
  27844. (0, _util.error)('Unicode ranges Bits > 123 are reserved for internal usage');
  27845. }
  27846. }
  27847. } else {
  27848. firstCharIndex = 0;
  27849. lastCharIndex = 255;
  27850. }
  27851. var bbox = properties.bbox || [0, 0, 0, 0];
  27852. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  27853. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  27854. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  27855. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  27856. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  27857. typoDescent = -typoDescent;
  27858. }
  27859. var winAscent = override.yMax || typoAscent;
  27860. var winDescent = -override.yMin || -typoDescent;
  27861. 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';
  27862. }
  27863. function createPostTable(properties) {
  27864. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  27865. 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';
  27866. }
  27867. function createNameTable(name, proto) {
  27868. if (!proto) {
  27869. proto = [[], []];
  27870. }
  27871. 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'];
  27872. var stringsUnicode = [];
  27873. var i, ii, j, jj, str;
  27874. for (i = 0, ii = strings.length; i < ii; i++) {
  27875. str = proto[1][i] || strings[i];
  27876. var strBufUnicode = [];
  27877. for (j = 0, jj = str.length; j < jj; j++) {
  27878. strBufUnicode.push(string16(str.charCodeAt(j)));
  27879. }
  27880. stringsUnicode.push(strBufUnicode.join(''));
  27881. }
  27882. var names = [strings, stringsUnicode];
  27883. var platforms = ['\x00\x01', '\x00\x03'];
  27884. var encodings = ['\x00\x00', '\x00\x01'];
  27885. var languages = ['\x00\x00', '\x04\x09'];
  27886. var namesRecordCount = strings.length * platforms.length;
  27887. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  27888. var strOffset = 0;
  27889. for (i = 0, ii = platforms.length; i < ii; i++) {
  27890. var strs = names[i];
  27891. for (j = 0, jj = strs.length; j < jj; j++) {
  27892. str = strs[j];
  27893. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  27894. nameTable += nameRecord;
  27895. strOffset += str.length;
  27896. }
  27897. }
  27898. nameTable += strings.join('') + stringsUnicode.join('');
  27899. return nameTable;
  27900. }
  27901. Font.prototype = {
  27902. name: null,
  27903. font: null,
  27904. mimetype: null,
  27905. encoding: null,
  27906. get renderer() {
  27907. var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  27908. return (0, _util.shadow)(this, 'renderer', renderer);
  27909. },
  27910. exportData: function Font_exportData() {
  27911. var data = {};
  27912. for (var i in this) {
  27913. if (this.hasOwnProperty(i)) {
  27914. data[i] = this[i];
  27915. }
  27916. }
  27917. return data;
  27918. },
  27919. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  27920. function readTableEntry(file) {
  27921. var tag = (0, _util.bytesToString)(file.getBytes(4));
  27922. var checksum = file.getInt32() >>> 0;
  27923. var offset = file.getInt32() >>> 0;
  27924. var length = file.getInt32() >>> 0;
  27925. var previousPosition = file.pos;
  27926. file.pos = file.start ? file.start : 0;
  27927. file.skip(offset);
  27928. var data = file.getBytes(length);
  27929. file.pos = previousPosition;
  27930. if (tag === 'head') {
  27931. data[8] = data[9] = data[10] = data[11] = 0;
  27932. data[17] |= 0x20;
  27933. }
  27934. return {
  27935. tag: tag,
  27936. checksum: checksum,
  27937. length: length,
  27938. offset: offset,
  27939. data: data
  27940. };
  27941. }
  27942. function readOpenTypeHeader(ttf) {
  27943. return {
  27944. version: (0, _util.bytesToString)(ttf.getBytes(4)),
  27945. numTables: ttf.getUint16(),
  27946. searchRange: ttf.getUint16(),
  27947. entrySelector: ttf.getUint16(),
  27948. rangeShift: ttf.getUint16()
  27949. };
  27950. }
  27951. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  27952. if (!cmap) {
  27953. (0, _util.warn)('No cmap table available.');
  27954. return {
  27955. platformId: -1,
  27956. encodingId: -1,
  27957. mappings: [],
  27958. hasShortCmap: false
  27959. };
  27960. }
  27961. var segment;
  27962. var start = (font.start ? font.start : 0) + cmap.offset;
  27963. font.pos = start;
  27964. font.getUint16();
  27965. var numTables = font.getUint16();
  27966. var potentialTable;
  27967. var canBreak = false;
  27968. for (var i = 0; i < numTables; i++) {
  27969. var platformId = font.getUint16();
  27970. var encodingId = font.getUint16();
  27971. var offset = font.getInt32() >>> 0;
  27972. var useTable = false;
  27973. if (platformId === 0 && encodingId === 0) {
  27974. useTable = true;
  27975. } else if (platformId === 1 && encodingId === 0) {
  27976. useTable = true;
  27977. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  27978. useTable = true;
  27979. if (!isSymbolicFont) {
  27980. canBreak = true;
  27981. }
  27982. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  27983. useTable = true;
  27984. canBreak = true;
  27985. }
  27986. if (useTable) {
  27987. potentialTable = {
  27988. platformId: platformId,
  27989. encodingId: encodingId,
  27990. offset: offset
  27991. };
  27992. }
  27993. if (canBreak) {
  27994. break;
  27995. }
  27996. }
  27997. if (potentialTable) {
  27998. font.pos = start + potentialTable.offset;
  27999. }
  28000. if (!potentialTable || font.peekByte() === -1) {
  28001. (0, _util.warn)('Could not find a preferred cmap table.');
  28002. return {
  28003. platformId: -1,
  28004. encodingId: -1,
  28005. mappings: [],
  28006. hasShortCmap: false
  28007. };
  28008. }
  28009. var format = font.getUint16();
  28010. font.getUint16();
  28011. font.getUint16();
  28012. var hasShortCmap = false;
  28013. var mappings = [];
  28014. var j, glyphId;
  28015. if (format === 0) {
  28016. for (j = 0; j < 256; j++) {
  28017. var index = font.getByte();
  28018. if (!index) {
  28019. continue;
  28020. }
  28021. mappings.push({
  28022. charCode: j,
  28023. glyphId: index
  28024. });
  28025. }
  28026. hasShortCmap = true;
  28027. } else if (format === 4) {
  28028. var segCount = font.getUint16() >> 1;
  28029. font.getBytes(6);
  28030. var segIndex,
  28031. segments = [];
  28032. for (segIndex = 0; segIndex < segCount; segIndex++) {
  28033. segments.push({ end: font.getUint16() });
  28034. }
  28035. font.getUint16();
  28036. for (segIndex = 0; segIndex < segCount; segIndex++) {
  28037. segments[segIndex].start = font.getUint16();
  28038. }
  28039. for (segIndex = 0; segIndex < segCount; segIndex++) {
  28040. segments[segIndex].delta = font.getUint16();
  28041. }
  28042. var offsetsCount = 0;
  28043. for (segIndex = 0; segIndex < segCount; segIndex++) {
  28044. segment = segments[segIndex];
  28045. var rangeOffset = font.getUint16();
  28046. if (!rangeOffset) {
  28047. segment.offsetIndex = -1;
  28048. continue;
  28049. }
  28050. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  28051. segment.offsetIndex = offsetIndex;
  28052. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  28053. }
  28054. var offsets = [];
  28055. for (j = 0; j < offsetsCount; j++) {
  28056. offsets.push(font.getUint16());
  28057. }
  28058. for (segIndex = 0; segIndex < segCount; segIndex++) {
  28059. segment = segments[segIndex];
  28060. start = segment.start;
  28061. var end = segment.end;
  28062. var delta = segment.delta;
  28063. offsetIndex = segment.offsetIndex;
  28064. for (j = start; j <= end; j++) {
  28065. if (j === 0xFFFF) {
  28066. continue;
  28067. }
  28068. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  28069. glyphId = glyphId + delta & 0xFFFF;
  28070. mappings.push({
  28071. charCode: j,
  28072. glyphId: glyphId
  28073. });
  28074. }
  28075. }
  28076. } else if (format === 6) {
  28077. var firstCode = font.getUint16();
  28078. var entryCount = font.getUint16();
  28079. for (j = 0; j < entryCount; j++) {
  28080. glyphId = font.getUint16();
  28081. var charCode = firstCode + j;
  28082. mappings.push({
  28083. charCode: charCode,
  28084. glyphId: glyphId
  28085. });
  28086. }
  28087. } else {
  28088. (0, _util.warn)('cmap table has unsupported format: ' + format);
  28089. return {
  28090. platformId: -1,
  28091. encodingId: -1,
  28092. mappings: [],
  28093. hasShortCmap: false
  28094. };
  28095. }
  28096. mappings.sort(function (a, b) {
  28097. return a.charCode - b.charCode;
  28098. });
  28099. for (i = 1; i < mappings.length; i++) {
  28100. if (mappings[i - 1].charCode === mappings[i].charCode) {
  28101. mappings.splice(i, 1);
  28102. i--;
  28103. }
  28104. }
  28105. return {
  28106. platformId: potentialTable.platformId,
  28107. encodingId: potentialTable.encodingId,
  28108. mappings: mappings,
  28109. hasShortCmap: hasShortCmap
  28110. };
  28111. }
  28112. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  28113. if (!header) {
  28114. if (metrics) {
  28115. metrics.data = null;
  28116. }
  28117. return;
  28118. }
  28119. font.pos = (font.start ? font.start : 0) + header.offset;
  28120. font.pos += header.length - 2;
  28121. var numOfMetrics = font.getUint16();
  28122. if (numOfMetrics > numGlyphs) {
  28123. (0, _util.info)('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  28124. numOfMetrics = numGlyphs;
  28125. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  28126. header.data[35] = numOfMetrics & 0x00ff;
  28127. }
  28128. var numOfSidebearings = numGlyphs - numOfMetrics;
  28129. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  28130. if (numMissing > 0) {
  28131. var entries = new Uint8Array(metrics.length + numMissing * 2);
  28132. entries.set(metrics.data);
  28133. metrics.data = entries;
  28134. }
  28135. }
  28136. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  28137. if (sourceEnd - sourceStart <= 12) {
  28138. return 0;
  28139. }
  28140. var glyf = source.subarray(sourceStart, sourceEnd);
  28141. var contoursCount = glyf[0] << 8 | glyf[1];
  28142. if (contoursCount & 0x8000) {
  28143. dest.set(glyf, destStart);
  28144. return glyf.length;
  28145. }
  28146. var i,
  28147. j = 10,
  28148. flagsCount = 0;
  28149. for (i = 0; i < contoursCount; i++) {
  28150. var endPoint = glyf[j] << 8 | glyf[j + 1];
  28151. flagsCount = endPoint + 1;
  28152. j += 2;
  28153. }
  28154. var instructionsStart = j;
  28155. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  28156. j += 2 + instructionsLength;
  28157. var instructionsEnd = j;
  28158. var coordinatesLength = 0;
  28159. for (i = 0; i < flagsCount; i++) {
  28160. var flag = glyf[j++];
  28161. if (flag & 0xC0) {
  28162. glyf[j - 1] = flag & 0x3F;
  28163. }
  28164. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  28165. coordinatesLength += xyLength;
  28166. if (flag & 8) {
  28167. var repeat = glyf[j++];
  28168. i += repeat;
  28169. coordinatesLength += repeat * xyLength;
  28170. }
  28171. }
  28172. if (coordinatesLength === 0) {
  28173. return 0;
  28174. }
  28175. var glyphDataLength = j + coordinatesLength;
  28176. if (glyphDataLength > glyf.length) {
  28177. return 0;
  28178. }
  28179. if (!hintsValid && instructionsLength > 0) {
  28180. dest.set(glyf.subarray(0, instructionsStart), destStart);
  28181. dest.set([0, 0], destStart + instructionsStart);
  28182. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  28183. glyphDataLength -= instructionsLength;
  28184. if (glyf.length - glyphDataLength > 3) {
  28185. glyphDataLength = glyphDataLength + 3 & ~3;
  28186. }
  28187. return glyphDataLength;
  28188. }
  28189. if (glyf.length - glyphDataLength > 3) {
  28190. glyphDataLength = glyphDataLength + 3 & ~3;
  28191. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  28192. return glyphDataLength;
  28193. }
  28194. dest.set(glyf, destStart);
  28195. return glyf.length;
  28196. }
  28197. function sanitizeHead(head, numGlyphs, locaLength) {
  28198. var data = head.data;
  28199. var version = int32(data[0], data[1], data[2], data[3]);
  28200. if (version >> 16 !== 1) {
  28201. (0, _util.info)('Attempting to fix invalid version in head table: ' + version);
  28202. data[0] = 0;
  28203. data[1] = 1;
  28204. data[2] = 0;
  28205. data[3] = 0;
  28206. }
  28207. var indexToLocFormat = int16(data[50], data[51]);
  28208. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  28209. (0, _util.info)('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  28210. var numGlyphsPlusOne = numGlyphs + 1;
  28211. if (locaLength === numGlyphsPlusOne << 1) {
  28212. data[50] = 0;
  28213. data[51] = 0;
  28214. } else if (locaLength === numGlyphsPlusOne << 2) {
  28215. data[50] = 0;
  28216. data[51] = 1;
  28217. } else {
  28218. (0, _util.warn)('Could not fix indexToLocFormat: ' + indexToLocFormat);
  28219. }
  28220. }
  28221. }
  28222. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  28223. var itemSize, itemDecode, itemEncode;
  28224. if (isGlyphLocationsLong) {
  28225. itemSize = 4;
  28226. itemDecode = function fontItemDecodeLong(data, offset) {
  28227. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  28228. };
  28229. itemEncode = function fontItemEncodeLong(data, offset, value) {
  28230. data[offset] = value >>> 24 & 0xFF;
  28231. data[offset + 1] = value >> 16 & 0xFF;
  28232. data[offset + 2] = value >> 8 & 0xFF;
  28233. data[offset + 3] = value & 0xFF;
  28234. };
  28235. } else {
  28236. itemSize = 2;
  28237. itemDecode = function fontItemDecode(data, offset) {
  28238. return data[offset] << 9 | data[offset + 1] << 1;
  28239. };
  28240. itemEncode = function fontItemEncode(data, offset, value) {
  28241. data[offset] = value >> 9 & 0xFF;
  28242. data[offset + 1] = value >> 1 & 0xFF;
  28243. };
  28244. }
  28245. var locaData = loca.data;
  28246. var locaDataSize = itemSize * (1 + numGlyphs);
  28247. if (locaData.length !== locaDataSize) {
  28248. locaData = new Uint8Array(locaDataSize);
  28249. locaData.set(loca.data.subarray(0, locaDataSize));
  28250. loca.data = locaData;
  28251. }
  28252. var oldGlyfData = glyf.data;
  28253. var oldGlyfDataLength = oldGlyfData.length;
  28254. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  28255. var startOffset = itemDecode(locaData, 0);
  28256. var writeOffset = 0;
  28257. var missingGlyphData = Object.create(null);
  28258. itemEncode(locaData, 0, writeOffset);
  28259. var i, j;
  28260. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  28261. var endOffset = itemDecode(locaData, j);
  28262. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  28263. endOffset = oldGlyfDataLength;
  28264. }
  28265. if (endOffset > oldGlyfDataLength) {
  28266. itemEncode(locaData, j, writeOffset);
  28267. startOffset = endOffset;
  28268. continue;
  28269. }
  28270. if (startOffset === endOffset) {
  28271. missingGlyphData[i] = true;
  28272. }
  28273. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  28274. writeOffset += newLength;
  28275. itemEncode(locaData, j, writeOffset);
  28276. startOffset = endOffset;
  28277. }
  28278. if (writeOffset === 0) {
  28279. var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  28280. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  28281. itemEncode(locaData, j, simpleGlyph.length);
  28282. }
  28283. glyf.data = simpleGlyph;
  28284. return missingGlyphData;
  28285. }
  28286. if (dupFirstEntry) {
  28287. var firstEntryLength = itemDecode(locaData, itemSize);
  28288. if (newGlyfData.length > firstEntryLength + writeOffset) {
  28289. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  28290. } else {
  28291. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  28292. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  28293. }
  28294. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  28295. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  28296. } else {
  28297. glyf.data = newGlyfData.subarray(0, writeOffset);
  28298. }
  28299. return missingGlyphData;
  28300. }
  28301. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  28302. var start = (font.start ? font.start : 0) + post.offset;
  28303. font.pos = start;
  28304. var length = post.length,
  28305. end = start + length;
  28306. var version = font.getInt32();
  28307. font.getBytes(28);
  28308. var glyphNames;
  28309. var valid = true;
  28310. var i;
  28311. switch (version) {
  28312. case 0x00010000:
  28313. glyphNames = MacStandardGlyphOrdering;
  28314. break;
  28315. case 0x00020000:
  28316. var numGlyphs = font.getUint16();
  28317. if (numGlyphs !== maxpNumGlyphs) {
  28318. valid = false;
  28319. break;
  28320. }
  28321. var glyphNameIndexes = [];
  28322. for (i = 0; i < numGlyphs; ++i) {
  28323. var index = font.getUint16();
  28324. if (index >= 32768) {
  28325. valid = false;
  28326. break;
  28327. }
  28328. glyphNameIndexes.push(index);
  28329. }
  28330. if (!valid) {
  28331. break;
  28332. }
  28333. var customNames = [];
  28334. var strBuf = [];
  28335. while (font.pos < end) {
  28336. var stringLength = font.getByte();
  28337. strBuf.length = stringLength;
  28338. for (i = 0; i < stringLength; ++i) {
  28339. strBuf[i] = String.fromCharCode(font.getByte());
  28340. }
  28341. customNames.push(strBuf.join(''));
  28342. }
  28343. glyphNames = [];
  28344. for (i = 0; i < numGlyphs; ++i) {
  28345. var j = glyphNameIndexes[i];
  28346. if (j < 258) {
  28347. glyphNames.push(MacStandardGlyphOrdering[j]);
  28348. continue;
  28349. }
  28350. glyphNames.push(customNames[j - 258]);
  28351. }
  28352. break;
  28353. case 0x00030000:
  28354. break;
  28355. default:
  28356. (0, _util.warn)('Unknown/unsupported post table version ' + version);
  28357. valid = false;
  28358. if (properties.defaultEncoding) {
  28359. glyphNames = properties.defaultEncoding;
  28360. }
  28361. break;
  28362. }
  28363. properties.glyphNames = glyphNames;
  28364. return valid;
  28365. }
  28366. function readNameTable(nameTable) {
  28367. var start = (font.start ? font.start : 0) + nameTable.offset;
  28368. font.pos = start;
  28369. var names = [[], []];
  28370. var length = nameTable.length,
  28371. end = start + length;
  28372. var format = font.getUint16();
  28373. var FORMAT_0_HEADER_LENGTH = 6;
  28374. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  28375. return names;
  28376. }
  28377. var numRecords = font.getUint16();
  28378. var stringsStart = font.getUint16();
  28379. var records = [];
  28380. var NAME_RECORD_LENGTH = 12;
  28381. var i, ii;
  28382. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  28383. var r = {
  28384. platform: font.getUint16(),
  28385. encoding: font.getUint16(),
  28386. language: font.getUint16(),
  28387. name: font.getUint16(),
  28388. length: font.getUint16(),
  28389. offset: font.getUint16()
  28390. };
  28391. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  28392. records.push(r);
  28393. }
  28394. }
  28395. for (i = 0, ii = records.length; i < ii; i++) {
  28396. var record = records[i];
  28397. if (record.length <= 0) {
  28398. continue;
  28399. }
  28400. var pos = start + stringsStart + record.offset;
  28401. if (pos + record.length > end) {
  28402. continue;
  28403. }
  28404. font.pos = pos;
  28405. var nameIndex = record.name;
  28406. if (record.encoding) {
  28407. var str = '';
  28408. for (var j = 0, jj = record.length; j < jj; j += 2) {
  28409. str += String.fromCharCode(font.getUint16());
  28410. }
  28411. names[1][nameIndex] = str;
  28412. } else {
  28413. names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
  28414. }
  28415. }
  28416. return names;
  28417. }
  28418. 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];
  28419. function sanitizeTTProgram(table, ttContext) {
  28420. var data = table.data;
  28421. var i = 0,
  28422. j,
  28423. n,
  28424. b,
  28425. funcId,
  28426. pc,
  28427. lastEndf = 0,
  28428. lastDeff = 0;
  28429. var stack = [];
  28430. var callstack = [];
  28431. var functionsCalled = [];
  28432. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  28433. var inFDEF = false,
  28434. ifLevel = 0,
  28435. inELSE = 0;
  28436. for (var ii = data.length; i < ii;) {
  28437. var op = data[i++];
  28438. if (op === 0x40) {
  28439. n = data[i++];
  28440. if (inFDEF || inELSE) {
  28441. i += n;
  28442. } else {
  28443. for (j = 0; j < n; j++) {
  28444. stack.push(data[i++]);
  28445. }
  28446. }
  28447. } else if (op === 0x41) {
  28448. n = data[i++];
  28449. if (inFDEF || inELSE) {
  28450. i += n * 2;
  28451. } else {
  28452. for (j = 0; j < n; j++) {
  28453. b = data[i++];
  28454. stack.push(b << 8 | data[i++]);
  28455. }
  28456. }
  28457. } else if ((op & 0xF8) === 0xB0) {
  28458. n = op - 0xB0 + 1;
  28459. if (inFDEF || inELSE) {
  28460. i += n;
  28461. } else {
  28462. for (j = 0; j < n; j++) {
  28463. stack.push(data[i++]);
  28464. }
  28465. }
  28466. } else if ((op & 0xF8) === 0xB8) {
  28467. n = op - 0xB8 + 1;
  28468. if (inFDEF || inELSE) {
  28469. i += n * 2;
  28470. } else {
  28471. for (j = 0; j < n; j++) {
  28472. b = data[i++];
  28473. stack.push(b << 8 | data[i++]);
  28474. }
  28475. }
  28476. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  28477. if (!inFDEF && !inELSE) {
  28478. funcId = stack[stack.length - 1];
  28479. ttContext.functionsUsed[funcId] = true;
  28480. if (funcId in ttContext.functionsStackDeltas) {
  28481. stack.length += ttContext.functionsStackDeltas[funcId];
  28482. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  28483. callstack.push({
  28484. data: data,
  28485. i: i,
  28486. stackTop: stack.length - 1
  28487. });
  28488. functionsCalled.push(funcId);
  28489. pc = ttContext.functionsDefined[funcId];
  28490. if (!pc) {
  28491. (0, _util.warn)('TT: CALL non-existent function');
  28492. ttContext.hintsValid = false;
  28493. return;
  28494. }
  28495. data = pc.data;
  28496. i = pc.i;
  28497. }
  28498. }
  28499. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  28500. if (inFDEF || inELSE) {
  28501. (0, _util.warn)('TT: nested FDEFs not allowed');
  28502. tooComplexToFollowFunctions = true;
  28503. }
  28504. inFDEF = true;
  28505. lastDeff = i;
  28506. funcId = stack.pop();
  28507. ttContext.functionsDefined[funcId] = {
  28508. data: data,
  28509. i: i
  28510. };
  28511. } else if (op === 0x2D) {
  28512. if (inFDEF) {
  28513. inFDEF = false;
  28514. lastEndf = i;
  28515. } else {
  28516. pc = callstack.pop();
  28517. if (!pc) {
  28518. (0, _util.warn)('TT: ENDF bad stack');
  28519. ttContext.hintsValid = false;
  28520. return;
  28521. }
  28522. funcId = functionsCalled.pop();
  28523. data = pc.data;
  28524. i = pc.i;
  28525. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  28526. }
  28527. } else if (op === 0x89) {
  28528. if (inFDEF || inELSE) {
  28529. (0, _util.warn)('TT: nested IDEFs not allowed');
  28530. tooComplexToFollowFunctions = true;
  28531. }
  28532. inFDEF = true;
  28533. lastDeff = i;
  28534. } else if (op === 0x58) {
  28535. ++ifLevel;
  28536. } else if (op === 0x1B) {
  28537. inELSE = ifLevel;
  28538. } else if (op === 0x59) {
  28539. if (inELSE === ifLevel) {
  28540. inELSE = 0;
  28541. }
  28542. --ifLevel;
  28543. } else if (op === 0x1C) {
  28544. if (!inFDEF && !inELSE) {
  28545. var offset = stack[stack.length - 1];
  28546. if (offset > 0) {
  28547. i += offset - 1;
  28548. }
  28549. }
  28550. }
  28551. if (!inFDEF && !inELSE) {
  28552. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  28553. if (op >= 0x71 && op <= 0x75) {
  28554. n = stack.pop();
  28555. if (!isNaN(n)) {
  28556. stackDelta = -n * 2;
  28557. }
  28558. }
  28559. while (stackDelta < 0 && stack.length > 0) {
  28560. stack.pop();
  28561. stackDelta++;
  28562. }
  28563. while (stackDelta > 0) {
  28564. stack.push(NaN);
  28565. stackDelta--;
  28566. }
  28567. }
  28568. }
  28569. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  28570. var content = [data];
  28571. if (i > data.length) {
  28572. content.push(new Uint8Array(i - data.length));
  28573. }
  28574. if (lastDeff > lastEndf) {
  28575. (0, _util.warn)('TT: complementing a missing function tail');
  28576. content.push(new Uint8Array([0x22, 0x2D]));
  28577. }
  28578. foldTTTable(table, content);
  28579. }
  28580. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  28581. if (ttContext.tooComplexToFollowFunctions) {
  28582. return;
  28583. }
  28584. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  28585. (0, _util.warn)('TT: more functions defined than expected');
  28586. ttContext.hintsValid = false;
  28587. return;
  28588. }
  28589. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  28590. if (j > maxFunctionDefs) {
  28591. (0, _util.warn)('TT: invalid function id: ' + j);
  28592. ttContext.hintsValid = false;
  28593. return;
  28594. }
  28595. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  28596. (0, _util.warn)('TT: undefined function: ' + j);
  28597. ttContext.hintsValid = false;
  28598. return;
  28599. }
  28600. }
  28601. }
  28602. function foldTTTable(table, content) {
  28603. if (content.length > 1) {
  28604. var newLength = 0;
  28605. var j, jj;
  28606. for (j = 0, jj = content.length; j < jj; j++) {
  28607. newLength += content[j].length;
  28608. }
  28609. newLength = newLength + 3 & ~3;
  28610. var result = new Uint8Array(newLength);
  28611. var pos = 0;
  28612. for (j = 0, jj = content.length; j < jj; j++) {
  28613. result.set(content[j], pos);
  28614. pos += content[j].length;
  28615. }
  28616. table.data = result;
  28617. table.length = newLength;
  28618. }
  28619. }
  28620. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  28621. var ttContext = {
  28622. functionsDefined: [],
  28623. functionsUsed: [],
  28624. functionsStackDeltas: [],
  28625. tooComplexToFollowFunctions: false,
  28626. hintsValid: true
  28627. };
  28628. if (fpgm) {
  28629. sanitizeTTProgram(fpgm, ttContext);
  28630. }
  28631. if (prep) {
  28632. sanitizeTTProgram(prep, ttContext);
  28633. }
  28634. if (fpgm) {
  28635. checkInvalidFunctions(ttContext, maxFunctionDefs);
  28636. }
  28637. if (cvt && cvt.length & 1) {
  28638. var cvtData = new Uint8Array(cvt.length + 1);
  28639. cvtData.set(cvt.data);
  28640. cvt.data = cvtData;
  28641. }
  28642. return ttContext.hintsValid;
  28643. }
  28644. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  28645. var VALID_TABLES = ['OS/2', 'cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'post', 'loca', 'glyf', 'fpgm', 'prep', 'cvt ', 'CFF '];
  28646. var header = readOpenTypeHeader(font);
  28647. var numTables = header.numTables;
  28648. var cff, cffFile;
  28649. var tables = Object.create(null);
  28650. tables['OS/2'] = null;
  28651. tables['cmap'] = null;
  28652. tables['head'] = null;
  28653. tables['hhea'] = null;
  28654. tables['hmtx'] = null;
  28655. tables['maxp'] = null;
  28656. tables['name'] = null;
  28657. tables['post'] = null;
  28658. var table;
  28659. for (var i = 0; i < numTables; i++) {
  28660. table = readTableEntry(font);
  28661. if (VALID_TABLES.indexOf(table.tag) < 0) {
  28662. continue;
  28663. }
  28664. if (table.length === 0) {
  28665. continue;
  28666. }
  28667. tables[table.tag] = table;
  28668. }
  28669. var isTrueType = !tables['CFF '];
  28670. if (!isTrueType) {
  28671. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  28672. cffFile = new _stream.Stream(tables['CFF '].data);
  28673. cff = new CFFFont(cffFile, properties);
  28674. adjustWidths(properties);
  28675. return this.convert(name, cff, properties);
  28676. }
  28677. delete tables['glyf'];
  28678. delete tables['loca'];
  28679. delete tables['fpgm'];
  28680. delete tables['prep'];
  28681. delete tables['cvt '];
  28682. this.isOpenType = true;
  28683. } else {
  28684. if (!tables['loca']) {
  28685. (0, _util.error)('Required "loca" table is not found');
  28686. }
  28687. if (!tables['glyf']) {
  28688. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  28689. tables['glyf'] = {
  28690. tag: 'glyf',
  28691. data: new Uint8Array(0)
  28692. };
  28693. }
  28694. this.isOpenType = false;
  28695. }
  28696. if (!tables['maxp']) {
  28697. (0, _util.error)('Required "maxp" table is not found');
  28698. }
  28699. font.pos = (font.start || 0) + tables['maxp'].offset;
  28700. var version = font.getInt32();
  28701. var numGlyphs = font.getUint16();
  28702. var maxFunctionDefs = 0;
  28703. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  28704. font.pos += 8;
  28705. var maxZones = font.getUint16();
  28706. if (maxZones > 2) {
  28707. tables['maxp'].data[14] = 0;
  28708. tables['maxp'].data[15] = 2;
  28709. }
  28710. font.pos += 4;
  28711. maxFunctionDefs = font.getUint16();
  28712. }
  28713. var dupFirstEntry = false;
  28714. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\0') {
  28715. dupFirstEntry = true;
  28716. numGlyphs++;
  28717. tables['maxp'].data[4] = numGlyphs >> 8;
  28718. tables['maxp'].data[5] = numGlyphs & 255;
  28719. }
  28720. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  28721. if (!hintsValid) {
  28722. delete tables['fpgm'];
  28723. delete tables['prep'];
  28724. delete tables['cvt '];
  28725. }
  28726. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  28727. if (!tables['head']) {
  28728. (0, _util.error)('Required "head" table is not found');
  28729. }
  28730. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  28731. var missingGlyphs = Object.create(null);
  28732. if (isTrueType) {
  28733. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  28734. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  28735. }
  28736. if (!tables['hhea']) {
  28737. (0, _util.error)('Required "hhea" table is not found');
  28738. }
  28739. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  28740. tables['hhea'].data[10] = 0xFF;
  28741. tables['hhea'].data[11] = 0xFF;
  28742. }
  28743. var metricsOverride = {
  28744. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  28745. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  28746. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  28747. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  28748. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  28749. };
  28750. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  28751. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  28752. if (tables['post']) {
  28753. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  28754. if (!valid) {
  28755. tables['post'] = null;
  28756. }
  28757. }
  28758. var charCodeToGlyphId = [],
  28759. charCode;
  28760. var toUnicode = properties.toUnicode,
  28761. widths = properties.widths;
  28762. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  28763. function hasGlyph(glyphId, charCode, widthCode) {
  28764. if (!missingGlyphs[glyphId]) {
  28765. return true;
  28766. }
  28767. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  28768. return true;
  28769. }
  28770. if (widths && widthCode >= 0 && (0, _util.isNum)(widths[widthCode])) {
  28771. return true;
  28772. }
  28773. return false;
  28774. }
  28775. if (properties.composite) {
  28776. var cidToGidMap = properties.cidToGidMap || [];
  28777. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  28778. properties.cMap.forEach(function (charCode, cid) {
  28779. (0, _util.assert)(cid <= 0xffff, 'Max size of CID is 65,535');
  28780. var glyphId = -1;
  28781. if (isCidToGidMapEmpty) {
  28782. glyphId = cid;
  28783. } else if (cidToGidMap[cid] !== undefined) {
  28784. glyphId = cidToGidMap[cid];
  28785. }
  28786. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  28787. charCodeToGlyphId[charCode] = glyphId;
  28788. }
  28789. });
  28790. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  28791. charCodeToGlyphId[0] = numGlyphs - 1;
  28792. }
  28793. } else {
  28794. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  28795. var cmapPlatformId = cmapTable.platformId;
  28796. var cmapEncodingId = cmapTable.encodingId;
  28797. var cmapMappings = cmapTable.mappings;
  28798. var cmapMappingsLength = cmapMappings.length;
  28799. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) {
  28800. var baseEncoding = [];
  28801. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  28802. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  28803. }
  28804. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  28805. for (charCode = 0; charCode < 256; charCode++) {
  28806. var glyphName, standardGlyphName;
  28807. if (this.differences && charCode in this.differences) {
  28808. glyphName = this.differences[charCode];
  28809. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  28810. glyphName = baseEncoding[charCode];
  28811. } else {
  28812. glyphName = _encodings.StandardEncoding[charCode];
  28813. }
  28814. if (!glyphName) {
  28815. continue;
  28816. }
  28817. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  28818. var unicodeOrCharCode,
  28819. isUnicode = false;
  28820. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  28821. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  28822. isUnicode = true;
  28823. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  28824. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  28825. }
  28826. var found = false;
  28827. for (i = 0; i < cmapMappingsLength; ++i) {
  28828. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  28829. continue;
  28830. }
  28831. var code = isUnicode ? charCode : unicodeOrCharCode;
  28832. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  28833. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  28834. found = true;
  28835. break;
  28836. }
  28837. }
  28838. if (!found && properties.glyphNames) {
  28839. var glyphId = properties.glyphNames.indexOf(glyphName);
  28840. if (glyphId === -1 && standardGlyphName !== glyphName) {
  28841. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  28842. }
  28843. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  28844. charCodeToGlyphId[charCode] = glyphId;
  28845. found = true;
  28846. }
  28847. }
  28848. if (!found) {
  28849. charCodeToGlyphId[charCode] = 0;
  28850. }
  28851. }
  28852. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  28853. for (i = 0; i < cmapMappingsLength; ++i) {
  28854. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  28855. }
  28856. } else {
  28857. for (i = 0; i < cmapMappingsLength; ++i) {
  28858. charCode = cmapMappings[i].charCode & 0xFF;
  28859. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  28860. }
  28861. }
  28862. }
  28863. if (charCodeToGlyphId.length === 0) {
  28864. charCodeToGlyphId[0] = 0;
  28865. }
  28866. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  28867. this.toFontChar = newMapping.toFontChar;
  28868. tables['cmap'] = {
  28869. tag: 'cmap',
  28870. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  28871. };
  28872. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  28873. tables['OS/2'] = {
  28874. tag: 'OS/2',
  28875. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  28876. };
  28877. }
  28878. if (!tables['post']) {
  28879. tables['post'] = {
  28880. tag: 'post',
  28881. data: createPostTable(properties)
  28882. };
  28883. }
  28884. if (!isTrueType) {
  28885. try {
  28886. cffFile = new _stream.Stream(tables['CFF '].data);
  28887. var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  28888. cff = parser.parse();
  28889. var compiler = new _cff_parser.CFFCompiler(cff);
  28890. tables['CFF '].data = compiler.compile();
  28891. } catch (e) {
  28892. (0, _util.warn)('Failed to compile font ' + properties.loadedName);
  28893. }
  28894. }
  28895. if (!tables['name']) {
  28896. tables['name'] = {
  28897. tag: 'name',
  28898. data: createNameTable(this.name)
  28899. };
  28900. } else {
  28901. var namePrototype = readNameTable(tables['name']);
  28902. tables['name'].data = createNameTable(name, namePrototype);
  28903. }
  28904. var builder = new OpenTypeFileBuilder(header.version);
  28905. for (var tableTag in tables) {
  28906. builder.addTable(tableTag, tables[tableTag].data);
  28907. }
  28908. return builder.toArray();
  28909. },
  28910. convert: function Font_convert(fontName, font, properties) {
  28911. properties.fixedPitch = false;
  28912. if (properties.builtInEncoding) {
  28913. adjustToUnicode(properties, properties.builtInEncoding);
  28914. }
  28915. var mapping = font.getGlyphMapping(properties);
  28916. var newMapping = adjustMapping(mapping, properties);
  28917. this.toFontChar = newMapping.toFontChar;
  28918. var numGlyphs = font.numGlyphs;
  28919. function getCharCodes(charCodeToGlyphId, glyphId) {
  28920. var charCodes = null;
  28921. for (var charCode in charCodeToGlyphId) {
  28922. if (glyphId === charCodeToGlyphId[charCode]) {
  28923. if (!charCodes) {
  28924. charCodes = [];
  28925. }
  28926. charCodes.push(charCode | 0);
  28927. }
  28928. }
  28929. return charCodes;
  28930. }
  28931. function createCharCode(charCodeToGlyphId, glyphId) {
  28932. for (var charCode in charCodeToGlyphId) {
  28933. if (glyphId === charCodeToGlyphId[charCode]) {
  28934. return charCode | 0;
  28935. }
  28936. }
  28937. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  28938. return newMapping.nextAvailableFontCharCode++;
  28939. }
  28940. var seacs = font.seacs;
  28941. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  28942. var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  28943. var charset = font.getCharset();
  28944. var seacMap = Object.create(null);
  28945. for (var glyphId in seacs) {
  28946. glyphId |= 0;
  28947. var seac = seacs[glyphId];
  28948. var baseGlyphName = _encodings.StandardEncoding[seac[2]];
  28949. var accentGlyphName = _encodings.StandardEncoding[seac[3]];
  28950. var baseGlyphId = charset.indexOf(baseGlyphName);
  28951. var accentGlyphId = charset.indexOf(accentGlyphName);
  28952. if (baseGlyphId < 0 || accentGlyphId < 0) {
  28953. continue;
  28954. }
  28955. var accentOffset = {
  28956. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  28957. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  28958. };
  28959. var charCodes = getCharCodes(mapping, glyphId);
  28960. if (!charCodes) {
  28961. continue;
  28962. }
  28963. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  28964. var charCode = charCodes[i];
  28965. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  28966. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  28967. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  28968. seacMap[charCode] = {
  28969. baseFontCharCode: baseFontCharCode,
  28970. accentFontCharCode: accentFontCharCode,
  28971. accentOffset: accentOffset
  28972. };
  28973. }
  28974. }
  28975. properties.seacMap = seacMap;
  28976. }
  28977. var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  28978. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  28979. builder.addTable('CFF ', font.data);
  28980. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  28981. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  28982. 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');
  28983. 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));
  28984. builder.addTable('hmtx', function fontFieldsHmtx() {
  28985. var charstrings = font.charstrings;
  28986. var cffWidths = font.cff ? font.cff.widths : null;
  28987. var hmtx = '\x00\x00\x00\x00';
  28988. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  28989. var width = 0;
  28990. if (charstrings) {
  28991. var charstring = charstrings[i - 1];
  28992. width = 'width' in charstring ? charstring.width : 0;
  28993. } else if (cffWidths) {
  28994. width = Math.ceil(cffWidths[i] || 0);
  28995. }
  28996. hmtx += string16(width) + string16(0);
  28997. }
  28998. return hmtx;
  28999. }());
  29000. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  29001. builder.addTable('name', createNameTable(fontName));
  29002. builder.addTable('post', createPostTable(properties));
  29003. return builder.toArray();
  29004. },
  29005. get spaceWidth() {
  29006. if ('_shadowWidth' in this) {
  29007. return this._shadowWidth;
  29008. }
  29009. var possibleSpaceReplacements = ['space', 'minus', 'one', 'i', 'I'];
  29010. var width;
  29011. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  29012. var glyphName = possibleSpaceReplacements[i];
  29013. if (glyphName in this.widths) {
  29014. width = this.widths[glyphName];
  29015. break;
  29016. }
  29017. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  29018. var glyphUnicode = glyphsUnicodeMap[glyphName];
  29019. var charcode = 0;
  29020. if (this.composite) {
  29021. if (this.cMap.contains(glyphUnicode)) {
  29022. charcode = this.cMap.lookup(glyphUnicode);
  29023. }
  29024. }
  29025. if (!charcode && this.toUnicode) {
  29026. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  29027. }
  29028. if (charcode <= 0) {
  29029. charcode = glyphUnicode;
  29030. }
  29031. width = this.widths[charcode];
  29032. if (width) {
  29033. break;
  29034. }
  29035. }
  29036. width = width || this.defaultWidth;
  29037. this._shadowWidth = width;
  29038. return width;
  29039. },
  29040. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  29041. var fontCharCode, width, operatorListId;
  29042. var widthCode = charcode;
  29043. if (this.cMap && this.cMap.contains(charcode)) {
  29044. widthCode = this.cMap.lookup(charcode);
  29045. }
  29046. width = this.widths[widthCode];
  29047. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  29048. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  29049. var unicode = this.toUnicode.get(charcode) || charcode;
  29050. if (typeof unicode === 'number') {
  29051. unicode = String.fromCharCode(unicode);
  29052. }
  29053. var isInFont = charcode in this.toFontChar;
  29054. fontCharCode = this.toFontChar[charcode] || charcode;
  29055. if (this.missingFile) {
  29056. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  29057. }
  29058. if (this.isType3Font) {
  29059. operatorListId = fontCharCode;
  29060. }
  29061. var accent = null;
  29062. if (this.seacMap && this.seacMap[charcode]) {
  29063. isInFont = true;
  29064. var seac = this.seacMap[charcode];
  29065. fontCharCode = seac.baseFontCharCode;
  29066. accent = {
  29067. fontChar: String.fromCharCode(seac.accentFontCharCode),
  29068. offset: seac.accentOffset
  29069. };
  29070. }
  29071. var fontChar = String.fromCharCode(fontCharCode);
  29072. var glyph = this.glyphCache[charcode];
  29073. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  29074. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  29075. this.glyphCache[charcode] = glyph;
  29076. }
  29077. return glyph;
  29078. },
  29079. charsToGlyphs: function Font_charsToGlyphs(chars) {
  29080. var charsCache = this.charsCache;
  29081. var glyphs, glyph, charcode;
  29082. if (charsCache) {
  29083. glyphs = charsCache[chars];
  29084. if (glyphs) {
  29085. return glyphs;
  29086. }
  29087. }
  29088. if (!charsCache) {
  29089. charsCache = this.charsCache = Object.create(null);
  29090. }
  29091. glyphs = [];
  29092. var charsCacheKey = chars;
  29093. var i = 0,
  29094. ii;
  29095. if (this.cMap) {
  29096. var c = Object.create(null);
  29097. while (i < chars.length) {
  29098. this.cMap.readCharCode(chars, i, c);
  29099. charcode = c.charcode;
  29100. var length = c.length;
  29101. i += length;
  29102. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  29103. glyph = this.charToGlyph(charcode, isSpace);
  29104. glyphs.push(glyph);
  29105. }
  29106. } else {
  29107. for (i = 0, ii = chars.length; i < ii; ++i) {
  29108. charcode = chars.charCodeAt(i);
  29109. glyph = this.charToGlyph(charcode, charcode === 0x20);
  29110. glyphs.push(glyph);
  29111. }
  29112. }
  29113. return charsCache[charsCacheKey] = glyphs;
  29114. }
  29115. };
  29116. return Font;
  29117. }();
  29118. var ErrorFont = function ErrorFontClosure() {
  29119. function ErrorFont(error) {
  29120. this.error = error;
  29121. this.loadedName = 'g_font_error';
  29122. this.loading = false;
  29123. }
  29124. ErrorFont.prototype = {
  29125. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  29126. return [];
  29127. },
  29128. exportData: function ErrorFont_exportData() {
  29129. return { error: this.error };
  29130. }
  29131. };
  29132. return ErrorFont;
  29133. }();
  29134. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  29135. var charCodeToGlyphId = Object.create(null);
  29136. var glyphId, charCode, baseEncoding;
  29137. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  29138. if (properties.baseEncodingName) {
  29139. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  29140. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  29141. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  29142. if (glyphId >= 0) {
  29143. charCodeToGlyphId[charCode] = glyphId;
  29144. } else {
  29145. charCodeToGlyphId[charCode] = 0;
  29146. }
  29147. }
  29148. } else if (isSymbolicFont) {
  29149. for (charCode in builtInEncoding) {
  29150. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  29151. }
  29152. } else {
  29153. baseEncoding = _encodings.StandardEncoding;
  29154. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  29155. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  29156. if (glyphId >= 0) {
  29157. charCodeToGlyphId[charCode] = glyphId;
  29158. } else {
  29159. charCodeToGlyphId[charCode] = 0;
  29160. }
  29161. }
  29162. }
  29163. var differences = properties.differences,
  29164. glyphsUnicodeMap;
  29165. if (differences) {
  29166. for (charCode in differences) {
  29167. var glyphName = differences[charCode];
  29168. glyphId = glyphNames.indexOf(glyphName);
  29169. if (glyphId === -1) {
  29170. if (!glyphsUnicodeMap) {
  29171. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  29172. }
  29173. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  29174. if (standardGlyphName !== glyphName) {
  29175. glyphId = glyphNames.indexOf(standardGlyphName);
  29176. }
  29177. }
  29178. if (glyphId >= 0) {
  29179. charCodeToGlyphId[charCode] = glyphId;
  29180. } else {
  29181. charCodeToGlyphId[charCode] = 0;
  29182. }
  29183. }
  29184. }
  29185. return charCodeToGlyphId;
  29186. }
  29187. var Type1Font = function Type1FontClosure() {
  29188. function findBlock(streamBytes, signature, startIndex) {
  29189. var streamBytesLength = streamBytes.length;
  29190. var signatureLength = signature.length;
  29191. var scanLength = streamBytesLength - signatureLength;
  29192. var i = startIndex,
  29193. j,
  29194. found = false;
  29195. while (i < scanLength) {
  29196. j = 0;
  29197. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  29198. j++;
  29199. }
  29200. if (j >= signatureLength) {
  29201. i += j;
  29202. while (i < streamBytesLength && (0, _util.isSpace)(streamBytes[i])) {
  29203. i++;
  29204. }
  29205. found = true;
  29206. break;
  29207. }
  29208. i++;
  29209. }
  29210. return {
  29211. found: found,
  29212. length: i
  29213. };
  29214. }
  29215. function getHeaderBlock(stream, suggestedLength) {
  29216. var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  29217. var streamStartPos = stream.pos;
  29218. var headerBytes, headerBytesLength, block;
  29219. try {
  29220. headerBytes = stream.getBytes(suggestedLength);
  29221. headerBytesLength = headerBytes.length;
  29222. } catch (ex) {
  29223. if (ex instanceof _util.MissingDataException) {
  29224. throw ex;
  29225. }
  29226. }
  29227. if (headerBytesLength === suggestedLength) {
  29228. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  29229. if (block.found && block.length === suggestedLength) {
  29230. return {
  29231. stream: new _stream.Stream(headerBytes),
  29232. length: suggestedLength
  29233. };
  29234. }
  29235. }
  29236. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  29237. stream.pos = streamStartPos;
  29238. var SCAN_BLOCK_LENGTH = 2048;
  29239. var actualLength;
  29240. while (true) {
  29241. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  29242. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  29243. if (block.length === 0) {
  29244. break;
  29245. }
  29246. stream.pos += block.length;
  29247. if (block.found) {
  29248. actualLength = stream.pos - streamStartPos;
  29249. break;
  29250. }
  29251. }
  29252. stream.pos = streamStartPos;
  29253. if (actualLength) {
  29254. return {
  29255. stream: new _stream.Stream(stream.getBytes(actualLength)),
  29256. length: actualLength
  29257. };
  29258. }
  29259. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  29260. return {
  29261. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  29262. length: suggestedLength
  29263. };
  29264. }
  29265. function getEexecBlock(stream, suggestedLength) {
  29266. var eexecBytes = stream.getBytes();
  29267. return {
  29268. stream: new _stream.Stream(eexecBytes),
  29269. length: eexecBytes.length
  29270. };
  29271. }
  29272. function Type1Font(name, file, properties) {
  29273. var PFB_HEADER_SIZE = 6;
  29274. var headerBlockLength = properties.length1;
  29275. var eexecBlockLength = properties.length2;
  29276. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  29277. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  29278. if (pfbHeaderPresent) {
  29279. file.skip(PFB_HEADER_SIZE);
  29280. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  29281. }
  29282. var headerBlock = getHeaderBlock(file, headerBlockLength);
  29283. headerBlockLength = headerBlock.length;
  29284. var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  29285. headerBlockParser.extractFontHeader(properties);
  29286. if (pfbHeaderPresent) {
  29287. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  29288. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  29289. }
  29290. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  29291. eexecBlockLength = eexecBlock.length;
  29292. var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  29293. var data = eexecBlockParser.extractFontProgram();
  29294. for (var info in data.properties) {
  29295. properties[info] = data.properties[info];
  29296. }
  29297. var charstrings = data.charstrings;
  29298. var type2Charstrings = this.getType2Charstrings(charstrings);
  29299. var subrs = this.getType2Subrs(data.subrs);
  29300. this.charstrings = charstrings;
  29301. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  29302. this.seacs = this.getSeacs(data.charstrings);
  29303. }
  29304. Type1Font.prototype = {
  29305. get numGlyphs() {
  29306. return this.charstrings.length + 1;
  29307. },
  29308. getCharset: function Type1Font_getCharset() {
  29309. var charset = ['.notdef'];
  29310. var charstrings = this.charstrings;
  29311. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  29312. charset.push(charstrings[glyphId].glyphName);
  29313. }
  29314. return charset;
  29315. },
  29316. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  29317. var charstrings = this.charstrings;
  29318. var glyphNames = ['.notdef'],
  29319. glyphId;
  29320. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  29321. glyphNames.push(charstrings[glyphId].glyphName);
  29322. }
  29323. var encoding = properties.builtInEncoding;
  29324. if (encoding) {
  29325. var builtInEncoding = Object.create(null);
  29326. for (var charCode in encoding) {
  29327. glyphId = glyphNames.indexOf(encoding[charCode]);
  29328. if (glyphId >= 0) {
  29329. builtInEncoding[charCode] = glyphId;
  29330. }
  29331. }
  29332. }
  29333. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  29334. },
  29335. getSeacs: function Type1Font_getSeacs(charstrings) {
  29336. var i, ii;
  29337. var seacMap = [];
  29338. for (i = 0, ii = charstrings.length; i < ii; i++) {
  29339. var charstring = charstrings[i];
  29340. if (charstring.seac) {
  29341. seacMap[i + 1] = charstring.seac;
  29342. }
  29343. }
  29344. return seacMap;
  29345. },
  29346. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  29347. var type2Charstrings = [];
  29348. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  29349. type2Charstrings.push(type1Charstrings[i].charstring);
  29350. }
  29351. return type2Charstrings;
  29352. },
  29353. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  29354. var bias = 0;
  29355. var count = type1Subrs.length;
  29356. if (count < 1133) {
  29357. bias = 107;
  29358. } else if (count < 33769) {
  29359. bias = 1131;
  29360. } else {
  29361. bias = 32768;
  29362. }
  29363. var type2Subrs = [];
  29364. var i;
  29365. for (i = 0; i < bias; i++) {
  29366. type2Subrs.push([0x0B]);
  29367. }
  29368. for (i = 0; i < count; i++) {
  29369. type2Subrs.push(type1Subrs[i]);
  29370. }
  29371. return type2Subrs;
  29372. },
  29373. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  29374. var cff = new _cff_parser.CFF();
  29375. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  29376. cff.names = [name];
  29377. var topDict = new _cff_parser.CFFTopDict();
  29378. topDict.setByName('version', 391);
  29379. topDict.setByName('Notice', 392);
  29380. topDict.setByName('FullName', 393);
  29381. topDict.setByName('FamilyName', 394);
  29382. topDict.setByName('Weight', 395);
  29383. topDict.setByName('Encoding', null);
  29384. topDict.setByName('FontMatrix', properties.fontMatrix);
  29385. topDict.setByName('FontBBox', properties.bbox);
  29386. topDict.setByName('charset', null);
  29387. topDict.setByName('CharStrings', null);
  29388. topDict.setByName('Private', null);
  29389. cff.topDict = topDict;
  29390. var strings = new _cff_parser.CFFStrings();
  29391. strings.add('Version 0.11');
  29392. strings.add('See original notice');
  29393. strings.add(name);
  29394. strings.add(name);
  29395. strings.add('Medium');
  29396. cff.strings = strings;
  29397. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  29398. var count = glyphs.length;
  29399. var charsetArray = [0];
  29400. var i, ii;
  29401. for (i = 0; i < count; i++) {
  29402. var index = _cff_parser.CFFStandardStrings.indexOf(charstrings[i].glyphName);
  29403. if (index === -1) {
  29404. index = 0;
  29405. }
  29406. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  29407. }
  29408. cff.charset = new _cff_parser.CFFCharset(false, 0, [], charsetArray);
  29409. var charStringsIndex = new _cff_parser.CFFIndex();
  29410. charStringsIndex.add([0x8B, 0x0E]);
  29411. for (i = 0; i < count; i++) {
  29412. var glyph = glyphs[i];
  29413. if (glyph.length === 0) {
  29414. charStringsIndex.add([0x8B, 0x0E]);
  29415. continue;
  29416. }
  29417. charStringsIndex.add(glyph);
  29418. }
  29419. cff.charStrings = charStringsIndex;
  29420. var privateDict = new _cff_parser.CFFPrivateDict();
  29421. privateDict.setByName('Subrs', null);
  29422. var fields = ['BlueValues', 'OtherBlues', 'FamilyBlues', 'FamilyOtherBlues', 'StemSnapH', 'StemSnapV', 'BlueShift', 'BlueFuzz', 'BlueScale', 'LanguageGroup', 'ExpansionFactor', 'ForceBold', 'StdHW', 'StdVW'];
  29423. for (i = 0, ii = fields.length; i < ii; i++) {
  29424. var field = fields[i];
  29425. if (!(field in properties.privateData)) {
  29426. continue;
  29427. }
  29428. var value = properties.privateData[field];
  29429. if ((0, _util.isArray)(value)) {
  29430. for (var j = value.length - 1; j > 0; j--) {
  29431. value[j] -= value[j - 1];
  29432. }
  29433. }
  29434. privateDict.setByName(field, value);
  29435. }
  29436. cff.topDict.privateDict = privateDict;
  29437. var subrIndex = new _cff_parser.CFFIndex();
  29438. for (i = 0, ii = subrs.length; i < ii; i++) {
  29439. subrIndex.add(subrs[i]);
  29440. }
  29441. privateDict.subrsIndex = subrIndex;
  29442. var compiler = new _cff_parser.CFFCompiler(cff);
  29443. return compiler.compile();
  29444. }
  29445. };
  29446. return Type1Font;
  29447. }();
  29448. var CFFFont = function CFFFontClosure() {
  29449. function CFFFont(file, properties) {
  29450. this.properties = properties;
  29451. var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  29452. this.cff = parser.parse();
  29453. var compiler = new _cff_parser.CFFCompiler(this.cff);
  29454. this.seacs = this.cff.seacs;
  29455. try {
  29456. this.data = compiler.compile();
  29457. } catch (e) {
  29458. (0, _util.warn)('Failed to compile font ' + properties.loadedName);
  29459. this.data = file;
  29460. }
  29461. }
  29462. CFFFont.prototype = {
  29463. get numGlyphs() {
  29464. return this.cff.charStrings.count;
  29465. },
  29466. getCharset: function CFFFont_getCharset() {
  29467. return this.cff.charset.charset;
  29468. },
  29469. getGlyphMapping: function CFFFont_getGlyphMapping() {
  29470. var cff = this.cff;
  29471. var properties = this.properties;
  29472. var charsets = cff.charset.charset;
  29473. var charCodeToGlyphId;
  29474. var glyphId;
  29475. if (properties.composite) {
  29476. charCodeToGlyphId = Object.create(null);
  29477. if (cff.isCIDFont) {
  29478. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  29479. var cid = charsets[glyphId];
  29480. var charCode = properties.cMap.charCodeOf(cid);
  29481. charCodeToGlyphId[charCode] = glyphId;
  29482. }
  29483. } else {
  29484. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  29485. charCodeToGlyphId[glyphId] = glyphId;
  29486. }
  29487. }
  29488. return charCodeToGlyphId;
  29489. }
  29490. var encoding = cff.encoding ? cff.encoding.encoding : null;
  29491. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  29492. return charCodeToGlyphId;
  29493. }
  29494. };
  29495. return CFFFont;
  29496. }();
  29497. (function checkSeacSupport() {
  29498. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  29499. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED = true;
  29500. }
  29501. })();
  29502. (function checkChromeWindows() {
  29503. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  29504. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  29505. }
  29506. })();
  29507. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  29508. exports.PRIVATE_USE_OFFSET_START = PRIVATE_USE_OFFSET_START;
  29509. exports.PRIVATE_USE_OFFSET_END = PRIVATE_USE_OFFSET_END;
  29510. exports.ErrorFont = ErrorFont;
  29511. exports.Font = Font;
  29512. exports.FontFlags = FontFlags;
  29513. exports.ToUnicodeMap = ToUnicodeMap;
  29514. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  29515. exports.ProblematicCharRanges = ProblematicCharRanges;
  29516. exports.getFontType = getFontType;
  29517. /***/ }),
  29518. /* 27 */
  29519. /***/ (function(module, exports, __w_pdfjs_require__) {
  29520. "use strict";
  29521. Object.defineProperty(exports, "__esModule", {
  29522. value: true
  29523. });
  29524. exports.PDFImage = undefined;
  29525. var _util = __w_pdfjs_require__(0);
  29526. var _stream = __w_pdfjs_require__(2);
  29527. var _primitives = __w_pdfjs_require__(1);
  29528. var _colorspace = __w_pdfjs_require__(3);
  29529. var _jpx = __w_pdfjs_require__(15);
  29530. var PDFImage = function PDFImageClosure() {
  29531. function handleImageData(image, nativeDecoder) {
  29532. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  29533. return nativeDecoder.decode(image);
  29534. }
  29535. return Promise.resolve(image);
  29536. }
  29537. function decodeAndClamp(value, addend, coefficient, max) {
  29538. value = addend + value * coefficient;
  29539. return value < 0 ? 0 : value > max ? max : value;
  29540. }
  29541. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  29542. var length = w2 * h2;
  29543. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  29544. var xRatio = w1 / w2;
  29545. var yRatio = h1 / h2;
  29546. var i,
  29547. j,
  29548. py,
  29549. newIndex = 0,
  29550. oldIndex;
  29551. var xScaled = new Uint16Array(w2);
  29552. var w1Scanline = w1;
  29553. for (i = 0; i < w2; i++) {
  29554. xScaled[i] = Math.floor(i * xRatio);
  29555. }
  29556. for (i = 0; i < h2; i++) {
  29557. py = Math.floor(i * yRatio) * w1Scanline;
  29558. for (j = 0; j < w2; j++) {
  29559. oldIndex = py + xScaled[j];
  29560. dest[newIndex++] = src[oldIndex];
  29561. }
  29562. }
  29563. return dest;
  29564. }
  29565. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  29566. this.image = image;
  29567. var dict = image.dict;
  29568. if (dict.has('Filter')) {
  29569. var filter = dict.get('Filter').name;
  29570. if (filter === 'JPXDecode') {
  29571. var jpxImage = new _jpx.JpxImage();
  29572. jpxImage.parseImageProperties(image.stream);
  29573. image.stream.reset();
  29574. image.bitsPerComponent = jpxImage.bitsPerComponent;
  29575. image.numComps = jpxImage.componentsCount;
  29576. } else if (filter === 'JBIG2Decode') {
  29577. image.bitsPerComponent = 1;
  29578. image.numComps = 1;
  29579. }
  29580. }
  29581. this.width = dict.get('Width', 'W');
  29582. this.height = dict.get('Height', 'H');
  29583. if (this.width < 1 || this.height < 1) {
  29584. (0, _util.error)('Invalid image width: ' + this.width + ' or height: ' + this.height);
  29585. }
  29586. this.interpolate = dict.get('Interpolate', 'I') || false;
  29587. this.imageMask = dict.get('ImageMask', 'IM') || false;
  29588. this.matte = dict.get('Matte') || false;
  29589. var bitsPerComponent = image.bitsPerComponent;
  29590. if (!bitsPerComponent) {
  29591. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  29592. if (!bitsPerComponent) {
  29593. if (this.imageMask) {
  29594. bitsPerComponent = 1;
  29595. } else {
  29596. (0, _util.error)('Bits per component missing in image: ' + this.imageMask);
  29597. }
  29598. }
  29599. }
  29600. this.bpc = bitsPerComponent;
  29601. if (!this.imageMask) {
  29602. var colorSpace = dict.get('ColorSpace', 'CS');
  29603. if (!colorSpace) {
  29604. (0, _util.info)('JPX images (which do not require color spaces)');
  29605. switch (image.numComps) {
  29606. case 1:
  29607. colorSpace = _primitives.Name.get('DeviceGray');
  29608. break;
  29609. case 3:
  29610. colorSpace = _primitives.Name.get('DeviceRGB');
  29611. break;
  29612. case 4:
  29613. colorSpace = _primitives.Name.get('DeviceCMYK');
  29614. break;
  29615. default:
  29616. (0, _util.error)('JPX images with ' + this.numComps + ' color components not supported.');
  29617. }
  29618. }
  29619. this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, res);
  29620. this.numComps = this.colorSpace.numComps;
  29621. }
  29622. this.decode = dict.getArray('Decode', 'D');
  29623. this.needsDecode = false;
  29624. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  29625. this.needsDecode = true;
  29626. var max = (1 << bitsPerComponent) - 1;
  29627. this.decodeCoefficients = [];
  29628. this.decodeAddends = [];
  29629. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  29630. var dmin = this.decode[i];
  29631. var dmax = this.decode[i + 1];
  29632. this.decodeCoefficients[j] = dmax - dmin;
  29633. this.decodeAddends[j] = max * dmin;
  29634. }
  29635. }
  29636. if (smask) {
  29637. this.smask = new PDFImage(xref, res, smask, false);
  29638. } else if (mask) {
  29639. if ((0, _primitives.isStream)(mask)) {
  29640. var maskDict = mask.dict,
  29641. imageMask = maskDict.get('ImageMask', 'IM');
  29642. if (!imageMask) {
  29643. (0, _util.warn)('Ignoring /Mask in image without /ImageMask.');
  29644. } else {
  29645. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  29646. }
  29647. } else {
  29648. this.mask = mask;
  29649. }
  29650. }
  29651. }
  29652. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  29653. var imagePromise = handleImageData(image, nativeDecoder);
  29654. var smaskPromise;
  29655. var maskPromise;
  29656. var smask = image.dict.get('SMask');
  29657. var mask = image.dict.get('Mask');
  29658. if (smask) {
  29659. smaskPromise = handleImageData(smask, nativeDecoder);
  29660. maskPromise = Promise.resolve(null);
  29661. } else {
  29662. smaskPromise = Promise.resolve(null);
  29663. if (mask) {
  29664. if ((0, _primitives.isStream)(mask)) {
  29665. maskPromise = handleImageData(mask, nativeDecoder);
  29666. } else if ((0, _util.isArray)(mask)) {
  29667. maskPromise = Promise.resolve(mask);
  29668. } else {
  29669. (0, _util.warn)('Unsupported mask format.');
  29670. maskPromise = Promise.resolve(null);
  29671. }
  29672. } else {
  29673. maskPromise = Promise.resolve(null);
  29674. }
  29675. }
  29676. return Promise.all([imagePromise, smaskPromise, maskPromise]).then(function (results) {
  29677. var imageData = results[0];
  29678. var smaskData = results[1];
  29679. var maskData = results[2];
  29680. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  29681. });
  29682. };
  29683. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  29684. var computedLength = (width + 7 >> 3) * height;
  29685. var actualLength = imgArray.byteLength;
  29686. var haveFullData = computedLength === actualLength;
  29687. var data, i;
  29688. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  29689. data = imgArray;
  29690. } else if (!inverseDecode) {
  29691. data = new Uint8Array(actualLength);
  29692. data.set(imgArray);
  29693. } else {
  29694. data = new Uint8Array(computedLength);
  29695. data.set(imgArray);
  29696. for (i = actualLength; i < computedLength; i++) {
  29697. data[i] = 0xff;
  29698. }
  29699. }
  29700. if (inverseDecode) {
  29701. for (i = 0; i < actualLength; i++) {
  29702. data[i] = ~data[i];
  29703. }
  29704. }
  29705. return {
  29706. data: data,
  29707. width: width,
  29708. height: height
  29709. };
  29710. };
  29711. PDFImage.prototype = {
  29712. get drawWidth() {
  29713. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  29714. },
  29715. get drawHeight() {
  29716. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  29717. },
  29718. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  29719. var bpc = this.bpc;
  29720. var numComps = this.numComps;
  29721. var decodeAddends = this.decodeAddends;
  29722. var decodeCoefficients = this.decodeCoefficients;
  29723. var max = (1 << bpc) - 1;
  29724. var i, ii;
  29725. if (bpc === 1) {
  29726. for (i = 0, ii = buffer.length; i < ii; i++) {
  29727. buffer[i] = +!buffer[i];
  29728. }
  29729. return;
  29730. }
  29731. var index = 0;
  29732. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  29733. for (var j = 0; j < numComps; j++) {
  29734. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  29735. index++;
  29736. }
  29737. }
  29738. },
  29739. getComponents: function PDFImage_getComponents(buffer) {
  29740. var bpc = this.bpc;
  29741. if (bpc === 8) {
  29742. return buffer;
  29743. }
  29744. var width = this.width;
  29745. var height = this.height;
  29746. var numComps = this.numComps;
  29747. var length = width * height * numComps;
  29748. var bufferPos = 0;
  29749. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  29750. var rowComps = width * numComps;
  29751. var max = (1 << bpc) - 1;
  29752. var i = 0,
  29753. ii,
  29754. buf;
  29755. if (bpc === 1) {
  29756. var mask, loop1End, loop2End;
  29757. for (var j = 0; j < height; j++) {
  29758. loop1End = i + (rowComps & ~7);
  29759. loop2End = i + rowComps;
  29760. while (i < loop1End) {
  29761. buf = buffer[bufferPos++];
  29762. output[i] = buf >> 7 & 1;
  29763. output[i + 1] = buf >> 6 & 1;
  29764. output[i + 2] = buf >> 5 & 1;
  29765. output[i + 3] = buf >> 4 & 1;
  29766. output[i + 4] = buf >> 3 & 1;
  29767. output[i + 5] = buf >> 2 & 1;
  29768. output[i + 6] = buf >> 1 & 1;
  29769. output[i + 7] = buf & 1;
  29770. i += 8;
  29771. }
  29772. if (i < loop2End) {
  29773. buf = buffer[bufferPos++];
  29774. mask = 128;
  29775. while (i < loop2End) {
  29776. output[i++] = +!!(buf & mask);
  29777. mask >>= 1;
  29778. }
  29779. }
  29780. }
  29781. } else {
  29782. var bits = 0;
  29783. buf = 0;
  29784. for (i = 0, ii = length; i < ii; ++i) {
  29785. if (i % rowComps === 0) {
  29786. buf = 0;
  29787. bits = 0;
  29788. }
  29789. while (bits < bpc) {
  29790. buf = buf << 8 | buffer[bufferPos++];
  29791. bits += 8;
  29792. }
  29793. var remainingBits = bits - bpc;
  29794. var value = buf >> remainingBits;
  29795. output[i] = value < 0 ? 0 : value > max ? max : value;
  29796. buf = buf & (1 << remainingBits) - 1;
  29797. bits = remainingBits;
  29798. }
  29799. }
  29800. return output;
  29801. },
  29802. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  29803. var smask = this.smask;
  29804. var mask = this.mask;
  29805. var alphaBuf, sw, sh, i, ii, j;
  29806. if (smask) {
  29807. sw = smask.width;
  29808. sh = smask.height;
  29809. alphaBuf = new Uint8Array(sw * sh);
  29810. smask.fillGrayBuffer(alphaBuf);
  29811. if (sw !== width || sh !== height) {
  29812. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  29813. }
  29814. } else if (mask) {
  29815. if (mask instanceof PDFImage) {
  29816. sw = mask.width;
  29817. sh = mask.height;
  29818. alphaBuf = new Uint8Array(sw * sh);
  29819. mask.numComps = 1;
  29820. mask.fillGrayBuffer(alphaBuf);
  29821. for (i = 0, ii = sw * sh; i < ii; ++i) {
  29822. alphaBuf[i] = 255 - alphaBuf[i];
  29823. }
  29824. if (sw !== width || sh !== height) {
  29825. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  29826. }
  29827. } else if ((0, _util.isArray)(mask)) {
  29828. alphaBuf = new Uint8Array(width * height);
  29829. var numComps = this.numComps;
  29830. for (i = 0, ii = width * height; i < ii; ++i) {
  29831. var opacity = 0;
  29832. var imageOffset = i * numComps;
  29833. for (j = 0; j < numComps; ++j) {
  29834. var color = image[imageOffset + j];
  29835. var maskOffset = j * 2;
  29836. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  29837. opacity = 255;
  29838. break;
  29839. }
  29840. }
  29841. alphaBuf[i] = opacity;
  29842. }
  29843. } else {
  29844. (0, _util.error)('Unknown mask format.');
  29845. }
  29846. }
  29847. if (alphaBuf) {
  29848. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  29849. rgbaBuf[j] = alphaBuf[i];
  29850. }
  29851. } else {
  29852. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  29853. rgbaBuf[j] = 255;
  29854. }
  29855. }
  29856. },
  29857. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  29858. var matte = this.smask && this.smask.matte;
  29859. if (!matte) {
  29860. return;
  29861. }
  29862. var matteRgb = this.colorSpace.getRgb(matte, 0);
  29863. var matteR = matteRgb[0];
  29864. var matteG = matteRgb[1];
  29865. var matteB = matteRgb[2];
  29866. var length = width * height * 4;
  29867. var r, g, b;
  29868. for (var i = 0; i < length; i += 4) {
  29869. var alpha = buffer[i + 3];
  29870. if (alpha === 0) {
  29871. buffer[i] = 255;
  29872. buffer[i + 1] = 255;
  29873. buffer[i + 2] = 255;
  29874. continue;
  29875. }
  29876. var k = 255 / alpha;
  29877. r = (buffer[i] - matteR) * k + matteR;
  29878. g = (buffer[i + 1] - matteG) * k + matteG;
  29879. b = (buffer[i + 2] - matteB) * k + matteB;
  29880. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  29881. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  29882. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  29883. }
  29884. },
  29885. createImageData: function PDFImage_createImageData(forceRGBA) {
  29886. var drawWidth = this.drawWidth;
  29887. var drawHeight = this.drawHeight;
  29888. var imgData = {
  29889. width: drawWidth,
  29890. height: drawHeight
  29891. };
  29892. var numComps = this.numComps;
  29893. var originalWidth = this.width;
  29894. var originalHeight = this.height;
  29895. var bpc = this.bpc;
  29896. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  29897. var imgArray;
  29898. if (!forceRGBA) {
  29899. var kind;
  29900. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  29901. kind = _util.ImageKind.GRAYSCALE_1BPP;
  29902. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  29903. kind = _util.ImageKind.RGB_24BPP;
  29904. }
  29905. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  29906. imgData.kind = kind;
  29907. imgArray = this.getImageBytes(originalHeight * rowBytes);
  29908. if (this.image instanceof _stream.DecodeStream) {
  29909. imgData.data = imgArray;
  29910. } else {
  29911. var newArray = new Uint8Array(imgArray.length);
  29912. newArray.set(imgArray);
  29913. imgData.data = newArray;
  29914. }
  29915. if (this.needsDecode) {
  29916. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP);
  29917. var buffer = imgData.data;
  29918. for (var i = 0, ii = buffer.length; i < ii; i++) {
  29919. buffer[i] ^= 0xff;
  29920. }
  29921. }
  29922. return imgData;
  29923. }
  29924. if (this.image instanceof _stream.JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  29925. imgData.kind = _util.ImageKind.RGB_24BPP;
  29926. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  29927. return imgData;
  29928. }
  29929. }
  29930. imgArray = this.getImageBytes(originalHeight * rowBytes);
  29931. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  29932. var comps = this.getComponents(imgArray);
  29933. var alpha01, maybeUndoPreblend;
  29934. if (!forceRGBA && !this.smask && !this.mask) {
  29935. imgData.kind = _util.ImageKind.RGB_24BPP;
  29936. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  29937. alpha01 = 0;
  29938. maybeUndoPreblend = false;
  29939. } else {
  29940. imgData.kind = _util.ImageKind.RGBA_32BPP;
  29941. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  29942. alpha01 = 1;
  29943. maybeUndoPreblend = true;
  29944. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  29945. }
  29946. if (this.needsDecode) {
  29947. this.decodeBuffer(comps);
  29948. }
  29949. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  29950. if (maybeUndoPreblend) {
  29951. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  29952. }
  29953. return imgData;
  29954. },
  29955. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  29956. var numComps = this.numComps;
  29957. if (numComps !== 1) {
  29958. (0, _util.error)('Reading gray scale from a color image: ' + numComps);
  29959. }
  29960. var width = this.width;
  29961. var height = this.height;
  29962. var bpc = this.bpc;
  29963. var rowBytes = width * numComps * bpc + 7 >> 3;
  29964. var imgArray = this.getImageBytes(height * rowBytes);
  29965. var comps = this.getComponents(imgArray);
  29966. var i, length;
  29967. if (bpc === 1) {
  29968. length = width * height;
  29969. if (this.needsDecode) {
  29970. for (i = 0; i < length; ++i) {
  29971. buffer[i] = comps[i] - 1 & 255;
  29972. }
  29973. } else {
  29974. for (i = 0; i < length; ++i) {
  29975. buffer[i] = -comps[i] & 255;
  29976. }
  29977. }
  29978. return;
  29979. }
  29980. if (this.needsDecode) {
  29981. this.decodeBuffer(comps);
  29982. }
  29983. length = width * height;
  29984. var scale = 255 / ((1 << bpc) - 1);
  29985. for (i = 0; i < length; ++i) {
  29986. buffer[i] = scale * comps[i] | 0;
  29987. }
  29988. },
  29989. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  29990. this.image.reset();
  29991. this.image.drawWidth = drawWidth || this.width;
  29992. this.image.drawHeight = drawHeight || this.height;
  29993. this.image.forceRGB = !!forceRGB;
  29994. return this.image.getBytes(length);
  29995. }
  29996. };
  29997. return PDFImage;
  29998. }();
  29999. exports.PDFImage = PDFImage;
  30000. /***/ }),
  30001. /* 28 */
  30002. /***/ (function(module, exports, __w_pdfjs_require__) {
  30003. "use strict";
  30004. Object.defineProperty(exports, "__esModule", {
  30005. value: true
  30006. });
  30007. exports.Jbig2Image = undefined;
  30008. var _util = __w_pdfjs_require__(0);
  30009. var _arithmetic_decoder = __w_pdfjs_require__(10);
  30010. var Jbig2Image = function Jbig2ImageClosure() {
  30011. function ContextCache() {}
  30012. ContextCache.prototype = {
  30013. getContexts: function getContexts(id) {
  30014. if (id in this) {
  30015. return this[id];
  30016. }
  30017. return this[id] = new Int8Array(1 << 16);
  30018. }
  30019. };
  30020. function DecodingContext(data, start, end) {
  30021. this.data = data;
  30022. this.start = start;
  30023. this.end = end;
  30024. }
  30025. DecodingContext.prototype = {
  30026. get decoder() {
  30027. var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  30028. return (0, _util.shadow)(this, 'decoder', decoder);
  30029. },
  30030. get contextCache() {
  30031. var cache = new ContextCache();
  30032. return (0, _util.shadow)(this, 'contextCache', cache);
  30033. }
  30034. };
  30035. function decodeInteger(contextCache, procedure, decoder) {
  30036. var contexts = contextCache.getContexts(procedure);
  30037. var prev = 1;
  30038. function readBits(length) {
  30039. var v = 0;
  30040. for (var i = 0; i < length; i++) {
  30041. var bit = decoder.readBit(contexts, prev);
  30042. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  30043. v = v << 1 | bit;
  30044. }
  30045. return v >>> 0;
  30046. }
  30047. var sign = readBits(1);
  30048. 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);
  30049. return sign === 0 ? value : value > 0 ? -value : null;
  30050. }
  30051. function decodeIAID(contextCache, decoder, codeLength) {
  30052. var contexts = contextCache.getContexts('IAID');
  30053. var prev = 1;
  30054. for (var i = 0; i < codeLength; i++) {
  30055. var bit = decoder.readBit(contexts, prev);
  30056. prev = prev << 1 | bit;
  30057. }
  30058. if (codeLength < 31) {
  30059. return prev & (1 << codeLength) - 1;
  30060. }
  30061. return prev & 0x7FFFFFFF;
  30062. }
  30063. 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'];
  30064. var CodingTemplates = [[{
  30065. x: -1,
  30066. y: -2
  30067. }, {
  30068. x: 0,
  30069. y: -2
  30070. }, {
  30071. x: 1,
  30072. y: -2
  30073. }, {
  30074. x: -2,
  30075. y: -1
  30076. }, {
  30077. x: -1,
  30078. y: -1
  30079. }, {
  30080. x: 0,
  30081. y: -1
  30082. }, {
  30083. x: 1,
  30084. y: -1
  30085. }, {
  30086. x: 2,
  30087. y: -1
  30088. }, {
  30089. x: -4,
  30090. y: 0
  30091. }, {
  30092. x: -3,
  30093. y: 0
  30094. }, {
  30095. x: -2,
  30096. y: 0
  30097. }, {
  30098. x: -1,
  30099. y: 0
  30100. }], [{
  30101. x: -1,
  30102. y: -2
  30103. }, {
  30104. x: 0,
  30105. y: -2
  30106. }, {
  30107. x: 1,
  30108. y: -2
  30109. }, {
  30110. x: 2,
  30111. y: -2
  30112. }, {
  30113. x: -2,
  30114. y: -1
  30115. }, {
  30116. x: -1,
  30117. y: -1
  30118. }, {
  30119. x: 0,
  30120. y: -1
  30121. }, {
  30122. x: 1,
  30123. y: -1
  30124. }, {
  30125. x: 2,
  30126. y: -1
  30127. }, {
  30128. x: -3,
  30129. y: 0
  30130. }, {
  30131. x: -2,
  30132. y: 0
  30133. }, {
  30134. x: -1,
  30135. y: 0
  30136. }], [{
  30137. x: -1,
  30138. y: -2
  30139. }, {
  30140. x: 0,
  30141. y: -2
  30142. }, {
  30143. x: 1,
  30144. y: -2
  30145. }, {
  30146. x: -2,
  30147. y: -1
  30148. }, {
  30149. x: -1,
  30150. y: -1
  30151. }, {
  30152. x: 0,
  30153. y: -1
  30154. }, {
  30155. x: 1,
  30156. y: -1
  30157. }, {
  30158. x: -2,
  30159. y: 0
  30160. }, {
  30161. x: -1,
  30162. y: 0
  30163. }], [{
  30164. x: -3,
  30165. y: -1
  30166. }, {
  30167. x: -2,
  30168. y: -1
  30169. }, {
  30170. x: -1,
  30171. y: -1
  30172. }, {
  30173. x: 0,
  30174. y: -1
  30175. }, {
  30176. x: 1,
  30177. y: -1
  30178. }, {
  30179. x: -4,
  30180. y: 0
  30181. }, {
  30182. x: -3,
  30183. y: 0
  30184. }, {
  30185. x: -2,
  30186. y: 0
  30187. }, {
  30188. x: -1,
  30189. y: 0
  30190. }]];
  30191. var RefinementTemplates = [{
  30192. coding: [{
  30193. x: 0,
  30194. y: -1
  30195. }, {
  30196. x: 1,
  30197. y: -1
  30198. }, {
  30199. x: -1,
  30200. y: 0
  30201. }],
  30202. reference: [{
  30203. x: 0,
  30204. y: -1
  30205. }, {
  30206. x: 1,
  30207. y: -1
  30208. }, {
  30209. x: -1,
  30210. y: 0
  30211. }, {
  30212. x: 0,
  30213. y: 0
  30214. }, {
  30215. x: 1,
  30216. y: 0
  30217. }, {
  30218. x: -1,
  30219. y: 1
  30220. }, {
  30221. x: 0,
  30222. y: 1
  30223. }, {
  30224. x: 1,
  30225. y: 1
  30226. }]
  30227. }, {
  30228. coding: [{
  30229. x: -1,
  30230. y: -1
  30231. }, {
  30232. x: 0,
  30233. y: -1
  30234. }, {
  30235. x: 1,
  30236. y: -1
  30237. }, {
  30238. x: -1,
  30239. y: 0
  30240. }],
  30241. reference: [{
  30242. x: 0,
  30243. y: -1
  30244. }, {
  30245. x: -1,
  30246. y: 0
  30247. }, {
  30248. x: 0,
  30249. y: 0
  30250. }, {
  30251. x: 1,
  30252. y: 0
  30253. }, {
  30254. x: 0,
  30255. y: 1
  30256. }, {
  30257. x: 1,
  30258. y: 1
  30259. }]
  30260. }];
  30261. var ReusedContexts = [0x9B25, 0x0795, 0x00E5, 0x0195];
  30262. var RefinementReusedContexts = [0x0020, 0x0008];
  30263. function decodeBitmapTemplate0(width, height, decodingContext) {
  30264. var decoder = decodingContext.decoder;
  30265. var contexts = decodingContext.contextCache.getContexts('GB');
  30266. var contextLabel,
  30267. i,
  30268. j,
  30269. pixel,
  30270. row,
  30271. row1,
  30272. row2,
  30273. bitmap = [];
  30274. var OLD_PIXEL_MASK = 0x7BF7;
  30275. for (i = 0; i < height; i++) {
  30276. row = bitmap[i] = new Uint8Array(width);
  30277. row1 = i < 1 ? row : bitmap[i - 1];
  30278. row2 = i < 2 ? row : bitmap[i - 2];
  30279. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  30280. for (j = 0; j < width; j++) {
  30281. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  30282. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  30283. }
  30284. }
  30285. return bitmap;
  30286. }
  30287. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  30288. if (mmr) {
  30289. (0, _util.error)('JBIG2 error: MMR encoding is not supported');
  30290. }
  30291. 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) {
  30292. return decodeBitmapTemplate0(width, height, decodingContext);
  30293. }
  30294. var useskip = !!skip;
  30295. var template = CodingTemplates[templateIndex].concat(at);
  30296. template.sort(function (a, b) {
  30297. return a.y - b.y || a.x - b.x;
  30298. });
  30299. var templateLength = template.length;
  30300. var templateX = new Int8Array(templateLength);
  30301. var templateY = new Int8Array(templateLength);
  30302. var changingTemplateEntries = [];
  30303. var reuseMask = 0,
  30304. minX = 0,
  30305. maxX = 0,
  30306. minY = 0;
  30307. var c, k;
  30308. for (k = 0; k < templateLength; k++) {
  30309. templateX[k] = template[k].x;
  30310. templateY[k] = template[k].y;
  30311. minX = Math.min(minX, template[k].x);
  30312. maxX = Math.max(maxX, template[k].x);
  30313. minY = Math.min(minY, template[k].y);
  30314. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  30315. reuseMask |= 1 << templateLength - 1 - k;
  30316. } else {
  30317. changingTemplateEntries.push(k);
  30318. }
  30319. }
  30320. var changingEntriesLength = changingTemplateEntries.length;
  30321. var changingTemplateX = new Int8Array(changingEntriesLength);
  30322. var changingTemplateY = new Int8Array(changingEntriesLength);
  30323. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  30324. for (c = 0; c < changingEntriesLength; c++) {
  30325. k = changingTemplateEntries[c];
  30326. changingTemplateX[c] = template[k].x;
  30327. changingTemplateY[c] = template[k].y;
  30328. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  30329. }
  30330. var sbb_left = -minX;
  30331. var sbb_top = -minY;
  30332. var sbb_right = width - maxX;
  30333. var pseudoPixelContext = ReusedContexts[templateIndex];
  30334. var row = new Uint8Array(width);
  30335. var bitmap = [];
  30336. var decoder = decodingContext.decoder;
  30337. var contexts = decodingContext.contextCache.getContexts('GB');
  30338. var ltp = 0,
  30339. j,
  30340. i0,
  30341. j0,
  30342. contextLabel = 0,
  30343. bit,
  30344. shift;
  30345. for (var i = 0; i < height; i++) {
  30346. if (prediction) {
  30347. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  30348. ltp ^= sltp;
  30349. if (ltp) {
  30350. bitmap.push(row);
  30351. continue;
  30352. }
  30353. }
  30354. row = new Uint8Array(row);
  30355. bitmap.push(row);
  30356. for (j = 0; j < width; j++) {
  30357. if (useskip && skip[i][j]) {
  30358. row[j] = 0;
  30359. continue;
  30360. }
  30361. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  30362. contextLabel = contextLabel << 1 & reuseMask;
  30363. for (k = 0; k < changingEntriesLength; k++) {
  30364. i0 = i + changingTemplateY[k];
  30365. j0 = j + changingTemplateX[k];
  30366. bit = bitmap[i0][j0];
  30367. if (bit) {
  30368. bit = changingTemplateBit[k];
  30369. contextLabel |= bit;
  30370. }
  30371. }
  30372. } else {
  30373. contextLabel = 0;
  30374. shift = templateLength - 1;
  30375. for (k = 0; k < templateLength; k++, shift--) {
  30376. j0 = j + templateX[k];
  30377. if (j0 >= 0 && j0 < width) {
  30378. i0 = i + templateY[k];
  30379. if (i0 >= 0) {
  30380. bit = bitmap[i0][j0];
  30381. if (bit) {
  30382. contextLabel |= bit << shift;
  30383. }
  30384. }
  30385. }
  30386. }
  30387. }
  30388. var pixel = decoder.readBit(contexts, contextLabel);
  30389. row[j] = pixel;
  30390. }
  30391. }
  30392. return bitmap;
  30393. }
  30394. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  30395. var codingTemplate = RefinementTemplates[templateIndex].coding;
  30396. if (templateIndex === 0) {
  30397. codingTemplate = codingTemplate.concat([at[0]]);
  30398. }
  30399. var codingTemplateLength = codingTemplate.length;
  30400. var codingTemplateX = new Int32Array(codingTemplateLength);
  30401. var codingTemplateY = new Int32Array(codingTemplateLength);
  30402. var k;
  30403. for (k = 0; k < codingTemplateLength; k++) {
  30404. codingTemplateX[k] = codingTemplate[k].x;
  30405. codingTemplateY[k] = codingTemplate[k].y;
  30406. }
  30407. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  30408. if (templateIndex === 0) {
  30409. referenceTemplate = referenceTemplate.concat([at[1]]);
  30410. }
  30411. var referenceTemplateLength = referenceTemplate.length;
  30412. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  30413. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  30414. for (k = 0; k < referenceTemplateLength; k++) {
  30415. referenceTemplateX[k] = referenceTemplate[k].x;
  30416. referenceTemplateY[k] = referenceTemplate[k].y;
  30417. }
  30418. var referenceWidth = referenceBitmap[0].length;
  30419. var referenceHeight = referenceBitmap.length;
  30420. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  30421. var bitmap = [];
  30422. var decoder = decodingContext.decoder;
  30423. var contexts = decodingContext.contextCache.getContexts('GR');
  30424. var ltp = 0;
  30425. for (var i = 0; i < height; i++) {
  30426. if (prediction) {
  30427. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  30428. ltp ^= sltp;
  30429. if (ltp) {
  30430. (0, _util.error)('JBIG2 error: prediction is not supported');
  30431. }
  30432. }
  30433. var row = new Uint8Array(width);
  30434. bitmap.push(row);
  30435. for (var j = 0; j < width; j++) {
  30436. var i0, j0;
  30437. var contextLabel = 0;
  30438. for (k = 0; k < codingTemplateLength; k++) {
  30439. i0 = i + codingTemplateY[k];
  30440. j0 = j + codingTemplateX[k];
  30441. if (i0 < 0 || j0 < 0 || j0 >= width) {
  30442. contextLabel <<= 1;
  30443. } else {
  30444. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  30445. }
  30446. }
  30447. for (k = 0; k < referenceTemplateLength; k++) {
  30448. i0 = i + referenceTemplateY[k] - offsetY;
  30449. j0 = j + referenceTemplateX[k] - offsetX;
  30450. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  30451. contextLabel <<= 1;
  30452. } else {
  30453. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  30454. }
  30455. }
  30456. var pixel = decoder.readBit(contexts, contextLabel);
  30457. row[j] = pixel;
  30458. }
  30459. }
  30460. return bitmap;
  30461. }
  30462. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  30463. if (huffman) {
  30464. (0, _util.error)('JBIG2 error: huffman is not supported');
  30465. }
  30466. var newSymbols = [];
  30467. var currentHeight = 0;
  30468. var symbolCodeLength = (0, _util.log2)(symbols.length + numberOfNewSymbols);
  30469. var decoder = decodingContext.decoder;
  30470. var contextCache = decodingContext.contextCache;
  30471. while (newSymbols.length < numberOfNewSymbols) {
  30472. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  30473. currentHeight += deltaHeight;
  30474. var currentWidth = 0;
  30475. while (true) {
  30476. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  30477. if (deltaWidth === null) {
  30478. break;
  30479. }
  30480. currentWidth += deltaWidth;
  30481. var bitmap;
  30482. if (refinement) {
  30483. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  30484. if (numberOfInstances > 1) {
  30485. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  30486. } else {
  30487. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  30488. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  30489. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  30490. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  30491. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  30492. }
  30493. } else {
  30494. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  30495. }
  30496. newSymbols.push(bitmap);
  30497. }
  30498. }
  30499. var exportedSymbols = [];
  30500. var flags = [],
  30501. currentFlag = false;
  30502. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  30503. while (flags.length < totalSymbolsLength) {
  30504. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  30505. while (runLength--) {
  30506. flags.push(currentFlag);
  30507. }
  30508. currentFlag = !currentFlag;
  30509. }
  30510. for (var i = 0, ii = symbols.length; i < ii; i++) {
  30511. if (flags[i]) {
  30512. exportedSymbols.push(symbols[i]);
  30513. }
  30514. }
  30515. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  30516. if (flags[i]) {
  30517. exportedSymbols.push(newSymbols[j]);
  30518. }
  30519. }
  30520. return exportedSymbols;
  30521. }
  30522. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  30523. if (huffman) {
  30524. (0, _util.error)('JBIG2 error: huffman is not supported');
  30525. }
  30526. var bitmap = [];
  30527. var i, row;
  30528. for (i = 0; i < height; i++) {
  30529. row = new Uint8Array(width);
  30530. if (defaultPixelValue) {
  30531. for (var j = 0; j < width; j++) {
  30532. row[j] = defaultPixelValue;
  30533. }
  30534. }
  30535. bitmap.push(row);
  30536. }
  30537. var decoder = decodingContext.decoder;
  30538. var contextCache = decodingContext.contextCache;
  30539. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  30540. var firstS = 0;
  30541. i = 0;
  30542. while (i < numberOfSymbolInstances) {
  30543. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  30544. stripT += deltaT;
  30545. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  30546. firstS += deltaFirstS;
  30547. var currentS = firstS;
  30548. do {
  30549. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  30550. var t = stripSize * stripT + currentT;
  30551. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  30552. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  30553. var symbolBitmap = inputSymbols[symbolId];
  30554. var symbolWidth = symbolBitmap[0].length;
  30555. var symbolHeight = symbolBitmap.length;
  30556. if (applyRefinement) {
  30557. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  30558. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  30559. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  30560. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  30561. symbolWidth += rdw;
  30562. symbolHeight += rdh;
  30563. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  30564. }
  30565. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  30566. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  30567. var s2, t2, symbolRow;
  30568. if (transposed) {
  30569. for (s2 = 0; s2 < symbolHeight; s2++) {
  30570. row = bitmap[offsetS + s2];
  30571. if (!row) {
  30572. continue;
  30573. }
  30574. symbolRow = symbolBitmap[s2];
  30575. var maxWidth = Math.min(width - offsetT, symbolWidth);
  30576. switch (combinationOperator) {
  30577. case 0:
  30578. for (t2 = 0; t2 < maxWidth; t2++) {
  30579. row[offsetT + t2] |= symbolRow[t2];
  30580. }
  30581. break;
  30582. case 2:
  30583. for (t2 = 0; t2 < maxWidth; t2++) {
  30584. row[offsetT + t2] ^= symbolRow[t2];
  30585. }
  30586. break;
  30587. default:
  30588. (0, _util.error)('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  30589. }
  30590. }
  30591. currentS += symbolHeight - 1;
  30592. } else {
  30593. for (t2 = 0; t2 < symbolHeight; t2++) {
  30594. row = bitmap[offsetT + t2];
  30595. if (!row) {
  30596. continue;
  30597. }
  30598. symbolRow = symbolBitmap[t2];
  30599. switch (combinationOperator) {
  30600. case 0:
  30601. for (s2 = 0; s2 < symbolWidth; s2++) {
  30602. row[offsetS + s2] |= symbolRow[s2];
  30603. }
  30604. break;
  30605. case 2:
  30606. for (s2 = 0; s2 < symbolWidth; s2++) {
  30607. row[offsetS + s2] ^= symbolRow[s2];
  30608. }
  30609. break;
  30610. default:
  30611. (0, _util.error)('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  30612. }
  30613. }
  30614. currentS += symbolWidth - 1;
  30615. }
  30616. i++;
  30617. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  30618. if (deltaS === null) {
  30619. break;
  30620. }
  30621. currentS += deltaS + dsOffset;
  30622. } while (true);
  30623. }
  30624. return bitmap;
  30625. }
  30626. function readSegmentHeader(data, start) {
  30627. var segmentHeader = {};
  30628. segmentHeader.number = (0, _util.readUint32)(data, start);
  30629. var flags = data[start + 4];
  30630. var segmentType = flags & 0x3F;
  30631. if (!SegmentTypes[segmentType]) {
  30632. (0, _util.error)('JBIG2 error: invalid segment type: ' + segmentType);
  30633. }
  30634. segmentHeader.type = segmentType;
  30635. segmentHeader.typeName = SegmentTypes[segmentType];
  30636. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  30637. var pageAssociationFieldSize = !!(flags & 0x40);
  30638. var referredFlags = data[start + 5];
  30639. var referredToCount = referredFlags >> 5 & 7;
  30640. var retainBits = [referredFlags & 31];
  30641. var position = start + 6;
  30642. if (referredFlags === 7) {
  30643. referredToCount = (0, _util.readUint32)(data, position - 1) & 0x1FFFFFFF;
  30644. position += 3;
  30645. var bytes = referredToCount + 7 >> 3;
  30646. retainBits[0] = data[position++];
  30647. while (--bytes > 0) {
  30648. retainBits.push(data[position++]);
  30649. }
  30650. } else if (referredFlags === 5 || referredFlags === 6) {
  30651. (0, _util.error)('JBIG2 error: invalid referred-to flags');
  30652. }
  30653. segmentHeader.retainBits = retainBits;
  30654. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  30655. var referredTo = [];
  30656. var i, ii;
  30657. for (i = 0; i < referredToCount; i++) {
  30658. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? (0, _util.readUint16)(data, position) : (0, _util.readUint32)(data, position);
  30659. referredTo.push(number);
  30660. position += referredToSegmentNumberSize;
  30661. }
  30662. segmentHeader.referredTo = referredTo;
  30663. if (!pageAssociationFieldSize) {
  30664. segmentHeader.pageAssociation = data[position++];
  30665. } else {
  30666. segmentHeader.pageAssociation = (0, _util.readUint32)(data, position);
  30667. position += 4;
  30668. }
  30669. segmentHeader.length = (0, _util.readUint32)(data, position);
  30670. position += 4;
  30671. if (segmentHeader.length === 0xFFFFFFFF) {
  30672. if (segmentType === 38) {
  30673. var genericRegionInfo = readRegionSegmentInformation(data, position);
  30674. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  30675. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  30676. var searchPatternLength = 6;
  30677. var searchPattern = new Uint8Array(searchPatternLength);
  30678. if (!genericRegionMmr) {
  30679. searchPattern[0] = 0xFF;
  30680. searchPattern[1] = 0xAC;
  30681. }
  30682. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  30683. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  30684. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  30685. searchPattern[5] = genericRegionInfo.height & 0xFF;
  30686. for (i = position, ii = data.length; i < ii; i++) {
  30687. var j = 0;
  30688. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  30689. j++;
  30690. }
  30691. if (j === searchPatternLength) {
  30692. segmentHeader.length = i + searchPatternLength;
  30693. break;
  30694. }
  30695. }
  30696. if (segmentHeader.length === 0xFFFFFFFF) {
  30697. (0, _util.error)('JBIG2 error: segment end was not found');
  30698. }
  30699. } else {
  30700. (0, _util.error)('JBIG2 error: invalid unknown segment length');
  30701. }
  30702. }
  30703. segmentHeader.headerEnd = position;
  30704. return segmentHeader;
  30705. }
  30706. function readSegments(header, data, start, end) {
  30707. var segments = [];
  30708. var position = start;
  30709. while (position < end) {
  30710. var segmentHeader = readSegmentHeader(data, position);
  30711. position = segmentHeader.headerEnd;
  30712. var segment = {
  30713. header: segmentHeader,
  30714. data: data
  30715. };
  30716. if (!header.randomAccess) {
  30717. segment.start = position;
  30718. position += segmentHeader.length;
  30719. segment.end = position;
  30720. }
  30721. segments.push(segment);
  30722. if (segmentHeader.type === 51) {
  30723. break;
  30724. }
  30725. }
  30726. if (header.randomAccess) {
  30727. for (var i = 0, ii = segments.length; i < ii; i++) {
  30728. segments[i].start = position;
  30729. position += segments[i].header.length;
  30730. segments[i].end = position;
  30731. }
  30732. }
  30733. return segments;
  30734. }
  30735. function readRegionSegmentInformation(data, start) {
  30736. return {
  30737. width: (0, _util.readUint32)(data, start),
  30738. height: (0, _util.readUint32)(data, start + 4),
  30739. x: (0, _util.readUint32)(data, start + 8),
  30740. y: (0, _util.readUint32)(data, start + 12),
  30741. combinationOperator: data[start + 16] & 7
  30742. };
  30743. }
  30744. var RegionSegmentInformationFieldLength = 17;
  30745. function processSegment(segment, visitor) {
  30746. var header = segment.header;
  30747. var data = segment.data,
  30748. position = segment.start,
  30749. end = segment.end;
  30750. var args, at, i, atLength;
  30751. switch (header.type) {
  30752. case 0:
  30753. var dictionary = {};
  30754. var dictionaryFlags = (0, _util.readUint16)(data, position);
  30755. dictionary.huffman = !!(dictionaryFlags & 1);
  30756. dictionary.refinement = !!(dictionaryFlags & 2);
  30757. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  30758. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  30759. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  30760. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  30761. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  30762. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  30763. dictionary.template = dictionaryFlags >> 10 & 3;
  30764. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  30765. position += 2;
  30766. if (!dictionary.huffman) {
  30767. atLength = dictionary.template === 0 ? 4 : 1;
  30768. at = [];
  30769. for (i = 0; i < atLength; i++) {
  30770. at.push({
  30771. x: (0, _util.readInt8)(data, position),
  30772. y: (0, _util.readInt8)(data, position + 1)
  30773. });
  30774. position += 2;
  30775. }
  30776. dictionary.at = at;
  30777. }
  30778. if (dictionary.refinement && !dictionary.refinementTemplate) {
  30779. at = [];
  30780. for (i = 0; i < 2; i++) {
  30781. at.push({
  30782. x: (0, _util.readInt8)(data, position),
  30783. y: (0, _util.readInt8)(data, position + 1)
  30784. });
  30785. position += 2;
  30786. }
  30787. dictionary.refinementAt = at;
  30788. }
  30789. dictionary.numberOfExportedSymbols = (0, _util.readUint32)(data, position);
  30790. position += 4;
  30791. dictionary.numberOfNewSymbols = (0, _util.readUint32)(data, position);
  30792. position += 4;
  30793. args = [dictionary, header.number, header.referredTo, data, position, end];
  30794. break;
  30795. case 6:
  30796. case 7:
  30797. var textRegion = {};
  30798. textRegion.info = readRegionSegmentInformation(data, position);
  30799. position += RegionSegmentInformationFieldLength;
  30800. var textRegionSegmentFlags = (0, _util.readUint16)(data, position);
  30801. position += 2;
  30802. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  30803. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  30804. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  30805. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  30806. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  30807. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  30808. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  30809. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  30810. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  30811. if (textRegion.huffman) {
  30812. var textRegionHuffmanFlags = (0, _util.readUint16)(data, position);
  30813. position += 2;
  30814. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  30815. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  30816. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  30817. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  30818. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  30819. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  30820. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  30821. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  30822. }
  30823. if (textRegion.refinement && !textRegion.refinementTemplate) {
  30824. at = [];
  30825. for (i = 0; i < 2; i++) {
  30826. at.push({
  30827. x: (0, _util.readInt8)(data, position),
  30828. y: (0, _util.readInt8)(data, position + 1)
  30829. });
  30830. position += 2;
  30831. }
  30832. textRegion.refinementAt = at;
  30833. }
  30834. textRegion.numberOfSymbolInstances = (0, _util.readUint32)(data, position);
  30835. position += 4;
  30836. if (textRegion.huffman) {
  30837. (0, _util.error)('JBIG2 error: huffman is not supported');
  30838. }
  30839. args = [textRegion, header.referredTo, data, position, end];
  30840. break;
  30841. case 38:
  30842. case 39:
  30843. var genericRegion = {};
  30844. genericRegion.info = readRegionSegmentInformation(data, position);
  30845. position += RegionSegmentInformationFieldLength;
  30846. var genericRegionSegmentFlags = data[position++];
  30847. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  30848. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  30849. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  30850. if (!genericRegion.mmr) {
  30851. atLength = genericRegion.template === 0 ? 4 : 1;
  30852. at = [];
  30853. for (i = 0; i < atLength; i++) {
  30854. at.push({
  30855. x: (0, _util.readInt8)(data, position),
  30856. y: (0, _util.readInt8)(data, position + 1)
  30857. });
  30858. position += 2;
  30859. }
  30860. genericRegion.at = at;
  30861. }
  30862. args = [genericRegion, data, position, end];
  30863. break;
  30864. case 48:
  30865. var pageInfo = {
  30866. width: (0, _util.readUint32)(data, position),
  30867. height: (0, _util.readUint32)(data, position + 4),
  30868. resolutionX: (0, _util.readUint32)(data, position + 8),
  30869. resolutionY: (0, _util.readUint32)(data, position + 12)
  30870. };
  30871. if (pageInfo.height === 0xFFFFFFFF) {
  30872. delete pageInfo.height;
  30873. }
  30874. var pageSegmentFlags = data[position + 16];
  30875. (0, _util.readUint16)(data, position + 17);
  30876. pageInfo.lossless = !!(pageSegmentFlags & 1);
  30877. pageInfo.refinement = !!(pageSegmentFlags & 2);
  30878. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  30879. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  30880. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  30881. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  30882. args = [pageInfo];
  30883. break;
  30884. case 49:
  30885. break;
  30886. case 50:
  30887. break;
  30888. case 51:
  30889. break;
  30890. case 62:
  30891. break;
  30892. default:
  30893. (0, _util.error)('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  30894. }
  30895. var callbackName = 'on' + header.typeName;
  30896. if (callbackName in visitor) {
  30897. visitor[callbackName].apply(visitor, args);
  30898. }
  30899. }
  30900. function processSegments(segments, visitor) {
  30901. for (var i = 0, ii = segments.length; i < ii; i++) {
  30902. processSegment(segments[i], visitor);
  30903. }
  30904. }
  30905. function parseJbig2(data, start, end) {
  30906. var position = start;
  30907. 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) {
  30908. (0, _util.error)('JBIG2 error: invalid header');
  30909. }
  30910. var header = {};
  30911. position += 8;
  30912. var flags = data[position++];
  30913. header.randomAccess = !(flags & 1);
  30914. if (!(flags & 2)) {
  30915. header.numberOfPages = (0, _util.readUint32)(data, position);
  30916. position += 4;
  30917. }
  30918. readSegments(header, data, position, end);
  30919. (0, _util.error)('Not implemented');
  30920. }
  30921. function parseJbig2Chunks(chunks) {
  30922. var visitor = new SimpleSegmentVisitor();
  30923. for (var i = 0, ii = chunks.length; i < ii; i++) {
  30924. var chunk = chunks[i];
  30925. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  30926. processSegments(segments, visitor);
  30927. }
  30928. return visitor.buffer;
  30929. }
  30930. function SimpleSegmentVisitor() {}
  30931. SimpleSegmentVisitor.prototype = {
  30932. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  30933. this.currentPageInfo = info;
  30934. var rowSize = info.width + 7 >> 3;
  30935. var buffer = new Uint8Array(rowSize * info.height);
  30936. if (info.defaultPixelValue) {
  30937. for (var i = 0, ii = buffer.length; i < ii; i++) {
  30938. buffer[i] = 0xFF;
  30939. }
  30940. }
  30941. this.buffer = buffer;
  30942. },
  30943. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  30944. var pageInfo = this.currentPageInfo;
  30945. var width = regionInfo.width,
  30946. height = regionInfo.height;
  30947. var rowSize = pageInfo.width + 7 >> 3;
  30948. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  30949. var buffer = this.buffer;
  30950. var mask0 = 128 >> (regionInfo.x & 7);
  30951. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  30952. var i, j, mask, offset;
  30953. switch (combinationOperator) {
  30954. case 0:
  30955. for (i = 0; i < height; i++) {
  30956. mask = mask0;
  30957. offset = offset0;
  30958. for (j = 0; j < width; j++) {
  30959. if (bitmap[i][j]) {
  30960. buffer[offset] |= mask;
  30961. }
  30962. mask >>= 1;
  30963. if (!mask) {
  30964. mask = 128;
  30965. offset++;
  30966. }
  30967. }
  30968. offset0 += rowSize;
  30969. }
  30970. break;
  30971. case 2:
  30972. for (i = 0; i < height; i++) {
  30973. mask = mask0;
  30974. offset = offset0;
  30975. for (j = 0; j < width; j++) {
  30976. if (bitmap[i][j]) {
  30977. buffer[offset] ^= mask;
  30978. }
  30979. mask >>= 1;
  30980. if (!mask) {
  30981. mask = 128;
  30982. offset++;
  30983. }
  30984. }
  30985. offset0 += rowSize;
  30986. }
  30987. break;
  30988. default:
  30989. (0, _util.error)('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  30990. }
  30991. },
  30992. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  30993. var regionInfo = region.info;
  30994. var decodingContext = new DecodingContext(data, start, end);
  30995. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  30996. this.drawBitmap(regionInfo, bitmap);
  30997. },
  30998. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  30999. this.onImmediateGenericRegion.apply(this, arguments);
  31000. },
  31001. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  31002. var huffmanTables;
  31003. if (dictionary.huffman) {
  31004. (0, _util.error)('JBIG2 error: huffman is not supported');
  31005. }
  31006. var symbols = this.symbols;
  31007. if (!symbols) {
  31008. this.symbols = symbols = {};
  31009. }
  31010. var inputSymbols = [];
  31011. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  31012. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  31013. }
  31014. var decodingContext = new DecodingContext(data, start, end);
  31015. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  31016. },
  31017. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  31018. var regionInfo = region.info;
  31019. var huffmanTables;
  31020. var symbols = this.symbols;
  31021. var inputSymbols = [];
  31022. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  31023. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  31024. }
  31025. var symbolCodeLength = (0, _util.log2)(inputSymbols.length);
  31026. var decodingContext = new DecodingContext(data, start, end);
  31027. 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);
  31028. this.drawBitmap(regionInfo, bitmap);
  31029. },
  31030. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  31031. this.onImmediateTextRegion.apply(this, arguments);
  31032. }
  31033. };
  31034. function Jbig2Image() {}
  31035. Jbig2Image.prototype = {
  31036. parseChunks: function Jbig2Image_parseChunks(chunks) {
  31037. return parseJbig2Chunks(chunks);
  31038. }
  31039. };
  31040. return Jbig2Image;
  31041. }();
  31042. exports.Jbig2Image = Jbig2Image;
  31043. /***/ }),
  31044. /* 29 */
  31045. /***/ (function(module, exports, __w_pdfjs_require__) {
  31046. "use strict";
  31047. Object.defineProperty(exports, "__esModule", {
  31048. value: true
  31049. });
  31050. exports.JpegImage = undefined;
  31051. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  31052. var _util = __w_pdfjs_require__(0);
  31053. var JpegImage = function JpegImageClosure() {
  31054. 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]);
  31055. var dctCos1 = 4017;
  31056. var dctSin1 = 799;
  31057. var dctCos3 = 3406;
  31058. var dctSin3 = 2276;
  31059. var dctCos6 = 1567;
  31060. var dctSin6 = 3784;
  31061. var dctSqrt2 = 5793;
  31062. var dctSqrt1d2 = 2896;
  31063. function JpegImage() {
  31064. this.decodeTransform = null;
  31065. this.colorTransform = -1;
  31066. }
  31067. function buildHuffmanTable(codeLengths, values) {
  31068. var k = 0,
  31069. code = [],
  31070. i,
  31071. j,
  31072. length = 16;
  31073. while (length > 0 && !codeLengths[length - 1]) {
  31074. length--;
  31075. }
  31076. code.push({
  31077. children: [],
  31078. index: 0
  31079. });
  31080. var p = code[0],
  31081. q;
  31082. for (i = 0; i < length; i++) {
  31083. for (j = 0; j < codeLengths[i]; j++) {
  31084. p = code.pop();
  31085. p.children[p.index] = values[k];
  31086. while (p.index > 0) {
  31087. p = code.pop();
  31088. }
  31089. p.index++;
  31090. code.push(p);
  31091. while (code.length <= i) {
  31092. code.push(q = {
  31093. children: [],
  31094. index: 0
  31095. });
  31096. p.children[p.index] = q.children;
  31097. p = q;
  31098. }
  31099. k++;
  31100. }
  31101. if (i + 1 < length) {
  31102. code.push(q = {
  31103. children: [],
  31104. index: 0
  31105. });
  31106. p.children[p.index] = q.children;
  31107. p = q;
  31108. }
  31109. }
  31110. return code[0].children;
  31111. }
  31112. function getBlockBufferOffset(component, row, col) {
  31113. return 64 * ((component.blocksPerLine + 1) * row + col);
  31114. }
  31115. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  31116. var mcusPerLine = frame.mcusPerLine;
  31117. var progressive = frame.progressive;
  31118. var startOffset = offset,
  31119. bitsData = 0,
  31120. bitsCount = 0;
  31121. function readBit() {
  31122. if (bitsCount > 0) {
  31123. bitsCount--;
  31124. return bitsData >> bitsCount & 1;
  31125. }
  31126. bitsData = data[offset++];
  31127. if (bitsData === 0xFF) {
  31128. var nextByte = data[offset++];
  31129. if (nextByte) {
  31130. (0, _util.error)('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  31131. }
  31132. }
  31133. bitsCount = 7;
  31134. return bitsData >>> 7;
  31135. }
  31136. function decodeHuffman(tree) {
  31137. var node = tree;
  31138. while (true) {
  31139. node = node[readBit()];
  31140. if (typeof node === 'number') {
  31141. return node;
  31142. }
  31143. if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) !== 'object') {
  31144. (0, _util.error)('JPEG error: invalid huffman sequence');
  31145. }
  31146. }
  31147. }
  31148. function receive(length) {
  31149. var n = 0;
  31150. while (length > 0) {
  31151. n = n << 1 | readBit();
  31152. length--;
  31153. }
  31154. return n;
  31155. }
  31156. function receiveAndExtend(length) {
  31157. if (length === 1) {
  31158. return readBit() === 1 ? 1 : -1;
  31159. }
  31160. var n = receive(length);
  31161. if (n >= 1 << length - 1) {
  31162. return n;
  31163. }
  31164. return n + (-1 << length) + 1;
  31165. }
  31166. function decodeBaseline(component, offset) {
  31167. var t = decodeHuffman(component.huffmanTableDC);
  31168. var diff = t === 0 ? 0 : receiveAndExtend(t);
  31169. component.blockData[offset] = component.pred += diff;
  31170. var k = 1;
  31171. while (k < 64) {
  31172. var rs = decodeHuffman(component.huffmanTableAC);
  31173. var s = rs & 15,
  31174. r = rs >> 4;
  31175. if (s === 0) {
  31176. if (r < 15) {
  31177. break;
  31178. }
  31179. k += 16;
  31180. continue;
  31181. }
  31182. k += r;
  31183. var z = dctZigZag[k];
  31184. component.blockData[offset + z] = receiveAndExtend(s);
  31185. k++;
  31186. }
  31187. }
  31188. function decodeDCFirst(component, offset) {
  31189. var t = decodeHuffman(component.huffmanTableDC);
  31190. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  31191. component.blockData[offset] = component.pred += diff;
  31192. }
  31193. function decodeDCSuccessive(component, offset) {
  31194. component.blockData[offset] |= readBit() << successive;
  31195. }
  31196. var eobrun = 0;
  31197. function decodeACFirst(component, offset) {
  31198. if (eobrun > 0) {
  31199. eobrun--;
  31200. return;
  31201. }
  31202. var k = spectralStart,
  31203. e = spectralEnd;
  31204. while (k <= e) {
  31205. var rs = decodeHuffman(component.huffmanTableAC);
  31206. var s = rs & 15,
  31207. r = rs >> 4;
  31208. if (s === 0) {
  31209. if (r < 15) {
  31210. eobrun = receive(r) + (1 << r) - 1;
  31211. break;
  31212. }
  31213. k += 16;
  31214. continue;
  31215. }
  31216. k += r;
  31217. var z = dctZigZag[k];
  31218. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  31219. k++;
  31220. }
  31221. }
  31222. var successiveACState = 0,
  31223. successiveACNextValue;
  31224. function decodeACSuccessive(component, offset) {
  31225. var k = spectralStart;
  31226. var e = spectralEnd;
  31227. var r = 0;
  31228. var s;
  31229. var rs;
  31230. while (k <= e) {
  31231. var z = dctZigZag[k];
  31232. switch (successiveACState) {
  31233. case 0:
  31234. rs = decodeHuffman(component.huffmanTableAC);
  31235. s = rs & 15;
  31236. r = rs >> 4;
  31237. if (s === 0) {
  31238. if (r < 15) {
  31239. eobrun = receive(r) + (1 << r);
  31240. successiveACState = 4;
  31241. } else {
  31242. r = 16;
  31243. successiveACState = 1;
  31244. }
  31245. } else {
  31246. if (s !== 1) {
  31247. (0, _util.error)('JPEG error: invalid ACn encoding');
  31248. }
  31249. successiveACNextValue = receiveAndExtend(s);
  31250. successiveACState = r ? 2 : 3;
  31251. }
  31252. continue;
  31253. case 1:
  31254. case 2:
  31255. if (component.blockData[offset + z]) {
  31256. component.blockData[offset + z] += readBit() << successive;
  31257. } else {
  31258. r--;
  31259. if (r === 0) {
  31260. successiveACState = successiveACState === 2 ? 3 : 0;
  31261. }
  31262. }
  31263. break;
  31264. case 3:
  31265. if (component.blockData[offset + z]) {
  31266. component.blockData[offset + z] += readBit() << successive;
  31267. } else {
  31268. component.blockData[offset + z] = successiveACNextValue << successive;
  31269. successiveACState = 0;
  31270. }
  31271. break;
  31272. case 4:
  31273. if (component.blockData[offset + z]) {
  31274. component.blockData[offset + z] += readBit() << successive;
  31275. }
  31276. break;
  31277. }
  31278. k++;
  31279. }
  31280. if (successiveACState === 4) {
  31281. eobrun--;
  31282. if (eobrun === 0) {
  31283. successiveACState = 0;
  31284. }
  31285. }
  31286. }
  31287. function decodeMcu(component, decode, mcu, row, col) {
  31288. var mcuRow = mcu / mcusPerLine | 0;
  31289. var mcuCol = mcu % mcusPerLine;
  31290. var blockRow = mcuRow * component.v + row;
  31291. var blockCol = mcuCol * component.h + col;
  31292. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  31293. decode(component, offset);
  31294. }
  31295. function decodeBlock(component, decode, mcu) {
  31296. var blockRow = mcu / component.blocksPerLine | 0;
  31297. var blockCol = mcu % component.blocksPerLine;
  31298. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  31299. decode(component, offset);
  31300. }
  31301. var componentsLength = components.length;
  31302. var component, i, j, k, n;
  31303. var decodeFn;
  31304. if (progressive) {
  31305. if (spectralStart === 0) {
  31306. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  31307. } else {
  31308. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  31309. }
  31310. } else {
  31311. decodeFn = decodeBaseline;
  31312. }
  31313. var mcu = 0,
  31314. fileMarker;
  31315. var mcuExpected;
  31316. if (componentsLength === 1) {
  31317. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  31318. } else {
  31319. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  31320. }
  31321. var h, v;
  31322. while (mcu < mcuExpected) {
  31323. var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  31324. for (i = 0; i < componentsLength; i++) {
  31325. components[i].pred = 0;
  31326. }
  31327. eobrun = 0;
  31328. if (componentsLength === 1) {
  31329. component = components[0];
  31330. for (n = 0; n < mcuToRead; n++) {
  31331. decodeBlock(component, decodeFn, mcu);
  31332. mcu++;
  31333. }
  31334. } else {
  31335. for (n = 0; n < mcuToRead; n++) {
  31336. for (i = 0; i < componentsLength; i++) {
  31337. component = components[i];
  31338. h = component.h;
  31339. v = component.v;
  31340. for (j = 0; j < v; j++) {
  31341. for (k = 0; k < h; k++) {
  31342. decodeMcu(component, decodeFn, mcu, j, k);
  31343. }
  31344. }
  31345. }
  31346. mcu++;
  31347. }
  31348. }
  31349. bitsCount = 0;
  31350. fileMarker = findNextFileMarker(data, offset);
  31351. if (fileMarker && fileMarker.invalid) {
  31352. (0, _util.warn)('decodeScan - unexpected MCU data, next marker is: ' + fileMarker.invalid);
  31353. offset = fileMarker.offset;
  31354. }
  31355. var marker = fileMarker && fileMarker.marker;
  31356. if (!marker || marker <= 0xFF00) {
  31357. (0, _util.error)('JPEG error: marker was not found');
  31358. }
  31359. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  31360. offset += 2;
  31361. } else {
  31362. break;
  31363. }
  31364. }
  31365. fileMarker = findNextFileMarker(data, offset);
  31366. if (fileMarker && fileMarker.invalid) {
  31367. (0, _util.warn)('decodeScan - unexpected Scan data, next marker is: ' + fileMarker.invalid);
  31368. offset = fileMarker.offset;
  31369. }
  31370. return offset - startOffset;
  31371. }
  31372. function quantizeAndInverse(component, blockBufferOffset, p) {
  31373. var qt = component.quantizationTable,
  31374. blockData = component.blockData;
  31375. var v0, v1, v2, v3, v4, v5, v6, v7;
  31376. var p0, p1, p2, p3, p4, p5, p6, p7;
  31377. var t;
  31378. if (!qt) {
  31379. (0, _util.error)('JPEG error: missing required Quantization Table.');
  31380. }
  31381. for (var row = 0; row < 64; row += 8) {
  31382. p0 = blockData[blockBufferOffset + row];
  31383. p1 = blockData[blockBufferOffset + row + 1];
  31384. p2 = blockData[blockBufferOffset + row + 2];
  31385. p3 = blockData[blockBufferOffset + row + 3];
  31386. p4 = blockData[blockBufferOffset + row + 4];
  31387. p5 = blockData[blockBufferOffset + row + 5];
  31388. p6 = blockData[blockBufferOffset + row + 6];
  31389. p7 = blockData[blockBufferOffset + row + 7];
  31390. p0 *= qt[row];
  31391. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  31392. t = dctSqrt2 * p0 + 512 >> 10;
  31393. p[row] = t;
  31394. p[row + 1] = t;
  31395. p[row + 2] = t;
  31396. p[row + 3] = t;
  31397. p[row + 4] = t;
  31398. p[row + 5] = t;
  31399. p[row + 6] = t;
  31400. p[row + 7] = t;
  31401. continue;
  31402. }
  31403. p1 *= qt[row + 1];
  31404. p2 *= qt[row + 2];
  31405. p3 *= qt[row + 3];
  31406. p4 *= qt[row + 4];
  31407. p5 *= qt[row + 5];
  31408. p6 *= qt[row + 6];
  31409. p7 *= qt[row + 7];
  31410. v0 = dctSqrt2 * p0 + 128 >> 8;
  31411. v1 = dctSqrt2 * p4 + 128 >> 8;
  31412. v2 = p2;
  31413. v3 = p6;
  31414. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  31415. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  31416. v5 = p3 << 4;
  31417. v6 = p5 << 4;
  31418. v0 = v0 + v1 + 1 >> 1;
  31419. v1 = v0 - v1;
  31420. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  31421. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  31422. v3 = t;
  31423. v4 = v4 + v6 + 1 >> 1;
  31424. v6 = v4 - v6;
  31425. v7 = v7 + v5 + 1 >> 1;
  31426. v5 = v7 - v5;
  31427. v0 = v0 + v3 + 1 >> 1;
  31428. v3 = v0 - v3;
  31429. v1 = v1 + v2 + 1 >> 1;
  31430. v2 = v1 - v2;
  31431. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  31432. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  31433. v7 = t;
  31434. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  31435. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  31436. v6 = t;
  31437. p[row] = v0 + v7;
  31438. p[row + 7] = v0 - v7;
  31439. p[row + 1] = v1 + v6;
  31440. p[row + 6] = v1 - v6;
  31441. p[row + 2] = v2 + v5;
  31442. p[row + 5] = v2 - v5;
  31443. p[row + 3] = v3 + v4;
  31444. p[row + 4] = v3 - v4;
  31445. }
  31446. for (var col = 0; col < 8; ++col) {
  31447. p0 = p[col];
  31448. p1 = p[col + 8];
  31449. p2 = p[col + 16];
  31450. p3 = p[col + 24];
  31451. p4 = p[col + 32];
  31452. p5 = p[col + 40];
  31453. p6 = p[col + 48];
  31454. p7 = p[col + 56];
  31455. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  31456. t = dctSqrt2 * p0 + 8192 >> 14;
  31457. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  31458. blockData[blockBufferOffset + col] = t;
  31459. blockData[blockBufferOffset + col + 8] = t;
  31460. blockData[blockBufferOffset + col + 16] = t;
  31461. blockData[blockBufferOffset + col + 24] = t;
  31462. blockData[blockBufferOffset + col + 32] = t;
  31463. blockData[blockBufferOffset + col + 40] = t;
  31464. blockData[blockBufferOffset + col + 48] = t;
  31465. blockData[blockBufferOffset + col + 56] = t;
  31466. continue;
  31467. }
  31468. v0 = dctSqrt2 * p0 + 2048 >> 12;
  31469. v1 = dctSqrt2 * p4 + 2048 >> 12;
  31470. v2 = p2;
  31471. v3 = p6;
  31472. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  31473. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  31474. v5 = p3;
  31475. v6 = p5;
  31476. v0 = (v0 + v1 + 1 >> 1) + 4112;
  31477. v1 = v0 - v1;
  31478. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  31479. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  31480. v3 = t;
  31481. v4 = v4 + v6 + 1 >> 1;
  31482. v6 = v4 - v6;
  31483. v7 = v7 + v5 + 1 >> 1;
  31484. v5 = v7 - v5;
  31485. v0 = v0 + v3 + 1 >> 1;
  31486. v3 = v0 - v3;
  31487. v1 = v1 + v2 + 1 >> 1;
  31488. v2 = v1 - v2;
  31489. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  31490. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  31491. v7 = t;
  31492. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  31493. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  31494. v6 = t;
  31495. p0 = v0 + v7;
  31496. p7 = v0 - v7;
  31497. p1 = v1 + v6;
  31498. p6 = v1 - v6;
  31499. p2 = v2 + v5;
  31500. p5 = v2 - v5;
  31501. p3 = v3 + v4;
  31502. p4 = v3 - v4;
  31503. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  31504. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  31505. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  31506. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  31507. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  31508. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  31509. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  31510. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  31511. blockData[blockBufferOffset + col] = p0;
  31512. blockData[blockBufferOffset + col + 8] = p1;
  31513. blockData[blockBufferOffset + col + 16] = p2;
  31514. blockData[blockBufferOffset + col + 24] = p3;
  31515. blockData[blockBufferOffset + col + 32] = p4;
  31516. blockData[blockBufferOffset + col + 40] = p5;
  31517. blockData[blockBufferOffset + col + 48] = p6;
  31518. blockData[blockBufferOffset + col + 56] = p7;
  31519. }
  31520. }
  31521. function buildComponentData(frame, component) {
  31522. var blocksPerLine = component.blocksPerLine;
  31523. var blocksPerColumn = component.blocksPerColumn;
  31524. var computationBuffer = new Int16Array(64);
  31525. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  31526. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  31527. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  31528. quantizeAndInverse(component, offset, computationBuffer);
  31529. }
  31530. }
  31531. return component.blockData;
  31532. }
  31533. function clamp0to255(a) {
  31534. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  31535. }
  31536. function findNextFileMarker(data, currentPos, startPos) {
  31537. function peekUint16(pos) {
  31538. return data[pos] << 8 | data[pos + 1];
  31539. }
  31540. var maxPos = data.length - 1;
  31541. var newPos = startPos < currentPos ? startPos : currentPos;
  31542. if (currentPos >= maxPos) {
  31543. return null;
  31544. }
  31545. var currentMarker = peekUint16(currentPos);
  31546. if (currentMarker >= 0xFFC0 && currentMarker <= 0xFFFE) {
  31547. return {
  31548. invalid: null,
  31549. marker: currentMarker,
  31550. offset: currentPos
  31551. };
  31552. }
  31553. var newMarker = peekUint16(newPos);
  31554. while (!(newMarker >= 0xFFC0 && newMarker <= 0xFFFE)) {
  31555. if (++newPos >= maxPos) {
  31556. return null;
  31557. }
  31558. newMarker = peekUint16(newPos);
  31559. }
  31560. return {
  31561. invalid: currentMarker.toString(16),
  31562. marker: newMarker,
  31563. offset: newPos
  31564. };
  31565. }
  31566. JpegImage.prototype = {
  31567. parse: function parse(data) {
  31568. function readUint16() {
  31569. var value = data[offset] << 8 | data[offset + 1];
  31570. offset += 2;
  31571. return value;
  31572. }
  31573. function readDataBlock() {
  31574. var length = readUint16();
  31575. var endOffset = offset + length - 2;
  31576. var fileMarker = findNextFileMarker(data, endOffset, offset);
  31577. if (fileMarker && fileMarker.invalid) {
  31578. (0, _util.warn)('readDataBlock - incorrect length, next marker is: ' + fileMarker.invalid);
  31579. endOffset = fileMarker.offset;
  31580. }
  31581. var array = data.subarray(offset, endOffset);
  31582. offset += array.length;
  31583. return array;
  31584. }
  31585. function prepareComponents(frame) {
  31586. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  31587. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  31588. for (var i = 0; i < frame.components.length; i++) {
  31589. component = frame.components[i];
  31590. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  31591. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  31592. var blocksPerLineForMcu = mcusPerLine * component.h;
  31593. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  31594. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  31595. component.blockData = new Int16Array(blocksBufferSize);
  31596. component.blocksPerLine = blocksPerLine;
  31597. component.blocksPerColumn = blocksPerColumn;
  31598. }
  31599. frame.mcusPerLine = mcusPerLine;
  31600. frame.mcusPerColumn = mcusPerColumn;
  31601. }
  31602. var offset = 0;
  31603. var jfif = null;
  31604. var adobe = null;
  31605. var frame, resetInterval;
  31606. var quantizationTables = [];
  31607. var huffmanTablesAC = [],
  31608. huffmanTablesDC = [];
  31609. var fileMarker = readUint16();
  31610. if (fileMarker !== 0xFFD8) {
  31611. (0, _util.error)('JPEG error: SOI not found');
  31612. }
  31613. fileMarker = readUint16();
  31614. while (fileMarker !== 0xFFD9) {
  31615. var i, j, l;
  31616. switch (fileMarker) {
  31617. case 0xFFE0:
  31618. case 0xFFE1:
  31619. case 0xFFE2:
  31620. case 0xFFE3:
  31621. case 0xFFE4:
  31622. case 0xFFE5:
  31623. case 0xFFE6:
  31624. case 0xFFE7:
  31625. case 0xFFE8:
  31626. case 0xFFE9:
  31627. case 0xFFEA:
  31628. case 0xFFEB:
  31629. case 0xFFEC:
  31630. case 0xFFED:
  31631. case 0xFFEE:
  31632. case 0xFFEF:
  31633. case 0xFFFE:
  31634. var appData = readDataBlock();
  31635. if (fileMarker === 0xFFE0) {
  31636. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  31637. jfif = {
  31638. version: {
  31639. major: appData[5],
  31640. minor: appData[6]
  31641. },
  31642. densityUnits: appData[7],
  31643. xDensity: appData[8] << 8 | appData[9],
  31644. yDensity: appData[10] << 8 | appData[11],
  31645. thumbWidth: appData[12],
  31646. thumbHeight: appData[13],
  31647. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  31648. };
  31649. }
  31650. }
  31651. if (fileMarker === 0xFFEE) {
  31652. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  31653. adobe = {
  31654. version: appData[5] << 8 | appData[6],
  31655. flags0: appData[7] << 8 | appData[8],
  31656. flags1: appData[9] << 8 | appData[10],
  31657. transformCode: appData[11]
  31658. };
  31659. }
  31660. }
  31661. break;
  31662. case 0xFFDB:
  31663. var quantizationTablesLength = readUint16();
  31664. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  31665. var z;
  31666. while (offset < quantizationTablesEnd) {
  31667. var quantizationTableSpec = data[offset++];
  31668. var tableData = new Uint16Array(64);
  31669. if (quantizationTableSpec >> 4 === 0) {
  31670. for (j = 0; j < 64; j++) {
  31671. z = dctZigZag[j];
  31672. tableData[z] = data[offset++];
  31673. }
  31674. } else if (quantizationTableSpec >> 4 === 1) {
  31675. for (j = 0; j < 64; j++) {
  31676. z = dctZigZag[j];
  31677. tableData[z] = readUint16();
  31678. }
  31679. } else {
  31680. (0, _util.error)('JPEG error: DQT - invalid table spec');
  31681. }
  31682. quantizationTables[quantizationTableSpec & 15] = tableData;
  31683. }
  31684. break;
  31685. case 0xFFC0:
  31686. case 0xFFC1:
  31687. case 0xFFC2:
  31688. if (frame) {
  31689. (0, _util.error)('JPEG error: Only single frame JPEGs supported');
  31690. }
  31691. readUint16();
  31692. frame = {};
  31693. frame.extended = fileMarker === 0xFFC1;
  31694. frame.progressive = fileMarker === 0xFFC2;
  31695. frame.precision = data[offset++];
  31696. frame.scanLines = readUint16();
  31697. frame.samplesPerLine = readUint16();
  31698. frame.components = [];
  31699. frame.componentIds = {};
  31700. var componentsCount = data[offset++],
  31701. componentId;
  31702. var maxH = 0,
  31703. maxV = 0;
  31704. for (i = 0; i < componentsCount; i++) {
  31705. componentId = data[offset];
  31706. var h = data[offset + 1] >> 4;
  31707. var v = data[offset + 1] & 15;
  31708. if (maxH < h) {
  31709. maxH = h;
  31710. }
  31711. if (maxV < v) {
  31712. maxV = v;
  31713. }
  31714. var qId = data[offset + 2];
  31715. l = frame.components.push({
  31716. h: h,
  31717. v: v,
  31718. quantizationId: qId,
  31719. quantizationTable: null
  31720. });
  31721. frame.componentIds[componentId] = l - 1;
  31722. offset += 3;
  31723. }
  31724. frame.maxH = maxH;
  31725. frame.maxV = maxV;
  31726. prepareComponents(frame);
  31727. break;
  31728. case 0xFFC4:
  31729. var huffmanLength = readUint16();
  31730. for (i = 2; i < huffmanLength;) {
  31731. var huffmanTableSpec = data[offset++];
  31732. var codeLengths = new Uint8Array(16);
  31733. var codeLengthSum = 0;
  31734. for (j = 0; j < 16; j++, offset++) {
  31735. codeLengthSum += codeLengths[j] = data[offset];
  31736. }
  31737. var huffmanValues = new Uint8Array(codeLengthSum);
  31738. for (j = 0; j < codeLengthSum; j++, offset++) {
  31739. huffmanValues[j] = data[offset];
  31740. }
  31741. i += 17 + codeLengthSum;
  31742. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  31743. }
  31744. break;
  31745. case 0xFFDD:
  31746. readUint16();
  31747. resetInterval = readUint16();
  31748. break;
  31749. case 0xFFDA:
  31750. readUint16();
  31751. var selectorsCount = data[offset++];
  31752. var components = [],
  31753. component;
  31754. for (i = 0; i < selectorsCount; i++) {
  31755. var componentIndex = frame.componentIds[data[offset++]];
  31756. component = frame.components[componentIndex];
  31757. var tableSpec = data[offset++];
  31758. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  31759. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  31760. components.push(component);
  31761. }
  31762. var spectralStart = data[offset++];
  31763. var spectralEnd = data[offset++];
  31764. var successiveApproximation = data[offset++];
  31765. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  31766. offset += processed;
  31767. break;
  31768. case 0xFFFF:
  31769. if (data[offset] !== 0xFF) {
  31770. offset--;
  31771. }
  31772. break;
  31773. default:
  31774. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  31775. offset -= 3;
  31776. break;
  31777. }
  31778. (0, _util.error)('JPEG error: unknown marker ' + fileMarker.toString(16));
  31779. }
  31780. fileMarker = readUint16();
  31781. }
  31782. this.width = frame.samplesPerLine;
  31783. this.height = frame.scanLines;
  31784. this.jfif = jfif;
  31785. this.adobe = adobe;
  31786. this.components = [];
  31787. for (i = 0; i < frame.components.length; i++) {
  31788. component = frame.components[i];
  31789. var quantizationTable = quantizationTables[component.quantizationId];
  31790. if (quantizationTable) {
  31791. component.quantizationTable = quantizationTable;
  31792. }
  31793. this.components.push({
  31794. output: buildComponentData(frame, component),
  31795. scaleX: component.h / frame.maxH,
  31796. scaleY: component.v / frame.maxV,
  31797. blocksPerLine: component.blocksPerLine,
  31798. blocksPerColumn: component.blocksPerColumn
  31799. });
  31800. }
  31801. this.numComponents = this.components.length;
  31802. },
  31803. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  31804. var scaleX = this.width / width,
  31805. scaleY = this.height / height;
  31806. var component, componentScaleX, componentScaleY, blocksPerScanline;
  31807. var x, y, i, j, k;
  31808. var index;
  31809. var offset = 0;
  31810. var output;
  31811. var numComponents = this.components.length;
  31812. var dataLength = width * height * numComponents;
  31813. var data = new Uint8Array(dataLength);
  31814. var xScaleBlockOffset = new Uint32Array(width);
  31815. var mask3LSB = 0xfffffff8;
  31816. for (i = 0; i < numComponents; i++) {
  31817. component = this.components[i];
  31818. componentScaleX = component.scaleX * scaleX;
  31819. componentScaleY = component.scaleY * scaleY;
  31820. offset = i;
  31821. output = component.output;
  31822. blocksPerScanline = component.blocksPerLine + 1 << 3;
  31823. for (x = 0; x < width; x++) {
  31824. j = 0 | x * componentScaleX;
  31825. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  31826. }
  31827. for (y = 0; y < height; y++) {
  31828. j = 0 | y * componentScaleY;
  31829. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  31830. for (x = 0; x < width; x++) {
  31831. data[offset] = output[index + xScaleBlockOffset[x]];
  31832. offset += numComponents;
  31833. }
  31834. }
  31835. }
  31836. var transform = this.decodeTransform;
  31837. if (transform) {
  31838. for (i = 0; i < dataLength;) {
  31839. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  31840. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  31841. }
  31842. }
  31843. }
  31844. return data;
  31845. },
  31846. _isColorConversionNeeded: function isColorConversionNeeded() {
  31847. if (this.adobe && this.adobe.transformCode) {
  31848. return true;
  31849. } else if (this.numComponents === 3) {
  31850. if (!this.adobe && this.colorTransform === 0) {
  31851. return false;
  31852. }
  31853. return true;
  31854. }
  31855. if (!this.adobe && this.colorTransform === 1) {
  31856. return true;
  31857. }
  31858. return false;
  31859. },
  31860. _convertYccToRgb: function convertYccToRgb(data) {
  31861. var Y, Cb, Cr;
  31862. for (var i = 0, length = data.length; i < length; i += 3) {
  31863. Y = data[i];
  31864. Cb = data[i + 1];
  31865. Cr = data[i + 2];
  31866. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  31867. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  31868. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  31869. }
  31870. return data;
  31871. },
  31872. _convertYcckToRgb: function convertYcckToRgb(data) {
  31873. var Y, Cb, Cr, k;
  31874. var offset = 0;
  31875. for (var i = 0, length = data.length; i < length; i += 4) {
  31876. Y = data[i];
  31877. Cb = data[i + 1];
  31878. Cr = data[i + 2];
  31879. k = data[i + 3];
  31880. var r = -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);
  31881. var g = 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);
  31882. var b = -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);
  31883. data[offset++] = clamp0to255(r);
  31884. data[offset++] = clamp0to255(g);
  31885. data[offset++] = clamp0to255(b);
  31886. }
  31887. return data;
  31888. },
  31889. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  31890. var Y, Cb, Cr;
  31891. for (var i = 0, length = data.length; i < length; i += 4) {
  31892. Y = data[i];
  31893. Cb = data[i + 1];
  31894. Cr = data[i + 2];
  31895. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  31896. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  31897. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  31898. }
  31899. return data;
  31900. },
  31901. _convertCmykToRgb: function convertCmykToRgb(data) {
  31902. var c, m, y, k;
  31903. var offset = 0;
  31904. var min = -255 * 255 * 255;
  31905. var scale = 1 / 255 / 255;
  31906. for (var i = 0, length = data.length; i < length; i += 4) {
  31907. c = data[i];
  31908. m = data[i + 1];
  31909. y = data[i + 2];
  31910. k = data[i + 3];
  31911. var r = c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k - 72734.4411664936) + m * (1.7149763477362134 * m - 5.6096736904047315 * y - 17.873870861415444 * k - 1401.7366389350734) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 4465.541406466231) - k * (21.86122147463605 * k + 48317.86113160301);
  31912. var g = c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k - 20220.756542821975) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 48691.05921601825) + y * (4.444339102852739 * y + 9.8632861493405 * k - 6341.191035517494) - k * (20.737325471181034 * k + 47890.15695978492);
  31913. var b = c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k - 3616.812083916688) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 28620.90484698408) + y * (0.03296041114873217 * y + 115.60384449646641 * k - 49363.43385999684) - k * (22.33816807309886 * k + 45932.16563550634);
  31914. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  31915. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  31916. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  31917. }
  31918. return data;
  31919. },
  31920. getData: function getData(width, height, forceRGBoutput) {
  31921. if (this.numComponents > 4) {
  31922. (0, _util.error)('JPEG error: Unsupported color mode');
  31923. }
  31924. var data = this._getLinearizedBlockData(width, height);
  31925. if (this.numComponents === 1 && forceRGBoutput) {
  31926. var dataLength = data.length;
  31927. var rgbData = new Uint8Array(dataLength * 3);
  31928. var offset = 0;
  31929. for (var i = 0; i < dataLength; i++) {
  31930. var grayColor = data[i];
  31931. rgbData[offset++] = grayColor;
  31932. rgbData[offset++] = grayColor;
  31933. rgbData[offset++] = grayColor;
  31934. }
  31935. return rgbData;
  31936. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  31937. return this._convertYccToRgb(data);
  31938. } else if (this.numComponents === 4) {
  31939. if (this._isColorConversionNeeded()) {
  31940. if (forceRGBoutput) {
  31941. return this._convertYcckToRgb(data);
  31942. }
  31943. return this._convertYcckToCmyk(data);
  31944. } else if (forceRGBoutput) {
  31945. return this._convertCmykToRgb(data);
  31946. }
  31947. }
  31948. return data;
  31949. }
  31950. };
  31951. return JpegImage;
  31952. }();
  31953. exports.JpegImage = JpegImage;
  31954. /***/ }),
  31955. /* 30 */
  31956. /***/ (function(module, exports, __w_pdfjs_require__) {
  31957. "use strict";
  31958. Object.defineProperty(exports, "__esModule", {
  31959. value: true
  31960. });
  31961. exports.getMetrics = undefined;
  31962. var _util = __w_pdfjs_require__(0);
  31963. var getMetrics = (0, _util.getLookupTableFactory)(function (t) {
  31964. t['Courier'] = 600;
  31965. t['Courier-Bold'] = 600;
  31966. t['Courier-BoldOblique'] = 600;
  31967. t['Courier-Oblique'] = 600;
  31968. t['Helvetica'] = (0, _util.getLookupTableFactory)(function (t) {
  31969. t['space'] = 278;
  31970. t['exclam'] = 278;
  31971. t['quotedbl'] = 355;
  31972. t['numbersign'] = 556;
  31973. t['dollar'] = 556;
  31974. t['percent'] = 889;
  31975. t['ampersand'] = 667;
  31976. t['quoteright'] = 222;
  31977. t['parenleft'] = 333;
  31978. t['parenright'] = 333;
  31979. t['asterisk'] = 389;
  31980. t['plus'] = 584;
  31981. t['comma'] = 278;
  31982. t['hyphen'] = 333;
  31983. t['period'] = 278;
  31984. t['slash'] = 278;
  31985. t['zero'] = 556;
  31986. t['one'] = 556;
  31987. t['two'] = 556;
  31988. t['three'] = 556;
  31989. t['four'] = 556;
  31990. t['five'] = 556;
  31991. t['six'] = 556;
  31992. t['seven'] = 556;
  31993. t['eight'] = 556;
  31994. t['nine'] = 556;
  31995. t['colon'] = 278;
  31996. t['semicolon'] = 278;
  31997. t['less'] = 584;
  31998. t['equal'] = 584;
  31999. t['greater'] = 584;
  32000. t['question'] = 556;
  32001. t['at'] = 1015;
  32002. t['A'] = 667;
  32003. t['B'] = 667;
  32004. t['C'] = 722;
  32005. t['D'] = 722;
  32006. t['E'] = 667;
  32007. t['F'] = 611;
  32008. t['G'] = 778;
  32009. t['H'] = 722;
  32010. t['I'] = 278;
  32011. t['J'] = 500;
  32012. t['K'] = 667;
  32013. t['L'] = 556;
  32014. t['M'] = 833;
  32015. t['N'] = 722;
  32016. t['O'] = 778;
  32017. t['P'] = 667;
  32018. t['Q'] = 778;
  32019. t['R'] = 722;
  32020. t['S'] = 667;
  32021. t['T'] = 611;
  32022. t['U'] = 722;
  32023. t['V'] = 667;
  32024. t['W'] = 944;
  32025. t['X'] = 667;
  32026. t['Y'] = 667;
  32027. t['Z'] = 611;
  32028. t['bracketleft'] = 278;
  32029. t['backslash'] = 278;
  32030. t['bracketright'] = 278;
  32031. t['asciicircum'] = 469;
  32032. t['underscore'] = 556;
  32033. t['quoteleft'] = 222;
  32034. t['a'] = 556;
  32035. t['b'] = 556;
  32036. t['c'] = 500;
  32037. t['d'] = 556;
  32038. t['e'] = 556;
  32039. t['f'] = 278;
  32040. t['g'] = 556;
  32041. t['h'] = 556;
  32042. t['i'] = 222;
  32043. t['j'] = 222;
  32044. t['k'] = 500;
  32045. t['l'] = 222;
  32046. t['m'] = 833;
  32047. t['n'] = 556;
  32048. t['o'] = 556;
  32049. t['p'] = 556;
  32050. t['q'] = 556;
  32051. t['r'] = 333;
  32052. t['s'] = 500;
  32053. t['t'] = 278;
  32054. t['u'] = 556;
  32055. t['v'] = 500;
  32056. t['w'] = 722;
  32057. t['x'] = 500;
  32058. t['y'] = 500;
  32059. t['z'] = 500;
  32060. t['braceleft'] = 334;
  32061. t['bar'] = 260;
  32062. t['braceright'] = 334;
  32063. t['asciitilde'] = 584;
  32064. t['exclamdown'] = 333;
  32065. t['cent'] = 556;
  32066. t['sterling'] = 556;
  32067. t['fraction'] = 167;
  32068. t['yen'] = 556;
  32069. t['florin'] = 556;
  32070. t['section'] = 556;
  32071. t['currency'] = 556;
  32072. t['quotesingle'] = 191;
  32073. t['quotedblleft'] = 333;
  32074. t['guillemotleft'] = 556;
  32075. t['guilsinglleft'] = 333;
  32076. t['guilsinglright'] = 333;
  32077. t['fi'] = 500;
  32078. t['fl'] = 500;
  32079. t['endash'] = 556;
  32080. t['dagger'] = 556;
  32081. t['daggerdbl'] = 556;
  32082. t['periodcentered'] = 278;
  32083. t['paragraph'] = 537;
  32084. t['bullet'] = 350;
  32085. t['quotesinglbase'] = 222;
  32086. t['quotedblbase'] = 333;
  32087. t['quotedblright'] = 333;
  32088. t['guillemotright'] = 556;
  32089. t['ellipsis'] = 1000;
  32090. t['perthousand'] = 1000;
  32091. t['questiondown'] = 611;
  32092. t['grave'] = 333;
  32093. t['acute'] = 333;
  32094. t['circumflex'] = 333;
  32095. t['tilde'] = 333;
  32096. t['macron'] = 333;
  32097. t['breve'] = 333;
  32098. t['dotaccent'] = 333;
  32099. t['dieresis'] = 333;
  32100. t['ring'] = 333;
  32101. t['cedilla'] = 333;
  32102. t['hungarumlaut'] = 333;
  32103. t['ogonek'] = 333;
  32104. t['caron'] = 333;
  32105. t['emdash'] = 1000;
  32106. t['AE'] = 1000;
  32107. t['ordfeminine'] = 370;
  32108. t['Lslash'] = 556;
  32109. t['Oslash'] = 778;
  32110. t['OE'] = 1000;
  32111. t['ordmasculine'] = 365;
  32112. t['ae'] = 889;
  32113. t['dotlessi'] = 278;
  32114. t['lslash'] = 222;
  32115. t['oslash'] = 611;
  32116. t['oe'] = 944;
  32117. t['germandbls'] = 611;
  32118. t['Idieresis'] = 278;
  32119. t['eacute'] = 556;
  32120. t['abreve'] = 556;
  32121. t['uhungarumlaut'] = 556;
  32122. t['ecaron'] = 556;
  32123. t['Ydieresis'] = 667;
  32124. t['divide'] = 584;
  32125. t['Yacute'] = 667;
  32126. t['Acircumflex'] = 667;
  32127. t['aacute'] = 556;
  32128. t['Ucircumflex'] = 722;
  32129. t['yacute'] = 500;
  32130. t['scommaaccent'] = 500;
  32131. t['ecircumflex'] = 556;
  32132. t['Uring'] = 722;
  32133. t['Udieresis'] = 722;
  32134. t['aogonek'] = 556;
  32135. t['Uacute'] = 722;
  32136. t['uogonek'] = 556;
  32137. t['Edieresis'] = 667;
  32138. t['Dcroat'] = 722;
  32139. t['commaaccent'] = 250;
  32140. t['copyright'] = 737;
  32141. t['Emacron'] = 667;
  32142. t['ccaron'] = 500;
  32143. t['aring'] = 556;
  32144. t['Ncommaaccent'] = 722;
  32145. t['lacute'] = 222;
  32146. t['agrave'] = 556;
  32147. t['Tcommaaccent'] = 611;
  32148. t['Cacute'] = 722;
  32149. t['atilde'] = 556;
  32150. t['Edotaccent'] = 667;
  32151. t['scaron'] = 500;
  32152. t['scedilla'] = 500;
  32153. t['iacute'] = 278;
  32154. t['lozenge'] = 471;
  32155. t['Rcaron'] = 722;
  32156. t['Gcommaaccent'] = 778;
  32157. t['ucircumflex'] = 556;
  32158. t['acircumflex'] = 556;
  32159. t['Amacron'] = 667;
  32160. t['rcaron'] = 333;
  32161. t['ccedilla'] = 500;
  32162. t['Zdotaccent'] = 611;
  32163. t['Thorn'] = 667;
  32164. t['Omacron'] = 778;
  32165. t['Racute'] = 722;
  32166. t['Sacute'] = 667;
  32167. t['dcaron'] = 643;
  32168. t['Umacron'] = 722;
  32169. t['uring'] = 556;
  32170. t['threesuperior'] = 333;
  32171. t['Ograve'] = 778;
  32172. t['Agrave'] = 667;
  32173. t['Abreve'] = 667;
  32174. t['multiply'] = 584;
  32175. t['uacute'] = 556;
  32176. t['Tcaron'] = 611;
  32177. t['partialdiff'] = 476;
  32178. t['ydieresis'] = 500;
  32179. t['Nacute'] = 722;
  32180. t['icircumflex'] = 278;
  32181. t['Ecircumflex'] = 667;
  32182. t['adieresis'] = 556;
  32183. t['edieresis'] = 556;
  32184. t['cacute'] = 500;
  32185. t['nacute'] = 556;
  32186. t['umacron'] = 556;
  32187. t['Ncaron'] = 722;
  32188. t['Iacute'] = 278;
  32189. t['plusminus'] = 584;
  32190. t['brokenbar'] = 260;
  32191. t['registered'] = 737;
  32192. t['Gbreve'] = 778;
  32193. t['Idotaccent'] = 278;
  32194. t['summation'] = 600;
  32195. t['Egrave'] = 667;
  32196. t['racute'] = 333;
  32197. t['omacron'] = 556;
  32198. t['Zacute'] = 611;
  32199. t['Zcaron'] = 611;
  32200. t['greaterequal'] = 549;
  32201. t['Eth'] = 722;
  32202. t['Ccedilla'] = 722;
  32203. t['lcommaaccent'] = 222;
  32204. t['tcaron'] = 317;
  32205. t['eogonek'] = 556;
  32206. t['Uogonek'] = 722;
  32207. t['Aacute'] = 667;
  32208. t['Adieresis'] = 667;
  32209. t['egrave'] = 556;
  32210. t['zacute'] = 500;
  32211. t['iogonek'] = 222;
  32212. t['Oacute'] = 778;
  32213. t['oacute'] = 556;
  32214. t['amacron'] = 556;
  32215. t['sacute'] = 500;
  32216. t['idieresis'] = 278;
  32217. t['Ocircumflex'] = 778;
  32218. t['Ugrave'] = 722;
  32219. t['Delta'] = 612;
  32220. t['thorn'] = 556;
  32221. t['twosuperior'] = 333;
  32222. t['Odieresis'] = 778;
  32223. t['mu'] = 556;
  32224. t['igrave'] = 278;
  32225. t['ohungarumlaut'] = 556;
  32226. t['Eogonek'] = 667;
  32227. t['dcroat'] = 556;
  32228. t['threequarters'] = 834;
  32229. t['Scedilla'] = 667;
  32230. t['lcaron'] = 299;
  32231. t['Kcommaaccent'] = 667;
  32232. t['Lacute'] = 556;
  32233. t['trademark'] = 1000;
  32234. t['edotaccent'] = 556;
  32235. t['Igrave'] = 278;
  32236. t['Imacron'] = 278;
  32237. t['Lcaron'] = 556;
  32238. t['onehalf'] = 834;
  32239. t['lessequal'] = 549;
  32240. t['ocircumflex'] = 556;
  32241. t['ntilde'] = 556;
  32242. t['Uhungarumlaut'] = 722;
  32243. t['Eacute'] = 667;
  32244. t['emacron'] = 556;
  32245. t['gbreve'] = 556;
  32246. t['onequarter'] = 834;
  32247. t['Scaron'] = 667;
  32248. t['Scommaaccent'] = 667;
  32249. t['Ohungarumlaut'] = 778;
  32250. t['degree'] = 400;
  32251. t['ograve'] = 556;
  32252. t['Ccaron'] = 722;
  32253. t['ugrave'] = 556;
  32254. t['radical'] = 453;
  32255. t['Dcaron'] = 722;
  32256. t['rcommaaccent'] = 333;
  32257. t['Ntilde'] = 722;
  32258. t['otilde'] = 556;
  32259. t['Rcommaaccent'] = 722;
  32260. t['Lcommaaccent'] = 556;
  32261. t['Atilde'] = 667;
  32262. t['Aogonek'] = 667;
  32263. t['Aring'] = 667;
  32264. t['Otilde'] = 778;
  32265. t['zdotaccent'] = 500;
  32266. t['Ecaron'] = 667;
  32267. t['Iogonek'] = 278;
  32268. t['kcommaaccent'] = 500;
  32269. t['minus'] = 584;
  32270. t['Icircumflex'] = 278;
  32271. t['ncaron'] = 556;
  32272. t['tcommaaccent'] = 278;
  32273. t['logicalnot'] = 584;
  32274. t['odieresis'] = 556;
  32275. t['udieresis'] = 556;
  32276. t['notequal'] = 549;
  32277. t['gcommaaccent'] = 556;
  32278. t['eth'] = 556;
  32279. t['zcaron'] = 500;
  32280. t['ncommaaccent'] = 556;
  32281. t['onesuperior'] = 333;
  32282. t['imacron'] = 278;
  32283. t['Euro'] = 556;
  32284. });
  32285. t['Helvetica-Bold'] = (0, _util.getLookupTableFactory)(function (t) {
  32286. t['space'] = 278;
  32287. t['exclam'] = 333;
  32288. t['quotedbl'] = 474;
  32289. t['numbersign'] = 556;
  32290. t['dollar'] = 556;
  32291. t['percent'] = 889;
  32292. t['ampersand'] = 722;
  32293. t['quoteright'] = 278;
  32294. t['parenleft'] = 333;
  32295. t['parenright'] = 333;
  32296. t['asterisk'] = 389;
  32297. t['plus'] = 584;
  32298. t['comma'] = 278;
  32299. t['hyphen'] = 333;
  32300. t['period'] = 278;
  32301. t['slash'] = 278;
  32302. t['zero'] = 556;
  32303. t['one'] = 556;
  32304. t['two'] = 556;
  32305. t['three'] = 556;
  32306. t['four'] = 556;
  32307. t['five'] = 556;
  32308. t['six'] = 556;
  32309. t['seven'] = 556;
  32310. t['eight'] = 556;
  32311. t['nine'] = 556;
  32312. t['colon'] = 333;
  32313. t['semicolon'] = 333;
  32314. t['less'] = 584;
  32315. t['equal'] = 584;
  32316. t['greater'] = 584;
  32317. t['question'] = 611;
  32318. t['at'] = 975;
  32319. t['A'] = 722;
  32320. t['B'] = 722;
  32321. t['C'] = 722;
  32322. t['D'] = 722;
  32323. t['E'] = 667;
  32324. t['F'] = 611;
  32325. t['G'] = 778;
  32326. t['H'] = 722;
  32327. t['I'] = 278;
  32328. t['J'] = 556;
  32329. t['K'] = 722;
  32330. t['L'] = 611;
  32331. t['M'] = 833;
  32332. t['N'] = 722;
  32333. t['O'] = 778;
  32334. t['P'] = 667;
  32335. t['Q'] = 778;
  32336. t['R'] = 722;
  32337. t['S'] = 667;
  32338. t['T'] = 611;
  32339. t['U'] = 722;
  32340. t['V'] = 667;
  32341. t['W'] = 944;
  32342. t['X'] = 667;
  32343. t['Y'] = 667;
  32344. t['Z'] = 611;
  32345. t['bracketleft'] = 333;
  32346. t['backslash'] = 278;
  32347. t['bracketright'] = 333;
  32348. t['asciicircum'] = 584;
  32349. t['underscore'] = 556;
  32350. t['quoteleft'] = 278;
  32351. t['a'] = 556;
  32352. t['b'] = 611;
  32353. t['c'] = 556;
  32354. t['d'] = 611;
  32355. t['e'] = 556;
  32356. t['f'] = 333;
  32357. t['g'] = 611;
  32358. t['h'] = 611;
  32359. t['i'] = 278;
  32360. t['j'] = 278;
  32361. t['k'] = 556;
  32362. t['l'] = 278;
  32363. t['m'] = 889;
  32364. t['n'] = 611;
  32365. t['o'] = 611;
  32366. t['p'] = 611;
  32367. t['q'] = 611;
  32368. t['r'] = 389;
  32369. t['s'] = 556;
  32370. t['t'] = 333;
  32371. t['u'] = 611;
  32372. t['v'] = 556;
  32373. t['w'] = 778;
  32374. t['x'] = 556;
  32375. t['y'] = 556;
  32376. t['z'] = 500;
  32377. t['braceleft'] = 389;
  32378. t['bar'] = 280;
  32379. t['braceright'] = 389;
  32380. t['asciitilde'] = 584;
  32381. t['exclamdown'] = 333;
  32382. t['cent'] = 556;
  32383. t['sterling'] = 556;
  32384. t['fraction'] = 167;
  32385. t['yen'] = 556;
  32386. t['florin'] = 556;
  32387. t['section'] = 556;
  32388. t['currency'] = 556;
  32389. t['quotesingle'] = 238;
  32390. t['quotedblleft'] = 500;
  32391. t['guillemotleft'] = 556;
  32392. t['guilsinglleft'] = 333;
  32393. t['guilsinglright'] = 333;
  32394. t['fi'] = 611;
  32395. t['fl'] = 611;
  32396. t['endash'] = 556;
  32397. t['dagger'] = 556;
  32398. t['daggerdbl'] = 556;
  32399. t['periodcentered'] = 278;
  32400. t['paragraph'] = 556;
  32401. t['bullet'] = 350;
  32402. t['quotesinglbase'] = 278;
  32403. t['quotedblbase'] = 500;
  32404. t['quotedblright'] = 500;
  32405. t['guillemotright'] = 556;
  32406. t['ellipsis'] = 1000;
  32407. t['perthousand'] = 1000;
  32408. t['questiondown'] = 611;
  32409. t['grave'] = 333;
  32410. t['acute'] = 333;
  32411. t['circumflex'] = 333;
  32412. t['tilde'] = 333;
  32413. t['macron'] = 333;
  32414. t['breve'] = 333;
  32415. t['dotaccent'] = 333;
  32416. t['dieresis'] = 333;
  32417. t['ring'] = 333;
  32418. t['cedilla'] = 333;
  32419. t['hungarumlaut'] = 333;
  32420. t['ogonek'] = 333;
  32421. t['caron'] = 333;
  32422. t['emdash'] = 1000;
  32423. t['AE'] = 1000;
  32424. t['ordfeminine'] = 370;
  32425. t['Lslash'] = 611;
  32426. t['Oslash'] = 778;
  32427. t['OE'] = 1000;
  32428. t['ordmasculine'] = 365;
  32429. t['ae'] = 889;
  32430. t['dotlessi'] = 278;
  32431. t['lslash'] = 278;
  32432. t['oslash'] = 611;
  32433. t['oe'] = 944;
  32434. t['germandbls'] = 611;
  32435. t['Idieresis'] = 278;
  32436. t['eacute'] = 556;
  32437. t['abreve'] = 556;
  32438. t['uhungarumlaut'] = 611;
  32439. t['ecaron'] = 556;
  32440. t['Ydieresis'] = 667;
  32441. t['divide'] = 584;
  32442. t['Yacute'] = 667;
  32443. t['Acircumflex'] = 722;
  32444. t['aacute'] = 556;
  32445. t['Ucircumflex'] = 722;
  32446. t['yacute'] = 556;
  32447. t['scommaaccent'] = 556;
  32448. t['ecircumflex'] = 556;
  32449. t['Uring'] = 722;
  32450. t['Udieresis'] = 722;
  32451. t['aogonek'] = 556;
  32452. t['Uacute'] = 722;
  32453. t['uogonek'] = 611;
  32454. t['Edieresis'] = 667;
  32455. t['Dcroat'] = 722;
  32456. t['commaaccent'] = 250;
  32457. t['copyright'] = 737;
  32458. t['Emacron'] = 667;
  32459. t['ccaron'] = 556;
  32460. t['aring'] = 556;
  32461. t['Ncommaaccent'] = 722;
  32462. t['lacute'] = 278;
  32463. t['agrave'] = 556;
  32464. t['Tcommaaccent'] = 611;
  32465. t['Cacute'] = 722;
  32466. t['atilde'] = 556;
  32467. t['Edotaccent'] = 667;
  32468. t['scaron'] = 556;
  32469. t['scedilla'] = 556;
  32470. t['iacute'] = 278;
  32471. t['lozenge'] = 494;
  32472. t['Rcaron'] = 722;
  32473. t['Gcommaaccent'] = 778;
  32474. t['ucircumflex'] = 611;
  32475. t['acircumflex'] = 556;
  32476. t['Amacron'] = 722;
  32477. t['rcaron'] = 389;
  32478. t['ccedilla'] = 556;
  32479. t['Zdotaccent'] = 611;
  32480. t['Thorn'] = 667;
  32481. t['Omacron'] = 778;
  32482. t['Racute'] = 722;
  32483. t['Sacute'] = 667;
  32484. t['dcaron'] = 743;
  32485. t['Umacron'] = 722;
  32486. t['uring'] = 611;
  32487. t['threesuperior'] = 333;
  32488. t['Ograve'] = 778;
  32489. t['Agrave'] = 722;
  32490. t['Abreve'] = 722;
  32491. t['multiply'] = 584;
  32492. t['uacute'] = 611;
  32493. t['Tcaron'] = 611;
  32494. t['partialdiff'] = 494;
  32495. t['ydieresis'] = 556;
  32496. t['Nacute'] = 722;
  32497. t['icircumflex'] = 278;
  32498. t['Ecircumflex'] = 667;
  32499. t['adieresis'] = 556;
  32500. t['edieresis'] = 556;
  32501. t['cacute'] = 556;
  32502. t['nacute'] = 611;
  32503. t['umacron'] = 611;
  32504. t['Ncaron'] = 722;
  32505. t['Iacute'] = 278;
  32506. t['plusminus'] = 584;
  32507. t['brokenbar'] = 280;
  32508. t['registered'] = 737;
  32509. t['Gbreve'] = 778;
  32510. t['Idotaccent'] = 278;
  32511. t['summation'] = 600;
  32512. t['Egrave'] = 667;
  32513. t['racute'] = 389;
  32514. t['omacron'] = 611;
  32515. t['Zacute'] = 611;
  32516. t['Zcaron'] = 611;
  32517. t['greaterequal'] = 549;
  32518. t['Eth'] = 722;
  32519. t['Ccedilla'] = 722;
  32520. t['lcommaaccent'] = 278;
  32521. t['tcaron'] = 389;
  32522. t['eogonek'] = 556;
  32523. t['Uogonek'] = 722;
  32524. t['Aacute'] = 722;
  32525. t['Adieresis'] = 722;
  32526. t['egrave'] = 556;
  32527. t['zacute'] = 500;
  32528. t['iogonek'] = 278;
  32529. t['Oacute'] = 778;
  32530. t['oacute'] = 611;
  32531. t['amacron'] = 556;
  32532. t['sacute'] = 556;
  32533. t['idieresis'] = 278;
  32534. t['Ocircumflex'] = 778;
  32535. t['Ugrave'] = 722;
  32536. t['Delta'] = 612;
  32537. t['thorn'] = 611;
  32538. t['twosuperior'] = 333;
  32539. t['Odieresis'] = 778;
  32540. t['mu'] = 611;
  32541. t['igrave'] = 278;
  32542. t['ohungarumlaut'] = 611;
  32543. t['Eogonek'] = 667;
  32544. t['dcroat'] = 611;
  32545. t['threequarters'] = 834;
  32546. t['Scedilla'] = 667;
  32547. t['lcaron'] = 400;
  32548. t['Kcommaaccent'] = 722;
  32549. t['Lacute'] = 611;
  32550. t['trademark'] = 1000;
  32551. t['edotaccent'] = 556;
  32552. t['Igrave'] = 278;
  32553. t['Imacron'] = 278;
  32554. t['Lcaron'] = 611;
  32555. t['onehalf'] = 834;
  32556. t['lessequal'] = 549;
  32557. t['ocircumflex'] = 611;
  32558. t['ntilde'] = 611;
  32559. t['Uhungarumlaut'] = 722;
  32560. t['Eacute'] = 667;
  32561. t['emacron'] = 556;
  32562. t['gbreve'] = 611;
  32563. t['onequarter'] = 834;
  32564. t['Scaron'] = 667;
  32565. t['Scommaaccent'] = 667;
  32566. t['Ohungarumlaut'] = 778;
  32567. t['degree'] = 400;
  32568. t['ograve'] = 611;
  32569. t['Ccaron'] = 722;
  32570. t['ugrave'] = 611;
  32571. t['radical'] = 549;
  32572. t['Dcaron'] = 722;
  32573. t['rcommaaccent'] = 389;
  32574. t['Ntilde'] = 722;
  32575. t['otilde'] = 611;
  32576. t['Rcommaaccent'] = 722;
  32577. t['Lcommaaccent'] = 611;
  32578. t['Atilde'] = 722;
  32579. t['Aogonek'] = 722;
  32580. t['Aring'] = 722;
  32581. t['Otilde'] = 778;
  32582. t['zdotaccent'] = 500;
  32583. t['Ecaron'] = 667;
  32584. t['Iogonek'] = 278;
  32585. t['kcommaaccent'] = 556;
  32586. t['minus'] = 584;
  32587. t['Icircumflex'] = 278;
  32588. t['ncaron'] = 611;
  32589. t['tcommaaccent'] = 333;
  32590. t['logicalnot'] = 584;
  32591. t['odieresis'] = 611;
  32592. t['udieresis'] = 611;
  32593. t['notequal'] = 549;
  32594. t['gcommaaccent'] = 611;
  32595. t['eth'] = 611;
  32596. t['zcaron'] = 500;
  32597. t['ncommaaccent'] = 611;
  32598. t['onesuperior'] = 333;
  32599. t['imacron'] = 278;
  32600. t['Euro'] = 556;
  32601. });
  32602. t['Helvetica-BoldOblique'] = (0, _util.getLookupTableFactory)(function (t) {
  32603. t['space'] = 278;
  32604. t['exclam'] = 333;
  32605. t['quotedbl'] = 474;
  32606. t['numbersign'] = 556;
  32607. t['dollar'] = 556;
  32608. t['percent'] = 889;
  32609. t['ampersand'] = 722;
  32610. t['quoteright'] = 278;
  32611. t['parenleft'] = 333;
  32612. t['parenright'] = 333;
  32613. t['asterisk'] = 389;
  32614. t['plus'] = 584;
  32615. t['comma'] = 278;
  32616. t['hyphen'] = 333;
  32617. t['period'] = 278;
  32618. t['slash'] = 278;
  32619. t['zero'] = 556;
  32620. t['one'] = 556;
  32621. t['two'] = 556;
  32622. t['three'] = 556;
  32623. t['four'] = 556;
  32624. t['five'] = 556;
  32625. t['six'] = 556;
  32626. t['seven'] = 556;
  32627. t['eight'] = 556;
  32628. t['nine'] = 556;
  32629. t['colon'] = 333;
  32630. t['semicolon'] = 333;
  32631. t['less'] = 584;
  32632. t['equal'] = 584;
  32633. t['greater'] = 584;
  32634. t['question'] = 611;
  32635. t['at'] = 975;
  32636. t['A'] = 722;
  32637. t['B'] = 722;
  32638. t['C'] = 722;
  32639. t['D'] = 722;
  32640. t['E'] = 667;
  32641. t['F'] = 611;
  32642. t['G'] = 778;
  32643. t['H'] = 722;
  32644. t['I'] = 278;
  32645. t['J'] = 556;
  32646. t['K'] = 722;
  32647. t['L'] = 611;
  32648. t['M'] = 833;
  32649. t['N'] = 722;
  32650. t['O'] = 778;
  32651. t['P'] = 667;
  32652. t['Q'] = 778;
  32653. t['R'] = 722;
  32654. t['S'] = 667;
  32655. t['T'] = 611;
  32656. t['U'] = 722;
  32657. t['V'] = 667;
  32658. t['W'] = 944;
  32659. t['X'] = 667;
  32660. t['Y'] = 667;
  32661. t['Z'] = 611;
  32662. t['bracketleft'] = 333;
  32663. t['backslash'] = 278;
  32664. t['bracketright'] = 333;
  32665. t['asciicircum'] = 584;
  32666. t['underscore'] = 556;
  32667. t['quoteleft'] = 278;
  32668. t['a'] = 556;
  32669. t['b'] = 611;
  32670. t['c'] = 556;
  32671. t['d'] = 611;
  32672. t['e'] = 556;
  32673. t['f'] = 333;
  32674. t['g'] = 611;
  32675. t['h'] = 611;
  32676. t['i'] = 278;
  32677. t['j'] = 278;
  32678. t['k'] = 556;
  32679. t['l'] = 278;
  32680. t['m'] = 889;
  32681. t['n'] = 611;
  32682. t['o'] = 611;
  32683. t['p'] = 611;
  32684. t['q'] = 611;
  32685. t['r'] = 389;
  32686. t['s'] = 556;
  32687. t['t'] = 333;
  32688. t['u'] = 611;
  32689. t['v'] = 556;
  32690. t['w'] = 778;
  32691. t['x'] = 556;
  32692. t['y'] = 556;
  32693. t['z'] = 500;
  32694. t['braceleft'] = 389;
  32695. t['bar'] = 280;
  32696. t['braceright'] = 389;
  32697. t['asciitilde'] = 584;
  32698. t['exclamdown'] = 333;
  32699. t['cent'] = 556;
  32700. t['sterling'] = 556;
  32701. t['fraction'] = 167;
  32702. t['yen'] = 556;
  32703. t['florin'] = 556;
  32704. t['section'] = 556;
  32705. t['currency'] = 556;
  32706. t['quotesingle'] = 238;
  32707. t['quotedblleft'] = 500;
  32708. t['guillemotleft'] = 556;
  32709. t['guilsinglleft'] = 333;
  32710. t['guilsinglright'] = 333;
  32711. t['fi'] = 611;
  32712. t['fl'] = 611;
  32713. t['endash'] = 556;
  32714. t['dagger'] = 556;
  32715. t['daggerdbl'] = 556;
  32716. t['periodcentered'] = 278;
  32717. t['paragraph'] = 556;
  32718. t['bullet'] = 350;
  32719. t['quotesinglbase'] = 278;
  32720. t['quotedblbase'] = 500;
  32721. t['quotedblright'] = 500;
  32722. t['guillemotright'] = 556;
  32723. t['ellipsis'] = 1000;
  32724. t['perthousand'] = 1000;
  32725. t['questiondown'] = 611;
  32726. t['grave'] = 333;
  32727. t['acute'] = 333;
  32728. t['circumflex'] = 333;
  32729. t['tilde'] = 333;
  32730. t['macron'] = 333;
  32731. t['breve'] = 333;
  32732. t['dotaccent'] = 333;
  32733. t['dieresis'] = 333;
  32734. t['ring'] = 333;
  32735. t['cedilla'] = 333;
  32736. t['hungarumlaut'] = 333;
  32737. t['ogonek'] = 333;
  32738. t['caron'] = 333;
  32739. t['emdash'] = 1000;
  32740. t['AE'] = 1000;
  32741. t['ordfeminine'] = 370;
  32742. t['Lslash'] = 611;
  32743. t['Oslash'] = 778;
  32744. t['OE'] = 1000;
  32745. t['ordmasculine'] = 365;
  32746. t['ae'] = 889;
  32747. t['dotlessi'] = 278;
  32748. t['lslash'] = 278;
  32749. t['oslash'] = 611;
  32750. t['oe'] = 944;
  32751. t['germandbls'] = 611;
  32752. t['Idieresis'] = 278;
  32753. t['eacute'] = 556;
  32754. t['abreve'] = 556;
  32755. t['uhungarumlaut'] = 611;
  32756. t['ecaron'] = 556;
  32757. t['Ydieresis'] = 667;
  32758. t['divide'] = 584;
  32759. t['Yacute'] = 667;
  32760. t['Acircumflex'] = 722;
  32761. t['aacute'] = 556;
  32762. t['Ucircumflex'] = 722;
  32763. t['yacute'] = 556;
  32764. t['scommaaccent'] = 556;
  32765. t['ecircumflex'] = 556;
  32766. t['Uring'] = 722;
  32767. t['Udieresis'] = 722;
  32768. t['aogonek'] = 556;
  32769. t['Uacute'] = 722;
  32770. t['uogonek'] = 611;
  32771. t['Edieresis'] = 667;
  32772. t['Dcroat'] = 722;
  32773. t['commaaccent'] = 250;
  32774. t['copyright'] = 737;
  32775. t['Emacron'] = 667;
  32776. t['ccaron'] = 556;
  32777. t['aring'] = 556;
  32778. t['Ncommaaccent'] = 722;
  32779. t['lacute'] = 278;
  32780. t['agrave'] = 556;
  32781. t['Tcommaaccent'] = 611;
  32782. t['Cacute'] = 722;
  32783. t['atilde'] = 556;
  32784. t['Edotaccent'] = 667;
  32785. t['scaron'] = 556;
  32786. t['scedilla'] = 556;
  32787. t['iacute'] = 278;
  32788. t['lozenge'] = 494;
  32789. t['Rcaron'] = 722;
  32790. t['Gcommaaccent'] = 778;
  32791. t['ucircumflex'] = 611;
  32792. t['acircumflex'] = 556;
  32793. t['Amacron'] = 722;
  32794. t['rcaron'] = 389;
  32795. t['ccedilla'] = 556;
  32796. t['Zdotaccent'] = 611;
  32797. t['Thorn'] = 667;
  32798. t['Omacron'] = 778;
  32799. t['Racute'] = 722;
  32800. t['Sacute'] = 667;
  32801. t['dcaron'] = 743;
  32802. t['Umacron'] = 722;
  32803. t['uring'] = 611;
  32804. t['threesuperior'] = 333;
  32805. t['Ograve'] = 778;
  32806. t['Agrave'] = 722;
  32807. t['Abreve'] = 722;
  32808. t['multiply'] = 584;
  32809. t['uacute'] = 611;
  32810. t['Tcaron'] = 611;
  32811. t['partialdiff'] = 494;
  32812. t['ydieresis'] = 556;
  32813. t['Nacute'] = 722;
  32814. t['icircumflex'] = 278;
  32815. t['Ecircumflex'] = 667;
  32816. t['adieresis'] = 556;
  32817. t['edieresis'] = 556;
  32818. t['cacute'] = 556;
  32819. t['nacute'] = 611;
  32820. t['umacron'] = 611;
  32821. t['Ncaron'] = 722;
  32822. t['Iacute'] = 278;
  32823. t['plusminus'] = 584;
  32824. t['brokenbar'] = 280;
  32825. t['registered'] = 737;
  32826. t['Gbreve'] = 778;
  32827. t['Idotaccent'] = 278;
  32828. t['summation'] = 600;
  32829. t['Egrave'] = 667;
  32830. t['racute'] = 389;
  32831. t['omacron'] = 611;
  32832. t['Zacute'] = 611;
  32833. t['Zcaron'] = 611;
  32834. t['greaterequal'] = 549;
  32835. t['Eth'] = 722;
  32836. t['Ccedilla'] = 722;
  32837. t['lcommaaccent'] = 278;
  32838. t['tcaron'] = 389;
  32839. t['eogonek'] = 556;
  32840. t['Uogonek'] = 722;
  32841. t['Aacute'] = 722;
  32842. t['Adieresis'] = 722;
  32843. t['egrave'] = 556;
  32844. t['zacute'] = 500;
  32845. t['iogonek'] = 278;
  32846. t['Oacute'] = 778;
  32847. t['oacute'] = 611;
  32848. t['amacron'] = 556;
  32849. t['sacute'] = 556;
  32850. t['idieresis'] = 278;
  32851. t['Ocircumflex'] = 778;
  32852. t['Ugrave'] = 722;
  32853. t['Delta'] = 612;
  32854. t['thorn'] = 611;
  32855. t['twosuperior'] = 333;
  32856. t['Odieresis'] = 778;
  32857. t['mu'] = 611;
  32858. t['igrave'] = 278;
  32859. t['ohungarumlaut'] = 611;
  32860. t['Eogonek'] = 667;
  32861. t['dcroat'] = 611;
  32862. t['threequarters'] = 834;
  32863. t['Scedilla'] = 667;
  32864. t['lcaron'] = 400;
  32865. t['Kcommaaccent'] = 722;
  32866. t['Lacute'] = 611;
  32867. t['trademark'] = 1000;
  32868. t['edotaccent'] = 556;
  32869. t['Igrave'] = 278;
  32870. t['Imacron'] = 278;
  32871. t['Lcaron'] = 611;
  32872. t['onehalf'] = 834;
  32873. t['lessequal'] = 549;
  32874. t['ocircumflex'] = 611;
  32875. t['ntilde'] = 611;
  32876. t['Uhungarumlaut'] = 722;
  32877. t['Eacute'] = 667;
  32878. t['emacron'] = 556;
  32879. t['gbreve'] = 611;
  32880. t['onequarter'] = 834;
  32881. t['Scaron'] = 667;
  32882. t['Scommaaccent'] = 667;
  32883. t['Ohungarumlaut'] = 778;
  32884. t['degree'] = 400;
  32885. t['ograve'] = 611;
  32886. t['Ccaron'] = 722;
  32887. t['ugrave'] = 611;
  32888. t['radical'] = 549;
  32889. t['Dcaron'] = 722;
  32890. t['rcommaaccent'] = 389;
  32891. t['Ntilde'] = 722;
  32892. t['otilde'] = 611;
  32893. t['Rcommaaccent'] = 722;
  32894. t['Lcommaaccent'] = 611;
  32895. t['Atilde'] = 722;
  32896. t['Aogonek'] = 722;
  32897. t['Aring'] = 722;
  32898. t['Otilde'] = 778;
  32899. t['zdotaccent'] = 500;
  32900. t['Ecaron'] = 667;
  32901. t['Iogonek'] = 278;
  32902. t['kcommaaccent'] = 556;
  32903. t['minus'] = 584;
  32904. t['Icircumflex'] = 278;
  32905. t['ncaron'] = 611;
  32906. t['tcommaaccent'] = 333;
  32907. t['logicalnot'] = 584;
  32908. t['odieresis'] = 611;
  32909. t['udieresis'] = 611;
  32910. t['notequal'] = 549;
  32911. t['gcommaaccent'] = 611;
  32912. t['eth'] = 611;
  32913. t['zcaron'] = 500;
  32914. t['ncommaaccent'] = 611;
  32915. t['onesuperior'] = 333;
  32916. t['imacron'] = 278;
  32917. t['Euro'] = 556;
  32918. });
  32919. t['Helvetica-Oblique'] = (0, _util.getLookupTableFactory)(function (t) {
  32920. t['space'] = 278;
  32921. t['exclam'] = 278;
  32922. t['quotedbl'] = 355;
  32923. t['numbersign'] = 556;
  32924. t['dollar'] = 556;
  32925. t['percent'] = 889;
  32926. t['ampersand'] = 667;
  32927. t['quoteright'] = 222;
  32928. t['parenleft'] = 333;
  32929. t['parenright'] = 333;
  32930. t['asterisk'] = 389;
  32931. t['plus'] = 584;
  32932. t['comma'] = 278;
  32933. t['hyphen'] = 333;
  32934. t['period'] = 278;
  32935. t['slash'] = 278;
  32936. t['zero'] = 556;
  32937. t['one'] = 556;
  32938. t['two'] = 556;
  32939. t['three'] = 556;
  32940. t['four'] = 556;
  32941. t['five'] = 556;
  32942. t['six'] = 556;
  32943. t['seven'] = 556;
  32944. t['eight'] = 556;
  32945. t['nine'] = 556;
  32946. t['colon'] = 278;
  32947. t['semicolon'] = 278;
  32948. t['less'] = 584;
  32949. t['equal'] = 584;
  32950. t['greater'] = 584;
  32951. t['question'] = 556;
  32952. t['at'] = 1015;
  32953. t['A'] = 667;
  32954. t['B'] = 667;
  32955. t['C'] = 722;
  32956. t['D'] = 722;
  32957. t['E'] = 667;
  32958. t['F'] = 611;
  32959. t['G'] = 778;
  32960. t['H'] = 722;
  32961. t['I'] = 278;
  32962. t['J'] = 500;
  32963. t['K'] = 667;
  32964. t['L'] = 556;
  32965. t['M'] = 833;
  32966. t['N'] = 722;
  32967. t['O'] = 778;
  32968. t['P'] = 667;
  32969. t['Q'] = 778;
  32970. t['R'] = 722;
  32971. t['S'] = 667;
  32972. t['T'] = 611;
  32973. t['U'] = 722;
  32974. t['V'] = 667;
  32975. t['W'] = 944;
  32976. t['X'] = 667;
  32977. t['Y'] = 667;
  32978. t['Z'] = 611;
  32979. t['bracketleft'] = 278;
  32980. t['backslash'] = 278;
  32981. t['bracketright'] = 278;
  32982. t['asciicircum'] = 469;
  32983. t['underscore'] = 556;
  32984. t['quoteleft'] = 222;
  32985. t['a'] = 556;
  32986. t['b'] = 556;
  32987. t['c'] = 500;
  32988. t['d'] = 556;
  32989. t['e'] = 556;
  32990. t['f'] = 278;
  32991. t['g'] = 556;
  32992. t['h'] = 556;
  32993. t['i'] = 222;
  32994. t['j'] = 222;
  32995. t['k'] = 500;
  32996. t['l'] = 222;
  32997. t['m'] = 833;
  32998. t['n'] = 556;
  32999. t['o'] = 556;
  33000. t['p'] = 556;
  33001. t['q'] = 556;
  33002. t['r'] = 333;
  33003. t['s'] = 500;
  33004. t['t'] = 278;
  33005. t['u'] = 556;
  33006. t['v'] = 500;
  33007. t['w'] = 722;
  33008. t['x'] = 500;
  33009. t['y'] = 500;
  33010. t['z'] = 500;
  33011. t['braceleft'] = 334;
  33012. t['bar'] = 260;
  33013. t['braceright'] = 334;
  33014. t['asciitilde'] = 584;
  33015. t['exclamdown'] = 333;
  33016. t['cent'] = 556;
  33017. t['sterling'] = 556;
  33018. t['fraction'] = 167;
  33019. t['yen'] = 556;
  33020. t['florin'] = 556;
  33021. t['section'] = 556;
  33022. t['currency'] = 556;
  33023. t['quotesingle'] = 191;
  33024. t['quotedblleft'] = 333;
  33025. t['guillemotleft'] = 556;
  33026. t['guilsinglleft'] = 333;
  33027. t['guilsinglright'] = 333;
  33028. t['fi'] = 500;
  33029. t['fl'] = 500;
  33030. t['endash'] = 556;
  33031. t['dagger'] = 556;
  33032. t['daggerdbl'] = 556;
  33033. t['periodcentered'] = 278;
  33034. t['paragraph'] = 537;
  33035. t['bullet'] = 350;
  33036. t['quotesinglbase'] = 222;
  33037. t['quotedblbase'] = 333;
  33038. t['quotedblright'] = 333;
  33039. t['guillemotright'] = 556;
  33040. t['ellipsis'] = 1000;
  33041. t['perthousand'] = 1000;
  33042. t['questiondown'] = 611;
  33043. t['grave'] = 333;
  33044. t['acute'] = 333;
  33045. t['circumflex'] = 333;
  33046. t['tilde'] = 333;
  33047. t['macron'] = 333;
  33048. t['breve'] = 333;
  33049. t['dotaccent'] = 333;
  33050. t['dieresis'] = 333;
  33051. t['ring'] = 333;
  33052. t['cedilla'] = 333;
  33053. t['hungarumlaut'] = 333;
  33054. t['ogonek'] = 333;
  33055. t['caron'] = 333;
  33056. t['emdash'] = 1000;
  33057. t['AE'] = 1000;
  33058. t['ordfeminine'] = 370;
  33059. t['Lslash'] = 556;
  33060. t['Oslash'] = 778;
  33061. t['OE'] = 1000;
  33062. t['ordmasculine'] = 365;
  33063. t['ae'] = 889;
  33064. t['dotlessi'] = 278;
  33065. t['lslash'] = 222;
  33066. t['oslash'] = 611;
  33067. t['oe'] = 944;
  33068. t['germandbls'] = 611;
  33069. t['Idieresis'] = 278;
  33070. t['eacute'] = 556;
  33071. t['abreve'] = 556;
  33072. t['uhungarumlaut'] = 556;
  33073. t['ecaron'] = 556;
  33074. t['Ydieresis'] = 667;
  33075. t['divide'] = 584;
  33076. t['Yacute'] = 667;
  33077. t['Acircumflex'] = 667;
  33078. t['aacute'] = 556;
  33079. t['Ucircumflex'] = 722;
  33080. t['yacute'] = 500;
  33081. t['scommaaccent'] = 500;
  33082. t['ecircumflex'] = 556;
  33083. t['Uring'] = 722;
  33084. t['Udieresis'] = 722;
  33085. t['aogonek'] = 556;
  33086. t['Uacute'] = 722;
  33087. t['uogonek'] = 556;
  33088. t['Edieresis'] = 667;
  33089. t['Dcroat'] = 722;
  33090. t['commaaccent'] = 250;
  33091. t['copyright'] = 737;
  33092. t['Emacron'] = 667;
  33093. t['ccaron'] = 500;
  33094. t['aring'] = 556;
  33095. t['Ncommaaccent'] = 722;
  33096. t['lacute'] = 222;
  33097. t['agrave'] = 556;
  33098. t['Tcommaaccent'] = 611;
  33099. t['Cacute'] = 722;
  33100. t['atilde'] = 556;
  33101. t['Edotaccent'] = 667;
  33102. t['scaron'] = 500;
  33103. t['scedilla'] = 500;
  33104. t['iacute'] = 278;
  33105. t['lozenge'] = 471;
  33106. t['Rcaron'] = 722;
  33107. t['Gcommaaccent'] = 778;
  33108. t['ucircumflex'] = 556;
  33109. t['acircumflex'] = 556;
  33110. t['Amacron'] = 667;
  33111. t['rcaron'] = 333;
  33112. t['ccedilla'] = 500;
  33113. t['Zdotaccent'] = 611;
  33114. t['Thorn'] = 667;
  33115. t['Omacron'] = 778;
  33116. t['Racute'] = 722;
  33117. t['Sacute'] = 667;
  33118. t['dcaron'] = 643;
  33119. t['Umacron'] = 722;
  33120. t['uring'] = 556;
  33121. t['threesuperior'] = 333;
  33122. t['Ograve'] = 778;
  33123. t['Agrave'] = 667;
  33124. t['Abreve'] = 667;
  33125. t['multiply'] = 584;
  33126. t['uacute'] = 556;
  33127. t['Tcaron'] = 611;
  33128. t['partialdiff'] = 476;
  33129. t['ydieresis'] = 500;
  33130. t['Nacute'] = 722;
  33131. t['icircumflex'] = 278;
  33132. t['Ecircumflex'] = 667;
  33133. t['adieresis'] = 556;
  33134. t['edieresis'] = 556;
  33135. t['cacute'] = 500;
  33136. t['nacute'] = 556;
  33137. t['umacron'] = 556;
  33138. t['Ncaron'] = 722;
  33139. t['Iacute'] = 278;
  33140. t['plusminus'] = 584;
  33141. t['brokenbar'] = 260;
  33142. t['registered'] = 737;
  33143. t['Gbreve'] = 778;
  33144. t['Idotaccent'] = 278;
  33145. t['summation'] = 600;
  33146. t['Egrave'] = 667;
  33147. t['racute'] = 333;
  33148. t['omacron'] = 556;
  33149. t['Zacute'] = 611;
  33150. t['Zcaron'] = 611;
  33151. t['greaterequal'] = 549;
  33152. t['Eth'] = 722;
  33153. t['Ccedilla'] = 722;
  33154. t['lcommaaccent'] = 222;
  33155. t['tcaron'] = 317;
  33156. t['eogonek'] = 556;
  33157. t['Uogonek'] = 722;
  33158. t['Aacute'] = 667;
  33159. t['Adieresis'] = 667;
  33160. t['egrave'] = 556;
  33161. t['zacute'] = 500;
  33162. t['iogonek'] = 222;
  33163. t['Oacute'] = 778;
  33164. t['oacute'] = 556;
  33165. t['amacron'] = 556;
  33166. t['sacute'] = 500;
  33167. t['idieresis'] = 278;
  33168. t['Ocircumflex'] = 778;
  33169. t['Ugrave'] = 722;
  33170. t['Delta'] = 612;
  33171. t['thorn'] = 556;
  33172. t['twosuperior'] = 333;
  33173. t['Odieresis'] = 778;
  33174. t['mu'] = 556;
  33175. t['igrave'] = 278;
  33176. t['ohungarumlaut'] = 556;
  33177. t['Eogonek'] = 667;
  33178. t['dcroat'] = 556;
  33179. t['threequarters'] = 834;
  33180. t['Scedilla'] = 667;
  33181. t['lcaron'] = 299;
  33182. t['Kcommaaccent'] = 667;
  33183. t['Lacute'] = 556;
  33184. t['trademark'] = 1000;
  33185. t['edotaccent'] = 556;
  33186. t['Igrave'] = 278;
  33187. t['Imacron'] = 278;
  33188. t['Lcaron'] = 556;
  33189. t['onehalf'] = 834;
  33190. t['lessequal'] = 549;
  33191. t['ocircumflex'] = 556;
  33192. t['ntilde'] = 556;
  33193. t['Uhungarumlaut'] = 722;
  33194. t['Eacute'] = 667;
  33195. t['emacron'] = 556;
  33196. t['gbreve'] = 556;
  33197. t['onequarter'] = 834;
  33198. t['Scaron'] = 667;
  33199. t['Scommaaccent'] = 667;
  33200. t['Ohungarumlaut'] = 778;
  33201. t['degree'] = 400;
  33202. t['ograve'] = 556;
  33203. t['Ccaron'] = 722;
  33204. t['ugrave'] = 556;
  33205. t['radical'] = 453;
  33206. t['Dcaron'] = 722;
  33207. t['rcommaaccent'] = 333;
  33208. t['Ntilde'] = 722;
  33209. t['otilde'] = 556;
  33210. t['Rcommaaccent'] = 722;
  33211. t['Lcommaaccent'] = 556;
  33212. t['Atilde'] = 667;
  33213. t['Aogonek'] = 667;
  33214. t['Aring'] = 667;
  33215. t['Otilde'] = 778;
  33216. t['zdotaccent'] = 500;
  33217. t['Ecaron'] = 667;
  33218. t['Iogonek'] = 278;
  33219. t['kcommaaccent'] = 500;
  33220. t['minus'] = 584;
  33221. t['Icircumflex'] = 278;
  33222. t['ncaron'] = 556;
  33223. t['tcommaaccent'] = 278;
  33224. t['logicalnot'] = 584;
  33225. t['odieresis'] = 556;
  33226. t['udieresis'] = 556;
  33227. t['notequal'] = 549;
  33228. t['gcommaaccent'] = 556;
  33229. t['eth'] = 556;
  33230. t['zcaron'] = 500;
  33231. t['ncommaaccent'] = 556;
  33232. t['onesuperior'] = 333;
  33233. t['imacron'] = 278;
  33234. t['Euro'] = 556;
  33235. });
  33236. t['Symbol'] = (0, _util.getLookupTableFactory)(function (t) {
  33237. t['space'] = 250;
  33238. t['exclam'] = 333;
  33239. t['universal'] = 713;
  33240. t['numbersign'] = 500;
  33241. t['existential'] = 549;
  33242. t['percent'] = 833;
  33243. t['ampersand'] = 778;
  33244. t['suchthat'] = 439;
  33245. t['parenleft'] = 333;
  33246. t['parenright'] = 333;
  33247. t['asteriskmath'] = 500;
  33248. t['plus'] = 549;
  33249. t['comma'] = 250;
  33250. t['minus'] = 549;
  33251. t['period'] = 250;
  33252. t['slash'] = 278;
  33253. t['zero'] = 500;
  33254. t['one'] = 500;
  33255. t['two'] = 500;
  33256. t['three'] = 500;
  33257. t['four'] = 500;
  33258. t['five'] = 500;
  33259. t['six'] = 500;
  33260. t['seven'] = 500;
  33261. t['eight'] = 500;
  33262. t['nine'] = 500;
  33263. t['colon'] = 278;
  33264. t['semicolon'] = 278;
  33265. t['less'] = 549;
  33266. t['equal'] = 549;
  33267. t['greater'] = 549;
  33268. t['question'] = 444;
  33269. t['congruent'] = 549;
  33270. t['Alpha'] = 722;
  33271. t['Beta'] = 667;
  33272. t['Chi'] = 722;
  33273. t['Delta'] = 612;
  33274. t['Epsilon'] = 611;
  33275. t['Phi'] = 763;
  33276. t['Gamma'] = 603;
  33277. t['Eta'] = 722;
  33278. t['Iota'] = 333;
  33279. t['theta1'] = 631;
  33280. t['Kappa'] = 722;
  33281. t['Lambda'] = 686;
  33282. t['Mu'] = 889;
  33283. t['Nu'] = 722;
  33284. t['Omicron'] = 722;
  33285. t['Pi'] = 768;
  33286. t['Theta'] = 741;
  33287. t['Rho'] = 556;
  33288. t['Sigma'] = 592;
  33289. t['Tau'] = 611;
  33290. t['Upsilon'] = 690;
  33291. t['sigma1'] = 439;
  33292. t['Omega'] = 768;
  33293. t['Xi'] = 645;
  33294. t['Psi'] = 795;
  33295. t['Zeta'] = 611;
  33296. t['bracketleft'] = 333;
  33297. t['therefore'] = 863;
  33298. t['bracketright'] = 333;
  33299. t['perpendicular'] = 658;
  33300. t['underscore'] = 500;
  33301. t['radicalex'] = 500;
  33302. t['alpha'] = 631;
  33303. t['beta'] = 549;
  33304. t['chi'] = 549;
  33305. t['delta'] = 494;
  33306. t['epsilon'] = 439;
  33307. t['phi'] = 521;
  33308. t['gamma'] = 411;
  33309. t['eta'] = 603;
  33310. t['iota'] = 329;
  33311. t['phi1'] = 603;
  33312. t['kappa'] = 549;
  33313. t['lambda'] = 549;
  33314. t['mu'] = 576;
  33315. t['nu'] = 521;
  33316. t['omicron'] = 549;
  33317. t['pi'] = 549;
  33318. t['theta'] = 521;
  33319. t['rho'] = 549;
  33320. t['sigma'] = 603;
  33321. t['tau'] = 439;
  33322. t['upsilon'] = 576;
  33323. t['omega1'] = 713;
  33324. t['omega'] = 686;
  33325. t['xi'] = 493;
  33326. t['psi'] = 686;
  33327. t['zeta'] = 494;
  33328. t['braceleft'] = 480;
  33329. t['bar'] = 200;
  33330. t['braceright'] = 480;
  33331. t['similar'] = 549;
  33332. t['Euro'] = 750;
  33333. t['Upsilon1'] = 620;
  33334. t['minute'] = 247;
  33335. t['lessequal'] = 549;
  33336. t['fraction'] = 167;
  33337. t['infinity'] = 713;
  33338. t['florin'] = 500;
  33339. t['club'] = 753;
  33340. t['diamond'] = 753;
  33341. t['heart'] = 753;
  33342. t['spade'] = 753;
  33343. t['arrowboth'] = 1042;
  33344. t['arrowleft'] = 987;
  33345. t['arrowup'] = 603;
  33346. t['arrowright'] = 987;
  33347. t['arrowdown'] = 603;
  33348. t['degree'] = 400;
  33349. t['plusminus'] = 549;
  33350. t['second'] = 411;
  33351. t['greaterequal'] = 549;
  33352. t['multiply'] = 549;
  33353. t['proportional'] = 713;
  33354. t['partialdiff'] = 494;
  33355. t['bullet'] = 460;
  33356. t['divide'] = 549;
  33357. t['notequal'] = 549;
  33358. t['equivalence'] = 549;
  33359. t['approxequal'] = 549;
  33360. t['ellipsis'] = 1000;
  33361. t['arrowvertex'] = 603;
  33362. t['arrowhorizex'] = 1000;
  33363. t['carriagereturn'] = 658;
  33364. t['aleph'] = 823;
  33365. t['Ifraktur'] = 686;
  33366. t['Rfraktur'] = 795;
  33367. t['weierstrass'] = 987;
  33368. t['circlemultiply'] = 768;
  33369. t['circleplus'] = 768;
  33370. t['emptyset'] = 823;
  33371. t['intersection'] = 768;
  33372. t['union'] = 768;
  33373. t['propersuperset'] = 713;
  33374. t['reflexsuperset'] = 713;
  33375. t['notsubset'] = 713;
  33376. t['propersubset'] = 713;
  33377. t['reflexsubset'] = 713;
  33378. t['element'] = 713;
  33379. t['notelement'] = 713;
  33380. t['angle'] = 768;
  33381. t['gradient'] = 713;
  33382. t['registerserif'] = 790;
  33383. t['copyrightserif'] = 790;
  33384. t['trademarkserif'] = 890;
  33385. t['product'] = 823;
  33386. t['radical'] = 549;
  33387. t['dotmath'] = 250;
  33388. t['logicalnot'] = 713;
  33389. t['logicaland'] = 603;
  33390. t['logicalor'] = 603;
  33391. t['arrowdblboth'] = 1042;
  33392. t['arrowdblleft'] = 987;
  33393. t['arrowdblup'] = 603;
  33394. t['arrowdblright'] = 987;
  33395. t['arrowdbldown'] = 603;
  33396. t['lozenge'] = 494;
  33397. t['angleleft'] = 329;
  33398. t['registersans'] = 790;
  33399. t['copyrightsans'] = 790;
  33400. t['trademarksans'] = 786;
  33401. t['summation'] = 713;
  33402. t['parenlefttp'] = 384;
  33403. t['parenleftex'] = 384;
  33404. t['parenleftbt'] = 384;
  33405. t['bracketlefttp'] = 384;
  33406. t['bracketleftex'] = 384;
  33407. t['bracketleftbt'] = 384;
  33408. t['bracelefttp'] = 494;
  33409. t['braceleftmid'] = 494;
  33410. t['braceleftbt'] = 494;
  33411. t['braceex'] = 494;
  33412. t['angleright'] = 329;
  33413. t['integral'] = 274;
  33414. t['integraltp'] = 686;
  33415. t['integralex'] = 686;
  33416. t['integralbt'] = 686;
  33417. t['parenrighttp'] = 384;
  33418. t['parenrightex'] = 384;
  33419. t['parenrightbt'] = 384;
  33420. t['bracketrighttp'] = 384;
  33421. t['bracketrightex'] = 384;
  33422. t['bracketrightbt'] = 384;
  33423. t['bracerighttp'] = 494;
  33424. t['bracerightmid'] = 494;
  33425. t['bracerightbt'] = 494;
  33426. t['apple'] = 790;
  33427. });
  33428. t['Times-Roman'] = (0, _util.getLookupTableFactory)(function (t) {
  33429. t['space'] = 250;
  33430. t['exclam'] = 333;
  33431. t['quotedbl'] = 408;
  33432. t['numbersign'] = 500;
  33433. t['dollar'] = 500;
  33434. t['percent'] = 833;
  33435. t['ampersand'] = 778;
  33436. t['quoteright'] = 333;
  33437. t['parenleft'] = 333;
  33438. t['parenright'] = 333;
  33439. t['asterisk'] = 500;
  33440. t['plus'] = 564;
  33441. t['comma'] = 250;
  33442. t['hyphen'] = 333;
  33443. t['period'] = 250;
  33444. t['slash'] = 278;
  33445. t['zero'] = 500;
  33446. t['one'] = 500;
  33447. t['two'] = 500;
  33448. t['three'] = 500;
  33449. t['four'] = 500;
  33450. t['five'] = 500;
  33451. t['six'] = 500;
  33452. t['seven'] = 500;
  33453. t['eight'] = 500;
  33454. t['nine'] = 500;
  33455. t['colon'] = 278;
  33456. t['semicolon'] = 278;
  33457. t['less'] = 564;
  33458. t['equal'] = 564;
  33459. t['greater'] = 564;
  33460. t['question'] = 444;
  33461. t['at'] = 921;
  33462. t['A'] = 722;
  33463. t['B'] = 667;
  33464. t['C'] = 667;
  33465. t['D'] = 722;
  33466. t['E'] = 611;
  33467. t['F'] = 556;
  33468. t['G'] = 722;
  33469. t['H'] = 722;
  33470. t['I'] = 333;
  33471. t['J'] = 389;
  33472. t['K'] = 722;
  33473. t['L'] = 611;
  33474. t['M'] = 889;
  33475. t['N'] = 722;
  33476. t['O'] = 722;
  33477. t['P'] = 556;
  33478. t['Q'] = 722;
  33479. t['R'] = 667;
  33480. t['S'] = 556;
  33481. t['T'] = 611;
  33482. t['U'] = 722;
  33483. t['V'] = 722;
  33484. t['W'] = 944;
  33485. t['X'] = 722;
  33486. t['Y'] = 722;
  33487. t['Z'] = 611;
  33488. t['bracketleft'] = 333;
  33489. t['backslash'] = 278;
  33490. t['bracketright'] = 333;
  33491. t['asciicircum'] = 469;
  33492. t['underscore'] = 500;
  33493. t['quoteleft'] = 333;
  33494. t['a'] = 444;
  33495. t['b'] = 500;
  33496. t['c'] = 444;
  33497. t['d'] = 500;
  33498. t['e'] = 444;
  33499. t['f'] = 333;
  33500. t['g'] = 500;
  33501. t['h'] = 500;
  33502. t['i'] = 278;
  33503. t['j'] = 278;
  33504. t['k'] = 500;
  33505. t['l'] = 278;
  33506. t['m'] = 778;
  33507. t['n'] = 500;
  33508. t['o'] = 500;
  33509. t['p'] = 500;
  33510. t['q'] = 500;
  33511. t['r'] = 333;
  33512. t['s'] = 389;
  33513. t['t'] = 278;
  33514. t['u'] = 500;
  33515. t['v'] = 500;
  33516. t['w'] = 722;
  33517. t['x'] = 500;
  33518. t['y'] = 500;
  33519. t['z'] = 444;
  33520. t['braceleft'] = 480;
  33521. t['bar'] = 200;
  33522. t['braceright'] = 480;
  33523. t['asciitilde'] = 541;
  33524. t['exclamdown'] = 333;
  33525. t['cent'] = 500;
  33526. t['sterling'] = 500;
  33527. t['fraction'] = 167;
  33528. t['yen'] = 500;
  33529. t['florin'] = 500;
  33530. t['section'] = 500;
  33531. t['currency'] = 500;
  33532. t['quotesingle'] = 180;
  33533. t['quotedblleft'] = 444;
  33534. t['guillemotleft'] = 500;
  33535. t['guilsinglleft'] = 333;
  33536. t['guilsinglright'] = 333;
  33537. t['fi'] = 556;
  33538. t['fl'] = 556;
  33539. t['endash'] = 500;
  33540. t['dagger'] = 500;
  33541. t['daggerdbl'] = 500;
  33542. t['periodcentered'] = 250;
  33543. t['paragraph'] = 453;
  33544. t['bullet'] = 350;
  33545. t['quotesinglbase'] = 333;
  33546. t['quotedblbase'] = 444;
  33547. t['quotedblright'] = 444;
  33548. t['guillemotright'] = 500;
  33549. t['ellipsis'] = 1000;
  33550. t['perthousand'] = 1000;
  33551. t['questiondown'] = 444;
  33552. t['grave'] = 333;
  33553. t['acute'] = 333;
  33554. t['circumflex'] = 333;
  33555. t['tilde'] = 333;
  33556. t['macron'] = 333;
  33557. t['breve'] = 333;
  33558. t['dotaccent'] = 333;
  33559. t['dieresis'] = 333;
  33560. t['ring'] = 333;
  33561. t['cedilla'] = 333;
  33562. t['hungarumlaut'] = 333;
  33563. t['ogonek'] = 333;
  33564. t['caron'] = 333;
  33565. t['emdash'] = 1000;
  33566. t['AE'] = 889;
  33567. t['ordfeminine'] = 276;
  33568. t['Lslash'] = 611;
  33569. t['Oslash'] = 722;
  33570. t['OE'] = 889;
  33571. t['ordmasculine'] = 310;
  33572. t['ae'] = 667;
  33573. t['dotlessi'] = 278;
  33574. t['lslash'] = 278;
  33575. t['oslash'] = 500;
  33576. t['oe'] = 722;
  33577. t['germandbls'] = 500;
  33578. t['Idieresis'] = 333;
  33579. t['eacute'] = 444;
  33580. t['abreve'] = 444;
  33581. t['uhungarumlaut'] = 500;
  33582. t['ecaron'] = 444;
  33583. t['Ydieresis'] = 722;
  33584. t['divide'] = 564;
  33585. t['Yacute'] = 722;
  33586. t['Acircumflex'] = 722;
  33587. t['aacute'] = 444;
  33588. t['Ucircumflex'] = 722;
  33589. t['yacute'] = 500;
  33590. t['scommaaccent'] = 389;
  33591. t['ecircumflex'] = 444;
  33592. t['Uring'] = 722;
  33593. t['Udieresis'] = 722;
  33594. t['aogonek'] = 444;
  33595. t['Uacute'] = 722;
  33596. t['uogonek'] = 500;
  33597. t['Edieresis'] = 611;
  33598. t['Dcroat'] = 722;
  33599. t['commaaccent'] = 250;
  33600. t['copyright'] = 760;
  33601. t['Emacron'] = 611;
  33602. t['ccaron'] = 444;
  33603. t['aring'] = 444;
  33604. t['Ncommaaccent'] = 722;
  33605. t['lacute'] = 278;
  33606. t['agrave'] = 444;
  33607. t['Tcommaaccent'] = 611;
  33608. t['Cacute'] = 667;
  33609. t['atilde'] = 444;
  33610. t['Edotaccent'] = 611;
  33611. t['scaron'] = 389;
  33612. t['scedilla'] = 389;
  33613. t['iacute'] = 278;
  33614. t['lozenge'] = 471;
  33615. t['Rcaron'] = 667;
  33616. t['Gcommaaccent'] = 722;
  33617. t['ucircumflex'] = 500;
  33618. t['acircumflex'] = 444;
  33619. t['Amacron'] = 722;
  33620. t['rcaron'] = 333;
  33621. t['ccedilla'] = 444;
  33622. t['Zdotaccent'] = 611;
  33623. t['Thorn'] = 556;
  33624. t['Omacron'] = 722;
  33625. t['Racute'] = 667;
  33626. t['Sacute'] = 556;
  33627. t['dcaron'] = 588;
  33628. t['Umacron'] = 722;
  33629. t['uring'] = 500;
  33630. t['threesuperior'] = 300;
  33631. t['Ograve'] = 722;
  33632. t['Agrave'] = 722;
  33633. t['Abreve'] = 722;
  33634. t['multiply'] = 564;
  33635. t['uacute'] = 500;
  33636. t['Tcaron'] = 611;
  33637. t['partialdiff'] = 476;
  33638. t['ydieresis'] = 500;
  33639. t['Nacute'] = 722;
  33640. t['icircumflex'] = 278;
  33641. t['Ecircumflex'] = 611;
  33642. t['adieresis'] = 444;
  33643. t['edieresis'] = 444;
  33644. t['cacute'] = 444;
  33645. t['nacute'] = 500;
  33646. t['umacron'] = 500;
  33647. t['Ncaron'] = 722;
  33648. t['Iacute'] = 333;
  33649. t['plusminus'] = 564;
  33650. t['brokenbar'] = 200;
  33651. t['registered'] = 760;
  33652. t['Gbreve'] = 722;
  33653. t['Idotaccent'] = 333;
  33654. t['summation'] = 600;
  33655. t['Egrave'] = 611;
  33656. t['racute'] = 333;
  33657. t['omacron'] = 500;
  33658. t['Zacute'] = 611;
  33659. t['Zcaron'] = 611;
  33660. t['greaterequal'] = 549;
  33661. t['Eth'] = 722;
  33662. t['Ccedilla'] = 667;
  33663. t['lcommaaccent'] = 278;
  33664. t['tcaron'] = 326;
  33665. t['eogonek'] = 444;
  33666. t['Uogonek'] = 722;
  33667. t['Aacute'] = 722;
  33668. t['Adieresis'] = 722;
  33669. t['egrave'] = 444;
  33670. t['zacute'] = 444;
  33671. t['iogonek'] = 278;
  33672. t['Oacute'] = 722;
  33673. t['oacute'] = 500;
  33674. t['amacron'] = 444;
  33675. t['sacute'] = 389;
  33676. t['idieresis'] = 278;
  33677. t['Ocircumflex'] = 722;
  33678. t['Ugrave'] = 722;
  33679. t['Delta'] = 612;
  33680. t['thorn'] = 500;
  33681. t['twosuperior'] = 300;
  33682. t['Odieresis'] = 722;
  33683. t['mu'] = 500;
  33684. t['igrave'] = 278;
  33685. t['ohungarumlaut'] = 500;
  33686. t['Eogonek'] = 611;
  33687. t['dcroat'] = 500;
  33688. t['threequarters'] = 750;
  33689. t['Scedilla'] = 556;
  33690. t['lcaron'] = 344;
  33691. t['Kcommaaccent'] = 722;
  33692. t['Lacute'] = 611;
  33693. t['trademark'] = 980;
  33694. t['edotaccent'] = 444;
  33695. t['Igrave'] = 333;
  33696. t['Imacron'] = 333;
  33697. t['Lcaron'] = 611;
  33698. t['onehalf'] = 750;
  33699. t['lessequal'] = 549;
  33700. t['ocircumflex'] = 500;
  33701. t['ntilde'] = 500;
  33702. t['Uhungarumlaut'] = 722;
  33703. t['Eacute'] = 611;
  33704. t['emacron'] = 444;
  33705. t['gbreve'] = 500;
  33706. t['onequarter'] = 750;
  33707. t['Scaron'] = 556;
  33708. t['Scommaaccent'] = 556;
  33709. t['Ohungarumlaut'] = 722;
  33710. t['degree'] = 400;
  33711. t['ograve'] = 500;
  33712. t['Ccaron'] = 667;
  33713. t['ugrave'] = 500;
  33714. t['radical'] = 453;
  33715. t['Dcaron'] = 722;
  33716. t['rcommaaccent'] = 333;
  33717. t['Ntilde'] = 722;
  33718. t['otilde'] = 500;
  33719. t['Rcommaaccent'] = 667;
  33720. t['Lcommaaccent'] = 611;
  33721. t['Atilde'] = 722;
  33722. t['Aogonek'] = 722;
  33723. t['Aring'] = 722;
  33724. t['Otilde'] = 722;
  33725. t['zdotaccent'] = 444;
  33726. t['Ecaron'] = 611;
  33727. t['Iogonek'] = 333;
  33728. t['kcommaaccent'] = 500;
  33729. t['minus'] = 564;
  33730. t['Icircumflex'] = 333;
  33731. t['ncaron'] = 500;
  33732. t['tcommaaccent'] = 278;
  33733. t['logicalnot'] = 564;
  33734. t['odieresis'] = 500;
  33735. t['udieresis'] = 500;
  33736. t['notequal'] = 549;
  33737. t['gcommaaccent'] = 500;
  33738. t['eth'] = 500;
  33739. t['zcaron'] = 444;
  33740. t['ncommaaccent'] = 500;
  33741. t['onesuperior'] = 300;
  33742. t['imacron'] = 278;
  33743. t['Euro'] = 500;
  33744. });
  33745. t['Times-Bold'] = (0, _util.getLookupTableFactory)(function (t) {
  33746. t['space'] = 250;
  33747. t['exclam'] = 333;
  33748. t['quotedbl'] = 555;
  33749. t['numbersign'] = 500;
  33750. t['dollar'] = 500;
  33751. t['percent'] = 1000;
  33752. t['ampersand'] = 833;
  33753. t['quoteright'] = 333;
  33754. t['parenleft'] = 333;
  33755. t['parenright'] = 333;
  33756. t['asterisk'] = 500;
  33757. t['plus'] = 570;
  33758. t['comma'] = 250;
  33759. t['hyphen'] = 333;
  33760. t['period'] = 250;
  33761. t['slash'] = 278;
  33762. t['zero'] = 500;
  33763. t['one'] = 500;
  33764. t['two'] = 500;
  33765. t['three'] = 500;
  33766. t['four'] = 500;
  33767. t['five'] = 500;
  33768. t['six'] = 500;
  33769. t['seven'] = 500;
  33770. t['eight'] = 500;
  33771. t['nine'] = 500;
  33772. t['colon'] = 333;
  33773. t['semicolon'] = 333;
  33774. t['less'] = 570;
  33775. t['equal'] = 570;
  33776. t['greater'] = 570;
  33777. t['question'] = 500;
  33778. t['at'] = 930;
  33779. t['A'] = 722;
  33780. t['B'] = 667;
  33781. t['C'] = 722;
  33782. t['D'] = 722;
  33783. t['E'] = 667;
  33784. t['F'] = 611;
  33785. t['G'] = 778;
  33786. t['H'] = 778;
  33787. t['I'] = 389;
  33788. t['J'] = 500;
  33789. t['K'] = 778;
  33790. t['L'] = 667;
  33791. t['M'] = 944;
  33792. t['N'] = 722;
  33793. t['O'] = 778;
  33794. t['P'] = 611;
  33795. t['Q'] = 778;
  33796. t['R'] = 722;
  33797. t['S'] = 556;
  33798. t['T'] = 667;
  33799. t['U'] = 722;
  33800. t['V'] = 722;
  33801. t['W'] = 1000;
  33802. t['X'] = 722;
  33803. t['Y'] = 722;
  33804. t['Z'] = 667;
  33805. t['bracketleft'] = 333;
  33806. t['backslash'] = 278;
  33807. t['bracketright'] = 333;
  33808. t['asciicircum'] = 581;
  33809. t['underscore'] = 500;
  33810. t['quoteleft'] = 333;
  33811. t['a'] = 500;
  33812. t['b'] = 556;
  33813. t['c'] = 444;
  33814. t['d'] = 556;
  33815. t['e'] = 444;
  33816. t['f'] = 333;
  33817. t['g'] = 500;
  33818. t['h'] = 556;
  33819. t['i'] = 278;
  33820. t['j'] = 333;
  33821. t['k'] = 556;
  33822. t['l'] = 278;
  33823. t['m'] = 833;
  33824. t['n'] = 556;
  33825. t['o'] = 500;
  33826. t['p'] = 556;
  33827. t['q'] = 556;
  33828. t['r'] = 444;
  33829. t['s'] = 389;
  33830. t['t'] = 333;
  33831. t['u'] = 556;
  33832. t['v'] = 500;
  33833. t['w'] = 722;
  33834. t['x'] = 500;
  33835. t['y'] = 500;
  33836. t['z'] = 444;
  33837. t['braceleft'] = 394;
  33838. t['bar'] = 220;
  33839. t['braceright'] = 394;
  33840. t['asciitilde'] = 520;
  33841. t['exclamdown'] = 333;
  33842. t['cent'] = 500;
  33843. t['sterling'] = 500;
  33844. t['fraction'] = 167;
  33845. t['yen'] = 500;
  33846. t['florin'] = 500;
  33847. t['section'] = 500;
  33848. t['currency'] = 500;
  33849. t['quotesingle'] = 278;
  33850. t['quotedblleft'] = 500;
  33851. t['guillemotleft'] = 500;
  33852. t['guilsinglleft'] = 333;
  33853. t['guilsinglright'] = 333;
  33854. t['fi'] = 556;
  33855. t['fl'] = 556;
  33856. t['endash'] = 500;
  33857. t['dagger'] = 500;
  33858. t['daggerdbl'] = 500;
  33859. t['periodcentered'] = 250;
  33860. t['paragraph'] = 540;
  33861. t['bullet'] = 350;
  33862. t['quotesinglbase'] = 333;
  33863. t['quotedblbase'] = 500;
  33864. t['quotedblright'] = 500;
  33865. t['guillemotright'] = 500;
  33866. t['ellipsis'] = 1000;
  33867. t['perthousand'] = 1000;
  33868. t['questiondown'] = 500;
  33869. t['grave'] = 333;
  33870. t['acute'] = 333;
  33871. t['circumflex'] = 333;
  33872. t['tilde'] = 333;
  33873. t['macron'] = 333;
  33874. t['breve'] = 333;
  33875. t['dotaccent'] = 333;
  33876. t['dieresis'] = 333;
  33877. t['ring'] = 333;
  33878. t['cedilla'] = 333;
  33879. t['hungarumlaut'] = 333;
  33880. t['ogonek'] = 333;
  33881. t['caron'] = 333;
  33882. t['emdash'] = 1000;
  33883. t['AE'] = 1000;
  33884. t['ordfeminine'] = 300;
  33885. t['Lslash'] = 667;
  33886. t['Oslash'] = 778;
  33887. t['OE'] = 1000;
  33888. t['ordmasculine'] = 330;
  33889. t['ae'] = 722;
  33890. t['dotlessi'] = 278;
  33891. t['lslash'] = 278;
  33892. t['oslash'] = 500;
  33893. t['oe'] = 722;
  33894. t['germandbls'] = 556;
  33895. t['Idieresis'] = 389;
  33896. t['eacute'] = 444;
  33897. t['abreve'] = 500;
  33898. t['uhungarumlaut'] = 556;
  33899. t['ecaron'] = 444;
  33900. t['Ydieresis'] = 722;
  33901. t['divide'] = 570;
  33902. t['Yacute'] = 722;
  33903. t['Acircumflex'] = 722;
  33904. t['aacute'] = 500;
  33905. t['Ucircumflex'] = 722;
  33906. t['yacute'] = 500;
  33907. t['scommaaccent'] = 389;
  33908. t['ecircumflex'] = 444;
  33909. t['Uring'] = 722;
  33910. t['Udieresis'] = 722;
  33911. t['aogonek'] = 500;
  33912. t['Uacute'] = 722;
  33913. t['uogonek'] = 556;
  33914. t['Edieresis'] = 667;
  33915. t['Dcroat'] = 722;
  33916. t['commaaccent'] = 250;
  33917. t['copyright'] = 747;
  33918. t['Emacron'] = 667;
  33919. t['ccaron'] = 444;
  33920. t['aring'] = 500;
  33921. t['Ncommaaccent'] = 722;
  33922. t['lacute'] = 278;
  33923. t['agrave'] = 500;
  33924. t['Tcommaaccent'] = 667;
  33925. t['Cacute'] = 722;
  33926. t['atilde'] = 500;
  33927. t['Edotaccent'] = 667;
  33928. t['scaron'] = 389;
  33929. t['scedilla'] = 389;
  33930. t['iacute'] = 278;
  33931. t['lozenge'] = 494;
  33932. t['Rcaron'] = 722;
  33933. t['Gcommaaccent'] = 778;
  33934. t['ucircumflex'] = 556;
  33935. t['acircumflex'] = 500;
  33936. t['Amacron'] = 722;
  33937. t['rcaron'] = 444;
  33938. t['ccedilla'] = 444;
  33939. t['Zdotaccent'] = 667;
  33940. t['Thorn'] = 611;
  33941. t['Omacron'] = 778;
  33942. t['Racute'] = 722;
  33943. t['Sacute'] = 556;
  33944. t['dcaron'] = 672;
  33945. t['Umacron'] = 722;
  33946. t['uring'] = 556;
  33947. t['threesuperior'] = 300;
  33948. t['Ograve'] = 778;
  33949. t['Agrave'] = 722;
  33950. t['Abreve'] = 722;
  33951. t['multiply'] = 570;
  33952. t['uacute'] = 556;
  33953. t['Tcaron'] = 667;
  33954. t['partialdiff'] = 494;
  33955. t['ydieresis'] = 500;
  33956. t['Nacute'] = 722;
  33957. t['icircumflex'] = 278;
  33958. t['Ecircumflex'] = 667;
  33959. t['adieresis'] = 500;
  33960. t['edieresis'] = 444;
  33961. t['cacute'] = 444;
  33962. t['nacute'] = 556;
  33963. t['umacron'] = 556;
  33964. t['Ncaron'] = 722;
  33965. t['Iacute'] = 389;
  33966. t['plusminus'] = 570;
  33967. t['brokenbar'] = 220;
  33968. t['registered'] = 747;
  33969. t['Gbreve'] = 778;
  33970. t['Idotaccent'] = 389;
  33971. t['summation'] = 600;
  33972. t['Egrave'] = 667;
  33973. t['racute'] = 444;
  33974. t['omacron'] = 500;
  33975. t['Zacute'] = 667;
  33976. t['Zcaron'] = 667;
  33977. t['greaterequal'] = 549;
  33978. t['Eth'] = 722;
  33979. t['Ccedilla'] = 722;
  33980. t['lcommaaccent'] = 278;
  33981. t['tcaron'] = 416;
  33982. t['eogonek'] = 444;
  33983. t['Uogonek'] = 722;
  33984. t['Aacute'] = 722;
  33985. t['Adieresis'] = 722;
  33986. t['egrave'] = 444;
  33987. t['zacute'] = 444;
  33988. t['iogonek'] = 278;
  33989. t['Oacute'] = 778;
  33990. t['oacute'] = 500;
  33991. t['amacron'] = 500;
  33992. t['sacute'] = 389;
  33993. t['idieresis'] = 278;
  33994. t['Ocircumflex'] = 778;
  33995. t['Ugrave'] = 722;
  33996. t['Delta'] = 612;
  33997. t['thorn'] = 556;
  33998. t['twosuperior'] = 300;
  33999. t['Odieresis'] = 778;
  34000. t['mu'] = 556;
  34001. t['igrave'] = 278;
  34002. t['ohungarumlaut'] = 500;
  34003. t['Eogonek'] = 667;
  34004. t['dcroat'] = 556;
  34005. t['threequarters'] = 750;
  34006. t['Scedilla'] = 556;
  34007. t['lcaron'] = 394;
  34008. t['Kcommaaccent'] = 778;
  34009. t['Lacute'] = 667;
  34010. t['trademark'] = 1000;
  34011. t['edotaccent'] = 444;
  34012. t['Igrave'] = 389;
  34013. t['Imacron'] = 389;
  34014. t['Lcaron'] = 667;
  34015. t['onehalf'] = 750;
  34016. t['lessequal'] = 549;
  34017. t['ocircumflex'] = 500;
  34018. t['ntilde'] = 556;
  34019. t['Uhungarumlaut'] = 722;
  34020. t['Eacute'] = 667;
  34021. t['emacron'] = 444;
  34022. t['gbreve'] = 500;
  34023. t['onequarter'] = 750;
  34024. t['Scaron'] = 556;
  34025. t['Scommaaccent'] = 556;
  34026. t['Ohungarumlaut'] = 778;
  34027. t['degree'] = 400;
  34028. t['ograve'] = 500;
  34029. t['Ccaron'] = 722;
  34030. t['ugrave'] = 556;
  34031. t['radical'] = 549;
  34032. t['Dcaron'] = 722;
  34033. t['rcommaaccent'] = 444;
  34034. t['Ntilde'] = 722;
  34035. t['otilde'] = 500;
  34036. t['Rcommaaccent'] = 722;
  34037. t['Lcommaaccent'] = 667;
  34038. t['Atilde'] = 722;
  34039. t['Aogonek'] = 722;
  34040. t['Aring'] = 722;
  34041. t['Otilde'] = 778;
  34042. t['zdotaccent'] = 444;
  34043. t['Ecaron'] = 667;
  34044. t['Iogonek'] = 389;
  34045. t['kcommaaccent'] = 556;
  34046. t['minus'] = 570;
  34047. t['Icircumflex'] = 389;
  34048. t['ncaron'] = 556;
  34049. t['tcommaaccent'] = 333;
  34050. t['logicalnot'] = 570;
  34051. t['odieresis'] = 500;
  34052. t['udieresis'] = 556;
  34053. t['notequal'] = 549;
  34054. t['gcommaaccent'] = 500;
  34055. t['eth'] = 500;
  34056. t['zcaron'] = 444;
  34057. t['ncommaaccent'] = 556;
  34058. t['onesuperior'] = 300;
  34059. t['imacron'] = 278;
  34060. t['Euro'] = 500;
  34061. });
  34062. t['Times-BoldItalic'] = (0, _util.getLookupTableFactory)(function (t) {
  34063. t['space'] = 250;
  34064. t['exclam'] = 389;
  34065. t['quotedbl'] = 555;
  34066. t['numbersign'] = 500;
  34067. t['dollar'] = 500;
  34068. t['percent'] = 833;
  34069. t['ampersand'] = 778;
  34070. t['quoteright'] = 333;
  34071. t['parenleft'] = 333;
  34072. t['parenright'] = 333;
  34073. t['asterisk'] = 500;
  34074. t['plus'] = 570;
  34075. t['comma'] = 250;
  34076. t['hyphen'] = 333;
  34077. t['period'] = 250;
  34078. t['slash'] = 278;
  34079. t['zero'] = 500;
  34080. t['one'] = 500;
  34081. t['two'] = 500;
  34082. t['three'] = 500;
  34083. t['four'] = 500;
  34084. t['five'] = 500;
  34085. t['six'] = 500;
  34086. t['seven'] = 500;
  34087. t['eight'] = 500;
  34088. t['nine'] = 500;
  34089. t['colon'] = 333;
  34090. t['semicolon'] = 333;
  34091. t['less'] = 570;
  34092. t['equal'] = 570;
  34093. t['greater'] = 570;
  34094. t['question'] = 500;
  34095. t['at'] = 832;
  34096. t['A'] = 667;
  34097. t['B'] = 667;
  34098. t['C'] = 667;
  34099. t['D'] = 722;
  34100. t['E'] = 667;
  34101. t['F'] = 667;
  34102. t['G'] = 722;
  34103. t['H'] = 778;
  34104. t['I'] = 389;
  34105. t['J'] = 500;
  34106. t['K'] = 667;
  34107. t['L'] = 611;
  34108. t['M'] = 889;
  34109. t['N'] = 722;
  34110. t['O'] = 722;
  34111. t['P'] = 611;
  34112. t['Q'] = 722;
  34113. t['R'] = 667;
  34114. t['S'] = 556;
  34115. t['T'] = 611;
  34116. t['U'] = 722;
  34117. t['V'] = 667;
  34118. t['W'] = 889;
  34119. t['X'] = 667;
  34120. t['Y'] = 611;
  34121. t['Z'] = 611;
  34122. t['bracketleft'] = 333;
  34123. t['backslash'] = 278;
  34124. t['bracketright'] = 333;
  34125. t['asciicircum'] = 570;
  34126. t['underscore'] = 500;
  34127. t['quoteleft'] = 333;
  34128. t['a'] = 500;
  34129. t['b'] = 500;
  34130. t['c'] = 444;
  34131. t['d'] = 500;
  34132. t['e'] = 444;
  34133. t['f'] = 333;
  34134. t['g'] = 500;
  34135. t['h'] = 556;
  34136. t['i'] = 278;
  34137. t['j'] = 278;
  34138. t['k'] = 500;
  34139. t['l'] = 278;
  34140. t['m'] = 778;
  34141. t['n'] = 556;
  34142. t['o'] = 500;
  34143. t['p'] = 500;
  34144. t['q'] = 500;
  34145. t['r'] = 389;
  34146. t['s'] = 389;
  34147. t['t'] = 278;
  34148. t['u'] = 556;
  34149. t['v'] = 444;
  34150. t['w'] = 667;
  34151. t['x'] = 500;
  34152. t['y'] = 444;
  34153. t['z'] = 389;
  34154. t['braceleft'] = 348;
  34155. t['bar'] = 220;
  34156. t['braceright'] = 348;
  34157. t['asciitilde'] = 570;
  34158. t['exclamdown'] = 389;
  34159. t['cent'] = 500;
  34160. t['sterling'] = 500;
  34161. t['fraction'] = 167;
  34162. t['yen'] = 500;
  34163. t['florin'] = 500;
  34164. t['section'] = 500;
  34165. t['currency'] = 500;
  34166. t['quotesingle'] = 278;
  34167. t['quotedblleft'] = 500;
  34168. t['guillemotleft'] = 500;
  34169. t['guilsinglleft'] = 333;
  34170. t['guilsinglright'] = 333;
  34171. t['fi'] = 556;
  34172. t['fl'] = 556;
  34173. t['endash'] = 500;
  34174. t['dagger'] = 500;
  34175. t['daggerdbl'] = 500;
  34176. t['periodcentered'] = 250;
  34177. t['paragraph'] = 500;
  34178. t['bullet'] = 350;
  34179. t['quotesinglbase'] = 333;
  34180. t['quotedblbase'] = 500;
  34181. t['quotedblright'] = 500;
  34182. t['guillemotright'] = 500;
  34183. t['ellipsis'] = 1000;
  34184. t['perthousand'] = 1000;
  34185. t['questiondown'] = 500;
  34186. t['grave'] = 333;
  34187. t['acute'] = 333;
  34188. t['circumflex'] = 333;
  34189. t['tilde'] = 333;
  34190. t['macron'] = 333;
  34191. t['breve'] = 333;
  34192. t['dotaccent'] = 333;
  34193. t['dieresis'] = 333;
  34194. t['ring'] = 333;
  34195. t['cedilla'] = 333;
  34196. t['hungarumlaut'] = 333;
  34197. t['ogonek'] = 333;
  34198. t['caron'] = 333;
  34199. t['emdash'] = 1000;
  34200. t['AE'] = 944;
  34201. t['ordfeminine'] = 266;
  34202. t['Lslash'] = 611;
  34203. t['Oslash'] = 722;
  34204. t['OE'] = 944;
  34205. t['ordmasculine'] = 300;
  34206. t['ae'] = 722;
  34207. t['dotlessi'] = 278;
  34208. t['lslash'] = 278;
  34209. t['oslash'] = 500;
  34210. t['oe'] = 722;
  34211. t['germandbls'] = 500;
  34212. t['Idieresis'] = 389;
  34213. t['eacute'] = 444;
  34214. t['abreve'] = 500;
  34215. t['uhungarumlaut'] = 556;
  34216. t['ecaron'] = 444;
  34217. t['Ydieresis'] = 611;
  34218. t['divide'] = 570;
  34219. t['Yacute'] = 611;
  34220. t['Acircumflex'] = 667;
  34221. t['aacute'] = 500;
  34222. t['Ucircumflex'] = 722;
  34223. t['yacute'] = 444;
  34224. t['scommaaccent'] = 389;
  34225. t['ecircumflex'] = 444;
  34226. t['Uring'] = 722;
  34227. t['Udieresis'] = 722;
  34228. t['aogonek'] = 500;
  34229. t['Uacute'] = 722;
  34230. t['uogonek'] = 556;
  34231. t['Edieresis'] = 667;
  34232. t['Dcroat'] = 722;
  34233. t['commaaccent'] = 250;
  34234. t['copyright'] = 747;
  34235. t['Emacron'] = 667;
  34236. t['ccaron'] = 444;
  34237. t['aring'] = 500;
  34238. t['Ncommaaccent'] = 722;
  34239. t['lacute'] = 278;
  34240. t['agrave'] = 500;
  34241. t['Tcommaaccent'] = 611;
  34242. t['Cacute'] = 667;
  34243. t['atilde'] = 500;
  34244. t['Edotaccent'] = 667;
  34245. t['scaron'] = 389;
  34246. t['scedilla'] = 389;
  34247. t['iacute'] = 278;
  34248. t['lozenge'] = 494;
  34249. t['Rcaron'] = 667;
  34250. t['Gcommaaccent'] = 722;
  34251. t['ucircumflex'] = 556;
  34252. t['acircumflex'] = 500;
  34253. t['Amacron'] = 667;
  34254. t['rcaron'] = 389;
  34255. t['ccedilla'] = 444;
  34256. t['Zdotaccent'] = 611;
  34257. t['Thorn'] = 611;
  34258. t['Omacron'] = 722;
  34259. t['Racute'] = 667;
  34260. t['Sacute'] = 556;
  34261. t['dcaron'] = 608;
  34262. t['Umacron'] = 722;
  34263. t['uring'] = 556;
  34264. t['threesuperior'] = 300;
  34265. t['Ograve'] = 722;
  34266. t['Agrave'] = 667;
  34267. t['Abreve'] = 667;
  34268. t['multiply'] = 570;
  34269. t['uacute'] = 556;
  34270. t['Tcaron'] = 611;
  34271. t['partialdiff'] = 494;
  34272. t['ydieresis'] = 444;
  34273. t['Nacute'] = 722;
  34274. t['icircumflex'] = 278;
  34275. t['Ecircumflex'] = 667;
  34276. t['adieresis'] = 500;
  34277. t['edieresis'] = 444;
  34278. t['cacute'] = 444;
  34279. t['nacute'] = 556;
  34280. t['umacron'] = 556;
  34281. t['Ncaron'] = 722;
  34282. t['Iacute'] = 389;
  34283. t['plusminus'] = 570;
  34284. t['brokenbar'] = 220;
  34285. t['registered'] = 747;
  34286. t['Gbreve'] = 722;
  34287. t['Idotaccent'] = 389;
  34288. t['summation'] = 600;
  34289. t['Egrave'] = 667;
  34290. t['racute'] = 389;
  34291. t['omacron'] = 500;
  34292. t['Zacute'] = 611;
  34293. t['Zcaron'] = 611;
  34294. t['greaterequal'] = 549;
  34295. t['Eth'] = 722;
  34296. t['Ccedilla'] = 667;
  34297. t['lcommaaccent'] = 278;
  34298. t['tcaron'] = 366;
  34299. t['eogonek'] = 444;
  34300. t['Uogonek'] = 722;
  34301. t['Aacute'] = 667;
  34302. t['Adieresis'] = 667;
  34303. t['egrave'] = 444;
  34304. t['zacute'] = 389;
  34305. t['iogonek'] = 278;
  34306. t['Oacute'] = 722;
  34307. t['oacute'] = 500;
  34308. t['amacron'] = 500;
  34309. t['sacute'] = 389;
  34310. t['idieresis'] = 278;
  34311. t['Ocircumflex'] = 722;
  34312. t['Ugrave'] = 722;
  34313. t['Delta'] = 612;
  34314. t['thorn'] = 500;
  34315. t['twosuperior'] = 300;
  34316. t['Odieresis'] = 722;
  34317. t['mu'] = 576;
  34318. t['igrave'] = 278;
  34319. t['ohungarumlaut'] = 500;
  34320. t['Eogonek'] = 667;
  34321. t['dcroat'] = 500;
  34322. t['threequarters'] = 750;
  34323. t['Scedilla'] = 556;
  34324. t['lcaron'] = 382;
  34325. t['Kcommaaccent'] = 667;
  34326. t['Lacute'] = 611;
  34327. t['trademark'] = 1000;
  34328. t['edotaccent'] = 444;
  34329. t['Igrave'] = 389;
  34330. t['Imacron'] = 389;
  34331. t['Lcaron'] = 611;
  34332. t['onehalf'] = 750;
  34333. t['lessequal'] = 549;
  34334. t['ocircumflex'] = 500;
  34335. t['ntilde'] = 556;
  34336. t['Uhungarumlaut'] = 722;
  34337. t['Eacute'] = 667;
  34338. t['emacron'] = 444;
  34339. t['gbreve'] = 500;
  34340. t['onequarter'] = 750;
  34341. t['Scaron'] = 556;
  34342. t['Scommaaccent'] = 556;
  34343. t['Ohungarumlaut'] = 722;
  34344. t['degree'] = 400;
  34345. t['ograve'] = 500;
  34346. t['Ccaron'] = 667;
  34347. t['ugrave'] = 556;
  34348. t['radical'] = 549;
  34349. t['Dcaron'] = 722;
  34350. t['rcommaaccent'] = 389;
  34351. t['Ntilde'] = 722;
  34352. t['otilde'] = 500;
  34353. t['Rcommaaccent'] = 667;
  34354. t['Lcommaaccent'] = 611;
  34355. t['Atilde'] = 667;
  34356. t['Aogonek'] = 667;
  34357. t['Aring'] = 667;
  34358. t['Otilde'] = 722;
  34359. t['zdotaccent'] = 389;
  34360. t['Ecaron'] = 667;
  34361. t['Iogonek'] = 389;
  34362. t['kcommaaccent'] = 500;
  34363. t['minus'] = 606;
  34364. t['Icircumflex'] = 389;
  34365. t['ncaron'] = 556;
  34366. t['tcommaaccent'] = 278;
  34367. t['logicalnot'] = 606;
  34368. t['odieresis'] = 500;
  34369. t['udieresis'] = 556;
  34370. t['notequal'] = 549;
  34371. t['gcommaaccent'] = 500;
  34372. t['eth'] = 500;
  34373. t['zcaron'] = 389;
  34374. t['ncommaaccent'] = 556;
  34375. t['onesuperior'] = 300;
  34376. t['imacron'] = 278;
  34377. t['Euro'] = 500;
  34378. });
  34379. t['Times-Italic'] = (0, _util.getLookupTableFactory)(function (t) {
  34380. t['space'] = 250;
  34381. t['exclam'] = 333;
  34382. t['quotedbl'] = 420;
  34383. t['numbersign'] = 500;
  34384. t['dollar'] = 500;
  34385. t['percent'] = 833;
  34386. t['ampersand'] = 778;
  34387. t['quoteright'] = 333;
  34388. t['parenleft'] = 333;
  34389. t['parenright'] = 333;
  34390. t['asterisk'] = 500;
  34391. t['plus'] = 675;
  34392. t['comma'] = 250;
  34393. t['hyphen'] = 333;
  34394. t['period'] = 250;
  34395. t['slash'] = 278;
  34396. t['zero'] = 500;
  34397. t['one'] = 500;
  34398. t['two'] = 500;
  34399. t['three'] = 500;
  34400. t['four'] = 500;
  34401. t['five'] = 500;
  34402. t['six'] = 500;
  34403. t['seven'] = 500;
  34404. t['eight'] = 500;
  34405. t['nine'] = 500;
  34406. t['colon'] = 333;
  34407. t['semicolon'] = 333;
  34408. t['less'] = 675;
  34409. t['equal'] = 675;
  34410. t['greater'] = 675;
  34411. t['question'] = 500;
  34412. t['at'] = 920;
  34413. t['A'] = 611;
  34414. t['B'] = 611;
  34415. t['C'] = 667;
  34416. t['D'] = 722;
  34417. t['E'] = 611;
  34418. t['F'] = 611;
  34419. t['G'] = 722;
  34420. t['H'] = 722;
  34421. t['I'] = 333;
  34422. t['J'] = 444;
  34423. t['K'] = 667;
  34424. t['L'] = 556;
  34425. t['M'] = 833;
  34426. t['N'] = 667;
  34427. t['O'] = 722;
  34428. t['P'] = 611;
  34429. t['Q'] = 722;
  34430. t['R'] = 611;
  34431. t['S'] = 500;
  34432. t['T'] = 556;
  34433. t['U'] = 722;
  34434. t['V'] = 611;
  34435. t['W'] = 833;
  34436. t['X'] = 611;
  34437. t['Y'] = 556;
  34438. t['Z'] = 556;
  34439. t['bracketleft'] = 389;
  34440. t['backslash'] = 278;
  34441. t['bracketright'] = 389;
  34442. t['asciicircum'] = 422;
  34443. t['underscore'] = 500;
  34444. t['quoteleft'] = 333;
  34445. t['a'] = 500;
  34446. t['b'] = 500;
  34447. t['c'] = 444;
  34448. t['d'] = 500;
  34449. t['e'] = 444;
  34450. t['f'] = 278;
  34451. t['g'] = 500;
  34452. t['h'] = 500;
  34453. t['i'] = 278;
  34454. t['j'] = 278;
  34455. t['k'] = 444;
  34456. t['l'] = 278;
  34457. t['m'] = 722;
  34458. t['n'] = 500;
  34459. t['o'] = 500;
  34460. t['p'] = 500;
  34461. t['q'] = 500;
  34462. t['r'] = 389;
  34463. t['s'] = 389;
  34464. t['t'] = 278;
  34465. t['u'] = 500;
  34466. t['v'] = 444;
  34467. t['w'] = 667;
  34468. t['x'] = 444;
  34469. t['y'] = 444;
  34470. t['z'] = 389;
  34471. t['braceleft'] = 400;
  34472. t['bar'] = 275;
  34473. t['braceright'] = 400;
  34474. t['asciitilde'] = 541;
  34475. t['exclamdown'] = 389;
  34476. t['cent'] = 500;
  34477. t['sterling'] = 500;
  34478. t['fraction'] = 167;
  34479. t['yen'] = 500;
  34480. t['florin'] = 500;
  34481. t['section'] = 500;
  34482. t['currency'] = 500;
  34483. t['quotesingle'] = 214;
  34484. t['quotedblleft'] = 556;
  34485. t['guillemotleft'] = 500;
  34486. t['guilsinglleft'] = 333;
  34487. t['guilsinglright'] = 333;
  34488. t['fi'] = 500;
  34489. t['fl'] = 500;
  34490. t['endash'] = 500;
  34491. t['dagger'] = 500;
  34492. t['daggerdbl'] = 500;
  34493. t['periodcentered'] = 250;
  34494. t['paragraph'] = 523;
  34495. t['bullet'] = 350;
  34496. t['quotesinglbase'] = 333;
  34497. t['quotedblbase'] = 556;
  34498. t['quotedblright'] = 556;
  34499. t['guillemotright'] = 500;
  34500. t['ellipsis'] = 889;
  34501. t['perthousand'] = 1000;
  34502. t['questiondown'] = 500;
  34503. t['grave'] = 333;
  34504. t['acute'] = 333;
  34505. t['circumflex'] = 333;
  34506. t['tilde'] = 333;
  34507. t['macron'] = 333;
  34508. t['breve'] = 333;
  34509. t['dotaccent'] = 333;
  34510. t['dieresis'] = 333;
  34511. t['ring'] = 333;
  34512. t['cedilla'] = 333;
  34513. t['hungarumlaut'] = 333;
  34514. t['ogonek'] = 333;
  34515. t['caron'] = 333;
  34516. t['emdash'] = 889;
  34517. t['AE'] = 889;
  34518. t['ordfeminine'] = 276;
  34519. t['Lslash'] = 556;
  34520. t['Oslash'] = 722;
  34521. t['OE'] = 944;
  34522. t['ordmasculine'] = 310;
  34523. t['ae'] = 667;
  34524. t['dotlessi'] = 278;
  34525. t['lslash'] = 278;
  34526. t['oslash'] = 500;
  34527. t['oe'] = 667;
  34528. t['germandbls'] = 500;
  34529. t['Idieresis'] = 333;
  34530. t['eacute'] = 444;
  34531. t['abreve'] = 500;
  34532. t['uhungarumlaut'] = 500;
  34533. t['ecaron'] = 444;
  34534. t['Ydieresis'] = 556;
  34535. t['divide'] = 675;
  34536. t['Yacute'] = 556;
  34537. t['Acircumflex'] = 611;
  34538. t['aacute'] = 500;
  34539. t['Ucircumflex'] = 722;
  34540. t['yacute'] = 444;
  34541. t['scommaaccent'] = 389;
  34542. t['ecircumflex'] = 444;
  34543. t['Uring'] = 722;
  34544. t['Udieresis'] = 722;
  34545. t['aogonek'] = 500;
  34546. t['Uacute'] = 722;
  34547. t['uogonek'] = 500;
  34548. t['Edieresis'] = 611;
  34549. t['Dcroat'] = 722;
  34550. t['commaaccent'] = 250;
  34551. t['copyright'] = 760;
  34552. t['Emacron'] = 611;
  34553. t['ccaron'] = 444;
  34554. t['aring'] = 500;
  34555. t['Ncommaaccent'] = 667;
  34556. t['lacute'] = 278;
  34557. t['agrave'] = 500;
  34558. t['Tcommaaccent'] = 556;
  34559. t['Cacute'] = 667;
  34560. t['atilde'] = 500;
  34561. t['Edotaccent'] = 611;
  34562. t['scaron'] = 389;
  34563. t['scedilla'] = 389;
  34564. t['iacute'] = 278;
  34565. t['lozenge'] = 471;
  34566. t['Rcaron'] = 611;
  34567. t['Gcommaaccent'] = 722;
  34568. t['ucircumflex'] = 500;
  34569. t['acircumflex'] = 500;
  34570. t['Amacron'] = 611;
  34571. t['rcaron'] = 389;
  34572. t['ccedilla'] = 444;
  34573. t['Zdotaccent'] = 556;
  34574. t['Thorn'] = 611;
  34575. t['Omacron'] = 722;
  34576. t['Racute'] = 611;
  34577. t['Sacute'] = 500;
  34578. t['dcaron'] = 544;
  34579. t['Umacron'] = 722;
  34580. t['uring'] = 500;
  34581. t['threesuperior'] = 300;
  34582. t['Ograve'] = 722;
  34583. t['Agrave'] = 611;
  34584. t['Abreve'] = 611;
  34585. t['multiply'] = 675;
  34586. t['uacute'] = 500;
  34587. t['Tcaron'] = 556;
  34588. t['partialdiff'] = 476;
  34589. t['ydieresis'] = 444;
  34590. t['Nacute'] = 667;
  34591. t['icircumflex'] = 278;
  34592. t['Ecircumflex'] = 611;
  34593. t['adieresis'] = 500;
  34594. t['edieresis'] = 444;
  34595. t['cacute'] = 444;
  34596. t['nacute'] = 500;
  34597. t['umacron'] = 500;
  34598. t['Ncaron'] = 667;
  34599. t['Iacute'] = 333;
  34600. t['plusminus'] = 675;
  34601. t['brokenbar'] = 275;
  34602. t['registered'] = 760;
  34603. t['Gbreve'] = 722;
  34604. t['Idotaccent'] = 333;
  34605. t['summation'] = 600;
  34606. t['Egrave'] = 611;
  34607. t['racute'] = 389;
  34608. t['omacron'] = 500;
  34609. t['Zacute'] = 556;
  34610. t['Zcaron'] = 556;
  34611. t['greaterequal'] = 549;
  34612. t['Eth'] = 722;
  34613. t['Ccedilla'] = 667;
  34614. t['lcommaaccent'] = 278;
  34615. t['tcaron'] = 300;
  34616. t['eogonek'] = 444;
  34617. t['Uogonek'] = 722;
  34618. t['Aacute'] = 611;
  34619. t['Adieresis'] = 611;
  34620. t['egrave'] = 444;
  34621. t['zacute'] = 389;
  34622. t['iogonek'] = 278;
  34623. t['Oacute'] = 722;
  34624. t['oacute'] = 500;
  34625. t['amacron'] = 500;
  34626. t['sacute'] = 389;
  34627. t['idieresis'] = 278;
  34628. t['Ocircumflex'] = 722;
  34629. t['Ugrave'] = 722;
  34630. t['Delta'] = 612;
  34631. t['thorn'] = 500;
  34632. t['twosuperior'] = 300;
  34633. t['Odieresis'] = 722;
  34634. t['mu'] = 500;
  34635. t['igrave'] = 278;
  34636. t['ohungarumlaut'] = 500;
  34637. t['Eogonek'] = 611;
  34638. t['dcroat'] = 500;
  34639. t['threequarters'] = 750;
  34640. t['Scedilla'] = 500;
  34641. t['lcaron'] = 300;
  34642. t['Kcommaaccent'] = 667;
  34643. t['Lacute'] = 556;
  34644. t['trademark'] = 980;
  34645. t['edotaccent'] = 444;
  34646. t['Igrave'] = 333;
  34647. t['Imacron'] = 333;
  34648. t['Lcaron'] = 611;
  34649. t['onehalf'] = 750;
  34650. t['lessequal'] = 549;
  34651. t['ocircumflex'] = 500;
  34652. t['ntilde'] = 500;
  34653. t['Uhungarumlaut'] = 722;
  34654. t['Eacute'] = 611;
  34655. t['emacron'] = 444;
  34656. t['gbreve'] = 500;
  34657. t['onequarter'] = 750;
  34658. t['Scaron'] = 500;
  34659. t['Scommaaccent'] = 500;
  34660. t['Ohungarumlaut'] = 722;
  34661. t['degree'] = 400;
  34662. t['ograve'] = 500;
  34663. t['Ccaron'] = 667;
  34664. t['ugrave'] = 500;
  34665. t['radical'] = 453;
  34666. t['Dcaron'] = 722;
  34667. t['rcommaaccent'] = 389;
  34668. t['Ntilde'] = 667;
  34669. t['otilde'] = 500;
  34670. t['Rcommaaccent'] = 611;
  34671. t['Lcommaaccent'] = 556;
  34672. t['Atilde'] = 611;
  34673. t['Aogonek'] = 611;
  34674. t['Aring'] = 611;
  34675. t['Otilde'] = 722;
  34676. t['zdotaccent'] = 389;
  34677. t['Ecaron'] = 611;
  34678. t['Iogonek'] = 333;
  34679. t['kcommaaccent'] = 444;
  34680. t['minus'] = 675;
  34681. t['Icircumflex'] = 333;
  34682. t['ncaron'] = 500;
  34683. t['tcommaaccent'] = 278;
  34684. t['logicalnot'] = 675;
  34685. t['odieresis'] = 500;
  34686. t['udieresis'] = 500;
  34687. t['notequal'] = 549;
  34688. t['gcommaaccent'] = 500;
  34689. t['eth'] = 500;
  34690. t['zcaron'] = 389;
  34691. t['ncommaaccent'] = 500;
  34692. t['onesuperior'] = 300;
  34693. t['imacron'] = 278;
  34694. t['Euro'] = 500;
  34695. });
  34696. t['ZapfDingbats'] = (0, _util.getLookupTableFactory)(function (t) {
  34697. t['space'] = 278;
  34698. t['a1'] = 974;
  34699. t['a2'] = 961;
  34700. t['a202'] = 974;
  34701. t['a3'] = 980;
  34702. t['a4'] = 719;
  34703. t['a5'] = 789;
  34704. t['a119'] = 790;
  34705. t['a118'] = 791;
  34706. t['a117'] = 690;
  34707. t['a11'] = 960;
  34708. t['a12'] = 939;
  34709. t['a13'] = 549;
  34710. t['a14'] = 855;
  34711. t['a15'] = 911;
  34712. t['a16'] = 933;
  34713. t['a105'] = 911;
  34714. t['a17'] = 945;
  34715. t['a18'] = 974;
  34716. t['a19'] = 755;
  34717. t['a20'] = 846;
  34718. t['a21'] = 762;
  34719. t['a22'] = 761;
  34720. t['a23'] = 571;
  34721. t['a24'] = 677;
  34722. t['a25'] = 763;
  34723. t['a26'] = 760;
  34724. t['a27'] = 759;
  34725. t['a28'] = 754;
  34726. t['a6'] = 494;
  34727. t['a7'] = 552;
  34728. t['a8'] = 537;
  34729. t['a9'] = 577;
  34730. t['a10'] = 692;
  34731. t['a29'] = 786;
  34732. t['a30'] = 788;
  34733. t['a31'] = 788;
  34734. t['a32'] = 790;
  34735. t['a33'] = 793;
  34736. t['a34'] = 794;
  34737. t['a35'] = 816;
  34738. t['a36'] = 823;
  34739. t['a37'] = 789;
  34740. t['a38'] = 841;
  34741. t['a39'] = 823;
  34742. t['a40'] = 833;
  34743. t['a41'] = 816;
  34744. t['a42'] = 831;
  34745. t['a43'] = 923;
  34746. t['a44'] = 744;
  34747. t['a45'] = 723;
  34748. t['a46'] = 749;
  34749. t['a47'] = 790;
  34750. t['a48'] = 792;
  34751. t['a49'] = 695;
  34752. t['a50'] = 776;
  34753. t['a51'] = 768;
  34754. t['a52'] = 792;
  34755. t['a53'] = 759;
  34756. t['a54'] = 707;
  34757. t['a55'] = 708;
  34758. t['a56'] = 682;
  34759. t['a57'] = 701;
  34760. t['a58'] = 826;
  34761. t['a59'] = 815;
  34762. t['a60'] = 789;
  34763. t['a61'] = 789;
  34764. t['a62'] = 707;
  34765. t['a63'] = 687;
  34766. t['a64'] = 696;
  34767. t['a65'] = 689;
  34768. t['a66'] = 786;
  34769. t['a67'] = 787;
  34770. t['a68'] = 713;
  34771. t['a69'] = 791;
  34772. t['a70'] = 785;
  34773. t['a71'] = 791;
  34774. t['a72'] = 873;
  34775. t['a73'] = 761;
  34776. t['a74'] = 762;
  34777. t['a203'] = 762;
  34778. t['a75'] = 759;
  34779. t['a204'] = 759;
  34780. t['a76'] = 892;
  34781. t['a77'] = 892;
  34782. t['a78'] = 788;
  34783. t['a79'] = 784;
  34784. t['a81'] = 438;
  34785. t['a82'] = 138;
  34786. t['a83'] = 277;
  34787. t['a84'] = 415;
  34788. t['a97'] = 392;
  34789. t['a98'] = 392;
  34790. t['a99'] = 668;
  34791. t['a100'] = 668;
  34792. t['a89'] = 390;
  34793. t['a90'] = 390;
  34794. t['a93'] = 317;
  34795. t['a94'] = 317;
  34796. t['a91'] = 276;
  34797. t['a92'] = 276;
  34798. t['a205'] = 509;
  34799. t['a85'] = 509;
  34800. t['a206'] = 410;
  34801. t['a86'] = 410;
  34802. t['a87'] = 234;
  34803. t['a88'] = 234;
  34804. t['a95'] = 334;
  34805. t['a96'] = 334;
  34806. t['a101'] = 732;
  34807. t['a102'] = 544;
  34808. t['a103'] = 544;
  34809. t['a104'] = 910;
  34810. t['a106'] = 667;
  34811. t['a107'] = 760;
  34812. t['a108'] = 760;
  34813. t['a112'] = 776;
  34814. t['a111'] = 595;
  34815. t['a110'] = 694;
  34816. t['a109'] = 626;
  34817. t['a120'] = 788;
  34818. t['a121'] = 788;
  34819. t['a122'] = 788;
  34820. t['a123'] = 788;
  34821. t['a124'] = 788;
  34822. t['a125'] = 788;
  34823. t['a126'] = 788;
  34824. t['a127'] = 788;
  34825. t['a128'] = 788;
  34826. t['a129'] = 788;
  34827. t['a130'] = 788;
  34828. t['a131'] = 788;
  34829. t['a132'] = 788;
  34830. t['a133'] = 788;
  34831. t['a134'] = 788;
  34832. t['a135'] = 788;
  34833. t['a136'] = 788;
  34834. t['a137'] = 788;
  34835. t['a138'] = 788;
  34836. t['a139'] = 788;
  34837. t['a140'] = 788;
  34838. t['a141'] = 788;
  34839. t['a142'] = 788;
  34840. t['a143'] = 788;
  34841. t['a144'] = 788;
  34842. t['a145'] = 788;
  34843. t['a146'] = 788;
  34844. t['a147'] = 788;
  34845. t['a148'] = 788;
  34846. t['a149'] = 788;
  34847. t['a150'] = 788;
  34848. t['a151'] = 788;
  34849. t['a152'] = 788;
  34850. t['a153'] = 788;
  34851. t['a154'] = 788;
  34852. t['a155'] = 788;
  34853. t['a156'] = 788;
  34854. t['a157'] = 788;
  34855. t['a158'] = 788;
  34856. t['a159'] = 788;
  34857. t['a160'] = 894;
  34858. t['a161'] = 838;
  34859. t['a163'] = 1016;
  34860. t['a164'] = 458;
  34861. t['a196'] = 748;
  34862. t['a165'] = 924;
  34863. t['a192'] = 748;
  34864. t['a166'] = 918;
  34865. t['a167'] = 927;
  34866. t['a168'] = 928;
  34867. t['a169'] = 928;
  34868. t['a170'] = 834;
  34869. t['a171'] = 873;
  34870. t['a172'] = 828;
  34871. t['a173'] = 924;
  34872. t['a162'] = 924;
  34873. t['a174'] = 917;
  34874. t['a175'] = 930;
  34875. t['a176'] = 931;
  34876. t['a177'] = 463;
  34877. t['a178'] = 883;
  34878. t['a179'] = 836;
  34879. t['a193'] = 836;
  34880. t['a180'] = 867;
  34881. t['a199'] = 867;
  34882. t['a181'] = 696;
  34883. t['a200'] = 696;
  34884. t['a182'] = 874;
  34885. t['a201'] = 874;
  34886. t['a183'] = 760;
  34887. t['a184'] = 946;
  34888. t['a197'] = 771;
  34889. t['a185'] = 865;
  34890. t['a194'] = 771;
  34891. t['a198'] = 888;
  34892. t['a186'] = 967;
  34893. t['a195'] = 888;
  34894. t['a187'] = 831;
  34895. t['a188'] = 873;
  34896. t['a189'] = 927;
  34897. t['a190'] = 970;
  34898. t['a191'] = 918;
  34899. });
  34900. });
  34901. exports.getMetrics = getMetrics;
  34902. /***/ }),
  34903. /* 31 */
  34904. /***/ (function(module, exports, __w_pdfjs_require__) {
  34905. "use strict";
  34906. Object.defineProperty(exports, "__esModule", {
  34907. value: true
  34908. });
  34909. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  34910. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  34911. var MASK_HIGH = 0xffff0000;
  34912. var MASK_LOW = 0xffff;
  34913. function MurmurHash3_64(seed) {
  34914. var SEED = 0xc3d2e1f0;
  34915. this.h1 = seed ? seed & 0xffffffff : SEED;
  34916. this.h2 = seed ? seed & 0xffffffff : SEED;
  34917. }
  34918. MurmurHash3_64.prototype = {
  34919. update: function MurmurHash3_64_update(input) {
  34920. var i;
  34921. if (typeof input === 'string') {
  34922. var data = new Uint8Array(input.length * 2);
  34923. var length = 0;
  34924. for (i = 0; i < input.length; i++) {
  34925. var code = input.charCodeAt(i);
  34926. if (code <= 0xff) {
  34927. data[length++] = code;
  34928. } else {
  34929. data[length++] = code >>> 8;
  34930. data[length++] = code & 0xff;
  34931. }
  34932. }
  34933. } else if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && 'byteLength' in input) {
  34934. data = input;
  34935. length = data.byteLength;
  34936. } else {
  34937. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  34938. }
  34939. var blockCounts = length >> 2;
  34940. var tailLength = length - blockCounts * 4;
  34941. var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  34942. var k1 = 0;
  34943. var k2 = 0;
  34944. var h1 = this.h1;
  34945. var h2 = this.h2;
  34946. var C1 = 0xcc9e2d51;
  34947. var C2 = 0x1b873593;
  34948. var C1_LOW = C1 & MASK_LOW;
  34949. var C2_LOW = C2 & MASK_LOW;
  34950. for (i = 0; i < blockCounts; i++) {
  34951. if (i & 1) {
  34952. k1 = dataUint32[i];
  34953. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  34954. k1 = k1 << 15 | k1 >>> 17;
  34955. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  34956. h1 ^= k1;
  34957. h1 = h1 << 13 | h1 >>> 19;
  34958. h1 = h1 * 5 + 0xe6546b64;
  34959. } else {
  34960. k2 = dataUint32[i];
  34961. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  34962. k2 = k2 << 15 | k2 >>> 17;
  34963. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  34964. h2 ^= k2;
  34965. h2 = h2 << 13 | h2 >>> 19;
  34966. h2 = h2 * 5 + 0xe6546b64;
  34967. }
  34968. }
  34969. k1 = 0;
  34970. switch (tailLength) {
  34971. case 3:
  34972. k1 ^= data[blockCounts * 4 + 2] << 16;
  34973. case 2:
  34974. k1 ^= data[blockCounts * 4 + 1] << 8;
  34975. case 1:
  34976. k1 ^= data[blockCounts * 4];
  34977. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  34978. k1 = k1 << 15 | k1 >>> 17;
  34979. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  34980. if (blockCounts & 1) {
  34981. h1 ^= k1;
  34982. } else {
  34983. h2 ^= k1;
  34984. }
  34985. }
  34986. this.h1 = h1;
  34987. this.h2 = h2;
  34988. return this;
  34989. },
  34990. hexdigest: function MurmurHash3_64_hexdigest() {
  34991. var h1 = this.h1;
  34992. var h2 = this.h2;
  34993. h1 ^= h2 >>> 1;
  34994. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  34995. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  34996. h1 ^= h2 >>> 1;
  34997. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  34998. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  34999. h1 ^= h2 >>> 1;
  35000. for (var i = 0, arr = [h1, h2], str = ''; i < arr.length; i++) {
  35001. var hex = (arr[i] >>> 0).toString(16);
  35002. while (hex.length < 8) {
  35003. hex = '0' + hex;
  35004. }
  35005. str += hex;
  35006. }
  35007. return str;
  35008. }
  35009. };
  35010. return MurmurHash3_64;
  35011. }();
  35012. exports.MurmurHash3_64 = MurmurHash3_64;
  35013. /***/ }),
  35014. /* 32 */
  35015. /***/ (function(module, exports, __w_pdfjs_require__) {
  35016. "use strict";
  35017. Object.defineProperty(exports, "__esModule", {
  35018. value: true
  35019. });
  35020. exports.getTilingPatternIR = exports.Pattern = undefined;
  35021. var _util = __w_pdfjs_require__(0);
  35022. var _colorspace = __w_pdfjs_require__(3);
  35023. var _primitives = __w_pdfjs_require__(1);
  35024. var _function = __w_pdfjs_require__(6);
  35025. var ShadingType = {
  35026. FUNCTION_BASED: 1,
  35027. AXIAL: 2,
  35028. RADIAL: 3,
  35029. FREE_FORM_MESH: 4,
  35030. LATTICE_FORM_MESH: 5,
  35031. COONS_PATCH_MESH: 6,
  35032. TENSOR_PATCH_MESH: 7
  35033. };
  35034. var Pattern = function PatternClosure() {
  35035. function Pattern() {
  35036. (0, _util.error)('should not call Pattern constructor');
  35037. }
  35038. Pattern.prototype = {
  35039. getPattern: function Pattern_getPattern(ctx) {
  35040. (0, _util.error)('Should not call Pattern.getStyle: ' + ctx);
  35041. }
  35042. };
  35043. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  35044. var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  35045. var type = dict.get('ShadingType');
  35046. try {
  35047. switch (type) {
  35048. case ShadingType.AXIAL:
  35049. case ShadingType.RADIAL:
  35050. return new Shadings.RadialAxial(dict, matrix, xref, res);
  35051. case ShadingType.FREE_FORM_MESH:
  35052. case ShadingType.LATTICE_FORM_MESH:
  35053. case ShadingType.COONS_PATCH_MESH:
  35054. case ShadingType.TENSOR_PATCH_MESH:
  35055. return new Shadings.Mesh(shading, matrix, xref, res);
  35056. default:
  35057. throw new Error('Unsupported ShadingType: ' + type);
  35058. }
  35059. } catch (ex) {
  35060. if (ex instanceof _util.MissingDataException) {
  35061. throw ex;
  35062. }
  35063. handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.shadingPattern });
  35064. (0, _util.warn)(ex);
  35065. return new Shadings.Dummy();
  35066. }
  35067. };
  35068. return Pattern;
  35069. }();
  35070. var Shadings = {};
  35071. Shadings.SMALL_NUMBER = 1e-6;
  35072. Shadings.RadialAxial = function RadialAxialClosure() {
  35073. function RadialAxial(dict, matrix, xref, res) {
  35074. this.matrix = matrix;
  35075. this.coordsArr = dict.getArray('Coords');
  35076. this.shadingType = dict.get('ShadingType');
  35077. this.type = 'Pattern';
  35078. var cs = dict.get('ColorSpace', 'CS');
  35079. cs = _colorspace.ColorSpace.parse(cs, xref, res);
  35080. this.cs = cs;
  35081. var t0 = 0.0,
  35082. t1 = 1.0;
  35083. if (dict.has('Domain')) {
  35084. var domainArr = dict.getArray('Domain');
  35085. t0 = domainArr[0];
  35086. t1 = domainArr[1];
  35087. }
  35088. var extendStart = false,
  35089. extendEnd = false;
  35090. if (dict.has('Extend')) {
  35091. var extendArr = dict.getArray('Extend');
  35092. extendStart = extendArr[0];
  35093. extendEnd = extendArr[1];
  35094. }
  35095. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  35096. var x1 = this.coordsArr[0];
  35097. var y1 = this.coordsArr[1];
  35098. var r1 = this.coordsArr[2];
  35099. var x2 = this.coordsArr[3];
  35100. var y2 = this.coordsArr[4];
  35101. var r2 = this.coordsArr[5];
  35102. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  35103. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  35104. (0, _util.warn)('Unsupported radial gradient.');
  35105. }
  35106. }
  35107. this.extendStart = extendStart;
  35108. this.extendEnd = extendEnd;
  35109. var fnObj = dict.get('Function');
  35110. var fn = _function.PDFFunction.parseArray(xref, fnObj);
  35111. var diff = t1 - t0;
  35112. var step = diff / 10;
  35113. var colorStops = this.colorStops = [];
  35114. if (t0 >= t1 || step <= 0) {
  35115. (0, _util.info)('Bad shading domain.');
  35116. return;
  35117. }
  35118. var color = new Float32Array(cs.numComps),
  35119. ratio = new Float32Array(1);
  35120. var rgbColor;
  35121. for (var i = t0; i <= t1; i += step) {
  35122. ratio[0] = i;
  35123. fn(ratio, 0, color, 0);
  35124. rgbColor = cs.getRgb(color, 0);
  35125. var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  35126. colorStops.push([(i - t0) / diff, cssColor]);
  35127. }
  35128. var background = 'transparent';
  35129. if (dict.has('Background')) {
  35130. rgbColor = cs.getRgb(dict.get('Background'), 0);
  35131. background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  35132. }
  35133. if (!extendStart) {
  35134. colorStops.unshift([0, background]);
  35135. colorStops[1][0] += Shadings.SMALL_NUMBER;
  35136. }
  35137. if (!extendEnd) {
  35138. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  35139. colorStops.push([1, background]);
  35140. }
  35141. this.colorStops = colorStops;
  35142. }
  35143. RadialAxial.prototype = {
  35144. getIR: function RadialAxial_getIR() {
  35145. var coordsArr = this.coordsArr;
  35146. var shadingType = this.shadingType;
  35147. var type, p0, p1, r0, r1;
  35148. if (shadingType === ShadingType.AXIAL) {
  35149. p0 = [coordsArr[0], coordsArr[1]];
  35150. p1 = [coordsArr[2], coordsArr[3]];
  35151. r0 = null;
  35152. r1 = null;
  35153. type = 'axial';
  35154. } else if (shadingType === ShadingType.RADIAL) {
  35155. p0 = [coordsArr[0], coordsArr[1]];
  35156. p1 = [coordsArr[3], coordsArr[4]];
  35157. r0 = coordsArr[2];
  35158. r1 = coordsArr[5];
  35159. type = 'radial';
  35160. } else {
  35161. (0, _util.error)('getPattern type unknown: ' + shadingType);
  35162. }
  35163. var matrix = this.matrix;
  35164. if (matrix) {
  35165. p0 = _util.Util.applyTransform(p0, matrix);
  35166. p1 = _util.Util.applyTransform(p1, matrix);
  35167. if (shadingType === ShadingType.RADIAL) {
  35168. var scale = _util.Util.singularValueDecompose2dScale(matrix);
  35169. r0 *= scale[0];
  35170. r1 *= scale[1];
  35171. }
  35172. }
  35173. return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
  35174. }
  35175. };
  35176. return RadialAxial;
  35177. }();
  35178. Shadings.Mesh = function MeshClosure() {
  35179. function MeshStreamReader(stream, context) {
  35180. this.stream = stream;
  35181. this.context = context;
  35182. this.buffer = 0;
  35183. this.bufferLength = 0;
  35184. var numComps = context.numComps;
  35185. this.tmpCompsBuf = new Float32Array(numComps);
  35186. var csNumComps = context.colorSpace.numComps;
  35187. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  35188. }
  35189. MeshStreamReader.prototype = {
  35190. get hasData() {
  35191. if (this.stream.end) {
  35192. return this.stream.pos < this.stream.end;
  35193. }
  35194. if (this.bufferLength > 0) {
  35195. return true;
  35196. }
  35197. var nextByte = this.stream.getByte();
  35198. if (nextByte < 0) {
  35199. return false;
  35200. }
  35201. this.buffer = nextByte;
  35202. this.bufferLength = 8;
  35203. return true;
  35204. },
  35205. readBits: function MeshStreamReader_readBits(n) {
  35206. var buffer = this.buffer;
  35207. var bufferLength = this.bufferLength;
  35208. if (n === 32) {
  35209. if (bufferLength === 0) {
  35210. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  35211. }
  35212. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  35213. var nextByte = this.stream.getByte();
  35214. this.buffer = nextByte & (1 << bufferLength) - 1;
  35215. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  35216. }
  35217. if (n === 8 && bufferLength === 0) {
  35218. return this.stream.getByte();
  35219. }
  35220. while (bufferLength < n) {
  35221. buffer = buffer << 8 | this.stream.getByte();
  35222. bufferLength += 8;
  35223. }
  35224. bufferLength -= n;
  35225. this.bufferLength = bufferLength;
  35226. this.buffer = buffer & (1 << bufferLength) - 1;
  35227. return buffer >> bufferLength;
  35228. },
  35229. align: function MeshStreamReader_align() {
  35230. this.buffer = 0;
  35231. this.bufferLength = 0;
  35232. },
  35233. readFlag: function MeshStreamReader_readFlag() {
  35234. return this.readBits(this.context.bitsPerFlag);
  35235. },
  35236. readCoordinate: function MeshStreamReader_readCoordinate() {
  35237. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  35238. var xi = this.readBits(bitsPerCoordinate);
  35239. var yi = this.readBits(bitsPerCoordinate);
  35240. var decode = this.context.decode;
  35241. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  35242. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  35243. },
  35244. readComponents: function MeshStreamReader_readComponents() {
  35245. var numComps = this.context.numComps;
  35246. var bitsPerComponent = this.context.bitsPerComponent;
  35247. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  35248. var decode = this.context.decode;
  35249. var components = this.tmpCompsBuf;
  35250. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  35251. var ci = this.readBits(bitsPerComponent);
  35252. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  35253. }
  35254. var color = this.tmpCsCompsBuf;
  35255. if (this.context.colorFn) {
  35256. this.context.colorFn(components, 0, color, 0);
  35257. }
  35258. return this.context.colorSpace.getRgb(color, 0);
  35259. }
  35260. };
  35261. function decodeType4Shading(mesh, reader) {
  35262. var coords = mesh.coords;
  35263. var colors = mesh.colors;
  35264. var operators = [];
  35265. var ps = [];
  35266. var verticesLeft = 0;
  35267. while (reader.hasData) {
  35268. var f = reader.readFlag();
  35269. var coord = reader.readCoordinate();
  35270. var color = reader.readComponents();
  35271. if (verticesLeft === 0) {
  35272. (0, _util.assert)(0 <= f && f <= 2, 'Unknown type4 flag');
  35273. switch (f) {
  35274. case 0:
  35275. verticesLeft = 3;
  35276. break;
  35277. case 1:
  35278. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  35279. verticesLeft = 1;
  35280. break;
  35281. case 2:
  35282. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  35283. verticesLeft = 1;
  35284. break;
  35285. }
  35286. operators.push(f);
  35287. }
  35288. ps.push(coords.length);
  35289. coords.push(coord);
  35290. colors.push(color);
  35291. verticesLeft--;
  35292. reader.align();
  35293. }
  35294. mesh.figures.push({
  35295. type: 'triangles',
  35296. coords: new Int32Array(ps),
  35297. colors: new Int32Array(ps)
  35298. });
  35299. }
  35300. function decodeType5Shading(mesh, reader, verticesPerRow) {
  35301. var coords = mesh.coords;
  35302. var colors = mesh.colors;
  35303. var ps = [];
  35304. while (reader.hasData) {
  35305. var coord = reader.readCoordinate();
  35306. var color = reader.readComponents();
  35307. ps.push(coords.length);
  35308. coords.push(coord);
  35309. colors.push(color);
  35310. }
  35311. mesh.figures.push({
  35312. type: 'lattice',
  35313. coords: new Int32Array(ps),
  35314. colors: new Int32Array(ps),
  35315. verticesPerRow: verticesPerRow
  35316. });
  35317. }
  35318. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  35319. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  35320. var TRIANGLE_DENSITY = 20;
  35321. var getB = function getBClosure() {
  35322. function buildB(count) {
  35323. var lut = [];
  35324. for (var i = 0; i <= count; i++) {
  35325. var t = i / count,
  35326. t_ = 1 - t;
  35327. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  35328. }
  35329. return lut;
  35330. }
  35331. var cache = [];
  35332. return function getB(count) {
  35333. if (!cache[count]) {
  35334. cache[count] = buildB(count);
  35335. }
  35336. return cache[count];
  35337. };
  35338. }();
  35339. function buildFigureFromPatch(mesh, index) {
  35340. var figure = mesh.figures[index];
  35341. (0, _util.assert)(figure.type === 'patch', 'Unexpected patch mesh figure');
  35342. var coords = mesh.coords,
  35343. colors = mesh.colors;
  35344. var pi = figure.coords;
  35345. var ci = figure.colors;
  35346. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  35347. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  35348. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  35349. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  35350. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  35351. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  35352. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  35353. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  35354. var verticesPerRow = splitXBy + 1;
  35355. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  35356. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  35357. var k = 0;
  35358. var cl = new Uint8Array(3),
  35359. cr = new Uint8Array(3);
  35360. var c0 = colors[ci[0]],
  35361. c1 = colors[ci[1]],
  35362. c2 = colors[ci[2]],
  35363. c3 = colors[ci[3]];
  35364. var bRow = getB(splitYBy),
  35365. bCol = getB(splitXBy);
  35366. for (var row = 0; row <= splitYBy; row++) {
  35367. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  35368. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  35369. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  35370. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  35371. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  35372. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  35373. for (var col = 0; col <= splitXBy; col++, k++) {
  35374. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  35375. continue;
  35376. }
  35377. var x = 0,
  35378. y = 0;
  35379. var q = 0;
  35380. for (var i = 0; i <= 3; i++) {
  35381. for (var j = 0; j <= 3; j++, q++) {
  35382. var m = bRow[row][i] * bCol[col][j];
  35383. x += coords[pi[q]][0] * m;
  35384. y += coords[pi[q]][1] * m;
  35385. }
  35386. }
  35387. figureCoords[k] = coords.length;
  35388. coords.push([x, y]);
  35389. figureColors[k] = colors.length;
  35390. var newColor = new Uint8Array(3);
  35391. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  35392. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  35393. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  35394. colors.push(newColor);
  35395. }
  35396. }
  35397. figureCoords[0] = pi[0];
  35398. figureColors[0] = ci[0];
  35399. figureCoords[splitXBy] = pi[3];
  35400. figureColors[splitXBy] = ci[1];
  35401. figureCoords[verticesPerRow * splitYBy] = pi[12];
  35402. figureColors[verticesPerRow * splitYBy] = ci[2];
  35403. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  35404. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  35405. mesh.figures[index] = {
  35406. type: 'lattice',
  35407. coords: figureCoords,
  35408. colors: figureColors,
  35409. verticesPerRow: verticesPerRow
  35410. };
  35411. }
  35412. function decodeType6Shading(mesh, reader) {
  35413. var coords = mesh.coords;
  35414. var colors = mesh.colors;
  35415. var ps = new Int32Array(16);
  35416. var cs = new Int32Array(4);
  35417. while (reader.hasData) {
  35418. var f = reader.readFlag();
  35419. (0, _util.assert)(0 <= f && f <= 3, 'Unknown type6 flag');
  35420. var i, ii;
  35421. var pi = coords.length;
  35422. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  35423. coords.push(reader.readCoordinate());
  35424. }
  35425. var ci = colors.length;
  35426. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  35427. colors.push(reader.readComponents());
  35428. }
  35429. var tmp1, tmp2, tmp3, tmp4;
  35430. switch (f) {
  35431. case 0:
  35432. ps[12] = pi + 3;
  35433. ps[13] = pi + 4;
  35434. ps[14] = pi + 5;
  35435. ps[15] = pi + 6;
  35436. ps[8] = pi + 2;
  35437. ps[11] = pi + 7;
  35438. ps[4] = pi + 1;
  35439. ps[7] = pi + 8;
  35440. ps[0] = pi;
  35441. ps[1] = pi + 11;
  35442. ps[2] = pi + 10;
  35443. ps[3] = pi + 9;
  35444. cs[2] = ci + 1;
  35445. cs[3] = ci + 2;
  35446. cs[0] = ci;
  35447. cs[1] = ci + 3;
  35448. break;
  35449. case 1:
  35450. tmp1 = ps[12];
  35451. tmp2 = ps[13];
  35452. tmp3 = ps[14];
  35453. tmp4 = ps[15];
  35454. ps[12] = tmp4;
  35455. ps[13] = pi + 0;
  35456. ps[14] = pi + 1;
  35457. ps[15] = pi + 2;
  35458. ps[8] = tmp3;
  35459. ps[11] = pi + 3;
  35460. ps[4] = tmp2;
  35461. ps[7] = pi + 4;
  35462. ps[0] = tmp1;
  35463. ps[1] = pi + 7;
  35464. ps[2] = pi + 6;
  35465. ps[3] = pi + 5;
  35466. tmp1 = cs[2];
  35467. tmp2 = cs[3];
  35468. cs[2] = tmp2;
  35469. cs[3] = ci;
  35470. cs[0] = tmp1;
  35471. cs[1] = ci + 1;
  35472. break;
  35473. case 2:
  35474. tmp1 = ps[15];
  35475. tmp2 = ps[11];
  35476. ps[12] = ps[3];
  35477. ps[13] = pi + 0;
  35478. ps[14] = pi + 1;
  35479. ps[15] = pi + 2;
  35480. ps[8] = ps[7];
  35481. ps[11] = pi + 3;
  35482. ps[4] = tmp2;
  35483. ps[7] = pi + 4;
  35484. ps[0] = tmp1;
  35485. ps[1] = pi + 7;
  35486. ps[2] = pi + 6;
  35487. ps[3] = pi + 5;
  35488. tmp1 = cs[3];
  35489. cs[2] = cs[1];
  35490. cs[3] = ci;
  35491. cs[0] = tmp1;
  35492. cs[1] = ci + 1;
  35493. break;
  35494. case 3:
  35495. ps[12] = ps[0];
  35496. ps[13] = pi + 0;
  35497. ps[14] = pi + 1;
  35498. ps[15] = pi + 2;
  35499. ps[8] = ps[1];
  35500. ps[11] = pi + 3;
  35501. ps[4] = ps[2];
  35502. ps[7] = pi + 4;
  35503. ps[0] = ps[3];
  35504. ps[1] = pi + 7;
  35505. ps[2] = pi + 6;
  35506. ps[3] = pi + 5;
  35507. cs[2] = cs[0];
  35508. cs[3] = ci;
  35509. cs[0] = cs[1];
  35510. cs[1] = ci + 1;
  35511. break;
  35512. }
  35513. ps[5] = coords.length;
  35514. 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]);
  35515. ps[6] = coords.length;
  35516. 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]);
  35517. ps[9] = coords.length;
  35518. 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]);
  35519. ps[10] = coords.length;
  35520. 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]);
  35521. mesh.figures.push({
  35522. type: 'patch',
  35523. coords: new Int32Array(ps),
  35524. colors: new Int32Array(cs)
  35525. });
  35526. }
  35527. }
  35528. function decodeType7Shading(mesh, reader) {
  35529. var coords = mesh.coords;
  35530. var colors = mesh.colors;
  35531. var ps = new Int32Array(16);
  35532. var cs = new Int32Array(4);
  35533. while (reader.hasData) {
  35534. var f = reader.readFlag();
  35535. (0, _util.assert)(0 <= f && f <= 3, 'Unknown type7 flag');
  35536. var i, ii;
  35537. var pi = coords.length;
  35538. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  35539. coords.push(reader.readCoordinate());
  35540. }
  35541. var ci = colors.length;
  35542. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  35543. colors.push(reader.readComponents());
  35544. }
  35545. var tmp1, tmp2, tmp3, tmp4;
  35546. switch (f) {
  35547. case 0:
  35548. ps[12] = pi + 3;
  35549. ps[13] = pi + 4;
  35550. ps[14] = pi + 5;
  35551. ps[15] = pi + 6;
  35552. ps[8] = pi + 2;
  35553. ps[9] = pi + 13;
  35554. ps[10] = pi + 14;
  35555. ps[11] = pi + 7;
  35556. ps[4] = pi + 1;
  35557. ps[5] = pi + 12;
  35558. ps[6] = pi + 15;
  35559. ps[7] = pi + 8;
  35560. ps[0] = pi;
  35561. ps[1] = pi + 11;
  35562. ps[2] = pi + 10;
  35563. ps[3] = pi + 9;
  35564. cs[2] = ci + 1;
  35565. cs[3] = ci + 2;
  35566. cs[0] = ci;
  35567. cs[1] = ci + 3;
  35568. break;
  35569. case 1:
  35570. tmp1 = ps[12];
  35571. tmp2 = ps[13];
  35572. tmp3 = ps[14];
  35573. tmp4 = ps[15];
  35574. ps[12] = tmp4;
  35575. ps[13] = pi + 0;
  35576. ps[14] = pi + 1;
  35577. ps[15] = pi + 2;
  35578. ps[8] = tmp3;
  35579. ps[9] = pi + 9;
  35580. ps[10] = pi + 10;
  35581. ps[11] = pi + 3;
  35582. ps[4] = tmp2;
  35583. ps[5] = pi + 8;
  35584. ps[6] = pi + 11;
  35585. ps[7] = pi + 4;
  35586. ps[0] = tmp1;
  35587. ps[1] = pi + 7;
  35588. ps[2] = pi + 6;
  35589. ps[3] = pi + 5;
  35590. tmp1 = cs[2];
  35591. tmp2 = cs[3];
  35592. cs[2] = tmp2;
  35593. cs[3] = ci;
  35594. cs[0] = tmp1;
  35595. cs[1] = ci + 1;
  35596. break;
  35597. case 2:
  35598. tmp1 = ps[15];
  35599. tmp2 = ps[11];
  35600. ps[12] = ps[3];
  35601. ps[13] = pi + 0;
  35602. ps[14] = pi + 1;
  35603. ps[15] = pi + 2;
  35604. ps[8] = ps[7];
  35605. ps[9] = pi + 9;
  35606. ps[10] = pi + 10;
  35607. ps[11] = pi + 3;
  35608. ps[4] = tmp2;
  35609. ps[5] = pi + 8;
  35610. ps[6] = pi + 11;
  35611. ps[7] = pi + 4;
  35612. ps[0] = tmp1;
  35613. ps[1] = pi + 7;
  35614. ps[2] = pi + 6;
  35615. ps[3] = pi + 5;
  35616. tmp1 = cs[3];
  35617. cs[2] = cs[1];
  35618. cs[3] = ci;
  35619. cs[0] = tmp1;
  35620. cs[1] = ci + 1;
  35621. break;
  35622. case 3:
  35623. ps[12] = ps[0];
  35624. ps[13] = pi + 0;
  35625. ps[14] = pi + 1;
  35626. ps[15] = pi + 2;
  35627. ps[8] = ps[1];
  35628. ps[9] = pi + 9;
  35629. ps[10] = pi + 10;
  35630. ps[11] = pi + 3;
  35631. ps[4] = ps[2];
  35632. ps[5] = pi + 8;
  35633. ps[6] = pi + 11;
  35634. ps[7] = pi + 4;
  35635. ps[0] = ps[3];
  35636. ps[1] = pi + 7;
  35637. ps[2] = pi + 6;
  35638. ps[3] = pi + 5;
  35639. cs[2] = cs[0];
  35640. cs[3] = ci;
  35641. cs[0] = cs[1];
  35642. cs[1] = ci + 1;
  35643. break;
  35644. }
  35645. mesh.figures.push({
  35646. type: 'patch',
  35647. coords: new Int32Array(ps),
  35648. colors: new Int32Array(cs)
  35649. });
  35650. }
  35651. }
  35652. function updateBounds(mesh) {
  35653. var minX = mesh.coords[0][0],
  35654. minY = mesh.coords[0][1],
  35655. maxX = minX,
  35656. maxY = minY;
  35657. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  35658. var x = mesh.coords[i][0],
  35659. y = mesh.coords[i][1];
  35660. minX = minX > x ? x : minX;
  35661. minY = minY > y ? y : minY;
  35662. maxX = maxX < x ? x : maxX;
  35663. maxY = maxY < y ? y : maxY;
  35664. }
  35665. mesh.bounds = [minX, minY, maxX, maxY];
  35666. }
  35667. function packData(mesh) {
  35668. var i, ii, j, jj;
  35669. var coords = mesh.coords;
  35670. var coordsPacked = new Float32Array(coords.length * 2);
  35671. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  35672. var xy = coords[i];
  35673. coordsPacked[j++] = xy[0];
  35674. coordsPacked[j++] = xy[1];
  35675. }
  35676. mesh.coords = coordsPacked;
  35677. var colors = mesh.colors;
  35678. var colorsPacked = new Uint8Array(colors.length * 3);
  35679. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  35680. var c = colors[i];
  35681. colorsPacked[j++] = c[0];
  35682. colorsPacked[j++] = c[1];
  35683. colorsPacked[j++] = c[2];
  35684. }
  35685. mesh.colors = colorsPacked;
  35686. var figures = mesh.figures;
  35687. for (i = 0, ii = figures.length; i < ii; i++) {
  35688. var figure = figures[i],
  35689. ps = figure.coords,
  35690. cs = figure.colors;
  35691. for (j = 0, jj = ps.length; j < jj; j++) {
  35692. ps[j] *= 2;
  35693. cs[j] *= 3;
  35694. }
  35695. }
  35696. }
  35697. function Mesh(stream, matrix, xref, res) {
  35698. (0, _util.assert)((0, _primitives.isStream)(stream), 'Mesh data is not a stream');
  35699. var dict = stream.dict;
  35700. this.matrix = matrix;
  35701. this.shadingType = dict.get('ShadingType');
  35702. this.type = 'Pattern';
  35703. this.bbox = dict.getArray('BBox');
  35704. var cs = dict.get('ColorSpace', 'CS');
  35705. cs = _colorspace.ColorSpace.parse(cs, xref, res);
  35706. this.cs = cs;
  35707. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  35708. var fnObj = dict.get('Function');
  35709. var fn = fnObj ? _function.PDFFunction.parseArray(xref, fnObj) : null;
  35710. this.coords = [];
  35711. this.colors = [];
  35712. this.figures = [];
  35713. var decodeContext = {
  35714. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  35715. bitsPerComponent: dict.get('BitsPerComponent'),
  35716. bitsPerFlag: dict.get('BitsPerFlag'),
  35717. decode: dict.getArray('Decode'),
  35718. colorFn: fn,
  35719. colorSpace: cs,
  35720. numComps: fn ? 1 : cs.numComps
  35721. };
  35722. var reader = new MeshStreamReader(stream, decodeContext);
  35723. var patchMesh = false;
  35724. switch (this.shadingType) {
  35725. case ShadingType.FREE_FORM_MESH:
  35726. decodeType4Shading(this, reader);
  35727. break;
  35728. case ShadingType.LATTICE_FORM_MESH:
  35729. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  35730. (0, _util.assert)(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  35731. decodeType5Shading(this, reader, verticesPerRow);
  35732. break;
  35733. case ShadingType.COONS_PATCH_MESH:
  35734. decodeType6Shading(this, reader);
  35735. patchMesh = true;
  35736. break;
  35737. case ShadingType.TENSOR_PATCH_MESH:
  35738. decodeType7Shading(this, reader);
  35739. patchMesh = true;
  35740. break;
  35741. default:
  35742. (0, _util.error)('Unsupported mesh type.');
  35743. break;
  35744. }
  35745. if (patchMesh) {
  35746. updateBounds(this);
  35747. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  35748. buildFigureFromPatch(this, i);
  35749. }
  35750. }
  35751. updateBounds(this);
  35752. packData(this);
  35753. }
  35754. Mesh.prototype = {
  35755. getIR: function Mesh_getIR() {
  35756. return ['Mesh', this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  35757. }
  35758. };
  35759. return Mesh;
  35760. }();
  35761. Shadings.Dummy = function DummyClosure() {
  35762. function Dummy() {
  35763. this.type = 'Pattern';
  35764. }
  35765. Dummy.prototype = {
  35766. getIR: function Dummy_getIR() {
  35767. return ['Dummy'];
  35768. }
  35769. };
  35770. return Dummy;
  35771. }();
  35772. function getTilingPatternIR(operatorList, dict, args) {
  35773. var matrix = dict.getArray('Matrix');
  35774. var bbox = dict.getArray('BBox');
  35775. var xstep = dict.get('XStep');
  35776. var ystep = dict.get('YStep');
  35777. var paintType = dict.get('PaintType');
  35778. var tilingType = dict.get('TilingType');
  35779. return ['TilingPattern', args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  35780. }
  35781. exports.Pattern = Pattern;
  35782. exports.getTilingPatternIR = getTilingPatternIR;
  35783. /***/ }),
  35784. /* 33 */
  35785. /***/ (function(module, exports, __w_pdfjs_require__) {
  35786. "use strict";
  35787. Object.defineProperty(exports, "__esModule", {
  35788. value: true
  35789. });
  35790. exports.NetworkPdfManager = exports.LocalPdfManager = undefined;
  35791. var _util = __w_pdfjs_require__(0);
  35792. var _chunked_stream = __w_pdfjs_require__(12);
  35793. var _document = __w_pdfjs_require__(24);
  35794. var _stream = __w_pdfjs_require__(2);
  35795. var BasePdfManager = function BasePdfManagerClosure() {
  35796. function BasePdfManager() {
  35797. throw new Error('Cannot initialize BaseManagerManager');
  35798. }
  35799. BasePdfManager.prototype = {
  35800. get docId() {
  35801. return this._docId;
  35802. },
  35803. get password() {
  35804. return this._password;
  35805. },
  35806. get docBaseUrl() {
  35807. var docBaseUrl = null;
  35808. if (this._docBaseUrl) {
  35809. var absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
  35810. if (absoluteUrl) {
  35811. docBaseUrl = absoluteUrl.href;
  35812. } else {
  35813. (0, _util.warn)('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  35814. }
  35815. }
  35816. return (0, _util.shadow)(this, 'docBaseUrl', docBaseUrl);
  35817. },
  35818. onLoadedStream: function BasePdfManager_onLoadedStream() {
  35819. throw new _util.NotImplementedException();
  35820. },
  35821. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  35822. return this.ensure(this.pdfDocument, prop, args);
  35823. },
  35824. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  35825. return this.ensure(this.pdfDocument.xref, prop, args);
  35826. },
  35827. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  35828. return this.ensure(this.pdfDocument.catalog, prop, args);
  35829. },
  35830. getPage: function BasePdfManager_getPage(pageIndex) {
  35831. return this.pdfDocument.getPage(pageIndex);
  35832. },
  35833. cleanup: function BasePdfManager_cleanup() {
  35834. return this.pdfDocument.cleanup();
  35835. },
  35836. ensure: function BasePdfManager_ensure(obj, prop, args) {
  35837. return new _util.NotImplementedException();
  35838. },
  35839. requestRange: function BasePdfManager_requestRange(begin, end) {
  35840. return new _util.NotImplementedException();
  35841. },
  35842. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  35843. return new _util.NotImplementedException();
  35844. },
  35845. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  35846. return new _util.NotImplementedException();
  35847. },
  35848. updatePassword: function BasePdfManager_updatePassword(password) {
  35849. this._password = password;
  35850. },
  35851. terminate: function BasePdfManager_terminate() {
  35852. return new _util.NotImplementedException();
  35853. }
  35854. };
  35855. return BasePdfManager;
  35856. }();
  35857. var LocalPdfManager = function LocalPdfManagerClosure() {
  35858. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  35859. this._docId = docId;
  35860. this._password = password;
  35861. this._docBaseUrl = docBaseUrl;
  35862. this.evaluatorOptions = evaluatorOptions;
  35863. var stream = new _stream.Stream(data);
  35864. this.pdfDocument = new _document.PDFDocument(this, stream);
  35865. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  35866. this._loadedStreamCapability.resolve(stream);
  35867. }
  35868. _util.Util.inherit(LocalPdfManager, BasePdfManager, {
  35869. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  35870. return new Promise(function (resolve, reject) {
  35871. try {
  35872. var value = obj[prop];
  35873. var result;
  35874. if (typeof value === 'function') {
  35875. result = value.apply(obj, args);
  35876. } else {
  35877. result = value;
  35878. }
  35879. resolve(result);
  35880. } catch (e) {
  35881. reject(e);
  35882. }
  35883. });
  35884. },
  35885. requestRange: function LocalPdfManager_requestRange(begin, end) {
  35886. return Promise.resolve();
  35887. },
  35888. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {},
  35889. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  35890. return this._loadedStreamCapability.promise;
  35891. },
  35892. terminate: function LocalPdfManager_terminate() {}
  35893. });
  35894. return LocalPdfManager;
  35895. }();
  35896. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  35897. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  35898. this._docId = docId;
  35899. this._password = args.password;
  35900. this._docBaseUrl = docBaseUrl;
  35901. this.msgHandler = args.msgHandler;
  35902. this.evaluatorOptions = evaluatorOptions;
  35903. var params = {
  35904. msgHandler: args.msgHandler,
  35905. url: args.url,
  35906. length: args.length,
  35907. disableAutoFetch: args.disableAutoFetch,
  35908. rangeChunkSize: args.rangeChunkSize
  35909. };
  35910. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, params);
  35911. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  35912. }
  35913. _util.Util.inherit(NetworkPdfManager, BasePdfManager, {
  35914. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  35915. var pdfManager = this;
  35916. return new Promise(function (resolve, reject) {
  35917. function ensureHelper() {
  35918. try {
  35919. var result;
  35920. var value = obj[prop];
  35921. if (typeof value === 'function') {
  35922. result = value.apply(obj, args);
  35923. } else {
  35924. result = value;
  35925. }
  35926. resolve(result);
  35927. } catch (e) {
  35928. if (!(e instanceof _util.MissingDataException)) {
  35929. reject(e);
  35930. return;
  35931. }
  35932. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  35933. }
  35934. }
  35935. ensureHelper();
  35936. });
  35937. },
  35938. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  35939. return this.streamManager.requestRange(begin, end);
  35940. },
  35941. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  35942. this.streamManager.requestAllChunks();
  35943. },
  35944. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  35945. this.streamManager.onReceiveData({ chunk: chunk });
  35946. },
  35947. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  35948. return this.streamManager.onLoadedStream();
  35949. },
  35950. terminate: function NetworkPdfManager_terminate() {
  35951. this.streamManager.abort();
  35952. }
  35953. });
  35954. return NetworkPdfManager;
  35955. }();
  35956. exports.LocalPdfManager = LocalPdfManager;
  35957. exports.NetworkPdfManager = NetworkPdfManager;
  35958. /***/ }),
  35959. /* 34 */
  35960. /***/ (function(module, exports, __w_pdfjs_require__) {
  35961. "use strict";
  35962. Object.defineProperty(exports, "__esModule", {
  35963. value: true
  35964. });
  35965. exports.PostScriptParser = exports.PostScriptLexer = undefined;
  35966. var _util = __w_pdfjs_require__(0);
  35967. var _primitives = __w_pdfjs_require__(1);
  35968. var PostScriptParser = function PostScriptParserClosure() {
  35969. function PostScriptParser(lexer) {
  35970. this.lexer = lexer;
  35971. this.operators = [];
  35972. this.token = null;
  35973. this.prev = null;
  35974. }
  35975. PostScriptParser.prototype = {
  35976. nextToken: function PostScriptParser_nextToken() {
  35977. this.prev = this.token;
  35978. this.token = this.lexer.getToken();
  35979. },
  35980. accept: function PostScriptParser_accept(type) {
  35981. if (this.token.type === type) {
  35982. this.nextToken();
  35983. return true;
  35984. }
  35985. return false;
  35986. },
  35987. expect: function PostScriptParser_expect(type) {
  35988. if (this.accept(type)) {
  35989. return true;
  35990. }
  35991. (0, _util.error)('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  35992. },
  35993. parse: function PostScriptParser_parse() {
  35994. this.nextToken();
  35995. this.expect(PostScriptTokenTypes.LBRACE);
  35996. this.parseBlock();
  35997. this.expect(PostScriptTokenTypes.RBRACE);
  35998. return this.operators;
  35999. },
  36000. parseBlock: function PostScriptParser_parseBlock() {
  36001. while (true) {
  36002. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  36003. this.operators.push(this.prev.value);
  36004. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  36005. this.operators.push(this.prev.value);
  36006. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  36007. this.parseCondition();
  36008. } else {
  36009. return;
  36010. }
  36011. }
  36012. },
  36013. parseCondition: function PostScriptParser_parseCondition() {
  36014. var conditionLocation = this.operators.length;
  36015. this.operators.push(null, null);
  36016. this.parseBlock();
  36017. this.expect(PostScriptTokenTypes.RBRACE);
  36018. if (this.accept(PostScriptTokenTypes.IF)) {
  36019. this.operators[conditionLocation] = this.operators.length;
  36020. this.operators[conditionLocation + 1] = 'jz';
  36021. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  36022. var jumpLocation = this.operators.length;
  36023. this.operators.push(null, null);
  36024. var endOfTrue = this.operators.length;
  36025. this.parseBlock();
  36026. this.expect(PostScriptTokenTypes.RBRACE);
  36027. this.expect(PostScriptTokenTypes.IFELSE);
  36028. this.operators[jumpLocation] = this.operators.length;
  36029. this.operators[jumpLocation + 1] = 'j';
  36030. this.operators[conditionLocation] = endOfTrue;
  36031. this.operators[conditionLocation + 1] = 'jz';
  36032. } else {
  36033. (0, _util.error)('PS Function: error parsing conditional.');
  36034. }
  36035. }
  36036. };
  36037. return PostScriptParser;
  36038. }();
  36039. var PostScriptTokenTypes = {
  36040. LBRACE: 0,
  36041. RBRACE: 1,
  36042. NUMBER: 2,
  36043. OPERATOR: 3,
  36044. IF: 4,
  36045. IFELSE: 5
  36046. };
  36047. var PostScriptToken = function PostScriptTokenClosure() {
  36048. function PostScriptToken(type, value) {
  36049. this.type = type;
  36050. this.value = value;
  36051. }
  36052. var opCache = Object.create(null);
  36053. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  36054. var opValue = opCache[op];
  36055. if (opValue) {
  36056. return opValue;
  36057. }
  36058. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  36059. };
  36060. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  36061. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  36062. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  36063. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  36064. return PostScriptToken;
  36065. }();
  36066. var PostScriptLexer = function PostScriptLexerClosure() {
  36067. function PostScriptLexer(stream) {
  36068. this.stream = stream;
  36069. this.nextChar();
  36070. this.strBuf = [];
  36071. }
  36072. PostScriptLexer.prototype = {
  36073. nextChar: function PostScriptLexer_nextChar() {
  36074. return this.currentChar = this.stream.getByte();
  36075. },
  36076. getToken: function PostScriptLexer_getToken() {
  36077. var comment = false;
  36078. var ch = this.currentChar;
  36079. while (true) {
  36080. if (ch < 0) {
  36081. return _primitives.EOF;
  36082. }
  36083. if (comment) {
  36084. if (ch === 0x0A || ch === 0x0D) {
  36085. comment = false;
  36086. }
  36087. } else if (ch === 0x25) {
  36088. comment = true;
  36089. } else if (!(0, _util.isSpace)(ch)) {
  36090. break;
  36091. }
  36092. ch = this.nextChar();
  36093. }
  36094. switch (ch | 0) {
  36095. case 0x30:
  36096. case 0x31:
  36097. case 0x32:
  36098. case 0x33:
  36099. case 0x34:
  36100. case 0x35:
  36101. case 0x36:
  36102. case 0x37:
  36103. case 0x38:
  36104. case 0x39:
  36105. case 0x2B:
  36106. case 0x2D:
  36107. case 0x2E:
  36108. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  36109. case 0x7B:
  36110. this.nextChar();
  36111. return PostScriptToken.LBRACE;
  36112. case 0x7D:
  36113. this.nextChar();
  36114. return PostScriptToken.RBRACE;
  36115. }
  36116. var strBuf = this.strBuf;
  36117. strBuf.length = 0;
  36118. strBuf[0] = String.fromCharCode(ch);
  36119. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  36120. strBuf.push(String.fromCharCode(ch));
  36121. }
  36122. var str = strBuf.join('');
  36123. switch (str.toLowerCase()) {
  36124. case 'if':
  36125. return PostScriptToken.IF;
  36126. case 'ifelse':
  36127. return PostScriptToken.IFELSE;
  36128. default:
  36129. return PostScriptToken.getOperator(str);
  36130. }
  36131. },
  36132. getNumber: function PostScriptLexer_getNumber() {
  36133. var ch = this.currentChar;
  36134. var strBuf = this.strBuf;
  36135. strBuf.length = 0;
  36136. strBuf[0] = String.fromCharCode(ch);
  36137. while ((ch = this.nextChar()) >= 0) {
  36138. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  36139. strBuf.push(String.fromCharCode(ch));
  36140. } else {
  36141. break;
  36142. }
  36143. }
  36144. var value = parseFloat(strBuf.join(''));
  36145. if (isNaN(value)) {
  36146. (0, _util.error)('Invalid floating point number: ' + value);
  36147. }
  36148. return value;
  36149. }
  36150. };
  36151. return PostScriptLexer;
  36152. }();
  36153. exports.PostScriptLexer = PostScriptLexer;
  36154. exports.PostScriptParser = PostScriptParser;
  36155. /***/ }),
  36156. /* 35 */
  36157. /***/ (function(module, exports, __w_pdfjs_require__) {
  36158. "use strict";
  36159. Object.defineProperty(exports, "__esModule", {
  36160. value: true
  36161. });
  36162. exports.Type1Parser = undefined;
  36163. var _util = __w_pdfjs_require__(0);
  36164. var _encodings = __w_pdfjs_require__(4);
  36165. var _stream = __w_pdfjs_require__(2);
  36166. var HINTING_ENABLED = false;
  36167. var Type1CharString = function Type1CharStringClosure() {
  36168. var COMMAND_MAP = {
  36169. 'hstem': [1],
  36170. 'vstem': [3],
  36171. 'vmoveto': [4],
  36172. 'rlineto': [5],
  36173. 'hlineto': [6],
  36174. 'vlineto': [7],
  36175. 'rrcurveto': [8],
  36176. 'callsubr': [10],
  36177. 'flex': [12, 35],
  36178. 'drop': [12, 18],
  36179. 'endchar': [14],
  36180. 'rmoveto': [21],
  36181. 'hmoveto': [22],
  36182. 'vhcurveto': [30],
  36183. 'hvcurveto': [31]
  36184. };
  36185. function Type1CharString() {
  36186. this.width = 0;
  36187. this.lsb = 0;
  36188. this.flexing = false;
  36189. this.output = [];
  36190. this.stack = [];
  36191. }
  36192. Type1CharString.prototype = {
  36193. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  36194. var count = encoded.length;
  36195. var error = false;
  36196. var wx, sbx, subrNumber;
  36197. for (var i = 0; i < count; i++) {
  36198. var value = encoded[i];
  36199. if (value < 32) {
  36200. if (value === 12) {
  36201. value = (value << 8) + encoded[++i];
  36202. }
  36203. switch (value) {
  36204. case 1:
  36205. if (!HINTING_ENABLED) {
  36206. this.stack = [];
  36207. break;
  36208. }
  36209. error = this.executeCommand(2, COMMAND_MAP.hstem);
  36210. break;
  36211. case 3:
  36212. if (!HINTING_ENABLED) {
  36213. this.stack = [];
  36214. break;
  36215. }
  36216. error = this.executeCommand(2, COMMAND_MAP.vstem);
  36217. break;
  36218. case 4:
  36219. if (this.flexing) {
  36220. if (this.stack.length < 1) {
  36221. error = true;
  36222. break;
  36223. }
  36224. var dy = this.stack.pop();
  36225. this.stack.push(0, dy);
  36226. break;
  36227. }
  36228. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  36229. break;
  36230. case 5:
  36231. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  36232. break;
  36233. case 6:
  36234. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  36235. break;
  36236. case 7:
  36237. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  36238. break;
  36239. case 8:
  36240. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  36241. break;
  36242. case 9:
  36243. this.stack = [];
  36244. break;
  36245. case 10:
  36246. if (this.stack.length < 1) {
  36247. error = true;
  36248. break;
  36249. }
  36250. subrNumber = this.stack.pop();
  36251. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  36252. break;
  36253. case 11:
  36254. return error;
  36255. case 13:
  36256. if (this.stack.length < 2) {
  36257. error = true;
  36258. break;
  36259. }
  36260. wx = this.stack.pop();
  36261. sbx = this.stack.pop();
  36262. this.lsb = sbx;
  36263. this.width = wx;
  36264. this.stack.push(wx, sbx);
  36265. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  36266. break;
  36267. case 14:
  36268. this.output.push(COMMAND_MAP.endchar[0]);
  36269. break;
  36270. case 21:
  36271. if (this.flexing) {
  36272. break;
  36273. }
  36274. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  36275. break;
  36276. case 22:
  36277. if (this.flexing) {
  36278. this.stack.push(0);
  36279. break;
  36280. }
  36281. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  36282. break;
  36283. case 30:
  36284. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  36285. break;
  36286. case 31:
  36287. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  36288. break;
  36289. case (12 << 8) + 0:
  36290. this.stack = [];
  36291. break;
  36292. case (12 << 8) + 1:
  36293. if (!HINTING_ENABLED) {
  36294. this.stack = [];
  36295. break;
  36296. }
  36297. error = this.executeCommand(2, COMMAND_MAP.vstem);
  36298. break;
  36299. case (12 << 8) + 2:
  36300. if (!HINTING_ENABLED) {
  36301. this.stack = [];
  36302. break;
  36303. }
  36304. error = this.executeCommand(2, COMMAND_MAP.hstem);
  36305. break;
  36306. case (12 << 8) + 6:
  36307. if (seacAnalysisEnabled) {
  36308. this.seac = this.stack.splice(-4, 4);
  36309. error = this.executeCommand(0, COMMAND_MAP.endchar);
  36310. } else {
  36311. error = this.executeCommand(4, COMMAND_MAP.endchar);
  36312. }
  36313. break;
  36314. case (12 << 8) + 7:
  36315. if (this.stack.length < 4) {
  36316. error = true;
  36317. break;
  36318. }
  36319. this.stack.pop();
  36320. wx = this.stack.pop();
  36321. var sby = this.stack.pop();
  36322. sbx = this.stack.pop();
  36323. this.lsb = sbx;
  36324. this.width = wx;
  36325. this.stack.push(wx, sbx, sby);
  36326. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  36327. break;
  36328. case (12 << 8) + 12:
  36329. if (this.stack.length < 2) {
  36330. error = true;
  36331. break;
  36332. }
  36333. var num2 = this.stack.pop();
  36334. var num1 = this.stack.pop();
  36335. this.stack.push(num1 / num2);
  36336. break;
  36337. case (12 << 8) + 16:
  36338. if (this.stack.length < 2) {
  36339. error = true;
  36340. break;
  36341. }
  36342. subrNumber = this.stack.pop();
  36343. var numArgs = this.stack.pop();
  36344. if (subrNumber === 0 && numArgs === 3) {
  36345. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  36346. 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]);
  36347. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  36348. this.flexing = false;
  36349. this.stack.push(flexArgs[15], flexArgs[16]);
  36350. } else if (subrNumber === 1 && numArgs === 0) {
  36351. this.flexing = true;
  36352. }
  36353. break;
  36354. case (12 << 8) + 17:
  36355. break;
  36356. case (12 << 8) + 33:
  36357. this.stack = [];
  36358. break;
  36359. default:
  36360. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  36361. break;
  36362. }
  36363. if (error) {
  36364. break;
  36365. }
  36366. continue;
  36367. } else if (value <= 246) {
  36368. value = value - 139;
  36369. } else if (value <= 250) {
  36370. value = (value - 247) * 256 + encoded[++i] + 108;
  36371. } else if (value <= 254) {
  36372. value = -((value - 251) * 256) - encoded[++i] - 108;
  36373. } else {
  36374. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  36375. }
  36376. this.stack.push(value);
  36377. }
  36378. return error;
  36379. },
  36380. executeCommand: function executeCommand(howManyArgs, command, keepStack) {
  36381. var stackLength = this.stack.length;
  36382. if (howManyArgs > stackLength) {
  36383. return true;
  36384. }
  36385. var start = stackLength - howManyArgs;
  36386. for (var i = start; i < stackLength; i++) {
  36387. var value = this.stack[i];
  36388. if (value === (value | 0)) {
  36389. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  36390. } else {
  36391. value = 65536 * value | 0;
  36392. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  36393. }
  36394. }
  36395. this.output.push.apply(this.output, command);
  36396. if (keepStack) {
  36397. this.stack.splice(start, howManyArgs);
  36398. } else {
  36399. this.stack.length = 0;
  36400. }
  36401. return false;
  36402. }
  36403. };
  36404. return Type1CharString;
  36405. }();
  36406. var Type1Parser = function Type1ParserClosure() {
  36407. var EEXEC_ENCRYPT_KEY = 55665;
  36408. var CHAR_STRS_ENCRYPT_KEY = 4330;
  36409. function isHexDigit(code) {
  36410. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  36411. }
  36412. function decrypt(data, key, discardNumber) {
  36413. if (discardNumber >= data.length) {
  36414. return new Uint8Array(0);
  36415. }
  36416. var r = key | 0,
  36417. c1 = 52845,
  36418. c2 = 22719,
  36419. i,
  36420. j;
  36421. for (i = 0; i < discardNumber; i++) {
  36422. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  36423. }
  36424. var count = data.length - discardNumber;
  36425. var decrypted = new Uint8Array(count);
  36426. for (i = discardNumber, j = 0; j < count; i++, j++) {
  36427. var value = data[i];
  36428. decrypted[j] = value ^ r >> 8;
  36429. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  36430. }
  36431. return decrypted;
  36432. }
  36433. function decryptAscii(data, key, discardNumber) {
  36434. var r = key | 0,
  36435. c1 = 52845,
  36436. c2 = 22719;
  36437. var count = data.length,
  36438. maybeLength = count >>> 1;
  36439. var decrypted = new Uint8Array(maybeLength);
  36440. var i, j;
  36441. for (i = 0, j = 0; i < count; i++) {
  36442. var digit1 = data[i];
  36443. if (!isHexDigit(digit1)) {
  36444. continue;
  36445. }
  36446. i++;
  36447. var digit2;
  36448. while (i < count && !isHexDigit(digit2 = data[i])) {
  36449. i++;
  36450. }
  36451. if (i < count) {
  36452. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  36453. decrypted[j++] = value ^ r >> 8;
  36454. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  36455. }
  36456. }
  36457. return Array.prototype.slice.call(decrypted, discardNumber, j);
  36458. }
  36459. function isSpecial(c) {
  36460. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  36461. }
  36462. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  36463. if (encrypted) {
  36464. var data = stream.getBytes();
  36465. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  36466. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  36467. }
  36468. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  36469. this.stream = stream;
  36470. this.nextChar();
  36471. }
  36472. Type1Parser.prototype = {
  36473. readNumberArray: function Type1Parser_readNumberArray() {
  36474. this.getToken();
  36475. var array = [];
  36476. while (true) {
  36477. var token = this.getToken();
  36478. if (token === null || token === ']' || token === '}') {
  36479. break;
  36480. }
  36481. array.push(parseFloat(token || 0));
  36482. }
  36483. return array;
  36484. },
  36485. readNumber: function Type1Parser_readNumber() {
  36486. var token = this.getToken();
  36487. return parseFloat(token || 0);
  36488. },
  36489. readInt: function Type1Parser_readInt() {
  36490. var token = this.getToken();
  36491. return parseInt(token || 0, 10) | 0;
  36492. },
  36493. readBoolean: function Type1Parser_readBoolean() {
  36494. var token = this.getToken();
  36495. return token === 'true' ? 1 : 0;
  36496. },
  36497. nextChar: function Type1_nextChar() {
  36498. return this.currentChar = this.stream.getByte();
  36499. },
  36500. getToken: function Type1Parser_getToken() {
  36501. var comment = false;
  36502. var ch = this.currentChar;
  36503. while (true) {
  36504. if (ch === -1) {
  36505. return null;
  36506. }
  36507. if (comment) {
  36508. if (ch === 0x0A || ch === 0x0D) {
  36509. comment = false;
  36510. }
  36511. } else if (ch === 0x25) {
  36512. comment = true;
  36513. } else if (!(0, _util.isSpace)(ch)) {
  36514. break;
  36515. }
  36516. ch = this.nextChar();
  36517. }
  36518. if (isSpecial(ch)) {
  36519. this.nextChar();
  36520. return String.fromCharCode(ch);
  36521. }
  36522. var token = '';
  36523. do {
  36524. token += String.fromCharCode(ch);
  36525. ch = this.nextChar();
  36526. } while (ch >= 0 && !(0, _util.isSpace)(ch) && !isSpecial(ch));
  36527. return token;
  36528. },
  36529. extractFontProgram: function Type1Parser_extractFontProgram() {
  36530. var stream = this.stream;
  36531. var subrs = [],
  36532. charstrings = [];
  36533. var privateData = Object.create(null);
  36534. privateData['lenIV'] = 4;
  36535. var program = {
  36536. subrs: [],
  36537. charstrings: [],
  36538. properties: { 'privateData': privateData }
  36539. };
  36540. var token, length, data, lenIV, encoded;
  36541. while ((token = this.getToken()) !== null) {
  36542. if (token !== '/') {
  36543. continue;
  36544. }
  36545. token = this.getToken();
  36546. switch (token) {
  36547. case 'CharStrings':
  36548. this.getToken();
  36549. this.getToken();
  36550. this.getToken();
  36551. this.getToken();
  36552. while (true) {
  36553. token = this.getToken();
  36554. if (token === null || token === 'end') {
  36555. break;
  36556. }
  36557. if (token !== '/') {
  36558. continue;
  36559. }
  36560. var glyph = this.getToken();
  36561. length = this.readInt();
  36562. this.getToken();
  36563. data = stream.makeSubStream(stream.pos, length);
  36564. lenIV = program.properties.privateData['lenIV'];
  36565. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  36566. stream.skip(length);
  36567. this.nextChar();
  36568. token = this.getToken();
  36569. if (token === 'noaccess') {
  36570. this.getToken();
  36571. }
  36572. charstrings.push({
  36573. glyph: glyph,
  36574. encoded: encoded
  36575. });
  36576. }
  36577. break;
  36578. case 'Subrs':
  36579. this.readInt();
  36580. this.getToken();
  36581. while ((token = this.getToken()) === 'dup') {
  36582. var index = this.readInt();
  36583. length = this.readInt();
  36584. this.getToken();
  36585. data = stream.makeSubStream(stream.pos, length);
  36586. lenIV = program.properties.privateData['lenIV'];
  36587. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  36588. stream.skip(length);
  36589. this.nextChar();
  36590. token = this.getToken();
  36591. if (token === 'noaccess') {
  36592. this.getToken();
  36593. }
  36594. subrs[index] = encoded;
  36595. }
  36596. break;
  36597. case 'BlueValues':
  36598. case 'OtherBlues':
  36599. case 'FamilyBlues':
  36600. case 'FamilyOtherBlues':
  36601. var blueArray = this.readNumberArray();
  36602. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  36603. program.properties.privateData[token] = blueArray;
  36604. }
  36605. break;
  36606. case 'StemSnapH':
  36607. case 'StemSnapV':
  36608. program.properties.privateData[token] = this.readNumberArray();
  36609. break;
  36610. case 'StdHW':
  36611. case 'StdVW':
  36612. program.properties.privateData[token] = this.readNumberArray()[0];
  36613. break;
  36614. case 'BlueShift':
  36615. case 'lenIV':
  36616. case 'BlueFuzz':
  36617. case 'BlueScale':
  36618. case 'LanguageGroup':
  36619. case 'ExpansionFactor':
  36620. program.properties.privateData[token] = this.readNumber();
  36621. break;
  36622. case 'ForceBold':
  36623. program.properties.privateData[token] = this.readBoolean();
  36624. break;
  36625. }
  36626. }
  36627. for (var i = 0; i < charstrings.length; i++) {
  36628. glyph = charstrings[i].glyph;
  36629. encoded = charstrings[i].encoded;
  36630. var charString = new Type1CharString();
  36631. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  36632. var output = charString.output;
  36633. if (error) {
  36634. output = [14];
  36635. }
  36636. program.charstrings.push({
  36637. glyphName: glyph,
  36638. charstring: output,
  36639. width: charString.width,
  36640. lsb: charString.lsb,
  36641. seac: charString.seac
  36642. });
  36643. }
  36644. return program;
  36645. },
  36646. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  36647. var token;
  36648. while ((token = this.getToken()) !== null) {
  36649. if (token !== '/') {
  36650. continue;
  36651. }
  36652. token = this.getToken();
  36653. switch (token) {
  36654. case 'FontMatrix':
  36655. var matrix = this.readNumberArray();
  36656. properties.fontMatrix = matrix;
  36657. break;
  36658. case 'Encoding':
  36659. var encodingArg = this.getToken();
  36660. var encoding;
  36661. if (!/^\d+$/.test(encodingArg)) {
  36662. encoding = (0, _encodings.getEncoding)(encodingArg);
  36663. } else {
  36664. encoding = [];
  36665. var size = parseInt(encodingArg, 10) | 0;
  36666. this.getToken();
  36667. for (var j = 0; j < size; j++) {
  36668. token = this.getToken();
  36669. while (token !== 'dup' && token !== 'def') {
  36670. token = this.getToken();
  36671. if (token === null) {
  36672. return;
  36673. }
  36674. }
  36675. if (token === 'def') {
  36676. break;
  36677. }
  36678. var index = this.readInt();
  36679. this.getToken();
  36680. var glyph = this.getToken();
  36681. encoding[index] = glyph;
  36682. this.getToken();
  36683. }
  36684. }
  36685. properties.builtInEncoding = encoding;
  36686. break;
  36687. case 'FontBBox':
  36688. var fontBBox = this.readNumberArray();
  36689. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  36690. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  36691. properties.ascentScaled = true;
  36692. break;
  36693. }
  36694. }
  36695. }
  36696. };
  36697. return Type1Parser;
  36698. }();
  36699. exports.Type1Parser = Type1Parser;
  36700. /***/ }),
  36701. /* 36 */
  36702. /***/ (function(module, exports, __w_pdfjs_require__) {
  36703. "use strict";
  36704. var pdfjsVersion = '1.8.400';
  36705. var pdfjsBuild = '1e6f49b1';
  36706. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  36707. {
  36708. __w_pdfjs_require__(19);
  36709. }
  36710. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  36711. /***/ }),
  36712. /* 37 */
  36713. /***/ (function(module, exports, __w_pdfjs_require__) {
  36714. "use strict";
  36715. /* WEBPACK VAR INJECTION */(function(global) {
  36716. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  36717. if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
  36718. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : undefined;
  36719. var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
  36720. var isAndroid = /Android/.test(userAgent);
  36721. var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent);
  36722. var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent);
  36723. var isChrome = userAgent.indexOf('Chrom') >= 0;
  36724. var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent);
  36725. var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
  36726. var isIE = userAgent.indexOf('Trident') >= 0;
  36727. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
  36728. var isOpera = userAgent.indexOf('Opera') >= 0;
  36729. var isSafari = /Safari\//.test(userAgent) && !/(Chrome\/|Android\s)/.test(userAgent);
  36730. var hasDOM = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (typeof document === 'undefined' ? 'undefined' : _typeof(document)) === 'object';
  36731. if (typeof PDFJS === 'undefined') {
  36732. globalScope.PDFJS = {};
  36733. }
  36734. PDFJS.compatibilityChecked = true;
  36735. (function checkTypedArrayCompatibility() {
  36736. if (typeof Uint8Array !== 'undefined') {
  36737. if (typeof Uint8Array.prototype.subarray === 'undefined') {
  36738. Uint8Array.prototype.subarray = function subarray(start, end) {
  36739. return new Uint8Array(this.slice(start, end));
  36740. };
  36741. Float32Array.prototype.subarray = function subarray(start, end) {
  36742. return new Float32Array(this.slice(start, end));
  36743. };
  36744. }
  36745. if (typeof Float64Array === 'undefined') {
  36746. globalScope.Float64Array = Float32Array;
  36747. }
  36748. return;
  36749. }
  36750. function subarray(start, end) {
  36751. return new TypedArray(this.slice(start, end));
  36752. }
  36753. function setArrayOffset(array, offset) {
  36754. if (arguments.length < 2) {
  36755. offset = 0;
  36756. }
  36757. for (var i = 0, n = array.length; i < n; ++i, ++offset) {
  36758. this[offset] = array[i] & 0xFF;
  36759. }
  36760. }
  36761. function Uint32ArrayView(buffer, length) {
  36762. this.buffer = buffer;
  36763. this.byteLength = buffer.length;
  36764. this.length = length;
  36765. ensureUint32ArrayViewProps(this.length);
  36766. }
  36767. Uint32ArrayView.prototype = Object.create(null);
  36768. var uint32ArrayViewSetters = 0;
  36769. function createUint32ArrayProp(index) {
  36770. return {
  36771. get: function get() {
  36772. var buffer = this.buffer,
  36773. offset = index << 2;
  36774. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  36775. },
  36776. set: function set(value) {
  36777. var buffer = this.buffer,
  36778. offset = index << 2;
  36779. buffer[offset] = value & 255;
  36780. buffer[offset + 1] = value >> 8 & 255;
  36781. buffer[offset + 2] = value >> 16 & 255;
  36782. buffer[offset + 3] = value >>> 24 & 255;
  36783. }
  36784. };
  36785. }
  36786. function ensureUint32ArrayViewProps(length) {
  36787. while (uint32ArrayViewSetters < length) {
  36788. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  36789. uint32ArrayViewSetters++;
  36790. }
  36791. }
  36792. function TypedArray(arg1) {
  36793. var result, i, n;
  36794. if (typeof arg1 === 'number') {
  36795. result = [];
  36796. for (i = 0; i < arg1; ++i) {
  36797. result[i] = 0;
  36798. }
  36799. } else if ('slice' in arg1) {
  36800. result = arg1.slice(0);
  36801. } else {
  36802. result = [];
  36803. for (i = 0, n = arg1.length; i < n; ++i) {
  36804. result[i] = arg1[i];
  36805. }
  36806. }
  36807. result.subarray = subarray;
  36808. result.buffer = result;
  36809. result.byteLength = result.length;
  36810. result.set = setArrayOffset;
  36811. if ((typeof arg1 === 'undefined' ? 'undefined' : _typeof(arg1)) === 'object' && arg1.buffer) {
  36812. result.buffer = arg1.buffer;
  36813. }
  36814. return result;
  36815. }
  36816. globalScope.Uint8Array = TypedArray;
  36817. globalScope.Int8Array = TypedArray;
  36818. globalScope.Int32Array = TypedArray;
  36819. globalScope.Uint16Array = TypedArray;
  36820. globalScope.Float32Array = TypedArray;
  36821. globalScope.Float64Array = TypedArray;
  36822. globalScope.Uint32Array = function () {
  36823. if (arguments.length === 3) {
  36824. if (arguments[1] !== 0) {
  36825. throw new Error('offset !== 0 is not supported');
  36826. }
  36827. return new Uint32ArrayView(arguments[0], arguments[2]);
  36828. }
  36829. return TypedArray.apply(this, arguments);
  36830. };
  36831. })();
  36832. (function canvasPixelArrayBuffer() {
  36833. if (!hasDOM || !window.CanvasPixelArray) {
  36834. return;
  36835. }
  36836. var cpaProto = window.CanvasPixelArray.prototype;
  36837. if ('buffer' in cpaProto) {
  36838. return;
  36839. }
  36840. Object.defineProperty(cpaProto, 'buffer', {
  36841. get: function get() {
  36842. return this;
  36843. },
  36844. enumerable: false,
  36845. configurable: true
  36846. });
  36847. Object.defineProperty(cpaProto, 'byteLength', {
  36848. get: function get() {
  36849. return this.length;
  36850. },
  36851. enumerable: false,
  36852. configurable: true
  36853. });
  36854. })();
  36855. (function normalizeURLObject() {
  36856. if (!globalScope.URL) {
  36857. globalScope.URL = globalScope.webkitURL;
  36858. }
  36859. })();
  36860. (function checkObjectDefinePropertyCompatibility() {
  36861. if (typeof Object.defineProperty !== 'undefined') {
  36862. var definePropertyPossible = true;
  36863. try {
  36864. if (hasDOM) {
  36865. Object.defineProperty(new Image(), 'id', { value: 'test' });
  36866. }
  36867. var Test = function Test() {};
  36868. Test.prototype = {
  36869. get id() {}
  36870. };
  36871. Object.defineProperty(new Test(), 'id', {
  36872. value: '',
  36873. configurable: true,
  36874. enumerable: true,
  36875. writable: false
  36876. });
  36877. } catch (e) {
  36878. definePropertyPossible = false;
  36879. }
  36880. if (definePropertyPossible) {
  36881. return;
  36882. }
  36883. }
  36884. Object.defineProperty = function objectDefineProperty(obj, name, def) {
  36885. delete obj[name];
  36886. if ('get' in def) {
  36887. obj.__defineGetter__(name, def['get']);
  36888. }
  36889. if ('set' in def) {
  36890. obj.__defineSetter__(name, def['set']);
  36891. }
  36892. if ('value' in def) {
  36893. obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
  36894. this.__defineGetter__(name, function objectDefinePropertyGetter() {
  36895. return value;
  36896. });
  36897. return value;
  36898. });
  36899. obj[name] = def.value;
  36900. }
  36901. };
  36902. })();
  36903. (function checkXMLHttpRequestResponseCompatibility() {
  36904. if (typeof XMLHttpRequest === 'undefined') {
  36905. return;
  36906. }
  36907. var xhrPrototype = XMLHttpRequest.prototype;
  36908. var xhr = new XMLHttpRequest();
  36909. if (!('overrideMimeType' in xhr)) {
  36910. Object.defineProperty(xhrPrototype, 'overrideMimeType', {
  36911. value: function xmlHttpRequestOverrideMimeType(mimeType) {}
  36912. });
  36913. }
  36914. if ('responseType' in xhr) {
  36915. return;
  36916. }
  36917. Object.defineProperty(xhrPrototype, 'responseType', {
  36918. get: function xmlHttpRequestGetResponseType() {
  36919. return this._responseType || 'text';
  36920. },
  36921. set: function xmlHttpRequestSetResponseType(value) {
  36922. if (value === 'text' || value === 'arraybuffer') {
  36923. this._responseType = value;
  36924. if (value === 'arraybuffer' && typeof this.overrideMimeType === 'function') {
  36925. this.overrideMimeType('text/plain; charset=x-user-defined');
  36926. }
  36927. }
  36928. }
  36929. });
  36930. if (typeof VBArray !== 'undefined') {
  36931. Object.defineProperty(xhrPrototype, 'response', {
  36932. get: function xmlHttpRequestResponseGet() {
  36933. if (this.responseType === 'arraybuffer') {
  36934. return new Uint8Array(new VBArray(this.responseBody).toArray());
  36935. }
  36936. return this.responseText;
  36937. }
  36938. });
  36939. return;
  36940. }
  36941. Object.defineProperty(xhrPrototype, 'response', {
  36942. get: function xmlHttpRequestResponseGet() {
  36943. if (this.responseType !== 'arraybuffer') {
  36944. return this.responseText;
  36945. }
  36946. var text = this.responseText;
  36947. var i,
  36948. n = text.length;
  36949. var result = new Uint8Array(n);
  36950. for (i = 0; i < n; ++i) {
  36951. result[i] = text.charCodeAt(i) & 0xFF;
  36952. }
  36953. return result.buffer;
  36954. }
  36955. });
  36956. })();
  36957. (function checkWindowBtoaCompatibility() {
  36958. if ('btoa' in globalScope) {
  36959. return;
  36960. }
  36961. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  36962. globalScope.btoa = function (chars) {
  36963. var buffer = '';
  36964. var i, n;
  36965. for (i = 0, n = chars.length; i < n; i += 3) {
  36966. var b1 = chars.charCodeAt(i) & 0xFF;
  36967. var b2 = chars.charCodeAt(i + 1) & 0xFF;
  36968. var b3 = chars.charCodeAt(i + 2) & 0xFF;
  36969. var d1 = b1 >> 2,
  36970. d2 = (b1 & 3) << 4 | b2 >> 4;
  36971. var d3 = i + 1 < n ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  36972. var d4 = i + 2 < n ? b3 & 0x3F : 64;
  36973. buffer += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4);
  36974. }
  36975. return buffer;
  36976. };
  36977. })();
  36978. (function checkWindowAtobCompatibility() {
  36979. if ('atob' in globalScope) {
  36980. return;
  36981. }
  36982. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  36983. globalScope.atob = function (input) {
  36984. input = input.replace(/=+$/, '');
  36985. if (input.length % 4 === 1) {
  36986. throw new Error('bad atob input');
  36987. }
  36988. for (var bc = 0, bs, buffer, idx = 0, output = ''; buffer = input.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
  36989. buffer = digits.indexOf(buffer);
  36990. }
  36991. return output;
  36992. };
  36993. })();
  36994. (function checkFunctionPrototypeBindCompatibility() {
  36995. if (typeof Function.prototype.bind !== 'undefined') {
  36996. return;
  36997. }
  36998. Function.prototype.bind = function functionPrototypeBind(obj) {
  36999. var fn = this,
  37000. headArgs = Array.prototype.slice.call(arguments, 1);
  37001. var bound = function functionPrototypeBindBound() {
  37002. var args = headArgs.concat(Array.prototype.slice.call(arguments));
  37003. return fn.apply(obj, args);
  37004. };
  37005. return bound;
  37006. };
  37007. })();
  37008. (function checkDatasetProperty() {
  37009. if (!hasDOM) {
  37010. return;
  37011. }
  37012. var div = document.createElement('div');
  37013. if ('dataset' in div) {
  37014. return;
  37015. }
  37016. Object.defineProperty(HTMLElement.prototype, 'dataset', {
  37017. get: function get() {
  37018. if (this._dataset) {
  37019. return this._dataset;
  37020. }
  37021. var dataset = {};
  37022. for (var j = 0, jj = this.attributes.length; j < jj; j++) {
  37023. var attribute = this.attributes[j];
  37024. if (attribute.name.substring(0, 5) !== 'data-') {
  37025. continue;
  37026. }
  37027. var key = attribute.name.substring(5).replace(/\-([a-z])/g, function (all, ch) {
  37028. return ch.toUpperCase();
  37029. });
  37030. dataset[key] = attribute.value;
  37031. }
  37032. Object.defineProperty(this, '_dataset', {
  37033. value: dataset,
  37034. writable: false,
  37035. enumerable: false
  37036. });
  37037. return dataset;
  37038. },
  37039. enumerable: true
  37040. });
  37041. })();
  37042. (function checkClassListProperty() {
  37043. function changeList(element, itemName, add, remove) {
  37044. var s = element.className || '';
  37045. var list = s.split(/\s+/g);
  37046. if (list[0] === '') {
  37047. list.shift();
  37048. }
  37049. var index = list.indexOf(itemName);
  37050. if (index < 0 && add) {
  37051. list.push(itemName);
  37052. }
  37053. if (index >= 0 && remove) {
  37054. list.splice(index, 1);
  37055. }
  37056. element.className = list.join(' ');
  37057. return index >= 0;
  37058. }
  37059. if (!hasDOM) {
  37060. return;
  37061. }
  37062. var div = document.createElement('div');
  37063. if ('classList' in div) {
  37064. return;
  37065. }
  37066. var classListPrototype = {
  37067. add: function add(name) {
  37068. changeList(this.element, name, true, false);
  37069. },
  37070. contains: function contains(name) {
  37071. return changeList(this.element, name, false, false);
  37072. },
  37073. remove: function remove(name) {
  37074. changeList(this.element, name, false, true);
  37075. },
  37076. toggle: function toggle(name) {
  37077. changeList(this.element, name, true, true);
  37078. }
  37079. };
  37080. Object.defineProperty(HTMLElement.prototype, 'classList', {
  37081. get: function get() {
  37082. if (this._classList) {
  37083. return this._classList;
  37084. }
  37085. var classList = Object.create(classListPrototype, {
  37086. element: {
  37087. value: this,
  37088. writable: false,
  37089. enumerable: true
  37090. }
  37091. });
  37092. Object.defineProperty(this, '_classList', {
  37093. value: classList,
  37094. writable: false,
  37095. enumerable: false
  37096. });
  37097. return classList;
  37098. },
  37099. enumerable: true
  37100. });
  37101. })();
  37102. (function checkWorkerConsoleCompatibility() {
  37103. if (typeof importScripts === 'undefined' || 'console' in globalScope) {
  37104. return;
  37105. }
  37106. var consoleTimer = {};
  37107. var workerConsole = {
  37108. log: function log() {
  37109. var args = Array.prototype.slice.call(arguments);
  37110. globalScope.postMessage({
  37111. targetName: 'main',
  37112. action: 'console_log',
  37113. data: args
  37114. });
  37115. },
  37116. error: function error() {
  37117. var args = Array.prototype.slice.call(arguments);
  37118. globalScope.postMessage({
  37119. targetName: 'main',
  37120. action: 'console_error',
  37121. data: args
  37122. });
  37123. },
  37124. time: function time(name) {
  37125. consoleTimer[name] = Date.now();
  37126. },
  37127. timeEnd: function timeEnd(name) {
  37128. var time = consoleTimer[name];
  37129. if (!time) {
  37130. throw new Error('Unknown timer name ' + name);
  37131. }
  37132. this.log('Timer:', name, Date.now() - time);
  37133. }
  37134. };
  37135. globalScope.console = workerConsole;
  37136. })();
  37137. (function checkConsoleCompatibility() {
  37138. if (!hasDOM) {
  37139. return;
  37140. }
  37141. if (!('console' in window)) {
  37142. window.console = {
  37143. log: function log() {},
  37144. error: function error() {},
  37145. warn: function warn() {}
  37146. };
  37147. return;
  37148. }
  37149. if (!('bind' in console.log)) {
  37150. console.log = function (fn) {
  37151. return function (msg) {
  37152. return fn(msg);
  37153. };
  37154. }(console.log);
  37155. console.error = function (fn) {
  37156. return function (msg) {
  37157. return fn(msg);
  37158. };
  37159. }(console.error);
  37160. console.warn = function (fn) {
  37161. return function (msg) {
  37162. return fn(msg);
  37163. };
  37164. }(console.warn);
  37165. return;
  37166. }
  37167. })();
  37168. (function checkOnClickCompatibility() {
  37169. function ignoreIfTargetDisabled(event) {
  37170. if (isDisabled(event.target)) {
  37171. event.stopPropagation();
  37172. }
  37173. }
  37174. function isDisabled(node) {
  37175. return node.disabled || node.parentNode && isDisabled(node.parentNode);
  37176. }
  37177. if (isOpera) {
  37178. document.addEventListener('click', ignoreIfTargetDisabled, true);
  37179. }
  37180. })();
  37181. (function checkOnBlobSupport() {
  37182. if (isIE || isIOSChrome) {
  37183. PDFJS.disableCreateObjectURL = true;
  37184. }
  37185. })();
  37186. (function checkNavigatorLanguage() {
  37187. if (typeof navigator === 'undefined') {
  37188. return;
  37189. }
  37190. if ('language' in navigator) {
  37191. return;
  37192. }
  37193. PDFJS.locale = navigator.userLanguage || 'en-US';
  37194. })();
  37195. (function checkRangeRequests() {
  37196. if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) {
  37197. PDFJS.disableRange = true;
  37198. PDFJS.disableStream = true;
  37199. }
  37200. })();
  37201. (function checkHistoryManipulation() {
  37202. if (!hasDOM) {
  37203. return;
  37204. }
  37205. if (!history.pushState || isAndroidPre3) {
  37206. PDFJS.disableHistory = true;
  37207. }
  37208. })();
  37209. (function checkSetPresenceInImageData() {
  37210. if (!hasDOM) {
  37211. return;
  37212. }
  37213. if (window.CanvasPixelArray) {
  37214. if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
  37215. window.CanvasPixelArray.prototype.set = function (arr) {
  37216. for (var i = 0, ii = this.length; i < ii; i++) {
  37217. this[i] = arr[i];
  37218. }
  37219. };
  37220. }
  37221. } else {
  37222. var polyfill = false,
  37223. versionMatch;
  37224. if (isChrome) {
  37225. versionMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
  37226. polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
  37227. } else if (isAndroid) {
  37228. polyfill = isAndroidPre5;
  37229. } else if (isSafari) {
  37230. versionMatch = userAgent.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
  37231. polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
  37232. }
  37233. if (polyfill) {
  37234. var contextPrototype = window.CanvasRenderingContext2D.prototype;
  37235. var createImageData = contextPrototype.createImageData;
  37236. contextPrototype.createImageData = function (w, h) {
  37237. var imageData = createImageData.call(this, w, h);
  37238. imageData.data.set = function (arr) {
  37239. for (var i = 0, ii = this.length; i < ii; i++) {
  37240. this[i] = arr[i];
  37241. }
  37242. };
  37243. return imageData;
  37244. };
  37245. contextPrototype = null;
  37246. }
  37247. }
  37248. })();
  37249. (function checkRequestAnimationFrame() {
  37250. function installFakeAnimationFrameFunctions() {
  37251. window.requestAnimationFrame = function (callback) {
  37252. return window.setTimeout(callback, 20);
  37253. };
  37254. window.cancelAnimationFrame = function (timeoutID) {
  37255. window.clearTimeout(timeoutID);
  37256. };
  37257. }
  37258. if (!hasDOM) {
  37259. return;
  37260. }
  37261. if (isIOS) {
  37262. installFakeAnimationFrameFunctions();
  37263. return;
  37264. }
  37265. if ('requestAnimationFrame' in window) {
  37266. return;
  37267. }
  37268. window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame;
  37269. if (window.requestAnimationFrame) {
  37270. return;
  37271. }
  37272. installFakeAnimationFrameFunctions();
  37273. })();
  37274. (function checkCanvasSizeLimitation() {
  37275. if (isIOS || isAndroid) {
  37276. PDFJS.maxCanvasPixels = 5242880;
  37277. }
  37278. })();
  37279. (function checkFullscreenSupport() {
  37280. if (!hasDOM) {
  37281. return;
  37282. }
  37283. if (isIE && window.parent !== window) {
  37284. PDFJS.disableFullscreen = true;
  37285. }
  37286. })();
  37287. (function checkCurrentScript() {
  37288. if (!hasDOM) {
  37289. return;
  37290. }
  37291. if ('currentScript' in document) {
  37292. return;
  37293. }
  37294. Object.defineProperty(document, 'currentScript', {
  37295. get: function get() {
  37296. var scripts = document.getElementsByTagName('script');
  37297. return scripts[scripts.length - 1];
  37298. },
  37299. enumerable: true,
  37300. configurable: true
  37301. });
  37302. })();
  37303. (function checkInputTypeNumberAssign() {
  37304. if (!hasDOM) {
  37305. return;
  37306. }
  37307. var el = document.createElement('input');
  37308. try {
  37309. el.type = 'number';
  37310. } catch (ex) {
  37311. var inputProto = el.constructor.prototype;
  37312. var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type');
  37313. Object.defineProperty(inputProto, 'type', {
  37314. get: function get() {
  37315. return typeProperty.get.call(this);
  37316. },
  37317. set: function set(value) {
  37318. typeProperty.set.call(this, value === 'number' ? 'text' : value);
  37319. },
  37320. enumerable: true,
  37321. configurable: true
  37322. });
  37323. }
  37324. })();
  37325. (function checkDocumentReadyState() {
  37326. if (!hasDOM) {
  37327. return;
  37328. }
  37329. if (!document.attachEvent) {
  37330. return;
  37331. }
  37332. var documentProto = document.constructor.prototype;
  37333. var readyStateProto = Object.getOwnPropertyDescriptor(documentProto, 'readyState');
  37334. Object.defineProperty(documentProto, 'readyState', {
  37335. get: function get() {
  37336. var value = readyStateProto.get.call(this);
  37337. return value === 'interactive' ? 'loading' : value;
  37338. },
  37339. set: function set(value) {
  37340. readyStateProto.set.call(this, value);
  37341. },
  37342. enumerable: true,
  37343. configurable: true
  37344. });
  37345. })();
  37346. (function checkChildNodeRemove() {
  37347. if (!hasDOM) {
  37348. return;
  37349. }
  37350. if (typeof Element.prototype.remove !== 'undefined') {
  37351. return;
  37352. }
  37353. Element.prototype.remove = function () {
  37354. if (this.parentNode) {
  37355. this.parentNode.removeChild(this);
  37356. }
  37357. };
  37358. })();
  37359. (function checkPromise() {
  37360. if (globalScope.Promise) {
  37361. if (typeof globalScope.Promise.all !== 'function') {
  37362. globalScope.Promise.all = function (iterable) {
  37363. var count = 0,
  37364. results = [],
  37365. resolve,
  37366. reject;
  37367. var promise = new globalScope.Promise(function (resolve_, reject_) {
  37368. resolve = resolve_;
  37369. reject = reject_;
  37370. });
  37371. iterable.forEach(function (p, i) {
  37372. count++;
  37373. p.then(function (result) {
  37374. results[i] = result;
  37375. count--;
  37376. if (count === 0) {
  37377. resolve(results);
  37378. }
  37379. }, reject);
  37380. });
  37381. if (count === 0) {
  37382. resolve(results);
  37383. }
  37384. return promise;
  37385. };
  37386. }
  37387. if (typeof globalScope.Promise.resolve !== 'function') {
  37388. globalScope.Promise.resolve = function (value) {
  37389. return new globalScope.Promise(function (resolve) {
  37390. resolve(value);
  37391. });
  37392. };
  37393. }
  37394. if (typeof globalScope.Promise.reject !== 'function') {
  37395. globalScope.Promise.reject = function (reason) {
  37396. return new globalScope.Promise(function (resolve, reject) {
  37397. reject(reason);
  37398. });
  37399. };
  37400. }
  37401. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  37402. globalScope.Promise.prototype.catch = function (onReject) {
  37403. return globalScope.Promise.prototype.then(undefined, onReject);
  37404. };
  37405. }
  37406. return;
  37407. }
  37408. var STATUS_PENDING = 0;
  37409. var STATUS_RESOLVED = 1;
  37410. var STATUS_REJECTED = 2;
  37411. var REJECTION_TIMEOUT = 500;
  37412. var HandlerManager = {
  37413. handlers: [],
  37414. running: false,
  37415. unhandledRejections: [],
  37416. pendingRejectionCheck: false,
  37417. scheduleHandlers: function scheduleHandlers(promise) {
  37418. if (promise._status === STATUS_PENDING) {
  37419. return;
  37420. }
  37421. this.handlers = this.handlers.concat(promise._handlers);
  37422. promise._handlers = [];
  37423. if (this.running) {
  37424. return;
  37425. }
  37426. this.running = true;
  37427. setTimeout(this.runHandlers.bind(this), 0);
  37428. },
  37429. runHandlers: function runHandlers() {
  37430. var RUN_TIMEOUT = 1;
  37431. var timeoutAt = Date.now() + RUN_TIMEOUT;
  37432. while (this.handlers.length > 0) {
  37433. var handler = this.handlers.shift();
  37434. var nextStatus = handler.thisPromise._status;
  37435. var nextValue = handler.thisPromise._value;
  37436. try {
  37437. if (nextStatus === STATUS_RESOLVED) {
  37438. if (typeof handler.onResolve === 'function') {
  37439. nextValue = handler.onResolve(nextValue);
  37440. }
  37441. } else if (typeof handler.onReject === 'function') {
  37442. nextValue = handler.onReject(nextValue);
  37443. nextStatus = STATUS_RESOLVED;
  37444. if (handler.thisPromise._unhandledRejection) {
  37445. this.removeUnhandeledRejection(handler.thisPromise);
  37446. }
  37447. }
  37448. } catch (ex) {
  37449. nextStatus = STATUS_REJECTED;
  37450. nextValue = ex;
  37451. }
  37452. handler.nextPromise._updateStatus(nextStatus, nextValue);
  37453. if (Date.now() >= timeoutAt) {
  37454. break;
  37455. }
  37456. }
  37457. if (this.handlers.length > 0) {
  37458. setTimeout(this.runHandlers.bind(this), 0);
  37459. return;
  37460. }
  37461. this.running = false;
  37462. },
  37463. addUnhandledRejection: function addUnhandledRejection(promise) {
  37464. this.unhandledRejections.push({
  37465. promise: promise,
  37466. time: Date.now()
  37467. });
  37468. this.scheduleRejectionCheck();
  37469. },
  37470. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  37471. promise._unhandledRejection = false;
  37472. for (var i = 0; i < this.unhandledRejections.length; i++) {
  37473. if (this.unhandledRejections[i].promise === promise) {
  37474. this.unhandledRejections.splice(i);
  37475. i--;
  37476. }
  37477. }
  37478. },
  37479. scheduleRejectionCheck: function scheduleRejectionCheck() {
  37480. var _this = this;
  37481. if (this.pendingRejectionCheck) {
  37482. return;
  37483. }
  37484. this.pendingRejectionCheck = true;
  37485. setTimeout(function () {
  37486. _this.pendingRejectionCheck = false;
  37487. var now = Date.now();
  37488. for (var i = 0; i < _this.unhandledRejections.length; i++) {
  37489. if (now - _this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  37490. var unhandled = _this.unhandledRejections[i].promise._value;
  37491. var msg = 'Unhandled rejection: ' + unhandled;
  37492. if (unhandled.stack) {
  37493. msg += '\n' + unhandled.stack;
  37494. }
  37495. try {
  37496. throw new Error(msg);
  37497. } catch (_) {
  37498. console.warn(msg);
  37499. }
  37500. _this.unhandledRejections.splice(i);
  37501. i--;
  37502. }
  37503. }
  37504. if (_this.unhandledRejections.length) {
  37505. _this.scheduleRejectionCheck();
  37506. }
  37507. }, REJECTION_TIMEOUT);
  37508. }
  37509. };
  37510. var Promise = function Promise(resolver) {
  37511. this._status = STATUS_PENDING;
  37512. this._handlers = [];
  37513. try {
  37514. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  37515. } catch (e) {
  37516. this._reject(e);
  37517. }
  37518. };
  37519. Promise.all = function Promise_all(promises) {
  37520. var resolveAll, rejectAll;
  37521. var deferred = new Promise(function (resolve, reject) {
  37522. resolveAll = resolve;
  37523. rejectAll = reject;
  37524. });
  37525. var unresolved = promises.length;
  37526. var results = [];
  37527. if (unresolved === 0) {
  37528. resolveAll(results);
  37529. return deferred;
  37530. }
  37531. function reject(reason) {
  37532. if (deferred._status === STATUS_REJECTED) {
  37533. return;
  37534. }
  37535. results = [];
  37536. rejectAll(reason);
  37537. }
  37538. for (var i = 0, ii = promises.length; i < ii; ++i) {
  37539. var promise = promises[i];
  37540. var resolve = function (i) {
  37541. return function (value) {
  37542. if (deferred._status === STATUS_REJECTED) {
  37543. return;
  37544. }
  37545. results[i] = value;
  37546. unresolved--;
  37547. if (unresolved === 0) {
  37548. resolveAll(results);
  37549. }
  37550. };
  37551. }(i);
  37552. if (Promise.isPromise(promise)) {
  37553. promise.then(resolve, reject);
  37554. } else {
  37555. resolve(promise);
  37556. }
  37557. }
  37558. return deferred;
  37559. };
  37560. Promise.isPromise = function Promise_isPromise(value) {
  37561. return value && typeof value.then === 'function';
  37562. };
  37563. Promise.resolve = function Promise_resolve(value) {
  37564. return new Promise(function (resolve) {
  37565. resolve(value);
  37566. });
  37567. };
  37568. Promise.reject = function Promise_reject(reason) {
  37569. return new Promise(function (resolve, reject) {
  37570. reject(reason);
  37571. });
  37572. };
  37573. Promise.prototype = {
  37574. _status: null,
  37575. _value: null,
  37576. _handlers: null,
  37577. _unhandledRejection: null,
  37578. _updateStatus: function Promise__updateStatus(status, value) {
  37579. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  37580. return;
  37581. }
  37582. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  37583. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  37584. return;
  37585. }
  37586. this._status = status;
  37587. this._value = value;
  37588. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  37589. this._unhandledRejection = true;
  37590. HandlerManager.addUnhandledRejection(this);
  37591. }
  37592. HandlerManager.scheduleHandlers(this);
  37593. },
  37594. _resolve: function Promise_resolve(value) {
  37595. this._updateStatus(STATUS_RESOLVED, value);
  37596. },
  37597. _reject: function Promise_reject(reason) {
  37598. this._updateStatus(STATUS_REJECTED, reason);
  37599. },
  37600. then: function Promise_then(onResolve, onReject) {
  37601. var nextPromise = new Promise(function (resolve, reject) {
  37602. this.resolve = resolve;
  37603. this.reject = reject;
  37604. });
  37605. this._handlers.push({
  37606. thisPromise: this,
  37607. onResolve: onResolve,
  37608. onReject: onReject,
  37609. nextPromise: nextPromise
  37610. });
  37611. HandlerManager.scheduleHandlers(this);
  37612. return nextPromise;
  37613. },
  37614. catch: function Promise_catch(onReject) {
  37615. return this.then(undefined, onReject);
  37616. }
  37617. };
  37618. globalScope.Promise = Promise;
  37619. })();
  37620. (function checkWeakMap() {
  37621. if (globalScope.WeakMap) {
  37622. return;
  37623. }
  37624. var id = 0;
  37625. function WeakMap() {
  37626. this.id = '$weakmap' + id++;
  37627. }
  37628. WeakMap.prototype = {
  37629. has: function has(obj) {
  37630. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  37631. },
  37632. get: function get(obj, defaultValue) {
  37633. return this.has(obj) ? obj[this.id] : defaultValue;
  37634. },
  37635. set: function set(obj, value) {
  37636. Object.defineProperty(obj, this.id, {
  37637. value: value,
  37638. enumerable: false,
  37639. configurable: true
  37640. });
  37641. },
  37642. delete: function _delete(obj) {
  37643. delete obj[this.id];
  37644. }
  37645. };
  37646. globalScope.WeakMap = WeakMap;
  37647. })();
  37648. (function checkURLConstructor() {
  37649. var hasWorkingUrl = false;
  37650. try {
  37651. if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) {
  37652. var u = new URL('b', 'http://a');
  37653. u.pathname = 'c%20d';
  37654. hasWorkingUrl = u.href === 'http://a/c%20d';
  37655. }
  37656. } catch (e) {}
  37657. if (hasWorkingUrl) {
  37658. return;
  37659. }
  37660. var relative = Object.create(null);
  37661. relative['ftp'] = 21;
  37662. relative['file'] = 0;
  37663. relative['gopher'] = 70;
  37664. relative['http'] = 80;
  37665. relative['https'] = 443;
  37666. relative['ws'] = 80;
  37667. relative['wss'] = 443;
  37668. var relativePathDotMapping = Object.create(null);
  37669. relativePathDotMapping['%2e'] = '.';
  37670. relativePathDotMapping['.%2e'] = '..';
  37671. relativePathDotMapping['%2e.'] = '..';
  37672. relativePathDotMapping['%2e%2e'] = '..';
  37673. function isRelativeScheme(scheme) {
  37674. return relative[scheme] !== undefined;
  37675. }
  37676. function invalid() {
  37677. clear.call(this);
  37678. this._isInvalid = true;
  37679. }
  37680. function IDNAToASCII(h) {
  37681. if (h === '') {
  37682. invalid.call(this);
  37683. }
  37684. return h.toLowerCase();
  37685. }
  37686. function percentEscape(c) {
  37687. var unicode = c.charCodeAt(0);
  37688. if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) {
  37689. return c;
  37690. }
  37691. return encodeURIComponent(c);
  37692. }
  37693. function percentEscapeQuery(c) {
  37694. var unicode = c.charCodeAt(0);
  37695. if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) {
  37696. return c;
  37697. }
  37698. return encodeURIComponent(c);
  37699. }
  37700. var EOF,
  37701. ALPHA = /[a-zA-Z]/,
  37702. ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  37703. function parse(input, stateOverride, base) {
  37704. function err(message) {
  37705. errors.push(message);
  37706. }
  37707. var state = stateOverride || 'scheme start',
  37708. cursor = 0,
  37709. buffer = '',
  37710. seenAt = false,
  37711. seenBracket = false,
  37712. errors = [];
  37713. loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  37714. var c = input[cursor];
  37715. switch (state) {
  37716. case 'scheme start':
  37717. if (c && ALPHA.test(c)) {
  37718. buffer += c.toLowerCase();
  37719. state = 'scheme';
  37720. } else if (!stateOverride) {
  37721. buffer = '';
  37722. state = 'no scheme';
  37723. continue;
  37724. } else {
  37725. err('Invalid scheme.');
  37726. break loop;
  37727. }
  37728. break;
  37729. case 'scheme':
  37730. if (c && ALPHANUMERIC.test(c)) {
  37731. buffer += c.toLowerCase();
  37732. } else if (c === ':') {
  37733. this._scheme = buffer;
  37734. buffer = '';
  37735. if (stateOverride) {
  37736. break loop;
  37737. }
  37738. if (isRelativeScheme(this._scheme)) {
  37739. this._isRelative = true;
  37740. }
  37741. if (this._scheme === 'file') {
  37742. state = 'relative';
  37743. } else if (this._isRelative && base && base._scheme === this._scheme) {
  37744. state = 'relative or authority';
  37745. } else if (this._isRelative) {
  37746. state = 'authority first slash';
  37747. } else {
  37748. state = 'scheme data';
  37749. }
  37750. } else if (!stateOverride) {
  37751. buffer = '';
  37752. cursor = 0;
  37753. state = 'no scheme';
  37754. continue;
  37755. } else if (c === EOF) {
  37756. break loop;
  37757. } else {
  37758. err('Code point not allowed in scheme: ' + c);
  37759. break loop;
  37760. }
  37761. break;
  37762. case 'scheme data':
  37763. if (c === '?') {
  37764. this._query = '?';
  37765. state = 'query';
  37766. } else if (c === '#') {
  37767. this._fragment = '#';
  37768. state = 'fragment';
  37769. } else {
  37770. if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
  37771. this._schemeData += percentEscape(c);
  37772. }
  37773. }
  37774. break;
  37775. case 'no scheme':
  37776. if (!base || !isRelativeScheme(base._scheme)) {
  37777. err('Missing scheme.');
  37778. invalid.call(this);
  37779. } else {
  37780. state = 'relative';
  37781. continue;
  37782. }
  37783. break;
  37784. case 'relative or authority':
  37785. if (c === '/' && input[cursor + 1] === '/') {
  37786. state = 'authority ignore slashes';
  37787. } else {
  37788. err('Expected /, got: ' + c);
  37789. state = 'relative';
  37790. continue;
  37791. }
  37792. break;
  37793. case 'relative':
  37794. this._isRelative = true;
  37795. if (this._scheme !== 'file') {
  37796. this._scheme = base._scheme;
  37797. }
  37798. if (c === EOF) {
  37799. this._host = base._host;
  37800. this._port = base._port;
  37801. this._path = base._path.slice();
  37802. this._query = base._query;
  37803. this._username = base._username;
  37804. this._password = base._password;
  37805. break loop;
  37806. } else if (c === '/' || c === '\\') {
  37807. if (c === '\\') {
  37808. err('\\ is an invalid code point.');
  37809. }
  37810. state = 'relative slash';
  37811. } else if (c === '?') {
  37812. this._host = base._host;
  37813. this._port = base._port;
  37814. this._path = base._path.slice();
  37815. this._query = '?';
  37816. this._username = base._username;
  37817. this._password = base._password;
  37818. state = 'query';
  37819. } else if (c === '#') {
  37820. this._host = base._host;
  37821. this._port = base._port;
  37822. this._path = base._path.slice();
  37823. this._query = base._query;
  37824. this._fragment = '#';
  37825. this._username = base._username;
  37826. this._password = base._password;
  37827. state = 'fragment';
  37828. } else {
  37829. var nextC = input[cursor + 1];
  37830. var nextNextC = input[cursor + 2];
  37831. if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') {
  37832. this._host = base._host;
  37833. this._port = base._port;
  37834. this._username = base._username;
  37835. this._password = base._password;
  37836. this._path = base._path.slice();
  37837. this._path.pop();
  37838. }
  37839. state = 'relative path';
  37840. continue;
  37841. }
  37842. break;
  37843. case 'relative slash':
  37844. if (c === '/' || c === '\\') {
  37845. if (c === '\\') {
  37846. err('\\ is an invalid code point.');
  37847. }
  37848. if (this._scheme === 'file') {
  37849. state = 'file host';
  37850. } else {
  37851. state = 'authority ignore slashes';
  37852. }
  37853. } else {
  37854. if (this._scheme !== 'file') {
  37855. this._host = base._host;
  37856. this._port = base._port;
  37857. this._username = base._username;
  37858. this._password = base._password;
  37859. }
  37860. state = 'relative path';
  37861. continue;
  37862. }
  37863. break;
  37864. case 'authority first slash':
  37865. if (c === '/') {
  37866. state = 'authority second slash';
  37867. } else {
  37868. err('Expected \'/\', got: ' + c);
  37869. state = 'authority ignore slashes';
  37870. continue;
  37871. }
  37872. break;
  37873. case 'authority second slash':
  37874. state = 'authority ignore slashes';
  37875. if (c !== '/') {
  37876. err('Expected \'/\', got: ' + c);
  37877. continue;
  37878. }
  37879. break;
  37880. case 'authority ignore slashes':
  37881. if (c !== '/' && c !== '\\') {
  37882. state = 'authority';
  37883. continue;
  37884. } else {
  37885. err('Expected authority, got: ' + c);
  37886. }
  37887. break;
  37888. case 'authority':
  37889. if (c === '@') {
  37890. if (seenAt) {
  37891. err('@ already seen.');
  37892. buffer += '%40';
  37893. }
  37894. seenAt = true;
  37895. for (var i = 0; i < buffer.length; i++) {
  37896. var cp = buffer[i];
  37897. if (cp === '\t' || cp === '\n' || cp === '\r') {
  37898. err('Invalid whitespace in authority.');
  37899. continue;
  37900. }
  37901. if (cp === ':' && this._password === null) {
  37902. this._password = '';
  37903. continue;
  37904. }
  37905. var tempC = percentEscape(cp);
  37906. if (this._password !== null) {
  37907. this._password += tempC;
  37908. } else {
  37909. this._username += tempC;
  37910. }
  37911. }
  37912. buffer = '';
  37913. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  37914. cursor -= buffer.length;
  37915. buffer = '';
  37916. state = 'host';
  37917. continue;
  37918. } else {
  37919. buffer += c;
  37920. }
  37921. break;
  37922. case 'file host':
  37923. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  37924. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  37925. state = 'relative path';
  37926. } else if (buffer.length === 0) {
  37927. state = 'relative path start';
  37928. } else {
  37929. this._host = IDNAToASCII.call(this, buffer);
  37930. buffer = '';
  37931. state = 'relative path start';
  37932. }
  37933. continue;
  37934. } else if (c === '\t' || c === '\n' || c === '\r') {
  37935. err('Invalid whitespace in file host.');
  37936. } else {
  37937. buffer += c;
  37938. }
  37939. break;
  37940. case 'host':
  37941. case 'hostname':
  37942. if (c === ':' && !seenBracket) {
  37943. this._host = IDNAToASCII.call(this, buffer);
  37944. buffer = '';
  37945. state = 'port';
  37946. if (stateOverride === 'hostname') {
  37947. break loop;
  37948. }
  37949. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  37950. this._host = IDNAToASCII.call(this, buffer);
  37951. buffer = '';
  37952. state = 'relative path start';
  37953. if (stateOverride) {
  37954. break loop;
  37955. }
  37956. continue;
  37957. } else if (c !== '\t' && c !== '\n' && c !== '\r') {
  37958. if (c === '[') {
  37959. seenBracket = true;
  37960. } else if (c === ']') {
  37961. seenBracket = false;
  37962. }
  37963. buffer += c;
  37964. } else {
  37965. err('Invalid code point in host/hostname: ' + c);
  37966. }
  37967. break;
  37968. case 'port':
  37969. if (/[0-9]/.test(c)) {
  37970. buffer += c;
  37971. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  37972. if (buffer !== '') {
  37973. var temp = parseInt(buffer, 10);
  37974. if (temp !== relative[this._scheme]) {
  37975. this._port = temp + '';
  37976. }
  37977. buffer = '';
  37978. }
  37979. if (stateOverride) {
  37980. break loop;
  37981. }
  37982. state = 'relative path start';
  37983. continue;
  37984. } else if (c === '\t' || c === '\n' || c === '\r') {
  37985. err('Invalid code point in port: ' + c);
  37986. } else {
  37987. invalid.call(this);
  37988. }
  37989. break;
  37990. case 'relative path start':
  37991. if (c === '\\') {
  37992. err('\'\\\' not allowed in path.');
  37993. }
  37994. state = 'relative path';
  37995. if (c !== '/' && c !== '\\') {
  37996. continue;
  37997. }
  37998. break;
  37999. case 'relative path':
  38000. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  38001. if (c === '\\') {
  38002. err('\\ not allowed in relative path.');
  38003. }
  38004. var tmp;
  38005. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  38006. buffer = tmp;
  38007. }
  38008. if (buffer === '..') {
  38009. this._path.pop();
  38010. if (c !== '/' && c !== '\\') {
  38011. this._path.push('');
  38012. }
  38013. } else if (buffer === '.' && c !== '/' && c !== '\\') {
  38014. this._path.push('');
  38015. } else if (buffer !== '.') {
  38016. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  38017. buffer = buffer[0] + ':';
  38018. }
  38019. this._path.push(buffer);
  38020. }
  38021. buffer = '';
  38022. if (c === '?') {
  38023. this._query = '?';
  38024. state = 'query';
  38025. } else if (c === '#') {
  38026. this._fragment = '#';
  38027. state = 'fragment';
  38028. }
  38029. } else if (c !== '\t' && c !== '\n' && c !== '\r') {
  38030. buffer += percentEscape(c);
  38031. }
  38032. break;
  38033. case 'query':
  38034. if (!stateOverride && c === '#') {
  38035. this._fragment = '#';
  38036. state = 'fragment';
  38037. } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
  38038. this._query += percentEscapeQuery(c);
  38039. }
  38040. break;
  38041. case 'fragment':
  38042. if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
  38043. this._fragment += c;
  38044. }
  38045. break;
  38046. }
  38047. cursor++;
  38048. }
  38049. }
  38050. function clear() {
  38051. this._scheme = '';
  38052. this._schemeData = '';
  38053. this._username = '';
  38054. this._password = null;
  38055. this._host = '';
  38056. this._port = '';
  38057. this._path = [];
  38058. this._query = '';
  38059. this._fragment = '';
  38060. this._isInvalid = false;
  38061. this._isRelative = false;
  38062. }
  38063. function JURL(url, base) {
  38064. if (base !== undefined && !(base instanceof JURL)) {
  38065. base = new JURL(String(base));
  38066. }
  38067. this._url = url;
  38068. clear.call(this);
  38069. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  38070. parse.call(this, input, null, base);
  38071. }
  38072. JURL.prototype = {
  38073. toString: function toString() {
  38074. return this.href;
  38075. },
  38076. get href() {
  38077. if (this._isInvalid) {
  38078. return this._url;
  38079. }
  38080. var authority = '';
  38081. if (this._username !== '' || this._password !== null) {
  38082. authority = this._username + (this._password !== null ? ':' + this._password : '') + '@';
  38083. }
  38084. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  38085. },
  38086. set href(href) {
  38087. clear.call(this);
  38088. parse.call(this, href);
  38089. },
  38090. get protocol() {
  38091. return this._scheme + ':';
  38092. },
  38093. set protocol(protocol) {
  38094. if (this._isInvalid) {
  38095. return;
  38096. }
  38097. parse.call(this, protocol + ':', 'scheme start');
  38098. },
  38099. get host() {
  38100. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  38101. },
  38102. set host(host) {
  38103. if (this._isInvalid || !this._isRelative) {
  38104. return;
  38105. }
  38106. parse.call(this, host, 'host');
  38107. },
  38108. get hostname() {
  38109. return this._host;
  38110. },
  38111. set hostname(hostname) {
  38112. if (this._isInvalid || !this._isRelative) {
  38113. return;
  38114. }
  38115. parse.call(this, hostname, 'hostname');
  38116. },
  38117. get port() {
  38118. return this._port;
  38119. },
  38120. set port(port) {
  38121. if (this._isInvalid || !this._isRelative) {
  38122. return;
  38123. }
  38124. parse.call(this, port, 'port');
  38125. },
  38126. get pathname() {
  38127. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  38128. },
  38129. set pathname(pathname) {
  38130. if (this._isInvalid || !this._isRelative) {
  38131. return;
  38132. }
  38133. this._path = [];
  38134. parse.call(this, pathname, 'relative path start');
  38135. },
  38136. get search() {
  38137. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  38138. },
  38139. set search(search) {
  38140. if (this._isInvalid || !this._isRelative) {
  38141. return;
  38142. }
  38143. this._query = '?';
  38144. if (search[0] === '?') {
  38145. search = search.slice(1);
  38146. }
  38147. parse.call(this, search, 'query');
  38148. },
  38149. get hash() {
  38150. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  38151. },
  38152. set hash(hash) {
  38153. if (this._isInvalid) {
  38154. return;
  38155. }
  38156. this._fragment = '#';
  38157. if (hash[0] === '#') {
  38158. hash = hash.slice(1);
  38159. }
  38160. parse.call(this, hash, 'fragment');
  38161. },
  38162. get origin() {
  38163. var host;
  38164. if (this._isInvalid || !this._scheme) {
  38165. return '';
  38166. }
  38167. switch (this._scheme) {
  38168. case 'data':
  38169. case 'file':
  38170. case 'javascript':
  38171. case 'mailto':
  38172. return 'null';
  38173. }
  38174. host = this.host;
  38175. if (!host) {
  38176. return '';
  38177. }
  38178. return this._scheme + '://' + host;
  38179. }
  38180. };
  38181. var OriginalURL = globalScope.URL;
  38182. if (OriginalURL) {
  38183. JURL.createObjectURL = function (blob) {
  38184. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  38185. };
  38186. JURL.revokeObjectURL = function (url) {
  38187. OriginalURL.revokeObjectURL(url);
  38188. };
  38189. }
  38190. globalScope.URL = JURL;
  38191. })();
  38192. }
  38193. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  38194. /***/ })
  38195. /******/ ]);
  38196. });
  38197. //# sourceMappingURL=pdf.worker.js.map