pdf.worker.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527
  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. /******/ // The require function
  29. /******/ function __w_pdfjs_require__(moduleId) {
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33. /******/ // Create a new module (and put it into the cache)
  34. /******/ var module = installedModules[moduleId] = {
  35. /******/ i: moduleId,
  36. /******/ l: false,
  37. /******/ exports: {}
  38. /******/ };
  39. /******/ // Execute the module function
  40. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  41. /******/ // Flag the module as loaded
  42. /******/ module.l = true;
  43. /******/ // Return the exports of the module
  44. /******/ return module.exports;
  45. /******/ }
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __w_pdfjs_require__.m = modules;
  48. /******/ // expose the module cache
  49. /******/ __w_pdfjs_require__.c = installedModules;
  50. /******/ // identity function for calling harmony imports with the correct context
  51. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  52. /******/ // define getter function for harmony exports
  53. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  54. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  55. /******/ Object.defineProperty(exports, name, {
  56. /******/ configurable: false,
  57. /******/ enumerable: true,
  58. /******/ get: getter
  59. /******/ });
  60. /******/ }
  61. /******/ };
  62. /******/ // getDefaultExport function for compatibility with non-harmony modules
  63. /******/ __w_pdfjs_require__.n = function(module) {
  64. /******/ var getter = module && module.__esModule ?
  65. /******/ function getDefault() { return module['default']; } :
  66. /******/ function getModuleExports() { return module; };
  67. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  68. /******/ return getter;
  69. /******/ };
  70. /******/ // Object.prototype.hasOwnProperty.call
  71. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  72. /******/ // __webpack_public_path__
  73. /******/ __w_pdfjs_require__.p = "";
  74. /******/ // Load entry module and return exports
  75. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 36);
  76. /******/ })
  77. /************************************************************************/
  78. /******/ ([
  79. /* 0 */
  80. /***/ (function(module, exports, __w_pdfjs_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(global) {
  83. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  84. var FONT_IDENTITY_MATRIX = [
  85. 0.001,
  86. 0,
  87. 0,
  88. 0.001,
  89. 0,
  90. 0
  91. ];
  92. var TextRenderingMode = {
  93. FILL: 0,
  94. STROKE: 1,
  95. FILL_STROKE: 2,
  96. INVISIBLE: 3,
  97. FILL_ADD_TO_PATH: 4,
  98. STROKE_ADD_TO_PATH: 5,
  99. FILL_STROKE_ADD_TO_PATH: 6,
  100. ADD_TO_PATH: 7,
  101. FILL_STROKE_MASK: 3,
  102. ADD_TO_PATH_FLAG: 4
  103. };
  104. var ImageKind = {
  105. GRAYSCALE_1BPP: 1,
  106. RGB_24BPP: 2,
  107. RGBA_32BPP: 3
  108. };
  109. var AnnotationType = {
  110. TEXT: 1,
  111. LINK: 2,
  112. FREETEXT: 3,
  113. LINE: 4,
  114. SQUARE: 5,
  115. CIRCLE: 6,
  116. POLYGON: 7,
  117. POLYLINE: 8,
  118. HIGHLIGHT: 9,
  119. UNDERLINE: 10,
  120. SQUIGGLY: 11,
  121. STRIKEOUT: 12,
  122. STAMP: 13,
  123. CARET: 14,
  124. INK: 15,
  125. POPUP: 16,
  126. FILEATTACHMENT: 17,
  127. SOUND: 18,
  128. MOVIE: 19,
  129. WIDGET: 20,
  130. SCREEN: 21,
  131. PRINTERMARK: 22,
  132. TRAPNET: 23,
  133. WATERMARK: 24,
  134. THREED: 25,
  135. REDACT: 26
  136. };
  137. var AnnotationFlag = {
  138. INVISIBLE: 0x01,
  139. HIDDEN: 0x02,
  140. PRINT: 0x04,
  141. NOZOOM: 0x08,
  142. NOROTATE: 0x10,
  143. NOVIEW: 0x20,
  144. READONLY: 0x40,
  145. LOCKED: 0x80,
  146. TOGGLENOVIEW: 0x100,
  147. LOCKEDCONTENTS: 0x200
  148. };
  149. var AnnotationFieldFlag = {
  150. READONLY: 0x0000001,
  151. REQUIRED: 0x0000002,
  152. NOEXPORT: 0x0000004,
  153. MULTILINE: 0x0001000,
  154. PASSWORD: 0x0002000,
  155. NOTOGGLETOOFF: 0x0004000,
  156. RADIO: 0x0008000,
  157. PUSHBUTTON: 0x0010000,
  158. COMBO: 0x0020000,
  159. EDIT: 0x0040000,
  160. SORT: 0x0080000,
  161. FILESELECT: 0x0100000,
  162. MULTISELECT: 0x0200000,
  163. DONOTSPELLCHECK: 0x0400000,
  164. DONOTSCROLL: 0x0800000,
  165. COMB: 0x1000000,
  166. RICHTEXT: 0x2000000,
  167. RADIOSINUNISON: 0x2000000,
  168. COMMITONSELCHANGE: 0x4000000
  169. };
  170. var AnnotationBorderStyleType = {
  171. SOLID: 1,
  172. DASHED: 2,
  173. BEVELED: 3,
  174. INSET: 4,
  175. UNDERLINE: 5
  176. };
  177. var StreamType = {
  178. UNKNOWN: 0,
  179. FLATE: 1,
  180. LZW: 2,
  181. DCT: 3,
  182. JPX: 4,
  183. JBIG: 5,
  184. A85: 6,
  185. AHX: 7,
  186. CCF: 8,
  187. RL: 9
  188. };
  189. var FontType = {
  190. UNKNOWN: 0,
  191. TYPE1: 1,
  192. TYPE1C: 2,
  193. CIDFONTTYPE0: 3,
  194. CIDFONTTYPE0C: 4,
  195. TRUETYPE: 5,
  196. CIDFONTTYPE2: 6,
  197. TYPE3: 7,
  198. OPENTYPE: 8,
  199. TYPE0: 9,
  200. MMTYPE1: 10
  201. };
  202. var VERBOSITY_LEVELS = {
  203. errors: 0,
  204. warnings: 1,
  205. infos: 5
  206. };
  207. var CMapCompressionType = {
  208. NONE: 0,
  209. BINARY: 1,
  210. STREAM: 2
  211. };
  212. var OPS = {
  213. dependency: 1,
  214. setLineWidth: 2,
  215. setLineCap: 3,
  216. setLineJoin: 4,
  217. setMiterLimit: 5,
  218. setDash: 6,
  219. setRenderingIntent: 7,
  220. setFlatness: 8,
  221. setGState: 9,
  222. save: 10,
  223. restore: 11,
  224. transform: 12,
  225. moveTo: 13,
  226. lineTo: 14,
  227. curveTo: 15,
  228. curveTo2: 16,
  229. curveTo3: 17,
  230. closePath: 18,
  231. rectangle: 19,
  232. stroke: 20,
  233. closeStroke: 21,
  234. fill: 22,
  235. eoFill: 23,
  236. fillStroke: 24,
  237. eoFillStroke: 25,
  238. closeFillStroke: 26,
  239. closeEOFillStroke: 27,
  240. endPath: 28,
  241. clip: 29,
  242. eoClip: 30,
  243. beginText: 31,
  244. endText: 32,
  245. setCharSpacing: 33,
  246. setWordSpacing: 34,
  247. setHScale: 35,
  248. setLeading: 36,
  249. setFont: 37,
  250. setTextRenderingMode: 38,
  251. setTextRise: 39,
  252. moveText: 40,
  253. setLeadingMoveText: 41,
  254. setTextMatrix: 42,
  255. nextLine: 43,
  256. showText: 44,
  257. showSpacedText: 45,
  258. nextLineShowText: 46,
  259. nextLineSetSpacingShowText: 47,
  260. setCharWidth: 48,
  261. setCharWidthAndBounds: 49,
  262. setStrokeColorSpace: 50,
  263. setFillColorSpace: 51,
  264. setStrokeColor: 52,
  265. setStrokeColorN: 53,
  266. setFillColor: 54,
  267. setFillColorN: 55,
  268. setStrokeGray: 56,
  269. setFillGray: 57,
  270. setStrokeRGBColor: 58,
  271. setFillRGBColor: 59,
  272. setStrokeCMYKColor: 60,
  273. setFillCMYKColor: 61,
  274. shadingFill: 62,
  275. beginInlineImage: 63,
  276. beginImageData: 64,
  277. endInlineImage: 65,
  278. paintXObject: 66,
  279. markPoint: 67,
  280. markPointProps: 68,
  281. beginMarkedContent: 69,
  282. beginMarkedContentProps: 70,
  283. endMarkedContent: 71,
  284. beginCompat: 72,
  285. endCompat: 73,
  286. paintFormXObjectBegin: 74,
  287. paintFormXObjectEnd: 75,
  288. beginGroup: 76,
  289. endGroup: 77,
  290. beginAnnotations: 78,
  291. endAnnotations: 79,
  292. beginAnnotation: 80,
  293. endAnnotation: 81,
  294. paintJpegXObject: 82,
  295. paintImageMaskXObject: 83,
  296. paintImageMaskXObjectGroup: 84,
  297. paintImageXObject: 85,
  298. paintInlineImageXObject: 86,
  299. paintInlineImageXObjectGroup: 87,
  300. paintImageXObjectRepeat: 88,
  301. paintImageMaskXObjectRepeat: 89,
  302. paintSolidColorImageMask: 90,
  303. constructPath: 91
  304. };
  305. var verbosity = VERBOSITY_LEVELS.warnings;
  306. function setVerbosityLevel(level) {
  307. verbosity = level;
  308. }
  309. function getVerbosityLevel() {
  310. return verbosity;
  311. }
  312. function info(msg) {
  313. if (verbosity >= VERBOSITY_LEVELS.infos) {
  314. console.log('Info: ' + msg);
  315. }
  316. }
  317. function warn(msg) {
  318. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  319. console.log('Warning: ' + msg);
  320. }
  321. }
  322. function deprecated(details) {
  323. console.log('Deprecated API usage: ' + details);
  324. }
  325. function error(msg) {
  326. if (verbosity >= VERBOSITY_LEVELS.errors) {
  327. console.log('Error: ' + msg);
  328. console.log(backtrace());
  329. }
  330. throw new Error(msg);
  331. }
  332. function backtrace() {
  333. try {
  334. throw new Error();
  335. } catch (e) {
  336. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  337. }
  338. }
  339. function assert(cond, msg) {
  340. if (!cond) {
  341. error(msg);
  342. }
  343. }
  344. var UNSUPPORTED_FEATURES = {
  345. unknown: 'unknown',
  346. forms: 'forms',
  347. javaScript: 'javaScript',
  348. smask: 'smask',
  349. shadingPattern: 'shadingPattern',
  350. font: 'font'
  351. };
  352. function isSameOrigin(baseUrl, otherUrl) {
  353. try {
  354. var base = new URL(baseUrl);
  355. if (!base.origin || base.origin === 'null') {
  356. return false;
  357. }
  358. } catch (e) {
  359. return false;
  360. }
  361. var other = new URL(otherUrl, base);
  362. return base.origin === other.origin;
  363. }
  364. function isValidProtocol(url) {
  365. if (!url) {
  366. return false;
  367. }
  368. switch (url.protocol) {
  369. case 'http:':
  370. case 'https:':
  371. case 'ftp:':
  372. case 'mailto:':
  373. case 'tel:':
  374. return true;
  375. default:
  376. return false;
  377. }
  378. }
  379. function createValidAbsoluteUrl(url, baseUrl) {
  380. if (!url) {
  381. return null;
  382. }
  383. try {
  384. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  385. if (isValidProtocol(absoluteUrl)) {
  386. return absoluteUrl;
  387. }
  388. } catch (ex) {
  389. }
  390. return null;
  391. }
  392. function shadow(obj, prop, value) {
  393. Object.defineProperty(obj, prop, {
  394. value: value,
  395. enumerable: true,
  396. configurable: true,
  397. writable: false
  398. });
  399. return value;
  400. }
  401. function getLookupTableFactory(initializer) {
  402. var lookup;
  403. return function () {
  404. if (initializer) {
  405. lookup = Object.create(null);
  406. initializer(lookup);
  407. initializer = null;
  408. }
  409. return lookup;
  410. };
  411. }
  412. var PasswordResponses = {
  413. NEED_PASSWORD: 1,
  414. INCORRECT_PASSWORD: 2
  415. };
  416. var PasswordException = function PasswordExceptionClosure() {
  417. function PasswordException(msg, code) {
  418. this.name = 'PasswordException';
  419. this.message = msg;
  420. this.code = code;
  421. }
  422. PasswordException.prototype = new Error();
  423. PasswordException.constructor = PasswordException;
  424. return PasswordException;
  425. }();
  426. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  427. function UnknownErrorException(msg, details) {
  428. this.name = 'UnknownErrorException';
  429. this.message = msg;
  430. this.details = details;
  431. }
  432. UnknownErrorException.prototype = new Error();
  433. UnknownErrorException.constructor = UnknownErrorException;
  434. return UnknownErrorException;
  435. }();
  436. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  437. function InvalidPDFException(msg) {
  438. this.name = 'InvalidPDFException';
  439. this.message = msg;
  440. }
  441. InvalidPDFException.prototype = new Error();
  442. InvalidPDFException.constructor = InvalidPDFException;
  443. return InvalidPDFException;
  444. }();
  445. var MissingPDFException = function MissingPDFExceptionClosure() {
  446. function MissingPDFException(msg) {
  447. this.name = 'MissingPDFException';
  448. this.message = msg;
  449. }
  450. MissingPDFException.prototype = new Error();
  451. MissingPDFException.constructor = MissingPDFException;
  452. return MissingPDFException;
  453. }();
  454. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  455. function UnexpectedResponseException(msg, status) {
  456. this.name = 'UnexpectedResponseException';
  457. this.message = msg;
  458. this.status = status;
  459. }
  460. UnexpectedResponseException.prototype = new Error();
  461. UnexpectedResponseException.constructor = UnexpectedResponseException;
  462. return UnexpectedResponseException;
  463. }();
  464. var NotImplementedException = function NotImplementedExceptionClosure() {
  465. function NotImplementedException(msg) {
  466. this.message = msg;
  467. }
  468. NotImplementedException.prototype = new Error();
  469. NotImplementedException.prototype.name = 'NotImplementedException';
  470. NotImplementedException.constructor = NotImplementedException;
  471. return NotImplementedException;
  472. }();
  473. var MissingDataException = function MissingDataExceptionClosure() {
  474. function MissingDataException(begin, end) {
  475. this.begin = begin;
  476. this.end = end;
  477. this.message = 'Missing data [' + begin + ', ' + end + ')';
  478. }
  479. MissingDataException.prototype = new Error();
  480. MissingDataException.prototype.name = 'MissingDataException';
  481. MissingDataException.constructor = MissingDataException;
  482. return MissingDataException;
  483. }();
  484. var XRefParseException = function XRefParseExceptionClosure() {
  485. function XRefParseException(msg) {
  486. this.message = msg;
  487. }
  488. XRefParseException.prototype = new Error();
  489. XRefParseException.prototype.name = 'XRefParseException';
  490. XRefParseException.constructor = XRefParseException;
  491. return XRefParseException;
  492. }();
  493. var NullCharactersRegExp = /\x00/g;
  494. function removeNullCharacters(str) {
  495. if (typeof str !== 'string') {
  496. warn('The argument for removeNullCharacters must be a string.');
  497. return str;
  498. }
  499. return str.replace(NullCharactersRegExp, '');
  500. }
  501. function bytesToString(bytes) {
  502. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  503. var length = bytes.length;
  504. var MAX_ARGUMENT_COUNT = 8192;
  505. if (length < MAX_ARGUMENT_COUNT) {
  506. return String.fromCharCode.apply(null, bytes);
  507. }
  508. var strBuf = [];
  509. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  510. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  511. var chunk = bytes.subarray(i, chunkEnd);
  512. strBuf.push(String.fromCharCode.apply(null, chunk));
  513. }
  514. return strBuf.join('');
  515. }
  516. function stringToBytes(str) {
  517. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  518. var length = str.length;
  519. var bytes = new Uint8Array(length);
  520. for (var i = 0; i < length; ++i) {
  521. bytes[i] = str.charCodeAt(i) & 0xFF;
  522. }
  523. return bytes;
  524. }
  525. function arrayByteLength(arr) {
  526. if (arr.length !== undefined) {
  527. return arr.length;
  528. }
  529. assert(arr.byteLength !== undefined);
  530. return arr.byteLength;
  531. }
  532. function arraysToBytes(arr) {
  533. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  534. return arr[0];
  535. }
  536. var resultLength = 0;
  537. var i, ii = arr.length;
  538. var item, itemLength;
  539. for (i = 0; i < ii; i++) {
  540. item = arr[i];
  541. itemLength = arrayByteLength(item);
  542. resultLength += itemLength;
  543. }
  544. var pos = 0;
  545. var data = new Uint8Array(resultLength);
  546. for (i = 0; i < ii; i++) {
  547. item = arr[i];
  548. if (!(item instanceof Uint8Array)) {
  549. if (typeof item === 'string') {
  550. item = stringToBytes(item);
  551. } else {
  552. item = new Uint8Array(item);
  553. }
  554. }
  555. itemLength = item.byteLength;
  556. data.set(item, pos);
  557. pos += itemLength;
  558. }
  559. return data;
  560. }
  561. function string32(value) {
  562. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  563. }
  564. function log2(x) {
  565. var n = 1, i = 0;
  566. while (x > n) {
  567. n <<= 1;
  568. i++;
  569. }
  570. return i;
  571. }
  572. function readInt8(data, start) {
  573. return data[start] << 24 >> 24;
  574. }
  575. function readUint16(data, offset) {
  576. return data[offset] << 8 | data[offset + 1];
  577. }
  578. function readUint32(data, offset) {
  579. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  580. }
  581. function isLittleEndian() {
  582. var buffer8 = new Uint8Array(2);
  583. buffer8[0] = 1;
  584. var buffer16 = new Uint16Array(buffer8.buffer);
  585. return buffer16[0] === 1;
  586. }
  587. function isEvalSupported() {
  588. try {
  589. new Function('');
  590. return true;
  591. } catch (e) {
  592. return false;
  593. }
  594. }
  595. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  596. function Uint32ArrayView(buffer, length) {
  597. this.buffer = buffer;
  598. this.byteLength = buffer.length;
  599. this.length = length === undefined ? this.byteLength >> 2 : length;
  600. ensureUint32ArrayViewProps(this.length);
  601. }
  602. Uint32ArrayView.prototype = Object.create(null);
  603. var uint32ArrayViewSetters = 0;
  604. function createUint32ArrayProp(index) {
  605. return {
  606. get: function () {
  607. var buffer = this.buffer, offset = index << 2;
  608. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  609. },
  610. set: function (value) {
  611. var buffer = this.buffer, offset = index << 2;
  612. buffer[offset] = value & 255;
  613. buffer[offset + 1] = value >> 8 & 255;
  614. buffer[offset + 2] = value >> 16 & 255;
  615. buffer[offset + 3] = value >>> 24 & 255;
  616. }
  617. };
  618. }
  619. function ensureUint32ArrayViewProps(length) {
  620. while (uint32ArrayViewSetters < length) {
  621. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  622. uint32ArrayViewSetters++;
  623. }
  624. }
  625. return Uint32ArrayView;
  626. }();
  627. exports.Uint32ArrayView = Uint32ArrayView;
  628. var IDENTITY_MATRIX = [
  629. 1,
  630. 0,
  631. 0,
  632. 1,
  633. 0,
  634. 0
  635. ];
  636. var Util = function UtilClosure() {
  637. function Util() {
  638. }
  639. var rgbBuf = [
  640. 'rgb(',
  641. 0,
  642. ',',
  643. 0,
  644. ',',
  645. 0,
  646. ')'
  647. ];
  648. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  649. rgbBuf[1] = r;
  650. rgbBuf[3] = g;
  651. rgbBuf[5] = b;
  652. return rgbBuf.join('');
  653. };
  654. Util.transform = function Util_transform(m1, m2) {
  655. return [
  656. m1[0] * m2[0] + m1[2] * m2[1],
  657. m1[1] * m2[0] + m1[3] * m2[1],
  658. m1[0] * m2[2] + m1[2] * m2[3],
  659. m1[1] * m2[2] + m1[3] * m2[3],
  660. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  661. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  662. ];
  663. };
  664. Util.applyTransform = function Util_applyTransform(p, m) {
  665. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  666. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  667. return [
  668. xt,
  669. yt
  670. ];
  671. };
  672. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  673. var d = m[0] * m[3] - m[1] * m[2];
  674. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  675. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  676. return [
  677. xt,
  678. yt
  679. ];
  680. };
  681. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  682. var p1 = Util.applyTransform(r, m);
  683. var p2 = Util.applyTransform(r.slice(2, 4), m);
  684. var p3 = Util.applyTransform([
  685. r[0],
  686. r[3]
  687. ], m);
  688. var p4 = Util.applyTransform([
  689. r[2],
  690. r[1]
  691. ], m);
  692. return [
  693. Math.min(p1[0], p2[0], p3[0], p4[0]),
  694. Math.min(p1[1], p2[1], p3[1], p4[1]),
  695. Math.max(p1[0], p2[0], p3[0], p4[0]),
  696. Math.max(p1[1], p2[1], p3[1], p4[1])
  697. ];
  698. };
  699. Util.inverseTransform = function Util_inverseTransform(m) {
  700. var d = m[0] * m[3] - m[1] * m[2];
  701. return [
  702. m[3] / d,
  703. -m[1] / d,
  704. -m[2] / d,
  705. m[0] / d,
  706. (m[2] * m[5] - m[4] * m[3]) / d,
  707. (m[4] * m[1] - m[5] * m[0]) / d
  708. ];
  709. };
  710. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  711. return [
  712. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  713. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  714. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  715. ];
  716. };
  717. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  718. var transpose = [
  719. m[0],
  720. m[2],
  721. m[1],
  722. m[3]
  723. ];
  724. var a = m[0] * transpose[0] + m[1] * transpose[2];
  725. var b = m[0] * transpose[1] + m[1] * transpose[3];
  726. var c = m[2] * transpose[0] + m[3] * transpose[2];
  727. var d = m[2] * transpose[1] + m[3] * transpose[3];
  728. var first = (a + d) / 2;
  729. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  730. var sx = first + second || 1;
  731. var sy = first - second || 1;
  732. return [
  733. Math.sqrt(sx),
  734. Math.sqrt(sy)
  735. ];
  736. };
  737. Util.normalizeRect = function Util_normalizeRect(rect) {
  738. var r = rect.slice(0);
  739. if (rect[0] > rect[2]) {
  740. r[0] = rect[2];
  741. r[2] = rect[0];
  742. }
  743. if (rect[1] > rect[3]) {
  744. r[1] = rect[3];
  745. r[3] = rect[1];
  746. }
  747. return r;
  748. };
  749. Util.intersect = function Util_intersect(rect1, rect2) {
  750. function compare(a, b) {
  751. return a - b;
  752. }
  753. var orderedX = [
  754. rect1[0],
  755. rect1[2],
  756. rect2[0],
  757. rect2[2]
  758. ].sort(compare), orderedY = [
  759. rect1[1],
  760. rect1[3],
  761. rect2[1],
  762. rect2[3]
  763. ].sort(compare), result = [];
  764. rect1 = Util.normalizeRect(rect1);
  765. rect2 = Util.normalizeRect(rect2);
  766. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  767. result[0] = orderedX[1];
  768. result[2] = orderedX[2];
  769. } else {
  770. return false;
  771. }
  772. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  773. result[1] = orderedY[1];
  774. result[3] = orderedY[2];
  775. } else {
  776. return false;
  777. }
  778. return result;
  779. };
  780. Util.sign = function Util_sign(num) {
  781. return num < 0 ? -1 : 1;
  782. };
  783. var ROMAN_NUMBER_MAP = [
  784. '',
  785. 'C',
  786. 'CC',
  787. 'CCC',
  788. 'CD',
  789. 'D',
  790. 'DC',
  791. 'DCC',
  792. 'DCCC',
  793. 'CM',
  794. '',
  795. 'X',
  796. 'XX',
  797. 'XXX',
  798. 'XL',
  799. 'L',
  800. 'LX',
  801. 'LXX',
  802. 'LXXX',
  803. 'XC',
  804. '',
  805. 'I',
  806. 'II',
  807. 'III',
  808. 'IV',
  809. 'V',
  810. 'VI',
  811. 'VII',
  812. 'VIII',
  813. 'IX'
  814. ];
  815. Util.toRoman = function Util_toRoman(number, lowerCase) {
  816. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  817. var pos, romanBuf = [];
  818. while (number >= 1000) {
  819. number -= 1000;
  820. romanBuf.push('M');
  821. }
  822. pos = number / 100 | 0;
  823. number %= 100;
  824. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  825. pos = number / 10 | 0;
  826. number %= 10;
  827. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  828. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  829. var romanStr = romanBuf.join('');
  830. return lowerCase ? romanStr.toLowerCase() : romanStr;
  831. };
  832. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  833. Array.prototype.push.apply(arr1, arr2);
  834. };
  835. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  836. Array.prototype.unshift.apply(arr1, arr2);
  837. };
  838. Util.extendObj = function extendObj(obj1, obj2) {
  839. for (var key in obj2) {
  840. obj1[key] = obj2[key];
  841. }
  842. };
  843. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  844. while (dict && !dict.has(name)) {
  845. dict = dict.get('Parent');
  846. }
  847. if (!dict) {
  848. return null;
  849. }
  850. return getArray ? dict.getArray(name) : dict.get(name);
  851. };
  852. Util.inherit = function Util_inherit(sub, base, prototype) {
  853. sub.prototype = Object.create(base.prototype);
  854. sub.prototype.constructor = sub;
  855. for (var prop in prototype) {
  856. sub.prototype[prop] = prototype[prop];
  857. }
  858. };
  859. Util.loadScript = function Util_loadScript(src, callback) {
  860. var script = document.createElement('script');
  861. var loaded = false;
  862. script.setAttribute('src', src);
  863. if (callback) {
  864. script.onload = function () {
  865. if (!loaded) {
  866. callback();
  867. }
  868. loaded = true;
  869. };
  870. }
  871. document.getElementsByTagName('head')[0].appendChild(script);
  872. };
  873. return Util;
  874. }();
  875. var PageViewport = function PageViewportClosure() {
  876. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  877. this.viewBox = viewBox;
  878. this.scale = scale;
  879. this.rotation = rotation;
  880. this.offsetX = offsetX;
  881. this.offsetY = offsetY;
  882. var centerX = (viewBox[2] + viewBox[0]) / 2;
  883. var centerY = (viewBox[3] + viewBox[1]) / 2;
  884. var rotateA, rotateB, rotateC, rotateD;
  885. rotation = rotation % 360;
  886. rotation = rotation < 0 ? rotation + 360 : rotation;
  887. switch (rotation) {
  888. case 180:
  889. rotateA = -1;
  890. rotateB = 0;
  891. rotateC = 0;
  892. rotateD = 1;
  893. break;
  894. case 90:
  895. rotateA = 0;
  896. rotateB = 1;
  897. rotateC = 1;
  898. rotateD = 0;
  899. break;
  900. case 270:
  901. rotateA = 0;
  902. rotateB = -1;
  903. rotateC = -1;
  904. rotateD = 0;
  905. break;
  906. default:
  907. rotateA = 1;
  908. rotateB = 0;
  909. rotateC = 0;
  910. rotateD = -1;
  911. break;
  912. }
  913. if (dontFlip) {
  914. rotateC = -rotateC;
  915. rotateD = -rotateD;
  916. }
  917. var offsetCanvasX, offsetCanvasY;
  918. var width, height;
  919. if (rotateA === 0) {
  920. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  921. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  922. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  923. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  924. } else {
  925. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  926. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  927. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  928. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  929. }
  930. this.transform = [
  931. rotateA * scale,
  932. rotateB * scale,
  933. rotateC * scale,
  934. rotateD * scale,
  935. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  936. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  937. ];
  938. this.width = width;
  939. this.height = height;
  940. this.fontScale = scale;
  941. }
  942. PageViewport.prototype = {
  943. clone: function PageViewPort_clone(args) {
  944. args = args || {};
  945. var scale = 'scale' in args ? args.scale : this.scale;
  946. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  947. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  948. },
  949. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  950. return Util.applyTransform([
  951. x,
  952. y
  953. ], this.transform);
  954. },
  955. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  956. var tl = Util.applyTransform([
  957. rect[0],
  958. rect[1]
  959. ], this.transform);
  960. var br = Util.applyTransform([
  961. rect[2],
  962. rect[3]
  963. ], this.transform);
  964. return [
  965. tl[0],
  966. tl[1],
  967. br[0],
  968. br[1]
  969. ];
  970. },
  971. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  972. return Util.applyInverseTransform([
  973. x,
  974. y
  975. ], this.transform);
  976. }
  977. };
  978. return PageViewport;
  979. }();
  980. var PDFStringTranslateTable = [
  981. 0,
  982. 0,
  983. 0,
  984. 0,
  985. 0,
  986. 0,
  987. 0,
  988. 0,
  989. 0,
  990. 0,
  991. 0,
  992. 0,
  993. 0,
  994. 0,
  995. 0,
  996. 0,
  997. 0,
  998. 0,
  999. 0,
  1000. 0,
  1001. 0,
  1002. 0,
  1003. 0,
  1004. 0,
  1005. 0x2D8,
  1006. 0x2C7,
  1007. 0x2C6,
  1008. 0x2D9,
  1009. 0x2DD,
  1010. 0x2DB,
  1011. 0x2DA,
  1012. 0x2DC,
  1013. 0,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0,
  1022. 0,
  1023. 0,
  1024. 0,
  1025. 0,
  1026. 0,
  1027. 0,
  1028. 0,
  1029. 0,
  1030. 0,
  1031. 0,
  1032. 0,
  1033. 0,
  1034. 0,
  1035. 0,
  1036. 0,
  1037. 0,
  1038. 0,
  1039. 0,
  1040. 0,
  1041. 0,
  1042. 0,
  1043. 0,
  1044. 0,
  1045. 0,
  1046. 0,
  1047. 0,
  1048. 0,
  1049. 0,
  1050. 0,
  1051. 0,
  1052. 0,
  1053. 0,
  1054. 0,
  1055. 0,
  1056. 0,
  1057. 0,
  1058. 0,
  1059. 0,
  1060. 0,
  1061. 0,
  1062. 0,
  1063. 0,
  1064. 0,
  1065. 0,
  1066. 0,
  1067. 0,
  1068. 0,
  1069. 0,
  1070. 0,
  1071. 0,
  1072. 0,
  1073. 0,
  1074. 0,
  1075. 0,
  1076. 0,
  1077. 0,
  1078. 0,
  1079. 0,
  1080. 0,
  1081. 0,
  1082. 0,
  1083. 0,
  1084. 0,
  1085. 0,
  1086. 0,
  1087. 0,
  1088. 0,
  1089. 0,
  1090. 0,
  1091. 0,
  1092. 0,
  1093. 0,
  1094. 0,
  1095. 0,
  1096. 0,
  1097. 0,
  1098. 0,
  1099. 0,
  1100. 0,
  1101. 0,
  1102. 0,
  1103. 0,
  1104. 0,
  1105. 0,
  1106. 0,
  1107. 0,
  1108. 0,
  1109. 0x2022,
  1110. 0x2020,
  1111. 0x2021,
  1112. 0x2026,
  1113. 0x2014,
  1114. 0x2013,
  1115. 0x192,
  1116. 0x2044,
  1117. 0x2039,
  1118. 0x203A,
  1119. 0x2212,
  1120. 0x2030,
  1121. 0x201E,
  1122. 0x201C,
  1123. 0x201D,
  1124. 0x2018,
  1125. 0x2019,
  1126. 0x201A,
  1127. 0x2122,
  1128. 0xFB01,
  1129. 0xFB02,
  1130. 0x141,
  1131. 0x152,
  1132. 0x160,
  1133. 0x178,
  1134. 0x17D,
  1135. 0x131,
  1136. 0x142,
  1137. 0x153,
  1138. 0x161,
  1139. 0x17E,
  1140. 0,
  1141. 0x20AC
  1142. ];
  1143. function stringToPDFString(str) {
  1144. var i, n = str.length, strBuf = [];
  1145. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1146. for (i = 2; i < n; i += 2) {
  1147. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1148. }
  1149. } else {
  1150. for (i = 0; i < n; ++i) {
  1151. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1152. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1153. }
  1154. }
  1155. return strBuf.join('');
  1156. }
  1157. function stringToUTF8String(str) {
  1158. return decodeURIComponent(escape(str));
  1159. }
  1160. function utf8StringToString(str) {
  1161. return unescape(encodeURIComponent(str));
  1162. }
  1163. function isEmptyObj(obj) {
  1164. for (var key in obj) {
  1165. return false;
  1166. }
  1167. return true;
  1168. }
  1169. function isBool(v) {
  1170. return typeof v === 'boolean';
  1171. }
  1172. function isInt(v) {
  1173. return typeof v === 'number' && (v | 0) === v;
  1174. }
  1175. function isNum(v) {
  1176. return typeof v === 'number';
  1177. }
  1178. function isString(v) {
  1179. return typeof v === 'string';
  1180. }
  1181. function isArray(v) {
  1182. return v instanceof Array;
  1183. }
  1184. function isArrayBuffer(v) {
  1185. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1186. }
  1187. function isSpace(ch) {
  1188. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1189. }
  1190. function isNodeJS() {
  1191. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1192. return typeof process === 'object' && process + '' === '[object process]';
  1193. }
  1194. return false;
  1195. }
  1196. function createPromiseCapability() {
  1197. var capability = {};
  1198. capability.promise = new Promise(function (resolve, reject) {
  1199. capability.resolve = resolve;
  1200. capability.reject = reject;
  1201. });
  1202. return capability;
  1203. }
  1204. (function PromiseClosure() {
  1205. if (globalScope.Promise) {
  1206. if (typeof globalScope.Promise.all !== 'function') {
  1207. globalScope.Promise.all = function (iterable) {
  1208. var count = 0, results = [], resolve, reject;
  1209. var promise = new globalScope.Promise(function (resolve_, reject_) {
  1210. resolve = resolve_;
  1211. reject = reject_;
  1212. });
  1213. iterable.forEach(function (p, i) {
  1214. count++;
  1215. p.then(function (result) {
  1216. results[i] = result;
  1217. count--;
  1218. if (count === 0) {
  1219. resolve(results);
  1220. }
  1221. }, reject);
  1222. });
  1223. if (count === 0) {
  1224. resolve(results);
  1225. }
  1226. return promise;
  1227. };
  1228. }
  1229. if (typeof globalScope.Promise.resolve !== 'function') {
  1230. globalScope.Promise.resolve = function (value) {
  1231. return new globalScope.Promise(function (resolve) {
  1232. resolve(value);
  1233. });
  1234. };
  1235. }
  1236. if (typeof globalScope.Promise.reject !== 'function') {
  1237. globalScope.Promise.reject = function (reason) {
  1238. return new globalScope.Promise(function (resolve, reject) {
  1239. reject(reason);
  1240. });
  1241. };
  1242. }
  1243. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  1244. globalScope.Promise.prototype.catch = function (onReject) {
  1245. return globalScope.Promise.prototype.then(undefined, onReject);
  1246. };
  1247. }
  1248. return;
  1249. }
  1250. var STATUS_PENDING = 0;
  1251. var STATUS_RESOLVED = 1;
  1252. var STATUS_REJECTED = 2;
  1253. var REJECTION_TIMEOUT = 500;
  1254. var HandlerManager = {
  1255. handlers: [],
  1256. running: false,
  1257. unhandledRejections: [],
  1258. pendingRejectionCheck: false,
  1259. scheduleHandlers: function scheduleHandlers(promise) {
  1260. if (promise._status === STATUS_PENDING) {
  1261. return;
  1262. }
  1263. this.handlers = this.handlers.concat(promise._handlers);
  1264. promise._handlers = [];
  1265. if (this.running) {
  1266. return;
  1267. }
  1268. this.running = true;
  1269. setTimeout(this.runHandlers.bind(this), 0);
  1270. },
  1271. runHandlers: function runHandlers() {
  1272. var RUN_TIMEOUT = 1;
  1273. var timeoutAt = Date.now() + RUN_TIMEOUT;
  1274. while (this.handlers.length > 0) {
  1275. var handler = this.handlers.shift();
  1276. var nextStatus = handler.thisPromise._status;
  1277. var nextValue = handler.thisPromise._value;
  1278. try {
  1279. if (nextStatus === STATUS_RESOLVED) {
  1280. if (typeof handler.onResolve === 'function') {
  1281. nextValue = handler.onResolve(nextValue);
  1282. }
  1283. } else if (typeof handler.onReject === 'function') {
  1284. nextValue = handler.onReject(nextValue);
  1285. nextStatus = STATUS_RESOLVED;
  1286. if (handler.thisPromise._unhandledRejection) {
  1287. this.removeUnhandeledRejection(handler.thisPromise);
  1288. }
  1289. }
  1290. } catch (ex) {
  1291. nextStatus = STATUS_REJECTED;
  1292. nextValue = ex;
  1293. }
  1294. handler.nextPromise._updateStatus(nextStatus, nextValue);
  1295. if (Date.now() >= timeoutAt) {
  1296. break;
  1297. }
  1298. }
  1299. if (this.handlers.length > 0) {
  1300. setTimeout(this.runHandlers.bind(this), 0);
  1301. return;
  1302. }
  1303. this.running = false;
  1304. },
  1305. addUnhandledRejection: function addUnhandledRejection(promise) {
  1306. this.unhandledRejections.push({
  1307. promise: promise,
  1308. time: Date.now()
  1309. });
  1310. this.scheduleRejectionCheck();
  1311. },
  1312. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  1313. promise._unhandledRejection = false;
  1314. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1315. if (this.unhandledRejections[i].promise === promise) {
  1316. this.unhandledRejections.splice(i);
  1317. i--;
  1318. }
  1319. }
  1320. },
  1321. scheduleRejectionCheck: function scheduleRejectionCheck() {
  1322. if (this.pendingRejectionCheck) {
  1323. return;
  1324. }
  1325. this.pendingRejectionCheck = true;
  1326. setTimeout(function rejectionCheck() {
  1327. this.pendingRejectionCheck = false;
  1328. var now = Date.now();
  1329. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1330. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  1331. var unhandled = this.unhandledRejections[i].promise._value;
  1332. var msg = 'Unhandled rejection: ' + unhandled;
  1333. if (unhandled.stack) {
  1334. msg += '\n' + unhandled.stack;
  1335. }
  1336. warn(msg);
  1337. this.unhandledRejections.splice(i);
  1338. i--;
  1339. }
  1340. }
  1341. if (this.unhandledRejections.length) {
  1342. this.scheduleRejectionCheck();
  1343. }
  1344. }.bind(this), REJECTION_TIMEOUT);
  1345. }
  1346. };
  1347. var Promise = function Promise(resolver) {
  1348. this._status = STATUS_PENDING;
  1349. this._handlers = [];
  1350. try {
  1351. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  1352. } catch (e) {
  1353. this._reject(e);
  1354. }
  1355. };
  1356. Promise.all = function Promise_all(promises) {
  1357. var resolveAll, rejectAll;
  1358. var deferred = new Promise(function (resolve, reject) {
  1359. resolveAll = resolve;
  1360. rejectAll = reject;
  1361. });
  1362. var unresolved = promises.length;
  1363. var results = [];
  1364. if (unresolved === 0) {
  1365. resolveAll(results);
  1366. return deferred;
  1367. }
  1368. function reject(reason) {
  1369. if (deferred._status === STATUS_REJECTED) {
  1370. return;
  1371. }
  1372. results = [];
  1373. rejectAll(reason);
  1374. }
  1375. for (var i = 0, ii = promises.length; i < ii; ++i) {
  1376. var promise = promises[i];
  1377. var resolve = function (i) {
  1378. return function (value) {
  1379. if (deferred._status === STATUS_REJECTED) {
  1380. return;
  1381. }
  1382. results[i] = value;
  1383. unresolved--;
  1384. if (unresolved === 0) {
  1385. resolveAll(results);
  1386. }
  1387. };
  1388. }(i);
  1389. if (Promise.isPromise(promise)) {
  1390. promise.then(resolve, reject);
  1391. } else {
  1392. resolve(promise);
  1393. }
  1394. }
  1395. return deferred;
  1396. };
  1397. Promise.isPromise = function Promise_isPromise(value) {
  1398. return value && typeof value.then === 'function';
  1399. };
  1400. Promise.resolve = function Promise_resolve(value) {
  1401. return new Promise(function (resolve) {
  1402. resolve(value);
  1403. });
  1404. };
  1405. Promise.reject = function Promise_reject(reason) {
  1406. return new Promise(function (resolve, reject) {
  1407. reject(reason);
  1408. });
  1409. };
  1410. Promise.prototype = {
  1411. _status: null,
  1412. _value: null,
  1413. _handlers: null,
  1414. _unhandledRejection: null,
  1415. _updateStatus: function Promise__updateStatus(status, value) {
  1416. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  1417. return;
  1418. }
  1419. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  1420. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  1421. return;
  1422. }
  1423. this._status = status;
  1424. this._value = value;
  1425. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  1426. this._unhandledRejection = true;
  1427. HandlerManager.addUnhandledRejection(this);
  1428. }
  1429. HandlerManager.scheduleHandlers(this);
  1430. },
  1431. _resolve: function Promise_resolve(value) {
  1432. this._updateStatus(STATUS_RESOLVED, value);
  1433. },
  1434. _reject: function Promise_reject(reason) {
  1435. this._updateStatus(STATUS_REJECTED, reason);
  1436. },
  1437. then: function Promise_then(onResolve, onReject) {
  1438. var nextPromise = new Promise(function (resolve, reject) {
  1439. this.resolve = resolve;
  1440. this.reject = reject;
  1441. });
  1442. this._handlers.push({
  1443. thisPromise: this,
  1444. onResolve: onResolve,
  1445. onReject: onReject,
  1446. nextPromise: nextPromise
  1447. });
  1448. HandlerManager.scheduleHandlers(this);
  1449. return nextPromise;
  1450. },
  1451. catch: function Promise_catch(onReject) {
  1452. return this.then(undefined, onReject);
  1453. }
  1454. };
  1455. globalScope.Promise = Promise;
  1456. }());
  1457. (function WeakMapClosure() {
  1458. if (globalScope.WeakMap) {
  1459. return;
  1460. }
  1461. var id = 0;
  1462. function WeakMap() {
  1463. this.id = '$weakmap' + id++;
  1464. }
  1465. WeakMap.prototype = {
  1466. has: function (obj) {
  1467. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  1468. },
  1469. get: function (obj, defaultValue) {
  1470. return this.has(obj) ? obj[this.id] : defaultValue;
  1471. },
  1472. set: function (obj, value) {
  1473. Object.defineProperty(obj, this.id, {
  1474. value: value,
  1475. enumerable: false,
  1476. configurable: true
  1477. });
  1478. },
  1479. delete: function (obj) {
  1480. delete obj[this.id];
  1481. }
  1482. };
  1483. globalScope.WeakMap = WeakMap;
  1484. }());
  1485. var StatTimer = function StatTimerClosure() {
  1486. function rpad(str, pad, length) {
  1487. while (str.length < length) {
  1488. str += pad;
  1489. }
  1490. return str;
  1491. }
  1492. function StatTimer() {
  1493. this.started = Object.create(null);
  1494. this.times = [];
  1495. this.enabled = true;
  1496. }
  1497. StatTimer.prototype = {
  1498. time: function StatTimer_time(name) {
  1499. if (!this.enabled) {
  1500. return;
  1501. }
  1502. if (name in this.started) {
  1503. warn('Timer is already running for ' + name);
  1504. }
  1505. this.started[name] = Date.now();
  1506. },
  1507. timeEnd: function StatTimer_timeEnd(name) {
  1508. if (!this.enabled) {
  1509. return;
  1510. }
  1511. if (!(name in this.started)) {
  1512. warn('Timer has not been started for ' + name);
  1513. }
  1514. this.times.push({
  1515. 'name': name,
  1516. 'start': this.started[name],
  1517. 'end': Date.now()
  1518. });
  1519. delete this.started[name];
  1520. },
  1521. toString: function StatTimer_toString() {
  1522. var i, ii;
  1523. var times = this.times;
  1524. var out = '';
  1525. var longest = 0;
  1526. for (i = 0, ii = times.length; i < ii; ++i) {
  1527. var name = times[i]['name'];
  1528. if (name.length > longest) {
  1529. longest = name.length;
  1530. }
  1531. }
  1532. for (i = 0, ii = times.length; i < ii; ++i) {
  1533. var span = times[i];
  1534. var duration = span.end - span.start;
  1535. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1536. }
  1537. return out;
  1538. }
  1539. };
  1540. return StatTimer;
  1541. }();
  1542. var createBlob = function createBlob(data, contentType) {
  1543. if (typeof Blob !== 'undefined') {
  1544. return new Blob([data], { type: contentType });
  1545. }
  1546. warn('The "Blob" constructor is not supported.');
  1547. };
  1548. var createObjectURL = function createObjectURLClosure() {
  1549. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1550. return function createObjectURL(data, contentType, forceDataSchema) {
  1551. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1552. var blob = createBlob(data, contentType);
  1553. return URL.createObjectURL(blob);
  1554. }
  1555. var buffer = 'data:' + contentType + ';base64,';
  1556. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1557. var b1 = data[i] & 0xFF;
  1558. var b2 = data[i + 1] & 0xFF;
  1559. var b3 = data[i + 2] & 0xFF;
  1560. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1561. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1562. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1563. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1564. }
  1565. return buffer;
  1566. };
  1567. }();
  1568. function MessageHandler(sourceName, targetName, comObj) {
  1569. this.sourceName = sourceName;
  1570. this.targetName = targetName;
  1571. this.comObj = comObj;
  1572. this.callbackIndex = 1;
  1573. this.postMessageTransfers = true;
  1574. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1575. var ah = this.actionHandler = Object.create(null);
  1576. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1577. var data = event.data;
  1578. if (data.targetName !== this.sourceName) {
  1579. return;
  1580. }
  1581. if (data.isReply) {
  1582. var callbackId = data.callbackId;
  1583. if (data.callbackId in callbacksCapabilities) {
  1584. var callback = callbacksCapabilities[callbackId];
  1585. delete callbacksCapabilities[callbackId];
  1586. if ('error' in data) {
  1587. callback.reject(data.error);
  1588. } else {
  1589. callback.resolve(data.data);
  1590. }
  1591. } else {
  1592. error('Cannot resolve callback ' + callbackId);
  1593. }
  1594. } else if (data.action in ah) {
  1595. var action = ah[data.action];
  1596. if (data.callbackId) {
  1597. var sourceName = this.sourceName;
  1598. var targetName = data.sourceName;
  1599. Promise.resolve().then(function () {
  1600. return action[0].call(action[1], data.data);
  1601. }).then(function (result) {
  1602. comObj.postMessage({
  1603. sourceName: sourceName,
  1604. targetName: targetName,
  1605. isReply: true,
  1606. callbackId: data.callbackId,
  1607. data: result
  1608. });
  1609. }, function (reason) {
  1610. if (reason instanceof Error) {
  1611. reason = reason + '';
  1612. }
  1613. comObj.postMessage({
  1614. sourceName: sourceName,
  1615. targetName: targetName,
  1616. isReply: true,
  1617. callbackId: data.callbackId,
  1618. error: reason
  1619. });
  1620. });
  1621. } else {
  1622. action[0].call(action[1], data.data);
  1623. }
  1624. } else {
  1625. error('Unknown action from worker: ' + data.action);
  1626. }
  1627. }.bind(this);
  1628. comObj.addEventListener('message', this._onComObjOnMessage);
  1629. }
  1630. MessageHandler.prototype = {
  1631. on: function messageHandlerOn(actionName, handler, scope) {
  1632. var ah = this.actionHandler;
  1633. if (ah[actionName]) {
  1634. error('There is already an actionName called "' + actionName + '"');
  1635. }
  1636. ah[actionName] = [
  1637. handler,
  1638. scope
  1639. ];
  1640. },
  1641. send: function messageHandlerSend(actionName, data, transfers) {
  1642. var message = {
  1643. sourceName: this.sourceName,
  1644. targetName: this.targetName,
  1645. action: actionName,
  1646. data: data
  1647. };
  1648. this.postMessage(message, transfers);
  1649. },
  1650. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1651. var callbackId = this.callbackIndex++;
  1652. var message = {
  1653. sourceName: this.sourceName,
  1654. targetName: this.targetName,
  1655. action: actionName,
  1656. data: data,
  1657. callbackId: callbackId
  1658. };
  1659. var capability = createPromiseCapability();
  1660. this.callbacksCapabilities[callbackId] = capability;
  1661. try {
  1662. this.postMessage(message, transfers);
  1663. } catch (e) {
  1664. capability.reject(e);
  1665. }
  1666. return capability.promise;
  1667. },
  1668. postMessage: function (message, transfers) {
  1669. if (transfers && this.postMessageTransfers) {
  1670. this.comObj.postMessage(message, transfers);
  1671. } else {
  1672. this.comObj.postMessage(message);
  1673. }
  1674. },
  1675. destroy: function () {
  1676. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1677. }
  1678. };
  1679. function loadJpegStream(id, imageUrl, objs) {
  1680. var img = new Image();
  1681. img.onload = function loadJpegStream_onloadClosure() {
  1682. objs.resolve(id, img);
  1683. };
  1684. img.onerror = function loadJpegStream_onerrorClosure() {
  1685. objs.resolve(id, null);
  1686. warn('Error during JPEG image loading');
  1687. };
  1688. img.src = imageUrl;
  1689. }
  1690. (function checkURLConstructor(scope) {
  1691. var hasWorkingUrl = false;
  1692. try {
  1693. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  1694. var u = new URL('b', 'http://a');
  1695. u.pathname = 'c%20d';
  1696. hasWorkingUrl = u.href === 'http://a/c%20d';
  1697. }
  1698. } catch (e) {
  1699. }
  1700. if (hasWorkingUrl) {
  1701. return;
  1702. }
  1703. var relative = Object.create(null);
  1704. relative['ftp'] = 21;
  1705. relative['file'] = 0;
  1706. relative['gopher'] = 70;
  1707. relative['http'] = 80;
  1708. relative['https'] = 443;
  1709. relative['ws'] = 80;
  1710. relative['wss'] = 443;
  1711. var relativePathDotMapping = Object.create(null);
  1712. relativePathDotMapping['%2e'] = '.';
  1713. relativePathDotMapping['.%2e'] = '..';
  1714. relativePathDotMapping['%2e.'] = '..';
  1715. relativePathDotMapping['%2e%2e'] = '..';
  1716. function isRelativeScheme(scheme) {
  1717. return relative[scheme] !== undefined;
  1718. }
  1719. function invalid() {
  1720. clear.call(this);
  1721. this._isInvalid = true;
  1722. }
  1723. function IDNAToASCII(h) {
  1724. if (h === '') {
  1725. invalid.call(this);
  1726. }
  1727. return h.toLowerCase();
  1728. }
  1729. function percentEscape(c) {
  1730. var unicode = c.charCodeAt(0);
  1731. if (unicode > 0x20 && unicode < 0x7F && [
  1732. 0x22,
  1733. 0x23,
  1734. 0x3C,
  1735. 0x3E,
  1736. 0x3F,
  1737. 0x60
  1738. ].indexOf(unicode) === -1) {
  1739. return c;
  1740. }
  1741. return encodeURIComponent(c);
  1742. }
  1743. function percentEscapeQuery(c) {
  1744. var unicode = c.charCodeAt(0);
  1745. if (unicode > 0x20 && unicode < 0x7F && [
  1746. 0x22,
  1747. 0x23,
  1748. 0x3C,
  1749. 0x3E,
  1750. 0x60
  1751. ].indexOf(unicode) === -1) {
  1752. return c;
  1753. }
  1754. return encodeURIComponent(c);
  1755. }
  1756. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  1757. function parse(input, stateOverride, base) {
  1758. function err(message) {
  1759. errors.push(message);
  1760. }
  1761. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  1762. loop:
  1763. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  1764. var c = input[cursor];
  1765. switch (state) {
  1766. case 'scheme start':
  1767. if (c && ALPHA.test(c)) {
  1768. buffer += c.toLowerCase();
  1769. state = 'scheme';
  1770. } else if (!stateOverride) {
  1771. buffer = '';
  1772. state = 'no scheme';
  1773. continue;
  1774. } else {
  1775. err('Invalid scheme.');
  1776. break loop;
  1777. }
  1778. break;
  1779. case 'scheme':
  1780. if (c && ALPHANUMERIC.test(c)) {
  1781. buffer += c.toLowerCase();
  1782. } else if (c === ':') {
  1783. this._scheme = buffer;
  1784. buffer = '';
  1785. if (stateOverride) {
  1786. break loop;
  1787. }
  1788. if (isRelativeScheme(this._scheme)) {
  1789. this._isRelative = true;
  1790. }
  1791. if (this._scheme === 'file') {
  1792. state = 'relative';
  1793. } else if (this._isRelative && base && base._scheme === this._scheme) {
  1794. state = 'relative or authority';
  1795. } else if (this._isRelative) {
  1796. state = 'authority first slash';
  1797. } else {
  1798. state = 'scheme data';
  1799. }
  1800. } else if (!stateOverride) {
  1801. buffer = '';
  1802. cursor = 0;
  1803. state = 'no scheme';
  1804. continue;
  1805. } else if (EOF === c) {
  1806. break loop;
  1807. } else {
  1808. err('Code point not allowed in scheme: ' + c);
  1809. break loop;
  1810. }
  1811. break;
  1812. case 'scheme data':
  1813. if (c === '?') {
  1814. this._query = '?';
  1815. state = 'query';
  1816. } else if (c === '#') {
  1817. this._fragment = '#';
  1818. state = 'fragment';
  1819. } else {
  1820. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  1821. this._schemeData += percentEscape(c);
  1822. }
  1823. }
  1824. break;
  1825. case 'no scheme':
  1826. if (!base || !isRelativeScheme(base._scheme)) {
  1827. err('Missing scheme.');
  1828. invalid.call(this);
  1829. } else {
  1830. state = 'relative';
  1831. continue;
  1832. }
  1833. break;
  1834. case 'relative or authority':
  1835. if (c === '/' && input[cursor + 1] === '/') {
  1836. state = 'authority ignore slashes';
  1837. } else {
  1838. err('Expected /, got: ' + c);
  1839. state = 'relative';
  1840. continue;
  1841. }
  1842. break;
  1843. case 'relative':
  1844. this._isRelative = true;
  1845. if ('file' !== this._scheme) {
  1846. this._scheme = base._scheme;
  1847. }
  1848. if (EOF === c) {
  1849. this._host = base._host;
  1850. this._port = base._port;
  1851. this._path = base._path.slice();
  1852. this._query = base._query;
  1853. this._username = base._username;
  1854. this._password = base._password;
  1855. break loop;
  1856. } else if (c === '/' || c === '\\') {
  1857. if (c === '\\') {
  1858. err('\\ is an invalid code point.');
  1859. }
  1860. state = 'relative slash';
  1861. } else if (c === '?') {
  1862. this._host = base._host;
  1863. this._port = base._port;
  1864. this._path = base._path.slice();
  1865. this._query = '?';
  1866. this._username = base._username;
  1867. this._password = base._password;
  1868. state = 'query';
  1869. } else if (c === '#') {
  1870. this._host = base._host;
  1871. this._port = base._port;
  1872. this._path = base._path.slice();
  1873. this._query = base._query;
  1874. this._fragment = '#';
  1875. this._username = base._username;
  1876. this._password = base._password;
  1877. state = 'fragment';
  1878. } else {
  1879. var nextC = input[cursor + 1];
  1880. var nextNextC = input[cursor + 2];
  1881. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  1882. this._host = base._host;
  1883. this._port = base._port;
  1884. this._username = base._username;
  1885. this._password = base._password;
  1886. this._path = base._path.slice();
  1887. this._path.pop();
  1888. }
  1889. state = 'relative path';
  1890. continue;
  1891. }
  1892. break;
  1893. case 'relative slash':
  1894. if (c === '/' || c === '\\') {
  1895. if (c === '\\') {
  1896. err('\\ is an invalid code point.');
  1897. }
  1898. if (this._scheme === 'file') {
  1899. state = 'file host';
  1900. } else {
  1901. state = 'authority ignore slashes';
  1902. }
  1903. } else {
  1904. if ('file' !== this._scheme) {
  1905. this._host = base._host;
  1906. this._port = base._port;
  1907. this._username = base._username;
  1908. this._password = base._password;
  1909. }
  1910. state = 'relative path';
  1911. continue;
  1912. }
  1913. break;
  1914. case 'authority first slash':
  1915. if (c === '/') {
  1916. state = 'authority second slash';
  1917. } else {
  1918. err('Expected \'/\', got: ' + c);
  1919. state = 'authority ignore slashes';
  1920. continue;
  1921. }
  1922. break;
  1923. case 'authority second slash':
  1924. state = 'authority ignore slashes';
  1925. if ('/' !== c) {
  1926. err('Expected \'/\', got: ' + c);
  1927. continue;
  1928. }
  1929. break;
  1930. case 'authority ignore slashes':
  1931. if ('/' !== c && '\\' !== c) {
  1932. state = 'authority';
  1933. continue;
  1934. } else {
  1935. err('Expected authority, got: ' + c);
  1936. }
  1937. break;
  1938. case 'authority':
  1939. if (c === '@') {
  1940. if (seenAt) {
  1941. err('@ already seen.');
  1942. buffer += '%40';
  1943. }
  1944. seenAt = true;
  1945. for (var i = 0; i < buffer.length; i++) {
  1946. var cp = buffer[i];
  1947. if (cp === '\t' || cp === '\n' || cp === '\r') {
  1948. err('Invalid whitespace in authority.');
  1949. continue;
  1950. }
  1951. if (cp === ':' && this._password === null) {
  1952. this._password = '';
  1953. continue;
  1954. }
  1955. var tempC = percentEscape(cp);
  1956. if (null !== this._password) {
  1957. this._password += tempC;
  1958. } else {
  1959. this._username += tempC;
  1960. }
  1961. }
  1962. buffer = '';
  1963. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1964. cursor -= buffer.length;
  1965. buffer = '';
  1966. state = 'host';
  1967. continue;
  1968. } else {
  1969. buffer += c;
  1970. }
  1971. break;
  1972. case 'file host':
  1973. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1974. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  1975. state = 'relative path';
  1976. } else if (buffer.length === 0) {
  1977. state = 'relative path start';
  1978. } else {
  1979. this._host = IDNAToASCII.call(this, buffer);
  1980. buffer = '';
  1981. state = 'relative path start';
  1982. }
  1983. continue;
  1984. } else if (c === '\t' || c === '\n' || c === '\r') {
  1985. err('Invalid whitespace in file host.');
  1986. } else {
  1987. buffer += c;
  1988. }
  1989. break;
  1990. case 'host':
  1991. case 'hostname':
  1992. if (c === ':' && !seenBracket) {
  1993. this._host = IDNAToASCII.call(this, buffer);
  1994. buffer = '';
  1995. state = 'port';
  1996. if (stateOverride === 'hostname') {
  1997. break loop;
  1998. }
  1999. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  2000. this._host = IDNAToASCII.call(this, buffer);
  2001. buffer = '';
  2002. state = 'relative path start';
  2003. if (stateOverride) {
  2004. break loop;
  2005. }
  2006. continue;
  2007. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  2008. if (c === '[') {
  2009. seenBracket = true;
  2010. } else if (c === ']') {
  2011. seenBracket = false;
  2012. }
  2013. buffer += c;
  2014. } else {
  2015. err('Invalid code point in host/hostname: ' + c);
  2016. }
  2017. break;
  2018. case 'port':
  2019. if (/[0-9]/.test(c)) {
  2020. buffer += c;
  2021. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  2022. if ('' !== buffer) {
  2023. var temp = parseInt(buffer, 10);
  2024. if (temp !== relative[this._scheme]) {
  2025. this._port = temp + '';
  2026. }
  2027. buffer = '';
  2028. }
  2029. if (stateOverride) {
  2030. break loop;
  2031. }
  2032. state = 'relative path start';
  2033. continue;
  2034. } else if (c === '\t' || c === '\n' || c === '\r') {
  2035. err('Invalid code point in port: ' + c);
  2036. } else {
  2037. invalid.call(this);
  2038. }
  2039. break;
  2040. case 'relative path start':
  2041. if (c === '\\') {
  2042. err('\'\\\' not allowed in path.');
  2043. }
  2044. state = 'relative path';
  2045. if ('/' !== c && '\\' !== c) {
  2046. continue;
  2047. }
  2048. break;
  2049. case 'relative path':
  2050. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  2051. if (c === '\\') {
  2052. err('\\ not allowed in relative path.');
  2053. }
  2054. var tmp;
  2055. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  2056. buffer = tmp;
  2057. }
  2058. if (buffer === '..') {
  2059. this._path.pop();
  2060. if ('/' !== c && '\\' !== c) {
  2061. this._path.push('');
  2062. }
  2063. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  2064. this._path.push('');
  2065. } else if ('.' !== buffer) {
  2066. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  2067. buffer = buffer[0] + ':';
  2068. }
  2069. this._path.push(buffer);
  2070. }
  2071. buffer = '';
  2072. if (c === '?') {
  2073. this._query = '?';
  2074. state = 'query';
  2075. } else if (c === '#') {
  2076. this._fragment = '#';
  2077. state = 'fragment';
  2078. }
  2079. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  2080. buffer += percentEscape(c);
  2081. }
  2082. break;
  2083. case 'query':
  2084. if (!stateOverride && c === '#') {
  2085. this._fragment = '#';
  2086. state = 'fragment';
  2087. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2088. this._query += percentEscapeQuery(c);
  2089. }
  2090. break;
  2091. case 'fragment':
  2092. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2093. this._fragment += c;
  2094. }
  2095. break;
  2096. }
  2097. cursor++;
  2098. }
  2099. }
  2100. function clear() {
  2101. this._scheme = '';
  2102. this._schemeData = '';
  2103. this._username = '';
  2104. this._password = null;
  2105. this._host = '';
  2106. this._port = '';
  2107. this._path = [];
  2108. this._query = '';
  2109. this._fragment = '';
  2110. this._isInvalid = false;
  2111. this._isRelative = false;
  2112. }
  2113. function JURL(url, base) {
  2114. if (base !== undefined && !(base instanceof JURL)) {
  2115. base = new JURL(String(base));
  2116. }
  2117. this._url = url;
  2118. clear.call(this);
  2119. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  2120. parse.call(this, input, null, base);
  2121. }
  2122. JURL.prototype = {
  2123. toString: function () {
  2124. return this.href;
  2125. },
  2126. get href() {
  2127. if (this._isInvalid) {
  2128. return this._url;
  2129. }
  2130. var authority = '';
  2131. if ('' !== this._username || null !== this._password) {
  2132. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  2133. }
  2134. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  2135. },
  2136. set href(href) {
  2137. clear.call(this);
  2138. parse.call(this, href);
  2139. },
  2140. get protocol() {
  2141. return this._scheme + ':';
  2142. },
  2143. set protocol(protocol) {
  2144. if (this._isInvalid) {
  2145. return;
  2146. }
  2147. parse.call(this, protocol + ':', 'scheme start');
  2148. },
  2149. get host() {
  2150. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  2151. },
  2152. set host(host) {
  2153. if (this._isInvalid || !this._isRelative) {
  2154. return;
  2155. }
  2156. parse.call(this, host, 'host');
  2157. },
  2158. get hostname() {
  2159. return this._host;
  2160. },
  2161. set hostname(hostname) {
  2162. if (this._isInvalid || !this._isRelative) {
  2163. return;
  2164. }
  2165. parse.call(this, hostname, 'hostname');
  2166. },
  2167. get port() {
  2168. return this._port;
  2169. },
  2170. set port(port) {
  2171. if (this._isInvalid || !this._isRelative) {
  2172. return;
  2173. }
  2174. parse.call(this, port, 'port');
  2175. },
  2176. get pathname() {
  2177. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  2178. },
  2179. set pathname(pathname) {
  2180. if (this._isInvalid || !this._isRelative) {
  2181. return;
  2182. }
  2183. this._path = [];
  2184. parse.call(this, pathname, 'relative path start');
  2185. },
  2186. get search() {
  2187. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  2188. },
  2189. set search(search) {
  2190. if (this._isInvalid || !this._isRelative) {
  2191. return;
  2192. }
  2193. this._query = '?';
  2194. if (search[0] === '?') {
  2195. search = search.slice(1);
  2196. }
  2197. parse.call(this, search, 'query');
  2198. },
  2199. get hash() {
  2200. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  2201. },
  2202. set hash(hash) {
  2203. if (this._isInvalid) {
  2204. return;
  2205. }
  2206. this._fragment = '#';
  2207. if (hash[0] === '#') {
  2208. hash = hash.slice(1);
  2209. }
  2210. parse.call(this, hash, 'fragment');
  2211. },
  2212. get origin() {
  2213. var host;
  2214. if (this._isInvalid || !this._scheme) {
  2215. return '';
  2216. }
  2217. switch (this._scheme) {
  2218. case 'data':
  2219. case 'file':
  2220. case 'javascript':
  2221. case 'mailto':
  2222. return 'null';
  2223. }
  2224. host = this.host;
  2225. if (!host) {
  2226. return '';
  2227. }
  2228. return this._scheme + '://' + host;
  2229. }
  2230. };
  2231. var OriginalURL = scope.URL;
  2232. if (OriginalURL) {
  2233. JURL.createObjectURL = function (blob) {
  2234. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  2235. };
  2236. JURL.revokeObjectURL = function (url) {
  2237. OriginalURL.revokeObjectURL(url);
  2238. };
  2239. }
  2240. scope.URL = JURL;
  2241. }(globalScope));
  2242. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  2243. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  2244. exports.OPS = OPS;
  2245. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  2246. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  2247. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  2248. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  2249. exports.AnnotationFlag = AnnotationFlag;
  2250. exports.AnnotationType = AnnotationType;
  2251. exports.FontType = FontType;
  2252. exports.ImageKind = ImageKind;
  2253. exports.CMapCompressionType = CMapCompressionType;
  2254. exports.InvalidPDFException = InvalidPDFException;
  2255. exports.MessageHandler = MessageHandler;
  2256. exports.MissingDataException = MissingDataException;
  2257. exports.MissingPDFException = MissingPDFException;
  2258. exports.NotImplementedException = NotImplementedException;
  2259. exports.PageViewport = PageViewport;
  2260. exports.PasswordException = PasswordException;
  2261. exports.PasswordResponses = PasswordResponses;
  2262. exports.StatTimer = StatTimer;
  2263. exports.StreamType = StreamType;
  2264. exports.TextRenderingMode = TextRenderingMode;
  2265. exports.UnexpectedResponseException = UnexpectedResponseException;
  2266. exports.UnknownErrorException = UnknownErrorException;
  2267. exports.Util = Util;
  2268. exports.XRefParseException = XRefParseException;
  2269. exports.arrayByteLength = arrayByteLength;
  2270. exports.arraysToBytes = arraysToBytes;
  2271. exports.assert = assert;
  2272. exports.bytesToString = bytesToString;
  2273. exports.createBlob = createBlob;
  2274. exports.createPromiseCapability = createPromiseCapability;
  2275. exports.createObjectURL = createObjectURL;
  2276. exports.deprecated = deprecated;
  2277. exports.error = error;
  2278. exports.getLookupTableFactory = getLookupTableFactory;
  2279. exports.getVerbosityLevel = getVerbosityLevel;
  2280. exports.globalScope = globalScope;
  2281. exports.info = info;
  2282. exports.isArray = isArray;
  2283. exports.isArrayBuffer = isArrayBuffer;
  2284. exports.isBool = isBool;
  2285. exports.isEmptyObj = isEmptyObj;
  2286. exports.isInt = isInt;
  2287. exports.isNum = isNum;
  2288. exports.isString = isString;
  2289. exports.isSpace = isSpace;
  2290. exports.isNodeJS = isNodeJS;
  2291. exports.isSameOrigin = isSameOrigin;
  2292. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  2293. exports.isLittleEndian = isLittleEndian;
  2294. exports.isEvalSupported = isEvalSupported;
  2295. exports.loadJpegStream = loadJpegStream;
  2296. exports.log2 = log2;
  2297. exports.readInt8 = readInt8;
  2298. exports.readUint16 = readUint16;
  2299. exports.readUint32 = readUint32;
  2300. exports.removeNullCharacters = removeNullCharacters;
  2301. exports.setVerbosityLevel = setVerbosityLevel;
  2302. exports.shadow = shadow;
  2303. exports.string32 = string32;
  2304. exports.stringToBytes = stringToBytes;
  2305. exports.stringToPDFString = stringToPDFString;
  2306. exports.stringToUTF8String = stringToUTF8String;
  2307. exports.utf8StringToString = utf8StringToString;
  2308. exports.warn = warn;
  2309. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(19)))
  2310. /***/ }),
  2311. /* 1 */
  2312. /***/ (function(module, exports, __w_pdfjs_require__) {
  2313. "use strict";
  2314. var sharedUtil = __w_pdfjs_require__(0);
  2315. var isArray = sharedUtil.isArray;
  2316. var EOF = {};
  2317. var Name = function NameClosure() {
  2318. function Name(name) {
  2319. this.name = name;
  2320. }
  2321. Name.prototype = {};
  2322. var nameCache = Object.create(null);
  2323. Name.get = function Name_get(name) {
  2324. var nameValue = nameCache[name];
  2325. return nameValue ? nameValue : nameCache[name] = new Name(name);
  2326. };
  2327. return Name;
  2328. }();
  2329. var Cmd = function CmdClosure() {
  2330. function Cmd(cmd) {
  2331. this.cmd = cmd;
  2332. }
  2333. Cmd.prototype = {};
  2334. var cmdCache = Object.create(null);
  2335. Cmd.get = function Cmd_get(cmd) {
  2336. var cmdValue = cmdCache[cmd];
  2337. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  2338. };
  2339. return Cmd;
  2340. }();
  2341. var Dict = function DictClosure() {
  2342. var nonSerializable = function nonSerializableClosure() {
  2343. return nonSerializable;
  2344. };
  2345. function Dict(xref) {
  2346. this.map = Object.create(null);
  2347. this.xref = xref;
  2348. this.objId = null;
  2349. this.suppressEncryption = false;
  2350. this.__nonSerializable__ = nonSerializable;
  2351. }
  2352. Dict.prototype = {
  2353. assignXref: function Dict_assignXref(newXref) {
  2354. this.xref = newXref;
  2355. },
  2356. get: function Dict_get(key1, key2, key3) {
  2357. var value;
  2358. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2359. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2360. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2361. }
  2362. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2363. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2364. }
  2365. value = this.map[key3] || null;
  2366. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2367. },
  2368. getAsync: function Dict_getAsync(key1, key2, key3) {
  2369. var value;
  2370. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2371. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2372. if (xref) {
  2373. return xref.fetchIfRefAsync(value, suppressEncryption);
  2374. }
  2375. return Promise.resolve(value);
  2376. }
  2377. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2378. if (xref) {
  2379. return xref.fetchIfRefAsync(value, suppressEncryption);
  2380. }
  2381. return Promise.resolve(value);
  2382. }
  2383. value = this.map[key3] || null;
  2384. if (xref) {
  2385. return xref.fetchIfRefAsync(value, suppressEncryption);
  2386. }
  2387. return Promise.resolve(value);
  2388. },
  2389. getArray: function Dict_getArray(key1, key2, key3) {
  2390. var value = this.get(key1, key2, key3);
  2391. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2392. if (!isArray(value) || !xref) {
  2393. return value;
  2394. }
  2395. value = value.slice();
  2396. for (var i = 0, ii = value.length; i < ii; i++) {
  2397. if (!isRef(value[i])) {
  2398. continue;
  2399. }
  2400. value[i] = xref.fetch(value[i], suppressEncryption);
  2401. }
  2402. return value;
  2403. },
  2404. getRaw: function Dict_getRaw(key) {
  2405. return this.map[key];
  2406. },
  2407. getKeys: function Dict_getKeys() {
  2408. return Object.keys(this.map);
  2409. },
  2410. set: function Dict_set(key, value) {
  2411. this.map[key] = value;
  2412. },
  2413. has: function Dict_has(key) {
  2414. return key in this.map;
  2415. },
  2416. forEach: function Dict_forEach(callback) {
  2417. for (var key in this.map) {
  2418. callback(key, this.get(key));
  2419. }
  2420. }
  2421. };
  2422. Dict.empty = new Dict(null);
  2423. Dict.merge = function Dict_merge(xref, dictArray) {
  2424. var mergedDict = new Dict(xref);
  2425. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  2426. var dict = dictArray[i];
  2427. if (!isDict(dict)) {
  2428. continue;
  2429. }
  2430. for (var keyName in dict.map) {
  2431. if (mergedDict.map[keyName]) {
  2432. continue;
  2433. }
  2434. mergedDict.map[keyName] = dict.map[keyName];
  2435. }
  2436. }
  2437. return mergedDict;
  2438. };
  2439. return Dict;
  2440. }();
  2441. var Ref = function RefClosure() {
  2442. function Ref(num, gen) {
  2443. this.num = num;
  2444. this.gen = gen;
  2445. }
  2446. Ref.prototype = {
  2447. toString: function Ref_toString() {
  2448. var str = this.num + 'R';
  2449. if (this.gen !== 0) {
  2450. str += this.gen;
  2451. }
  2452. return str;
  2453. }
  2454. };
  2455. return Ref;
  2456. }();
  2457. var RefSet = function RefSetClosure() {
  2458. function RefSet() {
  2459. this.dict = Object.create(null);
  2460. }
  2461. RefSet.prototype = {
  2462. has: function RefSet_has(ref) {
  2463. return ref.toString() in this.dict;
  2464. },
  2465. put: function RefSet_put(ref) {
  2466. this.dict[ref.toString()] = true;
  2467. },
  2468. remove: function RefSet_remove(ref) {
  2469. delete this.dict[ref.toString()];
  2470. }
  2471. };
  2472. return RefSet;
  2473. }();
  2474. var RefSetCache = function RefSetCacheClosure() {
  2475. function RefSetCache() {
  2476. this.dict = Object.create(null);
  2477. }
  2478. RefSetCache.prototype = {
  2479. get: function RefSetCache_get(ref) {
  2480. return this.dict[ref.toString()];
  2481. },
  2482. has: function RefSetCache_has(ref) {
  2483. return ref.toString() in this.dict;
  2484. },
  2485. put: function RefSetCache_put(ref, obj) {
  2486. this.dict[ref.toString()] = obj;
  2487. },
  2488. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  2489. this.dict[ref.toString()] = this.get(aliasRef);
  2490. },
  2491. forEach: function RefSetCache_forEach(fn, thisArg) {
  2492. for (var i in this.dict) {
  2493. fn.call(thisArg, this.dict[i]);
  2494. }
  2495. },
  2496. clear: function RefSetCache_clear() {
  2497. this.dict = Object.create(null);
  2498. }
  2499. };
  2500. return RefSetCache;
  2501. }();
  2502. function isEOF(v) {
  2503. return v === EOF;
  2504. }
  2505. function isName(v, name) {
  2506. return v instanceof Name && (name === undefined || v.name === name);
  2507. }
  2508. function isCmd(v, cmd) {
  2509. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  2510. }
  2511. function isDict(v, type) {
  2512. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  2513. }
  2514. function isRef(v) {
  2515. return v instanceof Ref;
  2516. }
  2517. function isRefsEqual(v1, v2) {
  2518. return v1.num === v2.num && v1.gen === v2.gen;
  2519. }
  2520. function isStream(v) {
  2521. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  2522. }
  2523. exports.EOF = EOF;
  2524. exports.Cmd = Cmd;
  2525. exports.Dict = Dict;
  2526. exports.Name = Name;
  2527. exports.Ref = Ref;
  2528. exports.RefSet = RefSet;
  2529. exports.RefSetCache = RefSetCache;
  2530. exports.isEOF = isEOF;
  2531. exports.isCmd = isCmd;
  2532. exports.isDict = isDict;
  2533. exports.isName = isName;
  2534. exports.isRef = isRef;
  2535. exports.isRefsEqual = isRefsEqual;
  2536. exports.isStream = isStream;
  2537. /***/ }),
  2538. /* 2 */
  2539. /***/ (function(module, exports, __w_pdfjs_require__) {
  2540. "use strict";
  2541. var sharedUtil = __w_pdfjs_require__(0);
  2542. var corePrimitives = __w_pdfjs_require__(1);
  2543. var coreJbig2 = __w_pdfjs_require__(28);
  2544. var coreJpg = __w_pdfjs_require__(29);
  2545. var coreJpx = __w_pdfjs_require__(14);
  2546. var Util = sharedUtil.Util;
  2547. var error = sharedUtil.error;
  2548. var info = sharedUtil.info;
  2549. var isInt = sharedUtil.isInt;
  2550. var isArray = sharedUtil.isArray;
  2551. var createObjectURL = sharedUtil.createObjectURL;
  2552. var shadow = sharedUtil.shadow;
  2553. var isSpace = sharedUtil.isSpace;
  2554. var Dict = corePrimitives.Dict;
  2555. var isDict = corePrimitives.isDict;
  2556. var isStream = corePrimitives.isStream;
  2557. var Jbig2Image = coreJbig2.Jbig2Image;
  2558. var JpegImage = coreJpg.JpegImage;
  2559. var JpxImage = coreJpx.JpxImage;
  2560. var Stream = function StreamClosure() {
  2561. function Stream(arrayBuffer, start, length, dict) {
  2562. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2563. this.start = start || 0;
  2564. this.pos = this.start;
  2565. this.end = start + length || this.bytes.length;
  2566. this.dict = dict;
  2567. }
  2568. Stream.prototype = {
  2569. get length() {
  2570. return this.end - this.start;
  2571. },
  2572. get isEmpty() {
  2573. return this.length === 0;
  2574. },
  2575. getByte: function Stream_getByte() {
  2576. if (this.pos >= this.end) {
  2577. return -1;
  2578. }
  2579. return this.bytes[this.pos++];
  2580. },
  2581. getUint16: function Stream_getUint16() {
  2582. var b0 = this.getByte();
  2583. var b1 = this.getByte();
  2584. if (b0 === -1 || b1 === -1) {
  2585. return -1;
  2586. }
  2587. return (b0 << 8) + b1;
  2588. },
  2589. getInt32: function Stream_getInt32() {
  2590. var b0 = this.getByte();
  2591. var b1 = this.getByte();
  2592. var b2 = this.getByte();
  2593. var b3 = this.getByte();
  2594. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2595. },
  2596. getBytes: function Stream_getBytes(length) {
  2597. var bytes = this.bytes;
  2598. var pos = this.pos;
  2599. var strEnd = this.end;
  2600. if (!length) {
  2601. return bytes.subarray(pos, strEnd);
  2602. }
  2603. var end = pos + length;
  2604. if (end > strEnd) {
  2605. end = strEnd;
  2606. }
  2607. this.pos = end;
  2608. return bytes.subarray(pos, end);
  2609. },
  2610. peekByte: function Stream_peekByte() {
  2611. var peekedByte = this.getByte();
  2612. this.pos--;
  2613. return peekedByte;
  2614. },
  2615. peekBytes: function Stream_peekBytes(length) {
  2616. var bytes = this.getBytes(length);
  2617. this.pos -= bytes.length;
  2618. return bytes;
  2619. },
  2620. skip: function Stream_skip(n) {
  2621. if (!n) {
  2622. n = 1;
  2623. }
  2624. this.pos += n;
  2625. },
  2626. reset: function Stream_reset() {
  2627. this.pos = this.start;
  2628. },
  2629. moveStart: function Stream_moveStart() {
  2630. this.start = this.pos;
  2631. },
  2632. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  2633. return new Stream(this.bytes.buffer, start, length, dict);
  2634. }
  2635. };
  2636. return Stream;
  2637. }();
  2638. var StringStream = function StringStreamClosure() {
  2639. function StringStream(str) {
  2640. var length = str.length;
  2641. var bytes = new Uint8Array(length);
  2642. for (var n = 0; n < length; ++n) {
  2643. bytes[n] = str.charCodeAt(n);
  2644. }
  2645. Stream.call(this, bytes);
  2646. }
  2647. StringStream.prototype = Stream.prototype;
  2648. return StringStream;
  2649. }();
  2650. var DecodeStream = function DecodeStreamClosure() {
  2651. var emptyBuffer = new Uint8Array(0);
  2652. function DecodeStream(maybeMinBufferLength) {
  2653. this.pos = 0;
  2654. this.bufferLength = 0;
  2655. this.eof = false;
  2656. this.buffer = emptyBuffer;
  2657. this.minBufferLength = 512;
  2658. if (maybeMinBufferLength) {
  2659. while (this.minBufferLength < maybeMinBufferLength) {
  2660. this.minBufferLength *= 2;
  2661. }
  2662. }
  2663. }
  2664. DecodeStream.prototype = {
  2665. get isEmpty() {
  2666. while (!this.eof && this.bufferLength === 0) {
  2667. this.readBlock();
  2668. }
  2669. return this.bufferLength === 0;
  2670. },
  2671. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  2672. var buffer = this.buffer;
  2673. if (requested <= buffer.byteLength) {
  2674. return buffer;
  2675. }
  2676. var size = this.minBufferLength;
  2677. while (size < requested) {
  2678. size *= 2;
  2679. }
  2680. var buffer2 = new Uint8Array(size);
  2681. buffer2.set(buffer);
  2682. return this.buffer = buffer2;
  2683. },
  2684. getByte: function DecodeStream_getByte() {
  2685. var pos = this.pos;
  2686. while (this.bufferLength <= pos) {
  2687. if (this.eof) {
  2688. return -1;
  2689. }
  2690. this.readBlock();
  2691. }
  2692. return this.buffer[this.pos++];
  2693. },
  2694. getUint16: function DecodeStream_getUint16() {
  2695. var b0 = this.getByte();
  2696. var b1 = this.getByte();
  2697. if (b0 === -1 || b1 === -1) {
  2698. return -1;
  2699. }
  2700. return (b0 << 8) + b1;
  2701. },
  2702. getInt32: function DecodeStream_getInt32() {
  2703. var b0 = this.getByte();
  2704. var b1 = this.getByte();
  2705. var b2 = this.getByte();
  2706. var b3 = this.getByte();
  2707. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2708. },
  2709. getBytes: function DecodeStream_getBytes(length) {
  2710. var end, pos = this.pos;
  2711. if (length) {
  2712. this.ensureBuffer(pos + length);
  2713. end = pos + length;
  2714. while (!this.eof && this.bufferLength < end) {
  2715. this.readBlock();
  2716. }
  2717. var bufEnd = this.bufferLength;
  2718. if (end > bufEnd) {
  2719. end = bufEnd;
  2720. }
  2721. } else {
  2722. while (!this.eof) {
  2723. this.readBlock();
  2724. }
  2725. end = this.bufferLength;
  2726. }
  2727. this.pos = end;
  2728. return this.buffer.subarray(pos, end);
  2729. },
  2730. peekByte: function DecodeStream_peekByte() {
  2731. var peekedByte = this.getByte();
  2732. this.pos--;
  2733. return peekedByte;
  2734. },
  2735. peekBytes: function DecodeStream_peekBytes(length) {
  2736. var bytes = this.getBytes(length);
  2737. this.pos -= bytes.length;
  2738. return bytes;
  2739. },
  2740. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  2741. var end = start + length;
  2742. while (this.bufferLength <= end && !this.eof) {
  2743. this.readBlock();
  2744. }
  2745. return new Stream(this.buffer, start, length, dict);
  2746. },
  2747. skip: function DecodeStream_skip(n) {
  2748. if (!n) {
  2749. n = 1;
  2750. }
  2751. this.pos += n;
  2752. },
  2753. reset: function DecodeStream_reset() {
  2754. this.pos = 0;
  2755. },
  2756. getBaseStreams: function DecodeStream_getBaseStreams() {
  2757. if (this.str && this.str.getBaseStreams) {
  2758. return this.str.getBaseStreams();
  2759. }
  2760. return [];
  2761. }
  2762. };
  2763. return DecodeStream;
  2764. }();
  2765. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  2766. function StreamsSequenceStream(streams) {
  2767. this.streams = streams;
  2768. DecodeStream.call(this, null);
  2769. }
  2770. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  2771. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  2772. var streams = this.streams;
  2773. if (streams.length === 0) {
  2774. this.eof = true;
  2775. return;
  2776. }
  2777. var stream = streams.shift();
  2778. var chunk = stream.getBytes();
  2779. var bufferLength = this.bufferLength;
  2780. var newLength = bufferLength + chunk.length;
  2781. var buffer = this.ensureBuffer(newLength);
  2782. buffer.set(chunk, bufferLength);
  2783. this.bufferLength = newLength;
  2784. };
  2785. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  2786. var baseStreams = [];
  2787. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  2788. var stream = this.streams[i];
  2789. if (stream.getBaseStreams) {
  2790. Util.appendToArray(baseStreams, stream.getBaseStreams());
  2791. }
  2792. }
  2793. return baseStreams;
  2794. };
  2795. return StreamsSequenceStream;
  2796. }();
  2797. var FlateStream = function FlateStreamClosure() {
  2798. var codeLenCodeMap = new Int32Array([
  2799. 16,
  2800. 17,
  2801. 18,
  2802. 0,
  2803. 8,
  2804. 7,
  2805. 9,
  2806. 6,
  2807. 10,
  2808. 5,
  2809. 11,
  2810. 4,
  2811. 12,
  2812. 3,
  2813. 13,
  2814. 2,
  2815. 14,
  2816. 1,
  2817. 15
  2818. ]);
  2819. var lengthDecode = new Int32Array([
  2820. 0x00003,
  2821. 0x00004,
  2822. 0x00005,
  2823. 0x00006,
  2824. 0x00007,
  2825. 0x00008,
  2826. 0x00009,
  2827. 0x0000a,
  2828. 0x1000b,
  2829. 0x1000d,
  2830. 0x1000f,
  2831. 0x10011,
  2832. 0x20013,
  2833. 0x20017,
  2834. 0x2001b,
  2835. 0x2001f,
  2836. 0x30023,
  2837. 0x3002b,
  2838. 0x30033,
  2839. 0x3003b,
  2840. 0x40043,
  2841. 0x40053,
  2842. 0x40063,
  2843. 0x40073,
  2844. 0x50083,
  2845. 0x500a3,
  2846. 0x500c3,
  2847. 0x500e3,
  2848. 0x00102,
  2849. 0x00102,
  2850. 0x00102
  2851. ]);
  2852. var distDecode = new Int32Array([
  2853. 0x00001,
  2854. 0x00002,
  2855. 0x00003,
  2856. 0x00004,
  2857. 0x10005,
  2858. 0x10007,
  2859. 0x20009,
  2860. 0x2000d,
  2861. 0x30011,
  2862. 0x30019,
  2863. 0x40021,
  2864. 0x40031,
  2865. 0x50041,
  2866. 0x50061,
  2867. 0x60081,
  2868. 0x600c1,
  2869. 0x70101,
  2870. 0x70181,
  2871. 0x80201,
  2872. 0x80301,
  2873. 0x90401,
  2874. 0x90601,
  2875. 0xa0801,
  2876. 0xa0c01,
  2877. 0xb1001,
  2878. 0xb1801,
  2879. 0xc2001,
  2880. 0xc3001,
  2881. 0xd4001,
  2882. 0xd6001
  2883. ]);
  2884. var fixedLitCodeTab = [
  2885. new Int32Array([
  2886. 0x70100,
  2887. 0x80050,
  2888. 0x80010,
  2889. 0x80118,
  2890. 0x70110,
  2891. 0x80070,
  2892. 0x80030,
  2893. 0x900c0,
  2894. 0x70108,
  2895. 0x80060,
  2896. 0x80020,
  2897. 0x900a0,
  2898. 0x80000,
  2899. 0x80080,
  2900. 0x80040,
  2901. 0x900e0,
  2902. 0x70104,
  2903. 0x80058,
  2904. 0x80018,
  2905. 0x90090,
  2906. 0x70114,
  2907. 0x80078,
  2908. 0x80038,
  2909. 0x900d0,
  2910. 0x7010c,
  2911. 0x80068,
  2912. 0x80028,
  2913. 0x900b0,
  2914. 0x80008,
  2915. 0x80088,
  2916. 0x80048,
  2917. 0x900f0,
  2918. 0x70102,
  2919. 0x80054,
  2920. 0x80014,
  2921. 0x8011c,
  2922. 0x70112,
  2923. 0x80074,
  2924. 0x80034,
  2925. 0x900c8,
  2926. 0x7010a,
  2927. 0x80064,
  2928. 0x80024,
  2929. 0x900a8,
  2930. 0x80004,
  2931. 0x80084,
  2932. 0x80044,
  2933. 0x900e8,
  2934. 0x70106,
  2935. 0x8005c,
  2936. 0x8001c,
  2937. 0x90098,
  2938. 0x70116,
  2939. 0x8007c,
  2940. 0x8003c,
  2941. 0x900d8,
  2942. 0x7010e,
  2943. 0x8006c,
  2944. 0x8002c,
  2945. 0x900b8,
  2946. 0x8000c,
  2947. 0x8008c,
  2948. 0x8004c,
  2949. 0x900f8,
  2950. 0x70101,
  2951. 0x80052,
  2952. 0x80012,
  2953. 0x8011a,
  2954. 0x70111,
  2955. 0x80072,
  2956. 0x80032,
  2957. 0x900c4,
  2958. 0x70109,
  2959. 0x80062,
  2960. 0x80022,
  2961. 0x900a4,
  2962. 0x80002,
  2963. 0x80082,
  2964. 0x80042,
  2965. 0x900e4,
  2966. 0x70105,
  2967. 0x8005a,
  2968. 0x8001a,
  2969. 0x90094,
  2970. 0x70115,
  2971. 0x8007a,
  2972. 0x8003a,
  2973. 0x900d4,
  2974. 0x7010d,
  2975. 0x8006a,
  2976. 0x8002a,
  2977. 0x900b4,
  2978. 0x8000a,
  2979. 0x8008a,
  2980. 0x8004a,
  2981. 0x900f4,
  2982. 0x70103,
  2983. 0x80056,
  2984. 0x80016,
  2985. 0x8011e,
  2986. 0x70113,
  2987. 0x80076,
  2988. 0x80036,
  2989. 0x900cc,
  2990. 0x7010b,
  2991. 0x80066,
  2992. 0x80026,
  2993. 0x900ac,
  2994. 0x80006,
  2995. 0x80086,
  2996. 0x80046,
  2997. 0x900ec,
  2998. 0x70107,
  2999. 0x8005e,
  3000. 0x8001e,
  3001. 0x9009c,
  3002. 0x70117,
  3003. 0x8007e,
  3004. 0x8003e,
  3005. 0x900dc,
  3006. 0x7010f,
  3007. 0x8006e,
  3008. 0x8002e,
  3009. 0x900bc,
  3010. 0x8000e,
  3011. 0x8008e,
  3012. 0x8004e,
  3013. 0x900fc,
  3014. 0x70100,
  3015. 0x80051,
  3016. 0x80011,
  3017. 0x80119,
  3018. 0x70110,
  3019. 0x80071,
  3020. 0x80031,
  3021. 0x900c2,
  3022. 0x70108,
  3023. 0x80061,
  3024. 0x80021,
  3025. 0x900a2,
  3026. 0x80001,
  3027. 0x80081,
  3028. 0x80041,
  3029. 0x900e2,
  3030. 0x70104,
  3031. 0x80059,
  3032. 0x80019,
  3033. 0x90092,
  3034. 0x70114,
  3035. 0x80079,
  3036. 0x80039,
  3037. 0x900d2,
  3038. 0x7010c,
  3039. 0x80069,
  3040. 0x80029,
  3041. 0x900b2,
  3042. 0x80009,
  3043. 0x80089,
  3044. 0x80049,
  3045. 0x900f2,
  3046. 0x70102,
  3047. 0x80055,
  3048. 0x80015,
  3049. 0x8011d,
  3050. 0x70112,
  3051. 0x80075,
  3052. 0x80035,
  3053. 0x900ca,
  3054. 0x7010a,
  3055. 0x80065,
  3056. 0x80025,
  3057. 0x900aa,
  3058. 0x80005,
  3059. 0x80085,
  3060. 0x80045,
  3061. 0x900ea,
  3062. 0x70106,
  3063. 0x8005d,
  3064. 0x8001d,
  3065. 0x9009a,
  3066. 0x70116,
  3067. 0x8007d,
  3068. 0x8003d,
  3069. 0x900da,
  3070. 0x7010e,
  3071. 0x8006d,
  3072. 0x8002d,
  3073. 0x900ba,
  3074. 0x8000d,
  3075. 0x8008d,
  3076. 0x8004d,
  3077. 0x900fa,
  3078. 0x70101,
  3079. 0x80053,
  3080. 0x80013,
  3081. 0x8011b,
  3082. 0x70111,
  3083. 0x80073,
  3084. 0x80033,
  3085. 0x900c6,
  3086. 0x70109,
  3087. 0x80063,
  3088. 0x80023,
  3089. 0x900a6,
  3090. 0x80003,
  3091. 0x80083,
  3092. 0x80043,
  3093. 0x900e6,
  3094. 0x70105,
  3095. 0x8005b,
  3096. 0x8001b,
  3097. 0x90096,
  3098. 0x70115,
  3099. 0x8007b,
  3100. 0x8003b,
  3101. 0x900d6,
  3102. 0x7010d,
  3103. 0x8006b,
  3104. 0x8002b,
  3105. 0x900b6,
  3106. 0x8000b,
  3107. 0x8008b,
  3108. 0x8004b,
  3109. 0x900f6,
  3110. 0x70103,
  3111. 0x80057,
  3112. 0x80017,
  3113. 0x8011f,
  3114. 0x70113,
  3115. 0x80077,
  3116. 0x80037,
  3117. 0x900ce,
  3118. 0x7010b,
  3119. 0x80067,
  3120. 0x80027,
  3121. 0x900ae,
  3122. 0x80007,
  3123. 0x80087,
  3124. 0x80047,
  3125. 0x900ee,
  3126. 0x70107,
  3127. 0x8005f,
  3128. 0x8001f,
  3129. 0x9009e,
  3130. 0x70117,
  3131. 0x8007f,
  3132. 0x8003f,
  3133. 0x900de,
  3134. 0x7010f,
  3135. 0x8006f,
  3136. 0x8002f,
  3137. 0x900be,
  3138. 0x8000f,
  3139. 0x8008f,
  3140. 0x8004f,
  3141. 0x900fe,
  3142. 0x70100,
  3143. 0x80050,
  3144. 0x80010,
  3145. 0x80118,
  3146. 0x70110,
  3147. 0x80070,
  3148. 0x80030,
  3149. 0x900c1,
  3150. 0x70108,
  3151. 0x80060,
  3152. 0x80020,
  3153. 0x900a1,
  3154. 0x80000,
  3155. 0x80080,
  3156. 0x80040,
  3157. 0x900e1,
  3158. 0x70104,
  3159. 0x80058,
  3160. 0x80018,
  3161. 0x90091,
  3162. 0x70114,
  3163. 0x80078,
  3164. 0x80038,
  3165. 0x900d1,
  3166. 0x7010c,
  3167. 0x80068,
  3168. 0x80028,
  3169. 0x900b1,
  3170. 0x80008,
  3171. 0x80088,
  3172. 0x80048,
  3173. 0x900f1,
  3174. 0x70102,
  3175. 0x80054,
  3176. 0x80014,
  3177. 0x8011c,
  3178. 0x70112,
  3179. 0x80074,
  3180. 0x80034,
  3181. 0x900c9,
  3182. 0x7010a,
  3183. 0x80064,
  3184. 0x80024,
  3185. 0x900a9,
  3186. 0x80004,
  3187. 0x80084,
  3188. 0x80044,
  3189. 0x900e9,
  3190. 0x70106,
  3191. 0x8005c,
  3192. 0x8001c,
  3193. 0x90099,
  3194. 0x70116,
  3195. 0x8007c,
  3196. 0x8003c,
  3197. 0x900d9,
  3198. 0x7010e,
  3199. 0x8006c,
  3200. 0x8002c,
  3201. 0x900b9,
  3202. 0x8000c,
  3203. 0x8008c,
  3204. 0x8004c,
  3205. 0x900f9,
  3206. 0x70101,
  3207. 0x80052,
  3208. 0x80012,
  3209. 0x8011a,
  3210. 0x70111,
  3211. 0x80072,
  3212. 0x80032,
  3213. 0x900c5,
  3214. 0x70109,
  3215. 0x80062,
  3216. 0x80022,
  3217. 0x900a5,
  3218. 0x80002,
  3219. 0x80082,
  3220. 0x80042,
  3221. 0x900e5,
  3222. 0x70105,
  3223. 0x8005a,
  3224. 0x8001a,
  3225. 0x90095,
  3226. 0x70115,
  3227. 0x8007a,
  3228. 0x8003a,
  3229. 0x900d5,
  3230. 0x7010d,
  3231. 0x8006a,
  3232. 0x8002a,
  3233. 0x900b5,
  3234. 0x8000a,
  3235. 0x8008a,
  3236. 0x8004a,
  3237. 0x900f5,
  3238. 0x70103,
  3239. 0x80056,
  3240. 0x80016,
  3241. 0x8011e,
  3242. 0x70113,
  3243. 0x80076,
  3244. 0x80036,
  3245. 0x900cd,
  3246. 0x7010b,
  3247. 0x80066,
  3248. 0x80026,
  3249. 0x900ad,
  3250. 0x80006,
  3251. 0x80086,
  3252. 0x80046,
  3253. 0x900ed,
  3254. 0x70107,
  3255. 0x8005e,
  3256. 0x8001e,
  3257. 0x9009d,
  3258. 0x70117,
  3259. 0x8007e,
  3260. 0x8003e,
  3261. 0x900dd,
  3262. 0x7010f,
  3263. 0x8006e,
  3264. 0x8002e,
  3265. 0x900bd,
  3266. 0x8000e,
  3267. 0x8008e,
  3268. 0x8004e,
  3269. 0x900fd,
  3270. 0x70100,
  3271. 0x80051,
  3272. 0x80011,
  3273. 0x80119,
  3274. 0x70110,
  3275. 0x80071,
  3276. 0x80031,
  3277. 0x900c3,
  3278. 0x70108,
  3279. 0x80061,
  3280. 0x80021,
  3281. 0x900a3,
  3282. 0x80001,
  3283. 0x80081,
  3284. 0x80041,
  3285. 0x900e3,
  3286. 0x70104,
  3287. 0x80059,
  3288. 0x80019,
  3289. 0x90093,
  3290. 0x70114,
  3291. 0x80079,
  3292. 0x80039,
  3293. 0x900d3,
  3294. 0x7010c,
  3295. 0x80069,
  3296. 0x80029,
  3297. 0x900b3,
  3298. 0x80009,
  3299. 0x80089,
  3300. 0x80049,
  3301. 0x900f3,
  3302. 0x70102,
  3303. 0x80055,
  3304. 0x80015,
  3305. 0x8011d,
  3306. 0x70112,
  3307. 0x80075,
  3308. 0x80035,
  3309. 0x900cb,
  3310. 0x7010a,
  3311. 0x80065,
  3312. 0x80025,
  3313. 0x900ab,
  3314. 0x80005,
  3315. 0x80085,
  3316. 0x80045,
  3317. 0x900eb,
  3318. 0x70106,
  3319. 0x8005d,
  3320. 0x8001d,
  3321. 0x9009b,
  3322. 0x70116,
  3323. 0x8007d,
  3324. 0x8003d,
  3325. 0x900db,
  3326. 0x7010e,
  3327. 0x8006d,
  3328. 0x8002d,
  3329. 0x900bb,
  3330. 0x8000d,
  3331. 0x8008d,
  3332. 0x8004d,
  3333. 0x900fb,
  3334. 0x70101,
  3335. 0x80053,
  3336. 0x80013,
  3337. 0x8011b,
  3338. 0x70111,
  3339. 0x80073,
  3340. 0x80033,
  3341. 0x900c7,
  3342. 0x70109,
  3343. 0x80063,
  3344. 0x80023,
  3345. 0x900a7,
  3346. 0x80003,
  3347. 0x80083,
  3348. 0x80043,
  3349. 0x900e7,
  3350. 0x70105,
  3351. 0x8005b,
  3352. 0x8001b,
  3353. 0x90097,
  3354. 0x70115,
  3355. 0x8007b,
  3356. 0x8003b,
  3357. 0x900d7,
  3358. 0x7010d,
  3359. 0x8006b,
  3360. 0x8002b,
  3361. 0x900b7,
  3362. 0x8000b,
  3363. 0x8008b,
  3364. 0x8004b,
  3365. 0x900f7,
  3366. 0x70103,
  3367. 0x80057,
  3368. 0x80017,
  3369. 0x8011f,
  3370. 0x70113,
  3371. 0x80077,
  3372. 0x80037,
  3373. 0x900cf,
  3374. 0x7010b,
  3375. 0x80067,
  3376. 0x80027,
  3377. 0x900af,
  3378. 0x80007,
  3379. 0x80087,
  3380. 0x80047,
  3381. 0x900ef,
  3382. 0x70107,
  3383. 0x8005f,
  3384. 0x8001f,
  3385. 0x9009f,
  3386. 0x70117,
  3387. 0x8007f,
  3388. 0x8003f,
  3389. 0x900df,
  3390. 0x7010f,
  3391. 0x8006f,
  3392. 0x8002f,
  3393. 0x900bf,
  3394. 0x8000f,
  3395. 0x8008f,
  3396. 0x8004f,
  3397. 0x900ff
  3398. ]),
  3399. 9
  3400. ];
  3401. var fixedDistCodeTab = [
  3402. new Int32Array([
  3403. 0x50000,
  3404. 0x50010,
  3405. 0x50008,
  3406. 0x50018,
  3407. 0x50004,
  3408. 0x50014,
  3409. 0x5000c,
  3410. 0x5001c,
  3411. 0x50002,
  3412. 0x50012,
  3413. 0x5000a,
  3414. 0x5001a,
  3415. 0x50006,
  3416. 0x50016,
  3417. 0x5000e,
  3418. 0x00000,
  3419. 0x50001,
  3420. 0x50011,
  3421. 0x50009,
  3422. 0x50019,
  3423. 0x50005,
  3424. 0x50015,
  3425. 0x5000d,
  3426. 0x5001d,
  3427. 0x50003,
  3428. 0x50013,
  3429. 0x5000b,
  3430. 0x5001b,
  3431. 0x50007,
  3432. 0x50017,
  3433. 0x5000f,
  3434. 0x00000
  3435. ]),
  3436. 5
  3437. ];
  3438. function FlateStream(str, maybeLength) {
  3439. this.str = str;
  3440. this.dict = str.dict;
  3441. var cmf = str.getByte();
  3442. var flg = str.getByte();
  3443. if (cmf === -1 || flg === -1) {
  3444. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  3445. }
  3446. if ((cmf & 0x0f) !== 0x08) {
  3447. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  3448. }
  3449. if (((cmf << 8) + flg) % 31 !== 0) {
  3450. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  3451. }
  3452. if (flg & 0x20) {
  3453. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  3454. }
  3455. this.codeSize = 0;
  3456. this.codeBuf = 0;
  3457. DecodeStream.call(this, maybeLength);
  3458. }
  3459. FlateStream.prototype = Object.create(DecodeStream.prototype);
  3460. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  3461. var str = this.str;
  3462. var codeSize = this.codeSize;
  3463. var codeBuf = this.codeBuf;
  3464. var b;
  3465. while (codeSize < bits) {
  3466. if ((b = str.getByte()) === -1) {
  3467. error('Bad encoding in flate stream');
  3468. }
  3469. codeBuf |= b << codeSize;
  3470. codeSize += 8;
  3471. }
  3472. b = codeBuf & (1 << bits) - 1;
  3473. this.codeBuf = codeBuf >> bits;
  3474. this.codeSize = codeSize -= bits;
  3475. return b;
  3476. };
  3477. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  3478. var str = this.str;
  3479. var codes = table[0];
  3480. var maxLen = table[1];
  3481. var codeSize = this.codeSize;
  3482. var codeBuf = this.codeBuf;
  3483. var b;
  3484. while (codeSize < maxLen) {
  3485. if ((b = str.getByte()) === -1) {
  3486. break;
  3487. }
  3488. codeBuf |= b << codeSize;
  3489. codeSize += 8;
  3490. }
  3491. var code = codes[codeBuf & (1 << maxLen) - 1];
  3492. var codeLen = code >> 16;
  3493. var codeVal = code & 0xffff;
  3494. if (codeLen < 1 || codeSize < codeLen) {
  3495. error('Bad encoding in flate stream');
  3496. }
  3497. this.codeBuf = codeBuf >> codeLen;
  3498. this.codeSize = codeSize - codeLen;
  3499. return codeVal;
  3500. };
  3501. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  3502. var n = lengths.length;
  3503. var maxLen = 0;
  3504. var i;
  3505. for (i = 0; i < n; ++i) {
  3506. if (lengths[i] > maxLen) {
  3507. maxLen = lengths[i];
  3508. }
  3509. }
  3510. var size = 1 << maxLen;
  3511. var codes = new Int32Array(size);
  3512. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  3513. for (var val = 0; val < n; ++val) {
  3514. if (lengths[val] === len) {
  3515. var code2 = 0;
  3516. var t = code;
  3517. for (i = 0; i < len; ++i) {
  3518. code2 = code2 << 1 | t & 1;
  3519. t >>= 1;
  3520. }
  3521. for (i = code2; i < size; i += skip) {
  3522. codes[i] = len << 16 | val;
  3523. }
  3524. ++code;
  3525. }
  3526. }
  3527. }
  3528. return [
  3529. codes,
  3530. maxLen
  3531. ];
  3532. };
  3533. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  3534. var buffer, len;
  3535. var str = this.str;
  3536. var hdr = this.getBits(3);
  3537. if (hdr & 1) {
  3538. this.eof = true;
  3539. }
  3540. hdr >>= 1;
  3541. if (hdr === 0) {
  3542. var b;
  3543. if ((b = str.getByte()) === -1) {
  3544. error('Bad block header in flate stream');
  3545. }
  3546. var blockLen = b;
  3547. if ((b = str.getByte()) === -1) {
  3548. error('Bad block header in flate stream');
  3549. }
  3550. blockLen |= b << 8;
  3551. if ((b = str.getByte()) === -1) {
  3552. error('Bad block header in flate stream');
  3553. }
  3554. var check = b;
  3555. if ((b = str.getByte()) === -1) {
  3556. error('Bad block header in flate stream');
  3557. }
  3558. check |= b << 8;
  3559. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  3560. error('Bad uncompressed block length in flate stream');
  3561. }
  3562. this.codeBuf = 0;
  3563. this.codeSize = 0;
  3564. var bufferLength = this.bufferLength;
  3565. buffer = this.ensureBuffer(bufferLength + blockLen);
  3566. var end = bufferLength + blockLen;
  3567. this.bufferLength = end;
  3568. if (blockLen === 0) {
  3569. if (str.peekByte() === -1) {
  3570. this.eof = true;
  3571. }
  3572. } else {
  3573. for (var n = bufferLength; n < end; ++n) {
  3574. if ((b = str.getByte()) === -1) {
  3575. this.eof = true;
  3576. break;
  3577. }
  3578. buffer[n] = b;
  3579. }
  3580. }
  3581. return;
  3582. }
  3583. var litCodeTable;
  3584. var distCodeTable;
  3585. if (hdr === 1) {
  3586. litCodeTable = fixedLitCodeTab;
  3587. distCodeTable = fixedDistCodeTab;
  3588. } else if (hdr === 2) {
  3589. var numLitCodes = this.getBits(5) + 257;
  3590. var numDistCodes = this.getBits(5) + 1;
  3591. var numCodeLenCodes = this.getBits(4) + 4;
  3592. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  3593. var i;
  3594. for (i = 0; i < numCodeLenCodes; ++i) {
  3595. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  3596. }
  3597. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  3598. len = 0;
  3599. i = 0;
  3600. var codes = numLitCodes + numDistCodes;
  3601. var codeLengths = new Uint8Array(codes);
  3602. var bitsLength, bitsOffset, what;
  3603. while (i < codes) {
  3604. var code = this.getCode(codeLenCodeTab);
  3605. if (code === 16) {
  3606. bitsLength = 2;
  3607. bitsOffset = 3;
  3608. what = len;
  3609. } else if (code === 17) {
  3610. bitsLength = 3;
  3611. bitsOffset = 3;
  3612. what = len = 0;
  3613. } else if (code === 18) {
  3614. bitsLength = 7;
  3615. bitsOffset = 11;
  3616. what = len = 0;
  3617. } else {
  3618. codeLengths[i++] = len = code;
  3619. continue;
  3620. }
  3621. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  3622. while (repeatLength-- > 0) {
  3623. codeLengths[i++] = what;
  3624. }
  3625. }
  3626. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  3627. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  3628. } else {
  3629. error('Unknown block type in flate stream');
  3630. }
  3631. buffer = this.buffer;
  3632. var limit = buffer ? buffer.length : 0;
  3633. var pos = this.bufferLength;
  3634. while (true) {
  3635. var code1 = this.getCode(litCodeTable);
  3636. if (code1 < 256) {
  3637. if (pos + 1 >= limit) {
  3638. buffer = this.ensureBuffer(pos + 1);
  3639. limit = buffer.length;
  3640. }
  3641. buffer[pos++] = code1;
  3642. continue;
  3643. }
  3644. if (code1 === 256) {
  3645. this.bufferLength = pos;
  3646. return;
  3647. }
  3648. code1 -= 257;
  3649. code1 = lengthDecode[code1];
  3650. var code2 = code1 >> 16;
  3651. if (code2 > 0) {
  3652. code2 = this.getBits(code2);
  3653. }
  3654. len = (code1 & 0xffff) + code2;
  3655. code1 = this.getCode(distCodeTable);
  3656. code1 = distDecode[code1];
  3657. code2 = code1 >> 16;
  3658. if (code2 > 0) {
  3659. code2 = this.getBits(code2);
  3660. }
  3661. var dist = (code1 & 0xffff) + code2;
  3662. if (pos + len >= limit) {
  3663. buffer = this.ensureBuffer(pos + len);
  3664. limit = buffer.length;
  3665. }
  3666. for (var k = 0; k < len; ++k, ++pos) {
  3667. buffer[pos] = buffer[pos - dist];
  3668. }
  3669. }
  3670. };
  3671. return FlateStream;
  3672. }();
  3673. var PredictorStream = function PredictorStreamClosure() {
  3674. function PredictorStream(str, maybeLength, params) {
  3675. if (!isDict(params)) {
  3676. return str;
  3677. }
  3678. var predictor = this.predictor = params.get('Predictor') || 1;
  3679. if (predictor <= 1) {
  3680. return str;
  3681. }
  3682. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  3683. error('Unsupported predictor: ' + predictor);
  3684. }
  3685. if (predictor === 2) {
  3686. this.readBlock = this.readBlockTiff;
  3687. } else {
  3688. this.readBlock = this.readBlockPng;
  3689. }
  3690. this.str = str;
  3691. this.dict = str.dict;
  3692. var colors = this.colors = params.get('Colors') || 1;
  3693. var bits = this.bits = params.get('BitsPerComponent') || 8;
  3694. var columns = this.columns = params.get('Columns') || 1;
  3695. this.pixBytes = colors * bits + 7 >> 3;
  3696. this.rowBytes = columns * colors * bits + 7 >> 3;
  3697. DecodeStream.call(this, maybeLength);
  3698. return this;
  3699. }
  3700. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  3701. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  3702. var rowBytes = this.rowBytes;
  3703. var bufferLength = this.bufferLength;
  3704. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3705. var bits = this.bits;
  3706. var colors = this.colors;
  3707. var rawBytes = this.str.getBytes(rowBytes);
  3708. this.eof = !rawBytes.length;
  3709. if (this.eof) {
  3710. return;
  3711. }
  3712. var inbuf = 0, outbuf = 0;
  3713. var inbits = 0, outbits = 0;
  3714. var pos = bufferLength;
  3715. var i;
  3716. if (bits === 1 && colors === 1) {
  3717. for (i = 0; i < rowBytes; ++i) {
  3718. var c = rawBytes[i] ^ inbuf;
  3719. c ^= c >> 1;
  3720. c ^= c >> 2;
  3721. c ^= c >> 4;
  3722. inbuf = (c & 1) << 7;
  3723. buffer[pos++] = c;
  3724. }
  3725. } else if (bits === 8) {
  3726. for (i = 0; i < colors; ++i) {
  3727. buffer[pos++] = rawBytes[i];
  3728. }
  3729. for (; i < rowBytes; ++i) {
  3730. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  3731. pos++;
  3732. }
  3733. } else {
  3734. var compArray = new Uint8Array(colors + 1);
  3735. var bitMask = (1 << bits) - 1;
  3736. var j = 0, k = bufferLength;
  3737. var columns = this.columns;
  3738. for (i = 0; i < columns; ++i) {
  3739. for (var kk = 0; kk < colors; ++kk) {
  3740. if (inbits < bits) {
  3741. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  3742. inbits += 8;
  3743. }
  3744. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  3745. inbits -= bits;
  3746. outbuf = outbuf << bits | compArray[kk];
  3747. outbits += bits;
  3748. if (outbits >= 8) {
  3749. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  3750. outbits -= 8;
  3751. }
  3752. }
  3753. }
  3754. if (outbits > 0) {
  3755. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  3756. }
  3757. }
  3758. this.bufferLength += rowBytes;
  3759. };
  3760. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  3761. var rowBytes = this.rowBytes;
  3762. var pixBytes = this.pixBytes;
  3763. var predictor = this.str.getByte();
  3764. var rawBytes = this.str.getBytes(rowBytes);
  3765. this.eof = !rawBytes.length;
  3766. if (this.eof) {
  3767. return;
  3768. }
  3769. var bufferLength = this.bufferLength;
  3770. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3771. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  3772. if (prevRow.length === 0) {
  3773. prevRow = new Uint8Array(rowBytes);
  3774. }
  3775. var i, j = bufferLength, up, c;
  3776. switch (predictor) {
  3777. case 0:
  3778. for (i = 0; i < rowBytes; ++i) {
  3779. buffer[j++] = rawBytes[i];
  3780. }
  3781. break;
  3782. case 1:
  3783. for (i = 0; i < pixBytes; ++i) {
  3784. buffer[j++] = rawBytes[i];
  3785. }
  3786. for (; i < rowBytes; ++i) {
  3787. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  3788. j++;
  3789. }
  3790. break;
  3791. case 2:
  3792. for (i = 0; i < rowBytes; ++i) {
  3793. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  3794. }
  3795. break;
  3796. case 3:
  3797. for (i = 0; i < pixBytes; ++i) {
  3798. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  3799. }
  3800. for (; i < rowBytes; ++i) {
  3801. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  3802. j++;
  3803. }
  3804. break;
  3805. case 4:
  3806. for (i = 0; i < pixBytes; ++i) {
  3807. up = prevRow[i];
  3808. c = rawBytes[i];
  3809. buffer[j++] = up + c;
  3810. }
  3811. for (; i < rowBytes; ++i) {
  3812. up = prevRow[i];
  3813. var upLeft = prevRow[i - pixBytes];
  3814. var left = buffer[j - pixBytes];
  3815. var p = left + up - upLeft;
  3816. var pa = p - left;
  3817. if (pa < 0) {
  3818. pa = -pa;
  3819. }
  3820. var pb = p - up;
  3821. if (pb < 0) {
  3822. pb = -pb;
  3823. }
  3824. var pc = p - upLeft;
  3825. if (pc < 0) {
  3826. pc = -pc;
  3827. }
  3828. c = rawBytes[i];
  3829. if (pa <= pb && pa <= pc) {
  3830. buffer[j++] = left + c;
  3831. } else if (pb <= pc) {
  3832. buffer[j++] = up + c;
  3833. } else {
  3834. buffer[j++] = upLeft + c;
  3835. }
  3836. }
  3837. break;
  3838. default:
  3839. error('Unsupported predictor: ' + predictor);
  3840. }
  3841. this.bufferLength += rowBytes;
  3842. };
  3843. return PredictorStream;
  3844. }();
  3845. var JpegStream = function JpegStreamClosure() {
  3846. function JpegStream(stream, maybeLength, dict, params) {
  3847. var ch;
  3848. while ((ch = stream.getByte()) !== -1) {
  3849. if (ch === 0xFF) {
  3850. stream.skip(-1);
  3851. break;
  3852. }
  3853. }
  3854. this.stream = stream;
  3855. this.maybeLength = maybeLength;
  3856. this.dict = dict;
  3857. this.params = params;
  3858. DecodeStream.call(this, maybeLength);
  3859. }
  3860. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3861. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3862. get: function JpegStream_bytes() {
  3863. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3864. },
  3865. configurable: true
  3866. });
  3867. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3868. if (this.bufferLength) {
  3869. return;
  3870. }
  3871. var jpegImage = new JpegImage();
  3872. var decodeArr = this.dict.getArray('Decode', 'D');
  3873. if (this.forceRGB && isArray(decodeArr)) {
  3874. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3875. var decodeArrLength = decodeArr.length;
  3876. var transform = new Int32Array(decodeArrLength);
  3877. var transformNeeded = false;
  3878. var maxValue = (1 << bitsPerComponent) - 1;
  3879. for (var i = 0; i < decodeArrLength; i += 2) {
  3880. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3881. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3882. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3883. transformNeeded = true;
  3884. }
  3885. }
  3886. if (transformNeeded) {
  3887. jpegImage.decodeTransform = transform;
  3888. }
  3889. }
  3890. if (isDict(this.params)) {
  3891. var colorTransform = this.params.get('ColorTransform');
  3892. if (isInt(colorTransform)) {
  3893. jpegImage.colorTransform = colorTransform;
  3894. }
  3895. }
  3896. jpegImage.parse(this.bytes);
  3897. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3898. this.buffer = data;
  3899. this.bufferLength = data.length;
  3900. this.eof = true;
  3901. };
  3902. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3903. this.ensureBuffer();
  3904. return this.buffer;
  3905. };
  3906. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3907. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3908. };
  3909. return JpegStream;
  3910. }();
  3911. var JpxStream = function JpxStreamClosure() {
  3912. function JpxStream(stream, maybeLength, dict, params) {
  3913. this.stream = stream;
  3914. this.maybeLength = maybeLength;
  3915. this.dict = dict;
  3916. this.params = params;
  3917. DecodeStream.call(this, maybeLength);
  3918. }
  3919. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3920. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3921. get: function JpxStream_bytes() {
  3922. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3923. },
  3924. configurable: true
  3925. });
  3926. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3927. if (this.bufferLength) {
  3928. return;
  3929. }
  3930. var jpxImage = new JpxImage();
  3931. jpxImage.parse(this.bytes);
  3932. var width = jpxImage.width;
  3933. var height = jpxImage.height;
  3934. var componentsCount = jpxImage.componentsCount;
  3935. var tileCount = jpxImage.tiles.length;
  3936. if (tileCount === 1) {
  3937. this.buffer = jpxImage.tiles[0].items;
  3938. } else {
  3939. var data = new Uint8Array(width * height * componentsCount);
  3940. for (var k = 0; k < tileCount; k++) {
  3941. var tileComponents = jpxImage.tiles[k];
  3942. var tileWidth = tileComponents.width;
  3943. var tileHeight = tileComponents.height;
  3944. var tileLeft = tileComponents.left;
  3945. var tileTop = tileComponents.top;
  3946. var src = tileComponents.items;
  3947. var srcPosition = 0;
  3948. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3949. var imgRowSize = width * componentsCount;
  3950. var tileRowSize = tileWidth * componentsCount;
  3951. for (var j = 0; j < tileHeight; j++) {
  3952. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3953. data.set(rowBytes, dataPosition);
  3954. srcPosition += tileRowSize;
  3955. dataPosition += imgRowSize;
  3956. }
  3957. }
  3958. this.buffer = data;
  3959. }
  3960. this.bufferLength = this.buffer.length;
  3961. this.eof = true;
  3962. };
  3963. return JpxStream;
  3964. }();
  3965. var Jbig2Stream = function Jbig2StreamClosure() {
  3966. function Jbig2Stream(stream, maybeLength, dict, params) {
  3967. this.stream = stream;
  3968. this.maybeLength = maybeLength;
  3969. this.dict = dict;
  3970. this.params = params;
  3971. DecodeStream.call(this, maybeLength);
  3972. }
  3973. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3974. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3975. get: function Jbig2Stream_bytes() {
  3976. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3977. },
  3978. configurable: true
  3979. });
  3980. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3981. if (this.bufferLength) {
  3982. return;
  3983. }
  3984. var jbig2Image = new Jbig2Image();
  3985. var chunks = [];
  3986. if (isDict(this.params)) {
  3987. var globalsStream = this.params.get('JBIG2Globals');
  3988. if (isStream(globalsStream)) {
  3989. var globals = globalsStream.getBytes();
  3990. chunks.push({
  3991. data: globals,
  3992. start: 0,
  3993. end: globals.length
  3994. });
  3995. }
  3996. }
  3997. chunks.push({
  3998. data: this.bytes,
  3999. start: 0,
  4000. end: this.bytes.length
  4001. });
  4002. var data = jbig2Image.parseChunks(chunks);
  4003. var dataLength = data.length;
  4004. for (var i = 0; i < dataLength; i++) {
  4005. data[i] ^= 0xFF;
  4006. }
  4007. this.buffer = data;
  4008. this.bufferLength = dataLength;
  4009. this.eof = true;
  4010. };
  4011. return Jbig2Stream;
  4012. }();
  4013. var DecryptStream = function DecryptStreamClosure() {
  4014. function DecryptStream(str, maybeLength, decrypt) {
  4015. this.str = str;
  4016. this.dict = str.dict;
  4017. this.decrypt = decrypt;
  4018. this.nextChunk = null;
  4019. this.initialized = false;
  4020. DecodeStream.call(this, maybeLength);
  4021. }
  4022. var chunkSize = 512;
  4023. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  4024. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  4025. var chunk;
  4026. if (this.initialized) {
  4027. chunk = this.nextChunk;
  4028. } else {
  4029. chunk = this.str.getBytes(chunkSize);
  4030. this.initialized = true;
  4031. }
  4032. if (!chunk || chunk.length === 0) {
  4033. this.eof = true;
  4034. return;
  4035. }
  4036. this.nextChunk = this.str.getBytes(chunkSize);
  4037. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  4038. var decrypt = this.decrypt;
  4039. chunk = decrypt(chunk, !hasMoreData);
  4040. var bufferLength = this.bufferLength;
  4041. var i, n = chunk.length;
  4042. var buffer = this.ensureBuffer(bufferLength + n);
  4043. for (i = 0; i < n; i++) {
  4044. buffer[bufferLength++] = chunk[i];
  4045. }
  4046. this.bufferLength = bufferLength;
  4047. };
  4048. return DecryptStream;
  4049. }();
  4050. var Ascii85Stream = function Ascii85StreamClosure() {
  4051. function Ascii85Stream(str, maybeLength) {
  4052. this.str = str;
  4053. this.dict = str.dict;
  4054. this.input = new Uint8Array(5);
  4055. if (maybeLength) {
  4056. maybeLength = 0.8 * maybeLength;
  4057. }
  4058. DecodeStream.call(this, maybeLength);
  4059. }
  4060. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  4061. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  4062. var TILDA_CHAR = 0x7E;
  4063. var Z_LOWER_CHAR = 0x7A;
  4064. var EOF = -1;
  4065. var str = this.str;
  4066. var c = str.getByte();
  4067. while (isSpace(c)) {
  4068. c = str.getByte();
  4069. }
  4070. if (c === EOF || c === TILDA_CHAR) {
  4071. this.eof = true;
  4072. return;
  4073. }
  4074. var bufferLength = this.bufferLength, buffer;
  4075. var i;
  4076. if (c === Z_LOWER_CHAR) {
  4077. buffer = this.ensureBuffer(bufferLength + 4);
  4078. for (i = 0; i < 4; ++i) {
  4079. buffer[bufferLength + i] = 0;
  4080. }
  4081. this.bufferLength += 4;
  4082. } else {
  4083. var input = this.input;
  4084. input[0] = c;
  4085. for (i = 1; i < 5; ++i) {
  4086. c = str.getByte();
  4087. while (isSpace(c)) {
  4088. c = str.getByte();
  4089. }
  4090. input[i] = c;
  4091. if (c === EOF || c === TILDA_CHAR) {
  4092. break;
  4093. }
  4094. }
  4095. buffer = this.ensureBuffer(bufferLength + i - 1);
  4096. this.bufferLength += i - 1;
  4097. if (i < 5) {
  4098. for (; i < 5; ++i) {
  4099. input[i] = 0x21 + 84;
  4100. }
  4101. this.eof = true;
  4102. }
  4103. var t = 0;
  4104. for (i = 0; i < 5; ++i) {
  4105. t = t * 85 + (input[i] - 0x21);
  4106. }
  4107. for (i = 3; i >= 0; --i) {
  4108. buffer[bufferLength + i] = t & 0xFF;
  4109. t >>= 8;
  4110. }
  4111. }
  4112. };
  4113. return Ascii85Stream;
  4114. }();
  4115. var AsciiHexStream = function AsciiHexStreamClosure() {
  4116. function AsciiHexStream(str, maybeLength) {
  4117. this.str = str;
  4118. this.dict = str.dict;
  4119. this.firstDigit = -1;
  4120. if (maybeLength) {
  4121. maybeLength = 0.5 * maybeLength;
  4122. }
  4123. DecodeStream.call(this, maybeLength);
  4124. }
  4125. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  4126. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  4127. var UPSTREAM_BLOCK_SIZE = 8000;
  4128. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  4129. if (!bytes.length) {
  4130. this.eof = true;
  4131. return;
  4132. }
  4133. var maxDecodeLength = bytes.length + 1 >> 1;
  4134. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  4135. var bufferLength = this.bufferLength;
  4136. var firstDigit = this.firstDigit;
  4137. for (var i = 0, ii = bytes.length; i < ii; i++) {
  4138. var ch = bytes[i], digit;
  4139. if (ch >= 0x30 && ch <= 0x39) {
  4140. digit = ch & 0x0F;
  4141. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  4142. digit = (ch & 0x0F) + 9;
  4143. } else if (ch === 0x3E) {
  4144. this.eof = true;
  4145. break;
  4146. } else {
  4147. continue;
  4148. }
  4149. if (firstDigit < 0) {
  4150. firstDigit = digit;
  4151. } else {
  4152. buffer[bufferLength++] = firstDigit << 4 | digit;
  4153. firstDigit = -1;
  4154. }
  4155. }
  4156. if (firstDigit >= 0 && this.eof) {
  4157. buffer[bufferLength++] = firstDigit << 4;
  4158. firstDigit = -1;
  4159. }
  4160. this.firstDigit = firstDigit;
  4161. this.bufferLength = bufferLength;
  4162. };
  4163. return AsciiHexStream;
  4164. }();
  4165. var RunLengthStream = function RunLengthStreamClosure() {
  4166. function RunLengthStream(str, maybeLength) {
  4167. this.str = str;
  4168. this.dict = str.dict;
  4169. DecodeStream.call(this, maybeLength);
  4170. }
  4171. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  4172. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  4173. var repeatHeader = this.str.getBytes(2);
  4174. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  4175. this.eof = true;
  4176. return;
  4177. }
  4178. var buffer;
  4179. var bufferLength = this.bufferLength;
  4180. var n = repeatHeader[0];
  4181. if (n < 128) {
  4182. buffer = this.ensureBuffer(bufferLength + n + 1);
  4183. buffer[bufferLength++] = repeatHeader[1];
  4184. if (n > 0) {
  4185. var source = this.str.getBytes(n);
  4186. buffer.set(source, bufferLength);
  4187. bufferLength += n;
  4188. }
  4189. } else {
  4190. n = 257 - n;
  4191. var b = repeatHeader[1];
  4192. buffer = this.ensureBuffer(bufferLength + n + 1);
  4193. for (var i = 0; i < n; i++) {
  4194. buffer[bufferLength++] = b;
  4195. }
  4196. }
  4197. this.bufferLength = bufferLength;
  4198. };
  4199. return RunLengthStream;
  4200. }();
  4201. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  4202. var ccittEOL = -2;
  4203. var ccittEOF = -1;
  4204. var twoDimPass = 0;
  4205. var twoDimHoriz = 1;
  4206. var twoDimVert0 = 2;
  4207. var twoDimVertR1 = 3;
  4208. var twoDimVertL1 = 4;
  4209. var twoDimVertR2 = 5;
  4210. var twoDimVertL2 = 6;
  4211. var twoDimVertR3 = 7;
  4212. var twoDimVertL3 = 8;
  4213. var twoDimTable = [
  4214. [
  4215. -1,
  4216. -1
  4217. ],
  4218. [
  4219. -1,
  4220. -1
  4221. ],
  4222. [
  4223. 7,
  4224. twoDimVertL3
  4225. ],
  4226. [
  4227. 7,
  4228. twoDimVertR3
  4229. ],
  4230. [
  4231. 6,
  4232. twoDimVertL2
  4233. ],
  4234. [
  4235. 6,
  4236. twoDimVertL2
  4237. ],
  4238. [
  4239. 6,
  4240. twoDimVertR2
  4241. ],
  4242. [
  4243. 6,
  4244. twoDimVertR2
  4245. ],
  4246. [
  4247. 4,
  4248. twoDimPass
  4249. ],
  4250. [
  4251. 4,
  4252. twoDimPass
  4253. ],
  4254. [
  4255. 4,
  4256. twoDimPass
  4257. ],
  4258. [
  4259. 4,
  4260. twoDimPass
  4261. ],
  4262. [
  4263. 4,
  4264. twoDimPass
  4265. ],
  4266. [
  4267. 4,
  4268. twoDimPass
  4269. ],
  4270. [
  4271. 4,
  4272. twoDimPass
  4273. ],
  4274. [
  4275. 4,
  4276. twoDimPass
  4277. ],
  4278. [
  4279. 3,
  4280. twoDimHoriz
  4281. ],
  4282. [
  4283. 3,
  4284. twoDimHoriz
  4285. ],
  4286. [
  4287. 3,
  4288. twoDimHoriz
  4289. ],
  4290. [
  4291. 3,
  4292. twoDimHoriz
  4293. ],
  4294. [
  4295. 3,
  4296. twoDimHoriz
  4297. ],
  4298. [
  4299. 3,
  4300. twoDimHoriz
  4301. ],
  4302. [
  4303. 3,
  4304. twoDimHoriz
  4305. ],
  4306. [
  4307. 3,
  4308. twoDimHoriz
  4309. ],
  4310. [
  4311. 3,
  4312. twoDimHoriz
  4313. ],
  4314. [
  4315. 3,
  4316. twoDimHoriz
  4317. ],
  4318. [
  4319. 3,
  4320. twoDimHoriz
  4321. ],
  4322. [
  4323. 3,
  4324. twoDimHoriz
  4325. ],
  4326. [
  4327. 3,
  4328. twoDimHoriz
  4329. ],
  4330. [
  4331. 3,
  4332. twoDimHoriz
  4333. ],
  4334. [
  4335. 3,
  4336. twoDimHoriz
  4337. ],
  4338. [
  4339. 3,
  4340. twoDimHoriz
  4341. ],
  4342. [
  4343. 3,
  4344. twoDimVertL1
  4345. ],
  4346. [
  4347. 3,
  4348. twoDimVertL1
  4349. ],
  4350. [
  4351. 3,
  4352. twoDimVertL1
  4353. ],
  4354. [
  4355. 3,
  4356. twoDimVertL1
  4357. ],
  4358. [
  4359. 3,
  4360. twoDimVertL1
  4361. ],
  4362. [
  4363. 3,
  4364. twoDimVertL1
  4365. ],
  4366. [
  4367. 3,
  4368. twoDimVertL1
  4369. ],
  4370. [
  4371. 3,
  4372. twoDimVertL1
  4373. ],
  4374. [
  4375. 3,
  4376. twoDimVertL1
  4377. ],
  4378. [
  4379. 3,
  4380. twoDimVertL1
  4381. ],
  4382. [
  4383. 3,
  4384. twoDimVertL1
  4385. ],
  4386. [
  4387. 3,
  4388. twoDimVertL1
  4389. ],
  4390. [
  4391. 3,
  4392. twoDimVertL1
  4393. ],
  4394. [
  4395. 3,
  4396. twoDimVertL1
  4397. ],
  4398. [
  4399. 3,
  4400. twoDimVertL1
  4401. ],
  4402. [
  4403. 3,
  4404. twoDimVertL1
  4405. ],
  4406. [
  4407. 3,
  4408. twoDimVertR1
  4409. ],
  4410. [
  4411. 3,
  4412. twoDimVertR1
  4413. ],
  4414. [
  4415. 3,
  4416. twoDimVertR1
  4417. ],
  4418. [
  4419. 3,
  4420. twoDimVertR1
  4421. ],
  4422. [
  4423. 3,
  4424. twoDimVertR1
  4425. ],
  4426. [
  4427. 3,
  4428. twoDimVertR1
  4429. ],
  4430. [
  4431. 3,
  4432. twoDimVertR1
  4433. ],
  4434. [
  4435. 3,
  4436. twoDimVertR1
  4437. ],
  4438. [
  4439. 3,
  4440. twoDimVertR1
  4441. ],
  4442. [
  4443. 3,
  4444. twoDimVertR1
  4445. ],
  4446. [
  4447. 3,
  4448. twoDimVertR1
  4449. ],
  4450. [
  4451. 3,
  4452. twoDimVertR1
  4453. ],
  4454. [
  4455. 3,
  4456. twoDimVertR1
  4457. ],
  4458. [
  4459. 3,
  4460. twoDimVertR1
  4461. ],
  4462. [
  4463. 3,
  4464. twoDimVertR1
  4465. ],
  4466. [
  4467. 3,
  4468. twoDimVertR1
  4469. ],
  4470. [
  4471. 1,
  4472. twoDimVert0
  4473. ],
  4474. [
  4475. 1,
  4476. twoDimVert0
  4477. ],
  4478. [
  4479. 1,
  4480. twoDimVert0
  4481. ],
  4482. [
  4483. 1,
  4484. twoDimVert0
  4485. ],
  4486. [
  4487. 1,
  4488. twoDimVert0
  4489. ],
  4490. [
  4491. 1,
  4492. twoDimVert0
  4493. ],
  4494. [
  4495. 1,
  4496. twoDimVert0
  4497. ],
  4498. [
  4499. 1,
  4500. twoDimVert0
  4501. ],
  4502. [
  4503. 1,
  4504. twoDimVert0
  4505. ],
  4506. [
  4507. 1,
  4508. twoDimVert0
  4509. ],
  4510. [
  4511. 1,
  4512. twoDimVert0
  4513. ],
  4514. [
  4515. 1,
  4516. twoDimVert0
  4517. ],
  4518. [
  4519. 1,
  4520. twoDimVert0
  4521. ],
  4522. [
  4523. 1,
  4524. twoDimVert0
  4525. ],
  4526. [
  4527. 1,
  4528. twoDimVert0
  4529. ],
  4530. [
  4531. 1,
  4532. twoDimVert0
  4533. ],
  4534. [
  4535. 1,
  4536. twoDimVert0
  4537. ],
  4538. [
  4539. 1,
  4540. twoDimVert0
  4541. ],
  4542. [
  4543. 1,
  4544. twoDimVert0
  4545. ],
  4546. [
  4547. 1,
  4548. twoDimVert0
  4549. ],
  4550. [
  4551. 1,
  4552. twoDimVert0
  4553. ],
  4554. [
  4555. 1,
  4556. twoDimVert0
  4557. ],
  4558. [
  4559. 1,
  4560. twoDimVert0
  4561. ],
  4562. [
  4563. 1,
  4564. twoDimVert0
  4565. ],
  4566. [
  4567. 1,
  4568. twoDimVert0
  4569. ],
  4570. [
  4571. 1,
  4572. twoDimVert0
  4573. ],
  4574. [
  4575. 1,
  4576. twoDimVert0
  4577. ],
  4578. [
  4579. 1,
  4580. twoDimVert0
  4581. ],
  4582. [
  4583. 1,
  4584. twoDimVert0
  4585. ],
  4586. [
  4587. 1,
  4588. twoDimVert0
  4589. ],
  4590. [
  4591. 1,
  4592. twoDimVert0
  4593. ],
  4594. [
  4595. 1,
  4596. twoDimVert0
  4597. ],
  4598. [
  4599. 1,
  4600. twoDimVert0
  4601. ],
  4602. [
  4603. 1,
  4604. twoDimVert0
  4605. ],
  4606. [
  4607. 1,
  4608. twoDimVert0
  4609. ],
  4610. [
  4611. 1,
  4612. twoDimVert0
  4613. ],
  4614. [
  4615. 1,
  4616. twoDimVert0
  4617. ],
  4618. [
  4619. 1,
  4620. twoDimVert0
  4621. ],
  4622. [
  4623. 1,
  4624. twoDimVert0
  4625. ],
  4626. [
  4627. 1,
  4628. twoDimVert0
  4629. ],
  4630. [
  4631. 1,
  4632. twoDimVert0
  4633. ],
  4634. [
  4635. 1,
  4636. twoDimVert0
  4637. ],
  4638. [
  4639. 1,
  4640. twoDimVert0
  4641. ],
  4642. [
  4643. 1,
  4644. twoDimVert0
  4645. ],
  4646. [
  4647. 1,
  4648. twoDimVert0
  4649. ],
  4650. [
  4651. 1,
  4652. twoDimVert0
  4653. ],
  4654. [
  4655. 1,
  4656. twoDimVert0
  4657. ],
  4658. [
  4659. 1,
  4660. twoDimVert0
  4661. ],
  4662. [
  4663. 1,
  4664. twoDimVert0
  4665. ],
  4666. [
  4667. 1,
  4668. twoDimVert0
  4669. ],
  4670. [
  4671. 1,
  4672. twoDimVert0
  4673. ],
  4674. [
  4675. 1,
  4676. twoDimVert0
  4677. ],
  4678. [
  4679. 1,
  4680. twoDimVert0
  4681. ],
  4682. [
  4683. 1,
  4684. twoDimVert0
  4685. ],
  4686. [
  4687. 1,
  4688. twoDimVert0
  4689. ],
  4690. [
  4691. 1,
  4692. twoDimVert0
  4693. ],
  4694. [
  4695. 1,
  4696. twoDimVert0
  4697. ],
  4698. [
  4699. 1,
  4700. twoDimVert0
  4701. ],
  4702. [
  4703. 1,
  4704. twoDimVert0
  4705. ],
  4706. [
  4707. 1,
  4708. twoDimVert0
  4709. ],
  4710. [
  4711. 1,
  4712. twoDimVert0
  4713. ],
  4714. [
  4715. 1,
  4716. twoDimVert0
  4717. ],
  4718. [
  4719. 1,
  4720. twoDimVert0
  4721. ],
  4722. [
  4723. 1,
  4724. twoDimVert0
  4725. ]
  4726. ];
  4727. var whiteTable1 = [
  4728. [
  4729. -1,
  4730. -1
  4731. ],
  4732. [
  4733. 12,
  4734. ccittEOL
  4735. ],
  4736. [
  4737. -1,
  4738. -1
  4739. ],
  4740. [
  4741. -1,
  4742. -1
  4743. ],
  4744. [
  4745. -1,
  4746. -1
  4747. ],
  4748. [
  4749. -1,
  4750. -1
  4751. ],
  4752. [
  4753. -1,
  4754. -1
  4755. ],
  4756. [
  4757. -1,
  4758. -1
  4759. ],
  4760. [
  4761. -1,
  4762. -1
  4763. ],
  4764. [
  4765. -1,
  4766. -1
  4767. ],
  4768. [
  4769. -1,
  4770. -1
  4771. ],
  4772. [
  4773. -1,
  4774. -1
  4775. ],
  4776. [
  4777. -1,
  4778. -1
  4779. ],
  4780. [
  4781. -1,
  4782. -1
  4783. ],
  4784. [
  4785. -1,
  4786. -1
  4787. ],
  4788. [
  4789. -1,
  4790. -1
  4791. ],
  4792. [
  4793. 11,
  4794. 1792
  4795. ],
  4796. [
  4797. 11,
  4798. 1792
  4799. ],
  4800. [
  4801. 12,
  4802. 1984
  4803. ],
  4804. [
  4805. 12,
  4806. 2048
  4807. ],
  4808. [
  4809. 12,
  4810. 2112
  4811. ],
  4812. [
  4813. 12,
  4814. 2176
  4815. ],
  4816. [
  4817. 12,
  4818. 2240
  4819. ],
  4820. [
  4821. 12,
  4822. 2304
  4823. ],
  4824. [
  4825. 11,
  4826. 1856
  4827. ],
  4828. [
  4829. 11,
  4830. 1856
  4831. ],
  4832. [
  4833. 11,
  4834. 1920
  4835. ],
  4836. [
  4837. 11,
  4838. 1920
  4839. ],
  4840. [
  4841. 12,
  4842. 2368
  4843. ],
  4844. [
  4845. 12,
  4846. 2432
  4847. ],
  4848. [
  4849. 12,
  4850. 2496
  4851. ],
  4852. [
  4853. 12,
  4854. 2560
  4855. ]
  4856. ];
  4857. var whiteTable2 = [
  4858. [
  4859. -1,
  4860. -1
  4861. ],
  4862. [
  4863. -1,
  4864. -1
  4865. ],
  4866. [
  4867. -1,
  4868. -1
  4869. ],
  4870. [
  4871. -1,
  4872. -1
  4873. ],
  4874. [
  4875. 8,
  4876. 29
  4877. ],
  4878. [
  4879. 8,
  4880. 29
  4881. ],
  4882. [
  4883. 8,
  4884. 30
  4885. ],
  4886. [
  4887. 8,
  4888. 30
  4889. ],
  4890. [
  4891. 8,
  4892. 45
  4893. ],
  4894. [
  4895. 8,
  4896. 45
  4897. ],
  4898. [
  4899. 8,
  4900. 46
  4901. ],
  4902. [
  4903. 8,
  4904. 46
  4905. ],
  4906. [
  4907. 7,
  4908. 22
  4909. ],
  4910. [
  4911. 7,
  4912. 22
  4913. ],
  4914. [
  4915. 7,
  4916. 22
  4917. ],
  4918. [
  4919. 7,
  4920. 22
  4921. ],
  4922. [
  4923. 7,
  4924. 23
  4925. ],
  4926. [
  4927. 7,
  4928. 23
  4929. ],
  4930. [
  4931. 7,
  4932. 23
  4933. ],
  4934. [
  4935. 7,
  4936. 23
  4937. ],
  4938. [
  4939. 8,
  4940. 47
  4941. ],
  4942. [
  4943. 8,
  4944. 47
  4945. ],
  4946. [
  4947. 8,
  4948. 48
  4949. ],
  4950. [
  4951. 8,
  4952. 48
  4953. ],
  4954. [
  4955. 6,
  4956. 13
  4957. ],
  4958. [
  4959. 6,
  4960. 13
  4961. ],
  4962. [
  4963. 6,
  4964. 13
  4965. ],
  4966. [
  4967. 6,
  4968. 13
  4969. ],
  4970. [
  4971. 6,
  4972. 13
  4973. ],
  4974. [
  4975. 6,
  4976. 13
  4977. ],
  4978. [
  4979. 6,
  4980. 13
  4981. ],
  4982. [
  4983. 6,
  4984. 13
  4985. ],
  4986. [
  4987. 7,
  4988. 20
  4989. ],
  4990. [
  4991. 7,
  4992. 20
  4993. ],
  4994. [
  4995. 7,
  4996. 20
  4997. ],
  4998. [
  4999. 7,
  5000. 20
  5001. ],
  5002. [
  5003. 8,
  5004. 33
  5005. ],
  5006. [
  5007. 8,
  5008. 33
  5009. ],
  5010. [
  5011. 8,
  5012. 34
  5013. ],
  5014. [
  5015. 8,
  5016. 34
  5017. ],
  5018. [
  5019. 8,
  5020. 35
  5021. ],
  5022. [
  5023. 8,
  5024. 35
  5025. ],
  5026. [
  5027. 8,
  5028. 36
  5029. ],
  5030. [
  5031. 8,
  5032. 36
  5033. ],
  5034. [
  5035. 8,
  5036. 37
  5037. ],
  5038. [
  5039. 8,
  5040. 37
  5041. ],
  5042. [
  5043. 8,
  5044. 38
  5045. ],
  5046. [
  5047. 8,
  5048. 38
  5049. ],
  5050. [
  5051. 7,
  5052. 19
  5053. ],
  5054. [
  5055. 7,
  5056. 19
  5057. ],
  5058. [
  5059. 7,
  5060. 19
  5061. ],
  5062. [
  5063. 7,
  5064. 19
  5065. ],
  5066. [
  5067. 8,
  5068. 31
  5069. ],
  5070. [
  5071. 8,
  5072. 31
  5073. ],
  5074. [
  5075. 8,
  5076. 32
  5077. ],
  5078. [
  5079. 8,
  5080. 32
  5081. ],
  5082. [
  5083. 6,
  5084. 1
  5085. ],
  5086. [
  5087. 6,
  5088. 1
  5089. ],
  5090. [
  5091. 6,
  5092. 1
  5093. ],
  5094. [
  5095. 6,
  5096. 1
  5097. ],
  5098. [
  5099. 6,
  5100. 1
  5101. ],
  5102. [
  5103. 6,
  5104. 1
  5105. ],
  5106. [
  5107. 6,
  5108. 1
  5109. ],
  5110. [
  5111. 6,
  5112. 1
  5113. ],
  5114. [
  5115. 6,
  5116. 12
  5117. ],
  5118. [
  5119. 6,
  5120. 12
  5121. ],
  5122. [
  5123. 6,
  5124. 12
  5125. ],
  5126. [
  5127. 6,
  5128. 12
  5129. ],
  5130. [
  5131. 6,
  5132. 12
  5133. ],
  5134. [
  5135. 6,
  5136. 12
  5137. ],
  5138. [
  5139. 6,
  5140. 12
  5141. ],
  5142. [
  5143. 6,
  5144. 12
  5145. ],
  5146. [
  5147. 8,
  5148. 53
  5149. ],
  5150. [
  5151. 8,
  5152. 53
  5153. ],
  5154. [
  5155. 8,
  5156. 54
  5157. ],
  5158. [
  5159. 8,
  5160. 54
  5161. ],
  5162. [
  5163. 7,
  5164. 26
  5165. ],
  5166. [
  5167. 7,
  5168. 26
  5169. ],
  5170. [
  5171. 7,
  5172. 26
  5173. ],
  5174. [
  5175. 7,
  5176. 26
  5177. ],
  5178. [
  5179. 8,
  5180. 39
  5181. ],
  5182. [
  5183. 8,
  5184. 39
  5185. ],
  5186. [
  5187. 8,
  5188. 40
  5189. ],
  5190. [
  5191. 8,
  5192. 40
  5193. ],
  5194. [
  5195. 8,
  5196. 41
  5197. ],
  5198. [
  5199. 8,
  5200. 41
  5201. ],
  5202. [
  5203. 8,
  5204. 42
  5205. ],
  5206. [
  5207. 8,
  5208. 42
  5209. ],
  5210. [
  5211. 8,
  5212. 43
  5213. ],
  5214. [
  5215. 8,
  5216. 43
  5217. ],
  5218. [
  5219. 8,
  5220. 44
  5221. ],
  5222. [
  5223. 8,
  5224. 44
  5225. ],
  5226. [
  5227. 7,
  5228. 21
  5229. ],
  5230. [
  5231. 7,
  5232. 21
  5233. ],
  5234. [
  5235. 7,
  5236. 21
  5237. ],
  5238. [
  5239. 7,
  5240. 21
  5241. ],
  5242. [
  5243. 7,
  5244. 28
  5245. ],
  5246. [
  5247. 7,
  5248. 28
  5249. ],
  5250. [
  5251. 7,
  5252. 28
  5253. ],
  5254. [
  5255. 7,
  5256. 28
  5257. ],
  5258. [
  5259. 8,
  5260. 61
  5261. ],
  5262. [
  5263. 8,
  5264. 61
  5265. ],
  5266. [
  5267. 8,
  5268. 62
  5269. ],
  5270. [
  5271. 8,
  5272. 62
  5273. ],
  5274. [
  5275. 8,
  5276. 63
  5277. ],
  5278. [
  5279. 8,
  5280. 63
  5281. ],
  5282. [
  5283. 8,
  5284. 0
  5285. ],
  5286. [
  5287. 8,
  5288. 0
  5289. ],
  5290. [
  5291. 8,
  5292. 320
  5293. ],
  5294. [
  5295. 8,
  5296. 320
  5297. ],
  5298. [
  5299. 8,
  5300. 384
  5301. ],
  5302. [
  5303. 8,
  5304. 384
  5305. ],
  5306. [
  5307. 5,
  5308. 10
  5309. ],
  5310. [
  5311. 5,
  5312. 10
  5313. ],
  5314. [
  5315. 5,
  5316. 10
  5317. ],
  5318. [
  5319. 5,
  5320. 10
  5321. ],
  5322. [
  5323. 5,
  5324. 10
  5325. ],
  5326. [
  5327. 5,
  5328. 10
  5329. ],
  5330. [
  5331. 5,
  5332. 10
  5333. ],
  5334. [
  5335. 5,
  5336. 10
  5337. ],
  5338. [
  5339. 5,
  5340. 10
  5341. ],
  5342. [
  5343. 5,
  5344. 10
  5345. ],
  5346. [
  5347. 5,
  5348. 10
  5349. ],
  5350. [
  5351. 5,
  5352. 10
  5353. ],
  5354. [
  5355. 5,
  5356. 10
  5357. ],
  5358. [
  5359. 5,
  5360. 10
  5361. ],
  5362. [
  5363. 5,
  5364. 10
  5365. ],
  5366. [
  5367. 5,
  5368. 10
  5369. ],
  5370. [
  5371. 5,
  5372. 11
  5373. ],
  5374. [
  5375. 5,
  5376. 11
  5377. ],
  5378. [
  5379. 5,
  5380. 11
  5381. ],
  5382. [
  5383. 5,
  5384. 11
  5385. ],
  5386. [
  5387. 5,
  5388. 11
  5389. ],
  5390. [
  5391. 5,
  5392. 11
  5393. ],
  5394. [
  5395. 5,
  5396. 11
  5397. ],
  5398. [
  5399. 5,
  5400. 11
  5401. ],
  5402. [
  5403. 5,
  5404. 11
  5405. ],
  5406. [
  5407. 5,
  5408. 11
  5409. ],
  5410. [
  5411. 5,
  5412. 11
  5413. ],
  5414. [
  5415. 5,
  5416. 11
  5417. ],
  5418. [
  5419. 5,
  5420. 11
  5421. ],
  5422. [
  5423. 5,
  5424. 11
  5425. ],
  5426. [
  5427. 5,
  5428. 11
  5429. ],
  5430. [
  5431. 5,
  5432. 11
  5433. ],
  5434. [
  5435. 7,
  5436. 27
  5437. ],
  5438. [
  5439. 7,
  5440. 27
  5441. ],
  5442. [
  5443. 7,
  5444. 27
  5445. ],
  5446. [
  5447. 7,
  5448. 27
  5449. ],
  5450. [
  5451. 8,
  5452. 59
  5453. ],
  5454. [
  5455. 8,
  5456. 59
  5457. ],
  5458. [
  5459. 8,
  5460. 60
  5461. ],
  5462. [
  5463. 8,
  5464. 60
  5465. ],
  5466. [
  5467. 9,
  5468. 1472
  5469. ],
  5470. [
  5471. 9,
  5472. 1536
  5473. ],
  5474. [
  5475. 9,
  5476. 1600
  5477. ],
  5478. [
  5479. 9,
  5480. 1728
  5481. ],
  5482. [
  5483. 7,
  5484. 18
  5485. ],
  5486. [
  5487. 7,
  5488. 18
  5489. ],
  5490. [
  5491. 7,
  5492. 18
  5493. ],
  5494. [
  5495. 7,
  5496. 18
  5497. ],
  5498. [
  5499. 7,
  5500. 24
  5501. ],
  5502. [
  5503. 7,
  5504. 24
  5505. ],
  5506. [
  5507. 7,
  5508. 24
  5509. ],
  5510. [
  5511. 7,
  5512. 24
  5513. ],
  5514. [
  5515. 8,
  5516. 49
  5517. ],
  5518. [
  5519. 8,
  5520. 49
  5521. ],
  5522. [
  5523. 8,
  5524. 50
  5525. ],
  5526. [
  5527. 8,
  5528. 50
  5529. ],
  5530. [
  5531. 8,
  5532. 51
  5533. ],
  5534. [
  5535. 8,
  5536. 51
  5537. ],
  5538. [
  5539. 8,
  5540. 52
  5541. ],
  5542. [
  5543. 8,
  5544. 52
  5545. ],
  5546. [
  5547. 7,
  5548. 25
  5549. ],
  5550. [
  5551. 7,
  5552. 25
  5553. ],
  5554. [
  5555. 7,
  5556. 25
  5557. ],
  5558. [
  5559. 7,
  5560. 25
  5561. ],
  5562. [
  5563. 8,
  5564. 55
  5565. ],
  5566. [
  5567. 8,
  5568. 55
  5569. ],
  5570. [
  5571. 8,
  5572. 56
  5573. ],
  5574. [
  5575. 8,
  5576. 56
  5577. ],
  5578. [
  5579. 8,
  5580. 57
  5581. ],
  5582. [
  5583. 8,
  5584. 57
  5585. ],
  5586. [
  5587. 8,
  5588. 58
  5589. ],
  5590. [
  5591. 8,
  5592. 58
  5593. ],
  5594. [
  5595. 6,
  5596. 192
  5597. ],
  5598. [
  5599. 6,
  5600. 192
  5601. ],
  5602. [
  5603. 6,
  5604. 192
  5605. ],
  5606. [
  5607. 6,
  5608. 192
  5609. ],
  5610. [
  5611. 6,
  5612. 192
  5613. ],
  5614. [
  5615. 6,
  5616. 192
  5617. ],
  5618. [
  5619. 6,
  5620. 192
  5621. ],
  5622. [
  5623. 6,
  5624. 192
  5625. ],
  5626. [
  5627. 6,
  5628. 1664
  5629. ],
  5630. [
  5631. 6,
  5632. 1664
  5633. ],
  5634. [
  5635. 6,
  5636. 1664
  5637. ],
  5638. [
  5639. 6,
  5640. 1664
  5641. ],
  5642. [
  5643. 6,
  5644. 1664
  5645. ],
  5646. [
  5647. 6,
  5648. 1664
  5649. ],
  5650. [
  5651. 6,
  5652. 1664
  5653. ],
  5654. [
  5655. 6,
  5656. 1664
  5657. ],
  5658. [
  5659. 8,
  5660. 448
  5661. ],
  5662. [
  5663. 8,
  5664. 448
  5665. ],
  5666. [
  5667. 8,
  5668. 512
  5669. ],
  5670. [
  5671. 8,
  5672. 512
  5673. ],
  5674. [
  5675. 9,
  5676. 704
  5677. ],
  5678. [
  5679. 9,
  5680. 768
  5681. ],
  5682. [
  5683. 8,
  5684. 640
  5685. ],
  5686. [
  5687. 8,
  5688. 640
  5689. ],
  5690. [
  5691. 8,
  5692. 576
  5693. ],
  5694. [
  5695. 8,
  5696. 576
  5697. ],
  5698. [
  5699. 9,
  5700. 832
  5701. ],
  5702. [
  5703. 9,
  5704. 896
  5705. ],
  5706. [
  5707. 9,
  5708. 960
  5709. ],
  5710. [
  5711. 9,
  5712. 1024
  5713. ],
  5714. [
  5715. 9,
  5716. 1088
  5717. ],
  5718. [
  5719. 9,
  5720. 1152
  5721. ],
  5722. [
  5723. 9,
  5724. 1216
  5725. ],
  5726. [
  5727. 9,
  5728. 1280
  5729. ],
  5730. [
  5731. 9,
  5732. 1344
  5733. ],
  5734. [
  5735. 9,
  5736. 1408
  5737. ],
  5738. [
  5739. 7,
  5740. 256
  5741. ],
  5742. [
  5743. 7,
  5744. 256
  5745. ],
  5746. [
  5747. 7,
  5748. 256
  5749. ],
  5750. [
  5751. 7,
  5752. 256
  5753. ],
  5754. [
  5755. 4,
  5756. 2
  5757. ],
  5758. [
  5759. 4,
  5760. 2
  5761. ],
  5762. [
  5763. 4,
  5764. 2
  5765. ],
  5766. [
  5767. 4,
  5768. 2
  5769. ],
  5770. [
  5771. 4,
  5772. 2
  5773. ],
  5774. [
  5775. 4,
  5776. 2
  5777. ],
  5778. [
  5779. 4,
  5780. 2
  5781. ],
  5782. [
  5783. 4,
  5784. 2
  5785. ],
  5786. [
  5787. 4,
  5788. 2
  5789. ],
  5790. [
  5791. 4,
  5792. 2
  5793. ],
  5794. [
  5795. 4,
  5796. 2
  5797. ],
  5798. [
  5799. 4,
  5800. 2
  5801. ],
  5802. [
  5803. 4,
  5804. 2
  5805. ],
  5806. [
  5807. 4,
  5808. 2
  5809. ],
  5810. [
  5811. 4,
  5812. 2
  5813. ],
  5814. [
  5815. 4,
  5816. 2
  5817. ],
  5818. [
  5819. 4,
  5820. 2
  5821. ],
  5822. [
  5823. 4,
  5824. 2
  5825. ],
  5826. [
  5827. 4,
  5828. 2
  5829. ],
  5830. [
  5831. 4,
  5832. 2
  5833. ],
  5834. [
  5835. 4,
  5836. 2
  5837. ],
  5838. [
  5839. 4,
  5840. 2
  5841. ],
  5842. [
  5843. 4,
  5844. 2
  5845. ],
  5846. [
  5847. 4,
  5848. 2
  5849. ],
  5850. [
  5851. 4,
  5852. 2
  5853. ],
  5854. [
  5855. 4,
  5856. 2
  5857. ],
  5858. [
  5859. 4,
  5860. 2
  5861. ],
  5862. [
  5863. 4,
  5864. 2
  5865. ],
  5866. [
  5867. 4,
  5868. 2
  5869. ],
  5870. [
  5871. 4,
  5872. 2
  5873. ],
  5874. [
  5875. 4,
  5876. 2
  5877. ],
  5878. [
  5879. 4,
  5880. 2
  5881. ],
  5882. [
  5883. 4,
  5884. 3
  5885. ],
  5886. [
  5887. 4,
  5888. 3
  5889. ],
  5890. [
  5891. 4,
  5892. 3
  5893. ],
  5894. [
  5895. 4,
  5896. 3
  5897. ],
  5898. [
  5899. 4,
  5900. 3
  5901. ],
  5902. [
  5903. 4,
  5904. 3
  5905. ],
  5906. [
  5907. 4,
  5908. 3
  5909. ],
  5910. [
  5911. 4,
  5912. 3
  5913. ],
  5914. [
  5915. 4,
  5916. 3
  5917. ],
  5918. [
  5919. 4,
  5920. 3
  5921. ],
  5922. [
  5923. 4,
  5924. 3
  5925. ],
  5926. [
  5927. 4,
  5928. 3
  5929. ],
  5930. [
  5931. 4,
  5932. 3
  5933. ],
  5934. [
  5935. 4,
  5936. 3
  5937. ],
  5938. [
  5939. 4,
  5940. 3
  5941. ],
  5942. [
  5943. 4,
  5944. 3
  5945. ],
  5946. [
  5947. 4,
  5948. 3
  5949. ],
  5950. [
  5951. 4,
  5952. 3
  5953. ],
  5954. [
  5955. 4,
  5956. 3
  5957. ],
  5958. [
  5959. 4,
  5960. 3
  5961. ],
  5962. [
  5963. 4,
  5964. 3
  5965. ],
  5966. [
  5967. 4,
  5968. 3
  5969. ],
  5970. [
  5971. 4,
  5972. 3
  5973. ],
  5974. [
  5975. 4,
  5976. 3
  5977. ],
  5978. [
  5979. 4,
  5980. 3
  5981. ],
  5982. [
  5983. 4,
  5984. 3
  5985. ],
  5986. [
  5987. 4,
  5988. 3
  5989. ],
  5990. [
  5991. 4,
  5992. 3
  5993. ],
  5994. [
  5995. 4,
  5996. 3
  5997. ],
  5998. [
  5999. 4,
  6000. 3
  6001. ],
  6002. [
  6003. 4,
  6004. 3
  6005. ],
  6006. [
  6007. 4,
  6008. 3
  6009. ],
  6010. [
  6011. 5,
  6012. 128
  6013. ],
  6014. [
  6015. 5,
  6016. 128
  6017. ],
  6018. [
  6019. 5,
  6020. 128
  6021. ],
  6022. [
  6023. 5,
  6024. 128
  6025. ],
  6026. [
  6027. 5,
  6028. 128
  6029. ],
  6030. [
  6031. 5,
  6032. 128
  6033. ],
  6034. [
  6035. 5,
  6036. 128
  6037. ],
  6038. [
  6039. 5,
  6040. 128
  6041. ],
  6042. [
  6043. 5,
  6044. 128
  6045. ],
  6046. [
  6047. 5,
  6048. 128
  6049. ],
  6050. [
  6051. 5,
  6052. 128
  6053. ],
  6054. [
  6055. 5,
  6056. 128
  6057. ],
  6058. [
  6059. 5,
  6060. 128
  6061. ],
  6062. [
  6063. 5,
  6064. 128
  6065. ],
  6066. [
  6067. 5,
  6068. 128
  6069. ],
  6070. [
  6071. 5,
  6072. 128
  6073. ],
  6074. [
  6075. 5,
  6076. 8
  6077. ],
  6078. [
  6079. 5,
  6080. 8
  6081. ],
  6082. [
  6083. 5,
  6084. 8
  6085. ],
  6086. [
  6087. 5,
  6088. 8
  6089. ],
  6090. [
  6091. 5,
  6092. 8
  6093. ],
  6094. [
  6095. 5,
  6096. 8
  6097. ],
  6098. [
  6099. 5,
  6100. 8
  6101. ],
  6102. [
  6103. 5,
  6104. 8
  6105. ],
  6106. [
  6107. 5,
  6108. 8
  6109. ],
  6110. [
  6111. 5,
  6112. 8
  6113. ],
  6114. [
  6115. 5,
  6116. 8
  6117. ],
  6118. [
  6119. 5,
  6120. 8
  6121. ],
  6122. [
  6123. 5,
  6124. 8
  6125. ],
  6126. [
  6127. 5,
  6128. 8
  6129. ],
  6130. [
  6131. 5,
  6132. 8
  6133. ],
  6134. [
  6135. 5,
  6136. 8
  6137. ],
  6138. [
  6139. 5,
  6140. 9
  6141. ],
  6142. [
  6143. 5,
  6144. 9
  6145. ],
  6146. [
  6147. 5,
  6148. 9
  6149. ],
  6150. [
  6151. 5,
  6152. 9
  6153. ],
  6154. [
  6155. 5,
  6156. 9
  6157. ],
  6158. [
  6159. 5,
  6160. 9
  6161. ],
  6162. [
  6163. 5,
  6164. 9
  6165. ],
  6166. [
  6167. 5,
  6168. 9
  6169. ],
  6170. [
  6171. 5,
  6172. 9
  6173. ],
  6174. [
  6175. 5,
  6176. 9
  6177. ],
  6178. [
  6179. 5,
  6180. 9
  6181. ],
  6182. [
  6183. 5,
  6184. 9
  6185. ],
  6186. [
  6187. 5,
  6188. 9
  6189. ],
  6190. [
  6191. 5,
  6192. 9
  6193. ],
  6194. [
  6195. 5,
  6196. 9
  6197. ],
  6198. [
  6199. 5,
  6200. 9
  6201. ],
  6202. [
  6203. 6,
  6204. 16
  6205. ],
  6206. [
  6207. 6,
  6208. 16
  6209. ],
  6210. [
  6211. 6,
  6212. 16
  6213. ],
  6214. [
  6215. 6,
  6216. 16
  6217. ],
  6218. [
  6219. 6,
  6220. 16
  6221. ],
  6222. [
  6223. 6,
  6224. 16
  6225. ],
  6226. [
  6227. 6,
  6228. 16
  6229. ],
  6230. [
  6231. 6,
  6232. 16
  6233. ],
  6234. [
  6235. 6,
  6236. 17
  6237. ],
  6238. [
  6239. 6,
  6240. 17
  6241. ],
  6242. [
  6243. 6,
  6244. 17
  6245. ],
  6246. [
  6247. 6,
  6248. 17
  6249. ],
  6250. [
  6251. 6,
  6252. 17
  6253. ],
  6254. [
  6255. 6,
  6256. 17
  6257. ],
  6258. [
  6259. 6,
  6260. 17
  6261. ],
  6262. [
  6263. 6,
  6264. 17
  6265. ],
  6266. [
  6267. 4,
  6268. 4
  6269. ],
  6270. [
  6271. 4,
  6272. 4
  6273. ],
  6274. [
  6275. 4,
  6276. 4
  6277. ],
  6278. [
  6279. 4,
  6280. 4
  6281. ],
  6282. [
  6283. 4,
  6284. 4
  6285. ],
  6286. [
  6287. 4,
  6288. 4
  6289. ],
  6290. [
  6291. 4,
  6292. 4
  6293. ],
  6294. [
  6295. 4,
  6296. 4
  6297. ],
  6298. [
  6299. 4,
  6300. 4
  6301. ],
  6302. [
  6303. 4,
  6304. 4
  6305. ],
  6306. [
  6307. 4,
  6308. 4
  6309. ],
  6310. [
  6311. 4,
  6312. 4
  6313. ],
  6314. [
  6315. 4,
  6316. 4
  6317. ],
  6318. [
  6319. 4,
  6320. 4
  6321. ],
  6322. [
  6323. 4,
  6324. 4
  6325. ],
  6326. [
  6327. 4,
  6328. 4
  6329. ],
  6330. [
  6331. 4,
  6332. 4
  6333. ],
  6334. [
  6335. 4,
  6336. 4
  6337. ],
  6338. [
  6339. 4,
  6340. 4
  6341. ],
  6342. [
  6343. 4,
  6344. 4
  6345. ],
  6346. [
  6347. 4,
  6348. 4
  6349. ],
  6350. [
  6351. 4,
  6352. 4
  6353. ],
  6354. [
  6355. 4,
  6356. 4
  6357. ],
  6358. [
  6359. 4,
  6360. 4
  6361. ],
  6362. [
  6363. 4,
  6364. 4
  6365. ],
  6366. [
  6367. 4,
  6368. 4
  6369. ],
  6370. [
  6371. 4,
  6372. 4
  6373. ],
  6374. [
  6375. 4,
  6376. 4
  6377. ],
  6378. [
  6379. 4,
  6380. 4
  6381. ],
  6382. [
  6383. 4,
  6384. 4
  6385. ],
  6386. [
  6387. 4,
  6388. 4
  6389. ],
  6390. [
  6391. 4,
  6392. 4
  6393. ],
  6394. [
  6395. 4,
  6396. 5
  6397. ],
  6398. [
  6399. 4,
  6400. 5
  6401. ],
  6402. [
  6403. 4,
  6404. 5
  6405. ],
  6406. [
  6407. 4,
  6408. 5
  6409. ],
  6410. [
  6411. 4,
  6412. 5
  6413. ],
  6414. [
  6415. 4,
  6416. 5
  6417. ],
  6418. [
  6419. 4,
  6420. 5
  6421. ],
  6422. [
  6423. 4,
  6424. 5
  6425. ],
  6426. [
  6427. 4,
  6428. 5
  6429. ],
  6430. [
  6431. 4,
  6432. 5
  6433. ],
  6434. [
  6435. 4,
  6436. 5
  6437. ],
  6438. [
  6439. 4,
  6440. 5
  6441. ],
  6442. [
  6443. 4,
  6444. 5
  6445. ],
  6446. [
  6447. 4,
  6448. 5
  6449. ],
  6450. [
  6451. 4,
  6452. 5
  6453. ],
  6454. [
  6455. 4,
  6456. 5
  6457. ],
  6458. [
  6459. 4,
  6460. 5
  6461. ],
  6462. [
  6463. 4,
  6464. 5
  6465. ],
  6466. [
  6467. 4,
  6468. 5
  6469. ],
  6470. [
  6471. 4,
  6472. 5
  6473. ],
  6474. [
  6475. 4,
  6476. 5
  6477. ],
  6478. [
  6479. 4,
  6480. 5
  6481. ],
  6482. [
  6483. 4,
  6484. 5
  6485. ],
  6486. [
  6487. 4,
  6488. 5
  6489. ],
  6490. [
  6491. 4,
  6492. 5
  6493. ],
  6494. [
  6495. 4,
  6496. 5
  6497. ],
  6498. [
  6499. 4,
  6500. 5
  6501. ],
  6502. [
  6503. 4,
  6504. 5
  6505. ],
  6506. [
  6507. 4,
  6508. 5
  6509. ],
  6510. [
  6511. 4,
  6512. 5
  6513. ],
  6514. [
  6515. 4,
  6516. 5
  6517. ],
  6518. [
  6519. 4,
  6520. 5
  6521. ],
  6522. [
  6523. 6,
  6524. 14
  6525. ],
  6526. [
  6527. 6,
  6528. 14
  6529. ],
  6530. [
  6531. 6,
  6532. 14
  6533. ],
  6534. [
  6535. 6,
  6536. 14
  6537. ],
  6538. [
  6539. 6,
  6540. 14
  6541. ],
  6542. [
  6543. 6,
  6544. 14
  6545. ],
  6546. [
  6547. 6,
  6548. 14
  6549. ],
  6550. [
  6551. 6,
  6552. 14
  6553. ],
  6554. [
  6555. 6,
  6556. 15
  6557. ],
  6558. [
  6559. 6,
  6560. 15
  6561. ],
  6562. [
  6563. 6,
  6564. 15
  6565. ],
  6566. [
  6567. 6,
  6568. 15
  6569. ],
  6570. [
  6571. 6,
  6572. 15
  6573. ],
  6574. [
  6575. 6,
  6576. 15
  6577. ],
  6578. [
  6579. 6,
  6580. 15
  6581. ],
  6582. [
  6583. 6,
  6584. 15
  6585. ],
  6586. [
  6587. 5,
  6588. 64
  6589. ],
  6590. [
  6591. 5,
  6592. 64
  6593. ],
  6594. [
  6595. 5,
  6596. 64
  6597. ],
  6598. [
  6599. 5,
  6600. 64
  6601. ],
  6602. [
  6603. 5,
  6604. 64
  6605. ],
  6606. [
  6607. 5,
  6608. 64
  6609. ],
  6610. [
  6611. 5,
  6612. 64
  6613. ],
  6614. [
  6615. 5,
  6616. 64
  6617. ],
  6618. [
  6619. 5,
  6620. 64
  6621. ],
  6622. [
  6623. 5,
  6624. 64
  6625. ],
  6626. [
  6627. 5,
  6628. 64
  6629. ],
  6630. [
  6631. 5,
  6632. 64
  6633. ],
  6634. [
  6635. 5,
  6636. 64
  6637. ],
  6638. [
  6639. 5,
  6640. 64
  6641. ],
  6642. [
  6643. 5,
  6644. 64
  6645. ],
  6646. [
  6647. 5,
  6648. 64
  6649. ],
  6650. [
  6651. 4,
  6652. 6
  6653. ],
  6654. [
  6655. 4,
  6656. 6
  6657. ],
  6658. [
  6659. 4,
  6660. 6
  6661. ],
  6662. [
  6663. 4,
  6664. 6
  6665. ],
  6666. [
  6667. 4,
  6668. 6
  6669. ],
  6670. [
  6671. 4,
  6672. 6
  6673. ],
  6674. [
  6675. 4,
  6676. 6
  6677. ],
  6678. [
  6679. 4,
  6680. 6
  6681. ],
  6682. [
  6683. 4,
  6684. 6
  6685. ],
  6686. [
  6687. 4,
  6688. 6
  6689. ],
  6690. [
  6691. 4,
  6692. 6
  6693. ],
  6694. [
  6695. 4,
  6696. 6
  6697. ],
  6698. [
  6699. 4,
  6700. 6
  6701. ],
  6702. [
  6703. 4,
  6704. 6
  6705. ],
  6706. [
  6707. 4,
  6708. 6
  6709. ],
  6710. [
  6711. 4,
  6712. 6
  6713. ],
  6714. [
  6715. 4,
  6716. 6
  6717. ],
  6718. [
  6719. 4,
  6720. 6
  6721. ],
  6722. [
  6723. 4,
  6724. 6
  6725. ],
  6726. [
  6727. 4,
  6728. 6
  6729. ],
  6730. [
  6731. 4,
  6732. 6
  6733. ],
  6734. [
  6735. 4,
  6736. 6
  6737. ],
  6738. [
  6739. 4,
  6740. 6
  6741. ],
  6742. [
  6743. 4,
  6744. 6
  6745. ],
  6746. [
  6747. 4,
  6748. 6
  6749. ],
  6750. [
  6751. 4,
  6752. 6
  6753. ],
  6754. [
  6755. 4,
  6756. 6
  6757. ],
  6758. [
  6759. 4,
  6760. 6
  6761. ],
  6762. [
  6763. 4,
  6764. 6
  6765. ],
  6766. [
  6767. 4,
  6768. 6
  6769. ],
  6770. [
  6771. 4,
  6772. 6
  6773. ],
  6774. [
  6775. 4,
  6776. 6
  6777. ],
  6778. [
  6779. 4,
  6780. 7
  6781. ],
  6782. [
  6783. 4,
  6784. 7
  6785. ],
  6786. [
  6787. 4,
  6788. 7
  6789. ],
  6790. [
  6791. 4,
  6792. 7
  6793. ],
  6794. [
  6795. 4,
  6796. 7
  6797. ],
  6798. [
  6799. 4,
  6800. 7
  6801. ],
  6802. [
  6803. 4,
  6804. 7
  6805. ],
  6806. [
  6807. 4,
  6808. 7
  6809. ],
  6810. [
  6811. 4,
  6812. 7
  6813. ],
  6814. [
  6815. 4,
  6816. 7
  6817. ],
  6818. [
  6819. 4,
  6820. 7
  6821. ],
  6822. [
  6823. 4,
  6824. 7
  6825. ],
  6826. [
  6827. 4,
  6828. 7
  6829. ],
  6830. [
  6831. 4,
  6832. 7
  6833. ],
  6834. [
  6835. 4,
  6836. 7
  6837. ],
  6838. [
  6839. 4,
  6840. 7
  6841. ],
  6842. [
  6843. 4,
  6844. 7
  6845. ],
  6846. [
  6847. 4,
  6848. 7
  6849. ],
  6850. [
  6851. 4,
  6852. 7
  6853. ],
  6854. [
  6855. 4,
  6856. 7
  6857. ],
  6858. [
  6859. 4,
  6860. 7
  6861. ],
  6862. [
  6863. 4,
  6864. 7
  6865. ],
  6866. [
  6867. 4,
  6868. 7
  6869. ],
  6870. [
  6871. 4,
  6872. 7
  6873. ],
  6874. [
  6875. 4,
  6876. 7
  6877. ],
  6878. [
  6879. 4,
  6880. 7
  6881. ],
  6882. [
  6883. 4,
  6884. 7
  6885. ],
  6886. [
  6887. 4,
  6888. 7
  6889. ],
  6890. [
  6891. 4,
  6892. 7
  6893. ],
  6894. [
  6895. 4,
  6896. 7
  6897. ],
  6898. [
  6899. 4,
  6900. 7
  6901. ],
  6902. [
  6903. 4,
  6904. 7
  6905. ]
  6906. ];
  6907. var blackTable1 = [
  6908. [
  6909. -1,
  6910. -1
  6911. ],
  6912. [
  6913. -1,
  6914. -1
  6915. ],
  6916. [
  6917. 12,
  6918. ccittEOL
  6919. ],
  6920. [
  6921. 12,
  6922. ccittEOL
  6923. ],
  6924. [
  6925. -1,
  6926. -1
  6927. ],
  6928. [
  6929. -1,
  6930. -1
  6931. ],
  6932. [
  6933. -1,
  6934. -1
  6935. ],
  6936. [
  6937. -1,
  6938. -1
  6939. ],
  6940. [
  6941. -1,
  6942. -1
  6943. ],
  6944. [
  6945. -1,
  6946. -1
  6947. ],
  6948. [
  6949. -1,
  6950. -1
  6951. ],
  6952. [
  6953. -1,
  6954. -1
  6955. ],
  6956. [
  6957. -1,
  6958. -1
  6959. ],
  6960. [
  6961. -1,
  6962. -1
  6963. ],
  6964. [
  6965. -1,
  6966. -1
  6967. ],
  6968. [
  6969. -1,
  6970. -1
  6971. ],
  6972. [
  6973. -1,
  6974. -1
  6975. ],
  6976. [
  6977. -1,
  6978. -1
  6979. ],
  6980. [
  6981. -1,
  6982. -1
  6983. ],
  6984. [
  6985. -1,
  6986. -1
  6987. ],
  6988. [
  6989. -1,
  6990. -1
  6991. ],
  6992. [
  6993. -1,
  6994. -1
  6995. ],
  6996. [
  6997. -1,
  6998. -1
  6999. ],
  7000. [
  7001. -1,
  7002. -1
  7003. ],
  7004. [
  7005. -1,
  7006. -1
  7007. ],
  7008. [
  7009. -1,
  7010. -1
  7011. ],
  7012. [
  7013. -1,
  7014. -1
  7015. ],
  7016. [
  7017. -1,
  7018. -1
  7019. ],
  7020. [
  7021. -1,
  7022. -1
  7023. ],
  7024. [
  7025. -1,
  7026. -1
  7027. ],
  7028. [
  7029. -1,
  7030. -1
  7031. ],
  7032. [
  7033. -1,
  7034. -1
  7035. ],
  7036. [
  7037. 11,
  7038. 1792
  7039. ],
  7040. [
  7041. 11,
  7042. 1792
  7043. ],
  7044. [
  7045. 11,
  7046. 1792
  7047. ],
  7048. [
  7049. 11,
  7050. 1792
  7051. ],
  7052. [
  7053. 12,
  7054. 1984
  7055. ],
  7056. [
  7057. 12,
  7058. 1984
  7059. ],
  7060. [
  7061. 12,
  7062. 2048
  7063. ],
  7064. [
  7065. 12,
  7066. 2048
  7067. ],
  7068. [
  7069. 12,
  7070. 2112
  7071. ],
  7072. [
  7073. 12,
  7074. 2112
  7075. ],
  7076. [
  7077. 12,
  7078. 2176
  7079. ],
  7080. [
  7081. 12,
  7082. 2176
  7083. ],
  7084. [
  7085. 12,
  7086. 2240
  7087. ],
  7088. [
  7089. 12,
  7090. 2240
  7091. ],
  7092. [
  7093. 12,
  7094. 2304
  7095. ],
  7096. [
  7097. 12,
  7098. 2304
  7099. ],
  7100. [
  7101. 11,
  7102. 1856
  7103. ],
  7104. [
  7105. 11,
  7106. 1856
  7107. ],
  7108. [
  7109. 11,
  7110. 1856
  7111. ],
  7112. [
  7113. 11,
  7114. 1856
  7115. ],
  7116. [
  7117. 11,
  7118. 1920
  7119. ],
  7120. [
  7121. 11,
  7122. 1920
  7123. ],
  7124. [
  7125. 11,
  7126. 1920
  7127. ],
  7128. [
  7129. 11,
  7130. 1920
  7131. ],
  7132. [
  7133. 12,
  7134. 2368
  7135. ],
  7136. [
  7137. 12,
  7138. 2368
  7139. ],
  7140. [
  7141. 12,
  7142. 2432
  7143. ],
  7144. [
  7145. 12,
  7146. 2432
  7147. ],
  7148. [
  7149. 12,
  7150. 2496
  7151. ],
  7152. [
  7153. 12,
  7154. 2496
  7155. ],
  7156. [
  7157. 12,
  7158. 2560
  7159. ],
  7160. [
  7161. 12,
  7162. 2560
  7163. ],
  7164. [
  7165. 10,
  7166. 18
  7167. ],
  7168. [
  7169. 10,
  7170. 18
  7171. ],
  7172. [
  7173. 10,
  7174. 18
  7175. ],
  7176. [
  7177. 10,
  7178. 18
  7179. ],
  7180. [
  7181. 10,
  7182. 18
  7183. ],
  7184. [
  7185. 10,
  7186. 18
  7187. ],
  7188. [
  7189. 10,
  7190. 18
  7191. ],
  7192. [
  7193. 10,
  7194. 18
  7195. ],
  7196. [
  7197. 12,
  7198. 52
  7199. ],
  7200. [
  7201. 12,
  7202. 52
  7203. ],
  7204. [
  7205. 13,
  7206. 640
  7207. ],
  7208. [
  7209. 13,
  7210. 704
  7211. ],
  7212. [
  7213. 13,
  7214. 768
  7215. ],
  7216. [
  7217. 13,
  7218. 832
  7219. ],
  7220. [
  7221. 12,
  7222. 55
  7223. ],
  7224. [
  7225. 12,
  7226. 55
  7227. ],
  7228. [
  7229. 12,
  7230. 56
  7231. ],
  7232. [
  7233. 12,
  7234. 56
  7235. ],
  7236. [
  7237. 13,
  7238. 1280
  7239. ],
  7240. [
  7241. 13,
  7242. 1344
  7243. ],
  7244. [
  7245. 13,
  7246. 1408
  7247. ],
  7248. [
  7249. 13,
  7250. 1472
  7251. ],
  7252. [
  7253. 12,
  7254. 59
  7255. ],
  7256. [
  7257. 12,
  7258. 59
  7259. ],
  7260. [
  7261. 12,
  7262. 60
  7263. ],
  7264. [
  7265. 12,
  7266. 60
  7267. ],
  7268. [
  7269. 13,
  7270. 1536
  7271. ],
  7272. [
  7273. 13,
  7274. 1600
  7275. ],
  7276. [
  7277. 11,
  7278. 24
  7279. ],
  7280. [
  7281. 11,
  7282. 24
  7283. ],
  7284. [
  7285. 11,
  7286. 24
  7287. ],
  7288. [
  7289. 11,
  7290. 24
  7291. ],
  7292. [
  7293. 11,
  7294. 25
  7295. ],
  7296. [
  7297. 11,
  7298. 25
  7299. ],
  7300. [
  7301. 11,
  7302. 25
  7303. ],
  7304. [
  7305. 11,
  7306. 25
  7307. ],
  7308. [
  7309. 13,
  7310. 1664
  7311. ],
  7312. [
  7313. 13,
  7314. 1728
  7315. ],
  7316. [
  7317. 12,
  7318. 320
  7319. ],
  7320. [
  7321. 12,
  7322. 320
  7323. ],
  7324. [
  7325. 12,
  7326. 384
  7327. ],
  7328. [
  7329. 12,
  7330. 384
  7331. ],
  7332. [
  7333. 12,
  7334. 448
  7335. ],
  7336. [
  7337. 12,
  7338. 448
  7339. ],
  7340. [
  7341. 13,
  7342. 512
  7343. ],
  7344. [
  7345. 13,
  7346. 576
  7347. ],
  7348. [
  7349. 12,
  7350. 53
  7351. ],
  7352. [
  7353. 12,
  7354. 53
  7355. ],
  7356. [
  7357. 12,
  7358. 54
  7359. ],
  7360. [
  7361. 12,
  7362. 54
  7363. ],
  7364. [
  7365. 13,
  7366. 896
  7367. ],
  7368. [
  7369. 13,
  7370. 960
  7371. ],
  7372. [
  7373. 13,
  7374. 1024
  7375. ],
  7376. [
  7377. 13,
  7378. 1088
  7379. ],
  7380. [
  7381. 13,
  7382. 1152
  7383. ],
  7384. [
  7385. 13,
  7386. 1216
  7387. ],
  7388. [
  7389. 10,
  7390. 64
  7391. ],
  7392. [
  7393. 10,
  7394. 64
  7395. ],
  7396. [
  7397. 10,
  7398. 64
  7399. ],
  7400. [
  7401. 10,
  7402. 64
  7403. ],
  7404. [
  7405. 10,
  7406. 64
  7407. ],
  7408. [
  7409. 10,
  7410. 64
  7411. ],
  7412. [
  7413. 10,
  7414. 64
  7415. ],
  7416. [
  7417. 10,
  7418. 64
  7419. ]
  7420. ];
  7421. var blackTable2 = [
  7422. [
  7423. 8,
  7424. 13
  7425. ],
  7426. [
  7427. 8,
  7428. 13
  7429. ],
  7430. [
  7431. 8,
  7432. 13
  7433. ],
  7434. [
  7435. 8,
  7436. 13
  7437. ],
  7438. [
  7439. 8,
  7440. 13
  7441. ],
  7442. [
  7443. 8,
  7444. 13
  7445. ],
  7446. [
  7447. 8,
  7448. 13
  7449. ],
  7450. [
  7451. 8,
  7452. 13
  7453. ],
  7454. [
  7455. 8,
  7456. 13
  7457. ],
  7458. [
  7459. 8,
  7460. 13
  7461. ],
  7462. [
  7463. 8,
  7464. 13
  7465. ],
  7466. [
  7467. 8,
  7468. 13
  7469. ],
  7470. [
  7471. 8,
  7472. 13
  7473. ],
  7474. [
  7475. 8,
  7476. 13
  7477. ],
  7478. [
  7479. 8,
  7480. 13
  7481. ],
  7482. [
  7483. 8,
  7484. 13
  7485. ],
  7486. [
  7487. 11,
  7488. 23
  7489. ],
  7490. [
  7491. 11,
  7492. 23
  7493. ],
  7494. [
  7495. 12,
  7496. 50
  7497. ],
  7498. [
  7499. 12,
  7500. 51
  7501. ],
  7502. [
  7503. 12,
  7504. 44
  7505. ],
  7506. [
  7507. 12,
  7508. 45
  7509. ],
  7510. [
  7511. 12,
  7512. 46
  7513. ],
  7514. [
  7515. 12,
  7516. 47
  7517. ],
  7518. [
  7519. 12,
  7520. 57
  7521. ],
  7522. [
  7523. 12,
  7524. 58
  7525. ],
  7526. [
  7527. 12,
  7528. 61
  7529. ],
  7530. [
  7531. 12,
  7532. 256
  7533. ],
  7534. [
  7535. 10,
  7536. 16
  7537. ],
  7538. [
  7539. 10,
  7540. 16
  7541. ],
  7542. [
  7543. 10,
  7544. 16
  7545. ],
  7546. [
  7547. 10,
  7548. 16
  7549. ],
  7550. [
  7551. 10,
  7552. 17
  7553. ],
  7554. [
  7555. 10,
  7556. 17
  7557. ],
  7558. [
  7559. 10,
  7560. 17
  7561. ],
  7562. [
  7563. 10,
  7564. 17
  7565. ],
  7566. [
  7567. 12,
  7568. 48
  7569. ],
  7570. [
  7571. 12,
  7572. 49
  7573. ],
  7574. [
  7575. 12,
  7576. 62
  7577. ],
  7578. [
  7579. 12,
  7580. 63
  7581. ],
  7582. [
  7583. 12,
  7584. 30
  7585. ],
  7586. [
  7587. 12,
  7588. 31
  7589. ],
  7590. [
  7591. 12,
  7592. 32
  7593. ],
  7594. [
  7595. 12,
  7596. 33
  7597. ],
  7598. [
  7599. 12,
  7600. 40
  7601. ],
  7602. [
  7603. 12,
  7604. 41
  7605. ],
  7606. [
  7607. 11,
  7608. 22
  7609. ],
  7610. [
  7611. 11,
  7612. 22
  7613. ],
  7614. [
  7615. 8,
  7616. 14
  7617. ],
  7618. [
  7619. 8,
  7620. 14
  7621. ],
  7622. [
  7623. 8,
  7624. 14
  7625. ],
  7626. [
  7627. 8,
  7628. 14
  7629. ],
  7630. [
  7631. 8,
  7632. 14
  7633. ],
  7634. [
  7635. 8,
  7636. 14
  7637. ],
  7638. [
  7639. 8,
  7640. 14
  7641. ],
  7642. [
  7643. 8,
  7644. 14
  7645. ],
  7646. [
  7647. 8,
  7648. 14
  7649. ],
  7650. [
  7651. 8,
  7652. 14
  7653. ],
  7654. [
  7655. 8,
  7656. 14
  7657. ],
  7658. [
  7659. 8,
  7660. 14
  7661. ],
  7662. [
  7663. 8,
  7664. 14
  7665. ],
  7666. [
  7667. 8,
  7668. 14
  7669. ],
  7670. [
  7671. 8,
  7672. 14
  7673. ],
  7674. [
  7675. 8,
  7676. 14
  7677. ],
  7678. [
  7679. 7,
  7680. 10
  7681. ],
  7682. [
  7683. 7,
  7684. 10
  7685. ],
  7686. [
  7687. 7,
  7688. 10
  7689. ],
  7690. [
  7691. 7,
  7692. 10
  7693. ],
  7694. [
  7695. 7,
  7696. 10
  7697. ],
  7698. [
  7699. 7,
  7700. 10
  7701. ],
  7702. [
  7703. 7,
  7704. 10
  7705. ],
  7706. [
  7707. 7,
  7708. 10
  7709. ],
  7710. [
  7711. 7,
  7712. 10
  7713. ],
  7714. [
  7715. 7,
  7716. 10
  7717. ],
  7718. [
  7719. 7,
  7720. 10
  7721. ],
  7722. [
  7723. 7,
  7724. 10
  7725. ],
  7726. [
  7727. 7,
  7728. 10
  7729. ],
  7730. [
  7731. 7,
  7732. 10
  7733. ],
  7734. [
  7735. 7,
  7736. 10
  7737. ],
  7738. [
  7739. 7,
  7740. 10
  7741. ],
  7742. [
  7743. 7,
  7744. 10
  7745. ],
  7746. [
  7747. 7,
  7748. 10
  7749. ],
  7750. [
  7751. 7,
  7752. 10
  7753. ],
  7754. [
  7755. 7,
  7756. 10
  7757. ],
  7758. [
  7759. 7,
  7760. 10
  7761. ],
  7762. [
  7763. 7,
  7764. 10
  7765. ],
  7766. [
  7767. 7,
  7768. 10
  7769. ],
  7770. [
  7771. 7,
  7772. 10
  7773. ],
  7774. [
  7775. 7,
  7776. 10
  7777. ],
  7778. [
  7779. 7,
  7780. 10
  7781. ],
  7782. [
  7783. 7,
  7784. 10
  7785. ],
  7786. [
  7787. 7,
  7788. 10
  7789. ],
  7790. [
  7791. 7,
  7792. 10
  7793. ],
  7794. [
  7795. 7,
  7796. 10
  7797. ],
  7798. [
  7799. 7,
  7800. 10
  7801. ],
  7802. [
  7803. 7,
  7804. 10
  7805. ],
  7806. [
  7807. 7,
  7808. 11
  7809. ],
  7810. [
  7811. 7,
  7812. 11
  7813. ],
  7814. [
  7815. 7,
  7816. 11
  7817. ],
  7818. [
  7819. 7,
  7820. 11
  7821. ],
  7822. [
  7823. 7,
  7824. 11
  7825. ],
  7826. [
  7827. 7,
  7828. 11
  7829. ],
  7830. [
  7831. 7,
  7832. 11
  7833. ],
  7834. [
  7835. 7,
  7836. 11
  7837. ],
  7838. [
  7839. 7,
  7840. 11
  7841. ],
  7842. [
  7843. 7,
  7844. 11
  7845. ],
  7846. [
  7847. 7,
  7848. 11
  7849. ],
  7850. [
  7851. 7,
  7852. 11
  7853. ],
  7854. [
  7855. 7,
  7856. 11
  7857. ],
  7858. [
  7859. 7,
  7860. 11
  7861. ],
  7862. [
  7863. 7,
  7864. 11
  7865. ],
  7866. [
  7867. 7,
  7868. 11
  7869. ],
  7870. [
  7871. 7,
  7872. 11
  7873. ],
  7874. [
  7875. 7,
  7876. 11
  7877. ],
  7878. [
  7879. 7,
  7880. 11
  7881. ],
  7882. [
  7883. 7,
  7884. 11
  7885. ],
  7886. [
  7887. 7,
  7888. 11
  7889. ],
  7890. [
  7891. 7,
  7892. 11
  7893. ],
  7894. [
  7895. 7,
  7896. 11
  7897. ],
  7898. [
  7899. 7,
  7900. 11
  7901. ],
  7902. [
  7903. 7,
  7904. 11
  7905. ],
  7906. [
  7907. 7,
  7908. 11
  7909. ],
  7910. [
  7911. 7,
  7912. 11
  7913. ],
  7914. [
  7915. 7,
  7916. 11
  7917. ],
  7918. [
  7919. 7,
  7920. 11
  7921. ],
  7922. [
  7923. 7,
  7924. 11
  7925. ],
  7926. [
  7927. 7,
  7928. 11
  7929. ],
  7930. [
  7931. 7,
  7932. 11
  7933. ],
  7934. [
  7935. 9,
  7936. 15
  7937. ],
  7938. [
  7939. 9,
  7940. 15
  7941. ],
  7942. [
  7943. 9,
  7944. 15
  7945. ],
  7946. [
  7947. 9,
  7948. 15
  7949. ],
  7950. [
  7951. 9,
  7952. 15
  7953. ],
  7954. [
  7955. 9,
  7956. 15
  7957. ],
  7958. [
  7959. 9,
  7960. 15
  7961. ],
  7962. [
  7963. 9,
  7964. 15
  7965. ],
  7966. [
  7967. 12,
  7968. 128
  7969. ],
  7970. [
  7971. 12,
  7972. 192
  7973. ],
  7974. [
  7975. 12,
  7976. 26
  7977. ],
  7978. [
  7979. 12,
  7980. 27
  7981. ],
  7982. [
  7983. 12,
  7984. 28
  7985. ],
  7986. [
  7987. 12,
  7988. 29
  7989. ],
  7990. [
  7991. 11,
  7992. 19
  7993. ],
  7994. [
  7995. 11,
  7996. 19
  7997. ],
  7998. [
  7999. 11,
  8000. 20
  8001. ],
  8002. [
  8003. 11,
  8004. 20
  8005. ],
  8006. [
  8007. 12,
  8008. 34
  8009. ],
  8010. [
  8011. 12,
  8012. 35
  8013. ],
  8014. [
  8015. 12,
  8016. 36
  8017. ],
  8018. [
  8019. 12,
  8020. 37
  8021. ],
  8022. [
  8023. 12,
  8024. 38
  8025. ],
  8026. [
  8027. 12,
  8028. 39
  8029. ],
  8030. [
  8031. 11,
  8032. 21
  8033. ],
  8034. [
  8035. 11,
  8036. 21
  8037. ],
  8038. [
  8039. 12,
  8040. 42
  8041. ],
  8042. [
  8043. 12,
  8044. 43
  8045. ],
  8046. [
  8047. 10,
  8048. 0
  8049. ],
  8050. [
  8051. 10,
  8052. 0
  8053. ],
  8054. [
  8055. 10,
  8056. 0
  8057. ],
  8058. [
  8059. 10,
  8060. 0
  8061. ],
  8062. [
  8063. 7,
  8064. 12
  8065. ],
  8066. [
  8067. 7,
  8068. 12
  8069. ],
  8070. [
  8071. 7,
  8072. 12
  8073. ],
  8074. [
  8075. 7,
  8076. 12
  8077. ],
  8078. [
  8079. 7,
  8080. 12
  8081. ],
  8082. [
  8083. 7,
  8084. 12
  8085. ],
  8086. [
  8087. 7,
  8088. 12
  8089. ],
  8090. [
  8091. 7,
  8092. 12
  8093. ],
  8094. [
  8095. 7,
  8096. 12
  8097. ],
  8098. [
  8099. 7,
  8100. 12
  8101. ],
  8102. [
  8103. 7,
  8104. 12
  8105. ],
  8106. [
  8107. 7,
  8108. 12
  8109. ],
  8110. [
  8111. 7,
  8112. 12
  8113. ],
  8114. [
  8115. 7,
  8116. 12
  8117. ],
  8118. [
  8119. 7,
  8120. 12
  8121. ],
  8122. [
  8123. 7,
  8124. 12
  8125. ],
  8126. [
  8127. 7,
  8128. 12
  8129. ],
  8130. [
  8131. 7,
  8132. 12
  8133. ],
  8134. [
  8135. 7,
  8136. 12
  8137. ],
  8138. [
  8139. 7,
  8140. 12
  8141. ],
  8142. [
  8143. 7,
  8144. 12
  8145. ],
  8146. [
  8147. 7,
  8148. 12
  8149. ],
  8150. [
  8151. 7,
  8152. 12
  8153. ],
  8154. [
  8155. 7,
  8156. 12
  8157. ],
  8158. [
  8159. 7,
  8160. 12
  8161. ],
  8162. [
  8163. 7,
  8164. 12
  8165. ],
  8166. [
  8167. 7,
  8168. 12
  8169. ],
  8170. [
  8171. 7,
  8172. 12
  8173. ],
  8174. [
  8175. 7,
  8176. 12
  8177. ],
  8178. [
  8179. 7,
  8180. 12
  8181. ],
  8182. [
  8183. 7,
  8184. 12
  8185. ],
  8186. [
  8187. 7,
  8188. 12
  8189. ]
  8190. ];
  8191. var blackTable3 = [
  8192. [
  8193. -1,
  8194. -1
  8195. ],
  8196. [
  8197. -1,
  8198. -1
  8199. ],
  8200. [
  8201. -1,
  8202. -1
  8203. ],
  8204. [
  8205. -1,
  8206. -1
  8207. ],
  8208. [
  8209. 6,
  8210. 9
  8211. ],
  8212. [
  8213. 6,
  8214. 8
  8215. ],
  8216. [
  8217. 5,
  8218. 7
  8219. ],
  8220. [
  8221. 5,
  8222. 7
  8223. ],
  8224. [
  8225. 4,
  8226. 6
  8227. ],
  8228. [
  8229. 4,
  8230. 6
  8231. ],
  8232. [
  8233. 4,
  8234. 6
  8235. ],
  8236. [
  8237. 4,
  8238. 6
  8239. ],
  8240. [
  8241. 4,
  8242. 5
  8243. ],
  8244. [
  8245. 4,
  8246. 5
  8247. ],
  8248. [
  8249. 4,
  8250. 5
  8251. ],
  8252. [
  8253. 4,
  8254. 5
  8255. ],
  8256. [
  8257. 3,
  8258. 1
  8259. ],
  8260. [
  8261. 3,
  8262. 1
  8263. ],
  8264. [
  8265. 3,
  8266. 1
  8267. ],
  8268. [
  8269. 3,
  8270. 1
  8271. ],
  8272. [
  8273. 3,
  8274. 1
  8275. ],
  8276. [
  8277. 3,
  8278. 1
  8279. ],
  8280. [
  8281. 3,
  8282. 1
  8283. ],
  8284. [
  8285. 3,
  8286. 1
  8287. ],
  8288. [
  8289. 3,
  8290. 4
  8291. ],
  8292. [
  8293. 3,
  8294. 4
  8295. ],
  8296. [
  8297. 3,
  8298. 4
  8299. ],
  8300. [
  8301. 3,
  8302. 4
  8303. ],
  8304. [
  8305. 3,
  8306. 4
  8307. ],
  8308. [
  8309. 3,
  8310. 4
  8311. ],
  8312. [
  8313. 3,
  8314. 4
  8315. ],
  8316. [
  8317. 3,
  8318. 4
  8319. ],
  8320. [
  8321. 2,
  8322. 3
  8323. ],
  8324. [
  8325. 2,
  8326. 3
  8327. ],
  8328. [
  8329. 2,
  8330. 3
  8331. ],
  8332. [
  8333. 2,
  8334. 3
  8335. ],
  8336. [
  8337. 2,
  8338. 3
  8339. ],
  8340. [
  8341. 2,
  8342. 3
  8343. ],
  8344. [
  8345. 2,
  8346. 3
  8347. ],
  8348. [
  8349. 2,
  8350. 3
  8351. ],
  8352. [
  8353. 2,
  8354. 3
  8355. ],
  8356. [
  8357. 2,
  8358. 3
  8359. ],
  8360. [
  8361. 2,
  8362. 3
  8363. ],
  8364. [
  8365. 2,
  8366. 3
  8367. ],
  8368. [
  8369. 2,
  8370. 3
  8371. ],
  8372. [
  8373. 2,
  8374. 3
  8375. ],
  8376. [
  8377. 2,
  8378. 3
  8379. ],
  8380. [
  8381. 2,
  8382. 3
  8383. ],
  8384. [
  8385. 2,
  8386. 2
  8387. ],
  8388. [
  8389. 2,
  8390. 2
  8391. ],
  8392. [
  8393. 2,
  8394. 2
  8395. ],
  8396. [
  8397. 2,
  8398. 2
  8399. ],
  8400. [
  8401. 2,
  8402. 2
  8403. ],
  8404. [
  8405. 2,
  8406. 2
  8407. ],
  8408. [
  8409. 2,
  8410. 2
  8411. ],
  8412. [
  8413. 2,
  8414. 2
  8415. ],
  8416. [
  8417. 2,
  8418. 2
  8419. ],
  8420. [
  8421. 2,
  8422. 2
  8423. ],
  8424. [
  8425. 2,
  8426. 2
  8427. ],
  8428. [
  8429. 2,
  8430. 2
  8431. ],
  8432. [
  8433. 2,
  8434. 2
  8435. ],
  8436. [
  8437. 2,
  8438. 2
  8439. ],
  8440. [
  8441. 2,
  8442. 2
  8443. ],
  8444. [
  8445. 2,
  8446. 2
  8447. ]
  8448. ];
  8449. function CCITTFaxStream(str, maybeLength, params) {
  8450. this.str = str;
  8451. this.dict = str.dict;
  8452. params = params || Dict.empty;
  8453. this.encoding = params.get('K') || 0;
  8454. this.eoline = params.get('EndOfLine') || false;
  8455. this.byteAlign = params.get('EncodedByteAlign') || false;
  8456. this.columns = params.get('Columns') || 1728;
  8457. this.rows = params.get('Rows') || 0;
  8458. var eoblock = params.get('EndOfBlock');
  8459. if (eoblock === null || eoblock === undefined) {
  8460. eoblock = true;
  8461. }
  8462. this.eoblock = eoblock;
  8463. this.black = params.get('BlackIs1') || false;
  8464. this.codingLine = new Uint32Array(this.columns + 1);
  8465. this.refLine = new Uint32Array(this.columns + 2);
  8466. this.codingLine[0] = this.columns;
  8467. this.codingPos = 0;
  8468. this.row = 0;
  8469. this.nextLine2D = this.encoding < 0;
  8470. this.inputBits = 0;
  8471. this.inputBuf = 0;
  8472. this.outputBits = 0;
  8473. var code1;
  8474. while ((code1 = this.lookBits(12)) === 0) {
  8475. this.eatBits(1);
  8476. }
  8477. if (code1 === 1) {
  8478. this.eatBits(12);
  8479. }
  8480. if (this.encoding > 0) {
  8481. this.nextLine2D = !this.lookBits(1);
  8482. this.eatBits(1);
  8483. }
  8484. DecodeStream.call(this, maybeLength);
  8485. }
  8486. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  8487. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  8488. while (!this.eof) {
  8489. var c = this.lookChar();
  8490. this.ensureBuffer(this.bufferLength + 1);
  8491. this.buffer[this.bufferLength++] = c;
  8492. }
  8493. };
  8494. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  8495. var codingLine = this.codingLine;
  8496. var codingPos = this.codingPos;
  8497. if (a1 > codingLine[codingPos]) {
  8498. if (a1 > this.columns) {
  8499. info('row is wrong length');
  8500. this.err = true;
  8501. a1 = this.columns;
  8502. }
  8503. if (codingPos & 1 ^ blackPixels) {
  8504. ++codingPos;
  8505. }
  8506. codingLine[codingPos] = a1;
  8507. }
  8508. this.codingPos = codingPos;
  8509. };
  8510. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  8511. var codingLine = this.codingLine;
  8512. var codingPos = this.codingPos;
  8513. if (a1 > codingLine[codingPos]) {
  8514. if (a1 > this.columns) {
  8515. info('row is wrong length');
  8516. this.err = true;
  8517. a1 = this.columns;
  8518. }
  8519. if (codingPos & 1 ^ blackPixels) {
  8520. ++codingPos;
  8521. }
  8522. codingLine[codingPos] = a1;
  8523. } else if (a1 < codingLine[codingPos]) {
  8524. if (a1 < 0) {
  8525. info('invalid code');
  8526. this.err = true;
  8527. a1 = 0;
  8528. }
  8529. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  8530. --codingPos;
  8531. }
  8532. codingLine[codingPos] = a1;
  8533. }
  8534. this.codingPos = codingPos;
  8535. };
  8536. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  8537. var refLine = this.refLine;
  8538. var codingLine = this.codingLine;
  8539. var columns = this.columns;
  8540. var refPos, blackPixels, bits, i;
  8541. if (this.outputBits === 0) {
  8542. if (this.eof) {
  8543. return null;
  8544. }
  8545. this.err = false;
  8546. var code1, code2, code3;
  8547. if (this.nextLine2D) {
  8548. for (i = 0; codingLine[i] < columns; ++i) {
  8549. refLine[i] = codingLine[i];
  8550. }
  8551. refLine[i++] = columns;
  8552. refLine[i] = columns;
  8553. codingLine[0] = 0;
  8554. this.codingPos = 0;
  8555. refPos = 0;
  8556. blackPixels = 0;
  8557. while (codingLine[this.codingPos] < columns) {
  8558. code1 = this.getTwoDimCode();
  8559. switch (code1) {
  8560. case twoDimPass:
  8561. this.addPixels(refLine[refPos + 1], blackPixels);
  8562. if (refLine[refPos + 1] < columns) {
  8563. refPos += 2;
  8564. }
  8565. break;
  8566. case twoDimHoriz:
  8567. code1 = code2 = 0;
  8568. if (blackPixels) {
  8569. do {
  8570. code1 += code3 = this.getBlackCode();
  8571. } while (code3 >= 64);
  8572. do {
  8573. code2 += code3 = this.getWhiteCode();
  8574. } while (code3 >= 64);
  8575. } else {
  8576. do {
  8577. code1 += code3 = this.getWhiteCode();
  8578. } while (code3 >= 64);
  8579. do {
  8580. code2 += code3 = this.getBlackCode();
  8581. } while (code3 >= 64);
  8582. }
  8583. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8584. if (codingLine[this.codingPos] < columns) {
  8585. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  8586. }
  8587. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8588. refPos += 2;
  8589. }
  8590. break;
  8591. case twoDimVertR3:
  8592. this.addPixels(refLine[refPos] + 3, blackPixels);
  8593. blackPixels ^= 1;
  8594. if (codingLine[this.codingPos] < columns) {
  8595. ++refPos;
  8596. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8597. refPos += 2;
  8598. }
  8599. }
  8600. break;
  8601. case twoDimVertR2:
  8602. this.addPixels(refLine[refPos] + 2, blackPixels);
  8603. blackPixels ^= 1;
  8604. if (codingLine[this.codingPos] < columns) {
  8605. ++refPos;
  8606. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8607. refPos += 2;
  8608. }
  8609. }
  8610. break;
  8611. case twoDimVertR1:
  8612. this.addPixels(refLine[refPos] + 1, blackPixels);
  8613. blackPixels ^= 1;
  8614. if (codingLine[this.codingPos] < columns) {
  8615. ++refPos;
  8616. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8617. refPos += 2;
  8618. }
  8619. }
  8620. break;
  8621. case twoDimVert0:
  8622. this.addPixels(refLine[refPos], blackPixels);
  8623. blackPixels ^= 1;
  8624. if (codingLine[this.codingPos] < columns) {
  8625. ++refPos;
  8626. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8627. refPos += 2;
  8628. }
  8629. }
  8630. break;
  8631. case twoDimVertL3:
  8632. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  8633. blackPixels ^= 1;
  8634. if (codingLine[this.codingPos] < columns) {
  8635. if (refPos > 0) {
  8636. --refPos;
  8637. } else {
  8638. ++refPos;
  8639. }
  8640. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8641. refPos += 2;
  8642. }
  8643. }
  8644. break;
  8645. case twoDimVertL2:
  8646. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  8647. blackPixels ^= 1;
  8648. if (codingLine[this.codingPos] < columns) {
  8649. if (refPos > 0) {
  8650. --refPos;
  8651. } else {
  8652. ++refPos;
  8653. }
  8654. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8655. refPos += 2;
  8656. }
  8657. }
  8658. break;
  8659. case twoDimVertL1:
  8660. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  8661. blackPixels ^= 1;
  8662. if (codingLine[this.codingPos] < columns) {
  8663. if (refPos > 0) {
  8664. --refPos;
  8665. } else {
  8666. ++refPos;
  8667. }
  8668. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8669. refPos += 2;
  8670. }
  8671. }
  8672. break;
  8673. case ccittEOF:
  8674. this.addPixels(columns, 0);
  8675. this.eof = true;
  8676. break;
  8677. default:
  8678. info('bad 2d code');
  8679. this.addPixels(columns, 0);
  8680. this.err = true;
  8681. }
  8682. }
  8683. } else {
  8684. codingLine[0] = 0;
  8685. this.codingPos = 0;
  8686. blackPixels = 0;
  8687. while (codingLine[this.codingPos] < columns) {
  8688. code1 = 0;
  8689. if (blackPixels) {
  8690. do {
  8691. code1 += code3 = this.getBlackCode();
  8692. } while (code3 >= 64);
  8693. } else {
  8694. do {
  8695. code1 += code3 = this.getWhiteCode();
  8696. } while (code3 >= 64);
  8697. }
  8698. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8699. blackPixels ^= 1;
  8700. }
  8701. }
  8702. var gotEOL = false;
  8703. if (this.byteAlign) {
  8704. this.inputBits &= ~7;
  8705. }
  8706. if (!this.eoblock && this.row === this.rows - 1) {
  8707. this.eof = true;
  8708. } else {
  8709. code1 = this.lookBits(12);
  8710. if (this.eoline) {
  8711. while (code1 !== ccittEOF && code1 !== 1) {
  8712. this.eatBits(1);
  8713. code1 = this.lookBits(12);
  8714. }
  8715. } else {
  8716. while (code1 === 0) {
  8717. this.eatBits(1);
  8718. code1 = this.lookBits(12);
  8719. }
  8720. }
  8721. if (code1 === 1) {
  8722. this.eatBits(12);
  8723. gotEOL = true;
  8724. } else if (code1 === ccittEOF) {
  8725. this.eof = true;
  8726. }
  8727. }
  8728. if (!this.eof && this.encoding > 0) {
  8729. this.nextLine2D = !this.lookBits(1);
  8730. this.eatBits(1);
  8731. }
  8732. if (this.eoblock && gotEOL && this.byteAlign) {
  8733. code1 = this.lookBits(12);
  8734. if (code1 === 1) {
  8735. this.eatBits(12);
  8736. if (this.encoding > 0) {
  8737. this.lookBits(1);
  8738. this.eatBits(1);
  8739. }
  8740. if (this.encoding >= 0) {
  8741. for (i = 0; i < 4; ++i) {
  8742. code1 = this.lookBits(12);
  8743. if (code1 !== 1) {
  8744. info('bad rtc code: ' + code1);
  8745. }
  8746. this.eatBits(12);
  8747. if (this.encoding > 0) {
  8748. this.lookBits(1);
  8749. this.eatBits(1);
  8750. }
  8751. }
  8752. }
  8753. this.eof = true;
  8754. }
  8755. } else if (this.err && this.eoline) {
  8756. while (true) {
  8757. code1 = this.lookBits(13);
  8758. if (code1 === ccittEOF) {
  8759. this.eof = true;
  8760. return null;
  8761. }
  8762. if (code1 >> 1 === 1) {
  8763. break;
  8764. }
  8765. this.eatBits(1);
  8766. }
  8767. this.eatBits(12);
  8768. if (this.encoding > 0) {
  8769. this.eatBits(1);
  8770. this.nextLine2D = !(code1 & 1);
  8771. }
  8772. }
  8773. if (codingLine[0] > 0) {
  8774. this.outputBits = codingLine[this.codingPos = 0];
  8775. } else {
  8776. this.outputBits = codingLine[this.codingPos = 1];
  8777. }
  8778. this.row++;
  8779. }
  8780. var c;
  8781. if (this.outputBits >= 8) {
  8782. c = this.codingPos & 1 ? 0 : 0xFF;
  8783. this.outputBits -= 8;
  8784. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  8785. this.codingPos++;
  8786. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8787. }
  8788. } else {
  8789. bits = 8;
  8790. c = 0;
  8791. do {
  8792. if (this.outputBits > bits) {
  8793. c <<= bits;
  8794. if (!(this.codingPos & 1)) {
  8795. c |= 0xFF >> 8 - bits;
  8796. }
  8797. this.outputBits -= bits;
  8798. bits = 0;
  8799. } else {
  8800. c <<= this.outputBits;
  8801. if (!(this.codingPos & 1)) {
  8802. c |= 0xFF >> 8 - this.outputBits;
  8803. }
  8804. bits -= this.outputBits;
  8805. this.outputBits = 0;
  8806. if (codingLine[this.codingPos] < columns) {
  8807. this.codingPos++;
  8808. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8809. } else if (bits > 0) {
  8810. c <<= bits;
  8811. bits = 0;
  8812. }
  8813. }
  8814. } while (bits);
  8815. }
  8816. if (this.black) {
  8817. c ^= 0xFF;
  8818. }
  8819. return c;
  8820. };
  8821. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  8822. var limitValue = limit || 0;
  8823. for (var i = start; i <= end; ++i) {
  8824. var code = this.lookBits(i);
  8825. if (code === ccittEOF) {
  8826. return [
  8827. true,
  8828. 1,
  8829. false
  8830. ];
  8831. }
  8832. if (i < end) {
  8833. code <<= end - i;
  8834. }
  8835. if (!limitValue || code >= limitValue) {
  8836. var p = table[code - limitValue];
  8837. if (p[0] === i) {
  8838. this.eatBits(i);
  8839. return [
  8840. true,
  8841. p[1],
  8842. true
  8843. ];
  8844. }
  8845. }
  8846. }
  8847. return [
  8848. false,
  8849. 0,
  8850. false
  8851. ];
  8852. };
  8853. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8854. var code = 0;
  8855. var p;
  8856. if (this.eoblock) {
  8857. code = this.lookBits(7);
  8858. p = twoDimTable[code];
  8859. if (p && p[0] > 0) {
  8860. this.eatBits(p[0]);
  8861. return p[1];
  8862. }
  8863. } else {
  8864. var result = this.findTableCode(1, 7, twoDimTable);
  8865. if (result[0] && result[2]) {
  8866. return result[1];
  8867. }
  8868. }
  8869. info('Bad two dim code');
  8870. return ccittEOF;
  8871. };
  8872. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8873. var code = 0;
  8874. var p;
  8875. if (this.eoblock) {
  8876. code = this.lookBits(12);
  8877. if (code === ccittEOF) {
  8878. return 1;
  8879. }
  8880. if (code >> 5 === 0) {
  8881. p = whiteTable1[code];
  8882. } else {
  8883. p = whiteTable2[code >> 3];
  8884. }
  8885. if (p[0] > 0) {
  8886. this.eatBits(p[0]);
  8887. return p[1];
  8888. }
  8889. } else {
  8890. var result = this.findTableCode(1, 9, whiteTable2);
  8891. if (result[0]) {
  8892. return result[1];
  8893. }
  8894. result = this.findTableCode(11, 12, whiteTable1);
  8895. if (result[0]) {
  8896. return result[1];
  8897. }
  8898. }
  8899. info('bad white code');
  8900. this.eatBits(1);
  8901. return 1;
  8902. };
  8903. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8904. var code, p;
  8905. if (this.eoblock) {
  8906. code = this.lookBits(13);
  8907. if (code === ccittEOF) {
  8908. return 1;
  8909. }
  8910. if (code >> 7 === 0) {
  8911. p = blackTable1[code];
  8912. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8913. p = blackTable2[(code >> 1) - 64];
  8914. } else {
  8915. p = blackTable3[code >> 7];
  8916. }
  8917. if (p[0] > 0) {
  8918. this.eatBits(p[0]);
  8919. return p[1];
  8920. }
  8921. } else {
  8922. var result = this.findTableCode(2, 6, blackTable3);
  8923. if (result[0]) {
  8924. return result[1];
  8925. }
  8926. result = this.findTableCode(7, 12, blackTable2, 64);
  8927. if (result[0]) {
  8928. return result[1];
  8929. }
  8930. result = this.findTableCode(10, 13, blackTable1);
  8931. if (result[0]) {
  8932. return result[1];
  8933. }
  8934. }
  8935. info('bad black code');
  8936. this.eatBits(1);
  8937. return 1;
  8938. };
  8939. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8940. var c;
  8941. while (this.inputBits < n) {
  8942. if ((c = this.str.getByte()) === -1) {
  8943. if (this.inputBits === 0) {
  8944. return ccittEOF;
  8945. }
  8946. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8947. }
  8948. this.inputBuf = this.inputBuf << 8 | c;
  8949. this.inputBits += 8;
  8950. }
  8951. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8952. };
  8953. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8954. if ((this.inputBits -= n) < 0) {
  8955. this.inputBits = 0;
  8956. }
  8957. };
  8958. return CCITTFaxStream;
  8959. }();
  8960. var LZWStream = function LZWStreamClosure() {
  8961. function LZWStream(str, maybeLength, earlyChange) {
  8962. this.str = str;
  8963. this.dict = str.dict;
  8964. this.cachedData = 0;
  8965. this.bitsCached = 0;
  8966. var maxLzwDictionarySize = 4096;
  8967. var lzwState = {
  8968. earlyChange: earlyChange,
  8969. codeLength: 9,
  8970. nextCode: 258,
  8971. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8972. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8973. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8974. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8975. currentSequenceLength: 0
  8976. };
  8977. for (var i = 0; i < 256; ++i) {
  8978. lzwState.dictionaryValues[i] = i;
  8979. lzwState.dictionaryLengths[i] = 1;
  8980. }
  8981. this.lzwState = lzwState;
  8982. DecodeStream.call(this, maybeLength);
  8983. }
  8984. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8985. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8986. var bitsCached = this.bitsCached;
  8987. var cachedData = this.cachedData;
  8988. while (bitsCached < n) {
  8989. var c = this.str.getByte();
  8990. if (c === -1) {
  8991. this.eof = true;
  8992. return null;
  8993. }
  8994. cachedData = cachedData << 8 | c;
  8995. bitsCached += 8;
  8996. }
  8997. this.bitsCached = bitsCached -= n;
  8998. this.cachedData = cachedData;
  8999. this.lastCode = null;
  9000. return cachedData >>> bitsCached & (1 << n) - 1;
  9001. };
  9002. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  9003. var blockSize = 512;
  9004. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  9005. var i, j, q;
  9006. var lzwState = this.lzwState;
  9007. if (!lzwState) {
  9008. return;
  9009. }
  9010. var earlyChange = lzwState.earlyChange;
  9011. var nextCode = lzwState.nextCode;
  9012. var dictionaryValues = lzwState.dictionaryValues;
  9013. var dictionaryLengths = lzwState.dictionaryLengths;
  9014. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  9015. var codeLength = lzwState.codeLength;
  9016. var prevCode = lzwState.prevCode;
  9017. var currentSequence = lzwState.currentSequence;
  9018. var currentSequenceLength = lzwState.currentSequenceLength;
  9019. var decodedLength = 0;
  9020. var currentBufferLength = this.bufferLength;
  9021. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9022. for (i = 0; i < blockSize; i++) {
  9023. var code = this.readBits(codeLength);
  9024. var hasPrev = currentSequenceLength > 0;
  9025. if (code < 256) {
  9026. currentSequence[0] = code;
  9027. currentSequenceLength = 1;
  9028. } else if (code >= 258) {
  9029. if (code < nextCode) {
  9030. currentSequenceLength = dictionaryLengths[code];
  9031. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  9032. currentSequence[j] = dictionaryValues[q];
  9033. q = dictionaryPrevCodes[q];
  9034. }
  9035. } else {
  9036. currentSequence[currentSequenceLength++] = currentSequence[0];
  9037. }
  9038. } else if (code === 256) {
  9039. codeLength = 9;
  9040. nextCode = 258;
  9041. currentSequenceLength = 0;
  9042. continue;
  9043. } else {
  9044. this.eof = true;
  9045. delete this.lzwState;
  9046. break;
  9047. }
  9048. if (hasPrev) {
  9049. dictionaryPrevCodes[nextCode] = prevCode;
  9050. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  9051. dictionaryValues[nextCode] = currentSequence[0];
  9052. nextCode++;
  9053. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  9054. }
  9055. prevCode = code;
  9056. decodedLength += currentSequenceLength;
  9057. if (estimatedDecodedSize < decodedLength) {
  9058. do {
  9059. estimatedDecodedSize += decodedSizeDelta;
  9060. } while (estimatedDecodedSize < decodedLength);
  9061. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9062. }
  9063. for (j = 0; j < currentSequenceLength; j++) {
  9064. buffer[currentBufferLength++] = currentSequence[j];
  9065. }
  9066. }
  9067. lzwState.nextCode = nextCode;
  9068. lzwState.codeLength = codeLength;
  9069. lzwState.prevCode = prevCode;
  9070. lzwState.currentSequenceLength = currentSequenceLength;
  9071. this.bufferLength = currentBufferLength;
  9072. };
  9073. return LZWStream;
  9074. }();
  9075. var NullStream = function NullStreamClosure() {
  9076. function NullStream() {
  9077. Stream.call(this, new Uint8Array(0));
  9078. }
  9079. NullStream.prototype = Stream.prototype;
  9080. return NullStream;
  9081. }();
  9082. exports.Ascii85Stream = Ascii85Stream;
  9083. exports.AsciiHexStream = AsciiHexStream;
  9084. exports.CCITTFaxStream = CCITTFaxStream;
  9085. exports.DecryptStream = DecryptStream;
  9086. exports.DecodeStream = DecodeStream;
  9087. exports.FlateStream = FlateStream;
  9088. exports.Jbig2Stream = Jbig2Stream;
  9089. exports.JpegStream = JpegStream;
  9090. exports.JpxStream = JpxStream;
  9091. exports.NullStream = NullStream;
  9092. exports.PredictorStream = PredictorStream;
  9093. exports.RunLengthStream = RunLengthStream;
  9094. exports.Stream = Stream;
  9095. exports.StreamsSequenceStream = StreamsSequenceStream;
  9096. exports.StringStream = StringStream;
  9097. exports.LZWStream = LZWStream;
  9098. /***/ }),
  9099. /* 3 */
  9100. /***/ (function(module, exports, __w_pdfjs_require__) {
  9101. "use strict";
  9102. var sharedUtil = __w_pdfjs_require__(0);
  9103. var corePrimitives = __w_pdfjs_require__(1);
  9104. var coreFunction = __w_pdfjs_require__(6);
  9105. var error = sharedUtil.error;
  9106. var info = sharedUtil.info;
  9107. var isArray = sharedUtil.isArray;
  9108. var isString = sharedUtil.isString;
  9109. var shadow = sharedUtil.shadow;
  9110. var warn = sharedUtil.warn;
  9111. var isDict = corePrimitives.isDict;
  9112. var isName = corePrimitives.isName;
  9113. var isStream = corePrimitives.isStream;
  9114. var PDFFunction = coreFunction.PDFFunction;
  9115. var ColorSpace = function ColorSpaceClosure() {
  9116. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  9117. var COMPONENTS = 3;
  9118. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  9119. var xRatio = w1 / w2;
  9120. var yRatio = h1 / h2;
  9121. var i, j, py, newIndex = 0, oldIndex;
  9122. var xScaled = new Uint16Array(w2);
  9123. var w1Scanline = w1 * COMPONENTS;
  9124. for (i = 0; i < w2; i++) {
  9125. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  9126. }
  9127. for (i = 0; i < h2; i++) {
  9128. py = Math.floor(i * yRatio) * w1Scanline;
  9129. for (j = 0; j < w2; j++) {
  9130. oldIndex = py + xScaled[j];
  9131. dest[newIndex++] = src[oldIndex++];
  9132. dest[newIndex++] = src[oldIndex++];
  9133. dest[newIndex++] = src[oldIndex++];
  9134. newIndex += alpha01;
  9135. }
  9136. }
  9137. }
  9138. function ColorSpace() {
  9139. error('should not call ColorSpace constructor');
  9140. }
  9141. ColorSpace.prototype = {
  9142. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  9143. var rgb = new Uint8Array(3);
  9144. this.getRgbItem(src, srcOffset, rgb, 0);
  9145. return rgb;
  9146. },
  9147. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  9148. error('Should not call ColorSpace.getRgbItem');
  9149. },
  9150. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9151. error('Should not call ColorSpace.getRgbBuffer');
  9152. },
  9153. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  9154. error('Should not call ColorSpace.getOutputLength');
  9155. },
  9156. isPassthrough: function ColorSpace_isPassthrough(bits) {
  9157. return false;
  9158. },
  9159. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  9160. var count = originalWidth * originalHeight;
  9161. var rgbBuf = null;
  9162. var numComponentColors = 1 << bpc;
  9163. var needsResizing = originalHeight !== height || originalWidth !== width;
  9164. var i, ii;
  9165. if (this.isPassthrough(bpc)) {
  9166. rgbBuf = comps;
  9167. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  9168. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  9169. var key;
  9170. for (i = 0; i < numComponentColors; i++) {
  9171. allColors[i] = i;
  9172. }
  9173. var colorMap = new Uint8Array(numComponentColors * 3);
  9174. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  9175. var destPos, rgbPos;
  9176. if (!needsResizing) {
  9177. destPos = 0;
  9178. for (i = 0; i < count; ++i) {
  9179. key = comps[i] * 3;
  9180. dest[destPos++] = colorMap[key];
  9181. dest[destPos++] = colorMap[key + 1];
  9182. dest[destPos++] = colorMap[key + 2];
  9183. destPos += alpha01;
  9184. }
  9185. } else {
  9186. rgbBuf = new Uint8Array(count * 3);
  9187. rgbPos = 0;
  9188. for (i = 0; i < count; ++i) {
  9189. key = comps[i] * 3;
  9190. rgbBuf[rgbPos++] = colorMap[key];
  9191. rgbBuf[rgbPos++] = colorMap[key + 1];
  9192. rgbBuf[rgbPos++] = colorMap[key + 2];
  9193. }
  9194. }
  9195. } else {
  9196. if (!needsResizing) {
  9197. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  9198. } else {
  9199. rgbBuf = new Uint8Array(count * 3);
  9200. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  9201. }
  9202. }
  9203. if (rgbBuf) {
  9204. if (needsResizing) {
  9205. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  9206. } else {
  9207. rgbPos = 0;
  9208. destPos = 0;
  9209. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  9210. dest[destPos++] = rgbBuf[rgbPos++];
  9211. dest[destPos++] = rgbBuf[rgbPos++];
  9212. dest[destPos++] = rgbBuf[rgbPos++];
  9213. destPos += alpha01;
  9214. }
  9215. }
  9216. }
  9217. },
  9218. usesZeroToOneRange: true
  9219. };
  9220. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  9221. var IR = ColorSpace.parseToIR(cs, xref, res);
  9222. if (IR instanceof AlternateCS) {
  9223. return IR;
  9224. }
  9225. return ColorSpace.fromIR(IR);
  9226. };
  9227. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  9228. var name = isArray(IR) ? IR[0] : IR;
  9229. var whitePoint, blackPoint, gamma;
  9230. switch (name) {
  9231. case 'DeviceGrayCS':
  9232. return this.singletons.gray;
  9233. case 'DeviceRgbCS':
  9234. return this.singletons.rgb;
  9235. case 'DeviceCmykCS':
  9236. return this.singletons.cmyk;
  9237. case 'CalGrayCS':
  9238. whitePoint = IR[1];
  9239. blackPoint = IR[2];
  9240. gamma = IR[3];
  9241. return new CalGrayCS(whitePoint, blackPoint, gamma);
  9242. case 'CalRGBCS':
  9243. whitePoint = IR[1];
  9244. blackPoint = IR[2];
  9245. gamma = IR[3];
  9246. var matrix = IR[4];
  9247. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  9248. case 'PatternCS':
  9249. var basePatternCS = IR[1];
  9250. if (basePatternCS) {
  9251. basePatternCS = ColorSpace.fromIR(basePatternCS);
  9252. }
  9253. return new PatternCS(basePatternCS);
  9254. case 'IndexedCS':
  9255. var baseIndexedCS = IR[1];
  9256. var hiVal = IR[2];
  9257. var lookup = IR[3];
  9258. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  9259. case 'AlternateCS':
  9260. var numComps = IR[1];
  9261. var alt = IR[2];
  9262. var tintFnIR = IR[3];
  9263. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  9264. case 'LabCS':
  9265. whitePoint = IR[1];
  9266. blackPoint = IR[2];
  9267. var range = IR[3];
  9268. return new LabCS(whitePoint, blackPoint, range);
  9269. default:
  9270. error('Unknown name ' + name);
  9271. }
  9272. return null;
  9273. };
  9274. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  9275. if (isName(cs)) {
  9276. var colorSpaces = res.get('ColorSpace');
  9277. if (isDict(colorSpaces)) {
  9278. var refcs = colorSpaces.get(cs.name);
  9279. if (refcs) {
  9280. cs = refcs;
  9281. }
  9282. }
  9283. }
  9284. cs = xref.fetchIfRef(cs);
  9285. if (isName(cs)) {
  9286. switch (cs.name) {
  9287. case 'DeviceGray':
  9288. case 'G':
  9289. return 'DeviceGrayCS';
  9290. case 'DeviceRGB':
  9291. case 'RGB':
  9292. return 'DeviceRgbCS';
  9293. case 'DeviceCMYK':
  9294. case 'CMYK':
  9295. return 'DeviceCmykCS';
  9296. case 'Pattern':
  9297. return [
  9298. 'PatternCS',
  9299. null
  9300. ];
  9301. default:
  9302. error('unrecognized colorspace ' + cs.name);
  9303. }
  9304. } else if (isArray(cs)) {
  9305. var mode = xref.fetchIfRef(cs[0]).name;
  9306. var numComps, params, alt, whitePoint, blackPoint, gamma;
  9307. switch (mode) {
  9308. case 'DeviceGray':
  9309. case 'G':
  9310. return 'DeviceGrayCS';
  9311. case 'DeviceRGB':
  9312. case 'RGB':
  9313. return 'DeviceRgbCS';
  9314. case 'DeviceCMYK':
  9315. case 'CMYK':
  9316. return 'DeviceCmykCS';
  9317. case 'CalGray':
  9318. params = xref.fetchIfRef(cs[1]);
  9319. whitePoint = params.getArray('WhitePoint');
  9320. blackPoint = params.getArray('BlackPoint');
  9321. gamma = params.get('Gamma');
  9322. return [
  9323. 'CalGrayCS',
  9324. whitePoint,
  9325. blackPoint,
  9326. gamma
  9327. ];
  9328. case 'CalRGB':
  9329. params = xref.fetchIfRef(cs[1]);
  9330. whitePoint = params.getArray('WhitePoint');
  9331. blackPoint = params.getArray('BlackPoint');
  9332. gamma = params.getArray('Gamma');
  9333. var matrix = params.getArray('Matrix');
  9334. return [
  9335. 'CalRGBCS',
  9336. whitePoint,
  9337. blackPoint,
  9338. gamma,
  9339. matrix
  9340. ];
  9341. case 'ICCBased':
  9342. var stream = xref.fetchIfRef(cs[1]);
  9343. var dict = stream.dict;
  9344. numComps = dict.get('N');
  9345. alt = dict.get('Alternate');
  9346. if (alt) {
  9347. var altIR = ColorSpace.parseToIR(alt, xref, res);
  9348. var altCS = ColorSpace.fromIR(altIR);
  9349. if (altCS.numComps === numComps) {
  9350. return altIR;
  9351. }
  9352. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  9353. }
  9354. if (numComps === 1) {
  9355. return 'DeviceGrayCS';
  9356. } else if (numComps === 3) {
  9357. return 'DeviceRgbCS';
  9358. } else if (numComps === 4) {
  9359. return 'DeviceCmykCS';
  9360. }
  9361. break;
  9362. case 'Pattern':
  9363. var basePatternCS = cs[1] || null;
  9364. if (basePatternCS) {
  9365. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  9366. }
  9367. return [
  9368. 'PatternCS',
  9369. basePatternCS
  9370. ];
  9371. case 'Indexed':
  9372. case 'I':
  9373. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  9374. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  9375. var lookup = xref.fetchIfRef(cs[3]);
  9376. if (isStream(lookup)) {
  9377. lookup = lookup.getBytes();
  9378. }
  9379. return [
  9380. 'IndexedCS',
  9381. baseIndexedCS,
  9382. hiVal,
  9383. lookup
  9384. ];
  9385. case 'Separation':
  9386. case 'DeviceN':
  9387. var name = xref.fetchIfRef(cs[1]);
  9388. numComps = isArray(name) ? name.length : 1;
  9389. alt = ColorSpace.parseToIR(cs[2], xref, res);
  9390. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  9391. return [
  9392. 'AlternateCS',
  9393. numComps,
  9394. alt,
  9395. tintFnIR
  9396. ];
  9397. case 'Lab':
  9398. params = xref.fetchIfRef(cs[1]);
  9399. whitePoint = params.getArray('WhitePoint');
  9400. blackPoint = params.getArray('BlackPoint');
  9401. var range = params.getArray('Range');
  9402. return [
  9403. 'LabCS',
  9404. whitePoint,
  9405. blackPoint,
  9406. range
  9407. ];
  9408. default:
  9409. error('unimplemented color space object "' + mode + '"');
  9410. }
  9411. } else {
  9412. error('unrecognized color space object: "' + cs + '"');
  9413. }
  9414. return null;
  9415. };
  9416. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  9417. if (!isArray(decode)) {
  9418. return true;
  9419. }
  9420. if (n * 2 !== decode.length) {
  9421. warn('The decode map is not the correct length');
  9422. return true;
  9423. }
  9424. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  9425. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  9426. return false;
  9427. }
  9428. }
  9429. return true;
  9430. };
  9431. ColorSpace.singletons = {
  9432. get gray() {
  9433. return shadow(this, 'gray', new DeviceGrayCS());
  9434. },
  9435. get rgb() {
  9436. return shadow(this, 'rgb', new DeviceRgbCS());
  9437. },
  9438. get cmyk() {
  9439. return shadow(this, 'cmyk', new DeviceCmykCS());
  9440. }
  9441. };
  9442. return ColorSpace;
  9443. }();
  9444. var AlternateCS = function AlternateCSClosure() {
  9445. function AlternateCS(numComps, base, tintFn) {
  9446. this.name = 'Alternate';
  9447. this.numComps = numComps;
  9448. this.defaultColor = new Float32Array(numComps);
  9449. for (var i = 0; i < numComps; ++i) {
  9450. this.defaultColor[i] = 1;
  9451. }
  9452. this.base = base;
  9453. this.tintFn = tintFn;
  9454. this.tmpBuf = new Float32Array(base.numComps);
  9455. }
  9456. AlternateCS.prototype = {
  9457. getRgb: ColorSpace.prototype.getRgb,
  9458. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9459. var tmpBuf = this.tmpBuf;
  9460. this.tintFn(src, srcOffset, tmpBuf, 0);
  9461. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  9462. },
  9463. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9464. var tintFn = this.tintFn;
  9465. var base = this.base;
  9466. var scale = 1 / ((1 << bits) - 1);
  9467. var baseNumComps = base.numComps;
  9468. var usesZeroToOneRange = base.usesZeroToOneRange;
  9469. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  9470. var pos = isPassthrough ? destOffset : 0;
  9471. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  9472. var numComps = this.numComps;
  9473. var scaled = new Float32Array(numComps);
  9474. var tinted = new Float32Array(baseNumComps);
  9475. var i, j;
  9476. for (i = 0; i < count; i++) {
  9477. for (j = 0; j < numComps; j++) {
  9478. scaled[j] = src[srcOffset++] * scale;
  9479. }
  9480. tintFn(scaled, 0, tinted, 0);
  9481. if (usesZeroToOneRange) {
  9482. for (j = 0; j < baseNumComps; j++) {
  9483. baseBuf[pos++] = tinted[j] * 255;
  9484. }
  9485. } else {
  9486. base.getRgbItem(tinted, 0, baseBuf, pos);
  9487. pos += baseNumComps;
  9488. }
  9489. }
  9490. if (!isPassthrough) {
  9491. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  9492. }
  9493. },
  9494. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  9495. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  9496. },
  9497. isPassthrough: ColorSpace.prototype.isPassthrough,
  9498. fillRgb: ColorSpace.prototype.fillRgb,
  9499. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  9500. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9501. },
  9502. usesZeroToOneRange: true
  9503. };
  9504. return AlternateCS;
  9505. }();
  9506. var PatternCS = function PatternCSClosure() {
  9507. function PatternCS(baseCS) {
  9508. this.name = 'Pattern';
  9509. this.base = baseCS;
  9510. }
  9511. PatternCS.prototype = {};
  9512. return PatternCS;
  9513. }();
  9514. var IndexedCS = function IndexedCSClosure() {
  9515. function IndexedCS(base, highVal, lookup) {
  9516. this.name = 'Indexed';
  9517. this.numComps = 1;
  9518. this.defaultColor = new Uint8Array(this.numComps);
  9519. this.base = base;
  9520. this.highVal = highVal;
  9521. var baseNumComps = base.numComps;
  9522. var length = baseNumComps * highVal;
  9523. if (isStream(lookup)) {
  9524. this.lookup = new Uint8Array(length);
  9525. var bytes = lookup.getBytes(length);
  9526. this.lookup.set(bytes);
  9527. } else if (isString(lookup)) {
  9528. this.lookup = new Uint8Array(length);
  9529. for (var i = 0; i < length; ++i) {
  9530. this.lookup[i] = lookup.charCodeAt(i);
  9531. }
  9532. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  9533. this.lookup = lookup;
  9534. } else {
  9535. error('Unrecognized lookup table: ' + lookup);
  9536. }
  9537. }
  9538. IndexedCS.prototype = {
  9539. getRgb: ColorSpace.prototype.getRgb,
  9540. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9541. var numComps = this.base.numComps;
  9542. var start = src[srcOffset] * numComps;
  9543. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  9544. },
  9545. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9546. var base = this.base;
  9547. var numComps = base.numComps;
  9548. var outputDelta = base.getOutputLength(numComps, alpha01);
  9549. var lookup = this.lookup;
  9550. for (var i = 0; i < count; ++i) {
  9551. var lookupPos = src[srcOffset++] * numComps;
  9552. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  9553. destOffset += outputDelta;
  9554. }
  9555. },
  9556. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  9557. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  9558. },
  9559. isPassthrough: ColorSpace.prototype.isPassthrough,
  9560. fillRgb: ColorSpace.prototype.fillRgb,
  9561. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  9562. return true;
  9563. },
  9564. usesZeroToOneRange: true
  9565. };
  9566. return IndexedCS;
  9567. }();
  9568. var DeviceGrayCS = function DeviceGrayCSClosure() {
  9569. function DeviceGrayCS() {
  9570. this.name = 'DeviceGray';
  9571. this.numComps = 1;
  9572. this.defaultColor = new Float32Array(this.numComps);
  9573. }
  9574. DeviceGrayCS.prototype = {
  9575. getRgb: ColorSpace.prototype.getRgb,
  9576. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9577. var c = src[srcOffset] * 255 | 0;
  9578. c = c < 0 ? 0 : c > 255 ? 255 : c;
  9579. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  9580. },
  9581. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9582. var scale = 255 / ((1 << bits) - 1);
  9583. var j = srcOffset, q = destOffset;
  9584. for (var i = 0; i < count; ++i) {
  9585. var c = scale * src[j++] | 0;
  9586. dest[q++] = c;
  9587. dest[q++] = c;
  9588. dest[q++] = c;
  9589. q += alpha01;
  9590. }
  9591. },
  9592. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  9593. return inputLength * (3 + alpha01);
  9594. },
  9595. isPassthrough: ColorSpace.prototype.isPassthrough,
  9596. fillRgb: ColorSpace.prototype.fillRgb,
  9597. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  9598. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9599. },
  9600. usesZeroToOneRange: true
  9601. };
  9602. return DeviceGrayCS;
  9603. }();
  9604. var DeviceRgbCS = function DeviceRgbCSClosure() {
  9605. function DeviceRgbCS() {
  9606. this.name = 'DeviceRGB';
  9607. this.numComps = 3;
  9608. this.defaultColor = new Float32Array(this.numComps);
  9609. }
  9610. DeviceRgbCS.prototype = {
  9611. getRgb: ColorSpace.prototype.getRgb,
  9612. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9613. var r = src[srcOffset] * 255 | 0;
  9614. var g = src[srcOffset + 1] * 255 | 0;
  9615. var b = src[srcOffset + 2] * 255 | 0;
  9616. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  9617. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  9618. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  9619. },
  9620. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9621. if (bits === 8 && alpha01 === 0) {
  9622. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  9623. return;
  9624. }
  9625. var scale = 255 / ((1 << bits) - 1);
  9626. var j = srcOffset, q = destOffset;
  9627. for (var i = 0; i < count; ++i) {
  9628. dest[q++] = scale * src[j++] | 0;
  9629. dest[q++] = scale * src[j++] | 0;
  9630. dest[q++] = scale * src[j++] | 0;
  9631. q += alpha01;
  9632. }
  9633. },
  9634. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  9635. return inputLength * (3 + alpha01) / 3 | 0;
  9636. },
  9637. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  9638. return bits === 8;
  9639. },
  9640. fillRgb: ColorSpace.prototype.fillRgb,
  9641. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  9642. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9643. },
  9644. usesZeroToOneRange: true
  9645. };
  9646. return DeviceRgbCS;
  9647. }();
  9648. var DeviceCmykCS = function DeviceCmykCSClosure() {
  9649. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  9650. var c = src[srcOffset + 0] * srcScale;
  9651. var m = src[srcOffset + 1] * srcScale;
  9652. var y = src[srcOffset + 2] * srcScale;
  9653. var k = src[srcOffset + 3] * srcScale;
  9654. 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;
  9655. 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;
  9656. 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;
  9657. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  9658. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  9659. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  9660. }
  9661. function DeviceCmykCS() {
  9662. this.name = 'DeviceCMYK';
  9663. this.numComps = 4;
  9664. this.defaultColor = new Float32Array(this.numComps);
  9665. this.defaultColor[3] = 1;
  9666. }
  9667. DeviceCmykCS.prototype = {
  9668. getRgb: ColorSpace.prototype.getRgb,
  9669. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9670. convertToRgb(src, srcOffset, 1, dest, destOffset);
  9671. },
  9672. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9673. var scale = 1 / ((1 << bits) - 1);
  9674. for (var i = 0; i < count; i++) {
  9675. convertToRgb(src, srcOffset, scale, dest, destOffset);
  9676. srcOffset += 4;
  9677. destOffset += 3 + alpha01;
  9678. }
  9679. },
  9680. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  9681. return inputLength / 4 * (3 + alpha01) | 0;
  9682. },
  9683. isPassthrough: ColorSpace.prototype.isPassthrough,
  9684. fillRgb: ColorSpace.prototype.fillRgb,
  9685. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  9686. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9687. },
  9688. usesZeroToOneRange: true
  9689. };
  9690. return DeviceCmykCS;
  9691. }();
  9692. var CalGrayCS = function CalGrayCSClosure() {
  9693. function CalGrayCS(whitePoint, blackPoint, gamma) {
  9694. this.name = 'CalGray';
  9695. this.numComps = 1;
  9696. this.defaultColor = new Float32Array(this.numComps);
  9697. if (!whitePoint) {
  9698. error('WhitePoint missing - required for color space CalGray');
  9699. }
  9700. blackPoint = blackPoint || [
  9701. 0,
  9702. 0,
  9703. 0
  9704. ];
  9705. gamma = gamma || 1;
  9706. this.XW = whitePoint[0];
  9707. this.YW = whitePoint[1];
  9708. this.ZW = whitePoint[2];
  9709. this.XB = blackPoint[0];
  9710. this.YB = blackPoint[1];
  9711. this.ZB = blackPoint[2];
  9712. this.G = gamma;
  9713. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9714. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9715. }
  9716. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9717. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  9718. this.XB = this.YB = this.ZB = 0;
  9719. }
  9720. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  9721. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  9722. }
  9723. if (this.G < 1) {
  9724. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  9725. this.G = 1;
  9726. }
  9727. }
  9728. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9729. var A = src[srcOffset] * scale;
  9730. var AG = Math.pow(A, cs.G);
  9731. var L = cs.YW * AG;
  9732. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  9733. dest[destOffset] = val;
  9734. dest[destOffset + 1] = val;
  9735. dest[destOffset + 2] = val;
  9736. }
  9737. CalGrayCS.prototype = {
  9738. getRgb: ColorSpace.prototype.getRgb,
  9739. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9740. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9741. },
  9742. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9743. var scale = 1 / ((1 << bits) - 1);
  9744. for (var i = 0; i < count; ++i) {
  9745. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9746. srcOffset += 1;
  9747. destOffset += 3 + alpha01;
  9748. }
  9749. },
  9750. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  9751. return inputLength * (3 + alpha01);
  9752. },
  9753. isPassthrough: ColorSpace.prototype.isPassthrough,
  9754. fillRgb: ColorSpace.prototype.fillRgb,
  9755. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  9756. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9757. },
  9758. usesZeroToOneRange: true
  9759. };
  9760. return CalGrayCS;
  9761. }();
  9762. var CalRGBCS = function CalRGBCSClosure() {
  9763. var BRADFORD_SCALE_MATRIX = new Float32Array([
  9764. 0.8951,
  9765. 0.2664,
  9766. -0.1614,
  9767. -0.7502,
  9768. 1.7135,
  9769. 0.0367,
  9770. 0.0389,
  9771. -0.0685,
  9772. 1.0296
  9773. ]);
  9774. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  9775. 0.9869929,
  9776. -0.1470543,
  9777. 0.1599627,
  9778. 0.4323053,
  9779. 0.5183603,
  9780. 0.0492912,
  9781. -0.0085287,
  9782. 0.0400428,
  9783. 0.9684867
  9784. ]);
  9785. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  9786. 3.2404542,
  9787. -1.5371385,
  9788. -0.4985314,
  9789. -0.9692660,
  9790. 1.8760108,
  9791. 0.0415560,
  9792. 0.0556434,
  9793. -0.2040259,
  9794. 1.0572252
  9795. ]);
  9796. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  9797. 1,
  9798. 1,
  9799. 1
  9800. ]);
  9801. var tempNormalizeMatrix = new Float32Array(3);
  9802. var tempConvertMatrix1 = new Float32Array(3);
  9803. var tempConvertMatrix2 = new Float32Array(3);
  9804. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  9805. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  9806. this.name = 'CalRGB';
  9807. this.numComps = 3;
  9808. this.defaultColor = new Float32Array(this.numComps);
  9809. if (!whitePoint) {
  9810. error('WhitePoint missing - required for color space CalRGB');
  9811. }
  9812. blackPoint = blackPoint || new Float32Array(3);
  9813. gamma = gamma || new Float32Array([
  9814. 1,
  9815. 1,
  9816. 1
  9817. ]);
  9818. matrix = matrix || new Float32Array([
  9819. 1,
  9820. 0,
  9821. 0,
  9822. 0,
  9823. 1,
  9824. 0,
  9825. 0,
  9826. 0,
  9827. 1
  9828. ]);
  9829. var XW = whitePoint[0];
  9830. var YW = whitePoint[1];
  9831. var ZW = whitePoint[2];
  9832. this.whitePoint = whitePoint;
  9833. var XB = blackPoint[0];
  9834. var YB = blackPoint[1];
  9835. var ZB = blackPoint[2];
  9836. this.blackPoint = blackPoint;
  9837. this.GR = gamma[0];
  9838. this.GG = gamma[1];
  9839. this.GB = gamma[2];
  9840. this.MXA = matrix[0];
  9841. this.MYA = matrix[1];
  9842. this.MZA = matrix[2];
  9843. this.MXB = matrix[3];
  9844. this.MYB = matrix[4];
  9845. this.MZB = matrix[5];
  9846. this.MXC = matrix[6];
  9847. this.MYC = matrix[7];
  9848. this.MZC = matrix[8];
  9849. if (XW < 0 || ZW < 0 || YW !== 1) {
  9850. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9851. }
  9852. if (XB < 0 || YB < 0 || ZB < 0) {
  9853. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9854. this.blackPoint = new Float32Array(3);
  9855. }
  9856. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9857. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9858. this.GR = this.GG = this.GB = 1;
  9859. }
  9860. 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) {
  9861. 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');
  9862. this.MXA = this.MYB = this.MZC = 1;
  9863. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9864. }
  9865. }
  9866. function matrixProduct(a, b, result) {
  9867. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9868. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9869. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9870. }
  9871. function convertToFlat(sourceWhitePoint, LMS, result) {
  9872. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9873. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9874. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9875. }
  9876. function convertToD65(sourceWhitePoint, LMS, result) {
  9877. var D65X = 0.95047;
  9878. var D65Y = 1;
  9879. var D65Z = 1.08883;
  9880. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9881. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9882. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9883. }
  9884. function sRGBTransferFunction(color) {
  9885. if (color <= 0.0031308) {
  9886. return adjustToRange(0, 1, 12.92 * color);
  9887. }
  9888. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9889. }
  9890. function adjustToRange(min, max, value) {
  9891. return Math.max(min, Math.min(max, value));
  9892. }
  9893. function decodeL(L) {
  9894. if (L < 0) {
  9895. return -decodeL(-L);
  9896. }
  9897. if (L > 8.0) {
  9898. return Math.pow((L + 16) / 116, 3);
  9899. }
  9900. return L * DECODE_L_CONSTANT;
  9901. }
  9902. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9903. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9904. result[0] = XYZ_Flat[0];
  9905. result[1] = XYZ_Flat[1];
  9906. result[2] = XYZ_Flat[2];
  9907. return;
  9908. }
  9909. var zeroDecodeL = decodeL(0);
  9910. var X_DST = zeroDecodeL;
  9911. var X_SRC = decodeL(sourceBlackPoint[0]);
  9912. var Y_DST = zeroDecodeL;
  9913. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9914. var Z_DST = zeroDecodeL;
  9915. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9916. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9917. var X_Offset = 1 - X_Scale;
  9918. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9919. var Y_Offset = 1 - Y_Scale;
  9920. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9921. var Z_Offset = 1 - Z_Scale;
  9922. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9923. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9924. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9925. }
  9926. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9927. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9928. result[0] = XYZ_In[0];
  9929. result[1] = XYZ_In[1];
  9930. result[2] = XYZ_In[2];
  9931. return;
  9932. }
  9933. var LMS = result;
  9934. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9935. var LMS_Flat = tempNormalizeMatrix;
  9936. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9937. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9938. }
  9939. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9940. var LMS = result;
  9941. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9942. var LMS_D65 = tempNormalizeMatrix;
  9943. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9944. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9945. }
  9946. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9947. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9948. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9949. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9950. var AGR = Math.pow(A, cs.GR);
  9951. var BGG = Math.pow(B, cs.GG);
  9952. var CGB = Math.pow(C, cs.GB);
  9953. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9954. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9955. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9956. var XYZ = tempConvertMatrix1;
  9957. XYZ[0] = X;
  9958. XYZ[1] = Y;
  9959. XYZ[2] = Z;
  9960. var XYZ_Flat = tempConvertMatrix2;
  9961. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9962. var XYZ_Black = tempConvertMatrix1;
  9963. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9964. var XYZ_D65 = tempConvertMatrix2;
  9965. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9966. var SRGB = tempConvertMatrix1;
  9967. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9968. var sR = sRGBTransferFunction(SRGB[0]);
  9969. var sG = sRGBTransferFunction(SRGB[1]);
  9970. var sB = sRGBTransferFunction(SRGB[2]);
  9971. dest[destOffset] = Math.round(sR * 255);
  9972. dest[destOffset + 1] = Math.round(sG * 255);
  9973. dest[destOffset + 2] = Math.round(sB * 255);
  9974. }
  9975. CalRGBCS.prototype = {
  9976. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9977. var rgb = new Uint8Array(3);
  9978. this.getRgbItem(src, srcOffset, rgb, 0);
  9979. return rgb;
  9980. },
  9981. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9982. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9983. },
  9984. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9985. var scale = 1 / ((1 << bits) - 1);
  9986. for (var i = 0; i < count; ++i) {
  9987. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9988. srcOffset += 3;
  9989. destOffset += 3 + alpha01;
  9990. }
  9991. },
  9992. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9993. return inputLength * (3 + alpha01) / 3 | 0;
  9994. },
  9995. isPassthrough: ColorSpace.prototype.isPassthrough,
  9996. fillRgb: ColorSpace.prototype.fillRgb,
  9997. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9998. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9999. },
  10000. usesZeroToOneRange: true
  10001. };
  10002. return CalRGBCS;
  10003. }();
  10004. var LabCS = function LabCSClosure() {
  10005. function LabCS(whitePoint, blackPoint, range) {
  10006. this.name = 'Lab';
  10007. this.numComps = 3;
  10008. this.defaultColor = new Float32Array(this.numComps);
  10009. if (!whitePoint) {
  10010. error('WhitePoint missing - required for color space Lab');
  10011. }
  10012. blackPoint = blackPoint || [
  10013. 0,
  10014. 0,
  10015. 0
  10016. ];
  10017. range = range || [
  10018. -100,
  10019. 100,
  10020. -100,
  10021. 100
  10022. ];
  10023. this.XW = whitePoint[0];
  10024. this.YW = whitePoint[1];
  10025. this.ZW = whitePoint[2];
  10026. this.amin = range[0];
  10027. this.amax = range[1];
  10028. this.bmin = range[2];
  10029. this.bmax = range[3];
  10030. this.XB = blackPoint[0];
  10031. this.YB = blackPoint[1];
  10032. this.ZB = blackPoint[2];
  10033. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10034. error('Invalid WhitePoint components, no fallback available');
  10035. }
  10036. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10037. info('Invalid BlackPoint, falling back to default');
  10038. this.XB = this.YB = this.ZB = 0;
  10039. }
  10040. if (this.amin > this.amax || this.bmin > this.bmax) {
  10041. info('Invalid Range, falling back to defaults');
  10042. this.amin = -100;
  10043. this.amax = 100;
  10044. this.bmin = -100;
  10045. this.bmax = 100;
  10046. }
  10047. }
  10048. function fn_g(x) {
  10049. var result;
  10050. if (x >= 6 / 29) {
  10051. result = x * x * x;
  10052. } else {
  10053. result = 108 / 841 * (x - 4 / 29);
  10054. }
  10055. return result;
  10056. }
  10057. function decode(value, high1, low2, high2) {
  10058. return low2 + value * (high2 - low2) / high1;
  10059. }
  10060. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  10061. var Ls = src[srcOffset];
  10062. var as = src[srcOffset + 1];
  10063. var bs = src[srcOffset + 2];
  10064. if (maxVal !== false) {
  10065. Ls = decode(Ls, maxVal, 0, 100);
  10066. as = decode(as, maxVal, cs.amin, cs.amax);
  10067. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  10068. }
  10069. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  10070. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  10071. var M = (Ls + 16) / 116;
  10072. var L = M + as / 500;
  10073. var N = M - bs / 200;
  10074. var X = cs.XW * fn_g(L);
  10075. var Y = cs.YW * fn_g(M);
  10076. var Z = cs.ZW * fn_g(N);
  10077. var r, g, b;
  10078. if (cs.ZW < 1) {
  10079. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  10080. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  10081. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  10082. } else {
  10083. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  10084. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  10085. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  10086. }
  10087. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  10088. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  10089. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  10090. }
  10091. LabCS.prototype = {
  10092. getRgb: ColorSpace.prototype.getRgb,
  10093. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  10094. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  10095. },
  10096. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10097. var maxVal = (1 << bits) - 1;
  10098. for (var i = 0; i < count; i++) {
  10099. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  10100. srcOffset += 3;
  10101. destOffset += 3 + alpha01;
  10102. }
  10103. },
  10104. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  10105. return inputLength * (3 + alpha01) / 3 | 0;
  10106. },
  10107. isPassthrough: ColorSpace.prototype.isPassthrough,
  10108. fillRgb: ColorSpace.prototype.fillRgb,
  10109. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  10110. return true;
  10111. },
  10112. usesZeroToOneRange: false
  10113. };
  10114. return LabCS;
  10115. }();
  10116. exports.ColorSpace = ColorSpace;
  10117. /***/ }),
  10118. /* 4 */
  10119. /***/ (function(module, exports, __w_pdfjs_require__) {
  10120. "use strict";
  10121. var ExpertEncoding = [
  10122. '',
  10123. '',
  10124. '',
  10125. '',
  10126. '',
  10127. '',
  10128. '',
  10129. '',
  10130. '',
  10131. '',
  10132. '',
  10133. '',
  10134. '',
  10135. '',
  10136. '',
  10137. '',
  10138. '',
  10139. '',
  10140. '',
  10141. '',
  10142. '',
  10143. '',
  10144. '',
  10145. '',
  10146. '',
  10147. '',
  10148. '',
  10149. '',
  10150. '',
  10151. '',
  10152. '',
  10153. '',
  10154. 'space',
  10155. 'exclamsmall',
  10156. 'Hungarumlautsmall',
  10157. '',
  10158. 'dollaroldstyle',
  10159. 'dollarsuperior',
  10160. 'ampersandsmall',
  10161. 'Acutesmall',
  10162. 'parenleftsuperior',
  10163. 'parenrightsuperior',
  10164. 'twodotenleader',
  10165. 'onedotenleader',
  10166. 'comma',
  10167. 'hyphen',
  10168. 'period',
  10169. 'fraction',
  10170. 'zerooldstyle',
  10171. 'oneoldstyle',
  10172. 'twooldstyle',
  10173. 'threeoldstyle',
  10174. 'fouroldstyle',
  10175. 'fiveoldstyle',
  10176. 'sixoldstyle',
  10177. 'sevenoldstyle',
  10178. 'eightoldstyle',
  10179. 'nineoldstyle',
  10180. 'colon',
  10181. 'semicolon',
  10182. 'commasuperior',
  10183. 'threequartersemdash',
  10184. 'periodsuperior',
  10185. 'questionsmall',
  10186. '',
  10187. 'asuperior',
  10188. 'bsuperior',
  10189. 'centsuperior',
  10190. 'dsuperior',
  10191. 'esuperior',
  10192. '',
  10193. '',
  10194. 'isuperior',
  10195. '',
  10196. '',
  10197. 'lsuperior',
  10198. 'msuperior',
  10199. 'nsuperior',
  10200. 'osuperior',
  10201. '',
  10202. '',
  10203. 'rsuperior',
  10204. 'ssuperior',
  10205. 'tsuperior',
  10206. '',
  10207. 'ff',
  10208. 'fi',
  10209. 'fl',
  10210. 'ffi',
  10211. 'ffl',
  10212. 'parenleftinferior',
  10213. '',
  10214. 'parenrightinferior',
  10215. 'Circumflexsmall',
  10216. 'hyphensuperior',
  10217. 'Gravesmall',
  10218. 'Asmall',
  10219. 'Bsmall',
  10220. 'Csmall',
  10221. 'Dsmall',
  10222. 'Esmall',
  10223. 'Fsmall',
  10224. 'Gsmall',
  10225. 'Hsmall',
  10226. 'Ismall',
  10227. 'Jsmall',
  10228. 'Ksmall',
  10229. 'Lsmall',
  10230. 'Msmall',
  10231. 'Nsmall',
  10232. 'Osmall',
  10233. 'Psmall',
  10234. 'Qsmall',
  10235. 'Rsmall',
  10236. 'Ssmall',
  10237. 'Tsmall',
  10238. 'Usmall',
  10239. 'Vsmall',
  10240. 'Wsmall',
  10241. 'Xsmall',
  10242. 'Ysmall',
  10243. 'Zsmall',
  10244. 'colonmonetary',
  10245. 'onefitted',
  10246. 'rupiah',
  10247. 'Tildesmall',
  10248. '',
  10249. '',
  10250. '',
  10251. '',
  10252. '',
  10253. '',
  10254. '',
  10255. '',
  10256. '',
  10257. '',
  10258. '',
  10259. '',
  10260. '',
  10261. '',
  10262. '',
  10263. '',
  10264. '',
  10265. '',
  10266. '',
  10267. '',
  10268. '',
  10269. '',
  10270. '',
  10271. '',
  10272. '',
  10273. '',
  10274. '',
  10275. '',
  10276. '',
  10277. '',
  10278. '',
  10279. '',
  10280. '',
  10281. '',
  10282. 'exclamdownsmall',
  10283. 'centoldstyle',
  10284. 'Lslashsmall',
  10285. '',
  10286. '',
  10287. 'Scaronsmall',
  10288. 'Zcaronsmall',
  10289. 'Dieresissmall',
  10290. 'Brevesmall',
  10291. 'Caronsmall',
  10292. '',
  10293. 'Dotaccentsmall',
  10294. '',
  10295. '',
  10296. 'Macronsmall',
  10297. '',
  10298. '',
  10299. 'figuredash',
  10300. 'hypheninferior',
  10301. '',
  10302. '',
  10303. 'Ogoneksmall',
  10304. 'Ringsmall',
  10305. 'Cedillasmall',
  10306. '',
  10307. '',
  10308. '',
  10309. 'onequarter',
  10310. 'onehalf',
  10311. 'threequarters',
  10312. 'questiondownsmall',
  10313. 'oneeighth',
  10314. 'threeeighths',
  10315. 'fiveeighths',
  10316. 'seveneighths',
  10317. 'onethird',
  10318. 'twothirds',
  10319. '',
  10320. '',
  10321. 'zerosuperior',
  10322. 'onesuperior',
  10323. 'twosuperior',
  10324. 'threesuperior',
  10325. 'foursuperior',
  10326. 'fivesuperior',
  10327. 'sixsuperior',
  10328. 'sevensuperior',
  10329. 'eightsuperior',
  10330. 'ninesuperior',
  10331. 'zeroinferior',
  10332. 'oneinferior',
  10333. 'twoinferior',
  10334. 'threeinferior',
  10335. 'fourinferior',
  10336. 'fiveinferior',
  10337. 'sixinferior',
  10338. 'seveninferior',
  10339. 'eightinferior',
  10340. 'nineinferior',
  10341. 'centinferior',
  10342. 'dollarinferior',
  10343. 'periodinferior',
  10344. 'commainferior',
  10345. 'Agravesmall',
  10346. 'Aacutesmall',
  10347. 'Acircumflexsmall',
  10348. 'Atildesmall',
  10349. 'Adieresissmall',
  10350. 'Aringsmall',
  10351. 'AEsmall',
  10352. 'Ccedillasmall',
  10353. 'Egravesmall',
  10354. 'Eacutesmall',
  10355. 'Ecircumflexsmall',
  10356. 'Edieresissmall',
  10357. 'Igravesmall',
  10358. 'Iacutesmall',
  10359. 'Icircumflexsmall',
  10360. 'Idieresissmall',
  10361. 'Ethsmall',
  10362. 'Ntildesmall',
  10363. 'Ogravesmall',
  10364. 'Oacutesmall',
  10365. 'Ocircumflexsmall',
  10366. 'Otildesmall',
  10367. 'Odieresissmall',
  10368. 'OEsmall',
  10369. 'Oslashsmall',
  10370. 'Ugravesmall',
  10371. 'Uacutesmall',
  10372. 'Ucircumflexsmall',
  10373. 'Udieresissmall',
  10374. 'Yacutesmall',
  10375. 'Thornsmall',
  10376. 'Ydieresissmall'
  10377. ];
  10378. var MacExpertEncoding = [
  10379. '',
  10380. '',
  10381. '',
  10382. '',
  10383. '',
  10384. '',
  10385. '',
  10386. '',
  10387. '',
  10388. '',
  10389. '',
  10390. '',
  10391. '',
  10392. '',
  10393. '',
  10394. '',
  10395. '',
  10396. '',
  10397. '',
  10398. '',
  10399. '',
  10400. '',
  10401. '',
  10402. '',
  10403. '',
  10404. '',
  10405. '',
  10406. '',
  10407. '',
  10408. '',
  10409. '',
  10410. '',
  10411. 'space',
  10412. 'exclamsmall',
  10413. 'Hungarumlautsmall',
  10414. 'centoldstyle',
  10415. 'dollaroldstyle',
  10416. 'dollarsuperior',
  10417. 'ampersandsmall',
  10418. 'Acutesmall',
  10419. 'parenleftsuperior',
  10420. 'parenrightsuperior',
  10421. 'twodotenleader',
  10422. 'onedotenleader',
  10423. 'comma',
  10424. 'hyphen',
  10425. 'period',
  10426. 'fraction',
  10427. 'zerooldstyle',
  10428. 'oneoldstyle',
  10429. 'twooldstyle',
  10430. 'threeoldstyle',
  10431. 'fouroldstyle',
  10432. 'fiveoldstyle',
  10433. 'sixoldstyle',
  10434. 'sevenoldstyle',
  10435. 'eightoldstyle',
  10436. 'nineoldstyle',
  10437. 'colon',
  10438. 'semicolon',
  10439. '',
  10440. 'threequartersemdash',
  10441. '',
  10442. 'questionsmall',
  10443. '',
  10444. '',
  10445. '',
  10446. '',
  10447. 'Ethsmall',
  10448. '',
  10449. '',
  10450. 'onequarter',
  10451. 'onehalf',
  10452. 'threequarters',
  10453. 'oneeighth',
  10454. 'threeeighths',
  10455. 'fiveeighths',
  10456. 'seveneighths',
  10457. 'onethird',
  10458. 'twothirds',
  10459. '',
  10460. '',
  10461. '',
  10462. '',
  10463. '',
  10464. '',
  10465. 'ff',
  10466. 'fi',
  10467. 'fl',
  10468. 'ffi',
  10469. 'ffl',
  10470. 'parenleftinferior',
  10471. '',
  10472. 'parenrightinferior',
  10473. 'Circumflexsmall',
  10474. 'hypheninferior',
  10475. 'Gravesmall',
  10476. 'Asmall',
  10477. 'Bsmall',
  10478. 'Csmall',
  10479. 'Dsmall',
  10480. 'Esmall',
  10481. 'Fsmall',
  10482. 'Gsmall',
  10483. 'Hsmall',
  10484. 'Ismall',
  10485. 'Jsmall',
  10486. 'Ksmall',
  10487. 'Lsmall',
  10488. 'Msmall',
  10489. 'Nsmall',
  10490. 'Osmall',
  10491. 'Psmall',
  10492. 'Qsmall',
  10493. 'Rsmall',
  10494. 'Ssmall',
  10495. 'Tsmall',
  10496. 'Usmall',
  10497. 'Vsmall',
  10498. 'Wsmall',
  10499. 'Xsmall',
  10500. 'Ysmall',
  10501. 'Zsmall',
  10502. 'colonmonetary',
  10503. 'onefitted',
  10504. 'rupiah',
  10505. 'Tildesmall',
  10506. '',
  10507. '',
  10508. 'asuperior',
  10509. 'centsuperior',
  10510. '',
  10511. '',
  10512. '',
  10513. '',
  10514. 'Aacutesmall',
  10515. 'Agravesmall',
  10516. 'Acircumflexsmall',
  10517. 'Adieresissmall',
  10518. 'Atildesmall',
  10519. 'Aringsmall',
  10520. 'Ccedillasmall',
  10521. 'Eacutesmall',
  10522. 'Egravesmall',
  10523. 'Ecircumflexsmall',
  10524. 'Edieresissmall',
  10525. 'Iacutesmall',
  10526. 'Igravesmall',
  10527. 'Icircumflexsmall',
  10528. 'Idieresissmall',
  10529. 'Ntildesmall',
  10530. 'Oacutesmall',
  10531. 'Ogravesmall',
  10532. 'Ocircumflexsmall',
  10533. 'Odieresissmall',
  10534. 'Otildesmall',
  10535. 'Uacutesmall',
  10536. 'Ugravesmall',
  10537. 'Ucircumflexsmall',
  10538. 'Udieresissmall',
  10539. '',
  10540. 'eightsuperior',
  10541. 'fourinferior',
  10542. 'threeinferior',
  10543. 'sixinferior',
  10544. 'eightinferior',
  10545. 'seveninferior',
  10546. 'Scaronsmall',
  10547. '',
  10548. 'centinferior',
  10549. 'twoinferior',
  10550. '',
  10551. 'Dieresissmall',
  10552. '',
  10553. 'Caronsmall',
  10554. 'osuperior',
  10555. 'fiveinferior',
  10556. '',
  10557. 'commainferior',
  10558. 'periodinferior',
  10559. 'Yacutesmall',
  10560. '',
  10561. 'dollarinferior',
  10562. '',
  10563. 'Thornsmall',
  10564. '',
  10565. 'nineinferior',
  10566. 'zeroinferior',
  10567. 'Zcaronsmall',
  10568. 'AEsmall',
  10569. 'Oslashsmall',
  10570. 'questiondownsmall',
  10571. 'oneinferior',
  10572. 'Lslashsmall',
  10573. '',
  10574. '',
  10575. '',
  10576. '',
  10577. '',
  10578. '',
  10579. 'Cedillasmall',
  10580. '',
  10581. '',
  10582. '',
  10583. '',
  10584. '',
  10585. 'OEsmall',
  10586. 'figuredash',
  10587. 'hyphensuperior',
  10588. '',
  10589. '',
  10590. '',
  10591. '',
  10592. 'exclamdownsmall',
  10593. '',
  10594. 'Ydieresissmall',
  10595. '',
  10596. 'onesuperior',
  10597. 'twosuperior',
  10598. 'threesuperior',
  10599. 'foursuperior',
  10600. 'fivesuperior',
  10601. 'sixsuperior',
  10602. 'sevensuperior',
  10603. 'ninesuperior',
  10604. 'zerosuperior',
  10605. '',
  10606. 'esuperior',
  10607. 'rsuperior',
  10608. 'tsuperior',
  10609. '',
  10610. '',
  10611. 'isuperior',
  10612. 'ssuperior',
  10613. 'dsuperior',
  10614. '',
  10615. '',
  10616. '',
  10617. '',
  10618. '',
  10619. 'lsuperior',
  10620. 'Ogoneksmall',
  10621. 'Brevesmall',
  10622. 'Macronsmall',
  10623. 'bsuperior',
  10624. 'nsuperior',
  10625. 'msuperior',
  10626. 'commasuperior',
  10627. 'periodsuperior',
  10628. 'Dotaccentsmall',
  10629. 'Ringsmall'
  10630. ];
  10631. var MacRomanEncoding = [
  10632. '',
  10633. '',
  10634. '',
  10635. '',
  10636. '',
  10637. '',
  10638. '',
  10639. '',
  10640. '',
  10641. '',
  10642. '',
  10643. '',
  10644. '',
  10645. '',
  10646. '',
  10647. '',
  10648. '',
  10649. '',
  10650. '',
  10651. '',
  10652. '',
  10653. '',
  10654. '',
  10655. '',
  10656. '',
  10657. '',
  10658. '',
  10659. '',
  10660. '',
  10661. '',
  10662. '',
  10663. '',
  10664. 'space',
  10665. 'exclam',
  10666. 'quotedbl',
  10667. 'numbersign',
  10668. 'dollar',
  10669. 'percent',
  10670. 'ampersand',
  10671. 'quotesingle',
  10672. 'parenleft',
  10673. 'parenright',
  10674. 'asterisk',
  10675. 'plus',
  10676. 'comma',
  10677. 'hyphen',
  10678. 'period',
  10679. 'slash',
  10680. 'zero',
  10681. 'one',
  10682. 'two',
  10683. 'three',
  10684. 'four',
  10685. 'five',
  10686. 'six',
  10687. 'seven',
  10688. 'eight',
  10689. 'nine',
  10690. 'colon',
  10691. 'semicolon',
  10692. 'less',
  10693. 'equal',
  10694. 'greater',
  10695. 'question',
  10696. 'at',
  10697. 'A',
  10698. 'B',
  10699. 'C',
  10700. 'D',
  10701. 'E',
  10702. 'F',
  10703. 'G',
  10704. 'H',
  10705. 'I',
  10706. 'J',
  10707. 'K',
  10708. 'L',
  10709. 'M',
  10710. 'N',
  10711. 'O',
  10712. 'P',
  10713. 'Q',
  10714. 'R',
  10715. 'S',
  10716. 'T',
  10717. 'U',
  10718. 'V',
  10719. 'W',
  10720. 'X',
  10721. 'Y',
  10722. 'Z',
  10723. 'bracketleft',
  10724. 'backslash',
  10725. 'bracketright',
  10726. 'asciicircum',
  10727. 'underscore',
  10728. 'grave',
  10729. 'a',
  10730. 'b',
  10731. 'c',
  10732. 'd',
  10733. 'e',
  10734. 'f',
  10735. 'g',
  10736. 'h',
  10737. 'i',
  10738. 'j',
  10739. 'k',
  10740. 'l',
  10741. 'm',
  10742. 'n',
  10743. 'o',
  10744. 'p',
  10745. 'q',
  10746. 'r',
  10747. 's',
  10748. 't',
  10749. 'u',
  10750. 'v',
  10751. 'w',
  10752. 'x',
  10753. 'y',
  10754. 'z',
  10755. 'braceleft',
  10756. 'bar',
  10757. 'braceright',
  10758. 'asciitilde',
  10759. '',
  10760. 'Adieresis',
  10761. 'Aring',
  10762. 'Ccedilla',
  10763. 'Eacute',
  10764. 'Ntilde',
  10765. 'Odieresis',
  10766. 'Udieresis',
  10767. 'aacute',
  10768. 'agrave',
  10769. 'acircumflex',
  10770. 'adieresis',
  10771. 'atilde',
  10772. 'aring',
  10773. 'ccedilla',
  10774. 'eacute',
  10775. 'egrave',
  10776. 'ecircumflex',
  10777. 'edieresis',
  10778. 'iacute',
  10779. 'igrave',
  10780. 'icircumflex',
  10781. 'idieresis',
  10782. 'ntilde',
  10783. 'oacute',
  10784. 'ograve',
  10785. 'ocircumflex',
  10786. 'odieresis',
  10787. 'otilde',
  10788. 'uacute',
  10789. 'ugrave',
  10790. 'ucircumflex',
  10791. 'udieresis',
  10792. 'dagger',
  10793. 'degree',
  10794. 'cent',
  10795. 'sterling',
  10796. 'section',
  10797. 'bullet',
  10798. 'paragraph',
  10799. 'germandbls',
  10800. 'registered',
  10801. 'copyright',
  10802. 'trademark',
  10803. 'acute',
  10804. 'dieresis',
  10805. 'notequal',
  10806. 'AE',
  10807. 'Oslash',
  10808. 'infinity',
  10809. 'plusminus',
  10810. 'lessequal',
  10811. 'greaterequal',
  10812. 'yen',
  10813. 'mu',
  10814. 'partialdiff',
  10815. 'summation',
  10816. 'product',
  10817. 'pi',
  10818. 'integral',
  10819. 'ordfeminine',
  10820. 'ordmasculine',
  10821. 'Omega',
  10822. 'ae',
  10823. 'oslash',
  10824. 'questiondown',
  10825. 'exclamdown',
  10826. 'logicalnot',
  10827. 'radical',
  10828. 'florin',
  10829. 'approxequal',
  10830. 'Delta',
  10831. 'guillemotleft',
  10832. 'guillemotright',
  10833. 'ellipsis',
  10834. 'space',
  10835. 'Agrave',
  10836. 'Atilde',
  10837. 'Otilde',
  10838. 'OE',
  10839. 'oe',
  10840. 'endash',
  10841. 'emdash',
  10842. 'quotedblleft',
  10843. 'quotedblright',
  10844. 'quoteleft',
  10845. 'quoteright',
  10846. 'divide',
  10847. 'lozenge',
  10848. 'ydieresis',
  10849. 'Ydieresis',
  10850. 'fraction',
  10851. 'currency',
  10852. 'guilsinglleft',
  10853. 'guilsinglright',
  10854. 'fi',
  10855. 'fl',
  10856. 'daggerdbl',
  10857. 'periodcentered',
  10858. 'quotesinglbase',
  10859. 'quotedblbase',
  10860. 'perthousand',
  10861. 'Acircumflex',
  10862. 'Ecircumflex',
  10863. 'Aacute',
  10864. 'Edieresis',
  10865. 'Egrave',
  10866. 'Iacute',
  10867. 'Icircumflex',
  10868. 'Idieresis',
  10869. 'Igrave',
  10870. 'Oacute',
  10871. 'Ocircumflex',
  10872. 'apple',
  10873. 'Ograve',
  10874. 'Uacute',
  10875. 'Ucircumflex',
  10876. 'Ugrave',
  10877. 'dotlessi',
  10878. 'circumflex',
  10879. 'tilde',
  10880. 'macron',
  10881. 'breve',
  10882. 'dotaccent',
  10883. 'ring',
  10884. 'cedilla',
  10885. 'hungarumlaut',
  10886. 'ogonek',
  10887. 'caron'
  10888. ];
  10889. var StandardEncoding = [
  10890. '',
  10891. '',
  10892. '',
  10893. '',
  10894. '',
  10895. '',
  10896. '',
  10897. '',
  10898. '',
  10899. '',
  10900. '',
  10901. '',
  10902. '',
  10903. '',
  10904. '',
  10905. '',
  10906. '',
  10907. '',
  10908. '',
  10909. '',
  10910. '',
  10911. '',
  10912. '',
  10913. '',
  10914. '',
  10915. '',
  10916. '',
  10917. '',
  10918. '',
  10919. '',
  10920. '',
  10921. '',
  10922. 'space',
  10923. 'exclam',
  10924. 'quotedbl',
  10925. 'numbersign',
  10926. 'dollar',
  10927. 'percent',
  10928. 'ampersand',
  10929. 'quoteright',
  10930. 'parenleft',
  10931. 'parenright',
  10932. 'asterisk',
  10933. 'plus',
  10934. 'comma',
  10935. 'hyphen',
  10936. 'period',
  10937. 'slash',
  10938. 'zero',
  10939. 'one',
  10940. 'two',
  10941. 'three',
  10942. 'four',
  10943. 'five',
  10944. 'six',
  10945. 'seven',
  10946. 'eight',
  10947. 'nine',
  10948. 'colon',
  10949. 'semicolon',
  10950. 'less',
  10951. 'equal',
  10952. 'greater',
  10953. 'question',
  10954. 'at',
  10955. 'A',
  10956. 'B',
  10957. 'C',
  10958. 'D',
  10959. 'E',
  10960. 'F',
  10961. 'G',
  10962. 'H',
  10963. 'I',
  10964. 'J',
  10965. 'K',
  10966. 'L',
  10967. 'M',
  10968. 'N',
  10969. 'O',
  10970. 'P',
  10971. 'Q',
  10972. 'R',
  10973. 'S',
  10974. 'T',
  10975. 'U',
  10976. 'V',
  10977. 'W',
  10978. 'X',
  10979. 'Y',
  10980. 'Z',
  10981. 'bracketleft',
  10982. 'backslash',
  10983. 'bracketright',
  10984. 'asciicircum',
  10985. 'underscore',
  10986. 'quoteleft',
  10987. 'a',
  10988. 'b',
  10989. 'c',
  10990. 'd',
  10991. 'e',
  10992. 'f',
  10993. 'g',
  10994. 'h',
  10995. 'i',
  10996. 'j',
  10997. 'k',
  10998. 'l',
  10999. 'm',
  11000. 'n',
  11001. 'o',
  11002. 'p',
  11003. 'q',
  11004. 'r',
  11005. 's',
  11006. 't',
  11007. 'u',
  11008. 'v',
  11009. 'w',
  11010. 'x',
  11011. 'y',
  11012. 'z',
  11013. 'braceleft',
  11014. 'bar',
  11015. 'braceright',
  11016. 'asciitilde',
  11017. '',
  11018. '',
  11019. '',
  11020. '',
  11021. '',
  11022. '',
  11023. '',
  11024. '',
  11025. '',
  11026. '',
  11027. '',
  11028. '',
  11029. '',
  11030. '',
  11031. '',
  11032. '',
  11033. '',
  11034. '',
  11035. '',
  11036. '',
  11037. '',
  11038. '',
  11039. '',
  11040. '',
  11041. '',
  11042. '',
  11043. '',
  11044. '',
  11045. '',
  11046. '',
  11047. '',
  11048. '',
  11049. '',
  11050. '',
  11051. 'exclamdown',
  11052. 'cent',
  11053. 'sterling',
  11054. 'fraction',
  11055. 'yen',
  11056. 'florin',
  11057. 'section',
  11058. 'currency',
  11059. 'quotesingle',
  11060. 'quotedblleft',
  11061. 'guillemotleft',
  11062. 'guilsinglleft',
  11063. 'guilsinglright',
  11064. 'fi',
  11065. 'fl',
  11066. '',
  11067. 'endash',
  11068. 'dagger',
  11069. 'daggerdbl',
  11070. 'periodcentered',
  11071. '',
  11072. 'paragraph',
  11073. 'bullet',
  11074. 'quotesinglbase',
  11075. 'quotedblbase',
  11076. 'quotedblright',
  11077. 'guillemotright',
  11078. 'ellipsis',
  11079. 'perthousand',
  11080. '',
  11081. 'questiondown',
  11082. '',
  11083. 'grave',
  11084. 'acute',
  11085. 'circumflex',
  11086. 'tilde',
  11087. 'macron',
  11088. 'breve',
  11089. 'dotaccent',
  11090. 'dieresis',
  11091. '',
  11092. 'ring',
  11093. 'cedilla',
  11094. '',
  11095. 'hungarumlaut',
  11096. 'ogonek',
  11097. 'caron',
  11098. 'emdash',
  11099. '',
  11100. '',
  11101. '',
  11102. '',
  11103. '',
  11104. '',
  11105. '',
  11106. '',
  11107. '',
  11108. '',
  11109. '',
  11110. '',
  11111. '',
  11112. '',
  11113. '',
  11114. '',
  11115. 'AE',
  11116. '',
  11117. 'ordfeminine',
  11118. '',
  11119. '',
  11120. '',
  11121. '',
  11122. 'Lslash',
  11123. 'Oslash',
  11124. 'OE',
  11125. 'ordmasculine',
  11126. '',
  11127. '',
  11128. '',
  11129. '',
  11130. '',
  11131. 'ae',
  11132. '',
  11133. '',
  11134. '',
  11135. 'dotlessi',
  11136. '',
  11137. '',
  11138. 'lslash',
  11139. 'oslash',
  11140. 'oe',
  11141. 'germandbls'
  11142. ];
  11143. var WinAnsiEncoding = [
  11144. '',
  11145. '',
  11146. '',
  11147. '',
  11148. '',
  11149. '',
  11150. '',
  11151. '',
  11152. '',
  11153. '',
  11154. '',
  11155. '',
  11156. '',
  11157. '',
  11158. '',
  11159. '',
  11160. '',
  11161. '',
  11162. '',
  11163. '',
  11164. '',
  11165. '',
  11166. '',
  11167. '',
  11168. '',
  11169. '',
  11170. '',
  11171. '',
  11172. '',
  11173. '',
  11174. '',
  11175. '',
  11176. 'space',
  11177. 'exclam',
  11178. 'quotedbl',
  11179. 'numbersign',
  11180. 'dollar',
  11181. 'percent',
  11182. 'ampersand',
  11183. 'quotesingle',
  11184. 'parenleft',
  11185. 'parenright',
  11186. 'asterisk',
  11187. 'plus',
  11188. 'comma',
  11189. 'hyphen',
  11190. 'period',
  11191. 'slash',
  11192. 'zero',
  11193. 'one',
  11194. 'two',
  11195. 'three',
  11196. 'four',
  11197. 'five',
  11198. 'six',
  11199. 'seven',
  11200. 'eight',
  11201. 'nine',
  11202. 'colon',
  11203. 'semicolon',
  11204. 'less',
  11205. 'equal',
  11206. 'greater',
  11207. 'question',
  11208. 'at',
  11209. 'A',
  11210. 'B',
  11211. 'C',
  11212. 'D',
  11213. 'E',
  11214. 'F',
  11215. 'G',
  11216. 'H',
  11217. 'I',
  11218. 'J',
  11219. 'K',
  11220. 'L',
  11221. 'M',
  11222. 'N',
  11223. 'O',
  11224. 'P',
  11225. 'Q',
  11226. 'R',
  11227. 'S',
  11228. 'T',
  11229. 'U',
  11230. 'V',
  11231. 'W',
  11232. 'X',
  11233. 'Y',
  11234. 'Z',
  11235. 'bracketleft',
  11236. 'backslash',
  11237. 'bracketright',
  11238. 'asciicircum',
  11239. 'underscore',
  11240. 'grave',
  11241. 'a',
  11242. 'b',
  11243. 'c',
  11244. 'd',
  11245. 'e',
  11246. 'f',
  11247. 'g',
  11248. 'h',
  11249. 'i',
  11250. 'j',
  11251. 'k',
  11252. 'l',
  11253. 'm',
  11254. 'n',
  11255. 'o',
  11256. 'p',
  11257. 'q',
  11258. 'r',
  11259. 's',
  11260. 't',
  11261. 'u',
  11262. 'v',
  11263. 'w',
  11264. 'x',
  11265. 'y',
  11266. 'z',
  11267. 'braceleft',
  11268. 'bar',
  11269. 'braceright',
  11270. 'asciitilde',
  11271. 'bullet',
  11272. 'Euro',
  11273. 'bullet',
  11274. 'quotesinglbase',
  11275. 'florin',
  11276. 'quotedblbase',
  11277. 'ellipsis',
  11278. 'dagger',
  11279. 'daggerdbl',
  11280. 'circumflex',
  11281. 'perthousand',
  11282. 'Scaron',
  11283. 'guilsinglleft',
  11284. 'OE',
  11285. 'bullet',
  11286. 'Zcaron',
  11287. 'bullet',
  11288. 'bullet',
  11289. 'quoteleft',
  11290. 'quoteright',
  11291. 'quotedblleft',
  11292. 'quotedblright',
  11293. 'bullet',
  11294. 'endash',
  11295. 'emdash',
  11296. 'tilde',
  11297. 'trademark',
  11298. 'scaron',
  11299. 'guilsinglright',
  11300. 'oe',
  11301. 'bullet',
  11302. 'zcaron',
  11303. 'Ydieresis',
  11304. 'space',
  11305. 'exclamdown',
  11306. 'cent',
  11307. 'sterling',
  11308. 'currency',
  11309. 'yen',
  11310. 'brokenbar',
  11311. 'section',
  11312. 'dieresis',
  11313. 'copyright',
  11314. 'ordfeminine',
  11315. 'guillemotleft',
  11316. 'logicalnot',
  11317. 'hyphen',
  11318. 'registered',
  11319. 'macron',
  11320. 'degree',
  11321. 'plusminus',
  11322. 'twosuperior',
  11323. 'threesuperior',
  11324. 'acute',
  11325. 'mu',
  11326. 'paragraph',
  11327. 'periodcentered',
  11328. 'cedilla',
  11329. 'onesuperior',
  11330. 'ordmasculine',
  11331. 'guillemotright',
  11332. 'onequarter',
  11333. 'onehalf',
  11334. 'threequarters',
  11335. 'questiondown',
  11336. 'Agrave',
  11337. 'Aacute',
  11338. 'Acircumflex',
  11339. 'Atilde',
  11340. 'Adieresis',
  11341. 'Aring',
  11342. 'AE',
  11343. 'Ccedilla',
  11344. 'Egrave',
  11345. 'Eacute',
  11346. 'Ecircumflex',
  11347. 'Edieresis',
  11348. 'Igrave',
  11349. 'Iacute',
  11350. 'Icircumflex',
  11351. 'Idieresis',
  11352. 'Eth',
  11353. 'Ntilde',
  11354. 'Ograve',
  11355. 'Oacute',
  11356. 'Ocircumflex',
  11357. 'Otilde',
  11358. 'Odieresis',
  11359. 'multiply',
  11360. 'Oslash',
  11361. 'Ugrave',
  11362. 'Uacute',
  11363. 'Ucircumflex',
  11364. 'Udieresis',
  11365. 'Yacute',
  11366. 'Thorn',
  11367. 'germandbls',
  11368. 'agrave',
  11369. 'aacute',
  11370. 'acircumflex',
  11371. 'atilde',
  11372. 'adieresis',
  11373. 'aring',
  11374. 'ae',
  11375. 'ccedilla',
  11376. 'egrave',
  11377. 'eacute',
  11378. 'ecircumflex',
  11379. 'edieresis',
  11380. 'igrave',
  11381. 'iacute',
  11382. 'icircumflex',
  11383. 'idieresis',
  11384. 'eth',
  11385. 'ntilde',
  11386. 'ograve',
  11387. 'oacute',
  11388. 'ocircumflex',
  11389. 'otilde',
  11390. 'odieresis',
  11391. 'divide',
  11392. 'oslash',
  11393. 'ugrave',
  11394. 'uacute',
  11395. 'ucircumflex',
  11396. 'udieresis',
  11397. 'yacute',
  11398. 'thorn',
  11399. 'ydieresis'
  11400. ];
  11401. var SymbolSetEncoding = [
  11402. '',
  11403. '',
  11404. '',
  11405. '',
  11406. '',
  11407. '',
  11408. '',
  11409. '',
  11410. '',
  11411. '',
  11412. '',
  11413. '',
  11414. '',
  11415. '',
  11416. '',
  11417. '',
  11418. '',
  11419. '',
  11420. '',
  11421. '',
  11422. '',
  11423. '',
  11424. '',
  11425. '',
  11426. '',
  11427. '',
  11428. '',
  11429. '',
  11430. '',
  11431. '',
  11432. '',
  11433. '',
  11434. 'space',
  11435. 'exclam',
  11436. 'universal',
  11437. 'numbersign',
  11438. 'existential',
  11439. 'percent',
  11440. 'ampersand',
  11441. 'suchthat',
  11442. 'parenleft',
  11443. 'parenright',
  11444. 'asteriskmath',
  11445. 'plus',
  11446. 'comma',
  11447. 'minus',
  11448. 'period',
  11449. 'slash',
  11450. 'zero',
  11451. 'one',
  11452. 'two',
  11453. 'three',
  11454. 'four',
  11455. 'five',
  11456. 'six',
  11457. 'seven',
  11458. 'eight',
  11459. 'nine',
  11460. 'colon',
  11461. 'semicolon',
  11462. 'less',
  11463. 'equal',
  11464. 'greater',
  11465. 'question',
  11466. 'congruent',
  11467. 'Alpha',
  11468. 'Beta',
  11469. 'Chi',
  11470. 'Delta',
  11471. 'Epsilon',
  11472. 'Phi',
  11473. 'Gamma',
  11474. 'Eta',
  11475. 'Iota',
  11476. 'theta1',
  11477. 'Kappa',
  11478. 'Lambda',
  11479. 'Mu',
  11480. 'Nu',
  11481. 'Omicron',
  11482. 'Pi',
  11483. 'Theta',
  11484. 'Rho',
  11485. 'Sigma',
  11486. 'Tau',
  11487. 'Upsilon',
  11488. 'sigma1',
  11489. 'Omega',
  11490. 'Xi',
  11491. 'Psi',
  11492. 'Zeta',
  11493. 'bracketleft',
  11494. 'therefore',
  11495. 'bracketright',
  11496. 'perpendicular',
  11497. 'underscore',
  11498. 'radicalex',
  11499. 'alpha',
  11500. 'beta',
  11501. 'chi',
  11502. 'delta',
  11503. 'epsilon',
  11504. 'phi',
  11505. 'gamma',
  11506. 'eta',
  11507. 'iota',
  11508. 'phi1',
  11509. 'kappa',
  11510. 'lambda',
  11511. 'mu',
  11512. 'nu',
  11513. 'omicron',
  11514. 'pi',
  11515. 'theta',
  11516. 'rho',
  11517. 'sigma',
  11518. 'tau',
  11519. 'upsilon',
  11520. 'omega1',
  11521. 'omega',
  11522. 'xi',
  11523. 'psi',
  11524. 'zeta',
  11525. 'braceleft',
  11526. 'bar',
  11527. 'braceright',
  11528. 'similar',
  11529. '',
  11530. '',
  11531. '',
  11532. '',
  11533. '',
  11534. '',
  11535. '',
  11536. '',
  11537. '',
  11538. '',
  11539. '',
  11540. '',
  11541. '',
  11542. '',
  11543. '',
  11544. '',
  11545. '',
  11546. '',
  11547. '',
  11548. '',
  11549. '',
  11550. '',
  11551. '',
  11552. '',
  11553. '',
  11554. '',
  11555. '',
  11556. '',
  11557. '',
  11558. '',
  11559. '',
  11560. '',
  11561. '',
  11562. 'Euro',
  11563. 'Upsilon1',
  11564. 'minute',
  11565. 'lessequal',
  11566. 'fraction',
  11567. 'infinity',
  11568. 'florin',
  11569. 'club',
  11570. 'diamond',
  11571. 'heart',
  11572. 'spade',
  11573. 'arrowboth',
  11574. 'arrowleft',
  11575. 'arrowup',
  11576. 'arrowright',
  11577. 'arrowdown',
  11578. 'degree',
  11579. 'plusminus',
  11580. 'second',
  11581. 'greaterequal',
  11582. 'multiply',
  11583. 'proportional',
  11584. 'partialdiff',
  11585. 'bullet',
  11586. 'divide',
  11587. 'notequal',
  11588. 'equivalence',
  11589. 'approxequal',
  11590. 'ellipsis',
  11591. 'arrowvertex',
  11592. 'arrowhorizex',
  11593. 'carriagereturn',
  11594. 'aleph',
  11595. 'Ifraktur',
  11596. 'Rfraktur',
  11597. 'weierstrass',
  11598. 'circlemultiply',
  11599. 'circleplus',
  11600. 'emptyset',
  11601. 'intersection',
  11602. 'union',
  11603. 'propersuperset',
  11604. 'reflexsuperset',
  11605. 'notsubset',
  11606. 'propersubset',
  11607. 'reflexsubset',
  11608. 'element',
  11609. 'notelement',
  11610. 'angle',
  11611. 'gradient',
  11612. 'registerserif',
  11613. 'copyrightserif',
  11614. 'trademarkserif',
  11615. 'product',
  11616. 'radical',
  11617. 'dotmath',
  11618. 'logicalnot',
  11619. 'logicaland',
  11620. 'logicalor',
  11621. 'arrowdblboth',
  11622. 'arrowdblleft',
  11623. 'arrowdblup',
  11624. 'arrowdblright',
  11625. 'arrowdbldown',
  11626. 'lozenge',
  11627. 'angleleft',
  11628. 'registersans',
  11629. 'copyrightsans',
  11630. 'trademarksans',
  11631. 'summation',
  11632. 'parenlefttp',
  11633. 'parenleftex',
  11634. 'parenleftbt',
  11635. 'bracketlefttp',
  11636. 'bracketleftex',
  11637. 'bracketleftbt',
  11638. 'bracelefttp',
  11639. 'braceleftmid',
  11640. 'braceleftbt',
  11641. 'braceex',
  11642. '',
  11643. 'angleright',
  11644. 'integral',
  11645. 'integraltp',
  11646. 'integralex',
  11647. 'integralbt',
  11648. 'parenrighttp',
  11649. 'parenrightex',
  11650. 'parenrightbt',
  11651. 'bracketrighttp',
  11652. 'bracketrightex',
  11653. 'bracketrightbt',
  11654. 'bracerighttp',
  11655. 'bracerightmid',
  11656. 'bracerightbt'
  11657. ];
  11658. var ZapfDingbatsEncoding = [
  11659. '',
  11660. '',
  11661. '',
  11662. '',
  11663. '',
  11664. '',
  11665. '',
  11666. '',
  11667. '',
  11668. '',
  11669. '',
  11670. '',
  11671. '',
  11672. '',
  11673. '',
  11674. '',
  11675. '',
  11676. '',
  11677. '',
  11678. '',
  11679. '',
  11680. '',
  11681. '',
  11682. '',
  11683. '',
  11684. '',
  11685. '',
  11686. '',
  11687. '',
  11688. '',
  11689. '',
  11690. '',
  11691. 'space',
  11692. 'a1',
  11693. 'a2',
  11694. 'a202',
  11695. 'a3',
  11696. 'a4',
  11697. 'a5',
  11698. 'a119',
  11699. 'a118',
  11700. 'a117',
  11701. 'a11',
  11702. 'a12',
  11703. 'a13',
  11704. 'a14',
  11705. 'a15',
  11706. 'a16',
  11707. 'a105',
  11708. 'a17',
  11709. 'a18',
  11710. 'a19',
  11711. 'a20',
  11712. 'a21',
  11713. 'a22',
  11714. 'a23',
  11715. 'a24',
  11716. 'a25',
  11717. 'a26',
  11718. 'a27',
  11719. 'a28',
  11720. 'a6',
  11721. 'a7',
  11722. 'a8',
  11723. 'a9',
  11724. 'a10',
  11725. 'a29',
  11726. 'a30',
  11727. 'a31',
  11728. 'a32',
  11729. 'a33',
  11730. 'a34',
  11731. 'a35',
  11732. 'a36',
  11733. 'a37',
  11734. 'a38',
  11735. 'a39',
  11736. 'a40',
  11737. 'a41',
  11738. 'a42',
  11739. 'a43',
  11740. 'a44',
  11741. 'a45',
  11742. 'a46',
  11743. 'a47',
  11744. 'a48',
  11745. 'a49',
  11746. 'a50',
  11747. 'a51',
  11748. 'a52',
  11749. 'a53',
  11750. 'a54',
  11751. 'a55',
  11752. 'a56',
  11753. 'a57',
  11754. 'a58',
  11755. 'a59',
  11756. 'a60',
  11757. 'a61',
  11758. 'a62',
  11759. 'a63',
  11760. 'a64',
  11761. 'a65',
  11762. 'a66',
  11763. 'a67',
  11764. 'a68',
  11765. 'a69',
  11766. 'a70',
  11767. 'a71',
  11768. 'a72',
  11769. 'a73',
  11770. 'a74',
  11771. 'a203',
  11772. 'a75',
  11773. 'a204',
  11774. 'a76',
  11775. 'a77',
  11776. 'a78',
  11777. 'a79',
  11778. 'a81',
  11779. 'a82',
  11780. 'a83',
  11781. 'a84',
  11782. 'a97',
  11783. 'a98',
  11784. 'a99',
  11785. 'a100',
  11786. '',
  11787. 'a89',
  11788. 'a90',
  11789. 'a93',
  11790. 'a94',
  11791. 'a91',
  11792. 'a92',
  11793. 'a205',
  11794. 'a85',
  11795. 'a206',
  11796. 'a86',
  11797. 'a87',
  11798. 'a88',
  11799. 'a95',
  11800. 'a96',
  11801. '',
  11802. '',
  11803. '',
  11804. '',
  11805. '',
  11806. '',
  11807. '',
  11808. '',
  11809. '',
  11810. '',
  11811. '',
  11812. '',
  11813. '',
  11814. '',
  11815. '',
  11816. '',
  11817. '',
  11818. '',
  11819. '',
  11820. 'a101',
  11821. 'a102',
  11822. 'a103',
  11823. 'a104',
  11824. 'a106',
  11825. 'a107',
  11826. 'a108',
  11827. 'a112',
  11828. 'a111',
  11829. 'a110',
  11830. 'a109',
  11831. 'a120',
  11832. 'a121',
  11833. 'a122',
  11834. 'a123',
  11835. 'a124',
  11836. 'a125',
  11837. 'a126',
  11838. 'a127',
  11839. 'a128',
  11840. 'a129',
  11841. 'a130',
  11842. 'a131',
  11843. 'a132',
  11844. 'a133',
  11845. 'a134',
  11846. 'a135',
  11847. 'a136',
  11848. 'a137',
  11849. 'a138',
  11850. 'a139',
  11851. 'a140',
  11852. 'a141',
  11853. 'a142',
  11854. 'a143',
  11855. 'a144',
  11856. 'a145',
  11857. 'a146',
  11858. 'a147',
  11859. 'a148',
  11860. 'a149',
  11861. 'a150',
  11862. 'a151',
  11863. 'a152',
  11864. 'a153',
  11865. 'a154',
  11866. 'a155',
  11867. 'a156',
  11868. 'a157',
  11869. 'a158',
  11870. 'a159',
  11871. 'a160',
  11872. 'a161',
  11873. 'a163',
  11874. 'a164',
  11875. 'a196',
  11876. 'a165',
  11877. 'a192',
  11878. 'a166',
  11879. 'a167',
  11880. 'a168',
  11881. 'a169',
  11882. 'a170',
  11883. 'a171',
  11884. 'a172',
  11885. 'a173',
  11886. 'a162',
  11887. 'a174',
  11888. 'a175',
  11889. 'a176',
  11890. 'a177',
  11891. 'a178',
  11892. 'a179',
  11893. 'a193',
  11894. 'a180',
  11895. 'a199',
  11896. 'a181',
  11897. 'a200',
  11898. 'a182',
  11899. '',
  11900. 'a201',
  11901. 'a183',
  11902. 'a184',
  11903. 'a197',
  11904. 'a185',
  11905. 'a194',
  11906. 'a198',
  11907. 'a186',
  11908. 'a195',
  11909. 'a187',
  11910. 'a188',
  11911. 'a189',
  11912. 'a190',
  11913. 'a191'
  11914. ];
  11915. function getEncoding(encodingName) {
  11916. switch (encodingName) {
  11917. case 'WinAnsiEncoding':
  11918. return WinAnsiEncoding;
  11919. case 'StandardEncoding':
  11920. return StandardEncoding;
  11921. case 'MacRomanEncoding':
  11922. return MacRomanEncoding;
  11923. case 'SymbolSetEncoding':
  11924. return SymbolSetEncoding;
  11925. case 'ZapfDingbatsEncoding':
  11926. return ZapfDingbatsEncoding;
  11927. case 'ExpertEncoding':
  11928. return ExpertEncoding;
  11929. case 'MacExpertEncoding':
  11930. return MacExpertEncoding;
  11931. default:
  11932. return null;
  11933. }
  11934. }
  11935. exports.WinAnsiEncoding = WinAnsiEncoding;
  11936. exports.StandardEncoding = StandardEncoding;
  11937. exports.MacRomanEncoding = MacRomanEncoding;
  11938. exports.SymbolSetEncoding = SymbolSetEncoding;
  11939. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11940. exports.ExpertEncoding = ExpertEncoding;
  11941. exports.getEncoding = getEncoding;
  11942. /***/ }),
  11943. /* 5 */
  11944. /***/ (function(module, exports, __w_pdfjs_require__) {
  11945. "use strict";
  11946. var sharedUtil = __w_pdfjs_require__(0);
  11947. var corePrimitives = __w_pdfjs_require__(1);
  11948. var coreStream = __w_pdfjs_require__(2);
  11949. var MissingDataException = sharedUtil.MissingDataException;
  11950. var StreamType = sharedUtil.StreamType;
  11951. var assert = sharedUtil.assert;
  11952. var error = sharedUtil.error;
  11953. var info = sharedUtil.info;
  11954. var isArray = sharedUtil.isArray;
  11955. var isInt = sharedUtil.isInt;
  11956. var isNum = sharedUtil.isNum;
  11957. var isString = sharedUtil.isString;
  11958. var warn = sharedUtil.warn;
  11959. var EOF = corePrimitives.EOF;
  11960. var Cmd = corePrimitives.Cmd;
  11961. var Dict = corePrimitives.Dict;
  11962. var Name = corePrimitives.Name;
  11963. var Ref = corePrimitives.Ref;
  11964. var isEOF = corePrimitives.isEOF;
  11965. var isCmd = corePrimitives.isCmd;
  11966. var isDict = corePrimitives.isDict;
  11967. var isName = corePrimitives.isName;
  11968. var Ascii85Stream = coreStream.Ascii85Stream;
  11969. var AsciiHexStream = coreStream.AsciiHexStream;
  11970. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11971. var FlateStream = coreStream.FlateStream;
  11972. var Jbig2Stream = coreStream.Jbig2Stream;
  11973. var JpegStream = coreStream.JpegStream;
  11974. var JpxStream = coreStream.JpxStream;
  11975. var LZWStream = coreStream.LZWStream;
  11976. var NullStream = coreStream.NullStream;
  11977. var PredictorStream = coreStream.PredictorStream;
  11978. var RunLengthStream = coreStream.RunLengthStream;
  11979. var MAX_LENGTH_TO_CACHE = 1000;
  11980. var Parser = function ParserClosure() {
  11981. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11982. this.lexer = lexer;
  11983. this.allowStreams = allowStreams;
  11984. this.xref = xref;
  11985. this.recoveryMode = recoveryMode || false;
  11986. this.imageCache = Object.create(null);
  11987. this.refill();
  11988. }
  11989. Parser.prototype = {
  11990. refill: function Parser_refill() {
  11991. this.buf1 = this.lexer.getObj();
  11992. this.buf2 = this.lexer.getObj();
  11993. },
  11994. shift: function Parser_shift() {
  11995. if (isCmd(this.buf2, 'ID')) {
  11996. this.buf1 = this.buf2;
  11997. this.buf2 = null;
  11998. } else {
  11999. this.buf1 = this.buf2;
  12000. this.buf2 = this.lexer.getObj();
  12001. }
  12002. },
  12003. tryShift: function Parser_tryShift() {
  12004. try {
  12005. this.shift();
  12006. return true;
  12007. } catch (e) {
  12008. if (e instanceof MissingDataException) {
  12009. throw e;
  12010. }
  12011. return false;
  12012. }
  12013. },
  12014. getObj: function Parser_getObj(cipherTransform) {
  12015. var buf1 = this.buf1;
  12016. this.shift();
  12017. if (buf1 instanceof Cmd) {
  12018. switch (buf1.cmd) {
  12019. case 'BI':
  12020. return this.makeInlineImage(cipherTransform);
  12021. case '[':
  12022. var array = [];
  12023. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  12024. array.push(this.getObj(cipherTransform));
  12025. }
  12026. if (isEOF(this.buf1)) {
  12027. if (!this.recoveryMode) {
  12028. error('End of file inside array');
  12029. }
  12030. return array;
  12031. }
  12032. this.shift();
  12033. return array;
  12034. case '<<':
  12035. var dict = new Dict(this.xref);
  12036. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  12037. if (!isName(this.buf1)) {
  12038. info('Malformed dictionary: key must be a name object');
  12039. this.shift();
  12040. continue;
  12041. }
  12042. var key = this.buf1.name;
  12043. this.shift();
  12044. if (isEOF(this.buf1)) {
  12045. break;
  12046. }
  12047. dict.set(key, this.getObj(cipherTransform));
  12048. }
  12049. if (isEOF(this.buf1)) {
  12050. if (!this.recoveryMode) {
  12051. error('End of file inside dictionary');
  12052. }
  12053. return dict;
  12054. }
  12055. if (isCmd(this.buf2, 'stream')) {
  12056. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12057. }
  12058. this.shift();
  12059. return dict;
  12060. default:
  12061. return buf1;
  12062. }
  12063. }
  12064. if (isInt(buf1)) {
  12065. var num = buf1;
  12066. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  12067. var ref = new Ref(num, this.buf1);
  12068. this.shift();
  12069. this.shift();
  12070. return ref;
  12071. }
  12072. return num;
  12073. }
  12074. if (isString(buf1)) {
  12075. var str = buf1;
  12076. if (cipherTransform) {
  12077. str = cipherTransform.decryptString(str);
  12078. }
  12079. return str;
  12080. }
  12081. return buf1;
  12082. },
  12083. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  12084. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  12085. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  12086. while ((ch = stream.getByte()) !== -1) {
  12087. if (state === 0) {
  12088. state = ch === E ? 1 : 0;
  12089. } else if (state === 1) {
  12090. state = ch === I ? 2 : 0;
  12091. } else {
  12092. assert(state === 2);
  12093. if (ch === SPACE || ch === LF || ch === CR) {
  12094. n = 5;
  12095. followingBytes = stream.peekBytes(n);
  12096. for (i = 0; i < n; i++) {
  12097. ch = followingBytes[i];
  12098. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  12099. state = 0;
  12100. break;
  12101. }
  12102. }
  12103. if (state === 2) {
  12104. break;
  12105. }
  12106. } else {
  12107. state = 0;
  12108. }
  12109. }
  12110. }
  12111. return stream.pos - 4 - startPos;
  12112. },
  12113. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  12114. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  12115. while ((b = stream.getByte()) !== -1) {
  12116. if (b !== 0xFF) {
  12117. continue;
  12118. }
  12119. switch (stream.getByte()) {
  12120. case 0x00:
  12121. break;
  12122. case 0xFF:
  12123. stream.skip(-1);
  12124. break;
  12125. case 0xD9:
  12126. foundEOI = true;
  12127. break;
  12128. case 0xC0:
  12129. case 0xC1:
  12130. case 0xC2:
  12131. case 0xC3:
  12132. case 0xC5:
  12133. case 0xC6:
  12134. case 0xC7:
  12135. case 0xC9:
  12136. case 0xCA:
  12137. case 0xCB:
  12138. case 0xCD:
  12139. case 0xCE:
  12140. case 0xCF:
  12141. case 0xC4:
  12142. case 0xCC:
  12143. case 0xDA:
  12144. case 0xDB:
  12145. case 0xDC:
  12146. case 0xDD:
  12147. case 0xDE:
  12148. case 0xDF:
  12149. case 0xE0:
  12150. case 0xE1:
  12151. case 0xE2:
  12152. case 0xE3:
  12153. case 0xE4:
  12154. case 0xE5:
  12155. case 0xE6:
  12156. case 0xE7:
  12157. case 0xE8:
  12158. case 0xE9:
  12159. case 0xEA:
  12160. case 0xEB:
  12161. case 0xEC:
  12162. case 0xED:
  12163. case 0xEE:
  12164. case 0xEF:
  12165. case 0xFE:
  12166. markerLength = stream.getUint16();
  12167. if (markerLength > 2) {
  12168. stream.skip(markerLength - 2);
  12169. } else {
  12170. stream.skip(-2);
  12171. }
  12172. break;
  12173. }
  12174. if (foundEOI) {
  12175. break;
  12176. }
  12177. }
  12178. length = stream.pos - startPos;
  12179. if (b === -1) {
  12180. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  12181. stream.skip(-length);
  12182. return this.findDefaultInlineStreamEnd(stream);
  12183. }
  12184. this.inlineStreamSkipEI(stream);
  12185. return length;
  12186. },
  12187. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  12188. var TILDE = 0x7E, GT = 0x3E;
  12189. var startPos = stream.pos, ch, length;
  12190. while ((ch = stream.getByte()) !== -1) {
  12191. if (ch === TILDE && stream.peekByte() === GT) {
  12192. stream.skip();
  12193. break;
  12194. }
  12195. }
  12196. length = stream.pos - startPos;
  12197. if (ch === -1) {
  12198. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12199. stream.skip(-length);
  12200. return this.findDefaultInlineStreamEnd(stream);
  12201. }
  12202. this.inlineStreamSkipEI(stream);
  12203. return length;
  12204. },
  12205. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  12206. var GT = 0x3E;
  12207. var startPos = stream.pos, ch, length;
  12208. while ((ch = stream.getByte()) !== -1) {
  12209. if (ch === GT) {
  12210. break;
  12211. }
  12212. }
  12213. length = stream.pos - startPos;
  12214. if (ch === -1) {
  12215. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12216. stream.skip(-length);
  12217. return this.findDefaultInlineStreamEnd(stream);
  12218. }
  12219. this.inlineStreamSkipEI(stream);
  12220. return length;
  12221. },
  12222. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  12223. var E = 0x45, I = 0x49;
  12224. var state = 0, ch;
  12225. while ((ch = stream.getByte()) !== -1) {
  12226. if (state === 0) {
  12227. state = ch === E ? 1 : 0;
  12228. } else if (state === 1) {
  12229. state = ch === I ? 2 : 0;
  12230. } else if (state === 2) {
  12231. break;
  12232. }
  12233. }
  12234. },
  12235. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  12236. var lexer = this.lexer;
  12237. var stream = lexer.stream;
  12238. var dict = new Dict(this.xref);
  12239. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  12240. if (!isName(this.buf1)) {
  12241. error('Dictionary key must be a name object');
  12242. }
  12243. var key = this.buf1.name;
  12244. this.shift();
  12245. if (isEOF(this.buf1)) {
  12246. break;
  12247. }
  12248. dict.set(key, this.getObj(cipherTransform));
  12249. }
  12250. var filter = dict.get('Filter', 'F'), filterName;
  12251. if (isName(filter)) {
  12252. filterName = filter.name;
  12253. } else if (isArray(filter)) {
  12254. var filterZero = this.xref.fetchIfRef(filter[0]);
  12255. if (isName(filterZero)) {
  12256. filterName = filterZero.name;
  12257. }
  12258. }
  12259. var startPos = stream.pos, length, i, ii;
  12260. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  12261. length = this.findDCTDecodeInlineStreamEnd(stream);
  12262. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  12263. length = this.findASCII85DecodeInlineStreamEnd(stream);
  12264. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  12265. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  12266. } else {
  12267. length = this.findDefaultInlineStreamEnd(stream);
  12268. }
  12269. var imageStream = stream.makeSubStream(startPos, length, dict);
  12270. var adler32;
  12271. if (length < MAX_LENGTH_TO_CACHE) {
  12272. var imageBytes = imageStream.getBytes();
  12273. imageStream.reset();
  12274. var a = 1;
  12275. var b = 0;
  12276. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  12277. a += imageBytes[i] & 0xff;
  12278. b += a;
  12279. }
  12280. adler32 = b % 65521 << 16 | a % 65521;
  12281. if (this.imageCache.adler32 === adler32) {
  12282. this.buf2 = Cmd.get('EI');
  12283. this.shift();
  12284. this.imageCache[adler32].reset();
  12285. return this.imageCache[adler32];
  12286. }
  12287. }
  12288. if (cipherTransform) {
  12289. imageStream = cipherTransform.createStream(imageStream, length);
  12290. }
  12291. imageStream = this.filter(imageStream, dict, length);
  12292. imageStream.dict = dict;
  12293. if (adler32 !== undefined) {
  12294. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  12295. this.imageCache[adler32] = imageStream;
  12296. }
  12297. this.buf2 = Cmd.get('EI');
  12298. this.shift();
  12299. return imageStream;
  12300. },
  12301. makeStream: function Parser_makeStream(dict, cipherTransform) {
  12302. var lexer = this.lexer;
  12303. var stream = lexer.stream;
  12304. lexer.skipToNextLine();
  12305. var pos = stream.pos - 1;
  12306. var length = dict.get('Length');
  12307. if (!isInt(length)) {
  12308. info('Bad ' + length + ' attribute in stream');
  12309. length = 0;
  12310. }
  12311. stream.pos = pos + length;
  12312. lexer.nextChar();
  12313. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  12314. this.shift();
  12315. } else {
  12316. stream.pos = pos;
  12317. var SCAN_BLOCK_SIZE = 2048;
  12318. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  12319. var ENDSTREAM_SIGNATURE = [
  12320. 0x65,
  12321. 0x6E,
  12322. 0x64,
  12323. 0x73,
  12324. 0x74,
  12325. 0x72,
  12326. 0x65,
  12327. 0x61,
  12328. 0x6D
  12329. ];
  12330. var skipped = 0, found = false, i, j;
  12331. while (stream.pos < stream.end) {
  12332. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  12333. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  12334. if (scanLength <= 0) {
  12335. break;
  12336. }
  12337. found = false;
  12338. i = 0;
  12339. while (i < scanLength) {
  12340. j = 0;
  12341. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  12342. j++;
  12343. }
  12344. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  12345. found = true;
  12346. break;
  12347. }
  12348. i++;
  12349. }
  12350. if (found) {
  12351. skipped += i;
  12352. stream.pos += i;
  12353. break;
  12354. }
  12355. skipped += scanLength;
  12356. stream.pos += scanLength;
  12357. }
  12358. if (!found) {
  12359. error('Missing endstream');
  12360. }
  12361. length = skipped;
  12362. lexer.nextChar();
  12363. this.shift();
  12364. this.shift();
  12365. }
  12366. this.shift();
  12367. stream = stream.makeSubStream(pos, length, dict);
  12368. if (cipherTransform) {
  12369. stream = cipherTransform.createStream(stream, length);
  12370. }
  12371. stream = this.filter(stream, dict, length);
  12372. stream.dict = dict;
  12373. return stream;
  12374. },
  12375. filter: function Parser_filter(stream, dict, length) {
  12376. var filter = dict.get('Filter', 'F');
  12377. var params = dict.get('DecodeParms', 'DP');
  12378. if (isName(filter)) {
  12379. if (isArray(params)) {
  12380. params = this.xref.fetchIfRef(params[0]);
  12381. }
  12382. return this.makeFilter(stream, filter.name, length, params);
  12383. }
  12384. var maybeLength = length;
  12385. if (isArray(filter)) {
  12386. var filterArray = filter;
  12387. var paramsArray = params;
  12388. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  12389. filter = this.xref.fetchIfRef(filterArray[i]);
  12390. if (!isName(filter)) {
  12391. error('Bad filter name: ' + filter);
  12392. }
  12393. params = null;
  12394. if (isArray(paramsArray) && i in paramsArray) {
  12395. params = this.xref.fetchIfRef(paramsArray[i]);
  12396. }
  12397. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  12398. maybeLength = null;
  12399. }
  12400. }
  12401. return stream;
  12402. },
  12403. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  12404. if (maybeLength === 0) {
  12405. warn('Empty "' + name + '" stream.');
  12406. return new NullStream(stream);
  12407. }
  12408. try {
  12409. var xrefStreamStats = this.xref.stats.streamTypes;
  12410. if (name === 'FlateDecode' || name === 'Fl') {
  12411. xrefStreamStats[StreamType.FLATE] = true;
  12412. if (params) {
  12413. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  12414. }
  12415. return new FlateStream(stream, maybeLength);
  12416. }
  12417. if (name === 'LZWDecode' || name === 'LZW') {
  12418. xrefStreamStats[StreamType.LZW] = true;
  12419. var earlyChange = 1;
  12420. if (params) {
  12421. if (params.has('EarlyChange')) {
  12422. earlyChange = params.get('EarlyChange');
  12423. }
  12424. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  12425. }
  12426. return new LZWStream(stream, maybeLength, earlyChange);
  12427. }
  12428. if (name === 'DCTDecode' || name === 'DCT') {
  12429. xrefStreamStats[StreamType.DCT] = true;
  12430. return new JpegStream(stream, maybeLength, stream.dict, params);
  12431. }
  12432. if (name === 'JPXDecode' || name === 'JPX') {
  12433. xrefStreamStats[StreamType.JPX] = true;
  12434. return new JpxStream(stream, maybeLength, stream.dict, params);
  12435. }
  12436. if (name === 'ASCII85Decode' || name === 'A85') {
  12437. xrefStreamStats[StreamType.A85] = true;
  12438. return new Ascii85Stream(stream, maybeLength);
  12439. }
  12440. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  12441. xrefStreamStats[StreamType.AHX] = true;
  12442. return new AsciiHexStream(stream, maybeLength);
  12443. }
  12444. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  12445. xrefStreamStats[StreamType.CCF] = true;
  12446. return new CCITTFaxStream(stream, maybeLength, params);
  12447. }
  12448. if (name === 'RunLengthDecode' || name === 'RL') {
  12449. xrefStreamStats[StreamType.RL] = true;
  12450. return new RunLengthStream(stream, maybeLength);
  12451. }
  12452. if (name === 'JBIG2Decode') {
  12453. xrefStreamStats[StreamType.JBIG] = true;
  12454. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  12455. }
  12456. warn('filter "' + name + '" not supported yet');
  12457. return stream;
  12458. } catch (ex) {
  12459. if (ex instanceof MissingDataException) {
  12460. throw ex;
  12461. }
  12462. warn('Invalid stream: \"' + ex + '\"');
  12463. return new NullStream(stream);
  12464. }
  12465. }
  12466. };
  12467. return Parser;
  12468. }();
  12469. var Lexer = function LexerClosure() {
  12470. function Lexer(stream, knownCommands) {
  12471. this.stream = stream;
  12472. this.nextChar();
  12473. this.strBuf = [];
  12474. this.knownCommands = knownCommands;
  12475. }
  12476. var specialChars = [
  12477. 1,
  12478. 0,
  12479. 0,
  12480. 0,
  12481. 0,
  12482. 0,
  12483. 0,
  12484. 0,
  12485. 0,
  12486. 1,
  12487. 1,
  12488. 0,
  12489. 1,
  12490. 1,
  12491. 0,
  12492. 0,
  12493. 0,
  12494. 0,
  12495. 0,
  12496. 0,
  12497. 0,
  12498. 0,
  12499. 0,
  12500. 0,
  12501. 0,
  12502. 0,
  12503. 0,
  12504. 0,
  12505. 0,
  12506. 0,
  12507. 0,
  12508. 0,
  12509. 1,
  12510. 0,
  12511. 0,
  12512. 0,
  12513. 0,
  12514. 2,
  12515. 0,
  12516. 0,
  12517. 2,
  12518. 2,
  12519. 0,
  12520. 0,
  12521. 0,
  12522. 0,
  12523. 0,
  12524. 2,
  12525. 0,
  12526. 0,
  12527. 0,
  12528. 0,
  12529. 0,
  12530. 0,
  12531. 0,
  12532. 0,
  12533. 0,
  12534. 0,
  12535. 0,
  12536. 0,
  12537. 2,
  12538. 0,
  12539. 2,
  12540. 0,
  12541. 0,
  12542. 0,
  12543. 0,
  12544. 0,
  12545. 0,
  12546. 0,
  12547. 0,
  12548. 0,
  12549. 0,
  12550. 0,
  12551. 0,
  12552. 0,
  12553. 0,
  12554. 0,
  12555. 0,
  12556. 0,
  12557. 0,
  12558. 0,
  12559. 0,
  12560. 0,
  12561. 0,
  12562. 0,
  12563. 0,
  12564. 0,
  12565. 0,
  12566. 0,
  12567. 0,
  12568. 2,
  12569. 0,
  12570. 2,
  12571. 0,
  12572. 0,
  12573. 0,
  12574. 0,
  12575. 0,
  12576. 0,
  12577. 0,
  12578. 0,
  12579. 0,
  12580. 0,
  12581. 0,
  12582. 0,
  12583. 0,
  12584. 0,
  12585. 0,
  12586. 0,
  12587. 0,
  12588. 0,
  12589. 0,
  12590. 0,
  12591. 0,
  12592. 0,
  12593. 0,
  12594. 0,
  12595. 0,
  12596. 0,
  12597. 0,
  12598. 0,
  12599. 0,
  12600. 2,
  12601. 0,
  12602. 2,
  12603. 0,
  12604. 0,
  12605. 0,
  12606. 0,
  12607. 0,
  12608. 0,
  12609. 0,
  12610. 0,
  12611. 0,
  12612. 0,
  12613. 0,
  12614. 0,
  12615. 0,
  12616. 0,
  12617. 0,
  12618. 0,
  12619. 0,
  12620. 0,
  12621. 0,
  12622. 0,
  12623. 0,
  12624. 0,
  12625. 0,
  12626. 0,
  12627. 0,
  12628. 0,
  12629. 0,
  12630. 0,
  12631. 0,
  12632. 0,
  12633. 0,
  12634. 0,
  12635. 0,
  12636. 0,
  12637. 0,
  12638. 0,
  12639. 0,
  12640. 0,
  12641. 0,
  12642. 0,
  12643. 0,
  12644. 0,
  12645. 0,
  12646. 0,
  12647. 0,
  12648. 0,
  12649. 0,
  12650. 0,
  12651. 0,
  12652. 0,
  12653. 0,
  12654. 0,
  12655. 0,
  12656. 0,
  12657. 0,
  12658. 0,
  12659. 0,
  12660. 0,
  12661. 0,
  12662. 0,
  12663. 0,
  12664. 0,
  12665. 0,
  12666. 0,
  12667. 0,
  12668. 0,
  12669. 0,
  12670. 0,
  12671. 0,
  12672. 0,
  12673. 0,
  12674. 0,
  12675. 0,
  12676. 0,
  12677. 0,
  12678. 0,
  12679. 0,
  12680. 0,
  12681. 0,
  12682. 0,
  12683. 0,
  12684. 0,
  12685. 0,
  12686. 0,
  12687. 0,
  12688. 0,
  12689. 0,
  12690. 0,
  12691. 0,
  12692. 0,
  12693. 0,
  12694. 0,
  12695. 0,
  12696. 0,
  12697. 0,
  12698. 0,
  12699. 0,
  12700. 0,
  12701. 0,
  12702. 0,
  12703. 0,
  12704. 0,
  12705. 0,
  12706. 0,
  12707. 0,
  12708. 0,
  12709. 0,
  12710. 0,
  12711. 0,
  12712. 0,
  12713. 0,
  12714. 0,
  12715. 0,
  12716. 0,
  12717. 0,
  12718. 0,
  12719. 0,
  12720. 0,
  12721. 0,
  12722. 0,
  12723. 0,
  12724. 0,
  12725. 0,
  12726. 0,
  12727. 0,
  12728. 0,
  12729. 0,
  12730. 0,
  12731. 0,
  12732. 0
  12733. ];
  12734. function toHexDigit(ch) {
  12735. if (ch >= 0x30 && ch <= 0x39) {
  12736. return ch & 0x0F;
  12737. }
  12738. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  12739. return (ch & 0x0F) + 9;
  12740. }
  12741. return -1;
  12742. }
  12743. Lexer.prototype = {
  12744. nextChar: function Lexer_nextChar() {
  12745. return this.currentChar = this.stream.getByte();
  12746. },
  12747. peekChar: function Lexer_peekChar() {
  12748. return this.stream.peekByte();
  12749. },
  12750. getNumber: function Lexer_getNumber() {
  12751. var ch = this.currentChar;
  12752. var eNotation = false;
  12753. var divideBy = 0;
  12754. var sign = 1;
  12755. if (ch === 0x2D) {
  12756. sign = -1;
  12757. ch = this.nextChar();
  12758. if (ch === 0x2D) {
  12759. ch = this.nextChar();
  12760. }
  12761. } else if (ch === 0x2B) {
  12762. ch = this.nextChar();
  12763. }
  12764. if (ch === 0x2E) {
  12765. divideBy = 10;
  12766. ch = this.nextChar();
  12767. }
  12768. if (ch < 0x30 || ch > 0x39) {
  12769. error('Invalid number: ' + String.fromCharCode(ch));
  12770. return 0;
  12771. }
  12772. var baseValue = ch - 0x30;
  12773. var powerValue = 0;
  12774. var powerValueSign = 1;
  12775. while ((ch = this.nextChar()) >= 0) {
  12776. if (0x30 <= ch && ch <= 0x39) {
  12777. var currentDigit = ch - 0x30;
  12778. if (eNotation) {
  12779. powerValue = powerValue * 10 + currentDigit;
  12780. } else {
  12781. if (divideBy !== 0) {
  12782. divideBy *= 10;
  12783. }
  12784. baseValue = baseValue * 10 + currentDigit;
  12785. }
  12786. } else if (ch === 0x2E) {
  12787. if (divideBy === 0) {
  12788. divideBy = 1;
  12789. } else {
  12790. break;
  12791. }
  12792. } else if (ch === 0x2D) {
  12793. warn('Badly formatted number');
  12794. } else if (ch === 0x45 || ch === 0x65) {
  12795. ch = this.peekChar();
  12796. if (ch === 0x2B || ch === 0x2D) {
  12797. powerValueSign = ch === 0x2D ? -1 : 1;
  12798. this.nextChar();
  12799. } else if (ch < 0x30 || ch > 0x39) {
  12800. break;
  12801. }
  12802. eNotation = true;
  12803. } else {
  12804. break;
  12805. }
  12806. }
  12807. if (divideBy !== 0) {
  12808. baseValue /= divideBy;
  12809. }
  12810. if (eNotation) {
  12811. baseValue *= Math.pow(10, powerValueSign * powerValue);
  12812. }
  12813. return sign * baseValue;
  12814. },
  12815. getString: function Lexer_getString() {
  12816. var numParen = 1;
  12817. var done = false;
  12818. var strBuf = this.strBuf;
  12819. strBuf.length = 0;
  12820. var ch = this.nextChar();
  12821. while (true) {
  12822. var charBuffered = false;
  12823. switch (ch | 0) {
  12824. case -1:
  12825. warn('Unterminated string');
  12826. done = true;
  12827. break;
  12828. case 0x28:
  12829. ++numParen;
  12830. strBuf.push('(');
  12831. break;
  12832. case 0x29:
  12833. if (--numParen === 0) {
  12834. this.nextChar();
  12835. done = true;
  12836. } else {
  12837. strBuf.push(')');
  12838. }
  12839. break;
  12840. case 0x5C:
  12841. ch = this.nextChar();
  12842. switch (ch) {
  12843. case -1:
  12844. warn('Unterminated string');
  12845. done = true;
  12846. break;
  12847. case 0x6E:
  12848. strBuf.push('\n');
  12849. break;
  12850. case 0x72:
  12851. strBuf.push('\r');
  12852. break;
  12853. case 0x74:
  12854. strBuf.push('\t');
  12855. break;
  12856. case 0x62:
  12857. strBuf.push('\b');
  12858. break;
  12859. case 0x66:
  12860. strBuf.push('\f');
  12861. break;
  12862. case 0x5C:
  12863. case 0x28:
  12864. case 0x29:
  12865. strBuf.push(String.fromCharCode(ch));
  12866. break;
  12867. case 0x30:
  12868. case 0x31:
  12869. case 0x32:
  12870. case 0x33:
  12871. case 0x34:
  12872. case 0x35:
  12873. case 0x36:
  12874. case 0x37:
  12875. var x = ch & 0x0F;
  12876. ch = this.nextChar();
  12877. charBuffered = true;
  12878. if (ch >= 0x30 && ch <= 0x37) {
  12879. x = (x << 3) + (ch & 0x0F);
  12880. ch = this.nextChar();
  12881. if (ch >= 0x30 && ch <= 0x37) {
  12882. charBuffered = false;
  12883. x = (x << 3) + (ch & 0x0F);
  12884. }
  12885. }
  12886. strBuf.push(String.fromCharCode(x));
  12887. break;
  12888. case 0x0D:
  12889. if (this.peekChar() === 0x0A) {
  12890. this.nextChar();
  12891. }
  12892. break;
  12893. case 0x0A:
  12894. break;
  12895. default:
  12896. strBuf.push(String.fromCharCode(ch));
  12897. break;
  12898. }
  12899. break;
  12900. default:
  12901. strBuf.push(String.fromCharCode(ch));
  12902. break;
  12903. }
  12904. if (done) {
  12905. break;
  12906. }
  12907. if (!charBuffered) {
  12908. ch = this.nextChar();
  12909. }
  12910. }
  12911. return strBuf.join('');
  12912. },
  12913. getName: function Lexer_getName() {
  12914. var ch, previousCh;
  12915. var strBuf = this.strBuf;
  12916. strBuf.length = 0;
  12917. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12918. if (ch === 0x23) {
  12919. ch = this.nextChar();
  12920. if (specialChars[ch]) {
  12921. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12922. strBuf.push('#');
  12923. break;
  12924. }
  12925. var x = toHexDigit(ch);
  12926. if (x !== -1) {
  12927. previousCh = ch;
  12928. ch = this.nextChar();
  12929. var x2 = toHexDigit(ch);
  12930. if (x2 === -1) {
  12931. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12932. strBuf.push('#', String.fromCharCode(previousCh));
  12933. if (specialChars[ch]) {
  12934. break;
  12935. }
  12936. strBuf.push(String.fromCharCode(ch));
  12937. continue;
  12938. }
  12939. strBuf.push(String.fromCharCode(x << 4 | x2));
  12940. } else {
  12941. strBuf.push('#', String.fromCharCode(ch));
  12942. }
  12943. } else {
  12944. strBuf.push(String.fromCharCode(ch));
  12945. }
  12946. }
  12947. if (strBuf.length > 127) {
  12948. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12949. }
  12950. return Name.get(strBuf.join(''));
  12951. },
  12952. getHexString: function Lexer_getHexString() {
  12953. var strBuf = this.strBuf;
  12954. strBuf.length = 0;
  12955. var ch = this.currentChar;
  12956. var isFirstHex = true;
  12957. var firstDigit;
  12958. var secondDigit;
  12959. while (true) {
  12960. if (ch < 0) {
  12961. warn('Unterminated hex string');
  12962. break;
  12963. } else if (ch === 0x3E) {
  12964. this.nextChar();
  12965. break;
  12966. } else if (specialChars[ch] === 1) {
  12967. ch = this.nextChar();
  12968. continue;
  12969. } else {
  12970. if (isFirstHex) {
  12971. firstDigit = toHexDigit(ch);
  12972. if (firstDigit === -1) {
  12973. warn('Ignoring invalid character "' + ch + '" in hex string');
  12974. ch = this.nextChar();
  12975. continue;
  12976. }
  12977. } else {
  12978. secondDigit = toHexDigit(ch);
  12979. if (secondDigit === -1) {
  12980. warn('Ignoring invalid character "' + ch + '" in hex string');
  12981. ch = this.nextChar();
  12982. continue;
  12983. }
  12984. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12985. }
  12986. isFirstHex = !isFirstHex;
  12987. ch = this.nextChar();
  12988. }
  12989. }
  12990. return strBuf.join('');
  12991. },
  12992. getObj: function Lexer_getObj() {
  12993. var comment = false;
  12994. var ch = this.currentChar;
  12995. while (true) {
  12996. if (ch < 0) {
  12997. return EOF;
  12998. }
  12999. if (comment) {
  13000. if (ch === 0x0A || ch === 0x0D) {
  13001. comment = false;
  13002. }
  13003. } else if (ch === 0x25) {
  13004. comment = true;
  13005. } else if (specialChars[ch] !== 1) {
  13006. break;
  13007. }
  13008. ch = this.nextChar();
  13009. }
  13010. switch (ch | 0) {
  13011. case 0x30:
  13012. case 0x31:
  13013. case 0x32:
  13014. case 0x33:
  13015. case 0x34:
  13016. case 0x35:
  13017. case 0x36:
  13018. case 0x37:
  13019. case 0x38:
  13020. case 0x39:
  13021. case 0x2B:
  13022. case 0x2D:
  13023. case 0x2E:
  13024. return this.getNumber();
  13025. case 0x28:
  13026. return this.getString();
  13027. case 0x2F:
  13028. return this.getName();
  13029. case 0x5B:
  13030. this.nextChar();
  13031. return Cmd.get('[');
  13032. case 0x5D:
  13033. this.nextChar();
  13034. return Cmd.get(']');
  13035. case 0x3C:
  13036. ch = this.nextChar();
  13037. if (ch === 0x3C) {
  13038. this.nextChar();
  13039. return Cmd.get('<<');
  13040. }
  13041. return this.getHexString();
  13042. case 0x3E:
  13043. ch = this.nextChar();
  13044. if (ch === 0x3E) {
  13045. this.nextChar();
  13046. return Cmd.get('>>');
  13047. }
  13048. return Cmd.get('>');
  13049. case 0x7B:
  13050. this.nextChar();
  13051. return Cmd.get('{');
  13052. case 0x7D:
  13053. this.nextChar();
  13054. return Cmd.get('}');
  13055. case 0x29:
  13056. this.nextChar();
  13057. error('Illegal character: ' + ch);
  13058. break;
  13059. }
  13060. var str = String.fromCharCode(ch);
  13061. var knownCommands = this.knownCommands;
  13062. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13063. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13064. var possibleCommand = str + String.fromCharCode(ch);
  13065. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13066. break;
  13067. }
  13068. if (str.length === 128) {
  13069. error('Command token too long: ' + str.length);
  13070. }
  13071. str = possibleCommand;
  13072. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13073. }
  13074. if (str === 'true') {
  13075. return true;
  13076. }
  13077. if (str === 'false') {
  13078. return false;
  13079. }
  13080. if (str === 'null') {
  13081. return null;
  13082. }
  13083. return Cmd.get(str);
  13084. },
  13085. skipToNextLine: function Lexer_skipToNextLine() {
  13086. var ch = this.currentChar;
  13087. while (ch >= 0) {
  13088. if (ch === 0x0D) {
  13089. ch = this.nextChar();
  13090. if (ch === 0x0A) {
  13091. this.nextChar();
  13092. }
  13093. break;
  13094. } else if (ch === 0x0A) {
  13095. this.nextChar();
  13096. break;
  13097. }
  13098. ch = this.nextChar();
  13099. }
  13100. }
  13101. };
  13102. return Lexer;
  13103. }();
  13104. var Linearization = {
  13105. create: function LinearizationCreate(stream) {
  13106. function getInt(name, allowZeroValue) {
  13107. var obj = linDict.get(name);
  13108. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13109. return obj;
  13110. }
  13111. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  13112. }
  13113. function getHints() {
  13114. var hints = linDict.get('H'), hintsLength, item;
  13115. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13116. for (var index = 0; index < hintsLength; index++) {
  13117. if (!(isInt(item = hints[index]) && item > 0)) {
  13118. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  13119. }
  13120. }
  13121. return hints;
  13122. }
  13123. throw new Error('Hint array in the linearization dictionary is invalid.');
  13124. }
  13125. var parser = new Parser(new Lexer(stream), false, null);
  13126. var obj1 = parser.getObj();
  13127. var obj2 = parser.getObj();
  13128. var obj3 = parser.getObj();
  13129. var linDict = parser.getObj();
  13130. var obj, length;
  13131. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  13132. return null;
  13133. } else if ((length = getInt('L')) !== stream.length) {
  13134. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  13135. }
  13136. return {
  13137. length: length,
  13138. hints: getHints(),
  13139. objectNumberFirst: getInt('O'),
  13140. endFirst: getInt('E'),
  13141. numPages: getInt('N'),
  13142. mainXRefEntriesOffset: getInt('T'),
  13143. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  13144. };
  13145. }
  13146. };
  13147. exports.Lexer = Lexer;
  13148. exports.Linearization = Linearization;
  13149. exports.Parser = Parser;
  13150. /***/ }),
  13151. /* 6 */
  13152. /***/ (function(module, exports, __w_pdfjs_require__) {
  13153. "use strict";
  13154. var sharedUtil = __w_pdfjs_require__(0);
  13155. var corePrimitives = __w_pdfjs_require__(1);
  13156. var corePsParser = __w_pdfjs_require__(34);
  13157. var error = sharedUtil.error;
  13158. var info = sharedUtil.info;
  13159. var isArray = sharedUtil.isArray;
  13160. var isBool = sharedUtil.isBool;
  13161. var isDict = corePrimitives.isDict;
  13162. var isStream = corePrimitives.isStream;
  13163. var PostScriptLexer = corePsParser.PostScriptLexer;
  13164. var PostScriptParser = corePsParser.PostScriptParser;
  13165. var PDFFunction = function PDFFunctionClosure() {
  13166. var CONSTRUCT_SAMPLED = 0;
  13167. var CONSTRUCT_INTERPOLATED = 2;
  13168. var CONSTRUCT_STICHED = 3;
  13169. var CONSTRUCT_POSTSCRIPT = 4;
  13170. return {
  13171. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  13172. var i, ii;
  13173. var length = 1;
  13174. for (i = 0, ii = size.length; i < ii; i++) {
  13175. length *= size[i];
  13176. }
  13177. length *= outputSize;
  13178. var array = new Array(length);
  13179. var codeSize = 0;
  13180. var codeBuf = 0;
  13181. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  13182. var strBytes = str.getBytes((length * bps + 7) / 8);
  13183. var strIdx = 0;
  13184. for (i = 0; i < length; i++) {
  13185. while (codeSize < bps) {
  13186. codeBuf <<= 8;
  13187. codeBuf |= strBytes[strIdx++];
  13188. codeSize += 8;
  13189. }
  13190. codeSize -= bps;
  13191. array[i] = (codeBuf >> codeSize) * sampleMul;
  13192. codeBuf &= (1 << codeSize) - 1;
  13193. }
  13194. return array;
  13195. },
  13196. getIR: function PDFFunction_getIR(xref, fn) {
  13197. var dict = fn.dict;
  13198. if (!dict) {
  13199. dict = fn;
  13200. }
  13201. var types = [
  13202. this.constructSampled,
  13203. null,
  13204. this.constructInterpolated,
  13205. this.constructStiched,
  13206. this.constructPostScript
  13207. ];
  13208. var typeNum = dict.get('FunctionType');
  13209. var typeFn = types[typeNum];
  13210. if (!typeFn) {
  13211. error('Unknown type of function');
  13212. }
  13213. return typeFn.call(this, fn, dict, xref);
  13214. },
  13215. fromIR: function PDFFunction_fromIR(IR) {
  13216. var type = IR[0];
  13217. switch (type) {
  13218. case CONSTRUCT_SAMPLED:
  13219. return this.constructSampledFromIR(IR);
  13220. case CONSTRUCT_INTERPOLATED:
  13221. return this.constructInterpolatedFromIR(IR);
  13222. case CONSTRUCT_STICHED:
  13223. return this.constructStichedFromIR(IR);
  13224. default:
  13225. return this.constructPostScriptFromIR(IR);
  13226. }
  13227. },
  13228. parse: function PDFFunction_parse(xref, fn) {
  13229. var IR = this.getIR(xref, fn);
  13230. return this.fromIR(IR);
  13231. },
  13232. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  13233. if (!isArray(fnObj)) {
  13234. return this.parse(xref, fnObj);
  13235. }
  13236. var fnArray = [];
  13237. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  13238. var obj = xref.fetchIfRef(fnObj[j]);
  13239. fnArray.push(PDFFunction.parse(xref, obj));
  13240. }
  13241. return function (src, srcOffset, dest, destOffset) {
  13242. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  13243. fnArray[i](src, srcOffset, dest, destOffset + i);
  13244. }
  13245. };
  13246. },
  13247. constructSampled: function PDFFunction_constructSampled(str, dict) {
  13248. function toMultiArray(arr) {
  13249. var inputLength = arr.length;
  13250. var out = [];
  13251. var index = 0;
  13252. for (var i = 0; i < inputLength; i += 2) {
  13253. out[index] = [
  13254. arr[i],
  13255. arr[i + 1]
  13256. ];
  13257. ++index;
  13258. }
  13259. return out;
  13260. }
  13261. var domain = dict.getArray('Domain');
  13262. var range = dict.getArray('Range');
  13263. if (!domain || !range) {
  13264. error('No domain or range');
  13265. }
  13266. var inputSize = domain.length / 2;
  13267. var outputSize = range.length / 2;
  13268. domain = toMultiArray(domain);
  13269. range = toMultiArray(range);
  13270. var size = dict.get('Size');
  13271. var bps = dict.get('BitsPerSample');
  13272. var order = dict.get('Order') || 1;
  13273. if (order !== 1) {
  13274. info('No support for cubic spline interpolation: ' + order);
  13275. }
  13276. var encode = dict.getArray('Encode');
  13277. if (!encode) {
  13278. encode = [];
  13279. for (var i = 0; i < inputSize; ++i) {
  13280. encode.push(0);
  13281. encode.push(size[i] - 1);
  13282. }
  13283. }
  13284. encode = toMultiArray(encode);
  13285. var decode = dict.getArray('Decode');
  13286. if (!decode) {
  13287. decode = range;
  13288. } else {
  13289. decode = toMultiArray(decode);
  13290. }
  13291. var samples = this.getSampleArray(size, outputSize, bps, str);
  13292. return [
  13293. CONSTRUCT_SAMPLED,
  13294. inputSize,
  13295. domain,
  13296. encode,
  13297. decode,
  13298. samples,
  13299. size,
  13300. outputSize,
  13301. Math.pow(2, bps) - 1,
  13302. range
  13303. ];
  13304. },
  13305. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  13306. function interpolate(x, xmin, xmax, ymin, ymax) {
  13307. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  13308. }
  13309. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  13310. var m = IR[1];
  13311. var domain = IR[2];
  13312. var encode = IR[3];
  13313. var decode = IR[4];
  13314. var samples = IR[5];
  13315. var size = IR[6];
  13316. var n = IR[7];
  13317. var range = IR[9];
  13318. var cubeVertices = 1 << m;
  13319. var cubeN = new Float64Array(cubeVertices);
  13320. var cubeVertex = new Uint32Array(cubeVertices);
  13321. var i, j;
  13322. for (j = 0; j < cubeVertices; j++) {
  13323. cubeN[j] = 1;
  13324. }
  13325. var k = n, pos = 1;
  13326. for (i = 0; i < m; ++i) {
  13327. var domain_2i = domain[i][0];
  13328. var domain_2i_1 = domain[i][1];
  13329. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  13330. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  13331. var size_i = size[i];
  13332. e = Math.min(Math.max(e, 0), size_i - 1);
  13333. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  13334. var n0 = e0 + 1 - e;
  13335. var n1 = e - e0;
  13336. var offset0 = e0 * k;
  13337. var offset1 = offset0 + k;
  13338. for (j = 0; j < cubeVertices; j++) {
  13339. if (j & pos) {
  13340. cubeN[j] *= n1;
  13341. cubeVertex[j] += offset1;
  13342. } else {
  13343. cubeN[j] *= n0;
  13344. cubeVertex[j] += offset0;
  13345. }
  13346. }
  13347. k *= size_i;
  13348. pos <<= 1;
  13349. }
  13350. for (j = 0; j < n; ++j) {
  13351. var rj = 0;
  13352. for (i = 0; i < cubeVertices; i++) {
  13353. rj += samples[cubeVertex[i] + j] * cubeN[i];
  13354. }
  13355. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  13356. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  13357. }
  13358. };
  13359. },
  13360. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  13361. var c0 = dict.getArray('C0') || [0];
  13362. var c1 = dict.getArray('C1') || [1];
  13363. var n = dict.get('N');
  13364. if (!isArray(c0) || !isArray(c1)) {
  13365. error('Illegal dictionary for interpolated function');
  13366. }
  13367. var length = c0.length;
  13368. var diff = [];
  13369. for (var i = 0; i < length; ++i) {
  13370. diff.push(c1[i] - c0[i]);
  13371. }
  13372. return [
  13373. CONSTRUCT_INTERPOLATED,
  13374. c0,
  13375. diff,
  13376. n
  13377. ];
  13378. },
  13379. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  13380. var c0 = IR[1];
  13381. var diff = IR[2];
  13382. var n = IR[3];
  13383. var length = diff.length;
  13384. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  13385. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  13386. for (var j = 0; j < length; ++j) {
  13387. dest[destOffset + j] = c0[j] + x * diff[j];
  13388. }
  13389. };
  13390. },
  13391. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  13392. var domain = dict.getArray('Domain');
  13393. if (!domain) {
  13394. error('No domain');
  13395. }
  13396. var inputSize = domain.length / 2;
  13397. if (inputSize !== 1) {
  13398. error('Bad domain for stiched function');
  13399. }
  13400. var fnRefs = dict.get('Functions');
  13401. var fns = [];
  13402. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  13403. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  13404. }
  13405. var bounds = dict.getArray('Bounds');
  13406. var encode = dict.getArray('Encode');
  13407. return [
  13408. CONSTRUCT_STICHED,
  13409. domain,
  13410. bounds,
  13411. encode,
  13412. fns
  13413. ];
  13414. },
  13415. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  13416. var domain = IR[1];
  13417. var bounds = IR[2];
  13418. var encode = IR[3];
  13419. var fnsIR = IR[4];
  13420. var fns = [];
  13421. var tmpBuf = new Float32Array(1);
  13422. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  13423. fns.push(PDFFunction.fromIR(fnsIR[i]));
  13424. }
  13425. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  13426. var clip = function constructStichedFromIRClip(v, min, max) {
  13427. if (v > max) {
  13428. v = max;
  13429. } else if (v < min) {
  13430. v = min;
  13431. }
  13432. return v;
  13433. };
  13434. var v = clip(src[srcOffset], domain[0], domain[1]);
  13435. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  13436. if (v < bounds[i]) {
  13437. break;
  13438. }
  13439. }
  13440. var dmin = domain[0];
  13441. if (i > 0) {
  13442. dmin = bounds[i - 1];
  13443. }
  13444. var dmax = domain[1];
  13445. if (i < bounds.length) {
  13446. dmax = bounds[i];
  13447. }
  13448. var rmin = encode[2 * i];
  13449. var rmax = encode[2 * i + 1];
  13450. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  13451. fns[i](tmpBuf, 0, dest, destOffset);
  13452. };
  13453. },
  13454. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  13455. var domain = dict.getArray('Domain');
  13456. var range = dict.getArray('Range');
  13457. if (!domain) {
  13458. error('No domain.');
  13459. }
  13460. if (!range) {
  13461. error('No range.');
  13462. }
  13463. var lexer = new PostScriptLexer(fn);
  13464. var parser = new PostScriptParser(lexer);
  13465. var code = parser.parse();
  13466. return [
  13467. CONSTRUCT_POSTSCRIPT,
  13468. domain,
  13469. range,
  13470. code
  13471. ];
  13472. },
  13473. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  13474. var domain = IR[1];
  13475. var range = IR[2];
  13476. var code = IR[3];
  13477. var compiled = new PostScriptCompiler().compile(code, domain, range);
  13478. if (compiled) {
  13479. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  13480. }
  13481. info('Unable to compile PS function');
  13482. var numOutputs = range.length >> 1;
  13483. var numInputs = domain.length >> 1;
  13484. var evaluator = new PostScriptEvaluator(code);
  13485. var cache = Object.create(null);
  13486. var MAX_CACHE_SIZE = 2048 * 4;
  13487. var cache_available = MAX_CACHE_SIZE;
  13488. var tmpBuf = new Float32Array(numInputs);
  13489. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  13490. var i, value;
  13491. var key = '';
  13492. var input = tmpBuf;
  13493. for (i = 0; i < numInputs; i++) {
  13494. value = src[srcOffset + i];
  13495. input[i] = value;
  13496. key += value + '_';
  13497. }
  13498. var cachedValue = cache[key];
  13499. if (cachedValue !== undefined) {
  13500. dest.set(cachedValue, destOffset);
  13501. return;
  13502. }
  13503. var output = new Float32Array(numOutputs);
  13504. var stack = evaluator.execute(input);
  13505. var stackIndex = stack.length - numOutputs;
  13506. for (i = 0; i < numOutputs; i++) {
  13507. value = stack[stackIndex + i];
  13508. var bound = range[i * 2];
  13509. if (value < bound) {
  13510. value = bound;
  13511. } else {
  13512. bound = range[i * 2 + 1];
  13513. if (value > bound) {
  13514. value = bound;
  13515. }
  13516. }
  13517. output[i] = value;
  13518. }
  13519. if (cache_available > 0) {
  13520. cache_available--;
  13521. cache[key] = output;
  13522. }
  13523. dest.set(output, destOffset);
  13524. };
  13525. }
  13526. };
  13527. }();
  13528. function isPDFFunction(v) {
  13529. var fnDict;
  13530. if (typeof v !== 'object') {
  13531. return false;
  13532. } else if (isDict(v)) {
  13533. fnDict = v;
  13534. } else if (isStream(v)) {
  13535. fnDict = v.dict;
  13536. } else {
  13537. return false;
  13538. }
  13539. return fnDict.has('FunctionType');
  13540. }
  13541. var PostScriptStack = function PostScriptStackClosure() {
  13542. var MAX_STACK_SIZE = 100;
  13543. function PostScriptStack(initialStack) {
  13544. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  13545. }
  13546. PostScriptStack.prototype = {
  13547. push: function PostScriptStack_push(value) {
  13548. if (this.stack.length >= MAX_STACK_SIZE) {
  13549. error('PostScript function stack overflow.');
  13550. }
  13551. this.stack.push(value);
  13552. },
  13553. pop: function PostScriptStack_pop() {
  13554. if (this.stack.length <= 0) {
  13555. error('PostScript function stack underflow.');
  13556. }
  13557. return this.stack.pop();
  13558. },
  13559. copy: function PostScriptStack_copy(n) {
  13560. if (this.stack.length + n >= MAX_STACK_SIZE) {
  13561. error('PostScript function stack overflow.');
  13562. }
  13563. var stack = this.stack;
  13564. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  13565. stack.push(stack[i]);
  13566. }
  13567. },
  13568. index: function PostScriptStack_index(n) {
  13569. this.push(this.stack[this.stack.length - n - 1]);
  13570. },
  13571. roll: function PostScriptStack_roll(n, p) {
  13572. var stack = this.stack;
  13573. var l = stack.length - n;
  13574. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  13575. for (i = l, j = r; i < j; i++, j--) {
  13576. t = stack[i];
  13577. stack[i] = stack[j];
  13578. stack[j] = t;
  13579. }
  13580. for (i = l, j = c - 1; i < j; i++, j--) {
  13581. t = stack[i];
  13582. stack[i] = stack[j];
  13583. stack[j] = t;
  13584. }
  13585. for (i = c, j = r; i < j; i++, j--) {
  13586. t = stack[i];
  13587. stack[i] = stack[j];
  13588. stack[j] = t;
  13589. }
  13590. }
  13591. };
  13592. return PostScriptStack;
  13593. }();
  13594. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  13595. function PostScriptEvaluator(operators) {
  13596. this.operators = operators;
  13597. }
  13598. PostScriptEvaluator.prototype = {
  13599. execute: function PostScriptEvaluator_execute(initialStack) {
  13600. var stack = new PostScriptStack(initialStack);
  13601. var counter = 0;
  13602. var operators = this.operators;
  13603. var length = operators.length;
  13604. var operator, a, b;
  13605. while (counter < length) {
  13606. operator = operators[counter++];
  13607. if (typeof operator === 'number') {
  13608. stack.push(operator);
  13609. continue;
  13610. }
  13611. switch (operator) {
  13612. case 'jz':
  13613. b = stack.pop();
  13614. a = stack.pop();
  13615. if (!a) {
  13616. counter = b;
  13617. }
  13618. break;
  13619. case 'j':
  13620. a = stack.pop();
  13621. counter = a;
  13622. break;
  13623. case 'abs':
  13624. a = stack.pop();
  13625. stack.push(Math.abs(a));
  13626. break;
  13627. case 'add':
  13628. b = stack.pop();
  13629. a = stack.pop();
  13630. stack.push(a + b);
  13631. break;
  13632. case 'and':
  13633. b = stack.pop();
  13634. a = stack.pop();
  13635. if (isBool(a) && isBool(b)) {
  13636. stack.push(a && b);
  13637. } else {
  13638. stack.push(a & b);
  13639. }
  13640. break;
  13641. case 'atan':
  13642. a = stack.pop();
  13643. stack.push(Math.atan(a));
  13644. break;
  13645. case 'bitshift':
  13646. b = stack.pop();
  13647. a = stack.pop();
  13648. if (a > 0) {
  13649. stack.push(a << b);
  13650. } else {
  13651. stack.push(a >> b);
  13652. }
  13653. break;
  13654. case 'ceiling':
  13655. a = stack.pop();
  13656. stack.push(Math.ceil(a));
  13657. break;
  13658. case 'copy':
  13659. a = stack.pop();
  13660. stack.copy(a);
  13661. break;
  13662. case 'cos':
  13663. a = stack.pop();
  13664. stack.push(Math.cos(a));
  13665. break;
  13666. case 'cvi':
  13667. a = stack.pop() | 0;
  13668. stack.push(a);
  13669. break;
  13670. case 'cvr':
  13671. break;
  13672. case 'div':
  13673. b = stack.pop();
  13674. a = stack.pop();
  13675. stack.push(a / b);
  13676. break;
  13677. case 'dup':
  13678. stack.copy(1);
  13679. break;
  13680. case 'eq':
  13681. b = stack.pop();
  13682. a = stack.pop();
  13683. stack.push(a === b);
  13684. break;
  13685. case 'exch':
  13686. stack.roll(2, 1);
  13687. break;
  13688. case 'exp':
  13689. b = stack.pop();
  13690. a = stack.pop();
  13691. stack.push(Math.pow(a, b));
  13692. break;
  13693. case 'false':
  13694. stack.push(false);
  13695. break;
  13696. case 'floor':
  13697. a = stack.pop();
  13698. stack.push(Math.floor(a));
  13699. break;
  13700. case 'ge':
  13701. b = stack.pop();
  13702. a = stack.pop();
  13703. stack.push(a >= b);
  13704. break;
  13705. case 'gt':
  13706. b = stack.pop();
  13707. a = stack.pop();
  13708. stack.push(a > b);
  13709. break;
  13710. case 'idiv':
  13711. b = stack.pop();
  13712. a = stack.pop();
  13713. stack.push(a / b | 0);
  13714. break;
  13715. case 'index':
  13716. a = stack.pop();
  13717. stack.index(a);
  13718. break;
  13719. case 'le':
  13720. b = stack.pop();
  13721. a = stack.pop();
  13722. stack.push(a <= b);
  13723. break;
  13724. case 'ln':
  13725. a = stack.pop();
  13726. stack.push(Math.log(a));
  13727. break;
  13728. case 'log':
  13729. a = stack.pop();
  13730. stack.push(Math.log(a) / Math.LN10);
  13731. break;
  13732. case 'lt':
  13733. b = stack.pop();
  13734. a = stack.pop();
  13735. stack.push(a < b);
  13736. break;
  13737. case 'mod':
  13738. b = stack.pop();
  13739. a = stack.pop();
  13740. stack.push(a % b);
  13741. break;
  13742. case 'mul':
  13743. b = stack.pop();
  13744. a = stack.pop();
  13745. stack.push(a * b);
  13746. break;
  13747. case 'ne':
  13748. b = stack.pop();
  13749. a = stack.pop();
  13750. stack.push(a !== b);
  13751. break;
  13752. case 'neg':
  13753. a = stack.pop();
  13754. stack.push(-a);
  13755. break;
  13756. case 'not':
  13757. a = stack.pop();
  13758. if (isBool(a)) {
  13759. stack.push(!a);
  13760. } else {
  13761. stack.push(~a);
  13762. }
  13763. break;
  13764. case 'or':
  13765. b = stack.pop();
  13766. a = stack.pop();
  13767. if (isBool(a) && isBool(b)) {
  13768. stack.push(a || b);
  13769. } else {
  13770. stack.push(a | b);
  13771. }
  13772. break;
  13773. case 'pop':
  13774. stack.pop();
  13775. break;
  13776. case 'roll':
  13777. b = stack.pop();
  13778. a = stack.pop();
  13779. stack.roll(a, b);
  13780. break;
  13781. case 'round':
  13782. a = stack.pop();
  13783. stack.push(Math.round(a));
  13784. break;
  13785. case 'sin':
  13786. a = stack.pop();
  13787. stack.push(Math.sin(a));
  13788. break;
  13789. case 'sqrt':
  13790. a = stack.pop();
  13791. stack.push(Math.sqrt(a));
  13792. break;
  13793. case 'sub':
  13794. b = stack.pop();
  13795. a = stack.pop();
  13796. stack.push(a - b);
  13797. break;
  13798. case 'true':
  13799. stack.push(true);
  13800. break;
  13801. case 'truncate':
  13802. a = stack.pop();
  13803. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  13804. stack.push(a);
  13805. break;
  13806. case 'xor':
  13807. b = stack.pop();
  13808. a = stack.pop();
  13809. if (isBool(a) && isBool(b)) {
  13810. stack.push(a !== b);
  13811. } else {
  13812. stack.push(a ^ b);
  13813. }
  13814. break;
  13815. default:
  13816. error('Unknown operator ' + operator);
  13817. break;
  13818. }
  13819. }
  13820. return stack.stack;
  13821. }
  13822. };
  13823. return PostScriptEvaluator;
  13824. }();
  13825. var PostScriptCompiler = function PostScriptCompilerClosure() {
  13826. function AstNode(type) {
  13827. this.type = type;
  13828. }
  13829. AstNode.prototype.visit = function (visitor) {
  13830. throw new Error('abstract method');
  13831. };
  13832. function AstArgument(index, min, max) {
  13833. AstNode.call(this, 'args');
  13834. this.index = index;
  13835. this.min = min;
  13836. this.max = max;
  13837. }
  13838. AstArgument.prototype = Object.create(AstNode.prototype);
  13839. AstArgument.prototype.visit = function (visitor) {
  13840. visitor.visitArgument(this);
  13841. };
  13842. function AstLiteral(number) {
  13843. AstNode.call(this, 'literal');
  13844. this.number = number;
  13845. this.min = number;
  13846. this.max = number;
  13847. }
  13848. AstLiteral.prototype = Object.create(AstNode.prototype);
  13849. AstLiteral.prototype.visit = function (visitor) {
  13850. visitor.visitLiteral(this);
  13851. };
  13852. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13853. AstNode.call(this, 'binary');
  13854. this.op = op;
  13855. this.arg1 = arg1;
  13856. this.arg2 = arg2;
  13857. this.min = min;
  13858. this.max = max;
  13859. }
  13860. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13861. AstBinaryOperation.prototype.visit = function (visitor) {
  13862. visitor.visitBinaryOperation(this);
  13863. };
  13864. function AstMin(arg, max) {
  13865. AstNode.call(this, 'max');
  13866. this.arg = arg;
  13867. this.min = arg.min;
  13868. this.max = max;
  13869. }
  13870. AstMin.prototype = Object.create(AstNode.prototype);
  13871. AstMin.prototype.visit = function (visitor) {
  13872. visitor.visitMin(this);
  13873. };
  13874. function AstVariable(index, min, max) {
  13875. AstNode.call(this, 'var');
  13876. this.index = index;
  13877. this.min = min;
  13878. this.max = max;
  13879. }
  13880. AstVariable.prototype = Object.create(AstNode.prototype);
  13881. AstVariable.prototype.visit = function (visitor) {
  13882. visitor.visitVariable(this);
  13883. };
  13884. function AstVariableDefinition(variable, arg) {
  13885. AstNode.call(this, 'definition');
  13886. this.variable = variable;
  13887. this.arg = arg;
  13888. }
  13889. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13890. AstVariableDefinition.prototype.visit = function (visitor) {
  13891. visitor.visitVariableDefinition(this);
  13892. };
  13893. function ExpressionBuilderVisitor() {
  13894. this.parts = [];
  13895. }
  13896. ExpressionBuilderVisitor.prototype = {
  13897. visitArgument: function (arg) {
  13898. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13899. },
  13900. visitVariable: function (variable) {
  13901. this.parts.push('v', variable.index);
  13902. },
  13903. visitLiteral: function (literal) {
  13904. this.parts.push(literal.number);
  13905. },
  13906. visitBinaryOperation: function (operation) {
  13907. this.parts.push('(');
  13908. operation.arg1.visit(this);
  13909. this.parts.push(' ', operation.op, ' ');
  13910. operation.arg2.visit(this);
  13911. this.parts.push(')');
  13912. },
  13913. visitVariableDefinition: function (definition) {
  13914. this.parts.push('var ');
  13915. definition.variable.visit(this);
  13916. this.parts.push(' = ');
  13917. definition.arg.visit(this);
  13918. this.parts.push(';');
  13919. },
  13920. visitMin: function (max) {
  13921. this.parts.push('Math.min(');
  13922. max.arg.visit(this);
  13923. this.parts.push(', ', max.max, ')');
  13924. },
  13925. toString: function () {
  13926. return this.parts.join('');
  13927. }
  13928. };
  13929. function buildAddOperation(num1, num2) {
  13930. if (num2.type === 'literal' && num2.number === 0) {
  13931. return num1;
  13932. }
  13933. if (num1.type === 'literal' && num1.number === 0) {
  13934. return num2;
  13935. }
  13936. if (num2.type === 'literal' && num1.type === 'literal') {
  13937. return new AstLiteral(num1.number + num2.number);
  13938. }
  13939. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13940. }
  13941. function buildMulOperation(num1, num2) {
  13942. if (num2.type === 'literal') {
  13943. if (num2.number === 0) {
  13944. return new AstLiteral(0);
  13945. } else if (num2.number === 1) {
  13946. return num1;
  13947. } else if (num1.type === 'literal') {
  13948. return new AstLiteral(num1.number * num2.number);
  13949. }
  13950. }
  13951. if (num1.type === 'literal') {
  13952. if (num1.number === 0) {
  13953. return new AstLiteral(0);
  13954. } else if (num1.number === 1) {
  13955. return num2;
  13956. }
  13957. }
  13958. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13959. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13960. return new AstBinaryOperation('*', num1, num2, min, max);
  13961. }
  13962. function buildSubOperation(num1, num2) {
  13963. if (num2.type === 'literal') {
  13964. if (num2.number === 0) {
  13965. return num1;
  13966. } else if (num1.type === 'literal') {
  13967. return new AstLiteral(num1.number - num2.number);
  13968. }
  13969. }
  13970. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13971. return num2.arg2;
  13972. }
  13973. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13974. }
  13975. function buildMinOperation(num1, max) {
  13976. if (num1.min >= max) {
  13977. return new AstLiteral(max);
  13978. } else if (num1.max <= max) {
  13979. return num1;
  13980. }
  13981. return new AstMin(num1, max);
  13982. }
  13983. function PostScriptCompiler() {
  13984. }
  13985. PostScriptCompiler.prototype = {
  13986. compile: function PostScriptCompiler_compile(code, domain, range) {
  13987. var stack = [];
  13988. var i, ii;
  13989. var instructions = [];
  13990. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13991. var lastRegister = 0;
  13992. var n, j;
  13993. var num1, num2, ast1, ast2, tmpVar, item;
  13994. for (i = 0; i < inputSize; i++) {
  13995. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13996. }
  13997. for (i = 0, ii = code.length; i < ii; i++) {
  13998. item = code[i];
  13999. if (typeof item === 'number') {
  14000. stack.push(new AstLiteral(item));
  14001. continue;
  14002. }
  14003. switch (item) {
  14004. case 'add':
  14005. if (stack.length < 2) {
  14006. return null;
  14007. }
  14008. num2 = stack.pop();
  14009. num1 = stack.pop();
  14010. stack.push(buildAddOperation(num1, num2));
  14011. break;
  14012. case 'cvr':
  14013. if (stack.length < 1) {
  14014. return null;
  14015. }
  14016. break;
  14017. case 'mul':
  14018. if (stack.length < 2) {
  14019. return null;
  14020. }
  14021. num2 = stack.pop();
  14022. num1 = stack.pop();
  14023. stack.push(buildMulOperation(num1, num2));
  14024. break;
  14025. case 'sub':
  14026. if (stack.length < 2) {
  14027. return null;
  14028. }
  14029. num2 = stack.pop();
  14030. num1 = stack.pop();
  14031. stack.push(buildSubOperation(num1, num2));
  14032. break;
  14033. case 'exch':
  14034. if (stack.length < 2) {
  14035. return null;
  14036. }
  14037. ast1 = stack.pop();
  14038. ast2 = stack.pop();
  14039. stack.push(ast1, ast2);
  14040. break;
  14041. case 'pop':
  14042. if (stack.length < 1) {
  14043. return null;
  14044. }
  14045. stack.pop();
  14046. break;
  14047. case 'index':
  14048. if (stack.length < 1) {
  14049. return null;
  14050. }
  14051. num1 = stack.pop();
  14052. if (num1.type !== 'literal') {
  14053. return null;
  14054. }
  14055. n = num1.number;
  14056. if (n < 0 || (n | 0) !== n || stack.length < n) {
  14057. return null;
  14058. }
  14059. ast1 = stack[stack.length - n - 1];
  14060. if (ast1.type === 'literal' || ast1.type === 'var') {
  14061. stack.push(ast1);
  14062. break;
  14063. }
  14064. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14065. stack[stack.length - n - 1] = tmpVar;
  14066. stack.push(tmpVar);
  14067. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14068. break;
  14069. case 'dup':
  14070. if (stack.length < 1) {
  14071. return null;
  14072. }
  14073. 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]) {
  14074. num1 = stack.pop();
  14075. stack.push(buildMinOperation(num1, code[i + 1]));
  14076. i += 6;
  14077. break;
  14078. }
  14079. ast1 = stack[stack.length - 1];
  14080. if (ast1.type === 'literal' || ast1.type === 'var') {
  14081. stack.push(ast1);
  14082. break;
  14083. }
  14084. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14085. stack[stack.length - 1] = tmpVar;
  14086. stack.push(tmpVar);
  14087. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14088. break;
  14089. case 'roll':
  14090. if (stack.length < 2) {
  14091. return null;
  14092. }
  14093. num2 = stack.pop();
  14094. num1 = stack.pop();
  14095. if (num2.type !== 'literal' || num1.type !== 'literal') {
  14096. return null;
  14097. }
  14098. j = num2.number;
  14099. n = num1.number;
  14100. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  14101. return null;
  14102. }
  14103. j = (j % n + n) % n;
  14104. if (j === 0) {
  14105. break;
  14106. }
  14107. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  14108. break;
  14109. default:
  14110. return null;
  14111. }
  14112. }
  14113. if (stack.length !== outputSize) {
  14114. return null;
  14115. }
  14116. var result = [];
  14117. instructions.forEach(function (instruction) {
  14118. var statementBuilder = new ExpressionBuilderVisitor();
  14119. instruction.visit(statementBuilder);
  14120. result.push(statementBuilder.toString());
  14121. });
  14122. stack.forEach(function (expr, i) {
  14123. var statementBuilder = new ExpressionBuilderVisitor();
  14124. expr.visit(statementBuilder);
  14125. var min = range[i * 2], max = range[i * 2 + 1];
  14126. var out = [statementBuilder.toString()];
  14127. if (min > expr.min) {
  14128. out.unshift('Math.max(', min, ', ');
  14129. out.push(')');
  14130. }
  14131. if (max < expr.max) {
  14132. out.unshift('Math.min(', max, ', ');
  14133. out.push(')');
  14134. }
  14135. out.unshift('dest[destOffset + ', i, '] = ');
  14136. out.push(';');
  14137. result.push(out.join(''));
  14138. });
  14139. return result.join('\n');
  14140. }
  14141. };
  14142. return PostScriptCompiler;
  14143. }();
  14144. exports.isPDFFunction = isPDFFunction;
  14145. exports.PDFFunction = PDFFunction;
  14146. exports.PostScriptEvaluator = PostScriptEvaluator;
  14147. exports.PostScriptCompiler = PostScriptCompiler;
  14148. /***/ }),
  14149. /* 7 */
  14150. /***/ (function(module, exports, __w_pdfjs_require__) {
  14151. "use strict";
  14152. var sharedUtil = __w_pdfjs_require__(0);
  14153. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  14154. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  14155. t['A'] = 0x0041;
  14156. t['AE'] = 0x00C6;
  14157. t['AEacute'] = 0x01FC;
  14158. t['AEmacron'] = 0x01E2;
  14159. t['AEsmall'] = 0xF7E6;
  14160. t['Aacute'] = 0x00C1;
  14161. t['Aacutesmall'] = 0xF7E1;
  14162. t['Abreve'] = 0x0102;
  14163. t['Abreveacute'] = 0x1EAE;
  14164. t['Abrevecyrillic'] = 0x04D0;
  14165. t['Abrevedotbelow'] = 0x1EB6;
  14166. t['Abrevegrave'] = 0x1EB0;
  14167. t['Abrevehookabove'] = 0x1EB2;
  14168. t['Abrevetilde'] = 0x1EB4;
  14169. t['Acaron'] = 0x01CD;
  14170. t['Acircle'] = 0x24B6;
  14171. t['Acircumflex'] = 0x00C2;
  14172. t['Acircumflexacute'] = 0x1EA4;
  14173. t['Acircumflexdotbelow'] = 0x1EAC;
  14174. t['Acircumflexgrave'] = 0x1EA6;
  14175. t['Acircumflexhookabove'] = 0x1EA8;
  14176. t['Acircumflexsmall'] = 0xF7E2;
  14177. t['Acircumflextilde'] = 0x1EAA;
  14178. t['Acute'] = 0xF6C9;
  14179. t['Acutesmall'] = 0xF7B4;
  14180. t['Acyrillic'] = 0x0410;
  14181. t['Adblgrave'] = 0x0200;
  14182. t['Adieresis'] = 0x00C4;
  14183. t['Adieresiscyrillic'] = 0x04D2;
  14184. t['Adieresismacron'] = 0x01DE;
  14185. t['Adieresissmall'] = 0xF7E4;
  14186. t['Adotbelow'] = 0x1EA0;
  14187. t['Adotmacron'] = 0x01E0;
  14188. t['Agrave'] = 0x00C0;
  14189. t['Agravesmall'] = 0xF7E0;
  14190. t['Ahookabove'] = 0x1EA2;
  14191. t['Aiecyrillic'] = 0x04D4;
  14192. t['Ainvertedbreve'] = 0x0202;
  14193. t['Alpha'] = 0x0391;
  14194. t['Alphatonos'] = 0x0386;
  14195. t['Amacron'] = 0x0100;
  14196. t['Amonospace'] = 0xFF21;
  14197. t['Aogonek'] = 0x0104;
  14198. t['Aring'] = 0x00C5;
  14199. t['Aringacute'] = 0x01FA;
  14200. t['Aringbelow'] = 0x1E00;
  14201. t['Aringsmall'] = 0xF7E5;
  14202. t['Asmall'] = 0xF761;
  14203. t['Atilde'] = 0x00C3;
  14204. t['Atildesmall'] = 0xF7E3;
  14205. t['Aybarmenian'] = 0x0531;
  14206. t['B'] = 0x0042;
  14207. t['Bcircle'] = 0x24B7;
  14208. t['Bdotaccent'] = 0x1E02;
  14209. t['Bdotbelow'] = 0x1E04;
  14210. t['Becyrillic'] = 0x0411;
  14211. t['Benarmenian'] = 0x0532;
  14212. t['Beta'] = 0x0392;
  14213. t['Bhook'] = 0x0181;
  14214. t['Blinebelow'] = 0x1E06;
  14215. t['Bmonospace'] = 0xFF22;
  14216. t['Brevesmall'] = 0xF6F4;
  14217. t['Bsmall'] = 0xF762;
  14218. t['Btopbar'] = 0x0182;
  14219. t['C'] = 0x0043;
  14220. t['Caarmenian'] = 0x053E;
  14221. t['Cacute'] = 0x0106;
  14222. t['Caron'] = 0xF6CA;
  14223. t['Caronsmall'] = 0xF6F5;
  14224. t['Ccaron'] = 0x010C;
  14225. t['Ccedilla'] = 0x00C7;
  14226. t['Ccedillaacute'] = 0x1E08;
  14227. t['Ccedillasmall'] = 0xF7E7;
  14228. t['Ccircle'] = 0x24B8;
  14229. t['Ccircumflex'] = 0x0108;
  14230. t['Cdot'] = 0x010A;
  14231. t['Cdotaccent'] = 0x010A;
  14232. t['Cedillasmall'] = 0xF7B8;
  14233. t['Chaarmenian'] = 0x0549;
  14234. t['Cheabkhasiancyrillic'] = 0x04BC;
  14235. t['Checyrillic'] = 0x0427;
  14236. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  14237. t['Chedescendercyrillic'] = 0x04B6;
  14238. t['Chedieresiscyrillic'] = 0x04F4;
  14239. t['Cheharmenian'] = 0x0543;
  14240. t['Chekhakassiancyrillic'] = 0x04CB;
  14241. t['Cheverticalstrokecyrillic'] = 0x04B8;
  14242. t['Chi'] = 0x03A7;
  14243. t['Chook'] = 0x0187;
  14244. t['Circumflexsmall'] = 0xF6F6;
  14245. t['Cmonospace'] = 0xFF23;
  14246. t['Coarmenian'] = 0x0551;
  14247. t['Csmall'] = 0xF763;
  14248. t['D'] = 0x0044;
  14249. t['DZ'] = 0x01F1;
  14250. t['DZcaron'] = 0x01C4;
  14251. t['Daarmenian'] = 0x0534;
  14252. t['Dafrican'] = 0x0189;
  14253. t['Dcaron'] = 0x010E;
  14254. t['Dcedilla'] = 0x1E10;
  14255. t['Dcircle'] = 0x24B9;
  14256. t['Dcircumflexbelow'] = 0x1E12;
  14257. t['Dcroat'] = 0x0110;
  14258. t['Ddotaccent'] = 0x1E0A;
  14259. t['Ddotbelow'] = 0x1E0C;
  14260. t['Decyrillic'] = 0x0414;
  14261. t['Deicoptic'] = 0x03EE;
  14262. t['Delta'] = 0x2206;
  14263. t['Deltagreek'] = 0x0394;
  14264. t['Dhook'] = 0x018A;
  14265. t['Dieresis'] = 0xF6CB;
  14266. t['DieresisAcute'] = 0xF6CC;
  14267. t['DieresisGrave'] = 0xF6CD;
  14268. t['Dieresissmall'] = 0xF7A8;
  14269. t['Digammagreek'] = 0x03DC;
  14270. t['Djecyrillic'] = 0x0402;
  14271. t['Dlinebelow'] = 0x1E0E;
  14272. t['Dmonospace'] = 0xFF24;
  14273. t['Dotaccentsmall'] = 0xF6F7;
  14274. t['Dslash'] = 0x0110;
  14275. t['Dsmall'] = 0xF764;
  14276. t['Dtopbar'] = 0x018B;
  14277. t['Dz'] = 0x01F2;
  14278. t['Dzcaron'] = 0x01C5;
  14279. t['Dzeabkhasiancyrillic'] = 0x04E0;
  14280. t['Dzecyrillic'] = 0x0405;
  14281. t['Dzhecyrillic'] = 0x040F;
  14282. t['E'] = 0x0045;
  14283. t['Eacute'] = 0x00C9;
  14284. t['Eacutesmall'] = 0xF7E9;
  14285. t['Ebreve'] = 0x0114;
  14286. t['Ecaron'] = 0x011A;
  14287. t['Ecedillabreve'] = 0x1E1C;
  14288. t['Echarmenian'] = 0x0535;
  14289. t['Ecircle'] = 0x24BA;
  14290. t['Ecircumflex'] = 0x00CA;
  14291. t['Ecircumflexacute'] = 0x1EBE;
  14292. t['Ecircumflexbelow'] = 0x1E18;
  14293. t['Ecircumflexdotbelow'] = 0x1EC6;
  14294. t['Ecircumflexgrave'] = 0x1EC0;
  14295. t['Ecircumflexhookabove'] = 0x1EC2;
  14296. t['Ecircumflexsmall'] = 0xF7EA;
  14297. t['Ecircumflextilde'] = 0x1EC4;
  14298. t['Ecyrillic'] = 0x0404;
  14299. t['Edblgrave'] = 0x0204;
  14300. t['Edieresis'] = 0x00CB;
  14301. t['Edieresissmall'] = 0xF7EB;
  14302. t['Edot'] = 0x0116;
  14303. t['Edotaccent'] = 0x0116;
  14304. t['Edotbelow'] = 0x1EB8;
  14305. t['Efcyrillic'] = 0x0424;
  14306. t['Egrave'] = 0x00C8;
  14307. t['Egravesmall'] = 0xF7E8;
  14308. t['Eharmenian'] = 0x0537;
  14309. t['Ehookabove'] = 0x1EBA;
  14310. t['Eightroman'] = 0x2167;
  14311. t['Einvertedbreve'] = 0x0206;
  14312. t['Eiotifiedcyrillic'] = 0x0464;
  14313. t['Elcyrillic'] = 0x041B;
  14314. t['Elevenroman'] = 0x216A;
  14315. t['Emacron'] = 0x0112;
  14316. t['Emacronacute'] = 0x1E16;
  14317. t['Emacrongrave'] = 0x1E14;
  14318. t['Emcyrillic'] = 0x041C;
  14319. t['Emonospace'] = 0xFF25;
  14320. t['Encyrillic'] = 0x041D;
  14321. t['Endescendercyrillic'] = 0x04A2;
  14322. t['Eng'] = 0x014A;
  14323. t['Enghecyrillic'] = 0x04A4;
  14324. t['Enhookcyrillic'] = 0x04C7;
  14325. t['Eogonek'] = 0x0118;
  14326. t['Eopen'] = 0x0190;
  14327. t['Epsilon'] = 0x0395;
  14328. t['Epsilontonos'] = 0x0388;
  14329. t['Ercyrillic'] = 0x0420;
  14330. t['Ereversed'] = 0x018E;
  14331. t['Ereversedcyrillic'] = 0x042D;
  14332. t['Escyrillic'] = 0x0421;
  14333. t['Esdescendercyrillic'] = 0x04AA;
  14334. t['Esh'] = 0x01A9;
  14335. t['Esmall'] = 0xF765;
  14336. t['Eta'] = 0x0397;
  14337. t['Etarmenian'] = 0x0538;
  14338. t['Etatonos'] = 0x0389;
  14339. t['Eth'] = 0x00D0;
  14340. t['Ethsmall'] = 0xF7F0;
  14341. t['Etilde'] = 0x1EBC;
  14342. t['Etildebelow'] = 0x1E1A;
  14343. t['Euro'] = 0x20AC;
  14344. t['Ezh'] = 0x01B7;
  14345. t['Ezhcaron'] = 0x01EE;
  14346. t['Ezhreversed'] = 0x01B8;
  14347. t['F'] = 0x0046;
  14348. t['Fcircle'] = 0x24BB;
  14349. t['Fdotaccent'] = 0x1E1E;
  14350. t['Feharmenian'] = 0x0556;
  14351. t['Feicoptic'] = 0x03E4;
  14352. t['Fhook'] = 0x0191;
  14353. t['Fitacyrillic'] = 0x0472;
  14354. t['Fiveroman'] = 0x2164;
  14355. t['Fmonospace'] = 0xFF26;
  14356. t['Fourroman'] = 0x2163;
  14357. t['Fsmall'] = 0xF766;
  14358. t['G'] = 0x0047;
  14359. t['GBsquare'] = 0x3387;
  14360. t['Gacute'] = 0x01F4;
  14361. t['Gamma'] = 0x0393;
  14362. t['Gammaafrican'] = 0x0194;
  14363. t['Gangiacoptic'] = 0x03EA;
  14364. t['Gbreve'] = 0x011E;
  14365. t['Gcaron'] = 0x01E6;
  14366. t['Gcedilla'] = 0x0122;
  14367. t['Gcircle'] = 0x24BC;
  14368. t['Gcircumflex'] = 0x011C;
  14369. t['Gcommaaccent'] = 0x0122;
  14370. t['Gdot'] = 0x0120;
  14371. t['Gdotaccent'] = 0x0120;
  14372. t['Gecyrillic'] = 0x0413;
  14373. t['Ghadarmenian'] = 0x0542;
  14374. t['Ghemiddlehookcyrillic'] = 0x0494;
  14375. t['Ghestrokecyrillic'] = 0x0492;
  14376. t['Gheupturncyrillic'] = 0x0490;
  14377. t['Ghook'] = 0x0193;
  14378. t['Gimarmenian'] = 0x0533;
  14379. t['Gjecyrillic'] = 0x0403;
  14380. t['Gmacron'] = 0x1E20;
  14381. t['Gmonospace'] = 0xFF27;
  14382. t['Grave'] = 0xF6CE;
  14383. t['Gravesmall'] = 0xF760;
  14384. t['Gsmall'] = 0xF767;
  14385. t['Gsmallhook'] = 0x029B;
  14386. t['Gstroke'] = 0x01E4;
  14387. t['H'] = 0x0048;
  14388. t['H18533'] = 0x25CF;
  14389. t['H18543'] = 0x25AA;
  14390. t['H18551'] = 0x25AB;
  14391. t['H22073'] = 0x25A1;
  14392. t['HPsquare'] = 0x33CB;
  14393. t['Haabkhasiancyrillic'] = 0x04A8;
  14394. t['Hadescendercyrillic'] = 0x04B2;
  14395. t['Hardsigncyrillic'] = 0x042A;
  14396. t['Hbar'] = 0x0126;
  14397. t['Hbrevebelow'] = 0x1E2A;
  14398. t['Hcedilla'] = 0x1E28;
  14399. t['Hcircle'] = 0x24BD;
  14400. t['Hcircumflex'] = 0x0124;
  14401. t['Hdieresis'] = 0x1E26;
  14402. t['Hdotaccent'] = 0x1E22;
  14403. t['Hdotbelow'] = 0x1E24;
  14404. t['Hmonospace'] = 0xFF28;
  14405. t['Hoarmenian'] = 0x0540;
  14406. t['Horicoptic'] = 0x03E8;
  14407. t['Hsmall'] = 0xF768;
  14408. t['Hungarumlaut'] = 0xF6CF;
  14409. t['Hungarumlautsmall'] = 0xF6F8;
  14410. t['Hzsquare'] = 0x3390;
  14411. t['I'] = 0x0049;
  14412. t['IAcyrillic'] = 0x042F;
  14413. t['IJ'] = 0x0132;
  14414. t['IUcyrillic'] = 0x042E;
  14415. t['Iacute'] = 0x00CD;
  14416. t['Iacutesmall'] = 0xF7ED;
  14417. t['Ibreve'] = 0x012C;
  14418. t['Icaron'] = 0x01CF;
  14419. t['Icircle'] = 0x24BE;
  14420. t['Icircumflex'] = 0x00CE;
  14421. t['Icircumflexsmall'] = 0xF7EE;
  14422. t['Icyrillic'] = 0x0406;
  14423. t['Idblgrave'] = 0x0208;
  14424. t['Idieresis'] = 0x00CF;
  14425. t['Idieresisacute'] = 0x1E2E;
  14426. t['Idieresiscyrillic'] = 0x04E4;
  14427. t['Idieresissmall'] = 0xF7EF;
  14428. t['Idot'] = 0x0130;
  14429. t['Idotaccent'] = 0x0130;
  14430. t['Idotbelow'] = 0x1ECA;
  14431. t['Iebrevecyrillic'] = 0x04D6;
  14432. t['Iecyrillic'] = 0x0415;
  14433. t['Ifraktur'] = 0x2111;
  14434. t['Igrave'] = 0x00CC;
  14435. t['Igravesmall'] = 0xF7EC;
  14436. t['Ihookabove'] = 0x1EC8;
  14437. t['Iicyrillic'] = 0x0418;
  14438. t['Iinvertedbreve'] = 0x020A;
  14439. t['Iishortcyrillic'] = 0x0419;
  14440. t['Imacron'] = 0x012A;
  14441. t['Imacroncyrillic'] = 0x04E2;
  14442. t['Imonospace'] = 0xFF29;
  14443. t['Iniarmenian'] = 0x053B;
  14444. t['Iocyrillic'] = 0x0401;
  14445. t['Iogonek'] = 0x012E;
  14446. t['Iota'] = 0x0399;
  14447. t['Iotaafrican'] = 0x0196;
  14448. t['Iotadieresis'] = 0x03AA;
  14449. t['Iotatonos'] = 0x038A;
  14450. t['Ismall'] = 0xF769;
  14451. t['Istroke'] = 0x0197;
  14452. t['Itilde'] = 0x0128;
  14453. t['Itildebelow'] = 0x1E2C;
  14454. t['Izhitsacyrillic'] = 0x0474;
  14455. t['Izhitsadblgravecyrillic'] = 0x0476;
  14456. t['J'] = 0x004A;
  14457. t['Jaarmenian'] = 0x0541;
  14458. t['Jcircle'] = 0x24BF;
  14459. t['Jcircumflex'] = 0x0134;
  14460. t['Jecyrillic'] = 0x0408;
  14461. t['Jheharmenian'] = 0x054B;
  14462. t['Jmonospace'] = 0xFF2A;
  14463. t['Jsmall'] = 0xF76A;
  14464. t['K'] = 0x004B;
  14465. t['KBsquare'] = 0x3385;
  14466. t['KKsquare'] = 0x33CD;
  14467. t['Kabashkircyrillic'] = 0x04A0;
  14468. t['Kacute'] = 0x1E30;
  14469. t['Kacyrillic'] = 0x041A;
  14470. t['Kadescendercyrillic'] = 0x049A;
  14471. t['Kahookcyrillic'] = 0x04C3;
  14472. t['Kappa'] = 0x039A;
  14473. t['Kastrokecyrillic'] = 0x049E;
  14474. t['Kaverticalstrokecyrillic'] = 0x049C;
  14475. t['Kcaron'] = 0x01E8;
  14476. t['Kcedilla'] = 0x0136;
  14477. t['Kcircle'] = 0x24C0;
  14478. t['Kcommaaccent'] = 0x0136;
  14479. t['Kdotbelow'] = 0x1E32;
  14480. t['Keharmenian'] = 0x0554;
  14481. t['Kenarmenian'] = 0x053F;
  14482. t['Khacyrillic'] = 0x0425;
  14483. t['Kheicoptic'] = 0x03E6;
  14484. t['Khook'] = 0x0198;
  14485. t['Kjecyrillic'] = 0x040C;
  14486. t['Klinebelow'] = 0x1E34;
  14487. t['Kmonospace'] = 0xFF2B;
  14488. t['Koppacyrillic'] = 0x0480;
  14489. t['Koppagreek'] = 0x03DE;
  14490. t['Ksicyrillic'] = 0x046E;
  14491. t['Ksmall'] = 0xF76B;
  14492. t['L'] = 0x004C;
  14493. t['LJ'] = 0x01C7;
  14494. t['LL'] = 0xF6BF;
  14495. t['Lacute'] = 0x0139;
  14496. t['Lambda'] = 0x039B;
  14497. t['Lcaron'] = 0x013D;
  14498. t['Lcedilla'] = 0x013B;
  14499. t['Lcircle'] = 0x24C1;
  14500. t['Lcircumflexbelow'] = 0x1E3C;
  14501. t['Lcommaaccent'] = 0x013B;
  14502. t['Ldot'] = 0x013F;
  14503. t['Ldotaccent'] = 0x013F;
  14504. t['Ldotbelow'] = 0x1E36;
  14505. t['Ldotbelowmacron'] = 0x1E38;
  14506. t['Liwnarmenian'] = 0x053C;
  14507. t['Lj'] = 0x01C8;
  14508. t['Ljecyrillic'] = 0x0409;
  14509. t['Llinebelow'] = 0x1E3A;
  14510. t['Lmonospace'] = 0xFF2C;
  14511. t['Lslash'] = 0x0141;
  14512. t['Lslashsmall'] = 0xF6F9;
  14513. t['Lsmall'] = 0xF76C;
  14514. t['M'] = 0x004D;
  14515. t['MBsquare'] = 0x3386;
  14516. t['Macron'] = 0xF6D0;
  14517. t['Macronsmall'] = 0xF7AF;
  14518. t['Macute'] = 0x1E3E;
  14519. t['Mcircle'] = 0x24C2;
  14520. t['Mdotaccent'] = 0x1E40;
  14521. t['Mdotbelow'] = 0x1E42;
  14522. t['Menarmenian'] = 0x0544;
  14523. t['Mmonospace'] = 0xFF2D;
  14524. t['Msmall'] = 0xF76D;
  14525. t['Mturned'] = 0x019C;
  14526. t['Mu'] = 0x039C;
  14527. t['N'] = 0x004E;
  14528. t['NJ'] = 0x01CA;
  14529. t['Nacute'] = 0x0143;
  14530. t['Ncaron'] = 0x0147;
  14531. t['Ncedilla'] = 0x0145;
  14532. t['Ncircle'] = 0x24C3;
  14533. t['Ncircumflexbelow'] = 0x1E4A;
  14534. t['Ncommaaccent'] = 0x0145;
  14535. t['Ndotaccent'] = 0x1E44;
  14536. t['Ndotbelow'] = 0x1E46;
  14537. t['Nhookleft'] = 0x019D;
  14538. t['Nineroman'] = 0x2168;
  14539. t['Nj'] = 0x01CB;
  14540. t['Njecyrillic'] = 0x040A;
  14541. t['Nlinebelow'] = 0x1E48;
  14542. t['Nmonospace'] = 0xFF2E;
  14543. t['Nowarmenian'] = 0x0546;
  14544. t['Nsmall'] = 0xF76E;
  14545. t['Ntilde'] = 0x00D1;
  14546. t['Ntildesmall'] = 0xF7F1;
  14547. t['Nu'] = 0x039D;
  14548. t['O'] = 0x004F;
  14549. t['OE'] = 0x0152;
  14550. t['OEsmall'] = 0xF6FA;
  14551. t['Oacute'] = 0x00D3;
  14552. t['Oacutesmall'] = 0xF7F3;
  14553. t['Obarredcyrillic'] = 0x04E8;
  14554. t['Obarreddieresiscyrillic'] = 0x04EA;
  14555. t['Obreve'] = 0x014E;
  14556. t['Ocaron'] = 0x01D1;
  14557. t['Ocenteredtilde'] = 0x019F;
  14558. t['Ocircle'] = 0x24C4;
  14559. t['Ocircumflex'] = 0x00D4;
  14560. t['Ocircumflexacute'] = 0x1ED0;
  14561. t['Ocircumflexdotbelow'] = 0x1ED8;
  14562. t['Ocircumflexgrave'] = 0x1ED2;
  14563. t['Ocircumflexhookabove'] = 0x1ED4;
  14564. t['Ocircumflexsmall'] = 0xF7F4;
  14565. t['Ocircumflextilde'] = 0x1ED6;
  14566. t['Ocyrillic'] = 0x041E;
  14567. t['Odblacute'] = 0x0150;
  14568. t['Odblgrave'] = 0x020C;
  14569. t['Odieresis'] = 0x00D6;
  14570. t['Odieresiscyrillic'] = 0x04E6;
  14571. t['Odieresissmall'] = 0xF7F6;
  14572. t['Odotbelow'] = 0x1ECC;
  14573. t['Ogoneksmall'] = 0xF6FB;
  14574. t['Ograve'] = 0x00D2;
  14575. t['Ogravesmall'] = 0xF7F2;
  14576. t['Oharmenian'] = 0x0555;
  14577. t['Ohm'] = 0x2126;
  14578. t['Ohookabove'] = 0x1ECE;
  14579. t['Ohorn'] = 0x01A0;
  14580. t['Ohornacute'] = 0x1EDA;
  14581. t['Ohorndotbelow'] = 0x1EE2;
  14582. t['Ohorngrave'] = 0x1EDC;
  14583. t['Ohornhookabove'] = 0x1EDE;
  14584. t['Ohorntilde'] = 0x1EE0;
  14585. t['Ohungarumlaut'] = 0x0150;
  14586. t['Oi'] = 0x01A2;
  14587. t['Oinvertedbreve'] = 0x020E;
  14588. t['Omacron'] = 0x014C;
  14589. t['Omacronacute'] = 0x1E52;
  14590. t['Omacrongrave'] = 0x1E50;
  14591. t['Omega'] = 0x2126;
  14592. t['Omegacyrillic'] = 0x0460;
  14593. t['Omegagreek'] = 0x03A9;
  14594. t['Omegaroundcyrillic'] = 0x047A;
  14595. t['Omegatitlocyrillic'] = 0x047C;
  14596. t['Omegatonos'] = 0x038F;
  14597. t['Omicron'] = 0x039F;
  14598. t['Omicrontonos'] = 0x038C;
  14599. t['Omonospace'] = 0xFF2F;
  14600. t['Oneroman'] = 0x2160;
  14601. t['Oogonek'] = 0x01EA;
  14602. t['Oogonekmacron'] = 0x01EC;
  14603. t['Oopen'] = 0x0186;
  14604. t['Oslash'] = 0x00D8;
  14605. t['Oslashacute'] = 0x01FE;
  14606. t['Oslashsmall'] = 0xF7F8;
  14607. t['Osmall'] = 0xF76F;
  14608. t['Ostrokeacute'] = 0x01FE;
  14609. t['Otcyrillic'] = 0x047E;
  14610. t['Otilde'] = 0x00D5;
  14611. t['Otildeacute'] = 0x1E4C;
  14612. t['Otildedieresis'] = 0x1E4E;
  14613. t['Otildesmall'] = 0xF7F5;
  14614. t['P'] = 0x0050;
  14615. t['Pacute'] = 0x1E54;
  14616. t['Pcircle'] = 0x24C5;
  14617. t['Pdotaccent'] = 0x1E56;
  14618. t['Pecyrillic'] = 0x041F;
  14619. t['Peharmenian'] = 0x054A;
  14620. t['Pemiddlehookcyrillic'] = 0x04A6;
  14621. t['Phi'] = 0x03A6;
  14622. t['Phook'] = 0x01A4;
  14623. t['Pi'] = 0x03A0;
  14624. t['Piwrarmenian'] = 0x0553;
  14625. t['Pmonospace'] = 0xFF30;
  14626. t['Psi'] = 0x03A8;
  14627. t['Psicyrillic'] = 0x0470;
  14628. t['Psmall'] = 0xF770;
  14629. t['Q'] = 0x0051;
  14630. t['Qcircle'] = 0x24C6;
  14631. t['Qmonospace'] = 0xFF31;
  14632. t['Qsmall'] = 0xF771;
  14633. t['R'] = 0x0052;
  14634. t['Raarmenian'] = 0x054C;
  14635. t['Racute'] = 0x0154;
  14636. t['Rcaron'] = 0x0158;
  14637. t['Rcedilla'] = 0x0156;
  14638. t['Rcircle'] = 0x24C7;
  14639. t['Rcommaaccent'] = 0x0156;
  14640. t['Rdblgrave'] = 0x0210;
  14641. t['Rdotaccent'] = 0x1E58;
  14642. t['Rdotbelow'] = 0x1E5A;
  14643. t['Rdotbelowmacron'] = 0x1E5C;
  14644. t['Reharmenian'] = 0x0550;
  14645. t['Rfraktur'] = 0x211C;
  14646. t['Rho'] = 0x03A1;
  14647. t['Ringsmall'] = 0xF6FC;
  14648. t['Rinvertedbreve'] = 0x0212;
  14649. t['Rlinebelow'] = 0x1E5E;
  14650. t['Rmonospace'] = 0xFF32;
  14651. t['Rsmall'] = 0xF772;
  14652. t['Rsmallinverted'] = 0x0281;
  14653. t['Rsmallinvertedsuperior'] = 0x02B6;
  14654. t['S'] = 0x0053;
  14655. t['SF010000'] = 0x250C;
  14656. t['SF020000'] = 0x2514;
  14657. t['SF030000'] = 0x2510;
  14658. t['SF040000'] = 0x2518;
  14659. t['SF050000'] = 0x253C;
  14660. t['SF060000'] = 0x252C;
  14661. t['SF070000'] = 0x2534;
  14662. t['SF080000'] = 0x251C;
  14663. t['SF090000'] = 0x2524;
  14664. t['SF100000'] = 0x2500;
  14665. t['SF110000'] = 0x2502;
  14666. t['SF190000'] = 0x2561;
  14667. t['SF200000'] = 0x2562;
  14668. t['SF210000'] = 0x2556;
  14669. t['SF220000'] = 0x2555;
  14670. t['SF230000'] = 0x2563;
  14671. t['SF240000'] = 0x2551;
  14672. t['SF250000'] = 0x2557;
  14673. t['SF260000'] = 0x255D;
  14674. t['SF270000'] = 0x255C;
  14675. t['SF280000'] = 0x255B;
  14676. t['SF360000'] = 0x255E;
  14677. t['SF370000'] = 0x255F;
  14678. t['SF380000'] = 0x255A;
  14679. t['SF390000'] = 0x2554;
  14680. t['SF400000'] = 0x2569;
  14681. t['SF410000'] = 0x2566;
  14682. t['SF420000'] = 0x2560;
  14683. t['SF430000'] = 0x2550;
  14684. t['SF440000'] = 0x256C;
  14685. t['SF450000'] = 0x2567;
  14686. t['SF460000'] = 0x2568;
  14687. t['SF470000'] = 0x2564;
  14688. t['SF480000'] = 0x2565;
  14689. t['SF490000'] = 0x2559;
  14690. t['SF500000'] = 0x2558;
  14691. t['SF510000'] = 0x2552;
  14692. t['SF520000'] = 0x2553;
  14693. t['SF530000'] = 0x256B;
  14694. t['SF540000'] = 0x256A;
  14695. t['Sacute'] = 0x015A;
  14696. t['Sacutedotaccent'] = 0x1E64;
  14697. t['Sampigreek'] = 0x03E0;
  14698. t['Scaron'] = 0x0160;
  14699. t['Scarondotaccent'] = 0x1E66;
  14700. t['Scaronsmall'] = 0xF6FD;
  14701. t['Scedilla'] = 0x015E;
  14702. t['Schwa'] = 0x018F;
  14703. t['Schwacyrillic'] = 0x04D8;
  14704. t['Schwadieresiscyrillic'] = 0x04DA;
  14705. t['Scircle'] = 0x24C8;
  14706. t['Scircumflex'] = 0x015C;
  14707. t['Scommaaccent'] = 0x0218;
  14708. t['Sdotaccent'] = 0x1E60;
  14709. t['Sdotbelow'] = 0x1E62;
  14710. t['Sdotbelowdotaccent'] = 0x1E68;
  14711. t['Seharmenian'] = 0x054D;
  14712. t['Sevenroman'] = 0x2166;
  14713. t['Shaarmenian'] = 0x0547;
  14714. t['Shacyrillic'] = 0x0428;
  14715. t['Shchacyrillic'] = 0x0429;
  14716. t['Sheicoptic'] = 0x03E2;
  14717. t['Shhacyrillic'] = 0x04BA;
  14718. t['Shimacoptic'] = 0x03EC;
  14719. t['Sigma'] = 0x03A3;
  14720. t['Sixroman'] = 0x2165;
  14721. t['Smonospace'] = 0xFF33;
  14722. t['Softsigncyrillic'] = 0x042C;
  14723. t['Ssmall'] = 0xF773;
  14724. t['Stigmagreek'] = 0x03DA;
  14725. t['T'] = 0x0054;
  14726. t['Tau'] = 0x03A4;
  14727. t['Tbar'] = 0x0166;
  14728. t['Tcaron'] = 0x0164;
  14729. t['Tcedilla'] = 0x0162;
  14730. t['Tcircle'] = 0x24C9;
  14731. t['Tcircumflexbelow'] = 0x1E70;
  14732. t['Tcommaaccent'] = 0x0162;
  14733. t['Tdotaccent'] = 0x1E6A;
  14734. t['Tdotbelow'] = 0x1E6C;
  14735. t['Tecyrillic'] = 0x0422;
  14736. t['Tedescendercyrillic'] = 0x04AC;
  14737. t['Tenroman'] = 0x2169;
  14738. t['Tetsecyrillic'] = 0x04B4;
  14739. t['Theta'] = 0x0398;
  14740. t['Thook'] = 0x01AC;
  14741. t['Thorn'] = 0x00DE;
  14742. t['Thornsmall'] = 0xF7FE;
  14743. t['Threeroman'] = 0x2162;
  14744. t['Tildesmall'] = 0xF6FE;
  14745. t['Tiwnarmenian'] = 0x054F;
  14746. t['Tlinebelow'] = 0x1E6E;
  14747. t['Tmonospace'] = 0xFF34;
  14748. t['Toarmenian'] = 0x0539;
  14749. t['Tonefive'] = 0x01BC;
  14750. t['Tonesix'] = 0x0184;
  14751. t['Tonetwo'] = 0x01A7;
  14752. t['Tretroflexhook'] = 0x01AE;
  14753. t['Tsecyrillic'] = 0x0426;
  14754. t['Tshecyrillic'] = 0x040B;
  14755. t['Tsmall'] = 0xF774;
  14756. t['Twelveroman'] = 0x216B;
  14757. t['Tworoman'] = 0x2161;
  14758. t['U'] = 0x0055;
  14759. t['Uacute'] = 0x00DA;
  14760. t['Uacutesmall'] = 0xF7FA;
  14761. t['Ubreve'] = 0x016C;
  14762. t['Ucaron'] = 0x01D3;
  14763. t['Ucircle'] = 0x24CA;
  14764. t['Ucircumflex'] = 0x00DB;
  14765. t['Ucircumflexbelow'] = 0x1E76;
  14766. t['Ucircumflexsmall'] = 0xF7FB;
  14767. t['Ucyrillic'] = 0x0423;
  14768. t['Udblacute'] = 0x0170;
  14769. t['Udblgrave'] = 0x0214;
  14770. t['Udieresis'] = 0x00DC;
  14771. t['Udieresisacute'] = 0x01D7;
  14772. t['Udieresisbelow'] = 0x1E72;
  14773. t['Udieresiscaron'] = 0x01D9;
  14774. t['Udieresiscyrillic'] = 0x04F0;
  14775. t['Udieresisgrave'] = 0x01DB;
  14776. t['Udieresismacron'] = 0x01D5;
  14777. t['Udieresissmall'] = 0xF7FC;
  14778. t['Udotbelow'] = 0x1EE4;
  14779. t['Ugrave'] = 0x00D9;
  14780. t['Ugravesmall'] = 0xF7F9;
  14781. t['Uhookabove'] = 0x1EE6;
  14782. t['Uhorn'] = 0x01AF;
  14783. t['Uhornacute'] = 0x1EE8;
  14784. t['Uhorndotbelow'] = 0x1EF0;
  14785. t['Uhorngrave'] = 0x1EEA;
  14786. t['Uhornhookabove'] = 0x1EEC;
  14787. t['Uhorntilde'] = 0x1EEE;
  14788. t['Uhungarumlaut'] = 0x0170;
  14789. t['Uhungarumlautcyrillic'] = 0x04F2;
  14790. t['Uinvertedbreve'] = 0x0216;
  14791. t['Ukcyrillic'] = 0x0478;
  14792. t['Umacron'] = 0x016A;
  14793. t['Umacroncyrillic'] = 0x04EE;
  14794. t['Umacrondieresis'] = 0x1E7A;
  14795. t['Umonospace'] = 0xFF35;
  14796. t['Uogonek'] = 0x0172;
  14797. t['Upsilon'] = 0x03A5;
  14798. t['Upsilon1'] = 0x03D2;
  14799. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  14800. t['Upsilonafrican'] = 0x01B1;
  14801. t['Upsilondieresis'] = 0x03AB;
  14802. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  14803. t['Upsilonhooksymbol'] = 0x03D2;
  14804. t['Upsilontonos'] = 0x038E;
  14805. t['Uring'] = 0x016E;
  14806. t['Ushortcyrillic'] = 0x040E;
  14807. t['Usmall'] = 0xF775;
  14808. t['Ustraightcyrillic'] = 0x04AE;
  14809. t['Ustraightstrokecyrillic'] = 0x04B0;
  14810. t['Utilde'] = 0x0168;
  14811. t['Utildeacute'] = 0x1E78;
  14812. t['Utildebelow'] = 0x1E74;
  14813. t['V'] = 0x0056;
  14814. t['Vcircle'] = 0x24CB;
  14815. t['Vdotbelow'] = 0x1E7E;
  14816. t['Vecyrillic'] = 0x0412;
  14817. t['Vewarmenian'] = 0x054E;
  14818. t['Vhook'] = 0x01B2;
  14819. t['Vmonospace'] = 0xFF36;
  14820. t['Voarmenian'] = 0x0548;
  14821. t['Vsmall'] = 0xF776;
  14822. t['Vtilde'] = 0x1E7C;
  14823. t['W'] = 0x0057;
  14824. t['Wacute'] = 0x1E82;
  14825. t['Wcircle'] = 0x24CC;
  14826. t['Wcircumflex'] = 0x0174;
  14827. t['Wdieresis'] = 0x1E84;
  14828. t['Wdotaccent'] = 0x1E86;
  14829. t['Wdotbelow'] = 0x1E88;
  14830. t['Wgrave'] = 0x1E80;
  14831. t['Wmonospace'] = 0xFF37;
  14832. t['Wsmall'] = 0xF777;
  14833. t['X'] = 0x0058;
  14834. t['Xcircle'] = 0x24CD;
  14835. t['Xdieresis'] = 0x1E8C;
  14836. t['Xdotaccent'] = 0x1E8A;
  14837. t['Xeharmenian'] = 0x053D;
  14838. t['Xi'] = 0x039E;
  14839. t['Xmonospace'] = 0xFF38;
  14840. t['Xsmall'] = 0xF778;
  14841. t['Y'] = 0x0059;
  14842. t['Yacute'] = 0x00DD;
  14843. t['Yacutesmall'] = 0xF7FD;
  14844. t['Yatcyrillic'] = 0x0462;
  14845. t['Ycircle'] = 0x24CE;
  14846. t['Ycircumflex'] = 0x0176;
  14847. t['Ydieresis'] = 0x0178;
  14848. t['Ydieresissmall'] = 0xF7FF;
  14849. t['Ydotaccent'] = 0x1E8E;
  14850. t['Ydotbelow'] = 0x1EF4;
  14851. t['Yericyrillic'] = 0x042B;
  14852. t['Yerudieresiscyrillic'] = 0x04F8;
  14853. t['Ygrave'] = 0x1EF2;
  14854. t['Yhook'] = 0x01B3;
  14855. t['Yhookabove'] = 0x1EF6;
  14856. t['Yiarmenian'] = 0x0545;
  14857. t['Yicyrillic'] = 0x0407;
  14858. t['Yiwnarmenian'] = 0x0552;
  14859. t['Ymonospace'] = 0xFF39;
  14860. t['Ysmall'] = 0xF779;
  14861. t['Ytilde'] = 0x1EF8;
  14862. t['Yusbigcyrillic'] = 0x046A;
  14863. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14864. t['Yuslittlecyrillic'] = 0x0466;
  14865. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14866. t['Z'] = 0x005A;
  14867. t['Zaarmenian'] = 0x0536;
  14868. t['Zacute'] = 0x0179;
  14869. t['Zcaron'] = 0x017D;
  14870. t['Zcaronsmall'] = 0xF6FF;
  14871. t['Zcircle'] = 0x24CF;
  14872. t['Zcircumflex'] = 0x1E90;
  14873. t['Zdot'] = 0x017B;
  14874. t['Zdotaccent'] = 0x017B;
  14875. t['Zdotbelow'] = 0x1E92;
  14876. t['Zecyrillic'] = 0x0417;
  14877. t['Zedescendercyrillic'] = 0x0498;
  14878. t['Zedieresiscyrillic'] = 0x04DE;
  14879. t['Zeta'] = 0x0396;
  14880. t['Zhearmenian'] = 0x053A;
  14881. t['Zhebrevecyrillic'] = 0x04C1;
  14882. t['Zhecyrillic'] = 0x0416;
  14883. t['Zhedescendercyrillic'] = 0x0496;
  14884. t['Zhedieresiscyrillic'] = 0x04DC;
  14885. t['Zlinebelow'] = 0x1E94;
  14886. t['Zmonospace'] = 0xFF3A;
  14887. t['Zsmall'] = 0xF77A;
  14888. t['Zstroke'] = 0x01B5;
  14889. t['a'] = 0x0061;
  14890. t['aabengali'] = 0x0986;
  14891. t['aacute'] = 0x00E1;
  14892. t['aadeva'] = 0x0906;
  14893. t['aagujarati'] = 0x0A86;
  14894. t['aagurmukhi'] = 0x0A06;
  14895. t['aamatragurmukhi'] = 0x0A3E;
  14896. t['aarusquare'] = 0x3303;
  14897. t['aavowelsignbengali'] = 0x09BE;
  14898. t['aavowelsigndeva'] = 0x093E;
  14899. t['aavowelsigngujarati'] = 0x0ABE;
  14900. t['abbreviationmarkarmenian'] = 0x055F;
  14901. t['abbreviationsigndeva'] = 0x0970;
  14902. t['abengali'] = 0x0985;
  14903. t['abopomofo'] = 0x311A;
  14904. t['abreve'] = 0x0103;
  14905. t['abreveacute'] = 0x1EAF;
  14906. t['abrevecyrillic'] = 0x04D1;
  14907. t['abrevedotbelow'] = 0x1EB7;
  14908. t['abrevegrave'] = 0x1EB1;
  14909. t['abrevehookabove'] = 0x1EB3;
  14910. t['abrevetilde'] = 0x1EB5;
  14911. t['acaron'] = 0x01CE;
  14912. t['acircle'] = 0x24D0;
  14913. t['acircumflex'] = 0x00E2;
  14914. t['acircumflexacute'] = 0x1EA5;
  14915. t['acircumflexdotbelow'] = 0x1EAD;
  14916. t['acircumflexgrave'] = 0x1EA7;
  14917. t['acircumflexhookabove'] = 0x1EA9;
  14918. t['acircumflextilde'] = 0x1EAB;
  14919. t['acute'] = 0x00B4;
  14920. t['acutebelowcmb'] = 0x0317;
  14921. t['acutecmb'] = 0x0301;
  14922. t['acutecomb'] = 0x0301;
  14923. t['acutedeva'] = 0x0954;
  14924. t['acutelowmod'] = 0x02CF;
  14925. t['acutetonecmb'] = 0x0341;
  14926. t['acyrillic'] = 0x0430;
  14927. t['adblgrave'] = 0x0201;
  14928. t['addakgurmukhi'] = 0x0A71;
  14929. t['adeva'] = 0x0905;
  14930. t['adieresis'] = 0x00E4;
  14931. t['adieresiscyrillic'] = 0x04D3;
  14932. t['adieresismacron'] = 0x01DF;
  14933. t['adotbelow'] = 0x1EA1;
  14934. t['adotmacron'] = 0x01E1;
  14935. t['ae'] = 0x00E6;
  14936. t['aeacute'] = 0x01FD;
  14937. t['aekorean'] = 0x3150;
  14938. t['aemacron'] = 0x01E3;
  14939. t['afii00208'] = 0x2015;
  14940. t['afii08941'] = 0x20A4;
  14941. t['afii10017'] = 0x0410;
  14942. t['afii10018'] = 0x0411;
  14943. t['afii10019'] = 0x0412;
  14944. t['afii10020'] = 0x0413;
  14945. t['afii10021'] = 0x0414;
  14946. t['afii10022'] = 0x0415;
  14947. t['afii10023'] = 0x0401;
  14948. t['afii10024'] = 0x0416;
  14949. t['afii10025'] = 0x0417;
  14950. t['afii10026'] = 0x0418;
  14951. t['afii10027'] = 0x0419;
  14952. t['afii10028'] = 0x041A;
  14953. t['afii10029'] = 0x041B;
  14954. t['afii10030'] = 0x041C;
  14955. t['afii10031'] = 0x041D;
  14956. t['afii10032'] = 0x041E;
  14957. t['afii10033'] = 0x041F;
  14958. t['afii10034'] = 0x0420;
  14959. t['afii10035'] = 0x0421;
  14960. t['afii10036'] = 0x0422;
  14961. t['afii10037'] = 0x0423;
  14962. t['afii10038'] = 0x0424;
  14963. t['afii10039'] = 0x0425;
  14964. t['afii10040'] = 0x0426;
  14965. t['afii10041'] = 0x0427;
  14966. t['afii10042'] = 0x0428;
  14967. t['afii10043'] = 0x0429;
  14968. t['afii10044'] = 0x042A;
  14969. t['afii10045'] = 0x042B;
  14970. t['afii10046'] = 0x042C;
  14971. t['afii10047'] = 0x042D;
  14972. t['afii10048'] = 0x042E;
  14973. t['afii10049'] = 0x042F;
  14974. t['afii10050'] = 0x0490;
  14975. t['afii10051'] = 0x0402;
  14976. t['afii10052'] = 0x0403;
  14977. t['afii10053'] = 0x0404;
  14978. t['afii10054'] = 0x0405;
  14979. t['afii10055'] = 0x0406;
  14980. t['afii10056'] = 0x0407;
  14981. t['afii10057'] = 0x0408;
  14982. t['afii10058'] = 0x0409;
  14983. t['afii10059'] = 0x040A;
  14984. t['afii10060'] = 0x040B;
  14985. t['afii10061'] = 0x040C;
  14986. t['afii10062'] = 0x040E;
  14987. t['afii10063'] = 0xF6C4;
  14988. t['afii10064'] = 0xF6C5;
  14989. t['afii10065'] = 0x0430;
  14990. t['afii10066'] = 0x0431;
  14991. t['afii10067'] = 0x0432;
  14992. t['afii10068'] = 0x0433;
  14993. t['afii10069'] = 0x0434;
  14994. t['afii10070'] = 0x0435;
  14995. t['afii10071'] = 0x0451;
  14996. t['afii10072'] = 0x0436;
  14997. t['afii10073'] = 0x0437;
  14998. t['afii10074'] = 0x0438;
  14999. t['afii10075'] = 0x0439;
  15000. t['afii10076'] = 0x043A;
  15001. t['afii10077'] = 0x043B;
  15002. t['afii10078'] = 0x043C;
  15003. t['afii10079'] = 0x043D;
  15004. t['afii10080'] = 0x043E;
  15005. t['afii10081'] = 0x043F;
  15006. t['afii10082'] = 0x0440;
  15007. t['afii10083'] = 0x0441;
  15008. t['afii10084'] = 0x0442;
  15009. t['afii10085'] = 0x0443;
  15010. t['afii10086'] = 0x0444;
  15011. t['afii10087'] = 0x0445;
  15012. t['afii10088'] = 0x0446;
  15013. t['afii10089'] = 0x0447;
  15014. t['afii10090'] = 0x0448;
  15015. t['afii10091'] = 0x0449;
  15016. t['afii10092'] = 0x044A;
  15017. t['afii10093'] = 0x044B;
  15018. t['afii10094'] = 0x044C;
  15019. t['afii10095'] = 0x044D;
  15020. t['afii10096'] = 0x044E;
  15021. t['afii10097'] = 0x044F;
  15022. t['afii10098'] = 0x0491;
  15023. t['afii10099'] = 0x0452;
  15024. t['afii10100'] = 0x0453;
  15025. t['afii10101'] = 0x0454;
  15026. t['afii10102'] = 0x0455;
  15027. t['afii10103'] = 0x0456;
  15028. t['afii10104'] = 0x0457;
  15029. t['afii10105'] = 0x0458;
  15030. t['afii10106'] = 0x0459;
  15031. t['afii10107'] = 0x045A;
  15032. t['afii10108'] = 0x045B;
  15033. t['afii10109'] = 0x045C;
  15034. t['afii10110'] = 0x045E;
  15035. t['afii10145'] = 0x040F;
  15036. t['afii10146'] = 0x0462;
  15037. t['afii10147'] = 0x0472;
  15038. t['afii10148'] = 0x0474;
  15039. t['afii10192'] = 0xF6C6;
  15040. t['afii10193'] = 0x045F;
  15041. t['afii10194'] = 0x0463;
  15042. t['afii10195'] = 0x0473;
  15043. t['afii10196'] = 0x0475;
  15044. t['afii10831'] = 0xF6C7;
  15045. t['afii10832'] = 0xF6C8;
  15046. t['afii10846'] = 0x04D9;
  15047. t['afii299'] = 0x200E;
  15048. t['afii300'] = 0x200F;
  15049. t['afii301'] = 0x200D;
  15050. t['afii57381'] = 0x066A;
  15051. t['afii57388'] = 0x060C;
  15052. t['afii57392'] = 0x0660;
  15053. t['afii57393'] = 0x0661;
  15054. t['afii57394'] = 0x0662;
  15055. t['afii57395'] = 0x0663;
  15056. t['afii57396'] = 0x0664;
  15057. t['afii57397'] = 0x0665;
  15058. t['afii57398'] = 0x0666;
  15059. t['afii57399'] = 0x0667;
  15060. t['afii57400'] = 0x0668;
  15061. t['afii57401'] = 0x0669;
  15062. t['afii57403'] = 0x061B;
  15063. t['afii57407'] = 0x061F;
  15064. t['afii57409'] = 0x0621;
  15065. t['afii57410'] = 0x0622;
  15066. t['afii57411'] = 0x0623;
  15067. t['afii57412'] = 0x0624;
  15068. t['afii57413'] = 0x0625;
  15069. t['afii57414'] = 0x0626;
  15070. t['afii57415'] = 0x0627;
  15071. t['afii57416'] = 0x0628;
  15072. t['afii57417'] = 0x0629;
  15073. t['afii57418'] = 0x062A;
  15074. t['afii57419'] = 0x062B;
  15075. t['afii57420'] = 0x062C;
  15076. t['afii57421'] = 0x062D;
  15077. t['afii57422'] = 0x062E;
  15078. t['afii57423'] = 0x062F;
  15079. t['afii57424'] = 0x0630;
  15080. t['afii57425'] = 0x0631;
  15081. t['afii57426'] = 0x0632;
  15082. t['afii57427'] = 0x0633;
  15083. t['afii57428'] = 0x0634;
  15084. t['afii57429'] = 0x0635;
  15085. t['afii57430'] = 0x0636;
  15086. t['afii57431'] = 0x0637;
  15087. t['afii57432'] = 0x0638;
  15088. t['afii57433'] = 0x0639;
  15089. t['afii57434'] = 0x063A;
  15090. t['afii57440'] = 0x0640;
  15091. t['afii57441'] = 0x0641;
  15092. t['afii57442'] = 0x0642;
  15093. t['afii57443'] = 0x0643;
  15094. t['afii57444'] = 0x0644;
  15095. t['afii57445'] = 0x0645;
  15096. t['afii57446'] = 0x0646;
  15097. t['afii57448'] = 0x0648;
  15098. t['afii57449'] = 0x0649;
  15099. t['afii57450'] = 0x064A;
  15100. t['afii57451'] = 0x064B;
  15101. t['afii57452'] = 0x064C;
  15102. t['afii57453'] = 0x064D;
  15103. t['afii57454'] = 0x064E;
  15104. t['afii57455'] = 0x064F;
  15105. t['afii57456'] = 0x0650;
  15106. t['afii57457'] = 0x0651;
  15107. t['afii57458'] = 0x0652;
  15108. t['afii57470'] = 0x0647;
  15109. t['afii57505'] = 0x06A4;
  15110. t['afii57506'] = 0x067E;
  15111. t['afii57507'] = 0x0686;
  15112. t['afii57508'] = 0x0698;
  15113. t['afii57509'] = 0x06AF;
  15114. t['afii57511'] = 0x0679;
  15115. t['afii57512'] = 0x0688;
  15116. t['afii57513'] = 0x0691;
  15117. t['afii57514'] = 0x06BA;
  15118. t['afii57519'] = 0x06D2;
  15119. t['afii57534'] = 0x06D5;
  15120. t['afii57636'] = 0x20AA;
  15121. t['afii57645'] = 0x05BE;
  15122. t['afii57658'] = 0x05C3;
  15123. t['afii57664'] = 0x05D0;
  15124. t['afii57665'] = 0x05D1;
  15125. t['afii57666'] = 0x05D2;
  15126. t['afii57667'] = 0x05D3;
  15127. t['afii57668'] = 0x05D4;
  15128. t['afii57669'] = 0x05D5;
  15129. t['afii57670'] = 0x05D6;
  15130. t['afii57671'] = 0x05D7;
  15131. t['afii57672'] = 0x05D8;
  15132. t['afii57673'] = 0x05D9;
  15133. t['afii57674'] = 0x05DA;
  15134. t['afii57675'] = 0x05DB;
  15135. t['afii57676'] = 0x05DC;
  15136. t['afii57677'] = 0x05DD;
  15137. t['afii57678'] = 0x05DE;
  15138. t['afii57679'] = 0x05DF;
  15139. t['afii57680'] = 0x05E0;
  15140. t['afii57681'] = 0x05E1;
  15141. t['afii57682'] = 0x05E2;
  15142. t['afii57683'] = 0x05E3;
  15143. t['afii57684'] = 0x05E4;
  15144. t['afii57685'] = 0x05E5;
  15145. t['afii57686'] = 0x05E6;
  15146. t['afii57687'] = 0x05E7;
  15147. t['afii57688'] = 0x05E8;
  15148. t['afii57689'] = 0x05E9;
  15149. t['afii57690'] = 0x05EA;
  15150. t['afii57694'] = 0xFB2A;
  15151. t['afii57695'] = 0xFB2B;
  15152. t['afii57700'] = 0xFB4B;
  15153. t['afii57705'] = 0xFB1F;
  15154. t['afii57716'] = 0x05F0;
  15155. t['afii57717'] = 0x05F1;
  15156. t['afii57718'] = 0x05F2;
  15157. t['afii57723'] = 0xFB35;
  15158. t['afii57793'] = 0x05B4;
  15159. t['afii57794'] = 0x05B5;
  15160. t['afii57795'] = 0x05B6;
  15161. t['afii57796'] = 0x05BB;
  15162. t['afii57797'] = 0x05B8;
  15163. t['afii57798'] = 0x05B7;
  15164. t['afii57799'] = 0x05B0;
  15165. t['afii57800'] = 0x05B2;
  15166. t['afii57801'] = 0x05B1;
  15167. t['afii57802'] = 0x05B3;
  15168. t['afii57803'] = 0x05C2;
  15169. t['afii57804'] = 0x05C1;
  15170. t['afii57806'] = 0x05B9;
  15171. t['afii57807'] = 0x05BC;
  15172. t['afii57839'] = 0x05BD;
  15173. t['afii57841'] = 0x05BF;
  15174. t['afii57842'] = 0x05C0;
  15175. t['afii57929'] = 0x02BC;
  15176. t['afii61248'] = 0x2105;
  15177. t['afii61289'] = 0x2113;
  15178. t['afii61352'] = 0x2116;
  15179. t['afii61573'] = 0x202C;
  15180. t['afii61574'] = 0x202D;
  15181. t['afii61575'] = 0x202E;
  15182. t['afii61664'] = 0x200C;
  15183. t['afii63167'] = 0x066D;
  15184. t['afii64937'] = 0x02BD;
  15185. t['agrave'] = 0x00E0;
  15186. t['agujarati'] = 0x0A85;
  15187. t['agurmukhi'] = 0x0A05;
  15188. t['ahiragana'] = 0x3042;
  15189. t['ahookabove'] = 0x1EA3;
  15190. t['aibengali'] = 0x0990;
  15191. t['aibopomofo'] = 0x311E;
  15192. t['aideva'] = 0x0910;
  15193. t['aiecyrillic'] = 0x04D5;
  15194. t['aigujarati'] = 0x0A90;
  15195. t['aigurmukhi'] = 0x0A10;
  15196. t['aimatragurmukhi'] = 0x0A48;
  15197. t['ainarabic'] = 0x0639;
  15198. t['ainfinalarabic'] = 0xFECA;
  15199. t['aininitialarabic'] = 0xFECB;
  15200. t['ainmedialarabic'] = 0xFECC;
  15201. t['ainvertedbreve'] = 0x0203;
  15202. t['aivowelsignbengali'] = 0x09C8;
  15203. t['aivowelsigndeva'] = 0x0948;
  15204. t['aivowelsigngujarati'] = 0x0AC8;
  15205. t['akatakana'] = 0x30A2;
  15206. t['akatakanahalfwidth'] = 0xFF71;
  15207. t['akorean'] = 0x314F;
  15208. t['alef'] = 0x05D0;
  15209. t['alefarabic'] = 0x0627;
  15210. t['alefdageshhebrew'] = 0xFB30;
  15211. t['aleffinalarabic'] = 0xFE8E;
  15212. t['alefhamzaabovearabic'] = 0x0623;
  15213. t['alefhamzaabovefinalarabic'] = 0xFE84;
  15214. t['alefhamzabelowarabic'] = 0x0625;
  15215. t['alefhamzabelowfinalarabic'] = 0xFE88;
  15216. t['alefhebrew'] = 0x05D0;
  15217. t['aleflamedhebrew'] = 0xFB4F;
  15218. t['alefmaddaabovearabic'] = 0x0622;
  15219. t['alefmaddaabovefinalarabic'] = 0xFE82;
  15220. t['alefmaksuraarabic'] = 0x0649;
  15221. t['alefmaksurafinalarabic'] = 0xFEF0;
  15222. t['alefmaksurainitialarabic'] = 0xFEF3;
  15223. t['alefmaksuramedialarabic'] = 0xFEF4;
  15224. t['alefpatahhebrew'] = 0xFB2E;
  15225. t['alefqamatshebrew'] = 0xFB2F;
  15226. t['aleph'] = 0x2135;
  15227. t['allequal'] = 0x224C;
  15228. t['alpha'] = 0x03B1;
  15229. t['alphatonos'] = 0x03AC;
  15230. t['amacron'] = 0x0101;
  15231. t['amonospace'] = 0xFF41;
  15232. t['ampersand'] = 0x0026;
  15233. t['ampersandmonospace'] = 0xFF06;
  15234. t['ampersandsmall'] = 0xF726;
  15235. t['amsquare'] = 0x33C2;
  15236. t['anbopomofo'] = 0x3122;
  15237. t['angbopomofo'] = 0x3124;
  15238. t['angbracketleft'] = 0x3008;
  15239. t['angbracketright'] = 0x3009;
  15240. t['angkhankhuthai'] = 0x0E5A;
  15241. t['angle'] = 0x2220;
  15242. t['anglebracketleft'] = 0x3008;
  15243. t['anglebracketleftvertical'] = 0xFE3F;
  15244. t['anglebracketright'] = 0x3009;
  15245. t['anglebracketrightvertical'] = 0xFE40;
  15246. t['angleleft'] = 0x2329;
  15247. t['angleright'] = 0x232A;
  15248. t['angstrom'] = 0x212B;
  15249. t['anoteleia'] = 0x0387;
  15250. t['anudattadeva'] = 0x0952;
  15251. t['anusvarabengali'] = 0x0982;
  15252. t['anusvaradeva'] = 0x0902;
  15253. t['anusvaragujarati'] = 0x0A82;
  15254. t['aogonek'] = 0x0105;
  15255. t['apaatosquare'] = 0x3300;
  15256. t['aparen'] = 0x249C;
  15257. t['apostrophearmenian'] = 0x055A;
  15258. t['apostrophemod'] = 0x02BC;
  15259. t['apple'] = 0xF8FF;
  15260. t['approaches'] = 0x2250;
  15261. t['approxequal'] = 0x2248;
  15262. t['approxequalorimage'] = 0x2252;
  15263. t['approximatelyequal'] = 0x2245;
  15264. t['araeaekorean'] = 0x318E;
  15265. t['araeakorean'] = 0x318D;
  15266. t['arc'] = 0x2312;
  15267. t['arighthalfring'] = 0x1E9A;
  15268. t['aring'] = 0x00E5;
  15269. t['aringacute'] = 0x01FB;
  15270. t['aringbelow'] = 0x1E01;
  15271. t['arrowboth'] = 0x2194;
  15272. t['arrowdashdown'] = 0x21E3;
  15273. t['arrowdashleft'] = 0x21E0;
  15274. t['arrowdashright'] = 0x21E2;
  15275. t['arrowdashup'] = 0x21E1;
  15276. t['arrowdblboth'] = 0x21D4;
  15277. t['arrowdbldown'] = 0x21D3;
  15278. t['arrowdblleft'] = 0x21D0;
  15279. t['arrowdblright'] = 0x21D2;
  15280. t['arrowdblup'] = 0x21D1;
  15281. t['arrowdown'] = 0x2193;
  15282. t['arrowdownleft'] = 0x2199;
  15283. t['arrowdownright'] = 0x2198;
  15284. t['arrowdownwhite'] = 0x21E9;
  15285. t['arrowheaddownmod'] = 0x02C5;
  15286. t['arrowheadleftmod'] = 0x02C2;
  15287. t['arrowheadrightmod'] = 0x02C3;
  15288. t['arrowheadupmod'] = 0x02C4;
  15289. t['arrowhorizex'] = 0xF8E7;
  15290. t['arrowleft'] = 0x2190;
  15291. t['arrowleftdbl'] = 0x21D0;
  15292. t['arrowleftdblstroke'] = 0x21CD;
  15293. t['arrowleftoverright'] = 0x21C6;
  15294. t['arrowleftwhite'] = 0x21E6;
  15295. t['arrowright'] = 0x2192;
  15296. t['arrowrightdblstroke'] = 0x21CF;
  15297. t['arrowrightheavy'] = 0x279E;
  15298. t['arrowrightoverleft'] = 0x21C4;
  15299. t['arrowrightwhite'] = 0x21E8;
  15300. t['arrowtableft'] = 0x21E4;
  15301. t['arrowtabright'] = 0x21E5;
  15302. t['arrowup'] = 0x2191;
  15303. t['arrowupdn'] = 0x2195;
  15304. t['arrowupdnbse'] = 0x21A8;
  15305. t['arrowupdownbase'] = 0x21A8;
  15306. t['arrowupleft'] = 0x2196;
  15307. t['arrowupleftofdown'] = 0x21C5;
  15308. t['arrowupright'] = 0x2197;
  15309. t['arrowupwhite'] = 0x21E7;
  15310. t['arrowvertex'] = 0xF8E6;
  15311. t['asciicircum'] = 0x005E;
  15312. t['asciicircummonospace'] = 0xFF3E;
  15313. t['asciitilde'] = 0x007E;
  15314. t['asciitildemonospace'] = 0xFF5E;
  15315. t['ascript'] = 0x0251;
  15316. t['ascriptturned'] = 0x0252;
  15317. t['asmallhiragana'] = 0x3041;
  15318. t['asmallkatakana'] = 0x30A1;
  15319. t['asmallkatakanahalfwidth'] = 0xFF67;
  15320. t['asterisk'] = 0x002A;
  15321. t['asteriskaltonearabic'] = 0x066D;
  15322. t['asteriskarabic'] = 0x066D;
  15323. t['asteriskmath'] = 0x2217;
  15324. t['asteriskmonospace'] = 0xFF0A;
  15325. t['asterisksmall'] = 0xFE61;
  15326. t['asterism'] = 0x2042;
  15327. t['asuperior'] = 0xF6E9;
  15328. t['asymptoticallyequal'] = 0x2243;
  15329. t['at'] = 0x0040;
  15330. t['atilde'] = 0x00E3;
  15331. t['atmonospace'] = 0xFF20;
  15332. t['atsmall'] = 0xFE6B;
  15333. t['aturned'] = 0x0250;
  15334. t['aubengali'] = 0x0994;
  15335. t['aubopomofo'] = 0x3120;
  15336. t['audeva'] = 0x0914;
  15337. t['augujarati'] = 0x0A94;
  15338. t['augurmukhi'] = 0x0A14;
  15339. t['aulengthmarkbengali'] = 0x09D7;
  15340. t['aumatragurmukhi'] = 0x0A4C;
  15341. t['auvowelsignbengali'] = 0x09CC;
  15342. t['auvowelsigndeva'] = 0x094C;
  15343. t['auvowelsigngujarati'] = 0x0ACC;
  15344. t['avagrahadeva'] = 0x093D;
  15345. t['aybarmenian'] = 0x0561;
  15346. t['ayin'] = 0x05E2;
  15347. t['ayinaltonehebrew'] = 0xFB20;
  15348. t['ayinhebrew'] = 0x05E2;
  15349. t['b'] = 0x0062;
  15350. t['babengali'] = 0x09AC;
  15351. t['backslash'] = 0x005C;
  15352. t['backslashmonospace'] = 0xFF3C;
  15353. t['badeva'] = 0x092C;
  15354. t['bagujarati'] = 0x0AAC;
  15355. t['bagurmukhi'] = 0x0A2C;
  15356. t['bahiragana'] = 0x3070;
  15357. t['bahtthai'] = 0x0E3F;
  15358. t['bakatakana'] = 0x30D0;
  15359. t['bar'] = 0x007C;
  15360. t['barmonospace'] = 0xFF5C;
  15361. t['bbopomofo'] = 0x3105;
  15362. t['bcircle'] = 0x24D1;
  15363. t['bdotaccent'] = 0x1E03;
  15364. t['bdotbelow'] = 0x1E05;
  15365. t['beamedsixteenthnotes'] = 0x266C;
  15366. t['because'] = 0x2235;
  15367. t['becyrillic'] = 0x0431;
  15368. t['beharabic'] = 0x0628;
  15369. t['behfinalarabic'] = 0xFE90;
  15370. t['behinitialarabic'] = 0xFE91;
  15371. t['behiragana'] = 0x3079;
  15372. t['behmedialarabic'] = 0xFE92;
  15373. t['behmeeminitialarabic'] = 0xFC9F;
  15374. t['behmeemisolatedarabic'] = 0xFC08;
  15375. t['behnoonfinalarabic'] = 0xFC6D;
  15376. t['bekatakana'] = 0x30D9;
  15377. t['benarmenian'] = 0x0562;
  15378. t['bet'] = 0x05D1;
  15379. t['beta'] = 0x03B2;
  15380. t['betasymbolgreek'] = 0x03D0;
  15381. t['betdagesh'] = 0xFB31;
  15382. t['betdageshhebrew'] = 0xFB31;
  15383. t['bethebrew'] = 0x05D1;
  15384. t['betrafehebrew'] = 0xFB4C;
  15385. t['bhabengali'] = 0x09AD;
  15386. t['bhadeva'] = 0x092D;
  15387. t['bhagujarati'] = 0x0AAD;
  15388. t['bhagurmukhi'] = 0x0A2D;
  15389. t['bhook'] = 0x0253;
  15390. t['bihiragana'] = 0x3073;
  15391. t['bikatakana'] = 0x30D3;
  15392. t['bilabialclick'] = 0x0298;
  15393. t['bindigurmukhi'] = 0x0A02;
  15394. t['birusquare'] = 0x3331;
  15395. t['blackcircle'] = 0x25CF;
  15396. t['blackdiamond'] = 0x25C6;
  15397. t['blackdownpointingtriangle'] = 0x25BC;
  15398. t['blackleftpointingpointer'] = 0x25C4;
  15399. t['blackleftpointingtriangle'] = 0x25C0;
  15400. t['blacklenticularbracketleft'] = 0x3010;
  15401. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  15402. t['blacklenticularbracketright'] = 0x3011;
  15403. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  15404. t['blacklowerlefttriangle'] = 0x25E3;
  15405. t['blacklowerrighttriangle'] = 0x25E2;
  15406. t['blackrectangle'] = 0x25AC;
  15407. t['blackrightpointingpointer'] = 0x25BA;
  15408. t['blackrightpointingtriangle'] = 0x25B6;
  15409. t['blacksmallsquare'] = 0x25AA;
  15410. t['blacksmilingface'] = 0x263B;
  15411. t['blacksquare'] = 0x25A0;
  15412. t['blackstar'] = 0x2605;
  15413. t['blackupperlefttriangle'] = 0x25E4;
  15414. t['blackupperrighttriangle'] = 0x25E5;
  15415. t['blackuppointingsmalltriangle'] = 0x25B4;
  15416. t['blackuppointingtriangle'] = 0x25B2;
  15417. t['blank'] = 0x2423;
  15418. t['blinebelow'] = 0x1E07;
  15419. t['block'] = 0x2588;
  15420. t['bmonospace'] = 0xFF42;
  15421. t['bobaimaithai'] = 0x0E1A;
  15422. t['bohiragana'] = 0x307C;
  15423. t['bokatakana'] = 0x30DC;
  15424. t['bparen'] = 0x249D;
  15425. t['bqsquare'] = 0x33C3;
  15426. t['braceex'] = 0xF8F4;
  15427. t['braceleft'] = 0x007B;
  15428. t['braceleftbt'] = 0xF8F3;
  15429. t['braceleftmid'] = 0xF8F2;
  15430. t['braceleftmonospace'] = 0xFF5B;
  15431. t['braceleftsmall'] = 0xFE5B;
  15432. t['bracelefttp'] = 0xF8F1;
  15433. t['braceleftvertical'] = 0xFE37;
  15434. t['braceright'] = 0x007D;
  15435. t['bracerightbt'] = 0xF8FE;
  15436. t['bracerightmid'] = 0xF8FD;
  15437. t['bracerightmonospace'] = 0xFF5D;
  15438. t['bracerightsmall'] = 0xFE5C;
  15439. t['bracerighttp'] = 0xF8FC;
  15440. t['bracerightvertical'] = 0xFE38;
  15441. t['bracketleft'] = 0x005B;
  15442. t['bracketleftbt'] = 0xF8F0;
  15443. t['bracketleftex'] = 0xF8EF;
  15444. t['bracketleftmonospace'] = 0xFF3B;
  15445. t['bracketlefttp'] = 0xF8EE;
  15446. t['bracketright'] = 0x005D;
  15447. t['bracketrightbt'] = 0xF8FB;
  15448. t['bracketrightex'] = 0xF8FA;
  15449. t['bracketrightmonospace'] = 0xFF3D;
  15450. t['bracketrighttp'] = 0xF8F9;
  15451. t['breve'] = 0x02D8;
  15452. t['brevebelowcmb'] = 0x032E;
  15453. t['brevecmb'] = 0x0306;
  15454. t['breveinvertedbelowcmb'] = 0x032F;
  15455. t['breveinvertedcmb'] = 0x0311;
  15456. t['breveinverteddoublecmb'] = 0x0361;
  15457. t['bridgebelowcmb'] = 0x032A;
  15458. t['bridgeinvertedbelowcmb'] = 0x033A;
  15459. t['brokenbar'] = 0x00A6;
  15460. t['bstroke'] = 0x0180;
  15461. t['bsuperior'] = 0xF6EA;
  15462. t['btopbar'] = 0x0183;
  15463. t['buhiragana'] = 0x3076;
  15464. t['bukatakana'] = 0x30D6;
  15465. t['bullet'] = 0x2022;
  15466. t['bulletinverse'] = 0x25D8;
  15467. t['bulletoperator'] = 0x2219;
  15468. t['bullseye'] = 0x25CE;
  15469. t['c'] = 0x0063;
  15470. t['caarmenian'] = 0x056E;
  15471. t['cabengali'] = 0x099A;
  15472. t['cacute'] = 0x0107;
  15473. t['cadeva'] = 0x091A;
  15474. t['cagujarati'] = 0x0A9A;
  15475. t['cagurmukhi'] = 0x0A1A;
  15476. t['calsquare'] = 0x3388;
  15477. t['candrabindubengali'] = 0x0981;
  15478. t['candrabinducmb'] = 0x0310;
  15479. t['candrabindudeva'] = 0x0901;
  15480. t['candrabindugujarati'] = 0x0A81;
  15481. t['capslock'] = 0x21EA;
  15482. t['careof'] = 0x2105;
  15483. t['caron'] = 0x02C7;
  15484. t['caronbelowcmb'] = 0x032C;
  15485. t['caroncmb'] = 0x030C;
  15486. t['carriagereturn'] = 0x21B5;
  15487. t['cbopomofo'] = 0x3118;
  15488. t['ccaron'] = 0x010D;
  15489. t['ccedilla'] = 0x00E7;
  15490. t['ccedillaacute'] = 0x1E09;
  15491. t['ccircle'] = 0x24D2;
  15492. t['ccircumflex'] = 0x0109;
  15493. t['ccurl'] = 0x0255;
  15494. t['cdot'] = 0x010B;
  15495. t['cdotaccent'] = 0x010B;
  15496. t['cdsquare'] = 0x33C5;
  15497. t['cedilla'] = 0x00B8;
  15498. t['cedillacmb'] = 0x0327;
  15499. t['cent'] = 0x00A2;
  15500. t['centigrade'] = 0x2103;
  15501. t['centinferior'] = 0xF6DF;
  15502. t['centmonospace'] = 0xFFE0;
  15503. t['centoldstyle'] = 0xF7A2;
  15504. t['centsuperior'] = 0xF6E0;
  15505. t['chaarmenian'] = 0x0579;
  15506. t['chabengali'] = 0x099B;
  15507. t['chadeva'] = 0x091B;
  15508. t['chagujarati'] = 0x0A9B;
  15509. t['chagurmukhi'] = 0x0A1B;
  15510. t['chbopomofo'] = 0x3114;
  15511. t['cheabkhasiancyrillic'] = 0x04BD;
  15512. t['checkmark'] = 0x2713;
  15513. t['checyrillic'] = 0x0447;
  15514. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  15515. t['chedescendercyrillic'] = 0x04B7;
  15516. t['chedieresiscyrillic'] = 0x04F5;
  15517. t['cheharmenian'] = 0x0573;
  15518. t['chekhakassiancyrillic'] = 0x04CC;
  15519. t['cheverticalstrokecyrillic'] = 0x04B9;
  15520. t['chi'] = 0x03C7;
  15521. t['chieuchacirclekorean'] = 0x3277;
  15522. t['chieuchaparenkorean'] = 0x3217;
  15523. t['chieuchcirclekorean'] = 0x3269;
  15524. t['chieuchkorean'] = 0x314A;
  15525. t['chieuchparenkorean'] = 0x3209;
  15526. t['chochangthai'] = 0x0E0A;
  15527. t['chochanthai'] = 0x0E08;
  15528. t['chochingthai'] = 0x0E09;
  15529. t['chochoethai'] = 0x0E0C;
  15530. t['chook'] = 0x0188;
  15531. t['cieucacirclekorean'] = 0x3276;
  15532. t['cieucaparenkorean'] = 0x3216;
  15533. t['cieuccirclekorean'] = 0x3268;
  15534. t['cieuckorean'] = 0x3148;
  15535. t['cieucparenkorean'] = 0x3208;
  15536. t['cieucuparenkorean'] = 0x321C;
  15537. t['circle'] = 0x25CB;
  15538. t['circlecopyrt'] = 0x00A9;
  15539. t['circlemultiply'] = 0x2297;
  15540. t['circleot'] = 0x2299;
  15541. t['circleplus'] = 0x2295;
  15542. t['circlepostalmark'] = 0x3036;
  15543. t['circlewithlefthalfblack'] = 0x25D0;
  15544. t['circlewithrighthalfblack'] = 0x25D1;
  15545. t['circumflex'] = 0x02C6;
  15546. t['circumflexbelowcmb'] = 0x032D;
  15547. t['circumflexcmb'] = 0x0302;
  15548. t['clear'] = 0x2327;
  15549. t['clickalveolar'] = 0x01C2;
  15550. t['clickdental'] = 0x01C0;
  15551. t['clicklateral'] = 0x01C1;
  15552. t['clickretroflex'] = 0x01C3;
  15553. t['club'] = 0x2663;
  15554. t['clubsuitblack'] = 0x2663;
  15555. t['clubsuitwhite'] = 0x2667;
  15556. t['cmcubedsquare'] = 0x33A4;
  15557. t['cmonospace'] = 0xFF43;
  15558. t['cmsquaredsquare'] = 0x33A0;
  15559. t['coarmenian'] = 0x0581;
  15560. t['colon'] = 0x003A;
  15561. t['colonmonetary'] = 0x20A1;
  15562. t['colonmonospace'] = 0xFF1A;
  15563. t['colonsign'] = 0x20A1;
  15564. t['colonsmall'] = 0xFE55;
  15565. t['colontriangularhalfmod'] = 0x02D1;
  15566. t['colontriangularmod'] = 0x02D0;
  15567. t['comma'] = 0x002C;
  15568. t['commaabovecmb'] = 0x0313;
  15569. t['commaaboverightcmb'] = 0x0315;
  15570. t['commaaccent'] = 0xF6C3;
  15571. t['commaarabic'] = 0x060C;
  15572. t['commaarmenian'] = 0x055D;
  15573. t['commainferior'] = 0xF6E1;
  15574. t['commamonospace'] = 0xFF0C;
  15575. t['commareversedabovecmb'] = 0x0314;
  15576. t['commareversedmod'] = 0x02BD;
  15577. t['commasmall'] = 0xFE50;
  15578. t['commasuperior'] = 0xF6E2;
  15579. t['commaturnedabovecmb'] = 0x0312;
  15580. t['commaturnedmod'] = 0x02BB;
  15581. t['compass'] = 0x263C;
  15582. t['congruent'] = 0x2245;
  15583. t['contourintegral'] = 0x222E;
  15584. t['control'] = 0x2303;
  15585. t['controlACK'] = 0x0006;
  15586. t['controlBEL'] = 0x0007;
  15587. t['controlBS'] = 0x0008;
  15588. t['controlCAN'] = 0x0018;
  15589. t['controlCR'] = 0x000D;
  15590. t['controlDC1'] = 0x0011;
  15591. t['controlDC2'] = 0x0012;
  15592. t['controlDC3'] = 0x0013;
  15593. t['controlDC4'] = 0x0014;
  15594. t['controlDEL'] = 0x007F;
  15595. t['controlDLE'] = 0x0010;
  15596. t['controlEM'] = 0x0019;
  15597. t['controlENQ'] = 0x0005;
  15598. t['controlEOT'] = 0x0004;
  15599. t['controlESC'] = 0x001B;
  15600. t['controlETB'] = 0x0017;
  15601. t['controlETX'] = 0x0003;
  15602. t['controlFF'] = 0x000C;
  15603. t['controlFS'] = 0x001C;
  15604. t['controlGS'] = 0x001D;
  15605. t['controlHT'] = 0x0009;
  15606. t['controlLF'] = 0x000A;
  15607. t['controlNAK'] = 0x0015;
  15608. t['controlNULL'] = 0x0000;
  15609. t['controlRS'] = 0x001E;
  15610. t['controlSI'] = 0x000F;
  15611. t['controlSO'] = 0x000E;
  15612. t['controlSOT'] = 0x0002;
  15613. t['controlSTX'] = 0x0001;
  15614. t['controlSUB'] = 0x001A;
  15615. t['controlSYN'] = 0x0016;
  15616. t['controlUS'] = 0x001F;
  15617. t['controlVT'] = 0x000B;
  15618. t['copyright'] = 0x00A9;
  15619. t['copyrightsans'] = 0xF8E9;
  15620. t['copyrightserif'] = 0xF6D9;
  15621. t['cornerbracketleft'] = 0x300C;
  15622. t['cornerbracketlefthalfwidth'] = 0xFF62;
  15623. t['cornerbracketleftvertical'] = 0xFE41;
  15624. t['cornerbracketright'] = 0x300D;
  15625. t['cornerbracketrighthalfwidth'] = 0xFF63;
  15626. t['cornerbracketrightvertical'] = 0xFE42;
  15627. t['corporationsquare'] = 0x337F;
  15628. t['cosquare'] = 0x33C7;
  15629. t['coverkgsquare'] = 0x33C6;
  15630. t['cparen'] = 0x249E;
  15631. t['cruzeiro'] = 0x20A2;
  15632. t['cstretched'] = 0x0297;
  15633. t['curlyand'] = 0x22CF;
  15634. t['curlyor'] = 0x22CE;
  15635. t['currency'] = 0x00A4;
  15636. t['cyrBreve'] = 0xF6D1;
  15637. t['cyrFlex'] = 0xF6D2;
  15638. t['cyrbreve'] = 0xF6D4;
  15639. t['cyrflex'] = 0xF6D5;
  15640. t['d'] = 0x0064;
  15641. t['daarmenian'] = 0x0564;
  15642. t['dabengali'] = 0x09A6;
  15643. t['dadarabic'] = 0x0636;
  15644. t['dadeva'] = 0x0926;
  15645. t['dadfinalarabic'] = 0xFEBE;
  15646. t['dadinitialarabic'] = 0xFEBF;
  15647. t['dadmedialarabic'] = 0xFEC0;
  15648. t['dagesh'] = 0x05BC;
  15649. t['dageshhebrew'] = 0x05BC;
  15650. t['dagger'] = 0x2020;
  15651. t['daggerdbl'] = 0x2021;
  15652. t['dagujarati'] = 0x0AA6;
  15653. t['dagurmukhi'] = 0x0A26;
  15654. t['dahiragana'] = 0x3060;
  15655. t['dakatakana'] = 0x30C0;
  15656. t['dalarabic'] = 0x062F;
  15657. t['dalet'] = 0x05D3;
  15658. t['daletdagesh'] = 0xFB33;
  15659. t['daletdageshhebrew'] = 0xFB33;
  15660. t['dalethebrew'] = 0x05D3;
  15661. t['dalfinalarabic'] = 0xFEAA;
  15662. t['dammaarabic'] = 0x064F;
  15663. t['dammalowarabic'] = 0x064F;
  15664. t['dammatanaltonearabic'] = 0x064C;
  15665. t['dammatanarabic'] = 0x064C;
  15666. t['danda'] = 0x0964;
  15667. t['dargahebrew'] = 0x05A7;
  15668. t['dargalefthebrew'] = 0x05A7;
  15669. t['dasiapneumatacyrilliccmb'] = 0x0485;
  15670. t['dblGrave'] = 0xF6D3;
  15671. t['dblanglebracketleft'] = 0x300A;
  15672. t['dblanglebracketleftvertical'] = 0xFE3D;
  15673. t['dblanglebracketright'] = 0x300B;
  15674. t['dblanglebracketrightvertical'] = 0xFE3E;
  15675. t['dblarchinvertedbelowcmb'] = 0x032B;
  15676. t['dblarrowleft'] = 0x21D4;
  15677. t['dblarrowright'] = 0x21D2;
  15678. t['dbldanda'] = 0x0965;
  15679. t['dblgrave'] = 0xF6D6;
  15680. t['dblgravecmb'] = 0x030F;
  15681. t['dblintegral'] = 0x222C;
  15682. t['dbllowline'] = 0x2017;
  15683. t['dbllowlinecmb'] = 0x0333;
  15684. t['dbloverlinecmb'] = 0x033F;
  15685. t['dblprimemod'] = 0x02BA;
  15686. t['dblverticalbar'] = 0x2016;
  15687. t['dblverticallineabovecmb'] = 0x030E;
  15688. t['dbopomofo'] = 0x3109;
  15689. t['dbsquare'] = 0x33C8;
  15690. t['dcaron'] = 0x010F;
  15691. t['dcedilla'] = 0x1E11;
  15692. t['dcircle'] = 0x24D3;
  15693. t['dcircumflexbelow'] = 0x1E13;
  15694. t['dcroat'] = 0x0111;
  15695. t['ddabengali'] = 0x09A1;
  15696. t['ddadeva'] = 0x0921;
  15697. t['ddagujarati'] = 0x0AA1;
  15698. t['ddagurmukhi'] = 0x0A21;
  15699. t['ddalarabic'] = 0x0688;
  15700. t['ddalfinalarabic'] = 0xFB89;
  15701. t['dddhadeva'] = 0x095C;
  15702. t['ddhabengali'] = 0x09A2;
  15703. t['ddhadeva'] = 0x0922;
  15704. t['ddhagujarati'] = 0x0AA2;
  15705. t['ddhagurmukhi'] = 0x0A22;
  15706. t['ddotaccent'] = 0x1E0B;
  15707. t['ddotbelow'] = 0x1E0D;
  15708. t['decimalseparatorarabic'] = 0x066B;
  15709. t['decimalseparatorpersian'] = 0x066B;
  15710. t['decyrillic'] = 0x0434;
  15711. t['degree'] = 0x00B0;
  15712. t['dehihebrew'] = 0x05AD;
  15713. t['dehiragana'] = 0x3067;
  15714. t['deicoptic'] = 0x03EF;
  15715. t['dekatakana'] = 0x30C7;
  15716. t['deleteleft'] = 0x232B;
  15717. t['deleteright'] = 0x2326;
  15718. t['delta'] = 0x03B4;
  15719. t['deltaturned'] = 0x018D;
  15720. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  15721. t['dezh'] = 0x02A4;
  15722. t['dhabengali'] = 0x09A7;
  15723. t['dhadeva'] = 0x0927;
  15724. t['dhagujarati'] = 0x0AA7;
  15725. t['dhagurmukhi'] = 0x0A27;
  15726. t['dhook'] = 0x0257;
  15727. t['dialytikatonos'] = 0x0385;
  15728. t['dialytikatonoscmb'] = 0x0344;
  15729. t['diamond'] = 0x2666;
  15730. t['diamondsuitwhite'] = 0x2662;
  15731. t['dieresis'] = 0x00A8;
  15732. t['dieresisacute'] = 0xF6D7;
  15733. t['dieresisbelowcmb'] = 0x0324;
  15734. t['dieresiscmb'] = 0x0308;
  15735. t['dieresisgrave'] = 0xF6D8;
  15736. t['dieresistonos'] = 0x0385;
  15737. t['dihiragana'] = 0x3062;
  15738. t['dikatakana'] = 0x30C2;
  15739. t['dittomark'] = 0x3003;
  15740. t['divide'] = 0x00F7;
  15741. t['divides'] = 0x2223;
  15742. t['divisionslash'] = 0x2215;
  15743. t['djecyrillic'] = 0x0452;
  15744. t['dkshade'] = 0x2593;
  15745. t['dlinebelow'] = 0x1E0F;
  15746. t['dlsquare'] = 0x3397;
  15747. t['dmacron'] = 0x0111;
  15748. t['dmonospace'] = 0xFF44;
  15749. t['dnblock'] = 0x2584;
  15750. t['dochadathai'] = 0x0E0E;
  15751. t['dodekthai'] = 0x0E14;
  15752. t['dohiragana'] = 0x3069;
  15753. t['dokatakana'] = 0x30C9;
  15754. t['dollar'] = 0x0024;
  15755. t['dollarinferior'] = 0xF6E3;
  15756. t['dollarmonospace'] = 0xFF04;
  15757. t['dollaroldstyle'] = 0xF724;
  15758. t['dollarsmall'] = 0xFE69;
  15759. t['dollarsuperior'] = 0xF6E4;
  15760. t['dong'] = 0x20AB;
  15761. t['dorusquare'] = 0x3326;
  15762. t['dotaccent'] = 0x02D9;
  15763. t['dotaccentcmb'] = 0x0307;
  15764. t['dotbelowcmb'] = 0x0323;
  15765. t['dotbelowcomb'] = 0x0323;
  15766. t['dotkatakana'] = 0x30FB;
  15767. t['dotlessi'] = 0x0131;
  15768. t['dotlessj'] = 0xF6BE;
  15769. t['dotlessjstrokehook'] = 0x0284;
  15770. t['dotmath'] = 0x22C5;
  15771. t['dottedcircle'] = 0x25CC;
  15772. t['doubleyodpatah'] = 0xFB1F;
  15773. t['doubleyodpatahhebrew'] = 0xFB1F;
  15774. t['downtackbelowcmb'] = 0x031E;
  15775. t['downtackmod'] = 0x02D5;
  15776. t['dparen'] = 0x249F;
  15777. t['dsuperior'] = 0xF6EB;
  15778. t['dtail'] = 0x0256;
  15779. t['dtopbar'] = 0x018C;
  15780. t['duhiragana'] = 0x3065;
  15781. t['dukatakana'] = 0x30C5;
  15782. t['dz'] = 0x01F3;
  15783. t['dzaltone'] = 0x02A3;
  15784. t['dzcaron'] = 0x01C6;
  15785. t['dzcurl'] = 0x02A5;
  15786. t['dzeabkhasiancyrillic'] = 0x04E1;
  15787. t['dzecyrillic'] = 0x0455;
  15788. t['dzhecyrillic'] = 0x045F;
  15789. t['e'] = 0x0065;
  15790. t['eacute'] = 0x00E9;
  15791. t['earth'] = 0x2641;
  15792. t['ebengali'] = 0x098F;
  15793. t['ebopomofo'] = 0x311C;
  15794. t['ebreve'] = 0x0115;
  15795. t['ecandradeva'] = 0x090D;
  15796. t['ecandragujarati'] = 0x0A8D;
  15797. t['ecandravowelsigndeva'] = 0x0945;
  15798. t['ecandravowelsigngujarati'] = 0x0AC5;
  15799. t['ecaron'] = 0x011B;
  15800. t['ecedillabreve'] = 0x1E1D;
  15801. t['echarmenian'] = 0x0565;
  15802. t['echyiwnarmenian'] = 0x0587;
  15803. t['ecircle'] = 0x24D4;
  15804. t['ecircumflex'] = 0x00EA;
  15805. t['ecircumflexacute'] = 0x1EBF;
  15806. t['ecircumflexbelow'] = 0x1E19;
  15807. t['ecircumflexdotbelow'] = 0x1EC7;
  15808. t['ecircumflexgrave'] = 0x1EC1;
  15809. t['ecircumflexhookabove'] = 0x1EC3;
  15810. t['ecircumflextilde'] = 0x1EC5;
  15811. t['ecyrillic'] = 0x0454;
  15812. t['edblgrave'] = 0x0205;
  15813. t['edeva'] = 0x090F;
  15814. t['edieresis'] = 0x00EB;
  15815. t['edot'] = 0x0117;
  15816. t['edotaccent'] = 0x0117;
  15817. t['edotbelow'] = 0x1EB9;
  15818. t['eegurmukhi'] = 0x0A0F;
  15819. t['eematragurmukhi'] = 0x0A47;
  15820. t['efcyrillic'] = 0x0444;
  15821. t['egrave'] = 0x00E8;
  15822. t['egujarati'] = 0x0A8F;
  15823. t['eharmenian'] = 0x0567;
  15824. t['ehbopomofo'] = 0x311D;
  15825. t['ehiragana'] = 0x3048;
  15826. t['ehookabove'] = 0x1EBB;
  15827. t['eibopomofo'] = 0x311F;
  15828. t['eight'] = 0x0038;
  15829. t['eightarabic'] = 0x0668;
  15830. t['eightbengali'] = 0x09EE;
  15831. t['eightcircle'] = 0x2467;
  15832. t['eightcircleinversesansserif'] = 0x2791;
  15833. t['eightdeva'] = 0x096E;
  15834. t['eighteencircle'] = 0x2471;
  15835. t['eighteenparen'] = 0x2485;
  15836. t['eighteenperiod'] = 0x2499;
  15837. t['eightgujarati'] = 0x0AEE;
  15838. t['eightgurmukhi'] = 0x0A6E;
  15839. t['eighthackarabic'] = 0x0668;
  15840. t['eighthangzhou'] = 0x3028;
  15841. t['eighthnotebeamed'] = 0x266B;
  15842. t['eightideographicparen'] = 0x3227;
  15843. t['eightinferior'] = 0x2088;
  15844. t['eightmonospace'] = 0xFF18;
  15845. t['eightoldstyle'] = 0xF738;
  15846. t['eightparen'] = 0x247B;
  15847. t['eightperiod'] = 0x248F;
  15848. t['eightpersian'] = 0x06F8;
  15849. t['eightroman'] = 0x2177;
  15850. t['eightsuperior'] = 0x2078;
  15851. t['eightthai'] = 0x0E58;
  15852. t['einvertedbreve'] = 0x0207;
  15853. t['eiotifiedcyrillic'] = 0x0465;
  15854. t['ekatakana'] = 0x30A8;
  15855. t['ekatakanahalfwidth'] = 0xFF74;
  15856. t['ekonkargurmukhi'] = 0x0A74;
  15857. t['ekorean'] = 0x3154;
  15858. t['elcyrillic'] = 0x043B;
  15859. t['element'] = 0x2208;
  15860. t['elevencircle'] = 0x246A;
  15861. t['elevenparen'] = 0x247E;
  15862. t['elevenperiod'] = 0x2492;
  15863. t['elevenroman'] = 0x217A;
  15864. t['ellipsis'] = 0x2026;
  15865. t['ellipsisvertical'] = 0x22EE;
  15866. t['emacron'] = 0x0113;
  15867. t['emacronacute'] = 0x1E17;
  15868. t['emacrongrave'] = 0x1E15;
  15869. t['emcyrillic'] = 0x043C;
  15870. t['emdash'] = 0x2014;
  15871. t['emdashvertical'] = 0xFE31;
  15872. t['emonospace'] = 0xFF45;
  15873. t['emphasismarkarmenian'] = 0x055B;
  15874. t['emptyset'] = 0x2205;
  15875. t['enbopomofo'] = 0x3123;
  15876. t['encyrillic'] = 0x043D;
  15877. t['endash'] = 0x2013;
  15878. t['endashvertical'] = 0xFE32;
  15879. t['endescendercyrillic'] = 0x04A3;
  15880. t['eng'] = 0x014B;
  15881. t['engbopomofo'] = 0x3125;
  15882. t['enghecyrillic'] = 0x04A5;
  15883. t['enhookcyrillic'] = 0x04C8;
  15884. t['enspace'] = 0x2002;
  15885. t['eogonek'] = 0x0119;
  15886. t['eokorean'] = 0x3153;
  15887. t['eopen'] = 0x025B;
  15888. t['eopenclosed'] = 0x029A;
  15889. t['eopenreversed'] = 0x025C;
  15890. t['eopenreversedclosed'] = 0x025E;
  15891. t['eopenreversedhook'] = 0x025D;
  15892. t['eparen'] = 0x24A0;
  15893. t['epsilon'] = 0x03B5;
  15894. t['epsilontonos'] = 0x03AD;
  15895. t['equal'] = 0x003D;
  15896. t['equalmonospace'] = 0xFF1D;
  15897. t['equalsmall'] = 0xFE66;
  15898. t['equalsuperior'] = 0x207C;
  15899. t['equivalence'] = 0x2261;
  15900. t['erbopomofo'] = 0x3126;
  15901. t['ercyrillic'] = 0x0440;
  15902. t['ereversed'] = 0x0258;
  15903. t['ereversedcyrillic'] = 0x044D;
  15904. t['escyrillic'] = 0x0441;
  15905. t['esdescendercyrillic'] = 0x04AB;
  15906. t['esh'] = 0x0283;
  15907. t['eshcurl'] = 0x0286;
  15908. t['eshortdeva'] = 0x090E;
  15909. t['eshortvowelsigndeva'] = 0x0946;
  15910. t['eshreversedloop'] = 0x01AA;
  15911. t['eshsquatreversed'] = 0x0285;
  15912. t['esmallhiragana'] = 0x3047;
  15913. t['esmallkatakana'] = 0x30A7;
  15914. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15915. t['estimated'] = 0x212E;
  15916. t['esuperior'] = 0xF6EC;
  15917. t['eta'] = 0x03B7;
  15918. t['etarmenian'] = 0x0568;
  15919. t['etatonos'] = 0x03AE;
  15920. t['eth'] = 0x00F0;
  15921. t['etilde'] = 0x1EBD;
  15922. t['etildebelow'] = 0x1E1B;
  15923. t['etnahtafoukhhebrew'] = 0x0591;
  15924. t['etnahtafoukhlefthebrew'] = 0x0591;
  15925. t['etnahtahebrew'] = 0x0591;
  15926. t['etnahtalefthebrew'] = 0x0591;
  15927. t['eturned'] = 0x01DD;
  15928. t['eukorean'] = 0x3161;
  15929. t['euro'] = 0x20AC;
  15930. t['evowelsignbengali'] = 0x09C7;
  15931. t['evowelsigndeva'] = 0x0947;
  15932. t['evowelsigngujarati'] = 0x0AC7;
  15933. t['exclam'] = 0x0021;
  15934. t['exclamarmenian'] = 0x055C;
  15935. t['exclamdbl'] = 0x203C;
  15936. t['exclamdown'] = 0x00A1;
  15937. t['exclamdownsmall'] = 0xF7A1;
  15938. t['exclammonospace'] = 0xFF01;
  15939. t['exclamsmall'] = 0xF721;
  15940. t['existential'] = 0x2203;
  15941. t['ezh'] = 0x0292;
  15942. t['ezhcaron'] = 0x01EF;
  15943. t['ezhcurl'] = 0x0293;
  15944. t['ezhreversed'] = 0x01B9;
  15945. t['ezhtail'] = 0x01BA;
  15946. t['f'] = 0x0066;
  15947. t['fadeva'] = 0x095E;
  15948. t['fagurmukhi'] = 0x0A5E;
  15949. t['fahrenheit'] = 0x2109;
  15950. t['fathaarabic'] = 0x064E;
  15951. t['fathalowarabic'] = 0x064E;
  15952. t['fathatanarabic'] = 0x064B;
  15953. t['fbopomofo'] = 0x3108;
  15954. t['fcircle'] = 0x24D5;
  15955. t['fdotaccent'] = 0x1E1F;
  15956. t['feharabic'] = 0x0641;
  15957. t['feharmenian'] = 0x0586;
  15958. t['fehfinalarabic'] = 0xFED2;
  15959. t['fehinitialarabic'] = 0xFED3;
  15960. t['fehmedialarabic'] = 0xFED4;
  15961. t['feicoptic'] = 0x03E5;
  15962. t['female'] = 0x2640;
  15963. t['ff'] = 0xFB00;
  15964. t['ffi'] = 0xFB03;
  15965. t['ffl'] = 0xFB04;
  15966. t['fi'] = 0xFB01;
  15967. t['fifteencircle'] = 0x246E;
  15968. t['fifteenparen'] = 0x2482;
  15969. t['fifteenperiod'] = 0x2496;
  15970. t['figuredash'] = 0x2012;
  15971. t['filledbox'] = 0x25A0;
  15972. t['filledrect'] = 0x25AC;
  15973. t['finalkaf'] = 0x05DA;
  15974. t['finalkafdagesh'] = 0xFB3A;
  15975. t['finalkafdageshhebrew'] = 0xFB3A;
  15976. t['finalkafhebrew'] = 0x05DA;
  15977. t['finalmem'] = 0x05DD;
  15978. t['finalmemhebrew'] = 0x05DD;
  15979. t['finalnun'] = 0x05DF;
  15980. t['finalnunhebrew'] = 0x05DF;
  15981. t['finalpe'] = 0x05E3;
  15982. t['finalpehebrew'] = 0x05E3;
  15983. t['finaltsadi'] = 0x05E5;
  15984. t['finaltsadihebrew'] = 0x05E5;
  15985. t['firsttonechinese'] = 0x02C9;
  15986. t['fisheye'] = 0x25C9;
  15987. t['fitacyrillic'] = 0x0473;
  15988. t['five'] = 0x0035;
  15989. t['fivearabic'] = 0x0665;
  15990. t['fivebengali'] = 0x09EB;
  15991. t['fivecircle'] = 0x2464;
  15992. t['fivecircleinversesansserif'] = 0x278E;
  15993. t['fivedeva'] = 0x096B;
  15994. t['fiveeighths'] = 0x215D;
  15995. t['fivegujarati'] = 0x0AEB;
  15996. t['fivegurmukhi'] = 0x0A6B;
  15997. t['fivehackarabic'] = 0x0665;
  15998. t['fivehangzhou'] = 0x3025;
  15999. t['fiveideographicparen'] = 0x3224;
  16000. t['fiveinferior'] = 0x2085;
  16001. t['fivemonospace'] = 0xFF15;
  16002. t['fiveoldstyle'] = 0xF735;
  16003. t['fiveparen'] = 0x2478;
  16004. t['fiveperiod'] = 0x248C;
  16005. t['fivepersian'] = 0x06F5;
  16006. t['fiveroman'] = 0x2174;
  16007. t['fivesuperior'] = 0x2075;
  16008. t['fivethai'] = 0x0E55;
  16009. t['fl'] = 0xFB02;
  16010. t['florin'] = 0x0192;
  16011. t['fmonospace'] = 0xFF46;
  16012. t['fmsquare'] = 0x3399;
  16013. t['fofanthai'] = 0x0E1F;
  16014. t['fofathai'] = 0x0E1D;
  16015. t['fongmanthai'] = 0x0E4F;
  16016. t['forall'] = 0x2200;
  16017. t['four'] = 0x0034;
  16018. t['fourarabic'] = 0x0664;
  16019. t['fourbengali'] = 0x09EA;
  16020. t['fourcircle'] = 0x2463;
  16021. t['fourcircleinversesansserif'] = 0x278D;
  16022. t['fourdeva'] = 0x096A;
  16023. t['fourgujarati'] = 0x0AEA;
  16024. t['fourgurmukhi'] = 0x0A6A;
  16025. t['fourhackarabic'] = 0x0664;
  16026. t['fourhangzhou'] = 0x3024;
  16027. t['fourideographicparen'] = 0x3223;
  16028. t['fourinferior'] = 0x2084;
  16029. t['fourmonospace'] = 0xFF14;
  16030. t['fournumeratorbengali'] = 0x09F7;
  16031. t['fouroldstyle'] = 0xF734;
  16032. t['fourparen'] = 0x2477;
  16033. t['fourperiod'] = 0x248B;
  16034. t['fourpersian'] = 0x06F4;
  16035. t['fourroman'] = 0x2173;
  16036. t['foursuperior'] = 0x2074;
  16037. t['fourteencircle'] = 0x246D;
  16038. t['fourteenparen'] = 0x2481;
  16039. t['fourteenperiod'] = 0x2495;
  16040. t['fourthai'] = 0x0E54;
  16041. t['fourthtonechinese'] = 0x02CB;
  16042. t['fparen'] = 0x24A1;
  16043. t['fraction'] = 0x2044;
  16044. t['franc'] = 0x20A3;
  16045. t['g'] = 0x0067;
  16046. t['gabengali'] = 0x0997;
  16047. t['gacute'] = 0x01F5;
  16048. t['gadeva'] = 0x0917;
  16049. t['gafarabic'] = 0x06AF;
  16050. t['gaffinalarabic'] = 0xFB93;
  16051. t['gafinitialarabic'] = 0xFB94;
  16052. t['gafmedialarabic'] = 0xFB95;
  16053. t['gagujarati'] = 0x0A97;
  16054. t['gagurmukhi'] = 0x0A17;
  16055. t['gahiragana'] = 0x304C;
  16056. t['gakatakana'] = 0x30AC;
  16057. t['gamma'] = 0x03B3;
  16058. t['gammalatinsmall'] = 0x0263;
  16059. t['gammasuperior'] = 0x02E0;
  16060. t['gangiacoptic'] = 0x03EB;
  16061. t['gbopomofo'] = 0x310D;
  16062. t['gbreve'] = 0x011F;
  16063. t['gcaron'] = 0x01E7;
  16064. t['gcedilla'] = 0x0123;
  16065. t['gcircle'] = 0x24D6;
  16066. t['gcircumflex'] = 0x011D;
  16067. t['gcommaaccent'] = 0x0123;
  16068. t['gdot'] = 0x0121;
  16069. t['gdotaccent'] = 0x0121;
  16070. t['gecyrillic'] = 0x0433;
  16071. t['gehiragana'] = 0x3052;
  16072. t['gekatakana'] = 0x30B2;
  16073. t['geometricallyequal'] = 0x2251;
  16074. t['gereshaccenthebrew'] = 0x059C;
  16075. t['gereshhebrew'] = 0x05F3;
  16076. t['gereshmuqdamhebrew'] = 0x059D;
  16077. t['germandbls'] = 0x00DF;
  16078. t['gershayimaccenthebrew'] = 0x059E;
  16079. t['gershayimhebrew'] = 0x05F4;
  16080. t['getamark'] = 0x3013;
  16081. t['ghabengali'] = 0x0998;
  16082. t['ghadarmenian'] = 0x0572;
  16083. t['ghadeva'] = 0x0918;
  16084. t['ghagujarati'] = 0x0A98;
  16085. t['ghagurmukhi'] = 0x0A18;
  16086. t['ghainarabic'] = 0x063A;
  16087. t['ghainfinalarabic'] = 0xFECE;
  16088. t['ghaininitialarabic'] = 0xFECF;
  16089. t['ghainmedialarabic'] = 0xFED0;
  16090. t['ghemiddlehookcyrillic'] = 0x0495;
  16091. t['ghestrokecyrillic'] = 0x0493;
  16092. t['gheupturncyrillic'] = 0x0491;
  16093. t['ghhadeva'] = 0x095A;
  16094. t['ghhagurmukhi'] = 0x0A5A;
  16095. t['ghook'] = 0x0260;
  16096. t['ghzsquare'] = 0x3393;
  16097. t['gihiragana'] = 0x304E;
  16098. t['gikatakana'] = 0x30AE;
  16099. t['gimarmenian'] = 0x0563;
  16100. t['gimel'] = 0x05D2;
  16101. t['gimeldagesh'] = 0xFB32;
  16102. t['gimeldageshhebrew'] = 0xFB32;
  16103. t['gimelhebrew'] = 0x05D2;
  16104. t['gjecyrillic'] = 0x0453;
  16105. t['glottalinvertedstroke'] = 0x01BE;
  16106. t['glottalstop'] = 0x0294;
  16107. t['glottalstopinverted'] = 0x0296;
  16108. t['glottalstopmod'] = 0x02C0;
  16109. t['glottalstopreversed'] = 0x0295;
  16110. t['glottalstopreversedmod'] = 0x02C1;
  16111. t['glottalstopreversedsuperior'] = 0x02E4;
  16112. t['glottalstopstroke'] = 0x02A1;
  16113. t['glottalstopstrokereversed'] = 0x02A2;
  16114. t['gmacron'] = 0x1E21;
  16115. t['gmonospace'] = 0xFF47;
  16116. t['gohiragana'] = 0x3054;
  16117. t['gokatakana'] = 0x30B4;
  16118. t['gparen'] = 0x24A2;
  16119. t['gpasquare'] = 0x33AC;
  16120. t['gradient'] = 0x2207;
  16121. t['grave'] = 0x0060;
  16122. t['gravebelowcmb'] = 0x0316;
  16123. t['gravecmb'] = 0x0300;
  16124. t['gravecomb'] = 0x0300;
  16125. t['gravedeva'] = 0x0953;
  16126. t['gravelowmod'] = 0x02CE;
  16127. t['gravemonospace'] = 0xFF40;
  16128. t['gravetonecmb'] = 0x0340;
  16129. t['greater'] = 0x003E;
  16130. t['greaterequal'] = 0x2265;
  16131. t['greaterequalorless'] = 0x22DB;
  16132. t['greatermonospace'] = 0xFF1E;
  16133. t['greaterorequivalent'] = 0x2273;
  16134. t['greaterorless'] = 0x2277;
  16135. t['greateroverequal'] = 0x2267;
  16136. t['greatersmall'] = 0xFE65;
  16137. t['gscript'] = 0x0261;
  16138. t['gstroke'] = 0x01E5;
  16139. t['guhiragana'] = 0x3050;
  16140. t['guillemotleft'] = 0x00AB;
  16141. t['guillemotright'] = 0x00BB;
  16142. t['guilsinglleft'] = 0x2039;
  16143. t['guilsinglright'] = 0x203A;
  16144. t['gukatakana'] = 0x30B0;
  16145. t['guramusquare'] = 0x3318;
  16146. t['gysquare'] = 0x33C9;
  16147. t['h'] = 0x0068;
  16148. t['haabkhasiancyrillic'] = 0x04A9;
  16149. t['haaltonearabic'] = 0x06C1;
  16150. t['habengali'] = 0x09B9;
  16151. t['hadescendercyrillic'] = 0x04B3;
  16152. t['hadeva'] = 0x0939;
  16153. t['hagujarati'] = 0x0AB9;
  16154. t['hagurmukhi'] = 0x0A39;
  16155. t['haharabic'] = 0x062D;
  16156. t['hahfinalarabic'] = 0xFEA2;
  16157. t['hahinitialarabic'] = 0xFEA3;
  16158. t['hahiragana'] = 0x306F;
  16159. t['hahmedialarabic'] = 0xFEA4;
  16160. t['haitusquare'] = 0x332A;
  16161. t['hakatakana'] = 0x30CF;
  16162. t['hakatakanahalfwidth'] = 0xFF8A;
  16163. t['halantgurmukhi'] = 0x0A4D;
  16164. t['hamzaarabic'] = 0x0621;
  16165. t['hamzalowarabic'] = 0x0621;
  16166. t['hangulfiller'] = 0x3164;
  16167. t['hardsigncyrillic'] = 0x044A;
  16168. t['harpoonleftbarbup'] = 0x21BC;
  16169. t['harpoonrightbarbup'] = 0x21C0;
  16170. t['hasquare'] = 0x33CA;
  16171. t['hatafpatah'] = 0x05B2;
  16172. t['hatafpatah16'] = 0x05B2;
  16173. t['hatafpatah23'] = 0x05B2;
  16174. t['hatafpatah2f'] = 0x05B2;
  16175. t['hatafpatahhebrew'] = 0x05B2;
  16176. t['hatafpatahnarrowhebrew'] = 0x05B2;
  16177. t['hatafpatahquarterhebrew'] = 0x05B2;
  16178. t['hatafpatahwidehebrew'] = 0x05B2;
  16179. t['hatafqamats'] = 0x05B3;
  16180. t['hatafqamats1b'] = 0x05B3;
  16181. t['hatafqamats28'] = 0x05B3;
  16182. t['hatafqamats34'] = 0x05B3;
  16183. t['hatafqamatshebrew'] = 0x05B3;
  16184. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  16185. t['hatafqamatsquarterhebrew'] = 0x05B3;
  16186. t['hatafqamatswidehebrew'] = 0x05B3;
  16187. t['hatafsegol'] = 0x05B1;
  16188. t['hatafsegol17'] = 0x05B1;
  16189. t['hatafsegol24'] = 0x05B1;
  16190. t['hatafsegol30'] = 0x05B1;
  16191. t['hatafsegolhebrew'] = 0x05B1;
  16192. t['hatafsegolnarrowhebrew'] = 0x05B1;
  16193. t['hatafsegolquarterhebrew'] = 0x05B1;
  16194. t['hatafsegolwidehebrew'] = 0x05B1;
  16195. t['hbar'] = 0x0127;
  16196. t['hbopomofo'] = 0x310F;
  16197. t['hbrevebelow'] = 0x1E2B;
  16198. t['hcedilla'] = 0x1E29;
  16199. t['hcircle'] = 0x24D7;
  16200. t['hcircumflex'] = 0x0125;
  16201. t['hdieresis'] = 0x1E27;
  16202. t['hdotaccent'] = 0x1E23;
  16203. t['hdotbelow'] = 0x1E25;
  16204. t['he'] = 0x05D4;
  16205. t['heart'] = 0x2665;
  16206. t['heartsuitblack'] = 0x2665;
  16207. t['heartsuitwhite'] = 0x2661;
  16208. t['hedagesh'] = 0xFB34;
  16209. t['hedageshhebrew'] = 0xFB34;
  16210. t['hehaltonearabic'] = 0x06C1;
  16211. t['heharabic'] = 0x0647;
  16212. t['hehebrew'] = 0x05D4;
  16213. t['hehfinalaltonearabic'] = 0xFBA7;
  16214. t['hehfinalalttwoarabic'] = 0xFEEA;
  16215. t['hehfinalarabic'] = 0xFEEA;
  16216. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  16217. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  16218. t['hehinitialaltonearabic'] = 0xFBA8;
  16219. t['hehinitialarabic'] = 0xFEEB;
  16220. t['hehiragana'] = 0x3078;
  16221. t['hehmedialaltonearabic'] = 0xFBA9;
  16222. t['hehmedialarabic'] = 0xFEEC;
  16223. t['heiseierasquare'] = 0x337B;
  16224. t['hekatakana'] = 0x30D8;
  16225. t['hekatakanahalfwidth'] = 0xFF8D;
  16226. t['hekutaarusquare'] = 0x3336;
  16227. t['henghook'] = 0x0267;
  16228. t['herutusquare'] = 0x3339;
  16229. t['het'] = 0x05D7;
  16230. t['hethebrew'] = 0x05D7;
  16231. t['hhook'] = 0x0266;
  16232. t['hhooksuperior'] = 0x02B1;
  16233. t['hieuhacirclekorean'] = 0x327B;
  16234. t['hieuhaparenkorean'] = 0x321B;
  16235. t['hieuhcirclekorean'] = 0x326D;
  16236. t['hieuhkorean'] = 0x314E;
  16237. t['hieuhparenkorean'] = 0x320D;
  16238. t['hihiragana'] = 0x3072;
  16239. t['hikatakana'] = 0x30D2;
  16240. t['hikatakanahalfwidth'] = 0xFF8B;
  16241. t['hiriq'] = 0x05B4;
  16242. t['hiriq14'] = 0x05B4;
  16243. t['hiriq21'] = 0x05B4;
  16244. t['hiriq2d'] = 0x05B4;
  16245. t['hiriqhebrew'] = 0x05B4;
  16246. t['hiriqnarrowhebrew'] = 0x05B4;
  16247. t['hiriqquarterhebrew'] = 0x05B4;
  16248. t['hiriqwidehebrew'] = 0x05B4;
  16249. t['hlinebelow'] = 0x1E96;
  16250. t['hmonospace'] = 0xFF48;
  16251. t['hoarmenian'] = 0x0570;
  16252. t['hohipthai'] = 0x0E2B;
  16253. t['hohiragana'] = 0x307B;
  16254. t['hokatakana'] = 0x30DB;
  16255. t['hokatakanahalfwidth'] = 0xFF8E;
  16256. t['holam'] = 0x05B9;
  16257. t['holam19'] = 0x05B9;
  16258. t['holam26'] = 0x05B9;
  16259. t['holam32'] = 0x05B9;
  16260. t['holamhebrew'] = 0x05B9;
  16261. t['holamnarrowhebrew'] = 0x05B9;
  16262. t['holamquarterhebrew'] = 0x05B9;
  16263. t['holamwidehebrew'] = 0x05B9;
  16264. t['honokhukthai'] = 0x0E2E;
  16265. t['hookabovecomb'] = 0x0309;
  16266. t['hookcmb'] = 0x0309;
  16267. t['hookpalatalizedbelowcmb'] = 0x0321;
  16268. t['hookretroflexbelowcmb'] = 0x0322;
  16269. t['hoonsquare'] = 0x3342;
  16270. t['horicoptic'] = 0x03E9;
  16271. t['horizontalbar'] = 0x2015;
  16272. t['horncmb'] = 0x031B;
  16273. t['hotsprings'] = 0x2668;
  16274. t['house'] = 0x2302;
  16275. t['hparen'] = 0x24A3;
  16276. t['hsuperior'] = 0x02B0;
  16277. t['hturned'] = 0x0265;
  16278. t['huhiragana'] = 0x3075;
  16279. t['huiitosquare'] = 0x3333;
  16280. t['hukatakana'] = 0x30D5;
  16281. t['hukatakanahalfwidth'] = 0xFF8C;
  16282. t['hungarumlaut'] = 0x02DD;
  16283. t['hungarumlautcmb'] = 0x030B;
  16284. t['hv'] = 0x0195;
  16285. t['hyphen'] = 0x002D;
  16286. t['hypheninferior'] = 0xF6E5;
  16287. t['hyphenmonospace'] = 0xFF0D;
  16288. t['hyphensmall'] = 0xFE63;
  16289. t['hyphensuperior'] = 0xF6E6;
  16290. t['hyphentwo'] = 0x2010;
  16291. t['i'] = 0x0069;
  16292. t['iacute'] = 0x00ED;
  16293. t['iacyrillic'] = 0x044F;
  16294. t['ibengali'] = 0x0987;
  16295. t['ibopomofo'] = 0x3127;
  16296. t['ibreve'] = 0x012D;
  16297. t['icaron'] = 0x01D0;
  16298. t['icircle'] = 0x24D8;
  16299. t['icircumflex'] = 0x00EE;
  16300. t['icyrillic'] = 0x0456;
  16301. t['idblgrave'] = 0x0209;
  16302. t['ideographearthcircle'] = 0x328F;
  16303. t['ideographfirecircle'] = 0x328B;
  16304. t['ideographicallianceparen'] = 0x323F;
  16305. t['ideographiccallparen'] = 0x323A;
  16306. t['ideographiccentrecircle'] = 0x32A5;
  16307. t['ideographicclose'] = 0x3006;
  16308. t['ideographiccomma'] = 0x3001;
  16309. t['ideographiccommaleft'] = 0xFF64;
  16310. t['ideographiccongratulationparen'] = 0x3237;
  16311. t['ideographiccorrectcircle'] = 0x32A3;
  16312. t['ideographicearthparen'] = 0x322F;
  16313. t['ideographicenterpriseparen'] = 0x323D;
  16314. t['ideographicexcellentcircle'] = 0x329D;
  16315. t['ideographicfestivalparen'] = 0x3240;
  16316. t['ideographicfinancialcircle'] = 0x3296;
  16317. t['ideographicfinancialparen'] = 0x3236;
  16318. t['ideographicfireparen'] = 0x322B;
  16319. t['ideographichaveparen'] = 0x3232;
  16320. t['ideographichighcircle'] = 0x32A4;
  16321. t['ideographiciterationmark'] = 0x3005;
  16322. t['ideographiclaborcircle'] = 0x3298;
  16323. t['ideographiclaborparen'] = 0x3238;
  16324. t['ideographicleftcircle'] = 0x32A7;
  16325. t['ideographiclowcircle'] = 0x32A6;
  16326. t['ideographicmedicinecircle'] = 0x32A9;
  16327. t['ideographicmetalparen'] = 0x322E;
  16328. t['ideographicmoonparen'] = 0x322A;
  16329. t['ideographicnameparen'] = 0x3234;
  16330. t['ideographicperiod'] = 0x3002;
  16331. t['ideographicprintcircle'] = 0x329E;
  16332. t['ideographicreachparen'] = 0x3243;
  16333. t['ideographicrepresentparen'] = 0x3239;
  16334. t['ideographicresourceparen'] = 0x323E;
  16335. t['ideographicrightcircle'] = 0x32A8;
  16336. t['ideographicsecretcircle'] = 0x3299;
  16337. t['ideographicselfparen'] = 0x3242;
  16338. t['ideographicsocietyparen'] = 0x3233;
  16339. t['ideographicspace'] = 0x3000;
  16340. t['ideographicspecialparen'] = 0x3235;
  16341. t['ideographicstockparen'] = 0x3231;
  16342. t['ideographicstudyparen'] = 0x323B;
  16343. t['ideographicsunparen'] = 0x3230;
  16344. t['ideographicsuperviseparen'] = 0x323C;
  16345. t['ideographicwaterparen'] = 0x322C;
  16346. t['ideographicwoodparen'] = 0x322D;
  16347. t['ideographiczero'] = 0x3007;
  16348. t['ideographmetalcircle'] = 0x328E;
  16349. t['ideographmooncircle'] = 0x328A;
  16350. t['ideographnamecircle'] = 0x3294;
  16351. t['ideographsuncircle'] = 0x3290;
  16352. t['ideographwatercircle'] = 0x328C;
  16353. t['ideographwoodcircle'] = 0x328D;
  16354. t['ideva'] = 0x0907;
  16355. t['idieresis'] = 0x00EF;
  16356. t['idieresisacute'] = 0x1E2F;
  16357. t['idieresiscyrillic'] = 0x04E5;
  16358. t['idotbelow'] = 0x1ECB;
  16359. t['iebrevecyrillic'] = 0x04D7;
  16360. t['iecyrillic'] = 0x0435;
  16361. t['ieungacirclekorean'] = 0x3275;
  16362. t['ieungaparenkorean'] = 0x3215;
  16363. t['ieungcirclekorean'] = 0x3267;
  16364. t['ieungkorean'] = 0x3147;
  16365. t['ieungparenkorean'] = 0x3207;
  16366. t['igrave'] = 0x00EC;
  16367. t['igujarati'] = 0x0A87;
  16368. t['igurmukhi'] = 0x0A07;
  16369. t['ihiragana'] = 0x3044;
  16370. t['ihookabove'] = 0x1EC9;
  16371. t['iibengali'] = 0x0988;
  16372. t['iicyrillic'] = 0x0438;
  16373. t['iideva'] = 0x0908;
  16374. t['iigujarati'] = 0x0A88;
  16375. t['iigurmukhi'] = 0x0A08;
  16376. t['iimatragurmukhi'] = 0x0A40;
  16377. t['iinvertedbreve'] = 0x020B;
  16378. t['iishortcyrillic'] = 0x0439;
  16379. t['iivowelsignbengali'] = 0x09C0;
  16380. t['iivowelsigndeva'] = 0x0940;
  16381. t['iivowelsigngujarati'] = 0x0AC0;
  16382. t['ij'] = 0x0133;
  16383. t['ikatakana'] = 0x30A4;
  16384. t['ikatakanahalfwidth'] = 0xFF72;
  16385. t['ikorean'] = 0x3163;
  16386. t['ilde'] = 0x02DC;
  16387. t['iluyhebrew'] = 0x05AC;
  16388. t['imacron'] = 0x012B;
  16389. t['imacroncyrillic'] = 0x04E3;
  16390. t['imageorapproximatelyequal'] = 0x2253;
  16391. t['imatragurmukhi'] = 0x0A3F;
  16392. t['imonospace'] = 0xFF49;
  16393. t['increment'] = 0x2206;
  16394. t['infinity'] = 0x221E;
  16395. t['iniarmenian'] = 0x056B;
  16396. t['integral'] = 0x222B;
  16397. t['integralbottom'] = 0x2321;
  16398. t['integralbt'] = 0x2321;
  16399. t['integralex'] = 0xF8F5;
  16400. t['integraltop'] = 0x2320;
  16401. t['integraltp'] = 0x2320;
  16402. t['intersection'] = 0x2229;
  16403. t['intisquare'] = 0x3305;
  16404. t['invbullet'] = 0x25D8;
  16405. t['invcircle'] = 0x25D9;
  16406. t['invsmileface'] = 0x263B;
  16407. t['iocyrillic'] = 0x0451;
  16408. t['iogonek'] = 0x012F;
  16409. t['iota'] = 0x03B9;
  16410. t['iotadieresis'] = 0x03CA;
  16411. t['iotadieresistonos'] = 0x0390;
  16412. t['iotalatin'] = 0x0269;
  16413. t['iotatonos'] = 0x03AF;
  16414. t['iparen'] = 0x24A4;
  16415. t['irigurmukhi'] = 0x0A72;
  16416. t['ismallhiragana'] = 0x3043;
  16417. t['ismallkatakana'] = 0x30A3;
  16418. t['ismallkatakanahalfwidth'] = 0xFF68;
  16419. t['issharbengali'] = 0x09FA;
  16420. t['istroke'] = 0x0268;
  16421. t['isuperior'] = 0xF6ED;
  16422. t['iterationhiragana'] = 0x309D;
  16423. t['iterationkatakana'] = 0x30FD;
  16424. t['itilde'] = 0x0129;
  16425. t['itildebelow'] = 0x1E2D;
  16426. t['iubopomofo'] = 0x3129;
  16427. t['iucyrillic'] = 0x044E;
  16428. t['ivowelsignbengali'] = 0x09BF;
  16429. t['ivowelsigndeva'] = 0x093F;
  16430. t['ivowelsigngujarati'] = 0x0ABF;
  16431. t['izhitsacyrillic'] = 0x0475;
  16432. t['izhitsadblgravecyrillic'] = 0x0477;
  16433. t['j'] = 0x006A;
  16434. t['jaarmenian'] = 0x0571;
  16435. t['jabengali'] = 0x099C;
  16436. t['jadeva'] = 0x091C;
  16437. t['jagujarati'] = 0x0A9C;
  16438. t['jagurmukhi'] = 0x0A1C;
  16439. t['jbopomofo'] = 0x3110;
  16440. t['jcaron'] = 0x01F0;
  16441. t['jcircle'] = 0x24D9;
  16442. t['jcircumflex'] = 0x0135;
  16443. t['jcrossedtail'] = 0x029D;
  16444. t['jdotlessstroke'] = 0x025F;
  16445. t['jecyrillic'] = 0x0458;
  16446. t['jeemarabic'] = 0x062C;
  16447. t['jeemfinalarabic'] = 0xFE9E;
  16448. t['jeeminitialarabic'] = 0xFE9F;
  16449. t['jeemmedialarabic'] = 0xFEA0;
  16450. t['jeharabic'] = 0x0698;
  16451. t['jehfinalarabic'] = 0xFB8B;
  16452. t['jhabengali'] = 0x099D;
  16453. t['jhadeva'] = 0x091D;
  16454. t['jhagujarati'] = 0x0A9D;
  16455. t['jhagurmukhi'] = 0x0A1D;
  16456. t['jheharmenian'] = 0x057B;
  16457. t['jis'] = 0x3004;
  16458. t['jmonospace'] = 0xFF4A;
  16459. t['jparen'] = 0x24A5;
  16460. t['jsuperior'] = 0x02B2;
  16461. t['k'] = 0x006B;
  16462. t['kabashkircyrillic'] = 0x04A1;
  16463. t['kabengali'] = 0x0995;
  16464. t['kacute'] = 0x1E31;
  16465. t['kacyrillic'] = 0x043A;
  16466. t['kadescendercyrillic'] = 0x049B;
  16467. t['kadeva'] = 0x0915;
  16468. t['kaf'] = 0x05DB;
  16469. t['kafarabic'] = 0x0643;
  16470. t['kafdagesh'] = 0xFB3B;
  16471. t['kafdageshhebrew'] = 0xFB3B;
  16472. t['kaffinalarabic'] = 0xFEDA;
  16473. t['kafhebrew'] = 0x05DB;
  16474. t['kafinitialarabic'] = 0xFEDB;
  16475. t['kafmedialarabic'] = 0xFEDC;
  16476. t['kafrafehebrew'] = 0xFB4D;
  16477. t['kagujarati'] = 0x0A95;
  16478. t['kagurmukhi'] = 0x0A15;
  16479. t['kahiragana'] = 0x304B;
  16480. t['kahookcyrillic'] = 0x04C4;
  16481. t['kakatakana'] = 0x30AB;
  16482. t['kakatakanahalfwidth'] = 0xFF76;
  16483. t['kappa'] = 0x03BA;
  16484. t['kappasymbolgreek'] = 0x03F0;
  16485. t['kapyeounmieumkorean'] = 0x3171;
  16486. t['kapyeounphieuphkorean'] = 0x3184;
  16487. t['kapyeounpieupkorean'] = 0x3178;
  16488. t['kapyeounssangpieupkorean'] = 0x3179;
  16489. t['karoriisquare'] = 0x330D;
  16490. t['kashidaautoarabic'] = 0x0640;
  16491. t['kashidaautonosidebearingarabic'] = 0x0640;
  16492. t['kasmallkatakana'] = 0x30F5;
  16493. t['kasquare'] = 0x3384;
  16494. t['kasraarabic'] = 0x0650;
  16495. t['kasratanarabic'] = 0x064D;
  16496. t['kastrokecyrillic'] = 0x049F;
  16497. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  16498. t['kaverticalstrokecyrillic'] = 0x049D;
  16499. t['kbopomofo'] = 0x310E;
  16500. t['kcalsquare'] = 0x3389;
  16501. t['kcaron'] = 0x01E9;
  16502. t['kcedilla'] = 0x0137;
  16503. t['kcircle'] = 0x24DA;
  16504. t['kcommaaccent'] = 0x0137;
  16505. t['kdotbelow'] = 0x1E33;
  16506. t['keharmenian'] = 0x0584;
  16507. t['kehiragana'] = 0x3051;
  16508. t['kekatakana'] = 0x30B1;
  16509. t['kekatakanahalfwidth'] = 0xFF79;
  16510. t['kenarmenian'] = 0x056F;
  16511. t['kesmallkatakana'] = 0x30F6;
  16512. t['kgreenlandic'] = 0x0138;
  16513. t['khabengali'] = 0x0996;
  16514. t['khacyrillic'] = 0x0445;
  16515. t['khadeva'] = 0x0916;
  16516. t['khagujarati'] = 0x0A96;
  16517. t['khagurmukhi'] = 0x0A16;
  16518. t['khaharabic'] = 0x062E;
  16519. t['khahfinalarabic'] = 0xFEA6;
  16520. t['khahinitialarabic'] = 0xFEA7;
  16521. t['khahmedialarabic'] = 0xFEA8;
  16522. t['kheicoptic'] = 0x03E7;
  16523. t['khhadeva'] = 0x0959;
  16524. t['khhagurmukhi'] = 0x0A59;
  16525. t['khieukhacirclekorean'] = 0x3278;
  16526. t['khieukhaparenkorean'] = 0x3218;
  16527. t['khieukhcirclekorean'] = 0x326A;
  16528. t['khieukhkorean'] = 0x314B;
  16529. t['khieukhparenkorean'] = 0x320A;
  16530. t['khokhaithai'] = 0x0E02;
  16531. t['khokhonthai'] = 0x0E05;
  16532. t['khokhuatthai'] = 0x0E03;
  16533. t['khokhwaithai'] = 0x0E04;
  16534. t['khomutthai'] = 0x0E5B;
  16535. t['khook'] = 0x0199;
  16536. t['khorakhangthai'] = 0x0E06;
  16537. t['khzsquare'] = 0x3391;
  16538. t['kihiragana'] = 0x304D;
  16539. t['kikatakana'] = 0x30AD;
  16540. t['kikatakanahalfwidth'] = 0xFF77;
  16541. t['kiroguramusquare'] = 0x3315;
  16542. t['kiromeetorusquare'] = 0x3316;
  16543. t['kirosquare'] = 0x3314;
  16544. t['kiyeokacirclekorean'] = 0x326E;
  16545. t['kiyeokaparenkorean'] = 0x320E;
  16546. t['kiyeokcirclekorean'] = 0x3260;
  16547. t['kiyeokkorean'] = 0x3131;
  16548. t['kiyeokparenkorean'] = 0x3200;
  16549. t['kiyeoksioskorean'] = 0x3133;
  16550. t['kjecyrillic'] = 0x045C;
  16551. t['klinebelow'] = 0x1E35;
  16552. t['klsquare'] = 0x3398;
  16553. t['kmcubedsquare'] = 0x33A6;
  16554. t['kmonospace'] = 0xFF4B;
  16555. t['kmsquaredsquare'] = 0x33A2;
  16556. t['kohiragana'] = 0x3053;
  16557. t['kohmsquare'] = 0x33C0;
  16558. t['kokaithai'] = 0x0E01;
  16559. t['kokatakana'] = 0x30B3;
  16560. t['kokatakanahalfwidth'] = 0xFF7A;
  16561. t['kooposquare'] = 0x331E;
  16562. t['koppacyrillic'] = 0x0481;
  16563. t['koreanstandardsymbol'] = 0x327F;
  16564. t['koroniscmb'] = 0x0343;
  16565. t['kparen'] = 0x24A6;
  16566. t['kpasquare'] = 0x33AA;
  16567. t['ksicyrillic'] = 0x046F;
  16568. t['ktsquare'] = 0x33CF;
  16569. t['kturned'] = 0x029E;
  16570. t['kuhiragana'] = 0x304F;
  16571. t['kukatakana'] = 0x30AF;
  16572. t['kukatakanahalfwidth'] = 0xFF78;
  16573. t['kvsquare'] = 0x33B8;
  16574. t['kwsquare'] = 0x33BE;
  16575. t['l'] = 0x006C;
  16576. t['labengali'] = 0x09B2;
  16577. t['lacute'] = 0x013A;
  16578. t['ladeva'] = 0x0932;
  16579. t['lagujarati'] = 0x0AB2;
  16580. t['lagurmukhi'] = 0x0A32;
  16581. t['lakkhangyaothai'] = 0x0E45;
  16582. t['lamaleffinalarabic'] = 0xFEFC;
  16583. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  16584. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  16585. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  16586. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  16587. t['lamalefisolatedarabic'] = 0xFEFB;
  16588. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  16589. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  16590. t['lamarabic'] = 0x0644;
  16591. t['lambda'] = 0x03BB;
  16592. t['lambdastroke'] = 0x019B;
  16593. t['lamed'] = 0x05DC;
  16594. t['lameddagesh'] = 0xFB3C;
  16595. t['lameddageshhebrew'] = 0xFB3C;
  16596. t['lamedhebrew'] = 0x05DC;
  16597. t['lamfinalarabic'] = 0xFEDE;
  16598. t['lamhahinitialarabic'] = 0xFCCA;
  16599. t['laminitialarabic'] = 0xFEDF;
  16600. t['lamjeeminitialarabic'] = 0xFCC9;
  16601. t['lamkhahinitialarabic'] = 0xFCCB;
  16602. t['lamlamhehisolatedarabic'] = 0xFDF2;
  16603. t['lammedialarabic'] = 0xFEE0;
  16604. t['lammeemhahinitialarabic'] = 0xFD88;
  16605. t['lammeeminitialarabic'] = 0xFCCC;
  16606. t['largecircle'] = 0x25EF;
  16607. t['lbar'] = 0x019A;
  16608. t['lbelt'] = 0x026C;
  16609. t['lbopomofo'] = 0x310C;
  16610. t['lcaron'] = 0x013E;
  16611. t['lcedilla'] = 0x013C;
  16612. t['lcircle'] = 0x24DB;
  16613. t['lcircumflexbelow'] = 0x1E3D;
  16614. t['lcommaaccent'] = 0x013C;
  16615. t['ldot'] = 0x0140;
  16616. t['ldotaccent'] = 0x0140;
  16617. t['ldotbelow'] = 0x1E37;
  16618. t['ldotbelowmacron'] = 0x1E39;
  16619. t['leftangleabovecmb'] = 0x031A;
  16620. t['lefttackbelowcmb'] = 0x0318;
  16621. t['less'] = 0x003C;
  16622. t['lessequal'] = 0x2264;
  16623. t['lessequalorgreater'] = 0x22DA;
  16624. t['lessmonospace'] = 0xFF1C;
  16625. t['lessorequivalent'] = 0x2272;
  16626. t['lessorgreater'] = 0x2276;
  16627. t['lessoverequal'] = 0x2266;
  16628. t['lesssmall'] = 0xFE64;
  16629. t['lezh'] = 0x026E;
  16630. t['lfblock'] = 0x258C;
  16631. t['lhookretroflex'] = 0x026D;
  16632. t['lira'] = 0x20A4;
  16633. t['liwnarmenian'] = 0x056C;
  16634. t['lj'] = 0x01C9;
  16635. t['ljecyrillic'] = 0x0459;
  16636. t['ll'] = 0xF6C0;
  16637. t['lladeva'] = 0x0933;
  16638. t['llagujarati'] = 0x0AB3;
  16639. t['llinebelow'] = 0x1E3B;
  16640. t['llladeva'] = 0x0934;
  16641. t['llvocalicbengali'] = 0x09E1;
  16642. t['llvocalicdeva'] = 0x0961;
  16643. t['llvocalicvowelsignbengali'] = 0x09E3;
  16644. t['llvocalicvowelsigndeva'] = 0x0963;
  16645. t['lmiddletilde'] = 0x026B;
  16646. t['lmonospace'] = 0xFF4C;
  16647. t['lmsquare'] = 0x33D0;
  16648. t['lochulathai'] = 0x0E2C;
  16649. t['logicaland'] = 0x2227;
  16650. t['logicalnot'] = 0x00AC;
  16651. t['logicalnotreversed'] = 0x2310;
  16652. t['logicalor'] = 0x2228;
  16653. t['lolingthai'] = 0x0E25;
  16654. t['longs'] = 0x017F;
  16655. t['lowlinecenterline'] = 0xFE4E;
  16656. t['lowlinecmb'] = 0x0332;
  16657. t['lowlinedashed'] = 0xFE4D;
  16658. t['lozenge'] = 0x25CA;
  16659. t['lparen'] = 0x24A7;
  16660. t['lslash'] = 0x0142;
  16661. t['lsquare'] = 0x2113;
  16662. t['lsuperior'] = 0xF6EE;
  16663. t['ltshade'] = 0x2591;
  16664. t['luthai'] = 0x0E26;
  16665. t['lvocalicbengali'] = 0x098C;
  16666. t['lvocalicdeva'] = 0x090C;
  16667. t['lvocalicvowelsignbengali'] = 0x09E2;
  16668. t['lvocalicvowelsigndeva'] = 0x0962;
  16669. t['lxsquare'] = 0x33D3;
  16670. t['m'] = 0x006D;
  16671. t['mabengali'] = 0x09AE;
  16672. t['macron'] = 0x00AF;
  16673. t['macronbelowcmb'] = 0x0331;
  16674. t['macroncmb'] = 0x0304;
  16675. t['macronlowmod'] = 0x02CD;
  16676. t['macronmonospace'] = 0xFFE3;
  16677. t['macute'] = 0x1E3F;
  16678. t['madeva'] = 0x092E;
  16679. t['magujarati'] = 0x0AAE;
  16680. t['magurmukhi'] = 0x0A2E;
  16681. t['mahapakhhebrew'] = 0x05A4;
  16682. t['mahapakhlefthebrew'] = 0x05A4;
  16683. t['mahiragana'] = 0x307E;
  16684. t['maichattawalowleftthai'] = 0xF895;
  16685. t['maichattawalowrightthai'] = 0xF894;
  16686. t['maichattawathai'] = 0x0E4B;
  16687. t['maichattawaupperleftthai'] = 0xF893;
  16688. t['maieklowleftthai'] = 0xF88C;
  16689. t['maieklowrightthai'] = 0xF88B;
  16690. t['maiekthai'] = 0x0E48;
  16691. t['maiekupperleftthai'] = 0xF88A;
  16692. t['maihanakatleftthai'] = 0xF884;
  16693. t['maihanakatthai'] = 0x0E31;
  16694. t['maitaikhuleftthai'] = 0xF889;
  16695. t['maitaikhuthai'] = 0x0E47;
  16696. t['maitholowleftthai'] = 0xF88F;
  16697. t['maitholowrightthai'] = 0xF88E;
  16698. t['maithothai'] = 0x0E49;
  16699. t['maithoupperleftthai'] = 0xF88D;
  16700. t['maitrilowleftthai'] = 0xF892;
  16701. t['maitrilowrightthai'] = 0xF891;
  16702. t['maitrithai'] = 0x0E4A;
  16703. t['maitriupperleftthai'] = 0xF890;
  16704. t['maiyamokthai'] = 0x0E46;
  16705. t['makatakana'] = 0x30DE;
  16706. t['makatakanahalfwidth'] = 0xFF8F;
  16707. t['male'] = 0x2642;
  16708. t['mansyonsquare'] = 0x3347;
  16709. t['maqafhebrew'] = 0x05BE;
  16710. t['mars'] = 0x2642;
  16711. t['masoracirclehebrew'] = 0x05AF;
  16712. t['masquare'] = 0x3383;
  16713. t['mbopomofo'] = 0x3107;
  16714. t['mbsquare'] = 0x33D4;
  16715. t['mcircle'] = 0x24DC;
  16716. t['mcubedsquare'] = 0x33A5;
  16717. t['mdotaccent'] = 0x1E41;
  16718. t['mdotbelow'] = 0x1E43;
  16719. t['meemarabic'] = 0x0645;
  16720. t['meemfinalarabic'] = 0xFEE2;
  16721. t['meeminitialarabic'] = 0xFEE3;
  16722. t['meemmedialarabic'] = 0xFEE4;
  16723. t['meemmeeminitialarabic'] = 0xFCD1;
  16724. t['meemmeemisolatedarabic'] = 0xFC48;
  16725. t['meetorusquare'] = 0x334D;
  16726. t['mehiragana'] = 0x3081;
  16727. t['meizierasquare'] = 0x337E;
  16728. t['mekatakana'] = 0x30E1;
  16729. t['mekatakanahalfwidth'] = 0xFF92;
  16730. t['mem'] = 0x05DE;
  16731. t['memdagesh'] = 0xFB3E;
  16732. t['memdageshhebrew'] = 0xFB3E;
  16733. t['memhebrew'] = 0x05DE;
  16734. t['menarmenian'] = 0x0574;
  16735. t['merkhahebrew'] = 0x05A5;
  16736. t['merkhakefulahebrew'] = 0x05A6;
  16737. t['merkhakefulalefthebrew'] = 0x05A6;
  16738. t['merkhalefthebrew'] = 0x05A5;
  16739. t['mhook'] = 0x0271;
  16740. t['mhzsquare'] = 0x3392;
  16741. t['middledotkatakanahalfwidth'] = 0xFF65;
  16742. t['middot'] = 0x00B7;
  16743. t['mieumacirclekorean'] = 0x3272;
  16744. t['mieumaparenkorean'] = 0x3212;
  16745. t['mieumcirclekorean'] = 0x3264;
  16746. t['mieumkorean'] = 0x3141;
  16747. t['mieumpansioskorean'] = 0x3170;
  16748. t['mieumparenkorean'] = 0x3204;
  16749. t['mieumpieupkorean'] = 0x316E;
  16750. t['mieumsioskorean'] = 0x316F;
  16751. t['mihiragana'] = 0x307F;
  16752. t['mikatakana'] = 0x30DF;
  16753. t['mikatakanahalfwidth'] = 0xFF90;
  16754. t['minus'] = 0x2212;
  16755. t['minusbelowcmb'] = 0x0320;
  16756. t['minuscircle'] = 0x2296;
  16757. t['minusmod'] = 0x02D7;
  16758. t['minusplus'] = 0x2213;
  16759. t['minute'] = 0x2032;
  16760. t['miribaarusquare'] = 0x334A;
  16761. t['mirisquare'] = 0x3349;
  16762. t['mlonglegturned'] = 0x0270;
  16763. t['mlsquare'] = 0x3396;
  16764. t['mmcubedsquare'] = 0x33A3;
  16765. t['mmonospace'] = 0xFF4D;
  16766. t['mmsquaredsquare'] = 0x339F;
  16767. t['mohiragana'] = 0x3082;
  16768. t['mohmsquare'] = 0x33C1;
  16769. t['mokatakana'] = 0x30E2;
  16770. t['mokatakanahalfwidth'] = 0xFF93;
  16771. t['molsquare'] = 0x33D6;
  16772. t['momathai'] = 0x0E21;
  16773. t['moverssquare'] = 0x33A7;
  16774. t['moverssquaredsquare'] = 0x33A8;
  16775. t['mparen'] = 0x24A8;
  16776. t['mpasquare'] = 0x33AB;
  16777. t['mssquare'] = 0x33B3;
  16778. t['msuperior'] = 0xF6EF;
  16779. t['mturned'] = 0x026F;
  16780. t['mu'] = 0x00B5;
  16781. t['mu1'] = 0x00B5;
  16782. t['muasquare'] = 0x3382;
  16783. t['muchgreater'] = 0x226B;
  16784. t['muchless'] = 0x226A;
  16785. t['mufsquare'] = 0x338C;
  16786. t['mugreek'] = 0x03BC;
  16787. t['mugsquare'] = 0x338D;
  16788. t['muhiragana'] = 0x3080;
  16789. t['mukatakana'] = 0x30E0;
  16790. t['mukatakanahalfwidth'] = 0xFF91;
  16791. t['mulsquare'] = 0x3395;
  16792. t['multiply'] = 0x00D7;
  16793. t['mumsquare'] = 0x339B;
  16794. t['munahhebrew'] = 0x05A3;
  16795. t['munahlefthebrew'] = 0x05A3;
  16796. t['musicalnote'] = 0x266A;
  16797. t['musicalnotedbl'] = 0x266B;
  16798. t['musicflatsign'] = 0x266D;
  16799. t['musicsharpsign'] = 0x266F;
  16800. t['mussquare'] = 0x33B2;
  16801. t['muvsquare'] = 0x33B6;
  16802. t['muwsquare'] = 0x33BC;
  16803. t['mvmegasquare'] = 0x33B9;
  16804. t['mvsquare'] = 0x33B7;
  16805. t['mwmegasquare'] = 0x33BF;
  16806. t['mwsquare'] = 0x33BD;
  16807. t['n'] = 0x006E;
  16808. t['nabengali'] = 0x09A8;
  16809. t['nabla'] = 0x2207;
  16810. t['nacute'] = 0x0144;
  16811. t['nadeva'] = 0x0928;
  16812. t['nagujarati'] = 0x0AA8;
  16813. t['nagurmukhi'] = 0x0A28;
  16814. t['nahiragana'] = 0x306A;
  16815. t['nakatakana'] = 0x30CA;
  16816. t['nakatakanahalfwidth'] = 0xFF85;
  16817. t['napostrophe'] = 0x0149;
  16818. t['nasquare'] = 0x3381;
  16819. t['nbopomofo'] = 0x310B;
  16820. t['nbspace'] = 0x00A0;
  16821. t['ncaron'] = 0x0148;
  16822. t['ncedilla'] = 0x0146;
  16823. t['ncircle'] = 0x24DD;
  16824. t['ncircumflexbelow'] = 0x1E4B;
  16825. t['ncommaaccent'] = 0x0146;
  16826. t['ndotaccent'] = 0x1E45;
  16827. t['ndotbelow'] = 0x1E47;
  16828. t['nehiragana'] = 0x306D;
  16829. t['nekatakana'] = 0x30CD;
  16830. t['nekatakanahalfwidth'] = 0xFF88;
  16831. t['newsheqelsign'] = 0x20AA;
  16832. t['nfsquare'] = 0x338B;
  16833. t['ngabengali'] = 0x0999;
  16834. t['ngadeva'] = 0x0919;
  16835. t['ngagujarati'] = 0x0A99;
  16836. t['ngagurmukhi'] = 0x0A19;
  16837. t['ngonguthai'] = 0x0E07;
  16838. t['nhiragana'] = 0x3093;
  16839. t['nhookleft'] = 0x0272;
  16840. t['nhookretroflex'] = 0x0273;
  16841. t['nieunacirclekorean'] = 0x326F;
  16842. t['nieunaparenkorean'] = 0x320F;
  16843. t['nieuncieuckorean'] = 0x3135;
  16844. t['nieuncirclekorean'] = 0x3261;
  16845. t['nieunhieuhkorean'] = 0x3136;
  16846. t['nieunkorean'] = 0x3134;
  16847. t['nieunpansioskorean'] = 0x3168;
  16848. t['nieunparenkorean'] = 0x3201;
  16849. t['nieunsioskorean'] = 0x3167;
  16850. t['nieuntikeutkorean'] = 0x3166;
  16851. t['nihiragana'] = 0x306B;
  16852. t['nikatakana'] = 0x30CB;
  16853. t['nikatakanahalfwidth'] = 0xFF86;
  16854. t['nikhahitleftthai'] = 0xF899;
  16855. t['nikhahitthai'] = 0x0E4D;
  16856. t['nine'] = 0x0039;
  16857. t['ninearabic'] = 0x0669;
  16858. t['ninebengali'] = 0x09EF;
  16859. t['ninecircle'] = 0x2468;
  16860. t['ninecircleinversesansserif'] = 0x2792;
  16861. t['ninedeva'] = 0x096F;
  16862. t['ninegujarati'] = 0x0AEF;
  16863. t['ninegurmukhi'] = 0x0A6F;
  16864. t['ninehackarabic'] = 0x0669;
  16865. t['ninehangzhou'] = 0x3029;
  16866. t['nineideographicparen'] = 0x3228;
  16867. t['nineinferior'] = 0x2089;
  16868. t['ninemonospace'] = 0xFF19;
  16869. t['nineoldstyle'] = 0xF739;
  16870. t['nineparen'] = 0x247C;
  16871. t['nineperiod'] = 0x2490;
  16872. t['ninepersian'] = 0x06F9;
  16873. t['nineroman'] = 0x2178;
  16874. t['ninesuperior'] = 0x2079;
  16875. t['nineteencircle'] = 0x2472;
  16876. t['nineteenparen'] = 0x2486;
  16877. t['nineteenperiod'] = 0x249A;
  16878. t['ninethai'] = 0x0E59;
  16879. t['nj'] = 0x01CC;
  16880. t['njecyrillic'] = 0x045A;
  16881. t['nkatakana'] = 0x30F3;
  16882. t['nkatakanahalfwidth'] = 0xFF9D;
  16883. t['nlegrightlong'] = 0x019E;
  16884. t['nlinebelow'] = 0x1E49;
  16885. t['nmonospace'] = 0xFF4E;
  16886. t['nmsquare'] = 0x339A;
  16887. t['nnabengali'] = 0x09A3;
  16888. t['nnadeva'] = 0x0923;
  16889. t['nnagujarati'] = 0x0AA3;
  16890. t['nnagurmukhi'] = 0x0A23;
  16891. t['nnnadeva'] = 0x0929;
  16892. t['nohiragana'] = 0x306E;
  16893. t['nokatakana'] = 0x30CE;
  16894. t['nokatakanahalfwidth'] = 0xFF89;
  16895. t['nonbreakingspace'] = 0x00A0;
  16896. t['nonenthai'] = 0x0E13;
  16897. t['nonuthai'] = 0x0E19;
  16898. t['noonarabic'] = 0x0646;
  16899. t['noonfinalarabic'] = 0xFEE6;
  16900. t['noonghunnaarabic'] = 0x06BA;
  16901. t['noonghunnafinalarabic'] = 0xFB9F;
  16902. t['nooninitialarabic'] = 0xFEE7;
  16903. t['noonjeeminitialarabic'] = 0xFCD2;
  16904. t['noonjeemisolatedarabic'] = 0xFC4B;
  16905. t['noonmedialarabic'] = 0xFEE8;
  16906. t['noonmeeminitialarabic'] = 0xFCD5;
  16907. t['noonmeemisolatedarabic'] = 0xFC4E;
  16908. t['noonnoonfinalarabic'] = 0xFC8D;
  16909. t['notcontains'] = 0x220C;
  16910. t['notelement'] = 0x2209;
  16911. t['notelementof'] = 0x2209;
  16912. t['notequal'] = 0x2260;
  16913. t['notgreater'] = 0x226F;
  16914. t['notgreaternorequal'] = 0x2271;
  16915. t['notgreaternorless'] = 0x2279;
  16916. t['notidentical'] = 0x2262;
  16917. t['notless'] = 0x226E;
  16918. t['notlessnorequal'] = 0x2270;
  16919. t['notparallel'] = 0x2226;
  16920. t['notprecedes'] = 0x2280;
  16921. t['notsubset'] = 0x2284;
  16922. t['notsucceeds'] = 0x2281;
  16923. t['notsuperset'] = 0x2285;
  16924. t['nowarmenian'] = 0x0576;
  16925. t['nparen'] = 0x24A9;
  16926. t['nssquare'] = 0x33B1;
  16927. t['nsuperior'] = 0x207F;
  16928. t['ntilde'] = 0x00F1;
  16929. t['nu'] = 0x03BD;
  16930. t['nuhiragana'] = 0x306C;
  16931. t['nukatakana'] = 0x30CC;
  16932. t['nukatakanahalfwidth'] = 0xFF87;
  16933. t['nuktabengali'] = 0x09BC;
  16934. t['nuktadeva'] = 0x093C;
  16935. t['nuktagujarati'] = 0x0ABC;
  16936. t['nuktagurmukhi'] = 0x0A3C;
  16937. t['numbersign'] = 0x0023;
  16938. t['numbersignmonospace'] = 0xFF03;
  16939. t['numbersignsmall'] = 0xFE5F;
  16940. t['numeralsigngreek'] = 0x0374;
  16941. t['numeralsignlowergreek'] = 0x0375;
  16942. t['numero'] = 0x2116;
  16943. t['nun'] = 0x05E0;
  16944. t['nundagesh'] = 0xFB40;
  16945. t['nundageshhebrew'] = 0xFB40;
  16946. t['nunhebrew'] = 0x05E0;
  16947. t['nvsquare'] = 0x33B5;
  16948. t['nwsquare'] = 0x33BB;
  16949. t['nyabengali'] = 0x099E;
  16950. t['nyadeva'] = 0x091E;
  16951. t['nyagujarati'] = 0x0A9E;
  16952. t['nyagurmukhi'] = 0x0A1E;
  16953. t['o'] = 0x006F;
  16954. t['oacute'] = 0x00F3;
  16955. t['oangthai'] = 0x0E2D;
  16956. t['obarred'] = 0x0275;
  16957. t['obarredcyrillic'] = 0x04E9;
  16958. t['obarreddieresiscyrillic'] = 0x04EB;
  16959. t['obengali'] = 0x0993;
  16960. t['obopomofo'] = 0x311B;
  16961. t['obreve'] = 0x014F;
  16962. t['ocandradeva'] = 0x0911;
  16963. t['ocandragujarati'] = 0x0A91;
  16964. t['ocandravowelsigndeva'] = 0x0949;
  16965. t['ocandravowelsigngujarati'] = 0x0AC9;
  16966. t['ocaron'] = 0x01D2;
  16967. t['ocircle'] = 0x24DE;
  16968. t['ocircumflex'] = 0x00F4;
  16969. t['ocircumflexacute'] = 0x1ED1;
  16970. t['ocircumflexdotbelow'] = 0x1ED9;
  16971. t['ocircumflexgrave'] = 0x1ED3;
  16972. t['ocircumflexhookabove'] = 0x1ED5;
  16973. t['ocircumflextilde'] = 0x1ED7;
  16974. t['ocyrillic'] = 0x043E;
  16975. t['odblacute'] = 0x0151;
  16976. t['odblgrave'] = 0x020D;
  16977. t['odeva'] = 0x0913;
  16978. t['odieresis'] = 0x00F6;
  16979. t['odieresiscyrillic'] = 0x04E7;
  16980. t['odotbelow'] = 0x1ECD;
  16981. t['oe'] = 0x0153;
  16982. t['oekorean'] = 0x315A;
  16983. t['ogonek'] = 0x02DB;
  16984. t['ogonekcmb'] = 0x0328;
  16985. t['ograve'] = 0x00F2;
  16986. t['ogujarati'] = 0x0A93;
  16987. t['oharmenian'] = 0x0585;
  16988. t['ohiragana'] = 0x304A;
  16989. t['ohookabove'] = 0x1ECF;
  16990. t['ohorn'] = 0x01A1;
  16991. t['ohornacute'] = 0x1EDB;
  16992. t['ohorndotbelow'] = 0x1EE3;
  16993. t['ohorngrave'] = 0x1EDD;
  16994. t['ohornhookabove'] = 0x1EDF;
  16995. t['ohorntilde'] = 0x1EE1;
  16996. t['ohungarumlaut'] = 0x0151;
  16997. t['oi'] = 0x01A3;
  16998. t['oinvertedbreve'] = 0x020F;
  16999. t['okatakana'] = 0x30AA;
  17000. t['okatakanahalfwidth'] = 0xFF75;
  17001. t['okorean'] = 0x3157;
  17002. t['olehebrew'] = 0x05AB;
  17003. t['omacron'] = 0x014D;
  17004. t['omacronacute'] = 0x1E53;
  17005. t['omacrongrave'] = 0x1E51;
  17006. t['omdeva'] = 0x0950;
  17007. t['omega'] = 0x03C9;
  17008. t['omega1'] = 0x03D6;
  17009. t['omegacyrillic'] = 0x0461;
  17010. t['omegalatinclosed'] = 0x0277;
  17011. t['omegaroundcyrillic'] = 0x047B;
  17012. t['omegatitlocyrillic'] = 0x047D;
  17013. t['omegatonos'] = 0x03CE;
  17014. t['omgujarati'] = 0x0AD0;
  17015. t['omicron'] = 0x03BF;
  17016. t['omicrontonos'] = 0x03CC;
  17017. t['omonospace'] = 0xFF4F;
  17018. t['one'] = 0x0031;
  17019. t['onearabic'] = 0x0661;
  17020. t['onebengali'] = 0x09E7;
  17021. t['onecircle'] = 0x2460;
  17022. t['onecircleinversesansserif'] = 0x278A;
  17023. t['onedeva'] = 0x0967;
  17024. t['onedotenleader'] = 0x2024;
  17025. t['oneeighth'] = 0x215B;
  17026. t['onefitted'] = 0xF6DC;
  17027. t['onegujarati'] = 0x0AE7;
  17028. t['onegurmukhi'] = 0x0A67;
  17029. t['onehackarabic'] = 0x0661;
  17030. t['onehalf'] = 0x00BD;
  17031. t['onehangzhou'] = 0x3021;
  17032. t['oneideographicparen'] = 0x3220;
  17033. t['oneinferior'] = 0x2081;
  17034. t['onemonospace'] = 0xFF11;
  17035. t['onenumeratorbengali'] = 0x09F4;
  17036. t['oneoldstyle'] = 0xF731;
  17037. t['oneparen'] = 0x2474;
  17038. t['oneperiod'] = 0x2488;
  17039. t['onepersian'] = 0x06F1;
  17040. t['onequarter'] = 0x00BC;
  17041. t['oneroman'] = 0x2170;
  17042. t['onesuperior'] = 0x00B9;
  17043. t['onethai'] = 0x0E51;
  17044. t['onethird'] = 0x2153;
  17045. t['oogonek'] = 0x01EB;
  17046. t['oogonekmacron'] = 0x01ED;
  17047. t['oogurmukhi'] = 0x0A13;
  17048. t['oomatragurmukhi'] = 0x0A4B;
  17049. t['oopen'] = 0x0254;
  17050. t['oparen'] = 0x24AA;
  17051. t['openbullet'] = 0x25E6;
  17052. t['option'] = 0x2325;
  17053. t['ordfeminine'] = 0x00AA;
  17054. t['ordmasculine'] = 0x00BA;
  17055. t['orthogonal'] = 0x221F;
  17056. t['oshortdeva'] = 0x0912;
  17057. t['oshortvowelsigndeva'] = 0x094A;
  17058. t['oslash'] = 0x00F8;
  17059. t['oslashacute'] = 0x01FF;
  17060. t['osmallhiragana'] = 0x3049;
  17061. t['osmallkatakana'] = 0x30A9;
  17062. t['osmallkatakanahalfwidth'] = 0xFF6B;
  17063. t['ostrokeacute'] = 0x01FF;
  17064. t['osuperior'] = 0xF6F0;
  17065. t['otcyrillic'] = 0x047F;
  17066. t['otilde'] = 0x00F5;
  17067. t['otildeacute'] = 0x1E4D;
  17068. t['otildedieresis'] = 0x1E4F;
  17069. t['oubopomofo'] = 0x3121;
  17070. t['overline'] = 0x203E;
  17071. t['overlinecenterline'] = 0xFE4A;
  17072. t['overlinecmb'] = 0x0305;
  17073. t['overlinedashed'] = 0xFE49;
  17074. t['overlinedblwavy'] = 0xFE4C;
  17075. t['overlinewavy'] = 0xFE4B;
  17076. t['overscore'] = 0x00AF;
  17077. t['ovowelsignbengali'] = 0x09CB;
  17078. t['ovowelsigndeva'] = 0x094B;
  17079. t['ovowelsigngujarati'] = 0x0ACB;
  17080. t['p'] = 0x0070;
  17081. t['paampssquare'] = 0x3380;
  17082. t['paasentosquare'] = 0x332B;
  17083. t['pabengali'] = 0x09AA;
  17084. t['pacute'] = 0x1E55;
  17085. t['padeva'] = 0x092A;
  17086. t['pagedown'] = 0x21DF;
  17087. t['pageup'] = 0x21DE;
  17088. t['pagujarati'] = 0x0AAA;
  17089. t['pagurmukhi'] = 0x0A2A;
  17090. t['pahiragana'] = 0x3071;
  17091. t['paiyannoithai'] = 0x0E2F;
  17092. t['pakatakana'] = 0x30D1;
  17093. t['palatalizationcyrilliccmb'] = 0x0484;
  17094. t['palochkacyrillic'] = 0x04C0;
  17095. t['pansioskorean'] = 0x317F;
  17096. t['paragraph'] = 0x00B6;
  17097. t['parallel'] = 0x2225;
  17098. t['parenleft'] = 0x0028;
  17099. t['parenleftaltonearabic'] = 0xFD3E;
  17100. t['parenleftbt'] = 0xF8ED;
  17101. t['parenleftex'] = 0xF8EC;
  17102. t['parenleftinferior'] = 0x208D;
  17103. t['parenleftmonospace'] = 0xFF08;
  17104. t['parenleftsmall'] = 0xFE59;
  17105. t['parenleftsuperior'] = 0x207D;
  17106. t['parenlefttp'] = 0xF8EB;
  17107. t['parenleftvertical'] = 0xFE35;
  17108. t['parenright'] = 0x0029;
  17109. t['parenrightaltonearabic'] = 0xFD3F;
  17110. t['parenrightbt'] = 0xF8F8;
  17111. t['parenrightex'] = 0xF8F7;
  17112. t['parenrightinferior'] = 0x208E;
  17113. t['parenrightmonospace'] = 0xFF09;
  17114. t['parenrightsmall'] = 0xFE5A;
  17115. t['parenrightsuperior'] = 0x207E;
  17116. t['parenrighttp'] = 0xF8F6;
  17117. t['parenrightvertical'] = 0xFE36;
  17118. t['partialdiff'] = 0x2202;
  17119. t['paseqhebrew'] = 0x05C0;
  17120. t['pashtahebrew'] = 0x0599;
  17121. t['pasquare'] = 0x33A9;
  17122. t['patah'] = 0x05B7;
  17123. t['patah11'] = 0x05B7;
  17124. t['patah1d'] = 0x05B7;
  17125. t['patah2a'] = 0x05B7;
  17126. t['patahhebrew'] = 0x05B7;
  17127. t['patahnarrowhebrew'] = 0x05B7;
  17128. t['patahquarterhebrew'] = 0x05B7;
  17129. t['patahwidehebrew'] = 0x05B7;
  17130. t['pazerhebrew'] = 0x05A1;
  17131. t['pbopomofo'] = 0x3106;
  17132. t['pcircle'] = 0x24DF;
  17133. t['pdotaccent'] = 0x1E57;
  17134. t['pe'] = 0x05E4;
  17135. t['pecyrillic'] = 0x043F;
  17136. t['pedagesh'] = 0xFB44;
  17137. t['pedageshhebrew'] = 0xFB44;
  17138. t['peezisquare'] = 0x333B;
  17139. t['pefinaldageshhebrew'] = 0xFB43;
  17140. t['peharabic'] = 0x067E;
  17141. t['peharmenian'] = 0x057A;
  17142. t['pehebrew'] = 0x05E4;
  17143. t['pehfinalarabic'] = 0xFB57;
  17144. t['pehinitialarabic'] = 0xFB58;
  17145. t['pehiragana'] = 0x307A;
  17146. t['pehmedialarabic'] = 0xFB59;
  17147. t['pekatakana'] = 0x30DA;
  17148. t['pemiddlehookcyrillic'] = 0x04A7;
  17149. t['perafehebrew'] = 0xFB4E;
  17150. t['percent'] = 0x0025;
  17151. t['percentarabic'] = 0x066A;
  17152. t['percentmonospace'] = 0xFF05;
  17153. t['percentsmall'] = 0xFE6A;
  17154. t['period'] = 0x002E;
  17155. t['periodarmenian'] = 0x0589;
  17156. t['periodcentered'] = 0x00B7;
  17157. t['periodhalfwidth'] = 0xFF61;
  17158. t['periodinferior'] = 0xF6E7;
  17159. t['periodmonospace'] = 0xFF0E;
  17160. t['periodsmall'] = 0xFE52;
  17161. t['periodsuperior'] = 0xF6E8;
  17162. t['perispomenigreekcmb'] = 0x0342;
  17163. t['perpendicular'] = 0x22A5;
  17164. t['perthousand'] = 0x2030;
  17165. t['peseta'] = 0x20A7;
  17166. t['pfsquare'] = 0x338A;
  17167. t['phabengali'] = 0x09AB;
  17168. t['phadeva'] = 0x092B;
  17169. t['phagujarati'] = 0x0AAB;
  17170. t['phagurmukhi'] = 0x0A2B;
  17171. t['phi'] = 0x03C6;
  17172. t['phi1'] = 0x03D5;
  17173. t['phieuphacirclekorean'] = 0x327A;
  17174. t['phieuphaparenkorean'] = 0x321A;
  17175. t['phieuphcirclekorean'] = 0x326C;
  17176. t['phieuphkorean'] = 0x314D;
  17177. t['phieuphparenkorean'] = 0x320C;
  17178. t['philatin'] = 0x0278;
  17179. t['phinthuthai'] = 0x0E3A;
  17180. t['phisymbolgreek'] = 0x03D5;
  17181. t['phook'] = 0x01A5;
  17182. t['phophanthai'] = 0x0E1E;
  17183. t['phophungthai'] = 0x0E1C;
  17184. t['phosamphaothai'] = 0x0E20;
  17185. t['pi'] = 0x03C0;
  17186. t['pieupacirclekorean'] = 0x3273;
  17187. t['pieupaparenkorean'] = 0x3213;
  17188. t['pieupcieuckorean'] = 0x3176;
  17189. t['pieupcirclekorean'] = 0x3265;
  17190. t['pieupkiyeokkorean'] = 0x3172;
  17191. t['pieupkorean'] = 0x3142;
  17192. t['pieupparenkorean'] = 0x3205;
  17193. t['pieupsioskiyeokkorean'] = 0x3174;
  17194. t['pieupsioskorean'] = 0x3144;
  17195. t['pieupsiostikeutkorean'] = 0x3175;
  17196. t['pieupthieuthkorean'] = 0x3177;
  17197. t['pieuptikeutkorean'] = 0x3173;
  17198. t['pihiragana'] = 0x3074;
  17199. t['pikatakana'] = 0x30D4;
  17200. t['pisymbolgreek'] = 0x03D6;
  17201. t['piwrarmenian'] = 0x0583;
  17202. t['plus'] = 0x002B;
  17203. t['plusbelowcmb'] = 0x031F;
  17204. t['pluscircle'] = 0x2295;
  17205. t['plusminus'] = 0x00B1;
  17206. t['plusmod'] = 0x02D6;
  17207. t['plusmonospace'] = 0xFF0B;
  17208. t['plussmall'] = 0xFE62;
  17209. t['plussuperior'] = 0x207A;
  17210. t['pmonospace'] = 0xFF50;
  17211. t['pmsquare'] = 0x33D8;
  17212. t['pohiragana'] = 0x307D;
  17213. t['pointingindexdownwhite'] = 0x261F;
  17214. t['pointingindexleftwhite'] = 0x261C;
  17215. t['pointingindexrightwhite'] = 0x261E;
  17216. t['pointingindexupwhite'] = 0x261D;
  17217. t['pokatakana'] = 0x30DD;
  17218. t['poplathai'] = 0x0E1B;
  17219. t['postalmark'] = 0x3012;
  17220. t['postalmarkface'] = 0x3020;
  17221. t['pparen'] = 0x24AB;
  17222. t['precedes'] = 0x227A;
  17223. t['prescription'] = 0x211E;
  17224. t['primemod'] = 0x02B9;
  17225. t['primereversed'] = 0x2035;
  17226. t['product'] = 0x220F;
  17227. t['projective'] = 0x2305;
  17228. t['prolongedkana'] = 0x30FC;
  17229. t['propellor'] = 0x2318;
  17230. t['propersubset'] = 0x2282;
  17231. t['propersuperset'] = 0x2283;
  17232. t['proportion'] = 0x2237;
  17233. t['proportional'] = 0x221D;
  17234. t['psi'] = 0x03C8;
  17235. t['psicyrillic'] = 0x0471;
  17236. t['psilipneumatacyrilliccmb'] = 0x0486;
  17237. t['pssquare'] = 0x33B0;
  17238. t['puhiragana'] = 0x3077;
  17239. t['pukatakana'] = 0x30D7;
  17240. t['pvsquare'] = 0x33B4;
  17241. t['pwsquare'] = 0x33BA;
  17242. t['q'] = 0x0071;
  17243. t['qadeva'] = 0x0958;
  17244. t['qadmahebrew'] = 0x05A8;
  17245. t['qafarabic'] = 0x0642;
  17246. t['qaffinalarabic'] = 0xFED6;
  17247. t['qafinitialarabic'] = 0xFED7;
  17248. t['qafmedialarabic'] = 0xFED8;
  17249. t['qamats'] = 0x05B8;
  17250. t['qamats10'] = 0x05B8;
  17251. t['qamats1a'] = 0x05B8;
  17252. t['qamats1c'] = 0x05B8;
  17253. t['qamats27'] = 0x05B8;
  17254. t['qamats29'] = 0x05B8;
  17255. t['qamats33'] = 0x05B8;
  17256. t['qamatsde'] = 0x05B8;
  17257. t['qamatshebrew'] = 0x05B8;
  17258. t['qamatsnarrowhebrew'] = 0x05B8;
  17259. t['qamatsqatanhebrew'] = 0x05B8;
  17260. t['qamatsqatannarrowhebrew'] = 0x05B8;
  17261. t['qamatsqatanquarterhebrew'] = 0x05B8;
  17262. t['qamatsqatanwidehebrew'] = 0x05B8;
  17263. t['qamatsquarterhebrew'] = 0x05B8;
  17264. t['qamatswidehebrew'] = 0x05B8;
  17265. t['qarneyparahebrew'] = 0x059F;
  17266. t['qbopomofo'] = 0x3111;
  17267. t['qcircle'] = 0x24E0;
  17268. t['qhook'] = 0x02A0;
  17269. t['qmonospace'] = 0xFF51;
  17270. t['qof'] = 0x05E7;
  17271. t['qofdagesh'] = 0xFB47;
  17272. t['qofdageshhebrew'] = 0xFB47;
  17273. t['qofhebrew'] = 0x05E7;
  17274. t['qparen'] = 0x24AC;
  17275. t['quarternote'] = 0x2669;
  17276. t['qubuts'] = 0x05BB;
  17277. t['qubuts18'] = 0x05BB;
  17278. t['qubuts25'] = 0x05BB;
  17279. t['qubuts31'] = 0x05BB;
  17280. t['qubutshebrew'] = 0x05BB;
  17281. t['qubutsnarrowhebrew'] = 0x05BB;
  17282. t['qubutsquarterhebrew'] = 0x05BB;
  17283. t['qubutswidehebrew'] = 0x05BB;
  17284. t['question'] = 0x003F;
  17285. t['questionarabic'] = 0x061F;
  17286. t['questionarmenian'] = 0x055E;
  17287. t['questiondown'] = 0x00BF;
  17288. t['questiondownsmall'] = 0xF7BF;
  17289. t['questiongreek'] = 0x037E;
  17290. t['questionmonospace'] = 0xFF1F;
  17291. t['questionsmall'] = 0xF73F;
  17292. t['quotedbl'] = 0x0022;
  17293. t['quotedblbase'] = 0x201E;
  17294. t['quotedblleft'] = 0x201C;
  17295. t['quotedblmonospace'] = 0xFF02;
  17296. t['quotedblprime'] = 0x301E;
  17297. t['quotedblprimereversed'] = 0x301D;
  17298. t['quotedblright'] = 0x201D;
  17299. t['quoteleft'] = 0x2018;
  17300. t['quoteleftreversed'] = 0x201B;
  17301. t['quotereversed'] = 0x201B;
  17302. t['quoteright'] = 0x2019;
  17303. t['quoterightn'] = 0x0149;
  17304. t['quotesinglbase'] = 0x201A;
  17305. t['quotesingle'] = 0x0027;
  17306. t['quotesinglemonospace'] = 0xFF07;
  17307. t['r'] = 0x0072;
  17308. t['raarmenian'] = 0x057C;
  17309. t['rabengali'] = 0x09B0;
  17310. t['racute'] = 0x0155;
  17311. t['radeva'] = 0x0930;
  17312. t['radical'] = 0x221A;
  17313. t['radicalex'] = 0xF8E5;
  17314. t['radoverssquare'] = 0x33AE;
  17315. t['radoverssquaredsquare'] = 0x33AF;
  17316. t['radsquare'] = 0x33AD;
  17317. t['rafe'] = 0x05BF;
  17318. t['rafehebrew'] = 0x05BF;
  17319. t['ragujarati'] = 0x0AB0;
  17320. t['ragurmukhi'] = 0x0A30;
  17321. t['rahiragana'] = 0x3089;
  17322. t['rakatakana'] = 0x30E9;
  17323. t['rakatakanahalfwidth'] = 0xFF97;
  17324. t['ralowerdiagonalbengali'] = 0x09F1;
  17325. t['ramiddlediagonalbengali'] = 0x09F0;
  17326. t['ramshorn'] = 0x0264;
  17327. t['ratio'] = 0x2236;
  17328. t['rbopomofo'] = 0x3116;
  17329. t['rcaron'] = 0x0159;
  17330. t['rcedilla'] = 0x0157;
  17331. t['rcircle'] = 0x24E1;
  17332. t['rcommaaccent'] = 0x0157;
  17333. t['rdblgrave'] = 0x0211;
  17334. t['rdotaccent'] = 0x1E59;
  17335. t['rdotbelow'] = 0x1E5B;
  17336. t['rdotbelowmacron'] = 0x1E5D;
  17337. t['referencemark'] = 0x203B;
  17338. t['reflexsubset'] = 0x2286;
  17339. t['reflexsuperset'] = 0x2287;
  17340. t['registered'] = 0x00AE;
  17341. t['registersans'] = 0xF8E8;
  17342. t['registerserif'] = 0xF6DA;
  17343. t['reharabic'] = 0x0631;
  17344. t['reharmenian'] = 0x0580;
  17345. t['rehfinalarabic'] = 0xFEAE;
  17346. t['rehiragana'] = 0x308C;
  17347. t['rekatakana'] = 0x30EC;
  17348. t['rekatakanahalfwidth'] = 0xFF9A;
  17349. t['resh'] = 0x05E8;
  17350. t['reshdageshhebrew'] = 0xFB48;
  17351. t['reshhebrew'] = 0x05E8;
  17352. t['reversedtilde'] = 0x223D;
  17353. t['reviahebrew'] = 0x0597;
  17354. t['reviamugrashhebrew'] = 0x0597;
  17355. t['revlogicalnot'] = 0x2310;
  17356. t['rfishhook'] = 0x027E;
  17357. t['rfishhookreversed'] = 0x027F;
  17358. t['rhabengali'] = 0x09DD;
  17359. t['rhadeva'] = 0x095D;
  17360. t['rho'] = 0x03C1;
  17361. t['rhook'] = 0x027D;
  17362. t['rhookturned'] = 0x027B;
  17363. t['rhookturnedsuperior'] = 0x02B5;
  17364. t['rhosymbolgreek'] = 0x03F1;
  17365. t['rhotichookmod'] = 0x02DE;
  17366. t['rieulacirclekorean'] = 0x3271;
  17367. t['rieulaparenkorean'] = 0x3211;
  17368. t['rieulcirclekorean'] = 0x3263;
  17369. t['rieulhieuhkorean'] = 0x3140;
  17370. t['rieulkiyeokkorean'] = 0x313A;
  17371. t['rieulkiyeoksioskorean'] = 0x3169;
  17372. t['rieulkorean'] = 0x3139;
  17373. t['rieulmieumkorean'] = 0x313B;
  17374. t['rieulpansioskorean'] = 0x316C;
  17375. t['rieulparenkorean'] = 0x3203;
  17376. t['rieulphieuphkorean'] = 0x313F;
  17377. t['rieulpieupkorean'] = 0x313C;
  17378. t['rieulpieupsioskorean'] = 0x316B;
  17379. t['rieulsioskorean'] = 0x313D;
  17380. t['rieulthieuthkorean'] = 0x313E;
  17381. t['rieultikeutkorean'] = 0x316A;
  17382. t['rieulyeorinhieuhkorean'] = 0x316D;
  17383. t['rightangle'] = 0x221F;
  17384. t['righttackbelowcmb'] = 0x0319;
  17385. t['righttriangle'] = 0x22BF;
  17386. t['rihiragana'] = 0x308A;
  17387. t['rikatakana'] = 0x30EA;
  17388. t['rikatakanahalfwidth'] = 0xFF98;
  17389. t['ring'] = 0x02DA;
  17390. t['ringbelowcmb'] = 0x0325;
  17391. t['ringcmb'] = 0x030A;
  17392. t['ringhalfleft'] = 0x02BF;
  17393. t['ringhalfleftarmenian'] = 0x0559;
  17394. t['ringhalfleftbelowcmb'] = 0x031C;
  17395. t['ringhalfleftcentered'] = 0x02D3;
  17396. t['ringhalfright'] = 0x02BE;
  17397. t['ringhalfrightbelowcmb'] = 0x0339;
  17398. t['ringhalfrightcentered'] = 0x02D2;
  17399. t['rinvertedbreve'] = 0x0213;
  17400. t['rittorusquare'] = 0x3351;
  17401. t['rlinebelow'] = 0x1E5F;
  17402. t['rlongleg'] = 0x027C;
  17403. t['rlonglegturned'] = 0x027A;
  17404. t['rmonospace'] = 0xFF52;
  17405. t['rohiragana'] = 0x308D;
  17406. t['rokatakana'] = 0x30ED;
  17407. t['rokatakanahalfwidth'] = 0xFF9B;
  17408. t['roruathai'] = 0x0E23;
  17409. t['rparen'] = 0x24AD;
  17410. t['rrabengali'] = 0x09DC;
  17411. t['rradeva'] = 0x0931;
  17412. t['rragurmukhi'] = 0x0A5C;
  17413. t['rreharabic'] = 0x0691;
  17414. t['rrehfinalarabic'] = 0xFB8D;
  17415. t['rrvocalicbengali'] = 0x09E0;
  17416. t['rrvocalicdeva'] = 0x0960;
  17417. t['rrvocalicgujarati'] = 0x0AE0;
  17418. t['rrvocalicvowelsignbengali'] = 0x09C4;
  17419. t['rrvocalicvowelsigndeva'] = 0x0944;
  17420. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  17421. t['rsuperior'] = 0xF6F1;
  17422. t['rtblock'] = 0x2590;
  17423. t['rturned'] = 0x0279;
  17424. t['rturnedsuperior'] = 0x02B4;
  17425. t['ruhiragana'] = 0x308B;
  17426. t['rukatakana'] = 0x30EB;
  17427. t['rukatakanahalfwidth'] = 0xFF99;
  17428. t['rupeemarkbengali'] = 0x09F2;
  17429. t['rupeesignbengali'] = 0x09F3;
  17430. t['rupiah'] = 0xF6DD;
  17431. t['ruthai'] = 0x0E24;
  17432. t['rvocalicbengali'] = 0x098B;
  17433. t['rvocalicdeva'] = 0x090B;
  17434. t['rvocalicgujarati'] = 0x0A8B;
  17435. t['rvocalicvowelsignbengali'] = 0x09C3;
  17436. t['rvocalicvowelsigndeva'] = 0x0943;
  17437. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  17438. t['s'] = 0x0073;
  17439. t['sabengali'] = 0x09B8;
  17440. t['sacute'] = 0x015B;
  17441. t['sacutedotaccent'] = 0x1E65;
  17442. t['sadarabic'] = 0x0635;
  17443. t['sadeva'] = 0x0938;
  17444. t['sadfinalarabic'] = 0xFEBA;
  17445. t['sadinitialarabic'] = 0xFEBB;
  17446. t['sadmedialarabic'] = 0xFEBC;
  17447. t['sagujarati'] = 0x0AB8;
  17448. t['sagurmukhi'] = 0x0A38;
  17449. t['sahiragana'] = 0x3055;
  17450. t['sakatakana'] = 0x30B5;
  17451. t['sakatakanahalfwidth'] = 0xFF7B;
  17452. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  17453. t['samekh'] = 0x05E1;
  17454. t['samekhdagesh'] = 0xFB41;
  17455. t['samekhdageshhebrew'] = 0xFB41;
  17456. t['samekhhebrew'] = 0x05E1;
  17457. t['saraaathai'] = 0x0E32;
  17458. t['saraaethai'] = 0x0E41;
  17459. t['saraaimaimalaithai'] = 0x0E44;
  17460. t['saraaimaimuanthai'] = 0x0E43;
  17461. t['saraamthai'] = 0x0E33;
  17462. t['saraathai'] = 0x0E30;
  17463. t['saraethai'] = 0x0E40;
  17464. t['saraiileftthai'] = 0xF886;
  17465. t['saraiithai'] = 0x0E35;
  17466. t['saraileftthai'] = 0xF885;
  17467. t['saraithai'] = 0x0E34;
  17468. t['saraothai'] = 0x0E42;
  17469. t['saraueeleftthai'] = 0xF888;
  17470. t['saraueethai'] = 0x0E37;
  17471. t['saraueleftthai'] = 0xF887;
  17472. t['sarauethai'] = 0x0E36;
  17473. t['sarauthai'] = 0x0E38;
  17474. t['sarauuthai'] = 0x0E39;
  17475. t['sbopomofo'] = 0x3119;
  17476. t['scaron'] = 0x0161;
  17477. t['scarondotaccent'] = 0x1E67;
  17478. t['scedilla'] = 0x015F;
  17479. t['schwa'] = 0x0259;
  17480. t['schwacyrillic'] = 0x04D9;
  17481. t['schwadieresiscyrillic'] = 0x04DB;
  17482. t['schwahook'] = 0x025A;
  17483. t['scircle'] = 0x24E2;
  17484. t['scircumflex'] = 0x015D;
  17485. t['scommaaccent'] = 0x0219;
  17486. t['sdotaccent'] = 0x1E61;
  17487. t['sdotbelow'] = 0x1E63;
  17488. t['sdotbelowdotaccent'] = 0x1E69;
  17489. t['seagullbelowcmb'] = 0x033C;
  17490. t['second'] = 0x2033;
  17491. t['secondtonechinese'] = 0x02CA;
  17492. t['section'] = 0x00A7;
  17493. t['seenarabic'] = 0x0633;
  17494. t['seenfinalarabic'] = 0xFEB2;
  17495. t['seeninitialarabic'] = 0xFEB3;
  17496. t['seenmedialarabic'] = 0xFEB4;
  17497. t['segol'] = 0x05B6;
  17498. t['segol13'] = 0x05B6;
  17499. t['segol1f'] = 0x05B6;
  17500. t['segol2c'] = 0x05B6;
  17501. t['segolhebrew'] = 0x05B6;
  17502. t['segolnarrowhebrew'] = 0x05B6;
  17503. t['segolquarterhebrew'] = 0x05B6;
  17504. t['segoltahebrew'] = 0x0592;
  17505. t['segolwidehebrew'] = 0x05B6;
  17506. t['seharmenian'] = 0x057D;
  17507. t['sehiragana'] = 0x305B;
  17508. t['sekatakana'] = 0x30BB;
  17509. t['sekatakanahalfwidth'] = 0xFF7E;
  17510. t['semicolon'] = 0x003B;
  17511. t['semicolonarabic'] = 0x061B;
  17512. t['semicolonmonospace'] = 0xFF1B;
  17513. t['semicolonsmall'] = 0xFE54;
  17514. t['semivoicedmarkkana'] = 0x309C;
  17515. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  17516. t['sentisquare'] = 0x3322;
  17517. t['sentosquare'] = 0x3323;
  17518. t['seven'] = 0x0037;
  17519. t['sevenarabic'] = 0x0667;
  17520. t['sevenbengali'] = 0x09ED;
  17521. t['sevencircle'] = 0x2466;
  17522. t['sevencircleinversesansserif'] = 0x2790;
  17523. t['sevendeva'] = 0x096D;
  17524. t['seveneighths'] = 0x215E;
  17525. t['sevengujarati'] = 0x0AED;
  17526. t['sevengurmukhi'] = 0x0A6D;
  17527. t['sevenhackarabic'] = 0x0667;
  17528. t['sevenhangzhou'] = 0x3027;
  17529. t['sevenideographicparen'] = 0x3226;
  17530. t['seveninferior'] = 0x2087;
  17531. t['sevenmonospace'] = 0xFF17;
  17532. t['sevenoldstyle'] = 0xF737;
  17533. t['sevenparen'] = 0x247A;
  17534. t['sevenperiod'] = 0x248E;
  17535. t['sevenpersian'] = 0x06F7;
  17536. t['sevenroman'] = 0x2176;
  17537. t['sevensuperior'] = 0x2077;
  17538. t['seventeencircle'] = 0x2470;
  17539. t['seventeenparen'] = 0x2484;
  17540. t['seventeenperiod'] = 0x2498;
  17541. t['seventhai'] = 0x0E57;
  17542. t['sfthyphen'] = 0x00AD;
  17543. t['shaarmenian'] = 0x0577;
  17544. t['shabengali'] = 0x09B6;
  17545. t['shacyrillic'] = 0x0448;
  17546. t['shaddaarabic'] = 0x0651;
  17547. t['shaddadammaarabic'] = 0xFC61;
  17548. t['shaddadammatanarabic'] = 0xFC5E;
  17549. t['shaddafathaarabic'] = 0xFC60;
  17550. t['shaddakasraarabic'] = 0xFC62;
  17551. t['shaddakasratanarabic'] = 0xFC5F;
  17552. t['shade'] = 0x2592;
  17553. t['shadedark'] = 0x2593;
  17554. t['shadelight'] = 0x2591;
  17555. t['shademedium'] = 0x2592;
  17556. t['shadeva'] = 0x0936;
  17557. t['shagujarati'] = 0x0AB6;
  17558. t['shagurmukhi'] = 0x0A36;
  17559. t['shalshelethebrew'] = 0x0593;
  17560. t['shbopomofo'] = 0x3115;
  17561. t['shchacyrillic'] = 0x0449;
  17562. t['sheenarabic'] = 0x0634;
  17563. t['sheenfinalarabic'] = 0xFEB6;
  17564. t['sheeninitialarabic'] = 0xFEB7;
  17565. t['sheenmedialarabic'] = 0xFEB8;
  17566. t['sheicoptic'] = 0x03E3;
  17567. t['sheqel'] = 0x20AA;
  17568. t['sheqelhebrew'] = 0x20AA;
  17569. t['sheva'] = 0x05B0;
  17570. t['sheva115'] = 0x05B0;
  17571. t['sheva15'] = 0x05B0;
  17572. t['sheva22'] = 0x05B0;
  17573. t['sheva2e'] = 0x05B0;
  17574. t['shevahebrew'] = 0x05B0;
  17575. t['shevanarrowhebrew'] = 0x05B0;
  17576. t['shevaquarterhebrew'] = 0x05B0;
  17577. t['shevawidehebrew'] = 0x05B0;
  17578. t['shhacyrillic'] = 0x04BB;
  17579. t['shimacoptic'] = 0x03ED;
  17580. t['shin'] = 0x05E9;
  17581. t['shindagesh'] = 0xFB49;
  17582. t['shindageshhebrew'] = 0xFB49;
  17583. t['shindageshshindot'] = 0xFB2C;
  17584. t['shindageshshindothebrew'] = 0xFB2C;
  17585. t['shindageshsindot'] = 0xFB2D;
  17586. t['shindageshsindothebrew'] = 0xFB2D;
  17587. t['shindothebrew'] = 0x05C1;
  17588. t['shinhebrew'] = 0x05E9;
  17589. t['shinshindot'] = 0xFB2A;
  17590. t['shinshindothebrew'] = 0xFB2A;
  17591. t['shinsindot'] = 0xFB2B;
  17592. t['shinsindothebrew'] = 0xFB2B;
  17593. t['shook'] = 0x0282;
  17594. t['sigma'] = 0x03C3;
  17595. t['sigma1'] = 0x03C2;
  17596. t['sigmafinal'] = 0x03C2;
  17597. t['sigmalunatesymbolgreek'] = 0x03F2;
  17598. t['sihiragana'] = 0x3057;
  17599. t['sikatakana'] = 0x30B7;
  17600. t['sikatakanahalfwidth'] = 0xFF7C;
  17601. t['siluqhebrew'] = 0x05BD;
  17602. t['siluqlefthebrew'] = 0x05BD;
  17603. t['similar'] = 0x223C;
  17604. t['sindothebrew'] = 0x05C2;
  17605. t['siosacirclekorean'] = 0x3274;
  17606. t['siosaparenkorean'] = 0x3214;
  17607. t['sioscieuckorean'] = 0x317E;
  17608. t['sioscirclekorean'] = 0x3266;
  17609. t['sioskiyeokkorean'] = 0x317A;
  17610. t['sioskorean'] = 0x3145;
  17611. t['siosnieunkorean'] = 0x317B;
  17612. t['siosparenkorean'] = 0x3206;
  17613. t['siospieupkorean'] = 0x317D;
  17614. t['siostikeutkorean'] = 0x317C;
  17615. t['six'] = 0x0036;
  17616. t['sixarabic'] = 0x0666;
  17617. t['sixbengali'] = 0x09EC;
  17618. t['sixcircle'] = 0x2465;
  17619. t['sixcircleinversesansserif'] = 0x278F;
  17620. t['sixdeva'] = 0x096C;
  17621. t['sixgujarati'] = 0x0AEC;
  17622. t['sixgurmukhi'] = 0x0A6C;
  17623. t['sixhackarabic'] = 0x0666;
  17624. t['sixhangzhou'] = 0x3026;
  17625. t['sixideographicparen'] = 0x3225;
  17626. t['sixinferior'] = 0x2086;
  17627. t['sixmonospace'] = 0xFF16;
  17628. t['sixoldstyle'] = 0xF736;
  17629. t['sixparen'] = 0x2479;
  17630. t['sixperiod'] = 0x248D;
  17631. t['sixpersian'] = 0x06F6;
  17632. t['sixroman'] = 0x2175;
  17633. t['sixsuperior'] = 0x2076;
  17634. t['sixteencircle'] = 0x246F;
  17635. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  17636. t['sixteenparen'] = 0x2483;
  17637. t['sixteenperiod'] = 0x2497;
  17638. t['sixthai'] = 0x0E56;
  17639. t['slash'] = 0x002F;
  17640. t['slashmonospace'] = 0xFF0F;
  17641. t['slong'] = 0x017F;
  17642. t['slongdotaccent'] = 0x1E9B;
  17643. t['smileface'] = 0x263A;
  17644. t['smonospace'] = 0xFF53;
  17645. t['sofpasuqhebrew'] = 0x05C3;
  17646. t['softhyphen'] = 0x00AD;
  17647. t['softsigncyrillic'] = 0x044C;
  17648. t['sohiragana'] = 0x305D;
  17649. t['sokatakana'] = 0x30BD;
  17650. t['sokatakanahalfwidth'] = 0xFF7F;
  17651. t['soliduslongoverlaycmb'] = 0x0338;
  17652. t['solidusshortoverlaycmb'] = 0x0337;
  17653. t['sorusithai'] = 0x0E29;
  17654. t['sosalathai'] = 0x0E28;
  17655. t['sosothai'] = 0x0E0B;
  17656. t['sosuathai'] = 0x0E2A;
  17657. t['space'] = 0x0020;
  17658. t['spacehackarabic'] = 0x0020;
  17659. t['spade'] = 0x2660;
  17660. t['spadesuitblack'] = 0x2660;
  17661. t['spadesuitwhite'] = 0x2664;
  17662. t['sparen'] = 0x24AE;
  17663. t['squarebelowcmb'] = 0x033B;
  17664. t['squarecc'] = 0x33C4;
  17665. t['squarecm'] = 0x339D;
  17666. t['squarediagonalcrosshatchfill'] = 0x25A9;
  17667. t['squarehorizontalfill'] = 0x25A4;
  17668. t['squarekg'] = 0x338F;
  17669. t['squarekm'] = 0x339E;
  17670. t['squarekmcapital'] = 0x33CE;
  17671. t['squareln'] = 0x33D1;
  17672. t['squarelog'] = 0x33D2;
  17673. t['squaremg'] = 0x338E;
  17674. t['squaremil'] = 0x33D5;
  17675. t['squaremm'] = 0x339C;
  17676. t['squaremsquared'] = 0x33A1;
  17677. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  17678. t['squareupperlefttolowerrightfill'] = 0x25A7;
  17679. t['squareupperrighttolowerleftfill'] = 0x25A8;
  17680. t['squareverticalfill'] = 0x25A5;
  17681. t['squarewhitewithsmallblack'] = 0x25A3;
  17682. t['srsquare'] = 0x33DB;
  17683. t['ssabengali'] = 0x09B7;
  17684. t['ssadeva'] = 0x0937;
  17685. t['ssagujarati'] = 0x0AB7;
  17686. t['ssangcieuckorean'] = 0x3149;
  17687. t['ssanghieuhkorean'] = 0x3185;
  17688. t['ssangieungkorean'] = 0x3180;
  17689. t['ssangkiyeokkorean'] = 0x3132;
  17690. t['ssangnieunkorean'] = 0x3165;
  17691. t['ssangpieupkorean'] = 0x3143;
  17692. t['ssangsioskorean'] = 0x3146;
  17693. t['ssangtikeutkorean'] = 0x3138;
  17694. t['ssuperior'] = 0xF6F2;
  17695. t['sterling'] = 0x00A3;
  17696. t['sterlingmonospace'] = 0xFFE1;
  17697. t['strokelongoverlaycmb'] = 0x0336;
  17698. t['strokeshortoverlaycmb'] = 0x0335;
  17699. t['subset'] = 0x2282;
  17700. t['subsetnotequal'] = 0x228A;
  17701. t['subsetorequal'] = 0x2286;
  17702. t['succeeds'] = 0x227B;
  17703. t['suchthat'] = 0x220B;
  17704. t['suhiragana'] = 0x3059;
  17705. t['sukatakana'] = 0x30B9;
  17706. t['sukatakanahalfwidth'] = 0xFF7D;
  17707. t['sukunarabic'] = 0x0652;
  17708. t['summation'] = 0x2211;
  17709. t['sun'] = 0x263C;
  17710. t['superset'] = 0x2283;
  17711. t['supersetnotequal'] = 0x228B;
  17712. t['supersetorequal'] = 0x2287;
  17713. t['svsquare'] = 0x33DC;
  17714. t['syouwaerasquare'] = 0x337C;
  17715. t['t'] = 0x0074;
  17716. t['tabengali'] = 0x09A4;
  17717. t['tackdown'] = 0x22A4;
  17718. t['tackleft'] = 0x22A3;
  17719. t['tadeva'] = 0x0924;
  17720. t['tagujarati'] = 0x0AA4;
  17721. t['tagurmukhi'] = 0x0A24;
  17722. t['taharabic'] = 0x0637;
  17723. t['tahfinalarabic'] = 0xFEC2;
  17724. t['tahinitialarabic'] = 0xFEC3;
  17725. t['tahiragana'] = 0x305F;
  17726. t['tahmedialarabic'] = 0xFEC4;
  17727. t['taisyouerasquare'] = 0x337D;
  17728. t['takatakana'] = 0x30BF;
  17729. t['takatakanahalfwidth'] = 0xFF80;
  17730. t['tatweelarabic'] = 0x0640;
  17731. t['tau'] = 0x03C4;
  17732. t['tav'] = 0x05EA;
  17733. t['tavdages'] = 0xFB4A;
  17734. t['tavdagesh'] = 0xFB4A;
  17735. t['tavdageshhebrew'] = 0xFB4A;
  17736. t['tavhebrew'] = 0x05EA;
  17737. t['tbar'] = 0x0167;
  17738. t['tbopomofo'] = 0x310A;
  17739. t['tcaron'] = 0x0165;
  17740. t['tccurl'] = 0x02A8;
  17741. t['tcedilla'] = 0x0163;
  17742. t['tcheharabic'] = 0x0686;
  17743. t['tchehfinalarabic'] = 0xFB7B;
  17744. t['tchehinitialarabic'] = 0xFB7C;
  17745. t['tchehmedialarabic'] = 0xFB7D;
  17746. t['tcircle'] = 0x24E3;
  17747. t['tcircumflexbelow'] = 0x1E71;
  17748. t['tcommaaccent'] = 0x0163;
  17749. t['tdieresis'] = 0x1E97;
  17750. t['tdotaccent'] = 0x1E6B;
  17751. t['tdotbelow'] = 0x1E6D;
  17752. t['tecyrillic'] = 0x0442;
  17753. t['tedescendercyrillic'] = 0x04AD;
  17754. t['teharabic'] = 0x062A;
  17755. t['tehfinalarabic'] = 0xFE96;
  17756. t['tehhahinitialarabic'] = 0xFCA2;
  17757. t['tehhahisolatedarabic'] = 0xFC0C;
  17758. t['tehinitialarabic'] = 0xFE97;
  17759. t['tehiragana'] = 0x3066;
  17760. t['tehjeeminitialarabic'] = 0xFCA1;
  17761. t['tehjeemisolatedarabic'] = 0xFC0B;
  17762. t['tehmarbutaarabic'] = 0x0629;
  17763. t['tehmarbutafinalarabic'] = 0xFE94;
  17764. t['tehmedialarabic'] = 0xFE98;
  17765. t['tehmeeminitialarabic'] = 0xFCA4;
  17766. t['tehmeemisolatedarabic'] = 0xFC0E;
  17767. t['tehnoonfinalarabic'] = 0xFC73;
  17768. t['tekatakana'] = 0x30C6;
  17769. t['tekatakanahalfwidth'] = 0xFF83;
  17770. t['telephone'] = 0x2121;
  17771. t['telephoneblack'] = 0x260E;
  17772. t['telishagedolahebrew'] = 0x05A0;
  17773. t['telishaqetanahebrew'] = 0x05A9;
  17774. t['tencircle'] = 0x2469;
  17775. t['tenideographicparen'] = 0x3229;
  17776. t['tenparen'] = 0x247D;
  17777. t['tenperiod'] = 0x2491;
  17778. t['tenroman'] = 0x2179;
  17779. t['tesh'] = 0x02A7;
  17780. t['tet'] = 0x05D8;
  17781. t['tetdagesh'] = 0xFB38;
  17782. t['tetdageshhebrew'] = 0xFB38;
  17783. t['tethebrew'] = 0x05D8;
  17784. t['tetsecyrillic'] = 0x04B5;
  17785. t['tevirhebrew'] = 0x059B;
  17786. t['tevirlefthebrew'] = 0x059B;
  17787. t['thabengali'] = 0x09A5;
  17788. t['thadeva'] = 0x0925;
  17789. t['thagujarati'] = 0x0AA5;
  17790. t['thagurmukhi'] = 0x0A25;
  17791. t['thalarabic'] = 0x0630;
  17792. t['thalfinalarabic'] = 0xFEAC;
  17793. t['thanthakhatlowleftthai'] = 0xF898;
  17794. t['thanthakhatlowrightthai'] = 0xF897;
  17795. t['thanthakhatthai'] = 0x0E4C;
  17796. t['thanthakhatupperleftthai'] = 0xF896;
  17797. t['theharabic'] = 0x062B;
  17798. t['thehfinalarabic'] = 0xFE9A;
  17799. t['thehinitialarabic'] = 0xFE9B;
  17800. t['thehmedialarabic'] = 0xFE9C;
  17801. t['thereexists'] = 0x2203;
  17802. t['therefore'] = 0x2234;
  17803. t['theta'] = 0x03B8;
  17804. t['theta1'] = 0x03D1;
  17805. t['thetasymbolgreek'] = 0x03D1;
  17806. t['thieuthacirclekorean'] = 0x3279;
  17807. t['thieuthaparenkorean'] = 0x3219;
  17808. t['thieuthcirclekorean'] = 0x326B;
  17809. t['thieuthkorean'] = 0x314C;
  17810. t['thieuthparenkorean'] = 0x320B;
  17811. t['thirteencircle'] = 0x246C;
  17812. t['thirteenparen'] = 0x2480;
  17813. t['thirteenperiod'] = 0x2494;
  17814. t['thonangmonthothai'] = 0x0E11;
  17815. t['thook'] = 0x01AD;
  17816. t['thophuthaothai'] = 0x0E12;
  17817. t['thorn'] = 0x00FE;
  17818. t['thothahanthai'] = 0x0E17;
  17819. t['thothanthai'] = 0x0E10;
  17820. t['thothongthai'] = 0x0E18;
  17821. t['thothungthai'] = 0x0E16;
  17822. t['thousandcyrillic'] = 0x0482;
  17823. t['thousandsseparatorarabic'] = 0x066C;
  17824. t['thousandsseparatorpersian'] = 0x066C;
  17825. t['three'] = 0x0033;
  17826. t['threearabic'] = 0x0663;
  17827. t['threebengali'] = 0x09E9;
  17828. t['threecircle'] = 0x2462;
  17829. t['threecircleinversesansserif'] = 0x278C;
  17830. t['threedeva'] = 0x0969;
  17831. t['threeeighths'] = 0x215C;
  17832. t['threegujarati'] = 0x0AE9;
  17833. t['threegurmukhi'] = 0x0A69;
  17834. t['threehackarabic'] = 0x0663;
  17835. t['threehangzhou'] = 0x3023;
  17836. t['threeideographicparen'] = 0x3222;
  17837. t['threeinferior'] = 0x2083;
  17838. t['threemonospace'] = 0xFF13;
  17839. t['threenumeratorbengali'] = 0x09F6;
  17840. t['threeoldstyle'] = 0xF733;
  17841. t['threeparen'] = 0x2476;
  17842. t['threeperiod'] = 0x248A;
  17843. t['threepersian'] = 0x06F3;
  17844. t['threequarters'] = 0x00BE;
  17845. t['threequartersemdash'] = 0xF6DE;
  17846. t['threeroman'] = 0x2172;
  17847. t['threesuperior'] = 0x00B3;
  17848. t['threethai'] = 0x0E53;
  17849. t['thzsquare'] = 0x3394;
  17850. t['tihiragana'] = 0x3061;
  17851. t['tikatakana'] = 0x30C1;
  17852. t['tikatakanahalfwidth'] = 0xFF81;
  17853. t['tikeutacirclekorean'] = 0x3270;
  17854. t['tikeutaparenkorean'] = 0x3210;
  17855. t['tikeutcirclekorean'] = 0x3262;
  17856. t['tikeutkorean'] = 0x3137;
  17857. t['tikeutparenkorean'] = 0x3202;
  17858. t['tilde'] = 0x02DC;
  17859. t['tildebelowcmb'] = 0x0330;
  17860. t['tildecmb'] = 0x0303;
  17861. t['tildecomb'] = 0x0303;
  17862. t['tildedoublecmb'] = 0x0360;
  17863. t['tildeoperator'] = 0x223C;
  17864. t['tildeoverlaycmb'] = 0x0334;
  17865. t['tildeverticalcmb'] = 0x033E;
  17866. t['timescircle'] = 0x2297;
  17867. t['tipehahebrew'] = 0x0596;
  17868. t['tipehalefthebrew'] = 0x0596;
  17869. t['tippigurmukhi'] = 0x0A70;
  17870. t['titlocyrilliccmb'] = 0x0483;
  17871. t['tiwnarmenian'] = 0x057F;
  17872. t['tlinebelow'] = 0x1E6F;
  17873. t['tmonospace'] = 0xFF54;
  17874. t['toarmenian'] = 0x0569;
  17875. t['tohiragana'] = 0x3068;
  17876. t['tokatakana'] = 0x30C8;
  17877. t['tokatakanahalfwidth'] = 0xFF84;
  17878. t['tonebarextrahighmod'] = 0x02E5;
  17879. t['tonebarextralowmod'] = 0x02E9;
  17880. t['tonebarhighmod'] = 0x02E6;
  17881. t['tonebarlowmod'] = 0x02E8;
  17882. t['tonebarmidmod'] = 0x02E7;
  17883. t['tonefive'] = 0x01BD;
  17884. t['tonesix'] = 0x0185;
  17885. t['tonetwo'] = 0x01A8;
  17886. t['tonos'] = 0x0384;
  17887. t['tonsquare'] = 0x3327;
  17888. t['topatakthai'] = 0x0E0F;
  17889. t['tortoiseshellbracketleft'] = 0x3014;
  17890. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17891. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17892. t['tortoiseshellbracketright'] = 0x3015;
  17893. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17894. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17895. t['totaothai'] = 0x0E15;
  17896. t['tpalatalhook'] = 0x01AB;
  17897. t['tparen'] = 0x24AF;
  17898. t['trademark'] = 0x2122;
  17899. t['trademarksans'] = 0xF8EA;
  17900. t['trademarkserif'] = 0xF6DB;
  17901. t['tretroflexhook'] = 0x0288;
  17902. t['triagdn'] = 0x25BC;
  17903. t['triaglf'] = 0x25C4;
  17904. t['triagrt'] = 0x25BA;
  17905. t['triagup'] = 0x25B2;
  17906. t['ts'] = 0x02A6;
  17907. t['tsadi'] = 0x05E6;
  17908. t['tsadidagesh'] = 0xFB46;
  17909. t['tsadidageshhebrew'] = 0xFB46;
  17910. t['tsadihebrew'] = 0x05E6;
  17911. t['tsecyrillic'] = 0x0446;
  17912. t['tsere'] = 0x05B5;
  17913. t['tsere12'] = 0x05B5;
  17914. t['tsere1e'] = 0x05B5;
  17915. t['tsere2b'] = 0x05B5;
  17916. t['tserehebrew'] = 0x05B5;
  17917. t['tserenarrowhebrew'] = 0x05B5;
  17918. t['tserequarterhebrew'] = 0x05B5;
  17919. t['tserewidehebrew'] = 0x05B5;
  17920. t['tshecyrillic'] = 0x045B;
  17921. t['tsuperior'] = 0xF6F3;
  17922. t['ttabengali'] = 0x099F;
  17923. t['ttadeva'] = 0x091F;
  17924. t['ttagujarati'] = 0x0A9F;
  17925. t['ttagurmukhi'] = 0x0A1F;
  17926. t['tteharabic'] = 0x0679;
  17927. t['ttehfinalarabic'] = 0xFB67;
  17928. t['ttehinitialarabic'] = 0xFB68;
  17929. t['ttehmedialarabic'] = 0xFB69;
  17930. t['tthabengali'] = 0x09A0;
  17931. t['tthadeva'] = 0x0920;
  17932. t['tthagujarati'] = 0x0AA0;
  17933. t['tthagurmukhi'] = 0x0A20;
  17934. t['tturned'] = 0x0287;
  17935. t['tuhiragana'] = 0x3064;
  17936. t['tukatakana'] = 0x30C4;
  17937. t['tukatakanahalfwidth'] = 0xFF82;
  17938. t['tusmallhiragana'] = 0x3063;
  17939. t['tusmallkatakana'] = 0x30C3;
  17940. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17941. t['twelvecircle'] = 0x246B;
  17942. t['twelveparen'] = 0x247F;
  17943. t['twelveperiod'] = 0x2493;
  17944. t['twelveroman'] = 0x217B;
  17945. t['twentycircle'] = 0x2473;
  17946. t['twentyhangzhou'] = 0x5344;
  17947. t['twentyparen'] = 0x2487;
  17948. t['twentyperiod'] = 0x249B;
  17949. t['two'] = 0x0032;
  17950. t['twoarabic'] = 0x0662;
  17951. t['twobengali'] = 0x09E8;
  17952. t['twocircle'] = 0x2461;
  17953. t['twocircleinversesansserif'] = 0x278B;
  17954. t['twodeva'] = 0x0968;
  17955. t['twodotenleader'] = 0x2025;
  17956. t['twodotleader'] = 0x2025;
  17957. t['twodotleadervertical'] = 0xFE30;
  17958. t['twogujarati'] = 0x0AE8;
  17959. t['twogurmukhi'] = 0x0A68;
  17960. t['twohackarabic'] = 0x0662;
  17961. t['twohangzhou'] = 0x3022;
  17962. t['twoideographicparen'] = 0x3221;
  17963. t['twoinferior'] = 0x2082;
  17964. t['twomonospace'] = 0xFF12;
  17965. t['twonumeratorbengali'] = 0x09F5;
  17966. t['twooldstyle'] = 0xF732;
  17967. t['twoparen'] = 0x2475;
  17968. t['twoperiod'] = 0x2489;
  17969. t['twopersian'] = 0x06F2;
  17970. t['tworoman'] = 0x2171;
  17971. t['twostroke'] = 0x01BB;
  17972. t['twosuperior'] = 0x00B2;
  17973. t['twothai'] = 0x0E52;
  17974. t['twothirds'] = 0x2154;
  17975. t['u'] = 0x0075;
  17976. t['uacute'] = 0x00FA;
  17977. t['ubar'] = 0x0289;
  17978. t['ubengali'] = 0x0989;
  17979. t['ubopomofo'] = 0x3128;
  17980. t['ubreve'] = 0x016D;
  17981. t['ucaron'] = 0x01D4;
  17982. t['ucircle'] = 0x24E4;
  17983. t['ucircumflex'] = 0x00FB;
  17984. t['ucircumflexbelow'] = 0x1E77;
  17985. t['ucyrillic'] = 0x0443;
  17986. t['udattadeva'] = 0x0951;
  17987. t['udblacute'] = 0x0171;
  17988. t['udblgrave'] = 0x0215;
  17989. t['udeva'] = 0x0909;
  17990. t['udieresis'] = 0x00FC;
  17991. t['udieresisacute'] = 0x01D8;
  17992. t['udieresisbelow'] = 0x1E73;
  17993. t['udieresiscaron'] = 0x01DA;
  17994. t['udieresiscyrillic'] = 0x04F1;
  17995. t['udieresisgrave'] = 0x01DC;
  17996. t['udieresismacron'] = 0x01D6;
  17997. t['udotbelow'] = 0x1EE5;
  17998. t['ugrave'] = 0x00F9;
  17999. t['ugujarati'] = 0x0A89;
  18000. t['ugurmukhi'] = 0x0A09;
  18001. t['uhiragana'] = 0x3046;
  18002. t['uhookabove'] = 0x1EE7;
  18003. t['uhorn'] = 0x01B0;
  18004. t['uhornacute'] = 0x1EE9;
  18005. t['uhorndotbelow'] = 0x1EF1;
  18006. t['uhorngrave'] = 0x1EEB;
  18007. t['uhornhookabove'] = 0x1EED;
  18008. t['uhorntilde'] = 0x1EEF;
  18009. t['uhungarumlaut'] = 0x0171;
  18010. t['uhungarumlautcyrillic'] = 0x04F3;
  18011. t['uinvertedbreve'] = 0x0217;
  18012. t['ukatakana'] = 0x30A6;
  18013. t['ukatakanahalfwidth'] = 0xFF73;
  18014. t['ukcyrillic'] = 0x0479;
  18015. t['ukorean'] = 0x315C;
  18016. t['umacron'] = 0x016B;
  18017. t['umacroncyrillic'] = 0x04EF;
  18018. t['umacrondieresis'] = 0x1E7B;
  18019. t['umatragurmukhi'] = 0x0A41;
  18020. t['umonospace'] = 0xFF55;
  18021. t['underscore'] = 0x005F;
  18022. t['underscoredbl'] = 0x2017;
  18023. t['underscoremonospace'] = 0xFF3F;
  18024. t['underscorevertical'] = 0xFE33;
  18025. t['underscorewavy'] = 0xFE4F;
  18026. t['union'] = 0x222A;
  18027. t['universal'] = 0x2200;
  18028. t['uogonek'] = 0x0173;
  18029. t['uparen'] = 0x24B0;
  18030. t['upblock'] = 0x2580;
  18031. t['upperdothebrew'] = 0x05C4;
  18032. t['upsilon'] = 0x03C5;
  18033. t['upsilondieresis'] = 0x03CB;
  18034. t['upsilondieresistonos'] = 0x03B0;
  18035. t['upsilonlatin'] = 0x028A;
  18036. t['upsilontonos'] = 0x03CD;
  18037. t['uptackbelowcmb'] = 0x031D;
  18038. t['uptackmod'] = 0x02D4;
  18039. t['uragurmukhi'] = 0x0A73;
  18040. t['uring'] = 0x016F;
  18041. t['ushortcyrillic'] = 0x045E;
  18042. t['usmallhiragana'] = 0x3045;
  18043. t['usmallkatakana'] = 0x30A5;
  18044. t['usmallkatakanahalfwidth'] = 0xFF69;
  18045. t['ustraightcyrillic'] = 0x04AF;
  18046. t['ustraightstrokecyrillic'] = 0x04B1;
  18047. t['utilde'] = 0x0169;
  18048. t['utildeacute'] = 0x1E79;
  18049. t['utildebelow'] = 0x1E75;
  18050. t['uubengali'] = 0x098A;
  18051. t['uudeva'] = 0x090A;
  18052. t['uugujarati'] = 0x0A8A;
  18053. t['uugurmukhi'] = 0x0A0A;
  18054. t['uumatragurmukhi'] = 0x0A42;
  18055. t['uuvowelsignbengali'] = 0x09C2;
  18056. t['uuvowelsigndeva'] = 0x0942;
  18057. t['uuvowelsigngujarati'] = 0x0AC2;
  18058. t['uvowelsignbengali'] = 0x09C1;
  18059. t['uvowelsigndeva'] = 0x0941;
  18060. t['uvowelsigngujarati'] = 0x0AC1;
  18061. t['v'] = 0x0076;
  18062. t['vadeva'] = 0x0935;
  18063. t['vagujarati'] = 0x0AB5;
  18064. t['vagurmukhi'] = 0x0A35;
  18065. t['vakatakana'] = 0x30F7;
  18066. t['vav'] = 0x05D5;
  18067. t['vavdagesh'] = 0xFB35;
  18068. t['vavdagesh65'] = 0xFB35;
  18069. t['vavdageshhebrew'] = 0xFB35;
  18070. t['vavhebrew'] = 0x05D5;
  18071. t['vavholam'] = 0xFB4B;
  18072. t['vavholamhebrew'] = 0xFB4B;
  18073. t['vavvavhebrew'] = 0x05F0;
  18074. t['vavyodhebrew'] = 0x05F1;
  18075. t['vcircle'] = 0x24E5;
  18076. t['vdotbelow'] = 0x1E7F;
  18077. t['vecyrillic'] = 0x0432;
  18078. t['veharabic'] = 0x06A4;
  18079. t['vehfinalarabic'] = 0xFB6B;
  18080. t['vehinitialarabic'] = 0xFB6C;
  18081. t['vehmedialarabic'] = 0xFB6D;
  18082. t['vekatakana'] = 0x30F9;
  18083. t['venus'] = 0x2640;
  18084. t['verticalbar'] = 0x007C;
  18085. t['verticallineabovecmb'] = 0x030D;
  18086. t['verticallinebelowcmb'] = 0x0329;
  18087. t['verticallinelowmod'] = 0x02CC;
  18088. t['verticallinemod'] = 0x02C8;
  18089. t['vewarmenian'] = 0x057E;
  18090. t['vhook'] = 0x028B;
  18091. t['vikatakana'] = 0x30F8;
  18092. t['viramabengali'] = 0x09CD;
  18093. t['viramadeva'] = 0x094D;
  18094. t['viramagujarati'] = 0x0ACD;
  18095. t['visargabengali'] = 0x0983;
  18096. t['visargadeva'] = 0x0903;
  18097. t['visargagujarati'] = 0x0A83;
  18098. t['vmonospace'] = 0xFF56;
  18099. t['voarmenian'] = 0x0578;
  18100. t['voicediterationhiragana'] = 0x309E;
  18101. t['voicediterationkatakana'] = 0x30FE;
  18102. t['voicedmarkkana'] = 0x309B;
  18103. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  18104. t['vokatakana'] = 0x30FA;
  18105. t['vparen'] = 0x24B1;
  18106. t['vtilde'] = 0x1E7D;
  18107. t['vturned'] = 0x028C;
  18108. t['vuhiragana'] = 0x3094;
  18109. t['vukatakana'] = 0x30F4;
  18110. t['w'] = 0x0077;
  18111. t['wacute'] = 0x1E83;
  18112. t['waekorean'] = 0x3159;
  18113. t['wahiragana'] = 0x308F;
  18114. t['wakatakana'] = 0x30EF;
  18115. t['wakatakanahalfwidth'] = 0xFF9C;
  18116. t['wakorean'] = 0x3158;
  18117. t['wasmallhiragana'] = 0x308E;
  18118. t['wasmallkatakana'] = 0x30EE;
  18119. t['wattosquare'] = 0x3357;
  18120. t['wavedash'] = 0x301C;
  18121. t['wavyunderscorevertical'] = 0xFE34;
  18122. t['wawarabic'] = 0x0648;
  18123. t['wawfinalarabic'] = 0xFEEE;
  18124. t['wawhamzaabovearabic'] = 0x0624;
  18125. t['wawhamzaabovefinalarabic'] = 0xFE86;
  18126. t['wbsquare'] = 0x33DD;
  18127. t['wcircle'] = 0x24E6;
  18128. t['wcircumflex'] = 0x0175;
  18129. t['wdieresis'] = 0x1E85;
  18130. t['wdotaccent'] = 0x1E87;
  18131. t['wdotbelow'] = 0x1E89;
  18132. t['wehiragana'] = 0x3091;
  18133. t['weierstrass'] = 0x2118;
  18134. t['wekatakana'] = 0x30F1;
  18135. t['wekorean'] = 0x315E;
  18136. t['weokorean'] = 0x315D;
  18137. t['wgrave'] = 0x1E81;
  18138. t['whitebullet'] = 0x25E6;
  18139. t['whitecircle'] = 0x25CB;
  18140. t['whitecircleinverse'] = 0x25D9;
  18141. t['whitecornerbracketleft'] = 0x300E;
  18142. t['whitecornerbracketleftvertical'] = 0xFE43;
  18143. t['whitecornerbracketright'] = 0x300F;
  18144. t['whitecornerbracketrightvertical'] = 0xFE44;
  18145. t['whitediamond'] = 0x25C7;
  18146. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  18147. t['whitedownpointingsmalltriangle'] = 0x25BF;
  18148. t['whitedownpointingtriangle'] = 0x25BD;
  18149. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  18150. t['whiteleftpointingtriangle'] = 0x25C1;
  18151. t['whitelenticularbracketleft'] = 0x3016;
  18152. t['whitelenticularbracketright'] = 0x3017;
  18153. t['whiterightpointingsmalltriangle'] = 0x25B9;
  18154. t['whiterightpointingtriangle'] = 0x25B7;
  18155. t['whitesmallsquare'] = 0x25AB;
  18156. t['whitesmilingface'] = 0x263A;
  18157. t['whitesquare'] = 0x25A1;
  18158. t['whitestar'] = 0x2606;
  18159. t['whitetelephone'] = 0x260F;
  18160. t['whitetortoiseshellbracketleft'] = 0x3018;
  18161. t['whitetortoiseshellbracketright'] = 0x3019;
  18162. t['whiteuppointingsmalltriangle'] = 0x25B5;
  18163. t['whiteuppointingtriangle'] = 0x25B3;
  18164. t['wihiragana'] = 0x3090;
  18165. t['wikatakana'] = 0x30F0;
  18166. t['wikorean'] = 0x315F;
  18167. t['wmonospace'] = 0xFF57;
  18168. t['wohiragana'] = 0x3092;
  18169. t['wokatakana'] = 0x30F2;
  18170. t['wokatakanahalfwidth'] = 0xFF66;
  18171. t['won'] = 0x20A9;
  18172. t['wonmonospace'] = 0xFFE6;
  18173. t['wowaenthai'] = 0x0E27;
  18174. t['wparen'] = 0x24B2;
  18175. t['wring'] = 0x1E98;
  18176. t['wsuperior'] = 0x02B7;
  18177. t['wturned'] = 0x028D;
  18178. t['wynn'] = 0x01BF;
  18179. t['x'] = 0x0078;
  18180. t['xabovecmb'] = 0x033D;
  18181. t['xbopomofo'] = 0x3112;
  18182. t['xcircle'] = 0x24E7;
  18183. t['xdieresis'] = 0x1E8D;
  18184. t['xdotaccent'] = 0x1E8B;
  18185. t['xeharmenian'] = 0x056D;
  18186. t['xi'] = 0x03BE;
  18187. t['xmonospace'] = 0xFF58;
  18188. t['xparen'] = 0x24B3;
  18189. t['xsuperior'] = 0x02E3;
  18190. t['y'] = 0x0079;
  18191. t['yaadosquare'] = 0x334E;
  18192. t['yabengali'] = 0x09AF;
  18193. t['yacute'] = 0x00FD;
  18194. t['yadeva'] = 0x092F;
  18195. t['yaekorean'] = 0x3152;
  18196. t['yagujarati'] = 0x0AAF;
  18197. t['yagurmukhi'] = 0x0A2F;
  18198. t['yahiragana'] = 0x3084;
  18199. t['yakatakana'] = 0x30E4;
  18200. t['yakatakanahalfwidth'] = 0xFF94;
  18201. t['yakorean'] = 0x3151;
  18202. t['yamakkanthai'] = 0x0E4E;
  18203. t['yasmallhiragana'] = 0x3083;
  18204. t['yasmallkatakana'] = 0x30E3;
  18205. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  18206. t['yatcyrillic'] = 0x0463;
  18207. t['ycircle'] = 0x24E8;
  18208. t['ycircumflex'] = 0x0177;
  18209. t['ydieresis'] = 0x00FF;
  18210. t['ydotaccent'] = 0x1E8F;
  18211. t['ydotbelow'] = 0x1EF5;
  18212. t['yeharabic'] = 0x064A;
  18213. t['yehbarreearabic'] = 0x06D2;
  18214. t['yehbarreefinalarabic'] = 0xFBAF;
  18215. t['yehfinalarabic'] = 0xFEF2;
  18216. t['yehhamzaabovearabic'] = 0x0626;
  18217. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  18218. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  18219. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  18220. t['yehinitialarabic'] = 0xFEF3;
  18221. t['yehmedialarabic'] = 0xFEF4;
  18222. t['yehmeeminitialarabic'] = 0xFCDD;
  18223. t['yehmeemisolatedarabic'] = 0xFC58;
  18224. t['yehnoonfinalarabic'] = 0xFC94;
  18225. t['yehthreedotsbelowarabic'] = 0x06D1;
  18226. t['yekorean'] = 0x3156;
  18227. t['yen'] = 0x00A5;
  18228. t['yenmonospace'] = 0xFFE5;
  18229. t['yeokorean'] = 0x3155;
  18230. t['yeorinhieuhkorean'] = 0x3186;
  18231. t['yerahbenyomohebrew'] = 0x05AA;
  18232. t['yerahbenyomolefthebrew'] = 0x05AA;
  18233. t['yericyrillic'] = 0x044B;
  18234. t['yerudieresiscyrillic'] = 0x04F9;
  18235. t['yesieungkorean'] = 0x3181;
  18236. t['yesieungpansioskorean'] = 0x3183;
  18237. t['yesieungsioskorean'] = 0x3182;
  18238. t['yetivhebrew'] = 0x059A;
  18239. t['ygrave'] = 0x1EF3;
  18240. t['yhook'] = 0x01B4;
  18241. t['yhookabove'] = 0x1EF7;
  18242. t['yiarmenian'] = 0x0575;
  18243. t['yicyrillic'] = 0x0457;
  18244. t['yikorean'] = 0x3162;
  18245. t['yinyang'] = 0x262F;
  18246. t['yiwnarmenian'] = 0x0582;
  18247. t['ymonospace'] = 0xFF59;
  18248. t['yod'] = 0x05D9;
  18249. t['yoddagesh'] = 0xFB39;
  18250. t['yoddageshhebrew'] = 0xFB39;
  18251. t['yodhebrew'] = 0x05D9;
  18252. t['yodyodhebrew'] = 0x05F2;
  18253. t['yodyodpatahhebrew'] = 0xFB1F;
  18254. t['yohiragana'] = 0x3088;
  18255. t['yoikorean'] = 0x3189;
  18256. t['yokatakana'] = 0x30E8;
  18257. t['yokatakanahalfwidth'] = 0xFF96;
  18258. t['yokorean'] = 0x315B;
  18259. t['yosmallhiragana'] = 0x3087;
  18260. t['yosmallkatakana'] = 0x30E7;
  18261. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  18262. t['yotgreek'] = 0x03F3;
  18263. t['yoyaekorean'] = 0x3188;
  18264. t['yoyakorean'] = 0x3187;
  18265. t['yoyakthai'] = 0x0E22;
  18266. t['yoyingthai'] = 0x0E0D;
  18267. t['yparen'] = 0x24B4;
  18268. t['ypogegrammeni'] = 0x037A;
  18269. t['ypogegrammenigreekcmb'] = 0x0345;
  18270. t['yr'] = 0x01A6;
  18271. t['yring'] = 0x1E99;
  18272. t['ysuperior'] = 0x02B8;
  18273. t['ytilde'] = 0x1EF9;
  18274. t['yturned'] = 0x028E;
  18275. t['yuhiragana'] = 0x3086;
  18276. t['yuikorean'] = 0x318C;
  18277. t['yukatakana'] = 0x30E6;
  18278. t['yukatakanahalfwidth'] = 0xFF95;
  18279. t['yukorean'] = 0x3160;
  18280. t['yusbigcyrillic'] = 0x046B;
  18281. t['yusbigiotifiedcyrillic'] = 0x046D;
  18282. t['yuslittlecyrillic'] = 0x0467;
  18283. t['yuslittleiotifiedcyrillic'] = 0x0469;
  18284. t['yusmallhiragana'] = 0x3085;
  18285. t['yusmallkatakana'] = 0x30E5;
  18286. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  18287. t['yuyekorean'] = 0x318B;
  18288. t['yuyeokorean'] = 0x318A;
  18289. t['yyabengali'] = 0x09DF;
  18290. t['yyadeva'] = 0x095F;
  18291. t['z'] = 0x007A;
  18292. t['zaarmenian'] = 0x0566;
  18293. t['zacute'] = 0x017A;
  18294. t['zadeva'] = 0x095B;
  18295. t['zagurmukhi'] = 0x0A5B;
  18296. t['zaharabic'] = 0x0638;
  18297. t['zahfinalarabic'] = 0xFEC6;
  18298. t['zahinitialarabic'] = 0xFEC7;
  18299. t['zahiragana'] = 0x3056;
  18300. t['zahmedialarabic'] = 0xFEC8;
  18301. t['zainarabic'] = 0x0632;
  18302. t['zainfinalarabic'] = 0xFEB0;
  18303. t['zakatakana'] = 0x30B6;
  18304. t['zaqefgadolhebrew'] = 0x0595;
  18305. t['zaqefqatanhebrew'] = 0x0594;
  18306. t['zarqahebrew'] = 0x0598;
  18307. t['zayin'] = 0x05D6;
  18308. t['zayindagesh'] = 0xFB36;
  18309. t['zayindageshhebrew'] = 0xFB36;
  18310. t['zayinhebrew'] = 0x05D6;
  18311. t['zbopomofo'] = 0x3117;
  18312. t['zcaron'] = 0x017E;
  18313. t['zcircle'] = 0x24E9;
  18314. t['zcircumflex'] = 0x1E91;
  18315. t['zcurl'] = 0x0291;
  18316. t['zdot'] = 0x017C;
  18317. t['zdotaccent'] = 0x017C;
  18318. t['zdotbelow'] = 0x1E93;
  18319. t['zecyrillic'] = 0x0437;
  18320. t['zedescendercyrillic'] = 0x0499;
  18321. t['zedieresiscyrillic'] = 0x04DF;
  18322. t['zehiragana'] = 0x305C;
  18323. t['zekatakana'] = 0x30BC;
  18324. t['zero'] = 0x0030;
  18325. t['zeroarabic'] = 0x0660;
  18326. t['zerobengali'] = 0x09E6;
  18327. t['zerodeva'] = 0x0966;
  18328. t['zerogujarati'] = 0x0AE6;
  18329. t['zerogurmukhi'] = 0x0A66;
  18330. t['zerohackarabic'] = 0x0660;
  18331. t['zeroinferior'] = 0x2080;
  18332. t['zeromonospace'] = 0xFF10;
  18333. t['zerooldstyle'] = 0xF730;
  18334. t['zeropersian'] = 0x06F0;
  18335. t['zerosuperior'] = 0x2070;
  18336. t['zerothai'] = 0x0E50;
  18337. t['zerowidthjoiner'] = 0xFEFF;
  18338. t['zerowidthnonjoiner'] = 0x200C;
  18339. t['zerowidthspace'] = 0x200B;
  18340. t['zeta'] = 0x03B6;
  18341. t['zhbopomofo'] = 0x3113;
  18342. t['zhearmenian'] = 0x056A;
  18343. t['zhebrevecyrillic'] = 0x04C2;
  18344. t['zhecyrillic'] = 0x0436;
  18345. t['zhedescendercyrillic'] = 0x0497;
  18346. t['zhedieresiscyrillic'] = 0x04DD;
  18347. t['zihiragana'] = 0x3058;
  18348. t['zikatakana'] = 0x30B8;
  18349. t['zinorhebrew'] = 0x05AE;
  18350. t['zlinebelow'] = 0x1E95;
  18351. t['zmonospace'] = 0xFF5A;
  18352. t['zohiragana'] = 0x305E;
  18353. t['zokatakana'] = 0x30BE;
  18354. t['zparen'] = 0x24B5;
  18355. t['zretroflexhook'] = 0x0290;
  18356. t['zstroke'] = 0x01B6;
  18357. t['zuhiragana'] = 0x305A;
  18358. t['zukatakana'] = 0x30BA;
  18359. t['.notdef'] = 0x0000;
  18360. t['angbracketleftbig'] = 0x2329;
  18361. t['angbracketleftBig'] = 0x2329;
  18362. t['angbracketleftbigg'] = 0x2329;
  18363. t['angbracketleftBigg'] = 0x2329;
  18364. t['angbracketrightBig'] = 0x232A;
  18365. t['angbracketrightbig'] = 0x232A;
  18366. t['angbracketrightBigg'] = 0x232A;
  18367. t['angbracketrightbigg'] = 0x232A;
  18368. t['arrowhookleft'] = 0x21AA;
  18369. t['arrowhookright'] = 0x21A9;
  18370. t['arrowlefttophalf'] = 0x21BC;
  18371. t['arrowleftbothalf'] = 0x21BD;
  18372. t['arrownortheast'] = 0x2197;
  18373. t['arrownorthwest'] = 0x2196;
  18374. t['arrowrighttophalf'] = 0x21C0;
  18375. t['arrowrightbothalf'] = 0x21C1;
  18376. t['arrowsoutheast'] = 0x2198;
  18377. t['arrowsouthwest'] = 0x2199;
  18378. t['backslashbig'] = 0x2216;
  18379. t['backslashBig'] = 0x2216;
  18380. t['backslashBigg'] = 0x2216;
  18381. t['backslashbigg'] = 0x2216;
  18382. t['bardbl'] = 0x2016;
  18383. t['bracehtipdownleft'] = 0xFE37;
  18384. t['bracehtipdownright'] = 0xFE37;
  18385. t['bracehtipupleft'] = 0xFE38;
  18386. t['bracehtipupright'] = 0xFE38;
  18387. t['braceleftBig'] = 0x007B;
  18388. t['braceleftbig'] = 0x007B;
  18389. t['braceleftbigg'] = 0x007B;
  18390. t['braceleftBigg'] = 0x007B;
  18391. t['bracerightBig'] = 0x007D;
  18392. t['bracerightbig'] = 0x007D;
  18393. t['bracerightbigg'] = 0x007D;
  18394. t['bracerightBigg'] = 0x007D;
  18395. t['bracketleftbig'] = 0x005B;
  18396. t['bracketleftBig'] = 0x005B;
  18397. t['bracketleftbigg'] = 0x005B;
  18398. t['bracketleftBigg'] = 0x005B;
  18399. t['bracketrightBig'] = 0x005D;
  18400. t['bracketrightbig'] = 0x005D;
  18401. t['bracketrightbigg'] = 0x005D;
  18402. t['bracketrightBigg'] = 0x005D;
  18403. t['ceilingleftbig'] = 0x2308;
  18404. t['ceilingleftBig'] = 0x2308;
  18405. t['ceilingleftBigg'] = 0x2308;
  18406. t['ceilingleftbigg'] = 0x2308;
  18407. t['ceilingrightbig'] = 0x2309;
  18408. t['ceilingrightBig'] = 0x2309;
  18409. t['ceilingrightbigg'] = 0x2309;
  18410. t['ceilingrightBigg'] = 0x2309;
  18411. t['circledotdisplay'] = 0x2299;
  18412. t['circledottext'] = 0x2299;
  18413. t['circlemultiplydisplay'] = 0x2297;
  18414. t['circlemultiplytext'] = 0x2297;
  18415. t['circleplusdisplay'] = 0x2295;
  18416. t['circleplustext'] = 0x2295;
  18417. t['contintegraldisplay'] = 0x222E;
  18418. t['contintegraltext'] = 0x222E;
  18419. t['coproductdisplay'] = 0x2210;
  18420. t['coproducttext'] = 0x2210;
  18421. t['floorleftBig'] = 0x230A;
  18422. t['floorleftbig'] = 0x230A;
  18423. t['floorleftbigg'] = 0x230A;
  18424. t['floorleftBigg'] = 0x230A;
  18425. t['floorrightbig'] = 0x230B;
  18426. t['floorrightBig'] = 0x230B;
  18427. t['floorrightBigg'] = 0x230B;
  18428. t['floorrightbigg'] = 0x230B;
  18429. t['hatwide'] = 0x0302;
  18430. t['hatwider'] = 0x0302;
  18431. t['hatwidest'] = 0x0302;
  18432. t['intercal'] = 0x1D40;
  18433. t['integraldisplay'] = 0x222B;
  18434. t['integraltext'] = 0x222B;
  18435. t['intersectiondisplay'] = 0x22C2;
  18436. t['intersectiontext'] = 0x22C2;
  18437. t['logicalanddisplay'] = 0x2227;
  18438. t['logicalandtext'] = 0x2227;
  18439. t['logicalordisplay'] = 0x2228;
  18440. t['logicalortext'] = 0x2228;
  18441. t['parenleftBig'] = 0x0028;
  18442. t['parenleftbig'] = 0x0028;
  18443. t['parenleftBigg'] = 0x0028;
  18444. t['parenleftbigg'] = 0x0028;
  18445. t['parenrightBig'] = 0x0029;
  18446. t['parenrightbig'] = 0x0029;
  18447. t['parenrightBigg'] = 0x0029;
  18448. t['parenrightbigg'] = 0x0029;
  18449. t['prime'] = 0x2032;
  18450. t['productdisplay'] = 0x220F;
  18451. t['producttext'] = 0x220F;
  18452. t['radicalbig'] = 0x221A;
  18453. t['radicalBig'] = 0x221A;
  18454. t['radicalBigg'] = 0x221A;
  18455. t['radicalbigg'] = 0x221A;
  18456. t['radicalbt'] = 0x221A;
  18457. t['radicaltp'] = 0x221A;
  18458. t['radicalvertex'] = 0x221A;
  18459. t['slashbig'] = 0x002F;
  18460. t['slashBig'] = 0x002F;
  18461. t['slashBigg'] = 0x002F;
  18462. t['slashbigg'] = 0x002F;
  18463. t['summationdisplay'] = 0x2211;
  18464. t['summationtext'] = 0x2211;
  18465. t['tildewide'] = 0x02DC;
  18466. t['tildewider'] = 0x02DC;
  18467. t['tildewidest'] = 0x02DC;
  18468. t['uniondisplay'] = 0x22C3;
  18469. t['unionmultidisplay'] = 0x228E;
  18470. t['unionmultitext'] = 0x228E;
  18471. t['unionsqdisplay'] = 0x2294;
  18472. t['unionsqtext'] = 0x2294;
  18473. t['uniontext'] = 0x22C3;
  18474. t['vextenddouble'] = 0x2225;
  18475. t['vextendsingle'] = 0x2223;
  18476. });
  18477. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  18478. t['space'] = 0x0020;
  18479. t['a1'] = 0x2701;
  18480. t['a2'] = 0x2702;
  18481. t['a202'] = 0x2703;
  18482. t['a3'] = 0x2704;
  18483. t['a4'] = 0x260E;
  18484. t['a5'] = 0x2706;
  18485. t['a119'] = 0x2707;
  18486. t['a118'] = 0x2708;
  18487. t['a117'] = 0x2709;
  18488. t['a11'] = 0x261B;
  18489. t['a12'] = 0x261E;
  18490. t['a13'] = 0x270C;
  18491. t['a14'] = 0x270D;
  18492. t['a15'] = 0x270E;
  18493. t['a16'] = 0x270F;
  18494. t['a105'] = 0x2710;
  18495. t['a17'] = 0x2711;
  18496. t['a18'] = 0x2712;
  18497. t['a19'] = 0x2713;
  18498. t['a20'] = 0x2714;
  18499. t['a21'] = 0x2715;
  18500. t['a22'] = 0x2716;
  18501. t['a23'] = 0x2717;
  18502. t['a24'] = 0x2718;
  18503. t['a25'] = 0x2719;
  18504. t['a26'] = 0x271A;
  18505. t['a27'] = 0x271B;
  18506. t['a28'] = 0x271C;
  18507. t['a6'] = 0x271D;
  18508. t['a7'] = 0x271E;
  18509. t['a8'] = 0x271F;
  18510. t['a9'] = 0x2720;
  18511. t['a10'] = 0x2721;
  18512. t['a29'] = 0x2722;
  18513. t['a30'] = 0x2723;
  18514. t['a31'] = 0x2724;
  18515. t['a32'] = 0x2725;
  18516. t['a33'] = 0x2726;
  18517. t['a34'] = 0x2727;
  18518. t['a35'] = 0x2605;
  18519. t['a36'] = 0x2729;
  18520. t['a37'] = 0x272A;
  18521. t['a38'] = 0x272B;
  18522. t['a39'] = 0x272C;
  18523. t['a40'] = 0x272D;
  18524. t['a41'] = 0x272E;
  18525. t['a42'] = 0x272F;
  18526. t['a43'] = 0x2730;
  18527. t['a44'] = 0x2731;
  18528. t['a45'] = 0x2732;
  18529. t['a46'] = 0x2733;
  18530. t['a47'] = 0x2734;
  18531. t['a48'] = 0x2735;
  18532. t['a49'] = 0x2736;
  18533. t['a50'] = 0x2737;
  18534. t['a51'] = 0x2738;
  18535. t['a52'] = 0x2739;
  18536. t['a53'] = 0x273A;
  18537. t['a54'] = 0x273B;
  18538. t['a55'] = 0x273C;
  18539. t['a56'] = 0x273D;
  18540. t['a57'] = 0x273E;
  18541. t['a58'] = 0x273F;
  18542. t['a59'] = 0x2740;
  18543. t['a60'] = 0x2741;
  18544. t['a61'] = 0x2742;
  18545. t['a62'] = 0x2743;
  18546. t['a63'] = 0x2744;
  18547. t['a64'] = 0x2745;
  18548. t['a65'] = 0x2746;
  18549. t['a66'] = 0x2747;
  18550. t['a67'] = 0x2748;
  18551. t['a68'] = 0x2749;
  18552. t['a69'] = 0x274A;
  18553. t['a70'] = 0x274B;
  18554. t['a71'] = 0x25CF;
  18555. t['a72'] = 0x274D;
  18556. t['a73'] = 0x25A0;
  18557. t['a74'] = 0x274F;
  18558. t['a203'] = 0x2750;
  18559. t['a75'] = 0x2751;
  18560. t['a204'] = 0x2752;
  18561. t['a76'] = 0x25B2;
  18562. t['a77'] = 0x25BC;
  18563. t['a78'] = 0x25C6;
  18564. t['a79'] = 0x2756;
  18565. t['a81'] = 0x25D7;
  18566. t['a82'] = 0x2758;
  18567. t['a83'] = 0x2759;
  18568. t['a84'] = 0x275A;
  18569. t['a97'] = 0x275B;
  18570. t['a98'] = 0x275C;
  18571. t['a99'] = 0x275D;
  18572. t['a100'] = 0x275E;
  18573. t['a101'] = 0x2761;
  18574. t['a102'] = 0x2762;
  18575. t['a103'] = 0x2763;
  18576. t['a104'] = 0x2764;
  18577. t['a106'] = 0x2765;
  18578. t['a107'] = 0x2766;
  18579. t['a108'] = 0x2767;
  18580. t['a112'] = 0x2663;
  18581. t['a111'] = 0x2666;
  18582. t['a110'] = 0x2665;
  18583. t['a109'] = 0x2660;
  18584. t['a120'] = 0x2460;
  18585. t['a121'] = 0x2461;
  18586. t['a122'] = 0x2462;
  18587. t['a123'] = 0x2463;
  18588. t['a124'] = 0x2464;
  18589. t['a125'] = 0x2465;
  18590. t['a126'] = 0x2466;
  18591. t['a127'] = 0x2467;
  18592. t['a128'] = 0x2468;
  18593. t['a129'] = 0x2469;
  18594. t['a130'] = 0x2776;
  18595. t['a131'] = 0x2777;
  18596. t['a132'] = 0x2778;
  18597. t['a133'] = 0x2779;
  18598. t['a134'] = 0x277A;
  18599. t['a135'] = 0x277B;
  18600. t['a136'] = 0x277C;
  18601. t['a137'] = 0x277D;
  18602. t['a138'] = 0x277E;
  18603. t['a139'] = 0x277F;
  18604. t['a140'] = 0x2780;
  18605. t['a141'] = 0x2781;
  18606. t['a142'] = 0x2782;
  18607. t['a143'] = 0x2783;
  18608. t['a144'] = 0x2784;
  18609. t['a145'] = 0x2785;
  18610. t['a146'] = 0x2786;
  18611. t['a147'] = 0x2787;
  18612. t['a148'] = 0x2788;
  18613. t['a149'] = 0x2789;
  18614. t['a150'] = 0x278A;
  18615. t['a151'] = 0x278B;
  18616. t['a152'] = 0x278C;
  18617. t['a153'] = 0x278D;
  18618. t['a154'] = 0x278E;
  18619. t['a155'] = 0x278F;
  18620. t['a156'] = 0x2790;
  18621. t['a157'] = 0x2791;
  18622. t['a158'] = 0x2792;
  18623. t['a159'] = 0x2793;
  18624. t['a160'] = 0x2794;
  18625. t['a161'] = 0x2192;
  18626. t['a163'] = 0x2194;
  18627. t['a164'] = 0x2195;
  18628. t['a196'] = 0x2798;
  18629. t['a165'] = 0x2799;
  18630. t['a192'] = 0x279A;
  18631. t['a166'] = 0x279B;
  18632. t['a167'] = 0x279C;
  18633. t['a168'] = 0x279D;
  18634. t['a169'] = 0x279E;
  18635. t['a170'] = 0x279F;
  18636. t['a171'] = 0x27A0;
  18637. t['a172'] = 0x27A1;
  18638. t['a173'] = 0x27A2;
  18639. t['a162'] = 0x27A3;
  18640. t['a174'] = 0x27A4;
  18641. t['a175'] = 0x27A5;
  18642. t['a176'] = 0x27A6;
  18643. t['a177'] = 0x27A7;
  18644. t['a178'] = 0x27A8;
  18645. t['a179'] = 0x27A9;
  18646. t['a193'] = 0x27AA;
  18647. t['a180'] = 0x27AB;
  18648. t['a199'] = 0x27AC;
  18649. t['a181'] = 0x27AD;
  18650. t['a200'] = 0x27AE;
  18651. t['a182'] = 0x27AF;
  18652. t['a201'] = 0x27B1;
  18653. t['a183'] = 0x27B2;
  18654. t['a184'] = 0x27B3;
  18655. t['a197'] = 0x27B4;
  18656. t['a185'] = 0x27B5;
  18657. t['a194'] = 0x27B6;
  18658. t['a198'] = 0x27B7;
  18659. t['a186'] = 0x27B8;
  18660. t['a195'] = 0x27B9;
  18661. t['a187'] = 0x27BA;
  18662. t['a188'] = 0x27BB;
  18663. t['a189'] = 0x27BC;
  18664. t['a190'] = 0x27BD;
  18665. t['a191'] = 0x27BE;
  18666. t['a89'] = 0x2768;
  18667. t['a90'] = 0x2769;
  18668. t['a93'] = 0x276A;
  18669. t['a94'] = 0x276B;
  18670. t['a91'] = 0x276C;
  18671. t['a92'] = 0x276D;
  18672. t['a205'] = 0x276E;
  18673. t['a85'] = 0x276F;
  18674. t['a206'] = 0x2770;
  18675. t['a86'] = 0x2771;
  18676. t['a87'] = 0x2772;
  18677. t['a88'] = 0x2773;
  18678. t['a95'] = 0x2774;
  18679. t['a96'] = 0x2775;
  18680. t['.notdef'] = 0x0000;
  18681. });
  18682. exports.getGlyphsUnicode = getGlyphsUnicode;
  18683. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  18684. /***/ }),
  18685. /* 8 */
  18686. /***/ (function(module, exports, __w_pdfjs_require__) {
  18687. "use strict";
  18688. var sharedUtil = __w_pdfjs_require__(0);
  18689. var corePrimitives = __w_pdfjs_require__(1);
  18690. var corePdfManager = __w_pdfjs_require__(33);
  18691. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  18692. var InvalidPDFException = sharedUtil.InvalidPDFException;
  18693. var MessageHandler = sharedUtil.MessageHandler;
  18694. var MissingPDFException = sharedUtil.MissingPDFException;
  18695. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  18696. var PasswordException = sharedUtil.PasswordException;
  18697. var UnknownErrorException = sharedUtil.UnknownErrorException;
  18698. var XRefParseException = sharedUtil.XRefParseException;
  18699. var arrayByteLength = sharedUtil.arrayByteLength;
  18700. var arraysToBytes = sharedUtil.arraysToBytes;
  18701. var assert = sharedUtil.assert;
  18702. var createPromiseCapability = sharedUtil.createPromiseCapability;
  18703. var error = sharedUtil.error;
  18704. var info = sharedUtil.info;
  18705. var warn = sharedUtil.warn;
  18706. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  18707. var isNodeJS = sharedUtil.isNodeJS;
  18708. var Ref = corePrimitives.Ref;
  18709. var LocalPdfManager = corePdfManager.LocalPdfManager;
  18710. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  18711. var globalScope = sharedUtil.globalScope;
  18712. var WorkerTask = function WorkerTaskClosure() {
  18713. function WorkerTask(name) {
  18714. this.name = name;
  18715. this.terminated = false;
  18716. this._capability = createPromiseCapability();
  18717. }
  18718. WorkerTask.prototype = {
  18719. get finished() {
  18720. return this._capability.promise;
  18721. },
  18722. finish: function () {
  18723. this._capability.resolve();
  18724. },
  18725. terminate: function () {
  18726. this.terminated = true;
  18727. },
  18728. ensureNotTerminated: function () {
  18729. if (this.terminated) {
  18730. throw new Error('Worker task was terminated');
  18731. }
  18732. }
  18733. };
  18734. return WorkerTask;
  18735. }();
  18736. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  18737. function PDFWorkerStream(params, msgHandler) {
  18738. this._queuedChunks = [];
  18739. var initialData = params.initialData;
  18740. if (initialData && initialData.length > 0) {
  18741. this._queuedChunks.push(initialData);
  18742. }
  18743. this._msgHandler = msgHandler;
  18744. this._isRangeSupported = !params.disableRange;
  18745. this._isStreamingSupported = !params.disableStream;
  18746. this._contentLength = params.length;
  18747. this._fullRequestReader = null;
  18748. this._rangeReaders = [];
  18749. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  18750. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  18751. }
  18752. PDFWorkerStream.prototype = {
  18753. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  18754. if (args.begin === undefined) {
  18755. if (this._fullRequestReader) {
  18756. this._fullRequestReader._enqueue(args.chunk);
  18757. } else {
  18758. this._queuedChunks.push(args.chunk);
  18759. }
  18760. } else {
  18761. var found = this._rangeReaders.some(function (rangeReader) {
  18762. if (rangeReader._begin !== args.begin) {
  18763. return false;
  18764. }
  18765. rangeReader._enqueue(args.chunk);
  18766. return true;
  18767. });
  18768. assert(found);
  18769. }
  18770. },
  18771. _onProgress: function PDFWorkerStream_onProgress(evt) {
  18772. if (this._rangeReaders.length > 0) {
  18773. var firstReader = this._rangeReaders[0];
  18774. if (firstReader.onProgress) {
  18775. firstReader.onProgress({ loaded: evt.loaded });
  18776. }
  18777. }
  18778. },
  18779. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  18780. var i = this._rangeReaders.indexOf(reader);
  18781. if (i >= 0) {
  18782. this._rangeReaders.splice(i, 1);
  18783. }
  18784. },
  18785. getFullReader: function PDFWorkerStream_getFullReader() {
  18786. assert(!this._fullRequestReader);
  18787. var queuedChunks = this._queuedChunks;
  18788. this._queuedChunks = null;
  18789. return new PDFWorkerStreamReader(this, queuedChunks);
  18790. },
  18791. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  18792. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  18793. this._msgHandler.send('RequestDataRange', {
  18794. begin: begin,
  18795. end: end
  18796. });
  18797. this._rangeReaders.push(reader);
  18798. return reader;
  18799. },
  18800. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  18801. if (this._fullRequestReader) {
  18802. this._fullRequestReader.cancel(reason);
  18803. }
  18804. var readers = this._rangeReaders.slice(0);
  18805. readers.forEach(function (rangeReader) {
  18806. rangeReader.cancel(reason);
  18807. });
  18808. }
  18809. };
  18810. function PDFWorkerStreamReader(stream, queuedChunks) {
  18811. this._stream = stream;
  18812. this._done = false;
  18813. this._queuedChunks = queuedChunks || [];
  18814. this._requests = [];
  18815. this._headersReady = Promise.resolve();
  18816. stream._fullRequestReader = this;
  18817. this.onProgress = null;
  18818. }
  18819. PDFWorkerStreamReader.prototype = {
  18820. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  18821. if (this._done) {
  18822. return;
  18823. }
  18824. if (this._requests.length > 0) {
  18825. var requestCapability = this._requests.shift();
  18826. requestCapability.resolve({
  18827. value: chunk,
  18828. done: false
  18829. });
  18830. return;
  18831. }
  18832. this._queuedChunks.push(chunk);
  18833. },
  18834. get headersReady() {
  18835. return this._headersReady;
  18836. },
  18837. get isRangeSupported() {
  18838. return this._stream._isRangeSupported;
  18839. },
  18840. get isStreamingSupported() {
  18841. return this._stream._isStreamingSupported;
  18842. },
  18843. get contentLength() {
  18844. return this._stream._contentLength;
  18845. },
  18846. read: function PDFWorkerStreamReader_read() {
  18847. if (this._queuedChunks.length > 0) {
  18848. var chunk = this._queuedChunks.shift();
  18849. return Promise.resolve({
  18850. value: chunk,
  18851. done: false
  18852. });
  18853. }
  18854. if (this._done) {
  18855. return Promise.resolve({
  18856. value: undefined,
  18857. done: true
  18858. });
  18859. }
  18860. var requestCapability = createPromiseCapability();
  18861. this._requests.push(requestCapability);
  18862. return requestCapability.promise;
  18863. },
  18864. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18865. this._done = true;
  18866. this._requests.forEach(function (requestCapability) {
  18867. requestCapability.resolve({
  18868. value: undefined,
  18869. done: true
  18870. });
  18871. });
  18872. this._requests = [];
  18873. }
  18874. };
  18875. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18876. this._stream = stream;
  18877. this._begin = begin;
  18878. this._end = end;
  18879. this._queuedChunk = null;
  18880. this._requests = [];
  18881. this._done = false;
  18882. this.onProgress = null;
  18883. }
  18884. PDFWorkerStreamRangeReader.prototype = {
  18885. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18886. if (this._done) {
  18887. return;
  18888. }
  18889. if (this._requests.length === 0) {
  18890. this._queuedChunk = chunk;
  18891. } else {
  18892. var requestsCapability = this._requests.shift();
  18893. requestsCapability.resolve({
  18894. value: chunk,
  18895. done: false
  18896. });
  18897. this._requests.forEach(function (requestCapability) {
  18898. requestCapability.resolve({
  18899. value: undefined,
  18900. done: true
  18901. });
  18902. });
  18903. this._requests = [];
  18904. }
  18905. this._done = true;
  18906. this._stream._removeRangeReader(this);
  18907. },
  18908. get isStreamingSupported() {
  18909. return false;
  18910. },
  18911. read: function PDFWorkerStreamRangeReader_read() {
  18912. if (this._queuedChunk) {
  18913. return Promise.resolve({
  18914. value: this._queuedChunk,
  18915. done: false
  18916. });
  18917. }
  18918. if (this._done) {
  18919. return Promise.resolve({
  18920. value: undefined,
  18921. done: true
  18922. });
  18923. }
  18924. var requestCapability = createPromiseCapability();
  18925. this._requests.push(requestCapability);
  18926. return requestCapability.promise;
  18927. },
  18928. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18929. this._done = true;
  18930. this._requests.forEach(function (requestCapability) {
  18931. requestCapability.resolve({
  18932. value: undefined,
  18933. done: true
  18934. });
  18935. });
  18936. this._requests = [];
  18937. this._stream._removeRangeReader(this);
  18938. }
  18939. };
  18940. return PDFWorkerStream;
  18941. }();
  18942. var PDFNetworkStream;
  18943. function setPDFNetworkStreamClass(cls) {
  18944. PDFNetworkStream = cls;
  18945. }
  18946. var WorkerMessageHandler = {
  18947. setup: function wphSetup(handler, port) {
  18948. var testMessageProcessed = false;
  18949. handler.on('test', function wphSetupTest(data) {
  18950. if (testMessageProcessed) {
  18951. return;
  18952. }
  18953. testMessageProcessed = true;
  18954. if (!(data instanceof Uint8Array)) {
  18955. handler.send('test', 'main', false);
  18956. return;
  18957. }
  18958. var supportTransfers = data[0] === 255;
  18959. handler.postMessageTransfers = supportTransfers;
  18960. var xhr = new XMLHttpRequest();
  18961. var responseExists = 'response' in xhr;
  18962. try {
  18963. xhr.responseType;
  18964. } catch (e) {
  18965. responseExists = false;
  18966. }
  18967. if (!responseExists) {
  18968. handler.send('test', false);
  18969. return;
  18970. }
  18971. handler.send('test', {
  18972. supportTypedArray: true,
  18973. supportTransfers: supportTransfers
  18974. });
  18975. });
  18976. handler.on('configure', function wphConfigure(data) {
  18977. setVerbosityLevel(data.verbosity);
  18978. });
  18979. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18980. return WorkerMessageHandler.createDocumentHandler(data, port);
  18981. });
  18982. },
  18983. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18984. var pdfManager;
  18985. var terminated = false;
  18986. var cancelXHRs = null;
  18987. var WorkerTasks = [];
  18988. var docId = docParams.docId;
  18989. var docBaseUrl = docParams.docBaseUrl;
  18990. var workerHandlerName = docParams.docId + '_worker';
  18991. var handler = new MessageHandler(workerHandlerName, docId, port);
  18992. handler.postMessageTransfers = docParams.postMessageTransfers;
  18993. function ensureNotTerminated() {
  18994. if (terminated) {
  18995. throw new Error('Worker was terminated');
  18996. }
  18997. }
  18998. function startWorkerTask(task) {
  18999. WorkerTasks.push(task);
  19000. }
  19001. function finishWorkerTask(task) {
  19002. task.finish();
  19003. var i = WorkerTasks.indexOf(task);
  19004. WorkerTasks.splice(i, 1);
  19005. }
  19006. function loadDocument(recoveryMode) {
  19007. var loadDocumentCapability = createPromiseCapability();
  19008. var parseSuccess = function parseSuccess() {
  19009. var numPagesPromise = pdfManager.ensureDoc('numPages');
  19010. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  19011. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  19012. Promise.all([
  19013. numPagesPromise,
  19014. fingerprintPromise,
  19015. encryptedPromise
  19016. ]).then(function onDocReady(results) {
  19017. var doc = {
  19018. numPages: results[0],
  19019. fingerprint: results[1],
  19020. encrypted: !!results[2]
  19021. };
  19022. loadDocumentCapability.resolve(doc);
  19023. }, parseFailure);
  19024. };
  19025. var parseFailure = function parseFailure(e) {
  19026. loadDocumentCapability.reject(e);
  19027. };
  19028. pdfManager.ensureDoc('checkHeader', []).then(function () {
  19029. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  19030. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  19031. }, parseFailure);
  19032. }, parseFailure);
  19033. return loadDocumentCapability.promise;
  19034. }
  19035. function getPdfManager(data, evaluatorOptions) {
  19036. var pdfManagerCapability = createPromiseCapability();
  19037. var pdfManager;
  19038. var source = data.source;
  19039. if (source.data) {
  19040. try {
  19041. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  19042. pdfManagerCapability.resolve(pdfManager);
  19043. } catch (ex) {
  19044. pdfManagerCapability.reject(ex);
  19045. }
  19046. return pdfManagerCapability.promise;
  19047. }
  19048. var pdfStream;
  19049. try {
  19050. if (source.chunkedViewerLoading) {
  19051. pdfStream = new PDFWorkerStream(source, handler);
  19052. } else {
  19053. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  19054. pdfStream = new PDFNetworkStream(data);
  19055. }
  19056. } catch (ex) {
  19057. pdfManagerCapability.reject(ex);
  19058. return pdfManagerCapability.promise;
  19059. }
  19060. var fullRequest = pdfStream.getFullReader();
  19061. fullRequest.headersReady.then(function () {
  19062. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  19063. fullRequest.onProgress = function (evt) {
  19064. handler.send('DocProgress', {
  19065. loaded: evt.loaded,
  19066. total: evt.total
  19067. });
  19068. };
  19069. }
  19070. if (!fullRequest.isRangeSupported) {
  19071. return;
  19072. }
  19073. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  19074. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  19075. msgHandler: handler,
  19076. url: source.url,
  19077. password: source.password,
  19078. length: fullRequest.contentLength,
  19079. disableAutoFetch: disableAutoFetch,
  19080. rangeChunkSize: source.rangeChunkSize
  19081. }, evaluatorOptions, docBaseUrl);
  19082. pdfManagerCapability.resolve(pdfManager);
  19083. cancelXHRs = null;
  19084. }).catch(function (reason) {
  19085. pdfManagerCapability.reject(reason);
  19086. cancelXHRs = null;
  19087. });
  19088. var cachedChunks = [], loaded = 0;
  19089. var flushChunks = function () {
  19090. var pdfFile = arraysToBytes(cachedChunks);
  19091. if (source.length && pdfFile.length !== source.length) {
  19092. warn('reported HTTP length is different from actual');
  19093. }
  19094. try {
  19095. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  19096. pdfManagerCapability.resolve(pdfManager);
  19097. } catch (ex) {
  19098. pdfManagerCapability.reject(ex);
  19099. }
  19100. cachedChunks = [];
  19101. };
  19102. var readPromise = new Promise(function (resolve, reject) {
  19103. var readChunk = function (chunk) {
  19104. try {
  19105. ensureNotTerminated();
  19106. if (chunk.done) {
  19107. if (!pdfManager) {
  19108. flushChunks();
  19109. }
  19110. cancelXHRs = null;
  19111. return;
  19112. }
  19113. var data = chunk.value;
  19114. loaded += arrayByteLength(data);
  19115. if (!fullRequest.isStreamingSupported) {
  19116. handler.send('DocProgress', {
  19117. loaded: loaded,
  19118. total: Math.max(loaded, fullRequest.contentLength || 0)
  19119. });
  19120. }
  19121. if (pdfManager) {
  19122. pdfManager.sendProgressiveData(data);
  19123. } else {
  19124. cachedChunks.push(data);
  19125. }
  19126. fullRequest.read().then(readChunk, reject);
  19127. } catch (e) {
  19128. reject(e);
  19129. }
  19130. };
  19131. fullRequest.read().then(readChunk, reject);
  19132. });
  19133. readPromise.catch(function (e) {
  19134. pdfManagerCapability.reject(e);
  19135. cancelXHRs = null;
  19136. });
  19137. cancelXHRs = function () {
  19138. pdfStream.cancelAllRequests('abort');
  19139. };
  19140. return pdfManagerCapability.promise;
  19141. }
  19142. function setupDoc(data) {
  19143. function onSuccess(doc) {
  19144. ensureNotTerminated();
  19145. handler.send('GetDoc', { pdfInfo: doc });
  19146. }
  19147. function onFailure(e) {
  19148. if (e instanceof PasswordException) {
  19149. var task = new WorkerTask('PasswordException: response ' + e.code);
  19150. startWorkerTask(task);
  19151. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  19152. finishWorkerTask(task);
  19153. pdfManager.updatePassword(data.password);
  19154. pdfManagerReady();
  19155. }).catch(function (ex) {
  19156. finishWorkerTask(task);
  19157. handler.send('PasswordException', ex);
  19158. }.bind(null, e));
  19159. } else if (e instanceof InvalidPDFException) {
  19160. handler.send('InvalidPDF', e);
  19161. } else if (e instanceof MissingPDFException) {
  19162. handler.send('MissingPDF', e);
  19163. } else if (e instanceof UnexpectedResponseException) {
  19164. handler.send('UnexpectedResponse', e);
  19165. } else {
  19166. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  19167. }
  19168. }
  19169. function pdfManagerReady() {
  19170. ensureNotTerminated();
  19171. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  19172. ensureNotTerminated();
  19173. if (!(ex instanceof XRefParseException)) {
  19174. onFailure(ex);
  19175. return;
  19176. }
  19177. pdfManager.requestLoadedStream();
  19178. pdfManager.onLoadedStream().then(function () {
  19179. ensureNotTerminated();
  19180. loadDocument(true).then(onSuccess, onFailure);
  19181. });
  19182. }, onFailure);
  19183. }
  19184. ensureNotTerminated();
  19185. var evaluatorOptions = {
  19186. forceDataSchema: data.disableCreateObjectURL,
  19187. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  19188. disableFontFace: data.disableFontFace,
  19189. disableNativeImageDecoder: data.disableNativeImageDecoder
  19190. };
  19191. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  19192. if (terminated) {
  19193. newPdfManager.terminate();
  19194. throw new Error('Worker was terminated');
  19195. }
  19196. pdfManager = newPdfManager;
  19197. handler.send('PDFManagerReady', null);
  19198. pdfManager.onLoadedStream().then(function (stream) {
  19199. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  19200. });
  19201. }).then(pdfManagerReady, onFailure);
  19202. }
  19203. handler.on('GetPage', function wphSetupGetPage(data) {
  19204. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19205. var rotatePromise = pdfManager.ensure(page, 'rotate');
  19206. var refPromise = pdfManager.ensure(page, 'ref');
  19207. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  19208. var viewPromise = pdfManager.ensure(page, 'view');
  19209. return Promise.all([
  19210. rotatePromise,
  19211. refPromise,
  19212. userUnitPromise,
  19213. viewPromise
  19214. ]).then(function (results) {
  19215. return {
  19216. rotate: results[0],
  19217. ref: results[1],
  19218. userUnit: results[2],
  19219. view: results[3]
  19220. };
  19221. });
  19222. });
  19223. });
  19224. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  19225. var ref = new Ref(data.ref.num, data.ref.gen);
  19226. var catalog = pdfManager.pdfDocument.catalog;
  19227. return catalog.getPageIndex(ref);
  19228. });
  19229. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  19230. return pdfManager.ensureCatalog('destinations');
  19231. });
  19232. handler.on('GetDestination', function wphSetupGetDestination(data) {
  19233. return pdfManager.ensureCatalog('getDestination', [data.id]);
  19234. });
  19235. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  19236. return pdfManager.ensureCatalog('pageLabels');
  19237. });
  19238. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  19239. return pdfManager.ensureCatalog('attachments');
  19240. });
  19241. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  19242. return pdfManager.ensureCatalog('javaScript');
  19243. });
  19244. handler.on('GetOutline', function wphSetupGetOutline(data) {
  19245. return pdfManager.ensureCatalog('documentOutline');
  19246. });
  19247. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  19248. return Promise.all([
  19249. pdfManager.ensureDoc('documentInfo'),
  19250. pdfManager.ensureCatalog('metadata')
  19251. ]);
  19252. });
  19253. handler.on('GetData', function wphSetupGetData(data) {
  19254. pdfManager.requestLoadedStream();
  19255. return pdfManager.onLoadedStream().then(function (stream) {
  19256. return stream.bytes;
  19257. });
  19258. });
  19259. handler.on('GetStats', function wphSetupGetStats(data) {
  19260. return pdfManager.pdfDocument.xref.stats;
  19261. });
  19262. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  19263. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19264. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  19265. });
  19266. });
  19267. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  19268. var pageIndex = data.pageIndex;
  19269. pdfManager.getPage(pageIndex).then(function (page) {
  19270. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  19271. startWorkerTask(task);
  19272. var pageNum = pageIndex + 1;
  19273. var start = Date.now();
  19274. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  19275. finishWorkerTask(task);
  19276. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  19277. }, function (e) {
  19278. finishWorkerTask(task);
  19279. if (task.terminated) {
  19280. return;
  19281. }
  19282. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  19283. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  19284. var wrappedException;
  19285. if (typeof e === 'string') {
  19286. wrappedException = {
  19287. message: e,
  19288. stack: minimumStackMessage
  19289. };
  19290. } else if (typeof e === 'object') {
  19291. wrappedException = {
  19292. message: e.message || e.toString(),
  19293. stack: e.stack || minimumStackMessage
  19294. };
  19295. } else {
  19296. wrappedException = {
  19297. message: 'Unknown exception type: ' + typeof e,
  19298. stack: minimumStackMessage
  19299. };
  19300. }
  19301. handler.send('PageError', {
  19302. pageNum: pageNum,
  19303. error: wrappedException,
  19304. intent: data.intent
  19305. });
  19306. });
  19307. });
  19308. }, this);
  19309. handler.on('GetTextContent', function wphExtractText(data) {
  19310. var pageIndex = data.pageIndex;
  19311. var normalizeWhitespace = data.normalizeWhitespace;
  19312. var combineTextItems = data.combineTextItems;
  19313. return pdfManager.getPage(pageIndex).then(function (page) {
  19314. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  19315. startWorkerTask(task);
  19316. var pageNum = pageIndex + 1;
  19317. var start = Date.now();
  19318. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  19319. finishWorkerTask(task);
  19320. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  19321. return textContent;
  19322. }, function (reason) {
  19323. finishWorkerTask(task);
  19324. if (task.terminated) {
  19325. return;
  19326. }
  19327. throw reason;
  19328. });
  19329. });
  19330. });
  19331. handler.on('Cleanup', function wphCleanup(data) {
  19332. return pdfManager.cleanup();
  19333. });
  19334. handler.on('Terminate', function wphTerminate(data) {
  19335. terminated = true;
  19336. if (pdfManager) {
  19337. pdfManager.terminate();
  19338. pdfManager = null;
  19339. }
  19340. if (cancelXHRs) {
  19341. cancelXHRs();
  19342. }
  19343. var waitOn = [];
  19344. WorkerTasks.forEach(function (task) {
  19345. waitOn.push(task.finished);
  19346. task.terminate();
  19347. });
  19348. return Promise.all(waitOn).then(function () {
  19349. handler.destroy();
  19350. handler = null;
  19351. });
  19352. });
  19353. handler.on('Ready', function wphReady(data) {
  19354. setupDoc(docParams);
  19355. docParams = null;
  19356. });
  19357. return workerHandlerName;
  19358. }
  19359. };
  19360. function initializeWorker() {
  19361. if (!('console' in globalScope)) {
  19362. var consoleTimer = {};
  19363. var workerConsole = {
  19364. log: function log() {
  19365. var args = Array.prototype.slice.call(arguments);
  19366. globalScope.postMessage({
  19367. targetName: 'main',
  19368. action: 'console_log',
  19369. data: args
  19370. });
  19371. },
  19372. error: function error() {
  19373. var args = Array.prototype.slice.call(arguments);
  19374. globalScope.postMessage({
  19375. targetName: 'main',
  19376. action: 'console_error',
  19377. data: args
  19378. });
  19379. throw 'pdf.js execution error';
  19380. },
  19381. time: function time(name) {
  19382. consoleTimer[name] = Date.now();
  19383. },
  19384. timeEnd: function timeEnd(name) {
  19385. var time = consoleTimer[name];
  19386. if (!time) {
  19387. error('Unknown timer name ' + name);
  19388. }
  19389. this.log('Timer:', name, Date.now() - time);
  19390. }
  19391. };
  19392. globalScope.console = workerConsole;
  19393. }
  19394. var handler = new MessageHandler('worker', 'main', self);
  19395. WorkerMessageHandler.setup(handler, self);
  19396. handler.send('ready', null);
  19397. }
  19398. if (typeof window === 'undefined' && !isNodeJS()) {
  19399. initializeWorker();
  19400. }
  19401. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  19402. exports.WorkerTask = WorkerTask;
  19403. exports.WorkerMessageHandler = WorkerMessageHandler;
  19404. /***/ }),
  19405. /* 9 */
  19406. /***/ (function(module, exports, __w_pdfjs_require__) {
  19407. "use strict";
  19408. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  19409. var QeTable = [
  19410. {
  19411. qe: 0x5601,
  19412. nmps: 1,
  19413. nlps: 1,
  19414. switchFlag: 1
  19415. },
  19416. {
  19417. qe: 0x3401,
  19418. nmps: 2,
  19419. nlps: 6,
  19420. switchFlag: 0
  19421. },
  19422. {
  19423. qe: 0x1801,
  19424. nmps: 3,
  19425. nlps: 9,
  19426. switchFlag: 0
  19427. },
  19428. {
  19429. qe: 0x0AC1,
  19430. nmps: 4,
  19431. nlps: 12,
  19432. switchFlag: 0
  19433. },
  19434. {
  19435. qe: 0x0521,
  19436. nmps: 5,
  19437. nlps: 29,
  19438. switchFlag: 0
  19439. },
  19440. {
  19441. qe: 0x0221,
  19442. nmps: 38,
  19443. nlps: 33,
  19444. switchFlag: 0
  19445. },
  19446. {
  19447. qe: 0x5601,
  19448. nmps: 7,
  19449. nlps: 6,
  19450. switchFlag: 1
  19451. },
  19452. {
  19453. qe: 0x5401,
  19454. nmps: 8,
  19455. nlps: 14,
  19456. switchFlag: 0
  19457. },
  19458. {
  19459. qe: 0x4801,
  19460. nmps: 9,
  19461. nlps: 14,
  19462. switchFlag: 0
  19463. },
  19464. {
  19465. qe: 0x3801,
  19466. nmps: 10,
  19467. nlps: 14,
  19468. switchFlag: 0
  19469. },
  19470. {
  19471. qe: 0x3001,
  19472. nmps: 11,
  19473. nlps: 17,
  19474. switchFlag: 0
  19475. },
  19476. {
  19477. qe: 0x2401,
  19478. nmps: 12,
  19479. nlps: 18,
  19480. switchFlag: 0
  19481. },
  19482. {
  19483. qe: 0x1C01,
  19484. nmps: 13,
  19485. nlps: 20,
  19486. switchFlag: 0
  19487. },
  19488. {
  19489. qe: 0x1601,
  19490. nmps: 29,
  19491. nlps: 21,
  19492. switchFlag: 0
  19493. },
  19494. {
  19495. qe: 0x5601,
  19496. nmps: 15,
  19497. nlps: 14,
  19498. switchFlag: 1
  19499. },
  19500. {
  19501. qe: 0x5401,
  19502. nmps: 16,
  19503. nlps: 14,
  19504. switchFlag: 0
  19505. },
  19506. {
  19507. qe: 0x5101,
  19508. nmps: 17,
  19509. nlps: 15,
  19510. switchFlag: 0
  19511. },
  19512. {
  19513. qe: 0x4801,
  19514. nmps: 18,
  19515. nlps: 16,
  19516. switchFlag: 0
  19517. },
  19518. {
  19519. qe: 0x3801,
  19520. nmps: 19,
  19521. nlps: 17,
  19522. switchFlag: 0
  19523. },
  19524. {
  19525. qe: 0x3401,
  19526. nmps: 20,
  19527. nlps: 18,
  19528. switchFlag: 0
  19529. },
  19530. {
  19531. qe: 0x3001,
  19532. nmps: 21,
  19533. nlps: 19,
  19534. switchFlag: 0
  19535. },
  19536. {
  19537. qe: 0x2801,
  19538. nmps: 22,
  19539. nlps: 19,
  19540. switchFlag: 0
  19541. },
  19542. {
  19543. qe: 0x2401,
  19544. nmps: 23,
  19545. nlps: 20,
  19546. switchFlag: 0
  19547. },
  19548. {
  19549. qe: 0x2201,
  19550. nmps: 24,
  19551. nlps: 21,
  19552. switchFlag: 0
  19553. },
  19554. {
  19555. qe: 0x1C01,
  19556. nmps: 25,
  19557. nlps: 22,
  19558. switchFlag: 0
  19559. },
  19560. {
  19561. qe: 0x1801,
  19562. nmps: 26,
  19563. nlps: 23,
  19564. switchFlag: 0
  19565. },
  19566. {
  19567. qe: 0x1601,
  19568. nmps: 27,
  19569. nlps: 24,
  19570. switchFlag: 0
  19571. },
  19572. {
  19573. qe: 0x1401,
  19574. nmps: 28,
  19575. nlps: 25,
  19576. switchFlag: 0
  19577. },
  19578. {
  19579. qe: 0x1201,
  19580. nmps: 29,
  19581. nlps: 26,
  19582. switchFlag: 0
  19583. },
  19584. {
  19585. qe: 0x1101,
  19586. nmps: 30,
  19587. nlps: 27,
  19588. switchFlag: 0
  19589. },
  19590. {
  19591. qe: 0x0AC1,
  19592. nmps: 31,
  19593. nlps: 28,
  19594. switchFlag: 0
  19595. },
  19596. {
  19597. qe: 0x09C1,
  19598. nmps: 32,
  19599. nlps: 29,
  19600. switchFlag: 0
  19601. },
  19602. {
  19603. qe: 0x08A1,
  19604. nmps: 33,
  19605. nlps: 30,
  19606. switchFlag: 0
  19607. },
  19608. {
  19609. qe: 0x0521,
  19610. nmps: 34,
  19611. nlps: 31,
  19612. switchFlag: 0
  19613. },
  19614. {
  19615. qe: 0x0441,
  19616. nmps: 35,
  19617. nlps: 32,
  19618. switchFlag: 0
  19619. },
  19620. {
  19621. qe: 0x02A1,
  19622. nmps: 36,
  19623. nlps: 33,
  19624. switchFlag: 0
  19625. },
  19626. {
  19627. qe: 0x0221,
  19628. nmps: 37,
  19629. nlps: 34,
  19630. switchFlag: 0
  19631. },
  19632. {
  19633. qe: 0x0141,
  19634. nmps: 38,
  19635. nlps: 35,
  19636. switchFlag: 0
  19637. },
  19638. {
  19639. qe: 0x0111,
  19640. nmps: 39,
  19641. nlps: 36,
  19642. switchFlag: 0
  19643. },
  19644. {
  19645. qe: 0x0085,
  19646. nmps: 40,
  19647. nlps: 37,
  19648. switchFlag: 0
  19649. },
  19650. {
  19651. qe: 0x0049,
  19652. nmps: 41,
  19653. nlps: 38,
  19654. switchFlag: 0
  19655. },
  19656. {
  19657. qe: 0x0025,
  19658. nmps: 42,
  19659. nlps: 39,
  19660. switchFlag: 0
  19661. },
  19662. {
  19663. qe: 0x0015,
  19664. nmps: 43,
  19665. nlps: 40,
  19666. switchFlag: 0
  19667. },
  19668. {
  19669. qe: 0x0009,
  19670. nmps: 44,
  19671. nlps: 41,
  19672. switchFlag: 0
  19673. },
  19674. {
  19675. qe: 0x0005,
  19676. nmps: 45,
  19677. nlps: 42,
  19678. switchFlag: 0
  19679. },
  19680. {
  19681. qe: 0x0001,
  19682. nmps: 45,
  19683. nlps: 43,
  19684. switchFlag: 0
  19685. },
  19686. {
  19687. qe: 0x5601,
  19688. nmps: 46,
  19689. nlps: 46,
  19690. switchFlag: 0
  19691. }
  19692. ];
  19693. function ArithmeticDecoder(data, start, end) {
  19694. this.data = data;
  19695. this.bp = start;
  19696. this.dataEnd = end;
  19697. this.chigh = data[start];
  19698. this.clow = 0;
  19699. this.byteIn();
  19700. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  19701. this.clow = this.clow << 7 & 0xFFFF;
  19702. this.ct -= 7;
  19703. this.a = 0x8000;
  19704. }
  19705. ArithmeticDecoder.prototype = {
  19706. byteIn: function ArithmeticDecoder_byteIn() {
  19707. var data = this.data;
  19708. var bp = this.bp;
  19709. if (data[bp] === 0xFF) {
  19710. var b1 = data[bp + 1];
  19711. if (b1 > 0x8F) {
  19712. this.clow += 0xFF00;
  19713. this.ct = 8;
  19714. } else {
  19715. bp++;
  19716. this.clow += data[bp] << 9;
  19717. this.ct = 7;
  19718. this.bp = bp;
  19719. }
  19720. } else {
  19721. bp++;
  19722. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  19723. this.ct = 8;
  19724. this.bp = bp;
  19725. }
  19726. if (this.clow > 0xFFFF) {
  19727. this.chigh += this.clow >> 16;
  19728. this.clow &= 0xFFFF;
  19729. }
  19730. },
  19731. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  19732. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  19733. var qeTableIcx = QeTable[cx_index];
  19734. var qeIcx = qeTableIcx.qe;
  19735. var d;
  19736. var a = this.a - qeIcx;
  19737. if (this.chigh < qeIcx) {
  19738. if (a < qeIcx) {
  19739. a = qeIcx;
  19740. d = cx_mps;
  19741. cx_index = qeTableIcx.nmps;
  19742. } else {
  19743. a = qeIcx;
  19744. d = 1 ^ cx_mps;
  19745. if (qeTableIcx.switchFlag === 1) {
  19746. cx_mps = d;
  19747. }
  19748. cx_index = qeTableIcx.nlps;
  19749. }
  19750. } else {
  19751. this.chigh -= qeIcx;
  19752. if ((a & 0x8000) !== 0) {
  19753. this.a = a;
  19754. return cx_mps;
  19755. }
  19756. if (a < qeIcx) {
  19757. d = 1 ^ cx_mps;
  19758. if (qeTableIcx.switchFlag === 1) {
  19759. cx_mps = d;
  19760. }
  19761. cx_index = qeTableIcx.nlps;
  19762. } else {
  19763. d = cx_mps;
  19764. cx_index = qeTableIcx.nmps;
  19765. }
  19766. }
  19767. do {
  19768. if (this.ct === 0) {
  19769. this.byteIn();
  19770. }
  19771. a <<= 1;
  19772. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  19773. this.clow = this.clow << 1 & 0xFFFF;
  19774. this.ct--;
  19775. } while ((a & 0x8000) === 0);
  19776. this.a = a;
  19777. contexts[pos] = cx_index << 1 | cx_mps;
  19778. return d;
  19779. }
  19780. };
  19781. return ArithmeticDecoder;
  19782. }();
  19783. exports.ArithmeticDecoder = ArithmeticDecoder;
  19784. /***/ }),
  19785. /* 10 */
  19786. /***/ (function(module, exports, __w_pdfjs_require__) {
  19787. "use strict";
  19788. var sharedUtil = __w_pdfjs_require__(0);
  19789. var coreCharsets = __w_pdfjs_require__(22);
  19790. var coreEncodings = __w_pdfjs_require__(4);
  19791. var error = sharedUtil.error;
  19792. var info = sharedUtil.info;
  19793. var bytesToString = sharedUtil.bytesToString;
  19794. var warn = sharedUtil.warn;
  19795. var isArray = sharedUtil.isArray;
  19796. var Util = sharedUtil.Util;
  19797. var stringToBytes = sharedUtil.stringToBytes;
  19798. var assert = sharedUtil.assert;
  19799. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  19800. var ExpertCharset = coreCharsets.ExpertCharset;
  19801. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  19802. var StandardEncoding = coreEncodings.StandardEncoding;
  19803. var ExpertEncoding = coreEncodings.ExpertEncoding;
  19804. var MAX_SUBR_NESTING = 10;
  19805. var CFFStandardStrings = [
  19806. '.notdef',
  19807. 'space',
  19808. 'exclam',
  19809. 'quotedbl',
  19810. 'numbersign',
  19811. 'dollar',
  19812. 'percent',
  19813. 'ampersand',
  19814. 'quoteright',
  19815. 'parenleft',
  19816. 'parenright',
  19817. 'asterisk',
  19818. 'plus',
  19819. 'comma',
  19820. 'hyphen',
  19821. 'period',
  19822. 'slash',
  19823. 'zero',
  19824. 'one',
  19825. 'two',
  19826. 'three',
  19827. 'four',
  19828. 'five',
  19829. 'six',
  19830. 'seven',
  19831. 'eight',
  19832. 'nine',
  19833. 'colon',
  19834. 'semicolon',
  19835. 'less',
  19836. 'equal',
  19837. 'greater',
  19838. 'question',
  19839. 'at',
  19840. 'A',
  19841. 'B',
  19842. 'C',
  19843. 'D',
  19844. 'E',
  19845. 'F',
  19846. 'G',
  19847. 'H',
  19848. 'I',
  19849. 'J',
  19850. 'K',
  19851. 'L',
  19852. 'M',
  19853. 'N',
  19854. 'O',
  19855. 'P',
  19856. 'Q',
  19857. 'R',
  19858. 'S',
  19859. 'T',
  19860. 'U',
  19861. 'V',
  19862. 'W',
  19863. 'X',
  19864. 'Y',
  19865. 'Z',
  19866. 'bracketleft',
  19867. 'backslash',
  19868. 'bracketright',
  19869. 'asciicircum',
  19870. 'underscore',
  19871. 'quoteleft',
  19872. 'a',
  19873. 'b',
  19874. 'c',
  19875. 'd',
  19876. 'e',
  19877. 'f',
  19878. 'g',
  19879. 'h',
  19880. 'i',
  19881. 'j',
  19882. 'k',
  19883. 'l',
  19884. 'm',
  19885. 'n',
  19886. 'o',
  19887. 'p',
  19888. 'q',
  19889. 'r',
  19890. 's',
  19891. 't',
  19892. 'u',
  19893. 'v',
  19894. 'w',
  19895. 'x',
  19896. 'y',
  19897. 'z',
  19898. 'braceleft',
  19899. 'bar',
  19900. 'braceright',
  19901. 'asciitilde',
  19902. 'exclamdown',
  19903. 'cent',
  19904. 'sterling',
  19905. 'fraction',
  19906. 'yen',
  19907. 'florin',
  19908. 'section',
  19909. 'currency',
  19910. 'quotesingle',
  19911. 'quotedblleft',
  19912. 'guillemotleft',
  19913. 'guilsinglleft',
  19914. 'guilsinglright',
  19915. 'fi',
  19916. 'fl',
  19917. 'endash',
  19918. 'dagger',
  19919. 'daggerdbl',
  19920. 'periodcentered',
  19921. 'paragraph',
  19922. 'bullet',
  19923. 'quotesinglbase',
  19924. 'quotedblbase',
  19925. 'quotedblright',
  19926. 'guillemotright',
  19927. 'ellipsis',
  19928. 'perthousand',
  19929. 'questiondown',
  19930. 'grave',
  19931. 'acute',
  19932. 'circumflex',
  19933. 'tilde',
  19934. 'macron',
  19935. 'breve',
  19936. 'dotaccent',
  19937. 'dieresis',
  19938. 'ring',
  19939. 'cedilla',
  19940. 'hungarumlaut',
  19941. 'ogonek',
  19942. 'caron',
  19943. 'emdash',
  19944. 'AE',
  19945. 'ordfeminine',
  19946. 'Lslash',
  19947. 'Oslash',
  19948. 'OE',
  19949. 'ordmasculine',
  19950. 'ae',
  19951. 'dotlessi',
  19952. 'lslash',
  19953. 'oslash',
  19954. 'oe',
  19955. 'germandbls',
  19956. 'onesuperior',
  19957. 'logicalnot',
  19958. 'mu',
  19959. 'trademark',
  19960. 'Eth',
  19961. 'onehalf',
  19962. 'plusminus',
  19963. 'Thorn',
  19964. 'onequarter',
  19965. 'divide',
  19966. 'brokenbar',
  19967. 'degree',
  19968. 'thorn',
  19969. 'threequarters',
  19970. 'twosuperior',
  19971. 'registered',
  19972. 'minus',
  19973. 'eth',
  19974. 'multiply',
  19975. 'threesuperior',
  19976. 'copyright',
  19977. 'Aacute',
  19978. 'Acircumflex',
  19979. 'Adieresis',
  19980. 'Agrave',
  19981. 'Aring',
  19982. 'Atilde',
  19983. 'Ccedilla',
  19984. 'Eacute',
  19985. 'Ecircumflex',
  19986. 'Edieresis',
  19987. 'Egrave',
  19988. 'Iacute',
  19989. 'Icircumflex',
  19990. 'Idieresis',
  19991. 'Igrave',
  19992. 'Ntilde',
  19993. 'Oacute',
  19994. 'Ocircumflex',
  19995. 'Odieresis',
  19996. 'Ograve',
  19997. 'Otilde',
  19998. 'Scaron',
  19999. 'Uacute',
  20000. 'Ucircumflex',
  20001. 'Udieresis',
  20002. 'Ugrave',
  20003. 'Yacute',
  20004. 'Ydieresis',
  20005. 'Zcaron',
  20006. 'aacute',
  20007. 'acircumflex',
  20008. 'adieresis',
  20009. 'agrave',
  20010. 'aring',
  20011. 'atilde',
  20012. 'ccedilla',
  20013. 'eacute',
  20014. 'ecircumflex',
  20015. 'edieresis',
  20016. 'egrave',
  20017. 'iacute',
  20018. 'icircumflex',
  20019. 'idieresis',
  20020. 'igrave',
  20021. 'ntilde',
  20022. 'oacute',
  20023. 'ocircumflex',
  20024. 'odieresis',
  20025. 'ograve',
  20026. 'otilde',
  20027. 'scaron',
  20028. 'uacute',
  20029. 'ucircumflex',
  20030. 'udieresis',
  20031. 'ugrave',
  20032. 'yacute',
  20033. 'ydieresis',
  20034. 'zcaron',
  20035. 'exclamsmall',
  20036. 'Hungarumlautsmall',
  20037. 'dollaroldstyle',
  20038. 'dollarsuperior',
  20039. 'ampersandsmall',
  20040. 'Acutesmall',
  20041. 'parenleftsuperior',
  20042. 'parenrightsuperior',
  20043. 'twodotenleader',
  20044. 'onedotenleader',
  20045. 'zerooldstyle',
  20046. 'oneoldstyle',
  20047. 'twooldstyle',
  20048. 'threeoldstyle',
  20049. 'fouroldstyle',
  20050. 'fiveoldstyle',
  20051. 'sixoldstyle',
  20052. 'sevenoldstyle',
  20053. 'eightoldstyle',
  20054. 'nineoldstyle',
  20055. 'commasuperior',
  20056. 'threequartersemdash',
  20057. 'periodsuperior',
  20058. 'questionsmall',
  20059. 'asuperior',
  20060. 'bsuperior',
  20061. 'centsuperior',
  20062. 'dsuperior',
  20063. 'esuperior',
  20064. 'isuperior',
  20065. 'lsuperior',
  20066. 'msuperior',
  20067. 'nsuperior',
  20068. 'osuperior',
  20069. 'rsuperior',
  20070. 'ssuperior',
  20071. 'tsuperior',
  20072. 'ff',
  20073. 'ffi',
  20074. 'ffl',
  20075. 'parenleftinferior',
  20076. 'parenrightinferior',
  20077. 'Circumflexsmall',
  20078. 'hyphensuperior',
  20079. 'Gravesmall',
  20080. 'Asmall',
  20081. 'Bsmall',
  20082. 'Csmall',
  20083. 'Dsmall',
  20084. 'Esmall',
  20085. 'Fsmall',
  20086. 'Gsmall',
  20087. 'Hsmall',
  20088. 'Ismall',
  20089. 'Jsmall',
  20090. 'Ksmall',
  20091. 'Lsmall',
  20092. 'Msmall',
  20093. 'Nsmall',
  20094. 'Osmall',
  20095. 'Psmall',
  20096. 'Qsmall',
  20097. 'Rsmall',
  20098. 'Ssmall',
  20099. 'Tsmall',
  20100. 'Usmall',
  20101. 'Vsmall',
  20102. 'Wsmall',
  20103. 'Xsmall',
  20104. 'Ysmall',
  20105. 'Zsmall',
  20106. 'colonmonetary',
  20107. 'onefitted',
  20108. 'rupiah',
  20109. 'Tildesmall',
  20110. 'exclamdownsmall',
  20111. 'centoldstyle',
  20112. 'Lslashsmall',
  20113. 'Scaronsmall',
  20114. 'Zcaronsmall',
  20115. 'Dieresissmall',
  20116. 'Brevesmall',
  20117. 'Caronsmall',
  20118. 'Dotaccentsmall',
  20119. 'Macronsmall',
  20120. 'figuredash',
  20121. 'hypheninferior',
  20122. 'Ogoneksmall',
  20123. 'Ringsmall',
  20124. 'Cedillasmall',
  20125. 'questiondownsmall',
  20126. 'oneeighth',
  20127. 'threeeighths',
  20128. 'fiveeighths',
  20129. 'seveneighths',
  20130. 'onethird',
  20131. 'twothirds',
  20132. 'zerosuperior',
  20133. 'foursuperior',
  20134. 'fivesuperior',
  20135. 'sixsuperior',
  20136. 'sevensuperior',
  20137. 'eightsuperior',
  20138. 'ninesuperior',
  20139. 'zeroinferior',
  20140. 'oneinferior',
  20141. 'twoinferior',
  20142. 'threeinferior',
  20143. 'fourinferior',
  20144. 'fiveinferior',
  20145. 'sixinferior',
  20146. 'seveninferior',
  20147. 'eightinferior',
  20148. 'nineinferior',
  20149. 'centinferior',
  20150. 'dollarinferior',
  20151. 'periodinferior',
  20152. 'commainferior',
  20153. 'Agravesmall',
  20154. 'Aacutesmall',
  20155. 'Acircumflexsmall',
  20156. 'Atildesmall',
  20157. 'Adieresissmall',
  20158. 'Aringsmall',
  20159. 'AEsmall',
  20160. 'Ccedillasmall',
  20161. 'Egravesmall',
  20162. 'Eacutesmall',
  20163. 'Ecircumflexsmall',
  20164. 'Edieresissmall',
  20165. 'Igravesmall',
  20166. 'Iacutesmall',
  20167. 'Icircumflexsmall',
  20168. 'Idieresissmall',
  20169. 'Ethsmall',
  20170. 'Ntildesmall',
  20171. 'Ogravesmall',
  20172. 'Oacutesmall',
  20173. 'Ocircumflexsmall',
  20174. 'Otildesmall',
  20175. 'Odieresissmall',
  20176. 'OEsmall',
  20177. 'Oslashsmall',
  20178. 'Ugravesmall',
  20179. 'Uacutesmall',
  20180. 'Ucircumflexsmall',
  20181. 'Udieresissmall',
  20182. 'Yacutesmall',
  20183. 'Thornsmall',
  20184. 'Ydieresissmall',
  20185. '001.000',
  20186. '001.001',
  20187. '001.002',
  20188. '001.003',
  20189. 'Black',
  20190. 'Bold',
  20191. 'Book',
  20192. 'Light',
  20193. 'Medium',
  20194. 'Regular',
  20195. 'Roman',
  20196. 'Semibold'
  20197. ];
  20198. var CFFParser = function CFFParserClosure() {
  20199. var CharstringValidationData = [
  20200. null,
  20201. {
  20202. id: 'hstem',
  20203. min: 2,
  20204. stackClearing: true,
  20205. stem: true
  20206. },
  20207. null,
  20208. {
  20209. id: 'vstem',
  20210. min: 2,
  20211. stackClearing: true,
  20212. stem: true
  20213. },
  20214. {
  20215. id: 'vmoveto',
  20216. min: 1,
  20217. stackClearing: true
  20218. },
  20219. {
  20220. id: 'rlineto',
  20221. min: 2,
  20222. resetStack: true
  20223. },
  20224. {
  20225. id: 'hlineto',
  20226. min: 1,
  20227. resetStack: true
  20228. },
  20229. {
  20230. id: 'vlineto',
  20231. min: 1,
  20232. resetStack: true
  20233. },
  20234. {
  20235. id: 'rrcurveto',
  20236. min: 6,
  20237. resetStack: true
  20238. },
  20239. null,
  20240. {
  20241. id: 'callsubr',
  20242. min: 1,
  20243. undefStack: true
  20244. },
  20245. {
  20246. id: 'return',
  20247. min: 0,
  20248. undefStack: true
  20249. },
  20250. null,
  20251. null,
  20252. {
  20253. id: 'endchar',
  20254. min: 0,
  20255. stackClearing: true
  20256. },
  20257. null,
  20258. null,
  20259. null,
  20260. {
  20261. id: 'hstemhm',
  20262. min: 2,
  20263. stackClearing: true,
  20264. stem: true
  20265. },
  20266. {
  20267. id: 'hintmask',
  20268. min: 0,
  20269. stackClearing: true
  20270. },
  20271. {
  20272. id: 'cntrmask',
  20273. min: 0,
  20274. stackClearing: true
  20275. },
  20276. {
  20277. id: 'rmoveto',
  20278. min: 2,
  20279. stackClearing: true
  20280. },
  20281. {
  20282. id: 'hmoveto',
  20283. min: 1,
  20284. stackClearing: true
  20285. },
  20286. {
  20287. id: 'vstemhm',
  20288. min: 2,
  20289. stackClearing: true,
  20290. stem: true
  20291. },
  20292. {
  20293. id: 'rcurveline',
  20294. min: 8,
  20295. resetStack: true
  20296. },
  20297. {
  20298. id: 'rlinecurve',
  20299. min: 8,
  20300. resetStack: true
  20301. },
  20302. {
  20303. id: 'vvcurveto',
  20304. min: 4,
  20305. resetStack: true
  20306. },
  20307. {
  20308. id: 'hhcurveto',
  20309. min: 4,
  20310. resetStack: true
  20311. },
  20312. null,
  20313. {
  20314. id: 'callgsubr',
  20315. min: 1,
  20316. undefStack: true
  20317. },
  20318. {
  20319. id: 'vhcurveto',
  20320. min: 4,
  20321. resetStack: true
  20322. },
  20323. {
  20324. id: 'hvcurveto',
  20325. min: 4,
  20326. resetStack: true
  20327. }
  20328. ];
  20329. var CharstringValidationData12 = [
  20330. null,
  20331. null,
  20332. null,
  20333. {
  20334. id: 'and',
  20335. min: 2,
  20336. stackDelta: -1
  20337. },
  20338. {
  20339. id: 'or',
  20340. min: 2,
  20341. stackDelta: -1
  20342. },
  20343. {
  20344. id: 'not',
  20345. min: 1,
  20346. stackDelta: 0
  20347. },
  20348. null,
  20349. null,
  20350. null,
  20351. {
  20352. id: 'abs',
  20353. min: 1,
  20354. stackDelta: 0
  20355. },
  20356. {
  20357. id: 'add',
  20358. min: 2,
  20359. stackDelta: -1,
  20360. stackFn: function stack_div(stack, index) {
  20361. stack[index - 2] = stack[index - 2] + stack[index - 1];
  20362. }
  20363. },
  20364. {
  20365. id: 'sub',
  20366. min: 2,
  20367. stackDelta: -1,
  20368. stackFn: function stack_div(stack, index) {
  20369. stack[index - 2] = stack[index - 2] - stack[index - 1];
  20370. }
  20371. },
  20372. {
  20373. id: 'div',
  20374. min: 2,
  20375. stackDelta: -1,
  20376. stackFn: function stack_div(stack, index) {
  20377. stack[index - 2] = stack[index - 2] / stack[index - 1];
  20378. }
  20379. },
  20380. null,
  20381. {
  20382. id: 'neg',
  20383. min: 1,
  20384. stackDelta: 0,
  20385. stackFn: function stack_div(stack, index) {
  20386. stack[index - 1] = -stack[index - 1];
  20387. }
  20388. },
  20389. {
  20390. id: 'eq',
  20391. min: 2,
  20392. stackDelta: -1
  20393. },
  20394. null,
  20395. null,
  20396. {
  20397. id: 'drop',
  20398. min: 1,
  20399. stackDelta: -1
  20400. },
  20401. null,
  20402. {
  20403. id: 'put',
  20404. min: 2,
  20405. stackDelta: -2
  20406. },
  20407. {
  20408. id: 'get',
  20409. min: 1,
  20410. stackDelta: 0
  20411. },
  20412. {
  20413. id: 'ifelse',
  20414. min: 4,
  20415. stackDelta: -3
  20416. },
  20417. {
  20418. id: 'random',
  20419. min: 0,
  20420. stackDelta: 1
  20421. },
  20422. {
  20423. id: 'mul',
  20424. min: 2,
  20425. stackDelta: -1,
  20426. stackFn: function stack_div(stack, index) {
  20427. stack[index - 2] = stack[index - 2] * stack[index - 1];
  20428. }
  20429. },
  20430. null,
  20431. {
  20432. id: 'sqrt',
  20433. min: 1,
  20434. stackDelta: 0
  20435. },
  20436. {
  20437. id: 'dup',
  20438. min: 1,
  20439. stackDelta: 1
  20440. },
  20441. {
  20442. id: 'exch',
  20443. min: 2,
  20444. stackDelta: 0
  20445. },
  20446. {
  20447. id: 'index',
  20448. min: 2,
  20449. stackDelta: 0
  20450. },
  20451. {
  20452. id: 'roll',
  20453. min: 3,
  20454. stackDelta: -2
  20455. },
  20456. null,
  20457. null,
  20458. null,
  20459. {
  20460. id: 'hflex',
  20461. min: 7,
  20462. resetStack: true
  20463. },
  20464. {
  20465. id: 'flex',
  20466. min: 13,
  20467. resetStack: true
  20468. },
  20469. {
  20470. id: 'hflex1',
  20471. min: 9,
  20472. resetStack: true
  20473. },
  20474. {
  20475. id: 'flex1',
  20476. min: 11,
  20477. resetStack: true
  20478. }
  20479. ];
  20480. function CFFParser(file, properties, seacAnalysisEnabled) {
  20481. this.bytes = file.getBytes();
  20482. this.properties = properties;
  20483. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  20484. }
  20485. CFFParser.prototype = {
  20486. parse: function CFFParser_parse() {
  20487. var properties = this.properties;
  20488. var cff = new CFF();
  20489. this.cff = cff;
  20490. var header = this.parseHeader();
  20491. var nameIndex = this.parseIndex(header.endPos);
  20492. var topDictIndex = this.parseIndex(nameIndex.endPos);
  20493. var stringIndex = this.parseIndex(topDictIndex.endPos);
  20494. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  20495. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  20496. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  20497. cff.header = header.obj;
  20498. cff.names = this.parseNameIndex(nameIndex.obj);
  20499. cff.strings = this.parseStringIndex(stringIndex.obj);
  20500. cff.topDict = topDict;
  20501. cff.globalSubrIndex = globalSubrIndex.obj;
  20502. this.parsePrivateDict(cff.topDict);
  20503. cff.isCIDFont = topDict.hasName('ROS');
  20504. var charStringOffset = topDict.getByName('CharStrings');
  20505. var charStringIndex = this.parseIndex(charStringOffset).obj;
  20506. var fontMatrix = topDict.getByName('FontMatrix');
  20507. if (fontMatrix) {
  20508. properties.fontMatrix = fontMatrix;
  20509. }
  20510. var fontBBox = topDict.getByName('FontBBox');
  20511. if (fontBBox) {
  20512. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  20513. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  20514. properties.ascentScaled = true;
  20515. }
  20516. var charset, encoding;
  20517. if (cff.isCIDFont) {
  20518. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  20519. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  20520. var dictRaw = fdArrayIndex.get(i);
  20521. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  20522. this.parsePrivateDict(fontDict);
  20523. cff.fdArray.push(fontDict);
  20524. }
  20525. encoding = null;
  20526. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  20527. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  20528. } else {
  20529. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  20530. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  20531. }
  20532. cff.charset = charset;
  20533. cff.encoding = encoding;
  20534. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  20535. cff.charStrings = charStringsAndSeacs.charStrings;
  20536. cff.seacs = charStringsAndSeacs.seacs;
  20537. cff.widths = charStringsAndSeacs.widths;
  20538. return cff;
  20539. },
  20540. parseHeader: function CFFParser_parseHeader() {
  20541. var bytes = this.bytes;
  20542. var bytesLength = bytes.length;
  20543. var offset = 0;
  20544. while (offset < bytesLength && bytes[offset] !== 1) {
  20545. ++offset;
  20546. }
  20547. if (offset >= bytesLength) {
  20548. error('Invalid CFF header');
  20549. } else if (offset !== 0) {
  20550. info('cff data is shifted');
  20551. bytes = bytes.subarray(offset);
  20552. this.bytes = bytes;
  20553. }
  20554. var major = bytes[0];
  20555. var minor = bytes[1];
  20556. var hdrSize = bytes[2];
  20557. var offSize = bytes[3];
  20558. var header = new CFFHeader(major, minor, hdrSize, offSize);
  20559. return {
  20560. obj: header,
  20561. endPos: hdrSize
  20562. };
  20563. },
  20564. parseDict: function CFFParser_parseDict(dict) {
  20565. var pos = 0;
  20566. function parseOperand() {
  20567. var value = dict[pos++];
  20568. if (value === 30) {
  20569. return parseFloatOperand();
  20570. } else if (value === 28) {
  20571. value = dict[pos++];
  20572. value = (value << 24 | dict[pos++] << 16) >> 16;
  20573. return value;
  20574. } else if (value === 29) {
  20575. value = dict[pos++];
  20576. value = value << 8 | dict[pos++];
  20577. value = value << 8 | dict[pos++];
  20578. value = value << 8 | dict[pos++];
  20579. return value;
  20580. } else if (value >= 32 && value <= 246) {
  20581. return value - 139;
  20582. } else if (value >= 247 && value <= 250) {
  20583. return (value - 247) * 256 + dict[pos++] + 108;
  20584. } else if (value >= 251 && value <= 254) {
  20585. return -((value - 251) * 256) - dict[pos++] - 108;
  20586. }
  20587. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  20588. return NaN;
  20589. }
  20590. function parseFloatOperand() {
  20591. var str = '';
  20592. var eof = 15;
  20593. var lookup = [
  20594. '0',
  20595. '1',
  20596. '2',
  20597. '3',
  20598. '4',
  20599. '5',
  20600. '6',
  20601. '7',
  20602. '8',
  20603. '9',
  20604. '.',
  20605. 'E',
  20606. 'E-',
  20607. null,
  20608. '-'
  20609. ];
  20610. var length = dict.length;
  20611. while (pos < length) {
  20612. var b = dict[pos++];
  20613. var b1 = b >> 4;
  20614. var b2 = b & 15;
  20615. if (b1 === eof) {
  20616. break;
  20617. }
  20618. str += lookup[b1];
  20619. if (b2 === eof) {
  20620. break;
  20621. }
  20622. str += lookup[b2];
  20623. }
  20624. return parseFloat(str);
  20625. }
  20626. var operands = [];
  20627. var entries = [];
  20628. pos = 0;
  20629. var end = dict.length;
  20630. while (pos < end) {
  20631. var b = dict[pos];
  20632. if (b <= 21) {
  20633. if (b === 12) {
  20634. b = b << 8 | dict[++pos];
  20635. }
  20636. entries.push([
  20637. b,
  20638. operands
  20639. ]);
  20640. operands = [];
  20641. ++pos;
  20642. } else {
  20643. operands.push(parseOperand());
  20644. }
  20645. }
  20646. return entries;
  20647. },
  20648. parseIndex: function CFFParser_parseIndex(pos) {
  20649. var cffIndex = new CFFIndex();
  20650. var bytes = this.bytes;
  20651. var count = bytes[pos++] << 8 | bytes[pos++];
  20652. var offsets = [];
  20653. var end = pos;
  20654. var i, ii;
  20655. if (count !== 0) {
  20656. var offsetSize = bytes[pos++];
  20657. var startPos = pos + (count + 1) * offsetSize - 1;
  20658. for (i = 0, ii = count + 1; i < ii; ++i) {
  20659. var offset = 0;
  20660. for (var j = 0; j < offsetSize; ++j) {
  20661. offset <<= 8;
  20662. offset += bytes[pos++];
  20663. }
  20664. offsets.push(startPos + offset);
  20665. }
  20666. end = offsets[count];
  20667. }
  20668. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  20669. var offsetStart = offsets[i];
  20670. var offsetEnd = offsets[i + 1];
  20671. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  20672. }
  20673. return {
  20674. obj: cffIndex,
  20675. endPos: end
  20676. };
  20677. },
  20678. parseNameIndex: function CFFParser_parseNameIndex(index) {
  20679. var names = [];
  20680. for (var i = 0, ii = index.count; i < ii; ++i) {
  20681. var name = index.get(i);
  20682. var length = Math.min(name.length, 127);
  20683. var data = [];
  20684. for (var j = 0; j < length; ++j) {
  20685. var c = name[j];
  20686. if (j === 0 && c === 0) {
  20687. data[j] = c;
  20688. continue;
  20689. }
  20690. 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) {
  20691. data[j] = 95;
  20692. continue;
  20693. }
  20694. data[j] = c;
  20695. }
  20696. names.push(bytesToString(data));
  20697. }
  20698. return names;
  20699. },
  20700. parseStringIndex: function CFFParser_parseStringIndex(index) {
  20701. var strings = new CFFStrings();
  20702. for (var i = 0, ii = index.count; i < ii; ++i) {
  20703. var data = index.get(i);
  20704. strings.add(bytesToString(data));
  20705. }
  20706. return strings;
  20707. },
  20708. createDict: function CFFParser_createDict(Type, dict, strings) {
  20709. var cffDict = new Type(strings);
  20710. for (var i = 0, ii = dict.length; i < ii; ++i) {
  20711. var pair = dict[i];
  20712. var key = pair[0];
  20713. var value = pair[1];
  20714. cffDict.setByKey(key, value);
  20715. }
  20716. return cffDict;
  20717. },
  20718. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  20719. if (state.callDepth > MAX_SUBR_NESTING) {
  20720. return false;
  20721. }
  20722. var stackSize = state.stackSize;
  20723. var stack = state.stack;
  20724. var length = data.length;
  20725. for (var j = 0; j < length;) {
  20726. var value = data[j++];
  20727. var validationCommand = null;
  20728. if (value === 12) {
  20729. var q = data[j++];
  20730. if (q === 0) {
  20731. data[j - 2] = 139;
  20732. data[j - 1] = 22;
  20733. stackSize = 0;
  20734. } else {
  20735. validationCommand = CharstringValidationData12[q];
  20736. }
  20737. } else if (value === 28) {
  20738. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  20739. j += 2;
  20740. stackSize++;
  20741. } else if (value === 14) {
  20742. if (stackSize >= 4) {
  20743. stackSize -= 4;
  20744. if (this.seacAnalysisEnabled) {
  20745. state.seac = stack.slice(stackSize, stackSize + 4);
  20746. return false;
  20747. }
  20748. }
  20749. validationCommand = CharstringValidationData[value];
  20750. } else if (value >= 32 && value <= 246) {
  20751. stack[stackSize] = value - 139;
  20752. stackSize++;
  20753. } else if (value >= 247 && value <= 254) {
  20754. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  20755. j++;
  20756. stackSize++;
  20757. } else if (value === 255) {
  20758. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  20759. j += 4;
  20760. stackSize++;
  20761. } else if (value === 19 || value === 20) {
  20762. state.hints += stackSize >> 1;
  20763. j += state.hints + 7 >> 3;
  20764. stackSize %= 2;
  20765. validationCommand = CharstringValidationData[value];
  20766. } else if (value === 10 || value === 29) {
  20767. var subrsIndex;
  20768. if (value === 10) {
  20769. subrsIndex = localSubrIndex;
  20770. } else {
  20771. subrsIndex = globalSubrIndex;
  20772. }
  20773. if (!subrsIndex) {
  20774. validationCommand = CharstringValidationData[value];
  20775. warn('Missing subrsIndex for ' + validationCommand.id);
  20776. return false;
  20777. }
  20778. var bias = 32768;
  20779. if (subrsIndex.count < 1240) {
  20780. bias = 107;
  20781. } else if (subrsIndex.count < 33900) {
  20782. bias = 1131;
  20783. }
  20784. var subrNumber = stack[--stackSize] + bias;
  20785. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  20786. validationCommand = CharstringValidationData[value];
  20787. warn('Out of bounds subrIndex for ' + validationCommand.id);
  20788. return false;
  20789. }
  20790. state.stackSize = stackSize;
  20791. state.callDepth++;
  20792. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  20793. if (!valid) {
  20794. return false;
  20795. }
  20796. state.callDepth--;
  20797. stackSize = state.stackSize;
  20798. continue;
  20799. } else if (value === 11) {
  20800. state.stackSize = stackSize;
  20801. return true;
  20802. } else {
  20803. validationCommand = CharstringValidationData[value];
  20804. }
  20805. if (validationCommand) {
  20806. if (validationCommand.stem) {
  20807. state.hints += stackSize >> 1;
  20808. }
  20809. if ('min' in validationCommand) {
  20810. if (!state.undefStack && stackSize < validationCommand.min) {
  20811. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  20812. return false;
  20813. }
  20814. }
  20815. if (state.firstStackClearing && validationCommand.stackClearing) {
  20816. state.firstStackClearing = false;
  20817. stackSize -= validationCommand.min;
  20818. if (stackSize >= 2 && validationCommand.stem) {
  20819. stackSize %= 2;
  20820. } else if (stackSize > 1) {
  20821. warn('Found too many parameters for stack-clearing command');
  20822. }
  20823. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  20824. state.width = stack[stackSize - 1];
  20825. }
  20826. }
  20827. if ('stackDelta' in validationCommand) {
  20828. if ('stackFn' in validationCommand) {
  20829. validationCommand.stackFn(stack, stackSize);
  20830. }
  20831. stackSize += validationCommand.stackDelta;
  20832. } else if (validationCommand.stackClearing) {
  20833. stackSize = 0;
  20834. } else if (validationCommand.resetStack) {
  20835. stackSize = 0;
  20836. state.undefStack = false;
  20837. } else if (validationCommand.undefStack) {
  20838. stackSize = 0;
  20839. state.undefStack = true;
  20840. state.firstStackClearing = false;
  20841. }
  20842. }
  20843. }
  20844. state.stackSize = stackSize;
  20845. return true;
  20846. },
  20847. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20848. var seacs = [];
  20849. var widths = [];
  20850. var count = charStrings.count;
  20851. for (var i = 0; i < count; i++) {
  20852. var charstring = charStrings.get(i);
  20853. var state = {
  20854. callDepth: 0,
  20855. stackSize: 0,
  20856. stack: [],
  20857. undefStack: true,
  20858. hints: 0,
  20859. firstStackClearing: true,
  20860. seac: null,
  20861. width: null
  20862. };
  20863. var valid = true;
  20864. var localSubrToUse = null;
  20865. if (fdSelect && fdArray.length) {
  20866. var fdIndex = fdSelect.getFDIndex(i);
  20867. if (fdIndex === -1) {
  20868. warn('Glyph index is not in fd select.');
  20869. valid = false;
  20870. }
  20871. if (fdIndex >= fdArray.length) {
  20872. warn('Invalid fd index for glyph index.');
  20873. valid = false;
  20874. }
  20875. if (valid) {
  20876. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20877. }
  20878. } else if (localSubrIndex) {
  20879. localSubrToUse = localSubrIndex;
  20880. }
  20881. if (valid) {
  20882. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20883. }
  20884. if (state.width !== null) {
  20885. widths[i] = state.width;
  20886. }
  20887. if (state.seac !== null) {
  20888. seacs[i] = state.seac;
  20889. }
  20890. if (!valid) {
  20891. charStrings.set(i, new Uint8Array([14]));
  20892. }
  20893. }
  20894. return {
  20895. charStrings: charStrings,
  20896. seacs: seacs,
  20897. widths: widths
  20898. };
  20899. },
  20900. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20901. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20902. parentDict.setByKey(18, [
  20903. 0,
  20904. 0
  20905. ]);
  20906. parentDict.privateDict = privateDict;
  20907. },
  20908. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20909. if (!parentDict.hasName('Private')) {
  20910. this.emptyPrivateDictionary(parentDict);
  20911. return;
  20912. }
  20913. var privateOffset = parentDict.getByName('Private');
  20914. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20915. parentDict.removeByName('Private');
  20916. return;
  20917. }
  20918. var size = privateOffset[0];
  20919. var offset = privateOffset[1];
  20920. if (size === 0 || offset >= this.bytes.length) {
  20921. this.emptyPrivateDictionary(parentDict);
  20922. return;
  20923. }
  20924. var privateDictEnd = offset + size;
  20925. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20926. var dict = this.parseDict(dictData);
  20927. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20928. parentDict.privateDict = privateDict;
  20929. if (!privateDict.getByName('Subrs')) {
  20930. return;
  20931. }
  20932. var subrsOffset = privateDict.getByName('Subrs');
  20933. var relativeOffset = offset + subrsOffset;
  20934. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20935. this.emptyPrivateDictionary(parentDict);
  20936. return;
  20937. }
  20938. var subrsIndex = this.parseIndex(relativeOffset);
  20939. privateDict.subrsIndex = subrsIndex.obj;
  20940. },
  20941. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20942. if (pos === 0) {
  20943. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20944. } else if (pos === 1) {
  20945. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20946. } else if (pos === 2) {
  20947. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20948. }
  20949. var bytes = this.bytes;
  20950. var start = pos;
  20951. var format = bytes[pos++];
  20952. var charset = ['.notdef'];
  20953. var id, count, i;
  20954. length -= 1;
  20955. switch (format) {
  20956. case 0:
  20957. for (i = 0; i < length; i++) {
  20958. id = bytes[pos++] << 8 | bytes[pos++];
  20959. charset.push(cid ? id : strings.get(id));
  20960. }
  20961. break;
  20962. case 1:
  20963. while (charset.length <= length) {
  20964. id = bytes[pos++] << 8 | bytes[pos++];
  20965. count = bytes[pos++];
  20966. for (i = 0; i <= count; i++) {
  20967. charset.push(cid ? id++ : strings.get(id++));
  20968. }
  20969. }
  20970. break;
  20971. case 2:
  20972. while (charset.length <= length) {
  20973. id = bytes[pos++] << 8 | bytes[pos++];
  20974. count = bytes[pos++] << 8 | bytes[pos++];
  20975. for (i = 0; i <= count; i++) {
  20976. charset.push(cid ? id++ : strings.get(id++));
  20977. }
  20978. }
  20979. break;
  20980. default:
  20981. error('Unknown charset format');
  20982. }
  20983. var end = pos;
  20984. var raw = bytes.subarray(start, end);
  20985. return new CFFCharset(false, format, charset, raw);
  20986. },
  20987. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20988. var encoding = Object.create(null);
  20989. var bytes = this.bytes;
  20990. var predefined = false;
  20991. var format, i, ii;
  20992. var raw = null;
  20993. function readSupplement() {
  20994. var supplementsCount = bytes[pos++];
  20995. for (i = 0; i < supplementsCount; i++) {
  20996. var code = bytes[pos++];
  20997. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20998. encoding[code] = charset.indexOf(strings.get(sid));
  20999. }
  21000. }
  21001. if (pos === 0 || pos === 1) {
  21002. predefined = true;
  21003. format = pos;
  21004. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  21005. for (i = 0, ii = charset.length; i < ii; i++) {
  21006. var index = baseEncoding.indexOf(charset[i]);
  21007. if (index !== -1) {
  21008. encoding[index] = i;
  21009. }
  21010. }
  21011. } else {
  21012. var dataStart = pos;
  21013. format = bytes[pos++];
  21014. switch (format & 0x7f) {
  21015. case 0:
  21016. var glyphsCount = bytes[pos++];
  21017. for (i = 1; i <= glyphsCount; i++) {
  21018. encoding[bytes[pos++]] = i;
  21019. }
  21020. break;
  21021. case 1:
  21022. var rangesCount = bytes[pos++];
  21023. var gid = 1;
  21024. for (i = 0; i < rangesCount; i++) {
  21025. var start = bytes[pos++];
  21026. var left = bytes[pos++];
  21027. for (var j = start; j <= start + left; j++) {
  21028. encoding[j] = gid++;
  21029. }
  21030. }
  21031. break;
  21032. default:
  21033. error('Unknown encoding format: ' + format + ' in CFF');
  21034. break;
  21035. }
  21036. var dataEnd = pos;
  21037. if (format & 0x80) {
  21038. bytes[dataStart] &= 0x7f;
  21039. readSupplement();
  21040. }
  21041. raw = bytes.subarray(dataStart, dataEnd);
  21042. }
  21043. format = format & 0x7f;
  21044. return new CFFEncoding(predefined, format, encoding, raw);
  21045. },
  21046. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  21047. var start = pos;
  21048. var bytes = this.bytes;
  21049. var format = bytes[pos++];
  21050. var fdSelect = [], rawBytes;
  21051. var i, invalidFirstGID = false;
  21052. switch (format) {
  21053. case 0:
  21054. for (i = 0; i < length; ++i) {
  21055. var id = bytes[pos++];
  21056. fdSelect.push(id);
  21057. }
  21058. rawBytes = bytes.subarray(start, pos);
  21059. break;
  21060. case 3:
  21061. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21062. for (i = 0; i < rangesCount; ++i) {
  21063. var first = bytes[pos++] << 8 | bytes[pos++];
  21064. if (i === 0 && first !== 0) {
  21065. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  21066. invalidFirstGID = true;
  21067. first = 0;
  21068. }
  21069. var fdIndex = bytes[pos++];
  21070. var next = bytes[pos] << 8 | bytes[pos + 1];
  21071. for (var j = first; j < next; ++j) {
  21072. fdSelect.push(fdIndex);
  21073. }
  21074. }
  21075. pos += 2;
  21076. rawBytes = bytes.subarray(start, pos);
  21077. if (invalidFirstGID) {
  21078. rawBytes[3] = rawBytes[4] = 0;
  21079. }
  21080. break;
  21081. default:
  21082. error('parseFDSelect: Unknown format "' + format + '".');
  21083. break;
  21084. }
  21085. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  21086. return new CFFFDSelect(fdSelect, rawBytes);
  21087. }
  21088. };
  21089. return CFFParser;
  21090. }();
  21091. var CFF = function CFFClosure() {
  21092. function CFF() {
  21093. this.header = null;
  21094. this.names = [];
  21095. this.topDict = null;
  21096. this.strings = new CFFStrings();
  21097. this.globalSubrIndex = null;
  21098. this.encoding = null;
  21099. this.charset = null;
  21100. this.charStrings = null;
  21101. this.fdArray = [];
  21102. this.fdSelect = null;
  21103. this.isCIDFont = false;
  21104. }
  21105. return CFF;
  21106. }();
  21107. var CFFHeader = function CFFHeaderClosure() {
  21108. function CFFHeader(major, minor, hdrSize, offSize) {
  21109. this.major = major;
  21110. this.minor = minor;
  21111. this.hdrSize = hdrSize;
  21112. this.offSize = offSize;
  21113. }
  21114. return CFFHeader;
  21115. }();
  21116. var CFFStrings = function CFFStringsClosure() {
  21117. function CFFStrings() {
  21118. this.strings = [];
  21119. }
  21120. CFFStrings.prototype = {
  21121. get: function CFFStrings_get(index) {
  21122. if (index >= 0 && index <= 390) {
  21123. return CFFStandardStrings[index];
  21124. }
  21125. if (index - 391 <= this.strings.length) {
  21126. return this.strings[index - 391];
  21127. }
  21128. return CFFStandardStrings[0];
  21129. },
  21130. add: function CFFStrings_add(value) {
  21131. this.strings.push(value);
  21132. },
  21133. get count() {
  21134. return this.strings.length;
  21135. }
  21136. };
  21137. return CFFStrings;
  21138. }();
  21139. var CFFIndex = function CFFIndexClosure() {
  21140. function CFFIndex() {
  21141. this.objects = [];
  21142. this.length = 0;
  21143. }
  21144. CFFIndex.prototype = {
  21145. add: function CFFIndex_add(data) {
  21146. this.length += data.length;
  21147. this.objects.push(data);
  21148. },
  21149. set: function CFFIndex_set(index, data) {
  21150. this.length += data.length - this.objects[index].length;
  21151. this.objects[index] = data;
  21152. },
  21153. get: function CFFIndex_get(index) {
  21154. return this.objects[index];
  21155. },
  21156. get count() {
  21157. return this.objects.length;
  21158. }
  21159. };
  21160. return CFFIndex;
  21161. }();
  21162. var CFFDict = function CFFDictClosure() {
  21163. function CFFDict(tables, strings) {
  21164. this.keyToNameMap = tables.keyToNameMap;
  21165. this.nameToKeyMap = tables.nameToKeyMap;
  21166. this.defaults = tables.defaults;
  21167. this.types = tables.types;
  21168. this.opcodes = tables.opcodes;
  21169. this.order = tables.order;
  21170. this.strings = strings;
  21171. this.values = Object.create(null);
  21172. }
  21173. CFFDict.prototype = {
  21174. setByKey: function CFFDict_setByKey(key, value) {
  21175. if (!(key in this.keyToNameMap)) {
  21176. return false;
  21177. }
  21178. var valueLength = value.length;
  21179. if (valueLength === 0) {
  21180. return true;
  21181. }
  21182. for (var i = 0; i < valueLength; i++) {
  21183. if (isNaN(value[i])) {
  21184. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21185. return true;
  21186. }
  21187. }
  21188. var type = this.types[key];
  21189. if (type === 'num' || type === 'sid' || type === 'offset') {
  21190. value = value[0];
  21191. }
  21192. this.values[key] = value;
  21193. return true;
  21194. },
  21195. setByName: function CFFDict_setByName(name, value) {
  21196. if (!(name in this.nameToKeyMap)) {
  21197. error('Invalid dictionary name "' + name + '"');
  21198. }
  21199. this.values[this.nameToKeyMap[name]] = value;
  21200. },
  21201. hasName: function CFFDict_hasName(name) {
  21202. return this.nameToKeyMap[name] in this.values;
  21203. },
  21204. getByName: function CFFDict_getByName(name) {
  21205. if (!(name in this.nameToKeyMap)) {
  21206. error('Invalid dictionary name "' + name + '"');
  21207. }
  21208. var key = this.nameToKeyMap[name];
  21209. if (!(key in this.values)) {
  21210. return this.defaults[key];
  21211. }
  21212. return this.values[key];
  21213. },
  21214. removeByName: function CFFDict_removeByName(name) {
  21215. delete this.values[this.nameToKeyMap[name]];
  21216. }
  21217. };
  21218. CFFDict.createTables = function CFFDict_createTables(layout) {
  21219. var tables = {
  21220. keyToNameMap: {},
  21221. nameToKeyMap: {},
  21222. defaults: {},
  21223. types: {},
  21224. opcodes: {},
  21225. order: []
  21226. };
  21227. for (var i = 0, ii = layout.length; i < ii; ++i) {
  21228. var entry = layout[i];
  21229. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21230. tables.keyToNameMap[key] = entry[1];
  21231. tables.nameToKeyMap[entry[1]] = key;
  21232. tables.types[key] = entry[2];
  21233. tables.defaults[key] = entry[3];
  21234. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  21235. tables.order.push(key);
  21236. }
  21237. return tables;
  21238. };
  21239. return CFFDict;
  21240. }();
  21241. var CFFTopDict = function CFFTopDictClosure() {
  21242. var layout = [
  21243. [
  21244. [
  21245. 12,
  21246. 30
  21247. ],
  21248. 'ROS',
  21249. [
  21250. 'sid',
  21251. 'sid',
  21252. 'num'
  21253. ],
  21254. null
  21255. ],
  21256. [
  21257. [
  21258. 12,
  21259. 20
  21260. ],
  21261. 'SyntheticBase',
  21262. 'num',
  21263. null
  21264. ],
  21265. [
  21266. 0,
  21267. 'version',
  21268. 'sid',
  21269. null
  21270. ],
  21271. [
  21272. 1,
  21273. 'Notice',
  21274. 'sid',
  21275. null
  21276. ],
  21277. [
  21278. [
  21279. 12,
  21280. 0
  21281. ],
  21282. 'Copyright',
  21283. 'sid',
  21284. null
  21285. ],
  21286. [
  21287. 2,
  21288. 'FullName',
  21289. 'sid',
  21290. null
  21291. ],
  21292. [
  21293. 3,
  21294. 'FamilyName',
  21295. 'sid',
  21296. null
  21297. ],
  21298. [
  21299. 4,
  21300. 'Weight',
  21301. 'sid',
  21302. null
  21303. ],
  21304. [
  21305. [
  21306. 12,
  21307. 1
  21308. ],
  21309. 'isFixedPitch',
  21310. 'num',
  21311. 0
  21312. ],
  21313. [
  21314. [
  21315. 12,
  21316. 2
  21317. ],
  21318. 'ItalicAngle',
  21319. 'num',
  21320. 0
  21321. ],
  21322. [
  21323. [
  21324. 12,
  21325. 3
  21326. ],
  21327. 'UnderlinePosition',
  21328. 'num',
  21329. -100
  21330. ],
  21331. [
  21332. [
  21333. 12,
  21334. 4
  21335. ],
  21336. 'UnderlineThickness',
  21337. 'num',
  21338. 50
  21339. ],
  21340. [
  21341. [
  21342. 12,
  21343. 5
  21344. ],
  21345. 'PaintType',
  21346. 'num',
  21347. 0
  21348. ],
  21349. [
  21350. [
  21351. 12,
  21352. 6
  21353. ],
  21354. 'CharstringType',
  21355. 'num',
  21356. 2
  21357. ],
  21358. [
  21359. [
  21360. 12,
  21361. 7
  21362. ],
  21363. 'FontMatrix',
  21364. [
  21365. 'num',
  21366. 'num',
  21367. 'num',
  21368. 'num',
  21369. 'num',
  21370. 'num'
  21371. ],
  21372. [
  21373. 0.001,
  21374. 0,
  21375. 0,
  21376. 0.001,
  21377. 0,
  21378. 0
  21379. ]
  21380. ],
  21381. [
  21382. 13,
  21383. 'UniqueID',
  21384. 'num',
  21385. null
  21386. ],
  21387. [
  21388. 5,
  21389. 'FontBBox',
  21390. [
  21391. 'num',
  21392. 'num',
  21393. 'num',
  21394. 'num'
  21395. ],
  21396. [
  21397. 0,
  21398. 0,
  21399. 0,
  21400. 0
  21401. ]
  21402. ],
  21403. [
  21404. [
  21405. 12,
  21406. 8
  21407. ],
  21408. 'StrokeWidth',
  21409. 'num',
  21410. 0
  21411. ],
  21412. [
  21413. 14,
  21414. 'XUID',
  21415. 'array',
  21416. null
  21417. ],
  21418. [
  21419. 15,
  21420. 'charset',
  21421. 'offset',
  21422. 0
  21423. ],
  21424. [
  21425. 16,
  21426. 'Encoding',
  21427. 'offset',
  21428. 0
  21429. ],
  21430. [
  21431. 17,
  21432. 'CharStrings',
  21433. 'offset',
  21434. 0
  21435. ],
  21436. [
  21437. 18,
  21438. 'Private',
  21439. [
  21440. 'offset',
  21441. 'offset'
  21442. ],
  21443. null
  21444. ],
  21445. [
  21446. [
  21447. 12,
  21448. 21
  21449. ],
  21450. 'PostScript',
  21451. 'sid',
  21452. null
  21453. ],
  21454. [
  21455. [
  21456. 12,
  21457. 22
  21458. ],
  21459. 'BaseFontName',
  21460. 'sid',
  21461. null
  21462. ],
  21463. [
  21464. [
  21465. 12,
  21466. 23
  21467. ],
  21468. 'BaseFontBlend',
  21469. 'delta',
  21470. null
  21471. ],
  21472. [
  21473. [
  21474. 12,
  21475. 31
  21476. ],
  21477. 'CIDFontVersion',
  21478. 'num',
  21479. 0
  21480. ],
  21481. [
  21482. [
  21483. 12,
  21484. 32
  21485. ],
  21486. 'CIDFontRevision',
  21487. 'num',
  21488. 0
  21489. ],
  21490. [
  21491. [
  21492. 12,
  21493. 33
  21494. ],
  21495. 'CIDFontType',
  21496. 'num',
  21497. 0
  21498. ],
  21499. [
  21500. [
  21501. 12,
  21502. 34
  21503. ],
  21504. 'CIDCount',
  21505. 'num',
  21506. 8720
  21507. ],
  21508. [
  21509. [
  21510. 12,
  21511. 35
  21512. ],
  21513. 'UIDBase',
  21514. 'num',
  21515. null
  21516. ],
  21517. [
  21518. [
  21519. 12,
  21520. 37
  21521. ],
  21522. 'FDSelect',
  21523. 'offset',
  21524. null
  21525. ],
  21526. [
  21527. [
  21528. 12,
  21529. 36
  21530. ],
  21531. 'FDArray',
  21532. 'offset',
  21533. null
  21534. ],
  21535. [
  21536. [
  21537. 12,
  21538. 38
  21539. ],
  21540. 'FontName',
  21541. 'sid',
  21542. null
  21543. ]
  21544. ];
  21545. var tables = null;
  21546. function CFFTopDict(strings) {
  21547. if (tables === null) {
  21548. tables = CFFDict.createTables(layout);
  21549. }
  21550. CFFDict.call(this, tables, strings);
  21551. this.privateDict = null;
  21552. }
  21553. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  21554. return CFFTopDict;
  21555. }();
  21556. var CFFPrivateDict = function CFFPrivateDictClosure() {
  21557. var layout = [
  21558. [
  21559. 6,
  21560. 'BlueValues',
  21561. 'delta',
  21562. null
  21563. ],
  21564. [
  21565. 7,
  21566. 'OtherBlues',
  21567. 'delta',
  21568. null
  21569. ],
  21570. [
  21571. 8,
  21572. 'FamilyBlues',
  21573. 'delta',
  21574. null
  21575. ],
  21576. [
  21577. 9,
  21578. 'FamilyOtherBlues',
  21579. 'delta',
  21580. null
  21581. ],
  21582. [
  21583. [
  21584. 12,
  21585. 9
  21586. ],
  21587. 'BlueScale',
  21588. 'num',
  21589. 0.039625
  21590. ],
  21591. [
  21592. [
  21593. 12,
  21594. 10
  21595. ],
  21596. 'BlueShift',
  21597. 'num',
  21598. 7
  21599. ],
  21600. [
  21601. [
  21602. 12,
  21603. 11
  21604. ],
  21605. 'BlueFuzz',
  21606. 'num',
  21607. 1
  21608. ],
  21609. [
  21610. 10,
  21611. 'StdHW',
  21612. 'num',
  21613. null
  21614. ],
  21615. [
  21616. 11,
  21617. 'StdVW',
  21618. 'num',
  21619. null
  21620. ],
  21621. [
  21622. [
  21623. 12,
  21624. 12
  21625. ],
  21626. 'StemSnapH',
  21627. 'delta',
  21628. null
  21629. ],
  21630. [
  21631. [
  21632. 12,
  21633. 13
  21634. ],
  21635. 'StemSnapV',
  21636. 'delta',
  21637. null
  21638. ],
  21639. [
  21640. [
  21641. 12,
  21642. 14
  21643. ],
  21644. 'ForceBold',
  21645. 'num',
  21646. 0
  21647. ],
  21648. [
  21649. [
  21650. 12,
  21651. 17
  21652. ],
  21653. 'LanguageGroup',
  21654. 'num',
  21655. 0
  21656. ],
  21657. [
  21658. [
  21659. 12,
  21660. 18
  21661. ],
  21662. 'ExpansionFactor',
  21663. 'num',
  21664. 0.06
  21665. ],
  21666. [
  21667. [
  21668. 12,
  21669. 19
  21670. ],
  21671. 'initialRandomSeed',
  21672. 'num',
  21673. 0
  21674. ],
  21675. [
  21676. 20,
  21677. 'defaultWidthX',
  21678. 'num',
  21679. 0
  21680. ],
  21681. [
  21682. 21,
  21683. 'nominalWidthX',
  21684. 'num',
  21685. 0
  21686. ],
  21687. [
  21688. 19,
  21689. 'Subrs',
  21690. 'offset',
  21691. null
  21692. ]
  21693. ];
  21694. var tables = null;
  21695. function CFFPrivateDict(strings) {
  21696. if (tables === null) {
  21697. tables = CFFDict.createTables(layout);
  21698. }
  21699. CFFDict.call(this, tables, strings);
  21700. this.subrsIndex = null;
  21701. }
  21702. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  21703. return CFFPrivateDict;
  21704. }();
  21705. var CFFCharsetPredefinedTypes = {
  21706. ISO_ADOBE: 0,
  21707. EXPERT: 1,
  21708. EXPERT_SUBSET: 2
  21709. };
  21710. var CFFCharset = function CFFCharsetClosure() {
  21711. function CFFCharset(predefined, format, charset, raw) {
  21712. this.predefined = predefined;
  21713. this.format = format;
  21714. this.charset = charset;
  21715. this.raw = raw;
  21716. }
  21717. return CFFCharset;
  21718. }();
  21719. var CFFEncoding = function CFFEncodingClosure() {
  21720. function CFFEncoding(predefined, format, encoding, raw) {
  21721. this.predefined = predefined;
  21722. this.format = format;
  21723. this.encoding = encoding;
  21724. this.raw = raw;
  21725. }
  21726. return CFFEncoding;
  21727. }();
  21728. var CFFFDSelect = function CFFFDSelectClosure() {
  21729. function CFFFDSelect(fdSelect, raw) {
  21730. this.fdSelect = fdSelect;
  21731. this.raw = raw;
  21732. }
  21733. CFFFDSelect.prototype = {
  21734. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  21735. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21736. return -1;
  21737. }
  21738. return this.fdSelect[glyphIndex];
  21739. }
  21740. };
  21741. return CFFFDSelect;
  21742. }();
  21743. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  21744. function CFFOffsetTracker() {
  21745. this.offsets = Object.create(null);
  21746. }
  21747. CFFOffsetTracker.prototype = {
  21748. isTracking: function CFFOffsetTracker_isTracking(key) {
  21749. return key in this.offsets;
  21750. },
  21751. track: function CFFOffsetTracker_track(key, location) {
  21752. if (key in this.offsets) {
  21753. error('Already tracking location of ' + key);
  21754. }
  21755. this.offsets[key] = location;
  21756. },
  21757. offset: function CFFOffsetTracker_offset(value) {
  21758. for (var key in this.offsets) {
  21759. this.offsets[key] += value;
  21760. }
  21761. },
  21762. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  21763. if (!(key in this.offsets)) {
  21764. error('Not tracking location of ' + key);
  21765. }
  21766. var data = output.data;
  21767. var dataOffset = this.offsets[key];
  21768. var size = 5;
  21769. for (var i = 0, ii = values.length; i < ii; ++i) {
  21770. var offset0 = i * size + dataOffset;
  21771. var offset1 = offset0 + 1;
  21772. var offset2 = offset0 + 2;
  21773. var offset3 = offset0 + 3;
  21774. var offset4 = offset0 + 4;
  21775. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  21776. error('writing to an offset that is not empty');
  21777. }
  21778. var value = values[i];
  21779. data[offset0] = 0x1d;
  21780. data[offset1] = value >> 24 & 0xFF;
  21781. data[offset2] = value >> 16 & 0xFF;
  21782. data[offset3] = value >> 8 & 0xFF;
  21783. data[offset4] = value & 0xFF;
  21784. }
  21785. }
  21786. };
  21787. return CFFOffsetTracker;
  21788. }();
  21789. var CFFCompiler = function CFFCompilerClosure() {
  21790. function CFFCompiler(cff) {
  21791. this.cff = cff;
  21792. }
  21793. CFFCompiler.prototype = {
  21794. compile: function CFFCompiler_compile() {
  21795. var cff = this.cff;
  21796. var output = {
  21797. data: [],
  21798. length: 0,
  21799. add: function CFFCompiler_add(data) {
  21800. this.data = this.data.concat(data);
  21801. this.length = this.data.length;
  21802. }
  21803. };
  21804. var header = this.compileHeader(cff.header);
  21805. output.add(header);
  21806. var nameIndex = this.compileNameIndex(cff.names);
  21807. output.add(nameIndex);
  21808. if (cff.isCIDFont) {
  21809. if (cff.topDict.hasName('FontMatrix')) {
  21810. var base = cff.topDict.getByName('FontMatrix');
  21811. cff.topDict.removeByName('FontMatrix');
  21812. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  21813. var subDict = cff.fdArray[i];
  21814. var matrix = base.slice(0);
  21815. if (subDict.hasName('FontMatrix')) {
  21816. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  21817. }
  21818. subDict.setByName('FontMatrix', matrix);
  21819. }
  21820. }
  21821. }
  21822. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  21823. output.add(compiled.output);
  21824. var topDictTracker = compiled.trackers[0];
  21825. var stringIndex = this.compileStringIndex(cff.strings.strings);
  21826. output.add(stringIndex);
  21827. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  21828. output.add(globalSubrIndex);
  21829. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  21830. if (cff.encoding.predefined) {
  21831. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  21832. } else {
  21833. var encoding = this.compileEncoding(cff.encoding);
  21834. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  21835. output.add(encoding);
  21836. }
  21837. }
  21838. if (cff.charset && cff.topDict.hasName('charset')) {
  21839. if (cff.charset.predefined) {
  21840. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21841. } else {
  21842. var charset = this.compileCharset(cff.charset);
  21843. topDictTracker.setEntryLocation('charset', [output.length], output);
  21844. output.add(charset);
  21845. }
  21846. }
  21847. var charStrings = this.compileCharStrings(cff.charStrings);
  21848. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21849. output.add(charStrings);
  21850. if (cff.isCIDFont) {
  21851. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21852. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21853. output.add(fdSelect);
  21854. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21855. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21856. output.add(compiled.output);
  21857. var fontDictTrackers = compiled.trackers;
  21858. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21859. }
  21860. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21861. output.add([0]);
  21862. return output.data;
  21863. },
  21864. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21865. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21866. return this.encodeInteger(value);
  21867. }
  21868. return this.encodeFloat(value);
  21869. },
  21870. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21871. var value = num.toString();
  21872. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21873. if (m) {
  21874. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21875. value = (Math.round(num * epsilon) / epsilon).toString();
  21876. }
  21877. var nibbles = '';
  21878. var i, ii;
  21879. for (i = 0, ii = value.length; i < ii; ++i) {
  21880. var a = value[i];
  21881. if (a === 'e') {
  21882. nibbles += value[++i] === '-' ? 'c' : 'b';
  21883. } else if (a === '.') {
  21884. nibbles += 'a';
  21885. } else if (a === '-') {
  21886. nibbles += 'e';
  21887. } else {
  21888. nibbles += a;
  21889. }
  21890. }
  21891. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21892. var out = [30];
  21893. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21894. out.push(parseInt(nibbles.substr(i, 2), 16));
  21895. }
  21896. return out;
  21897. },
  21898. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21899. var code;
  21900. if (value >= -107 && value <= 107) {
  21901. code = [value + 139];
  21902. } else if (value >= 108 && value <= 1131) {
  21903. value = value - 108;
  21904. code = [
  21905. (value >> 8) + 247,
  21906. value & 0xFF
  21907. ];
  21908. } else if (value >= -1131 && value <= -108) {
  21909. value = -value - 108;
  21910. code = [
  21911. (value >> 8) + 251,
  21912. value & 0xFF
  21913. ];
  21914. } else if (value >= -32768 && value <= 32767) {
  21915. code = [
  21916. 0x1c,
  21917. value >> 8 & 0xFF,
  21918. value & 0xFF
  21919. ];
  21920. } else {
  21921. code = [
  21922. 0x1d,
  21923. value >> 24 & 0xFF,
  21924. value >> 16 & 0xFF,
  21925. value >> 8 & 0xFF,
  21926. value & 0xFF
  21927. ];
  21928. }
  21929. return code;
  21930. },
  21931. compileHeader: function CFFCompiler_compileHeader(header) {
  21932. return [
  21933. header.major,
  21934. header.minor,
  21935. header.hdrSize,
  21936. header.offSize
  21937. ];
  21938. },
  21939. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21940. var nameIndex = new CFFIndex();
  21941. for (var i = 0, ii = names.length; i < ii; ++i) {
  21942. nameIndex.add(stringToBytes(names[i]));
  21943. }
  21944. return this.compileIndex(nameIndex);
  21945. },
  21946. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21947. var fontDictTrackers = [];
  21948. var fdArrayIndex = new CFFIndex();
  21949. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21950. var fontDict = dicts[i];
  21951. if (removeCidKeys) {
  21952. fontDict.removeByName('CIDFontVersion');
  21953. fontDict.removeByName('CIDFontRevision');
  21954. fontDict.removeByName('CIDFontType');
  21955. fontDict.removeByName('CIDCount');
  21956. fontDict.removeByName('UIDBase');
  21957. }
  21958. var fontDictTracker = new CFFOffsetTracker();
  21959. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21960. fontDictTrackers.push(fontDictTracker);
  21961. fdArrayIndex.add(fontDictData);
  21962. fontDictTracker.offset(length);
  21963. }
  21964. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21965. return {
  21966. trackers: fontDictTrackers,
  21967. output: fdArrayIndex
  21968. };
  21969. },
  21970. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21971. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21972. var fontDict = dicts[i];
  21973. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21974. var privateDict = fontDict.privateDict;
  21975. var privateDictTracker = new CFFOffsetTracker();
  21976. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21977. var outputLength = output.length;
  21978. privateDictTracker.offset(outputLength);
  21979. if (!privateDictData.length) {
  21980. outputLength = 0;
  21981. }
  21982. trackers[i].setEntryLocation('Private', [
  21983. privateDictData.length,
  21984. outputLength
  21985. ], output);
  21986. output.add(privateDictData);
  21987. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21988. var subrs = this.compileIndex(privateDict.subrsIndex);
  21989. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21990. output.add(subrs);
  21991. }
  21992. }
  21993. },
  21994. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21995. var out = [];
  21996. var order = dict.order;
  21997. for (var i = 0; i < order.length; ++i) {
  21998. var key = order[i];
  21999. if (!(key in dict.values)) {
  22000. continue;
  22001. }
  22002. var values = dict.values[key];
  22003. var types = dict.types[key];
  22004. if (!isArray(types)) {
  22005. types = [types];
  22006. }
  22007. if (!isArray(values)) {
  22008. values = [values];
  22009. }
  22010. if (values.length === 0) {
  22011. continue;
  22012. }
  22013. for (var j = 0, jj = types.length; j < jj; ++j) {
  22014. var type = types[j];
  22015. var value = values[j];
  22016. switch (type) {
  22017. case 'num':
  22018. case 'sid':
  22019. out = out.concat(this.encodeNumber(value));
  22020. break;
  22021. case 'offset':
  22022. var name = dict.keyToNameMap[key];
  22023. if (!offsetTracker.isTracking(name)) {
  22024. offsetTracker.track(name, out.length);
  22025. }
  22026. out = out.concat([
  22027. 0x1d,
  22028. 0,
  22029. 0,
  22030. 0,
  22031. 0
  22032. ]);
  22033. break;
  22034. case 'array':
  22035. case 'delta':
  22036. out = out.concat(this.encodeNumber(value));
  22037. for (var k = 1, kk = values.length; k < kk; ++k) {
  22038. out = out.concat(this.encodeNumber(values[k]));
  22039. }
  22040. break;
  22041. default:
  22042. error('Unknown data type of ' + type);
  22043. break;
  22044. }
  22045. }
  22046. out = out.concat(dict.opcodes[key]);
  22047. }
  22048. return out;
  22049. },
  22050. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  22051. var stringIndex = new CFFIndex();
  22052. for (var i = 0, ii = strings.length; i < ii; ++i) {
  22053. stringIndex.add(stringToBytes(strings[i]));
  22054. }
  22055. return this.compileIndex(stringIndex);
  22056. },
  22057. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  22058. var globalSubrIndex = this.cff.globalSubrIndex;
  22059. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  22060. },
  22061. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  22062. return this.compileIndex(charStrings);
  22063. },
  22064. compileCharset: function CFFCompiler_compileCharset(charset) {
  22065. return this.compileTypedArray(charset.raw);
  22066. },
  22067. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  22068. return this.compileTypedArray(encoding.raw);
  22069. },
  22070. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  22071. return this.compileTypedArray(fdSelect);
  22072. },
  22073. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  22074. var out = [];
  22075. for (var i = 0, ii = data.length; i < ii; ++i) {
  22076. out[i] = data[i];
  22077. }
  22078. return out;
  22079. },
  22080. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  22081. trackers = trackers || [];
  22082. var objects = index.objects;
  22083. var count = objects.length;
  22084. if (count === 0) {
  22085. return [
  22086. 0,
  22087. 0,
  22088. 0
  22089. ];
  22090. }
  22091. var data = [
  22092. count >> 8 & 0xFF,
  22093. count & 0xff
  22094. ];
  22095. var lastOffset = 1, i;
  22096. for (i = 0; i < count; ++i) {
  22097. lastOffset += objects[i].length;
  22098. }
  22099. var offsetSize;
  22100. if (lastOffset < 0x100) {
  22101. offsetSize = 1;
  22102. } else if (lastOffset < 0x10000) {
  22103. offsetSize = 2;
  22104. } else if (lastOffset < 0x1000000) {
  22105. offsetSize = 3;
  22106. } else {
  22107. offsetSize = 4;
  22108. }
  22109. data.push(offsetSize);
  22110. var relativeOffset = 1;
  22111. for (i = 0; i < count + 1; i++) {
  22112. if (offsetSize === 1) {
  22113. data.push(relativeOffset & 0xFF);
  22114. } else if (offsetSize === 2) {
  22115. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22116. } else if (offsetSize === 3) {
  22117. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22118. } else {
  22119. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22120. }
  22121. if (objects[i]) {
  22122. relativeOffset += objects[i].length;
  22123. }
  22124. }
  22125. for (i = 0; i < count; i++) {
  22126. if (trackers[i]) {
  22127. trackers[i].offset(data.length);
  22128. }
  22129. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  22130. data.push(objects[i][j]);
  22131. }
  22132. }
  22133. return data;
  22134. }
  22135. };
  22136. return CFFCompiler;
  22137. }();
  22138. exports.CFFStandardStrings = CFFStandardStrings;
  22139. exports.CFFParser = CFFParser;
  22140. exports.CFF = CFF;
  22141. exports.CFFHeader = CFFHeader;
  22142. exports.CFFStrings = CFFStrings;
  22143. exports.CFFIndex = CFFIndex;
  22144. exports.CFFCharset = CFFCharset;
  22145. exports.CFFTopDict = CFFTopDict;
  22146. exports.CFFPrivateDict = CFFPrivateDict;
  22147. exports.CFFCompiler = CFFCompiler;
  22148. /***/ }),
  22149. /* 11 */
  22150. /***/ (function(module, exports, __w_pdfjs_require__) {
  22151. "use strict";
  22152. var sharedUtil = __w_pdfjs_require__(0);
  22153. var MissingDataException = sharedUtil.MissingDataException;
  22154. var arrayByteLength = sharedUtil.arrayByteLength;
  22155. var arraysToBytes = sharedUtil.arraysToBytes;
  22156. var assert = sharedUtil.assert;
  22157. var createPromiseCapability = sharedUtil.createPromiseCapability;
  22158. var isInt = sharedUtil.isInt;
  22159. var isEmptyObj = sharedUtil.isEmptyObj;
  22160. var ChunkedStream = function ChunkedStreamClosure() {
  22161. function ChunkedStream(length, chunkSize, manager) {
  22162. this.bytes = new Uint8Array(length);
  22163. this.start = 0;
  22164. this.pos = 0;
  22165. this.end = length;
  22166. this.chunkSize = chunkSize;
  22167. this.loadedChunks = [];
  22168. this.numChunksLoaded = 0;
  22169. this.numChunks = Math.ceil(length / chunkSize);
  22170. this.manager = manager;
  22171. this.progressiveDataLength = 0;
  22172. this.lastSuccessfulEnsureByteChunk = -1;
  22173. }
  22174. ChunkedStream.prototype = {
  22175. getMissingChunks: function ChunkedStream_getMissingChunks() {
  22176. var chunks = [];
  22177. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  22178. if (!this.loadedChunks[chunk]) {
  22179. chunks.push(chunk);
  22180. }
  22181. }
  22182. return chunks;
  22183. },
  22184. getBaseStreams: function ChunkedStream_getBaseStreams() {
  22185. return [this];
  22186. },
  22187. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  22188. return this.numChunksLoaded === this.numChunks;
  22189. },
  22190. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  22191. var end = begin + chunk.byteLength;
  22192. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  22193. var length = this.bytes.length;
  22194. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  22195. this.bytes.set(new Uint8Array(chunk), begin);
  22196. var chunkSize = this.chunkSize;
  22197. var beginChunk = Math.floor(begin / chunkSize);
  22198. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22199. var curChunk;
  22200. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22201. if (!this.loadedChunks[curChunk]) {
  22202. this.loadedChunks[curChunk] = true;
  22203. ++this.numChunksLoaded;
  22204. }
  22205. }
  22206. },
  22207. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  22208. var position = this.progressiveDataLength;
  22209. var beginChunk = Math.floor(position / this.chunkSize);
  22210. this.bytes.set(new Uint8Array(data), position);
  22211. position += data.byteLength;
  22212. this.progressiveDataLength = position;
  22213. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  22214. var curChunk;
  22215. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22216. if (!this.loadedChunks[curChunk]) {
  22217. this.loadedChunks[curChunk] = true;
  22218. ++this.numChunksLoaded;
  22219. }
  22220. }
  22221. },
  22222. ensureByte: function ChunkedStream_ensureByte(pos) {
  22223. var chunk = Math.floor(pos / this.chunkSize);
  22224. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  22225. return;
  22226. }
  22227. if (!this.loadedChunks[chunk]) {
  22228. throw new MissingDataException(pos, pos + 1);
  22229. }
  22230. this.lastSuccessfulEnsureByteChunk = chunk;
  22231. },
  22232. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  22233. if (begin >= end) {
  22234. return;
  22235. }
  22236. if (end <= this.progressiveDataLength) {
  22237. return;
  22238. }
  22239. var chunkSize = this.chunkSize;
  22240. var beginChunk = Math.floor(begin / chunkSize);
  22241. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22242. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22243. if (!this.loadedChunks[chunk]) {
  22244. throw new MissingDataException(begin, end);
  22245. }
  22246. }
  22247. },
  22248. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  22249. var chunk, numChunks = this.numChunks;
  22250. for (var i = 0; i < numChunks; ++i) {
  22251. chunk = (beginChunk + i) % numChunks;
  22252. if (!this.loadedChunks[chunk]) {
  22253. return chunk;
  22254. }
  22255. }
  22256. return null;
  22257. },
  22258. hasChunk: function ChunkedStream_hasChunk(chunk) {
  22259. return !!this.loadedChunks[chunk];
  22260. },
  22261. get length() {
  22262. return this.end - this.start;
  22263. },
  22264. get isEmpty() {
  22265. return this.length === 0;
  22266. },
  22267. getByte: function ChunkedStream_getByte() {
  22268. var pos = this.pos;
  22269. if (pos >= this.end) {
  22270. return -1;
  22271. }
  22272. this.ensureByte(pos);
  22273. return this.bytes[this.pos++];
  22274. },
  22275. getUint16: function ChunkedStream_getUint16() {
  22276. var b0 = this.getByte();
  22277. var b1 = this.getByte();
  22278. if (b0 === -1 || b1 === -1) {
  22279. return -1;
  22280. }
  22281. return (b0 << 8) + b1;
  22282. },
  22283. getInt32: function ChunkedStream_getInt32() {
  22284. var b0 = this.getByte();
  22285. var b1 = this.getByte();
  22286. var b2 = this.getByte();
  22287. var b3 = this.getByte();
  22288. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22289. },
  22290. getBytes: function ChunkedStream_getBytes(length) {
  22291. var bytes = this.bytes;
  22292. var pos = this.pos;
  22293. var strEnd = this.end;
  22294. if (!length) {
  22295. this.ensureRange(pos, strEnd);
  22296. return bytes.subarray(pos, strEnd);
  22297. }
  22298. var end = pos + length;
  22299. if (end > strEnd) {
  22300. end = strEnd;
  22301. }
  22302. this.ensureRange(pos, end);
  22303. this.pos = end;
  22304. return bytes.subarray(pos, end);
  22305. },
  22306. peekByte: function ChunkedStream_peekByte() {
  22307. var peekedByte = this.getByte();
  22308. this.pos--;
  22309. return peekedByte;
  22310. },
  22311. peekBytes: function ChunkedStream_peekBytes(length) {
  22312. var bytes = this.getBytes(length);
  22313. this.pos -= bytes.length;
  22314. return bytes;
  22315. },
  22316. getByteRange: function ChunkedStream_getBytes(begin, end) {
  22317. this.ensureRange(begin, end);
  22318. return this.bytes.subarray(begin, end);
  22319. },
  22320. skip: function ChunkedStream_skip(n) {
  22321. if (!n) {
  22322. n = 1;
  22323. }
  22324. this.pos += n;
  22325. },
  22326. reset: function ChunkedStream_reset() {
  22327. this.pos = this.start;
  22328. },
  22329. moveStart: function ChunkedStream_moveStart() {
  22330. this.start = this.pos;
  22331. },
  22332. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  22333. this.ensureRange(start, start + length);
  22334. function ChunkedStreamSubstream() {
  22335. }
  22336. ChunkedStreamSubstream.prototype = Object.create(this);
  22337. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  22338. var chunkSize = this.chunkSize;
  22339. var beginChunk = Math.floor(this.start / chunkSize);
  22340. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  22341. var missingChunks = [];
  22342. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22343. if (!this.loadedChunks[chunk]) {
  22344. missingChunks.push(chunk);
  22345. }
  22346. }
  22347. return missingChunks;
  22348. };
  22349. var subStream = new ChunkedStreamSubstream();
  22350. subStream.pos = subStream.start = start;
  22351. subStream.end = start + length || this.end;
  22352. subStream.dict = dict;
  22353. return subStream;
  22354. }
  22355. };
  22356. return ChunkedStream;
  22357. }();
  22358. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  22359. function ChunkedStreamManager(pdfNetworkStream, args) {
  22360. var chunkSize = args.rangeChunkSize;
  22361. var length = args.length;
  22362. this.stream = new ChunkedStream(length, chunkSize, this);
  22363. this.length = length;
  22364. this.chunkSize = chunkSize;
  22365. this.pdfNetworkStream = pdfNetworkStream;
  22366. this.url = args.url;
  22367. this.disableAutoFetch = args.disableAutoFetch;
  22368. this.msgHandler = args.msgHandler;
  22369. this.currRequestId = 0;
  22370. this.chunksNeededByRequest = Object.create(null);
  22371. this.requestsByChunk = Object.create(null);
  22372. this.promisesByRequest = Object.create(null);
  22373. this.progressiveDataLength = 0;
  22374. this.aborted = false;
  22375. this._loadedStreamCapability = createPromiseCapability();
  22376. }
  22377. ChunkedStreamManager.prototype = {
  22378. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  22379. return this._loadedStreamCapability.promise;
  22380. },
  22381. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  22382. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  22383. if (!rangeReader.isStreamingSupported) {
  22384. rangeReader.onProgress = this.onProgress.bind(this);
  22385. }
  22386. var chunks = [], loaded = 0;
  22387. var manager = this;
  22388. var promise = new Promise(function (resolve, reject) {
  22389. var readChunk = function (chunk) {
  22390. try {
  22391. if (!chunk.done) {
  22392. var data = chunk.value;
  22393. chunks.push(data);
  22394. loaded += arrayByteLength(data);
  22395. if (rangeReader.isStreamingSupported) {
  22396. manager.onProgress({ loaded: loaded });
  22397. }
  22398. rangeReader.read().then(readChunk, reject);
  22399. return;
  22400. }
  22401. var chunkData = arraysToBytes(chunks);
  22402. chunks = null;
  22403. resolve(chunkData);
  22404. } catch (e) {
  22405. reject(e);
  22406. }
  22407. };
  22408. rangeReader.read().then(readChunk, reject);
  22409. });
  22410. promise.then(function (data) {
  22411. if (this.aborted) {
  22412. return;
  22413. }
  22414. this.onReceiveData({
  22415. chunk: data,
  22416. begin: begin
  22417. });
  22418. }.bind(this));
  22419. },
  22420. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  22421. var missingChunks = this.stream.getMissingChunks();
  22422. this._requestChunks(missingChunks);
  22423. return this._loadedStreamCapability.promise;
  22424. },
  22425. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  22426. var requestId = this.currRequestId++;
  22427. var i, ii;
  22428. var chunksNeeded = Object.create(null);
  22429. this.chunksNeededByRequest[requestId] = chunksNeeded;
  22430. for (i = 0, ii = chunks.length; i < ii; i++) {
  22431. if (!this.stream.hasChunk(chunks[i])) {
  22432. chunksNeeded[chunks[i]] = true;
  22433. }
  22434. }
  22435. if (isEmptyObj(chunksNeeded)) {
  22436. return Promise.resolve();
  22437. }
  22438. var capability = createPromiseCapability();
  22439. this.promisesByRequest[requestId] = capability;
  22440. var chunksToRequest = [];
  22441. for (var chunk in chunksNeeded) {
  22442. chunk = chunk | 0;
  22443. if (!(chunk in this.requestsByChunk)) {
  22444. this.requestsByChunk[chunk] = [];
  22445. chunksToRequest.push(chunk);
  22446. }
  22447. this.requestsByChunk[chunk].push(requestId);
  22448. }
  22449. if (!chunksToRequest.length) {
  22450. return capability.promise;
  22451. }
  22452. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  22453. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  22454. var groupedChunk = groupedChunksToRequest[i];
  22455. var begin = groupedChunk.beginChunk * this.chunkSize;
  22456. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  22457. this.sendRequest(begin, end);
  22458. }
  22459. return capability.promise;
  22460. },
  22461. getStream: function ChunkedStreamManager_getStream() {
  22462. return this.stream;
  22463. },
  22464. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  22465. end = Math.min(end, this.length);
  22466. var beginChunk = this.getBeginChunk(begin);
  22467. var endChunk = this.getEndChunk(end);
  22468. var chunks = [];
  22469. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22470. chunks.push(chunk);
  22471. }
  22472. return this._requestChunks(chunks);
  22473. },
  22474. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  22475. ranges = ranges || [];
  22476. var chunksToRequest = [];
  22477. for (var i = 0; i < ranges.length; i++) {
  22478. var beginChunk = this.getBeginChunk(ranges[i].begin);
  22479. var endChunk = this.getEndChunk(ranges[i].end);
  22480. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22481. if (chunksToRequest.indexOf(chunk) < 0) {
  22482. chunksToRequest.push(chunk);
  22483. }
  22484. }
  22485. }
  22486. chunksToRequest.sort(function (a, b) {
  22487. return a - b;
  22488. });
  22489. return this._requestChunks(chunksToRequest);
  22490. },
  22491. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  22492. var groupedChunks = [];
  22493. var beginChunk = -1;
  22494. var prevChunk = -1;
  22495. for (var i = 0; i < chunks.length; ++i) {
  22496. var chunk = chunks[i];
  22497. if (beginChunk < 0) {
  22498. beginChunk = chunk;
  22499. }
  22500. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  22501. groupedChunks.push({
  22502. beginChunk: beginChunk,
  22503. endChunk: prevChunk + 1
  22504. });
  22505. beginChunk = chunk;
  22506. }
  22507. if (i + 1 === chunks.length) {
  22508. groupedChunks.push({
  22509. beginChunk: beginChunk,
  22510. endChunk: chunk + 1
  22511. });
  22512. }
  22513. prevChunk = chunk;
  22514. }
  22515. return groupedChunks;
  22516. },
  22517. onProgress: function ChunkedStreamManager_onProgress(args) {
  22518. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  22519. this.msgHandler.send('DocProgress', {
  22520. loaded: bytesLoaded,
  22521. total: this.length
  22522. });
  22523. },
  22524. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  22525. var chunk = args.chunk;
  22526. var isProgressive = args.begin === undefined;
  22527. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  22528. var end = begin + chunk.byteLength;
  22529. var beginChunk = Math.floor(begin / this.chunkSize);
  22530. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  22531. if (isProgressive) {
  22532. this.stream.onReceiveProgressiveData(chunk);
  22533. this.progressiveDataLength = end;
  22534. } else {
  22535. this.stream.onReceiveData(begin, chunk);
  22536. }
  22537. if (this.stream.allChunksLoaded()) {
  22538. this._loadedStreamCapability.resolve(this.stream);
  22539. }
  22540. var loadedRequests = [];
  22541. var i, requestId;
  22542. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  22543. var requestIds = this.requestsByChunk[chunk] || [];
  22544. delete this.requestsByChunk[chunk];
  22545. for (i = 0; i < requestIds.length; ++i) {
  22546. requestId = requestIds[i];
  22547. var chunksNeeded = this.chunksNeededByRequest[requestId];
  22548. if (chunk in chunksNeeded) {
  22549. delete chunksNeeded[chunk];
  22550. }
  22551. if (!isEmptyObj(chunksNeeded)) {
  22552. continue;
  22553. }
  22554. loadedRequests.push(requestId);
  22555. }
  22556. }
  22557. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  22558. var nextEmptyChunk;
  22559. if (this.stream.numChunksLoaded === 1) {
  22560. var lastChunk = this.stream.numChunks - 1;
  22561. if (!this.stream.hasChunk(lastChunk)) {
  22562. nextEmptyChunk = lastChunk;
  22563. }
  22564. } else {
  22565. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  22566. }
  22567. if (isInt(nextEmptyChunk)) {
  22568. this._requestChunks([nextEmptyChunk]);
  22569. }
  22570. }
  22571. for (i = 0; i < loadedRequests.length; ++i) {
  22572. requestId = loadedRequests[i];
  22573. var capability = this.promisesByRequest[requestId];
  22574. delete this.promisesByRequest[requestId];
  22575. capability.resolve();
  22576. }
  22577. this.msgHandler.send('DocProgress', {
  22578. loaded: this.stream.numChunksLoaded * this.chunkSize,
  22579. total: this.length
  22580. });
  22581. },
  22582. onError: function ChunkedStreamManager_onError(err) {
  22583. this._loadedStreamCapability.reject(err);
  22584. },
  22585. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  22586. var chunk = Math.floor(begin / this.chunkSize);
  22587. return chunk;
  22588. },
  22589. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  22590. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  22591. return chunk;
  22592. },
  22593. abort: function ChunkedStreamManager_abort() {
  22594. this.aborted = true;
  22595. if (this.pdfNetworkStream) {
  22596. this.pdfNetworkStream.cancelAllRequests('abort');
  22597. }
  22598. for (var requestId in this.promisesByRequest) {
  22599. var capability = this.promisesByRequest[requestId];
  22600. capability.reject(new Error('Request was aborted'));
  22601. }
  22602. }
  22603. };
  22604. return ChunkedStreamManager;
  22605. }();
  22606. exports.ChunkedStream = ChunkedStream;
  22607. exports.ChunkedStreamManager = ChunkedStreamManager;
  22608. /***/ }),
  22609. /* 12 */
  22610. /***/ (function(module, exports, __w_pdfjs_require__) {
  22611. "use strict";
  22612. var sharedUtil = __w_pdfjs_require__(0);
  22613. var corePrimitives = __w_pdfjs_require__(1);
  22614. var coreStream = __w_pdfjs_require__(2);
  22615. var PasswordException = sharedUtil.PasswordException;
  22616. var PasswordResponses = sharedUtil.PasswordResponses;
  22617. var bytesToString = sharedUtil.bytesToString;
  22618. var warn = sharedUtil.warn;
  22619. var error = sharedUtil.error;
  22620. var assert = sharedUtil.assert;
  22621. var isInt = sharedUtil.isInt;
  22622. var stringToBytes = sharedUtil.stringToBytes;
  22623. var utf8StringToString = sharedUtil.utf8StringToString;
  22624. var Name = corePrimitives.Name;
  22625. var isName = corePrimitives.isName;
  22626. var isDict = corePrimitives.isDict;
  22627. var DecryptStream = coreStream.DecryptStream;
  22628. var ARCFourCipher = function ARCFourCipherClosure() {
  22629. function ARCFourCipher(key) {
  22630. this.a = 0;
  22631. this.b = 0;
  22632. var s = new Uint8Array(256);
  22633. var i, j = 0, tmp, keyLength = key.length;
  22634. for (i = 0; i < 256; ++i) {
  22635. s[i] = i;
  22636. }
  22637. for (i = 0; i < 256; ++i) {
  22638. tmp = s[i];
  22639. j = j + tmp + key[i % keyLength] & 0xFF;
  22640. s[i] = s[j];
  22641. s[j] = tmp;
  22642. }
  22643. this.s = s;
  22644. }
  22645. ARCFourCipher.prototype = {
  22646. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  22647. var i, n = data.length, tmp, tmp2;
  22648. var a = this.a, b = this.b, s = this.s;
  22649. var output = new Uint8Array(n);
  22650. for (i = 0; i < n; ++i) {
  22651. a = a + 1 & 0xFF;
  22652. tmp = s[a];
  22653. b = b + tmp & 0xFF;
  22654. tmp2 = s[b];
  22655. s[a] = tmp2;
  22656. s[b] = tmp;
  22657. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  22658. }
  22659. this.a = a;
  22660. this.b = b;
  22661. return output;
  22662. }
  22663. };
  22664. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  22665. return ARCFourCipher;
  22666. }();
  22667. var calculateMD5 = function calculateMD5Closure() {
  22668. var r = new Uint8Array([
  22669. 7,
  22670. 12,
  22671. 17,
  22672. 22,
  22673. 7,
  22674. 12,
  22675. 17,
  22676. 22,
  22677. 7,
  22678. 12,
  22679. 17,
  22680. 22,
  22681. 7,
  22682. 12,
  22683. 17,
  22684. 22,
  22685. 5,
  22686. 9,
  22687. 14,
  22688. 20,
  22689. 5,
  22690. 9,
  22691. 14,
  22692. 20,
  22693. 5,
  22694. 9,
  22695. 14,
  22696. 20,
  22697. 5,
  22698. 9,
  22699. 14,
  22700. 20,
  22701. 4,
  22702. 11,
  22703. 16,
  22704. 23,
  22705. 4,
  22706. 11,
  22707. 16,
  22708. 23,
  22709. 4,
  22710. 11,
  22711. 16,
  22712. 23,
  22713. 4,
  22714. 11,
  22715. 16,
  22716. 23,
  22717. 6,
  22718. 10,
  22719. 15,
  22720. 21,
  22721. 6,
  22722. 10,
  22723. 15,
  22724. 21,
  22725. 6,
  22726. 10,
  22727. 15,
  22728. 21,
  22729. 6,
  22730. 10,
  22731. 15,
  22732. 21
  22733. ]);
  22734. var k = new Int32Array([
  22735. -680876936,
  22736. -389564586,
  22737. 606105819,
  22738. -1044525330,
  22739. -176418897,
  22740. 1200080426,
  22741. -1473231341,
  22742. -45705983,
  22743. 1770035416,
  22744. -1958414417,
  22745. -42063,
  22746. -1990404162,
  22747. 1804603682,
  22748. -40341101,
  22749. -1502002290,
  22750. 1236535329,
  22751. -165796510,
  22752. -1069501632,
  22753. 643717713,
  22754. -373897302,
  22755. -701558691,
  22756. 38016083,
  22757. -660478335,
  22758. -405537848,
  22759. 568446438,
  22760. -1019803690,
  22761. -187363961,
  22762. 1163531501,
  22763. -1444681467,
  22764. -51403784,
  22765. 1735328473,
  22766. -1926607734,
  22767. -378558,
  22768. -2022574463,
  22769. 1839030562,
  22770. -35309556,
  22771. -1530992060,
  22772. 1272893353,
  22773. -155497632,
  22774. -1094730640,
  22775. 681279174,
  22776. -358537222,
  22777. -722521979,
  22778. 76029189,
  22779. -640364487,
  22780. -421815835,
  22781. 530742520,
  22782. -995338651,
  22783. -198630844,
  22784. 1126891415,
  22785. -1416354905,
  22786. -57434055,
  22787. 1700485571,
  22788. -1894986606,
  22789. -1051523,
  22790. -2054922799,
  22791. 1873313359,
  22792. -30611744,
  22793. -1560198380,
  22794. 1309151649,
  22795. -145523070,
  22796. -1120210379,
  22797. 718787259,
  22798. -343485551
  22799. ]);
  22800. function hash(data, offset, length) {
  22801. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  22802. var paddedLength = length + 72 & ~63;
  22803. var padded = new Uint8Array(paddedLength);
  22804. var i, j, n;
  22805. for (i = 0; i < length; ++i) {
  22806. padded[i] = data[offset++];
  22807. }
  22808. padded[i++] = 0x80;
  22809. n = paddedLength - 8;
  22810. while (i < n) {
  22811. padded[i++] = 0;
  22812. }
  22813. padded[i++] = length << 3 & 0xFF;
  22814. padded[i++] = length >> 5 & 0xFF;
  22815. padded[i++] = length >> 13 & 0xFF;
  22816. padded[i++] = length >> 21 & 0xFF;
  22817. padded[i++] = length >>> 29 & 0xFF;
  22818. padded[i++] = 0;
  22819. padded[i++] = 0;
  22820. padded[i++] = 0;
  22821. var w = new Int32Array(16);
  22822. for (i = 0; i < paddedLength;) {
  22823. for (j = 0; j < 16; ++j, i += 4) {
  22824. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  22825. }
  22826. var a = h0, b = h1, c = h2, d = h3, f, g;
  22827. for (j = 0; j < 64; ++j) {
  22828. if (j < 16) {
  22829. f = b & c | ~b & d;
  22830. g = j;
  22831. } else if (j < 32) {
  22832. f = d & b | ~d & c;
  22833. g = 5 * j + 1 & 15;
  22834. } else if (j < 48) {
  22835. f = b ^ c ^ d;
  22836. g = 3 * j + 5 & 15;
  22837. } else {
  22838. f = c ^ (b | ~d);
  22839. g = 7 * j & 15;
  22840. }
  22841. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22842. d = c;
  22843. c = b;
  22844. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22845. a = tmp;
  22846. }
  22847. h0 = h0 + a | 0;
  22848. h1 = h1 + b | 0;
  22849. h2 = h2 + c | 0;
  22850. h3 = h3 + d | 0;
  22851. }
  22852. return new Uint8Array([
  22853. h0 & 0xFF,
  22854. h0 >> 8 & 0xFF,
  22855. h0 >> 16 & 0xFF,
  22856. h0 >>> 24 & 0xFF,
  22857. h1 & 0xFF,
  22858. h1 >> 8 & 0xFF,
  22859. h1 >> 16 & 0xFF,
  22860. h1 >>> 24 & 0xFF,
  22861. h2 & 0xFF,
  22862. h2 >> 8 & 0xFF,
  22863. h2 >> 16 & 0xFF,
  22864. h2 >>> 24 & 0xFF,
  22865. h3 & 0xFF,
  22866. h3 >> 8 & 0xFF,
  22867. h3 >> 16 & 0xFF,
  22868. h3 >>> 24 & 0xFF
  22869. ]);
  22870. }
  22871. return hash;
  22872. }();
  22873. var Word64 = function Word64Closure() {
  22874. function Word64(highInteger, lowInteger) {
  22875. this.high = highInteger | 0;
  22876. this.low = lowInteger | 0;
  22877. }
  22878. Word64.prototype = {
  22879. and: function Word64_and(word) {
  22880. this.high &= word.high;
  22881. this.low &= word.low;
  22882. },
  22883. xor: function Word64_xor(word) {
  22884. this.high ^= word.high;
  22885. this.low ^= word.low;
  22886. },
  22887. or: function Word64_or(word) {
  22888. this.high |= word.high;
  22889. this.low |= word.low;
  22890. },
  22891. shiftRight: function Word64_shiftRight(places) {
  22892. if (places >= 32) {
  22893. this.low = this.high >>> places - 32 | 0;
  22894. this.high = 0;
  22895. } else {
  22896. this.low = this.low >>> places | this.high << 32 - places;
  22897. this.high = this.high >>> places | 0;
  22898. }
  22899. },
  22900. shiftLeft: function Word64_shiftLeft(places) {
  22901. if (places >= 32) {
  22902. this.high = this.low << places - 32;
  22903. this.low = 0;
  22904. } else {
  22905. this.high = this.high << places | this.low >>> 32 - places;
  22906. this.low = this.low << places;
  22907. }
  22908. },
  22909. rotateRight: function Word64_rotateRight(places) {
  22910. var low, high;
  22911. if (places & 32) {
  22912. high = this.low;
  22913. low = this.high;
  22914. } else {
  22915. low = this.low;
  22916. high = this.high;
  22917. }
  22918. places &= 31;
  22919. this.low = low >>> places | high << 32 - places;
  22920. this.high = high >>> places | low << 32 - places;
  22921. },
  22922. not: function Word64_not() {
  22923. this.high = ~this.high;
  22924. this.low = ~this.low;
  22925. },
  22926. add: function Word64_add(word) {
  22927. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22928. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22929. if (lowAdd > 0xFFFFFFFF) {
  22930. highAdd += 1;
  22931. }
  22932. this.low = lowAdd | 0;
  22933. this.high = highAdd | 0;
  22934. },
  22935. copyTo: function Word64_copyTo(bytes, offset) {
  22936. bytes[offset] = this.high >>> 24 & 0xFF;
  22937. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22938. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22939. bytes[offset + 3] = this.high & 0xFF;
  22940. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22941. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22942. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22943. bytes[offset + 7] = this.low & 0xFF;
  22944. },
  22945. assign: function Word64_assign(word) {
  22946. this.high = word.high;
  22947. this.low = word.low;
  22948. }
  22949. };
  22950. return Word64;
  22951. }();
  22952. var calculateSHA256 = function calculateSHA256Closure() {
  22953. function rotr(x, n) {
  22954. return x >>> n | x << 32 - n;
  22955. }
  22956. function ch(x, y, z) {
  22957. return x & y ^ ~x & z;
  22958. }
  22959. function maj(x, y, z) {
  22960. return x & y ^ x & z ^ y & z;
  22961. }
  22962. function sigma(x) {
  22963. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22964. }
  22965. function sigmaPrime(x) {
  22966. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22967. }
  22968. function littleSigma(x) {
  22969. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22970. }
  22971. function littleSigmaPrime(x) {
  22972. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22973. }
  22974. var k = [
  22975. 0x428a2f98,
  22976. 0x71374491,
  22977. 0xb5c0fbcf,
  22978. 0xe9b5dba5,
  22979. 0x3956c25b,
  22980. 0x59f111f1,
  22981. 0x923f82a4,
  22982. 0xab1c5ed5,
  22983. 0xd807aa98,
  22984. 0x12835b01,
  22985. 0x243185be,
  22986. 0x550c7dc3,
  22987. 0x72be5d74,
  22988. 0x80deb1fe,
  22989. 0x9bdc06a7,
  22990. 0xc19bf174,
  22991. 0xe49b69c1,
  22992. 0xefbe4786,
  22993. 0x0fc19dc6,
  22994. 0x240ca1cc,
  22995. 0x2de92c6f,
  22996. 0x4a7484aa,
  22997. 0x5cb0a9dc,
  22998. 0x76f988da,
  22999. 0x983e5152,
  23000. 0xa831c66d,
  23001. 0xb00327c8,
  23002. 0xbf597fc7,
  23003. 0xc6e00bf3,
  23004. 0xd5a79147,
  23005. 0x06ca6351,
  23006. 0x14292967,
  23007. 0x27b70a85,
  23008. 0x2e1b2138,
  23009. 0x4d2c6dfc,
  23010. 0x53380d13,
  23011. 0x650a7354,
  23012. 0x766a0abb,
  23013. 0x81c2c92e,
  23014. 0x92722c85,
  23015. 0xa2bfe8a1,
  23016. 0xa81a664b,
  23017. 0xc24b8b70,
  23018. 0xc76c51a3,
  23019. 0xd192e819,
  23020. 0xd6990624,
  23021. 0xf40e3585,
  23022. 0x106aa070,
  23023. 0x19a4c116,
  23024. 0x1e376c08,
  23025. 0x2748774c,
  23026. 0x34b0bcb5,
  23027. 0x391c0cb3,
  23028. 0x4ed8aa4a,
  23029. 0x5b9cca4f,
  23030. 0x682e6ff3,
  23031. 0x748f82ee,
  23032. 0x78a5636f,
  23033. 0x84c87814,
  23034. 0x8cc70208,
  23035. 0x90befffa,
  23036. 0xa4506ceb,
  23037. 0xbef9a3f7,
  23038. 0xc67178f2
  23039. ];
  23040. function hash(data, offset, length) {
  23041. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  23042. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  23043. var padded = new Uint8Array(paddedLength);
  23044. var i, j, n;
  23045. for (i = 0; i < length; ++i) {
  23046. padded[i] = data[offset++];
  23047. }
  23048. padded[i++] = 0x80;
  23049. n = paddedLength - 8;
  23050. while (i < n) {
  23051. padded[i++] = 0;
  23052. }
  23053. padded[i++] = 0;
  23054. padded[i++] = 0;
  23055. padded[i++] = 0;
  23056. padded[i++] = length >>> 29 & 0xFF;
  23057. padded[i++] = length >> 21 & 0xFF;
  23058. padded[i++] = length >> 13 & 0xFF;
  23059. padded[i++] = length >> 5 & 0xFF;
  23060. padded[i++] = length << 3 & 0xFF;
  23061. var w = new Uint32Array(64);
  23062. for (i = 0; i < paddedLength;) {
  23063. for (j = 0; j < 16; ++j) {
  23064. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23065. i += 4;
  23066. }
  23067. for (j = 16; j < 64; ++j) {
  23068. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  23069. }
  23070. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  23071. for (j = 0; j < 64; ++j) {
  23072. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  23073. t2 = sigma(a) + maj(a, b, c);
  23074. h = g;
  23075. g = f;
  23076. f = e;
  23077. e = d + t1 | 0;
  23078. d = c;
  23079. c = b;
  23080. b = a;
  23081. a = t1 + t2 | 0;
  23082. }
  23083. h0 = h0 + a | 0;
  23084. h1 = h1 + b | 0;
  23085. h2 = h2 + c | 0;
  23086. h3 = h3 + d | 0;
  23087. h4 = h4 + e | 0;
  23088. h5 = h5 + f | 0;
  23089. h6 = h6 + g | 0;
  23090. h7 = h7 + h | 0;
  23091. }
  23092. return new Uint8Array([
  23093. h0 >> 24 & 0xFF,
  23094. h0 >> 16 & 0xFF,
  23095. h0 >> 8 & 0xFF,
  23096. h0 & 0xFF,
  23097. h1 >> 24 & 0xFF,
  23098. h1 >> 16 & 0xFF,
  23099. h1 >> 8 & 0xFF,
  23100. h1 & 0xFF,
  23101. h2 >> 24 & 0xFF,
  23102. h2 >> 16 & 0xFF,
  23103. h2 >> 8 & 0xFF,
  23104. h2 & 0xFF,
  23105. h3 >> 24 & 0xFF,
  23106. h3 >> 16 & 0xFF,
  23107. h3 >> 8 & 0xFF,
  23108. h3 & 0xFF,
  23109. h4 >> 24 & 0xFF,
  23110. h4 >> 16 & 0xFF,
  23111. h4 >> 8 & 0xFF,
  23112. h4 & 0xFF,
  23113. h5 >> 24 & 0xFF,
  23114. h5 >> 16 & 0xFF,
  23115. h5 >> 8 & 0xFF,
  23116. h5 & 0xFF,
  23117. h6 >> 24 & 0xFF,
  23118. h6 >> 16 & 0xFF,
  23119. h6 >> 8 & 0xFF,
  23120. h6 & 0xFF,
  23121. h7 >> 24 & 0xFF,
  23122. h7 >> 16 & 0xFF,
  23123. h7 >> 8 & 0xFF,
  23124. h7 & 0xFF
  23125. ]);
  23126. }
  23127. return hash;
  23128. }();
  23129. var calculateSHA512 = function calculateSHA512Closure() {
  23130. function ch(result, x, y, z, tmp) {
  23131. result.assign(x);
  23132. result.and(y);
  23133. tmp.assign(x);
  23134. tmp.not();
  23135. tmp.and(z);
  23136. result.xor(tmp);
  23137. }
  23138. function maj(result, x, y, z, tmp) {
  23139. result.assign(x);
  23140. result.and(y);
  23141. tmp.assign(x);
  23142. tmp.and(z);
  23143. result.xor(tmp);
  23144. tmp.assign(y);
  23145. tmp.and(z);
  23146. result.xor(tmp);
  23147. }
  23148. function sigma(result, x, tmp) {
  23149. result.assign(x);
  23150. result.rotateRight(28);
  23151. tmp.assign(x);
  23152. tmp.rotateRight(34);
  23153. result.xor(tmp);
  23154. tmp.assign(x);
  23155. tmp.rotateRight(39);
  23156. result.xor(tmp);
  23157. }
  23158. function sigmaPrime(result, x, tmp) {
  23159. result.assign(x);
  23160. result.rotateRight(14);
  23161. tmp.assign(x);
  23162. tmp.rotateRight(18);
  23163. result.xor(tmp);
  23164. tmp.assign(x);
  23165. tmp.rotateRight(41);
  23166. result.xor(tmp);
  23167. }
  23168. function littleSigma(result, x, tmp) {
  23169. result.assign(x);
  23170. result.rotateRight(1);
  23171. tmp.assign(x);
  23172. tmp.rotateRight(8);
  23173. result.xor(tmp);
  23174. tmp.assign(x);
  23175. tmp.shiftRight(7);
  23176. result.xor(tmp);
  23177. }
  23178. function littleSigmaPrime(result, x, tmp) {
  23179. result.assign(x);
  23180. result.rotateRight(19);
  23181. tmp.assign(x);
  23182. tmp.rotateRight(61);
  23183. result.xor(tmp);
  23184. tmp.assign(x);
  23185. tmp.shiftRight(6);
  23186. result.xor(tmp);
  23187. }
  23188. var k = [
  23189. new Word64(0x428a2f98, 0xd728ae22),
  23190. new Word64(0x71374491, 0x23ef65cd),
  23191. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  23192. new Word64(0xe9b5dba5, 0x8189dbbc),
  23193. new Word64(0x3956c25b, 0xf348b538),
  23194. new Word64(0x59f111f1, 0xb605d019),
  23195. new Word64(0x923f82a4, 0xaf194f9b),
  23196. new Word64(0xab1c5ed5, 0xda6d8118),
  23197. new Word64(0xd807aa98, 0xa3030242),
  23198. new Word64(0x12835b01, 0x45706fbe),
  23199. new Word64(0x243185be, 0x4ee4b28c),
  23200. new Word64(0x550c7dc3, 0xd5ffb4e2),
  23201. new Word64(0x72be5d74, 0xf27b896f),
  23202. new Word64(0x80deb1fe, 0x3b1696b1),
  23203. new Word64(0x9bdc06a7, 0x25c71235),
  23204. new Word64(0xc19bf174, 0xcf692694),
  23205. new Word64(0xe49b69c1, 0x9ef14ad2),
  23206. new Word64(0xefbe4786, 0x384f25e3),
  23207. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  23208. new Word64(0x240ca1cc, 0x77ac9c65),
  23209. new Word64(0x2de92c6f, 0x592b0275),
  23210. new Word64(0x4a7484aa, 0x6ea6e483),
  23211. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  23212. new Word64(0x76f988da, 0x831153b5),
  23213. new Word64(0x983e5152, 0xee66dfab),
  23214. new Word64(0xa831c66d, 0x2db43210),
  23215. new Word64(0xb00327c8, 0x98fb213f),
  23216. new Word64(0xbf597fc7, 0xbeef0ee4),
  23217. new Word64(0xc6e00bf3, 0x3da88fc2),
  23218. new Word64(0xd5a79147, 0x930aa725),
  23219. new Word64(0x06ca6351, 0xe003826f),
  23220. new Word64(0x14292967, 0x0a0e6e70),
  23221. new Word64(0x27b70a85, 0x46d22ffc),
  23222. new Word64(0x2e1b2138, 0x5c26c926),
  23223. new Word64(0x4d2c6dfc, 0x5ac42aed),
  23224. new Word64(0x53380d13, 0x9d95b3df),
  23225. new Word64(0x650a7354, 0x8baf63de),
  23226. new Word64(0x766a0abb, 0x3c77b2a8),
  23227. new Word64(0x81c2c92e, 0x47edaee6),
  23228. new Word64(0x92722c85, 0x1482353b),
  23229. new Word64(0xa2bfe8a1, 0x4cf10364),
  23230. new Word64(0xa81a664b, 0xbc423001),
  23231. new Word64(0xc24b8b70, 0xd0f89791),
  23232. new Word64(0xc76c51a3, 0x0654be30),
  23233. new Word64(0xd192e819, 0xd6ef5218),
  23234. new Word64(0xd6990624, 0x5565a910),
  23235. new Word64(0xf40e3585, 0x5771202a),
  23236. new Word64(0x106aa070, 0x32bbd1b8),
  23237. new Word64(0x19a4c116, 0xb8d2d0c8),
  23238. new Word64(0x1e376c08, 0x5141ab53),
  23239. new Word64(0x2748774c, 0xdf8eeb99),
  23240. new Word64(0x34b0bcb5, 0xe19b48a8),
  23241. new Word64(0x391c0cb3, 0xc5c95a63),
  23242. new Word64(0x4ed8aa4a, 0xe3418acb),
  23243. new Word64(0x5b9cca4f, 0x7763e373),
  23244. new Word64(0x682e6ff3, 0xd6b2b8a3),
  23245. new Word64(0x748f82ee, 0x5defb2fc),
  23246. new Word64(0x78a5636f, 0x43172f60),
  23247. new Word64(0x84c87814, 0xa1f0ab72),
  23248. new Word64(0x8cc70208, 0x1a6439ec),
  23249. new Word64(0x90befffa, 0x23631e28),
  23250. new Word64(0xa4506ceb, 0xde82bde9),
  23251. new Word64(0xbef9a3f7, 0xb2c67915),
  23252. new Word64(0xc67178f2, 0xe372532b),
  23253. new Word64(0xca273ece, 0xea26619c),
  23254. new Word64(0xd186b8c7, 0x21c0c207),
  23255. new Word64(0xeada7dd6, 0xcde0eb1e),
  23256. new Word64(0xf57d4f7f, 0xee6ed178),
  23257. new Word64(0x06f067aa, 0x72176fba),
  23258. new Word64(0x0a637dc5, 0xa2c898a6),
  23259. new Word64(0x113f9804, 0xbef90dae),
  23260. new Word64(0x1b710b35, 0x131c471b),
  23261. new Word64(0x28db77f5, 0x23047d84),
  23262. new Word64(0x32caab7b, 0x40c72493),
  23263. new Word64(0x3c9ebe0a, 0x15c9bebc),
  23264. new Word64(0x431d67c4, 0x9c100d4c),
  23265. new Word64(0x4cc5d4be, 0xcb3e42b6),
  23266. new Word64(0x597f299c, 0xfc657e2a),
  23267. new Word64(0x5fcb6fab, 0x3ad6faec),
  23268. new Word64(0x6c44198c, 0x4a475817)
  23269. ];
  23270. function hash(data, offset, length, mode384) {
  23271. mode384 = !!mode384;
  23272. var h0, h1, h2, h3, h4, h5, h6, h7;
  23273. if (!mode384) {
  23274. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  23275. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  23276. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  23277. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  23278. h4 = new Word64(0x510e527f, 0xade682d1);
  23279. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  23280. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  23281. h7 = new Word64(0x5be0cd19, 0x137e2179);
  23282. } else {
  23283. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  23284. h1 = new Word64(0x629a292a, 0x367cd507);
  23285. h2 = new Word64(0x9159015a, 0x3070dd17);
  23286. h3 = new Word64(0x152fecd8, 0xf70e5939);
  23287. h4 = new Word64(0x67332667, 0xffc00b31);
  23288. h5 = new Word64(0x8eb44a87, 0x68581511);
  23289. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  23290. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  23291. }
  23292. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  23293. var padded = new Uint8Array(paddedLength);
  23294. var i, j, n;
  23295. for (i = 0; i < length; ++i) {
  23296. padded[i] = data[offset++];
  23297. }
  23298. padded[i++] = 0x80;
  23299. n = paddedLength - 16;
  23300. while (i < n) {
  23301. padded[i++] = 0;
  23302. }
  23303. padded[i++] = 0;
  23304. padded[i++] = 0;
  23305. padded[i++] = 0;
  23306. padded[i++] = 0;
  23307. padded[i++] = 0;
  23308. padded[i++] = 0;
  23309. padded[i++] = 0;
  23310. padded[i++] = 0;
  23311. padded[i++] = 0;
  23312. padded[i++] = 0;
  23313. padded[i++] = 0;
  23314. padded[i++] = length >>> 29 & 0xFF;
  23315. padded[i++] = length >> 21 & 0xFF;
  23316. padded[i++] = length >> 13 & 0xFF;
  23317. padded[i++] = length >> 5 & 0xFF;
  23318. padded[i++] = length << 3 & 0xFF;
  23319. var w = new Array(80);
  23320. for (i = 0; i < 80; i++) {
  23321. w[i] = new Word64(0, 0);
  23322. }
  23323. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  23324. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  23325. var g = new Word64(0, 0), h = new Word64(0, 0);
  23326. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  23327. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  23328. for (i = 0; i < paddedLength;) {
  23329. for (j = 0; j < 16; ++j) {
  23330. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23331. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  23332. i += 8;
  23333. }
  23334. for (j = 16; j < 80; ++j) {
  23335. tmp3 = w[j];
  23336. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  23337. tmp3.add(w[j - 7]);
  23338. littleSigma(tmp1, w[j - 15], tmp2);
  23339. tmp3.add(tmp1);
  23340. tmp3.add(w[j - 16]);
  23341. }
  23342. a.assign(h0);
  23343. b.assign(h1);
  23344. c.assign(h2);
  23345. d.assign(h3);
  23346. e.assign(h4);
  23347. f.assign(h5);
  23348. g.assign(h6);
  23349. h.assign(h7);
  23350. for (j = 0; j < 80; ++j) {
  23351. t1.assign(h);
  23352. sigmaPrime(tmp1, e, tmp2);
  23353. t1.add(tmp1);
  23354. ch(tmp1, e, f, g, tmp2);
  23355. t1.add(tmp1);
  23356. t1.add(k[j]);
  23357. t1.add(w[j]);
  23358. sigma(t2, a, tmp2);
  23359. maj(tmp1, a, b, c, tmp2);
  23360. t2.add(tmp1);
  23361. tmp3 = h;
  23362. h = g;
  23363. g = f;
  23364. f = e;
  23365. d.add(t1);
  23366. e = d;
  23367. d = c;
  23368. c = b;
  23369. b = a;
  23370. tmp3.assign(t1);
  23371. tmp3.add(t2);
  23372. a = tmp3;
  23373. }
  23374. h0.add(a);
  23375. h1.add(b);
  23376. h2.add(c);
  23377. h3.add(d);
  23378. h4.add(e);
  23379. h5.add(f);
  23380. h6.add(g);
  23381. h7.add(h);
  23382. }
  23383. var result;
  23384. if (!mode384) {
  23385. result = new Uint8Array(64);
  23386. h0.copyTo(result, 0);
  23387. h1.copyTo(result, 8);
  23388. h2.copyTo(result, 16);
  23389. h3.copyTo(result, 24);
  23390. h4.copyTo(result, 32);
  23391. h5.copyTo(result, 40);
  23392. h6.copyTo(result, 48);
  23393. h7.copyTo(result, 56);
  23394. } else {
  23395. result = new Uint8Array(48);
  23396. h0.copyTo(result, 0);
  23397. h1.copyTo(result, 8);
  23398. h2.copyTo(result, 16);
  23399. h3.copyTo(result, 24);
  23400. h4.copyTo(result, 32);
  23401. h5.copyTo(result, 40);
  23402. }
  23403. return result;
  23404. }
  23405. return hash;
  23406. }();
  23407. var calculateSHA384 = function calculateSHA384Closure() {
  23408. function hash(data, offset, length) {
  23409. return calculateSHA512(data, offset, length, true);
  23410. }
  23411. return hash;
  23412. }();
  23413. var NullCipher = function NullCipherClosure() {
  23414. function NullCipher() {
  23415. }
  23416. NullCipher.prototype = {
  23417. decryptBlock: function NullCipher_decryptBlock(data) {
  23418. return data;
  23419. }
  23420. };
  23421. return NullCipher;
  23422. }();
  23423. var AES128Cipher = function AES128CipherClosure() {
  23424. var rcon = new Uint8Array([
  23425. 0x8d,
  23426. 0x01,
  23427. 0x02,
  23428. 0x04,
  23429. 0x08,
  23430. 0x10,
  23431. 0x20,
  23432. 0x40,
  23433. 0x80,
  23434. 0x1b,
  23435. 0x36,
  23436. 0x6c,
  23437. 0xd8,
  23438. 0xab,
  23439. 0x4d,
  23440. 0x9a,
  23441. 0x2f,
  23442. 0x5e,
  23443. 0xbc,
  23444. 0x63,
  23445. 0xc6,
  23446. 0x97,
  23447. 0x35,
  23448. 0x6a,
  23449. 0xd4,
  23450. 0xb3,
  23451. 0x7d,
  23452. 0xfa,
  23453. 0xef,
  23454. 0xc5,
  23455. 0x91,
  23456. 0x39,
  23457. 0x72,
  23458. 0xe4,
  23459. 0xd3,
  23460. 0xbd,
  23461. 0x61,
  23462. 0xc2,
  23463. 0x9f,
  23464. 0x25,
  23465. 0x4a,
  23466. 0x94,
  23467. 0x33,
  23468. 0x66,
  23469. 0xcc,
  23470. 0x83,
  23471. 0x1d,
  23472. 0x3a,
  23473. 0x74,
  23474. 0xe8,
  23475. 0xcb,
  23476. 0x8d,
  23477. 0x01,
  23478. 0x02,
  23479. 0x04,
  23480. 0x08,
  23481. 0x10,
  23482. 0x20,
  23483. 0x40,
  23484. 0x80,
  23485. 0x1b,
  23486. 0x36,
  23487. 0x6c,
  23488. 0xd8,
  23489. 0xab,
  23490. 0x4d,
  23491. 0x9a,
  23492. 0x2f,
  23493. 0x5e,
  23494. 0xbc,
  23495. 0x63,
  23496. 0xc6,
  23497. 0x97,
  23498. 0x35,
  23499. 0x6a,
  23500. 0xd4,
  23501. 0xb3,
  23502. 0x7d,
  23503. 0xfa,
  23504. 0xef,
  23505. 0xc5,
  23506. 0x91,
  23507. 0x39,
  23508. 0x72,
  23509. 0xe4,
  23510. 0xd3,
  23511. 0xbd,
  23512. 0x61,
  23513. 0xc2,
  23514. 0x9f,
  23515. 0x25,
  23516. 0x4a,
  23517. 0x94,
  23518. 0x33,
  23519. 0x66,
  23520. 0xcc,
  23521. 0x83,
  23522. 0x1d,
  23523. 0x3a,
  23524. 0x74,
  23525. 0xe8,
  23526. 0xcb,
  23527. 0x8d,
  23528. 0x01,
  23529. 0x02,
  23530. 0x04,
  23531. 0x08,
  23532. 0x10,
  23533. 0x20,
  23534. 0x40,
  23535. 0x80,
  23536. 0x1b,
  23537. 0x36,
  23538. 0x6c,
  23539. 0xd8,
  23540. 0xab,
  23541. 0x4d,
  23542. 0x9a,
  23543. 0x2f,
  23544. 0x5e,
  23545. 0xbc,
  23546. 0x63,
  23547. 0xc6,
  23548. 0x97,
  23549. 0x35,
  23550. 0x6a,
  23551. 0xd4,
  23552. 0xb3,
  23553. 0x7d,
  23554. 0xfa,
  23555. 0xef,
  23556. 0xc5,
  23557. 0x91,
  23558. 0x39,
  23559. 0x72,
  23560. 0xe4,
  23561. 0xd3,
  23562. 0xbd,
  23563. 0x61,
  23564. 0xc2,
  23565. 0x9f,
  23566. 0x25,
  23567. 0x4a,
  23568. 0x94,
  23569. 0x33,
  23570. 0x66,
  23571. 0xcc,
  23572. 0x83,
  23573. 0x1d,
  23574. 0x3a,
  23575. 0x74,
  23576. 0xe8,
  23577. 0xcb,
  23578. 0x8d,
  23579. 0x01,
  23580. 0x02,
  23581. 0x04,
  23582. 0x08,
  23583. 0x10,
  23584. 0x20,
  23585. 0x40,
  23586. 0x80,
  23587. 0x1b,
  23588. 0x36,
  23589. 0x6c,
  23590. 0xd8,
  23591. 0xab,
  23592. 0x4d,
  23593. 0x9a,
  23594. 0x2f,
  23595. 0x5e,
  23596. 0xbc,
  23597. 0x63,
  23598. 0xc6,
  23599. 0x97,
  23600. 0x35,
  23601. 0x6a,
  23602. 0xd4,
  23603. 0xb3,
  23604. 0x7d,
  23605. 0xfa,
  23606. 0xef,
  23607. 0xc5,
  23608. 0x91,
  23609. 0x39,
  23610. 0x72,
  23611. 0xe4,
  23612. 0xd3,
  23613. 0xbd,
  23614. 0x61,
  23615. 0xc2,
  23616. 0x9f,
  23617. 0x25,
  23618. 0x4a,
  23619. 0x94,
  23620. 0x33,
  23621. 0x66,
  23622. 0xcc,
  23623. 0x83,
  23624. 0x1d,
  23625. 0x3a,
  23626. 0x74,
  23627. 0xe8,
  23628. 0xcb,
  23629. 0x8d,
  23630. 0x01,
  23631. 0x02,
  23632. 0x04,
  23633. 0x08,
  23634. 0x10,
  23635. 0x20,
  23636. 0x40,
  23637. 0x80,
  23638. 0x1b,
  23639. 0x36,
  23640. 0x6c,
  23641. 0xd8,
  23642. 0xab,
  23643. 0x4d,
  23644. 0x9a,
  23645. 0x2f,
  23646. 0x5e,
  23647. 0xbc,
  23648. 0x63,
  23649. 0xc6,
  23650. 0x97,
  23651. 0x35,
  23652. 0x6a,
  23653. 0xd4,
  23654. 0xb3,
  23655. 0x7d,
  23656. 0xfa,
  23657. 0xef,
  23658. 0xc5,
  23659. 0x91,
  23660. 0x39,
  23661. 0x72,
  23662. 0xe4,
  23663. 0xd3,
  23664. 0xbd,
  23665. 0x61,
  23666. 0xc2,
  23667. 0x9f,
  23668. 0x25,
  23669. 0x4a,
  23670. 0x94,
  23671. 0x33,
  23672. 0x66,
  23673. 0xcc,
  23674. 0x83,
  23675. 0x1d,
  23676. 0x3a,
  23677. 0x74,
  23678. 0xe8,
  23679. 0xcb,
  23680. 0x8d
  23681. ]);
  23682. var s = new Uint8Array([
  23683. 0x63,
  23684. 0x7c,
  23685. 0x77,
  23686. 0x7b,
  23687. 0xf2,
  23688. 0x6b,
  23689. 0x6f,
  23690. 0xc5,
  23691. 0x30,
  23692. 0x01,
  23693. 0x67,
  23694. 0x2b,
  23695. 0xfe,
  23696. 0xd7,
  23697. 0xab,
  23698. 0x76,
  23699. 0xca,
  23700. 0x82,
  23701. 0xc9,
  23702. 0x7d,
  23703. 0xfa,
  23704. 0x59,
  23705. 0x47,
  23706. 0xf0,
  23707. 0xad,
  23708. 0xd4,
  23709. 0xa2,
  23710. 0xaf,
  23711. 0x9c,
  23712. 0xa4,
  23713. 0x72,
  23714. 0xc0,
  23715. 0xb7,
  23716. 0xfd,
  23717. 0x93,
  23718. 0x26,
  23719. 0x36,
  23720. 0x3f,
  23721. 0xf7,
  23722. 0xcc,
  23723. 0x34,
  23724. 0xa5,
  23725. 0xe5,
  23726. 0xf1,
  23727. 0x71,
  23728. 0xd8,
  23729. 0x31,
  23730. 0x15,
  23731. 0x04,
  23732. 0xc7,
  23733. 0x23,
  23734. 0xc3,
  23735. 0x18,
  23736. 0x96,
  23737. 0x05,
  23738. 0x9a,
  23739. 0x07,
  23740. 0x12,
  23741. 0x80,
  23742. 0xe2,
  23743. 0xeb,
  23744. 0x27,
  23745. 0xb2,
  23746. 0x75,
  23747. 0x09,
  23748. 0x83,
  23749. 0x2c,
  23750. 0x1a,
  23751. 0x1b,
  23752. 0x6e,
  23753. 0x5a,
  23754. 0xa0,
  23755. 0x52,
  23756. 0x3b,
  23757. 0xd6,
  23758. 0xb3,
  23759. 0x29,
  23760. 0xe3,
  23761. 0x2f,
  23762. 0x84,
  23763. 0x53,
  23764. 0xd1,
  23765. 0x00,
  23766. 0xed,
  23767. 0x20,
  23768. 0xfc,
  23769. 0xb1,
  23770. 0x5b,
  23771. 0x6a,
  23772. 0xcb,
  23773. 0xbe,
  23774. 0x39,
  23775. 0x4a,
  23776. 0x4c,
  23777. 0x58,
  23778. 0xcf,
  23779. 0xd0,
  23780. 0xef,
  23781. 0xaa,
  23782. 0xfb,
  23783. 0x43,
  23784. 0x4d,
  23785. 0x33,
  23786. 0x85,
  23787. 0x45,
  23788. 0xf9,
  23789. 0x02,
  23790. 0x7f,
  23791. 0x50,
  23792. 0x3c,
  23793. 0x9f,
  23794. 0xa8,
  23795. 0x51,
  23796. 0xa3,
  23797. 0x40,
  23798. 0x8f,
  23799. 0x92,
  23800. 0x9d,
  23801. 0x38,
  23802. 0xf5,
  23803. 0xbc,
  23804. 0xb6,
  23805. 0xda,
  23806. 0x21,
  23807. 0x10,
  23808. 0xff,
  23809. 0xf3,
  23810. 0xd2,
  23811. 0xcd,
  23812. 0x0c,
  23813. 0x13,
  23814. 0xec,
  23815. 0x5f,
  23816. 0x97,
  23817. 0x44,
  23818. 0x17,
  23819. 0xc4,
  23820. 0xa7,
  23821. 0x7e,
  23822. 0x3d,
  23823. 0x64,
  23824. 0x5d,
  23825. 0x19,
  23826. 0x73,
  23827. 0x60,
  23828. 0x81,
  23829. 0x4f,
  23830. 0xdc,
  23831. 0x22,
  23832. 0x2a,
  23833. 0x90,
  23834. 0x88,
  23835. 0x46,
  23836. 0xee,
  23837. 0xb8,
  23838. 0x14,
  23839. 0xde,
  23840. 0x5e,
  23841. 0x0b,
  23842. 0xdb,
  23843. 0xe0,
  23844. 0x32,
  23845. 0x3a,
  23846. 0x0a,
  23847. 0x49,
  23848. 0x06,
  23849. 0x24,
  23850. 0x5c,
  23851. 0xc2,
  23852. 0xd3,
  23853. 0xac,
  23854. 0x62,
  23855. 0x91,
  23856. 0x95,
  23857. 0xe4,
  23858. 0x79,
  23859. 0xe7,
  23860. 0xc8,
  23861. 0x37,
  23862. 0x6d,
  23863. 0x8d,
  23864. 0xd5,
  23865. 0x4e,
  23866. 0xa9,
  23867. 0x6c,
  23868. 0x56,
  23869. 0xf4,
  23870. 0xea,
  23871. 0x65,
  23872. 0x7a,
  23873. 0xae,
  23874. 0x08,
  23875. 0xba,
  23876. 0x78,
  23877. 0x25,
  23878. 0x2e,
  23879. 0x1c,
  23880. 0xa6,
  23881. 0xb4,
  23882. 0xc6,
  23883. 0xe8,
  23884. 0xdd,
  23885. 0x74,
  23886. 0x1f,
  23887. 0x4b,
  23888. 0xbd,
  23889. 0x8b,
  23890. 0x8a,
  23891. 0x70,
  23892. 0x3e,
  23893. 0xb5,
  23894. 0x66,
  23895. 0x48,
  23896. 0x03,
  23897. 0xf6,
  23898. 0x0e,
  23899. 0x61,
  23900. 0x35,
  23901. 0x57,
  23902. 0xb9,
  23903. 0x86,
  23904. 0xc1,
  23905. 0x1d,
  23906. 0x9e,
  23907. 0xe1,
  23908. 0xf8,
  23909. 0x98,
  23910. 0x11,
  23911. 0x69,
  23912. 0xd9,
  23913. 0x8e,
  23914. 0x94,
  23915. 0x9b,
  23916. 0x1e,
  23917. 0x87,
  23918. 0xe9,
  23919. 0xce,
  23920. 0x55,
  23921. 0x28,
  23922. 0xdf,
  23923. 0x8c,
  23924. 0xa1,
  23925. 0x89,
  23926. 0x0d,
  23927. 0xbf,
  23928. 0xe6,
  23929. 0x42,
  23930. 0x68,
  23931. 0x41,
  23932. 0x99,
  23933. 0x2d,
  23934. 0x0f,
  23935. 0xb0,
  23936. 0x54,
  23937. 0xbb,
  23938. 0x16
  23939. ]);
  23940. var inv_s = new Uint8Array([
  23941. 0x52,
  23942. 0x09,
  23943. 0x6a,
  23944. 0xd5,
  23945. 0x30,
  23946. 0x36,
  23947. 0xa5,
  23948. 0x38,
  23949. 0xbf,
  23950. 0x40,
  23951. 0xa3,
  23952. 0x9e,
  23953. 0x81,
  23954. 0xf3,
  23955. 0xd7,
  23956. 0xfb,
  23957. 0x7c,
  23958. 0xe3,
  23959. 0x39,
  23960. 0x82,
  23961. 0x9b,
  23962. 0x2f,
  23963. 0xff,
  23964. 0x87,
  23965. 0x34,
  23966. 0x8e,
  23967. 0x43,
  23968. 0x44,
  23969. 0xc4,
  23970. 0xde,
  23971. 0xe9,
  23972. 0xcb,
  23973. 0x54,
  23974. 0x7b,
  23975. 0x94,
  23976. 0x32,
  23977. 0xa6,
  23978. 0xc2,
  23979. 0x23,
  23980. 0x3d,
  23981. 0xee,
  23982. 0x4c,
  23983. 0x95,
  23984. 0x0b,
  23985. 0x42,
  23986. 0xfa,
  23987. 0xc3,
  23988. 0x4e,
  23989. 0x08,
  23990. 0x2e,
  23991. 0xa1,
  23992. 0x66,
  23993. 0x28,
  23994. 0xd9,
  23995. 0x24,
  23996. 0xb2,
  23997. 0x76,
  23998. 0x5b,
  23999. 0xa2,
  24000. 0x49,
  24001. 0x6d,
  24002. 0x8b,
  24003. 0xd1,
  24004. 0x25,
  24005. 0x72,
  24006. 0xf8,
  24007. 0xf6,
  24008. 0x64,
  24009. 0x86,
  24010. 0x68,
  24011. 0x98,
  24012. 0x16,
  24013. 0xd4,
  24014. 0xa4,
  24015. 0x5c,
  24016. 0xcc,
  24017. 0x5d,
  24018. 0x65,
  24019. 0xb6,
  24020. 0x92,
  24021. 0x6c,
  24022. 0x70,
  24023. 0x48,
  24024. 0x50,
  24025. 0xfd,
  24026. 0xed,
  24027. 0xb9,
  24028. 0xda,
  24029. 0x5e,
  24030. 0x15,
  24031. 0x46,
  24032. 0x57,
  24033. 0xa7,
  24034. 0x8d,
  24035. 0x9d,
  24036. 0x84,
  24037. 0x90,
  24038. 0xd8,
  24039. 0xab,
  24040. 0x00,
  24041. 0x8c,
  24042. 0xbc,
  24043. 0xd3,
  24044. 0x0a,
  24045. 0xf7,
  24046. 0xe4,
  24047. 0x58,
  24048. 0x05,
  24049. 0xb8,
  24050. 0xb3,
  24051. 0x45,
  24052. 0x06,
  24053. 0xd0,
  24054. 0x2c,
  24055. 0x1e,
  24056. 0x8f,
  24057. 0xca,
  24058. 0x3f,
  24059. 0x0f,
  24060. 0x02,
  24061. 0xc1,
  24062. 0xaf,
  24063. 0xbd,
  24064. 0x03,
  24065. 0x01,
  24066. 0x13,
  24067. 0x8a,
  24068. 0x6b,
  24069. 0x3a,
  24070. 0x91,
  24071. 0x11,
  24072. 0x41,
  24073. 0x4f,
  24074. 0x67,
  24075. 0xdc,
  24076. 0xea,
  24077. 0x97,
  24078. 0xf2,
  24079. 0xcf,
  24080. 0xce,
  24081. 0xf0,
  24082. 0xb4,
  24083. 0xe6,
  24084. 0x73,
  24085. 0x96,
  24086. 0xac,
  24087. 0x74,
  24088. 0x22,
  24089. 0xe7,
  24090. 0xad,
  24091. 0x35,
  24092. 0x85,
  24093. 0xe2,
  24094. 0xf9,
  24095. 0x37,
  24096. 0xe8,
  24097. 0x1c,
  24098. 0x75,
  24099. 0xdf,
  24100. 0x6e,
  24101. 0x47,
  24102. 0xf1,
  24103. 0x1a,
  24104. 0x71,
  24105. 0x1d,
  24106. 0x29,
  24107. 0xc5,
  24108. 0x89,
  24109. 0x6f,
  24110. 0xb7,
  24111. 0x62,
  24112. 0x0e,
  24113. 0xaa,
  24114. 0x18,
  24115. 0xbe,
  24116. 0x1b,
  24117. 0xfc,
  24118. 0x56,
  24119. 0x3e,
  24120. 0x4b,
  24121. 0xc6,
  24122. 0xd2,
  24123. 0x79,
  24124. 0x20,
  24125. 0x9a,
  24126. 0xdb,
  24127. 0xc0,
  24128. 0xfe,
  24129. 0x78,
  24130. 0xcd,
  24131. 0x5a,
  24132. 0xf4,
  24133. 0x1f,
  24134. 0xdd,
  24135. 0xa8,
  24136. 0x33,
  24137. 0x88,
  24138. 0x07,
  24139. 0xc7,
  24140. 0x31,
  24141. 0xb1,
  24142. 0x12,
  24143. 0x10,
  24144. 0x59,
  24145. 0x27,
  24146. 0x80,
  24147. 0xec,
  24148. 0x5f,
  24149. 0x60,
  24150. 0x51,
  24151. 0x7f,
  24152. 0xa9,
  24153. 0x19,
  24154. 0xb5,
  24155. 0x4a,
  24156. 0x0d,
  24157. 0x2d,
  24158. 0xe5,
  24159. 0x7a,
  24160. 0x9f,
  24161. 0x93,
  24162. 0xc9,
  24163. 0x9c,
  24164. 0xef,
  24165. 0xa0,
  24166. 0xe0,
  24167. 0x3b,
  24168. 0x4d,
  24169. 0xae,
  24170. 0x2a,
  24171. 0xf5,
  24172. 0xb0,
  24173. 0xc8,
  24174. 0xeb,
  24175. 0xbb,
  24176. 0x3c,
  24177. 0x83,
  24178. 0x53,
  24179. 0x99,
  24180. 0x61,
  24181. 0x17,
  24182. 0x2b,
  24183. 0x04,
  24184. 0x7e,
  24185. 0xba,
  24186. 0x77,
  24187. 0xd6,
  24188. 0x26,
  24189. 0xe1,
  24190. 0x69,
  24191. 0x14,
  24192. 0x63,
  24193. 0x55,
  24194. 0x21,
  24195. 0x0c,
  24196. 0x7d
  24197. ]);
  24198. var mixCol = new Uint8Array(256);
  24199. for (var i = 0; i < 256; i++) {
  24200. if (i < 128) {
  24201. mixCol[i] = i << 1;
  24202. } else {
  24203. mixCol[i] = i << 1 ^ 0x1b;
  24204. }
  24205. }
  24206. var mix = new Uint32Array([
  24207. 0x00000000,
  24208. 0x0e090d0b,
  24209. 0x1c121a16,
  24210. 0x121b171d,
  24211. 0x3824342c,
  24212. 0x362d3927,
  24213. 0x24362e3a,
  24214. 0x2a3f2331,
  24215. 0x70486858,
  24216. 0x7e416553,
  24217. 0x6c5a724e,
  24218. 0x62537f45,
  24219. 0x486c5c74,
  24220. 0x4665517f,
  24221. 0x547e4662,
  24222. 0x5a774b69,
  24223. 0xe090d0b0,
  24224. 0xee99ddbb,
  24225. 0xfc82caa6,
  24226. 0xf28bc7ad,
  24227. 0xd8b4e49c,
  24228. 0xd6bde997,
  24229. 0xc4a6fe8a,
  24230. 0xcaaff381,
  24231. 0x90d8b8e8,
  24232. 0x9ed1b5e3,
  24233. 0x8ccaa2fe,
  24234. 0x82c3aff5,
  24235. 0xa8fc8cc4,
  24236. 0xa6f581cf,
  24237. 0xb4ee96d2,
  24238. 0xbae79bd9,
  24239. 0xdb3bbb7b,
  24240. 0xd532b670,
  24241. 0xc729a16d,
  24242. 0xc920ac66,
  24243. 0xe31f8f57,
  24244. 0xed16825c,
  24245. 0xff0d9541,
  24246. 0xf104984a,
  24247. 0xab73d323,
  24248. 0xa57ade28,
  24249. 0xb761c935,
  24250. 0xb968c43e,
  24251. 0x9357e70f,
  24252. 0x9d5eea04,
  24253. 0x8f45fd19,
  24254. 0x814cf012,
  24255. 0x3bab6bcb,
  24256. 0x35a266c0,
  24257. 0x27b971dd,
  24258. 0x29b07cd6,
  24259. 0x038f5fe7,
  24260. 0x0d8652ec,
  24261. 0x1f9d45f1,
  24262. 0x119448fa,
  24263. 0x4be30393,
  24264. 0x45ea0e98,
  24265. 0x57f11985,
  24266. 0x59f8148e,
  24267. 0x73c737bf,
  24268. 0x7dce3ab4,
  24269. 0x6fd52da9,
  24270. 0x61dc20a2,
  24271. 0xad766df6,
  24272. 0xa37f60fd,
  24273. 0xb16477e0,
  24274. 0xbf6d7aeb,
  24275. 0x955259da,
  24276. 0x9b5b54d1,
  24277. 0x894043cc,
  24278. 0x87494ec7,
  24279. 0xdd3e05ae,
  24280. 0xd33708a5,
  24281. 0xc12c1fb8,
  24282. 0xcf2512b3,
  24283. 0xe51a3182,
  24284. 0xeb133c89,
  24285. 0xf9082b94,
  24286. 0xf701269f,
  24287. 0x4de6bd46,
  24288. 0x43efb04d,
  24289. 0x51f4a750,
  24290. 0x5ffdaa5b,
  24291. 0x75c2896a,
  24292. 0x7bcb8461,
  24293. 0x69d0937c,
  24294. 0x67d99e77,
  24295. 0x3daed51e,
  24296. 0x33a7d815,
  24297. 0x21bccf08,
  24298. 0x2fb5c203,
  24299. 0x058ae132,
  24300. 0x0b83ec39,
  24301. 0x1998fb24,
  24302. 0x1791f62f,
  24303. 0x764dd68d,
  24304. 0x7844db86,
  24305. 0x6a5fcc9b,
  24306. 0x6456c190,
  24307. 0x4e69e2a1,
  24308. 0x4060efaa,
  24309. 0x527bf8b7,
  24310. 0x5c72f5bc,
  24311. 0x0605bed5,
  24312. 0x080cb3de,
  24313. 0x1a17a4c3,
  24314. 0x141ea9c8,
  24315. 0x3e218af9,
  24316. 0x302887f2,
  24317. 0x223390ef,
  24318. 0x2c3a9de4,
  24319. 0x96dd063d,
  24320. 0x98d40b36,
  24321. 0x8acf1c2b,
  24322. 0x84c61120,
  24323. 0xaef93211,
  24324. 0xa0f03f1a,
  24325. 0xb2eb2807,
  24326. 0xbce2250c,
  24327. 0xe6956e65,
  24328. 0xe89c636e,
  24329. 0xfa877473,
  24330. 0xf48e7978,
  24331. 0xdeb15a49,
  24332. 0xd0b85742,
  24333. 0xc2a3405f,
  24334. 0xccaa4d54,
  24335. 0x41ecdaf7,
  24336. 0x4fe5d7fc,
  24337. 0x5dfec0e1,
  24338. 0x53f7cdea,
  24339. 0x79c8eedb,
  24340. 0x77c1e3d0,
  24341. 0x65daf4cd,
  24342. 0x6bd3f9c6,
  24343. 0x31a4b2af,
  24344. 0x3fadbfa4,
  24345. 0x2db6a8b9,
  24346. 0x23bfa5b2,
  24347. 0x09808683,
  24348. 0x07898b88,
  24349. 0x15929c95,
  24350. 0x1b9b919e,
  24351. 0xa17c0a47,
  24352. 0xaf75074c,
  24353. 0xbd6e1051,
  24354. 0xb3671d5a,
  24355. 0x99583e6b,
  24356. 0x97513360,
  24357. 0x854a247d,
  24358. 0x8b432976,
  24359. 0xd134621f,
  24360. 0xdf3d6f14,
  24361. 0xcd267809,
  24362. 0xc32f7502,
  24363. 0xe9105633,
  24364. 0xe7195b38,
  24365. 0xf5024c25,
  24366. 0xfb0b412e,
  24367. 0x9ad7618c,
  24368. 0x94de6c87,
  24369. 0x86c57b9a,
  24370. 0x88cc7691,
  24371. 0xa2f355a0,
  24372. 0xacfa58ab,
  24373. 0xbee14fb6,
  24374. 0xb0e842bd,
  24375. 0xea9f09d4,
  24376. 0xe49604df,
  24377. 0xf68d13c2,
  24378. 0xf8841ec9,
  24379. 0xd2bb3df8,
  24380. 0xdcb230f3,
  24381. 0xcea927ee,
  24382. 0xc0a02ae5,
  24383. 0x7a47b13c,
  24384. 0x744ebc37,
  24385. 0x6655ab2a,
  24386. 0x685ca621,
  24387. 0x42638510,
  24388. 0x4c6a881b,
  24389. 0x5e719f06,
  24390. 0x5078920d,
  24391. 0x0a0fd964,
  24392. 0x0406d46f,
  24393. 0x161dc372,
  24394. 0x1814ce79,
  24395. 0x322bed48,
  24396. 0x3c22e043,
  24397. 0x2e39f75e,
  24398. 0x2030fa55,
  24399. 0xec9ab701,
  24400. 0xe293ba0a,
  24401. 0xf088ad17,
  24402. 0xfe81a01c,
  24403. 0xd4be832d,
  24404. 0xdab78e26,
  24405. 0xc8ac993b,
  24406. 0xc6a59430,
  24407. 0x9cd2df59,
  24408. 0x92dbd252,
  24409. 0x80c0c54f,
  24410. 0x8ec9c844,
  24411. 0xa4f6eb75,
  24412. 0xaaffe67e,
  24413. 0xb8e4f163,
  24414. 0xb6edfc68,
  24415. 0x0c0a67b1,
  24416. 0x02036aba,
  24417. 0x10187da7,
  24418. 0x1e1170ac,
  24419. 0x342e539d,
  24420. 0x3a275e96,
  24421. 0x283c498b,
  24422. 0x26354480,
  24423. 0x7c420fe9,
  24424. 0x724b02e2,
  24425. 0x605015ff,
  24426. 0x6e5918f4,
  24427. 0x44663bc5,
  24428. 0x4a6f36ce,
  24429. 0x587421d3,
  24430. 0x567d2cd8,
  24431. 0x37a10c7a,
  24432. 0x39a80171,
  24433. 0x2bb3166c,
  24434. 0x25ba1b67,
  24435. 0x0f853856,
  24436. 0x018c355d,
  24437. 0x13972240,
  24438. 0x1d9e2f4b,
  24439. 0x47e96422,
  24440. 0x49e06929,
  24441. 0x5bfb7e34,
  24442. 0x55f2733f,
  24443. 0x7fcd500e,
  24444. 0x71c45d05,
  24445. 0x63df4a18,
  24446. 0x6dd64713,
  24447. 0xd731dcca,
  24448. 0xd938d1c1,
  24449. 0xcb23c6dc,
  24450. 0xc52acbd7,
  24451. 0xef15e8e6,
  24452. 0xe11ce5ed,
  24453. 0xf307f2f0,
  24454. 0xfd0efffb,
  24455. 0xa779b492,
  24456. 0xa970b999,
  24457. 0xbb6bae84,
  24458. 0xb562a38f,
  24459. 0x9f5d80be,
  24460. 0x91548db5,
  24461. 0x834f9aa8,
  24462. 0x8d4697a3
  24463. ]);
  24464. function expandKey128(cipherKey) {
  24465. var b = 176, result = new Uint8Array(b);
  24466. result.set(cipherKey);
  24467. for (var j = 16, i = 1; j < b; ++i) {
  24468. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24469. t1 = s[t1];
  24470. t2 = s[t2];
  24471. t3 = s[t3];
  24472. t4 = s[t4];
  24473. t1 = t1 ^ rcon[i];
  24474. for (var n = 0; n < 4; ++n) {
  24475. result[j] = t1 ^= result[j - 16];
  24476. j++;
  24477. result[j] = t2 ^= result[j - 16];
  24478. j++;
  24479. result[j] = t3 ^= result[j - 16];
  24480. j++;
  24481. result[j] = t4 ^= result[j - 16];
  24482. j++;
  24483. }
  24484. }
  24485. return result;
  24486. }
  24487. function decrypt128(input, key) {
  24488. var state = new Uint8Array(16);
  24489. state.set(input);
  24490. var i, j, k;
  24491. var t, u, v;
  24492. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24493. state[j] ^= key[k];
  24494. }
  24495. for (i = 9; i >= 1; --i) {
  24496. t = state[13];
  24497. state[13] = state[9];
  24498. state[9] = state[5];
  24499. state[5] = state[1];
  24500. state[1] = t;
  24501. t = state[14];
  24502. u = state[10];
  24503. state[14] = state[6];
  24504. state[10] = state[2];
  24505. state[6] = t;
  24506. state[2] = u;
  24507. t = state[15];
  24508. u = state[11];
  24509. v = state[7];
  24510. state[15] = state[3];
  24511. state[11] = t;
  24512. state[7] = u;
  24513. state[3] = v;
  24514. for (j = 0; j < 16; ++j) {
  24515. state[j] = inv_s[state[j]];
  24516. }
  24517. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24518. state[j] ^= key[k];
  24519. }
  24520. for (j = 0; j < 16; j += 4) {
  24521. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24522. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24523. state[j] = t >>> 24 & 0xFF;
  24524. state[j + 1] = t >> 16 & 0xFF;
  24525. state[j + 2] = t >> 8 & 0xFF;
  24526. state[j + 3] = t & 0xFF;
  24527. }
  24528. }
  24529. t = state[13];
  24530. state[13] = state[9];
  24531. state[9] = state[5];
  24532. state[5] = state[1];
  24533. state[1] = t;
  24534. t = state[14];
  24535. u = state[10];
  24536. state[14] = state[6];
  24537. state[10] = state[2];
  24538. state[6] = t;
  24539. state[2] = u;
  24540. t = state[15];
  24541. u = state[11];
  24542. v = state[7];
  24543. state[15] = state[3];
  24544. state[11] = t;
  24545. state[7] = u;
  24546. state[3] = v;
  24547. for (j = 0; j < 16; ++j) {
  24548. state[j] = inv_s[state[j]];
  24549. state[j] ^= key[j];
  24550. }
  24551. return state;
  24552. }
  24553. function encrypt128(input, key) {
  24554. var t, u, v, k;
  24555. var state = new Uint8Array(16);
  24556. state.set(input);
  24557. for (j = 0; j < 16; ++j) {
  24558. state[j] ^= key[j];
  24559. }
  24560. for (i = 1; i < 10; i++) {
  24561. for (j = 0; j < 16; ++j) {
  24562. state[j] = s[state[j]];
  24563. }
  24564. v = state[1];
  24565. state[1] = state[5];
  24566. state[5] = state[9];
  24567. state[9] = state[13];
  24568. state[13] = v;
  24569. v = state[2];
  24570. u = state[6];
  24571. state[2] = state[10];
  24572. state[6] = state[14];
  24573. state[10] = v;
  24574. state[14] = u;
  24575. v = state[3];
  24576. u = state[7];
  24577. t = state[11];
  24578. state[3] = state[15];
  24579. state[7] = v;
  24580. state[11] = u;
  24581. state[15] = t;
  24582. for (var j = 0; j < 16; j += 4) {
  24583. var s0 = state[j + 0], s1 = state[j + 1];
  24584. var s2 = state[j + 2], s3 = state[j + 3];
  24585. t = s0 ^ s1 ^ s2 ^ s3;
  24586. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24587. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24588. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24589. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24590. }
  24591. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24592. state[j] ^= key[k];
  24593. }
  24594. }
  24595. for (j = 0; j < 16; ++j) {
  24596. state[j] = s[state[j]];
  24597. }
  24598. v = state[1];
  24599. state[1] = state[5];
  24600. state[5] = state[9];
  24601. state[9] = state[13];
  24602. state[13] = v;
  24603. v = state[2];
  24604. u = state[6];
  24605. state[2] = state[10];
  24606. state[6] = state[14];
  24607. state[10] = v;
  24608. state[14] = u;
  24609. v = state[3];
  24610. u = state[7];
  24611. t = state[11];
  24612. state[3] = state[15];
  24613. state[7] = v;
  24614. state[11] = u;
  24615. state[15] = t;
  24616. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24617. state[j] ^= key[k];
  24618. }
  24619. return state;
  24620. }
  24621. function AES128Cipher(key) {
  24622. this.key = expandKey128(key);
  24623. this.buffer = new Uint8Array(16);
  24624. this.bufferPosition = 0;
  24625. }
  24626. function decryptBlock2(data, finalize) {
  24627. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24628. for (i = 0; i < sourceLength; ++i) {
  24629. buffer[bufferLength] = data[i];
  24630. ++bufferLength;
  24631. if (bufferLength < 16) {
  24632. continue;
  24633. }
  24634. var plain = decrypt128(buffer, this.key);
  24635. for (j = 0; j < 16; ++j) {
  24636. plain[j] ^= iv[j];
  24637. }
  24638. iv = buffer;
  24639. result.push(plain);
  24640. buffer = new Uint8Array(16);
  24641. bufferLength = 0;
  24642. }
  24643. this.buffer = buffer;
  24644. this.bufferLength = bufferLength;
  24645. this.iv = iv;
  24646. if (result.length === 0) {
  24647. return new Uint8Array([]);
  24648. }
  24649. var outputLength = 16 * result.length;
  24650. if (finalize) {
  24651. var lastBlock = result[result.length - 1];
  24652. var psLen = lastBlock[15];
  24653. if (psLen <= 16) {
  24654. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24655. if (lastBlock[i] !== psLen) {
  24656. psLen = 0;
  24657. break;
  24658. }
  24659. }
  24660. outputLength -= psLen;
  24661. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24662. }
  24663. }
  24664. var output = new Uint8Array(outputLength);
  24665. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24666. output.set(result[i], j);
  24667. }
  24668. return output;
  24669. }
  24670. AES128Cipher.prototype = {
  24671. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  24672. var i, sourceLength = data.length;
  24673. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24674. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24675. buffer[bufferLength] = data[i];
  24676. }
  24677. if (bufferLength < 16) {
  24678. this.bufferLength = bufferLength;
  24679. return new Uint8Array([]);
  24680. }
  24681. this.iv = buffer;
  24682. this.buffer = new Uint8Array(16);
  24683. this.bufferLength = 0;
  24684. this.decryptBlock = decryptBlock2;
  24685. return this.decryptBlock(data.subarray(16), finalize);
  24686. },
  24687. encrypt: function AES128Cipher_encrypt(data, iv) {
  24688. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24689. if (!iv) {
  24690. iv = new Uint8Array(16);
  24691. }
  24692. for (i = 0; i < sourceLength; ++i) {
  24693. buffer[bufferLength] = data[i];
  24694. ++bufferLength;
  24695. if (bufferLength < 16) {
  24696. continue;
  24697. }
  24698. for (j = 0; j < 16; ++j) {
  24699. buffer[j] ^= iv[j];
  24700. }
  24701. var cipher = encrypt128(buffer, this.key);
  24702. iv = cipher;
  24703. result.push(cipher);
  24704. buffer = new Uint8Array(16);
  24705. bufferLength = 0;
  24706. }
  24707. this.buffer = buffer;
  24708. this.bufferLength = bufferLength;
  24709. this.iv = iv;
  24710. if (result.length === 0) {
  24711. return new Uint8Array([]);
  24712. }
  24713. var outputLength = 16 * result.length;
  24714. var output = new Uint8Array(outputLength);
  24715. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24716. output.set(result[i], j);
  24717. }
  24718. return output;
  24719. }
  24720. };
  24721. return AES128Cipher;
  24722. }();
  24723. var AES256Cipher = function AES256CipherClosure() {
  24724. var s = new Uint8Array([
  24725. 0x63,
  24726. 0x7c,
  24727. 0x77,
  24728. 0x7b,
  24729. 0xf2,
  24730. 0x6b,
  24731. 0x6f,
  24732. 0xc5,
  24733. 0x30,
  24734. 0x01,
  24735. 0x67,
  24736. 0x2b,
  24737. 0xfe,
  24738. 0xd7,
  24739. 0xab,
  24740. 0x76,
  24741. 0xca,
  24742. 0x82,
  24743. 0xc9,
  24744. 0x7d,
  24745. 0xfa,
  24746. 0x59,
  24747. 0x47,
  24748. 0xf0,
  24749. 0xad,
  24750. 0xd4,
  24751. 0xa2,
  24752. 0xaf,
  24753. 0x9c,
  24754. 0xa4,
  24755. 0x72,
  24756. 0xc0,
  24757. 0xb7,
  24758. 0xfd,
  24759. 0x93,
  24760. 0x26,
  24761. 0x36,
  24762. 0x3f,
  24763. 0xf7,
  24764. 0xcc,
  24765. 0x34,
  24766. 0xa5,
  24767. 0xe5,
  24768. 0xf1,
  24769. 0x71,
  24770. 0xd8,
  24771. 0x31,
  24772. 0x15,
  24773. 0x04,
  24774. 0xc7,
  24775. 0x23,
  24776. 0xc3,
  24777. 0x18,
  24778. 0x96,
  24779. 0x05,
  24780. 0x9a,
  24781. 0x07,
  24782. 0x12,
  24783. 0x80,
  24784. 0xe2,
  24785. 0xeb,
  24786. 0x27,
  24787. 0xb2,
  24788. 0x75,
  24789. 0x09,
  24790. 0x83,
  24791. 0x2c,
  24792. 0x1a,
  24793. 0x1b,
  24794. 0x6e,
  24795. 0x5a,
  24796. 0xa0,
  24797. 0x52,
  24798. 0x3b,
  24799. 0xd6,
  24800. 0xb3,
  24801. 0x29,
  24802. 0xe3,
  24803. 0x2f,
  24804. 0x84,
  24805. 0x53,
  24806. 0xd1,
  24807. 0x00,
  24808. 0xed,
  24809. 0x20,
  24810. 0xfc,
  24811. 0xb1,
  24812. 0x5b,
  24813. 0x6a,
  24814. 0xcb,
  24815. 0xbe,
  24816. 0x39,
  24817. 0x4a,
  24818. 0x4c,
  24819. 0x58,
  24820. 0xcf,
  24821. 0xd0,
  24822. 0xef,
  24823. 0xaa,
  24824. 0xfb,
  24825. 0x43,
  24826. 0x4d,
  24827. 0x33,
  24828. 0x85,
  24829. 0x45,
  24830. 0xf9,
  24831. 0x02,
  24832. 0x7f,
  24833. 0x50,
  24834. 0x3c,
  24835. 0x9f,
  24836. 0xa8,
  24837. 0x51,
  24838. 0xa3,
  24839. 0x40,
  24840. 0x8f,
  24841. 0x92,
  24842. 0x9d,
  24843. 0x38,
  24844. 0xf5,
  24845. 0xbc,
  24846. 0xb6,
  24847. 0xda,
  24848. 0x21,
  24849. 0x10,
  24850. 0xff,
  24851. 0xf3,
  24852. 0xd2,
  24853. 0xcd,
  24854. 0x0c,
  24855. 0x13,
  24856. 0xec,
  24857. 0x5f,
  24858. 0x97,
  24859. 0x44,
  24860. 0x17,
  24861. 0xc4,
  24862. 0xa7,
  24863. 0x7e,
  24864. 0x3d,
  24865. 0x64,
  24866. 0x5d,
  24867. 0x19,
  24868. 0x73,
  24869. 0x60,
  24870. 0x81,
  24871. 0x4f,
  24872. 0xdc,
  24873. 0x22,
  24874. 0x2a,
  24875. 0x90,
  24876. 0x88,
  24877. 0x46,
  24878. 0xee,
  24879. 0xb8,
  24880. 0x14,
  24881. 0xde,
  24882. 0x5e,
  24883. 0x0b,
  24884. 0xdb,
  24885. 0xe0,
  24886. 0x32,
  24887. 0x3a,
  24888. 0x0a,
  24889. 0x49,
  24890. 0x06,
  24891. 0x24,
  24892. 0x5c,
  24893. 0xc2,
  24894. 0xd3,
  24895. 0xac,
  24896. 0x62,
  24897. 0x91,
  24898. 0x95,
  24899. 0xe4,
  24900. 0x79,
  24901. 0xe7,
  24902. 0xc8,
  24903. 0x37,
  24904. 0x6d,
  24905. 0x8d,
  24906. 0xd5,
  24907. 0x4e,
  24908. 0xa9,
  24909. 0x6c,
  24910. 0x56,
  24911. 0xf4,
  24912. 0xea,
  24913. 0x65,
  24914. 0x7a,
  24915. 0xae,
  24916. 0x08,
  24917. 0xba,
  24918. 0x78,
  24919. 0x25,
  24920. 0x2e,
  24921. 0x1c,
  24922. 0xa6,
  24923. 0xb4,
  24924. 0xc6,
  24925. 0xe8,
  24926. 0xdd,
  24927. 0x74,
  24928. 0x1f,
  24929. 0x4b,
  24930. 0xbd,
  24931. 0x8b,
  24932. 0x8a,
  24933. 0x70,
  24934. 0x3e,
  24935. 0xb5,
  24936. 0x66,
  24937. 0x48,
  24938. 0x03,
  24939. 0xf6,
  24940. 0x0e,
  24941. 0x61,
  24942. 0x35,
  24943. 0x57,
  24944. 0xb9,
  24945. 0x86,
  24946. 0xc1,
  24947. 0x1d,
  24948. 0x9e,
  24949. 0xe1,
  24950. 0xf8,
  24951. 0x98,
  24952. 0x11,
  24953. 0x69,
  24954. 0xd9,
  24955. 0x8e,
  24956. 0x94,
  24957. 0x9b,
  24958. 0x1e,
  24959. 0x87,
  24960. 0xe9,
  24961. 0xce,
  24962. 0x55,
  24963. 0x28,
  24964. 0xdf,
  24965. 0x8c,
  24966. 0xa1,
  24967. 0x89,
  24968. 0x0d,
  24969. 0xbf,
  24970. 0xe6,
  24971. 0x42,
  24972. 0x68,
  24973. 0x41,
  24974. 0x99,
  24975. 0x2d,
  24976. 0x0f,
  24977. 0xb0,
  24978. 0x54,
  24979. 0xbb,
  24980. 0x16
  24981. ]);
  24982. var inv_s = new Uint8Array([
  24983. 0x52,
  24984. 0x09,
  24985. 0x6a,
  24986. 0xd5,
  24987. 0x30,
  24988. 0x36,
  24989. 0xa5,
  24990. 0x38,
  24991. 0xbf,
  24992. 0x40,
  24993. 0xa3,
  24994. 0x9e,
  24995. 0x81,
  24996. 0xf3,
  24997. 0xd7,
  24998. 0xfb,
  24999. 0x7c,
  25000. 0xe3,
  25001. 0x39,
  25002. 0x82,
  25003. 0x9b,
  25004. 0x2f,
  25005. 0xff,
  25006. 0x87,
  25007. 0x34,
  25008. 0x8e,
  25009. 0x43,
  25010. 0x44,
  25011. 0xc4,
  25012. 0xde,
  25013. 0xe9,
  25014. 0xcb,
  25015. 0x54,
  25016. 0x7b,
  25017. 0x94,
  25018. 0x32,
  25019. 0xa6,
  25020. 0xc2,
  25021. 0x23,
  25022. 0x3d,
  25023. 0xee,
  25024. 0x4c,
  25025. 0x95,
  25026. 0x0b,
  25027. 0x42,
  25028. 0xfa,
  25029. 0xc3,
  25030. 0x4e,
  25031. 0x08,
  25032. 0x2e,
  25033. 0xa1,
  25034. 0x66,
  25035. 0x28,
  25036. 0xd9,
  25037. 0x24,
  25038. 0xb2,
  25039. 0x76,
  25040. 0x5b,
  25041. 0xa2,
  25042. 0x49,
  25043. 0x6d,
  25044. 0x8b,
  25045. 0xd1,
  25046. 0x25,
  25047. 0x72,
  25048. 0xf8,
  25049. 0xf6,
  25050. 0x64,
  25051. 0x86,
  25052. 0x68,
  25053. 0x98,
  25054. 0x16,
  25055. 0xd4,
  25056. 0xa4,
  25057. 0x5c,
  25058. 0xcc,
  25059. 0x5d,
  25060. 0x65,
  25061. 0xb6,
  25062. 0x92,
  25063. 0x6c,
  25064. 0x70,
  25065. 0x48,
  25066. 0x50,
  25067. 0xfd,
  25068. 0xed,
  25069. 0xb9,
  25070. 0xda,
  25071. 0x5e,
  25072. 0x15,
  25073. 0x46,
  25074. 0x57,
  25075. 0xa7,
  25076. 0x8d,
  25077. 0x9d,
  25078. 0x84,
  25079. 0x90,
  25080. 0xd8,
  25081. 0xab,
  25082. 0x00,
  25083. 0x8c,
  25084. 0xbc,
  25085. 0xd3,
  25086. 0x0a,
  25087. 0xf7,
  25088. 0xe4,
  25089. 0x58,
  25090. 0x05,
  25091. 0xb8,
  25092. 0xb3,
  25093. 0x45,
  25094. 0x06,
  25095. 0xd0,
  25096. 0x2c,
  25097. 0x1e,
  25098. 0x8f,
  25099. 0xca,
  25100. 0x3f,
  25101. 0x0f,
  25102. 0x02,
  25103. 0xc1,
  25104. 0xaf,
  25105. 0xbd,
  25106. 0x03,
  25107. 0x01,
  25108. 0x13,
  25109. 0x8a,
  25110. 0x6b,
  25111. 0x3a,
  25112. 0x91,
  25113. 0x11,
  25114. 0x41,
  25115. 0x4f,
  25116. 0x67,
  25117. 0xdc,
  25118. 0xea,
  25119. 0x97,
  25120. 0xf2,
  25121. 0xcf,
  25122. 0xce,
  25123. 0xf0,
  25124. 0xb4,
  25125. 0xe6,
  25126. 0x73,
  25127. 0x96,
  25128. 0xac,
  25129. 0x74,
  25130. 0x22,
  25131. 0xe7,
  25132. 0xad,
  25133. 0x35,
  25134. 0x85,
  25135. 0xe2,
  25136. 0xf9,
  25137. 0x37,
  25138. 0xe8,
  25139. 0x1c,
  25140. 0x75,
  25141. 0xdf,
  25142. 0x6e,
  25143. 0x47,
  25144. 0xf1,
  25145. 0x1a,
  25146. 0x71,
  25147. 0x1d,
  25148. 0x29,
  25149. 0xc5,
  25150. 0x89,
  25151. 0x6f,
  25152. 0xb7,
  25153. 0x62,
  25154. 0x0e,
  25155. 0xaa,
  25156. 0x18,
  25157. 0xbe,
  25158. 0x1b,
  25159. 0xfc,
  25160. 0x56,
  25161. 0x3e,
  25162. 0x4b,
  25163. 0xc6,
  25164. 0xd2,
  25165. 0x79,
  25166. 0x20,
  25167. 0x9a,
  25168. 0xdb,
  25169. 0xc0,
  25170. 0xfe,
  25171. 0x78,
  25172. 0xcd,
  25173. 0x5a,
  25174. 0xf4,
  25175. 0x1f,
  25176. 0xdd,
  25177. 0xa8,
  25178. 0x33,
  25179. 0x88,
  25180. 0x07,
  25181. 0xc7,
  25182. 0x31,
  25183. 0xb1,
  25184. 0x12,
  25185. 0x10,
  25186. 0x59,
  25187. 0x27,
  25188. 0x80,
  25189. 0xec,
  25190. 0x5f,
  25191. 0x60,
  25192. 0x51,
  25193. 0x7f,
  25194. 0xa9,
  25195. 0x19,
  25196. 0xb5,
  25197. 0x4a,
  25198. 0x0d,
  25199. 0x2d,
  25200. 0xe5,
  25201. 0x7a,
  25202. 0x9f,
  25203. 0x93,
  25204. 0xc9,
  25205. 0x9c,
  25206. 0xef,
  25207. 0xa0,
  25208. 0xe0,
  25209. 0x3b,
  25210. 0x4d,
  25211. 0xae,
  25212. 0x2a,
  25213. 0xf5,
  25214. 0xb0,
  25215. 0xc8,
  25216. 0xeb,
  25217. 0xbb,
  25218. 0x3c,
  25219. 0x83,
  25220. 0x53,
  25221. 0x99,
  25222. 0x61,
  25223. 0x17,
  25224. 0x2b,
  25225. 0x04,
  25226. 0x7e,
  25227. 0xba,
  25228. 0x77,
  25229. 0xd6,
  25230. 0x26,
  25231. 0xe1,
  25232. 0x69,
  25233. 0x14,
  25234. 0x63,
  25235. 0x55,
  25236. 0x21,
  25237. 0x0c,
  25238. 0x7d
  25239. ]);
  25240. var mixCol = new Uint8Array(256);
  25241. for (var i = 0; i < 256; i++) {
  25242. if (i < 128) {
  25243. mixCol[i] = i << 1;
  25244. } else {
  25245. mixCol[i] = i << 1 ^ 0x1b;
  25246. }
  25247. }
  25248. var mix = new Uint32Array([
  25249. 0x00000000,
  25250. 0x0e090d0b,
  25251. 0x1c121a16,
  25252. 0x121b171d,
  25253. 0x3824342c,
  25254. 0x362d3927,
  25255. 0x24362e3a,
  25256. 0x2a3f2331,
  25257. 0x70486858,
  25258. 0x7e416553,
  25259. 0x6c5a724e,
  25260. 0x62537f45,
  25261. 0x486c5c74,
  25262. 0x4665517f,
  25263. 0x547e4662,
  25264. 0x5a774b69,
  25265. 0xe090d0b0,
  25266. 0xee99ddbb,
  25267. 0xfc82caa6,
  25268. 0xf28bc7ad,
  25269. 0xd8b4e49c,
  25270. 0xd6bde997,
  25271. 0xc4a6fe8a,
  25272. 0xcaaff381,
  25273. 0x90d8b8e8,
  25274. 0x9ed1b5e3,
  25275. 0x8ccaa2fe,
  25276. 0x82c3aff5,
  25277. 0xa8fc8cc4,
  25278. 0xa6f581cf,
  25279. 0xb4ee96d2,
  25280. 0xbae79bd9,
  25281. 0xdb3bbb7b,
  25282. 0xd532b670,
  25283. 0xc729a16d,
  25284. 0xc920ac66,
  25285. 0xe31f8f57,
  25286. 0xed16825c,
  25287. 0xff0d9541,
  25288. 0xf104984a,
  25289. 0xab73d323,
  25290. 0xa57ade28,
  25291. 0xb761c935,
  25292. 0xb968c43e,
  25293. 0x9357e70f,
  25294. 0x9d5eea04,
  25295. 0x8f45fd19,
  25296. 0x814cf012,
  25297. 0x3bab6bcb,
  25298. 0x35a266c0,
  25299. 0x27b971dd,
  25300. 0x29b07cd6,
  25301. 0x038f5fe7,
  25302. 0x0d8652ec,
  25303. 0x1f9d45f1,
  25304. 0x119448fa,
  25305. 0x4be30393,
  25306. 0x45ea0e98,
  25307. 0x57f11985,
  25308. 0x59f8148e,
  25309. 0x73c737bf,
  25310. 0x7dce3ab4,
  25311. 0x6fd52da9,
  25312. 0x61dc20a2,
  25313. 0xad766df6,
  25314. 0xa37f60fd,
  25315. 0xb16477e0,
  25316. 0xbf6d7aeb,
  25317. 0x955259da,
  25318. 0x9b5b54d1,
  25319. 0x894043cc,
  25320. 0x87494ec7,
  25321. 0xdd3e05ae,
  25322. 0xd33708a5,
  25323. 0xc12c1fb8,
  25324. 0xcf2512b3,
  25325. 0xe51a3182,
  25326. 0xeb133c89,
  25327. 0xf9082b94,
  25328. 0xf701269f,
  25329. 0x4de6bd46,
  25330. 0x43efb04d,
  25331. 0x51f4a750,
  25332. 0x5ffdaa5b,
  25333. 0x75c2896a,
  25334. 0x7bcb8461,
  25335. 0x69d0937c,
  25336. 0x67d99e77,
  25337. 0x3daed51e,
  25338. 0x33a7d815,
  25339. 0x21bccf08,
  25340. 0x2fb5c203,
  25341. 0x058ae132,
  25342. 0x0b83ec39,
  25343. 0x1998fb24,
  25344. 0x1791f62f,
  25345. 0x764dd68d,
  25346. 0x7844db86,
  25347. 0x6a5fcc9b,
  25348. 0x6456c190,
  25349. 0x4e69e2a1,
  25350. 0x4060efaa,
  25351. 0x527bf8b7,
  25352. 0x5c72f5bc,
  25353. 0x0605bed5,
  25354. 0x080cb3de,
  25355. 0x1a17a4c3,
  25356. 0x141ea9c8,
  25357. 0x3e218af9,
  25358. 0x302887f2,
  25359. 0x223390ef,
  25360. 0x2c3a9de4,
  25361. 0x96dd063d,
  25362. 0x98d40b36,
  25363. 0x8acf1c2b,
  25364. 0x84c61120,
  25365. 0xaef93211,
  25366. 0xa0f03f1a,
  25367. 0xb2eb2807,
  25368. 0xbce2250c,
  25369. 0xe6956e65,
  25370. 0xe89c636e,
  25371. 0xfa877473,
  25372. 0xf48e7978,
  25373. 0xdeb15a49,
  25374. 0xd0b85742,
  25375. 0xc2a3405f,
  25376. 0xccaa4d54,
  25377. 0x41ecdaf7,
  25378. 0x4fe5d7fc,
  25379. 0x5dfec0e1,
  25380. 0x53f7cdea,
  25381. 0x79c8eedb,
  25382. 0x77c1e3d0,
  25383. 0x65daf4cd,
  25384. 0x6bd3f9c6,
  25385. 0x31a4b2af,
  25386. 0x3fadbfa4,
  25387. 0x2db6a8b9,
  25388. 0x23bfa5b2,
  25389. 0x09808683,
  25390. 0x07898b88,
  25391. 0x15929c95,
  25392. 0x1b9b919e,
  25393. 0xa17c0a47,
  25394. 0xaf75074c,
  25395. 0xbd6e1051,
  25396. 0xb3671d5a,
  25397. 0x99583e6b,
  25398. 0x97513360,
  25399. 0x854a247d,
  25400. 0x8b432976,
  25401. 0xd134621f,
  25402. 0xdf3d6f14,
  25403. 0xcd267809,
  25404. 0xc32f7502,
  25405. 0xe9105633,
  25406. 0xe7195b38,
  25407. 0xf5024c25,
  25408. 0xfb0b412e,
  25409. 0x9ad7618c,
  25410. 0x94de6c87,
  25411. 0x86c57b9a,
  25412. 0x88cc7691,
  25413. 0xa2f355a0,
  25414. 0xacfa58ab,
  25415. 0xbee14fb6,
  25416. 0xb0e842bd,
  25417. 0xea9f09d4,
  25418. 0xe49604df,
  25419. 0xf68d13c2,
  25420. 0xf8841ec9,
  25421. 0xd2bb3df8,
  25422. 0xdcb230f3,
  25423. 0xcea927ee,
  25424. 0xc0a02ae5,
  25425. 0x7a47b13c,
  25426. 0x744ebc37,
  25427. 0x6655ab2a,
  25428. 0x685ca621,
  25429. 0x42638510,
  25430. 0x4c6a881b,
  25431. 0x5e719f06,
  25432. 0x5078920d,
  25433. 0x0a0fd964,
  25434. 0x0406d46f,
  25435. 0x161dc372,
  25436. 0x1814ce79,
  25437. 0x322bed48,
  25438. 0x3c22e043,
  25439. 0x2e39f75e,
  25440. 0x2030fa55,
  25441. 0xec9ab701,
  25442. 0xe293ba0a,
  25443. 0xf088ad17,
  25444. 0xfe81a01c,
  25445. 0xd4be832d,
  25446. 0xdab78e26,
  25447. 0xc8ac993b,
  25448. 0xc6a59430,
  25449. 0x9cd2df59,
  25450. 0x92dbd252,
  25451. 0x80c0c54f,
  25452. 0x8ec9c844,
  25453. 0xa4f6eb75,
  25454. 0xaaffe67e,
  25455. 0xb8e4f163,
  25456. 0xb6edfc68,
  25457. 0x0c0a67b1,
  25458. 0x02036aba,
  25459. 0x10187da7,
  25460. 0x1e1170ac,
  25461. 0x342e539d,
  25462. 0x3a275e96,
  25463. 0x283c498b,
  25464. 0x26354480,
  25465. 0x7c420fe9,
  25466. 0x724b02e2,
  25467. 0x605015ff,
  25468. 0x6e5918f4,
  25469. 0x44663bc5,
  25470. 0x4a6f36ce,
  25471. 0x587421d3,
  25472. 0x567d2cd8,
  25473. 0x37a10c7a,
  25474. 0x39a80171,
  25475. 0x2bb3166c,
  25476. 0x25ba1b67,
  25477. 0x0f853856,
  25478. 0x018c355d,
  25479. 0x13972240,
  25480. 0x1d9e2f4b,
  25481. 0x47e96422,
  25482. 0x49e06929,
  25483. 0x5bfb7e34,
  25484. 0x55f2733f,
  25485. 0x7fcd500e,
  25486. 0x71c45d05,
  25487. 0x63df4a18,
  25488. 0x6dd64713,
  25489. 0xd731dcca,
  25490. 0xd938d1c1,
  25491. 0xcb23c6dc,
  25492. 0xc52acbd7,
  25493. 0xef15e8e6,
  25494. 0xe11ce5ed,
  25495. 0xf307f2f0,
  25496. 0xfd0efffb,
  25497. 0xa779b492,
  25498. 0xa970b999,
  25499. 0xbb6bae84,
  25500. 0xb562a38f,
  25501. 0x9f5d80be,
  25502. 0x91548db5,
  25503. 0x834f9aa8,
  25504. 0x8d4697a3
  25505. ]);
  25506. function expandKey256(cipherKey) {
  25507. var b = 240, result = new Uint8Array(b);
  25508. var r = 1;
  25509. result.set(cipherKey);
  25510. for (var j = 32, i = 1; j < b; ++i) {
  25511. if (j % 32 === 16) {
  25512. t1 = s[t1];
  25513. t2 = s[t2];
  25514. t3 = s[t3];
  25515. t4 = s[t4];
  25516. } else if (j % 32 === 0) {
  25517. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  25518. t1 = s[t1];
  25519. t2 = s[t2];
  25520. t3 = s[t3];
  25521. t4 = s[t4];
  25522. t1 = t1 ^ r;
  25523. if ((r <<= 1) >= 256) {
  25524. r = (r ^ 0x1b) & 0xFF;
  25525. }
  25526. }
  25527. for (var n = 0; n < 4; ++n) {
  25528. result[j] = t1 ^= result[j - 32];
  25529. j++;
  25530. result[j] = t2 ^= result[j - 32];
  25531. j++;
  25532. result[j] = t3 ^= result[j - 32];
  25533. j++;
  25534. result[j] = t4 ^= result[j - 32];
  25535. j++;
  25536. }
  25537. }
  25538. return result;
  25539. }
  25540. function decrypt256(input, key) {
  25541. var state = new Uint8Array(16);
  25542. state.set(input);
  25543. var i, j, k;
  25544. var t, u, v;
  25545. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25546. state[j] ^= key[k];
  25547. }
  25548. for (i = 13; i >= 1; --i) {
  25549. t = state[13];
  25550. state[13] = state[9];
  25551. state[9] = state[5];
  25552. state[5] = state[1];
  25553. state[1] = t;
  25554. t = state[14];
  25555. u = state[10];
  25556. state[14] = state[6];
  25557. state[10] = state[2];
  25558. state[6] = t;
  25559. state[2] = u;
  25560. t = state[15];
  25561. u = state[11];
  25562. v = state[7];
  25563. state[15] = state[3];
  25564. state[11] = t;
  25565. state[7] = u;
  25566. state[3] = v;
  25567. for (j = 0; j < 16; ++j) {
  25568. state[j] = inv_s[state[j]];
  25569. }
  25570. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25571. state[j] ^= key[k];
  25572. }
  25573. for (j = 0; j < 16; j += 4) {
  25574. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  25575. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  25576. state[j] = t >>> 24 & 0xFF;
  25577. state[j + 1] = t >> 16 & 0xFF;
  25578. state[j + 2] = t >> 8 & 0xFF;
  25579. state[j + 3] = t & 0xFF;
  25580. }
  25581. }
  25582. t = state[13];
  25583. state[13] = state[9];
  25584. state[9] = state[5];
  25585. state[5] = state[1];
  25586. state[1] = t;
  25587. t = state[14];
  25588. u = state[10];
  25589. state[14] = state[6];
  25590. state[10] = state[2];
  25591. state[6] = t;
  25592. state[2] = u;
  25593. t = state[15];
  25594. u = state[11];
  25595. v = state[7];
  25596. state[15] = state[3];
  25597. state[11] = t;
  25598. state[7] = u;
  25599. state[3] = v;
  25600. for (j = 0; j < 16; ++j) {
  25601. state[j] = inv_s[state[j]];
  25602. state[j] ^= key[j];
  25603. }
  25604. return state;
  25605. }
  25606. function encrypt256(input, key) {
  25607. var t, u, v, k;
  25608. var state = new Uint8Array(16);
  25609. state.set(input);
  25610. for (j = 0; j < 16; ++j) {
  25611. state[j] ^= key[j];
  25612. }
  25613. for (i = 1; i < 14; i++) {
  25614. for (j = 0; j < 16; ++j) {
  25615. state[j] = s[state[j]];
  25616. }
  25617. v = state[1];
  25618. state[1] = state[5];
  25619. state[5] = state[9];
  25620. state[9] = state[13];
  25621. state[13] = v;
  25622. v = state[2];
  25623. u = state[6];
  25624. state[2] = state[10];
  25625. state[6] = state[14];
  25626. state[10] = v;
  25627. state[14] = u;
  25628. v = state[3];
  25629. u = state[7];
  25630. t = state[11];
  25631. state[3] = state[15];
  25632. state[7] = v;
  25633. state[11] = u;
  25634. state[15] = t;
  25635. for (var j = 0; j < 16; j += 4) {
  25636. var s0 = state[j + 0], s1 = state[j + 1];
  25637. var s2 = state[j + 2], s3 = state[j + 3];
  25638. t = s0 ^ s1 ^ s2 ^ s3;
  25639. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  25640. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  25641. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  25642. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  25643. }
  25644. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25645. state[j] ^= key[k];
  25646. }
  25647. }
  25648. for (j = 0; j < 16; ++j) {
  25649. state[j] = s[state[j]];
  25650. }
  25651. v = state[1];
  25652. state[1] = state[5];
  25653. state[5] = state[9];
  25654. state[9] = state[13];
  25655. state[13] = v;
  25656. v = state[2];
  25657. u = state[6];
  25658. state[2] = state[10];
  25659. state[6] = state[14];
  25660. state[10] = v;
  25661. state[14] = u;
  25662. v = state[3];
  25663. u = state[7];
  25664. t = state[11];
  25665. state[3] = state[15];
  25666. state[7] = v;
  25667. state[11] = u;
  25668. state[15] = t;
  25669. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25670. state[j] ^= key[k];
  25671. }
  25672. return state;
  25673. }
  25674. function AES256Cipher(key) {
  25675. this.key = expandKey256(key);
  25676. this.buffer = new Uint8Array(16);
  25677. this.bufferPosition = 0;
  25678. }
  25679. function decryptBlock2(data, finalize) {
  25680. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  25681. for (i = 0; i < sourceLength; ++i) {
  25682. buffer[bufferLength] = data[i];
  25683. ++bufferLength;
  25684. if (bufferLength < 16) {
  25685. continue;
  25686. }
  25687. var plain = decrypt256(buffer, this.key);
  25688. for (j = 0; j < 16; ++j) {
  25689. plain[j] ^= iv[j];
  25690. }
  25691. iv = buffer;
  25692. result.push(plain);
  25693. buffer = new Uint8Array(16);
  25694. bufferLength = 0;
  25695. }
  25696. this.buffer = buffer;
  25697. this.bufferLength = bufferLength;
  25698. this.iv = iv;
  25699. if (result.length === 0) {
  25700. return new Uint8Array([]);
  25701. }
  25702. var outputLength = 16 * result.length;
  25703. if (finalize) {
  25704. var lastBlock = result[result.length - 1];
  25705. var psLen = lastBlock[15];
  25706. if (psLen <= 16) {
  25707. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  25708. if (lastBlock[i] !== psLen) {
  25709. psLen = 0;
  25710. break;
  25711. }
  25712. }
  25713. outputLength -= psLen;
  25714. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  25715. }
  25716. }
  25717. var output = new Uint8Array(outputLength);
  25718. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25719. output.set(result[i], j);
  25720. }
  25721. return output;
  25722. }
  25723. AES256Cipher.prototype = {
  25724. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  25725. var i, sourceLength = data.length;
  25726. var buffer = this.buffer, bufferLength = this.bufferPosition;
  25727. if (iv) {
  25728. this.iv = iv;
  25729. } else {
  25730. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  25731. buffer[bufferLength] = data[i];
  25732. }
  25733. if (bufferLength < 16) {
  25734. this.bufferLength = bufferLength;
  25735. return new Uint8Array([]);
  25736. }
  25737. this.iv = buffer;
  25738. data = data.subarray(16);
  25739. }
  25740. this.buffer = new Uint8Array(16);
  25741. this.bufferLength = 0;
  25742. this.decryptBlock = decryptBlock2;
  25743. return this.decryptBlock(data, finalize);
  25744. },
  25745. encrypt: function AES256Cipher_encrypt(data, iv) {
  25746. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  25747. if (!iv) {
  25748. iv = new Uint8Array(16);
  25749. }
  25750. for (i = 0; i < sourceLength; ++i) {
  25751. buffer[bufferLength] = data[i];
  25752. ++bufferLength;
  25753. if (bufferLength < 16) {
  25754. continue;
  25755. }
  25756. for (j = 0; j < 16; ++j) {
  25757. buffer[j] ^= iv[j];
  25758. }
  25759. var cipher = encrypt256(buffer, this.key);
  25760. this.iv = cipher;
  25761. result.push(cipher);
  25762. buffer = new Uint8Array(16);
  25763. bufferLength = 0;
  25764. }
  25765. this.buffer = buffer;
  25766. this.bufferLength = bufferLength;
  25767. this.iv = iv;
  25768. if (result.length === 0) {
  25769. return new Uint8Array([]);
  25770. }
  25771. var outputLength = 16 * result.length;
  25772. var output = new Uint8Array(outputLength);
  25773. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25774. output.set(result[i], j);
  25775. }
  25776. return output;
  25777. }
  25778. };
  25779. return AES256Cipher;
  25780. }();
  25781. var PDF17 = function PDF17Closure() {
  25782. function compareByteArrays(array1, array2) {
  25783. if (array1.length !== array2.length) {
  25784. return false;
  25785. }
  25786. for (var i = 0; i < array1.length; i++) {
  25787. if (array1[i] !== array2[i]) {
  25788. return false;
  25789. }
  25790. }
  25791. return true;
  25792. }
  25793. function PDF17() {
  25794. }
  25795. PDF17.prototype = {
  25796. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25797. var hashData = new Uint8Array(password.length + 56);
  25798. hashData.set(password, 0);
  25799. hashData.set(ownerValidationSalt, password.length);
  25800. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25801. var result = calculateSHA256(hashData, 0, hashData.length);
  25802. return compareByteArrays(result, ownerPassword);
  25803. },
  25804. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  25805. var hashData = new Uint8Array(password.length + 8);
  25806. hashData.set(password, 0);
  25807. hashData.set(userValidationSalt, password.length);
  25808. var result = calculateSHA256(hashData, 0, hashData.length);
  25809. return compareByteArrays(result, userPassword);
  25810. },
  25811. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25812. var hashData = new Uint8Array(password.length + 56);
  25813. hashData.set(password, 0);
  25814. hashData.set(ownerKeySalt, password.length);
  25815. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25816. var key = calculateSHA256(hashData, 0, hashData.length);
  25817. var cipher = new AES256Cipher(key);
  25818. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25819. },
  25820. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  25821. var hashData = new Uint8Array(password.length + 8);
  25822. hashData.set(password, 0);
  25823. hashData.set(userKeySalt, password.length);
  25824. var key = calculateSHA256(hashData, 0, hashData.length);
  25825. var cipher = new AES256Cipher(key);
  25826. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25827. }
  25828. };
  25829. return PDF17;
  25830. }();
  25831. var PDF20 = function PDF20Closure() {
  25832. function concatArrays(array1, array2) {
  25833. var t = new Uint8Array(array1.length + array2.length);
  25834. t.set(array1, 0);
  25835. t.set(array2, array1.length);
  25836. return t;
  25837. }
  25838. function calculatePDF20Hash(password, input, userBytes) {
  25839. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25840. var e = [0];
  25841. var i = 0;
  25842. while (i < 64 || e[e.length - 1] > i - 32) {
  25843. var arrayLength = password.length + k.length + userBytes.length;
  25844. var k1 = new Uint8Array(arrayLength * 64);
  25845. var array = concatArrays(password, k);
  25846. array = concatArrays(array, userBytes);
  25847. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25848. k1.set(array, pos);
  25849. }
  25850. var cipher = new AES128Cipher(k.subarray(0, 16));
  25851. e = cipher.encrypt(k1, k.subarray(16, 32));
  25852. var remainder = 0;
  25853. for (var z = 0; z < 16; z++) {
  25854. remainder *= 256 % 3;
  25855. remainder %= 3;
  25856. remainder += (e[z] >>> 0) % 3;
  25857. remainder %= 3;
  25858. }
  25859. if (remainder === 0) {
  25860. k = calculateSHA256(e, 0, e.length);
  25861. } else if (remainder === 1) {
  25862. k = calculateSHA384(e, 0, e.length);
  25863. } else if (remainder === 2) {
  25864. k = calculateSHA512(e, 0, e.length);
  25865. }
  25866. i++;
  25867. }
  25868. return k.subarray(0, 32);
  25869. }
  25870. function PDF20() {
  25871. }
  25872. function compareByteArrays(array1, array2) {
  25873. if (array1.length !== array2.length) {
  25874. return false;
  25875. }
  25876. for (var i = 0; i < array1.length; i++) {
  25877. if (array1[i] !== array2[i]) {
  25878. return false;
  25879. }
  25880. }
  25881. return true;
  25882. }
  25883. PDF20.prototype = {
  25884. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25885. return calculatePDF20Hash(password, concatBytes, userBytes);
  25886. },
  25887. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25888. var hashData = new Uint8Array(password.length + 56);
  25889. hashData.set(password, 0);
  25890. hashData.set(ownerValidationSalt, password.length);
  25891. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25892. var result = calculatePDF20Hash(password, hashData, userBytes);
  25893. return compareByteArrays(result, ownerPassword);
  25894. },
  25895. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25896. var hashData = new Uint8Array(password.length + 8);
  25897. hashData.set(password, 0);
  25898. hashData.set(userValidationSalt, password.length);
  25899. var result = calculatePDF20Hash(password, hashData, []);
  25900. return compareByteArrays(result, userPassword);
  25901. },
  25902. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25903. var hashData = new Uint8Array(password.length + 56);
  25904. hashData.set(password, 0);
  25905. hashData.set(ownerKeySalt, password.length);
  25906. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25907. var key = calculatePDF20Hash(password, hashData, userBytes);
  25908. var cipher = new AES256Cipher(key);
  25909. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25910. },
  25911. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25912. var hashData = new Uint8Array(password.length + 8);
  25913. hashData.set(password, 0);
  25914. hashData.set(userKeySalt, password.length);
  25915. var key = calculatePDF20Hash(password, hashData, []);
  25916. var cipher = new AES256Cipher(key);
  25917. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25918. }
  25919. };
  25920. return PDF20;
  25921. }();
  25922. var CipherTransform = function CipherTransformClosure() {
  25923. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25924. this.StringCipherConstructor = stringCipherConstructor;
  25925. this.StreamCipherConstructor = streamCipherConstructor;
  25926. }
  25927. CipherTransform.prototype = {
  25928. createStream: function CipherTransform_createStream(stream, length) {
  25929. var cipher = new this.StreamCipherConstructor();
  25930. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25931. return cipher.decryptBlock(data, finalize);
  25932. });
  25933. },
  25934. decryptString: function CipherTransform_decryptString(s) {
  25935. var cipher = new this.StringCipherConstructor();
  25936. var data = stringToBytes(s);
  25937. data = cipher.decryptBlock(data, true);
  25938. return bytesToString(data);
  25939. }
  25940. };
  25941. return CipherTransform;
  25942. }();
  25943. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25944. var defaultPasswordBytes = new Uint8Array([
  25945. 0x28,
  25946. 0xBF,
  25947. 0x4E,
  25948. 0x5E,
  25949. 0x4E,
  25950. 0x75,
  25951. 0x8A,
  25952. 0x41,
  25953. 0x64,
  25954. 0x00,
  25955. 0x4E,
  25956. 0x56,
  25957. 0xFF,
  25958. 0xFA,
  25959. 0x01,
  25960. 0x08,
  25961. 0x2E,
  25962. 0x2E,
  25963. 0x00,
  25964. 0xB6,
  25965. 0xD0,
  25966. 0x68,
  25967. 0x3E,
  25968. 0x80,
  25969. 0x2F,
  25970. 0x0C,
  25971. 0xA9,
  25972. 0xFE,
  25973. 0x64,
  25974. 0x53,
  25975. 0x69,
  25976. 0x7A
  25977. ]);
  25978. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25979. if (password) {
  25980. var passwordLength = Math.min(127, password.length);
  25981. password = password.subarray(0, passwordLength);
  25982. } else {
  25983. password = [];
  25984. }
  25985. var pdfAlgorithm;
  25986. if (revision === 6) {
  25987. pdfAlgorithm = new PDF20();
  25988. } else {
  25989. pdfAlgorithm = new PDF17();
  25990. }
  25991. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25992. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25993. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25994. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25995. }
  25996. return null;
  25997. }
  25998. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25999. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  26000. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  26001. if (password) {
  26002. n = Math.min(32, password.length);
  26003. for (; i < n; ++i) {
  26004. hashData[i] = password[i];
  26005. }
  26006. }
  26007. j = 0;
  26008. while (i < 32) {
  26009. hashData[i++] = defaultPasswordBytes[j++];
  26010. }
  26011. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  26012. hashData[i++] = ownerPassword[j];
  26013. }
  26014. hashData[i++] = flags & 0xFF;
  26015. hashData[i++] = flags >> 8 & 0xFF;
  26016. hashData[i++] = flags >> 16 & 0xFF;
  26017. hashData[i++] = flags >>> 24 & 0xFF;
  26018. for (j = 0, n = fileId.length; j < n; ++j) {
  26019. hashData[i++] = fileId[j];
  26020. }
  26021. if (revision >= 4 && !encryptMetadata) {
  26022. hashData[i++] = 0xFF;
  26023. hashData[i++] = 0xFF;
  26024. hashData[i++] = 0xFF;
  26025. hashData[i++] = 0xFF;
  26026. }
  26027. var hash = calculateMD5(hashData, 0, i);
  26028. var keyLengthInBytes = keyLength >> 3;
  26029. if (revision >= 3) {
  26030. for (j = 0; j < 50; ++j) {
  26031. hash = calculateMD5(hash, 0, keyLengthInBytes);
  26032. }
  26033. }
  26034. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  26035. var cipher, checkData;
  26036. if (revision >= 3) {
  26037. for (i = 0; i < 32; ++i) {
  26038. hashData[i] = defaultPasswordBytes[i];
  26039. }
  26040. for (j = 0, n = fileId.length; j < n; ++j) {
  26041. hashData[i++] = fileId[j];
  26042. }
  26043. cipher = new ARCFourCipher(encryptionKey);
  26044. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  26045. n = encryptionKey.length;
  26046. var derivedKey = new Uint8Array(n), k;
  26047. for (j = 1; j <= 19; ++j) {
  26048. for (k = 0; k < n; ++k) {
  26049. derivedKey[k] = encryptionKey[k] ^ j;
  26050. }
  26051. cipher = new ARCFourCipher(derivedKey);
  26052. checkData = cipher.encryptBlock(checkData);
  26053. }
  26054. for (j = 0, n = checkData.length; j < n; ++j) {
  26055. if (userPassword[j] !== checkData[j]) {
  26056. return null;
  26057. }
  26058. }
  26059. } else {
  26060. cipher = new ARCFourCipher(encryptionKey);
  26061. checkData = cipher.encryptBlock(defaultPasswordBytes);
  26062. for (j = 0, n = checkData.length; j < n; ++j) {
  26063. if (userPassword[j] !== checkData[j]) {
  26064. return null;
  26065. }
  26066. }
  26067. }
  26068. return encryptionKey;
  26069. }
  26070. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  26071. var hashData = new Uint8Array(32), i = 0, j, n;
  26072. n = Math.min(32, password.length);
  26073. for (; i < n; ++i) {
  26074. hashData[i] = password[i];
  26075. }
  26076. j = 0;
  26077. while (i < 32) {
  26078. hashData[i++] = defaultPasswordBytes[j++];
  26079. }
  26080. var hash = calculateMD5(hashData, 0, i);
  26081. var keyLengthInBytes = keyLength >> 3;
  26082. if (revision >= 3) {
  26083. for (j = 0; j < 50; ++j) {
  26084. hash = calculateMD5(hash, 0, hash.length);
  26085. }
  26086. }
  26087. var cipher, userPassword;
  26088. if (revision >= 3) {
  26089. userPassword = ownerPassword;
  26090. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  26091. for (j = 19; j >= 0; j--) {
  26092. for (k = 0; k < keyLengthInBytes; ++k) {
  26093. derivedKey[k] = hash[k] ^ j;
  26094. }
  26095. cipher = new ARCFourCipher(derivedKey);
  26096. userPassword = cipher.encryptBlock(userPassword);
  26097. }
  26098. } else {
  26099. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  26100. userPassword = cipher.encryptBlock(ownerPassword);
  26101. }
  26102. return userPassword;
  26103. }
  26104. var identityName = Name.get('Identity');
  26105. function CipherTransformFactory(dict, fileId, password) {
  26106. var filter = dict.get('Filter');
  26107. if (!isName(filter, 'Standard')) {
  26108. error('unknown encryption method');
  26109. }
  26110. this.dict = dict;
  26111. var algorithm = dict.get('V');
  26112. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  26113. error('unsupported encryption algorithm');
  26114. }
  26115. this.algorithm = algorithm;
  26116. var keyLength = dict.get('Length');
  26117. if (!keyLength) {
  26118. if (algorithm <= 3) {
  26119. keyLength = 40;
  26120. } else {
  26121. var cfDict = dict.get('CF');
  26122. var streamCryptoName = dict.get('StmF');
  26123. if (isDict(cfDict) && isName(streamCryptoName)) {
  26124. cfDict.suppressEncryption = true;
  26125. var handlerDict = cfDict.get(streamCryptoName.name);
  26126. keyLength = handlerDict && handlerDict.get('Length') || 128;
  26127. if (keyLength < 40) {
  26128. keyLength <<= 3;
  26129. }
  26130. }
  26131. }
  26132. }
  26133. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  26134. error('invalid key length');
  26135. }
  26136. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  26137. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  26138. var flags = dict.get('P');
  26139. var revision = dict.get('R');
  26140. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  26141. this.encryptMetadata = encryptMetadata;
  26142. var fileIdBytes = stringToBytes(fileId);
  26143. var passwordBytes;
  26144. if (password) {
  26145. if (revision === 6) {
  26146. try {
  26147. password = utf8StringToString(password);
  26148. } catch (ex) {
  26149. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  26150. }
  26151. }
  26152. passwordBytes = stringToBytes(password);
  26153. }
  26154. var encryptionKey;
  26155. if (algorithm !== 5) {
  26156. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26157. } else {
  26158. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  26159. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  26160. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  26161. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  26162. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  26163. var ownerEncryption = stringToBytes(dict.get('OE'));
  26164. var userEncryption = stringToBytes(dict.get('UE'));
  26165. var perms = stringToBytes(dict.get('Perms'));
  26166. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  26167. }
  26168. if (!encryptionKey && !password) {
  26169. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  26170. } else if (!encryptionKey && password) {
  26171. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  26172. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26173. }
  26174. if (!encryptionKey) {
  26175. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  26176. }
  26177. this.encryptionKey = encryptionKey;
  26178. if (algorithm >= 4) {
  26179. var cf = dict.get('CF');
  26180. if (isDict(cf)) {
  26181. cf.suppressEncryption = true;
  26182. }
  26183. this.cf = cf;
  26184. this.stmf = dict.get('StmF') || identityName;
  26185. this.strf = dict.get('StrF') || identityName;
  26186. this.eff = dict.get('EFF') || this.stmf;
  26187. }
  26188. }
  26189. function buildObjectKey(num, gen, encryptionKey, isAes) {
  26190. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  26191. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  26192. key[i] = encryptionKey[i];
  26193. }
  26194. key[i++] = num & 0xFF;
  26195. key[i++] = num >> 8 & 0xFF;
  26196. key[i++] = num >> 16 & 0xFF;
  26197. key[i++] = gen & 0xFF;
  26198. key[i++] = gen >> 8 & 0xFF;
  26199. if (isAes) {
  26200. key[i++] = 0x73;
  26201. key[i++] = 0x41;
  26202. key[i++] = 0x6C;
  26203. key[i++] = 0x54;
  26204. }
  26205. var hash = calculateMD5(key, 0, i);
  26206. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  26207. }
  26208. function buildCipherConstructor(cf, name, num, gen, key) {
  26209. assert(isName(name), 'Invalid crypt filter name.');
  26210. var cryptFilter = cf.get(name.name);
  26211. var cfm;
  26212. if (cryptFilter !== null && cryptFilter !== undefined) {
  26213. cfm = cryptFilter.get('CFM');
  26214. }
  26215. if (!cfm || cfm.name === 'None') {
  26216. return function cipherTransformFactoryBuildCipherConstructorNone() {
  26217. return new NullCipher();
  26218. };
  26219. }
  26220. if (cfm.name === 'V2') {
  26221. return function cipherTransformFactoryBuildCipherConstructorV2() {
  26222. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  26223. };
  26224. }
  26225. if (cfm.name === 'AESV2') {
  26226. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  26227. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  26228. };
  26229. }
  26230. if (cfm.name === 'AESV3') {
  26231. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  26232. return new AES256Cipher(key);
  26233. };
  26234. }
  26235. error('Unknown crypto method');
  26236. }
  26237. CipherTransformFactory.prototype = {
  26238. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  26239. if (this.algorithm === 4 || this.algorithm === 5) {
  26240. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  26241. }
  26242. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  26243. var cipherConstructor = function buildCipherCipherConstructor() {
  26244. return new ARCFourCipher(key);
  26245. };
  26246. return new CipherTransform(cipherConstructor, cipherConstructor);
  26247. }
  26248. };
  26249. return CipherTransformFactory;
  26250. }();
  26251. exports.AES128Cipher = AES128Cipher;
  26252. exports.AES256Cipher = AES256Cipher;
  26253. exports.ARCFourCipher = ARCFourCipher;
  26254. exports.CipherTransformFactory = CipherTransformFactory;
  26255. exports.PDF17 = PDF17;
  26256. exports.PDF20 = PDF20;
  26257. exports.calculateMD5 = calculateMD5;
  26258. exports.calculateSHA256 = calculateSHA256;
  26259. exports.calculateSHA384 = calculateSHA384;
  26260. exports.calculateSHA512 = calculateSHA512;
  26261. /***/ }),
  26262. /* 13 */
  26263. /***/ (function(module, exports, __w_pdfjs_require__) {
  26264. "use strict";
  26265. var sharedUtil = __w_pdfjs_require__(0);
  26266. var corePrimitives = __w_pdfjs_require__(1);
  26267. var coreStream = __w_pdfjs_require__(2);
  26268. var coreParser = __w_pdfjs_require__(5);
  26269. var coreImage = __w_pdfjs_require__(27);
  26270. var coreColorSpace = __w_pdfjs_require__(3);
  26271. var coreMurmurHash3 = __w_pdfjs_require__(31);
  26272. var coreFonts = __w_pdfjs_require__(26);
  26273. var coreFunction = __w_pdfjs_require__(6);
  26274. var corePattern = __w_pdfjs_require__(32);
  26275. var coreCMap = __w_pdfjs_require__(23);
  26276. var coreMetrics = __w_pdfjs_require__(30);
  26277. var coreBidi = __w_pdfjs_require__(21);
  26278. var coreEncodings = __w_pdfjs_require__(4);
  26279. var coreStandardFonts = __w_pdfjs_require__(16);
  26280. var coreUnicode = __w_pdfjs_require__(17);
  26281. var coreGlyphList = __w_pdfjs_require__(7);
  26282. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  26283. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  26284. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  26285. var ImageKind = sharedUtil.ImageKind;
  26286. var OPS = sharedUtil.OPS;
  26287. var TextRenderingMode = sharedUtil.TextRenderingMode;
  26288. var CMapCompressionType = sharedUtil.CMapCompressionType;
  26289. var Util = sharedUtil.Util;
  26290. var assert = sharedUtil.assert;
  26291. var createPromiseCapability = sharedUtil.createPromiseCapability;
  26292. var error = sharedUtil.error;
  26293. var info = sharedUtil.info;
  26294. var isArray = sharedUtil.isArray;
  26295. var isNum = sharedUtil.isNum;
  26296. var isString = sharedUtil.isString;
  26297. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  26298. var warn = sharedUtil.warn;
  26299. var Dict = corePrimitives.Dict;
  26300. var Name = corePrimitives.Name;
  26301. var isEOF = corePrimitives.isEOF;
  26302. var isCmd = corePrimitives.isCmd;
  26303. var isDict = corePrimitives.isDict;
  26304. var isName = corePrimitives.isName;
  26305. var isRef = corePrimitives.isRef;
  26306. var isStream = corePrimitives.isStream;
  26307. var DecodeStream = coreStream.DecodeStream;
  26308. var JpegStream = coreStream.JpegStream;
  26309. var Stream = coreStream.Stream;
  26310. var Lexer = coreParser.Lexer;
  26311. var Parser = coreParser.Parser;
  26312. var PDFImage = coreImage.PDFImage;
  26313. var ColorSpace = coreColorSpace.ColorSpace;
  26314. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  26315. var ErrorFont = coreFonts.ErrorFont;
  26316. var FontFlags = coreFonts.FontFlags;
  26317. var Font = coreFonts.Font;
  26318. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  26319. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  26320. var getFontType = coreFonts.getFontType;
  26321. var isPDFFunction = coreFunction.isPDFFunction;
  26322. var PDFFunction = coreFunction.PDFFunction;
  26323. var Pattern = corePattern.Pattern;
  26324. var getTilingPatternIR = corePattern.getTilingPatternIR;
  26325. var CMapFactory = coreCMap.CMapFactory;
  26326. var IdentityCMap = coreCMap.IdentityCMap;
  26327. var getMetrics = coreMetrics.getMetrics;
  26328. var bidi = coreBidi.bidi;
  26329. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  26330. var StandardEncoding = coreEncodings.StandardEncoding;
  26331. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  26332. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  26333. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  26334. var getEncoding = coreEncodings.getEncoding;
  26335. var getStdFontMap = coreStandardFonts.getStdFontMap;
  26336. var getSerifFonts = coreStandardFonts.getSerifFonts;
  26337. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  26338. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  26339. var reverseIfRtl = coreUnicode.reverseIfRtl;
  26340. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  26341. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  26342. var PartialEvaluator = function PartialEvaluatorClosure() {
  26343. var DefaultPartialEvaluatorOptions = {
  26344. forceDataSchema: false,
  26345. maxImageSize: -1,
  26346. disableFontFace: false,
  26347. disableNativeImageDecoder: false
  26348. };
  26349. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  26350. this.xref = xref;
  26351. this.resources = resources;
  26352. this.handler = handler;
  26353. this.forceDataSchema = forceDataSchema;
  26354. }
  26355. NativeImageDecoder.prototype = {
  26356. canDecode: function (image) {
  26357. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  26358. },
  26359. decode: function (image) {
  26360. var dict = image.dict;
  26361. var colorSpace = dict.get('ColorSpace', 'CS');
  26362. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  26363. var numComps = colorSpace.numComps;
  26364. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  26365. image.getIR(this.forceDataSchema),
  26366. numComps
  26367. ]);
  26368. return decodePromise.then(function (message) {
  26369. var data = message.data;
  26370. return new Stream(data, 0, data.length, image.dict);
  26371. });
  26372. }
  26373. };
  26374. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  26375. var dict = image.dict;
  26376. if (dict.has('DecodeParms') || dict.has('DP')) {
  26377. return false;
  26378. }
  26379. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26380. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26381. };
  26382. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  26383. var dict = image.dict;
  26384. if (dict.has('DecodeParms') || dict.has('DP')) {
  26385. return false;
  26386. }
  26387. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26388. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26389. };
  26390. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
  26391. this.pdfManager = pdfManager;
  26392. this.xref = xref;
  26393. this.handler = handler;
  26394. this.pageIndex = pageIndex;
  26395. this.idFactory = idFactory;
  26396. this.fontCache = fontCache;
  26397. this.builtInCMapCache = builtInCMapCache;
  26398. this.options = options || DefaultPartialEvaluatorOptions;
  26399. this.fetchBuiltInCMap = function (name) {
  26400. var cachedCMap = builtInCMapCache[name];
  26401. if (cachedCMap) {
  26402. return Promise.resolve(cachedCMap);
  26403. }
  26404. return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  26405. if (data.compressionType !== CMapCompressionType.NONE) {
  26406. builtInCMapCache[name] = data;
  26407. }
  26408. return data;
  26409. });
  26410. };
  26411. }
  26412. var TIME_SLOT_DURATION_MS = 20;
  26413. var CHECK_TIME_EVERY = 100;
  26414. function TimeSlotManager() {
  26415. this.reset();
  26416. }
  26417. TimeSlotManager.prototype = {
  26418. check: function TimeSlotManager_check() {
  26419. if (++this.checked < CHECK_TIME_EVERY) {
  26420. return false;
  26421. }
  26422. this.checked = 0;
  26423. return this.endTime <= Date.now();
  26424. },
  26425. reset: function TimeSlotManager_reset() {
  26426. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  26427. this.checked = 0;
  26428. }
  26429. };
  26430. var deferred = Promise.resolve();
  26431. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  26432. PartialEvaluator.prototype = {
  26433. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  26434. if (!isDict(resources)) {
  26435. return false;
  26436. }
  26437. var processed = Object.create(null);
  26438. if (resources.objId) {
  26439. processed[resources.objId] = true;
  26440. }
  26441. var nodes = [resources], xref = this.xref;
  26442. while (nodes.length) {
  26443. var key, i, ii;
  26444. var node = nodes.shift();
  26445. var graphicStates = node.get('ExtGState');
  26446. if (isDict(graphicStates)) {
  26447. var graphicStatesKeys = graphicStates.getKeys();
  26448. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  26449. key = graphicStatesKeys[i];
  26450. var graphicState = graphicStates.get(key);
  26451. var bm = graphicState.get('BM');
  26452. if (isName(bm) && bm.name !== 'Normal') {
  26453. return true;
  26454. }
  26455. }
  26456. }
  26457. var xObjects = node.get('XObject');
  26458. if (!isDict(xObjects)) {
  26459. continue;
  26460. }
  26461. var xObjectsKeys = xObjects.getKeys();
  26462. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  26463. key = xObjectsKeys[i];
  26464. var xObject = xObjects.getRaw(key);
  26465. if (isRef(xObject)) {
  26466. if (processed[xObject.toString()]) {
  26467. continue;
  26468. }
  26469. xObject = xref.fetch(xObject);
  26470. }
  26471. if (!isStream(xObject)) {
  26472. continue;
  26473. }
  26474. if (xObject.dict.objId) {
  26475. if (processed[xObject.dict.objId]) {
  26476. continue;
  26477. }
  26478. processed[xObject.dict.objId] = true;
  26479. }
  26480. var xResources = xObject.dict.get('Resources');
  26481. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  26482. nodes.push(xResources);
  26483. if (xResources.objId) {
  26484. processed[xResources.objId] = true;
  26485. }
  26486. }
  26487. }
  26488. }
  26489. return false;
  26490. },
  26491. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  26492. var matrix = xobj.dict.getArray('Matrix');
  26493. var bbox = xobj.dict.getArray('BBox');
  26494. var group = xobj.dict.get('Group');
  26495. if (group) {
  26496. var groupOptions = {
  26497. matrix: matrix,
  26498. bbox: bbox,
  26499. smask: smask,
  26500. isolated: false,
  26501. knockout: false
  26502. };
  26503. var groupSubtype = group.get('S');
  26504. var colorSpace;
  26505. if (isName(groupSubtype, 'Transparency')) {
  26506. groupOptions.isolated = group.get('I') || false;
  26507. groupOptions.knockout = group.get('K') || false;
  26508. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  26509. }
  26510. if (smask && smask.backdrop) {
  26511. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  26512. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  26513. }
  26514. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  26515. }
  26516. operatorList.addOp(OPS.paintFormXObjectBegin, [
  26517. matrix,
  26518. bbox
  26519. ]);
  26520. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  26521. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  26522. if (group) {
  26523. operatorList.addOp(OPS.endGroup, [groupOptions]);
  26524. }
  26525. });
  26526. },
  26527. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  26528. var self = this;
  26529. var dict = image.dict;
  26530. var w = dict.get('Width', 'W');
  26531. var h = dict.get('Height', 'H');
  26532. if (!(w && isNum(w)) || !(h && isNum(h))) {
  26533. warn('Image dimensions are missing, or not numbers.');
  26534. return;
  26535. }
  26536. var maxImageSize = this.options.maxImageSize;
  26537. if (maxImageSize !== -1 && w * h > maxImageSize) {
  26538. warn('Image exceeded maximum allowed size and was removed.');
  26539. return;
  26540. }
  26541. var imageMask = dict.get('ImageMask', 'IM') || false;
  26542. var imgData, args;
  26543. if (imageMask) {
  26544. var width = dict.get('Width', 'W');
  26545. var height = dict.get('Height', 'H');
  26546. var bitStrideLength = width + 7 >> 3;
  26547. var imgArray = image.getBytes(bitStrideLength * height);
  26548. var decode = dict.getArray('Decode', 'D');
  26549. var inverseDecode = !!decode && decode[0] > 0;
  26550. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  26551. imgData.cached = true;
  26552. args = [imgData];
  26553. operatorList.addOp(OPS.paintImageMaskXObject, args);
  26554. if (cacheKey) {
  26555. imageCache[cacheKey] = {
  26556. fn: OPS.paintImageMaskXObject,
  26557. args: args
  26558. };
  26559. }
  26560. return;
  26561. }
  26562. var softMask = dict.get('SMask', 'SM') || false;
  26563. var mask = dict.get('Mask') || false;
  26564. var SMALL_IMAGE_DIMENSIONS = 200;
  26565. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  26566. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  26567. imgData = imageObj.createImageData(true);
  26568. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  26569. return;
  26570. }
  26571. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  26572. var objId = 'img_' + this.idFactory.createObjId();
  26573. operatorList.addDependency(objId);
  26574. args = [
  26575. objId,
  26576. w,
  26577. h
  26578. ];
  26579. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  26580. operatorList.addOp(OPS.paintJpegXObject, args);
  26581. this.handler.send('obj', [
  26582. objId,
  26583. this.pageIndex,
  26584. 'JpegStream',
  26585. image.getIR(this.options.forceDataSchema)
  26586. ]);
  26587. return;
  26588. }
  26589. var nativeImageDecoder = null;
  26590. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  26591. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  26592. }
  26593. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  26594. var imgData = imageObj.createImageData(false);
  26595. self.handler.send('obj', [
  26596. objId,
  26597. self.pageIndex,
  26598. 'Image',
  26599. imgData
  26600. ], [imgData.data.buffer]);
  26601. }).then(undefined, function (reason) {
  26602. warn('Unable to decode image: ' + reason);
  26603. self.handler.send('obj', [
  26604. objId,
  26605. self.pageIndex,
  26606. 'Image',
  26607. null
  26608. ]);
  26609. });
  26610. operatorList.addOp(OPS.paintImageXObject, args);
  26611. if (cacheKey) {
  26612. imageCache[cacheKey] = {
  26613. fn: OPS.paintImageXObject,
  26614. args: args
  26615. };
  26616. }
  26617. },
  26618. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  26619. var smaskContent = smask.get('G');
  26620. var smaskOptions = {
  26621. subtype: smask.get('S').name,
  26622. backdrop: smask.get('BC')
  26623. };
  26624. var transferObj = smask.get('TR');
  26625. if (isPDFFunction(transferObj)) {
  26626. var transferFn = PDFFunction.parse(this.xref, transferObj);
  26627. var transferMap = new Uint8Array(256);
  26628. var tmp = new Float32Array(1);
  26629. for (var i = 0; i < 256; i++) {
  26630. tmp[0] = i / 255;
  26631. transferFn(tmp, 0, tmp, 0);
  26632. transferMap[i] = tmp[0] * 255 | 0;
  26633. }
  26634. smaskOptions.transferMap = transferMap;
  26635. }
  26636. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  26637. },
  26638. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  26639. var tilingOpList = new OperatorList();
  26640. var resourcesArray = [
  26641. patternDict.get('Resources'),
  26642. resources
  26643. ];
  26644. var patternResources = Dict.merge(this.xref, resourcesArray);
  26645. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  26646. operatorList.addDependencies(tilingOpList.dependencies);
  26647. operatorList.addOp(fn, getTilingPatternIR({
  26648. fnArray: tilingOpList.fnArray,
  26649. argsArray: tilingOpList.argsArray
  26650. }, patternDict, args));
  26651. });
  26652. },
  26653. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  26654. var fontName;
  26655. if (fontArgs) {
  26656. fontArgs = fontArgs.slice();
  26657. fontName = fontArgs[0].name;
  26658. }
  26659. var self = this;
  26660. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  26661. if (!translated.font.isType3Font) {
  26662. return translated;
  26663. }
  26664. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  26665. return translated;
  26666. }, function (reason) {
  26667. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26668. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  26669. });
  26670. }).then(function (translated) {
  26671. state.font = translated.font;
  26672. translated.send(self.handler);
  26673. return translated.loadedName;
  26674. });
  26675. },
  26676. handleText: function PartialEvaluator_handleText(chars, state) {
  26677. var font = state.font;
  26678. var glyphs = font.charsToGlyphs(chars);
  26679. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  26680. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  26681. var buildPath = function (fontChar) {
  26682. if (!font.renderer.hasBuiltPath(fontChar)) {
  26683. var path = font.renderer.getPathJs(fontChar);
  26684. this.handler.send('commonobj', [
  26685. font.loadedName + '_path_' + fontChar,
  26686. 'FontPath',
  26687. path
  26688. ]);
  26689. }
  26690. }.bind(this);
  26691. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  26692. var glyph = glyphs[i];
  26693. buildPath(glyph.fontChar);
  26694. var accent = glyph.accent;
  26695. if (accent && accent.fontChar) {
  26696. buildPath(accent.fontChar);
  26697. }
  26698. }
  26699. }
  26700. return glyphs;
  26701. },
  26702. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  26703. var gStateObj = [];
  26704. var gStateKeys = gState.getKeys();
  26705. var self = this;
  26706. var promise = Promise.resolve();
  26707. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  26708. var key = gStateKeys[i];
  26709. var value = gState.get(key);
  26710. switch (key) {
  26711. case 'Type':
  26712. break;
  26713. case 'LW':
  26714. case 'LC':
  26715. case 'LJ':
  26716. case 'ML':
  26717. case 'D':
  26718. case 'RI':
  26719. case 'FL':
  26720. case 'CA':
  26721. case 'ca':
  26722. gStateObj.push([
  26723. key,
  26724. value
  26725. ]);
  26726. break;
  26727. case 'Font':
  26728. promise = promise.then(function () {
  26729. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  26730. operatorList.addDependency(loadedName);
  26731. gStateObj.push([
  26732. key,
  26733. [
  26734. loadedName,
  26735. value[1]
  26736. ]
  26737. ]);
  26738. });
  26739. });
  26740. break;
  26741. case 'BM':
  26742. gStateObj.push([
  26743. key,
  26744. value
  26745. ]);
  26746. break;
  26747. case 'SMask':
  26748. if (isName(value, 'None')) {
  26749. gStateObj.push([
  26750. key,
  26751. false
  26752. ]);
  26753. break;
  26754. }
  26755. if (isDict(value)) {
  26756. promise = promise.then(function (dict) {
  26757. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  26758. }.bind(this, value));
  26759. gStateObj.push([
  26760. key,
  26761. true
  26762. ]);
  26763. } else {
  26764. warn('Unsupported SMask type');
  26765. }
  26766. break;
  26767. case 'OP':
  26768. case 'op':
  26769. case 'OPM':
  26770. case 'BG':
  26771. case 'BG2':
  26772. case 'UCR':
  26773. case 'UCR2':
  26774. case 'TR':
  26775. case 'TR2':
  26776. case 'HT':
  26777. case 'SM':
  26778. case 'SA':
  26779. case 'AIS':
  26780. case 'TK':
  26781. info('graphic state operator ' + key);
  26782. break;
  26783. default:
  26784. info('Unknown graphic state operator ' + key);
  26785. break;
  26786. }
  26787. }
  26788. return promise.then(function () {
  26789. if (gStateObj.length > 0) {
  26790. operatorList.addOp(OPS.setGState, [gStateObj]);
  26791. }
  26792. });
  26793. },
  26794. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  26795. function errorFont() {
  26796. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  26797. }
  26798. var fontRef;
  26799. if (font) {
  26800. assert(isRef(font));
  26801. fontRef = font;
  26802. } else {
  26803. var fontRes = resources.get('Font');
  26804. if (fontRes) {
  26805. fontRef = fontRes.getRaw(fontName);
  26806. } else {
  26807. warn('fontRes not available');
  26808. return errorFont();
  26809. }
  26810. }
  26811. if (!fontRef) {
  26812. warn('fontRef not available');
  26813. return errorFont();
  26814. }
  26815. if (this.fontCache.has(fontRef)) {
  26816. return this.fontCache.get(fontRef);
  26817. }
  26818. font = xref.fetchIfRef(fontRef);
  26819. if (!isDict(font)) {
  26820. return errorFont();
  26821. }
  26822. if (font.translated) {
  26823. return font.translated;
  26824. }
  26825. var fontCapability = createPromiseCapability();
  26826. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  26827. var descriptor = preEvaluatedFont.descriptor;
  26828. var fontRefIsRef = isRef(fontRef), fontID;
  26829. if (fontRefIsRef) {
  26830. fontID = fontRef.toString();
  26831. }
  26832. if (isDict(descriptor)) {
  26833. if (!descriptor.fontAliases) {
  26834. descriptor.fontAliases = Object.create(null);
  26835. }
  26836. var fontAliases = descriptor.fontAliases;
  26837. var hash = preEvaluatedFont.hash;
  26838. if (fontAliases[hash]) {
  26839. var aliasFontRef = fontAliases[hash].aliasRef;
  26840. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26841. this.fontCache.putAlias(fontRef, aliasFontRef);
  26842. return this.fontCache.get(fontRef);
  26843. }
  26844. } else {
  26845. fontAliases[hash] = { fontID: Font.getFontID() };
  26846. }
  26847. if (fontRefIsRef) {
  26848. fontAliases[hash].aliasRef = fontRef;
  26849. }
  26850. fontID = fontAliases[hash].fontID;
  26851. }
  26852. if (fontRefIsRef) {
  26853. this.fontCache.put(fontRef, fontCapability.promise);
  26854. } else {
  26855. if (!fontID) {
  26856. fontID = this.idFactory.createObjId();
  26857. }
  26858. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26859. }
  26860. assert(fontID, 'The "fontID" must be defined.');
  26861. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26862. font.translated = fontCapability.promise;
  26863. var translatedPromise;
  26864. try {
  26865. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26866. } catch (e) {
  26867. translatedPromise = Promise.reject(e);
  26868. }
  26869. var self = this;
  26870. translatedPromise.then(function (translatedFont) {
  26871. if (translatedFont.fontType !== undefined) {
  26872. var xrefFontStats = xref.stats.fontTypes;
  26873. xrefFontStats[translatedFont.fontType] = true;
  26874. }
  26875. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26876. }, function (reason) {
  26877. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26878. try {
  26879. var descriptor = preEvaluatedFont.descriptor;
  26880. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26881. var subtype = fontFile3 && fontFile3.get('Subtype');
  26882. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26883. var xrefFontStats = xref.stats.fontTypes;
  26884. xrefFontStats[fontType] = true;
  26885. } catch (ex) {
  26886. }
  26887. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26888. });
  26889. return fontCapability.promise;
  26890. },
  26891. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26892. var lastIndex = operatorList.length - 1;
  26893. if (!args) {
  26894. args = [];
  26895. }
  26896. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26897. operatorList.addOp(OPS.constructPath, [
  26898. [fn],
  26899. args
  26900. ]);
  26901. } else {
  26902. var opArgs = operatorList.argsArray[lastIndex];
  26903. opArgs[0].push(fn);
  26904. Array.prototype.push.apply(opArgs[1], args);
  26905. }
  26906. },
  26907. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26908. var patternName = args[args.length - 1];
  26909. var pattern;
  26910. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26911. var dict = isStream(pattern) ? pattern.dict : pattern;
  26912. var typeNum = dict.get('PatternType');
  26913. if (typeNum === TILING_PATTERN) {
  26914. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26915. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26916. } else if (typeNum === SHADING_PATTERN) {
  26917. var shading = dict.get('Shading');
  26918. var matrix = dict.getArray('Matrix');
  26919. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26920. operatorList.addOp(fn, pattern.getIR());
  26921. return Promise.resolve();
  26922. }
  26923. return Promise.reject('Unknown PatternType: ' + typeNum);
  26924. }
  26925. operatorList.addOp(fn, args);
  26926. return Promise.resolve();
  26927. },
  26928. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26929. var self = this;
  26930. var xref = this.xref;
  26931. var imageCache = Object.create(null);
  26932. assert(operatorList);
  26933. resources = resources || Dict.empty;
  26934. var xobjs = resources.get('XObject') || Dict.empty;
  26935. var patterns = resources.get('Pattern') || Dict.empty;
  26936. var stateManager = new StateManager(initialState || new EvalState());
  26937. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26938. var timeSlotManager = new TimeSlotManager();
  26939. return new Promise(function promiseBody(resolve, reject) {
  26940. var next = function (promise) {
  26941. promise.then(function () {
  26942. try {
  26943. promiseBody(resolve, reject);
  26944. } catch (ex) {
  26945. reject(ex);
  26946. }
  26947. }, reject);
  26948. };
  26949. task.ensureNotTerminated();
  26950. timeSlotManager.reset();
  26951. var stop, operation = {}, i, ii, cs;
  26952. while (!(stop = timeSlotManager.check())) {
  26953. operation.args = null;
  26954. if (!preprocessor.read(operation)) {
  26955. break;
  26956. }
  26957. var args = operation.args;
  26958. var fn = operation.fn;
  26959. switch (fn | 0) {
  26960. case OPS.paintXObject:
  26961. if (args[0].code) {
  26962. break;
  26963. }
  26964. var name = args[0].name;
  26965. if (!name) {
  26966. warn('XObject must be referred to by name.');
  26967. continue;
  26968. }
  26969. if (imageCache[name] !== undefined) {
  26970. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26971. args = null;
  26972. continue;
  26973. }
  26974. var xobj = xobjs.get(name);
  26975. if (xobj) {
  26976. assert(isStream(xobj), 'XObject should be a stream');
  26977. var type = xobj.dict.get('Subtype');
  26978. assert(isName(type), 'XObject should have a Name subtype');
  26979. if (type.name === 'Form') {
  26980. stateManager.save();
  26981. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26982. stateManager.restore();
  26983. }));
  26984. return;
  26985. } else if (type.name === 'Image') {
  26986. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26987. args = null;
  26988. continue;
  26989. } else if (type.name === 'PS') {
  26990. info('Ignored XObject subtype PS');
  26991. continue;
  26992. } else {
  26993. error('Unhandled XObject subtype ' + type.name);
  26994. }
  26995. }
  26996. break;
  26997. case OPS.setFont:
  26998. var fontSize = args[1];
  26999. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  27000. operatorList.addDependency(loadedName);
  27001. operatorList.addOp(OPS.setFont, [
  27002. loadedName,
  27003. fontSize
  27004. ]);
  27005. }));
  27006. return;
  27007. case OPS.endInlineImage:
  27008. var cacheKey = args[0].cacheKey;
  27009. if (cacheKey) {
  27010. var cacheEntry = imageCache[cacheKey];
  27011. if (cacheEntry !== undefined) {
  27012. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  27013. args = null;
  27014. continue;
  27015. }
  27016. }
  27017. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  27018. args = null;
  27019. continue;
  27020. case OPS.showText:
  27021. args[0] = self.handleText(args[0], stateManager.state);
  27022. break;
  27023. case OPS.showSpacedText:
  27024. var arr = args[0];
  27025. var combinedGlyphs = [];
  27026. var arrLength = arr.length;
  27027. var state = stateManager.state;
  27028. for (i = 0; i < arrLength; ++i) {
  27029. var arrItem = arr[i];
  27030. if (isString(arrItem)) {
  27031. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  27032. } else if (isNum(arrItem)) {
  27033. combinedGlyphs.push(arrItem);
  27034. }
  27035. }
  27036. args[0] = combinedGlyphs;
  27037. fn = OPS.showText;
  27038. break;
  27039. case OPS.nextLineShowText:
  27040. operatorList.addOp(OPS.nextLine);
  27041. args[0] = self.handleText(args[0], stateManager.state);
  27042. fn = OPS.showText;
  27043. break;
  27044. case OPS.nextLineSetSpacingShowText:
  27045. operatorList.addOp(OPS.nextLine);
  27046. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  27047. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  27048. args[0] = self.handleText(args[0], stateManager.state);
  27049. fn = OPS.showText;
  27050. break;
  27051. case OPS.setTextRenderingMode:
  27052. stateManager.state.textRenderingMode = args[0];
  27053. break;
  27054. case OPS.setFillColorSpace:
  27055. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  27056. continue;
  27057. case OPS.setStrokeColorSpace:
  27058. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  27059. continue;
  27060. case OPS.setFillColor:
  27061. cs = stateManager.state.fillColorSpace;
  27062. args = cs.getRgb(args, 0);
  27063. fn = OPS.setFillRGBColor;
  27064. break;
  27065. case OPS.setStrokeColor:
  27066. cs = stateManager.state.strokeColorSpace;
  27067. args = cs.getRgb(args, 0);
  27068. fn = OPS.setStrokeRGBColor;
  27069. break;
  27070. case OPS.setFillGray:
  27071. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  27072. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27073. fn = OPS.setFillRGBColor;
  27074. break;
  27075. case OPS.setStrokeGray:
  27076. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  27077. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27078. fn = OPS.setStrokeRGBColor;
  27079. break;
  27080. case OPS.setFillCMYKColor:
  27081. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  27082. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27083. fn = OPS.setFillRGBColor;
  27084. break;
  27085. case OPS.setStrokeCMYKColor:
  27086. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  27087. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27088. fn = OPS.setStrokeRGBColor;
  27089. break;
  27090. case OPS.setFillRGBColor:
  27091. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  27092. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27093. break;
  27094. case OPS.setStrokeRGBColor:
  27095. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  27096. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27097. break;
  27098. case OPS.setFillColorN:
  27099. cs = stateManager.state.fillColorSpace;
  27100. if (cs.name === 'Pattern') {
  27101. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  27102. return;
  27103. }
  27104. args = cs.getRgb(args, 0);
  27105. fn = OPS.setFillRGBColor;
  27106. break;
  27107. case OPS.setStrokeColorN:
  27108. cs = stateManager.state.strokeColorSpace;
  27109. if (cs.name === 'Pattern') {
  27110. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  27111. return;
  27112. }
  27113. args = cs.getRgb(args, 0);
  27114. fn = OPS.setStrokeRGBColor;
  27115. break;
  27116. case OPS.shadingFill:
  27117. var shadingRes = resources.get('Shading');
  27118. if (!shadingRes) {
  27119. error('No shading resource found');
  27120. }
  27121. var shading = shadingRes.get(args[0].name);
  27122. if (!shading) {
  27123. error('No shading object found');
  27124. }
  27125. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  27126. var patternIR = shadingFill.getIR();
  27127. args = [patternIR];
  27128. fn = OPS.shadingFill;
  27129. break;
  27130. case OPS.setGState:
  27131. var dictName = args[0];
  27132. var extGState = resources.get('ExtGState');
  27133. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  27134. break;
  27135. }
  27136. var gState = extGState.get(dictName.name);
  27137. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  27138. return;
  27139. case OPS.moveTo:
  27140. case OPS.lineTo:
  27141. case OPS.curveTo:
  27142. case OPS.curveTo2:
  27143. case OPS.curveTo3:
  27144. case OPS.closePath:
  27145. self.buildPath(operatorList, fn, args);
  27146. continue;
  27147. case OPS.rectangle:
  27148. self.buildPath(operatorList, fn, args);
  27149. continue;
  27150. case OPS.markPoint:
  27151. case OPS.markPointProps:
  27152. case OPS.beginMarkedContent:
  27153. case OPS.beginMarkedContentProps:
  27154. case OPS.endMarkedContent:
  27155. case OPS.beginCompat:
  27156. case OPS.endCompat:
  27157. continue;
  27158. default:
  27159. if (args !== null) {
  27160. for (i = 0, ii = args.length; i < ii; i++) {
  27161. if (args[i] instanceof Dict) {
  27162. break;
  27163. }
  27164. }
  27165. if (i < ii) {
  27166. warn('getOperatorList - ignoring operator: ' + fn);
  27167. continue;
  27168. }
  27169. }
  27170. }
  27171. operatorList.addOp(fn, args);
  27172. }
  27173. if (stop) {
  27174. next(deferred);
  27175. return;
  27176. }
  27177. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  27178. operatorList.addOp(OPS.restore, []);
  27179. }
  27180. resolve();
  27181. });
  27182. },
  27183. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  27184. stateManager = stateManager || new StateManager(new TextState());
  27185. var WhitespaceRegexp = /\s/g;
  27186. var textContent = {
  27187. items: [],
  27188. styles: Object.create(null)
  27189. };
  27190. var textContentItem = {
  27191. initialized: false,
  27192. str: [],
  27193. width: 0,
  27194. height: 0,
  27195. vertical: false,
  27196. lastAdvanceWidth: 0,
  27197. lastAdvanceHeight: 0,
  27198. textAdvanceScale: 0,
  27199. spaceWidth: 0,
  27200. fakeSpaceMin: Infinity,
  27201. fakeMultiSpaceMin: Infinity,
  27202. fakeMultiSpaceMax: -0,
  27203. textRunBreakAllowed: false,
  27204. transform: null,
  27205. fontName: null
  27206. };
  27207. var SPACE_FACTOR = 0.3;
  27208. var MULTI_SPACE_FACTOR = 1.5;
  27209. var MULTI_SPACE_FACTOR_MAX = 4;
  27210. var self = this;
  27211. var xref = this.xref;
  27212. resources = xref.fetchIfRef(resources) || Dict.empty;
  27213. var xobjs = null;
  27214. var xobjsCache = Object.create(null);
  27215. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  27216. var textState;
  27217. function ensureTextContentItem() {
  27218. if (textContentItem.initialized) {
  27219. return textContentItem;
  27220. }
  27221. var font = textState.font;
  27222. if (!(font.loadedName in textContent.styles)) {
  27223. textContent.styles[font.loadedName] = {
  27224. fontFamily: font.fallbackName,
  27225. ascent: font.ascent,
  27226. descent: font.descent,
  27227. vertical: font.vertical
  27228. };
  27229. }
  27230. textContentItem.fontName = font.loadedName;
  27231. var tsm = [
  27232. textState.fontSize * textState.textHScale,
  27233. 0,
  27234. 0,
  27235. textState.fontSize,
  27236. 0,
  27237. textState.textRise
  27238. ];
  27239. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  27240. var glyphHeight = font.bbox[3] - font.bbox[1];
  27241. if (glyphHeight > 0) {
  27242. glyphHeight = glyphHeight * textState.fontMatrix[3];
  27243. tsm[3] *= glyphHeight;
  27244. }
  27245. }
  27246. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  27247. textContentItem.transform = trm;
  27248. if (!font.vertical) {
  27249. textContentItem.width = 0;
  27250. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  27251. textContentItem.vertical = false;
  27252. } else {
  27253. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  27254. textContentItem.height = 0;
  27255. textContentItem.vertical = true;
  27256. }
  27257. var a = textState.textLineMatrix[0];
  27258. var b = textState.textLineMatrix[1];
  27259. var scaleLineX = Math.sqrt(a * a + b * b);
  27260. a = textState.ctm[0];
  27261. b = textState.ctm[1];
  27262. var scaleCtmX = Math.sqrt(a * a + b * b);
  27263. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  27264. textContentItem.lastAdvanceWidth = 0;
  27265. textContentItem.lastAdvanceHeight = 0;
  27266. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  27267. if (spaceWidth) {
  27268. textContentItem.spaceWidth = spaceWidth;
  27269. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  27270. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  27271. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  27272. textContentItem.textRunBreakAllowed = !font.isMonospace;
  27273. } else {
  27274. textContentItem.spaceWidth = 0;
  27275. textContentItem.fakeSpaceMin = Infinity;
  27276. textContentItem.fakeMultiSpaceMin = Infinity;
  27277. textContentItem.fakeMultiSpaceMax = 0;
  27278. textContentItem.textRunBreakAllowed = false;
  27279. }
  27280. textContentItem.initialized = true;
  27281. return textContentItem;
  27282. }
  27283. function replaceWhitespace(str) {
  27284. var i = 0, ii = str.length, code;
  27285. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  27286. i++;
  27287. }
  27288. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  27289. }
  27290. function runBidiTransform(textChunk) {
  27291. var str = textChunk.str.join('');
  27292. var bidiResult = bidi(str, -1, textChunk.vertical);
  27293. return {
  27294. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  27295. dir: bidiResult.dir,
  27296. width: textChunk.width,
  27297. height: textChunk.height,
  27298. transform: textChunk.transform,
  27299. fontName: textChunk.fontName
  27300. };
  27301. }
  27302. function handleSetFont(fontName, fontRef) {
  27303. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  27304. textState.font = translated.font;
  27305. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  27306. });
  27307. }
  27308. function buildTextContentItem(chars) {
  27309. var font = textState.font;
  27310. var textChunk = ensureTextContentItem();
  27311. var width = 0;
  27312. var height = 0;
  27313. var glyphs = font.charsToGlyphs(chars);
  27314. for (var i = 0; i < glyphs.length; i++) {
  27315. var glyph = glyphs[i];
  27316. var glyphWidth = null;
  27317. if (font.vertical && glyph.vmetric) {
  27318. glyphWidth = glyph.vmetric[0];
  27319. } else {
  27320. glyphWidth = glyph.width;
  27321. }
  27322. var glyphUnicode = glyph.unicode;
  27323. var NormalizedUnicodes = getNormalizedUnicodes();
  27324. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  27325. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  27326. }
  27327. glyphUnicode = reverseIfRtl(glyphUnicode);
  27328. var charSpacing = textState.charSpacing;
  27329. if (glyph.isSpace) {
  27330. var wordSpacing = textState.wordSpacing;
  27331. charSpacing += wordSpacing;
  27332. if (wordSpacing > 0) {
  27333. addFakeSpaces(wordSpacing, textChunk.str);
  27334. }
  27335. }
  27336. var tx = 0;
  27337. var ty = 0;
  27338. if (!font.vertical) {
  27339. var w0 = glyphWidth * textState.fontMatrix[0];
  27340. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  27341. width += tx;
  27342. } else {
  27343. var w1 = glyphWidth * textState.fontMatrix[0];
  27344. ty = w1 * textState.fontSize + charSpacing;
  27345. height += ty;
  27346. }
  27347. textState.translateTextMatrix(tx, ty);
  27348. textChunk.str.push(glyphUnicode);
  27349. }
  27350. if (!font.vertical) {
  27351. textChunk.lastAdvanceWidth = width;
  27352. textChunk.width += width;
  27353. } else {
  27354. textChunk.lastAdvanceHeight = height;
  27355. textChunk.height += Math.abs(height);
  27356. }
  27357. return textChunk;
  27358. }
  27359. function addFakeSpaces(width, strBuf) {
  27360. if (width < textContentItem.fakeSpaceMin) {
  27361. return;
  27362. }
  27363. if (width < textContentItem.fakeMultiSpaceMin) {
  27364. strBuf.push(' ');
  27365. return;
  27366. }
  27367. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  27368. while (fakeSpaces-- > 0) {
  27369. strBuf.push(' ');
  27370. }
  27371. }
  27372. function flushTextContentItem() {
  27373. if (!textContentItem.initialized) {
  27374. return;
  27375. }
  27376. textContentItem.width *= textContentItem.textAdvanceScale;
  27377. textContentItem.height *= textContentItem.textAdvanceScale;
  27378. textContent.items.push(runBidiTransform(textContentItem));
  27379. textContentItem.initialized = false;
  27380. textContentItem.str.length = 0;
  27381. }
  27382. var timeSlotManager = new TimeSlotManager();
  27383. return new Promise(function promiseBody(resolve, reject) {
  27384. var next = function (promise) {
  27385. promise.then(function () {
  27386. try {
  27387. promiseBody(resolve, reject);
  27388. } catch (ex) {
  27389. reject(ex);
  27390. }
  27391. }, reject);
  27392. };
  27393. task.ensureNotTerminated();
  27394. timeSlotManager.reset();
  27395. var stop, operation = {}, args = [];
  27396. while (!(stop = timeSlotManager.check())) {
  27397. args.length = 0;
  27398. operation.args = args;
  27399. if (!preprocessor.read(operation)) {
  27400. break;
  27401. }
  27402. textState = stateManager.state;
  27403. var fn = operation.fn;
  27404. args = operation.args;
  27405. var advance, diff;
  27406. switch (fn | 0) {
  27407. case OPS.setFont:
  27408. var fontNameArg = args[0].name, fontSizeArg = args[1];
  27409. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  27410. break;
  27411. }
  27412. flushTextContentItem();
  27413. textState.fontName = fontNameArg;
  27414. textState.fontSize = fontSizeArg;
  27415. next(handleSetFont(fontNameArg, null));
  27416. return;
  27417. case OPS.setTextRise:
  27418. flushTextContentItem();
  27419. textState.textRise = args[0];
  27420. break;
  27421. case OPS.setHScale:
  27422. flushTextContentItem();
  27423. textState.textHScale = args[0] / 100;
  27424. break;
  27425. case OPS.setLeading:
  27426. flushTextContentItem();
  27427. textState.leading = args[0];
  27428. break;
  27429. case OPS.moveText:
  27430. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  27431. advance = args[0] - args[1];
  27432. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  27433. textState.translateTextLineMatrix(args[0], args[1]);
  27434. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  27435. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  27436. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  27437. addFakeSpaces(diff, textContentItem.str);
  27438. break;
  27439. }
  27440. flushTextContentItem();
  27441. textState.translateTextLineMatrix(args[0], args[1]);
  27442. textState.textMatrix = textState.textLineMatrix.slice();
  27443. break;
  27444. case OPS.setLeadingMoveText:
  27445. flushTextContentItem();
  27446. textState.leading = -args[1];
  27447. textState.translateTextLineMatrix(args[0], args[1]);
  27448. textState.textMatrix = textState.textLineMatrix.slice();
  27449. break;
  27450. case OPS.nextLine:
  27451. flushTextContentItem();
  27452. textState.carriageReturn();
  27453. break;
  27454. case OPS.setTextMatrix:
  27455. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  27456. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  27457. textState.translateTextLineMatrix(advance.width, advance.height);
  27458. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  27459. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  27460. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  27461. addFakeSpaces(diff, textContentItem.str);
  27462. break;
  27463. }
  27464. flushTextContentItem();
  27465. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27466. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27467. break;
  27468. case OPS.setCharSpacing:
  27469. textState.charSpacing = args[0];
  27470. break;
  27471. case OPS.setWordSpacing:
  27472. textState.wordSpacing = args[0];
  27473. break;
  27474. case OPS.beginText:
  27475. flushTextContentItem();
  27476. textState.textMatrix = IDENTITY_MATRIX.slice();
  27477. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  27478. break;
  27479. case OPS.showSpacedText:
  27480. var items = args[0];
  27481. var offset;
  27482. for (var j = 0, jj = items.length; j < jj; j++) {
  27483. if (typeof items[j] === 'string') {
  27484. buildTextContentItem(items[j]);
  27485. } else if (isNum(items[j])) {
  27486. ensureTextContentItem();
  27487. advance = items[j] * textState.fontSize / 1000;
  27488. var breakTextRun = false;
  27489. if (textState.font.vertical) {
  27490. offset = advance;
  27491. textState.translateTextMatrix(0, offset);
  27492. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27493. if (!breakTextRun) {
  27494. textContentItem.height += offset;
  27495. }
  27496. } else {
  27497. advance = -advance;
  27498. offset = advance * textState.textHScale;
  27499. textState.translateTextMatrix(offset, 0);
  27500. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27501. if (!breakTextRun) {
  27502. textContentItem.width += offset;
  27503. }
  27504. }
  27505. if (breakTextRun) {
  27506. flushTextContentItem();
  27507. } else if (advance > 0) {
  27508. addFakeSpaces(advance, textContentItem.str);
  27509. }
  27510. }
  27511. }
  27512. break;
  27513. case OPS.showText:
  27514. buildTextContentItem(args[0]);
  27515. break;
  27516. case OPS.nextLineShowText:
  27517. flushTextContentItem();
  27518. textState.carriageReturn();
  27519. buildTextContentItem(args[0]);
  27520. break;
  27521. case OPS.nextLineSetSpacingShowText:
  27522. flushTextContentItem();
  27523. textState.wordSpacing = args[0];
  27524. textState.charSpacing = args[1];
  27525. textState.carriageReturn();
  27526. buildTextContentItem(args[2]);
  27527. break;
  27528. case OPS.paintXObject:
  27529. flushTextContentItem();
  27530. if (args[0].code) {
  27531. break;
  27532. }
  27533. if (!xobjs) {
  27534. xobjs = resources.get('XObject') || Dict.empty;
  27535. }
  27536. var name = args[0].name;
  27537. if (xobjsCache.key === name) {
  27538. if (xobjsCache.texts) {
  27539. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  27540. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  27541. }
  27542. break;
  27543. }
  27544. var xobj = xobjs.get(name);
  27545. if (!xobj) {
  27546. break;
  27547. }
  27548. assert(isStream(xobj), 'XObject should be a stream');
  27549. var type = xobj.dict.get('Subtype');
  27550. assert(isName(type), 'XObject should have a Name subtype');
  27551. if ('Form' !== type.name) {
  27552. xobjsCache.key = name;
  27553. xobjsCache.texts = null;
  27554. break;
  27555. }
  27556. stateManager.save();
  27557. var matrix = xobj.dict.getArray('Matrix');
  27558. if (isArray(matrix) && matrix.length === 6) {
  27559. stateManager.transform(matrix);
  27560. }
  27561. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  27562. Util.appendToArray(textContent.items, formTextContent.items);
  27563. Util.extendObj(textContent.styles, formTextContent.styles);
  27564. stateManager.restore();
  27565. xobjsCache.key = name;
  27566. xobjsCache.texts = formTextContent;
  27567. }));
  27568. return;
  27569. case OPS.setGState:
  27570. flushTextContentItem();
  27571. var dictName = args[0];
  27572. var extGState = resources.get('ExtGState');
  27573. if (!isDict(extGState) || !isName(dictName)) {
  27574. break;
  27575. }
  27576. var gState = extGState.get(dictName.name);
  27577. if (!isDict(gState)) {
  27578. break;
  27579. }
  27580. var gStateFont = gState.get('Font');
  27581. if (gStateFont) {
  27582. textState.fontName = null;
  27583. textState.fontSize = gStateFont[1];
  27584. next(handleSetFont(null, gStateFont[0]));
  27585. return;
  27586. }
  27587. break;
  27588. }
  27589. }
  27590. if (stop) {
  27591. next(deferred);
  27592. return;
  27593. }
  27594. flushTextContentItem();
  27595. resolve(textContent);
  27596. });
  27597. },
  27598. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  27599. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27600. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  27601. if (properties.composite) {
  27602. var cidSystemInfo = dict.get('CIDSystemInfo');
  27603. if (isDict(cidSystemInfo)) {
  27604. properties.cidSystemInfo = {
  27605. registry: cidSystemInfo.get('Registry'),
  27606. ordering: cidSystemInfo.get('Ordering'),
  27607. supplement: cidSystemInfo.get('Supplement')
  27608. };
  27609. }
  27610. var cidToGidMap = dict.get('CIDToGIDMap');
  27611. if (isStream(cidToGidMap)) {
  27612. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  27613. }
  27614. }
  27615. var differences = [];
  27616. var baseEncodingName = null;
  27617. var encoding;
  27618. if (dict.has('Encoding')) {
  27619. encoding = dict.get('Encoding');
  27620. if (isDict(encoding)) {
  27621. baseEncodingName = encoding.get('BaseEncoding');
  27622. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  27623. if (encoding.has('Differences')) {
  27624. var diffEncoding = encoding.get('Differences');
  27625. var index = 0;
  27626. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  27627. var data = xref.fetchIfRef(diffEncoding[j]);
  27628. if (isNum(data)) {
  27629. index = data;
  27630. } else if (isName(data)) {
  27631. differences[index++] = data.name;
  27632. } else {
  27633. error('Invalid entry in \'Differences\' array: ' + data);
  27634. }
  27635. }
  27636. }
  27637. } else if (isName(encoding)) {
  27638. baseEncodingName = encoding.name;
  27639. } else {
  27640. error('Encoding is not a Name nor a Dict');
  27641. }
  27642. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  27643. baseEncodingName = null;
  27644. }
  27645. }
  27646. if (baseEncodingName) {
  27647. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  27648. } else {
  27649. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27650. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  27651. encoding = StandardEncoding;
  27652. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  27653. encoding = WinAnsiEncoding;
  27654. }
  27655. if (isSymbolicFont) {
  27656. encoding = MacRomanEncoding;
  27657. if (!properties.file) {
  27658. if (/Symbol/i.test(properties.name)) {
  27659. encoding = SymbolSetEncoding;
  27660. } else if (/Dingbats/i.test(properties.name)) {
  27661. encoding = ZapfDingbatsEncoding;
  27662. }
  27663. }
  27664. }
  27665. properties.defaultEncoding = encoding;
  27666. }
  27667. properties.differences = differences;
  27668. properties.baseEncodingName = baseEncodingName;
  27669. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  27670. properties.dict = dict;
  27671. return toUnicodePromise.then(function (toUnicode) {
  27672. properties.toUnicode = toUnicode;
  27673. return this.buildToUnicode(properties);
  27674. }.bind(this)).then(function (toUnicode) {
  27675. properties.toUnicode = toUnicode;
  27676. return properties;
  27677. });
  27678. },
  27679. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  27680. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  27681. if (properties.hasIncludedToUnicodeMap) {
  27682. return Promise.resolve(properties.toUnicode);
  27683. }
  27684. var toUnicode, charcode, glyphName;
  27685. if (!properties.composite) {
  27686. toUnicode = [];
  27687. var encoding = properties.defaultEncoding.slice();
  27688. var baseEncodingName = properties.baseEncodingName;
  27689. var differences = properties.differences;
  27690. for (charcode in differences) {
  27691. glyphName = differences[charcode];
  27692. if (glyphName === '.notdef') {
  27693. continue;
  27694. }
  27695. encoding[charcode] = glyphName;
  27696. }
  27697. var glyphsUnicodeMap = getGlyphsUnicode();
  27698. for (charcode in encoding) {
  27699. glyphName = encoding[charcode];
  27700. if (glyphName === '') {
  27701. continue;
  27702. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  27703. var code = 0;
  27704. switch (glyphName[0]) {
  27705. case 'G':
  27706. if (glyphName.length === 3) {
  27707. code = parseInt(glyphName.substr(1), 16);
  27708. }
  27709. break;
  27710. case 'g':
  27711. if (glyphName.length === 5) {
  27712. code = parseInt(glyphName.substr(1), 16);
  27713. }
  27714. break;
  27715. case 'C':
  27716. case 'c':
  27717. if (glyphName.length >= 3) {
  27718. code = +glyphName.substr(1);
  27719. }
  27720. break;
  27721. default:
  27722. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  27723. if (unicode !== -1) {
  27724. code = unicode;
  27725. }
  27726. }
  27727. if (code) {
  27728. if (baseEncodingName && code === +charcode) {
  27729. var baseEncoding = getEncoding(baseEncodingName);
  27730. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  27731. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27732. continue;
  27733. }
  27734. }
  27735. toUnicode[charcode] = String.fromCharCode(code);
  27736. }
  27737. continue;
  27738. }
  27739. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27740. }
  27741. return Promise.resolve(new ToUnicodeMap(toUnicode));
  27742. }
  27743. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) {
  27744. var registry = properties.cidSystemInfo.registry;
  27745. var ordering = properties.cidSystemInfo.ordering;
  27746. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  27747. return CMapFactory.create({
  27748. encoding: ucs2CMapName,
  27749. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27750. useCMap: null
  27751. }).then(function (ucs2CMap) {
  27752. var cMap = properties.cMap;
  27753. toUnicode = [];
  27754. cMap.forEach(function (charcode, cid) {
  27755. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  27756. var ucs2 = ucs2CMap.lookup(cid);
  27757. if (ucs2) {
  27758. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  27759. }
  27760. });
  27761. return new ToUnicodeMap(toUnicode);
  27762. });
  27763. }
  27764. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  27765. },
  27766. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  27767. var cmapObj = toUnicode;
  27768. if (isName(cmapObj)) {
  27769. return CMapFactory.create({
  27770. encoding: cmapObj,
  27771. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27772. useCMap: null
  27773. }).then(function (cmap) {
  27774. if (cmap instanceof IdentityCMap) {
  27775. return new IdentityToUnicodeMap(0, 0xFFFF);
  27776. }
  27777. return new ToUnicodeMap(cmap.getMap());
  27778. });
  27779. } else if (isStream(cmapObj)) {
  27780. return CMapFactory.create({
  27781. encoding: cmapObj,
  27782. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27783. useCMap: null
  27784. }).then(function (cmap) {
  27785. if (cmap instanceof IdentityCMap) {
  27786. return new IdentityToUnicodeMap(0, 0xFFFF);
  27787. }
  27788. var map = new Array(cmap.length);
  27789. cmap.forEach(function (charCode, token) {
  27790. var str = [];
  27791. for (var k = 0; k < token.length; k += 2) {
  27792. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27793. if ((w1 & 0xF800) !== 0xD800) {
  27794. str.push(w1);
  27795. continue;
  27796. }
  27797. k += 2;
  27798. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27799. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  27800. }
  27801. map[charCode] = String.fromCharCode.apply(String, str);
  27802. });
  27803. return new ToUnicodeMap(map);
  27804. });
  27805. }
  27806. return Promise.resolve(null);
  27807. },
  27808. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  27809. var glyphsData = cidToGidStream.getBytes();
  27810. var result = [];
  27811. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  27812. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  27813. if (glyphID === 0) {
  27814. continue;
  27815. }
  27816. var code = j >> 1;
  27817. result[code] = glyphID;
  27818. }
  27819. return result;
  27820. },
  27821. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  27822. var glyphsWidths = [];
  27823. var defaultWidth = 0;
  27824. var glyphsVMetrics = [];
  27825. var defaultVMetrics;
  27826. var i, ii, j, jj, start, code, widths;
  27827. if (properties.composite) {
  27828. defaultWidth = dict.get('DW') || 1000;
  27829. widths = dict.get('W');
  27830. if (widths) {
  27831. for (i = 0, ii = widths.length; i < ii; i++) {
  27832. start = xref.fetchIfRef(widths[i++]);
  27833. code = xref.fetchIfRef(widths[i]);
  27834. if (isArray(code)) {
  27835. for (j = 0, jj = code.length; j < jj; j++) {
  27836. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  27837. }
  27838. } else {
  27839. var width = xref.fetchIfRef(widths[++i]);
  27840. for (j = start; j <= code; j++) {
  27841. glyphsWidths[j] = width;
  27842. }
  27843. }
  27844. }
  27845. }
  27846. if (properties.vertical) {
  27847. var vmetrics = dict.getArray('DW2') || [
  27848. 880,
  27849. -1000
  27850. ];
  27851. defaultVMetrics = [
  27852. vmetrics[1],
  27853. defaultWidth * 0.5,
  27854. vmetrics[0]
  27855. ];
  27856. vmetrics = dict.get('W2');
  27857. if (vmetrics) {
  27858. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27859. start = xref.fetchIfRef(vmetrics[i++]);
  27860. code = xref.fetchIfRef(vmetrics[i]);
  27861. if (isArray(code)) {
  27862. for (j = 0, jj = code.length; j < jj; j++) {
  27863. glyphsVMetrics[start++] = [
  27864. xref.fetchIfRef(code[j++]),
  27865. xref.fetchIfRef(code[j++]),
  27866. xref.fetchIfRef(code[j])
  27867. ];
  27868. }
  27869. } else {
  27870. var vmetric = [
  27871. xref.fetchIfRef(vmetrics[++i]),
  27872. xref.fetchIfRef(vmetrics[++i]),
  27873. xref.fetchIfRef(vmetrics[++i])
  27874. ];
  27875. for (j = start; j <= code; j++) {
  27876. glyphsVMetrics[j] = vmetric;
  27877. }
  27878. }
  27879. }
  27880. }
  27881. }
  27882. } else {
  27883. var firstChar = properties.firstChar;
  27884. widths = dict.get('Widths');
  27885. if (widths) {
  27886. j = firstChar;
  27887. for (i = 0, ii = widths.length; i < ii; i++) {
  27888. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27889. }
  27890. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27891. } else {
  27892. var baseFontName = dict.get('BaseFont');
  27893. if (isName(baseFontName)) {
  27894. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27895. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27896. defaultWidth = metrics.defaultWidth;
  27897. }
  27898. }
  27899. }
  27900. var isMonospace = true;
  27901. var firstWidth = defaultWidth;
  27902. for (var glyph in glyphsWidths) {
  27903. var glyphWidth = glyphsWidths[glyph];
  27904. if (!glyphWidth) {
  27905. continue;
  27906. }
  27907. if (!firstWidth) {
  27908. firstWidth = glyphWidth;
  27909. continue;
  27910. }
  27911. if (firstWidth !== glyphWidth) {
  27912. isMonospace = false;
  27913. break;
  27914. }
  27915. }
  27916. if (isMonospace) {
  27917. properties.flags |= FontFlags.FixedPitch;
  27918. }
  27919. properties.defaultWidth = defaultWidth;
  27920. properties.widths = glyphsWidths;
  27921. properties.defaultVMetrics = defaultVMetrics;
  27922. properties.vmetrics = glyphsVMetrics;
  27923. },
  27924. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27925. var fontNameWoStyle = baseFontName.split('-')[0];
  27926. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27927. },
  27928. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27929. var defaultWidth = 0;
  27930. var widths = [];
  27931. var monospace = false;
  27932. var stdFontMap = getStdFontMap();
  27933. var lookupName = stdFontMap[name] || name;
  27934. var Metrics = getMetrics();
  27935. if (!(lookupName in Metrics)) {
  27936. if (this.isSerifFont(name)) {
  27937. lookupName = 'Times-Roman';
  27938. } else {
  27939. lookupName = 'Helvetica';
  27940. }
  27941. }
  27942. var glyphWidths = Metrics[lookupName];
  27943. if (isNum(glyphWidths)) {
  27944. defaultWidth = glyphWidths;
  27945. monospace = true;
  27946. } else {
  27947. widths = glyphWidths();
  27948. }
  27949. return {
  27950. defaultWidth: defaultWidth,
  27951. monospace: monospace,
  27952. widths: widths
  27953. };
  27954. },
  27955. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27956. var widths = Object.create(null);
  27957. var differences = properties.differences;
  27958. var encoding = properties.defaultEncoding;
  27959. for (var charCode = 0; charCode < 256; charCode++) {
  27960. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27961. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27962. continue;
  27963. }
  27964. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27965. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27966. continue;
  27967. }
  27968. }
  27969. return widths;
  27970. },
  27971. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27972. var baseDict = dict;
  27973. var type = dict.get('Subtype');
  27974. assert(isName(type), 'invalid font Subtype');
  27975. var composite = false;
  27976. var uint8array;
  27977. if (type.name === 'Type0') {
  27978. var df = dict.get('DescendantFonts');
  27979. if (!df) {
  27980. error('Descendant fonts are not specified');
  27981. }
  27982. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27983. type = dict.get('Subtype');
  27984. assert(isName(type), 'invalid font Subtype');
  27985. composite = true;
  27986. }
  27987. var descriptor = dict.get('FontDescriptor');
  27988. if (descriptor) {
  27989. var hash = new MurmurHash3_64();
  27990. var encoding = baseDict.getRaw('Encoding');
  27991. if (isName(encoding)) {
  27992. hash.update(encoding.name);
  27993. } else if (isRef(encoding)) {
  27994. hash.update(encoding.toString());
  27995. } else if (isDict(encoding)) {
  27996. var keys = encoding.getKeys();
  27997. for (var i = 0, ii = keys.length; i < ii; i++) {
  27998. var entry = encoding.getRaw(keys[i]);
  27999. if (isName(entry)) {
  28000. hash.update(entry.name);
  28001. } else if (isRef(entry)) {
  28002. hash.update(entry.toString());
  28003. } else if (isArray(entry)) {
  28004. var diffLength = entry.length, diffBuf = new Array(diffLength);
  28005. for (var j = 0; j < diffLength; j++) {
  28006. var diffEntry = entry[j];
  28007. if (isName(diffEntry)) {
  28008. diffBuf[j] = diffEntry.name;
  28009. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  28010. diffBuf[j] = diffEntry.toString();
  28011. }
  28012. }
  28013. hash.update(diffBuf.join());
  28014. }
  28015. }
  28016. }
  28017. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  28018. if (isStream(toUnicode)) {
  28019. var stream = toUnicode.str || toUnicode;
  28020. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  28021. hash.update(uint8array);
  28022. } else if (isName(toUnicode)) {
  28023. hash.update(toUnicode.name);
  28024. }
  28025. var widths = dict.get('Widths') || baseDict.get('Widths');
  28026. if (widths) {
  28027. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  28028. hash.update(uint8array);
  28029. }
  28030. }
  28031. return {
  28032. descriptor: descriptor,
  28033. dict: dict,
  28034. baseDict: baseDict,
  28035. composite: composite,
  28036. type: type.name,
  28037. hash: hash ? hash.hexdigest() : ''
  28038. };
  28039. },
  28040. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  28041. var baseDict = preEvaluatedFont.baseDict;
  28042. var dict = preEvaluatedFont.dict;
  28043. var composite = preEvaluatedFont.composite;
  28044. var descriptor = preEvaluatedFont.descriptor;
  28045. var type = preEvaluatedFont.type;
  28046. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  28047. var properties;
  28048. if (!descriptor) {
  28049. if (type === 'Type3') {
  28050. descriptor = new Dict(null);
  28051. descriptor.set('FontName', Name.get(type));
  28052. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  28053. } else {
  28054. var baseFontName = dict.get('BaseFont');
  28055. if (!isName(baseFontName)) {
  28056. error('Base font is not specified');
  28057. }
  28058. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  28059. var metrics = this.getBaseFontMetrics(baseFontName);
  28060. var fontNameWoStyle = baseFontName.split('-')[0];
  28061. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  28062. properties = {
  28063. type: type,
  28064. name: baseFontName,
  28065. widths: metrics.widths,
  28066. defaultWidth: metrics.defaultWidth,
  28067. flags: flags,
  28068. firstChar: 0,
  28069. lastChar: maxCharIndex
  28070. };
  28071. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  28072. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  28073. return new Font(baseFontName, null, properties);
  28074. }.bind(this));
  28075. }
  28076. }
  28077. var firstChar = dict.get('FirstChar') || 0;
  28078. var lastChar = dict.get('LastChar') || maxCharIndex;
  28079. var fontName = descriptor.get('FontName');
  28080. var baseFont = dict.get('BaseFont');
  28081. if (isString(fontName)) {
  28082. fontName = Name.get(fontName);
  28083. }
  28084. if (isString(baseFont)) {
  28085. baseFont = Name.get(baseFont);
  28086. }
  28087. if (type !== 'Type3') {
  28088. var fontNameStr = fontName && fontName.name;
  28089. var baseFontStr = baseFont && baseFont.name;
  28090. if (fontNameStr !== baseFontStr) {
  28091. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  28092. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  28093. fontName = baseFont;
  28094. }
  28095. }
  28096. }
  28097. fontName = fontName || baseFont;
  28098. assert(isName(fontName), 'invalid font name');
  28099. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  28100. if (fontFile) {
  28101. if (fontFile.dict) {
  28102. var subtype = fontFile.dict.get('Subtype');
  28103. if (subtype) {
  28104. subtype = subtype.name;
  28105. }
  28106. var length1 = fontFile.dict.get('Length1');
  28107. var length2 = fontFile.dict.get('Length2');
  28108. var length3 = fontFile.dict.get('Length3');
  28109. }
  28110. }
  28111. properties = {
  28112. type: type,
  28113. name: fontName.name,
  28114. subtype: subtype,
  28115. file: fontFile,
  28116. length1: length1,
  28117. length2: length2,
  28118. length3: length3,
  28119. loadedName: baseDict.loadedName,
  28120. composite: composite,
  28121. wideChars: composite,
  28122. fixedPitch: false,
  28123. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  28124. firstChar: firstChar || 0,
  28125. lastChar: lastChar || maxCharIndex,
  28126. bbox: descriptor.getArray('FontBBox'),
  28127. ascent: descriptor.get('Ascent'),
  28128. descent: descriptor.get('Descent'),
  28129. xHeight: descriptor.get('XHeight'),
  28130. capHeight: descriptor.get('CapHeight'),
  28131. flags: descriptor.get('Flags'),
  28132. italicAngle: descriptor.get('ItalicAngle'),
  28133. coded: false
  28134. };
  28135. var cMapPromise;
  28136. if (composite) {
  28137. var cidEncoding = baseDict.get('Encoding');
  28138. if (isName(cidEncoding)) {
  28139. properties.cidEncoding = cidEncoding.name;
  28140. }
  28141. cMapPromise = CMapFactory.create({
  28142. encoding: cidEncoding,
  28143. fetchBuiltInCMap: this.fetchBuiltInCMap,
  28144. useCMap: null
  28145. }).then(function (cMap) {
  28146. properties.cMap = cMap;
  28147. properties.vertical = properties.cMap.vertical;
  28148. });
  28149. } else {
  28150. cMapPromise = Promise.resolve(undefined);
  28151. }
  28152. return cMapPromise.then(function () {
  28153. return this.extractDataStructures(dict, baseDict, xref, properties);
  28154. }.bind(this)).then(function (properties) {
  28155. this.extractWidths(dict, xref, descriptor, properties);
  28156. if (type === 'Type3') {
  28157. properties.isType3Font = true;
  28158. }
  28159. return new Font(fontName.name, fontFile, properties);
  28160. }.bind(this));
  28161. }
  28162. };
  28163. return PartialEvaluator;
  28164. }();
  28165. var TranslatedFont = function TranslatedFontClosure() {
  28166. function TranslatedFont(loadedName, font, dict) {
  28167. this.loadedName = loadedName;
  28168. this.font = font;
  28169. this.dict = dict;
  28170. this.type3Loaded = null;
  28171. this.sent = false;
  28172. }
  28173. TranslatedFont.prototype = {
  28174. send: function (handler) {
  28175. if (this.sent) {
  28176. return;
  28177. }
  28178. var fontData = this.font.exportData();
  28179. handler.send('commonobj', [
  28180. this.loadedName,
  28181. 'Font',
  28182. fontData
  28183. ]);
  28184. this.sent = true;
  28185. },
  28186. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  28187. assert(this.font.isType3Font);
  28188. if (this.type3Loaded) {
  28189. return this.type3Loaded;
  28190. }
  28191. var translatedFont = this.font;
  28192. var loadCharProcsPromise = Promise.resolve();
  28193. var charProcs = this.dict.get('CharProcs');
  28194. var fontResources = this.dict.get('Resources') || resources;
  28195. var charProcKeys = charProcs.getKeys();
  28196. var charProcOperatorList = Object.create(null);
  28197. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  28198. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  28199. var glyphStream = charProcs.get(key);
  28200. var operatorList = new OperatorList();
  28201. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  28202. charProcOperatorList[key] = operatorList.getIR();
  28203. parentOperatorList.addDependencies(operatorList.dependencies);
  28204. }, function (reason) {
  28205. warn('Type3 font resource \"' + key + '\" is not available');
  28206. var operatorList = new OperatorList();
  28207. charProcOperatorList[key] = operatorList.getIR();
  28208. });
  28209. }.bind(this, charProcKeys[i]));
  28210. }
  28211. this.type3Loaded = loadCharProcsPromise.then(function () {
  28212. translatedFont.charProcOperatorList = charProcOperatorList;
  28213. });
  28214. return this.type3Loaded;
  28215. }
  28216. };
  28217. return TranslatedFont;
  28218. }();
  28219. var OperatorList = function OperatorListClosure() {
  28220. var CHUNK_SIZE = 1000;
  28221. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  28222. function getTransfers(queue) {
  28223. var transfers = [];
  28224. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28225. for (var i = 0, ii = queue.length; i < ii; i++) {
  28226. switch (fnArray[i]) {
  28227. case OPS.paintInlineImageXObject:
  28228. case OPS.paintInlineImageXObjectGroup:
  28229. case OPS.paintImageMaskXObject:
  28230. var arg = argsArray[i][0];
  28231. if (!arg.cached) {
  28232. transfers.push(arg.data.buffer);
  28233. }
  28234. break;
  28235. }
  28236. }
  28237. return transfers;
  28238. }
  28239. function OperatorList(intent, messageHandler, pageIndex) {
  28240. this.messageHandler = messageHandler;
  28241. this.fnArray = [];
  28242. this.argsArray = [];
  28243. this.dependencies = Object.create(null);
  28244. this._totalLength = 0;
  28245. this.pageIndex = pageIndex;
  28246. this.intent = intent;
  28247. }
  28248. OperatorList.prototype = {
  28249. get length() {
  28250. return this.argsArray.length;
  28251. },
  28252. get totalLength() {
  28253. return this._totalLength + this.length;
  28254. },
  28255. addOp: function (fn, args) {
  28256. this.fnArray.push(fn);
  28257. this.argsArray.push(args);
  28258. if (this.messageHandler) {
  28259. if (this.fnArray.length >= CHUNK_SIZE) {
  28260. this.flush();
  28261. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  28262. this.flush();
  28263. }
  28264. }
  28265. },
  28266. addDependency: function (dependency) {
  28267. if (dependency in this.dependencies) {
  28268. return;
  28269. }
  28270. this.dependencies[dependency] = true;
  28271. this.addOp(OPS.dependency, [dependency]);
  28272. },
  28273. addDependencies: function (dependencies) {
  28274. for (var key in dependencies) {
  28275. this.addDependency(key);
  28276. }
  28277. },
  28278. addOpList: function (opList) {
  28279. Util.extendObj(this.dependencies, opList.dependencies);
  28280. for (var i = 0, ii = opList.length; i < ii; i++) {
  28281. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  28282. }
  28283. },
  28284. getIR: function () {
  28285. return {
  28286. fnArray: this.fnArray,
  28287. argsArray: this.argsArray,
  28288. length: this.length
  28289. };
  28290. },
  28291. flush: function (lastChunk) {
  28292. if (this.intent !== 'oplist') {
  28293. new QueueOptimizer().optimize(this);
  28294. }
  28295. var transfers = getTransfers(this);
  28296. var length = this.length;
  28297. this._totalLength += length;
  28298. this.messageHandler.send('RenderPageChunk', {
  28299. operatorList: {
  28300. fnArray: this.fnArray,
  28301. argsArray: this.argsArray,
  28302. lastChunk: lastChunk,
  28303. length: length
  28304. },
  28305. pageIndex: this.pageIndex,
  28306. intent: this.intent
  28307. }, transfers);
  28308. this.dependencies = Object.create(null);
  28309. this.fnArray.length = 0;
  28310. this.argsArray.length = 0;
  28311. }
  28312. };
  28313. return OperatorList;
  28314. }();
  28315. var StateManager = function StateManagerClosure() {
  28316. function StateManager(initialState) {
  28317. this.state = initialState;
  28318. this.stateStack = [];
  28319. }
  28320. StateManager.prototype = {
  28321. save: function () {
  28322. var old = this.state;
  28323. this.stateStack.push(this.state);
  28324. this.state = old.clone();
  28325. },
  28326. restore: function () {
  28327. var prev = this.stateStack.pop();
  28328. if (prev) {
  28329. this.state = prev;
  28330. }
  28331. },
  28332. transform: function (args) {
  28333. this.state.ctm = Util.transform(this.state.ctm, args);
  28334. }
  28335. };
  28336. return StateManager;
  28337. }();
  28338. var TextState = function TextStateClosure() {
  28339. function TextState() {
  28340. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28341. this.fontName = null;
  28342. this.fontSize = 0;
  28343. this.font = null;
  28344. this.fontMatrix = FONT_IDENTITY_MATRIX;
  28345. this.textMatrix = IDENTITY_MATRIX.slice();
  28346. this.textLineMatrix = IDENTITY_MATRIX.slice();
  28347. this.charSpacing = 0;
  28348. this.wordSpacing = 0;
  28349. this.leading = 0;
  28350. this.textHScale = 1;
  28351. this.textRise = 0;
  28352. }
  28353. TextState.prototype = {
  28354. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28355. var m = this.textMatrix;
  28356. m[0] = a;
  28357. m[1] = b;
  28358. m[2] = c;
  28359. m[3] = d;
  28360. m[4] = e;
  28361. m[5] = f;
  28362. },
  28363. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28364. var m = this.textLineMatrix;
  28365. m[0] = a;
  28366. m[1] = b;
  28367. m[2] = c;
  28368. m[3] = d;
  28369. m[4] = e;
  28370. m[5] = f;
  28371. },
  28372. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  28373. var m = this.textMatrix;
  28374. m[4] = m[0] * x + m[2] * y + m[4];
  28375. m[5] = m[1] * x + m[3] * y + m[5];
  28376. },
  28377. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  28378. var m = this.textLineMatrix;
  28379. m[4] = m[0] * x + m[2] * y + m[4];
  28380. m[5] = m[1] * x + m[3] * y + m[5];
  28381. },
  28382. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  28383. var font = this.font;
  28384. if (!font) {
  28385. return null;
  28386. }
  28387. var m = this.textLineMatrix;
  28388. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  28389. return null;
  28390. }
  28391. var txDiff = e - m[4], tyDiff = f - m[5];
  28392. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  28393. return null;
  28394. }
  28395. var tx, ty, denominator = a * d - b * c;
  28396. if (font.vertical) {
  28397. tx = -tyDiff * c / denominator;
  28398. ty = tyDiff * a / denominator;
  28399. } else {
  28400. tx = txDiff * d / denominator;
  28401. ty = -txDiff * b / denominator;
  28402. }
  28403. return {
  28404. width: tx,
  28405. height: ty,
  28406. value: font.vertical ? ty : tx
  28407. };
  28408. },
  28409. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  28410. var tsm = [
  28411. this.fontSize * this.textHScale,
  28412. 0,
  28413. 0,
  28414. this.fontSize,
  28415. 0,
  28416. this.textRise
  28417. ];
  28418. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  28419. },
  28420. carriageReturn: function TextState_carriageReturn() {
  28421. this.translateTextLineMatrix(0, -this.leading);
  28422. this.textMatrix = this.textLineMatrix.slice();
  28423. },
  28424. clone: function TextState_clone() {
  28425. var clone = Object.create(this);
  28426. clone.textMatrix = this.textMatrix.slice();
  28427. clone.textLineMatrix = this.textLineMatrix.slice();
  28428. clone.fontMatrix = this.fontMatrix.slice();
  28429. return clone;
  28430. }
  28431. };
  28432. return TextState;
  28433. }();
  28434. var EvalState = function EvalStateClosure() {
  28435. function EvalState() {
  28436. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28437. this.font = null;
  28438. this.textRenderingMode = TextRenderingMode.FILL;
  28439. this.fillColorSpace = ColorSpace.singletons.gray;
  28440. this.strokeColorSpace = ColorSpace.singletons.gray;
  28441. }
  28442. EvalState.prototype = {
  28443. clone: function CanvasExtraState_clone() {
  28444. return Object.create(this);
  28445. }
  28446. };
  28447. return EvalState;
  28448. }();
  28449. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  28450. var getOPMap = getLookupTableFactory(function (t) {
  28451. t['w'] = {
  28452. id: OPS.setLineWidth,
  28453. numArgs: 1,
  28454. variableArgs: false
  28455. };
  28456. t['J'] = {
  28457. id: OPS.setLineCap,
  28458. numArgs: 1,
  28459. variableArgs: false
  28460. };
  28461. t['j'] = {
  28462. id: OPS.setLineJoin,
  28463. numArgs: 1,
  28464. variableArgs: false
  28465. };
  28466. t['M'] = {
  28467. id: OPS.setMiterLimit,
  28468. numArgs: 1,
  28469. variableArgs: false
  28470. };
  28471. t['d'] = {
  28472. id: OPS.setDash,
  28473. numArgs: 2,
  28474. variableArgs: false
  28475. };
  28476. t['ri'] = {
  28477. id: OPS.setRenderingIntent,
  28478. numArgs: 1,
  28479. variableArgs: false
  28480. };
  28481. t['i'] = {
  28482. id: OPS.setFlatness,
  28483. numArgs: 1,
  28484. variableArgs: false
  28485. };
  28486. t['gs'] = {
  28487. id: OPS.setGState,
  28488. numArgs: 1,
  28489. variableArgs: false
  28490. };
  28491. t['q'] = {
  28492. id: OPS.save,
  28493. numArgs: 0,
  28494. variableArgs: false
  28495. };
  28496. t['Q'] = {
  28497. id: OPS.restore,
  28498. numArgs: 0,
  28499. variableArgs: false
  28500. };
  28501. t['cm'] = {
  28502. id: OPS.transform,
  28503. numArgs: 6,
  28504. variableArgs: false
  28505. };
  28506. t['m'] = {
  28507. id: OPS.moveTo,
  28508. numArgs: 2,
  28509. variableArgs: false
  28510. };
  28511. t['l'] = {
  28512. id: OPS.lineTo,
  28513. numArgs: 2,
  28514. variableArgs: false
  28515. };
  28516. t['c'] = {
  28517. id: OPS.curveTo,
  28518. numArgs: 6,
  28519. variableArgs: false
  28520. };
  28521. t['v'] = {
  28522. id: OPS.curveTo2,
  28523. numArgs: 4,
  28524. variableArgs: false
  28525. };
  28526. t['y'] = {
  28527. id: OPS.curveTo3,
  28528. numArgs: 4,
  28529. variableArgs: false
  28530. };
  28531. t['h'] = {
  28532. id: OPS.closePath,
  28533. numArgs: 0,
  28534. variableArgs: false
  28535. };
  28536. t['re'] = {
  28537. id: OPS.rectangle,
  28538. numArgs: 4,
  28539. variableArgs: false
  28540. };
  28541. t['S'] = {
  28542. id: OPS.stroke,
  28543. numArgs: 0,
  28544. variableArgs: false
  28545. };
  28546. t['s'] = {
  28547. id: OPS.closeStroke,
  28548. numArgs: 0,
  28549. variableArgs: false
  28550. };
  28551. t['f'] = {
  28552. id: OPS.fill,
  28553. numArgs: 0,
  28554. variableArgs: false
  28555. };
  28556. t['F'] = {
  28557. id: OPS.fill,
  28558. numArgs: 0,
  28559. variableArgs: false
  28560. };
  28561. t['f*'] = {
  28562. id: OPS.eoFill,
  28563. numArgs: 0,
  28564. variableArgs: false
  28565. };
  28566. t['B'] = {
  28567. id: OPS.fillStroke,
  28568. numArgs: 0,
  28569. variableArgs: false
  28570. };
  28571. t['B*'] = {
  28572. id: OPS.eoFillStroke,
  28573. numArgs: 0,
  28574. variableArgs: false
  28575. };
  28576. t['b'] = {
  28577. id: OPS.closeFillStroke,
  28578. numArgs: 0,
  28579. variableArgs: false
  28580. };
  28581. t['b*'] = {
  28582. id: OPS.closeEOFillStroke,
  28583. numArgs: 0,
  28584. variableArgs: false
  28585. };
  28586. t['n'] = {
  28587. id: OPS.endPath,
  28588. numArgs: 0,
  28589. variableArgs: false
  28590. };
  28591. t['W'] = {
  28592. id: OPS.clip,
  28593. numArgs: 0,
  28594. variableArgs: false
  28595. };
  28596. t['W*'] = {
  28597. id: OPS.eoClip,
  28598. numArgs: 0,
  28599. variableArgs: false
  28600. };
  28601. t['BT'] = {
  28602. id: OPS.beginText,
  28603. numArgs: 0,
  28604. variableArgs: false
  28605. };
  28606. t['ET'] = {
  28607. id: OPS.endText,
  28608. numArgs: 0,
  28609. variableArgs: false
  28610. };
  28611. t['Tc'] = {
  28612. id: OPS.setCharSpacing,
  28613. numArgs: 1,
  28614. variableArgs: false
  28615. };
  28616. t['Tw'] = {
  28617. id: OPS.setWordSpacing,
  28618. numArgs: 1,
  28619. variableArgs: false
  28620. };
  28621. t['Tz'] = {
  28622. id: OPS.setHScale,
  28623. numArgs: 1,
  28624. variableArgs: false
  28625. };
  28626. t['TL'] = {
  28627. id: OPS.setLeading,
  28628. numArgs: 1,
  28629. variableArgs: false
  28630. };
  28631. t['Tf'] = {
  28632. id: OPS.setFont,
  28633. numArgs: 2,
  28634. variableArgs: false
  28635. };
  28636. t['Tr'] = {
  28637. id: OPS.setTextRenderingMode,
  28638. numArgs: 1,
  28639. variableArgs: false
  28640. };
  28641. t['Ts'] = {
  28642. id: OPS.setTextRise,
  28643. numArgs: 1,
  28644. variableArgs: false
  28645. };
  28646. t['Td'] = {
  28647. id: OPS.moveText,
  28648. numArgs: 2,
  28649. variableArgs: false
  28650. };
  28651. t['TD'] = {
  28652. id: OPS.setLeadingMoveText,
  28653. numArgs: 2,
  28654. variableArgs: false
  28655. };
  28656. t['Tm'] = {
  28657. id: OPS.setTextMatrix,
  28658. numArgs: 6,
  28659. variableArgs: false
  28660. };
  28661. t['T*'] = {
  28662. id: OPS.nextLine,
  28663. numArgs: 0,
  28664. variableArgs: false
  28665. };
  28666. t['Tj'] = {
  28667. id: OPS.showText,
  28668. numArgs: 1,
  28669. variableArgs: false
  28670. };
  28671. t['TJ'] = {
  28672. id: OPS.showSpacedText,
  28673. numArgs: 1,
  28674. variableArgs: false
  28675. };
  28676. t['\''] = {
  28677. id: OPS.nextLineShowText,
  28678. numArgs: 1,
  28679. variableArgs: false
  28680. };
  28681. t['"'] = {
  28682. id: OPS.nextLineSetSpacingShowText,
  28683. numArgs: 3,
  28684. variableArgs: false
  28685. };
  28686. t['d0'] = {
  28687. id: OPS.setCharWidth,
  28688. numArgs: 2,
  28689. variableArgs: false
  28690. };
  28691. t['d1'] = {
  28692. id: OPS.setCharWidthAndBounds,
  28693. numArgs: 6,
  28694. variableArgs: false
  28695. };
  28696. t['CS'] = {
  28697. id: OPS.setStrokeColorSpace,
  28698. numArgs: 1,
  28699. variableArgs: false
  28700. };
  28701. t['cs'] = {
  28702. id: OPS.setFillColorSpace,
  28703. numArgs: 1,
  28704. variableArgs: false
  28705. };
  28706. t['SC'] = {
  28707. id: OPS.setStrokeColor,
  28708. numArgs: 4,
  28709. variableArgs: true
  28710. };
  28711. t['SCN'] = {
  28712. id: OPS.setStrokeColorN,
  28713. numArgs: 33,
  28714. variableArgs: true
  28715. };
  28716. t['sc'] = {
  28717. id: OPS.setFillColor,
  28718. numArgs: 4,
  28719. variableArgs: true
  28720. };
  28721. t['scn'] = {
  28722. id: OPS.setFillColorN,
  28723. numArgs: 33,
  28724. variableArgs: true
  28725. };
  28726. t['G'] = {
  28727. id: OPS.setStrokeGray,
  28728. numArgs: 1,
  28729. variableArgs: false
  28730. };
  28731. t['g'] = {
  28732. id: OPS.setFillGray,
  28733. numArgs: 1,
  28734. variableArgs: false
  28735. };
  28736. t['RG'] = {
  28737. id: OPS.setStrokeRGBColor,
  28738. numArgs: 3,
  28739. variableArgs: false
  28740. };
  28741. t['rg'] = {
  28742. id: OPS.setFillRGBColor,
  28743. numArgs: 3,
  28744. variableArgs: false
  28745. };
  28746. t['K'] = {
  28747. id: OPS.setStrokeCMYKColor,
  28748. numArgs: 4,
  28749. variableArgs: false
  28750. };
  28751. t['k'] = {
  28752. id: OPS.setFillCMYKColor,
  28753. numArgs: 4,
  28754. variableArgs: false
  28755. };
  28756. t['sh'] = {
  28757. id: OPS.shadingFill,
  28758. numArgs: 1,
  28759. variableArgs: false
  28760. };
  28761. t['BI'] = {
  28762. id: OPS.beginInlineImage,
  28763. numArgs: 0,
  28764. variableArgs: false
  28765. };
  28766. t['ID'] = {
  28767. id: OPS.beginImageData,
  28768. numArgs: 0,
  28769. variableArgs: false
  28770. };
  28771. t['EI'] = {
  28772. id: OPS.endInlineImage,
  28773. numArgs: 1,
  28774. variableArgs: false
  28775. };
  28776. t['Do'] = {
  28777. id: OPS.paintXObject,
  28778. numArgs: 1,
  28779. variableArgs: false
  28780. };
  28781. t['MP'] = {
  28782. id: OPS.markPoint,
  28783. numArgs: 1,
  28784. variableArgs: false
  28785. };
  28786. t['DP'] = {
  28787. id: OPS.markPointProps,
  28788. numArgs: 2,
  28789. variableArgs: false
  28790. };
  28791. t['BMC'] = {
  28792. id: OPS.beginMarkedContent,
  28793. numArgs: 1,
  28794. variableArgs: false
  28795. };
  28796. t['BDC'] = {
  28797. id: OPS.beginMarkedContentProps,
  28798. numArgs: 2,
  28799. variableArgs: false
  28800. };
  28801. t['EMC'] = {
  28802. id: OPS.endMarkedContent,
  28803. numArgs: 0,
  28804. variableArgs: false
  28805. };
  28806. t['BX'] = {
  28807. id: OPS.beginCompat,
  28808. numArgs: 0,
  28809. variableArgs: false
  28810. };
  28811. t['EX'] = {
  28812. id: OPS.endCompat,
  28813. numArgs: 0,
  28814. variableArgs: false
  28815. };
  28816. t['BM'] = null;
  28817. t['BD'] = null;
  28818. t['true'] = null;
  28819. t['fa'] = null;
  28820. t['fal'] = null;
  28821. t['fals'] = null;
  28822. t['false'] = null;
  28823. t['nu'] = null;
  28824. t['nul'] = null;
  28825. t['null'] = null;
  28826. });
  28827. function EvaluatorPreprocessor(stream, xref, stateManager) {
  28828. this.opMap = getOPMap();
  28829. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  28830. this.stateManager = stateManager;
  28831. this.nonProcessedArgs = [];
  28832. }
  28833. EvaluatorPreprocessor.prototype = {
  28834. get savedStatesDepth() {
  28835. return this.stateManager.stateStack.length;
  28836. },
  28837. read: function EvaluatorPreprocessor_read(operation) {
  28838. var args = operation.args;
  28839. while (true) {
  28840. var obj = this.parser.getObj();
  28841. if (isCmd(obj)) {
  28842. var cmd = obj.cmd;
  28843. var opSpec = this.opMap[cmd];
  28844. if (!opSpec) {
  28845. warn('Unknown command "' + cmd + '"');
  28846. continue;
  28847. }
  28848. var fn = opSpec.id;
  28849. var numArgs = opSpec.numArgs;
  28850. var argsLength = args !== null ? args.length : 0;
  28851. if (!opSpec.variableArgs) {
  28852. if (argsLength !== numArgs) {
  28853. var nonProcessedArgs = this.nonProcessedArgs;
  28854. while (argsLength > numArgs) {
  28855. nonProcessedArgs.push(args.shift());
  28856. argsLength--;
  28857. }
  28858. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28859. if (args === null) {
  28860. args = [];
  28861. }
  28862. args.unshift(nonProcessedArgs.pop());
  28863. argsLength++;
  28864. }
  28865. }
  28866. if (argsLength < numArgs) {
  28867. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28868. if (args !== null) {
  28869. args.length = 0;
  28870. }
  28871. continue;
  28872. }
  28873. } else if (argsLength > numArgs) {
  28874. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28875. }
  28876. this.preprocessCommand(fn, args);
  28877. operation.fn = fn;
  28878. operation.args = args;
  28879. return true;
  28880. }
  28881. if (isEOF(obj)) {
  28882. return false;
  28883. }
  28884. if (obj !== null) {
  28885. if (args === null) {
  28886. args = [];
  28887. }
  28888. args.push(obj);
  28889. assert(args.length <= 33, 'Too many arguments');
  28890. }
  28891. }
  28892. },
  28893. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28894. switch (fn | 0) {
  28895. case OPS.save:
  28896. this.stateManager.save();
  28897. break;
  28898. case OPS.restore:
  28899. this.stateManager.restore();
  28900. break;
  28901. case OPS.transform:
  28902. this.stateManager.transform(args);
  28903. break;
  28904. }
  28905. }
  28906. };
  28907. return EvaluatorPreprocessor;
  28908. }();
  28909. var QueueOptimizer = function QueueOptimizerClosure() {
  28910. function addState(parentState, pattern, fn) {
  28911. var state = parentState;
  28912. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28913. var item = pattern[i];
  28914. state = state[item] || (state[item] = []);
  28915. }
  28916. state[pattern[pattern.length - 1]] = fn;
  28917. }
  28918. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28919. var iFirstPIMXO = iFirstSave + 2;
  28920. for (var i = 0; i < count; i++) {
  28921. var arg = argsArray[iFirstPIMXO + 4 * i];
  28922. var imageMask = arg.length === 1 && arg[0];
  28923. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28924. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28925. continue;
  28926. }
  28927. break;
  28928. }
  28929. return count - i;
  28930. }
  28931. var InitialState = [];
  28932. addState(InitialState, [
  28933. OPS.save,
  28934. OPS.transform,
  28935. OPS.paintInlineImageXObject,
  28936. OPS.restore
  28937. ], function foundInlineImageGroup(context) {
  28938. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28939. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28940. var MAX_WIDTH = 1000;
  28941. var IMAGE_PADDING = 1;
  28942. var fnArray = context.fnArray, argsArray = context.argsArray;
  28943. var curr = context.iCurr;
  28944. var iFirstSave = curr - 3;
  28945. var iFirstTransform = curr - 2;
  28946. var iFirstPIIXO = curr - 1;
  28947. var i = iFirstSave + 4;
  28948. var ii = fnArray.length;
  28949. while (i + 3 < ii) {
  28950. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28951. break;
  28952. }
  28953. i += 4;
  28954. }
  28955. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28956. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28957. return i;
  28958. }
  28959. var maxX = 0;
  28960. var map = [], maxLineHeight = 0;
  28961. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28962. var q;
  28963. for (q = 0; q < count; q++) {
  28964. var transform = argsArray[iFirstTransform + (q << 2)];
  28965. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28966. if (currentX + img.width > MAX_WIDTH) {
  28967. maxX = Math.max(maxX, currentX);
  28968. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28969. currentX = 0;
  28970. maxLineHeight = 0;
  28971. }
  28972. map.push({
  28973. transform: transform,
  28974. x: currentX,
  28975. y: currentY,
  28976. w: img.width,
  28977. h: img.height
  28978. });
  28979. currentX += img.width + 2 * IMAGE_PADDING;
  28980. maxLineHeight = Math.max(maxLineHeight, img.height);
  28981. }
  28982. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28983. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28984. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28985. var imgRowSize = imgWidth << 2;
  28986. for (q = 0; q < count; q++) {
  28987. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28988. var rowSize = map[q].w << 2;
  28989. var dataOffset = 0;
  28990. var offset = map[q].x + map[q].y * imgWidth << 2;
  28991. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28992. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28993. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28994. dataOffset += rowSize;
  28995. offset += imgRowSize;
  28996. }
  28997. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28998. while (offset >= 0) {
  28999. data[offset - 4] = data[offset];
  29000. data[offset - 3] = data[offset + 1];
  29001. data[offset - 2] = data[offset + 2];
  29002. data[offset - 1] = data[offset + 3];
  29003. data[offset + rowSize] = data[offset + rowSize - 4];
  29004. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  29005. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  29006. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  29007. offset -= imgRowSize;
  29008. }
  29009. }
  29010. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  29011. argsArray.splice(iFirstSave, count * 4, [
  29012. {
  29013. width: imgWidth,
  29014. height: imgHeight,
  29015. kind: ImageKind.RGBA_32BPP,
  29016. data: imgData
  29017. },
  29018. map
  29019. ]);
  29020. return iFirstSave + 1;
  29021. });
  29022. addState(InitialState, [
  29023. OPS.save,
  29024. OPS.transform,
  29025. OPS.paintImageMaskXObject,
  29026. OPS.restore
  29027. ], function foundImageMaskGroup(context) {
  29028. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  29029. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  29030. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  29031. var fnArray = context.fnArray, argsArray = context.argsArray;
  29032. var curr = context.iCurr;
  29033. var iFirstSave = curr - 3;
  29034. var iFirstTransform = curr - 2;
  29035. var iFirstPIMXO = curr - 1;
  29036. var i = iFirstSave + 4;
  29037. var ii = fnArray.length;
  29038. while (i + 3 < ii) {
  29039. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  29040. break;
  29041. }
  29042. i += 4;
  29043. }
  29044. var count = (i - iFirstSave) / 4;
  29045. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  29046. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  29047. return i;
  29048. }
  29049. var q;
  29050. var isSameImage = false;
  29051. var iTransform, transformArgs;
  29052. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  29053. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  29054. isSameImage = true;
  29055. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29056. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29057. iTransform = iFirstTransform + 4;
  29058. var iPIMXO = iFirstPIMXO + 4;
  29059. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  29060. transformArgs = argsArray[iTransform];
  29061. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  29062. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  29063. isSameImage = false;
  29064. } else {
  29065. count = q;
  29066. }
  29067. break;
  29068. }
  29069. }
  29070. }
  29071. if (isSameImage) {
  29072. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  29073. var positions = new Float32Array(count * 2);
  29074. iTransform = iFirstTransform;
  29075. for (q = 0; q < count; q++, iTransform += 4) {
  29076. transformArgs = argsArray[iTransform];
  29077. positions[q << 1] = transformArgs[4];
  29078. positions[(q << 1) + 1] = transformArgs[5];
  29079. }
  29080. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  29081. argsArray.splice(iFirstSave, count * 4, [
  29082. firstPIMXOArg0,
  29083. firstTransformArg0,
  29084. firstTransformArg3,
  29085. positions
  29086. ]);
  29087. } else {
  29088. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  29089. var images = [];
  29090. for (q = 0; q < count; q++) {
  29091. transformArgs = argsArray[iFirstTransform + (q << 2)];
  29092. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  29093. images.push({
  29094. data: maskParams.data,
  29095. width: maskParams.width,
  29096. height: maskParams.height,
  29097. transform: transformArgs
  29098. });
  29099. }
  29100. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  29101. argsArray.splice(iFirstSave, count * 4, [images]);
  29102. }
  29103. return iFirstSave + 1;
  29104. });
  29105. addState(InitialState, [
  29106. OPS.save,
  29107. OPS.transform,
  29108. OPS.paintImageXObject,
  29109. OPS.restore
  29110. ], function (context) {
  29111. var MIN_IMAGES_IN_BLOCK = 3;
  29112. var MAX_IMAGES_IN_BLOCK = 1000;
  29113. var fnArray = context.fnArray, argsArray = context.argsArray;
  29114. var curr = context.iCurr;
  29115. var iFirstSave = curr - 3;
  29116. var iFirstTransform = curr - 2;
  29117. var iFirstPIXO = curr - 1;
  29118. var iFirstRestore = curr;
  29119. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  29120. return iFirstRestore + 1;
  29121. }
  29122. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  29123. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29124. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29125. var i = iFirstSave + 4;
  29126. var ii = fnArray.length;
  29127. while (i + 3 < ii) {
  29128. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  29129. break;
  29130. }
  29131. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  29132. break;
  29133. }
  29134. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  29135. break;
  29136. }
  29137. i += 4;
  29138. }
  29139. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  29140. if (count < MIN_IMAGES_IN_BLOCK) {
  29141. return i;
  29142. }
  29143. var positions = new Float32Array(count * 2);
  29144. var iTransform = iFirstTransform;
  29145. for (var q = 0; q < count; q++, iTransform += 4) {
  29146. var transformArgs = argsArray[iTransform];
  29147. positions[q << 1] = transformArgs[4];
  29148. positions[(q << 1) + 1] = transformArgs[5];
  29149. }
  29150. var args = [
  29151. firstPIXOArg0,
  29152. firstTransformArg0,
  29153. firstTransformArg3,
  29154. positions
  29155. ];
  29156. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  29157. argsArray.splice(iFirstSave, count * 4, args);
  29158. return iFirstSave + 1;
  29159. });
  29160. addState(InitialState, [
  29161. OPS.beginText,
  29162. OPS.setFont,
  29163. OPS.setTextMatrix,
  29164. OPS.showText,
  29165. OPS.endText
  29166. ], function (context) {
  29167. var MIN_CHARS_IN_BLOCK = 3;
  29168. var MAX_CHARS_IN_BLOCK = 1000;
  29169. var fnArray = context.fnArray, argsArray = context.argsArray;
  29170. var curr = context.iCurr;
  29171. var iFirstBeginText = curr - 4;
  29172. var iFirstSetFont = curr - 3;
  29173. var iFirstSetTextMatrix = curr - 2;
  29174. var iFirstShowText = curr - 1;
  29175. var iFirstEndText = curr;
  29176. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  29177. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  29178. var i = iFirstBeginText + 5;
  29179. var ii = fnArray.length;
  29180. while (i + 4 < ii) {
  29181. if (fnArray[i] !== OPS.beginText || fnArray[i + 1] !== OPS.setFont || fnArray[i + 2] !== OPS.setTextMatrix || fnArray[i + 3] !== OPS.showText || fnArray[i + 4] !== OPS.endText) {
  29182. break;
  29183. }
  29184. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  29185. break;
  29186. }
  29187. i += 5;
  29188. }
  29189. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  29190. if (count < MIN_CHARS_IN_BLOCK) {
  29191. return i;
  29192. }
  29193. var iFirst = iFirstBeginText;
  29194. 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) {
  29195. count++;
  29196. iFirst -= 5;
  29197. }
  29198. var iEndText = iFirst + 4;
  29199. for (var q = 1; q < count; q++) {
  29200. fnArray.splice(iEndText, 3);
  29201. argsArray.splice(iEndText, 3);
  29202. iEndText += 2;
  29203. }
  29204. return iEndText + 1;
  29205. });
  29206. function QueueOptimizer() {
  29207. }
  29208. QueueOptimizer.prototype = {
  29209. optimize: function QueueOptimizer_optimize(queue) {
  29210. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  29211. var context = {
  29212. iCurr: 0,
  29213. fnArray: fnArray,
  29214. argsArray: argsArray
  29215. };
  29216. var state;
  29217. var i = 0, ii = fnArray.length;
  29218. while (i < ii) {
  29219. state = (state || InitialState)[fnArray[i]];
  29220. if (typeof state === 'function') {
  29221. context.iCurr = i;
  29222. i = state(context);
  29223. state = undefined;
  29224. ii = context.fnArray.length;
  29225. } else {
  29226. i++;
  29227. }
  29228. }
  29229. }
  29230. };
  29231. return QueueOptimizer;
  29232. }();
  29233. exports.OperatorList = OperatorList;
  29234. exports.PartialEvaluator = PartialEvaluator;
  29235. /***/ }),
  29236. /* 14 */
  29237. /***/ (function(module, exports, __w_pdfjs_require__) {
  29238. "use strict";
  29239. var sharedUtil = __w_pdfjs_require__(0);
  29240. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  29241. var info = sharedUtil.info;
  29242. var warn = sharedUtil.warn;
  29243. var error = sharedUtil.error;
  29244. var log2 = sharedUtil.log2;
  29245. var readUint16 = sharedUtil.readUint16;
  29246. var readUint32 = sharedUtil.readUint32;
  29247. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  29248. var JpxImage = function JpxImageClosure() {
  29249. var SubbandsGainLog2 = {
  29250. 'LL': 0,
  29251. 'LH': 1,
  29252. 'HL': 1,
  29253. 'HH': 2
  29254. };
  29255. function JpxImage() {
  29256. this.failOnCorruptedImage = false;
  29257. }
  29258. JpxImage.prototype = {
  29259. parse: function JpxImage_parse(data) {
  29260. var head = readUint16(data, 0);
  29261. if (head === 0xFF4F) {
  29262. this.parseCodestream(data, 0, data.length);
  29263. return;
  29264. }
  29265. var position = 0, length = data.length;
  29266. while (position < length) {
  29267. var headerSize = 8;
  29268. var lbox = readUint32(data, position);
  29269. var tbox = readUint32(data, position + 4);
  29270. position += headerSize;
  29271. if (lbox === 1) {
  29272. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  29273. position += 8;
  29274. headerSize += 8;
  29275. }
  29276. if (lbox === 0) {
  29277. lbox = length - position + headerSize;
  29278. }
  29279. if (lbox < headerSize) {
  29280. error('JPX Error: Invalid box field size');
  29281. }
  29282. var dataLength = lbox - headerSize;
  29283. var jumpDataLength = true;
  29284. switch (tbox) {
  29285. case 0x6A703268:
  29286. jumpDataLength = false;
  29287. break;
  29288. case 0x636F6C72:
  29289. var method = data[position];
  29290. if (method === 1) {
  29291. var colorspace = readUint32(data, position + 3);
  29292. switch (colorspace) {
  29293. case 16:
  29294. case 17:
  29295. case 18:
  29296. break;
  29297. default:
  29298. warn('Unknown colorspace ' + colorspace);
  29299. break;
  29300. }
  29301. } else if (method === 2) {
  29302. info('ICC profile not supported');
  29303. }
  29304. break;
  29305. case 0x6A703263:
  29306. this.parseCodestream(data, position, position + dataLength);
  29307. break;
  29308. case 0x6A502020:
  29309. if (0x0d0a870a !== readUint32(data, position)) {
  29310. warn('Invalid JP2 signature');
  29311. }
  29312. break;
  29313. case 0x6A501A1A:
  29314. case 0x66747970:
  29315. case 0x72726571:
  29316. case 0x72657320:
  29317. case 0x69686472:
  29318. break;
  29319. default:
  29320. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  29321. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  29322. break;
  29323. }
  29324. if (jumpDataLength) {
  29325. position += dataLength;
  29326. }
  29327. }
  29328. },
  29329. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  29330. var newByte = stream.getByte();
  29331. while (newByte >= 0) {
  29332. var oldByte = newByte;
  29333. newByte = stream.getByte();
  29334. var code = oldByte << 8 | newByte;
  29335. if (code === 0xFF51) {
  29336. stream.skip(4);
  29337. var Xsiz = stream.getInt32() >>> 0;
  29338. var Ysiz = stream.getInt32() >>> 0;
  29339. var XOsiz = stream.getInt32() >>> 0;
  29340. var YOsiz = stream.getInt32() >>> 0;
  29341. stream.skip(16);
  29342. var Csiz = stream.getUint16();
  29343. this.width = Xsiz - XOsiz;
  29344. this.height = Ysiz - YOsiz;
  29345. this.componentsCount = Csiz;
  29346. this.bitsPerComponent = 8;
  29347. return;
  29348. }
  29349. }
  29350. error('JPX Error: No size marker found in JPX stream');
  29351. },
  29352. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  29353. var context = {};
  29354. var doNotRecover = false;
  29355. try {
  29356. var position = start;
  29357. while (position + 1 < end) {
  29358. var code = readUint16(data, position);
  29359. position += 2;
  29360. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  29361. switch (code) {
  29362. case 0xFF4F:
  29363. context.mainHeader = true;
  29364. break;
  29365. case 0xFFD9:
  29366. break;
  29367. case 0xFF51:
  29368. length = readUint16(data, position);
  29369. var siz = {};
  29370. siz.Xsiz = readUint32(data, position + 4);
  29371. siz.Ysiz = readUint32(data, position + 8);
  29372. siz.XOsiz = readUint32(data, position + 12);
  29373. siz.YOsiz = readUint32(data, position + 16);
  29374. siz.XTsiz = readUint32(data, position + 20);
  29375. siz.YTsiz = readUint32(data, position + 24);
  29376. siz.XTOsiz = readUint32(data, position + 28);
  29377. siz.YTOsiz = readUint32(data, position + 32);
  29378. var componentsCount = readUint16(data, position + 36);
  29379. siz.Csiz = componentsCount;
  29380. var components = [];
  29381. j = position + 38;
  29382. for (var i = 0; i < componentsCount; i++) {
  29383. var component = {
  29384. precision: (data[j] & 0x7F) + 1,
  29385. isSigned: !!(data[j] & 0x80),
  29386. XRsiz: data[j + 1],
  29387. YRsiz: data[j + 1]
  29388. };
  29389. calculateComponentDimensions(component, siz);
  29390. components.push(component);
  29391. }
  29392. context.SIZ = siz;
  29393. context.components = components;
  29394. calculateTileGrids(context, components);
  29395. context.QCC = [];
  29396. context.COC = [];
  29397. break;
  29398. case 0xFF5C:
  29399. length = readUint16(data, position);
  29400. var qcd = {};
  29401. j = position + 2;
  29402. sqcd = data[j++];
  29403. switch (sqcd & 0x1F) {
  29404. case 0:
  29405. spqcdSize = 8;
  29406. scalarExpounded = true;
  29407. break;
  29408. case 1:
  29409. spqcdSize = 16;
  29410. scalarExpounded = false;
  29411. break;
  29412. case 2:
  29413. spqcdSize = 16;
  29414. scalarExpounded = true;
  29415. break;
  29416. default:
  29417. throw new Error('Invalid SQcd value ' + sqcd);
  29418. }
  29419. qcd.noQuantization = spqcdSize === 8;
  29420. qcd.scalarExpounded = scalarExpounded;
  29421. qcd.guardBits = sqcd >> 5;
  29422. spqcds = [];
  29423. while (j < length + position) {
  29424. var spqcd = {};
  29425. if (spqcdSize === 8) {
  29426. spqcd.epsilon = data[j++] >> 3;
  29427. spqcd.mu = 0;
  29428. } else {
  29429. spqcd.epsilon = data[j] >> 3;
  29430. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29431. j += 2;
  29432. }
  29433. spqcds.push(spqcd);
  29434. }
  29435. qcd.SPqcds = spqcds;
  29436. if (context.mainHeader) {
  29437. context.QCD = qcd;
  29438. } else {
  29439. context.currentTile.QCD = qcd;
  29440. context.currentTile.QCC = [];
  29441. }
  29442. break;
  29443. case 0xFF5D:
  29444. length = readUint16(data, position);
  29445. var qcc = {};
  29446. j = position + 2;
  29447. var cqcc;
  29448. if (context.SIZ.Csiz < 257) {
  29449. cqcc = data[j++];
  29450. } else {
  29451. cqcc = readUint16(data, j);
  29452. j += 2;
  29453. }
  29454. sqcd = data[j++];
  29455. switch (sqcd & 0x1F) {
  29456. case 0:
  29457. spqcdSize = 8;
  29458. scalarExpounded = true;
  29459. break;
  29460. case 1:
  29461. spqcdSize = 16;
  29462. scalarExpounded = false;
  29463. break;
  29464. case 2:
  29465. spqcdSize = 16;
  29466. scalarExpounded = true;
  29467. break;
  29468. default:
  29469. throw new Error('Invalid SQcd value ' + sqcd);
  29470. }
  29471. qcc.noQuantization = spqcdSize === 8;
  29472. qcc.scalarExpounded = scalarExpounded;
  29473. qcc.guardBits = sqcd >> 5;
  29474. spqcds = [];
  29475. while (j < length + position) {
  29476. spqcd = {};
  29477. if (spqcdSize === 8) {
  29478. spqcd.epsilon = data[j++] >> 3;
  29479. spqcd.mu = 0;
  29480. } else {
  29481. spqcd.epsilon = data[j] >> 3;
  29482. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29483. j += 2;
  29484. }
  29485. spqcds.push(spqcd);
  29486. }
  29487. qcc.SPqcds = spqcds;
  29488. if (context.mainHeader) {
  29489. context.QCC[cqcc] = qcc;
  29490. } else {
  29491. context.currentTile.QCC[cqcc] = qcc;
  29492. }
  29493. break;
  29494. case 0xFF52:
  29495. length = readUint16(data, position);
  29496. var cod = {};
  29497. j = position + 2;
  29498. var scod = data[j++];
  29499. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  29500. cod.sopMarkerUsed = !!(scod & 2);
  29501. cod.ephMarkerUsed = !!(scod & 4);
  29502. cod.progressionOrder = data[j++];
  29503. cod.layersCount = readUint16(data, j);
  29504. j += 2;
  29505. cod.multipleComponentTransform = data[j++];
  29506. cod.decompositionLevelsCount = data[j++];
  29507. cod.xcb = (data[j++] & 0xF) + 2;
  29508. cod.ycb = (data[j++] & 0xF) + 2;
  29509. var blockStyle = data[j++];
  29510. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  29511. cod.resetContextProbabilities = !!(blockStyle & 2);
  29512. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  29513. cod.verticalyStripe = !!(blockStyle & 8);
  29514. cod.predictableTermination = !!(blockStyle & 16);
  29515. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  29516. cod.reversibleTransformation = data[j++];
  29517. if (cod.entropyCoderWithCustomPrecincts) {
  29518. var precinctsSizes = [];
  29519. while (j < length + position) {
  29520. var precinctsSize = data[j++];
  29521. precinctsSizes.push({
  29522. PPx: precinctsSize & 0xF,
  29523. PPy: precinctsSize >> 4
  29524. });
  29525. }
  29526. cod.precinctsSizes = precinctsSizes;
  29527. }
  29528. var unsupported = [];
  29529. if (cod.selectiveArithmeticCodingBypass) {
  29530. unsupported.push('selectiveArithmeticCodingBypass');
  29531. }
  29532. if (cod.resetContextProbabilities) {
  29533. unsupported.push('resetContextProbabilities');
  29534. }
  29535. if (cod.terminationOnEachCodingPass) {
  29536. unsupported.push('terminationOnEachCodingPass');
  29537. }
  29538. if (cod.verticalyStripe) {
  29539. unsupported.push('verticalyStripe');
  29540. }
  29541. if (cod.predictableTermination) {
  29542. unsupported.push('predictableTermination');
  29543. }
  29544. if (unsupported.length > 0) {
  29545. doNotRecover = true;
  29546. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  29547. }
  29548. if (context.mainHeader) {
  29549. context.COD = cod;
  29550. } else {
  29551. context.currentTile.COD = cod;
  29552. context.currentTile.COC = [];
  29553. }
  29554. break;
  29555. case 0xFF90:
  29556. length = readUint16(data, position);
  29557. tile = {};
  29558. tile.index = readUint16(data, position + 2);
  29559. tile.length = readUint32(data, position + 4);
  29560. tile.dataEnd = tile.length + position - 2;
  29561. tile.partIndex = data[position + 8];
  29562. tile.partsCount = data[position + 9];
  29563. context.mainHeader = false;
  29564. if (tile.partIndex === 0) {
  29565. tile.COD = context.COD;
  29566. tile.COC = context.COC.slice(0);
  29567. tile.QCD = context.QCD;
  29568. tile.QCC = context.QCC.slice(0);
  29569. }
  29570. context.currentTile = tile;
  29571. break;
  29572. case 0xFF93:
  29573. tile = context.currentTile;
  29574. if (tile.partIndex === 0) {
  29575. initializeTile(context, tile.index);
  29576. buildPackets(context);
  29577. }
  29578. length = tile.dataEnd - position;
  29579. parseTilePackets(context, data, position, length);
  29580. break;
  29581. case 0xFF55:
  29582. case 0xFF57:
  29583. case 0xFF58:
  29584. case 0xFF64:
  29585. length = readUint16(data, position);
  29586. break;
  29587. case 0xFF53:
  29588. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  29589. default:
  29590. throw new Error('Unknown codestream code: ' + code.toString(16));
  29591. }
  29592. position += length;
  29593. }
  29594. } catch (e) {
  29595. if (doNotRecover || this.failOnCorruptedImage) {
  29596. error('JPX Error: ' + e.message);
  29597. } else {
  29598. warn('JPX: Trying to recover from: ' + e.message);
  29599. }
  29600. }
  29601. this.tiles = transformComponents(context);
  29602. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  29603. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  29604. this.componentsCount = context.SIZ.Csiz;
  29605. }
  29606. };
  29607. function calculateComponentDimensions(component, siz) {
  29608. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  29609. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  29610. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  29611. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  29612. component.width = component.x1 - component.x0;
  29613. component.height = component.y1 - component.y0;
  29614. }
  29615. function calculateTileGrids(context, components) {
  29616. var siz = context.SIZ;
  29617. var tile, tiles = [];
  29618. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  29619. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  29620. for (var q = 0; q < numYtiles; q++) {
  29621. for (var p = 0; p < numXtiles; p++) {
  29622. tile = {};
  29623. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  29624. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  29625. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  29626. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  29627. tile.width = tile.tx1 - tile.tx0;
  29628. tile.height = tile.ty1 - tile.ty0;
  29629. tile.components = [];
  29630. tiles.push(tile);
  29631. }
  29632. }
  29633. context.tiles = tiles;
  29634. var componentsCount = siz.Csiz;
  29635. for (var i = 0, ii = componentsCount; i < ii; i++) {
  29636. var component = components[i];
  29637. for (var j = 0, jj = tiles.length; j < jj; j++) {
  29638. var tileComponent = {};
  29639. tile = tiles[j];
  29640. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  29641. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  29642. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  29643. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  29644. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  29645. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  29646. tile.components[i] = tileComponent;
  29647. }
  29648. }
  29649. }
  29650. function getBlocksDimensions(context, component, r) {
  29651. var codOrCoc = component.codingStyleParameters;
  29652. var result = {};
  29653. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  29654. result.PPx = 15;
  29655. result.PPy = 15;
  29656. } else {
  29657. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  29658. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  29659. }
  29660. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  29661. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  29662. return result;
  29663. }
  29664. function buildPrecincts(context, resolution, dimensions) {
  29665. var precinctWidth = 1 << dimensions.PPx;
  29666. var precinctHeight = 1 << dimensions.PPy;
  29667. var isZeroRes = resolution.resLevel === 0;
  29668. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  29669. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  29670. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  29671. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  29672. var numprecincts = numprecinctswide * numprecinctshigh;
  29673. resolution.precinctParameters = {
  29674. precinctWidth: precinctWidth,
  29675. precinctHeight: precinctHeight,
  29676. numprecinctswide: numprecinctswide,
  29677. numprecinctshigh: numprecinctshigh,
  29678. numprecincts: numprecincts,
  29679. precinctWidthInSubband: precinctWidthInSubband,
  29680. precinctHeightInSubband: precinctHeightInSubband
  29681. };
  29682. }
  29683. function buildCodeblocks(context, subband, dimensions) {
  29684. var xcb_ = dimensions.xcb_;
  29685. var ycb_ = dimensions.ycb_;
  29686. var codeblockWidth = 1 << xcb_;
  29687. var codeblockHeight = 1 << ycb_;
  29688. var cbx0 = subband.tbx0 >> xcb_;
  29689. var cby0 = subband.tby0 >> ycb_;
  29690. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  29691. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  29692. var precinctParameters = subband.resolution.precinctParameters;
  29693. var codeblocks = [];
  29694. var precincts = [];
  29695. var i, j, codeblock, precinctNumber;
  29696. for (j = cby0; j < cby1; j++) {
  29697. for (i = cbx0; i < cbx1; i++) {
  29698. codeblock = {
  29699. cbx: i,
  29700. cby: j,
  29701. tbx0: codeblockWidth * i,
  29702. tby0: codeblockHeight * j,
  29703. tbx1: codeblockWidth * (i + 1),
  29704. tby1: codeblockHeight * (j + 1)
  29705. };
  29706. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  29707. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  29708. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  29709. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  29710. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  29711. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  29712. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  29713. codeblock.precinctNumber = precinctNumber;
  29714. codeblock.subbandType = subband.type;
  29715. codeblock.Lblock = 3;
  29716. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  29717. continue;
  29718. }
  29719. codeblocks.push(codeblock);
  29720. var precinct = precincts[precinctNumber];
  29721. if (precinct !== undefined) {
  29722. if (i < precinct.cbxMin) {
  29723. precinct.cbxMin = i;
  29724. } else if (i > precinct.cbxMax) {
  29725. precinct.cbxMax = i;
  29726. }
  29727. if (j < precinct.cbyMin) {
  29728. precinct.cbxMin = j;
  29729. } else if (j > precinct.cbyMax) {
  29730. precinct.cbyMax = j;
  29731. }
  29732. } else {
  29733. precincts[precinctNumber] = precinct = {
  29734. cbxMin: i,
  29735. cbyMin: j,
  29736. cbxMax: i,
  29737. cbyMax: j
  29738. };
  29739. }
  29740. codeblock.precinct = precinct;
  29741. }
  29742. }
  29743. subband.codeblockParameters = {
  29744. codeblockWidth: xcb_,
  29745. codeblockHeight: ycb_,
  29746. numcodeblockwide: cbx1 - cbx0 + 1,
  29747. numcodeblockhigh: cby1 - cby0 + 1
  29748. };
  29749. subband.codeblocks = codeblocks;
  29750. subband.precincts = precincts;
  29751. }
  29752. function createPacket(resolution, precinctNumber, layerNumber) {
  29753. var precinctCodeblocks = [];
  29754. var subbands = resolution.subbands;
  29755. for (var i = 0, ii = subbands.length; i < ii; i++) {
  29756. var subband = subbands[i];
  29757. var codeblocks = subband.codeblocks;
  29758. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  29759. var codeblock = codeblocks[j];
  29760. if (codeblock.precinctNumber !== precinctNumber) {
  29761. continue;
  29762. }
  29763. precinctCodeblocks.push(codeblock);
  29764. }
  29765. }
  29766. return {
  29767. layerNumber: layerNumber,
  29768. codeblocks: precinctCodeblocks
  29769. };
  29770. }
  29771. function LayerResolutionComponentPositionIterator(context) {
  29772. var siz = context.SIZ;
  29773. var tileIndex = context.currentTile.index;
  29774. var tile = context.tiles[tileIndex];
  29775. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29776. var componentsCount = siz.Csiz;
  29777. var maxDecompositionLevelsCount = 0;
  29778. for (var q = 0; q < componentsCount; q++) {
  29779. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29780. }
  29781. var l = 0, r = 0, i = 0, k = 0;
  29782. this.nextPacket = function JpxImage_nextPacket() {
  29783. for (; l < layersCount; l++) {
  29784. for (; r <= maxDecompositionLevelsCount; r++) {
  29785. for (; i < componentsCount; i++) {
  29786. var component = tile.components[i];
  29787. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29788. continue;
  29789. }
  29790. var resolution = component.resolutions[r];
  29791. var numprecincts = resolution.precinctParameters.numprecincts;
  29792. for (; k < numprecincts;) {
  29793. var packet = createPacket(resolution, k, l);
  29794. k++;
  29795. return packet;
  29796. }
  29797. k = 0;
  29798. }
  29799. i = 0;
  29800. }
  29801. r = 0;
  29802. }
  29803. error('JPX Error: Out of packets');
  29804. };
  29805. }
  29806. function ResolutionLayerComponentPositionIterator(context) {
  29807. var siz = context.SIZ;
  29808. var tileIndex = context.currentTile.index;
  29809. var tile = context.tiles[tileIndex];
  29810. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29811. var componentsCount = siz.Csiz;
  29812. var maxDecompositionLevelsCount = 0;
  29813. for (var q = 0; q < componentsCount; q++) {
  29814. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29815. }
  29816. var r = 0, l = 0, i = 0, k = 0;
  29817. this.nextPacket = function JpxImage_nextPacket() {
  29818. for (; r <= maxDecompositionLevelsCount; r++) {
  29819. for (; l < layersCount; l++) {
  29820. for (; i < componentsCount; i++) {
  29821. var component = tile.components[i];
  29822. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29823. continue;
  29824. }
  29825. var resolution = component.resolutions[r];
  29826. var numprecincts = resolution.precinctParameters.numprecincts;
  29827. for (; k < numprecincts;) {
  29828. var packet = createPacket(resolution, k, l);
  29829. k++;
  29830. return packet;
  29831. }
  29832. k = 0;
  29833. }
  29834. i = 0;
  29835. }
  29836. l = 0;
  29837. }
  29838. error('JPX Error: Out of packets');
  29839. };
  29840. }
  29841. function ResolutionPositionComponentLayerIterator(context) {
  29842. var siz = context.SIZ;
  29843. var tileIndex = context.currentTile.index;
  29844. var tile = context.tiles[tileIndex];
  29845. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29846. var componentsCount = siz.Csiz;
  29847. var l, r, c, p;
  29848. var maxDecompositionLevelsCount = 0;
  29849. for (c = 0; c < componentsCount; c++) {
  29850. var component = tile.components[c];
  29851. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29852. }
  29853. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29854. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29855. var maxNumPrecincts = 0;
  29856. for (c = 0; c < componentsCount; ++c) {
  29857. var resolutions = tile.components[c].resolutions;
  29858. if (r < resolutions.length) {
  29859. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29860. }
  29861. }
  29862. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29863. }
  29864. l = 0;
  29865. r = 0;
  29866. c = 0;
  29867. p = 0;
  29868. this.nextPacket = function JpxImage_nextPacket() {
  29869. for (; r <= maxDecompositionLevelsCount; r++) {
  29870. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29871. for (; c < componentsCount; c++) {
  29872. var component = tile.components[c];
  29873. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29874. continue;
  29875. }
  29876. var resolution = component.resolutions[r];
  29877. var numprecincts = resolution.precinctParameters.numprecincts;
  29878. if (p >= numprecincts) {
  29879. continue;
  29880. }
  29881. for (; l < layersCount;) {
  29882. var packet = createPacket(resolution, p, l);
  29883. l++;
  29884. return packet;
  29885. }
  29886. l = 0;
  29887. }
  29888. c = 0;
  29889. }
  29890. p = 0;
  29891. }
  29892. error('JPX Error: Out of packets');
  29893. };
  29894. }
  29895. function PositionComponentResolutionLayerIterator(context) {
  29896. var siz = context.SIZ;
  29897. var tileIndex = context.currentTile.index;
  29898. var tile = context.tiles[tileIndex];
  29899. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29900. var componentsCount = siz.Csiz;
  29901. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29902. var precinctsIterationSizes = precinctsSizes;
  29903. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29904. this.nextPacket = function JpxImage_nextPacket() {
  29905. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29906. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29907. for (; c < componentsCount; c++) {
  29908. var component = tile.components[c];
  29909. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29910. for (; r <= decompositionLevelsCount; r++) {
  29911. var resolution = component.resolutions[r];
  29912. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29913. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29914. if (k === null) {
  29915. continue;
  29916. }
  29917. for (; l < layersCount;) {
  29918. var packet = createPacket(resolution, k, l);
  29919. l++;
  29920. return packet;
  29921. }
  29922. l = 0;
  29923. }
  29924. r = 0;
  29925. }
  29926. c = 0;
  29927. }
  29928. px = 0;
  29929. }
  29930. error('JPX Error: Out of packets');
  29931. };
  29932. }
  29933. function ComponentPositionResolutionLayerIterator(context) {
  29934. var siz = context.SIZ;
  29935. var tileIndex = context.currentTile.index;
  29936. var tile = context.tiles[tileIndex];
  29937. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29938. var componentsCount = siz.Csiz;
  29939. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29940. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29941. this.nextPacket = function JpxImage_nextPacket() {
  29942. for (; c < componentsCount; ++c) {
  29943. var component = tile.components[c];
  29944. var precinctsIterationSizes = precinctsSizes.components[c];
  29945. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29946. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29947. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29948. for (; r <= decompositionLevelsCount; r++) {
  29949. var resolution = component.resolutions[r];
  29950. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29951. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29952. if (k === null) {
  29953. continue;
  29954. }
  29955. for (; l < layersCount;) {
  29956. var packet = createPacket(resolution, k, l);
  29957. l++;
  29958. return packet;
  29959. }
  29960. l = 0;
  29961. }
  29962. r = 0;
  29963. }
  29964. px = 0;
  29965. }
  29966. py = 0;
  29967. }
  29968. error('JPX Error: Out of packets');
  29969. };
  29970. }
  29971. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29972. var posX = pxIndex * precinctIterationSizes.minWidth;
  29973. var posY = pyIndex * precinctIterationSizes.minHeight;
  29974. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29975. return null;
  29976. }
  29977. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29978. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29979. }
  29980. function getPrecinctSizesInImageScale(tile) {
  29981. var componentsCount = tile.components.length;
  29982. var minWidth = Number.MAX_VALUE;
  29983. var minHeight = Number.MAX_VALUE;
  29984. var maxNumWide = 0;
  29985. var maxNumHigh = 0;
  29986. var sizePerComponent = new Array(componentsCount);
  29987. for (var c = 0; c < componentsCount; c++) {
  29988. var component = tile.components[c];
  29989. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29990. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29991. var minWidthCurrentComponent = Number.MAX_VALUE;
  29992. var minHeightCurrentComponent = Number.MAX_VALUE;
  29993. var maxNumWideCurrentComponent = 0;
  29994. var maxNumHighCurrentComponent = 0;
  29995. var scale = 1;
  29996. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29997. var resolution = component.resolutions[r];
  29998. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29999. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30000. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30001. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30002. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30003. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30004. sizePerResolution[r] = {
  30005. width: widthCurrentResolution,
  30006. height: heightCurrentResolution
  30007. };
  30008. scale <<= 1;
  30009. }
  30010. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30011. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30012. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30013. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30014. sizePerComponent[c] = {
  30015. resolutions: sizePerResolution,
  30016. minWidth: minWidthCurrentComponent,
  30017. minHeight: minHeightCurrentComponent,
  30018. maxNumWide: maxNumWideCurrentComponent,
  30019. maxNumHigh: maxNumHighCurrentComponent
  30020. };
  30021. }
  30022. return {
  30023. components: sizePerComponent,
  30024. minWidth: minWidth,
  30025. minHeight: minHeight,
  30026. maxNumWide: maxNumWide,
  30027. maxNumHigh: maxNumHigh
  30028. };
  30029. }
  30030. function buildPackets(context) {
  30031. var siz = context.SIZ;
  30032. var tileIndex = context.currentTile.index;
  30033. var tile = context.tiles[tileIndex];
  30034. var componentsCount = siz.Csiz;
  30035. for (var c = 0; c < componentsCount; c++) {
  30036. var component = tile.components[c];
  30037. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30038. var resolutions = [];
  30039. var subbands = [];
  30040. for (var r = 0; r <= decompositionLevelsCount; r++) {
  30041. var blocksDimensions = getBlocksDimensions(context, component, r);
  30042. var resolution = {};
  30043. var scale = 1 << decompositionLevelsCount - r;
  30044. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30045. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30046. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30047. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30048. resolution.resLevel = r;
  30049. buildPrecincts(context, resolution, blocksDimensions);
  30050. resolutions.push(resolution);
  30051. var subband;
  30052. if (r === 0) {
  30053. subband = {};
  30054. subband.type = 'LL';
  30055. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30056. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30057. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30058. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30059. subband.resolution = resolution;
  30060. buildCodeblocks(context, subband, blocksDimensions);
  30061. subbands.push(subband);
  30062. resolution.subbands = [subband];
  30063. } else {
  30064. var bscale = 1 << decompositionLevelsCount - r + 1;
  30065. var resolutionSubbands = [];
  30066. subband = {};
  30067. subband.type = 'HL';
  30068. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30069. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30070. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30071. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30072. subband.resolution = resolution;
  30073. buildCodeblocks(context, subband, blocksDimensions);
  30074. subbands.push(subband);
  30075. resolutionSubbands.push(subband);
  30076. subband = {};
  30077. subband.type = 'LH';
  30078. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30079. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30080. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30081. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30082. subband.resolution = resolution;
  30083. buildCodeblocks(context, subband, blocksDimensions);
  30084. subbands.push(subband);
  30085. resolutionSubbands.push(subband);
  30086. subband = {};
  30087. subband.type = 'HH';
  30088. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30089. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30090. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30091. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30092. subband.resolution = resolution;
  30093. buildCodeblocks(context, subband, blocksDimensions);
  30094. subbands.push(subband);
  30095. resolutionSubbands.push(subband);
  30096. resolution.subbands = resolutionSubbands;
  30097. }
  30098. }
  30099. component.resolutions = resolutions;
  30100. component.subbands = subbands;
  30101. }
  30102. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30103. switch (progressionOrder) {
  30104. case 0:
  30105. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30106. break;
  30107. case 1:
  30108. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30109. break;
  30110. case 2:
  30111. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30112. break;
  30113. case 3:
  30114. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30115. break;
  30116. case 4:
  30117. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30118. break;
  30119. default:
  30120. error('JPX Error: Unsupported progression order ' + progressionOrder);
  30121. }
  30122. }
  30123. function parseTilePackets(context, data, offset, dataLength) {
  30124. var position = 0;
  30125. var buffer, bufferSize = 0, skipNextBit = false;
  30126. function readBits(count) {
  30127. while (bufferSize < count) {
  30128. var b = data[offset + position];
  30129. position++;
  30130. if (skipNextBit) {
  30131. buffer = buffer << 7 | b;
  30132. bufferSize += 7;
  30133. skipNextBit = false;
  30134. } else {
  30135. buffer = buffer << 8 | b;
  30136. bufferSize += 8;
  30137. }
  30138. if (b === 0xFF) {
  30139. skipNextBit = true;
  30140. }
  30141. }
  30142. bufferSize -= count;
  30143. return buffer >>> bufferSize & (1 << count) - 1;
  30144. }
  30145. function skipMarkerIfEqual(value) {
  30146. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  30147. skipBytes(1);
  30148. return true;
  30149. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  30150. skipBytes(2);
  30151. return true;
  30152. }
  30153. return false;
  30154. }
  30155. function skipBytes(count) {
  30156. position += count;
  30157. }
  30158. function alignToByte() {
  30159. bufferSize = 0;
  30160. if (skipNextBit) {
  30161. position++;
  30162. skipNextBit = false;
  30163. }
  30164. }
  30165. function readCodingpasses() {
  30166. if (readBits(1) === 0) {
  30167. return 1;
  30168. }
  30169. if (readBits(1) === 0) {
  30170. return 2;
  30171. }
  30172. var value = readBits(2);
  30173. if (value < 3) {
  30174. return value + 3;
  30175. }
  30176. value = readBits(5);
  30177. if (value < 31) {
  30178. return value + 6;
  30179. }
  30180. value = readBits(7);
  30181. return value + 37;
  30182. }
  30183. var tileIndex = context.currentTile.index;
  30184. var tile = context.tiles[tileIndex];
  30185. var sopMarkerUsed = context.COD.sopMarkerUsed;
  30186. var ephMarkerUsed = context.COD.ephMarkerUsed;
  30187. var packetsIterator = tile.packetsIterator;
  30188. while (position < dataLength) {
  30189. alignToByte();
  30190. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30191. skipBytes(4);
  30192. }
  30193. var packet = packetsIterator.nextPacket();
  30194. if (!readBits(1)) {
  30195. continue;
  30196. }
  30197. var layerNumber = packet.layerNumber;
  30198. var queue = [], codeblock;
  30199. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30200. codeblock = packet.codeblocks[i];
  30201. var precinct = codeblock.precinct;
  30202. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30203. var codeblockRow = codeblock.cby - precinct.cbyMin;
  30204. var codeblockIncluded = false;
  30205. var firstTimeInclusion = false;
  30206. var valueReady;
  30207. if (codeblock['included'] !== undefined) {
  30208. codeblockIncluded = !!readBits(1);
  30209. } else {
  30210. precinct = codeblock.precinct;
  30211. var inclusionTree, zeroBitPlanesTree;
  30212. if (precinct['inclusionTree'] !== undefined) {
  30213. inclusionTree = precinct.inclusionTree;
  30214. } else {
  30215. var width = precinct.cbxMax - precinct.cbxMin + 1;
  30216. var height = precinct.cbyMax - precinct.cbyMin + 1;
  30217. inclusionTree = new InclusionTree(width, height, layerNumber);
  30218. zeroBitPlanesTree = new TagTree(width, height);
  30219. precinct.inclusionTree = inclusionTree;
  30220. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30221. }
  30222. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30223. while (true) {
  30224. if (readBits(1)) {
  30225. valueReady = !inclusionTree.nextLevel();
  30226. if (valueReady) {
  30227. codeblock.included = true;
  30228. codeblockIncluded = firstTimeInclusion = true;
  30229. break;
  30230. }
  30231. } else {
  30232. inclusionTree.incrementValue(layerNumber);
  30233. break;
  30234. }
  30235. }
  30236. }
  30237. }
  30238. if (!codeblockIncluded) {
  30239. continue;
  30240. }
  30241. if (firstTimeInclusion) {
  30242. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30243. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30244. while (true) {
  30245. if (readBits(1)) {
  30246. valueReady = !zeroBitPlanesTree.nextLevel();
  30247. if (valueReady) {
  30248. break;
  30249. }
  30250. } else {
  30251. zeroBitPlanesTree.incrementValue();
  30252. }
  30253. }
  30254. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30255. }
  30256. var codingpasses = readCodingpasses();
  30257. while (readBits(1)) {
  30258. codeblock.Lblock++;
  30259. }
  30260. var codingpassesLog2 = log2(codingpasses);
  30261. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30262. var codedDataLength = readBits(bits);
  30263. queue.push({
  30264. codeblock: codeblock,
  30265. codingpasses: codingpasses,
  30266. dataLength: codedDataLength
  30267. });
  30268. }
  30269. alignToByte();
  30270. if (ephMarkerUsed) {
  30271. skipMarkerIfEqual(0x92);
  30272. }
  30273. while (queue.length > 0) {
  30274. var packetItem = queue.shift();
  30275. codeblock = packetItem.codeblock;
  30276. if (codeblock['data'] === undefined) {
  30277. codeblock.data = [];
  30278. }
  30279. codeblock.data.push({
  30280. data: data,
  30281. start: offset + position,
  30282. end: offset + position + packetItem.dataLength,
  30283. codingpasses: packetItem.codingpasses
  30284. });
  30285. position += packetItem.dataLength;
  30286. }
  30287. }
  30288. return position;
  30289. }
  30290. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30291. var x0 = subband.tbx0;
  30292. var y0 = subband.tby0;
  30293. var width = subband.tbx1 - subband.tbx0;
  30294. var codeblocks = subband.codeblocks;
  30295. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  30296. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  30297. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  30298. var codeblock = codeblocks[i];
  30299. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30300. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30301. if (blockWidth === 0 || blockHeight === 0) {
  30302. continue;
  30303. }
  30304. if (codeblock['data'] === undefined) {
  30305. continue;
  30306. }
  30307. var bitModel, currentCodingpassType;
  30308. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30309. currentCodingpassType = 2;
  30310. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  30311. var j, jj, dataItem;
  30312. for (j = 0, jj = data.length; j < jj; j++) {
  30313. dataItem = data[j];
  30314. totalLength += dataItem.end - dataItem.start;
  30315. codingpasses += dataItem.codingpasses;
  30316. }
  30317. var encodedData = new Uint8Array(totalLength);
  30318. var position = 0;
  30319. for (j = 0, jj = data.length; j < jj; j++) {
  30320. dataItem = data[j];
  30321. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30322. encodedData.set(chunk, position);
  30323. position += chunk.length;
  30324. }
  30325. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  30326. bitModel.setDecoder(decoder);
  30327. for (j = 0; j < codingpasses; j++) {
  30328. switch (currentCodingpassType) {
  30329. case 0:
  30330. bitModel.runSignificancePropagationPass();
  30331. break;
  30332. case 1:
  30333. bitModel.runMagnitudeRefinementPass();
  30334. break;
  30335. case 2:
  30336. bitModel.runCleanupPass();
  30337. if (segmentationSymbolUsed) {
  30338. bitModel.checkSegmentationSymbol();
  30339. }
  30340. break;
  30341. }
  30342. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30343. }
  30344. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30345. var sign = bitModel.coefficentsSign;
  30346. var magnitude = bitModel.coefficentsMagnitude;
  30347. var bitsDecoded = bitModel.bitsDecoded;
  30348. var magnitudeCorrection = reversible ? 0 : 0.5;
  30349. var k, n, nb;
  30350. position = 0;
  30351. var interleave = subband.type !== 'LL';
  30352. for (j = 0; j < blockHeight; j++) {
  30353. var row = offset / width | 0;
  30354. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30355. for (k = 0; k < blockWidth; k++) {
  30356. n = magnitude[position];
  30357. if (n !== 0) {
  30358. n = (n + magnitudeCorrection) * delta;
  30359. if (sign[position] !== 0) {
  30360. n = -n;
  30361. }
  30362. nb = bitsDecoded[position];
  30363. var pos = interleave ? levelOffset + (offset << 1) : offset;
  30364. if (reversible && nb >= mb) {
  30365. coefficients[pos] = n;
  30366. } else {
  30367. coefficients[pos] = n * (1 << mb - nb);
  30368. }
  30369. }
  30370. offset++;
  30371. position++;
  30372. }
  30373. offset += width - blockWidth;
  30374. }
  30375. }
  30376. }
  30377. function transformTile(context, tile, c) {
  30378. var component = tile.components[c];
  30379. var codingStyleParameters = component.codingStyleParameters;
  30380. var quantizationParameters = component.quantizationParameters;
  30381. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  30382. var spqcds = quantizationParameters.SPqcds;
  30383. var scalarExpounded = quantizationParameters.scalarExpounded;
  30384. var guardBits = quantizationParameters.guardBits;
  30385. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  30386. var precision = context.components[c].precision;
  30387. var reversible = codingStyleParameters.reversibleTransformation;
  30388. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  30389. var subbandCoefficients = [];
  30390. var b = 0;
  30391. for (var i = 0; i <= decompositionLevelsCount; i++) {
  30392. var resolution = component.resolutions[i];
  30393. var width = resolution.trx1 - resolution.trx0;
  30394. var height = resolution.try1 - resolution.try0;
  30395. var coefficients = new Float32Array(width * height);
  30396. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  30397. var mu, epsilon;
  30398. if (!scalarExpounded) {
  30399. mu = spqcds[0].mu;
  30400. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  30401. } else {
  30402. mu = spqcds[b].mu;
  30403. epsilon = spqcds[b].epsilon;
  30404. b++;
  30405. }
  30406. var subband = resolution.subbands[j];
  30407. var gainLog2 = SubbandsGainLog2[subband.type];
  30408. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  30409. var mb = guardBits + epsilon - 1;
  30410. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  30411. }
  30412. subbandCoefficients.push({
  30413. width: width,
  30414. height: height,
  30415. items: coefficients
  30416. });
  30417. }
  30418. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  30419. return {
  30420. left: component.tcx0,
  30421. top: component.tcy0,
  30422. width: result.width,
  30423. height: result.height,
  30424. items: result.items
  30425. };
  30426. }
  30427. function transformComponents(context) {
  30428. var siz = context.SIZ;
  30429. var components = context.components;
  30430. var componentsCount = siz.Csiz;
  30431. var resultImages = [];
  30432. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  30433. var tile = context.tiles[i];
  30434. var transformedTiles = [];
  30435. var c;
  30436. for (c = 0; c < componentsCount; c++) {
  30437. transformedTiles[c] = transformTile(context, tile, c);
  30438. }
  30439. var tile0 = transformedTiles[0];
  30440. var out = new Uint8Array(tile0.items.length * componentsCount);
  30441. var result = {
  30442. left: tile0.left,
  30443. top: tile0.top,
  30444. width: tile0.width,
  30445. height: tile0.height,
  30446. items: out
  30447. };
  30448. var shift, offset, max, min, maxK;
  30449. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  30450. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  30451. var fourComponents = componentsCount === 4;
  30452. var y0items = transformedTiles[0].items;
  30453. var y1items = transformedTiles[1].items;
  30454. var y2items = transformedTiles[2].items;
  30455. var y3items = fourComponents ? transformedTiles[3].items : null;
  30456. shift = components[0].precision - 8;
  30457. offset = (128 << shift) + 0.5;
  30458. max = 255 * (1 << shift);
  30459. maxK = max * 0.5;
  30460. min = -maxK;
  30461. var component0 = tile.components[0];
  30462. var alpha01 = componentsCount - 3;
  30463. jj = y0items.length;
  30464. if (!component0.codingStyleParameters.reversibleTransformation) {
  30465. for (j = 0; j < jj; j++, pos += alpha01) {
  30466. y0 = y0items[j] + offset;
  30467. y1 = y1items[j];
  30468. y2 = y2items[j];
  30469. r = y0 + 1.402 * y2;
  30470. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  30471. b = y0 + 1.772 * y1;
  30472. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30473. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30474. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30475. }
  30476. } else {
  30477. for (j = 0; j < jj; j++, pos += alpha01) {
  30478. y0 = y0items[j] + offset;
  30479. y1 = y1items[j];
  30480. y2 = y2items[j];
  30481. g = y0 - (y2 + y1 >> 2);
  30482. r = g + y2;
  30483. b = g + y1;
  30484. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30485. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30486. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30487. }
  30488. }
  30489. if (fourComponents) {
  30490. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  30491. k = y3items[j];
  30492. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  30493. }
  30494. }
  30495. } else {
  30496. for (c = 0; c < componentsCount; c++) {
  30497. var items = transformedTiles[c].items;
  30498. shift = components[c].precision - 8;
  30499. offset = (128 << shift) + 0.5;
  30500. max = 127.5 * (1 << shift);
  30501. min = -max;
  30502. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  30503. val = items[j];
  30504. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  30505. pos += componentsCount;
  30506. }
  30507. }
  30508. }
  30509. resultImages.push(result);
  30510. }
  30511. return resultImages;
  30512. }
  30513. function initializeTile(context, tileIndex) {
  30514. var siz = context.SIZ;
  30515. var componentsCount = siz.Csiz;
  30516. var tile = context.tiles[tileIndex];
  30517. for (var c = 0; c < componentsCount; c++) {
  30518. var component = tile.components[c];
  30519. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  30520. component.quantizationParameters = qcdOrQcc;
  30521. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  30522. component.codingStyleParameters = codOrCoc;
  30523. }
  30524. tile.codingStyleDefaultParameters = context.currentTile.COD;
  30525. }
  30526. var TagTree = function TagTreeClosure() {
  30527. function TagTree(width, height) {
  30528. var levelsLength = log2(Math.max(width, height)) + 1;
  30529. this.levels = [];
  30530. for (var i = 0; i < levelsLength; i++) {
  30531. var level = {
  30532. width: width,
  30533. height: height,
  30534. items: []
  30535. };
  30536. this.levels.push(level);
  30537. width = Math.ceil(width / 2);
  30538. height = Math.ceil(height / 2);
  30539. }
  30540. }
  30541. TagTree.prototype = {
  30542. reset: function TagTree_reset(i, j) {
  30543. var currentLevel = 0, value = 0, level;
  30544. while (currentLevel < this.levels.length) {
  30545. level = this.levels[currentLevel];
  30546. var index = i + j * level.width;
  30547. if (level.items[index] !== undefined) {
  30548. value = level.items[index];
  30549. break;
  30550. }
  30551. level.index = index;
  30552. i >>= 1;
  30553. j >>= 1;
  30554. currentLevel++;
  30555. }
  30556. currentLevel--;
  30557. level = this.levels[currentLevel];
  30558. level.items[level.index] = value;
  30559. this.currentLevel = currentLevel;
  30560. delete this.value;
  30561. },
  30562. incrementValue: function TagTree_incrementValue() {
  30563. var level = this.levels[this.currentLevel];
  30564. level.items[level.index]++;
  30565. },
  30566. nextLevel: function TagTree_nextLevel() {
  30567. var currentLevel = this.currentLevel;
  30568. var level = this.levels[currentLevel];
  30569. var value = level.items[level.index];
  30570. currentLevel--;
  30571. if (currentLevel < 0) {
  30572. this.value = value;
  30573. return false;
  30574. }
  30575. this.currentLevel = currentLevel;
  30576. level = this.levels[currentLevel];
  30577. level.items[level.index] = value;
  30578. return true;
  30579. }
  30580. };
  30581. return TagTree;
  30582. }();
  30583. var InclusionTree = function InclusionTreeClosure() {
  30584. function InclusionTree(width, height, defaultValue) {
  30585. var levelsLength = log2(Math.max(width, height)) + 1;
  30586. this.levels = [];
  30587. for (var i = 0; i < levelsLength; i++) {
  30588. var items = new Uint8Array(width * height);
  30589. for (var j = 0, jj = items.length; j < jj; j++) {
  30590. items[j] = defaultValue;
  30591. }
  30592. var level = {
  30593. width: width,
  30594. height: height,
  30595. items: items
  30596. };
  30597. this.levels.push(level);
  30598. width = Math.ceil(width / 2);
  30599. height = Math.ceil(height / 2);
  30600. }
  30601. }
  30602. InclusionTree.prototype = {
  30603. reset: function InclusionTree_reset(i, j, stopValue) {
  30604. var currentLevel = 0;
  30605. while (currentLevel < this.levels.length) {
  30606. var level = this.levels[currentLevel];
  30607. var index = i + j * level.width;
  30608. level.index = index;
  30609. var value = level.items[index];
  30610. if (value === 0xFF) {
  30611. break;
  30612. }
  30613. if (value > stopValue) {
  30614. this.currentLevel = currentLevel;
  30615. this.propagateValues();
  30616. return false;
  30617. }
  30618. i >>= 1;
  30619. j >>= 1;
  30620. currentLevel++;
  30621. }
  30622. this.currentLevel = currentLevel - 1;
  30623. return true;
  30624. },
  30625. incrementValue: function InclusionTree_incrementValue(stopValue) {
  30626. var level = this.levels[this.currentLevel];
  30627. level.items[level.index] = stopValue + 1;
  30628. this.propagateValues();
  30629. },
  30630. propagateValues: function InclusionTree_propagateValues() {
  30631. var levelIndex = this.currentLevel;
  30632. var level = this.levels[levelIndex];
  30633. var currentValue = level.items[level.index];
  30634. while (--levelIndex >= 0) {
  30635. level = this.levels[levelIndex];
  30636. level.items[level.index] = currentValue;
  30637. }
  30638. },
  30639. nextLevel: function InclusionTree_nextLevel() {
  30640. var currentLevel = this.currentLevel;
  30641. var level = this.levels[currentLevel];
  30642. var value = level.items[level.index];
  30643. level.items[level.index] = 0xFF;
  30644. currentLevel--;
  30645. if (currentLevel < 0) {
  30646. return false;
  30647. }
  30648. this.currentLevel = currentLevel;
  30649. level = this.levels[currentLevel];
  30650. level.items[level.index] = value;
  30651. return true;
  30652. }
  30653. };
  30654. return InclusionTree;
  30655. }();
  30656. var BitModel = function BitModelClosure() {
  30657. var UNIFORM_CONTEXT = 17;
  30658. var RUNLENGTH_CONTEXT = 18;
  30659. var LLAndLHContextsLabel = new Uint8Array([
  30660. 0,
  30661. 5,
  30662. 8,
  30663. 0,
  30664. 3,
  30665. 7,
  30666. 8,
  30667. 0,
  30668. 4,
  30669. 7,
  30670. 8,
  30671. 0,
  30672. 0,
  30673. 0,
  30674. 0,
  30675. 0,
  30676. 1,
  30677. 6,
  30678. 8,
  30679. 0,
  30680. 3,
  30681. 7,
  30682. 8,
  30683. 0,
  30684. 4,
  30685. 7,
  30686. 8,
  30687. 0,
  30688. 0,
  30689. 0,
  30690. 0,
  30691. 0,
  30692. 2,
  30693. 6,
  30694. 8,
  30695. 0,
  30696. 3,
  30697. 7,
  30698. 8,
  30699. 0,
  30700. 4,
  30701. 7,
  30702. 8,
  30703. 0,
  30704. 0,
  30705. 0,
  30706. 0,
  30707. 0,
  30708. 2,
  30709. 6,
  30710. 8,
  30711. 0,
  30712. 3,
  30713. 7,
  30714. 8,
  30715. 0,
  30716. 4,
  30717. 7,
  30718. 8,
  30719. 0,
  30720. 0,
  30721. 0,
  30722. 0,
  30723. 0,
  30724. 2,
  30725. 6,
  30726. 8,
  30727. 0,
  30728. 3,
  30729. 7,
  30730. 8,
  30731. 0,
  30732. 4,
  30733. 7,
  30734. 8
  30735. ]);
  30736. var HLContextLabel = new Uint8Array([
  30737. 0,
  30738. 3,
  30739. 4,
  30740. 0,
  30741. 5,
  30742. 7,
  30743. 7,
  30744. 0,
  30745. 8,
  30746. 8,
  30747. 8,
  30748. 0,
  30749. 0,
  30750. 0,
  30751. 0,
  30752. 0,
  30753. 1,
  30754. 3,
  30755. 4,
  30756. 0,
  30757. 6,
  30758. 7,
  30759. 7,
  30760. 0,
  30761. 8,
  30762. 8,
  30763. 8,
  30764. 0,
  30765. 0,
  30766. 0,
  30767. 0,
  30768. 0,
  30769. 2,
  30770. 3,
  30771. 4,
  30772. 0,
  30773. 6,
  30774. 7,
  30775. 7,
  30776. 0,
  30777. 8,
  30778. 8,
  30779. 8,
  30780. 0,
  30781. 0,
  30782. 0,
  30783. 0,
  30784. 0,
  30785. 2,
  30786. 3,
  30787. 4,
  30788. 0,
  30789. 6,
  30790. 7,
  30791. 7,
  30792. 0,
  30793. 8,
  30794. 8,
  30795. 8,
  30796. 0,
  30797. 0,
  30798. 0,
  30799. 0,
  30800. 0,
  30801. 2,
  30802. 3,
  30803. 4,
  30804. 0,
  30805. 6,
  30806. 7,
  30807. 7,
  30808. 0,
  30809. 8,
  30810. 8,
  30811. 8
  30812. ]);
  30813. var HHContextLabel = new Uint8Array([
  30814. 0,
  30815. 1,
  30816. 2,
  30817. 0,
  30818. 1,
  30819. 2,
  30820. 2,
  30821. 0,
  30822. 2,
  30823. 2,
  30824. 2,
  30825. 0,
  30826. 0,
  30827. 0,
  30828. 0,
  30829. 0,
  30830. 3,
  30831. 4,
  30832. 5,
  30833. 0,
  30834. 4,
  30835. 5,
  30836. 5,
  30837. 0,
  30838. 5,
  30839. 5,
  30840. 5,
  30841. 0,
  30842. 0,
  30843. 0,
  30844. 0,
  30845. 0,
  30846. 6,
  30847. 7,
  30848. 7,
  30849. 0,
  30850. 7,
  30851. 7,
  30852. 7,
  30853. 0,
  30854. 7,
  30855. 7,
  30856. 7,
  30857. 0,
  30858. 0,
  30859. 0,
  30860. 0,
  30861. 0,
  30862. 8,
  30863. 8,
  30864. 8,
  30865. 0,
  30866. 8,
  30867. 8,
  30868. 8,
  30869. 0,
  30870. 8,
  30871. 8,
  30872. 8,
  30873. 0,
  30874. 0,
  30875. 0,
  30876. 0,
  30877. 0,
  30878. 8,
  30879. 8,
  30880. 8,
  30881. 0,
  30882. 8,
  30883. 8,
  30884. 8,
  30885. 0,
  30886. 8,
  30887. 8,
  30888. 8
  30889. ]);
  30890. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30891. this.width = width;
  30892. this.height = height;
  30893. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30894. var coefficientCount = width * height;
  30895. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30896. this.coefficentsSign = new Uint8Array(coefficientCount);
  30897. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30898. this.processingFlags = new Uint8Array(coefficientCount);
  30899. var bitsDecoded = new Uint8Array(coefficientCount);
  30900. if (zeroBitPlanes !== 0) {
  30901. for (var i = 0; i < coefficientCount; i++) {
  30902. bitsDecoded[i] = zeroBitPlanes;
  30903. }
  30904. }
  30905. this.bitsDecoded = bitsDecoded;
  30906. this.reset();
  30907. }
  30908. BitModel.prototype = {
  30909. setDecoder: function BitModel_setDecoder(decoder) {
  30910. this.decoder = decoder;
  30911. },
  30912. reset: function BitModel_reset() {
  30913. this.contexts = new Int8Array(19);
  30914. this.contexts[0] = 4 << 1 | 0;
  30915. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30916. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30917. },
  30918. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30919. var neighborsSignificance = this.neighborsSignificance;
  30920. var width = this.width, height = this.height;
  30921. var left = column > 0;
  30922. var right = column + 1 < width;
  30923. var i;
  30924. if (row > 0) {
  30925. i = index - width;
  30926. if (left) {
  30927. neighborsSignificance[i - 1] += 0x10;
  30928. }
  30929. if (right) {
  30930. neighborsSignificance[i + 1] += 0x10;
  30931. }
  30932. neighborsSignificance[i] += 0x04;
  30933. }
  30934. if (row + 1 < height) {
  30935. i = index + width;
  30936. if (left) {
  30937. neighborsSignificance[i - 1] += 0x10;
  30938. }
  30939. if (right) {
  30940. neighborsSignificance[i + 1] += 0x10;
  30941. }
  30942. neighborsSignificance[i] += 0x04;
  30943. }
  30944. if (left) {
  30945. neighborsSignificance[index - 1] += 0x01;
  30946. }
  30947. if (right) {
  30948. neighborsSignificance[index + 1] += 0x01;
  30949. }
  30950. neighborsSignificance[index] |= 0x80;
  30951. },
  30952. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30953. var decoder = this.decoder;
  30954. var width = this.width, height = this.height;
  30955. var coefficentsMagnitude = this.coefficentsMagnitude;
  30956. var coefficentsSign = this.coefficentsSign;
  30957. var neighborsSignificance = this.neighborsSignificance;
  30958. var processingFlags = this.processingFlags;
  30959. var contexts = this.contexts;
  30960. var labels = this.contextLabelTable;
  30961. var bitsDecoded = this.bitsDecoded;
  30962. var processedInverseMask = ~1;
  30963. var processedMask = 1;
  30964. var firstMagnitudeBitMask = 2;
  30965. for (var i0 = 0; i0 < height; i0 += 4) {
  30966. for (var j = 0; j < width; j++) {
  30967. var index = i0 * width + j;
  30968. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30969. var i = i0 + i1;
  30970. if (i >= height) {
  30971. break;
  30972. }
  30973. processingFlags[index] &= processedInverseMask;
  30974. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30975. continue;
  30976. }
  30977. var contextLabel = labels[neighborsSignificance[index]];
  30978. var decision = decoder.readBit(contexts, contextLabel);
  30979. if (decision) {
  30980. var sign = this.decodeSignBit(i, j, index);
  30981. coefficentsSign[index] = sign;
  30982. coefficentsMagnitude[index] = 1;
  30983. this.setNeighborsSignificance(i, j, index);
  30984. processingFlags[index] |= firstMagnitudeBitMask;
  30985. }
  30986. bitsDecoded[index]++;
  30987. processingFlags[index] |= processedMask;
  30988. }
  30989. }
  30990. }
  30991. },
  30992. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30993. var width = this.width, height = this.height;
  30994. var coefficentsMagnitude = this.coefficentsMagnitude;
  30995. var coefficentsSign = this.coefficentsSign;
  30996. var contribution, sign0, sign1, significance1;
  30997. var contextLabel, decoded;
  30998. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30999. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31000. sign1 = coefficentsSign[index + 1];
  31001. if (significance1) {
  31002. sign0 = coefficentsSign[index - 1];
  31003. contribution = 1 - sign1 - sign0;
  31004. } else {
  31005. contribution = 1 - sign1 - sign1;
  31006. }
  31007. } else if (significance1) {
  31008. sign0 = coefficentsSign[index - 1];
  31009. contribution = 1 - sign0 - sign0;
  31010. } else {
  31011. contribution = 0;
  31012. }
  31013. var horizontalContribution = 3 * contribution;
  31014. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31015. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31016. sign1 = coefficentsSign[index + width];
  31017. if (significance1) {
  31018. sign0 = coefficentsSign[index - width];
  31019. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31020. } else {
  31021. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31022. }
  31023. } else if (significance1) {
  31024. sign0 = coefficentsSign[index - width];
  31025. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31026. } else {
  31027. contribution = horizontalContribution;
  31028. }
  31029. if (contribution >= 0) {
  31030. contextLabel = 9 + contribution;
  31031. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31032. } else {
  31033. contextLabel = 9 - contribution;
  31034. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31035. }
  31036. return decoded;
  31037. },
  31038. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  31039. var decoder = this.decoder;
  31040. var width = this.width, height = this.height;
  31041. var coefficentsMagnitude = this.coefficentsMagnitude;
  31042. var neighborsSignificance = this.neighborsSignificance;
  31043. var contexts = this.contexts;
  31044. var bitsDecoded = this.bitsDecoded;
  31045. var processingFlags = this.processingFlags;
  31046. var processedMask = 1;
  31047. var firstMagnitudeBitMask = 2;
  31048. var length = width * height;
  31049. var width4 = width * 4;
  31050. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31051. indexNext = Math.min(length, index0 + width4);
  31052. for (var j = 0; j < width; j++) {
  31053. for (var index = index0 + j; index < indexNext; index += width) {
  31054. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31055. continue;
  31056. }
  31057. var contextLabel = 16;
  31058. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31059. processingFlags[index] ^= firstMagnitudeBitMask;
  31060. var significance = neighborsSignificance[index] & 127;
  31061. contextLabel = significance === 0 ? 15 : 14;
  31062. }
  31063. var bit = decoder.readBit(contexts, contextLabel);
  31064. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31065. bitsDecoded[index]++;
  31066. processingFlags[index] |= processedMask;
  31067. }
  31068. }
  31069. }
  31070. },
  31071. runCleanupPass: function BitModel_runCleanupPass() {
  31072. var decoder = this.decoder;
  31073. var width = this.width, height = this.height;
  31074. var neighborsSignificance = this.neighborsSignificance;
  31075. var coefficentsMagnitude = this.coefficentsMagnitude;
  31076. var coefficentsSign = this.coefficentsSign;
  31077. var contexts = this.contexts;
  31078. var labels = this.contextLabelTable;
  31079. var bitsDecoded = this.bitsDecoded;
  31080. var processingFlags = this.processingFlags;
  31081. var processedMask = 1;
  31082. var firstMagnitudeBitMask = 2;
  31083. var oneRowDown = width;
  31084. var twoRowsDown = width * 2;
  31085. var threeRowsDown = width * 3;
  31086. var iNext;
  31087. for (var i0 = 0; i0 < height; i0 = iNext) {
  31088. iNext = Math.min(i0 + 4, height);
  31089. var indexBase = i0 * width;
  31090. var checkAllEmpty = i0 + 3 < height;
  31091. for (var j = 0; j < width; j++) {
  31092. var index0 = indexBase + j;
  31093. 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;
  31094. var i1 = 0, index = index0;
  31095. var i = i0, sign;
  31096. if (allEmpty) {
  31097. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31098. if (!hasSignificantCoefficent) {
  31099. bitsDecoded[index0]++;
  31100. bitsDecoded[index0 + oneRowDown]++;
  31101. bitsDecoded[index0 + twoRowsDown]++;
  31102. bitsDecoded[index0 + threeRowsDown]++;
  31103. continue;
  31104. }
  31105. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31106. if (i1 !== 0) {
  31107. i = i0 + i1;
  31108. index += i1 * width;
  31109. }
  31110. sign = this.decodeSignBit(i, j, index);
  31111. coefficentsSign[index] = sign;
  31112. coefficentsMagnitude[index] = 1;
  31113. this.setNeighborsSignificance(i, j, index);
  31114. processingFlags[index] |= firstMagnitudeBitMask;
  31115. index = index0;
  31116. for (var i2 = i0; i2 <= i; i2++, index += width) {
  31117. bitsDecoded[index]++;
  31118. }
  31119. i1++;
  31120. }
  31121. for (i = i0 + i1; i < iNext; i++, index += width) {
  31122. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31123. continue;
  31124. }
  31125. var contextLabel = labels[neighborsSignificance[index]];
  31126. var decision = decoder.readBit(contexts, contextLabel);
  31127. if (decision === 1) {
  31128. sign = this.decodeSignBit(i, j, index);
  31129. coefficentsSign[index] = sign;
  31130. coefficentsMagnitude[index] = 1;
  31131. this.setNeighborsSignificance(i, j, index);
  31132. processingFlags[index] |= firstMagnitudeBitMask;
  31133. }
  31134. bitsDecoded[index]++;
  31135. }
  31136. }
  31137. }
  31138. },
  31139. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  31140. var decoder = this.decoder;
  31141. var contexts = this.contexts;
  31142. 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);
  31143. if (symbol !== 0xA) {
  31144. error('JPX Error: Invalid segmentation symbol');
  31145. }
  31146. }
  31147. };
  31148. return BitModel;
  31149. }();
  31150. var Transform = function TransformClosure() {
  31151. function Transform() {
  31152. }
  31153. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  31154. var ll = subbands[0];
  31155. for (var i = 1, ii = subbands.length; i < ii; i++) {
  31156. ll = this.iterate(ll, subbands[i], u0, v0);
  31157. }
  31158. return ll;
  31159. };
  31160. Transform.prototype.extend = function extend(buffer, offset, size) {
  31161. var i1 = offset - 1, j1 = offset + 1;
  31162. var i2 = offset + size - 2, j2 = offset + size;
  31163. buffer[i1--] = buffer[j1++];
  31164. buffer[j2++] = buffer[i2--];
  31165. buffer[i1--] = buffer[j1++];
  31166. buffer[j2++] = buffer[i2--];
  31167. buffer[i1--] = buffer[j1++];
  31168. buffer[j2++] = buffer[i2--];
  31169. buffer[i1] = buffer[j1];
  31170. buffer[j2] = buffer[i2];
  31171. };
  31172. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  31173. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  31174. var width = hl_lh_hh.width;
  31175. var height = hl_lh_hh.height;
  31176. var items = hl_lh_hh.items;
  31177. var i, j, k, l, u, v;
  31178. for (k = 0, i = 0; i < llHeight; i++) {
  31179. l = i * 2 * width;
  31180. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31181. items[l] = llItems[k];
  31182. }
  31183. }
  31184. llItems = ll.items = null;
  31185. var bufferPadding = 4;
  31186. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31187. if (width === 1) {
  31188. if ((u0 & 1) !== 0) {
  31189. for (v = 0, k = 0; v < height; v++, k += width) {
  31190. items[k] *= 0.5;
  31191. }
  31192. }
  31193. } else {
  31194. for (v = 0, k = 0; v < height; v++, k += width) {
  31195. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31196. this.extend(rowBuffer, bufferPadding, width);
  31197. this.filter(rowBuffer, bufferPadding, width);
  31198. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31199. }
  31200. }
  31201. var numBuffers = 16;
  31202. var colBuffers = [];
  31203. for (i = 0; i < numBuffers; i++) {
  31204. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31205. }
  31206. var b, currentBuffer = 0;
  31207. ll = bufferPadding + height;
  31208. if (height === 1) {
  31209. if ((v0 & 1) !== 0) {
  31210. for (u = 0; u < width; u++) {
  31211. items[u] *= 0.5;
  31212. }
  31213. }
  31214. } else {
  31215. for (u = 0; u < width; u++) {
  31216. if (currentBuffer === 0) {
  31217. numBuffers = Math.min(width - u, numBuffers);
  31218. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31219. for (b = 0; b < numBuffers; b++) {
  31220. colBuffers[b][l] = items[k + b];
  31221. }
  31222. }
  31223. currentBuffer = numBuffers;
  31224. }
  31225. currentBuffer--;
  31226. var buffer = colBuffers[currentBuffer];
  31227. this.extend(buffer, bufferPadding, height);
  31228. this.filter(buffer, bufferPadding, height);
  31229. if (currentBuffer === 0) {
  31230. k = u - numBuffers + 1;
  31231. for (l = bufferPadding; l < ll; k += width, l++) {
  31232. for (b = 0; b < numBuffers; b++) {
  31233. items[k + b] = colBuffers[b][l];
  31234. }
  31235. }
  31236. }
  31237. }
  31238. }
  31239. return {
  31240. width: width,
  31241. height: height,
  31242. items: items
  31243. };
  31244. };
  31245. return Transform;
  31246. }();
  31247. var IrreversibleTransform = function IrreversibleTransformClosure() {
  31248. function IrreversibleTransform() {
  31249. Transform.call(this);
  31250. }
  31251. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  31252. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  31253. var len = length >> 1;
  31254. offset = offset | 0;
  31255. var j, n, current, next;
  31256. var alpha = -1.586134342059924;
  31257. var beta = -0.052980118572961;
  31258. var gamma = 0.882911075530934;
  31259. var delta = 0.443506852043971;
  31260. var K = 1.230174104914001;
  31261. var K_ = 1 / K;
  31262. j = offset - 3;
  31263. for (n = len + 4; n--; j += 2) {
  31264. x[j] *= K_;
  31265. }
  31266. j = offset - 2;
  31267. current = delta * x[j - 1];
  31268. for (n = len + 3; n--; j += 2) {
  31269. next = delta * x[j + 1];
  31270. x[j] = K * x[j] - current - next;
  31271. if (n--) {
  31272. j += 2;
  31273. current = delta * x[j + 1];
  31274. x[j] = K * x[j] - current - next;
  31275. } else {
  31276. break;
  31277. }
  31278. }
  31279. j = offset - 1;
  31280. current = gamma * x[j - 1];
  31281. for (n = len + 2; n--; j += 2) {
  31282. next = gamma * x[j + 1];
  31283. x[j] -= current + next;
  31284. if (n--) {
  31285. j += 2;
  31286. current = gamma * x[j + 1];
  31287. x[j] -= current + next;
  31288. } else {
  31289. break;
  31290. }
  31291. }
  31292. j = offset;
  31293. current = beta * x[j - 1];
  31294. for (n = len + 1; n--; j += 2) {
  31295. next = beta * x[j + 1];
  31296. x[j] -= current + next;
  31297. if (n--) {
  31298. j += 2;
  31299. current = beta * x[j + 1];
  31300. x[j] -= current + next;
  31301. } else {
  31302. break;
  31303. }
  31304. }
  31305. if (len !== 0) {
  31306. j = offset + 1;
  31307. current = alpha * x[j - 1];
  31308. for (n = len; n--; j += 2) {
  31309. next = alpha * x[j + 1];
  31310. x[j] -= current + next;
  31311. if (n--) {
  31312. j += 2;
  31313. current = alpha * x[j + 1];
  31314. x[j] -= current + next;
  31315. } else {
  31316. break;
  31317. }
  31318. }
  31319. }
  31320. };
  31321. return IrreversibleTransform;
  31322. }();
  31323. var ReversibleTransform = function ReversibleTransformClosure() {
  31324. function ReversibleTransform() {
  31325. Transform.call(this);
  31326. }
  31327. ReversibleTransform.prototype = Object.create(Transform.prototype);
  31328. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  31329. var len = length >> 1;
  31330. offset = offset | 0;
  31331. var j, n;
  31332. for (j = offset, n = len + 1; n--; j += 2) {
  31333. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31334. }
  31335. for (j = offset + 1, n = len; n--; j += 2) {
  31336. x[j] += x[j - 1] + x[j + 1] >> 1;
  31337. }
  31338. };
  31339. return ReversibleTransform;
  31340. }();
  31341. return JpxImage;
  31342. }();
  31343. exports.JpxImage = JpxImage;
  31344. /***/ }),
  31345. /* 15 */
  31346. /***/ (function(module, exports, __w_pdfjs_require__) {
  31347. "use strict";
  31348. var sharedUtil = __w_pdfjs_require__(0);
  31349. var corePrimitives = __w_pdfjs_require__(1);
  31350. var coreCrypto = __w_pdfjs_require__(12);
  31351. var coreParser = __w_pdfjs_require__(5);
  31352. var coreChunkedStream = __w_pdfjs_require__(11);
  31353. var coreColorSpace = __w_pdfjs_require__(3);
  31354. var InvalidPDFException = sharedUtil.InvalidPDFException;
  31355. var MissingDataException = sharedUtil.MissingDataException;
  31356. var XRefParseException = sharedUtil.XRefParseException;
  31357. var assert = sharedUtil.assert;
  31358. var bytesToString = sharedUtil.bytesToString;
  31359. var createPromiseCapability = sharedUtil.createPromiseCapability;
  31360. var error = sharedUtil.error;
  31361. var info = sharedUtil.info;
  31362. var isArray = sharedUtil.isArray;
  31363. var isBool = sharedUtil.isBool;
  31364. var isInt = sharedUtil.isInt;
  31365. var isString = sharedUtil.isString;
  31366. var shadow = sharedUtil.shadow;
  31367. var stringToPDFString = sharedUtil.stringToPDFString;
  31368. var stringToUTF8String = sharedUtil.stringToUTF8String;
  31369. var warn = sharedUtil.warn;
  31370. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  31371. var Util = sharedUtil.Util;
  31372. var Ref = corePrimitives.Ref;
  31373. var RefSet = corePrimitives.RefSet;
  31374. var RefSetCache = corePrimitives.RefSetCache;
  31375. var isName = corePrimitives.isName;
  31376. var isCmd = corePrimitives.isCmd;
  31377. var isDict = corePrimitives.isDict;
  31378. var isRef = corePrimitives.isRef;
  31379. var isRefsEqual = corePrimitives.isRefsEqual;
  31380. var isStream = corePrimitives.isStream;
  31381. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  31382. var Lexer = coreParser.Lexer;
  31383. var Parser = coreParser.Parser;
  31384. var ChunkedStream = coreChunkedStream.ChunkedStream;
  31385. var ColorSpace = coreColorSpace.ColorSpace;
  31386. var Catalog = function CatalogClosure() {
  31387. function Catalog(pdfManager, xref, pageFactory) {
  31388. this.pdfManager = pdfManager;
  31389. this.xref = xref;
  31390. this.catDict = xref.getCatalogObj();
  31391. this.fontCache = new RefSetCache();
  31392. this.builtInCMapCache = Object.create(null);
  31393. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  31394. this.pageFactory = pageFactory;
  31395. this.pagePromises = [];
  31396. }
  31397. Catalog.prototype = {
  31398. get metadata() {
  31399. var streamRef = this.catDict.getRaw('Metadata');
  31400. if (!isRef(streamRef)) {
  31401. return shadow(this, 'metadata', null);
  31402. }
  31403. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  31404. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  31405. var metadata;
  31406. if (stream && isDict(stream.dict)) {
  31407. var type = stream.dict.get('Type');
  31408. var subtype = stream.dict.get('Subtype');
  31409. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  31410. try {
  31411. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  31412. } catch (e) {
  31413. info('Skipping invalid metadata.');
  31414. }
  31415. }
  31416. }
  31417. return shadow(this, 'metadata', metadata);
  31418. },
  31419. get toplevelPagesDict() {
  31420. var pagesObj = this.catDict.get('Pages');
  31421. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  31422. return shadow(this, 'toplevelPagesDict', pagesObj);
  31423. },
  31424. get documentOutline() {
  31425. var obj = null;
  31426. try {
  31427. obj = this.readDocumentOutline();
  31428. } catch (ex) {
  31429. if (ex instanceof MissingDataException) {
  31430. throw ex;
  31431. }
  31432. warn('Unable to read document outline');
  31433. }
  31434. return shadow(this, 'documentOutline', obj);
  31435. },
  31436. readDocumentOutline: function Catalog_readDocumentOutline() {
  31437. var obj = this.catDict.get('Outlines');
  31438. if (!isDict(obj)) {
  31439. return null;
  31440. }
  31441. obj = obj.getRaw('First');
  31442. if (!isRef(obj)) {
  31443. return null;
  31444. }
  31445. var root = { items: [] };
  31446. var queue = [{
  31447. obj: obj,
  31448. parent: root
  31449. }];
  31450. var processed = new RefSet();
  31451. processed.put(obj);
  31452. var xref = this.xref, blackColor = new Uint8Array(3);
  31453. while (queue.length > 0) {
  31454. var i = queue.shift();
  31455. var outlineDict = xref.fetchIfRef(i.obj);
  31456. if (outlineDict === null) {
  31457. continue;
  31458. }
  31459. assert(outlineDict.has('Title'), 'Invalid outline item');
  31460. var data = {
  31461. url: null,
  31462. dest: null
  31463. };
  31464. Catalog.parseDestDictionary({
  31465. destDict: outlineDict,
  31466. resultObj: data,
  31467. docBaseUrl: this.pdfManager.docBaseUrl
  31468. });
  31469. var title = outlineDict.get('Title');
  31470. var flags = outlineDict.get('F') || 0;
  31471. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  31472. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  31473. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  31474. }
  31475. var outlineItem = {
  31476. dest: data.dest,
  31477. url: data.url,
  31478. unsafeUrl: data.unsafeUrl,
  31479. newWindow: data.newWindow,
  31480. title: stringToPDFString(title),
  31481. color: rgbColor,
  31482. count: outlineDict.get('Count'),
  31483. bold: !!(flags & 2),
  31484. italic: !!(flags & 1),
  31485. items: []
  31486. };
  31487. i.parent.items.push(outlineItem);
  31488. obj = outlineDict.getRaw('First');
  31489. if (isRef(obj) && !processed.has(obj)) {
  31490. queue.push({
  31491. obj: obj,
  31492. parent: outlineItem
  31493. });
  31494. processed.put(obj);
  31495. }
  31496. obj = outlineDict.getRaw('Next');
  31497. if (isRef(obj) && !processed.has(obj)) {
  31498. queue.push({
  31499. obj: obj,
  31500. parent: i.parent
  31501. });
  31502. processed.put(obj);
  31503. }
  31504. }
  31505. return root.items.length > 0 ? root.items : null;
  31506. },
  31507. get numPages() {
  31508. var obj = this.toplevelPagesDict.get('Count');
  31509. assert(isInt(obj), 'page count in top level pages object is not an integer');
  31510. return shadow(this, 'num', obj);
  31511. },
  31512. get destinations() {
  31513. function fetchDestination(dest) {
  31514. return isDict(dest) ? dest.get('D') : dest;
  31515. }
  31516. var xref = this.xref;
  31517. var dests = {}, nameTreeRef, nameDictionaryRef;
  31518. var obj = this.catDict.get('Names');
  31519. if (obj && obj.has('Dests')) {
  31520. nameTreeRef = obj.getRaw('Dests');
  31521. } else if (this.catDict.has('Dests')) {
  31522. nameDictionaryRef = this.catDict.get('Dests');
  31523. }
  31524. if (nameDictionaryRef) {
  31525. obj = nameDictionaryRef;
  31526. obj.forEach(function catalogForEach(key, value) {
  31527. if (!value) {
  31528. return;
  31529. }
  31530. dests[key] = fetchDestination(value);
  31531. });
  31532. }
  31533. if (nameTreeRef) {
  31534. var nameTree = new NameTree(nameTreeRef, xref);
  31535. var names = nameTree.getAll();
  31536. for (var name in names) {
  31537. dests[name] = fetchDestination(names[name]);
  31538. }
  31539. }
  31540. return shadow(this, 'destinations', dests);
  31541. },
  31542. getDestination: function Catalog_getDestination(destinationId) {
  31543. function fetchDestination(dest) {
  31544. return isDict(dest) ? dest.get('D') : dest;
  31545. }
  31546. var xref = this.xref;
  31547. var dest = null, nameTreeRef, nameDictionaryRef;
  31548. var obj = this.catDict.get('Names');
  31549. if (obj && obj.has('Dests')) {
  31550. nameTreeRef = obj.getRaw('Dests');
  31551. } else if (this.catDict.has('Dests')) {
  31552. nameDictionaryRef = this.catDict.get('Dests');
  31553. }
  31554. if (nameDictionaryRef) {
  31555. var value = nameDictionaryRef.get(destinationId);
  31556. if (value) {
  31557. dest = fetchDestination(value);
  31558. }
  31559. }
  31560. if (nameTreeRef) {
  31561. var nameTree = new NameTree(nameTreeRef, xref);
  31562. dest = fetchDestination(nameTree.get(destinationId));
  31563. }
  31564. return dest;
  31565. },
  31566. get pageLabels() {
  31567. var obj = null;
  31568. try {
  31569. obj = this.readPageLabels();
  31570. } catch (ex) {
  31571. if (ex instanceof MissingDataException) {
  31572. throw ex;
  31573. }
  31574. warn('Unable to read page labels.');
  31575. }
  31576. return shadow(this, 'pageLabels', obj);
  31577. },
  31578. readPageLabels: function Catalog_readPageLabels() {
  31579. var obj = this.catDict.getRaw('PageLabels');
  31580. if (!obj) {
  31581. return null;
  31582. }
  31583. var pageLabels = new Array(this.numPages);
  31584. var style = null;
  31585. var prefix = '';
  31586. var numberTree = new NumberTree(obj, this.xref);
  31587. var nums = numberTree.getAll();
  31588. var currentLabel = '', currentIndex = 1;
  31589. for (var i = 0, ii = this.numPages; i < ii; i++) {
  31590. if (i in nums) {
  31591. var labelDict = nums[i];
  31592. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  31593. var type = labelDict.get('Type');
  31594. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  31595. var s = labelDict.get('S');
  31596. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  31597. style = s ? s.name : null;
  31598. var p = labelDict.get('P');
  31599. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  31600. prefix = p ? stringToPDFString(p) : '';
  31601. var st = labelDict.get('St');
  31602. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  31603. currentIndex = st || 1;
  31604. }
  31605. switch (style) {
  31606. case 'D':
  31607. currentLabel = currentIndex;
  31608. break;
  31609. case 'R':
  31610. case 'r':
  31611. currentLabel = Util.toRoman(currentIndex, style === 'r');
  31612. break;
  31613. case 'A':
  31614. case 'a':
  31615. var LIMIT = 26;
  31616. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  31617. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  31618. var letterIndex = currentIndex - 1;
  31619. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  31620. var charBuf = [];
  31621. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  31622. charBuf.push(character);
  31623. }
  31624. currentLabel = charBuf.join('');
  31625. break;
  31626. default:
  31627. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  31628. }
  31629. pageLabels[i] = prefix + currentLabel;
  31630. currentLabel = '';
  31631. currentIndex++;
  31632. }
  31633. return pageLabels;
  31634. },
  31635. get attachments() {
  31636. var xref = this.xref;
  31637. var attachments = null, nameTreeRef;
  31638. var obj = this.catDict.get('Names');
  31639. if (obj) {
  31640. nameTreeRef = obj.getRaw('EmbeddedFiles');
  31641. }
  31642. if (nameTreeRef) {
  31643. var nameTree = new NameTree(nameTreeRef, xref);
  31644. var names = nameTree.getAll();
  31645. for (var name in names) {
  31646. var fs = new FileSpec(names[name], xref);
  31647. if (!attachments) {
  31648. attachments = Object.create(null);
  31649. }
  31650. attachments[stringToPDFString(name)] = fs.serializable;
  31651. }
  31652. }
  31653. return shadow(this, 'attachments', attachments);
  31654. },
  31655. get javaScript() {
  31656. var xref = this.xref;
  31657. var obj = this.catDict.get('Names');
  31658. var javaScript = [];
  31659. function appendIfJavaScriptDict(jsDict) {
  31660. var type = jsDict.get('S');
  31661. if (!isName(type, 'JavaScript')) {
  31662. return;
  31663. }
  31664. var js = jsDict.get('JS');
  31665. if (isStream(js)) {
  31666. js = bytesToString(js.getBytes());
  31667. } else if (!isString(js)) {
  31668. return;
  31669. }
  31670. javaScript.push(stringToPDFString(js));
  31671. }
  31672. if (obj && obj.has('JavaScript')) {
  31673. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  31674. var names = nameTree.getAll();
  31675. for (var name in names) {
  31676. var jsDict = names[name];
  31677. if (isDict(jsDict)) {
  31678. appendIfJavaScriptDict(jsDict);
  31679. }
  31680. }
  31681. }
  31682. var openactionDict = this.catDict.get('OpenAction');
  31683. if (isDict(openactionDict, 'Action')) {
  31684. var actionType = openactionDict.get('S');
  31685. if (isName(actionType, 'Named')) {
  31686. var action = openactionDict.get('N');
  31687. if (isName(action, 'Print')) {
  31688. javaScript.push('print({});');
  31689. }
  31690. } else {
  31691. appendIfJavaScriptDict(openactionDict);
  31692. }
  31693. }
  31694. return shadow(this, 'javaScript', javaScript);
  31695. },
  31696. cleanup: function Catalog_cleanup() {
  31697. var promises = [];
  31698. this.fontCache.forEach(function (promise) {
  31699. promises.push(promise);
  31700. });
  31701. return Promise.all(promises).then(function (translatedFonts) {
  31702. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  31703. var font = translatedFonts[i].dict;
  31704. delete font.translated;
  31705. }
  31706. this.fontCache.clear();
  31707. this.builtInCMapCache = Object.create(null);
  31708. }.bind(this));
  31709. },
  31710. getPage: function Catalog_getPage(pageIndex) {
  31711. if (!(pageIndex in this.pagePromises)) {
  31712. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  31713. var dict = a[0];
  31714. var ref = a[1];
  31715. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
  31716. }.bind(this));
  31717. }
  31718. return this.pagePromises[pageIndex];
  31719. },
  31720. getPageDict: function Catalog_getPageDict(pageIndex) {
  31721. var capability = createPromiseCapability();
  31722. var nodesToVisit = [this.catDict.getRaw('Pages')];
  31723. var currentPageIndex = 0;
  31724. var xref = this.xref;
  31725. function next() {
  31726. while (nodesToVisit.length) {
  31727. var currentNode = nodesToVisit.pop();
  31728. if (isRef(currentNode)) {
  31729. xref.fetchAsync(currentNode).then(function (obj) {
  31730. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  31731. if (pageIndex === currentPageIndex) {
  31732. capability.resolve([
  31733. obj,
  31734. currentNode
  31735. ]);
  31736. } else {
  31737. currentPageIndex++;
  31738. next();
  31739. }
  31740. return;
  31741. }
  31742. nodesToVisit.push(obj);
  31743. next();
  31744. }, capability.reject);
  31745. return;
  31746. }
  31747. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  31748. var count = currentNode.get('Count');
  31749. if (currentPageIndex + count <= pageIndex) {
  31750. currentPageIndex += count;
  31751. continue;
  31752. }
  31753. var kids = currentNode.get('Kids');
  31754. assert(isArray(kids), 'page dictionary kids object is not an array');
  31755. for (var last = kids.length - 1; last >= 0; last--) {
  31756. nodesToVisit.push(kids[last]);
  31757. }
  31758. }
  31759. capability.reject('Page index ' + pageIndex + ' not found.');
  31760. }
  31761. next();
  31762. return capability.promise;
  31763. },
  31764. getPageIndex: function Catalog_getPageIndex(pageRef) {
  31765. var xref = this.xref;
  31766. function pagesBeforeRef(kidRef) {
  31767. var total = 0;
  31768. var parentRef;
  31769. return xref.fetchAsync(kidRef).then(function (node) {
  31770. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  31771. throw new Error('The reference does not point to a /Page Dict.');
  31772. }
  31773. if (!node) {
  31774. return null;
  31775. }
  31776. assert(isDict(node), 'node must be a Dict.');
  31777. parentRef = node.getRaw('Parent');
  31778. return node.getAsync('Parent');
  31779. }).then(function (parent) {
  31780. if (!parent) {
  31781. return null;
  31782. }
  31783. assert(isDict(parent), 'parent must be a Dict.');
  31784. return parent.getAsync('Kids');
  31785. }).then(function (kids) {
  31786. if (!kids) {
  31787. return null;
  31788. }
  31789. var kidPromises = [];
  31790. var found = false;
  31791. for (var i = 0; i < kids.length; i++) {
  31792. var kid = kids[i];
  31793. assert(isRef(kid), 'kid must be a Ref.');
  31794. if (kid.num === kidRef.num) {
  31795. found = true;
  31796. break;
  31797. }
  31798. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  31799. if (kid.has('Count')) {
  31800. var count = kid.get('Count');
  31801. total += count;
  31802. } else {
  31803. total++;
  31804. }
  31805. }));
  31806. }
  31807. if (!found) {
  31808. error('kid ref not found in parents kids');
  31809. }
  31810. return Promise.all(kidPromises).then(function () {
  31811. return [
  31812. total,
  31813. parentRef
  31814. ];
  31815. });
  31816. });
  31817. }
  31818. var total = 0;
  31819. function next(ref) {
  31820. return pagesBeforeRef(ref).then(function (args) {
  31821. if (!args) {
  31822. return total;
  31823. }
  31824. var count = args[0];
  31825. var parentRef = args[1];
  31826. total += count;
  31827. return next(parentRef);
  31828. });
  31829. }
  31830. return next(pageRef);
  31831. }
  31832. };
  31833. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  31834. function addDefaultProtocolToUrl(url) {
  31835. if (url.indexOf('www.') === 0) {
  31836. return 'http://' + url;
  31837. }
  31838. return url;
  31839. }
  31840. function tryConvertUrlEncoding(url) {
  31841. try {
  31842. return stringToUTF8String(url);
  31843. } catch (e) {
  31844. return url;
  31845. }
  31846. }
  31847. var destDict = params.destDict;
  31848. if (!isDict(destDict)) {
  31849. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31850. return;
  31851. }
  31852. var resultObj = params.resultObj;
  31853. if (typeof resultObj !== 'object') {
  31854. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31855. return;
  31856. }
  31857. var docBaseUrl = params.docBaseUrl || null;
  31858. var action = destDict.get('A'), url, dest;
  31859. if (isDict(action)) {
  31860. var linkType = action.get('S').name;
  31861. switch (linkType) {
  31862. case 'URI':
  31863. url = action.get('URI');
  31864. if (isName(url)) {
  31865. url = '/' + url.name;
  31866. } else if (isString(url)) {
  31867. url = addDefaultProtocolToUrl(url);
  31868. }
  31869. break;
  31870. case 'GoTo':
  31871. dest = action.get('D');
  31872. break;
  31873. case 'Launch':
  31874. case 'GoToR':
  31875. var urlDict = action.get('F');
  31876. if (isDict(urlDict)) {
  31877. url = urlDict.get('F') || null;
  31878. } else if (isString(urlDict)) {
  31879. url = urlDict;
  31880. }
  31881. var remoteDest = action.get('D');
  31882. if (remoteDest) {
  31883. if (isName(remoteDest)) {
  31884. remoteDest = remoteDest.name;
  31885. }
  31886. if (isString(url)) {
  31887. var baseUrl = url.split('#')[0];
  31888. if (isString(remoteDest)) {
  31889. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31890. } else if (isArray(remoteDest)) {
  31891. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31892. }
  31893. }
  31894. }
  31895. var newWindow = action.get('NewWindow');
  31896. if (isBool(newWindow)) {
  31897. resultObj.newWindow = newWindow;
  31898. }
  31899. break;
  31900. case 'Named':
  31901. var namedAction = action.get('N');
  31902. if (isName(namedAction)) {
  31903. resultObj.action = namedAction.name;
  31904. }
  31905. break;
  31906. case 'JavaScript':
  31907. var jsAction = action.get('JS'), js;
  31908. if (isStream(jsAction)) {
  31909. js = bytesToString(jsAction.getBytes());
  31910. } else if (isString(jsAction)) {
  31911. js = jsAction;
  31912. }
  31913. if (js) {
  31914. var URL_OPEN_METHODS = [
  31915. 'app.launchURL',
  31916. 'window.open'
  31917. ];
  31918. var regex = new RegExp('^(?:' + URL_OPEN_METHODS.join('|') + ')' + '\\((?:\'|\")(\\S+)(?:\'|\")(?:,|\\))');
  31919. var jsUrl = regex.exec(stringToPDFString(js), 'i');
  31920. if (jsUrl && jsUrl[1]) {
  31921. url = jsUrl[1];
  31922. break;
  31923. }
  31924. }
  31925. default:
  31926. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31927. break;
  31928. }
  31929. } else if (destDict.has('Dest')) {
  31930. dest = destDict.get('Dest');
  31931. }
  31932. if (isString(url)) {
  31933. url = tryConvertUrlEncoding(url);
  31934. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31935. if (absoluteUrl) {
  31936. resultObj.url = absoluteUrl.href;
  31937. }
  31938. resultObj.unsafeUrl = url;
  31939. }
  31940. if (dest) {
  31941. if (isName(dest)) {
  31942. dest = dest.name;
  31943. }
  31944. if (isString(dest) || isArray(dest)) {
  31945. resultObj.dest = dest;
  31946. }
  31947. }
  31948. };
  31949. return Catalog;
  31950. }();
  31951. var XRef = function XRefClosure() {
  31952. function XRef(stream, pdfManager) {
  31953. this.stream = stream;
  31954. this.pdfManager = pdfManager;
  31955. this.entries = [];
  31956. this.xrefstms = Object.create(null);
  31957. this.cache = [];
  31958. this.stats = {
  31959. streamTypes: [],
  31960. fontTypes: []
  31961. };
  31962. }
  31963. XRef.prototype = {
  31964. setStartXRef: function XRef_setStartXRef(startXRef) {
  31965. this.startXRefQueue = [startXRef];
  31966. },
  31967. parse: function XRef_parse(recoveryMode) {
  31968. var trailerDict;
  31969. if (!recoveryMode) {
  31970. trailerDict = this.readXRef();
  31971. } else {
  31972. warn('Indexing all PDF objects');
  31973. trailerDict = this.indexObjects();
  31974. }
  31975. trailerDict.assignXref(this);
  31976. this.trailer = trailerDict;
  31977. var encrypt = trailerDict.get('Encrypt');
  31978. if (isDict(encrypt)) {
  31979. var ids = trailerDict.get('ID');
  31980. var fileId = ids && ids.length ? ids[0] : '';
  31981. encrypt.suppressEncryption = true;
  31982. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31983. }
  31984. if (!(this.root = trailerDict.get('Root'))) {
  31985. error('Invalid root reference');
  31986. }
  31987. },
  31988. processXRefTable: function XRef_processXRefTable(parser) {
  31989. if (!('tableState' in this)) {
  31990. this.tableState = {
  31991. entryNum: 0,
  31992. streamPos: parser.lexer.stream.pos,
  31993. parserBuf1: parser.buf1,
  31994. parserBuf2: parser.buf2
  31995. };
  31996. }
  31997. var obj = this.readXRefTable(parser);
  31998. if (!isCmd(obj, 'trailer')) {
  31999. error('Invalid XRef table: could not find trailer dictionary');
  32000. }
  32001. var dict = parser.getObj();
  32002. if (!isDict(dict) && dict.dict) {
  32003. dict = dict.dict;
  32004. }
  32005. if (!isDict(dict)) {
  32006. error('Invalid XRef table: could not parse trailer dictionary');
  32007. }
  32008. delete this.tableState;
  32009. return dict;
  32010. },
  32011. readXRefTable: function XRef_readXRefTable(parser) {
  32012. var stream = parser.lexer.stream;
  32013. var tableState = this.tableState;
  32014. stream.pos = tableState.streamPos;
  32015. parser.buf1 = tableState.parserBuf1;
  32016. parser.buf2 = tableState.parserBuf2;
  32017. var obj;
  32018. while (true) {
  32019. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  32020. if (isCmd(obj = parser.getObj(), 'trailer')) {
  32021. break;
  32022. }
  32023. tableState.firstEntryNum = obj;
  32024. tableState.entryCount = parser.getObj();
  32025. }
  32026. var first = tableState.firstEntryNum;
  32027. var count = tableState.entryCount;
  32028. if (!isInt(first) || !isInt(count)) {
  32029. error('Invalid XRef table: wrong types in subsection header');
  32030. }
  32031. for (var i = tableState.entryNum; i < count; i++) {
  32032. tableState.streamPos = stream.pos;
  32033. tableState.entryNum = i;
  32034. tableState.parserBuf1 = parser.buf1;
  32035. tableState.parserBuf2 = parser.buf2;
  32036. var entry = {};
  32037. entry.offset = parser.getObj();
  32038. entry.gen = parser.getObj();
  32039. var type = parser.getObj();
  32040. if (isCmd(type, 'f')) {
  32041. entry.free = true;
  32042. } else if (isCmd(type, 'n')) {
  32043. entry.uncompressed = true;
  32044. }
  32045. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  32046. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  32047. }
  32048. if (i === 0 && entry.free && first === 1) {
  32049. first = 0;
  32050. }
  32051. if (!this.entries[i + first]) {
  32052. this.entries[i + first] = entry;
  32053. }
  32054. }
  32055. tableState.entryNum = 0;
  32056. tableState.streamPos = stream.pos;
  32057. tableState.parserBuf1 = parser.buf1;
  32058. tableState.parserBuf2 = parser.buf2;
  32059. delete tableState.firstEntryNum;
  32060. delete tableState.entryCount;
  32061. }
  32062. if (this.entries[0] && !this.entries[0].free) {
  32063. error('Invalid XRef table: unexpected first object');
  32064. }
  32065. return obj;
  32066. },
  32067. processXRefStream: function XRef_processXRefStream(stream) {
  32068. if (!('streamState' in this)) {
  32069. var streamParameters = stream.dict;
  32070. var byteWidths = streamParameters.get('W');
  32071. var range = streamParameters.get('Index');
  32072. if (!range) {
  32073. range = [
  32074. 0,
  32075. streamParameters.get('Size')
  32076. ];
  32077. }
  32078. this.streamState = {
  32079. entryRanges: range,
  32080. byteWidths: byteWidths,
  32081. entryNum: 0,
  32082. streamPos: stream.pos
  32083. };
  32084. }
  32085. this.readXRefStream(stream);
  32086. delete this.streamState;
  32087. return stream.dict;
  32088. },
  32089. readXRefStream: function XRef_readXRefStream(stream) {
  32090. var i, j;
  32091. var streamState = this.streamState;
  32092. stream.pos = streamState.streamPos;
  32093. var byteWidths = streamState.byteWidths;
  32094. var typeFieldWidth = byteWidths[0];
  32095. var offsetFieldWidth = byteWidths[1];
  32096. var generationFieldWidth = byteWidths[2];
  32097. var entryRanges = streamState.entryRanges;
  32098. while (entryRanges.length > 0) {
  32099. var first = entryRanges[0];
  32100. var n = entryRanges[1];
  32101. if (!isInt(first) || !isInt(n)) {
  32102. error('Invalid XRef range fields: ' + first + ', ' + n);
  32103. }
  32104. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  32105. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  32106. }
  32107. for (i = streamState.entryNum; i < n; ++i) {
  32108. streamState.entryNum = i;
  32109. streamState.streamPos = stream.pos;
  32110. var type = 0, offset = 0, generation = 0;
  32111. for (j = 0; j < typeFieldWidth; ++j) {
  32112. type = type << 8 | stream.getByte();
  32113. }
  32114. if (typeFieldWidth === 0) {
  32115. type = 1;
  32116. }
  32117. for (j = 0; j < offsetFieldWidth; ++j) {
  32118. offset = offset << 8 | stream.getByte();
  32119. }
  32120. for (j = 0; j < generationFieldWidth; ++j) {
  32121. generation = generation << 8 | stream.getByte();
  32122. }
  32123. var entry = {};
  32124. entry.offset = offset;
  32125. entry.gen = generation;
  32126. switch (type) {
  32127. case 0:
  32128. entry.free = true;
  32129. break;
  32130. case 1:
  32131. entry.uncompressed = true;
  32132. break;
  32133. case 2:
  32134. break;
  32135. default:
  32136. error('Invalid XRef entry type: ' + type);
  32137. }
  32138. if (!this.entries[first + i]) {
  32139. this.entries[first + i] = entry;
  32140. }
  32141. }
  32142. streamState.entryNum = 0;
  32143. streamState.streamPos = stream.pos;
  32144. entryRanges.splice(0, 2);
  32145. }
  32146. },
  32147. indexObjects: function XRef_indexObjects() {
  32148. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  32149. var PERCENT = 0x25, LT = 0x3C;
  32150. function readToken(data, offset) {
  32151. var token = '', ch = data[offset];
  32152. while (ch !== LF && ch !== CR && ch !== LT) {
  32153. if (++offset >= data.length) {
  32154. break;
  32155. }
  32156. token += String.fromCharCode(ch);
  32157. ch = data[offset];
  32158. }
  32159. return token;
  32160. }
  32161. function skipUntil(data, offset, what) {
  32162. var length = what.length, dataLength = data.length;
  32163. var skipped = 0;
  32164. while (offset < dataLength) {
  32165. var i = 0;
  32166. while (i < length && data[offset + i] === what[i]) {
  32167. ++i;
  32168. }
  32169. if (i >= length) {
  32170. break;
  32171. }
  32172. offset++;
  32173. skipped++;
  32174. }
  32175. return skipped;
  32176. }
  32177. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  32178. var trailerBytes = new Uint8Array([
  32179. 116,
  32180. 114,
  32181. 97,
  32182. 105,
  32183. 108,
  32184. 101,
  32185. 114
  32186. ]);
  32187. var startxrefBytes = new Uint8Array([
  32188. 115,
  32189. 116,
  32190. 97,
  32191. 114,
  32192. 116,
  32193. 120,
  32194. 114,
  32195. 101,
  32196. 102
  32197. ]);
  32198. var endobjBytes = new Uint8Array([
  32199. 101,
  32200. 110,
  32201. 100,
  32202. 111,
  32203. 98,
  32204. 106
  32205. ]);
  32206. var xrefBytes = new Uint8Array([
  32207. 47,
  32208. 88,
  32209. 82,
  32210. 101,
  32211. 102
  32212. ]);
  32213. this.entries.length = 0;
  32214. var stream = this.stream;
  32215. stream.pos = 0;
  32216. var buffer = stream.getBytes();
  32217. var position = stream.start, length = buffer.length;
  32218. var trailers = [], xrefStms = [];
  32219. while (position < length) {
  32220. var ch = buffer[position];
  32221. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  32222. ++position;
  32223. continue;
  32224. }
  32225. if (ch === PERCENT) {
  32226. do {
  32227. ++position;
  32228. if (position >= length) {
  32229. break;
  32230. }
  32231. ch = buffer[position];
  32232. } while (ch !== LF && ch !== CR);
  32233. continue;
  32234. }
  32235. var token = readToken(buffer, position);
  32236. var m;
  32237. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  32238. position += skipUntil(buffer, position, trailerBytes);
  32239. trailers.push(position);
  32240. position += skipUntil(buffer, position, startxrefBytes);
  32241. } else if (m = objRegExp.exec(token)) {
  32242. if (typeof this.entries[m[1]] === 'undefined') {
  32243. this.entries[m[1]] = {
  32244. offset: position - stream.start,
  32245. gen: m[2] | 0,
  32246. uncompressed: true
  32247. };
  32248. }
  32249. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  32250. var content = buffer.subarray(position, position + contentLength);
  32251. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  32252. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  32253. xrefStms.push(position - stream.start);
  32254. this.xrefstms[position - stream.start] = 1;
  32255. }
  32256. position += contentLength;
  32257. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  32258. trailers.push(position);
  32259. position += skipUntil(buffer, position, startxrefBytes);
  32260. } else {
  32261. position += token.length + 1;
  32262. }
  32263. }
  32264. var i, ii;
  32265. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  32266. this.startXRefQueue.push(xrefStms[i]);
  32267. this.readXRef(true);
  32268. }
  32269. var dict;
  32270. for (i = 0, ii = trailers.length; i < ii; ++i) {
  32271. stream.pos = trailers[i];
  32272. var parser = new Parser(new Lexer(stream), true, this, true);
  32273. var obj = parser.getObj();
  32274. if (!isCmd(obj, 'trailer')) {
  32275. continue;
  32276. }
  32277. dict = parser.getObj();
  32278. if (!isDict(dict)) {
  32279. continue;
  32280. }
  32281. if (dict.has('ID')) {
  32282. return dict;
  32283. }
  32284. }
  32285. if (dict) {
  32286. return dict;
  32287. }
  32288. throw new InvalidPDFException('Invalid PDF structure');
  32289. },
  32290. readXRef: function XRef_readXRef(recoveryMode) {
  32291. var stream = this.stream;
  32292. try {
  32293. while (this.startXRefQueue.length) {
  32294. var startXRef = this.startXRefQueue[0];
  32295. stream.pos = startXRef + stream.start;
  32296. var parser = new Parser(new Lexer(stream), true, this);
  32297. var obj = parser.getObj();
  32298. var dict;
  32299. if (isCmd(obj, 'xref')) {
  32300. dict = this.processXRefTable(parser);
  32301. if (!this.topDict) {
  32302. this.topDict = dict;
  32303. }
  32304. obj = dict.get('XRefStm');
  32305. if (isInt(obj)) {
  32306. var pos = obj;
  32307. if (!(pos in this.xrefstms)) {
  32308. this.xrefstms[pos] = 1;
  32309. this.startXRefQueue.push(pos);
  32310. }
  32311. }
  32312. } else if (isInt(obj)) {
  32313. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  32314. error('Invalid XRef stream');
  32315. }
  32316. dict = this.processXRefStream(obj);
  32317. if (!this.topDict) {
  32318. this.topDict = dict;
  32319. }
  32320. if (!dict) {
  32321. error('Failed to read XRef stream');
  32322. }
  32323. } else {
  32324. error('Invalid XRef stream header');
  32325. }
  32326. obj = dict.get('Prev');
  32327. if (isInt(obj)) {
  32328. this.startXRefQueue.push(obj);
  32329. } else if (isRef(obj)) {
  32330. this.startXRefQueue.push(obj.num);
  32331. }
  32332. this.startXRefQueue.shift();
  32333. }
  32334. return this.topDict;
  32335. } catch (e) {
  32336. if (e instanceof MissingDataException) {
  32337. throw e;
  32338. }
  32339. info('(while reading XRef): ' + e);
  32340. }
  32341. if (recoveryMode) {
  32342. return;
  32343. }
  32344. throw new XRefParseException();
  32345. },
  32346. getEntry: function XRef_getEntry(i) {
  32347. var xrefEntry = this.entries[i];
  32348. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  32349. return xrefEntry;
  32350. }
  32351. return null;
  32352. },
  32353. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  32354. if (!isRef(obj)) {
  32355. return obj;
  32356. }
  32357. return this.fetch(obj, suppressEncryption);
  32358. },
  32359. fetch: function XRef_fetch(ref, suppressEncryption) {
  32360. assert(isRef(ref), 'ref object is not a reference');
  32361. var num = ref.num;
  32362. if (num in this.cache) {
  32363. var cacheEntry = this.cache[num];
  32364. return cacheEntry;
  32365. }
  32366. var xrefEntry = this.getEntry(num);
  32367. if (xrefEntry === null) {
  32368. return this.cache[num] = null;
  32369. }
  32370. if (xrefEntry.uncompressed) {
  32371. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  32372. } else {
  32373. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  32374. }
  32375. if (isDict(xrefEntry)) {
  32376. xrefEntry.objId = ref.toString();
  32377. } else if (isStream(xrefEntry)) {
  32378. xrefEntry.dict.objId = ref.toString();
  32379. }
  32380. return xrefEntry;
  32381. },
  32382. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  32383. var gen = ref.gen;
  32384. var num = ref.num;
  32385. if (xrefEntry.gen !== gen) {
  32386. error('inconsistent generation in XRef');
  32387. }
  32388. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  32389. var parser = new Parser(new Lexer(stream), true, this);
  32390. var obj1 = parser.getObj();
  32391. var obj2 = parser.getObj();
  32392. var obj3 = parser.getObj();
  32393. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  32394. error('bad XRef entry');
  32395. }
  32396. if (!isCmd(obj3, 'obj')) {
  32397. if (obj3.cmd.indexOf('obj') === 0) {
  32398. num = parseInt(obj3.cmd.substring(3), 10);
  32399. if (!isNaN(num)) {
  32400. return num;
  32401. }
  32402. }
  32403. error('bad XRef entry');
  32404. }
  32405. if (this.encrypt && !suppressEncryption) {
  32406. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  32407. } else {
  32408. xrefEntry = parser.getObj();
  32409. }
  32410. if (!isStream(xrefEntry)) {
  32411. this.cache[num] = xrefEntry;
  32412. }
  32413. return xrefEntry;
  32414. },
  32415. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  32416. var tableOffset = xrefEntry.offset;
  32417. var stream = this.fetch(new Ref(tableOffset, 0));
  32418. if (!isStream(stream)) {
  32419. error('bad ObjStm stream');
  32420. }
  32421. var first = stream.dict.get('First');
  32422. var n = stream.dict.get('N');
  32423. if (!isInt(first) || !isInt(n)) {
  32424. error('invalid first and n parameters for ObjStm stream');
  32425. }
  32426. var parser = new Parser(new Lexer(stream), false, this);
  32427. parser.allowStreams = true;
  32428. var i, entries = [], num, nums = [];
  32429. for (i = 0; i < n; ++i) {
  32430. num = parser.getObj();
  32431. if (!isInt(num)) {
  32432. error('invalid object number in the ObjStm stream: ' + num);
  32433. }
  32434. nums.push(num);
  32435. var offset = parser.getObj();
  32436. if (!isInt(offset)) {
  32437. error('invalid object offset in the ObjStm stream: ' + offset);
  32438. }
  32439. }
  32440. for (i = 0; i < n; ++i) {
  32441. entries.push(parser.getObj());
  32442. if (isCmd(parser.buf1, 'endobj')) {
  32443. parser.shift();
  32444. }
  32445. num = nums[i];
  32446. var entry = this.entries[num];
  32447. if (entry && entry.offset === tableOffset && entry.gen === i) {
  32448. this.cache[num] = entries[i];
  32449. }
  32450. }
  32451. xrefEntry = entries[xrefEntry.gen];
  32452. if (xrefEntry === undefined) {
  32453. error('bad XRef entry for compressed object');
  32454. }
  32455. return xrefEntry;
  32456. },
  32457. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  32458. if (!isRef(obj)) {
  32459. return Promise.resolve(obj);
  32460. }
  32461. return this.fetchAsync(obj, suppressEncryption);
  32462. },
  32463. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  32464. var streamManager = this.stream.manager;
  32465. var xref = this;
  32466. return new Promise(function tryFetch(resolve, reject) {
  32467. try {
  32468. resolve(xref.fetch(ref, suppressEncryption));
  32469. } catch (e) {
  32470. if (e instanceof MissingDataException) {
  32471. streamManager.requestRange(e.begin, e.end).then(function () {
  32472. tryFetch(resolve, reject);
  32473. }, reject);
  32474. return;
  32475. }
  32476. reject(e);
  32477. }
  32478. });
  32479. },
  32480. getCatalogObj: function XRef_getCatalogObj() {
  32481. return this.root;
  32482. }
  32483. };
  32484. return XRef;
  32485. }();
  32486. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  32487. function NameOrNumberTree(root, xref) {
  32488. throw new Error('Cannot initialize NameOrNumberTree.');
  32489. }
  32490. NameOrNumberTree.prototype = {
  32491. getAll: function NameOrNumberTree_getAll() {
  32492. var dict = Object.create(null);
  32493. if (!this.root) {
  32494. return dict;
  32495. }
  32496. var xref = this.xref;
  32497. var processed = new RefSet();
  32498. processed.put(this.root);
  32499. var queue = [this.root];
  32500. while (queue.length > 0) {
  32501. var i, n;
  32502. var obj = xref.fetchIfRef(queue.shift());
  32503. if (!isDict(obj)) {
  32504. continue;
  32505. }
  32506. if (obj.has('Kids')) {
  32507. var kids = obj.get('Kids');
  32508. for (i = 0, n = kids.length; i < n; i++) {
  32509. var kid = kids[i];
  32510. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  32511. queue.push(kid);
  32512. processed.put(kid);
  32513. }
  32514. continue;
  32515. }
  32516. var entries = obj.get(this._type);
  32517. if (isArray(entries)) {
  32518. for (i = 0, n = entries.length; i < n; i += 2) {
  32519. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  32520. }
  32521. }
  32522. }
  32523. return dict;
  32524. },
  32525. get: function NameOrNumberTree_get(key) {
  32526. if (!this.root) {
  32527. return null;
  32528. }
  32529. var xref = this.xref;
  32530. var kidsOrEntries = xref.fetchIfRef(this.root);
  32531. var loopCount = 0;
  32532. var MAX_LEVELS = 10;
  32533. var l, r, m;
  32534. while (kidsOrEntries.has('Kids')) {
  32535. if (++loopCount > MAX_LEVELS) {
  32536. warn('Search depth limit reached for "' + this._type + '" tree.');
  32537. return null;
  32538. }
  32539. var kids = kidsOrEntries.get('Kids');
  32540. if (!isArray(kids)) {
  32541. return null;
  32542. }
  32543. l = 0;
  32544. r = kids.length - 1;
  32545. while (l <= r) {
  32546. m = l + r >> 1;
  32547. var kid = xref.fetchIfRef(kids[m]);
  32548. var limits = kid.get('Limits');
  32549. if (key < xref.fetchIfRef(limits[0])) {
  32550. r = m - 1;
  32551. } else if (key > xref.fetchIfRef(limits[1])) {
  32552. l = m + 1;
  32553. } else {
  32554. kidsOrEntries = xref.fetchIfRef(kids[m]);
  32555. break;
  32556. }
  32557. }
  32558. if (l > r) {
  32559. return null;
  32560. }
  32561. }
  32562. var entries = kidsOrEntries.get(this._type);
  32563. if (isArray(entries)) {
  32564. l = 0;
  32565. r = entries.length - 2;
  32566. while (l <= r) {
  32567. m = l + r & ~1;
  32568. var currentKey = xref.fetchIfRef(entries[m]);
  32569. if (key < currentKey) {
  32570. r = m - 2;
  32571. } else if (key > currentKey) {
  32572. l = m + 2;
  32573. } else {
  32574. return xref.fetchIfRef(entries[m + 1]);
  32575. }
  32576. }
  32577. }
  32578. return null;
  32579. }
  32580. };
  32581. return NameOrNumberTree;
  32582. }();
  32583. var NameTree = function NameTreeClosure() {
  32584. function NameTree(root, xref) {
  32585. this.root = root;
  32586. this.xref = xref;
  32587. this._type = 'Names';
  32588. }
  32589. Util.inherit(NameTree, NameOrNumberTree, {});
  32590. return NameTree;
  32591. }();
  32592. var NumberTree = function NumberTreeClosure() {
  32593. function NumberTree(root, xref) {
  32594. this.root = root;
  32595. this.xref = xref;
  32596. this._type = 'Nums';
  32597. }
  32598. Util.inherit(NumberTree, NameOrNumberTree, {});
  32599. return NumberTree;
  32600. }();
  32601. var FileSpec = function FileSpecClosure() {
  32602. function FileSpec(root, xref) {
  32603. if (!root || !isDict(root)) {
  32604. return;
  32605. }
  32606. this.xref = xref;
  32607. this.root = root;
  32608. if (root.has('FS')) {
  32609. this.fs = root.get('FS');
  32610. }
  32611. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  32612. if (root.has('RF')) {
  32613. warn('Related file specifications are not supported');
  32614. }
  32615. this.contentAvailable = true;
  32616. if (!root.has('EF')) {
  32617. this.contentAvailable = false;
  32618. warn('Non-embedded file specifications are not supported');
  32619. }
  32620. }
  32621. function pickPlatformItem(dict) {
  32622. if (dict.has('UF')) {
  32623. return dict.get('UF');
  32624. } else if (dict.has('F')) {
  32625. return dict.get('F');
  32626. } else if (dict.has('Unix')) {
  32627. return dict.get('Unix');
  32628. } else if (dict.has('Mac')) {
  32629. return dict.get('Mac');
  32630. } else if (dict.has('DOS')) {
  32631. return dict.get('DOS');
  32632. }
  32633. return null;
  32634. }
  32635. FileSpec.prototype = {
  32636. get filename() {
  32637. if (!this._filename && this.root) {
  32638. var filename = pickPlatformItem(this.root) || 'unnamed';
  32639. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  32640. }
  32641. return this._filename;
  32642. },
  32643. get content() {
  32644. if (!this.contentAvailable) {
  32645. return null;
  32646. }
  32647. if (!this.contentRef && this.root) {
  32648. this.contentRef = pickPlatformItem(this.root.get('EF'));
  32649. }
  32650. var content = null;
  32651. if (this.contentRef) {
  32652. var xref = this.xref;
  32653. var fileObj = xref.fetchIfRef(this.contentRef);
  32654. if (fileObj && isStream(fileObj)) {
  32655. content = fileObj.getBytes();
  32656. } else {
  32657. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  32658. }
  32659. } else {
  32660. warn('Embedded file specification does not have a content');
  32661. }
  32662. return content;
  32663. },
  32664. get serializable() {
  32665. return {
  32666. filename: this.filename,
  32667. content: this.content
  32668. };
  32669. }
  32670. };
  32671. return FileSpec;
  32672. }();
  32673. var ObjectLoader = function () {
  32674. function mayHaveChildren(value) {
  32675. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  32676. }
  32677. function addChildren(node, nodesToVisit) {
  32678. var value;
  32679. if (isDict(node) || isStream(node)) {
  32680. var map;
  32681. if (isDict(node)) {
  32682. map = node.map;
  32683. } else {
  32684. map = node.dict.map;
  32685. }
  32686. for (var key in map) {
  32687. value = map[key];
  32688. if (mayHaveChildren(value)) {
  32689. nodesToVisit.push(value);
  32690. }
  32691. }
  32692. } else if (isArray(node)) {
  32693. for (var i = 0, ii = node.length; i < ii; i++) {
  32694. value = node[i];
  32695. if (mayHaveChildren(value)) {
  32696. nodesToVisit.push(value);
  32697. }
  32698. }
  32699. }
  32700. }
  32701. function ObjectLoader(obj, keys, xref) {
  32702. this.obj = obj;
  32703. this.keys = keys;
  32704. this.xref = xref;
  32705. this.refSet = null;
  32706. this.capability = null;
  32707. }
  32708. ObjectLoader.prototype = {
  32709. load: function ObjectLoader_load() {
  32710. var keys = this.keys;
  32711. this.capability = createPromiseCapability();
  32712. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  32713. this.capability.resolve();
  32714. return this.capability.promise;
  32715. }
  32716. this.refSet = new RefSet();
  32717. var nodesToVisit = [];
  32718. for (var i = 0; i < keys.length; i++) {
  32719. nodesToVisit.push(this.obj[keys[i]]);
  32720. }
  32721. this._walk(nodesToVisit);
  32722. return this.capability.promise;
  32723. },
  32724. _walk: function ObjectLoader_walk(nodesToVisit) {
  32725. var nodesToRevisit = [];
  32726. var pendingRequests = [];
  32727. while (nodesToVisit.length) {
  32728. var currentNode = nodesToVisit.pop();
  32729. if (isRef(currentNode)) {
  32730. if (this.refSet.has(currentNode)) {
  32731. continue;
  32732. }
  32733. try {
  32734. var ref = currentNode;
  32735. this.refSet.put(ref);
  32736. currentNode = this.xref.fetch(currentNode);
  32737. } catch (e) {
  32738. if (!(e instanceof MissingDataException)) {
  32739. throw e;
  32740. }
  32741. nodesToRevisit.push(currentNode);
  32742. pendingRequests.push({
  32743. begin: e.begin,
  32744. end: e.end
  32745. });
  32746. }
  32747. }
  32748. if (currentNode && currentNode.getBaseStreams) {
  32749. var baseStreams = currentNode.getBaseStreams();
  32750. var foundMissingData = false;
  32751. for (var i = 0; i < baseStreams.length; i++) {
  32752. var stream = baseStreams[i];
  32753. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  32754. foundMissingData = true;
  32755. pendingRequests.push({
  32756. begin: stream.start,
  32757. end: stream.end
  32758. });
  32759. }
  32760. }
  32761. if (foundMissingData) {
  32762. nodesToRevisit.push(currentNode);
  32763. }
  32764. }
  32765. addChildren(currentNode, nodesToVisit);
  32766. }
  32767. if (pendingRequests.length) {
  32768. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  32769. nodesToVisit = nodesToRevisit;
  32770. for (var i = 0; i < nodesToRevisit.length; i++) {
  32771. var node = nodesToRevisit[i];
  32772. if (isRef(node)) {
  32773. this.refSet.remove(node);
  32774. }
  32775. }
  32776. this._walk(nodesToVisit);
  32777. }.bind(this), this.capability.reject);
  32778. return;
  32779. }
  32780. this.refSet = null;
  32781. this.capability.resolve();
  32782. }
  32783. };
  32784. return ObjectLoader;
  32785. }();
  32786. exports.Catalog = Catalog;
  32787. exports.ObjectLoader = ObjectLoader;
  32788. exports.XRef = XRef;
  32789. exports.FileSpec = FileSpec;
  32790. /***/ }),
  32791. /* 16 */
  32792. /***/ (function(module, exports, __w_pdfjs_require__) {
  32793. "use strict";
  32794. var sharedUtil = __w_pdfjs_require__(0);
  32795. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32796. var getStdFontMap = getLookupTableFactory(function (t) {
  32797. t['ArialNarrow'] = 'Helvetica';
  32798. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  32799. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  32800. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  32801. t['ArialBlack'] = 'Helvetica';
  32802. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  32803. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  32804. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  32805. t['Arial-Black'] = 'Helvetica';
  32806. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  32807. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  32808. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  32809. t['Arial'] = 'Helvetica';
  32810. t['Arial-Bold'] = 'Helvetica-Bold';
  32811. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  32812. t['Arial-Italic'] = 'Helvetica-Oblique';
  32813. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  32814. t['Arial-BoldMT'] = 'Helvetica-Bold';
  32815. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  32816. t['ArialMT'] = 'Helvetica';
  32817. t['Courier-Bold'] = 'Courier-Bold';
  32818. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  32819. t['Courier-Italic'] = 'Courier-Oblique';
  32820. t['CourierNew'] = 'Courier';
  32821. t['CourierNew-Bold'] = 'Courier-Bold';
  32822. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  32823. t['CourierNew-Italic'] = 'Courier-Oblique';
  32824. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  32825. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  32826. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  32827. t['CourierNewPSMT'] = 'Courier';
  32828. t['Helvetica'] = 'Helvetica';
  32829. t['Helvetica-Bold'] = 'Helvetica-Bold';
  32830. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  32831. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32832. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32833. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32834. t['Symbol-Bold'] = 'Symbol';
  32835. t['Symbol-BoldItalic'] = 'Symbol';
  32836. t['Symbol-Italic'] = 'Symbol';
  32837. t['TimesNewRoman'] = 'Times-Roman';
  32838. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32839. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32840. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32841. t['TimesNewRomanPS'] = 'Times-Roman';
  32842. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32843. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32844. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32845. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32846. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32847. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32848. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32849. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32850. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32851. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32852. });
  32853. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32854. t['CenturyGothic'] = 'Helvetica';
  32855. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32856. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32857. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32858. t['ComicSansMS'] = 'Comic Sans MS';
  32859. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32860. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32861. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32862. t['LucidaConsole'] = 'Courier';
  32863. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32864. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32865. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32866. t['MS-Gothic'] = 'MS Gothic';
  32867. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32868. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32869. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32870. t['MS-Mincho'] = 'MS Mincho';
  32871. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32872. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32873. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32874. t['MS-PGothic'] = 'MS PGothic';
  32875. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32876. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32877. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32878. t['MS-PMincho'] = 'MS PMincho';
  32879. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32880. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32881. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32882. t['NuptialScript'] = 'Times-Italic';
  32883. t['Wingdings'] = 'ZapfDingbats';
  32884. });
  32885. var getSerifFonts = getLookupTableFactory(function (t) {
  32886. t['Adobe Jenson'] = true;
  32887. t['Adobe Text'] = true;
  32888. t['Albertus'] = true;
  32889. t['Aldus'] = true;
  32890. t['Alexandria'] = true;
  32891. t['Algerian'] = true;
  32892. t['American Typewriter'] = true;
  32893. t['Antiqua'] = true;
  32894. t['Apex'] = true;
  32895. t['Arno'] = true;
  32896. t['Aster'] = true;
  32897. t['Aurora'] = true;
  32898. t['Baskerville'] = true;
  32899. t['Bell'] = true;
  32900. t['Bembo'] = true;
  32901. t['Bembo Schoolbook'] = true;
  32902. t['Benguiat'] = true;
  32903. t['Berkeley Old Style'] = true;
  32904. t['Bernhard Modern'] = true;
  32905. t['Berthold City'] = true;
  32906. t['Bodoni'] = true;
  32907. t['Bauer Bodoni'] = true;
  32908. t['Book Antiqua'] = true;
  32909. t['Bookman'] = true;
  32910. t['Bordeaux Roman'] = true;
  32911. t['Californian FB'] = true;
  32912. t['Calisto'] = true;
  32913. t['Calvert'] = true;
  32914. t['Capitals'] = true;
  32915. t['Cambria'] = true;
  32916. t['Cartier'] = true;
  32917. t['Caslon'] = true;
  32918. t['Catull'] = true;
  32919. t['Centaur'] = true;
  32920. t['Century Old Style'] = true;
  32921. t['Century Schoolbook'] = true;
  32922. t['Chaparral'] = true;
  32923. t['Charis SIL'] = true;
  32924. t['Cheltenham'] = true;
  32925. t['Cholla Slab'] = true;
  32926. t['Clarendon'] = true;
  32927. t['Clearface'] = true;
  32928. t['Cochin'] = true;
  32929. t['Colonna'] = true;
  32930. t['Computer Modern'] = true;
  32931. t['Concrete Roman'] = true;
  32932. t['Constantia'] = true;
  32933. t['Cooper Black'] = true;
  32934. t['Corona'] = true;
  32935. t['Ecotype'] = true;
  32936. t['Egyptienne'] = true;
  32937. t['Elephant'] = true;
  32938. t['Excelsior'] = true;
  32939. t['Fairfield'] = true;
  32940. t['FF Scala'] = true;
  32941. t['Folkard'] = true;
  32942. t['Footlight'] = true;
  32943. t['FreeSerif'] = true;
  32944. t['Friz Quadrata'] = true;
  32945. t['Garamond'] = true;
  32946. t['Gentium'] = true;
  32947. t['Georgia'] = true;
  32948. t['Gloucester'] = true;
  32949. t['Goudy Old Style'] = true;
  32950. t['Goudy Schoolbook'] = true;
  32951. t['Goudy Pro Font'] = true;
  32952. t['Granjon'] = true;
  32953. t['Guardian Egyptian'] = true;
  32954. t['Heather'] = true;
  32955. t['Hercules'] = true;
  32956. t['High Tower Text'] = true;
  32957. t['Hiroshige'] = true;
  32958. t['Hoefler Text'] = true;
  32959. t['Humana Serif'] = true;
  32960. t['Imprint'] = true;
  32961. t['Ionic No. 5'] = true;
  32962. t['Janson'] = true;
  32963. t['Joanna'] = true;
  32964. t['Korinna'] = true;
  32965. t['Lexicon'] = true;
  32966. t['Liberation Serif'] = true;
  32967. t['Linux Libertine'] = true;
  32968. t['Literaturnaya'] = true;
  32969. t['Lucida'] = true;
  32970. t['Lucida Bright'] = true;
  32971. t['Melior'] = true;
  32972. t['Memphis'] = true;
  32973. t['Miller'] = true;
  32974. t['Minion'] = true;
  32975. t['Modern'] = true;
  32976. t['Mona Lisa'] = true;
  32977. t['Mrs Eaves'] = true;
  32978. t['MS Serif'] = true;
  32979. t['Museo Slab'] = true;
  32980. t['New York'] = true;
  32981. t['Nimbus Roman'] = true;
  32982. t['NPS Rawlinson Roadway'] = true;
  32983. t['NuptialScript'] = true;
  32984. t['Palatino'] = true;
  32985. t['Perpetua'] = true;
  32986. t['Plantin'] = true;
  32987. t['Plantin Schoolbook'] = true;
  32988. t['Playbill'] = true;
  32989. t['Poor Richard'] = true;
  32990. t['Rawlinson Roadway'] = true;
  32991. t['Renault'] = true;
  32992. t['Requiem'] = true;
  32993. t['Rockwell'] = true;
  32994. t['Roman'] = true;
  32995. t['Rotis Serif'] = true;
  32996. t['Sabon'] = true;
  32997. t['Scala'] = true;
  32998. t['Seagull'] = true;
  32999. t['Sistina'] = true;
  33000. t['Souvenir'] = true;
  33001. t['STIX'] = true;
  33002. t['Stone Informal'] = true;
  33003. t['Stone Serif'] = true;
  33004. t['Sylfaen'] = true;
  33005. t['Times'] = true;
  33006. t['Trajan'] = true;
  33007. t['Trinité'] = true;
  33008. t['Trump Mediaeval'] = true;
  33009. t['Utopia'] = true;
  33010. t['Vale Type'] = true;
  33011. t['Bitstream Vera'] = true;
  33012. t['Vera Serif'] = true;
  33013. t['Versailles'] = true;
  33014. t['Wanted'] = true;
  33015. t['Weiss'] = true;
  33016. t['Wide Latin'] = true;
  33017. t['Windsor'] = true;
  33018. t['XITS'] = true;
  33019. });
  33020. var getSymbolsFonts = getLookupTableFactory(function (t) {
  33021. t['Dingbats'] = true;
  33022. t['Symbol'] = true;
  33023. t['ZapfDingbats'] = true;
  33024. });
  33025. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  33026. t[2] = 10;
  33027. t[3] = 32;
  33028. t[4] = 33;
  33029. t[5] = 34;
  33030. t[6] = 35;
  33031. t[7] = 36;
  33032. t[8] = 37;
  33033. t[9] = 38;
  33034. t[10] = 39;
  33035. t[11] = 40;
  33036. t[12] = 41;
  33037. t[13] = 42;
  33038. t[14] = 43;
  33039. t[15] = 44;
  33040. t[16] = 45;
  33041. t[17] = 46;
  33042. t[18] = 47;
  33043. t[19] = 48;
  33044. t[20] = 49;
  33045. t[21] = 50;
  33046. t[22] = 51;
  33047. t[23] = 52;
  33048. t[24] = 53;
  33049. t[25] = 54;
  33050. t[26] = 55;
  33051. t[27] = 56;
  33052. t[28] = 57;
  33053. t[29] = 58;
  33054. t[30] = 894;
  33055. t[31] = 60;
  33056. t[32] = 61;
  33057. t[33] = 62;
  33058. t[34] = 63;
  33059. t[35] = 64;
  33060. t[36] = 65;
  33061. t[37] = 66;
  33062. t[38] = 67;
  33063. t[39] = 68;
  33064. t[40] = 69;
  33065. t[41] = 70;
  33066. t[42] = 71;
  33067. t[43] = 72;
  33068. t[44] = 73;
  33069. t[45] = 74;
  33070. t[46] = 75;
  33071. t[47] = 76;
  33072. t[48] = 77;
  33073. t[49] = 78;
  33074. t[50] = 79;
  33075. t[51] = 80;
  33076. t[52] = 81;
  33077. t[53] = 82;
  33078. t[54] = 83;
  33079. t[55] = 84;
  33080. t[56] = 85;
  33081. t[57] = 86;
  33082. t[58] = 87;
  33083. t[59] = 88;
  33084. t[60] = 89;
  33085. t[61] = 90;
  33086. t[62] = 91;
  33087. t[63] = 92;
  33088. t[64] = 93;
  33089. t[65] = 94;
  33090. t[66] = 95;
  33091. t[67] = 96;
  33092. t[68] = 97;
  33093. t[69] = 98;
  33094. t[70] = 99;
  33095. t[71] = 100;
  33096. t[72] = 101;
  33097. t[73] = 102;
  33098. t[74] = 103;
  33099. t[75] = 104;
  33100. t[76] = 105;
  33101. t[77] = 106;
  33102. t[78] = 107;
  33103. t[79] = 108;
  33104. t[80] = 109;
  33105. t[81] = 110;
  33106. t[82] = 111;
  33107. t[83] = 112;
  33108. t[84] = 113;
  33109. t[85] = 114;
  33110. t[86] = 115;
  33111. t[87] = 116;
  33112. t[88] = 117;
  33113. t[89] = 118;
  33114. t[90] = 119;
  33115. t[91] = 120;
  33116. t[92] = 121;
  33117. t[93] = 122;
  33118. t[94] = 123;
  33119. t[95] = 124;
  33120. t[96] = 125;
  33121. t[97] = 126;
  33122. t[98] = 196;
  33123. t[99] = 197;
  33124. t[100] = 199;
  33125. t[101] = 201;
  33126. t[102] = 209;
  33127. t[103] = 214;
  33128. t[104] = 220;
  33129. t[105] = 225;
  33130. t[106] = 224;
  33131. t[107] = 226;
  33132. t[108] = 228;
  33133. t[109] = 227;
  33134. t[110] = 229;
  33135. t[111] = 231;
  33136. t[112] = 233;
  33137. t[113] = 232;
  33138. t[114] = 234;
  33139. t[115] = 235;
  33140. t[116] = 237;
  33141. t[117] = 236;
  33142. t[118] = 238;
  33143. t[119] = 239;
  33144. t[120] = 241;
  33145. t[121] = 243;
  33146. t[122] = 242;
  33147. t[123] = 244;
  33148. t[124] = 246;
  33149. t[125] = 245;
  33150. t[126] = 250;
  33151. t[127] = 249;
  33152. t[128] = 251;
  33153. t[129] = 252;
  33154. t[130] = 8224;
  33155. t[131] = 176;
  33156. t[132] = 162;
  33157. t[133] = 163;
  33158. t[134] = 167;
  33159. t[135] = 8226;
  33160. t[136] = 182;
  33161. t[137] = 223;
  33162. t[138] = 174;
  33163. t[139] = 169;
  33164. t[140] = 8482;
  33165. t[141] = 180;
  33166. t[142] = 168;
  33167. t[143] = 8800;
  33168. t[144] = 198;
  33169. t[145] = 216;
  33170. t[146] = 8734;
  33171. t[147] = 177;
  33172. t[148] = 8804;
  33173. t[149] = 8805;
  33174. t[150] = 165;
  33175. t[151] = 181;
  33176. t[152] = 8706;
  33177. t[153] = 8721;
  33178. t[154] = 8719;
  33179. t[156] = 8747;
  33180. t[157] = 170;
  33181. t[158] = 186;
  33182. t[159] = 8486;
  33183. t[160] = 230;
  33184. t[161] = 248;
  33185. t[162] = 191;
  33186. t[163] = 161;
  33187. t[164] = 172;
  33188. t[165] = 8730;
  33189. t[166] = 402;
  33190. t[167] = 8776;
  33191. t[168] = 8710;
  33192. t[169] = 171;
  33193. t[170] = 187;
  33194. t[171] = 8230;
  33195. t[210] = 218;
  33196. t[223] = 711;
  33197. t[224] = 321;
  33198. t[225] = 322;
  33199. t[227] = 353;
  33200. t[229] = 382;
  33201. t[234] = 253;
  33202. t[252] = 263;
  33203. t[253] = 268;
  33204. t[254] = 269;
  33205. t[258] = 258;
  33206. t[260] = 260;
  33207. t[261] = 261;
  33208. t[265] = 280;
  33209. t[266] = 281;
  33210. t[268] = 283;
  33211. t[269] = 313;
  33212. t[275] = 323;
  33213. t[276] = 324;
  33214. t[278] = 328;
  33215. t[284] = 345;
  33216. t[285] = 346;
  33217. t[286] = 347;
  33218. t[292] = 367;
  33219. t[295] = 377;
  33220. t[296] = 378;
  33221. t[298] = 380;
  33222. t[305] = 963;
  33223. t[306] = 964;
  33224. t[307] = 966;
  33225. t[308] = 8215;
  33226. t[309] = 8252;
  33227. t[310] = 8319;
  33228. t[311] = 8359;
  33229. t[312] = 8592;
  33230. t[313] = 8593;
  33231. t[337] = 9552;
  33232. t[493] = 1039;
  33233. t[494] = 1040;
  33234. t[705] = 1524;
  33235. t[706] = 8362;
  33236. t[710] = 64288;
  33237. t[711] = 64298;
  33238. t[759] = 1617;
  33239. t[761] = 1776;
  33240. t[763] = 1778;
  33241. t[775] = 1652;
  33242. t[777] = 1764;
  33243. t[778] = 1780;
  33244. t[779] = 1781;
  33245. t[780] = 1782;
  33246. t[782] = 771;
  33247. t[783] = 64726;
  33248. t[786] = 8363;
  33249. t[788] = 8532;
  33250. t[790] = 768;
  33251. t[791] = 769;
  33252. t[792] = 768;
  33253. t[795] = 803;
  33254. t[797] = 64336;
  33255. t[798] = 64337;
  33256. t[799] = 64342;
  33257. t[800] = 64343;
  33258. t[801] = 64344;
  33259. t[802] = 64345;
  33260. t[803] = 64362;
  33261. t[804] = 64363;
  33262. t[805] = 64364;
  33263. t[2424] = 7821;
  33264. t[2425] = 7822;
  33265. t[2426] = 7823;
  33266. t[2427] = 7824;
  33267. t[2428] = 7825;
  33268. t[2429] = 7826;
  33269. t[2430] = 7827;
  33270. t[2433] = 7682;
  33271. t[2678] = 8045;
  33272. t[2679] = 8046;
  33273. t[2830] = 1552;
  33274. t[2838] = 686;
  33275. t[2840] = 751;
  33276. t[2842] = 753;
  33277. t[2843] = 754;
  33278. t[2844] = 755;
  33279. t[2846] = 757;
  33280. t[2856] = 767;
  33281. t[2857] = 848;
  33282. t[2858] = 849;
  33283. t[2862] = 853;
  33284. t[2863] = 854;
  33285. t[2864] = 855;
  33286. t[2865] = 861;
  33287. t[2866] = 862;
  33288. t[2906] = 7460;
  33289. t[2908] = 7462;
  33290. t[2909] = 7463;
  33291. t[2910] = 7464;
  33292. t[2912] = 7466;
  33293. t[2913] = 7467;
  33294. t[2914] = 7468;
  33295. t[2916] = 7470;
  33296. t[2917] = 7471;
  33297. t[2918] = 7472;
  33298. t[2920] = 7474;
  33299. t[2921] = 7475;
  33300. t[2922] = 7476;
  33301. t[2924] = 7478;
  33302. t[2925] = 7479;
  33303. t[2926] = 7480;
  33304. t[2928] = 7482;
  33305. t[2929] = 7483;
  33306. t[2930] = 7484;
  33307. t[2932] = 7486;
  33308. t[2933] = 7487;
  33309. t[2934] = 7488;
  33310. t[2936] = 7490;
  33311. t[2937] = 7491;
  33312. t[2938] = 7492;
  33313. t[2940] = 7494;
  33314. t[2941] = 7495;
  33315. t[2942] = 7496;
  33316. t[2944] = 7498;
  33317. t[2946] = 7500;
  33318. t[2948] = 7502;
  33319. t[2950] = 7504;
  33320. t[2951] = 7505;
  33321. t[2952] = 7506;
  33322. t[2954] = 7508;
  33323. t[2955] = 7509;
  33324. t[2956] = 7510;
  33325. t[2958] = 7512;
  33326. t[2959] = 7513;
  33327. t[2960] = 7514;
  33328. t[2962] = 7516;
  33329. t[2963] = 7517;
  33330. t[2964] = 7518;
  33331. t[2966] = 7520;
  33332. t[2967] = 7521;
  33333. t[2968] = 7522;
  33334. t[2970] = 7524;
  33335. t[2971] = 7525;
  33336. t[2972] = 7526;
  33337. t[2974] = 7528;
  33338. t[2975] = 7529;
  33339. t[2976] = 7530;
  33340. t[2978] = 1537;
  33341. t[2979] = 1538;
  33342. t[2980] = 1539;
  33343. t[2982] = 1549;
  33344. t[2983] = 1551;
  33345. t[2984] = 1552;
  33346. t[2986] = 1554;
  33347. t[2987] = 1555;
  33348. t[2988] = 1556;
  33349. t[2990] = 1623;
  33350. t[2991] = 1624;
  33351. t[2995] = 1775;
  33352. t[2999] = 1791;
  33353. t[3002] = 64290;
  33354. t[3003] = 64291;
  33355. t[3004] = 64292;
  33356. t[3006] = 64294;
  33357. t[3007] = 64295;
  33358. t[3008] = 64296;
  33359. t[3011] = 1900;
  33360. t[3014] = 8223;
  33361. t[3015] = 8244;
  33362. t[3017] = 7532;
  33363. t[3018] = 7533;
  33364. t[3019] = 7534;
  33365. t[3075] = 7590;
  33366. t[3076] = 7591;
  33367. t[3079] = 7594;
  33368. t[3080] = 7595;
  33369. t[3083] = 7598;
  33370. t[3084] = 7599;
  33371. t[3087] = 7602;
  33372. t[3088] = 7603;
  33373. t[3091] = 7606;
  33374. t[3092] = 7607;
  33375. t[3095] = 7610;
  33376. t[3096] = 7611;
  33377. t[3099] = 7614;
  33378. t[3100] = 7615;
  33379. t[3103] = 7618;
  33380. t[3104] = 7619;
  33381. t[3107] = 8337;
  33382. t[3108] = 8338;
  33383. t[3116] = 1884;
  33384. t[3119] = 1885;
  33385. t[3120] = 1885;
  33386. t[3123] = 1886;
  33387. t[3124] = 1886;
  33388. t[3127] = 1887;
  33389. t[3128] = 1887;
  33390. t[3131] = 1888;
  33391. t[3132] = 1888;
  33392. t[3135] = 1889;
  33393. t[3136] = 1889;
  33394. t[3139] = 1890;
  33395. t[3140] = 1890;
  33396. t[3143] = 1891;
  33397. t[3144] = 1891;
  33398. t[3147] = 1892;
  33399. t[3148] = 1892;
  33400. t[3153] = 580;
  33401. t[3154] = 581;
  33402. t[3157] = 584;
  33403. t[3158] = 585;
  33404. t[3161] = 588;
  33405. t[3162] = 589;
  33406. t[3165] = 891;
  33407. t[3166] = 892;
  33408. t[3169] = 1274;
  33409. t[3170] = 1275;
  33410. t[3173] = 1278;
  33411. t[3174] = 1279;
  33412. t[3181] = 7622;
  33413. t[3182] = 7623;
  33414. t[3282] = 11799;
  33415. t[3316] = 578;
  33416. t[3379] = 42785;
  33417. t[3393] = 1159;
  33418. t[3416] = 8377;
  33419. });
  33420. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  33421. t[227] = 322;
  33422. t[264] = 261;
  33423. t[291] = 346;
  33424. });
  33425. exports.getStdFontMap = getStdFontMap;
  33426. exports.getNonStdFontMap = getNonStdFontMap;
  33427. exports.getSerifFonts = getSerifFonts;
  33428. exports.getSymbolsFonts = getSymbolsFonts;
  33429. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  33430. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  33431. /***/ }),
  33432. /* 17 */
  33433. /***/ (function(module, exports, __w_pdfjs_require__) {
  33434. "use strict";
  33435. var sharedUtil = __w_pdfjs_require__(0);
  33436. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  33437. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  33438. t[63721] = 0x00A9;
  33439. t[63193] = 0x00A9;
  33440. t[63720] = 0x00AE;
  33441. t[63194] = 0x00AE;
  33442. t[63722] = 0x2122;
  33443. t[63195] = 0x2122;
  33444. t[63729] = 0x23A7;
  33445. t[63730] = 0x23A8;
  33446. t[63731] = 0x23A9;
  33447. t[63740] = 0x23AB;
  33448. t[63741] = 0x23AC;
  33449. t[63742] = 0x23AD;
  33450. t[63726] = 0x23A1;
  33451. t[63727] = 0x23A2;
  33452. t[63728] = 0x23A3;
  33453. t[63737] = 0x23A4;
  33454. t[63738] = 0x23A5;
  33455. t[63739] = 0x23A6;
  33456. t[63723] = 0x239B;
  33457. t[63724] = 0x239C;
  33458. t[63725] = 0x239D;
  33459. t[63734] = 0x239E;
  33460. t[63735] = 0x239F;
  33461. t[63736] = 0x23A0;
  33462. });
  33463. function mapSpecialUnicodeValues(code) {
  33464. if (code >= 0xFFF0 && code <= 0xFFFF) {
  33465. return 0;
  33466. } else if (code >= 0xF600 && code <= 0xF8FF) {
  33467. return getSpecialPUASymbols()[code] || code;
  33468. }
  33469. return code;
  33470. }
  33471. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33472. var unicode = glyphsUnicodeMap[name];
  33473. if (unicode !== undefined) {
  33474. return unicode;
  33475. }
  33476. if (!name) {
  33477. return -1;
  33478. }
  33479. if (name[0] === 'u') {
  33480. var nameLen = name.length, hexStr;
  33481. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  33482. hexStr = name.substr(3);
  33483. } else if (nameLen >= 5 && nameLen <= 7) {
  33484. hexStr = name.substr(1);
  33485. } else {
  33486. return -1;
  33487. }
  33488. if (hexStr === hexStr.toUpperCase()) {
  33489. unicode = parseInt(hexStr, 16);
  33490. if (unicode >= 0) {
  33491. return unicode;
  33492. }
  33493. }
  33494. }
  33495. return -1;
  33496. }
  33497. var UnicodeRanges = [
  33498. {
  33499. 'begin': 0x0000,
  33500. 'end': 0x007F
  33501. },
  33502. {
  33503. 'begin': 0x0080,
  33504. 'end': 0x00FF
  33505. },
  33506. {
  33507. 'begin': 0x0100,
  33508. 'end': 0x017F
  33509. },
  33510. {
  33511. 'begin': 0x0180,
  33512. 'end': 0x024F
  33513. },
  33514. {
  33515. 'begin': 0x0250,
  33516. 'end': 0x02AF
  33517. },
  33518. {
  33519. 'begin': 0x02B0,
  33520. 'end': 0x02FF
  33521. },
  33522. {
  33523. 'begin': 0x0300,
  33524. 'end': 0x036F
  33525. },
  33526. {
  33527. 'begin': 0x0370,
  33528. 'end': 0x03FF
  33529. },
  33530. {
  33531. 'begin': 0x2C80,
  33532. 'end': 0x2CFF
  33533. },
  33534. {
  33535. 'begin': 0x0400,
  33536. 'end': 0x04FF
  33537. },
  33538. {
  33539. 'begin': 0x0530,
  33540. 'end': 0x058F
  33541. },
  33542. {
  33543. 'begin': 0x0590,
  33544. 'end': 0x05FF
  33545. },
  33546. {
  33547. 'begin': 0xA500,
  33548. 'end': 0xA63F
  33549. },
  33550. {
  33551. 'begin': 0x0600,
  33552. 'end': 0x06FF
  33553. },
  33554. {
  33555. 'begin': 0x07C0,
  33556. 'end': 0x07FF
  33557. },
  33558. {
  33559. 'begin': 0x0900,
  33560. 'end': 0x097F
  33561. },
  33562. {
  33563. 'begin': 0x0980,
  33564. 'end': 0x09FF
  33565. },
  33566. {
  33567. 'begin': 0x0A00,
  33568. 'end': 0x0A7F
  33569. },
  33570. {
  33571. 'begin': 0x0A80,
  33572. 'end': 0x0AFF
  33573. },
  33574. {
  33575. 'begin': 0x0B00,
  33576. 'end': 0x0B7F
  33577. },
  33578. {
  33579. 'begin': 0x0B80,
  33580. 'end': 0x0BFF
  33581. },
  33582. {
  33583. 'begin': 0x0C00,
  33584. 'end': 0x0C7F
  33585. },
  33586. {
  33587. 'begin': 0x0C80,
  33588. 'end': 0x0CFF
  33589. },
  33590. {
  33591. 'begin': 0x0D00,
  33592. 'end': 0x0D7F
  33593. },
  33594. {
  33595. 'begin': 0x0E00,
  33596. 'end': 0x0E7F
  33597. },
  33598. {
  33599. 'begin': 0x0E80,
  33600. 'end': 0x0EFF
  33601. },
  33602. {
  33603. 'begin': 0x10A0,
  33604. 'end': 0x10FF
  33605. },
  33606. {
  33607. 'begin': 0x1B00,
  33608. 'end': 0x1B7F
  33609. },
  33610. {
  33611. 'begin': 0x1100,
  33612. 'end': 0x11FF
  33613. },
  33614. {
  33615. 'begin': 0x1E00,
  33616. 'end': 0x1EFF
  33617. },
  33618. {
  33619. 'begin': 0x1F00,
  33620. 'end': 0x1FFF
  33621. },
  33622. {
  33623. 'begin': 0x2000,
  33624. 'end': 0x206F
  33625. },
  33626. {
  33627. 'begin': 0x2070,
  33628. 'end': 0x209F
  33629. },
  33630. {
  33631. 'begin': 0x20A0,
  33632. 'end': 0x20CF
  33633. },
  33634. {
  33635. 'begin': 0x20D0,
  33636. 'end': 0x20FF
  33637. },
  33638. {
  33639. 'begin': 0x2100,
  33640. 'end': 0x214F
  33641. },
  33642. {
  33643. 'begin': 0x2150,
  33644. 'end': 0x218F
  33645. },
  33646. {
  33647. 'begin': 0x2190,
  33648. 'end': 0x21FF
  33649. },
  33650. {
  33651. 'begin': 0x2200,
  33652. 'end': 0x22FF
  33653. },
  33654. {
  33655. 'begin': 0x2300,
  33656. 'end': 0x23FF
  33657. },
  33658. {
  33659. 'begin': 0x2400,
  33660. 'end': 0x243F
  33661. },
  33662. {
  33663. 'begin': 0x2440,
  33664. 'end': 0x245F
  33665. },
  33666. {
  33667. 'begin': 0x2460,
  33668. 'end': 0x24FF
  33669. },
  33670. {
  33671. 'begin': 0x2500,
  33672. 'end': 0x257F
  33673. },
  33674. {
  33675. 'begin': 0x2580,
  33676. 'end': 0x259F
  33677. },
  33678. {
  33679. 'begin': 0x25A0,
  33680. 'end': 0x25FF
  33681. },
  33682. {
  33683. 'begin': 0x2600,
  33684. 'end': 0x26FF
  33685. },
  33686. {
  33687. 'begin': 0x2700,
  33688. 'end': 0x27BF
  33689. },
  33690. {
  33691. 'begin': 0x3000,
  33692. 'end': 0x303F
  33693. },
  33694. {
  33695. 'begin': 0x3040,
  33696. 'end': 0x309F
  33697. },
  33698. {
  33699. 'begin': 0x30A0,
  33700. 'end': 0x30FF
  33701. },
  33702. {
  33703. 'begin': 0x3100,
  33704. 'end': 0x312F
  33705. },
  33706. {
  33707. 'begin': 0x3130,
  33708. 'end': 0x318F
  33709. },
  33710. {
  33711. 'begin': 0xA840,
  33712. 'end': 0xA87F
  33713. },
  33714. {
  33715. 'begin': 0x3200,
  33716. 'end': 0x32FF
  33717. },
  33718. {
  33719. 'begin': 0x3300,
  33720. 'end': 0x33FF
  33721. },
  33722. {
  33723. 'begin': 0xAC00,
  33724. 'end': 0xD7AF
  33725. },
  33726. {
  33727. 'begin': 0xD800,
  33728. 'end': 0xDFFF
  33729. },
  33730. {
  33731. 'begin': 0x10900,
  33732. 'end': 0x1091F
  33733. },
  33734. {
  33735. 'begin': 0x4E00,
  33736. 'end': 0x9FFF
  33737. },
  33738. {
  33739. 'begin': 0xE000,
  33740. 'end': 0xF8FF
  33741. },
  33742. {
  33743. 'begin': 0x31C0,
  33744. 'end': 0x31EF
  33745. },
  33746. {
  33747. 'begin': 0xFB00,
  33748. 'end': 0xFB4F
  33749. },
  33750. {
  33751. 'begin': 0xFB50,
  33752. 'end': 0xFDFF
  33753. },
  33754. {
  33755. 'begin': 0xFE20,
  33756. 'end': 0xFE2F
  33757. },
  33758. {
  33759. 'begin': 0xFE10,
  33760. 'end': 0xFE1F
  33761. },
  33762. {
  33763. 'begin': 0xFE50,
  33764. 'end': 0xFE6F
  33765. },
  33766. {
  33767. 'begin': 0xFE70,
  33768. 'end': 0xFEFF
  33769. },
  33770. {
  33771. 'begin': 0xFF00,
  33772. 'end': 0xFFEF
  33773. },
  33774. {
  33775. 'begin': 0xFFF0,
  33776. 'end': 0xFFFF
  33777. },
  33778. {
  33779. 'begin': 0x0F00,
  33780. 'end': 0x0FFF
  33781. },
  33782. {
  33783. 'begin': 0x0700,
  33784. 'end': 0x074F
  33785. },
  33786. {
  33787. 'begin': 0x0780,
  33788. 'end': 0x07BF
  33789. },
  33790. {
  33791. 'begin': 0x0D80,
  33792. 'end': 0x0DFF
  33793. },
  33794. {
  33795. 'begin': 0x1000,
  33796. 'end': 0x109F
  33797. },
  33798. {
  33799. 'begin': 0x1200,
  33800. 'end': 0x137F
  33801. },
  33802. {
  33803. 'begin': 0x13A0,
  33804. 'end': 0x13FF
  33805. },
  33806. {
  33807. 'begin': 0x1400,
  33808. 'end': 0x167F
  33809. },
  33810. {
  33811. 'begin': 0x1680,
  33812. 'end': 0x169F
  33813. },
  33814. {
  33815. 'begin': 0x16A0,
  33816. 'end': 0x16FF
  33817. },
  33818. {
  33819. 'begin': 0x1780,
  33820. 'end': 0x17FF
  33821. },
  33822. {
  33823. 'begin': 0x1800,
  33824. 'end': 0x18AF
  33825. },
  33826. {
  33827. 'begin': 0x2800,
  33828. 'end': 0x28FF
  33829. },
  33830. {
  33831. 'begin': 0xA000,
  33832. 'end': 0xA48F
  33833. },
  33834. {
  33835. 'begin': 0x1700,
  33836. 'end': 0x171F
  33837. },
  33838. {
  33839. 'begin': 0x10300,
  33840. 'end': 0x1032F
  33841. },
  33842. {
  33843. 'begin': 0x10330,
  33844. 'end': 0x1034F
  33845. },
  33846. {
  33847. 'begin': 0x10400,
  33848. 'end': 0x1044F
  33849. },
  33850. {
  33851. 'begin': 0x1D000,
  33852. 'end': 0x1D0FF
  33853. },
  33854. {
  33855. 'begin': 0x1D400,
  33856. 'end': 0x1D7FF
  33857. },
  33858. {
  33859. 'begin': 0xFF000,
  33860. 'end': 0xFFFFD
  33861. },
  33862. {
  33863. 'begin': 0xFE00,
  33864. 'end': 0xFE0F
  33865. },
  33866. {
  33867. 'begin': 0xE0000,
  33868. 'end': 0xE007F
  33869. },
  33870. {
  33871. 'begin': 0x1900,
  33872. 'end': 0x194F
  33873. },
  33874. {
  33875. 'begin': 0x1950,
  33876. 'end': 0x197F
  33877. },
  33878. {
  33879. 'begin': 0x1980,
  33880. 'end': 0x19DF
  33881. },
  33882. {
  33883. 'begin': 0x1A00,
  33884. 'end': 0x1A1F
  33885. },
  33886. {
  33887. 'begin': 0x2C00,
  33888. 'end': 0x2C5F
  33889. },
  33890. {
  33891. 'begin': 0x2D30,
  33892. 'end': 0x2D7F
  33893. },
  33894. {
  33895. 'begin': 0x4DC0,
  33896. 'end': 0x4DFF
  33897. },
  33898. {
  33899. 'begin': 0xA800,
  33900. 'end': 0xA82F
  33901. },
  33902. {
  33903. 'begin': 0x10000,
  33904. 'end': 0x1007F
  33905. },
  33906. {
  33907. 'begin': 0x10140,
  33908. 'end': 0x1018F
  33909. },
  33910. {
  33911. 'begin': 0x10380,
  33912. 'end': 0x1039F
  33913. },
  33914. {
  33915. 'begin': 0x103A0,
  33916. 'end': 0x103DF
  33917. },
  33918. {
  33919. 'begin': 0x10450,
  33920. 'end': 0x1047F
  33921. },
  33922. {
  33923. 'begin': 0x10480,
  33924. 'end': 0x104AF
  33925. },
  33926. {
  33927. 'begin': 0x10800,
  33928. 'end': 0x1083F
  33929. },
  33930. {
  33931. 'begin': 0x10A00,
  33932. 'end': 0x10A5F
  33933. },
  33934. {
  33935. 'begin': 0x1D300,
  33936. 'end': 0x1D35F
  33937. },
  33938. {
  33939. 'begin': 0x12000,
  33940. 'end': 0x123FF
  33941. },
  33942. {
  33943. 'begin': 0x1D360,
  33944. 'end': 0x1D37F
  33945. },
  33946. {
  33947. 'begin': 0x1B80,
  33948. 'end': 0x1BBF
  33949. },
  33950. {
  33951. 'begin': 0x1C00,
  33952. 'end': 0x1C4F
  33953. },
  33954. {
  33955. 'begin': 0x1C50,
  33956. 'end': 0x1C7F
  33957. },
  33958. {
  33959. 'begin': 0xA880,
  33960. 'end': 0xA8DF
  33961. },
  33962. {
  33963. 'begin': 0xA900,
  33964. 'end': 0xA92F
  33965. },
  33966. {
  33967. 'begin': 0xA930,
  33968. 'end': 0xA95F
  33969. },
  33970. {
  33971. 'begin': 0xAA00,
  33972. 'end': 0xAA5F
  33973. },
  33974. {
  33975. 'begin': 0x10190,
  33976. 'end': 0x101CF
  33977. },
  33978. {
  33979. 'begin': 0x101D0,
  33980. 'end': 0x101FF
  33981. },
  33982. {
  33983. 'begin': 0x102A0,
  33984. 'end': 0x102DF
  33985. },
  33986. {
  33987. 'begin': 0x1F030,
  33988. 'end': 0x1F09F
  33989. }
  33990. ];
  33991. function getUnicodeRangeFor(value) {
  33992. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33993. var range = UnicodeRanges[i];
  33994. if (value >= range.begin && value < range.end) {
  33995. return i;
  33996. }
  33997. }
  33998. return -1;
  33999. }
  34000. function isRTLRangeFor(value) {
  34001. var range = UnicodeRanges[13];
  34002. if (value >= range.begin && value < range.end) {
  34003. return true;
  34004. }
  34005. range = UnicodeRanges[11];
  34006. if (value >= range.begin && value < range.end) {
  34007. return true;
  34008. }
  34009. return false;
  34010. }
  34011. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  34012. t['\u00A8'] = '\u0020\u0308';
  34013. t['\u00AF'] = '\u0020\u0304';
  34014. t['\u00B4'] = '\u0020\u0301';
  34015. t['\u00B5'] = '\u03BC';
  34016. t['\u00B8'] = '\u0020\u0327';
  34017. t['\u0132'] = '\u0049\u004A';
  34018. t['\u0133'] = '\u0069\u006A';
  34019. t['\u013F'] = '\u004C\u00B7';
  34020. t['\u0140'] = '\u006C\u00B7';
  34021. t['\u0149'] = '\u02BC\u006E';
  34022. t['\u017F'] = '\u0073';
  34023. t['\u01C4'] = '\u0044\u017D';
  34024. t['\u01C5'] = '\u0044\u017E';
  34025. t['\u01C6'] = '\u0064\u017E';
  34026. t['\u01C7'] = '\u004C\u004A';
  34027. t['\u01C8'] = '\u004C\u006A';
  34028. t['\u01C9'] = '\u006C\u006A';
  34029. t['\u01CA'] = '\u004E\u004A';
  34030. t['\u01CB'] = '\u004E\u006A';
  34031. t['\u01CC'] = '\u006E\u006A';
  34032. t['\u01F1'] = '\u0044\u005A';
  34033. t['\u01F2'] = '\u0044\u007A';
  34034. t['\u01F3'] = '\u0064\u007A';
  34035. t['\u02D8'] = '\u0020\u0306';
  34036. t['\u02D9'] = '\u0020\u0307';
  34037. t['\u02DA'] = '\u0020\u030A';
  34038. t['\u02DB'] = '\u0020\u0328';
  34039. t['\u02DC'] = '\u0020\u0303';
  34040. t['\u02DD'] = '\u0020\u030B';
  34041. t['\u037A'] = '\u0020\u0345';
  34042. t['\u0384'] = '\u0020\u0301';
  34043. t['\u03D0'] = '\u03B2';
  34044. t['\u03D1'] = '\u03B8';
  34045. t['\u03D2'] = '\u03A5';
  34046. t['\u03D5'] = '\u03C6';
  34047. t['\u03D6'] = '\u03C0';
  34048. t['\u03F0'] = '\u03BA';
  34049. t['\u03F1'] = '\u03C1';
  34050. t['\u03F2'] = '\u03C2';
  34051. t['\u03F4'] = '\u0398';
  34052. t['\u03F5'] = '\u03B5';
  34053. t['\u03F9'] = '\u03A3';
  34054. t['\u0587'] = '\u0565\u0582';
  34055. t['\u0675'] = '\u0627\u0674';
  34056. t['\u0676'] = '\u0648\u0674';
  34057. t['\u0677'] = '\u06C7\u0674';
  34058. t['\u0678'] = '\u064A\u0674';
  34059. t['\u0E33'] = '\u0E4D\u0E32';
  34060. t['\u0EB3'] = '\u0ECD\u0EB2';
  34061. t['\u0EDC'] = '\u0EAB\u0E99';
  34062. t['\u0EDD'] = '\u0EAB\u0EA1';
  34063. t['\u0F77'] = '\u0FB2\u0F81';
  34064. t['\u0F79'] = '\u0FB3\u0F81';
  34065. t['\u1E9A'] = '\u0061\u02BE';
  34066. t['\u1FBD'] = '\u0020\u0313';
  34067. t['\u1FBF'] = '\u0020\u0313';
  34068. t['\u1FC0'] = '\u0020\u0342';
  34069. t['\u1FFE'] = '\u0020\u0314';
  34070. t['\u2002'] = '\u0020';
  34071. t['\u2003'] = '\u0020';
  34072. t['\u2004'] = '\u0020';
  34073. t['\u2005'] = '\u0020';
  34074. t['\u2006'] = '\u0020';
  34075. t['\u2008'] = '\u0020';
  34076. t['\u2009'] = '\u0020';
  34077. t['\u200A'] = '\u0020';
  34078. t['\u2017'] = '\u0020\u0333';
  34079. t['\u2024'] = '\u002E';
  34080. t['\u2025'] = '\u002E\u002E';
  34081. t['\u2026'] = '\u002E\u002E\u002E';
  34082. t['\u2033'] = '\u2032\u2032';
  34083. t['\u2034'] = '\u2032\u2032\u2032';
  34084. t['\u2036'] = '\u2035\u2035';
  34085. t['\u2037'] = '\u2035\u2035\u2035';
  34086. t['\u203C'] = '\u0021\u0021';
  34087. t['\u203E'] = '\u0020\u0305';
  34088. t['\u2047'] = '\u003F\u003F';
  34089. t['\u2048'] = '\u003F\u0021';
  34090. t['\u2049'] = '\u0021\u003F';
  34091. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  34092. t['\u205F'] = '\u0020';
  34093. t['\u20A8'] = '\u0052\u0073';
  34094. t['\u2100'] = '\u0061\u002F\u0063';
  34095. t['\u2101'] = '\u0061\u002F\u0073';
  34096. t['\u2103'] = '\u00B0\u0043';
  34097. t['\u2105'] = '\u0063\u002F\u006F';
  34098. t['\u2106'] = '\u0063\u002F\u0075';
  34099. t['\u2107'] = '\u0190';
  34100. t['\u2109'] = '\u00B0\u0046';
  34101. t['\u2116'] = '\u004E\u006F';
  34102. t['\u2121'] = '\u0054\u0045\u004C';
  34103. t['\u2135'] = '\u05D0';
  34104. t['\u2136'] = '\u05D1';
  34105. t['\u2137'] = '\u05D2';
  34106. t['\u2138'] = '\u05D3';
  34107. t['\u213B'] = '\u0046\u0041\u0058';
  34108. t['\u2160'] = '\u0049';
  34109. t['\u2161'] = '\u0049\u0049';
  34110. t['\u2162'] = '\u0049\u0049\u0049';
  34111. t['\u2163'] = '\u0049\u0056';
  34112. t['\u2164'] = '\u0056';
  34113. t['\u2165'] = '\u0056\u0049';
  34114. t['\u2166'] = '\u0056\u0049\u0049';
  34115. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  34116. t['\u2168'] = '\u0049\u0058';
  34117. t['\u2169'] = '\u0058';
  34118. t['\u216A'] = '\u0058\u0049';
  34119. t['\u216B'] = '\u0058\u0049\u0049';
  34120. t['\u216C'] = '\u004C';
  34121. t['\u216D'] = '\u0043';
  34122. t['\u216E'] = '\u0044';
  34123. t['\u216F'] = '\u004D';
  34124. t['\u2170'] = '\u0069';
  34125. t['\u2171'] = '\u0069\u0069';
  34126. t['\u2172'] = '\u0069\u0069\u0069';
  34127. t['\u2173'] = '\u0069\u0076';
  34128. t['\u2174'] = '\u0076';
  34129. t['\u2175'] = '\u0076\u0069';
  34130. t['\u2176'] = '\u0076\u0069\u0069';
  34131. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  34132. t['\u2178'] = '\u0069\u0078';
  34133. t['\u2179'] = '\u0078';
  34134. t['\u217A'] = '\u0078\u0069';
  34135. t['\u217B'] = '\u0078\u0069\u0069';
  34136. t['\u217C'] = '\u006C';
  34137. t['\u217D'] = '\u0063';
  34138. t['\u217E'] = '\u0064';
  34139. t['\u217F'] = '\u006D';
  34140. t['\u222C'] = '\u222B\u222B';
  34141. t['\u222D'] = '\u222B\u222B\u222B';
  34142. t['\u222F'] = '\u222E\u222E';
  34143. t['\u2230'] = '\u222E\u222E\u222E';
  34144. t['\u2474'] = '\u0028\u0031\u0029';
  34145. t['\u2475'] = '\u0028\u0032\u0029';
  34146. t['\u2476'] = '\u0028\u0033\u0029';
  34147. t['\u2477'] = '\u0028\u0034\u0029';
  34148. t['\u2478'] = '\u0028\u0035\u0029';
  34149. t['\u2479'] = '\u0028\u0036\u0029';
  34150. t['\u247A'] = '\u0028\u0037\u0029';
  34151. t['\u247B'] = '\u0028\u0038\u0029';
  34152. t['\u247C'] = '\u0028\u0039\u0029';
  34153. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  34154. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  34155. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  34156. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  34157. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  34158. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  34159. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  34160. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  34161. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  34162. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  34163. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  34164. t['\u2488'] = '\u0031\u002E';
  34165. t['\u2489'] = '\u0032\u002E';
  34166. t['\u248A'] = '\u0033\u002E';
  34167. t['\u248B'] = '\u0034\u002E';
  34168. t['\u248C'] = '\u0035\u002E';
  34169. t['\u248D'] = '\u0036\u002E';
  34170. t['\u248E'] = '\u0037\u002E';
  34171. t['\u248F'] = '\u0038\u002E';
  34172. t['\u2490'] = '\u0039\u002E';
  34173. t['\u2491'] = '\u0031\u0030\u002E';
  34174. t['\u2492'] = '\u0031\u0031\u002E';
  34175. t['\u2493'] = '\u0031\u0032\u002E';
  34176. t['\u2494'] = '\u0031\u0033\u002E';
  34177. t['\u2495'] = '\u0031\u0034\u002E';
  34178. t['\u2496'] = '\u0031\u0035\u002E';
  34179. t['\u2497'] = '\u0031\u0036\u002E';
  34180. t['\u2498'] = '\u0031\u0037\u002E';
  34181. t['\u2499'] = '\u0031\u0038\u002E';
  34182. t['\u249A'] = '\u0031\u0039\u002E';
  34183. t['\u249B'] = '\u0032\u0030\u002E';
  34184. t['\u249C'] = '\u0028\u0061\u0029';
  34185. t['\u249D'] = '\u0028\u0062\u0029';
  34186. t['\u249E'] = '\u0028\u0063\u0029';
  34187. t['\u249F'] = '\u0028\u0064\u0029';
  34188. t['\u24A0'] = '\u0028\u0065\u0029';
  34189. t['\u24A1'] = '\u0028\u0066\u0029';
  34190. t['\u24A2'] = '\u0028\u0067\u0029';
  34191. t['\u24A3'] = '\u0028\u0068\u0029';
  34192. t['\u24A4'] = '\u0028\u0069\u0029';
  34193. t['\u24A5'] = '\u0028\u006A\u0029';
  34194. t['\u24A6'] = '\u0028\u006B\u0029';
  34195. t['\u24A7'] = '\u0028\u006C\u0029';
  34196. t['\u24A8'] = '\u0028\u006D\u0029';
  34197. t['\u24A9'] = '\u0028\u006E\u0029';
  34198. t['\u24AA'] = '\u0028\u006F\u0029';
  34199. t['\u24AB'] = '\u0028\u0070\u0029';
  34200. t['\u24AC'] = '\u0028\u0071\u0029';
  34201. t['\u24AD'] = '\u0028\u0072\u0029';
  34202. t['\u24AE'] = '\u0028\u0073\u0029';
  34203. t['\u24AF'] = '\u0028\u0074\u0029';
  34204. t['\u24B0'] = '\u0028\u0075\u0029';
  34205. t['\u24B1'] = '\u0028\u0076\u0029';
  34206. t['\u24B2'] = '\u0028\u0077\u0029';
  34207. t['\u24B3'] = '\u0028\u0078\u0029';
  34208. t['\u24B4'] = '\u0028\u0079\u0029';
  34209. t['\u24B5'] = '\u0028\u007A\u0029';
  34210. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  34211. t['\u2A74'] = '\u003A\u003A\u003D';
  34212. t['\u2A75'] = '\u003D\u003D';
  34213. t['\u2A76'] = '\u003D\u003D\u003D';
  34214. t['\u2E9F'] = '\u6BCD';
  34215. t['\u2EF3'] = '\u9F9F';
  34216. t['\u2F00'] = '\u4E00';
  34217. t['\u2F01'] = '\u4E28';
  34218. t['\u2F02'] = '\u4E36';
  34219. t['\u2F03'] = '\u4E3F';
  34220. t['\u2F04'] = '\u4E59';
  34221. t['\u2F05'] = '\u4E85';
  34222. t['\u2F06'] = '\u4E8C';
  34223. t['\u2F07'] = '\u4EA0';
  34224. t['\u2F08'] = '\u4EBA';
  34225. t['\u2F09'] = '\u513F';
  34226. t['\u2F0A'] = '\u5165';
  34227. t['\u2F0B'] = '\u516B';
  34228. t['\u2F0C'] = '\u5182';
  34229. t['\u2F0D'] = '\u5196';
  34230. t['\u2F0E'] = '\u51AB';
  34231. t['\u2F0F'] = '\u51E0';
  34232. t['\u2F10'] = '\u51F5';
  34233. t['\u2F11'] = '\u5200';
  34234. t['\u2F12'] = '\u529B';
  34235. t['\u2F13'] = '\u52F9';
  34236. t['\u2F14'] = '\u5315';
  34237. t['\u2F15'] = '\u531A';
  34238. t['\u2F16'] = '\u5338';
  34239. t['\u2F17'] = '\u5341';
  34240. t['\u2F18'] = '\u535C';
  34241. t['\u2F19'] = '\u5369';
  34242. t['\u2F1A'] = '\u5382';
  34243. t['\u2F1B'] = '\u53B6';
  34244. t['\u2F1C'] = '\u53C8';
  34245. t['\u2F1D'] = '\u53E3';
  34246. t['\u2F1E'] = '\u56D7';
  34247. t['\u2F1F'] = '\u571F';
  34248. t['\u2F20'] = '\u58EB';
  34249. t['\u2F21'] = '\u5902';
  34250. t['\u2F22'] = '\u590A';
  34251. t['\u2F23'] = '\u5915';
  34252. t['\u2F24'] = '\u5927';
  34253. t['\u2F25'] = '\u5973';
  34254. t['\u2F26'] = '\u5B50';
  34255. t['\u2F27'] = '\u5B80';
  34256. t['\u2F28'] = '\u5BF8';
  34257. t['\u2F29'] = '\u5C0F';
  34258. t['\u2F2A'] = '\u5C22';
  34259. t['\u2F2B'] = '\u5C38';
  34260. t['\u2F2C'] = '\u5C6E';
  34261. t['\u2F2D'] = '\u5C71';
  34262. t['\u2F2E'] = '\u5DDB';
  34263. t['\u2F2F'] = '\u5DE5';
  34264. t['\u2F30'] = '\u5DF1';
  34265. t['\u2F31'] = '\u5DFE';
  34266. t['\u2F32'] = '\u5E72';
  34267. t['\u2F33'] = '\u5E7A';
  34268. t['\u2F34'] = '\u5E7F';
  34269. t['\u2F35'] = '\u5EF4';
  34270. t['\u2F36'] = '\u5EFE';
  34271. t['\u2F37'] = '\u5F0B';
  34272. t['\u2F38'] = '\u5F13';
  34273. t['\u2F39'] = '\u5F50';
  34274. t['\u2F3A'] = '\u5F61';
  34275. t['\u2F3B'] = '\u5F73';
  34276. t['\u2F3C'] = '\u5FC3';
  34277. t['\u2F3D'] = '\u6208';
  34278. t['\u2F3E'] = '\u6236';
  34279. t['\u2F3F'] = '\u624B';
  34280. t['\u2F40'] = '\u652F';
  34281. t['\u2F41'] = '\u6534';
  34282. t['\u2F42'] = '\u6587';
  34283. t['\u2F43'] = '\u6597';
  34284. t['\u2F44'] = '\u65A4';
  34285. t['\u2F45'] = '\u65B9';
  34286. t['\u2F46'] = '\u65E0';
  34287. t['\u2F47'] = '\u65E5';
  34288. t['\u2F48'] = '\u66F0';
  34289. t['\u2F49'] = '\u6708';
  34290. t['\u2F4A'] = '\u6728';
  34291. t['\u2F4B'] = '\u6B20';
  34292. t['\u2F4C'] = '\u6B62';
  34293. t['\u2F4D'] = '\u6B79';
  34294. t['\u2F4E'] = '\u6BB3';
  34295. t['\u2F4F'] = '\u6BCB';
  34296. t['\u2F50'] = '\u6BD4';
  34297. t['\u2F51'] = '\u6BDB';
  34298. t['\u2F52'] = '\u6C0F';
  34299. t['\u2F53'] = '\u6C14';
  34300. t['\u2F54'] = '\u6C34';
  34301. t['\u2F55'] = '\u706B';
  34302. t['\u2F56'] = '\u722A';
  34303. t['\u2F57'] = '\u7236';
  34304. t['\u2F58'] = '\u723B';
  34305. t['\u2F59'] = '\u723F';
  34306. t['\u2F5A'] = '\u7247';
  34307. t['\u2F5B'] = '\u7259';
  34308. t['\u2F5C'] = '\u725B';
  34309. t['\u2F5D'] = '\u72AC';
  34310. t['\u2F5E'] = '\u7384';
  34311. t['\u2F5F'] = '\u7389';
  34312. t['\u2F60'] = '\u74DC';
  34313. t['\u2F61'] = '\u74E6';
  34314. t['\u2F62'] = '\u7518';
  34315. t['\u2F63'] = '\u751F';
  34316. t['\u2F64'] = '\u7528';
  34317. t['\u2F65'] = '\u7530';
  34318. t['\u2F66'] = '\u758B';
  34319. t['\u2F67'] = '\u7592';
  34320. t['\u2F68'] = '\u7676';
  34321. t['\u2F69'] = '\u767D';
  34322. t['\u2F6A'] = '\u76AE';
  34323. t['\u2F6B'] = '\u76BF';
  34324. t['\u2F6C'] = '\u76EE';
  34325. t['\u2F6D'] = '\u77DB';
  34326. t['\u2F6E'] = '\u77E2';
  34327. t['\u2F6F'] = '\u77F3';
  34328. t['\u2F70'] = '\u793A';
  34329. t['\u2F71'] = '\u79B8';
  34330. t['\u2F72'] = '\u79BE';
  34331. t['\u2F73'] = '\u7A74';
  34332. t['\u2F74'] = '\u7ACB';
  34333. t['\u2F75'] = '\u7AF9';
  34334. t['\u2F76'] = '\u7C73';
  34335. t['\u2F77'] = '\u7CF8';
  34336. t['\u2F78'] = '\u7F36';
  34337. t['\u2F79'] = '\u7F51';
  34338. t['\u2F7A'] = '\u7F8A';
  34339. t['\u2F7B'] = '\u7FBD';
  34340. t['\u2F7C'] = '\u8001';
  34341. t['\u2F7D'] = '\u800C';
  34342. t['\u2F7E'] = '\u8012';
  34343. t['\u2F7F'] = '\u8033';
  34344. t['\u2F80'] = '\u807F';
  34345. t['\u2F81'] = '\u8089';
  34346. t['\u2F82'] = '\u81E3';
  34347. t['\u2F83'] = '\u81EA';
  34348. t['\u2F84'] = '\u81F3';
  34349. t['\u2F85'] = '\u81FC';
  34350. t['\u2F86'] = '\u820C';
  34351. t['\u2F87'] = '\u821B';
  34352. t['\u2F88'] = '\u821F';
  34353. t['\u2F89'] = '\u826E';
  34354. t['\u2F8A'] = '\u8272';
  34355. t['\u2F8B'] = '\u8278';
  34356. t['\u2F8C'] = '\u864D';
  34357. t['\u2F8D'] = '\u866B';
  34358. t['\u2F8E'] = '\u8840';
  34359. t['\u2F8F'] = '\u884C';
  34360. t['\u2F90'] = '\u8863';
  34361. t['\u2F91'] = '\u897E';
  34362. t['\u2F92'] = '\u898B';
  34363. t['\u2F93'] = '\u89D2';
  34364. t['\u2F94'] = '\u8A00';
  34365. t['\u2F95'] = '\u8C37';
  34366. t['\u2F96'] = '\u8C46';
  34367. t['\u2F97'] = '\u8C55';
  34368. t['\u2F98'] = '\u8C78';
  34369. t['\u2F99'] = '\u8C9D';
  34370. t['\u2F9A'] = '\u8D64';
  34371. t['\u2F9B'] = '\u8D70';
  34372. t['\u2F9C'] = '\u8DB3';
  34373. t['\u2F9D'] = '\u8EAB';
  34374. t['\u2F9E'] = '\u8ECA';
  34375. t['\u2F9F'] = '\u8F9B';
  34376. t['\u2FA0'] = '\u8FB0';
  34377. t['\u2FA1'] = '\u8FB5';
  34378. t['\u2FA2'] = '\u9091';
  34379. t['\u2FA3'] = '\u9149';
  34380. t['\u2FA4'] = '\u91C6';
  34381. t['\u2FA5'] = '\u91CC';
  34382. t['\u2FA6'] = '\u91D1';
  34383. t['\u2FA7'] = '\u9577';
  34384. t['\u2FA8'] = '\u9580';
  34385. t['\u2FA9'] = '\u961C';
  34386. t['\u2FAA'] = '\u96B6';
  34387. t['\u2FAB'] = '\u96B9';
  34388. t['\u2FAC'] = '\u96E8';
  34389. t['\u2FAD'] = '\u9751';
  34390. t['\u2FAE'] = '\u975E';
  34391. t['\u2FAF'] = '\u9762';
  34392. t['\u2FB0'] = '\u9769';
  34393. t['\u2FB1'] = '\u97CB';
  34394. t['\u2FB2'] = '\u97ED';
  34395. t['\u2FB3'] = '\u97F3';
  34396. t['\u2FB4'] = '\u9801';
  34397. t['\u2FB5'] = '\u98A8';
  34398. t['\u2FB6'] = '\u98DB';
  34399. t['\u2FB7'] = '\u98DF';
  34400. t['\u2FB8'] = '\u9996';
  34401. t['\u2FB9'] = '\u9999';
  34402. t['\u2FBA'] = '\u99AC';
  34403. t['\u2FBB'] = '\u9AA8';
  34404. t['\u2FBC'] = '\u9AD8';
  34405. t['\u2FBD'] = '\u9ADF';
  34406. t['\u2FBE'] = '\u9B25';
  34407. t['\u2FBF'] = '\u9B2F';
  34408. t['\u2FC0'] = '\u9B32';
  34409. t['\u2FC1'] = '\u9B3C';
  34410. t['\u2FC2'] = '\u9B5A';
  34411. t['\u2FC3'] = '\u9CE5';
  34412. t['\u2FC4'] = '\u9E75';
  34413. t['\u2FC5'] = '\u9E7F';
  34414. t['\u2FC6'] = '\u9EA5';
  34415. t['\u2FC7'] = '\u9EBB';
  34416. t['\u2FC8'] = '\u9EC3';
  34417. t['\u2FC9'] = '\u9ECD';
  34418. t['\u2FCA'] = '\u9ED1';
  34419. t['\u2FCB'] = '\u9EF9';
  34420. t['\u2FCC'] = '\u9EFD';
  34421. t['\u2FCD'] = '\u9F0E';
  34422. t['\u2FCE'] = '\u9F13';
  34423. t['\u2FCF'] = '\u9F20';
  34424. t['\u2FD0'] = '\u9F3B';
  34425. t['\u2FD1'] = '\u9F4A';
  34426. t['\u2FD2'] = '\u9F52';
  34427. t['\u2FD3'] = '\u9F8D';
  34428. t['\u2FD4'] = '\u9F9C';
  34429. t['\u2FD5'] = '\u9FA0';
  34430. t['\u3036'] = '\u3012';
  34431. t['\u3038'] = '\u5341';
  34432. t['\u3039'] = '\u5344';
  34433. t['\u303A'] = '\u5345';
  34434. t['\u309B'] = '\u0020\u3099';
  34435. t['\u309C'] = '\u0020\u309A';
  34436. t['\u3131'] = '\u1100';
  34437. t['\u3132'] = '\u1101';
  34438. t['\u3133'] = '\u11AA';
  34439. t['\u3134'] = '\u1102';
  34440. t['\u3135'] = '\u11AC';
  34441. t['\u3136'] = '\u11AD';
  34442. t['\u3137'] = '\u1103';
  34443. t['\u3138'] = '\u1104';
  34444. t['\u3139'] = '\u1105';
  34445. t['\u313A'] = '\u11B0';
  34446. t['\u313B'] = '\u11B1';
  34447. t['\u313C'] = '\u11B2';
  34448. t['\u313D'] = '\u11B3';
  34449. t['\u313E'] = '\u11B4';
  34450. t['\u313F'] = '\u11B5';
  34451. t['\u3140'] = '\u111A';
  34452. t['\u3141'] = '\u1106';
  34453. t['\u3142'] = '\u1107';
  34454. t['\u3143'] = '\u1108';
  34455. t['\u3144'] = '\u1121';
  34456. t['\u3145'] = '\u1109';
  34457. t['\u3146'] = '\u110A';
  34458. t['\u3147'] = '\u110B';
  34459. t['\u3148'] = '\u110C';
  34460. t['\u3149'] = '\u110D';
  34461. t['\u314A'] = '\u110E';
  34462. t['\u314B'] = '\u110F';
  34463. t['\u314C'] = '\u1110';
  34464. t['\u314D'] = '\u1111';
  34465. t['\u314E'] = '\u1112';
  34466. t['\u314F'] = '\u1161';
  34467. t['\u3150'] = '\u1162';
  34468. t['\u3151'] = '\u1163';
  34469. t['\u3152'] = '\u1164';
  34470. t['\u3153'] = '\u1165';
  34471. t['\u3154'] = '\u1166';
  34472. t['\u3155'] = '\u1167';
  34473. t['\u3156'] = '\u1168';
  34474. t['\u3157'] = '\u1169';
  34475. t['\u3158'] = '\u116A';
  34476. t['\u3159'] = '\u116B';
  34477. t['\u315A'] = '\u116C';
  34478. t['\u315B'] = '\u116D';
  34479. t['\u315C'] = '\u116E';
  34480. t['\u315D'] = '\u116F';
  34481. t['\u315E'] = '\u1170';
  34482. t['\u315F'] = '\u1171';
  34483. t['\u3160'] = '\u1172';
  34484. t['\u3161'] = '\u1173';
  34485. t['\u3162'] = '\u1174';
  34486. t['\u3163'] = '\u1175';
  34487. t['\u3164'] = '\u1160';
  34488. t['\u3165'] = '\u1114';
  34489. t['\u3166'] = '\u1115';
  34490. t['\u3167'] = '\u11C7';
  34491. t['\u3168'] = '\u11C8';
  34492. t['\u3169'] = '\u11CC';
  34493. t['\u316A'] = '\u11CE';
  34494. t['\u316B'] = '\u11D3';
  34495. t['\u316C'] = '\u11D7';
  34496. t['\u316D'] = '\u11D9';
  34497. t['\u316E'] = '\u111C';
  34498. t['\u316F'] = '\u11DD';
  34499. t['\u3170'] = '\u11DF';
  34500. t['\u3171'] = '\u111D';
  34501. t['\u3172'] = '\u111E';
  34502. t['\u3173'] = '\u1120';
  34503. t['\u3174'] = '\u1122';
  34504. t['\u3175'] = '\u1123';
  34505. t['\u3176'] = '\u1127';
  34506. t['\u3177'] = '\u1129';
  34507. t['\u3178'] = '\u112B';
  34508. t['\u3179'] = '\u112C';
  34509. t['\u317A'] = '\u112D';
  34510. t['\u317B'] = '\u112E';
  34511. t['\u317C'] = '\u112F';
  34512. t['\u317D'] = '\u1132';
  34513. t['\u317E'] = '\u1136';
  34514. t['\u317F'] = '\u1140';
  34515. t['\u3180'] = '\u1147';
  34516. t['\u3181'] = '\u114C';
  34517. t['\u3182'] = '\u11F1';
  34518. t['\u3183'] = '\u11F2';
  34519. t['\u3184'] = '\u1157';
  34520. t['\u3185'] = '\u1158';
  34521. t['\u3186'] = '\u1159';
  34522. t['\u3187'] = '\u1184';
  34523. t['\u3188'] = '\u1185';
  34524. t['\u3189'] = '\u1188';
  34525. t['\u318A'] = '\u1191';
  34526. t['\u318B'] = '\u1192';
  34527. t['\u318C'] = '\u1194';
  34528. t['\u318D'] = '\u119E';
  34529. t['\u318E'] = '\u11A1';
  34530. t['\u3200'] = '\u0028\u1100\u0029';
  34531. t['\u3201'] = '\u0028\u1102\u0029';
  34532. t['\u3202'] = '\u0028\u1103\u0029';
  34533. t['\u3203'] = '\u0028\u1105\u0029';
  34534. t['\u3204'] = '\u0028\u1106\u0029';
  34535. t['\u3205'] = '\u0028\u1107\u0029';
  34536. t['\u3206'] = '\u0028\u1109\u0029';
  34537. t['\u3207'] = '\u0028\u110B\u0029';
  34538. t['\u3208'] = '\u0028\u110C\u0029';
  34539. t['\u3209'] = '\u0028\u110E\u0029';
  34540. t['\u320A'] = '\u0028\u110F\u0029';
  34541. t['\u320B'] = '\u0028\u1110\u0029';
  34542. t['\u320C'] = '\u0028\u1111\u0029';
  34543. t['\u320D'] = '\u0028\u1112\u0029';
  34544. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  34545. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  34546. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  34547. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  34548. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  34549. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  34550. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  34551. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  34552. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  34553. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  34554. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  34555. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  34556. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  34557. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  34558. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  34559. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  34560. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  34561. t['\u3220'] = '\u0028\u4E00\u0029';
  34562. t['\u3221'] = '\u0028\u4E8C\u0029';
  34563. t['\u3222'] = '\u0028\u4E09\u0029';
  34564. t['\u3223'] = '\u0028\u56DB\u0029';
  34565. t['\u3224'] = '\u0028\u4E94\u0029';
  34566. t['\u3225'] = '\u0028\u516D\u0029';
  34567. t['\u3226'] = '\u0028\u4E03\u0029';
  34568. t['\u3227'] = '\u0028\u516B\u0029';
  34569. t['\u3228'] = '\u0028\u4E5D\u0029';
  34570. t['\u3229'] = '\u0028\u5341\u0029';
  34571. t['\u322A'] = '\u0028\u6708\u0029';
  34572. t['\u322B'] = '\u0028\u706B\u0029';
  34573. t['\u322C'] = '\u0028\u6C34\u0029';
  34574. t['\u322D'] = '\u0028\u6728\u0029';
  34575. t['\u322E'] = '\u0028\u91D1\u0029';
  34576. t['\u322F'] = '\u0028\u571F\u0029';
  34577. t['\u3230'] = '\u0028\u65E5\u0029';
  34578. t['\u3231'] = '\u0028\u682A\u0029';
  34579. t['\u3232'] = '\u0028\u6709\u0029';
  34580. t['\u3233'] = '\u0028\u793E\u0029';
  34581. t['\u3234'] = '\u0028\u540D\u0029';
  34582. t['\u3235'] = '\u0028\u7279\u0029';
  34583. t['\u3236'] = '\u0028\u8CA1\u0029';
  34584. t['\u3237'] = '\u0028\u795D\u0029';
  34585. t['\u3238'] = '\u0028\u52B4\u0029';
  34586. t['\u3239'] = '\u0028\u4EE3\u0029';
  34587. t['\u323A'] = '\u0028\u547C\u0029';
  34588. t['\u323B'] = '\u0028\u5B66\u0029';
  34589. t['\u323C'] = '\u0028\u76E3\u0029';
  34590. t['\u323D'] = '\u0028\u4F01\u0029';
  34591. t['\u323E'] = '\u0028\u8CC7\u0029';
  34592. t['\u323F'] = '\u0028\u5354\u0029';
  34593. t['\u3240'] = '\u0028\u796D\u0029';
  34594. t['\u3241'] = '\u0028\u4F11\u0029';
  34595. t['\u3242'] = '\u0028\u81EA\u0029';
  34596. t['\u3243'] = '\u0028\u81F3\u0029';
  34597. t['\u32C0'] = '\u0031\u6708';
  34598. t['\u32C1'] = '\u0032\u6708';
  34599. t['\u32C2'] = '\u0033\u6708';
  34600. t['\u32C3'] = '\u0034\u6708';
  34601. t['\u32C4'] = '\u0035\u6708';
  34602. t['\u32C5'] = '\u0036\u6708';
  34603. t['\u32C6'] = '\u0037\u6708';
  34604. t['\u32C7'] = '\u0038\u6708';
  34605. t['\u32C8'] = '\u0039\u6708';
  34606. t['\u32C9'] = '\u0031\u0030\u6708';
  34607. t['\u32CA'] = '\u0031\u0031\u6708';
  34608. t['\u32CB'] = '\u0031\u0032\u6708';
  34609. t['\u3358'] = '\u0030\u70B9';
  34610. t['\u3359'] = '\u0031\u70B9';
  34611. t['\u335A'] = '\u0032\u70B9';
  34612. t['\u335B'] = '\u0033\u70B9';
  34613. t['\u335C'] = '\u0034\u70B9';
  34614. t['\u335D'] = '\u0035\u70B9';
  34615. t['\u335E'] = '\u0036\u70B9';
  34616. t['\u335F'] = '\u0037\u70B9';
  34617. t['\u3360'] = '\u0038\u70B9';
  34618. t['\u3361'] = '\u0039\u70B9';
  34619. t['\u3362'] = '\u0031\u0030\u70B9';
  34620. t['\u3363'] = '\u0031\u0031\u70B9';
  34621. t['\u3364'] = '\u0031\u0032\u70B9';
  34622. t['\u3365'] = '\u0031\u0033\u70B9';
  34623. t['\u3366'] = '\u0031\u0034\u70B9';
  34624. t['\u3367'] = '\u0031\u0035\u70B9';
  34625. t['\u3368'] = '\u0031\u0036\u70B9';
  34626. t['\u3369'] = '\u0031\u0037\u70B9';
  34627. t['\u336A'] = '\u0031\u0038\u70B9';
  34628. t['\u336B'] = '\u0031\u0039\u70B9';
  34629. t['\u336C'] = '\u0032\u0030\u70B9';
  34630. t['\u336D'] = '\u0032\u0031\u70B9';
  34631. t['\u336E'] = '\u0032\u0032\u70B9';
  34632. t['\u336F'] = '\u0032\u0033\u70B9';
  34633. t['\u3370'] = '\u0032\u0034\u70B9';
  34634. t['\u33E0'] = '\u0031\u65E5';
  34635. t['\u33E1'] = '\u0032\u65E5';
  34636. t['\u33E2'] = '\u0033\u65E5';
  34637. t['\u33E3'] = '\u0034\u65E5';
  34638. t['\u33E4'] = '\u0035\u65E5';
  34639. t['\u33E5'] = '\u0036\u65E5';
  34640. t['\u33E6'] = '\u0037\u65E5';
  34641. t['\u33E7'] = '\u0038\u65E5';
  34642. t['\u33E8'] = '\u0039\u65E5';
  34643. t['\u33E9'] = '\u0031\u0030\u65E5';
  34644. t['\u33EA'] = '\u0031\u0031\u65E5';
  34645. t['\u33EB'] = '\u0031\u0032\u65E5';
  34646. t['\u33EC'] = '\u0031\u0033\u65E5';
  34647. t['\u33ED'] = '\u0031\u0034\u65E5';
  34648. t['\u33EE'] = '\u0031\u0035\u65E5';
  34649. t['\u33EF'] = '\u0031\u0036\u65E5';
  34650. t['\u33F0'] = '\u0031\u0037\u65E5';
  34651. t['\u33F1'] = '\u0031\u0038\u65E5';
  34652. t['\u33F2'] = '\u0031\u0039\u65E5';
  34653. t['\u33F3'] = '\u0032\u0030\u65E5';
  34654. t['\u33F4'] = '\u0032\u0031\u65E5';
  34655. t['\u33F5'] = '\u0032\u0032\u65E5';
  34656. t['\u33F6'] = '\u0032\u0033\u65E5';
  34657. t['\u33F7'] = '\u0032\u0034\u65E5';
  34658. t['\u33F8'] = '\u0032\u0035\u65E5';
  34659. t['\u33F9'] = '\u0032\u0036\u65E5';
  34660. t['\u33FA'] = '\u0032\u0037\u65E5';
  34661. t['\u33FB'] = '\u0032\u0038\u65E5';
  34662. t['\u33FC'] = '\u0032\u0039\u65E5';
  34663. t['\u33FD'] = '\u0033\u0030\u65E5';
  34664. t['\u33FE'] = '\u0033\u0031\u65E5';
  34665. t['\uFB00'] = '\u0066\u0066';
  34666. t['\uFB01'] = '\u0066\u0069';
  34667. t['\uFB02'] = '\u0066\u006C';
  34668. t['\uFB03'] = '\u0066\u0066\u0069';
  34669. t['\uFB04'] = '\u0066\u0066\u006C';
  34670. t['\uFB05'] = '\u017F\u0074';
  34671. t['\uFB06'] = '\u0073\u0074';
  34672. t['\uFB13'] = '\u0574\u0576';
  34673. t['\uFB14'] = '\u0574\u0565';
  34674. t['\uFB15'] = '\u0574\u056B';
  34675. t['\uFB16'] = '\u057E\u0576';
  34676. t['\uFB17'] = '\u0574\u056D';
  34677. t['\uFB4F'] = '\u05D0\u05DC';
  34678. t['\uFB50'] = '\u0671';
  34679. t['\uFB51'] = '\u0671';
  34680. t['\uFB52'] = '\u067B';
  34681. t['\uFB53'] = '\u067B';
  34682. t['\uFB54'] = '\u067B';
  34683. t['\uFB55'] = '\u067B';
  34684. t['\uFB56'] = '\u067E';
  34685. t['\uFB57'] = '\u067E';
  34686. t['\uFB58'] = '\u067E';
  34687. t['\uFB59'] = '\u067E';
  34688. t['\uFB5A'] = '\u0680';
  34689. t['\uFB5B'] = '\u0680';
  34690. t['\uFB5C'] = '\u0680';
  34691. t['\uFB5D'] = '\u0680';
  34692. t['\uFB5E'] = '\u067A';
  34693. t['\uFB5F'] = '\u067A';
  34694. t['\uFB60'] = '\u067A';
  34695. t['\uFB61'] = '\u067A';
  34696. t['\uFB62'] = '\u067F';
  34697. t['\uFB63'] = '\u067F';
  34698. t['\uFB64'] = '\u067F';
  34699. t['\uFB65'] = '\u067F';
  34700. t['\uFB66'] = '\u0679';
  34701. t['\uFB67'] = '\u0679';
  34702. t['\uFB68'] = '\u0679';
  34703. t['\uFB69'] = '\u0679';
  34704. t['\uFB6A'] = '\u06A4';
  34705. t['\uFB6B'] = '\u06A4';
  34706. t['\uFB6C'] = '\u06A4';
  34707. t['\uFB6D'] = '\u06A4';
  34708. t['\uFB6E'] = '\u06A6';
  34709. t['\uFB6F'] = '\u06A6';
  34710. t['\uFB70'] = '\u06A6';
  34711. t['\uFB71'] = '\u06A6';
  34712. t['\uFB72'] = '\u0684';
  34713. t['\uFB73'] = '\u0684';
  34714. t['\uFB74'] = '\u0684';
  34715. t['\uFB75'] = '\u0684';
  34716. t['\uFB76'] = '\u0683';
  34717. t['\uFB77'] = '\u0683';
  34718. t['\uFB78'] = '\u0683';
  34719. t['\uFB79'] = '\u0683';
  34720. t['\uFB7A'] = '\u0686';
  34721. t['\uFB7B'] = '\u0686';
  34722. t['\uFB7C'] = '\u0686';
  34723. t['\uFB7D'] = '\u0686';
  34724. t['\uFB7E'] = '\u0687';
  34725. t['\uFB7F'] = '\u0687';
  34726. t['\uFB80'] = '\u0687';
  34727. t['\uFB81'] = '\u0687';
  34728. t['\uFB82'] = '\u068D';
  34729. t['\uFB83'] = '\u068D';
  34730. t['\uFB84'] = '\u068C';
  34731. t['\uFB85'] = '\u068C';
  34732. t['\uFB86'] = '\u068E';
  34733. t['\uFB87'] = '\u068E';
  34734. t['\uFB88'] = '\u0688';
  34735. t['\uFB89'] = '\u0688';
  34736. t['\uFB8A'] = '\u0698';
  34737. t['\uFB8B'] = '\u0698';
  34738. t['\uFB8C'] = '\u0691';
  34739. t['\uFB8D'] = '\u0691';
  34740. t['\uFB8E'] = '\u06A9';
  34741. t['\uFB8F'] = '\u06A9';
  34742. t['\uFB90'] = '\u06A9';
  34743. t['\uFB91'] = '\u06A9';
  34744. t['\uFB92'] = '\u06AF';
  34745. t['\uFB93'] = '\u06AF';
  34746. t['\uFB94'] = '\u06AF';
  34747. t['\uFB95'] = '\u06AF';
  34748. t['\uFB96'] = '\u06B3';
  34749. t['\uFB97'] = '\u06B3';
  34750. t['\uFB98'] = '\u06B3';
  34751. t['\uFB99'] = '\u06B3';
  34752. t['\uFB9A'] = '\u06B1';
  34753. t['\uFB9B'] = '\u06B1';
  34754. t['\uFB9C'] = '\u06B1';
  34755. t['\uFB9D'] = '\u06B1';
  34756. t['\uFB9E'] = '\u06BA';
  34757. t['\uFB9F'] = '\u06BA';
  34758. t['\uFBA0'] = '\u06BB';
  34759. t['\uFBA1'] = '\u06BB';
  34760. t['\uFBA2'] = '\u06BB';
  34761. t['\uFBA3'] = '\u06BB';
  34762. t['\uFBA4'] = '\u06C0';
  34763. t['\uFBA5'] = '\u06C0';
  34764. t['\uFBA6'] = '\u06C1';
  34765. t['\uFBA7'] = '\u06C1';
  34766. t['\uFBA8'] = '\u06C1';
  34767. t['\uFBA9'] = '\u06C1';
  34768. t['\uFBAA'] = '\u06BE';
  34769. t['\uFBAB'] = '\u06BE';
  34770. t['\uFBAC'] = '\u06BE';
  34771. t['\uFBAD'] = '\u06BE';
  34772. t['\uFBAE'] = '\u06D2';
  34773. t['\uFBAF'] = '\u06D2';
  34774. t['\uFBB0'] = '\u06D3';
  34775. t['\uFBB1'] = '\u06D3';
  34776. t['\uFBD3'] = '\u06AD';
  34777. t['\uFBD4'] = '\u06AD';
  34778. t['\uFBD5'] = '\u06AD';
  34779. t['\uFBD6'] = '\u06AD';
  34780. t['\uFBD7'] = '\u06C7';
  34781. t['\uFBD8'] = '\u06C7';
  34782. t['\uFBD9'] = '\u06C6';
  34783. t['\uFBDA'] = '\u06C6';
  34784. t['\uFBDB'] = '\u06C8';
  34785. t['\uFBDC'] = '\u06C8';
  34786. t['\uFBDD'] = '\u0677';
  34787. t['\uFBDE'] = '\u06CB';
  34788. t['\uFBDF'] = '\u06CB';
  34789. t['\uFBE0'] = '\u06C5';
  34790. t['\uFBE1'] = '\u06C5';
  34791. t['\uFBE2'] = '\u06C9';
  34792. t['\uFBE3'] = '\u06C9';
  34793. t['\uFBE4'] = '\u06D0';
  34794. t['\uFBE5'] = '\u06D0';
  34795. t['\uFBE6'] = '\u06D0';
  34796. t['\uFBE7'] = '\u06D0';
  34797. t['\uFBE8'] = '\u0649';
  34798. t['\uFBE9'] = '\u0649';
  34799. t['\uFBEA'] = '\u0626\u0627';
  34800. t['\uFBEB'] = '\u0626\u0627';
  34801. t['\uFBEC'] = '\u0626\u06D5';
  34802. t['\uFBED'] = '\u0626\u06D5';
  34803. t['\uFBEE'] = '\u0626\u0648';
  34804. t['\uFBEF'] = '\u0626\u0648';
  34805. t['\uFBF0'] = '\u0626\u06C7';
  34806. t['\uFBF1'] = '\u0626\u06C7';
  34807. t['\uFBF2'] = '\u0626\u06C6';
  34808. t['\uFBF3'] = '\u0626\u06C6';
  34809. t['\uFBF4'] = '\u0626\u06C8';
  34810. t['\uFBF5'] = '\u0626\u06C8';
  34811. t['\uFBF6'] = '\u0626\u06D0';
  34812. t['\uFBF7'] = '\u0626\u06D0';
  34813. t['\uFBF8'] = '\u0626\u06D0';
  34814. t['\uFBF9'] = '\u0626\u0649';
  34815. t['\uFBFA'] = '\u0626\u0649';
  34816. t['\uFBFB'] = '\u0626\u0649';
  34817. t['\uFBFC'] = '\u06CC';
  34818. t['\uFBFD'] = '\u06CC';
  34819. t['\uFBFE'] = '\u06CC';
  34820. t['\uFBFF'] = '\u06CC';
  34821. t['\uFC00'] = '\u0626\u062C';
  34822. t['\uFC01'] = '\u0626\u062D';
  34823. t['\uFC02'] = '\u0626\u0645';
  34824. t['\uFC03'] = '\u0626\u0649';
  34825. t['\uFC04'] = '\u0626\u064A';
  34826. t['\uFC05'] = '\u0628\u062C';
  34827. t['\uFC06'] = '\u0628\u062D';
  34828. t['\uFC07'] = '\u0628\u062E';
  34829. t['\uFC08'] = '\u0628\u0645';
  34830. t['\uFC09'] = '\u0628\u0649';
  34831. t['\uFC0A'] = '\u0628\u064A';
  34832. t['\uFC0B'] = '\u062A\u062C';
  34833. t['\uFC0C'] = '\u062A\u062D';
  34834. t['\uFC0D'] = '\u062A\u062E';
  34835. t['\uFC0E'] = '\u062A\u0645';
  34836. t['\uFC0F'] = '\u062A\u0649';
  34837. t['\uFC10'] = '\u062A\u064A';
  34838. t['\uFC11'] = '\u062B\u062C';
  34839. t['\uFC12'] = '\u062B\u0645';
  34840. t['\uFC13'] = '\u062B\u0649';
  34841. t['\uFC14'] = '\u062B\u064A';
  34842. t['\uFC15'] = '\u062C\u062D';
  34843. t['\uFC16'] = '\u062C\u0645';
  34844. t['\uFC17'] = '\u062D\u062C';
  34845. t['\uFC18'] = '\u062D\u0645';
  34846. t['\uFC19'] = '\u062E\u062C';
  34847. t['\uFC1A'] = '\u062E\u062D';
  34848. t['\uFC1B'] = '\u062E\u0645';
  34849. t['\uFC1C'] = '\u0633\u062C';
  34850. t['\uFC1D'] = '\u0633\u062D';
  34851. t['\uFC1E'] = '\u0633\u062E';
  34852. t['\uFC1F'] = '\u0633\u0645';
  34853. t['\uFC20'] = '\u0635\u062D';
  34854. t['\uFC21'] = '\u0635\u0645';
  34855. t['\uFC22'] = '\u0636\u062C';
  34856. t['\uFC23'] = '\u0636\u062D';
  34857. t['\uFC24'] = '\u0636\u062E';
  34858. t['\uFC25'] = '\u0636\u0645';
  34859. t['\uFC26'] = '\u0637\u062D';
  34860. t['\uFC27'] = '\u0637\u0645';
  34861. t['\uFC28'] = '\u0638\u0645';
  34862. t['\uFC29'] = '\u0639\u062C';
  34863. t['\uFC2A'] = '\u0639\u0645';
  34864. t['\uFC2B'] = '\u063A\u062C';
  34865. t['\uFC2C'] = '\u063A\u0645';
  34866. t['\uFC2D'] = '\u0641\u062C';
  34867. t['\uFC2E'] = '\u0641\u062D';
  34868. t['\uFC2F'] = '\u0641\u062E';
  34869. t['\uFC30'] = '\u0641\u0645';
  34870. t['\uFC31'] = '\u0641\u0649';
  34871. t['\uFC32'] = '\u0641\u064A';
  34872. t['\uFC33'] = '\u0642\u062D';
  34873. t['\uFC34'] = '\u0642\u0645';
  34874. t['\uFC35'] = '\u0642\u0649';
  34875. t['\uFC36'] = '\u0642\u064A';
  34876. t['\uFC37'] = '\u0643\u0627';
  34877. t['\uFC38'] = '\u0643\u062C';
  34878. t['\uFC39'] = '\u0643\u062D';
  34879. t['\uFC3A'] = '\u0643\u062E';
  34880. t['\uFC3B'] = '\u0643\u0644';
  34881. t['\uFC3C'] = '\u0643\u0645';
  34882. t['\uFC3D'] = '\u0643\u0649';
  34883. t['\uFC3E'] = '\u0643\u064A';
  34884. t['\uFC3F'] = '\u0644\u062C';
  34885. t['\uFC40'] = '\u0644\u062D';
  34886. t['\uFC41'] = '\u0644\u062E';
  34887. t['\uFC42'] = '\u0644\u0645';
  34888. t['\uFC43'] = '\u0644\u0649';
  34889. t['\uFC44'] = '\u0644\u064A';
  34890. t['\uFC45'] = '\u0645\u062C';
  34891. t['\uFC46'] = '\u0645\u062D';
  34892. t['\uFC47'] = '\u0645\u062E';
  34893. t['\uFC48'] = '\u0645\u0645';
  34894. t['\uFC49'] = '\u0645\u0649';
  34895. t['\uFC4A'] = '\u0645\u064A';
  34896. t['\uFC4B'] = '\u0646\u062C';
  34897. t['\uFC4C'] = '\u0646\u062D';
  34898. t['\uFC4D'] = '\u0646\u062E';
  34899. t['\uFC4E'] = '\u0646\u0645';
  34900. t['\uFC4F'] = '\u0646\u0649';
  34901. t['\uFC50'] = '\u0646\u064A';
  34902. t['\uFC51'] = '\u0647\u062C';
  34903. t['\uFC52'] = '\u0647\u0645';
  34904. t['\uFC53'] = '\u0647\u0649';
  34905. t['\uFC54'] = '\u0647\u064A';
  34906. t['\uFC55'] = '\u064A\u062C';
  34907. t['\uFC56'] = '\u064A\u062D';
  34908. t['\uFC57'] = '\u064A\u062E';
  34909. t['\uFC58'] = '\u064A\u0645';
  34910. t['\uFC59'] = '\u064A\u0649';
  34911. t['\uFC5A'] = '\u064A\u064A';
  34912. t['\uFC5B'] = '\u0630\u0670';
  34913. t['\uFC5C'] = '\u0631\u0670';
  34914. t['\uFC5D'] = '\u0649\u0670';
  34915. t['\uFC5E'] = '\u0020\u064C\u0651';
  34916. t['\uFC5F'] = '\u0020\u064D\u0651';
  34917. t['\uFC60'] = '\u0020\u064E\u0651';
  34918. t['\uFC61'] = '\u0020\u064F\u0651';
  34919. t['\uFC62'] = '\u0020\u0650\u0651';
  34920. t['\uFC63'] = '\u0020\u0651\u0670';
  34921. t['\uFC64'] = '\u0626\u0631';
  34922. t['\uFC65'] = '\u0626\u0632';
  34923. t['\uFC66'] = '\u0626\u0645';
  34924. t['\uFC67'] = '\u0626\u0646';
  34925. t['\uFC68'] = '\u0626\u0649';
  34926. t['\uFC69'] = '\u0626\u064A';
  34927. t['\uFC6A'] = '\u0628\u0631';
  34928. t['\uFC6B'] = '\u0628\u0632';
  34929. t['\uFC6C'] = '\u0628\u0645';
  34930. t['\uFC6D'] = '\u0628\u0646';
  34931. t['\uFC6E'] = '\u0628\u0649';
  34932. t['\uFC6F'] = '\u0628\u064A';
  34933. t['\uFC70'] = '\u062A\u0631';
  34934. t['\uFC71'] = '\u062A\u0632';
  34935. t['\uFC72'] = '\u062A\u0645';
  34936. t['\uFC73'] = '\u062A\u0646';
  34937. t['\uFC74'] = '\u062A\u0649';
  34938. t['\uFC75'] = '\u062A\u064A';
  34939. t['\uFC76'] = '\u062B\u0631';
  34940. t['\uFC77'] = '\u062B\u0632';
  34941. t['\uFC78'] = '\u062B\u0645';
  34942. t['\uFC79'] = '\u062B\u0646';
  34943. t['\uFC7A'] = '\u062B\u0649';
  34944. t['\uFC7B'] = '\u062B\u064A';
  34945. t['\uFC7C'] = '\u0641\u0649';
  34946. t['\uFC7D'] = '\u0641\u064A';
  34947. t['\uFC7E'] = '\u0642\u0649';
  34948. t['\uFC7F'] = '\u0642\u064A';
  34949. t['\uFC80'] = '\u0643\u0627';
  34950. t['\uFC81'] = '\u0643\u0644';
  34951. t['\uFC82'] = '\u0643\u0645';
  34952. t['\uFC83'] = '\u0643\u0649';
  34953. t['\uFC84'] = '\u0643\u064A';
  34954. t['\uFC85'] = '\u0644\u0645';
  34955. t['\uFC86'] = '\u0644\u0649';
  34956. t['\uFC87'] = '\u0644\u064A';
  34957. t['\uFC88'] = '\u0645\u0627';
  34958. t['\uFC89'] = '\u0645\u0645';
  34959. t['\uFC8A'] = '\u0646\u0631';
  34960. t['\uFC8B'] = '\u0646\u0632';
  34961. t['\uFC8C'] = '\u0646\u0645';
  34962. t['\uFC8D'] = '\u0646\u0646';
  34963. t['\uFC8E'] = '\u0646\u0649';
  34964. t['\uFC8F'] = '\u0646\u064A';
  34965. t['\uFC90'] = '\u0649\u0670';
  34966. t['\uFC91'] = '\u064A\u0631';
  34967. t['\uFC92'] = '\u064A\u0632';
  34968. t['\uFC93'] = '\u064A\u0645';
  34969. t['\uFC94'] = '\u064A\u0646';
  34970. t['\uFC95'] = '\u064A\u0649';
  34971. t['\uFC96'] = '\u064A\u064A';
  34972. t['\uFC97'] = '\u0626\u062C';
  34973. t['\uFC98'] = '\u0626\u062D';
  34974. t['\uFC99'] = '\u0626\u062E';
  34975. t['\uFC9A'] = '\u0626\u0645';
  34976. t['\uFC9B'] = '\u0626\u0647';
  34977. t['\uFC9C'] = '\u0628\u062C';
  34978. t['\uFC9D'] = '\u0628\u062D';
  34979. t['\uFC9E'] = '\u0628\u062E';
  34980. t['\uFC9F'] = '\u0628\u0645';
  34981. t['\uFCA0'] = '\u0628\u0647';
  34982. t['\uFCA1'] = '\u062A\u062C';
  34983. t['\uFCA2'] = '\u062A\u062D';
  34984. t['\uFCA3'] = '\u062A\u062E';
  34985. t['\uFCA4'] = '\u062A\u0645';
  34986. t['\uFCA5'] = '\u062A\u0647';
  34987. t['\uFCA6'] = '\u062B\u0645';
  34988. t['\uFCA7'] = '\u062C\u062D';
  34989. t['\uFCA8'] = '\u062C\u0645';
  34990. t['\uFCA9'] = '\u062D\u062C';
  34991. t['\uFCAA'] = '\u062D\u0645';
  34992. t['\uFCAB'] = '\u062E\u062C';
  34993. t['\uFCAC'] = '\u062E\u0645';
  34994. t['\uFCAD'] = '\u0633\u062C';
  34995. t['\uFCAE'] = '\u0633\u062D';
  34996. t['\uFCAF'] = '\u0633\u062E';
  34997. t['\uFCB0'] = '\u0633\u0645';
  34998. t['\uFCB1'] = '\u0635\u062D';
  34999. t['\uFCB2'] = '\u0635\u062E';
  35000. t['\uFCB3'] = '\u0635\u0645';
  35001. t['\uFCB4'] = '\u0636\u062C';
  35002. t['\uFCB5'] = '\u0636\u062D';
  35003. t['\uFCB6'] = '\u0636\u062E';
  35004. t['\uFCB7'] = '\u0636\u0645';
  35005. t['\uFCB8'] = '\u0637\u062D';
  35006. t['\uFCB9'] = '\u0638\u0645';
  35007. t['\uFCBA'] = '\u0639\u062C';
  35008. t['\uFCBB'] = '\u0639\u0645';
  35009. t['\uFCBC'] = '\u063A\u062C';
  35010. t['\uFCBD'] = '\u063A\u0645';
  35011. t['\uFCBE'] = '\u0641\u062C';
  35012. t['\uFCBF'] = '\u0641\u062D';
  35013. t['\uFCC0'] = '\u0641\u062E';
  35014. t['\uFCC1'] = '\u0641\u0645';
  35015. t['\uFCC2'] = '\u0642\u062D';
  35016. t['\uFCC3'] = '\u0642\u0645';
  35017. t['\uFCC4'] = '\u0643\u062C';
  35018. t['\uFCC5'] = '\u0643\u062D';
  35019. t['\uFCC6'] = '\u0643\u062E';
  35020. t['\uFCC7'] = '\u0643\u0644';
  35021. t['\uFCC8'] = '\u0643\u0645';
  35022. t['\uFCC9'] = '\u0644\u062C';
  35023. t['\uFCCA'] = '\u0644\u062D';
  35024. t['\uFCCB'] = '\u0644\u062E';
  35025. t['\uFCCC'] = '\u0644\u0645';
  35026. t['\uFCCD'] = '\u0644\u0647';
  35027. t['\uFCCE'] = '\u0645\u062C';
  35028. t['\uFCCF'] = '\u0645\u062D';
  35029. t['\uFCD0'] = '\u0645\u062E';
  35030. t['\uFCD1'] = '\u0645\u0645';
  35031. t['\uFCD2'] = '\u0646\u062C';
  35032. t['\uFCD3'] = '\u0646\u062D';
  35033. t['\uFCD4'] = '\u0646\u062E';
  35034. t['\uFCD5'] = '\u0646\u0645';
  35035. t['\uFCD6'] = '\u0646\u0647';
  35036. t['\uFCD7'] = '\u0647\u062C';
  35037. t['\uFCD8'] = '\u0647\u0645';
  35038. t['\uFCD9'] = '\u0647\u0670';
  35039. t['\uFCDA'] = '\u064A\u062C';
  35040. t['\uFCDB'] = '\u064A\u062D';
  35041. t['\uFCDC'] = '\u064A\u062E';
  35042. t['\uFCDD'] = '\u064A\u0645';
  35043. t['\uFCDE'] = '\u064A\u0647';
  35044. t['\uFCDF'] = '\u0626\u0645';
  35045. t['\uFCE0'] = '\u0626\u0647';
  35046. t['\uFCE1'] = '\u0628\u0645';
  35047. t['\uFCE2'] = '\u0628\u0647';
  35048. t['\uFCE3'] = '\u062A\u0645';
  35049. t['\uFCE4'] = '\u062A\u0647';
  35050. t['\uFCE5'] = '\u062B\u0645';
  35051. t['\uFCE6'] = '\u062B\u0647';
  35052. t['\uFCE7'] = '\u0633\u0645';
  35053. t['\uFCE8'] = '\u0633\u0647';
  35054. t['\uFCE9'] = '\u0634\u0645';
  35055. t['\uFCEA'] = '\u0634\u0647';
  35056. t['\uFCEB'] = '\u0643\u0644';
  35057. t['\uFCEC'] = '\u0643\u0645';
  35058. t['\uFCED'] = '\u0644\u0645';
  35059. t['\uFCEE'] = '\u0646\u0645';
  35060. t['\uFCEF'] = '\u0646\u0647';
  35061. t['\uFCF0'] = '\u064A\u0645';
  35062. t['\uFCF1'] = '\u064A\u0647';
  35063. t['\uFCF2'] = '\u0640\u064E\u0651';
  35064. t['\uFCF3'] = '\u0640\u064F\u0651';
  35065. t['\uFCF4'] = '\u0640\u0650\u0651';
  35066. t['\uFCF5'] = '\u0637\u0649';
  35067. t['\uFCF6'] = '\u0637\u064A';
  35068. t['\uFCF7'] = '\u0639\u0649';
  35069. t['\uFCF8'] = '\u0639\u064A';
  35070. t['\uFCF9'] = '\u063A\u0649';
  35071. t['\uFCFA'] = '\u063A\u064A';
  35072. t['\uFCFB'] = '\u0633\u0649';
  35073. t['\uFCFC'] = '\u0633\u064A';
  35074. t['\uFCFD'] = '\u0634\u0649';
  35075. t['\uFCFE'] = '\u0634\u064A';
  35076. t['\uFCFF'] = '\u062D\u0649';
  35077. t['\uFD00'] = '\u062D\u064A';
  35078. t['\uFD01'] = '\u062C\u0649';
  35079. t['\uFD02'] = '\u062C\u064A';
  35080. t['\uFD03'] = '\u062E\u0649';
  35081. t['\uFD04'] = '\u062E\u064A';
  35082. t['\uFD05'] = '\u0635\u0649';
  35083. t['\uFD06'] = '\u0635\u064A';
  35084. t['\uFD07'] = '\u0636\u0649';
  35085. t['\uFD08'] = '\u0636\u064A';
  35086. t['\uFD09'] = '\u0634\u062C';
  35087. t['\uFD0A'] = '\u0634\u062D';
  35088. t['\uFD0B'] = '\u0634\u062E';
  35089. t['\uFD0C'] = '\u0634\u0645';
  35090. t['\uFD0D'] = '\u0634\u0631';
  35091. t['\uFD0E'] = '\u0633\u0631';
  35092. t['\uFD0F'] = '\u0635\u0631';
  35093. t['\uFD10'] = '\u0636\u0631';
  35094. t['\uFD11'] = '\u0637\u0649';
  35095. t['\uFD12'] = '\u0637\u064A';
  35096. t['\uFD13'] = '\u0639\u0649';
  35097. t['\uFD14'] = '\u0639\u064A';
  35098. t['\uFD15'] = '\u063A\u0649';
  35099. t['\uFD16'] = '\u063A\u064A';
  35100. t['\uFD17'] = '\u0633\u0649';
  35101. t['\uFD18'] = '\u0633\u064A';
  35102. t['\uFD19'] = '\u0634\u0649';
  35103. t['\uFD1A'] = '\u0634\u064A';
  35104. t['\uFD1B'] = '\u062D\u0649';
  35105. t['\uFD1C'] = '\u062D\u064A';
  35106. t['\uFD1D'] = '\u062C\u0649';
  35107. t['\uFD1E'] = '\u062C\u064A';
  35108. t['\uFD1F'] = '\u062E\u0649';
  35109. t['\uFD20'] = '\u062E\u064A';
  35110. t['\uFD21'] = '\u0635\u0649';
  35111. t['\uFD22'] = '\u0635\u064A';
  35112. t['\uFD23'] = '\u0636\u0649';
  35113. t['\uFD24'] = '\u0636\u064A';
  35114. t['\uFD25'] = '\u0634\u062C';
  35115. t['\uFD26'] = '\u0634\u062D';
  35116. t['\uFD27'] = '\u0634\u062E';
  35117. t['\uFD28'] = '\u0634\u0645';
  35118. t['\uFD29'] = '\u0634\u0631';
  35119. t['\uFD2A'] = '\u0633\u0631';
  35120. t['\uFD2B'] = '\u0635\u0631';
  35121. t['\uFD2C'] = '\u0636\u0631';
  35122. t['\uFD2D'] = '\u0634\u062C';
  35123. t['\uFD2E'] = '\u0634\u062D';
  35124. t['\uFD2F'] = '\u0634\u062E';
  35125. t['\uFD30'] = '\u0634\u0645';
  35126. t['\uFD31'] = '\u0633\u0647';
  35127. t['\uFD32'] = '\u0634\u0647';
  35128. t['\uFD33'] = '\u0637\u0645';
  35129. t['\uFD34'] = '\u0633\u062C';
  35130. t['\uFD35'] = '\u0633\u062D';
  35131. t['\uFD36'] = '\u0633\u062E';
  35132. t['\uFD37'] = '\u0634\u062C';
  35133. t['\uFD38'] = '\u0634\u062D';
  35134. t['\uFD39'] = '\u0634\u062E';
  35135. t['\uFD3A'] = '\u0637\u0645';
  35136. t['\uFD3B'] = '\u0638\u0645';
  35137. t['\uFD3C'] = '\u0627\u064B';
  35138. t['\uFD3D'] = '\u0627\u064B';
  35139. t['\uFD50'] = '\u062A\u062C\u0645';
  35140. t['\uFD51'] = '\u062A\u062D\u062C';
  35141. t['\uFD52'] = '\u062A\u062D\u062C';
  35142. t['\uFD53'] = '\u062A\u062D\u0645';
  35143. t['\uFD54'] = '\u062A\u062E\u0645';
  35144. t['\uFD55'] = '\u062A\u0645\u062C';
  35145. t['\uFD56'] = '\u062A\u0645\u062D';
  35146. t['\uFD57'] = '\u062A\u0645\u062E';
  35147. t['\uFD58'] = '\u062C\u0645\u062D';
  35148. t['\uFD59'] = '\u062C\u0645\u062D';
  35149. t['\uFD5A'] = '\u062D\u0645\u064A';
  35150. t['\uFD5B'] = '\u062D\u0645\u0649';
  35151. t['\uFD5C'] = '\u0633\u062D\u062C';
  35152. t['\uFD5D'] = '\u0633\u062C\u062D';
  35153. t['\uFD5E'] = '\u0633\u062C\u0649';
  35154. t['\uFD5F'] = '\u0633\u0645\u062D';
  35155. t['\uFD60'] = '\u0633\u0645\u062D';
  35156. t['\uFD61'] = '\u0633\u0645\u062C';
  35157. t['\uFD62'] = '\u0633\u0645\u0645';
  35158. t['\uFD63'] = '\u0633\u0645\u0645';
  35159. t['\uFD64'] = '\u0635\u062D\u062D';
  35160. t['\uFD65'] = '\u0635\u062D\u062D';
  35161. t['\uFD66'] = '\u0635\u0645\u0645';
  35162. t['\uFD67'] = '\u0634\u062D\u0645';
  35163. t['\uFD68'] = '\u0634\u062D\u0645';
  35164. t['\uFD69'] = '\u0634\u062C\u064A';
  35165. t['\uFD6A'] = '\u0634\u0645\u062E';
  35166. t['\uFD6B'] = '\u0634\u0645\u062E';
  35167. t['\uFD6C'] = '\u0634\u0645\u0645';
  35168. t['\uFD6D'] = '\u0634\u0645\u0645';
  35169. t['\uFD6E'] = '\u0636\u062D\u0649';
  35170. t['\uFD6F'] = '\u0636\u062E\u0645';
  35171. t['\uFD70'] = '\u0636\u062E\u0645';
  35172. t['\uFD71'] = '\u0637\u0645\u062D';
  35173. t['\uFD72'] = '\u0637\u0645\u062D';
  35174. t['\uFD73'] = '\u0637\u0645\u0645';
  35175. t['\uFD74'] = '\u0637\u0645\u064A';
  35176. t['\uFD75'] = '\u0639\u062C\u0645';
  35177. t['\uFD76'] = '\u0639\u0645\u0645';
  35178. t['\uFD77'] = '\u0639\u0645\u0645';
  35179. t['\uFD78'] = '\u0639\u0645\u0649';
  35180. t['\uFD79'] = '\u063A\u0645\u0645';
  35181. t['\uFD7A'] = '\u063A\u0645\u064A';
  35182. t['\uFD7B'] = '\u063A\u0645\u0649';
  35183. t['\uFD7C'] = '\u0641\u062E\u0645';
  35184. t['\uFD7D'] = '\u0641\u062E\u0645';
  35185. t['\uFD7E'] = '\u0642\u0645\u062D';
  35186. t['\uFD7F'] = '\u0642\u0645\u0645';
  35187. t['\uFD80'] = '\u0644\u062D\u0645';
  35188. t['\uFD81'] = '\u0644\u062D\u064A';
  35189. t['\uFD82'] = '\u0644\u062D\u0649';
  35190. t['\uFD83'] = '\u0644\u062C\u062C';
  35191. t['\uFD84'] = '\u0644\u062C\u062C';
  35192. t['\uFD85'] = '\u0644\u062E\u0645';
  35193. t['\uFD86'] = '\u0644\u062E\u0645';
  35194. t['\uFD87'] = '\u0644\u0645\u062D';
  35195. t['\uFD88'] = '\u0644\u0645\u062D';
  35196. t['\uFD89'] = '\u0645\u062D\u062C';
  35197. t['\uFD8A'] = '\u0645\u062D\u0645';
  35198. t['\uFD8B'] = '\u0645\u062D\u064A';
  35199. t['\uFD8C'] = '\u0645\u062C\u062D';
  35200. t['\uFD8D'] = '\u0645\u062C\u0645';
  35201. t['\uFD8E'] = '\u0645\u062E\u062C';
  35202. t['\uFD8F'] = '\u0645\u062E\u0645';
  35203. t['\uFD92'] = '\u0645\u062C\u062E';
  35204. t['\uFD93'] = '\u0647\u0645\u062C';
  35205. t['\uFD94'] = '\u0647\u0645\u0645';
  35206. t['\uFD95'] = '\u0646\u062D\u0645';
  35207. t['\uFD96'] = '\u0646\u062D\u0649';
  35208. t['\uFD97'] = '\u0646\u062C\u0645';
  35209. t['\uFD98'] = '\u0646\u062C\u0645';
  35210. t['\uFD99'] = '\u0646\u062C\u0649';
  35211. t['\uFD9A'] = '\u0646\u0645\u064A';
  35212. t['\uFD9B'] = '\u0646\u0645\u0649';
  35213. t['\uFD9C'] = '\u064A\u0645\u0645';
  35214. t['\uFD9D'] = '\u064A\u0645\u0645';
  35215. t['\uFD9E'] = '\u0628\u062E\u064A';
  35216. t['\uFD9F'] = '\u062A\u062C\u064A';
  35217. t['\uFDA0'] = '\u062A\u062C\u0649';
  35218. t['\uFDA1'] = '\u062A\u062E\u064A';
  35219. t['\uFDA2'] = '\u062A\u062E\u0649';
  35220. t['\uFDA3'] = '\u062A\u0645\u064A';
  35221. t['\uFDA4'] = '\u062A\u0645\u0649';
  35222. t['\uFDA5'] = '\u062C\u0645\u064A';
  35223. t['\uFDA6'] = '\u062C\u062D\u0649';
  35224. t['\uFDA7'] = '\u062C\u0645\u0649';
  35225. t['\uFDA8'] = '\u0633\u062E\u0649';
  35226. t['\uFDA9'] = '\u0635\u062D\u064A';
  35227. t['\uFDAA'] = '\u0634\u062D\u064A';
  35228. t['\uFDAB'] = '\u0636\u062D\u064A';
  35229. t['\uFDAC'] = '\u0644\u062C\u064A';
  35230. t['\uFDAD'] = '\u0644\u0645\u064A';
  35231. t['\uFDAE'] = '\u064A\u062D\u064A';
  35232. t['\uFDAF'] = '\u064A\u062C\u064A';
  35233. t['\uFDB0'] = '\u064A\u0645\u064A';
  35234. t['\uFDB1'] = '\u0645\u0645\u064A';
  35235. t['\uFDB2'] = '\u0642\u0645\u064A';
  35236. t['\uFDB3'] = '\u0646\u062D\u064A';
  35237. t['\uFDB4'] = '\u0642\u0645\u062D';
  35238. t['\uFDB5'] = '\u0644\u062D\u0645';
  35239. t['\uFDB6'] = '\u0639\u0645\u064A';
  35240. t['\uFDB7'] = '\u0643\u0645\u064A';
  35241. t['\uFDB8'] = '\u0646\u062C\u062D';
  35242. t['\uFDB9'] = '\u0645\u062E\u064A';
  35243. t['\uFDBA'] = '\u0644\u062C\u0645';
  35244. t['\uFDBB'] = '\u0643\u0645\u0645';
  35245. t['\uFDBC'] = '\u0644\u062C\u0645';
  35246. t['\uFDBD'] = '\u0646\u062C\u062D';
  35247. t['\uFDBE'] = '\u062C\u062D\u064A';
  35248. t['\uFDBF'] = '\u062D\u062C\u064A';
  35249. t['\uFDC0'] = '\u0645\u062C\u064A';
  35250. t['\uFDC1'] = '\u0641\u0645\u064A';
  35251. t['\uFDC2'] = '\u0628\u062D\u064A';
  35252. t['\uFDC3'] = '\u0643\u0645\u0645';
  35253. t['\uFDC4'] = '\u0639\u062C\u0645';
  35254. t['\uFDC5'] = '\u0635\u0645\u0645';
  35255. t['\uFDC6'] = '\u0633\u062E\u064A';
  35256. t['\uFDC7'] = '\u0646\u062C\u064A';
  35257. t['\uFE49'] = '\u203E';
  35258. t['\uFE4A'] = '\u203E';
  35259. t['\uFE4B'] = '\u203E';
  35260. t['\uFE4C'] = '\u203E';
  35261. t['\uFE4D'] = '\u005F';
  35262. t['\uFE4E'] = '\u005F';
  35263. t['\uFE4F'] = '\u005F';
  35264. t['\uFE80'] = '\u0621';
  35265. t['\uFE81'] = '\u0622';
  35266. t['\uFE82'] = '\u0622';
  35267. t['\uFE83'] = '\u0623';
  35268. t['\uFE84'] = '\u0623';
  35269. t['\uFE85'] = '\u0624';
  35270. t['\uFE86'] = '\u0624';
  35271. t['\uFE87'] = '\u0625';
  35272. t['\uFE88'] = '\u0625';
  35273. t['\uFE89'] = '\u0626';
  35274. t['\uFE8A'] = '\u0626';
  35275. t['\uFE8B'] = '\u0626';
  35276. t['\uFE8C'] = '\u0626';
  35277. t['\uFE8D'] = '\u0627';
  35278. t['\uFE8E'] = '\u0627';
  35279. t['\uFE8F'] = '\u0628';
  35280. t['\uFE90'] = '\u0628';
  35281. t['\uFE91'] = '\u0628';
  35282. t['\uFE92'] = '\u0628';
  35283. t['\uFE93'] = '\u0629';
  35284. t['\uFE94'] = '\u0629';
  35285. t['\uFE95'] = '\u062A';
  35286. t['\uFE96'] = '\u062A';
  35287. t['\uFE97'] = '\u062A';
  35288. t['\uFE98'] = '\u062A';
  35289. t['\uFE99'] = '\u062B';
  35290. t['\uFE9A'] = '\u062B';
  35291. t['\uFE9B'] = '\u062B';
  35292. t['\uFE9C'] = '\u062B';
  35293. t['\uFE9D'] = '\u062C';
  35294. t['\uFE9E'] = '\u062C';
  35295. t['\uFE9F'] = '\u062C';
  35296. t['\uFEA0'] = '\u062C';
  35297. t['\uFEA1'] = '\u062D';
  35298. t['\uFEA2'] = '\u062D';
  35299. t['\uFEA3'] = '\u062D';
  35300. t['\uFEA4'] = '\u062D';
  35301. t['\uFEA5'] = '\u062E';
  35302. t['\uFEA6'] = '\u062E';
  35303. t['\uFEA7'] = '\u062E';
  35304. t['\uFEA8'] = '\u062E';
  35305. t['\uFEA9'] = '\u062F';
  35306. t['\uFEAA'] = '\u062F';
  35307. t['\uFEAB'] = '\u0630';
  35308. t['\uFEAC'] = '\u0630';
  35309. t['\uFEAD'] = '\u0631';
  35310. t['\uFEAE'] = '\u0631';
  35311. t['\uFEAF'] = '\u0632';
  35312. t['\uFEB0'] = '\u0632';
  35313. t['\uFEB1'] = '\u0633';
  35314. t['\uFEB2'] = '\u0633';
  35315. t['\uFEB3'] = '\u0633';
  35316. t['\uFEB4'] = '\u0633';
  35317. t['\uFEB5'] = '\u0634';
  35318. t['\uFEB6'] = '\u0634';
  35319. t['\uFEB7'] = '\u0634';
  35320. t['\uFEB8'] = '\u0634';
  35321. t['\uFEB9'] = '\u0635';
  35322. t['\uFEBA'] = '\u0635';
  35323. t['\uFEBB'] = '\u0635';
  35324. t['\uFEBC'] = '\u0635';
  35325. t['\uFEBD'] = '\u0636';
  35326. t['\uFEBE'] = '\u0636';
  35327. t['\uFEBF'] = '\u0636';
  35328. t['\uFEC0'] = '\u0636';
  35329. t['\uFEC1'] = '\u0637';
  35330. t['\uFEC2'] = '\u0637';
  35331. t['\uFEC3'] = '\u0637';
  35332. t['\uFEC4'] = '\u0637';
  35333. t['\uFEC5'] = '\u0638';
  35334. t['\uFEC6'] = '\u0638';
  35335. t['\uFEC7'] = '\u0638';
  35336. t['\uFEC8'] = '\u0638';
  35337. t['\uFEC9'] = '\u0639';
  35338. t['\uFECA'] = '\u0639';
  35339. t['\uFECB'] = '\u0639';
  35340. t['\uFECC'] = '\u0639';
  35341. t['\uFECD'] = '\u063A';
  35342. t['\uFECE'] = '\u063A';
  35343. t['\uFECF'] = '\u063A';
  35344. t['\uFED0'] = '\u063A';
  35345. t['\uFED1'] = '\u0641';
  35346. t['\uFED2'] = '\u0641';
  35347. t['\uFED3'] = '\u0641';
  35348. t['\uFED4'] = '\u0641';
  35349. t['\uFED5'] = '\u0642';
  35350. t['\uFED6'] = '\u0642';
  35351. t['\uFED7'] = '\u0642';
  35352. t['\uFED8'] = '\u0642';
  35353. t['\uFED9'] = '\u0643';
  35354. t['\uFEDA'] = '\u0643';
  35355. t['\uFEDB'] = '\u0643';
  35356. t['\uFEDC'] = '\u0643';
  35357. t['\uFEDD'] = '\u0644';
  35358. t['\uFEDE'] = '\u0644';
  35359. t['\uFEDF'] = '\u0644';
  35360. t['\uFEE0'] = '\u0644';
  35361. t['\uFEE1'] = '\u0645';
  35362. t['\uFEE2'] = '\u0645';
  35363. t['\uFEE3'] = '\u0645';
  35364. t['\uFEE4'] = '\u0645';
  35365. t['\uFEE5'] = '\u0646';
  35366. t['\uFEE6'] = '\u0646';
  35367. t['\uFEE7'] = '\u0646';
  35368. t['\uFEE8'] = '\u0646';
  35369. t['\uFEE9'] = '\u0647';
  35370. t['\uFEEA'] = '\u0647';
  35371. t['\uFEEB'] = '\u0647';
  35372. t['\uFEEC'] = '\u0647';
  35373. t['\uFEED'] = '\u0648';
  35374. t['\uFEEE'] = '\u0648';
  35375. t['\uFEEF'] = '\u0649';
  35376. t['\uFEF0'] = '\u0649';
  35377. t['\uFEF1'] = '\u064A';
  35378. t['\uFEF2'] = '\u064A';
  35379. t['\uFEF3'] = '\u064A';
  35380. t['\uFEF4'] = '\u064A';
  35381. t['\uFEF5'] = '\u0644\u0622';
  35382. t['\uFEF6'] = '\u0644\u0622';
  35383. t['\uFEF7'] = '\u0644\u0623';
  35384. t['\uFEF8'] = '\u0644\u0623';
  35385. t['\uFEF9'] = '\u0644\u0625';
  35386. t['\uFEFA'] = '\u0644\u0625';
  35387. t['\uFEFB'] = '\u0644\u0627';
  35388. t['\uFEFC'] = '\u0644\u0627';
  35389. });
  35390. function reverseIfRtl(chars) {
  35391. var charsLength = chars.length;
  35392. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  35393. return chars;
  35394. }
  35395. var s = '';
  35396. for (var ii = charsLength - 1; ii >= 0; ii--) {
  35397. s += chars[ii];
  35398. }
  35399. return s;
  35400. }
  35401. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  35402. exports.reverseIfRtl = reverseIfRtl;
  35403. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  35404. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  35405. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  35406. /***/ }),
  35407. /* 18 */
  35408. /***/ (function(module, exports, __w_pdfjs_require__) {
  35409. "use strict";
  35410. var sharedUtil = __w_pdfjs_require__(0);
  35411. var coreWorker = __w_pdfjs_require__(8);
  35412. var OK_RESPONSE = 200;
  35413. var PARTIAL_CONTENT_RESPONSE = 206;
  35414. function NetworkManager(url, args) {
  35415. this.url = url;
  35416. args = args || {};
  35417. this.isHttp = /^https?:/i.test(url);
  35418. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  35419. this.withCredentials = args.withCredentials || false;
  35420. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  35421. return new XMLHttpRequest();
  35422. };
  35423. this.currXhrId = 0;
  35424. this.pendingRequests = Object.create(null);
  35425. this.loadedRequests = Object.create(null);
  35426. }
  35427. function getArrayBuffer(xhr) {
  35428. var data = xhr.response;
  35429. if (typeof data !== 'string') {
  35430. return data;
  35431. }
  35432. var length = data.length;
  35433. var array = new Uint8Array(length);
  35434. for (var i = 0; i < length; i++) {
  35435. array[i] = data.charCodeAt(i) & 0xFF;
  35436. }
  35437. return array.buffer;
  35438. }
  35439. var supportsMozChunked = function supportsMozChunkedClosure() {
  35440. try {
  35441. var x = new XMLHttpRequest();
  35442. x.open('GET', 'https://example.com');
  35443. x.responseType = 'moz-chunked-arraybuffer';
  35444. return x.responseType === 'moz-chunked-arraybuffer';
  35445. } catch (e) {
  35446. return false;
  35447. }
  35448. }();
  35449. NetworkManager.prototype = {
  35450. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  35451. var args = {
  35452. begin: begin,
  35453. end: end
  35454. };
  35455. for (var prop in listeners) {
  35456. args[prop] = listeners[prop];
  35457. }
  35458. return this.request(args);
  35459. },
  35460. requestFull: function NetworkManager_requestFull(listeners) {
  35461. return this.request(listeners);
  35462. },
  35463. request: function NetworkManager_request(args) {
  35464. var xhr = this.getXhr();
  35465. var xhrId = this.currXhrId++;
  35466. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  35467. xhr.open('GET', this.url);
  35468. xhr.withCredentials = this.withCredentials;
  35469. for (var property in this.httpHeaders) {
  35470. var value = this.httpHeaders[property];
  35471. if (typeof value === 'undefined') {
  35472. continue;
  35473. }
  35474. xhr.setRequestHeader(property, value);
  35475. }
  35476. if (this.isHttp && 'begin' in args && 'end' in args) {
  35477. var rangeStr = args.begin + '-' + (args.end - 1);
  35478. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  35479. pendingRequest.expectedStatus = 206;
  35480. } else {
  35481. pendingRequest.expectedStatus = 200;
  35482. }
  35483. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  35484. if (useMozChunkedLoading) {
  35485. xhr.responseType = 'moz-chunked-arraybuffer';
  35486. pendingRequest.onProgressiveData = args.onProgressiveData;
  35487. pendingRequest.mozChunked = true;
  35488. } else {
  35489. xhr.responseType = 'arraybuffer';
  35490. }
  35491. if (args.onError) {
  35492. xhr.onerror = function (evt) {
  35493. args.onError(xhr.status);
  35494. };
  35495. }
  35496. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  35497. xhr.onprogress = this.onProgress.bind(this, xhrId);
  35498. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  35499. pendingRequest.onDone = args.onDone;
  35500. pendingRequest.onError = args.onError;
  35501. pendingRequest.onProgress = args.onProgress;
  35502. xhr.send(null);
  35503. return xhrId;
  35504. },
  35505. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  35506. var pendingRequest = this.pendingRequests[xhrId];
  35507. if (!pendingRequest) {
  35508. return;
  35509. }
  35510. if (pendingRequest.mozChunked) {
  35511. var chunk = getArrayBuffer(pendingRequest.xhr);
  35512. pendingRequest.onProgressiveData(chunk);
  35513. }
  35514. var onProgress = pendingRequest.onProgress;
  35515. if (onProgress) {
  35516. onProgress(evt);
  35517. }
  35518. },
  35519. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  35520. var pendingRequest = this.pendingRequests[xhrId];
  35521. if (!pendingRequest) {
  35522. return;
  35523. }
  35524. var xhr = pendingRequest.xhr;
  35525. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  35526. pendingRequest.onHeadersReceived();
  35527. delete pendingRequest.onHeadersReceived;
  35528. }
  35529. if (xhr.readyState !== 4) {
  35530. return;
  35531. }
  35532. if (!(xhrId in this.pendingRequests)) {
  35533. return;
  35534. }
  35535. delete this.pendingRequests[xhrId];
  35536. if (xhr.status === 0 && this.isHttp) {
  35537. if (pendingRequest.onError) {
  35538. pendingRequest.onError(xhr.status);
  35539. }
  35540. return;
  35541. }
  35542. var xhrStatus = xhr.status || OK_RESPONSE;
  35543. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  35544. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  35545. if (pendingRequest.onError) {
  35546. pendingRequest.onError(xhr.status);
  35547. }
  35548. return;
  35549. }
  35550. this.loadedRequests[xhrId] = true;
  35551. var chunk = getArrayBuffer(xhr);
  35552. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  35553. var rangeHeader = xhr.getResponseHeader('Content-Range');
  35554. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  35555. var begin = parseInt(matches[1], 10);
  35556. pendingRequest.onDone({
  35557. begin: begin,
  35558. chunk: chunk
  35559. });
  35560. } else if (pendingRequest.onProgressiveData) {
  35561. pendingRequest.onDone(null);
  35562. } else if (chunk) {
  35563. pendingRequest.onDone({
  35564. begin: 0,
  35565. chunk: chunk
  35566. });
  35567. } else if (pendingRequest.onError) {
  35568. pendingRequest.onError(xhr.status);
  35569. }
  35570. },
  35571. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  35572. for (var xhrId in this.pendingRequests) {
  35573. return true;
  35574. }
  35575. return false;
  35576. },
  35577. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  35578. return this.pendingRequests[xhrId].xhr;
  35579. },
  35580. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  35581. return !!this.pendingRequests[xhrId].onProgressiveData;
  35582. },
  35583. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  35584. return xhrId in this.pendingRequests;
  35585. },
  35586. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  35587. return xhrId in this.loadedRequests;
  35588. },
  35589. abortAllRequests: function NetworkManager_abortAllRequests() {
  35590. for (var xhrId in this.pendingRequests) {
  35591. this.abortRequest(xhrId | 0);
  35592. }
  35593. },
  35594. abortRequest: function NetworkManager_abortRequest(xhrId) {
  35595. var xhr = this.pendingRequests[xhrId].xhr;
  35596. delete this.pendingRequests[xhrId];
  35597. xhr.abort();
  35598. }
  35599. };
  35600. var assert = sharedUtil.assert;
  35601. var createPromiseCapability = sharedUtil.createPromiseCapability;
  35602. var isInt = sharedUtil.isInt;
  35603. var MissingPDFException = sharedUtil.MissingPDFException;
  35604. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  35605. function PDFNetworkStream(options) {
  35606. this._options = options;
  35607. var source = options.source;
  35608. this._manager = new NetworkManager(source.url, {
  35609. httpHeaders: source.httpHeaders,
  35610. withCredentials: source.withCredentials
  35611. });
  35612. this._rangeChunkSize = source.rangeChunkSize;
  35613. this._fullRequestReader = null;
  35614. this._rangeRequestReaders = [];
  35615. }
  35616. PDFNetworkStream.prototype = {
  35617. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  35618. var i = this._rangeRequestReaders.indexOf(reader);
  35619. if (i >= 0) {
  35620. this._rangeRequestReaders.splice(i, 1);
  35621. }
  35622. },
  35623. getFullReader: function PDFNetworkStream_getFullReader() {
  35624. assert(!this._fullRequestReader);
  35625. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  35626. return this._fullRequestReader;
  35627. },
  35628. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  35629. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  35630. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  35631. this._rangeRequestReaders.push(reader);
  35632. return reader;
  35633. },
  35634. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  35635. if (this._fullRequestReader) {
  35636. this._fullRequestReader.cancel(reason);
  35637. }
  35638. var readers = this._rangeRequestReaders.slice(0);
  35639. readers.forEach(function (reader) {
  35640. reader.cancel(reason);
  35641. });
  35642. }
  35643. };
  35644. function PDFNetworkStreamFullRequestReader(manager, options) {
  35645. this._manager = manager;
  35646. var source = options.source;
  35647. var args = {
  35648. onHeadersReceived: this._onHeadersReceived.bind(this),
  35649. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  35650. onDone: this._onDone.bind(this),
  35651. onError: this._onError.bind(this),
  35652. onProgress: this._onProgress.bind(this)
  35653. };
  35654. this._url = source.url;
  35655. this._fullRequestId = manager.requestFull(args);
  35656. this._headersReceivedCapability = createPromiseCapability();
  35657. this._disableRange = options.disableRange || false;
  35658. this._contentLength = source.length;
  35659. this._rangeChunkSize = source.rangeChunkSize;
  35660. if (!this._rangeChunkSize && !this._disableRange) {
  35661. this._disableRange = true;
  35662. }
  35663. this._isStreamingSupported = false;
  35664. this._isRangeSupported = false;
  35665. this._cachedChunks = [];
  35666. this._requests = [];
  35667. this._done = false;
  35668. this._storedError = undefined;
  35669. this.onProgress = null;
  35670. }
  35671. PDFNetworkStreamFullRequestReader.prototype = {
  35672. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  35673. if (this._disableRange) {
  35674. return false;
  35675. }
  35676. var networkManager = this._manager;
  35677. if (!networkManager.isHttp) {
  35678. return false;
  35679. }
  35680. var fullRequestXhrId = this._fullRequestId;
  35681. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  35682. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  35683. return false;
  35684. }
  35685. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  35686. if (contentEncoding !== 'identity') {
  35687. return false;
  35688. }
  35689. var length = fullRequestXhr.getResponseHeader('Content-Length');
  35690. length = parseInt(length, 10);
  35691. if (!isInt(length)) {
  35692. return false;
  35693. }
  35694. this._contentLength = length;
  35695. if (length <= 2 * this._rangeChunkSize) {
  35696. return false;
  35697. }
  35698. return true;
  35699. },
  35700. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  35701. if (this._validateRangeRequestCapabilities()) {
  35702. this._isRangeSupported = true;
  35703. }
  35704. var networkManager = this._manager;
  35705. var fullRequestXhrId = this._fullRequestId;
  35706. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  35707. this._isStreamingSupported = true;
  35708. } else if (this._isRangeSupported) {
  35709. networkManager.abortRequest(fullRequestXhrId);
  35710. }
  35711. this._headersReceivedCapability.resolve();
  35712. },
  35713. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  35714. if (this._requests.length > 0) {
  35715. var requestCapability = this._requests.shift();
  35716. requestCapability.resolve({
  35717. value: chunk,
  35718. done: false
  35719. });
  35720. } else {
  35721. this._cachedChunks.push(chunk);
  35722. }
  35723. },
  35724. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  35725. if (args) {
  35726. this._onProgressiveData(args.chunk);
  35727. }
  35728. this._done = true;
  35729. if (this._cachedChunks.length > 0) {
  35730. return;
  35731. }
  35732. this._requests.forEach(function (requestCapability) {
  35733. requestCapability.resolve({
  35734. value: undefined,
  35735. done: true
  35736. });
  35737. });
  35738. this._requests = [];
  35739. },
  35740. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  35741. var url = this._url;
  35742. var exception;
  35743. if (status === 404 || status === 0 && /^file:/.test(url)) {
  35744. exception = new MissingPDFException('Missing PDF "' + url + '".');
  35745. } else {
  35746. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  35747. }
  35748. this._storedError = exception;
  35749. this._headersReceivedCapability.reject(exception);
  35750. this._requests.forEach(function (requestCapability) {
  35751. requestCapability.reject(exception);
  35752. });
  35753. this._requests = [];
  35754. this._cachedChunks = [];
  35755. },
  35756. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  35757. if (this.onProgress) {
  35758. this.onProgress({
  35759. loaded: data.loaded,
  35760. total: data.lengthComputable ? data.total : this._contentLength
  35761. });
  35762. }
  35763. },
  35764. get isRangeSupported() {
  35765. return this._isRangeSupported;
  35766. },
  35767. get isStreamingSupported() {
  35768. return this._isStreamingSupported;
  35769. },
  35770. get contentLength() {
  35771. return this._contentLength;
  35772. },
  35773. get headersReady() {
  35774. return this._headersReceivedCapability.promise;
  35775. },
  35776. read: function PDFNetworkStreamFullRequestReader_read() {
  35777. if (this._storedError) {
  35778. return Promise.reject(this._storedError);
  35779. }
  35780. if (this._cachedChunks.length > 0) {
  35781. var chunk = this._cachedChunks.shift();
  35782. return Promise.resolve(chunk);
  35783. }
  35784. if (this._done) {
  35785. return Promise.resolve({
  35786. value: undefined,
  35787. done: true
  35788. });
  35789. }
  35790. var requestCapability = createPromiseCapability();
  35791. this._requests.push(requestCapability);
  35792. return requestCapability.promise;
  35793. },
  35794. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  35795. this._done = true;
  35796. this._headersReceivedCapability.reject(reason);
  35797. this._requests.forEach(function (requestCapability) {
  35798. requestCapability.resolve({
  35799. value: undefined,
  35800. done: true
  35801. });
  35802. });
  35803. this._requests = [];
  35804. if (this._manager.isPendingRequest(this._fullRequestId)) {
  35805. this._manager.abortRequest(this._fullRequestId);
  35806. }
  35807. this._fullRequestReader = null;
  35808. }
  35809. };
  35810. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  35811. this._manager = manager;
  35812. var args = {
  35813. onDone: this._onDone.bind(this),
  35814. onProgress: this._onProgress.bind(this)
  35815. };
  35816. this._requestId = manager.requestRange(begin, end, args);
  35817. this._requests = [];
  35818. this._queuedChunk = null;
  35819. this._done = false;
  35820. this.onProgress = null;
  35821. this.onClosed = null;
  35822. }
  35823. PDFNetworkStreamRangeRequestReader.prototype = {
  35824. _close: function PDFNetworkStreamRangeRequestReader_close() {
  35825. if (this.onClosed) {
  35826. this.onClosed(this);
  35827. }
  35828. },
  35829. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  35830. var chunk = data.chunk;
  35831. if (this._requests.length > 0) {
  35832. var requestCapability = this._requests.shift();
  35833. requestCapability.resolve({
  35834. value: chunk,
  35835. done: false
  35836. });
  35837. } else {
  35838. this._queuedChunk = chunk;
  35839. }
  35840. this._done = true;
  35841. this._requests.forEach(function (requestCapability) {
  35842. requestCapability.resolve({
  35843. value: undefined,
  35844. done: true
  35845. });
  35846. });
  35847. this._requests = [];
  35848. this._close();
  35849. },
  35850. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35851. if (!this.isStreamingSupported && this.onProgress) {
  35852. this.onProgress({ loaded: evt.loaded });
  35853. }
  35854. },
  35855. get isStreamingSupported() {
  35856. return false;
  35857. },
  35858. read: function PDFNetworkStreamRangeRequestReader_read() {
  35859. if (this._queuedChunk !== null) {
  35860. var chunk = this._queuedChunk;
  35861. this._queuedChunk = null;
  35862. return Promise.resolve({
  35863. value: chunk,
  35864. done: false
  35865. });
  35866. }
  35867. if (this._done) {
  35868. return Promise.resolve({
  35869. value: undefined,
  35870. done: true
  35871. });
  35872. }
  35873. var requestCapability = createPromiseCapability();
  35874. this._requests.push(requestCapability);
  35875. return requestCapability.promise;
  35876. },
  35877. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35878. this._done = true;
  35879. this._requests.forEach(function (requestCapability) {
  35880. requestCapability.resolve({
  35881. value: undefined,
  35882. done: true
  35883. });
  35884. });
  35885. this._requests = [];
  35886. if (this._manager.isPendingRequest(this._requestId)) {
  35887. this._manager.abortRequest(this._requestId);
  35888. }
  35889. this._close();
  35890. }
  35891. };
  35892. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35893. exports.PDFNetworkStream = PDFNetworkStream;
  35894. exports.NetworkManager = NetworkManager;
  35895. /***/ }),
  35896. /* 19 */
  35897. /***/ (function(module, exports) {
  35898. var g;
  35899. g = function () {
  35900. return this;
  35901. }();
  35902. try {
  35903. g = g || Function("return this")() || (1, eval)("this");
  35904. } catch (e) {
  35905. if (typeof window === "object")
  35906. g = window;
  35907. }
  35908. module.exports = g;
  35909. /***/ }),
  35910. /* 20 */
  35911. /***/ (function(module, exports, __w_pdfjs_require__) {
  35912. "use strict";
  35913. var sharedUtil = __w_pdfjs_require__(0);
  35914. var corePrimitives = __w_pdfjs_require__(1);
  35915. var coreStream = __w_pdfjs_require__(2);
  35916. var coreColorSpace = __w_pdfjs_require__(3);
  35917. var coreObj = __w_pdfjs_require__(15);
  35918. var coreEvaluator = __w_pdfjs_require__(13);
  35919. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35920. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35921. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35922. var AnnotationType = sharedUtil.AnnotationType;
  35923. var OPS = sharedUtil.OPS;
  35924. var Util = sharedUtil.Util;
  35925. var isArray = sharedUtil.isArray;
  35926. var isInt = sharedUtil.isInt;
  35927. var stringToBytes = sharedUtil.stringToBytes;
  35928. var stringToPDFString = sharedUtil.stringToPDFString;
  35929. var warn = sharedUtil.warn;
  35930. var Dict = corePrimitives.Dict;
  35931. var isDict = corePrimitives.isDict;
  35932. var isName = corePrimitives.isName;
  35933. var isRef = corePrimitives.isRef;
  35934. var isStream = corePrimitives.isStream;
  35935. var Stream = coreStream.Stream;
  35936. var ColorSpace = coreColorSpace.ColorSpace;
  35937. var Catalog = coreObj.Catalog;
  35938. var ObjectLoader = coreObj.ObjectLoader;
  35939. var FileSpec = coreObj.FileSpec;
  35940. var OperatorList = coreEvaluator.OperatorList;
  35941. function AnnotationFactory() {
  35942. }
  35943. AnnotationFactory.prototype = {
  35944. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35945. var dict = xref.fetchIfRef(ref);
  35946. if (!isDict(dict)) {
  35947. return;
  35948. }
  35949. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35950. var subtype = dict.get('Subtype');
  35951. subtype = isName(subtype) ? subtype.name : null;
  35952. var parameters = {
  35953. xref: xref,
  35954. dict: dict,
  35955. ref: isRef(ref) ? ref : null,
  35956. subtype: subtype,
  35957. id: id,
  35958. pdfManager: pdfManager
  35959. };
  35960. switch (subtype) {
  35961. case 'Link':
  35962. return new LinkAnnotation(parameters);
  35963. case 'Text':
  35964. return new TextAnnotation(parameters);
  35965. case 'Widget':
  35966. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35967. fieldType = isName(fieldType) ? fieldType.name : null;
  35968. switch (fieldType) {
  35969. case 'Tx':
  35970. return new TextWidgetAnnotation(parameters);
  35971. case 'Btn':
  35972. return new ButtonWidgetAnnotation(parameters);
  35973. case 'Ch':
  35974. return new ChoiceWidgetAnnotation(parameters);
  35975. }
  35976. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35977. return new WidgetAnnotation(parameters);
  35978. case 'Popup':
  35979. return new PopupAnnotation(parameters);
  35980. case 'Highlight':
  35981. return new HighlightAnnotation(parameters);
  35982. case 'Underline':
  35983. return new UnderlineAnnotation(parameters);
  35984. case 'Squiggly':
  35985. return new SquigglyAnnotation(parameters);
  35986. case 'StrikeOut':
  35987. return new StrikeOutAnnotation(parameters);
  35988. case 'FileAttachment':
  35989. return new FileAttachmentAnnotation(parameters);
  35990. default:
  35991. if (!subtype) {
  35992. warn('Annotation is missing the required /Subtype.');
  35993. } else {
  35994. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35995. }
  35996. return new Annotation(parameters);
  35997. }
  35998. }
  35999. };
  36000. var Annotation = function AnnotationClosure() {
  36001. function getTransformMatrix(rect, bbox, matrix) {
  36002. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  36003. var minX = bounds[0];
  36004. var minY = bounds[1];
  36005. var maxX = bounds[2];
  36006. var maxY = bounds[3];
  36007. if (minX === maxX || minY === maxY) {
  36008. return [
  36009. 1,
  36010. 0,
  36011. 0,
  36012. 1,
  36013. rect[0],
  36014. rect[1]
  36015. ];
  36016. }
  36017. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  36018. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  36019. return [
  36020. xRatio,
  36021. 0,
  36022. 0,
  36023. yRatio,
  36024. rect[0] - minX * xRatio,
  36025. rect[1] - minY * yRatio
  36026. ];
  36027. }
  36028. function Annotation(params) {
  36029. var dict = params.dict;
  36030. this.setFlags(dict.get('F'));
  36031. this.setRectangle(dict.getArray('Rect'));
  36032. this.setColor(dict.getArray('C'));
  36033. this.setBorderStyle(dict);
  36034. this.setAppearance(dict);
  36035. this.data = {};
  36036. this.data.id = params.id;
  36037. this.data.subtype = params.subtype;
  36038. this.data.annotationFlags = this.flags;
  36039. this.data.rect = this.rectangle;
  36040. this.data.color = this.color;
  36041. this.data.borderStyle = this.borderStyle;
  36042. this.data.hasAppearance = !!this.appearance;
  36043. }
  36044. Annotation.prototype = {
  36045. _hasFlag: function Annotation_hasFlag(flags, flag) {
  36046. return !!(flags & flag);
  36047. },
  36048. _isViewable: function Annotation_isViewable(flags) {
  36049. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  36050. },
  36051. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  36052. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  36053. },
  36054. get viewable() {
  36055. if (this.flags === 0) {
  36056. return true;
  36057. }
  36058. return this._isViewable(this.flags);
  36059. },
  36060. get printable() {
  36061. if (this.flags === 0) {
  36062. return false;
  36063. }
  36064. return this._isPrintable(this.flags);
  36065. },
  36066. setFlags: function Annotation_setFlags(flags) {
  36067. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  36068. },
  36069. hasFlag: function Annotation_hasFlag(flag) {
  36070. return this._hasFlag(this.flags, flag);
  36071. },
  36072. setRectangle: function Annotation_setRectangle(rectangle) {
  36073. if (isArray(rectangle) && rectangle.length === 4) {
  36074. this.rectangle = Util.normalizeRect(rectangle);
  36075. } else {
  36076. this.rectangle = [
  36077. 0,
  36078. 0,
  36079. 0,
  36080. 0
  36081. ];
  36082. }
  36083. },
  36084. setColor: function Annotation_setColor(color) {
  36085. var rgbColor = new Uint8Array(3);
  36086. if (!isArray(color)) {
  36087. this.color = rgbColor;
  36088. return;
  36089. }
  36090. switch (color.length) {
  36091. case 0:
  36092. this.color = null;
  36093. break;
  36094. case 1:
  36095. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  36096. this.color = rgbColor;
  36097. break;
  36098. case 3:
  36099. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  36100. this.color = rgbColor;
  36101. break;
  36102. case 4:
  36103. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  36104. this.color = rgbColor;
  36105. break;
  36106. default:
  36107. this.color = rgbColor;
  36108. break;
  36109. }
  36110. },
  36111. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  36112. this.borderStyle = new AnnotationBorderStyle();
  36113. if (!isDict(borderStyle)) {
  36114. return;
  36115. }
  36116. if (borderStyle.has('BS')) {
  36117. var dict = borderStyle.get('BS');
  36118. var dictType = dict.get('Type');
  36119. if (!dictType || isName(dictType, 'Border')) {
  36120. this.borderStyle.setWidth(dict.get('W'));
  36121. this.borderStyle.setStyle(dict.get('S'));
  36122. this.borderStyle.setDashArray(dict.getArray('D'));
  36123. }
  36124. } else if (borderStyle.has('Border')) {
  36125. var array = borderStyle.getArray('Border');
  36126. if (isArray(array) && array.length >= 3) {
  36127. this.borderStyle.setHorizontalCornerRadius(array[0]);
  36128. this.borderStyle.setVerticalCornerRadius(array[1]);
  36129. this.borderStyle.setWidth(array[2]);
  36130. if (array.length === 4) {
  36131. this.borderStyle.setDashArray(array[3]);
  36132. }
  36133. }
  36134. } else {
  36135. this.borderStyle.setWidth(0);
  36136. }
  36137. },
  36138. setAppearance: function Annotation_setAppearance(dict) {
  36139. this.appearance = null;
  36140. var appearanceStates = dict.get('AP');
  36141. if (!isDict(appearanceStates)) {
  36142. return;
  36143. }
  36144. var normalAppearanceState = appearanceStates.get('N');
  36145. if (isStream(normalAppearanceState)) {
  36146. this.appearance = normalAppearanceState;
  36147. return;
  36148. }
  36149. if (!isDict(normalAppearanceState)) {
  36150. return;
  36151. }
  36152. var as = dict.get('AS');
  36153. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  36154. return;
  36155. }
  36156. this.appearance = normalAppearanceState.get(as.name);
  36157. },
  36158. _preparePopup: function Annotation_preparePopup(dict) {
  36159. if (!dict.has('C')) {
  36160. this.data.color = null;
  36161. }
  36162. this.data.hasPopup = dict.has('Popup');
  36163. this.data.title = stringToPDFString(dict.get('T') || '');
  36164. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  36165. },
  36166. loadResources: function Annotation_loadResources(keys) {
  36167. return new Promise(function (resolve, reject) {
  36168. this.appearance.dict.getAsync('Resources').then(function (resources) {
  36169. if (!resources) {
  36170. resolve();
  36171. return;
  36172. }
  36173. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  36174. objectLoader.load().then(function () {
  36175. resolve(resources);
  36176. }, reject);
  36177. }, reject);
  36178. }.bind(this));
  36179. },
  36180. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  36181. if (!this.appearance) {
  36182. return Promise.resolve(new OperatorList());
  36183. }
  36184. var data = this.data;
  36185. var appearanceDict = this.appearance.dict;
  36186. var resourcesPromise = this.loadResources([
  36187. 'ExtGState',
  36188. 'ColorSpace',
  36189. 'Pattern',
  36190. 'Shading',
  36191. 'XObject',
  36192. 'Font'
  36193. ]);
  36194. var bbox = appearanceDict.getArray('BBox') || [
  36195. 0,
  36196. 0,
  36197. 1,
  36198. 1
  36199. ];
  36200. var matrix = appearanceDict.getArray('Matrix') || [
  36201. 1,
  36202. 0,
  36203. 0,
  36204. 1,
  36205. 0,
  36206. 0
  36207. ];
  36208. var transform = getTransformMatrix(data.rect, bbox, matrix);
  36209. var self = this;
  36210. return resourcesPromise.then(function (resources) {
  36211. var opList = new OperatorList();
  36212. opList.addOp(OPS.beginAnnotation, [
  36213. data.rect,
  36214. transform,
  36215. matrix
  36216. ]);
  36217. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  36218. opList.addOp(OPS.endAnnotation, []);
  36219. self.appearance.reset();
  36220. return opList;
  36221. });
  36222. });
  36223. }
  36224. };
  36225. Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) {
  36226. var annotationPromises = [];
  36227. for (var i = 0, n = annotations.length; i < n; ++i) {
  36228. if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) {
  36229. annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms));
  36230. }
  36231. }
  36232. return Promise.all(annotationPromises).then(function (operatorLists) {
  36233. opList.addOp(OPS.beginAnnotations, []);
  36234. for (var i = 0, n = operatorLists.length; i < n; ++i) {
  36235. opList.addOpList(operatorLists[i]);
  36236. }
  36237. opList.addOp(OPS.endAnnotations, []);
  36238. });
  36239. };
  36240. return Annotation;
  36241. }();
  36242. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  36243. function AnnotationBorderStyle() {
  36244. this.width = 1;
  36245. this.style = AnnotationBorderStyleType.SOLID;
  36246. this.dashArray = [3];
  36247. this.horizontalCornerRadius = 0;
  36248. this.verticalCornerRadius = 0;
  36249. }
  36250. AnnotationBorderStyle.prototype = {
  36251. setWidth: function AnnotationBorderStyle_setWidth(width) {
  36252. if (width === (width | 0)) {
  36253. this.width = width;
  36254. }
  36255. },
  36256. setStyle: function AnnotationBorderStyle_setStyle(style) {
  36257. if (!style) {
  36258. return;
  36259. }
  36260. switch (style.name) {
  36261. case 'S':
  36262. this.style = AnnotationBorderStyleType.SOLID;
  36263. break;
  36264. case 'D':
  36265. this.style = AnnotationBorderStyleType.DASHED;
  36266. break;
  36267. case 'B':
  36268. this.style = AnnotationBorderStyleType.BEVELED;
  36269. break;
  36270. case 'I':
  36271. this.style = AnnotationBorderStyleType.INSET;
  36272. break;
  36273. case 'U':
  36274. this.style = AnnotationBorderStyleType.UNDERLINE;
  36275. break;
  36276. default:
  36277. break;
  36278. }
  36279. },
  36280. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  36281. if (isArray(dashArray) && dashArray.length > 0) {
  36282. var isValid = true;
  36283. var allZeros = true;
  36284. for (var i = 0, len = dashArray.length; i < len; i++) {
  36285. var element = dashArray[i];
  36286. var validNumber = +element >= 0;
  36287. if (!validNumber) {
  36288. isValid = false;
  36289. break;
  36290. } else if (element > 0) {
  36291. allZeros = false;
  36292. }
  36293. }
  36294. if (isValid && !allZeros) {
  36295. this.dashArray = dashArray;
  36296. } else {
  36297. this.width = 0;
  36298. }
  36299. } else if (dashArray) {
  36300. this.width = 0;
  36301. }
  36302. },
  36303. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  36304. if (radius === (radius | 0)) {
  36305. this.horizontalCornerRadius = radius;
  36306. }
  36307. },
  36308. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  36309. if (radius === (radius | 0)) {
  36310. this.verticalCornerRadius = radius;
  36311. }
  36312. }
  36313. };
  36314. return AnnotationBorderStyle;
  36315. }();
  36316. var WidgetAnnotation = function WidgetAnnotationClosure() {
  36317. function WidgetAnnotation(params) {
  36318. Annotation.call(this, params);
  36319. var dict = params.dict;
  36320. var data = this.data;
  36321. data.annotationType = AnnotationType.WIDGET;
  36322. data.fieldName = this._constructFieldName(dict);
  36323. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  36324. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  36325. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  36326. var fieldType = Util.getInheritableProperty(dict, 'FT');
  36327. data.fieldType = isName(fieldType) ? fieldType.name : null;
  36328. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  36329. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  36330. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  36331. data.fieldFlags = 0;
  36332. }
  36333. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  36334. if (data.fieldType === 'Sig') {
  36335. this.setFlags(AnnotationFlag.HIDDEN);
  36336. }
  36337. }
  36338. Util.inherit(WidgetAnnotation, Annotation, {
  36339. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  36340. if (!dict.has('T') && !dict.has('Parent')) {
  36341. warn('Unknown field name, falling back to empty field name.');
  36342. return '';
  36343. }
  36344. if (!dict.has('Parent')) {
  36345. return stringToPDFString(dict.get('T'));
  36346. }
  36347. var fieldName = [];
  36348. if (dict.has('T')) {
  36349. fieldName.unshift(stringToPDFString(dict.get('T')));
  36350. }
  36351. var loopDict = dict;
  36352. while (loopDict.has('Parent')) {
  36353. loopDict = loopDict.get('Parent');
  36354. if (loopDict.has('T')) {
  36355. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  36356. }
  36357. }
  36358. return fieldName.join('.');
  36359. },
  36360. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  36361. return !!(this.data.fieldFlags & flag);
  36362. }
  36363. });
  36364. return WidgetAnnotation;
  36365. }();
  36366. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  36367. function TextWidgetAnnotation(params) {
  36368. WidgetAnnotation.call(this, params);
  36369. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  36370. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  36371. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  36372. alignment = null;
  36373. }
  36374. this.data.textAlignment = alignment;
  36375. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  36376. if (!isInt(maximumLength) || maximumLength < 0) {
  36377. maximumLength = null;
  36378. }
  36379. this.data.maxLen = maximumLength;
  36380. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  36381. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  36382. }
  36383. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  36384. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36385. var operatorList = new OperatorList();
  36386. if (renderForms) {
  36387. return Promise.resolve(operatorList);
  36388. }
  36389. if (this.appearance) {
  36390. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36391. }
  36392. if (!this.data.defaultAppearance) {
  36393. return Promise.resolve(operatorList);
  36394. }
  36395. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  36396. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  36397. return operatorList;
  36398. });
  36399. }
  36400. });
  36401. return TextWidgetAnnotation;
  36402. }();
  36403. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  36404. function ButtonWidgetAnnotation(params) {
  36405. WidgetAnnotation.call(this, params);
  36406. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36407. if (this.data.checkBox) {
  36408. if (!isName(this.data.fieldValue)) {
  36409. return;
  36410. }
  36411. this.data.fieldValue = this.data.fieldValue.name;
  36412. }
  36413. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36414. if (this.data.radioButton) {
  36415. this.data.fieldValue = this.data.buttonValue = null;
  36416. var fieldParent = params.dict.get('Parent');
  36417. if (isDict(fieldParent) && fieldParent.has('V')) {
  36418. var fieldParentValue = fieldParent.get('V');
  36419. if (isName(fieldParentValue)) {
  36420. this.data.fieldValue = fieldParentValue.name;
  36421. }
  36422. }
  36423. var appearanceStates = params.dict.get('AP');
  36424. if (!isDict(appearanceStates)) {
  36425. return;
  36426. }
  36427. var normalAppearanceState = appearanceStates.get('N');
  36428. if (!isDict(normalAppearanceState)) {
  36429. return;
  36430. }
  36431. var keys = normalAppearanceState.getKeys();
  36432. for (var i = 0, ii = keys.length; i < ii; i++) {
  36433. if (keys[i] !== 'Off') {
  36434. this.data.buttonValue = keys[i];
  36435. break;
  36436. }
  36437. }
  36438. }
  36439. }
  36440. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  36441. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36442. var operatorList = new OperatorList();
  36443. if (renderForms) {
  36444. return Promise.resolve(operatorList);
  36445. }
  36446. if (this.appearance) {
  36447. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36448. }
  36449. return Promise.resolve(operatorList);
  36450. }
  36451. });
  36452. return ButtonWidgetAnnotation;
  36453. }();
  36454. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  36455. function ChoiceWidgetAnnotation(params) {
  36456. WidgetAnnotation.call(this, params);
  36457. this.data.options = [];
  36458. var options = params.dict.get('Opt');
  36459. if (isArray(options)) {
  36460. var xref = params.xref;
  36461. for (var i = 0, ii = options.length; i < ii; i++) {
  36462. var option = xref.fetchIfRef(options[i]);
  36463. var isOptionArray = isArray(option);
  36464. this.data.options[i] = {
  36465. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  36466. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  36467. };
  36468. }
  36469. }
  36470. if (!isArray(this.data.fieldValue)) {
  36471. this.data.fieldValue = [this.data.fieldValue];
  36472. }
  36473. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  36474. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  36475. }
  36476. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  36477. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36478. var operatorList = new OperatorList();
  36479. if (renderForms) {
  36480. return Promise.resolve(operatorList);
  36481. }
  36482. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36483. }
  36484. });
  36485. return ChoiceWidgetAnnotation;
  36486. }();
  36487. var TextAnnotation = function TextAnnotationClosure() {
  36488. var DEFAULT_ICON_SIZE = 22;
  36489. function TextAnnotation(parameters) {
  36490. Annotation.call(this, parameters);
  36491. this.data.annotationType = AnnotationType.TEXT;
  36492. if (this.data.hasAppearance) {
  36493. this.data.name = 'NoIcon';
  36494. } else {
  36495. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  36496. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  36497. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  36498. }
  36499. this._preparePopup(parameters.dict);
  36500. }
  36501. Util.inherit(TextAnnotation, Annotation, {});
  36502. return TextAnnotation;
  36503. }();
  36504. var LinkAnnotation = function LinkAnnotationClosure() {
  36505. function LinkAnnotation(params) {
  36506. Annotation.call(this, params);
  36507. var data = this.data;
  36508. data.annotationType = AnnotationType.LINK;
  36509. Catalog.parseDestDictionary({
  36510. destDict: params.dict,
  36511. resultObj: data,
  36512. docBaseUrl: params.pdfManager.docBaseUrl
  36513. });
  36514. }
  36515. Util.inherit(LinkAnnotation, Annotation, {});
  36516. return LinkAnnotation;
  36517. }();
  36518. var PopupAnnotation = function PopupAnnotationClosure() {
  36519. function PopupAnnotation(parameters) {
  36520. Annotation.call(this, parameters);
  36521. this.data.annotationType = AnnotationType.POPUP;
  36522. var dict = parameters.dict;
  36523. var parentItem = dict.get('Parent');
  36524. if (!parentItem) {
  36525. warn('Popup annotation has a missing or invalid parent annotation.');
  36526. return;
  36527. }
  36528. this.data.parentId = dict.getRaw('Parent').toString();
  36529. this.data.title = stringToPDFString(parentItem.get('T') || '');
  36530. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  36531. if (!parentItem.has('C')) {
  36532. this.data.color = null;
  36533. } else {
  36534. this.setColor(parentItem.getArray('C'));
  36535. this.data.color = this.color;
  36536. }
  36537. if (!this.viewable) {
  36538. var parentFlags = parentItem.get('F');
  36539. if (this._isViewable(parentFlags)) {
  36540. this.setFlags(parentFlags);
  36541. }
  36542. }
  36543. }
  36544. Util.inherit(PopupAnnotation, Annotation, {});
  36545. return PopupAnnotation;
  36546. }();
  36547. var HighlightAnnotation = function HighlightAnnotationClosure() {
  36548. function HighlightAnnotation(parameters) {
  36549. Annotation.call(this, parameters);
  36550. this.data.annotationType = AnnotationType.HIGHLIGHT;
  36551. this._preparePopup(parameters.dict);
  36552. this.data.borderStyle.setWidth(0);
  36553. }
  36554. Util.inherit(HighlightAnnotation, Annotation, {});
  36555. return HighlightAnnotation;
  36556. }();
  36557. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  36558. function UnderlineAnnotation(parameters) {
  36559. Annotation.call(this, parameters);
  36560. this.data.annotationType = AnnotationType.UNDERLINE;
  36561. this._preparePopup(parameters.dict);
  36562. this.data.borderStyle.setWidth(0);
  36563. }
  36564. Util.inherit(UnderlineAnnotation, Annotation, {});
  36565. return UnderlineAnnotation;
  36566. }();
  36567. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  36568. function SquigglyAnnotation(parameters) {
  36569. Annotation.call(this, parameters);
  36570. this.data.annotationType = AnnotationType.SQUIGGLY;
  36571. this._preparePopup(parameters.dict);
  36572. this.data.borderStyle.setWidth(0);
  36573. }
  36574. Util.inherit(SquigglyAnnotation, Annotation, {});
  36575. return SquigglyAnnotation;
  36576. }();
  36577. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  36578. function StrikeOutAnnotation(parameters) {
  36579. Annotation.call(this, parameters);
  36580. this.data.annotationType = AnnotationType.STRIKEOUT;
  36581. this._preparePopup(parameters.dict);
  36582. this.data.borderStyle.setWidth(0);
  36583. }
  36584. Util.inherit(StrikeOutAnnotation, Annotation, {});
  36585. return StrikeOutAnnotation;
  36586. }();
  36587. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  36588. function FileAttachmentAnnotation(parameters) {
  36589. Annotation.call(this, parameters);
  36590. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  36591. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  36592. this.data.file = file.serializable;
  36593. this._preparePopup(parameters.dict);
  36594. }
  36595. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  36596. return FileAttachmentAnnotation;
  36597. }();
  36598. exports.Annotation = Annotation;
  36599. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  36600. exports.AnnotationFactory = AnnotationFactory;
  36601. /***/ }),
  36602. /* 21 */
  36603. /***/ (function(module, exports, __w_pdfjs_require__) {
  36604. "use strict";
  36605. var sharedUtil = __w_pdfjs_require__(0);
  36606. var warn = sharedUtil.warn;
  36607. var baseTypes = [
  36608. 'BN',
  36609. 'BN',
  36610. 'BN',
  36611. 'BN',
  36612. 'BN',
  36613. 'BN',
  36614. 'BN',
  36615. 'BN',
  36616. 'BN',
  36617. 'S',
  36618. 'B',
  36619. 'S',
  36620. 'WS',
  36621. 'B',
  36622. 'BN',
  36623. 'BN',
  36624. 'BN',
  36625. 'BN',
  36626. 'BN',
  36627. 'BN',
  36628. 'BN',
  36629. 'BN',
  36630. 'BN',
  36631. 'BN',
  36632. 'BN',
  36633. 'BN',
  36634. 'BN',
  36635. 'BN',
  36636. 'B',
  36637. 'B',
  36638. 'B',
  36639. 'S',
  36640. 'WS',
  36641. 'ON',
  36642. 'ON',
  36643. 'ET',
  36644. 'ET',
  36645. 'ET',
  36646. 'ON',
  36647. 'ON',
  36648. 'ON',
  36649. 'ON',
  36650. 'ON',
  36651. 'ES',
  36652. 'CS',
  36653. 'ES',
  36654. 'CS',
  36655. 'CS',
  36656. 'EN',
  36657. 'EN',
  36658. 'EN',
  36659. 'EN',
  36660. 'EN',
  36661. 'EN',
  36662. 'EN',
  36663. 'EN',
  36664. 'EN',
  36665. 'EN',
  36666. 'CS',
  36667. 'ON',
  36668. 'ON',
  36669. 'ON',
  36670. 'ON',
  36671. 'ON',
  36672. 'ON',
  36673. 'L',
  36674. 'L',
  36675. 'L',
  36676. 'L',
  36677. 'L',
  36678. 'L',
  36679. 'L',
  36680. 'L',
  36681. 'L',
  36682. 'L',
  36683. 'L',
  36684. 'L',
  36685. 'L',
  36686. 'L',
  36687. 'L',
  36688. 'L',
  36689. 'L',
  36690. 'L',
  36691. 'L',
  36692. 'L',
  36693. 'L',
  36694. 'L',
  36695. 'L',
  36696. 'L',
  36697. 'L',
  36698. 'L',
  36699. 'ON',
  36700. 'ON',
  36701. 'ON',
  36702. 'ON',
  36703. 'ON',
  36704. 'ON',
  36705. 'L',
  36706. 'L',
  36707. 'L',
  36708. 'L',
  36709. 'L',
  36710. 'L',
  36711. 'L',
  36712. 'L',
  36713. 'L',
  36714. 'L',
  36715. 'L',
  36716. 'L',
  36717. 'L',
  36718. 'L',
  36719. 'L',
  36720. 'L',
  36721. 'L',
  36722. 'L',
  36723. 'L',
  36724. 'L',
  36725. 'L',
  36726. 'L',
  36727. 'L',
  36728. 'L',
  36729. 'L',
  36730. 'L',
  36731. 'ON',
  36732. 'ON',
  36733. 'ON',
  36734. 'ON',
  36735. 'BN',
  36736. 'BN',
  36737. 'BN',
  36738. 'BN',
  36739. 'BN',
  36740. 'BN',
  36741. 'B',
  36742. 'BN',
  36743. 'BN',
  36744. 'BN',
  36745. 'BN',
  36746. 'BN',
  36747. 'BN',
  36748. 'BN',
  36749. 'BN',
  36750. 'BN',
  36751. 'BN',
  36752. 'BN',
  36753. 'BN',
  36754. 'BN',
  36755. 'BN',
  36756. 'BN',
  36757. 'BN',
  36758. 'BN',
  36759. 'BN',
  36760. 'BN',
  36761. 'BN',
  36762. 'BN',
  36763. 'BN',
  36764. 'BN',
  36765. 'BN',
  36766. 'BN',
  36767. 'BN',
  36768. 'CS',
  36769. 'ON',
  36770. 'ET',
  36771. 'ET',
  36772. 'ET',
  36773. 'ET',
  36774. 'ON',
  36775. 'ON',
  36776. 'ON',
  36777. 'ON',
  36778. 'L',
  36779. 'ON',
  36780. 'ON',
  36781. 'BN',
  36782. 'ON',
  36783. 'ON',
  36784. 'ET',
  36785. 'ET',
  36786. 'EN',
  36787. 'EN',
  36788. 'ON',
  36789. 'L',
  36790. 'ON',
  36791. 'ON',
  36792. 'ON',
  36793. 'EN',
  36794. 'L',
  36795. 'ON',
  36796. 'ON',
  36797. 'ON',
  36798. 'ON',
  36799. 'ON',
  36800. 'L',
  36801. 'L',
  36802. 'L',
  36803. 'L',
  36804. 'L',
  36805. 'L',
  36806. 'L',
  36807. 'L',
  36808. 'L',
  36809. 'L',
  36810. 'L',
  36811. 'L',
  36812. 'L',
  36813. 'L',
  36814. 'L',
  36815. 'L',
  36816. 'L',
  36817. 'L',
  36818. 'L',
  36819. 'L',
  36820. 'L',
  36821. 'L',
  36822. 'L',
  36823. 'ON',
  36824. 'L',
  36825. 'L',
  36826. 'L',
  36827. 'L',
  36828. 'L',
  36829. 'L',
  36830. 'L',
  36831. 'L',
  36832. 'L',
  36833. 'L',
  36834. 'L',
  36835. 'L',
  36836. 'L',
  36837. 'L',
  36838. 'L',
  36839. 'L',
  36840. 'L',
  36841. 'L',
  36842. 'L',
  36843. 'L',
  36844. 'L',
  36845. 'L',
  36846. 'L',
  36847. 'L',
  36848. 'L',
  36849. 'L',
  36850. 'L',
  36851. 'L',
  36852. 'L',
  36853. 'L',
  36854. 'L',
  36855. 'ON',
  36856. 'L',
  36857. 'L',
  36858. 'L',
  36859. 'L',
  36860. 'L',
  36861. 'L',
  36862. 'L',
  36863. 'L'
  36864. ];
  36865. var arabicTypes = [
  36866. 'AN',
  36867. 'AN',
  36868. 'AN',
  36869. 'AN',
  36870. 'AN',
  36871. 'AN',
  36872. 'ON',
  36873. 'ON',
  36874. 'AL',
  36875. 'ET',
  36876. 'ET',
  36877. 'AL',
  36878. 'CS',
  36879. 'AL',
  36880. 'ON',
  36881. 'ON',
  36882. 'NSM',
  36883. 'NSM',
  36884. 'NSM',
  36885. 'NSM',
  36886. 'NSM',
  36887. 'NSM',
  36888. 'NSM',
  36889. 'NSM',
  36890. 'NSM',
  36891. 'NSM',
  36892. 'NSM',
  36893. 'AL',
  36894. 'AL',
  36895. '',
  36896. 'AL',
  36897. 'AL',
  36898. 'AL',
  36899. 'AL',
  36900. 'AL',
  36901. 'AL',
  36902. 'AL',
  36903. 'AL',
  36904. 'AL',
  36905. 'AL',
  36906. 'AL',
  36907. 'AL',
  36908. 'AL',
  36909. 'AL',
  36910. 'AL',
  36911. 'AL',
  36912. 'AL',
  36913. 'AL',
  36914. 'AL',
  36915. 'AL',
  36916. 'AL',
  36917. 'AL',
  36918. 'AL',
  36919. 'AL',
  36920. 'AL',
  36921. 'AL',
  36922. 'AL',
  36923. 'AL',
  36924. 'AL',
  36925. 'AL',
  36926. 'AL',
  36927. 'AL',
  36928. 'AL',
  36929. 'AL',
  36930. 'AL',
  36931. 'AL',
  36932. 'AL',
  36933. 'AL',
  36934. 'AL',
  36935. 'AL',
  36936. 'AL',
  36937. 'AL',
  36938. 'AL',
  36939. 'AL',
  36940. 'AL',
  36941. 'NSM',
  36942. 'NSM',
  36943. 'NSM',
  36944. 'NSM',
  36945. 'NSM',
  36946. 'NSM',
  36947. 'NSM',
  36948. 'NSM',
  36949. 'NSM',
  36950. 'NSM',
  36951. 'NSM',
  36952. 'NSM',
  36953. 'NSM',
  36954. 'NSM',
  36955. 'NSM',
  36956. 'NSM',
  36957. 'NSM',
  36958. 'NSM',
  36959. 'NSM',
  36960. 'NSM',
  36961. 'NSM',
  36962. 'AN',
  36963. 'AN',
  36964. 'AN',
  36965. 'AN',
  36966. 'AN',
  36967. 'AN',
  36968. 'AN',
  36969. 'AN',
  36970. 'AN',
  36971. 'AN',
  36972. 'ET',
  36973. 'AN',
  36974. 'AN',
  36975. 'AL',
  36976. 'AL',
  36977. 'AL',
  36978. 'NSM',
  36979. 'AL',
  36980. 'AL',
  36981. 'AL',
  36982. 'AL',
  36983. 'AL',
  36984. 'AL',
  36985. 'AL',
  36986. 'AL',
  36987. 'AL',
  36988. 'AL',
  36989. 'AL',
  36990. 'AL',
  36991. 'AL',
  36992. 'AL',
  36993. 'AL',
  36994. 'AL',
  36995. 'AL',
  36996. 'AL',
  36997. 'AL',
  36998. 'AL',
  36999. 'AL',
  37000. 'AL',
  37001. 'AL',
  37002. 'AL',
  37003. 'AL',
  37004. 'AL',
  37005. 'AL',
  37006. 'AL',
  37007. 'AL',
  37008. 'AL',
  37009. 'AL',
  37010. 'AL',
  37011. 'AL',
  37012. 'AL',
  37013. 'AL',
  37014. 'AL',
  37015. 'AL',
  37016. 'AL',
  37017. 'AL',
  37018. 'AL',
  37019. 'AL',
  37020. 'AL',
  37021. 'AL',
  37022. 'AL',
  37023. 'AL',
  37024. 'AL',
  37025. 'AL',
  37026. 'AL',
  37027. 'AL',
  37028. 'AL',
  37029. 'AL',
  37030. 'AL',
  37031. 'AL',
  37032. 'AL',
  37033. 'AL',
  37034. 'AL',
  37035. 'AL',
  37036. 'AL',
  37037. 'AL',
  37038. 'AL',
  37039. 'AL',
  37040. 'AL',
  37041. 'AL',
  37042. 'AL',
  37043. 'AL',
  37044. 'AL',
  37045. 'AL',
  37046. 'AL',
  37047. 'AL',
  37048. 'AL',
  37049. 'AL',
  37050. 'AL',
  37051. 'AL',
  37052. 'AL',
  37053. 'AL',
  37054. 'AL',
  37055. 'AL',
  37056. 'AL',
  37057. 'AL',
  37058. 'AL',
  37059. 'AL',
  37060. 'AL',
  37061. 'AL',
  37062. 'AL',
  37063. 'AL',
  37064. 'AL',
  37065. 'AL',
  37066. 'AL',
  37067. 'AL',
  37068. 'AL',
  37069. 'AL',
  37070. 'AL',
  37071. 'AL',
  37072. 'AL',
  37073. 'AL',
  37074. 'AL',
  37075. 'AL',
  37076. 'AL',
  37077. 'AL',
  37078. 'AL',
  37079. 'AL',
  37080. 'NSM',
  37081. 'NSM',
  37082. 'NSM',
  37083. 'NSM',
  37084. 'NSM',
  37085. 'NSM',
  37086. 'NSM',
  37087. 'AN',
  37088. 'ON',
  37089. 'NSM',
  37090. 'NSM',
  37091. 'NSM',
  37092. 'NSM',
  37093. 'NSM',
  37094. 'NSM',
  37095. 'AL',
  37096. 'AL',
  37097. 'NSM',
  37098. 'NSM',
  37099. 'ON',
  37100. 'NSM',
  37101. 'NSM',
  37102. 'NSM',
  37103. 'NSM',
  37104. 'AL',
  37105. 'AL',
  37106. 'EN',
  37107. 'EN',
  37108. 'EN',
  37109. 'EN',
  37110. 'EN',
  37111. 'EN',
  37112. 'EN',
  37113. 'EN',
  37114. 'EN',
  37115. 'EN',
  37116. 'AL',
  37117. 'AL',
  37118. 'AL',
  37119. 'AL',
  37120. 'AL',
  37121. 'AL'
  37122. ];
  37123. function isOdd(i) {
  37124. return (i & 1) !== 0;
  37125. }
  37126. function isEven(i) {
  37127. return (i & 1) === 0;
  37128. }
  37129. function findUnequal(arr, start, value) {
  37130. for (var j = start, jj = arr.length; j < jj; ++j) {
  37131. if (arr[j] !== value) {
  37132. return j;
  37133. }
  37134. }
  37135. return j;
  37136. }
  37137. function setValues(arr, start, end, value) {
  37138. for (var j = start; j < end; ++j) {
  37139. arr[j] = value;
  37140. }
  37141. }
  37142. function reverseValues(arr, start, end) {
  37143. for (var i = start, j = end - 1; i < j; ++i, --j) {
  37144. var temp = arr[i];
  37145. arr[i] = arr[j];
  37146. arr[j] = temp;
  37147. }
  37148. }
  37149. function createBidiText(str, isLTR, vertical) {
  37150. return {
  37151. str: str,
  37152. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  37153. };
  37154. }
  37155. var chars = [];
  37156. var types = [];
  37157. function bidi(str, startLevel, vertical) {
  37158. var isLTR = true;
  37159. var strLength = str.length;
  37160. if (strLength === 0 || vertical) {
  37161. return createBidiText(str, isLTR, vertical);
  37162. }
  37163. chars.length = strLength;
  37164. types.length = strLength;
  37165. var numBidi = 0;
  37166. var i, ii;
  37167. for (i = 0; i < strLength; ++i) {
  37168. chars[i] = str.charAt(i);
  37169. var charCode = str.charCodeAt(i);
  37170. var charType = 'L';
  37171. if (charCode <= 0x00ff) {
  37172. charType = baseTypes[charCode];
  37173. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  37174. charType = 'R';
  37175. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  37176. charType = arabicTypes[charCode & 0xff];
  37177. if (!charType) {
  37178. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  37179. }
  37180. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  37181. charType = 'AL';
  37182. }
  37183. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  37184. numBidi++;
  37185. }
  37186. types[i] = charType;
  37187. }
  37188. if (numBidi === 0) {
  37189. isLTR = true;
  37190. return createBidiText(str, isLTR);
  37191. }
  37192. if (startLevel === -1) {
  37193. if (numBidi / strLength < 0.3) {
  37194. isLTR = true;
  37195. startLevel = 0;
  37196. } else {
  37197. isLTR = false;
  37198. startLevel = 1;
  37199. }
  37200. }
  37201. var levels = [];
  37202. for (i = 0; i < strLength; ++i) {
  37203. levels[i] = startLevel;
  37204. }
  37205. var e = isOdd(startLevel) ? 'R' : 'L';
  37206. var sor = e;
  37207. var eor = sor;
  37208. var lastType = sor;
  37209. for (i = 0; i < strLength; ++i) {
  37210. if (types[i] === 'NSM') {
  37211. types[i] = lastType;
  37212. } else {
  37213. lastType = types[i];
  37214. }
  37215. }
  37216. lastType = sor;
  37217. var t;
  37218. for (i = 0; i < strLength; ++i) {
  37219. t = types[i];
  37220. if (t === 'EN') {
  37221. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  37222. } else if (t === 'R' || t === 'L' || t === 'AL') {
  37223. lastType = t;
  37224. }
  37225. }
  37226. for (i = 0; i < strLength; ++i) {
  37227. t = types[i];
  37228. if (t === 'AL') {
  37229. types[i] = 'R';
  37230. }
  37231. }
  37232. for (i = 1; i < strLength - 1; ++i) {
  37233. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  37234. types[i] = 'EN';
  37235. }
  37236. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  37237. types[i] = types[i - 1];
  37238. }
  37239. }
  37240. for (i = 0; i < strLength; ++i) {
  37241. if (types[i] === 'EN') {
  37242. var j;
  37243. for (j = i - 1; j >= 0; --j) {
  37244. if (types[j] !== 'ET') {
  37245. break;
  37246. }
  37247. types[j] = 'EN';
  37248. }
  37249. for (j = i + 1; j < strLength; ++j) {
  37250. if (types[j] !== 'ET') {
  37251. break;
  37252. }
  37253. types[j] = 'EN';
  37254. }
  37255. }
  37256. }
  37257. for (i = 0; i < strLength; ++i) {
  37258. t = types[i];
  37259. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  37260. types[i] = 'ON';
  37261. }
  37262. }
  37263. lastType = sor;
  37264. for (i = 0; i < strLength; ++i) {
  37265. t = types[i];
  37266. if (t === 'EN') {
  37267. types[i] = lastType === 'L' ? 'L' : 'EN';
  37268. } else if (t === 'R' || t === 'L') {
  37269. lastType = t;
  37270. }
  37271. }
  37272. for (i = 0; i < strLength; ++i) {
  37273. if (types[i] === 'ON') {
  37274. var end = findUnequal(types, i + 1, 'ON');
  37275. var before = sor;
  37276. if (i > 0) {
  37277. before = types[i - 1];
  37278. }
  37279. var after = eor;
  37280. if (end + 1 < strLength) {
  37281. after = types[end + 1];
  37282. }
  37283. if (before !== 'L') {
  37284. before = 'R';
  37285. }
  37286. if (after !== 'L') {
  37287. after = 'R';
  37288. }
  37289. if (before === after) {
  37290. setValues(types, i, end, before);
  37291. }
  37292. i = end - 1;
  37293. }
  37294. }
  37295. for (i = 0; i < strLength; ++i) {
  37296. if (types[i] === 'ON') {
  37297. types[i] = e;
  37298. }
  37299. }
  37300. for (i = 0; i < strLength; ++i) {
  37301. t = types[i];
  37302. if (isEven(levels[i])) {
  37303. if (t === 'R') {
  37304. levels[i] += 1;
  37305. } else if (t === 'AN' || t === 'EN') {
  37306. levels[i] += 2;
  37307. }
  37308. } else {
  37309. if (t === 'L' || t === 'AN' || t === 'EN') {
  37310. levels[i] += 1;
  37311. }
  37312. }
  37313. }
  37314. var highestLevel = -1;
  37315. var lowestOddLevel = 99;
  37316. var level;
  37317. for (i = 0, ii = levels.length; i < ii; ++i) {
  37318. level = levels[i];
  37319. if (highestLevel < level) {
  37320. highestLevel = level;
  37321. }
  37322. if (lowestOddLevel > level && isOdd(level)) {
  37323. lowestOddLevel = level;
  37324. }
  37325. }
  37326. for (level = highestLevel; level >= lowestOddLevel; --level) {
  37327. var start = -1;
  37328. for (i = 0, ii = levels.length; i < ii; ++i) {
  37329. if (levels[i] < level) {
  37330. if (start >= 0) {
  37331. reverseValues(chars, start, i);
  37332. start = -1;
  37333. }
  37334. } else if (start < 0) {
  37335. start = i;
  37336. }
  37337. }
  37338. if (start >= 0) {
  37339. reverseValues(chars, start, levels.length);
  37340. }
  37341. }
  37342. for (i = 0, ii = chars.length; i < ii; ++i) {
  37343. var ch = chars[i];
  37344. if (ch === '<' || ch === '>') {
  37345. chars[i] = '';
  37346. }
  37347. }
  37348. return createBidiText(chars.join(''), isLTR);
  37349. }
  37350. exports.bidi = bidi;
  37351. /***/ }),
  37352. /* 22 */
  37353. /***/ (function(module, exports, __w_pdfjs_require__) {
  37354. "use strict";
  37355. var ISOAdobeCharset = [
  37356. '.notdef',
  37357. 'space',
  37358. 'exclam',
  37359. 'quotedbl',
  37360. 'numbersign',
  37361. 'dollar',
  37362. 'percent',
  37363. 'ampersand',
  37364. 'quoteright',
  37365. 'parenleft',
  37366. 'parenright',
  37367. 'asterisk',
  37368. 'plus',
  37369. 'comma',
  37370. 'hyphen',
  37371. 'period',
  37372. 'slash',
  37373. 'zero',
  37374. 'one',
  37375. 'two',
  37376. 'three',
  37377. 'four',
  37378. 'five',
  37379. 'six',
  37380. 'seven',
  37381. 'eight',
  37382. 'nine',
  37383. 'colon',
  37384. 'semicolon',
  37385. 'less',
  37386. 'equal',
  37387. 'greater',
  37388. 'question',
  37389. 'at',
  37390. 'A',
  37391. 'B',
  37392. 'C',
  37393. 'D',
  37394. 'E',
  37395. 'F',
  37396. 'G',
  37397. 'H',
  37398. 'I',
  37399. 'J',
  37400. 'K',
  37401. 'L',
  37402. 'M',
  37403. 'N',
  37404. 'O',
  37405. 'P',
  37406. 'Q',
  37407. 'R',
  37408. 'S',
  37409. 'T',
  37410. 'U',
  37411. 'V',
  37412. 'W',
  37413. 'X',
  37414. 'Y',
  37415. 'Z',
  37416. 'bracketleft',
  37417. 'backslash',
  37418. 'bracketright',
  37419. 'asciicircum',
  37420. 'underscore',
  37421. 'quoteleft',
  37422. 'a',
  37423. 'b',
  37424. 'c',
  37425. 'd',
  37426. 'e',
  37427. 'f',
  37428. 'g',
  37429. 'h',
  37430. 'i',
  37431. 'j',
  37432. 'k',
  37433. 'l',
  37434. 'm',
  37435. 'n',
  37436. 'o',
  37437. 'p',
  37438. 'q',
  37439. 'r',
  37440. 's',
  37441. 't',
  37442. 'u',
  37443. 'v',
  37444. 'w',
  37445. 'x',
  37446. 'y',
  37447. 'z',
  37448. 'braceleft',
  37449. 'bar',
  37450. 'braceright',
  37451. 'asciitilde',
  37452. 'exclamdown',
  37453. 'cent',
  37454. 'sterling',
  37455. 'fraction',
  37456. 'yen',
  37457. 'florin',
  37458. 'section',
  37459. 'currency',
  37460. 'quotesingle',
  37461. 'quotedblleft',
  37462. 'guillemotleft',
  37463. 'guilsinglleft',
  37464. 'guilsinglright',
  37465. 'fi',
  37466. 'fl',
  37467. 'endash',
  37468. 'dagger',
  37469. 'daggerdbl',
  37470. 'periodcentered',
  37471. 'paragraph',
  37472. 'bullet',
  37473. 'quotesinglbase',
  37474. 'quotedblbase',
  37475. 'quotedblright',
  37476. 'guillemotright',
  37477. 'ellipsis',
  37478. 'perthousand',
  37479. 'questiondown',
  37480. 'grave',
  37481. 'acute',
  37482. 'circumflex',
  37483. 'tilde',
  37484. 'macron',
  37485. 'breve',
  37486. 'dotaccent',
  37487. 'dieresis',
  37488. 'ring',
  37489. 'cedilla',
  37490. 'hungarumlaut',
  37491. 'ogonek',
  37492. 'caron',
  37493. 'emdash',
  37494. 'AE',
  37495. 'ordfeminine',
  37496. 'Lslash',
  37497. 'Oslash',
  37498. 'OE',
  37499. 'ordmasculine',
  37500. 'ae',
  37501. 'dotlessi',
  37502. 'lslash',
  37503. 'oslash',
  37504. 'oe',
  37505. 'germandbls',
  37506. 'onesuperior',
  37507. 'logicalnot',
  37508. 'mu',
  37509. 'trademark',
  37510. 'Eth',
  37511. 'onehalf',
  37512. 'plusminus',
  37513. 'Thorn',
  37514. 'onequarter',
  37515. 'divide',
  37516. 'brokenbar',
  37517. 'degree',
  37518. 'thorn',
  37519. 'threequarters',
  37520. 'twosuperior',
  37521. 'registered',
  37522. 'minus',
  37523. 'eth',
  37524. 'multiply',
  37525. 'threesuperior',
  37526. 'copyright',
  37527. 'Aacute',
  37528. 'Acircumflex',
  37529. 'Adieresis',
  37530. 'Agrave',
  37531. 'Aring',
  37532. 'Atilde',
  37533. 'Ccedilla',
  37534. 'Eacute',
  37535. 'Ecircumflex',
  37536. 'Edieresis',
  37537. 'Egrave',
  37538. 'Iacute',
  37539. 'Icircumflex',
  37540. 'Idieresis',
  37541. 'Igrave',
  37542. 'Ntilde',
  37543. 'Oacute',
  37544. 'Ocircumflex',
  37545. 'Odieresis',
  37546. 'Ograve',
  37547. 'Otilde',
  37548. 'Scaron',
  37549. 'Uacute',
  37550. 'Ucircumflex',
  37551. 'Udieresis',
  37552. 'Ugrave',
  37553. 'Yacute',
  37554. 'Ydieresis',
  37555. 'Zcaron',
  37556. 'aacute',
  37557. 'acircumflex',
  37558. 'adieresis',
  37559. 'agrave',
  37560. 'aring',
  37561. 'atilde',
  37562. 'ccedilla',
  37563. 'eacute',
  37564. 'ecircumflex',
  37565. 'edieresis',
  37566. 'egrave',
  37567. 'iacute',
  37568. 'icircumflex',
  37569. 'idieresis',
  37570. 'igrave',
  37571. 'ntilde',
  37572. 'oacute',
  37573. 'ocircumflex',
  37574. 'odieresis',
  37575. 'ograve',
  37576. 'otilde',
  37577. 'scaron',
  37578. 'uacute',
  37579. 'ucircumflex',
  37580. 'udieresis',
  37581. 'ugrave',
  37582. 'yacute',
  37583. 'ydieresis',
  37584. 'zcaron'
  37585. ];
  37586. var ExpertCharset = [
  37587. '.notdef',
  37588. 'space',
  37589. 'exclamsmall',
  37590. 'Hungarumlautsmall',
  37591. 'dollaroldstyle',
  37592. 'dollarsuperior',
  37593. 'ampersandsmall',
  37594. 'Acutesmall',
  37595. 'parenleftsuperior',
  37596. 'parenrightsuperior',
  37597. 'twodotenleader',
  37598. 'onedotenleader',
  37599. 'comma',
  37600. 'hyphen',
  37601. 'period',
  37602. 'fraction',
  37603. 'zerooldstyle',
  37604. 'oneoldstyle',
  37605. 'twooldstyle',
  37606. 'threeoldstyle',
  37607. 'fouroldstyle',
  37608. 'fiveoldstyle',
  37609. 'sixoldstyle',
  37610. 'sevenoldstyle',
  37611. 'eightoldstyle',
  37612. 'nineoldstyle',
  37613. 'colon',
  37614. 'semicolon',
  37615. 'commasuperior',
  37616. 'threequartersemdash',
  37617. 'periodsuperior',
  37618. 'questionsmall',
  37619. 'asuperior',
  37620. 'bsuperior',
  37621. 'centsuperior',
  37622. 'dsuperior',
  37623. 'esuperior',
  37624. 'isuperior',
  37625. 'lsuperior',
  37626. 'msuperior',
  37627. 'nsuperior',
  37628. 'osuperior',
  37629. 'rsuperior',
  37630. 'ssuperior',
  37631. 'tsuperior',
  37632. 'ff',
  37633. 'fi',
  37634. 'fl',
  37635. 'ffi',
  37636. 'ffl',
  37637. 'parenleftinferior',
  37638. 'parenrightinferior',
  37639. 'Circumflexsmall',
  37640. 'hyphensuperior',
  37641. 'Gravesmall',
  37642. 'Asmall',
  37643. 'Bsmall',
  37644. 'Csmall',
  37645. 'Dsmall',
  37646. 'Esmall',
  37647. 'Fsmall',
  37648. 'Gsmall',
  37649. 'Hsmall',
  37650. 'Ismall',
  37651. 'Jsmall',
  37652. 'Ksmall',
  37653. 'Lsmall',
  37654. 'Msmall',
  37655. 'Nsmall',
  37656. 'Osmall',
  37657. 'Psmall',
  37658. 'Qsmall',
  37659. 'Rsmall',
  37660. 'Ssmall',
  37661. 'Tsmall',
  37662. 'Usmall',
  37663. 'Vsmall',
  37664. 'Wsmall',
  37665. 'Xsmall',
  37666. 'Ysmall',
  37667. 'Zsmall',
  37668. 'colonmonetary',
  37669. 'onefitted',
  37670. 'rupiah',
  37671. 'Tildesmall',
  37672. 'exclamdownsmall',
  37673. 'centoldstyle',
  37674. 'Lslashsmall',
  37675. 'Scaronsmall',
  37676. 'Zcaronsmall',
  37677. 'Dieresissmall',
  37678. 'Brevesmall',
  37679. 'Caronsmall',
  37680. 'Dotaccentsmall',
  37681. 'Macronsmall',
  37682. 'figuredash',
  37683. 'hypheninferior',
  37684. 'Ogoneksmall',
  37685. 'Ringsmall',
  37686. 'Cedillasmall',
  37687. 'onequarter',
  37688. 'onehalf',
  37689. 'threequarters',
  37690. 'questiondownsmall',
  37691. 'oneeighth',
  37692. 'threeeighths',
  37693. 'fiveeighths',
  37694. 'seveneighths',
  37695. 'onethird',
  37696. 'twothirds',
  37697. 'zerosuperior',
  37698. 'onesuperior',
  37699. 'twosuperior',
  37700. 'threesuperior',
  37701. 'foursuperior',
  37702. 'fivesuperior',
  37703. 'sixsuperior',
  37704. 'sevensuperior',
  37705. 'eightsuperior',
  37706. 'ninesuperior',
  37707. 'zeroinferior',
  37708. 'oneinferior',
  37709. 'twoinferior',
  37710. 'threeinferior',
  37711. 'fourinferior',
  37712. 'fiveinferior',
  37713. 'sixinferior',
  37714. 'seveninferior',
  37715. 'eightinferior',
  37716. 'nineinferior',
  37717. 'centinferior',
  37718. 'dollarinferior',
  37719. 'periodinferior',
  37720. 'commainferior',
  37721. 'Agravesmall',
  37722. 'Aacutesmall',
  37723. 'Acircumflexsmall',
  37724. 'Atildesmall',
  37725. 'Adieresissmall',
  37726. 'Aringsmall',
  37727. 'AEsmall',
  37728. 'Ccedillasmall',
  37729. 'Egravesmall',
  37730. 'Eacutesmall',
  37731. 'Ecircumflexsmall',
  37732. 'Edieresissmall',
  37733. 'Igravesmall',
  37734. 'Iacutesmall',
  37735. 'Icircumflexsmall',
  37736. 'Idieresissmall',
  37737. 'Ethsmall',
  37738. 'Ntildesmall',
  37739. 'Ogravesmall',
  37740. 'Oacutesmall',
  37741. 'Ocircumflexsmall',
  37742. 'Otildesmall',
  37743. 'Odieresissmall',
  37744. 'OEsmall',
  37745. 'Oslashsmall',
  37746. 'Ugravesmall',
  37747. 'Uacutesmall',
  37748. 'Ucircumflexsmall',
  37749. 'Udieresissmall',
  37750. 'Yacutesmall',
  37751. 'Thornsmall',
  37752. 'Ydieresissmall'
  37753. ];
  37754. var ExpertSubsetCharset = [
  37755. '.notdef',
  37756. 'space',
  37757. 'dollaroldstyle',
  37758. 'dollarsuperior',
  37759. 'parenleftsuperior',
  37760. 'parenrightsuperior',
  37761. 'twodotenleader',
  37762. 'onedotenleader',
  37763. 'comma',
  37764. 'hyphen',
  37765. 'period',
  37766. 'fraction',
  37767. 'zerooldstyle',
  37768. 'oneoldstyle',
  37769. 'twooldstyle',
  37770. 'threeoldstyle',
  37771. 'fouroldstyle',
  37772. 'fiveoldstyle',
  37773. 'sixoldstyle',
  37774. 'sevenoldstyle',
  37775. 'eightoldstyle',
  37776. 'nineoldstyle',
  37777. 'colon',
  37778. 'semicolon',
  37779. 'commasuperior',
  37780. 'threequartersemdash',
  37781. 'periodsuperior',
  37782. 'asuperior',
  37783. 'bsuperior',
  37784. 'centsuperior',
  37785. 'dsuperior',
  37786. 'esuperior',
  37787. 'isuperior',
  37788. 'lsuperior',
  37789. 'msuperior',
  37790. 'nsuperior',
  37791. 'osuperior',
  37792. 'rsuperior',
  37793. 'ssuperior',
  37794. 'tsuperior',
  37795. 'ff',
  37796. 'fi',
  37797. 'fl',
  37798. 'ffi',
  37799. 'ffl',
  37800. 'parenleftinferior',
  37801. 'parenrightinferior',
  37802. 'hyphensuperior',
  37803. 'colonmonetary',
  37804. 'onefitted',
  37805. 'rupiah',
  37806. 'centoldstyle',
  37807. 'figuredash',
  37808. 'hypheninferior',
  37809. 'onequarter',
  37810. 'onehalf',
  37811. 'threequarters',
  37812. 'oneeighth',
  37813. 'threeeighths',
  37814. 'fiveeighths',
  37815. 'seveneighths',
  37816. 'onethird',
  37817. 'twothirds',
  37818. 'zerosuperior',
  37819. 'onesuperior',
  37820. 'twosuperior',
  37821. 'threesuperior',
  37822. 'foursuperior',
  37823. 'fivesuperior',
  37824. 'sixsuperior',
  37825. 'sevensuperior',
  37826. 'eightsuperior',
  37827. 'ninesuperior',
  37828. 'zeroinferior',
  37829. 'oneinferior',
  37830. 'twoinferior',
  37831. 'threeinferior',
  37832. 'fourinferior',
  37833. 'fiveinferior',
  37834. 'sixinferior',
  37835. 'seveninferior',
  37836. 'eightinferior',
  37837. 'nineinferior',
  37838. 'centinferior',
  37839. 'dollarinferior',
  37840. 'periodinferior',
  37841. 'commainferior'
  37842. ];
  37843. exports.ISOAdobeCharset = ISOAdobeCharset;
  37844. exports.ExpertCharset = ExpertCharset;
  37845. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  37846. /***/ }),
  37847. /* 23 */
  37848. /***/ (function(module, exports, __w_pdfjs_require__) {
  37849. "use strict";
  37850. var sharedUtil = __w_pdfjs_require__(0);
  37851. var corePrimitives = __w_pdfjs_require__(1);
  37852. var coreStream = __w_pdfjs_require__(2);
  37853. var coreParser = __w_pdfjs_require__(5);
  37854. var Util = sharedUtil.Util;
  37855. var assert = sharedUtil.assert;
  37856. var warn = sharedUtil.warn;
  37857. var error = sharedUtil.error;
  37858. var isInt = sharedUtil.isInt;
  37859. var isString = sharedUtil.isString;
  37860. var MissingDataException = sharedUtil.MissingDataException;
  37861. var CMapCompressionType = sharedUtil.CMapCompressionType;
  37862. var isEOF = corePrimitives.isEOF;
  37863. var isName = corePrimitives.isName;
  37864. var isCmd = corePrimitives.isCmd;
  37865. var isStream = corePrimitives.isStream;
  37866. var Stream = coreStream.Stream;
  37867. var Lexer = coreParser.Lexer;
  37868. var BUILT_IN_CMAPS = [
  37869. 'Adobe-GB1-UCS2',
  37870. 'Adobe-CNS1-UCS2',
  37871. 'Adobe-Japan1-UCS2',
  37872. 'Adobe-Korea1-UCS2',
  37873. '78-EUC-H',
  37874. '78-EUC-V',
  37875. '78-H',
  37876. '78-RKSJ-H',
  37877. '78-RKSJ-V',
  37878. '78-V',
  37879. '78ms-RKSJ-H',
  37880. '78ms-RKSJ-V',
  37881. '83pv-RKSJ-H',
  37882. '90ms-RKSJ-H',
  37883. '90ms-RKSJ-V',
  37884. '90msp-RKSJ-H',
  37885. '90msp-RKSJ-V',
  37886. '90pv-RKSJ-H',
  37887. '90pv-RKSJ-V',
  37888. 'Add-H',
  37889. 'Add-RKSJ-H',
  37890. 'Add-RKSJ-V',
  37891. 'Add-V',
  37892. 'Adobe-CNS1-0',
  37893. 'Adobe-CNS1-1',
  37894. 'Adobe-CNS1-2',
  37895. 'Adobe-CNS1-3',
  37896. 'Adobe-CNS1-4',
  37897. 'Adobe-CNS1-5',
  37898. 'Adobe-CNS1-6',
  37899. 'Adobe-GB1-0',
  37900. 'Adobe-GB1-1',
  37901. 'Adobe-GB1-2',
  37902. 'Adobe-GB1-3',
  37903. 'Adobe-GB1-4',
  37904. 'Adobe-GB1-5',
  37905. 'Adobe-Japan1-0',
  37906. 'Adobe-Japan1-1',
  37907. 'Adobe-Japan1-2',
  37908. 'Adobe-Japan1-3',
  37909. 'Adobe-Japan1-4',
  37910. 'Adobe-Japan1-5',
  37911. 'Adobe-Japan1-6',
  37912. 'Adobe-Korea1-0',
  37913. 'Adobe-Korea1-1',
  37914. 'Adobe-Korea1-2',
  37915. 'B5-H',
  37916. 'B5-V',
  37917. 'B5pc-H',
  37918. 'B5pc-V',
  37919. 'CNS-EUC-H',
  37920. 'CNS-EUC-V',
  37921. 'CNS1-H',
  37922. 'CNS1-V',
  37923. 'CNS2-H',
  37924. 'CNS2-V',
  37925. 'ETHK-B5-H',
  37926. 'ETHK-B5-V',
  37927. 'ETen-B5-H',
  37928. 'ETen-B5-V',
  37929. 'ETenms-B5-H',
  37930. 'ETenms-B5-V',
  37931. 'EUC-H',
  37932. 'EUC-V',
  37933. 'Ext-H',
  37934. 'Ext-RKSJ-H',
  37935. 'Ext-RKSJ-V',
  37936. 'Ext-V',
  37937. 'GB-EUC-H',
  37938. 'GB-EUC-V',
  37939. 'GB-H',
  37940. 'GB-V',
  37941. 'GBK-EUC-H',
  37942. 'GBK-EUC-V',
  37943. 'GBK2K-H',
  37944. 'GBK2K-V',
  37945. 'GBKp-EUC-H',
  37946. 'GBKp-EUC-V',
  37947. 'GBT-EUC-H',
  37948. 'GBT-EUC-V',
  37949. 'GBT-H',
  37950. 'GBT-V',
  37951. 'GBTpc-EUC-H',
  37952. 'GBTpc-EUC-V',
  37953. 'GBpc-EUC-H',
  37954. 'GBpc-EUC-V',
  37955. 'H',
  37956. 'HKdla-B5-H',
  37957. 'HKdla-B5-V',
  37958. 'HKdlb-B5-H',
  37959. 'HKdlb-B5-V',
  37960. 'HKgccs-B5-H',
  37961. 'HKgccs-B5-V',
  37962. 'HKm314-B5-H',
  37963. 'HKm314-B5-V',
  37964. 'HKm471-B5-H',
  37965. 'HKm471-B5-V',
  37966. 'HKscs-B5-H',
  37967. 'HKscs-B5-V',
  37968. 'Hankaku',
  37969. 'Hiragana',
  37970. 'KSC-EUC-H',
  37971. 'KSC-EUC-V',
  37972. 'KSC-H',
  37973. 'KSC-Johab-H',
  37974. 'KSC-Johab-V',
  37975. 'KSC-V',
  37976. 'KSCms-UHC-H',
  37977. 'KSCms-UHC-HW-H',
  37978. 'KSCms-UHC-HW-V',
  37979. 'KSCms-UHC-V',
  37980. 'KSCpc-EUC-H',
  37981. 'KSCpc-EUC-V',
  37982. 'Katakana',
  37983. 'NWP-H',
  37984. 'NWP-V',
  37985. 'RKSJ-H',
  37986. 'RKSJ-V',
  37987. 'Roman',
  37988. 'UniCNS-UCS2-H',
  37989. 'UniCNS-UCS2-V',
  37990. 'UniCNS-UTF16-H',
  37991. 'UniCNS-UTF16-V',
  37992. 'UniCNS-UTF32-H',
  37993. 'UniCNS-UTF32-V',
  37994. 'UniCNS-UTF8-H',
  37995. 'UniCNS-UTF8-V',
  37996. 'UniGB-UCS2-H',
  37997. 'UniGB-UCS2-V',
  37998. 'UniGB-UTF16-H',
  37999. 'UniGB-UTF16-V',
  38000. 'UniGB-UTF32-H',
  38001. 'UniGB-UTF32-V',
  38002. 'UniGB-UTF8-H',
  38003. 'UniGB-UTF8-V',
  38004. 'UniJIS-UCS2-H',
  38005. 'UniJIS-UCS2-HW-H',
  38006. 'UniJIS-UCS2-HW-V',
  38007. 'UniJIS-UCS2-V',
  38008. 'UniJIS-UTF16-H',
  38009. 'UniJIS-UTF16-V',
  38010. 'UniJIS-UTF32-H',
  38011. 'UniJIS-UTF32-V',
  38012. 'UniJIS-UTF8-H',
  38013. 'UniJIS-UTF8-V',
  38014. 'UniJIS2004-UTF16-H',
  38015. 'UniJIS2004-UTF16-V',
  38016. 'UniJIS2004-UTF32-H',
  38017. 'UniJIS2004-UTF32-V',
  38018. 'UniJIS2004-UTF8-H',
  38019. 'UniJIS2004-UTF8-V',
  38020. 'UniJISPro-UCS2-HW-V',
  38021. 'UniJISPro-UCS2-V',
  38022. 'UniJISPro-UTF8-V',
  38023. 'UniJISX0213-UTF32-H',
  38024. 'UniJISX0213-UTF32-V',
  38025. 'UniJISX02132004-UTF32-H',
  38026. 'UniJISX02132004-UTF32-V',
  38027. 'UniKS-UCS2-H',
  38028. 'UniKS-UCS2-V',
  38029. 'UniKS-UTF16-H',
  38030. 'UniKS-UTF16-V',
  38031. 'UniKS-UTF32-H',
  38032. 'UniKS-UTF32-V',
  38033. 'UniKS-UTF8-H',
  38034. 'UniKS-UTF8-V',
  38035. 'V',
  38036. 'WP-Symbol'
  38037. ];
  38038. var CMap = function CMapClosure() {
  38039. function CMap(builtInCMap) {
  38040. this.codespaceRanges = [
  38041. [],
  38042. [],
  38043. [],
  38044. []
  38045. ];
  38046. this.numCodespaceRanges = 0;
  38047. this._map = [];
  38048. this.name = '';
  38049. this.vertical = false;
  38050. this.useCMap = null;
  38051. this.builtInCMap = builtInCMap;
  38052. }
  38053. CMap.prototype = {
  38054. addCodespaceRange: function (n, low, high) {
  38055. this.codespaceRanges[n - 1].push(low, high);
  38056. this.numCodespaceRanges++;
  38057. },
  38058. mapCidRange: function (low, high, dstLow) {
  38059. while (low <= high) {
  38060. this._map[low++] = dstLow++;
  38061. }
  38062. },
  38063. mapBfRange: function (low, high, dstLow) {
  38064. var lastByte = dstLow.length - 1;
  38065. while (low <= high) {
  38066. this._map[low++] = dstLow;
  38067. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  38068. }
  38069. },
  38070. mapBfRangeToArray: function (low, high, array) {
  38071. var i = 0, ii = array.length;
  38072. while (low <= high && i < ii) {
  38073. this._map[low] = array[i++];
  38074. ++low;
  38075. }
  38076. },
  38077. mapOne: function (src, dst) {
  38078. this._map[src] = dst;
  38079. },
  38080. lookup: function (code) {
  38081. return this._map[code];
  38082. },
  38083. contains: function (code) {
  38084. return this._map[code] !== undefined;
  38085. },
  38086. forEach: function (callback) {
  38087. var map = this._map;
  38088. var length = map.length;
  38089. var i;
  38090. if (length <= 0x10000) {
  38091. for (i = 0; i < length; i++) {
  38092. if (map[i] !== undefined) {
  38093. callback(i, map[i]);
  38094. }
  38095. }
  38096. } else {
  38097. for (i in this._map) {
  38098. callback(i, map[i]);
  38099. }
  38100. }
  38101. },
  38102. charCodeOf: function (value) {
  38103. return this._map.indexOf(value);
  38104. },
  38105. getMap: function () {
  38106. return this._map;
  38107. },
  38108. readCharCode: function (str, offset, out) {
  38109. var c = 0;
  38110. var codespaceRanges = this.codespaceRanges;
  38111. var codespaceRangesLen = this.codespaceRanges.length;
  38112. for (var n = 0; n < codespaceRangesLen; n++) {
  38113. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  38114. var codespaceRange = codespaceRanges[n];
  38115. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  38116. var low = codespaceRange[k++];
  38117. var high = codespaceRange[k++];
  38118. if (c >= low && c <= high) {
  38119. out.charcode = c;
  38120. out.length = n + 1;
  38121. return;
  38122. }
  38123. }
  38124. }
  38125. out.charcode = 0;
  38126. out.length = 1;
  38127. },
  38128. get length() {
  38129. return this._map.length;
  38130. },
  38131. get isIdentityCMap() {
  38132. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  38133. return false;
  38134. }
  38135. if (this._map.length !== 0x10000) {
  38136. return false;
  38137. }
  38138. for (var i = 0; i < 0x10000; i++) {
  38139. if (this._map[i] !== i) {
  38140. return false;
  38141. }
  38142. }
  38143. return true;
  38144. }
  38145. };
  38146. return CMap;
  38147. }();
  38148. var IdentityCMap = function IdentityCMapClosure() {
  38149. function IdentityCMap(vertical, n) {
  38150. CMap.call(this);
  38151. this.vertical = vertical;
  38152. this.addCodespaceRange(n, 0, 0xffff);
  38153. }
  38154. Util.inherit(IdentityCMap, CMap, {});
  38155. IdentityCMap.prototype = {
  38156. addCodespaceRange: CMap.prototype.addCodespaceRange,
  38157. mapCidRange: function (low, high, dstLow) {
  38158. error('should not call mapCidRange');
  38159. },
  38160. mapBfRange: function (low, high, dstLow) {
  38161. error('should not call mapBfRange');
  38162. },
  38163. mapBfRangeToArray: function (low, high, array) {
  38164. error('should not call mapBfRangeToArray');
  38165. },
  38166. mapOne: function (src, dst) {
  38167. error('should not call mapCidOne');
  38168. },
  38169. lookup: function (code) {
  38170. return isInt(code) && code <= 0xffff ? code : undefined;
  38171. },
  38172. contains: function (code) {
  38173. return isInt(code) && code <= 0xffff;
  38174. },
  38175. forEach: function (callback) {
  38176. for (var i = 0; i <= 0xffff; i++) {
  38177. callback(i, i);
  38178. }
  38179. },
  38180. charCodeOf: function (value) {
  38181. return isInt(value) && value <= 0xffff ? value : -1;
  38182. },
  38183. getMap: function () {
  38184. var map = new Array(0x10000);
  38185. for (var i = 0; i <= 0xffff; i++) {
  38186. map[i] = i;
  38187. }
  38188. return map;
  38189. },
  38190. readCharCode: CMap.prototype.readCharCode,
  38191. get length() {
  38192. return 0x10000;
  38193. },
  38194. get isIdentityCMap() {
  38195. error('should not access .isIdentityCMap');
  38196. }
  38197. };
  38198. return IdentityCMap;
  38199. }();
  38200. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  38201. function hexToInt(a, size) {
  38202. var n = 0;
  38203. for (var i = 0; i <= size; i++) {
  38204. n = n << 8 | a[i];
  38205. }
  38206. return n >>> 0;
  38207. }
  38208. function hexToStr(a, size) {
  38209. if (size === 1) {
  38210. return String.fromCharCode(a[0], a[1]);
  38211. }
  38212. if (size === 3) {
  38213. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  38214. }
  38215. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  38216. }
  38217. function addHex(a, b, size) {
  38218. var c = 0;
  38219. for (var i = size; i >= 0; i--) {
  38220. c += a[i] + b[i];
  38221. a[i] = c & 255;
  38222. c >>= 8;
  38223. }
  38224. }
  38225. function incHex(a, size) {
  38226. var c = 1;
  38227. for (var i = size; i >= 0 && c > 0; i--) {
  38228. c += a[i];
  38229. a[i] = c & 255;
  38230. c >>= 8;
  38231. }
  38232. }
  38233. var MAX_NUM_SIZE = 16;
  38234. var MAX_ENCODED_NUM_SIZE = 19;
  38235. function BinaryCMapStream(data) {
  38236. this.buffer = data;
  38237. this.pos = 0;
  38238. this.end = data.length;
  38239. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  38240. }
  38241. BinaryCMapStream.prototype = {
  38242. readByte: function () {
  38243. if (this.pos >= this.end) {
  38244. return -1;
  38245. }
  38246. return this.buffer[this.pos++];
  38247. },
  38248. readNumber: function () {
  38249. var n = 0;
  38250. var last;
  38251. do {
  38252. var b = this.readByte();
  38253. if (b < 0) {
  38254. error('unexpected EOF in bcmap');
  38255. }
  38256. last = !(b & 0x80);
  38257. n = n << 7 | b & 0x7F;
  38258. } while (!last);
  38259. return n;
  38260. },
  38261. readSigned: function () {
  38262. var n = this.readNumber();
  38263. return n & 1 ? ~(n >>> 1) : n >>> 1;
  38264. },
  38265. readHex: function (num, size) {
  38266. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  38267. this.pos += size + 1;
  38268. },
  38269. readHexNumber: function (num, size) {
  38270. var last;
  38271. var stack = this.tmpBuf, sp = 0;
  38272. do {
  38273. var b = this.readByte();
  38274. if (b < 0) {
  38275. error('unexpected EOF in bcmap');
  38276. }
  38277. last = !(b & 0x80);
  38278. stack[sp++] = b & 0x7F;
  38279. } while (!last);
  38280. var i = size, buffer = 0, bufferSize = 0;
  38281. while (i >= 0) {
  38282. while (bufferSize < 8 && stack.length > 0) {
  38283. buffer = stack[--sp] << bufferSize | buffer;
  38284. bufferSize += 7;
  38285. }
  38286. num[i] = buffer & 255;
  38287. i--;
  38288. buffer >>= 8;
  38289. bufferSize -= 8;
  38290. }
  38291. },
  38292. readHexSigned: function (num, size) {
  38293. this.readHexNumber(num, size);
  38294. var sign = num[size] & 1 ? 255 : 0;
  38295. var c = 0;
  38296. for (var i = 0; i <= size; i++) {
  38297. c = (c & 1) << 8 | num[i];
  38298. num[i] = c >> 1 ^ sign;
  38299. }
  38300. },
  38301. readString: function () {
  38302. var len = this.readNumber();
  38303. var s = '';
  38304. for (var i = 0; i < len; i++) {
  38305. s += String.fromCharCode(this.readNumber());
  38306. }
  38307. return s;
  38308. }
  38309. };
  38310. function processBinaryCMap(data, cMap, extend) {
  38311. return new Promise(function (resolve, reject) {
  38312. var stream = new BinaryCMapStream(data);
  38313. var header = stream.readByte();
  38314. cMap.vertical = !!(header & 1);
  38315. var useCMap = null;
  38316. var start = new Uint8Array(MAX_NUM_SIZE);
  38317. var end = new Uint8Array(MAX_NUM_SIZE);
  38318. var char = new Uint8Array(MAX_NUM_SIZE);
  38319. var charCode = new Uint8Array(MAX_NUM_SIZE);
  38320. var tmp = new Uint8Array(MAX_NUM_SIZE);
  38321. var code;
  38322. var b;
  38323. while ((b = stream.readByte()) >= 0) {
  38324. var type = b >> 5;
  38325. if (type === 7) {
  38326. switch (b & 0x1F) {
  38327. case 0:
  38328. stream.readString();
  38329. break;
  38330. case 1:
  38331. useCMap = stream.readString();
  38332. break;
  38333. }
  38334. continue;
  38335. }
  38336. var sequence = !!(b & 0x10);
  38337. var dataSize = b & 15;
  38338. assert(dataSize + 1 <= MAX_NUM_SIZE);
  38339. var ucs2DataSize = 1;
  38340. var subitemsCount = stream.readNumber();
  38341. var i;
  38342. switch (type) {
  38343. case 0:
  38344. stream.readHex(start, dataSize);
  38345. stream.readHexNumber(end, dataSize);
  38346. addHex(end, start, dataSize);
  38347. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38348. for (i = 1; i < subitemsCount; i++) {
  38349. incHex(end, dataSize);
  38350. stream.readHexNumber(start, dataSize);
  38351. addHex(start, end, dataSize);
  38352. stream.readHexNumber(end, dataSize);
  38353. addHex(end, start, dataSize);
  38354. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38355. }
  38356. break;
  38357. case 1:
  38358. stream.readHex(start, dataSize);
  38359. stream.readHexNumber(end, dataSize);
  38360. addHex(end, start, dataSize);
  38361. code = stream.readNumber();
  38362. for (i = 1; i < subitemsCount; i++) {
  38363. incHex(end, dataSize);
  38364. stream.readHexNumber(start, dataSize);
  38365. addHex(start, end, dataSize);
  38366. stream.readHexNumber(end, dataSize);
  38367. addHex(end, start, dataSize);
  38368. code = stream.readNumber();
  38369. }
  38370. break;
  38371. case 2:
  38372. stream.readHex(char, dataSize);
  38373. code = stream.readNumber();
  38374. cMap.mapOne(hexToInt(char, dataSize), code);
  38375. for (i = 1; i < subitemsCount; i++) {
  38376. incHex(char, dataSize);
  38377. if (!sequence) {
  38378. stream.readHexNumber(tmp, dataSize);
  38379. addHex(char, tmp, dataSize);
  38380. }
  38381. code = stream.readSigned() + (code + 1);
  38382. cMap.mapOne(hexToInt(char, dataSize), code);
  38383. }
  38384. break;
  38385. case 3:
  38386. stream.readHex(start, dataSize);
  38387. stream.readHexNumber(end, dataSize);
  38388. addHex(end, start, dataSize);
  38389. code = stream.readNumber();
  38390. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38391. for (i = 1; i < subitemsCount; i++) {
  38392. incHex(end, dataSize);
  38393. if (!sequence) {
  38394. stream.readHexNumber(start, dataSize);
  38395. addHex(start, end, dataSize);
  38396. } else {
  38397. start.set(end);
  38398. }
  38399. stream.readHexNumber(end, dataSize);
  38400. addHex(end, start, dataSize);
  38401. code = stream.readNumber();
  38402. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38403. }
  38404. break;
  38405. case 4:
  38406. stream.readHex(char, ucs2DataSize);
  38407. stream.readHex(charCode, dataSize);
  38408. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38409. for (i = 1; i < subitemsCount; i++) {
  38410. incHex(char, ucs2DataSize);
  38411. if (!sequence) {
  38412. stream.readHexNumber(tmp, ucs2DataSize);
  38413. addHex(char, tmp, ucs2DataSize);
  38414. }
  38415. incHex(charCode, dataSize);
  38416. stream.readHexSigned(tmp, dataSize);
  38417. addHex(charCode, tmp, dataSize);
  38418. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38419. }
  38420. break;
  38421. case 5:
  38422. stream.readHex(start, ucs2DataSize);
  38423. stream.readHexNumber(end, ucs2DataSize);
  38424. addHex(end, start, ucs2DataSize);
  38425. stream.readHex(charCode, dataSize);
  38426. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38427. for (i = 1; i < subitemsCount; i++) {
  38428. incHex(end, ucs2DataSize);
  38429. if (!sequence) {
  38430. stream.readHexNumber(start, ucs2DataSize);
  38431. addHex(start, end, ucs2DataSize);
  38432. } else {
  38433. start.set(end);
  38434. }
  38435. stream.readHexNumber(end, ucs2DataSize);
  38436. addHex(end, start, ucs2DataSize);
  38437. stream.readHex(charCode, dataSize);
  38438. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38439. }
  38440. break;
  38441. default:
  38442. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  38443. return;
  38444. }
  38445. }
  38446. if (useCMap) {
  38447. resolve(extend(useCMap));
  38448. return;
  38449. }
  38450. resolve(cMap);
  38451. });
  38452. }
  38453. function BinaryCMapReader() {
  38454. }
  38455. BinaryCMapReader.prototype = { process: processBinaryCMap };
  38456. return BinaryCMapReader;
  38457. }();
  38458. var CMapFactory = function CMapFactoryClosure() {
  38459. function strToInt(str) {
  38460. var a = 0;
  38461. for (var i = 0; i < str.length; i++) {
  38462. a = a << 8 | str.charCodeAt(i);
  38463. }
  38464. return a >>> 0;
  38465. }
  38466. function expectString(obj) {
  38467. if (!isString(obj)) {
  38468. error('Malformed CMap: expected string.');
  38469. }
  38470. }
  38471. function expectInt(obj) {
  38472. if (!isInt(obj)) {
  38473. error('Malformed CMap: expected int.');
  38474. }
  38475. }
  38476. function parseBfChar(cMap, lexer) {
  38477. while (true) {
  38478. var obj = lexer.getObj();
  38479. if (isEOF(obj)) {
  38480. break;
  38481. }
  38482. if (isCmd(obj, 'endbfchar')) {
  38483. return;
  38484. }
  38485. expectString(obj);
  38486. var src = strToInt(obj);
  38487. obj = lexer.getObj();
  38488. expectString(obj);
  38489. var dst = obj;
  38490. cMap.mapOne(src, dst);
  38491. }
  38492. }
  38493. function parseBfRange(cMap, lexer) {
  38494. while (true) {
  38495. var obj = lexer.getObj();
  38496. if (isEOF(obj)) {
  38497. break;
  38498. }
  38499. if (isCmd(obj, 'endbfrange')) {
  38500. return;
  38501. }
  38502. expectString(obj);
  38503. var low = strToInt(obj);
  38504. obj = lexer.getObj();
  38505. expectString(obj);
  38506. var high = strToInt(obj);
  38507. obj = lexer.getObj();
  38508. if (isInt(obj) || isString(obj)) {
  38509. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  38510. cMap.mapBfRange(low, high, dstLow);
  38511. } else if (isCmd(obj, '[')) {
  38512. obj = lexer.getObj();
  38513. var array = [];
  38514. while (!isCmd(obj, ']') && !isEOF(obj)) {
  38515. array.push(obj);
  38516. obj = lexer.getObj();
  38517. }
  38518. cMap.mapBfRangeToArray(low, high, array);
  38519. } else {
  38520. break;
  38521. }
  38522. }
  38523. error('Invalid bf range.');
  38524. }
  38525. function parseCidChar(cMap, lexer) {
  38526. while (true) {
  38527. var obj = lexer.getObj();
  38528. if (isEOF(obj)) {
  38529. break;
  38530. }
  38531. if (isCmd(obj, 'endcidchar')) {
  38532. return;
  38533. }
  38534. expectString(obj);
  38535. var src = strToInt(obj);
  38536. obj = lexer.getObj();
  38537. expectInt(obj);
  38538. var dst = obj;
  38539. cMap.mapOne(src, dst);
  38540. }
  38541. }
  38542. function parseCidRange(cMap, lexer) {
  38543. while (true) {
  38544. var obj = lexer.getObj();
  38545. if (isEOF(obj)) {
  38546. break;
  38547. }
  38548. if (isCmd(obj, 'endcidrange')) {
  38549. return;
  38550. }
  38551. expectString(obj);
  38552. var low = strToInt(obj);
  38553. obj = lexer.getObj();
  38554. expectString(obj);
  38555. var high = strToInt(obj);
  38556. obj = lexer.getObj();
  38557. expectInt(obj);
  38558. var dstLow = obj;
  38559. cMap.mapCidRange(low, high, dstLow);
  38560. }
  38561. }
  38562. function parseCodespaceRange(cMap, lexer) {
  38563. while (true) {
  38564. var obj = lexer.getObj();
  38565. if (isEOF(obj)) {
  38566. break;
  38567. }
  38568. if (isCmd(obj, 'endcodespacerange')) {
  38569. return;
  38570. }
  38571. if (!isString(obj)) {
  38572. break;
  38573. }
  38574. var low = strToInt(obj);
  38575. obj = lexer.getObj();
  38576. if (!isString(obj)) {
  38577. break;
  38578. }
  38579. var high = strToInt(obj);
  38580. cMap.addCodespaceRange(obj.length, low, high);
  38581. }
  38582. error('Invalid codespace range.');
  38583. }
  38584. function parseWMode(cMap, lexer) {
  38585. var obj = lexer.getObj();
  38586. if (isInt(obj)) {
  38587. cMap.vertical = !!obj;
  38588. }
  38589. }
  38590. function parseCMapName(cMap, lexer) {
  38591. var obj = lexer.getObj();
  38592. if (isName(obj) && isString(obj.name)) {
  38593. cMap.name = obj.name;
  38594. }
  38595. }
  38596. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  38597. var previous;
  38598. var embededUseCMap;
  38599. objLoop:
  38600. while (true) {
  38601. try {
  38602. var obj = lexer.getObj();
  38603. if (isEOF(obj)) {
  38604. break;
  38605. } else if (isName(obj)) {
  38606. if (obj.name === 'WMode') {
  38607. parseWMode(cMap, lexer);
  38608. } else if (obj.name === 'CMapName') {
  38609. parseCMapName(cMap, lexer);
  38610. }
  38611. previous = obj;
  38612. } else if (isCmd(obj)) {
  38613. switch (obj.cmd) {
  38614. case 'endcmap':
  38615. break objLoop;
  38616. case 'usecmap':
  38617. if (isName(previous)) {
  38618. embededUseCMap = previous.name;
  38619. }
  38620. break;
  38621. case 'begincodespacerange':
  38622. parseCodespaceRange(cMap, lexer);
  38623. break;
  38624. case 'beginbfchar':
  38625. parseBfChar(cMap, lexer);
  38626. break;
  38627. case 'begincidchar':
  38628. parseCidChar(cMap, lexer);
  38629. break;
  38630. case 'beginbfrange':
  38631. parseBfRange(cMap, lexer);
  38632. break;
  38633. case 'begincidrange':
  38634. parseCidRange(cMap, lexer);
  38635. break;
  38636. }
  38637. }
  38638. } catch (ex) {
  38639. if (ex instanceof MissingDataException) {
  38640. throw ex;
  38641. }
  38642. warn('Invalid cMap data: ' + ex);
  38643. continue;
  38644. }
  38645. }
  38646. if (!useCMap && embededUseCMap) {
  38647. useCMap = embededUseCMap;
  38648. }
  38649. if (useCMap) {
  38650. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  38651. }
  38652. return Promise.resolve(cMap);
  38653. }
  38654. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  38655. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  38656. cMap.useCMap = newCMap;
  38657. if (cMap.numCodespaceRanges === 0) {
  38658. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  38659. for (var i = 0; i < useCodespaceRanges.length; i++) {
  38660. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  38661. }
  38662. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  38663. }
  38664. cMap.useCMap.forEach(function (key, value) {
  38665. if (!cMap.contains(key)) {
  38666. cMap.mapOne(key, cMap.useCMap.lookup(key));
  38667. }
  38668. });
  38669. return cMap;
  38670. });
  38671. }
  38672. function createBuiltInCMap(name, fetchBuiltInCMap) {
  38673. if (name === 'Identity-H') {
  38674. return Promise.resolve(new IdentityCMap(false, 2));
  38675. } else if (name === 'Identity-V') {
  38676. return Promise.resolve(new IdentityCMap(true, 2));
  38677. }
  38678. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  38679. return Promise.reject(new Error('Unknown cMap name: ' + name));
  38680. }
  38681. assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  38682. return fetchBuiltInCMap(name).then(function (data) {
  38683. var cMapData = data.cMapData, compressionType = data.compressionType;
  38684. var cMap = new CMap(true);
  38685. if (compressionType === CMapCompressionType.BINARY) {
  38686. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  38687. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  38688. });
  38689. }
  38690. assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  38691. var lexer = new Lexer(new Stream(cMapData));
  38692. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  38693. });
  38694. }
  38695. return {
  38696. create: function (params) {
  38697. var encoding = params.encoding;
  38698. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  38699. var useCMap = params.useCMap;
  38700. if (isName(encoding)) {
  38701. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  38702. } else if (isStream(encoding)) {
  38703. var cMap = new CMap();
  38704. var lexer = new Lexer(encoding);
  38705. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  38706. if (parsedCMap.isIdentityCMap) {
  38707. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  38708. }
  38709. return parsedCMap;
  38710. });
  38711. }
  38712. return Promise.reject(new Error('Encoding required.'));
  38713. }
  38714. };
  38715. }();
  38716. exports.CMap = CMap;
  38717. exports.CMapFactory = CMapFactory;
  38718. exports.IdentityCMap = IdentityCMap;
  38719. /***/ }),
  38720. /* 24 */
  38721. /***/ (function(module, exports, __w_pdfjs_require__) {
  38722. "use strict";
  38723. var sharedUtil = __w_pdfjs_require__(0);
  38724. var corePrimitives = __w_pdfjs_require__(1);
  38725. var coreStream = __w_pdfjs_require__(2);
  38726. var coreObj = __w_pdfjs_require__(15);
  38727. var coreParser = __w_pdfjs_require__(5);
  38728. var coreCrypto = __w_pdfjs_require__(12);
  38729. var coreEvaluator = __w_pdfjs_require__(13);
  38730. var coreAnnotation = __w_pdfjs_require__(20);
  38731. var MissingDataException = sharedUtil.MissingDataException;
  38732. var Util = sharedUtil.Util;
  38733. var assert = sharedUtil.assert;
  38734. var error = sharedUtil.error;
  38735. var info = sharedUtil.info;
  38736. var isArray = sharedUtil.isArray;
  38737. var isArrayBuffer = sharedUtil.isArrayBuffer;
  38738. var isNum = sharedUtil.isNum;
  38739. var isString = sharedUtil.isString;
  38740. var shadow = sharedUtil.shadow;
  38741. var stringToBytes = sharedUtil.stringToBytes;
  38742. var stringToPDFString = sharedUtil.stringToPDFString;
  38743. var warn = sharedUtil.warn;
  38744. var isSpace = sharedUtil.isSpace;
  38745. var Dict = corePrimitives.Dict;
  38746. var isDict = corePrimitives.isDict;
  38747. var isName = corePrimitives.isName;
  38748. var isStream = corePrimitives.isStream;
  38749. var NullStream = coreStream.NullStream;
  38750. var Stream = coreStream.Stream;
  38751. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  38752. var Catalog = coreObj.Catalog;
  38753. var ObjectLoader = coreObj.ObjectLoader;
  38754. var XRef = coreObj.XRef;
  38755. var Linearization = coreParser.Linearization;
  38756. var calculateMD5 = coreCrypto.calculateMD5;
  38757. var OperatorList = coreEvaluator.OperatorList;
  38758. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  38759. var Annotation = coreAnnotation.Annotation;
  38760. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  38761. var Page = function PageClosure() {
  38762. var DEFAULT_USER_UNIT = 1.0;
  38763. var LETTER_SIZE_MEDIABOX = [
  38764. 0,
  38765. 0,
  38766. 612,
  38767. 792
  38768. ];
  38769. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  38770. this.pdfManager = pdfManager;
  38771. this.pageIndex = pageIndex;
  38772. this.pageDict = pageDict;
  38773. this.xref = xref;
  38774. this.ref = ref;
  38775. this.fontCache = fontCache;
  38776. this.builtInCMapCache = builtInCMapCache;
  38777. this.evaluatorOptions = pdfManager.evaluatorOptions;
  38778. this.resourcesPromise = null;
  38779. var uniquePrefix = 'p' + this.pageIndex + '_';
  38780. var idCounters = { obj: 0 };
  38781. this.idFactory = {
  38782. createObjId: function () {
  38783. return uniquePrefix + ++idCounters.obj;
  38784. }
  38785. };
  38786. }
  38787. Page.prototype = {
  38788. getPageProp: function Page_getPageProp(key) {
  38789. return this.pageDict.get(key);
  38790. },
  38791. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  38792. var dict = this.pageDict, valueArray = null, loopCount = 0;
  38793. var MAX_LOOP_COUNT = 100;
  38794. getArray = getArray || false;
  38795. while (dict) {
  38796. var value = getArray ? dict.getArray(key) : dict.get(key);
  38797. if (value) {
  38798. if (!valueArray) {
  38799. valueArray = [];
  38800. }
  38801. valueArray.push(value);
  38802. }
  38803. if (++loopCount > MAX_LOOP_COUNT) {
  38804. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  38805. break;
  38806. }
  38807. dict = dict.get('Parent');
  38808. }
  38809. if (!valueArray) {
  38810. return Dict.empty;
  38811. }
  38812. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  38813. return valueArray[0];
  38814. }
  38815. return Dict.merge(this.xref, valueArray);
  38816. },
  38817. get content() {
  38818. return this.getPageProp('Contents');
  38819. },
  38820. get resources() {
  38821. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  38822. },
  38823. get mediaBox() {
  38824. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  38825. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  38826. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  38827. }
  38828. return shadow(this, 'mediaBox', mediaBox);
  38829. },
  38830. get cropBox() {
  38831. var cropBox = this.getInheritedPageProp('CropBox', true);
  38832. if (!isArray(cropBox) || cropBox.length !== 4) {
  38833. return shadow(this, 'cropBox', this.mediaBox);
  38834. }
  38835. return shadow(this, 'cropBox', cropBox);
  38836. },
  38837. get userUnit() {
  38838. var obj = this.getPageProp('UserUnit');
  38839. if (!isNum(obj) || obj <= 0) {
  38840. obj = DEFAULT_USER_UNIT;
  38841. }
  38842. return shadow(this, 'userUnit', obj);
  38843. },
  38844. get view() {
  38845. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  38846. if (mediaBox === cropBox) {
  38847. return shadow(this, 'view', mediaBox);
  38848. }
  38849. var intersection = Util.intersect(cropBox, mediaBox);
  38850. return shadow(this, 'view', intersection || mediaBox);
  38851. },
  38852. get rotate() {
  38853. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38854. if (rotate % 90 !== 0) {
  38855. rotate = 0;
  38856. } else if (rotate >= 360) {
  38857. rotate = rotate % 360;
  38858. } else if (rotate < 0) {
  38859. rotate = (rotate % 360 + 360) % 360;
  38860. }
  38861. return shadow(this, 'rotate', rotate);
  38862. },
  38863. getContentStream: function Page_getContentStream() {
  38864. var content = this.content;
  38865. var stream;
  38866. if (isArray(content)) {
  38867. var xref = this.xref;
  38868. var i, n = content.length;
  38869. var streams = [];
  38870. for (i = 0; i < n; ++i) {
  38871. streams.push(xref.fetchIfRef(content[i]));
  38872. }
  38873. stream = new StreamsSequenceStream(streams);
  38874. } else if (isStream(content)) {
  38875. stream = content;
  38876. } else {
  38877. stream = new NullStream();
  38878. }
  38879. return stream;
  38880. },
  38881. loadResources: function Page_loadResources(keys) {
  38882. if (!this.resourcesPromise) {
  38883. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38884. }
  38885. return this.resourcesPromise.then(function resourceSuccess() {
  38886. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38887. return objectLoader.load();
  38888. }.bind(this));
  38889. },
  38890. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38891. var self = this;
  38892. var pdfManager = this.pdfManager;
  38893. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38894. var resourcesPromise = this.loadResources([
  38895. 'ExtGState',
  38896. 'ColorSpace',
  38897. 'Pattern',
  38898. 'Shading',
  38899. 'XObject',
  38900. 'Font'
  38901. ]);
  38902. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
  38903. var dataPromises = Promise.all([
  38904. contentStreamPromise,
  38905. resourcesPromise
  38906. ]);
  38907. var pageListPromise = dataPromises.then(function (data) {
  38908. var contentStream = data[0];
  38909. var opList = new OperatorList(intent, handler, self.pageIndex);
  38910. handler.send('StartRenderPage', {
  38911. transparency: partialEvaluator.hasBlendModes(self.resources),
  38912. pageIndex: self.pageIndex,
  38913. intent: intent
  38914. });
  38915. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38916. return opList;
  38917. });
  38918. });
  38919. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38920. return Promise.all([
  38921. pageListPromise,
  38922. annotationsPromise
  38923. ]).then(function (datas) {
  38924. var pageOpList = datas[0];
  38925. var annotations = datas[1];
  38926. if (annotations.length === 0) {
  38927. pageOpList.flush(true);
  38928. return pageOpList;
  38929. }
  38930. var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms);
  38931. return annotationsReadyPromise.then(function () {
  38932. pageOpList.flush(true);
  38933. return pageOpList;
  38934. });
  38935. });
  38936. },
  38937. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38938. var handler = {
  38939. on: function nullHandlerOn() {
  38940. },
  38941. send: function nullHandlerSend() {
  38942. }
  38943. };
  38944. var self = this;
  38945. var pdfManager = this.pdfManager;
  38946. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38947. var resourcesPromise = this.loadResources([
  38948. 'ExtGState',
  38949. 'XObject',
  38950. 'Font'
  38951. ]);
  38952. var dataPromises = Promise.all([
  38953. contentStreamPromise,
  38954. resourcesPromise
  38955. ]);
  38956. return dataPromises.then(function (data) {
  38957. var contentStream = data[0];
  38958. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
  38959. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38960. });
  38961. },
  38962. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38963. var annotations = this.annotations;
  38964. var annotationsData = [];
  38965. for (var i = 0, n = annotations.length; i < n; ++i) {
  38966. if (intent) {
  38967. if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) {
  38968. continue;
  38969. }
  38970. }
  38971. annotationsData.push(annotations[i].data);
  38972. }
  38973. return annotationsData;
  38974. },
  38975. get annotations() {
  38976. var annotations = [];
  38977. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38978. var annotationFactory = new AnnotationFactory();
  38979. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38980. var annotationRef = annotationRefs[i];
  38981. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38982. if (annotation) {
  38983. annotations.push(annotation);
  38984. }
  38985. }
  38986. return shadow(this, 'annotations', annotations);
  38987. }
  38988. };
  38989. return Page;
  38990. }();
  38991. var PDFDocument = function PDFDocumentClosure() {
  38992. var FINGERPRINT_FIRST_BYTES = 1024;
  38993. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  38994. function PDFDocument(pdfManager, arg) {
  38995. var stream;
  38996. if (isStream(arg)) {
  38997. stream = arg;
  38998. } else if (isArrayBuffer(arg)) {
  38999. stream = new Stream(arg);
  39000. } else {
  39001. error('PDFDocument: Unknown argument type');
  39002. }
  39003. assert(stream.length > 0, 'stream must have data');
  39004. this.pdfManager = pdfManager;
  39005. this.stream = stream;
  39006. this.xref = new XRef(stream, pdfManager);
  39007. }
  39008. function find(stream, needle, limit, backwards) {
  39009. var pos = stream.pos;
  39010. var end = stream.end;
  39011. var strBuf = [];
  39012. if (pos + limit > end) {
  39013. limit = end - pos;
  39014. }
  39015. for (var n = 0; n < limit; ++n) {
  39016. strBuf.push(String.fromCharCode(stream.getByte()));
  39017. }
  39018. var str = strBuf.join('');
  39019. stream.pos = pos;
  39020. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  39021. if (index === -1) {
  39022. return false;
  39023. }
  39024. stream.pos += index;
  39025. return true;
  39026. }
  39027. var DocumentInfoValidators = {
  39028. get entries() {
  39029. return shadow(this, 'entries', {
  39030. Title: isString,
  39031. Author: isString,
  39032. Subject: isString,
  39033. Keywords: isString,
  39034. Creator: isString,
  39035. Producer: isString,
  39036. CreationDate: isString,
  39037. ModDate: isString,
  39038. Trapped: isName
  39039. });
  39040. }
  39041. };
  39042. PDFDocument.prototype = {
  39043. parse: function PDFDocument_parse(recoveryMode) {
  39044. this.setup(recoveryMode);
  39045. var version = this.catalog.catDict.get('Version');
  39046. if (isName(version)) {
  39047. this.pdfFormatVersion = version.name;
  39048. }
  39049. try {
  39050. this.acroForm = this.catalog.catDict.get('AcroForm');
  39051. if (this.acroForm) {
  39052. this.xfa = this.acroForm.get('XFA');
  39053. var fields = this.acroForm.get('Fields');
  39054. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  39055. this.acroForm = null;
  39056. }
  39057. }
  39058. } catch (ex) {
  39059. info('Something wrong with AcroForm entry');
  39060. this.acroForm = null;
  39061. }
  39062. },
  39063. get linearization() {
  39064. var linearization = null;
  39065. if (this.stream.length) {
  39066. try {
  39067. linearization = Linearization.create(this.stream);
  39068. } catch (err) {
  39069. if (err instanceof MissingDataException) {
  39070. throw err;
  39071. }
  39072. info(err);
  39073. }
  39074. }
  39075. return shadow(this, 'linearization', linearization);
  39076. },
  39077. get startXRef() {
  39078. var stream = this.stream;
  39079. var startXRef = 0;
  39080. var linearization = this.linearization;
  39081. if (linearization) {
  39082. stream.reset();
  39083. if (find(stream, 'endobj', 1024)) {
  39084. startXRef = stream.pos + 6;
  39085. }
  39086. } else {
  39087. var step = 1024;
  39088. var found = false, pos = stream.end;
  39089. while (!found && pos > 0) {
  39090. pos -= step - 'startxref'.length;
  39091. if (pos < 0) {
  39092. pos = 0;
  39093. }
  39094. stream.pos = pos;
  39095. found = find(stream, 'startxref', step, true);
  39096. }
  39097. if (found) {
  39098. stream.skip(9);
  39099. var ch;
  39100. do {
  39101. ch = stream.getByte();
  39102. } while (isSpace(ch));
  39103. var str = '';
  39104. while (ch >= 0x20 && ch <= 0x39) {
  39105. str += String.fromCharCode(ch);
  39106. ch = stream.getByte();
  39107. }
  39108. startXRef = parseInt(str, 10);
  39109. if (isNaN(startXRef)) {
  39110. startXRef = 0;
  39111. }
  39112. }
  39113. }
  39114. return shadow(this, 'startXRef', startXRef);
  39115. },
  39116. get mainXRefEntriesOffset() {
  39117. var mainXRefEntriesOffset = 0;
  39118. var linearization = this.linearization;
  39119. if (linearization) {
  39120. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  39121. }
  39122. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  39123. },
  39124. checkHeader: function PDFDocument_checkHeader() {
  39125. var stream = this.stream;
  39126. stream.reset();
  39127. if (find(stream, '%PDF-', 1024)) {
  39128. stream.moveStart();
  39129. var MAX_VERSION_LENGTH = 12;
  39130. var version = '', ch;
  39131. while ((ch = stream.getByte()) > 0x20) {
  39132. if (version.length >= MAX_VERSION_LENGTH) {
  39133. break;
  39134. }
  39135. version += String.fromCharCode(ch);
  39136. }
  39137. if (!this.pdfFormatVersion) {
  39138. this.pdfFormatVersion = version.substring(5);
  39139. }
  39140. return;
  39141. }
  39142. },
  39143. parseStartXRef: function PDFDocument_parseStartXRef() {
  39144. var startXRef = this.startXRef;
  39145. this.xref.setStartXRef(startXRef);
  39146. },
  39147. setup: function PDFDocument_setup(recoveryMode) {
  39148. this.xref.parse(recoveryMode);
  39149. var self = this;
  39150. var pageFactory = {
  39151. createPage: function (pageIndex, dict, ref, fontCache, builtInCMapCache) {
  39152. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  39153. }
  39154. };
  39155. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  39156. },
  39157. get numPages() {
  39158. var linearization = this.linearization;
  39159. var num = linearization ? linearization.numPages : this.catalog.numPages;
  39160. return shadow(this, 'numPages', num);
  39161. },
  39162. get documentInfo() {
  39163. var docInfo = {
  39164. PDFFormatVersion: this.pdfFormatVersion,
  39165. IsAcroFormPresent: !!this.acroForm,
  39166. IsXFAPresent: !!this.xfa
  39167. };
  39168. var infoDict;
  39169. try {
  39170. infoDict = this.xref.trailer.get('Info');
  39171. } catch (err) {
  39172. info('The document information dictionary is invalid.');
  39173. }
  39174. if (infoDict) {
  39175. var validEntries = DocumentInfoValidators.entries;
  39176. for (var key in validEntries) {
  39177. if (infoDict.has(key)) {
  39178. var value = infoDict.get(key);
  39179. if (validEntries[key](value)) {
  39180. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  39181. } else {
  39182. info('Bad value in document info for "' + key + '"');
  39183. }
  39184. }
  39185. }
  39186. }
  39187. return shadow(this, 'documentInfo', docInfo);
  39188. },
  39189. get fingerprint() {
  39190. var xref = this.xref, hash, fileID = '';
  39191. var idArray = xref.trailer.get('ID');
  39192. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  39193. hash = stringToBytes(idArray[0]);
  39194. } else {
  39195. if (this.stream.ensureRange) {
  39196. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  39197. }
  39198. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  39199. }
  39200. for (var i = 0, n = hash.length; i < n; i++) {
  39201. var hex = hash[i].toString(16);
  39202. fileID += hex.length === 1 ? '0' + hex : hex;
  39203. }
  39204. return shadow(this, 'fingerprint', fileID);
  39205. },
  39206. getPage: function PDFDocument_getPage(pageIndex) {
  39207. return this.catalog.getPage(pageIndex);
  39208. },
  39209. cleanup: function PDFDocument_cleanup() {
  39210. return this.catalog.cleanup();
  39211. }
  39212. };
  39213. return PDFDocument;
  39214. }();
  39215. exports.Page = Page;
  39216. exports.PDFDocument = PDFDocument;
  39217. /***/ }),
  39218. /* 25 */
  39219. /***/ (function(module, exports, __w_pdfjs_require__) {
  39220. "use strict";
  39221. var sharedUtil = __w_pdfjs_require__(0);
  39222. var coreStream = __w_pdfjs_require__(2);
  39223. var coreGlyphList = __w_pdfjs_require__(7);
  39224. var coreEncodings = __w_pdfjs_require__(4);
  39225. var coreCFFParser = __w_pdfjs_require__(10);
  39226. var Util = sharedUtil.Util;
  39227. var bytesToString = sharedUtil.bytesToString;
  39228. var error = sharedUtil.error;
  39229. var Stream = coreStream.Stream;
  39230. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39231. var StandardEncoding = coreEncodings.StandardEncoding;
  39232. var CFFParser = coreCFFParser.CFFParser;
  39233. var FontRendererFactory = function FontRendererFactoryClosure() {
  39234. function getLong(data, offset) {
  39235. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39236. }
  39237. function getUshort(data, offset) {
  39238. return data[offset] << 8 | data[offset + 1];
  39239. }
  39240. function parseCmap(data, start, end) {
  39241. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39242. var format = getUshort(data, start + offset);
  39243. var ranges, p, i;
  39244. if (format === 4) {
  39245. getUshort(data, start + offset + 2);
  39246. var segCount = getUshort(data, start + offset + 6) >> 1;
  39247. p = start + offset + 14;
  39248. ranges = [];
  39249. for (i = 0; i < segCount; i++, p += 2) {
  39250. ranges[i] = { end: getUshort(data, p) };
  39251. }
  39252. p += 2;
  39253. for (i = 0; i < segCount; i++, p += 2) {
  39254. ranges[i].start = getUshort(data, p);
  39255. }
  39256. for (i = 0; i < segCount; i++, p += 2) {
  39257. ranges[i].idDelta = getUshort(data, p);
  39258. }
  39259. for (i = 0; i < segCount; i++, p += 2) {
  39260. var idOffset = getUshort(data, p);
  39261. if (idOffset === 0) {
  39262. continue;
  39263. }
  39264. ranges[i].ids = [];
  39265. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39266. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39267. idOffset += 2;
  39268. }
  39269. }
  39270. return ranges;
  39271. } else if (format === 12) {
  39272. getLong(data, start + offset + 4);
  39273. var groups = getLong(data, start + offset + 12);
  39274. p = start + offset + 16;
  39275. ranges = [];
  39276. for (i = 0; i < groups; i++) {
  39277. ranges.push({
  39278. start: getLong(data, p),
  39279. end: getLong(data, p + 4),
  39280. idDelta: getLong(data, p + 8) - getLong(data, p)
  39281. });
  39282. p += 12;
  39283. }
  39284. return ranges;
  39285. }
  39286. error('not supported cmap: ' + format);
  39287. }
  39288. function parseCff(data, start, end, seacAnalysisEnabled) {
  39289. var properties = {};
  39290. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39291. var cff = parser.parse();
  39292. return {
  39293. glyphs: cff.charStrings.objects,
  39294. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39295. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  39296. };
  39297. }
  39298. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39299. var itemSize, itemDecode;
  39300. if (isGlyphLocationsLong) {
  39301. itemSize = 4;
  39302. itemDecode = function fontItemDecodeLong(data, offset) {
  39303. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39304. };
  39305. } else {
  39306. itemSize = 2;
  39307. itemDecode = function fontItemDecode(data, offset) {
  39308. return data[offset] << 9 | data[offset + 1] << 1;
  39309. };
  39310. }
  39311. var glyphs = [];
  39312. var startOffset = itemDecode(loca, 0);
  39313. for (var j = itemSize; j < loca.length; j += itemSize) {
  39314. var endOffset = itemDecode(loca, j);
  39315. glyphs.push(glyf.subarray(startOffset, endOffset));
  39316. startOffset = endOffset;
  39317. }
  39318. return glyphs;
  39319. }
  39320. function lookupCmap(ranges, unicode) {
  39321. var code = unicode.charCodeAt(0), gid = 0;
  39322. var l = 0, r = ranges.length - 1;
  39323. while (l < r) {
  39324. var c = l + r + 1 >> 1;
  39325. if (code < ranges[c].start) {
  39326. r = c - 1;
  39327. } else {
  39328. l = c;
  39329. }
  39330. }
  39331. if (ranges[l].start <= code && code <= ranges[l].end) {
  39332. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  39333. }
  39334. return {
  39335. charCode: code,
  39336. glyphId: gid
  39337. };
  39338. }
  39339. function compileGlyf(code, cmds, font) {
  39340. function moveTo(x, y) {
  39341. cmds.push({
  39342. cmd: 'moveTo',
  39343. args: [
  39344. x,
  39345. y
  39346. ]
  39347. });
  39348. }
  39349. function lineTo(x, y) {
  39350. cmds.push({
  39351. cmd: 'lineTo',
  39352. args: [
  39353. x,
  39354. y
  39355. ]
  39356. });
  39357. }
  39358. function quadraticCurveTo(xa, ya, x, y) {
  39359. cmds.push({
  39360. cmd: 'quadraticCurveTo',
  39361. args: [
  39362. xa,
  39363. ya,
  39364. x,
  39365. y
  39366. ]
  39367. });
  39368. }
  39369. var i = 0;
  39370. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39371. var flags;
  39372. var x = 0, y = 0;
  39373. i += 10;
  39374. if (numberOfContours < 0) {
  39375. do {
  39376. flags = code[i] << 8 | code[i + 1];
  39377. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  39378. i += 4;
  39379. var arg1, arg2;
  39380. if (flags & 0x01) {
  39381. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39382. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39383. i += 4;
  39384. } else {
  39385. arg1 = code[i++];
  39386. arg2 = code[i++];
  39387. }
  39388. if (flags & 0x02) {
  39389. x = arg1;
  39390. y = arg2;
  39391. } else {
  39392. x = 0;
  39393. y = 0;
  39394. }
  39395. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  39396. if (flags & 0x08) {
  39397. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39398. i += 2;
  39399. } else if (flags & 0x40) {
  39400. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39401. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39402. i += 4;
  39403. } else if (flags & 0x80) {
  39404. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39405. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39406. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39407. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39408. i += 8;
  39409. }
  39410. var subglyph = font.glyphs[glyphIndex];
  39411. if (subglyph) {
  39412. cmds.push({ cmd: 'save' });
  39413. cmds.push({
  39414. cmd: 'transform',
  39415. args: [
  39416. scaleX,
  39417. scale01,
  39418. scale10,
  39419. scaleY,
  39420. x,
  39421. y
  39422. ]
  39423. });
  39424. compileGlyf(subglyph, cmds, font);
  39425. cmds.push({ cmd: 'restore' });
  39426. }
  39427. } while (flags & 0x20);
  39428. } else {
  39429. var endPtsOfContours = [];
  39430. var j, jj;
  39431. for (j = 0; j < numberOfContours; j++) {
  39432. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39433. i += 2;
  39434. }
  39435. var instructionLength = code[i] << 8 | code[i + 1];
  39436. i += 2 + instructionLength;
  39437. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39438. var points = [];
  39439. while (points.length < numberOfPoints) {
  39440. flags = code[i++];
  39441. var repeat = 1;
  39442. if (flags & 0x08) {
  39443. repeat += code[i++];
  39444. }
  39445. while (repeat-- > 0) {
  39446. points.push({ flags: flags });
  39447. }
  39448. }
  39449. for (j = 0; j < numberOfPoints; j++) {
  39450. switch (points[j].flags & 0x12) {
  39451. case 0x00:
  39452. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39453. i += 2;
  39454. break;
  39455. case 0x02:
  39456. x -= code[i++];
  39457. break;
  39458. case 0x12:
  39459. x += code[i++];
  39460. break;
  39461. }
  39462. points[j].x = x;
  39463. }
  39464. for (j = 0; j < numberOfPoints; j++) {
  39465. switch (points[j].flags & 0x24) {
  39466. case 0x00:
  39467. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39468. i += 2;
  39469. break;
  39470. case 0x04:
  39471. y -= code[i++];
  39472. break;
  39473. case 0x24:
  39474. y += code[i++];
  39475. break;
  39476. }
  39477. points[j].y = y;
  39478. }
  39479. var startPoint = 0;
  39480. for (i = 0; i < numberOfContours; i++) {
  39481. var endPoint = endPtsOfContours[i];
  39482. var contour = points.slice(startPoint, endPoint + 1);
  39483. if (contour[0].flags & 1) {
  39484. contour.push(contour[0]);
  39485. } else if (contour[contour.length - 1].flags & 1) {
  39486. contour.unshift(contour[contour.length - 1]);
  39487. } else {
  39488. var p = {
  39489. flags: 1,
  39490. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39491. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39492. };
  39493. contour.unshift(p);
  39494. contour.push(p);
  39495. }
  39496. moveTo(contour[0].x, contour[0].y);
  39497. for (j = 1, jj = contour.length; j < jj; j++) {
  39498. if (contour[j].flags & 1) {
  39499. lineTo(contour[j].x, contour[j].y);
  39500. } else if (contour[j + 1].flags & 1) {
  39501. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39502. j++;
  39503. } else {
  39504. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39505. }
  39506. }
  39507. startPoint = endPoint + 1;
  39508. }
  39509. }
  39510. }
  39511. function compileCharString(code, cmds, font) {
  39512. var stack = [];
  39513. var x = 0, y = 0;
  39514. var stems = 0;
  39515. function moveTo(x, y) {
  39516. cmds.push({
  39517. cmd: 'moveTo',
  39518. args: [
  39519. x,
  39520. y
  39521. ]
  39522. });
  39523. }
  39524. function lineTo(x, y) {
  39525. cmds.push({
  39526. cmd: 'lineTo',
  39527. args: [
  39528. x,
  39529. y
  39530. ]
  39531. });
  39532. }
  39533. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39534. cmds.push({
  39535. cmd: 'bezierCurveTo',
  39536. args: [
  39537. x1,
  39538. y1,
  39539. x2,
  39540. y2,
  39541. x,
  39542. y
  39543. ]
  39544. });
  39545. }
  39546. function parse(code) {
  39547. var i = 0;
  39548. while (i < code.length) {
  39549. var stackClean = false;
  39550. var v = code[i++];
  39551. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39552. switch (v) {
  39553. case 1:
  39554. stems += stack.length >> 1;
  39555. stackClean = true;
  39556. break;
  39557. case 3:
  39558. stems += stack.length >> 1;
  39559. stackClean = true;
  39560. break;
  39561. case 4:
  39562. y += stack.pop();
  39563. moveTo(x, y);
  39564. stackClean = true;
  39565. break;
  39566. case 5:
  39567. while (stack.length > 0) {
  39568. x += stack.shift();
  39569. y += stack.shift();
  39570. lineTo(x, y);
  39571. }
  39572. break;
  39573. case 6:
  39574. while (stack.length > 0) {
  39575. x += stack.shift();
  39576. lineTo(x, y);
  39577. if (stack.length === 0) {
  39578. break;
  39579. }
  39580. y += stack.shift();
  39581. lineTo(x, y);
  39582. }
  39583. break;
  39584. case 7:
  39585. while (stack.length > 0) {
  39586. y += stack.shift();
  39587. lineTo(x, y);
  39588. if (stack.length === 0) {
  39589. break;
  39590. }
  39591. x += stack.shift();
  39592. lineTo(x, y);
  39593. }
  39594. break;
  39595. case 8:
  39596. while (stack.length > 0) {
  39597. xa = x + stack.shift();
  39598. ya = y + stack.shift();
  39599. xb = xa + stack.shift();
  39600. yb = ya + stack.shift();
  39601. x = xb + stack.shift();
  39602. y = yb + stack.shift();
  39603. bezierCurveTo(xa, ya, xb, yb, x, y);
  39604. }
  39605. break;
  39606. case 10:
  39607. n = stack.pop() + font.subrsBias;
  39608. subrCode = font.subrs[n];
  39609. if (subrCode) {
  39610. parse(subrCode);
  39611. }
  39612. break;
  39613. case 11:
  39614. return;
  39615. case 12:
  39616. v = code[i++];
  39617. switch (v) {
  39618. case 34:
  39619. xa = x + stack.shift();
  39620. xb = xa + stack.shift();
  39621. y1 = y + stack.shift();
  39622. x = xb + stack.shift();
  39623. bezierCurveTo(xa, y, xb, y1, x, y1);
  39624. xa = x + stack.shift();
  39625. xb = xa + stack.shift();
  39626. x = xb + stack.shift();
  39627. bezierCurveTo(xa, y1, xb, y, x, y);
  39628. break;
  39629. case 35:
  39630. xa = x + stack.shift();
  39631. ya = y + stack.shift();
  39632. xb = xa + stack.shift();
  39633. yb = ya + stack.shift();
  39634. x = xb + stack.shift();
  39635. y = yb + stack.shift();
  39636. bezierCurveTo(xa, ya, xb, yb, x, y);
  39637. xa = x + stack.shift();
  39638. ya = y + stack.shift();
  39639. xb = xa + stack.shift();
  39640. yb = ya + stack.shift();
  39641. x = xb + stack.shift();
  39642. y = yb + stack.shift();
  39643. bezierCurveTo(xa, ya, xb, yb, x, y);
  39644. stack.pop();
  39645. break;
  39646. case 36:
  39647. xa = x + stack.shift();
  39648. y1 = y + stack.shift();
  39649. xb = xa + stack.shift();
  39650. y2 = y1 + stack.shift();
  39651. x = xb + stack.shift();
  39652. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39653. xa = x + stack.shift();
  39654. xb = xa + stack.shift();
  39655. y3 = y2 + stack.shift();
  39656. x = xb + stack.shift();
  39657. bezierCurveTo(xa, y2, xb, y3, x, y);
  39658. break;
  39659. case 37:
  39660. var x0 = x, y0 = y;
  39661. xa = x + stack.shift();
  39662. ya = y + stack.shift();
  39663. xb = xa + stack.shift();
  39664. yb = ya + stack.shift();
  39665. x = xb + stack.shift();
  39666. y = yb + stack.shift();
  39667. bezierCurveTo(xa, ya, xb, yb, x, y);
  39668. xa = x + stack.shift();
  39669. ya = y + stack.shift();
  39670. xb = xa + stack.shift();
  39671. yb = ya + stack.shift();
  39672. x = xb;
  39673. y = yb;
  39674. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39675. x += stack.shift();
  39676. } else {
  39677. y += stack.shift();
  39678. }
  39679. bezierCurveTo(xa, ya, xb, yb, x, y);
  39680. break;
  39681. default:
  39682. error('unknown operator: 12 ' + v);
  39683. }
  39684. break;
  39685. case 14:
  39686. if (stack.length >= 4) {
  39687. var achar = stack.pop();
  39688. var bchar = stack.pop();
  39689. y = stack.pop();
  39690. x = stack.pop();
  39691. cmds.push({ cmd: 'save' });
  39692. cmds.push({
  39693. cmd: 'translate',
  39694. args: [
  39695. x,
  39696. y
  39697. ]
  39698. });
  39699. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  39700. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39701. cmds.push({ cmd: 'restore' });
  39702. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  39703. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39704. }
  39705. return;
  39706. case 18:
  39707. stems += stack.length >> 1;
  39708. stackClean = true;
  39709. break;
  39710. case 19:
  39711. stems += stack.length >> 1;
  39712. i += stems + 7 >> 3;
  39713. stackClean = true;
  39714. break;
  39715. case 20:
  39716. stems += stack.length >> 1;
  39717. i += stems + 7 >> 3;
  39718. stackClean = true;
  39719. break;
  39720. case 21:
  39721. y += stack.pop();
  39722. x += stack.pop();
  39723. moveTo(x, y);
  39724. stackClean = true;
  39725. break;
  39726. case 22:
  39727. x += stack.pop();
  39728. moveTo(x, y);
  39729. stackClean = true;
  39730. break;
  39731. case 23:
  39732. stems += stack.length >> 1;
  39733. stackClean = true;
  39734. break;
  39735. case 24:
  39736. while (stack.length > 2) {
  39737. xa = x + stack.shift();
  39738. ya = y + stack.shift();
  39739. xb = xa + stack.shift();
  39740. yb = ya + stack.shift();
  39741. x = xb + stack.shift();
  39742. y = yb + stack.shift();
  39743. bezierCurveTo(xa, ya, xb, yb, x, y);
  39744. }
  39745. x += stack.shift();
  39746. y += stack.shift();
  39747. lineTo(x, y);
  39748. break;
  39749. case 25:
  39750. while (stack.length > 6) {
  39751. x += stack.shift();
  39752. y += stack.shift();
  39753. lineTo(x, y);
  39754. }
  39755. xa = x + stack.shift();
  39756. ya = y + stack.shift();
  39757. xb = xa + stack.shift();
  39758. yb = ya + stack.shift();
  39759. x = xb + stack.shift();
  39760. y = yb + stack.shift();
  39761. bezierCurveTo(xa, ya, xb, yb, x, y);
  39762. break;
  39763. case 26:
  39764. if (stack.length % 2) {
  39765. x += stack.shift();
  39766. }
  39767. while (stack.length > 0) {
  39768. xa = x;
  39769. ya = y + stack.shift();
  39770. xb = xa + stack.shift();
  39771. yb = ya + stack.shift();
  39772. x = xb;
  39773. y = yb + stack.shift();
  39774. bezierCurveTo(xa, ya, xb, yb, x, y);
  39775. }
  39776. break;
  39777. case 27:
  39778. if (stack.length % 2) {
  39779. y += stack.shift();
  39780. }
  39781. while (stack.length > 0) {
  39782. xa = x + stack.shift();
  39783. ya = y;
  39784. xb = xa + stack.shift();
  39785. yb = ya + stack.shift();
  39786. x = xb + stack.shift();
  39787. y = yb;
  39788. bezierCurveTo(xa, ya, xb, yb, x, y);
  39789. }
  39790. break;
  39791. case 28:
  39792. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39793. i += 2;
  39794. break;
  39795. case 29:
  39796. n = stack.pop() + font.gsubrsBias;
  39797. subrCode = font.gsubrs[n];
  39798. if (subrCode) {
  39799. parse(subrCode);
  39800. }
  39801. break;
  39802. case 30:
  39803. while (stack.length > 0) {
  39804. xa = x;
  39805. ya = y + stack.shift();
  39806. xb = xa + stack.shift();
  39807. yb = ya + stack.shift();
  39808. x = xb + stack.shift();
  39809. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39810. bezierCurveTo(xa, ya, xb, yb, x, y);
  39811. if (stack.length === 0) {
  39812. break;
  39813. }
  39814. xa = x + stack.shift();
  39815. ya = y;
  39816. xb = xa + stack.shift();
  39817. yb = ya + stack.shift();
  39818. y = yb + stack.shift();
  39819. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39820. bezierCurveTo(xa, ya, xb, yb, x, y);
  39821. }
  39822. break;
  39823. case 31:
  39824. while (stack.length > 0) {
  39825. xa = x + stack.shift();
  39826. ya = y;
  39827. xb = xa + stack.shift();
  39828. yb = ya + stack.shift();
  39829. y = yb + stack.shift();
  39830. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39831. bezierCurveTo(xa, ya, xb, yb, x, y);
  39832. if (stack.length === 0) {
  39833. break;
  39834. }
  39835. xa = x;
  39836. ya = y + stack.shift();
  39837. xb = xa + stack.shift();
  39838. yb = ya + stack.shift();
  39839. x = xb + stack.shift();
  39840. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39841. bezierCurveTo(xa, ya, xb, yb, x, y);
  39842. }
  39843. break;
  39844. default:
  39845. if (v < 32) {
  39846. error('unknown operator: ' + v);
  39847. }
  39848. if (v < 247) {
  39849. stack.push(v - 139);
  39850. } else if (v < 251) {
  39851. stack.push((v - 247) * 256 + code[i++] + 108);
  39852. } else if (v < 255) {
  39853. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39854. } else {
  39855. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39856. i += 4;
  39857. }
  39858. break;
  39859. }
  39860. if (stackClean) {
  39861. stack.length = 0;
  39862. }
  39863. }
  39864. }
  39865. parse(code);
  39866. }
  39867. var noop = '';
  39868. function CompiledFont(fontMatrix) {
  39869. this.compiledGlyphs = Object.create(null);
  39870. this.compiledCharCodeToGlyphId = Object.create(null);
  39871. this.fontMatrix = fontMatrix;
  39872. }
  39873. CompiledFont.prototype = {
  39874. getPathJs: function (unicode) {
  39875. var cmap = lookupCmap(this.cmap, unicode);
  39876. var fn = this.compiledGlyphs[cmap.glyphId];
  39877. if (!fn) {
  39878. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39879. this.compiledGlyphs[cmap.glyphId] = fn;
  39880. }
  39881. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39882. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39883. }
  39884. return fn;
  39885. },
  39886. compileGlyph: function (code) {
  39887. if (!code || code.length === 0 || code[0] === 14) {
  39888. return noop;
  39889. }
  39890. var cmds = [];
  39891. cmds.push({ cmd: 'save' });
  39892. cmds.push({
  39893. cmd: 'transform',
  39894. args: this.fontMatrix.slice()
  39895. });
  39896. cmds.push({
  39897. cmd: 'scale',
  39898. args: [
  39899. 'size',
  39900. '-size'
  39901. ]
  39902. });
  39903. this.compileGlyphImpl(code, cmds);
  39904. cmds.push({ cmd: 'restore' });
  39905. return cmds;
  39906. },
  39907. compileGlyphImpl: function () {
  39908. error('Children classes should implement this.');
  39909. },
  39910. hasBuiltPath: function (unicode) {
  39911. var cmap = lookupCmap(this.cmap, unicode);
  39912. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39913. }
  39914. };
  39915. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39916. fontMatrix = fontMatrix || [
  39917. 0.000488,
  39918. 0,
  39919. 0,
  39920. 0.000488,
  39921. 0,
  39922. 0
  39923. ];
  39924. CompiledFont.call(this, fontMatrix);
  39925. this.glyphs = glyphs;
  39926. this.cmap = cmap;
  39927. }
  39928. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39929. compileGlyphImpl: function (code, cmds) {
  39930. compileGlyf(code, cmds, this);
  39931. }
  39932. });
  39933. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39934. fontMatrix = fontMatrix || [
  39935. 0.001,
  39936. 0,
  39937. 0,
  39938. 0.001,
  39939. 0,
  39940. 0
  39941. ];
  39942. CompiledFont.call(this, fontMatrix);
  39943. this.glyphs = cffInfo.glyphs;
  39944. this.gsubrs = cffInfo.gsubrs || [];
  39945. this.subrs = cffInfo.subrs || [];
  39946. this.cmap = cmap;
  39947. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39948. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39949. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39950. }
  39951. Util.inherit(Type2Compiled, CompiledFont, {
  39952. compileGlyphImpl: function (code, cmds) {
  39953. compileCharString(code, cmds, this);
  39954. }
  39955. });
  39956. return {
  39957. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39958. var data = new Uint8Array(font.data);
  39959. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39960. var numTables = getUshort(data, 4);
  39961. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39962. var tag = bytesToString(data.subarray(p, p + 4));
  39963. var offset = getLong(data, p + 8);
  39964. var length = getLong(data, p + 12);
  39965. switch (tag) {
  39966. case 'cmap':
  39967. cmap = parseCmap(data, offset, offset + length);
  39968. break;
  39969. case 'glyf':
  39970. glyf = data.subarray(offset, offset + length);
  39971. break;
  39972. case 'loca':
  39973. loca = data.subarray(offset, offset + length);
  39974. break;
  39975. case 'head':
  39976. unitsPerEm = getUshort(data, offset + 18);
  39977. indexToLocFormat = getUshort(data, offset + 50);
  39978. break;
  39979. case 'CFF ':
  39980. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39981. break;
  39982. }
  39983. }
  39984. if (glyf) {
  39985. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39986. 1 / unitsPerEm,
  39987. 0,
  39988. 0,
  39989. 1 / unitsPerEm,
  39990. 0,
  39991. 0
  39992. ];
  39993. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39994. }
  39995. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  39996. }
  39997. };
  39998. }();
  39999. exports.FontRendererFactory = FontRendererFactory;
  40000. /***/ }),
  40001. /* 26 */
  40002. /***/ (function(module, exports, __w_pdfjs_require__) {
  40003. "use strict";
  40004. var sharedUtil = __w_pdfjs_require__(0);
  40005. var corePrimitives = __w_pdfjs_require__(1);
  40006. var coreStream = __w_pdfjs_require__(2);
  40007. var coreGlyphList = __w_pdfjs_require__(7);
  40008. var coreFontRenderer = __w_pdfjs_require__(25);
  40009. var coreEncodings = __w_pdfjs_require__(4);
  40010. var coreStandardFonts = __w_pdfjs_require__(16);
  40011. var coreUnicode = __w_pdfjs_require__(17);
  40012. var coreType1Parser = __w_pdfjs_require__(35);
  40013. var coreCFFParser = __w_pdfjs_require__(10);
  40014. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  40015. var FontType = sharedUtil.FontType;
  40016. var assert = sharedUtil.assert;
  40017. var bytesToString = sharedUtil.bytesToString;
  40018. var error = sharedUtil.error;
  40019. var info = sharedUtil.info;
  40020. var isArray = sharedUtil.isArray;
  40021. var isInt = sharedUtil.isInt;
  40022. var isNum = sharedUtil.isNum;
  40023. var readUint32 = sharedUtil.readUint32;
  40024. var shadow = sharedUtil.shadow;
  40025. var string32 = sharedUtil.string32;
  40026. var warn = sharedUtil.warn;
  40027. var MissingDataException = sharedUtil.MissingDataException;
  40028. var isSpace = sharedUtil.isSpace;
  40029. var Stream = coreStream.Stream;
  40030. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  40031. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  40032. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  40033. var StandardEncoding = coreEncodings.StandardEncoding;
  40034. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  40035. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  40036. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  40037. var getEncoding = coreEncodings.getEncoding;
  40038. var getStdFontMap = coreStandardFonts.getStdFontMap;
  40039. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  40040. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  40041. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  40042. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  40043. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  40044. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  40045. var Type1Parser = coreType1Parser.Type1Parser;
  40046. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  40047. var CFFParser = coreCFFParser.CFFParser;
  40048. var CFFCompiler = coreCFFParser.CFFCompiler;
  40049. var CFF = coreCFFParser.CFF;
  40050. var CFFHeader = coreCFFParser.CFFHeader;
  40051. var CFFTopDict = coreCFFParser.CFFTopDict;
  40052. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  40053. var CFFStrings = coreCFFParser.CFFStrings;
  40054. var CFFIndex = coreCFFParser.CFFIndex;
  40055. var CFFCharset = coreCFFParser.CFFCharset;
  40056. var PRIVATE_USE_OFFSET_START = 0xE000;
  40057. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  40058. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  40059. var PDF_GLYPH_SPACE_UNITS = 1000;
  40060. var SEAC_ANALYSIS_ENABLED = false;
  40061. var FontFlags = {
  40062. FixedPitch: 1,
  40063. Serif: 2,
  40064. Symbolic: 4,
  40065. Script: 8,
  40066. Nonsymbolic: 32,
  40067. Italic: 64,
  40068. AllCap: 65536,
  40069. SmallCap: 131072,
  40070. ForceBold: 262144
  40071. };
  40072. var MacStandardGlyphOrdering = [
  40073. '.notdef',
  40074. '.null',
  40075. 'nonmarkingreturn',
  40076. 'space',
  40077. 'exclam',
  40078. 'quotedbl',
  40079. 'numbersign',
  40080. 'dollar',
  40081. 'percent',
  40082. 'ampersand',
  40083. 'quotesingle',
  40084. 'parenleft',
  40085. 'parenright',
  40086. 'asterisk',
  40087. 'plus',
  40088. 'comma',
  40089. 'hyphen',
  40090. 'period',
  40091. 'slash',
  40092. 'zero',
  40093. 'one',
  40094. 'two',
  40095. 'three',
  40096. 'four',
  40097. 'five',
  40098. 'six',
  40099. 'seven',
  40100. 'eight',
  40101. 'nine',
  40102. 'colon',
  40103. 'semicolon',
  40104. 'less',
  40105. 'equal',
  40106. 'greater',
  40107. 'question',
  40108. 'at',
  40109. 'A',
  40110. 'B',
  40111. 'C',
  40112. 'D',
  40113. 'E',
  40114. 'F',
  40115. 'G',
  40116. 'H',
  40117. 'I',
  40118. 'J',
  40119. 'K',
  40120. 'L',
  40121. 'M',
  40122. 'N',
  40123. 'O',
  40124. 'P',
  40125. 'Q',
  40126. 'R',
  40127. 'S',
  40128. 'T',
  40129. 'U',
  40130. 'V',
  40131. 'W',
  40132. 'X',
  40133. 'Y',
  40134. 'Z',
  40135. 'bracketleft',
  40136. 'backslash',
  40137. 'bracketright',
  40138. 'asciicircum',
  40139. 'underscore',
  40140. 'grave',
  40141. 'a',
  40142. 'b',
  40143. 'c',
  40144. 'd',
  40145. 'e',
  40146. 'f',
  40147. 'g',
  40148. 'h',
  40149. 'i',
  40150. 'j',
  40151. 'k',
  40152. 'l',
  40153. 'm',
  40154. 'n',
  40155. 'o',
  40156. 'p',
  40157. 'q',
  40158. 'r',
  40159. 's',
  40160. 't',
  40161. 'u',
  40162. 'v',
  40163. 'w',
  40164. 'x',
  40165. 'y',
  40166. 'z',
  40167. 'braceleft',
  40168. 'bar',
  40169. 'braceright',
  40170. 'asciitilde',
  40171. 'Adieresis',
  40172. 'Aring',
  40173. 'Ccedilla',
  40174. 'Eacute',
  40175. 'Ntilde',
  40176. 'Odieresis',
  40177. 'Udieresis',
  40178. 'aacute',
  40179. 'agrave',
  40180. 'acircumflex',
  40181. 'adieresis',
  40182. 'atilde',
  40183. 'aring',
  40184. 'ccedilla',
  40185. 'eacute',
  40186. 'egrave',
  40187. 'ecircumflex',
  40188. 'edieresis',
  40189. 'iacute',
  40190. 'igrave',
  40191. 'icircumflex',
  40192. 'idieresis',
  40193. 'ntilde',
  40194. 'oacute',
  40195. 'ograve',
  40196. 'ocircumflex',
  40197. 'odieresis',
  40198. 'otilde',
  40199. 'uacute',
  40200. 'ugrave',
  40201. 'ucircumflex',
  40202. 'udieresis',
  40203. 'dagger',
  40204. 'degree',
  40205. 'cent',
  40206. 'sterling',
  40207. 'section',
  40208. 'bullet',
  40209. 'paragraph',
  40210. 'germandbls',
  40211. 'registered',
  40212. 'copyright',
  40213. 'trademark',
  40214. 'acute',
  40215. 'dieresis',
  40216. 'notequal',
  40217. 'AE',
  40218. 'Oslash',
  40219. 'infinity',
  40220. 'plusminus',
  40221. 'lessequal',
  40222. 'greaterequal',
  40223. 'yen',
  40224. 'mu',
  40225. 'partialdiff',
  40226. 'summation',
  40227. 'product',
  40228. 'pi',
  40229. 'integral',
  40230. 'ordfeminine',
  40231. 'ordmasculine',
  40232. 'Omega',
  40233. 'ae',
  40234. 'oslash',
  40235. 'questiondown',
  40236. 'exclamdown',
  40237. 'logicalnot',
  40238. 'radical',
  40239. 'florin',
  40240. 'approxequal',
  40241. 'Delta',
  40242. 'guillemotleft',
  40243. 'guillemotright',
  40244. 'ellipsis',
  40245. 'nonbreakingspace',
  40246. 'Agrave',
  40247. 'Atilde',
  40248. 'Otilde',
  40249. 'OE',
  40250. 'oe',
  40251. 'endash',
  40252. 'emdash',
  40253. 'quotedblleft',
  40254. 'quotedblright',
  40255. 'quoteleft',
  40256. 'quoteright',
  40257. 'divide',
  40258. 'lozenge',
  40259. 'ydieresis',
  40260. 'Ydieresis',
  40261. 'fraction',
  40262. 'currency',
  40263. 'guilsinglleft',
  40264. 'guilsinglright',
  40265. 'fi',
  40266. 'fl',
  40267. 'daggerdbl',
  40268. 'periodcentered',
  40269. 'quotesinglbase',
  40270. 'quotedblbase',
  40271. 'perthousand',
  40272. 'Acircumflex',
  40273. 'Ecircumflex',
  40274. 'Aacute',
  40275. 'Edieresis',
  40276. 'Egrave',
  40277. 'Iacute',
  40278. 'Icircumflex',
  40279. 'Idieresis',
  40280. 'Igrave',
  40281. 'Oacute',
  40282. 'Ocircumflex',
  40283. 'apple',
  40284. 'Ograve',
  40285. 'Uacute',
  40286. 'Ucircumflex',
  40287. 'Ugrave',
  40288. 'dotlessi',
  40289. 'circumflex',
  40290. 'tilde',
  40291. 'macron',
  40292. 'breve',
  40293. 'dotaccent',
  40294. 'ring',
  40295. 'cedilla',
  40296. 'hungarumlaut',
  40297. 'ogonek',
  40298. 'caron',
  40299. 'Lslash',
  40300. 'lslash',
  40301. 'Scaron',
  40302. 'scaron',
  40303. 'Zcaron',
  40304. 'zcaron',
  40305. 'brokenbar',
  40306. 'Eth',
  40307. 'eth',
  40308. 'Yacute',
  40309. 'yacute',
  40310. 'Thorn',
  40311. 'thorn',
  40312. 'minus',
  40313. 'multiply',
  40314. 'onesuperior',
  40315. 'twosuperior',
  40316. 'threesuperior',
  40317. 'onehalf',
  40318. 'onequarter',
  40319. 'threequarters',
  40320. 'franc',
  40321. 'Gbreve',
  40322. 'gbreve',
  40323. 'Idotaccent',
  40324. 'Scedilla',
  40325. 'scedilla',
  40326. 'Cacute',
  40327. 'cacute',
  40328. 'Ccaron',
  40329. 'ccaron',
  40330. 'dcroat'
  40331. ];
  40332. function adjustWidths(properties) {
  40333. if (!properties.fontMatrix) {
  40334. return;
  40335. }
  40336. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  40337. return;
  40338. }
  40339. var scale = 0.001 / properties.fontMatrix[0];
  40340. var glyphsWidths = properties.widths;
  40341. for (var glyph in glyphsWidths) {
  40342. glyphsWidths[glyph] *= scale;
  40343. }
  40344. properties.defaultWidth *= scale;
  40345. }
  40346. function adjustToUnicode(properties, builtInEncoding) {
  40347. if (properties.hasIncludedToUnicodeMap) {
  40348. return;
  40349. }
  40350. if (properties.hasEncoding) {
  40351. return;
  40352. }
  40353. if (builtInEncoding === properties.defaultEncoding) {
  40354. return;
  40355. }
  40356. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  40357. return;
  40358. }
  40359. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  40360. for (var charCode in builtInEncoding) {
  40361. var glyphName = builtInEncoding[charCode];
  40362. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40363. if (unicode !== -1) {
  40364. toUnicode[charCode] = String.fromCharCode(unicode);
  40365. }
  40366. }
  40367. properties.toUnicode.amend(toUnicode);
  40368. }
  40369. function getFontType(type, subtype) {
  40370. switch (type) {
  40371. case 'Type1':
  40372. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  40373. case 'CIDFontType0':
  40374. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  40375. case 'OpenType':
  40376. return FontType.OPENTYPE;
  40377. case 'TrueType':
  40378. return FontType.TRUETYPE;
  40379. case 'CIDFontType2':
  40380. return FontType.CIDFONTTYPE2;
  40381. case 'MMType1':
  40382. return FontType.MMTYPE1;
  40383. case 'Type0':
  40384. return FontType.TYPE0;
  40385. default:
  40386. return FontType.UNKNOWN;
  40387. }
  40388. }
  40389. function recoverGlyphName(name, glyphsUnicodeMap) {
  40390. if (glyphsUnicodeMap[name] !== undefined) {
  40391. return name;
  40392. }
  40393. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  40394. if (unicode !== -1) {
  40395. for (var key in glyphsUnicodeMap) {
  40396. if (glyphsUnicodeMap[key] === unicode) {
  40397. return key;
  40398. }
  40399. }
  40400. }
  40401. info('Unable to recover a standard glyph name for: ' + name);
  40402. return name;
  40403. }
  40404. var Glyph = function GlyphClosure() {
  40405. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40406. this.fontChar = fontChar;
  40407. this.unicode = unicode;
  40408. this.accent = accent;
  40409. this.width = width;
  40410. this.vmetric = vmetric;
  40411. this.operatorListId = operatorListId;
  40412. this.isSpace = isSpace;
  40413. this.isInFont = isInFont;
  40414. }
  40415. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40416. 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;
  40417. };
  40418. return Glyph;
  40419. }();
  40420. var ToUnicodeMap = function ToUnicodeMapClosure() {
  40421. function ToUnicodeMap(cmap) {
  40422. this._map = cmap;
  40423. }
  40424. ToUnicodeMap.prototype = {
  40425. get length() {
  40426. return this._map.length;
  40427. },
  40428. forEach: function (callback) {
  40429. for (var charCode in this._map) {
  40430. callback(charCode, this._map[charCode].charCodeAt(0));
  40431. }
  40432. },
  40433. has: function (i) {
  40434. return this._map[i] !== undefined;
  40435. },
  40436. get: function (i) {
  40437. return this._map[i];
  40438. },
  40439. charCodeOf: function (v) {
  40440. return this._map.indexOf(v);
  40441. },
  40442. amend: function (map) {
  40443. for (var charCode in map) {
  40444. this._map[charCode] = map[charCode];
  40445. }
  40446. }
  40447. };
  40448. return ToUnicodeMap;
  40449. }();
  40450. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  40451. function IdentityToUnicodeMap(firstChar, lastChar) {
  40452. this.firstChar = firstChar;
  40453. this.lastChar = lastChar;
  40454. }
  40455. IdentityToUnicodeMap.prototype = {
  40456. get length() {
  40457. return this.lastChar + 1 - this.firstChar;
  40458. },
  40459. forEach: function (callback) {
  40460. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40461. callback(i, i);
  40462. }
  40463. },
  40464. has: function (i) {
  40465. return this.firstChar <= i && i <= this.lastChar;
  40466. },
  40467. get: function (i) {
  40468. if (this.firstChar <= i && i <= this.lastChar) {
  40469. return String.fromCharCode(i);
  40470. }
  40471. return undefined;
  40472. },
  40473. charCodeOf: function (v) {
  40474. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40475. },
  40476. amend: function (map) {
  40477. error('Should not call amend()');
  40478. }
  40479. };
  40480. return IdentityToUnicodeMap;
  40481. }();
  40482. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  40483. function writeInt16(dest, offset, num) {
  40484. dest[offset] = num >> 8 & 0xFF;
  40485. dest[offset + 1] = num & 0xFF;
  40486. }
  40487. function writeInt32(dest, offset, num) {
  40488. dest[offset] = num >> 24 & 0xFF;
  40489. dest[offset + 1] = num >> 16 & 0xFF;
  40490. dest[offset + 2] = num >> 8 & 0xFF;
  40491. dest[offset + 3] = num & 0xFF;
  40492. }
  40493. function writeData(dest, offset, data) {
  40494. var i, ii;
  40495. if (data instanceof Uint8Array) {
  40496. dest.set(data, offset);
  40497. } else if (typeof data === 'string') {
  40498. for (i = 0, ii = data.length; i < ii; i++) {
  40499. dest[offset++] = data.charCodeAt(i) & 0xFF;
  40500. }
  40501. } else {
  40502. for (i = 0, ii = data.length; i < ii; i++) {
  40503. dest[offset++] = data[i] & 0xFF;
  40504. }
  40505. }
  40506. }
  40507. function OpenTypeFileBuilder(sfnt) {
  40508. this.sfnt = sfnt;
  40509. this.tables = Object.create(null);
  40510. }
  40511. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  40512. var maxPower2 = 1, log2 = 0;
  40513. while ((maxPower2 ^ entriesCount) > maxPower2) {
  40514. maxPower2 <<= 1;
  40515. log2++;
  40516. }
  40517. var searchRange = maxPower2 * entrySize;
  40518. return {
  40519. range: searchRange,
  40520. entry: log2,
  40521. rangeShift: entrySize * entriesCount - searchRange
  40522. };
  40523. };
  40524. var OTF_HEADER_SIZE = 12;
  40525. var OTF_TABLE_ENTRY_SIZE = 16;
  40526. OpenTypeFileBuilder.prototype = {
  40527. toArray: function OpenTypeFileBuilder_toArray() {
  40528. var sfnt = this.sfnt;
  40529. var tables = this.tables;
  40530. var tablesNames = Object.keys(tables);
  40531. tablesNames.sort();
  40532. var numTables = tablesNames.length;
  40533. var i, j, jj, table, tableName;
  40534. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  40535. var tableOffsets = [offset];
  40536. for (i = 0; i < numTables; i++) {
  40537. table = tables[tablesNames[i]];
  40538. var paddedLength = (table.length + 3 & ~3) >>> 0;
  40539. offset += paddedLength;
  40540. tableOffsets.push(offset);
  40541. }
  40542. var file = new Uint8Array(offset);
  40543. for (i = 0; i < numTables; i++) {
  40544. table = tables[tablesNames[i]];
  40545. writeData(file, tableOffsets[i], table);
  40546. }
  40547. if (sfnt === 'true') {
  40548. sfnt = string32(0x00010000);
  40549. }
  40550. file[0] = sfnt.charCodeAt(0) & 0xFF;
  40551. file[1] = sfnt.charCodeAt(1) & 0xFF;
  40552. file[2] = sfnt.charCodeAt(2) & 0xFF;
  40553. file[3] = sfnt.charCodeAt(3) & 0xFF;
  40554. writeInt16(file, 4, numTables);
  40555. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  40556. writeInt16(file, 6, searchParams.range);
  40557. writeInt16(file, 8, searchParams.entry);
  40558. writeInt16(file, 10, searchParams.rangeShift);
  40559. offset = OTF_HEADER_SIZE;
  40560. for (i = 0; i < numTables; i++) {
  40561. tableName = tablesNames[i];
  40562. file[offset] = tableName.charCodeAt(0) & 0xFF;
  40563. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  40564. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  40565. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  40566. var checksum = 0;
  40567. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  40568. var quad = readUint32(file, j);
  40569. checksum = checksum + quad >>> 0;
  40570. }
  40571. writeInt32(file, offset + 4, checksum);
  40572. writeInt32(file, offset + 8, tableOffsets[i]);
  40573. writeInt32(file, offset + 12, tables[tableName].length);
  40574. offset += OTF_TABLE_ENTRY_SIZE;
  40575. }
  40576. return file;
  40577. },
  40578. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  40579. if (tag in this.tables) {
  40580. throw new Error('Table ' + tag + ' already exists');
  40581. }
  40582. this.tables[tag] = data;
  40583. }
  40584. };
  40585. return OpenTypeFileBuilder;
  40586. }();
  40587. var ProblematicCharRanges = new Int32Array([
  40588. 0x0000,
  40589. 0x0020,
  40590. 0x007F,
  40591. 0x00A1,
  40592. 0x00AD,
  40593. 0x00AE,
  40594. 0x0600,
  40595. 0x0780,
  40596. 0x08A0,
  40597. 0x10A0,
  40598. 0x1780,
  40599. 0x1800,
  40600. 0x1C00,
  40601. 0x1C50,
  40602. 0x2000,
  40603. 0x2010,
  40604. 0x2011,
  40605. 0x2012,
  40606. 0x2028,
  40607. 0x2030,
  40608. 0x205F,
  40609. 0x2070,
  40610. 0x25CC,
  40611. 0x25CD,
  40612. 0x3000,
  40613. 0x3001,
  40614. 0xAA60,
  40615. 0xAA80,
  40616. 0xFFF0,
  40617. 0x10000
  40618. ]);
  40619. var Font = function FontClosure() {
  40620. function Font(name, file, properties) {
  40621. var charCode, glyphName, unicode;
  40622. this.name = name;
  40623. this.loadedName = properties.loadedName;
  40624. this.isType3Font = properties.isType3Font;
  40625. this.sizes = [];
  40626. this.missingFile = false;
  40627. this.glyphCache = Object.create(null);
  40628. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  40629. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  40630. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  40631. var type = properties.type;
  40632. var subtype = properties.subtype;
  40633. this.type = type;
  40634. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  40635. this.differences = properties.differences;
  40636. this.widths = properties.widths;
  40637. this.defaultWidth = properties.defaultWidth;
  40638. this.composite = properties.composite;
  40639. this.wideChars = properties.wideChars;
  40640. this.cMap = properties.cMap;
  40641. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  40642. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  40643. this.fontMatrix = properties.fontMatrix;
  40644. this.bbox = properties.bbox;
  40645. this.toUnicode = properties.toUnicode;
  40646. this.toFontChar = [];
  40647. if (properties.type === 'Type3') {
  40648. for (charCode = 0; charCode < 256; charCode++) {
  40649. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  40650. }
  40651. this.fontType = FontType.TYPE3;
  40652. return;
  40653. }
  40654. this.cidEncoding = properties.cidEncoding;
  40655. this.vertical = properties.vertical;
  40656. if (this.vertical) {
  40657. this.vmetrics = properties.vmetrics;
  40658. this.defaultVMetrics = properties.defaultVMetrics;
  40659. }
  40660. var glyphsUnicodeMap;
  40661. if (!file || file.isEmpty) {
  40662. if (file) {
  40663. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  40664. }
  40665. this.missingFile = true;
  40666. var fontName = name.replace(/[,_]/g, '-');
  40667. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  40668. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  40669. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  40670. this.bold = fontName.search(/bold/gi) !== -1;
  40671. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  40672. this.black = name.search(/Black/g) !== -1;
  40673. this.remeasure = Object.keys(this.widths).length > 0;
  40674. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  40675. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  40676. var map = [];
  40677. for (charCode in GlyphMapForStandardFonts) {
  40678. map[+charCode] = GlyphMapForStandardFonts[charCode];
  40679. }
  40680. if (/Arial-?Black/i.test(name)) {
  40681. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  40682. for (charCode in SupplementalGlyphMapForArialBlack) {
  40683. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  40684. }
  40685. }
  40686. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  40687. if (!isIdentityUnicode) {
  40688. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40689. map[+charCode] = unicodeCharCode;
  40690. });
  40691. }
  40692. this.toFontChar = map;
  40693. this.toUnicode = new ToUnicodeMap(map);
  40694. } else if (/Symbol/i.test(fontName)) {
  40695. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  40696. } else if (/Dingbats/i.test(fontName)) {
  40697. if (/Wingdings/i.test(name)) {
  40698. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  40699. }
  40700. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  40701. } else if (isStandardFont) {
  40702. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  40703. } else {
  40704. glyphsUnicodeMap = getGlyphsUnicode();
  40705. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40706. if (!this.composite) {
  40707. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  40708. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40709. if (unicode !== -1) {
  40710. unicodeCharCode = unicode;
  40711. }
  40712. }
  40713. this.toFontChar[charCode] = unicodeCharCode;
  40714. }.bind(this));
  40715. }
  40716. this.loadedName = fontName.split('-')[0];
  40717. this.loading = false;
  40718. this.fontType = getFontType(type, subtype);
  40719. return;
  40720. }
  40721. if (subtype === 'Type1C') {
  40722. if (type !== 'Type1' && type !== 'MMType1') {
  40723. if (isTrueTypeFile(file)) {
  40724. subtype = 'TrueType';
  40725. } else {
  40726. type = 'Type1';
  40727. }
  40728. } else if (isOpenTypeFile(file)) {
  40729. type = subtype = 'OpenType';
  40730. }
  40731. }
  40732. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  40733. type = 'CIDFontType0';
  40734. }
  40735. if (subtype === 'OpenType') {
  40736. type = 'OpenType';
  40737. }
  40738. if (type === 'CIDFontType0') {
  40739. if (isType1File(file)) {
  40740. subtype = 'CIDFontType0';
  40741. } else if (isOpenTypeFile(file)) {
  40742. type = subtype = 'OpenType';
  40743. } else {
  40744. subtype = 'CIDFontType0C';
  40745. }
  40746. }
  40747. var data;
  40748. switch (type) {
  40749. case 'MMType1':
  40750. info('MMType1 font (' + name + '), falling back to Type1.');
  40751. case 'Type1':
  40752. case 'CIDFontType0':
  40753. this.mimetype = 'font/opentype';
  40754. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  40755. adjustWidths(properties);
  40756. data = this.convert(name, cff, properties);
  40757. break;
  40758. case 'OpenType':
  40759. case 'TrueType':
  40760. case 'CIDFontType2':
  40761. this.mimetype = 'font/opentype';
  40762. data = this.checkAndRepair(name, file, properties);
  40763. if (this.isOpenType) {
  40764. adjustWidths(properties);
  40765. type = 'OpenType';
  40766. }
  40767. break;
  40768. default:
  40769. error('Font ' + type + ' is not supported');
  40770. break;
  40771. }
  40772. this.data = data;
  40773. this.fontType = getFontType(type, subtype);
  40774. this.fontMatrix = properties.fontMatrix;
  40775. this.widths = properties.widths;
  40776. this.defaultWidth = properties.defaultWidth;
  40777. this.toUnicode = properties.toUnicode;
  40778. this.encoding = properties.baseEncoding;
  40779. this.seacMap = properties.seacMap;
  40780. this.loading = true;
  40781. }
  40782. Font.getFontID = function () {
  40783. var ID = 1;
  40784. return function Font_getFontID() {
  40785. return String(ID++);
  40786. };
  40787. }();
  40788. function int16(b0, b1) {
  40789. return (b0 << 8) + b1;
  40790. }
  40791. function signedInt16(b0, b1) {
  40792. var value = (b0 << 8) + b1;
  40793. return value & 1 << 15 ? value - 0x10000 : value;
  40794. }
  40795. function int32(b0, b1, b2, b3) {
  40796. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  40797. }
  40798. function string16(value) {
  40799. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40800. }
  40801. function safeString16(value) {
  40802. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  40803. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40804. }
  40805. function isTrueTypeFile(file) {
  40806. var header = file.peekBytes(4);
  40807. return readUint32(header, 0) === 0x00010000;
  40808. }
  40809. function isOpenTypeFile(file) {
  40810. var header = file.peekBytes(4);
  40811. return bytesToString(header) === 'OTTO';
  40812. }
  40813. function isType1File(file) {
  40814. var header = file.peekBytes(2);
  40815. if (header[0] === 0x25 && header[1] === 0x21) {
  40816. return true;
  40817. }
  40818. if (header[0] === 0x80 && header[1] === 0x01) {
  40819. return true;
  40820. }
  40821. return false;
  40822. }
  40823. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  40824. var toFontChar = [], unicode;
  40825. for (var i = 0, ii = encoding.length; i < ii; i++) {
  40826. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  40827. if (unicode !== -1) {
  40828. toFontChar[i] = unicode;
  40829. }
  40830. }
  40831. for (var charCode in differences) {
  40832. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  40833. if (unicode !== -1) {
  40834. toFontChar[+charCode] = unicode;
  40835. }
  40836. }
  40837. return toFontChar;
  40838. }
  40839. function isProblematicUnicodeLocation(code) {
  40840. var i = 0, j = ProblematicCharRanges.length - 1;
  40841. while (i < j) {
  40842. var c = i + j + 1 >> 1;
  40843. if (code < ProblematicCharRanges[c]) {
  40844. j = c - 1;
  40845. } else {
  40846. i = c;
  40847. }
  40848. }
  40849. return !(i & 1);
  40850. }
  40851. function adjustMapping(charCodeToGlyphId, properties) {
  40852. var toUnicode = properties.toUnicode;
  40853. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40854. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40855. var newMap = Object.create(null);
  40856. var toFontChar = [];
  40857. var usedFontCharCodes = [];
  40858. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40859. for (var originalCharCode in charCodeToGlyphId) {
  40860. originalCharCode |= 0;
  40861. var glyphId = charCodeToGlyphId[originalCharCode];
  40862. var fontCharCode = originalCharCode;
  40863. var hasUnicodeValue = false;
  40864. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40865. hasUnicodeValue = true;
  40866. var unicode = toUnicode.get(fontCharCode);
  40867. if (unicode.length === 1) {
  40868. fontCharCode = unicode.charCodeAt(0);
  40869. }
  40870. }
  40871. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40872. do {
  40873. fontCharCode = nextAvailableFontCharCode++;
  40874. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40875. fontCharCode = 0xF020;
  40876. nextAvailableFontCharCode = fontCharCode + 1;
  40877. }
  40878. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40879. }
  40880. newMap[fontCharCode] = glyphId;
  40881. toFontChar[originalCharCode] = fontCharCode;
  40882. usedFontCharCodes[fontCharCode] = true;
  40883. }
  40884. return {
  40885. toFontChar: toFontChar,
  40886. charCodeToGlyphId: newMap,
  40887. nextAvailableFontCharCode: nextAvailableFontCharCode
  40888. };
  40889. }
  40890. function getRanges(glyphs, numGlyphs) {
  40891. var codes = [];
  40892. for (var charCode in glyphs) {
  40893. if (glyphs[charCode] >= numGlyphs) {
  40894. continue;
  40895. }
  40896. codes.push({
  40897. fontCharCode: charCode | 0,
  40898. glyphId: glyphs[charCode]
  40899. });
  40900. }
  40901. codes.sort(function fontGetRangesSort(a, b) {
  40902. return a.fontCharCode - b.fontCharCode;
  40903. });
  40904. var ranges = [];
  40905. var length = codes.length;
  40906. for (var n = 0; n < length;) {
  40907. var start = codes[n].fontCharCode;
  40908. var codeIndices = [codes[n].glyphId];
  40909. ++n;
  40910. var end = start;
  40911. while (n < length && end + 1 === codes[n].fontCharCode) {
  40912. codeIndices.push(codes[n].glyphId);
  40913. ++end;
  40914. ++n;
  40915. if (end === 0xFFFF) {
  40916. break;
  40917. }
  40918. }
  40919. ranges.push([
  40920. start,
  40921. end,
  40922. codeIndices
  40923. ]);
  40924. }
  40925. return ranges;
  40926. }
  40927. function createCmapTable(glyphs, numGlyphs) {
  40928. var ranges = getRanges(glyphs, numGlyphs);
  40929. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40930. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40931. var i, ii, j, jj;
  40932. for (i = ranges.length - 1; i >= 0; --i) {
  40933. if (ranges[i][0] <= 0xFFFF) {
  40934. break;
  40935. }
  40936. }
  40937. var bmpLength = i + 1;
  40938. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40939. ranges[i][1] = 0xFFFE;
  40940. }
  40941. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40942. var segCount = bmpLength + trailingRangesCount;
  40943. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40944. var startCount = '';
  40945. var endCount = '';
  40946. var idDeltas = '';
  40947. var idRangeOffsets = '';
  40948. var glyphsIds = '';
  40949. var bias = 0;
  40950. var range, start, end, codes;
  40951. for (i = 0, ii = bmpLength; i < ii; i++) {
  40952. range = ranges[i];
  40953. start = range[0];
  40954. end = range[1];
  40955. startCount += string16(start);
  40956. endCount += string16(end);
  40957. codes = range[2];
  40958. var contiguous = true;
  40959. for (j = 1, jj = codes.length; j < jj; ++j) {
  40960. if (codes[j] !== codes[j - 1] + 1) {
  40961. contiguous = false;
  40962. break;
  40963. }
  40964. }
  40965. if (!contiguous) {
  40966. var offset = (segCount - i) * 2 + bias * 2;
  40967. bias += end - start + 1;
  40968. idDeltas += string16(0);
  40969. idRangeOffsets += string16(offset);
  40970. for (j = 0, jj = codes.length; j < jj; ++j) {
  40971. glyphsIds += string16(codes[j]);
  40972. }
  40973. } else {
  40974. var startCode = codes[0];
  40975. idDeltas += string16(startCode - start & 0xFFFF);
  40976. idRangeOffsets += string16(0);
  40977. }
  40978. }
  40979. if (trailingRangesCount > 0) {
  40980. endCount += '\xFF\xFF';
  40981. startCount += '\xFF\xFF';
  40982. idDeltas += '\x00\x01';
  40983. idRangeOffsets += '\x00\x00';
  40984. }
  40985. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40986. var format31012 = '';
  40987. var header31012 = '';
  40988. if (numTables > 1) {
  40989. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40990. format31012 = '';
  40991. for (i = 0, ii = ranges.length; i < ii; i++) {
  40992. range = ranges[i];
  40993. start = range[0];
  40994. codes = range[2];
  40995. var code = codes[0];
  40996. for (j = 1, jj = codes.length; j < jj; ++j) {
  40997. if (codes[j] !== codes[j - 1] + 1) {
  40998. end = range[0] + j - 1;
  40999. format31012 += string32(start) + string32(end) + string32(code);
  41000. start = end + 1;
  41001. code = codes[j];
  41002. }
  41003. }
  41004. format31012 += string32(start) + string32(range[1]) + string32(code);
  41005. }
  41006. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  41007. }
  41008. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  41009. }
  41010. function validateOS2Table(os2) {
  41011. var stream = new Stream(os2.data);
  41012. var version = stream.getUint16();
  41013. stream.getBytes(60);
  41014. var selection = stream.getUint16();
  41015. if (version < 4 && selection & 0x0300) {
  41016. return false;
  41017. }
  41018. var firstChar = stream.getUint16();
  41019. var lastChar = stream.getUint16();
  41020. if (firstChar > lastChar) {
  41021. return false;
  41022. }
  41023. stream.getBytes(6);
  41024. var usWinAscent = stream.getUint16();
  41025. if (usWinAscent === 0) {
  41026. return false;
  41027. }
  41028. os2.data[8] = os2.data[9] = 0;
  41029. return true;
  41030. }
  41031. function createOS2Table(properties, charstrings, override) {
  41032. override = override || {
  41033. unitsPerEm: 0,
  41034. yMax: 0,
  41035. yMin: 0,
  41036. ascent: 0,
  41037. descent: 0
  41038. };
  41039. var ulUnicodeRange1 = 0;
  41040. var ulUnicodeRange2 = 0;
  41041. var ulUnicodeRange3 = 0;
  41042. var ulUnicodeRange4 = 0;
  41043. var firstCharIndex = null;
  41044. var lastCharIndex = 0;
  41045. if (charstrings) {
  41046. for (var code in charstrings) {
  41047. code |= 0;
  41048. if (firstCharIndex > code || !firstCharIndex) {
  41049. firstCharIndex = code;
  41050. }
  41051. if (lastCharIndex < code) {
  41052. lastCharIndex = code;
  41053. }
  41054. var position = getUnicodeRangeFor(code);
  41055. if (position < 32) {
  41056. ulUnicodeRange1 |= 1 << position;
  41057. } else if (position < 64) {
  41058. ulUnicodeRange2 |= 1 << position - 32;
  41059. } else if (position < 96) {
  41060. ulUnicodeRange3 |= 1 << position - 64;
  41061. } else if (position < 123) {
  41062. ulUnicodeRange4 |= 1 << position - 96;
  41063. } else {
  41064. error('Unicode ranges Bits > 123 are reserved for internal usage');
  41065. }
  41066. }
  41067. } else {
  41068. firstCharIndex = 0;
  41069. lastCharIndex = 255;
  41070. }
  41071. var bbox = properties.bbox || [
  41072. 0,
  41073. 0,
  41074. 0,
  41075. 0
  41076. ];
  41077. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41078. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  41079. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  41080. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  41081. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  41082. typoDescent = -typoDescent;
  41083. }
  41084. var winAscent = override.yMax || typoAscent;
  41085. var winDescent = -override.yMin || -typoDescent;
  41086. 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' + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + 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';
  41087. }
  41088. function createPostTable(properties) {
  41089. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  41090. return '\x00\x03\x00\x00' + string32(angle) + '\x00\x00' + '\x00\x00' + string32(properties.fixedPitch) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00';
  41091. }
  41092. function createNameTable(name, proto) {
  41093. if (!proto) {
  41094. proto = [
  41095. [],
  41096. []
  41097. ];
  41098. }
  41099. var strings = [
  41100. proto[0][0] || 'Original licence',
  41101. proto[0][1] || name,
  41102. proto[0][2] || 'Unknown',
  41103. proto[0][3] || 'uniqueID',
  41104. proto[0][4] || name,
  41105. proto[0][5] || 'Version 0.11',
  41106. proto[0][6] || '',
  41107. proto[0][7] || 'Unknown',
  41108. proto[0][8] || 'Unknown',
  41109. proto[0][9] || 'Unknown'
  41110. ];
  41111. var stringsUnicode = [];
  41112. var i, ii, j, jj, str;
  41113. for (i = 0, ii = strings.length; i < ii; i++) {
  41114. str = proto[1][i] || strings[i];
  41115. var strBufUnicode = [];
  41116. for (j = 0, jj = str.length; j < jj; j++) {
  41117. strBufUnicode.push(string16(str.charCodeAt(j)));
  41118. }
  41119. stringsUnicode.push(strBufUnicode.join(''));
  41120. }
  41121. var names = [
  41122. strings,
  41123. stringsUnicode
  41124. ];
  41125. var platforms = [
  41126. '\x00\x01',
  41127. '\x00\x03'
  41128. ];
  41129. var encodings = [
  41130. '\x00\x00',
  41131. '\x00\x01'
  41132. ];
  41133. var languages = [
  41134. '\x00\x00',
  41135. '\x04\x09'
  41136. ];
  41137. var namesRecordCount = strings.length * platforms.length;
  41138. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  41139. var strOffset = 0;
  41140. for (i = 0, ii = platforms.length; i < ii; i++) {
  41141. var strs = names[i];
  41142. for (j = 0, jj = strs.length; j < jj; j++) {
  41143. str = strs[j];
  41144. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  41145. nameTable += nameRecord;
  41146. strOffset += str.length;
  41147. }
  41148. }
  41149. nameTable += strings.join('') + stringsUnicode.join('');
  41150. return nameTable;
  41151. }
  41152. Font.prototype = {
  41153. name: null,
  41154. font: null,
  41155. mimetype: null,
  41156. encoding: null,
  41157. get renderer() {
  41158. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  41159. return shadow(this, 'renderer', renderer);
  41160. },
  41161. exportData: function Font_exportData() {
  41162. var data = {};
  41163. for (var i in this) {
  41164. if (this.hasOwnProperty(i)) {
  41165. data[i] = this[i];
  41166. }
  41167. }
  41168. return data;
  41169. },
  41170. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  41171. function readTableEntry(file) {
  41172. var tag = bytesToString(file.getBytes(4));
  41173. var checksum = file.getInt32() >>> 0;
  41174. var offset = file.getInt32() >>> 0;
  41175. var length = file.getInt32() >>> 0;
  41176. var previousPosition = file.pos;
  41177. file.pos = file.start ? file.start : 0;
  41178. file.skip(offset);
  41179. var data = file.getBytes(length);
  41180. file.pos = previousPosition;
  41181. if (tag === 'head') {
  41182. data[8] = data[9] = data[10] = data[11] = 0;
  41183. data[17] |= 0x20;
  41184. }
  41185. return {
  41186. tag: tag,
  41187. checksum: checksum,
  41188. length: length,
  41189. offset: offset,
  41190. data: data
  41191. };
  41192. }
  41193. function readOpenTypeHeader(ttf) {
  41194. return {
  41195. version: bytesToString(ttf.getBytes(4)),
  41196. numTables: ttf.getUint16(),
  41197. searchRange: ttf.getUint16(),
  41198. entrySelector: ttf.getUint16(),
  41199. rangeShift: ttf.getUint16()
  41200. };
  41201. }
  41202. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  41203. if (!cmap) {
  41204. warn('No cmap table available.');
  41205. return {
  41206. platformId: -1,
  41207. encodingId: -1,
  41208. mappings: [],
  41209. hasShortCmap: false
  41210. };
  41211. }
  41212. var segment;
  41213. var start = (font.start ? font.start : 0) + cmap.offset;
  41214. font.pos = start;
  41215. font.getUint16();
  41216. var numTables = font.getUint16();
  41217. var potentialTable;
  41218. var canBreak = false;
  41219. for (var i = 0; i < numTables; i++) {
  41220. var platformId = font.getUint16();
  41221. var encodingId = font.getUint16();
  41222. var offset = font.getInt32() >>> 0;
  41223. var useTable = false;
  41224. if (platformId === 0 && encodingId === 0) {
  41225. useTable = true;
  41226. } else if (platformId === 1 && encodingId === 0) {
  41227. useTable = true;
  41228. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  41229. useTable = true;
  41230. if (!isSymbolicFont) {
  41231. canBreak = true;
  41232. }
  41233. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  41234. useTable = true;
  41235. canBreak = true;
  41236. }
  41237. if (useTable) {
  41238. potentialTable = {
  41239. platformId: platformId,
  41240. encodingId: encodingId,
  41241. offset: offset
  41242. };
  41243. }
  41244. if (canBreak) {
  41245. break;
  41246. }
  41247. }
  41248. if (potentialTable) {
  41249. font.pos = start + potentialTable.offset;
  41250. }
  41251. if (!potentialTable || font.peekByte() === -1) {
  41252. warn('Could not find a preferred cmap table.');
  41253. return {
  41254. platformId: -1,
  41255. encodingId: -1,
  41256. mappings: [],
  41257. hasShortCmap: false
  41258. };
  41259. }
  41260. var format = font.getUint16();
  41261. font.getUint16();
  41262. font.getUint16();
  41263. var hasShortCmap = false;
  41264. var mappings = [];
  41265. var j, glyphId;
  41266. if (format === 0) {
  41267. for (j = 0; j < 256; j++) {
  41268. var index = font.getByte();
  41269. if (!index) {
  41270. continue;
  41271. }
  41272. mappings.push({
  41273. charCode: j,
  41274. glyphId: index
  41275. });
  41276. }
  41277. hasShortCmap = true;
  41278. } else if (format === 4) {
  41279. var segCount = font.getUint16() >> 1;
  41280. font.getBytes(6);
  41281. var segIndex, segments = [];
  41282. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41283. segments.push({ end: font.getUint16() });
  41284. }
  41285. font.getUint16();
  41286. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41287. segments[segIndex].start = font.getUint16();
  41288. }
  41289. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41290. segments[segIndex].delta = font.getUint16();
  41291. }
  41292. var offsetsCount = 0;
  41293. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41294. segment = segments[segIndex];
  41295. var rangeOffset = font.getUint16();
  41296. if (!rangeOffset) {
  41297. segment.offsetIndex = -1;
  41298. continue;
  41299. }
  41300. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  41301. segment.offsetIndex = offsetIndex;
  41302. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  41303. }
  41304. var offsets = [];
  41305. for (j = 0; j < offsetsCount; j++) {
  41306. offsets.push(font.getUint16());
  41307. }
  41308. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41309. segment = segments[segIndex];
  41310. start = segment.start;
  41311. var end = segment.end;
  41312. var delta = segment.delta;
  41313. offsetIndex = segment.offsetIndex;
  41314. for (j = start; j <= end; j++) {
  41315. if (j === 0xFFFF) {
  41316. continue;
  41317. }
  41318. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  41319. glyphId = glyphId + delta & 0xFFFF;
  41320. if (glyphId === 0) {
  41321. continue;
  41322. }
  41323. mappings.push({
  41324. charCode: j,
  41325. glyphId: glyphId
  41326. });
  41327. }
  41328. }
  41329. } else if (format === 6) {
  41330. var firstCode = font.getUint16();
  41331. var entryCount = font.getUint16();
  41332. for (j = 0; j < entryCount; j++) {
  41333. glyphId = font.getUint16();
  41334. var charCode = firstCode + j;
  41335. mappings.push({
  41336. charCode: charCode,
  41337. glyphId: glyphId
  41338. });
  41339. }
  41340. } else {
  41341. warn('cmap table has unsupported format: ' + format);
  41342. return {
  41343. platformId: -1,
  41344. encodingId: -1,
  41345. mappings: [],
  41346. hasShortCmap: false
  41347. };
  41348. }
  41349. mappings.sort(function (a, b) {
  41350. return a.charCode - b.charCode;
  41351. });
  41352. for (i = 1; i < mappings.length; i++) {
  41353. if (mappings[i - 1].charCode === mappings[i].charCode) {
  41354. mappings.splice(i, 1);
  41355. i--;
  41356. }
  41357. }
  41358. return {
  41359. platformId: potentialTable.platformId,
  41360. encodingId: potentialTable.encodingId,
  41361. mappings: mappings,
  41362. hasShortCmap: hasShortCmap
  41363. };
  41364. }
  41365. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  41366. if (!header) {
  41367. if (metrics) {
  41368. metrics.data = null;
  41369. }
  41370. return;
  41371. }
  41372. font.pos = (font.start ? font.start : 0) + header.offset;
  41373. font.pos += header.length - 2;
  41374. var numOfMetrics = font.getUint16();
  41375. if (numOfMetrics > numGlyphs) {
  41376. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  41377. numOfMetrics = numGlyphs;
  41378. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  41379. header.data[35] = numOfMetrics & 0x00ff;
  41380. }
  41381. var numOfSidebearings = numGlyphs - numOfMetrics;
  41382. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  41383. if (numMissing > 0) {
  41384. var entries = new Uint8Array(metrics.length + numMissing * 2);
  41385. entries.set(metrics.data);
  41386. metrics.data = entries;
  41387. }
  41388. }
  41389. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  41390. if (sourceEnd - sourceStart <= 12) {
  41391. return 0;
  41392. }
  41393. var glyf = source.subarray(sourceStart, sourceEnd);
  41394. var contoursCount = glyf[0] << 8 | glyf[1];
  41395. if (contoursCount & 0x8000) {
  41396. dest.set(glyf, destStart);
  41397. return glyf.length;
  41398. }
  41399. var i, j = 10, flagsCount = 0;
  41400. for (i = 0; i < contoursCount; i++) {
  41401. var endPoint = glyf[j] << 8 | glyf[j + 1];
  41402. flagsCount = endPoint + 1;
  41403. j += 2;
  41404. }
  41405. var instructionsStart = j;
  41406. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  41407. j += 2 + instructionsLength;
  41408. var instructionsEnd = j;
  41409. var coordinatesLength = 0;
  41410. for (i = 0; i < flagsCount; i++) {
  41411. var flag = glyf[j++];
  41412. if (flag & 0xC0) {
  41413. glyf[j - 1] = flag & 0x3F;
  41414. }
  41415. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  41416. coordinatesLength += xyLength;
  41417. if (flag & 8) {
  41418. var repeat = glyf[j++];
  41419. i += repeat;
  41420. coordinatesLength += repeat * xyLength;
  41421. }
  41422. }
  41423. if (coordinatesLength === 0) {
  41424. return 0;
  41425. }
  41426. var glyphDataLength = j + coordinatesLength;
  41427. if (glyphDataLength > glyf.length) {
  41428. return 0;
  41429. }
  41430. if (!hintsValid && instructionsLength > 0) {
  41431. dest.set(glyf.subarray(0, instructionsStart), destStart);
  41432. dest.set([
  41433. 0,
  41434. 0
  41435. ], destStart + instructionsStart);
  41436. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  41437. glyphDataLength -= instructionsLength;
  41438. if (glyf.length - glyphDataLength > 3) {
  41439. glyphDataLength = glyphDataLength + 3 & ~3;
  41440. }
  41441. return glyphDataLength;
  41442. }
  41443. if (glyf.length - glyphDataLength > 3) {
  41444. glyphDataLength = glyphDataLength + 3 & ~3;
  41445. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  41446. return glyphDataLength;
  41447. }
  41448. dest.set(glyf, destStart);
  41449. return glyf.length;
  41450. }
  41451. function sanitizeHead(head, numGlyphs, locaLength) {
  41452. var data = head.data;
  41453. var version = int32(data[0], data[1], data[2], data[3]);
  41454. if (version >> 16 !== 1) {
  41455. info('Attempting to fix invalid version in head table: ' + version);
  41456. data[0] = 0;
  41457. data[1] = 1;
  41458. data[2] = 0;
  41459. data[3] = 0;
  41460. }
  41461. var indexToLocFormat = int16(data[50], data[51]);
  41462. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  41463. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  41464. var numGlyphsPlusOne = numGlyphs + 1;
  41465. if (locaLength === numGlyphsPlusOne << 1) {
  41466. data[50] = 0;
  41467. data[51] = 0;
  41468. } else if (locaLength === numGlyphsPlusOne << 2) {
  41469. data[50] = 0;
  41470. data[51] = 1;
  41471. } else {
  41472. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  41473. }
  41474. }
  41475. }
  41476. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  41477. var itemSize, itemDecode, itemEncode;
  41478. if (isGlyphLocationsLong) {
  41479. itemSize = 4;
  41480. itemDecode = function fontItemDecodeLong(data, offset) {
  41481. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  41482. };
  41483. itemEncode = function fontItemEncodeLong(data, offset, value) {
  41484. data[offset] = value >>> 24 & 0xFF;
  41485. data[offset + 1] = value >> 16 & 0xFF;
  41486. data[offset + 2] = value >> 8 & 0xFF;
  41487. data[offset + 3] = value & 0xFF;
  41488. };
  41489. } else {
  41490. itemSize = 2;
  41491. itemDecode = function fontItemDecode(data, offset) {
  41492. return data[offset] << 9 | data[offset + 1] << 1;
  41493. };
  41494. itemEncode = function fontItemEncode(data, offset, value) {
  41495. data[offset] = value >> 9 & 0xFF;
  41496. data[offset + 1] = value >> 1 & 0xFF;
  41497. };
  41498. }
  41499. var locaData = loca.data;
  41500. var locaDataSize = itemSize * (1 + numGlyphs);
  41501. if (locaData.length !== locaDataSize) {
  41502. locaData = new Uint8Array(locaDataSize);
  41503. locaData.set(loca.data.subarray(0, locaDataSize));
  41504. loca.data = locaData;
  41505. }
  41506. var oldGlyfData = glyf.data;
  41507. var oldGlyfDataLength = oldGlyfData.length;
  41508. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  41509. var startOffset = itemDecode(locaData, 0);
  41510. var writeOffset = 0;
  41511. var missingGlyphData = Object.create(null);
  41512. itemEncode(locaData, 0, writeOffset);
  41513. var i, j;
  41514. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41515. var endOffset = itemDecode(locaData, j);
  41516. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  41517. endOffset = oldGlyfDataLength;
  41518. }
  41519. if (endOffset > oldGlyfDataLength) {
  41520. itemEncode(locaData, j, writeOffset);
  41521. startOffset = endOffset;
  41522. continue;
  41523. }
  41524. if (startOffset === endOffset) {
  41525. missingGlyphData[i] = true;
  41526. }
  41527. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  41528. writeOffset += newLength;
  41529. itemEncode(locaData, j, writeOffset);
  41530. startOffset = endOffset;
  41531. }
  41532. if (writeOffset === 0) {
  41533. var simpleGlyph = new Uint8Array([
  41534. 0,
  41535. 1,
  41536. 0,
  41537. 0,
  41538. 0,
  41539. 0,
  41540. 0,
  41541. 0,
  41542. 0,
  41543. 0,
  41544. 0,
  41545. 0,
  41546. 0,
  41547. 0,
  41548. 49,
  41549. 0
  41550. ]);
  41551. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41552. itemEncode(locaData, j, simpleGlyph.length);
  41553. }
  41554. glyf.data = simpleGlyph;
  41555. return missingGlyphData;
  41556. }
  41557. if (dupFirstEntry) {
  41558. var firstEntryLength = itemDecode(locaData, itemSize);
  41559. if (newGlyfData.length > firstEntryLength + writeOffset) {
  41560. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  41561. } else {
  41562. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  41563. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  41564. }
  41565. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  41566. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  41567. } else {
  41568. glyf.data = newGlyfData.subarray(0, writeOffset);
  41569. }
  41570. return missingGlyphData;
  41571. }
  41572. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  41573. var start = (font.start ? font.start : 0) + post.offset;
  41574. font.pos = start;
  41575. var length = post.length, end = start + length;
  41576. var version = font.getInt32();
  41577. font.getBytes(28);
  41578. var glyphNames;
  41579. var valid = true;
  41580. var i;
  41581. switch (version) {
  41582. case 0x00010000:
  41583. glyphNames = MacStandardGlyphOrdering;
  41584. break;
  41585. case 0x00020000:
  41586. var numGlyphs = font.getUint16();
  41587. if (numGlyphs !== maxpNumGlyphs) {
  41588. valid = false;
  41589. break;
  41590. }
  41591. var glyphNameIndexes = [];
  41592. for (i = 0; i < numGlyphs; ++i) {
  41593. var index = font.getUint16();
  41594. if (index >= 32768) {
  41595. valid = false;
  41596. break;
  41597. }
  41598. glyphNameIndexes.push(index);
  41599. }
  41600. if (!valid) {
  41601. break;
  41602. }
  41603. var customNames = [];
  41604. var strBuf = [];
  41605. while (font.pos < end) {
  41606. var stringLength = font.getByte();
  41607. strBuf.length = stringLength;
  41608. for (i = 0; i < stringLength; ++i) {
  41609. strBuf[i] = String.fromCharCode(font.getByte());
  41610. }
  41611. customNames.push(strBuf.join(''));
  41612. }
  41613. glyphNames = [];
  41614. for (i = 0; i < numGlyphs; ++i) {
  41615. var j = glyphNameIndexes[i];
  41616. if (j < 258) {
  41617. glyphNames.push(MacStandardGlyphOrdering[j]);
  41618. continue;
  41619. }
  41620. glyphNames.push(customNames[j - 258]);
  41621. }
  41622. break;
  41623. case 0x00030000:
  41624. break;
  41625. default:
  41626. warn('Unknown/unsupported post table version ' + version);
  41627. valid = false;
  41628. if (properties.defaultEncoding) {
  41629. glyphNames = properties.defaultEncoding;
  41630. }
  41631. break;
  41632. }
  41633. properties.glyphNames = glyphNames;
  41634. return valid;
  41635. }
  41636. function readNameTable(nameTable) {
  41637. var start = (font.start ? font.start : 0) + nameTable.offset;
  41638. font.pos = start;
  41639. var names = [
  41640. [],
  41641. []
  41642. ];
  41643. var length = nameTable.length, end = start + length;
  41644. var format = font.getUint16();
  41645. var FORMAT_0_HEADER_LENGTH = 6;
  41646. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  41647. return names;
  41648. }
  41649. var numRecords = font.getUint16();
  41650. var stringsStart = font.getUint16();
  41651. var records = [];
  41652. var NAME_RECORD_LENGTH = 12;
  41653. var i, ii;
  41654. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  41655. var r = {
  41656. platform: font.getUint16(),
  41657. encoding: font.getUint16(),
  41658. language: font.getUint16(),
  41659. name: font.getUint16(),
  41660. length: font.getUint16(),
  41661. offset: font.getUint16()
  41662. };
  41663. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  41664. records.push(r);
  41665. }
  41666. }
  41667. for (i = 0, ii = records.length; i < ii; i++) {
  41668. var record = records[i];
  41669. if (record.length <= 0) {
  41670. continue;
  41671. }
  41672. var pos = start + stringsStart + record.offset;
  41673. if (pos + record.length > end) {
  41674. continue;
  41675. }
  41676. font.pos = pos;
  41677. var nameIndex = record.name;
  41678. if (record.encoding) {
  41679. var str = '';
  41680. for (var j = 0, jj = record.length; j < jj; j += 2) {
  41681. str += String.fromCharCode(font.getUint16());
  41682. }
  41683. names[1][nameIndex] = str;
  41684. } else {
  41685. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  41686. }
  41687. }
  41688. return names;
  41689. }
  41690. var TTOpsStackDeltas = [
  41691. 0,
  41692. 0,
  41693. 0,
  41694. 0,
  41695. 0,
  41696. 0,
  41697. 0,
  41698. 0,
  41699. -2,
  41700. -2,
  41701. -2,
  41702. -2,
  41703. 0,
  41704. 0,
  41705. -2,
  41706. -5,
  41707. -1,
  41708. -1,
  41709. -1,
  41710. -1,
  41711. -1,
  41712. -1,
  41713. -1,
  41714. -1,
  41715. 0,
  41716. 0,
  41717. -1,
  41718. 0,
  41719. -1,
  41720. -1,
  41721. -1,
  41722. -1,
  41723. 1,
  41724. -1,
  41725. -999,
  41726. 0,
  41727. 1,
  41728. 0,
  41729. -1,
  41730. -2,
  41731. 0,
  41732. -1,
  41733. -2,
  41734. -1,
  41735. -1,
  41736. 0,
  41737. -1,
  41738. -1,
  41739. 0,
  41740. 0,
  41741. -999,
  41742. -999,
  41743. -1,
  41744. -1,
  41745. -1,
  41746. -1,
  41747. -2,
  41748. -999,
  41749. -2,
  41750. -2,
  41751. -999,
  41752. 0,
  41753. -2,
  41754. -2,
  41755. 0,
  41756. 0,
  41757. -2,
  41758. 0,
  41759. -2,
  41760. 0,
  41761. 0,
  41762. 0,
  41763. -2,
  41764. -1,
  41765. -1,
  41766. 1,
  41767. 1,
  41768. 0,
  41769. 0,
  41770. -1,
  41771. -1,
  41772. -1,
  41773. -1,
  41774. -1,
  41775. -1,
  41776. -1,
  41777. 0,
  41778. 0,
  41779. -1,
  41780. 0,
  41781. -1,
  41782. -1,
  41783. 0,
  41784. -999,
  41785. -1,
  41786. -1,
  41787. -1,
  41788. -1,
  41789. -1,
  41790. -1,
  41791. 0,
  41792. 0,
  41793. 0,
  41794. 0,
  41795. 0,
  41796. 0,
  41797. 0,
  41798. 0,
  41799. 0,
  41800. 0,
  41801. 0,
  41802. 0,
  41803. -2,
  41804. -999,
  41805. -999,
  41806. -999,
  41807. -999,
  41808. -999,
  41809. -1,
  41810. -1,
  41811. -2,
  41812. -2,
  41813. 0,
  41814. 0,
  41815. 0,
  41816. 0,
  41817. -1,
  41818. -1,
  41819. -999,
  41820. -2,
  41821. -2,
  41822. 0,
  41823. 0,
  41824. -1,
  41825. -2,
  41826. -2,
  41827. 0,
  41828. 0,
  41829. 0,
  41830. -1,
  41831. -1,
  41832. -1,
  41833. -2
  41834. ];
  41835. function sanitizeTTProgram(table, ttContext) {
  41836. var data = table.data;
  41837. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41838. var stack = [];
  41839. var callstack = [];
  41840. var functionsCalled = [];
  41841. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41842. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41843. for (var ii = data.length; i < ii;) {
  41844. var op = data[i++];
  41845. if (op === 0x40) {
  41846. n = data[i++];
  41847. if (inFDEF || inELSE) {
  41848. i += n;
  41849. } else {
  41850. for (j = 0; j < n; j++) {
  41851. stack.push(data[i++]);
  41852. }
  41853. }
  41854. } else if (op === 0x41) {
  41855. n = data[i++];
  41856. if (inFDEF || inELSE) {
  41857. i += n * 2;
  41858. } else {
  41859. for (j = 0; j < n; j++) {
  41860. b = data[i++];
  41861. stack.push(b << 8 | data[i++]);
  41862. }
  41863. }
  41864. } else if ((op & 0xF8) === 0xB0) {
  41865. n = op - 0xB0 + 1;
  41866. if (inFDEF || inELSE) {
  41867. i += n;
  41868. } else {
  41869. for (j = 0; j < n; j++) {
  41870. stack.push(data[i++]);
  41871. }
  41872. }
  41873. } else if ((op & 0xF8) === 0xB8) {
  41874. n = op - 0xB8 + 1;
  41875. if (inFDEF || inELSE) {
  41876. i += n * 2;
  41877. } else {
  41878. for (j = 0; j < n; j++) {
  41879. b = data[i++];
  41880. stack.push(b << 8 | data[i++]);
  41881. }
  41882. }
  41883. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41884. if (!inFDEF && !inELSE) {
  41885. funcId = stack[stack.length - 1];
  41886. ttContext.functionsUsed[funcId] = true;
  41887. if (funcId in ttContext.functionsStackDeltas) {
  41888. stack.length += ttContext.functionsStackDeltas[funcId];
  41889. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41890. callstack.push({
  41891. data: data,
  41892. i: i,
  41893. stackTop: stack.length - 1
  41894. });
  41895. functionsCalled.push(funcId);
  41896. pc = ttContext.functionsDefined[funcId];
  41897. if (!pc) {
  41898. warn('TT: CALL non-existent function');
  41899. ttContext.hintsValid = false;
  41900. return;
  41901. }
  41902. data = pc.data;
  41903. i = pc.i;
  41904. }
  41905. }
  41906. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41907. if (inFDEF || inELSE) {
  41908. warn('TT: nested FDEFs not allowed');
  41909. tooComplexToFollowFunctions = true;
  41910. }
  41911. inFDEF = true;
  41912. lastDeff = i;
  41913. funcId = stack.pop();
  41914. ttContext.functionsDefined[funcId] = {
  41915. data: data,
  41916. i: i
  41917. };
  41918. } else if (op === 0x2D) {
  41919. if (inFDEF) {
  41920. inFDEF = false;
  41921. lastEndf = i;
  41922. } else {
  41923. pc = callstack.pop();
  41924. if (!pc) {
  41925. warn('TT: ENDF bad stack');
  41926. ttContext.hintsValid = false;
  41927. return;
  41928. }
  41929. funcId = functionsCalled.pop();
  41930. data = pc.data;
  41931. i = pc.i;
  41932. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41933. }
  41934. } else if (op === 0x89) {
  41935. if (inFDEF || inELSE) {
  41936. warn('TT: nested IDEFs not allowed');
  41937. tooComplexToFollowFunctions = true;
  41938. }
  41939. inFDEF = true;
  41940. lastDeff = i;
  41941. } else if (op === 0x58) {
  41942. ++ifLevel;
  41943. } else if (op === 0x1B) {
  41944. inELSE = ifLevel;
  41945. } else if (op === 0x59) {
  41946. if (inELSE === ifLevel) {
  41947. inELSE = 0;
  41948. }
  41949. --ifLevel;
  41950. } else if (op === 0x1C) {
  41951. if (!inFDEF && !inELSE) {
  41952. var offset = stack[stack.length - 1];
  41953. if (offset > 0) {
  41954. i += offset - 1;
  41955. }
  41956. }
  41957. }
  41958. if (!inFDEF && !inELSE) {
  41959. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41960. if (op >= 0x71 && op <= 0x75) {
  41961. n = stack.pop();
  41962. if (!isNaN(n)) {
  41963. stackDelta = -n * 2;
  41964. }
  41965. }
  41966. while (stackDelta < 0 && stack.length > 0) {
  41967. stack.pop();
  41968. stackDelta++;
  41969. }
  41970. while (stackDelta > 0) {
  41971. stack.push(NaN);
  41972. stackDelta--;
  41973. }
  41974. }
  41975. }
  41976. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41977. var content = [data];
  41978. if (i > data.length) {
  41979. content.push(new Uint8Array(i - data.length));
  41980. }
  41981. if (lastDeff > lastEndf) {
  41982. warn('TT: complementing a missing function tail');
  41983. content.push(new Uint8Array([
  41984. 0x22,
  41985. 0x2D
  41986. ]));
  41987. }
  41988. foldTTTable(table, content);
  41989. }
  41990. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41991. if (ttContext.tooComplexToFollowFunctions) {
  41992. return;
  41993. }
  41994. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  41995. warn('TT: more functions defined than expected');
  41996. ttContext.hintsValid = false;
  41997. return;
  41998. }
  41999. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  42000. if (j > maxFunctionDefs) {
  42001. warn('TT: invalid function id: ' + j);
  42002. ttContext.hintsValid = false;
  42003. return;
  42004. }
  42005. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  42006. warn('TT: undefined function: ' + j);
  42007. ttContext.hintsValid = false;
  42008. return;
  42009. }
  42010. }
  42011. }
  42012. function foldTTTable(table, content) {
  42013. if (content.length > 1) {
  42014. var newLength = 0;
  42015. var j, jj;
  42016. for (j = 0, jj = content.length; j < jj; j++) {
  42017. newLength += content[j].length;
  42018. }
  42019. newLength = newLength + 3 & ~3;
  42020. var result = new Uint8Array(newLength);
  42021. var pos = 0;
  42022. for (j = 0, jj = content.length; j < jj; j++) {
  42023. result.set(content[j], pos);
  42024. pos += content[j].length;
  42025. }
  42026. table.data = result;
  42027. table.length = newLength;
  42028. }
  42029. }
  42030. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  42031. var ttContext = {
  42032. functionsDefined: [],
  42033. functionsUsed: [],
  42034. functionsStackDeltas: [],
  42035. tooComplexToFollowFunctions: false,
  42036. hintsValid: true
  42037. };
  42038. if (fpgm) {
  42039. sanitizeTTProgram(fpgm, ttContext);
  42040. }
  42041. if (prep) {
  42042. sanitizeTTProgram(prep, ttContext);
  42043. }
  42044. if (fpgm) {
  42045. checkInvalidFunctions(ttContext, maxFunctionDefs);
  42046. }
  42047. if (cvt && cvt.length & 1) {
  42048. var cvtData = new Uint8Array(cvt.length + 1);
  42049. cvtData.set(cvt.data);
  42050. cvt.data = cvtData;
  42051. }
  42052. return ttContext.hintsValid;
  42053. }
  42054. font = new Stream(new Uint8Array(font.getBytes()));
  42055. var VALID_TABLES = [
  42056. 'OS/2',
  42057. 'cmap',
  42058. 'head',
  42059. 'hhea',
  42060. 'hmtx',
  42061. 'maxp',
  42062. 'name',
  42063. 'post',
  42064. 'loca',
  42065. 'glyf',
  42066. 'fpgm',
  42067. 'prep',
  42068. 'cvt ',
  42069. 'CFF '
  42070. ];
  42071. var header = readOpenTypeHeader(font);
  42072. var numTables = header.numTables;
  42073. var cff, cffFile;
  42074. var tables = Object.create(null);
  42075. tables['OS/2'] = null;
  42076. tables['cmap'] = null;
  42077. tables['head'] = null;
  42078. tables['hhea'] = null;
  42079. tables['hmtx'] = null;
  42080. tables['maxp'] = null;
  42081. tables['name'] = null;
  42082. tables['post'] = null;
  42083. var table;
  42084. for (var i = 0; i < numTables; i++) {
  42085. table = readTableEntry(font);
  42086. if (VALID_TABLES.indexOf(table.tag) < 0) {
  42087. continue;
  42088. }
  42089. if (table.length === 0) {
  42090. continue;
  42091. }
  42092. tables[table.tag] = table;
  42093. }
  42094. var isTrueType = !tables['CFF '];
  42095. if (!isTrueType) {
  42096. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  42097. cffFile = new Stream(tables['CFF '].data);
  42098. cff = new CFFFont(cffFile, properties);
  42099. adjustWidths(properties);
  42100. return this.convert(name, cff, properties);
  42101. }
  42102. delete tables['glyf'];
  42103. delete tables['loca'];
  42104. delete tables['fpgm'];
  42105. delete tables['prep'];
  42106. delete tables['cvt '];
  42107. this.isOpenType = true;
  42108. } else {
  42109. if (!tables['loca']) {
  42110. error('Required "loca" table is not found');
  42111. }
  42112. if (!tables['glyf']) {
  42113. warn('Required "glyf" table is not found -- trying to recover.');
  42114. tables['glyf'] = {
  42115. tag: 'glyf',
  42116. data: new Uint8Array(0)
  42117. };
  42118. }
  42119. this.isOpenType = false;
  42120. }
  42121. if (!tables['maxp']) {
  42122. error('Required "maxp" table is not found');
  42123. }
  42124. font.pos = (font.start || 0) + tables['maxp'].offset;
  42125. var version = font.getInt32();
  42126. var numGlyphs = font.getUint16();
  42127. var maxFunctionDefs = 0;
  42128. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  42129. font.pos += 8;
  42130. var maxZones = font.getUint16();
  42131. if (maxZones > 2) {
  42132. tables['maxp'].data[14] = 0;
  42133. tables['maxp'].data[15] = 2;
  42134. }
  42135. font.pos += 4;
  42136. maxFunctionDefs = font.getUint16();
  42137. }
  42138. var dupFirstEntry = false;
  42139. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  42140. dupFirstEntry = true;
  42141. numGlyphs++;
  42142. tables['maxp'].data[4] = numGlyphs >> 8;
  42143. tables['maxp'].data[5] = numGlyphs & 255;
  42144. }
  42145. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  42146. if (!hintsValid) {
  42147. delete tables['fpgm'];
  42148. delete tables['prep'];
  42149. delete tables['cvt '];
  42150. }
  42151. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  42152. if (!tables['head']) {
  42153. error('Required "head" table is not found');
  42154. }
  42155. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  42156. var missingGlyphs = Object.create(null);
  42157. if (isTrueType) {
  42158. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  42159. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  42160. }
  42161. if (!tables['hhea']) {
  42162. error('Required "hhea" table is not found');
  42163. }
  42164. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  42165. tables['hhea'].data[10] = 0xFF;
  42166. tables['hhea'].data[11] = 0xFF;
  42167. }
  42168. var metricsOverride = {
  42169. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  42170. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  42171. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  42172. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  42173. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  42174. };
  42175. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  42176. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  42177. if (tables['post']) {
  42178. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  42179. if (!valid) {
  42180. tables['post'] = null;
  42181. }
  42182. }
  42183. var charCodeToGlyphId = [], charCode;
  42184. var toUnicode = properties.toUnicode, widths = properties.widths;
  42185. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  42186. function hasGlyph(glyphId, charCode, widthCode) {
  42187. if (!missingGlyphs[glyphId]) {
  42188. return true;
  42189. }
  42190. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  42191. return true;
  42192. }
  42193. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  42194. return true;
  42195. }
  42196. return false;
  42197. }
  42198. if (properties.composite) {
  42199. var cidToGidMap = properties.cidToGidMap || [];
  42200. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  42201. properties.cMap.forEach(function (charCode, cid) {
  42202. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  42203. var glyphId = -1;
  42204. if (isCidToGidMapEmpty) {
  42205. glyphId = cid;
  42206. } else if (cidToGidMap[cid] !== undefined) {
  42207. glyphId = cidToGidMap[cid];
  42208. }
  42209. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  42210. charCodeToGlyphId[charCode] = glyphId;
  42211. }
  42212. });
  42213. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  42214. charCodeToGlyphId[0] = numGlyphs - 1;
  42215. }
  42216. } else {
  42217. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  42218. var cmapPlatformId = cmapTable.platformId;
  42219. var cmapEncodingId = cmapTable.encodingId;
  42220. var cmapMappings = cmapTable.mappings;
  42221. var cmapMappingsLength = cmapMappings.length;
  42222. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  42223. var baseEncoding = [];
  42224. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  42225. baseEncoding = getEncoding(properties.baseEncodingName);
  42226. }
  42227. var glyphsUnicodeMap = getGlyphsUnicode();
  42228. for (charCode = 0; charCode < 256; charCode++) {
  42229. var glyphName, standardGlyphName;
  42230. if (this.differences && charCode in this.differences) {
  42231. glyphName = this.differences[charCode];
  42232. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  42233. glyphName = baseEncoding[charCode];
  42234. } else {
  42235. glyphName = StandardEncoding[charCode];
  42236. }
  42237. if (!glyphName) {
  42238. continue;
  42239. }
  42240. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42241. var unicodeOrCharCode, isUnicode = false;
  42242. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  42243. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  42244. isUnicode = true;
  42245. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  42246. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  42247. }
  42248. var found = false;
  42249. for (i = 0; i < cmapMappingsLength; ++i) {
  42250. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  42251. continue;
  42252. }
  42253. var code = isUnicode ? charCode : unicodeOrCharCode;
  42254. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  42255. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42256. found = true;
  42257. break;
  42258. }
  42259. }
  42260. if (!found && properties.glyphNames) {
  42261. var glyphId = properties.glyphNames.indexOf(glyphName);
  42262. if (glyphId === -1 && standardGlyphName !== glyphName) {
  42263. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  42264. }
  42265. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  42266. charCodeToGlyphId[charCode] = glyphId;
  42267. found = true;
  42268. }
  42269. }
  42270. if (!found) {
  42271. charCodeToGlyphId[charCode] = 0;
  42272. }
  42273. }
  42274. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  42275. for (i = 0; i < cmapMappingsLength; ++i) {
  42276. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  42277. }
  42278. } else {
  42279. for (i = 0; i < cmapMappingsLength; ++i) {
  42280. charCode = cmapMappings[i].charCode & 0xFF;
  42281. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42282. }
  42283. }
  42284. }
  42285. if (charCodeToGlyphId.length === 0) {
  42286. charCodeToGlyphId[0] = 0;
  42287. }
  42288. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  42289. this.toFontChar = newMapping.toFontChar;
  42290. tables['cmap'] = {
  42291. tag: 'cmap',
  42292. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  42293. };
  42294. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  42295. tables['OS/2'] = {
  42296. tag: 'OS/2',
  42297. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  42298. };
  42299. }
  42300. if (!tables['post']) {
  42301. tables['post'] = {
  42302. tag: 'post',
  42303. data: createPostTable(properties)
  42304. };
  42305. }
  42306. if (!isTrueType) {
  42307. try {
  42308. cffFile = new Stream(tables['CFF '].data);
  42309. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  42310. cff = parser.parse();
  42311. var compiler = new CFFCompiler(cff);
  42312. tables['CFF '].data = compiler.compile();
  42313. } catch (e) {
  42314. warn('Failed to compile font ' + properties.loadedName);
  42315. }
  42316. }
  42317. if (!tables['name']) {
  42318. tables['name'] = {
  42319. tag: 'name',
  42320. data: createNameTable(this.name)
  42321. };
  42322. } else {
  42323. var namePrototype = readNameTable(tables['name']);
  42324. tables['name'].data = createNameTable(name, namePrototype);
  42325. }
  42326. var builder = new OpenTypeFileBuilder(header.version);
  42327. for (var tableTag in tables) {
  42328. builder.addTable(tableTag, tables[tableTag].data);
  42329. }
  42330. return builder.toArray();
  42331. },
  42332. convert: function Font_convert(fontName, font, properties) {
  42333. properties.fixedPitch = false;
  42334. if (properties.builtInEncoding) {
  42335. adjustToUnicode(properties, properties.builtInEncoding);
  42336. }
  42337. var mapping = font.getGlyphMapping(properties);
  42338. var newMapping = adjustMapping(mapping, properties);
  42339. this.toFontChar = newMapping.toFontChar;
  42340. var numGlyphs = font.numGlyphs;
  42341. function getCharCodes(charCodeToGlyphId, glyphId) {
  42342. var charCodes = null;
  42343. for (var charCode in charCodeToGlyphId) {
  42344. if (glyphId === charCodeToGlyphId[charCode]) {
  42345. if (!charCodes) {
  42346. charCodes = [];
  42347. }
  42348. charCodes.push(charCode | 0);
  42349. }
  42350. }
  42351. return charCodes;
  42352. }
  42353. function createCharCode(charCodeToGlyphId, glyphId) {
  42354. for (var charCode in charCodeToGlyphId) {
  42355. if (glyphId === charCodeToGlyphId[charCode]) {
  42356. return charCode | 0;
  42357. }
  42358. }
  42359. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  42360. return newMapping.nextAvailableFontCharCode++;
  42361. }
  42362. var seacs = font.seacs;
  42363. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  42364. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  42365. var charset = font.getCharset();
  42366. var seacMap = Object.create(null);
  42367. for (var glyphId in seacs) {
  42368. glyphId |= 0;
  42369. var seac = seacs[glyphId];
  42370. var baseGlyphName = StandardEncoding[seac[2]];
  42371. var accentGlyphName = StandardEncoding[seac[3]];
  42372. var baseGlyphId = charset.indexOf(baseGlyphName);
  42373. var accentGlyphId = charset.indexOf(accentGlyphName);
  42374. if (baseGlyphId < 0 || accentGlyphId < 0) {
  42375. continue;
  42376. }
  42377. var accentOffset = {
  42378. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  42379. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  42380. };
  42381. var charCodes = getCharCodes(mapping, glyphId);
  42382. if (!charCodes) {
  42383. continue;
  42384. }
  42385. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  42386. var charCode = charCodes[i];
  42387. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  42388. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  42389. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  42390. seacMap[charCode] = {
  42391. baseFontCharCode: baseFontCharCode,
  42392. accentFontCharCode: accentFontCharCode,
  42393. accentOffset: accentOffset
  42394. };
  42395. }
  42396. }
  42397. properties.seacMap = seacMap;
  42398. }
  42399. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  42400. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  42401. builder.addTable('CFF ', font.data);
  42402. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  42403. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  42404. 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');
  42405. 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));
  42406. builder.addTable('hmtx', function fontFieldsHmtx() {
  42407. var charstrings = font.charstrings;
  42408. var cffWidths = font.cff ? font.cff.widths : null;
  42409. var hmtx = '\x00\x00\x00\x00';
  42410. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  42411. var width = 0;
  42412. if (charstrings) {
  42413. var charstring = charstrings[i - 1];
  42414. width = 'width' in charstring ? charstring.width : 0;
  42415. } else if (cffWidths) {
  42416. width = Math.ceil(cffWidths[i] || 0);
  42417. }
  42418. hmtx += string16(width) + string16(0);
  42419. }
  42420. return hmtx;
  42421. }());
  42422. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  42423. builder.addTable('name', createNameTable(fontName));
  42424. builder.addTable('post', createPostTable(properties));
  42425. return builder.toArray();
  42426. },
  42427. get spaceWidth() {
  42428. if ('_shadowWidth' in this) {
  42429. return this._shadowWidth;
  42430. }
  42431. var possibleSpaceReplacements = [
  42432. 'space',
  42433. 'minus',
  42434. 'one',
  42435. 'i',
  42436. 'I'
  42437. ];
  42438. var width;
  42439. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  42440. var glyphName = possibleSpaceReplacements[i];
  42441. if (glyphName in this.widths) {
  42442. width = this.widths[glyphName];
  42443. break;
  42444. }
  42445. var glyphsUnicodeMap = getGlyphsUnicode();
  42446. var glyphUnicode = glyphsUnicodeMap[glyphName];
  42447. var charcode = 0;
  42448. if (this.composite) {
  42449. if (this.cMap.contains(glyphUnicode)) {
  42450. charcode = this.cMap.lookup(glyphUnicode);
  42451. }
  42452. }
  42453. if (!charcode && this.toUnicode) {
  42454. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  42455. }
  42456. if (charcode <= 0) {
  42457. charcode = glyphUnicode;
  42458. }
  42459. width = this.widths[charcode];
  42460. if (width) {
  42461. break;
  42462. }
  42463. }
  42464. width = width || this.defaultWidth;
  42465. this._shadowWidth = width;
  42466. return width;
  42467. },
  42468. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  42469. var fontCharCode, width, operatorListId;
  42470. var widthCode = charcode;
  42471. if (this.cMap && this.cMap.contains(charcode)) {
  42472. widthCode = this.cMap.lookup(charcode);
  42473. }
  42474. width = this.widths[widthCode];
  42475. width = isNum(width) ? width : this.defaultWidth;
  42476. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  42477. var unicode = this.toUnicode.get(charcode) || charcode;
  42478. if (typeof unicode === 'number') {
  42479. unicode = String.fromCharCode(unicode);
  42480. }
  42481. var isInFont = charcode in this.toFontChar;
  42482. fontCharCode = this.toFontChar[charcode] || charcode;
  42483. if (this.missingFile) {
  42484. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  42485. }
  42486. if (this.isType3Font) {
  42487. operatorListId = fontCharCode;
  42488. }
  42489. var accent = null;
  42490. if (this.seacMap && this.seacMap[charcode]) {
  42491. isInFont = true;
  42492. var seac = this.seacMap[charcode];
  42493. fontCharCode = seac.baseFontCharCode;
  42494. accent = {
  42495. fontChar: String.fromCharCode(seac.accentFontCharCode),
  42496. offset: seac.accentOffset
  42497. };
  42498. }
  42499. var fontChar = String.fromCharCode(fontCharCode);
  42500. var glyph = this.glyphCache[charcode];
  42501. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  42502. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  42503. this.glyphCache[charcode] = glyph;
  42504. }
  42505. return glyph;
  42506. },
  42507. charsToGlyphs: function Font_charsToGlyphs(chars) {
  42508. var charsCache = this.charsCache;
  42509. var glyphs, glyph, charcode;
  42510. if (charsCache) {
  42511. glyphs = charsCache[chars];
  42512. if (glyphs) {
  42513. return glyphs;
  42514. }
  42515. }
  42516. if (!charsCache) {
  42517. charsCache = this.charsCache = Object.create(null);
  42518. }
  42519. glyphs = [];
  42520. var charsCacheKey = chars;
  42521. var i = 0, ii;
  42522. if (this.cMap) {
  42523. var c = Object.create(null);
  42524. while (i < chars.length) {
  42525. this.cMap.readCharCode(chars, i, c);
  42526. charcode = c.charcode;
  42527. var length = c.length;
  42528. i += length;
  42529. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  42530. glyph = this.charToGlyph(charcode, isSpace);
  42531. glyphs.push(glyph);
  42532. }
  42533. } else {
  42534. for (i = 0, ii = chars.length; i < ii; ++i) {
  42535. charcode = chars.charCodeAt(i);
  42536. glyph = this.charToGlyph(charcode, charcode === 0x20);
  42537. glyphs.push(glyph);
  42538. }
  42539. }
  42540. return charsCache[charsCacheKey] = glyphs;
  42541. }
  42542. };
  42543. return Font;
  42544. }();
  42545. var ErrorFont = function ErrorFontClosure() {
  42546. function ErrorFont(error) {
  42547. this.error = error;
  42548. this.loadedName = 'g_font_error';
  42549. this.loading = false;
  42550. }
  42551. ErrorFont.prototype = {
  42552. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  42553. return [];
  42554. },
  42555. exportData: function ErrorFont_exportData() {
  42556. return { error: this.error };
  42557. }
  42558. };
  42559. return ErrorFont;
  42560. }();
  42561. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  42562. var charCodeToGlyphId = Object.create(null);
  42563. var glyphId, charCode, baseEncoding;
  42564. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  42565. if (properties.baseEncodingName) {
  42566. baseEncoding = getEncoding(properties.baseEncodingName);
  42567. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42568. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42569. if (glyphId >= 0) {
  42570. charCodeToGlyphId[charCode] = glyphId;
  42571. } else {
  42572. charCodeToGlyphId[charCode] = 0;
  42573. }
  42574. }
  42575. } else if (isSymbolicFont) {
  42576. for (charCode in builtInEncoding) {
  42577. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  42578. }
  42579. } else {
  42580. baseEncoding = StandardEncoding;
  42581. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42582. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42583. if (glyphId >= 0) {
  42584. charCodeToGlyphId[charCode] = glyphId;
  42585. } else {
  42586. charCodeToGlyphId[charCode] = 0;
  42587. }
  42588. }
  42589. }
  42590. var differences = properties.differences, glyphsUnicodeMap;
  42591. if (differences) {
  42592. for (charCode in differences) {
  42593. var glyphName = differences[charCode];
  42594. glyphId = glyphNames.indexOf(glyphName);
  42595. if (glyphId === -1) {
  42596. if (!glyphsUnicodeMap) {
  42597. glyphsUnicodeMap = getGlyphsUnicode();
  42598. }
  42599. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42600. if (standardGlyphName !== glyphName) {
  42601. glyphId = glyphNames.indexOf(standardGlyphName);
  42602. }
  42603. }
  42604. if (glyphId >= 0) {
  42605. charCodeToGlyphId[charCode] = glyphId;
  42606. } else {
  42607. charCodeToGlyphId[charCode] = 0;
  42608. }
  42609. }
  42610. }
  42611. return charCodeToGlyphId;
  42612. }
  42613. var Type1Font = function Type1FontClosure() {
  42614. function findBlock(streamBytes, signature, startIndex) {
  42615. var streamBytesLength = streamBytes.length;
  42616. var signatureLength = signature.length;
  42617. var scanLength = streamBytesLength - signatureLength;
  42618. var i = startIndex, j, found = false;
  42619. while (i < scanLength) {
  42620. j = 0;
  42621. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42622. j++;
  42623. }
  42624. if (j >= signatureLength) {
  42625. i += j;
  42626. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  42627. i++;
  42628. }
  42629. found = true;
  42630. break;
  42631. }
  42632. i++;
  42633. }
  42634. return {
  42635. found: found,
  42636. length: i
  42637. };
  42638. }
  42639. function getHeaderBlock(stream, suggestedLength) {
  42640. var EEXEC_SIGNATURE = [
  42641. 0x65,
  42642. 0x65,
  42643. 0x78,
  42644. 0x65,
  42645. 0x63
  42646. ];
  42647. var streamStartPos = stream.pos;
  42648. var headerBytes, headerBytesLength, block;
  42649. try {
  42650. headerBytes = stream.getBytes(suggestedLength);
  42651. headerBytesLength = headerBytes.length;
  42652. } catch (ex) {
  42653. if (ex instanceof MissingDataException) {
  42654. throw ex;
  42655. }
  42656. }
  42657. if (headerBytesLength === suggestedLength) {
  42658. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42659. if (block.found && block.length === suggestedLength) {
  42660. return {
  42661. stream: new Stream(headerBytes),
  42662. length: suggestedLength
  42663. };
  42664. }
  42665. }
  42666. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  42667. stream.pos = streamStartPos;
  42668. var SCAN_BLOCK_LENGTH = 2048;
  42669. var actualLength;
  42670. while (true) {
  42671. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42672. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42673. if (block.length === 0) {
  42674. break;
  42675. }
  42676. stream.pos += block.length;
  42677. if (block.found) {
  42678. actualLength = stream.pos - streamStartPos;
  42679. break;
  42680. }
  42681. }
  42682. stream.pos = streamStartPos;
  42683. if (actualLength) {
  42684. return {
  42685. stream: new Stream(stream.getBytes(actualLength)),
  42686. length: actualLength
  42687. };
  42688. }
  42689. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  42690. return {
  42691. stream: new Stream(stream.getBytes(suggestedLength)),
  42692. length: suggestedLength
  42693. };
  42694. }
  42695. function getEexecBlock(stream, suggestedLength) {
  42696. var eexecBytes = stream.getBytes();
  42697. return {
  42698. stream: new Stream(eexecBytes),
  42699. length: eexecBytes.length
  42700. };
  42701. }
  42702. function Type1Font(name, file, properties) {
  42703. var PFB_HEADER_SIZE = 6;
  42704. var headerBlockLength = properties.length1;
  42705. var eexecBlockLength = properties.length2;
  42706. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42707. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42708. if (pfbHeaderPresent) {
  42709. file.skip(PFB_HEADER_SIZE);
  42710. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42711. }
  42712. var headerBlock = getHeaderBlock(file, headerBlockLength);
  42713. headerBlockLength = headerBlock.length;
  42714. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  42715. headerBlockParser.extractFontHeader(properties);
  42716. if (pfbHeaderPresent) {
  42717. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42718. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42719. }
  42720. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  42721. eexecBlockLength = eexecBlock.length;
  42722. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  42723. var data = eexecBlockParser.extractFontProgram();
  42724. for (var info in data.properties) {
  42725. properties[info] = data.properties[info];
  42726. }
  42727. var charstrings = data.charstrings;
  42728. var type2Charstrings = this.getType2Charstrings(charstrings);
  42729. var subrs = this.getType2Subrs(data.subrs);
  42730. this.charstrings = charstrings;
  42731. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42732. this.seacs = this.getSeacs(data.charstrings);
  42733. }
  42734. Type1Font.prototype = {
  42735. get numGlyphs() {
  42736. return this.charstrings.length + 1;
  42737. },
  42738. getCharset: function Type1Font_getCharset() {
  42739. var charset = ['.notdef'];
  42740. var charstrings = this.charstrings;
  42741. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42742. charset.push(charstrings[glyphId].glyphName);
  42743. }
  42744. return charset;
  42745. },
  42746. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  42747. var charstrings = this.charstrings;
  42748. var glyphNames = ['.notdef'], glyphId;
  42749. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42750. glyphNames.push(charstrings[glyphId].glyphName);
  42751. }
  42752. var encoding = properties.builtInEncoding;
  42753. if (encoding) {
  42754. var builtInEncoding = Object.create(null);
  42755. for (var charCode in encoding) {
  42756. glyphId = glyphNames.indexOf(encoding[charCode]);
  42757. if (glyphId >= 0) {
  42758. builtInEncoding[charCode] = glyphId;
  42759. }
  42760. }
  42761. }
  42762. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  42763. },
  42764. getSeacs: function Type1Font_getSeacs(charstrings) {
  42765. var i, ii;
  42766. var seacMap = [];
  42767. for (i = 0, ii = charstrings.length; i < ii; i++) {
  42768. var charstring = charstrings[i];
  42769. if (charstring.seac) {
  42770. seacMap[i + 1] = charstring.seac;
  42771. }
  42772. }
  42773. return seacMap;
  42774. },
  42775. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  42776. var type2Charstrings = [];
  42777. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42778. type2Charstrings.push(type1Charstrings[i].charstring);
  42779. }
  42780. return type2Charstrings;
  42781. },
  42782. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  42783. var bias = 0;
  42784. var count = type1Subrs.length;
  42785. if (count < 1133) {
  42786. bias = 107;
  42787. } else if (count < 33769) {
  42788. bias = 1131;
  42789. } else {
  42790. bias = 32768;
  42791. }
  42792. var type2Subrs = [];
  42793. var i;
  42794. for (i = 0; i < bias; i++) {
  42795. type2Subrs.push([0x0B]);
  42796. }
  42797. for (i = 0; i < count; i++) {
  42798. type2Subrs.push(type1Subrs[i]);
  42799. }
  42800. return type2Subrs;
  42801. },
  42802. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  42803. var cff = new CFF();
  42804. cff.header = new CFFHeader(1, 0, 4, 4);
  42805. cff.names = [name];
  42806. var topDict = new CFFTopDict();
  42807. topDict.setByName('version', 391);
  42808. topDict.setByName('Notice', 392);
  42809. topDict.setByName('FullName', 393);
  42810. topDict.setByName('FamilyName', 394);
  42811. topDict.setByName('Weight', 395);
  42812. topDict.setByName('Encoding', null);
  42813. topDict.setByName('FontMatrix', properties.fontMatrix);
  42814. topDict.setByName('FontBBox', properties.bbox);
  42815. topDict.setByName('charset', null);
  42816. topDict.setByName('CharStrings', null);
  42817. topDict.setByName('Private', null);
  42818. cff.topDict = topDict;
  42819. var strings = new CFFStrings();
  42820. strings.add('Version 0.11');
  42821. strings.add('See original notice');
  42822. strings.add(name);
  42823. strings.add(name);
  42824. strings.add('Medium');
  42825. cff.strings = strings;
  42826. cff.globalSubrIndex = new CFFIndex();
  42827. var count = glyphs.length;
  42828. var charsetArray = [0];
  42829. var i, ii;
  42830. for (i = 0; i < count; i++) {
  42831. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  42832. if (index === -1) {
  42833. index = 0;
  42834. }
  42835. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  42836. }
  42837. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42838. var charStringsIndex = new CFFIndex();
  42839. charStringsIndex.add([
  42840. 0x8B,
  42841. 0x0E
  42842. ]);
  42843. for (i = 0; i < count; i++) {
  42844. var glyph = glyphs[i];
  42845. if (glyph.length === 0) {
  42846. charStringsIndex.add([
  42847. 0x8B,
  42848. 0x0E
  42849. ]);
  42850. continue;
  42851. }
  42852. charStringsIndex.add(glyph);
  42853. }
  42854. cff.charStrings = charStringsIndex;
  42855. var privateDict = new CFFPrivateDict();
  42856. privateDict.setByName('Subrs', null);
  42857. var fields = [
  42858. 'BlueValues',
  42859. 'OtherBlues',
  42860. 'FamilyBlues',
  42861. 'FamilyOtherBlues',
  42862. 'StemSnapH',
  42863. 'StemSnapV',
  42864. 'BlueShift',
  42865. 'BlueFuzz',
  42866. 'BlueScale',
  42867. 'LanguageGroup',
  42868. 'ExpansionFactor',
  42869. 'ForceBold',
  42870. 'StdHW',
  42871. 'StdVW'
  42872. ];
  42873. for (i = 0, ii = fields.length; i < ii; i++) {
  42874. var field = fields[i];
  42875. if (!(field in properties.privateData)) {
  42876. continue;
  42877. }
  42878. var value = properties.privateData[field];
  42879. if (isArray(value)) {
  42880. for (var j = value.length - 1; j > 0; j--) {
  42881. value[j] -= value[j - 1];
  42882. }
  42883. }
  42884. privateDict.setByName(field, value);
  42885. }
  42886. cff.topDict.privateDict = privateDict;
  42887. var subrIndex = new CFFIndex();
  42888. for (i = 0, ii = subrs.length; i < ii; i++) {
  42889. subrIndex.add(subrs[i]);
  42890. }
  42891. privateDict.subrsIndex = subrIndex;
  42892. var compiler = new CFFCompiler(cff);
  42893. return compiler.compile();
  42894. }
  42895. };
  42896. return Type1Font;
  42897. }();
  42898. var CFFFont = function CFFFontClosure() {
  42899. function CFFFont(file, properties) {
  42900. this.properties = properties;
  42901. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42902. this.cff = parser.parse();
  42903. var compiler = new CFFCompiler(this.cff);
  42904. this.seacs = this.cff.seacs;
  42905. try {
  42906. this.data = compiler.compile();
  42907. } catch (e) {
  42908. warn('Failed to compile font ' + properties.loadedName);
  42909. this.data = file;
  42910. }
  42911. }
  42912. CFFFont.prototype = {
  42913. get numGlyphs() {
  42914. return this.cff.charStrings.count;
  42915. },
  42916. getCharset: function CFFFont_getCharset() {
  42917. return this.cff.charset.charset;
  42918. },
  42919. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42920. var cff = this.cff;
  42921. var properties = this.properties;
  42922. var charsets = cff.charset.charset;
  42923. var charCodeToGlyphId;
  42924. var glyphId;
  42925. if (properties.composite) {
  42926. charCodeToGlyphId = Object.create(null);
  42927. if (cff.isCIDFont) {
  42928. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42929. var cid = charsets[glyphId];
  42930. var charCode = properties.cMap.charCodeOf(cid);
  42931. charCodeToGlyphId[charCode] = glyphId;
  42932. }
  42933. } else {
  42934. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42935. charCodeToGlyphId[glyphId] = glyphId;
  42936. }
  42937. }
  42938. return charCodeToGlyphId;
  42939. }
  42940. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42941. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42942. return charCodeToGlyphId;
  42943. }
  42944. };
  42945. return CFFFont;
  42946. }();
  42947. (function checkSeacSupport() {
  42948. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42949. SEAC_ANALYSIS_ENABLED = true;
  42950. }
  42951. }());
  42952. (function checkChromeWindows() {
  42953. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42954. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42955. }
  42956. }());
  42957. exports.ErrorFont = ErrorFont;
  42958. exports.Font = Font;
  42959. exports.FontFlags = FontFlags;
  42960. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42961. exports.ToUnicodeMap = ToUnicodeMap;
  42962. exports.getFontType = getFontType;
  42963. /***/ }),
  42964. /* 27 */
  42965. /***/ (function(module, exports, __w_pdfjs_require__) {
  42966. "use strict";
  42967. var sharedUtil = __w_pdfjs_require__(0);
  42968. var corePrimitives = __w_pdfjs_require__(1);
  42969. var coreColorSpace = __w_pdfjs_require__(3);
  42970. var coreStream = __w_pdfjs_require__(2);
  42971. var coreJpx = __w_pdfjs_require__(14);
  42972. var ImageKind = sharedUtil.ImageKind;
  42973. var assert = sharedUtil.assert;
  42974. var error = sharedUtil.error;
  42975. var info = sharedUtil.info;
  42976. var isArray = sharedUtil.isArray;
  42977. var warn = sharedUtil.warn;
  42978. var Name = corePrimitives.Name;
  42979. var isStream = corePrimitives.isStream;
  42980. var ColorSpace = coreColorSpace.ColorSpace;
  42981. var DecodeStream = coreStream.DecodeStream;
  42982. var JpegStream = coreStream.JpegStream;
  42983. var JpxImage = coreJpx.JpxImage;
  42984. var PDFImage = function PDFImageClosure() {
  42985. function handleImageData(image, nativeDecoder) {
  42986. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42987. return nativeDecoder.decode(image);
  42988. }
  42989. return Promise.resolve(image);
  42990. }
  42991. function decodeAndClamp(value, addend, coefficient, max) {
  42992. value = addend + value * coefficient;
  42993. return value < 0 ? 0 : value > max ? max : value;
  42994. }
  42995. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  42996. var length = w2 * h2;
  42997. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42998. var xRatio = w1 / w2;
  42999. var yRatio = h1 / h2;
  43000. var i, j, py, newIndex = 0, oldIndex;
  43001. var xScaled = new Uint16Array(w2);
  43002. var w1Scanline = w1;
  43003. for (i = 0; i < w2; i++) {
  43004. xScaled[i] = Math.floor(i * xRatio);
  43005. }
  43006. for (i = 0; i < h2; i++) {
  43007. py = Math.floor(i * yRatio) * w1Scanline;
  43008. for (j = 0; j < w2; j++) {
  43009. oldIndex = py + xScaled[j];
  43010. dest[newIndex++] = src[oldIndex];
  43011. }
  43012. }
  43013. return dest;
  43014. }
  43015. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  43016. this.image = image;
  43017. var dict = image.dict;
  43018. if (dict.has('Filter')) {
  43019. var filter = dict.get('Filter').name;
  43020. if (filter === 'JPXDecode') {
  43021. var jpxImage = new JpxImage();
  43022. jpxImage.parseImageProperties(image.stream);
  43023. image.stream.reset();
  43024. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43025. image.numComps = jpxImage.componentsCount;
  43026. } else if (filter === 'JBIG2Decode') {
  43027. image.bitsPerComponent = 1;
  43028. image.numComps = 1;
  43029. }
  43030. }
  43031. this.width = dict.get('Width', 'W');
  43032. this.height = dict.get('Height', 'H');
  43033. if (this.width < 1 || this.height < 1) {
  43034. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  43035. }
  43036. this.interpolate = dict.get('Interpolate', 'I') || false;
  43037. this.imageMask = dict.get('ImageMask', 'IM') || false;
  43038. this.matte = dict.get('Matte') || false;
  43039. var bitsPerComponent = image.bitsPerComponent;
  43040. if (!bitsPerComponent) {
  43041. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  43042. if (!bitsPerComponent) {
  43043. if (this.imageMask) {
  43044. bitsPerComponent = 1;
  43045. } else {
  43046. error('Bits per component missing in image: ' + this.imageMask);
  43047. }
  43048. }
  43049. }
  43050. this.bpc = bitsPerComponent;
  43051. if (!this.imageMask) {
  43052. var colorSpace = dict.get('ColorSpace', 'CS');
  43053. if (!colorSpace) {
  43054. info('JPX images (which do not require color spaces)');
  43055. switch (image.numComps) {
  43056. case 1:
  43057. colorSpace = Name.get('DeviceGray');
  43058. break;
  43059. case 3:
  43060. colorSpace = Name.get('DeviceRGB');
  43061. break;
  43062. case 4:
  43063. colorSpace = Name.get('DeviceCMYK');
  43064. break;
  43065. default:
  43066. error('JPX images with ' + this.numComps + ' color components not supported.');
  43067. }
  43068. }
  43069. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  43070. this.numComps = this.colorSpace.numComps;
  43071. }
  43072. this.decode = dict.getArray('Decode', 'D');
  43073. this.needsDecode = false;
  43074. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  43075. this.needsDecode = true;
  43076. var max = (1 << bitsPerComponent) - 1;
  43077. this.decodeCoefficients = [];
  43078. this.decodeAddends = [];
  43079. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43080. var dmin = this.decode[i];
  43081. var dmax = this.decode[i + 1];
  43082. this.decodeCoefficients[j] = dmax - dmin;
  43083. this.decodeAddends[j] = max * dmin;
  43084. }
  43085. }
  43086. if (smask) {
  43087. this.smask = new PDFImage(xref, res, smask, false);
  43088. } else if (mask) {
  43089. if (isStream(mask)) {
  43090. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  43091. if (!imageMask) {
  43092. warn('Ignoring /Mask in image without /ImageMask.');
  43093. } else {
  43094. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  43095. }
  43096. } else {
  43097. this.mask = mask;
  43098. }
  43099. }
  43100. }
  43101. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  43102. var imagePromise = handleImageData(image, nativeDecoder);
  43103. var smaskPromise;
  43104. var maskPromise;
  43105. var smask = image.dict.get('SMask');
  43106. var mask = image.dict.get('Mask');
  43107. if (smask) {
  43108. smaskPromise = handleImageData(smask, nativeDecoder);
  43109. maskPromise = Promise.resolve(null);
  43110. } else {
  43111. smaskPromise = Promise.resolve(null);
  43112. if (mask) {
  43113. if (isStream(mask)) {
  43114. maskPromise = handleImageData(mask, nativeDecoder);
  43115. } else if (isArray(mask)) {
  43116. maskPromise = Promise.resolve(mask);
  43117. } else {
  43118. warn('Unsupported mask format.');
  43119. maskPromise = Promise.resolve(null);
  43120. }
  43121. } else {
  43122. maskPromise = Promise.resolve(null);
  43123. }
  43124. }
  43125. return Promise.all([
  43126. imagePromise,
  43127. smaskPromise,
  43128. maskPromise
  43129. ]).then(function (results) {
  43130. var imageData = results[0];
  43131. var smaskData = results[1];
  43132. var maskData = results[2];
  43133. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  43134. });
  43135. };
  43136. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  43137. var computedLength = (width + 7 >> 3) * height;
  43138. var actualLength = imgArray.byteLength;
  43139. var haveFullData = computedLength === actualLength;
  43140. var data, i;
  43141. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43142. data = imgArray;
  43143. } else if (!inverseDecode) {
  43144. data = new Uint8Array(actualLength);
  43145. data.set(imgArray);
  43146. } else {
  43147. data = new Uint8Array(computedLength);
  43148. data.set(imgArray);
  43149. for (i = actualLength; i < computedLength; i++) {
  43150. data[i] = 0xff;
  43151. }
  43152. }
  43153. if (inverseDecode) {
  43154. for (i = 0; i < actualLength; i++) {
  43155. data[i] = ~data[i];
  43156. }
  43157. }
  43158. return {
  43159. data: data,
  43160. width: width,
  43161. height: height
  43162. };
  43163. };
  43164. PDFImage.prototype = {
  43165. get drawWidth() {
  43166. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43167. },
  43168. get drawHeight() {
  43169. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43170. },
  43171. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  43172. var bpc = this.bpc;
  43173. var numComps = this.numComps;
  43174. var decodeAddends = this.decodeAddends;
  43175. var decodeCoefficients = this.decodeCoefficients;
  43176. var max = (1 << bpc) - 1;
  43177. var i, ii;
  43178. if (bpc === 1) {
  43179. for (i = 0, ii = buffer.length; i < ii; i++) {
  43180. buffer[i] = +!buffer[i];
  43181. }
  43182. return;
  43183. }
  43184. var index = 0;
  43185. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43186. for (var j = 0; j < numComps; j++) {
  43187. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43188. index++;
  43189. }
  43190. }
  43191. },
  43192. getComponents: function PDFImage_getComponents(buffer) {
  43193. var bpc = this.bpc;
  43194. if (bpc === 8) {
  43195. return buffer;
  43196. }
  43197. var width = this.width;
  43198. var height = this.height;
  43199. var numComps = this.numComps;
  43200. var length = width * height * numComps;
  43201. var bufferPos = 0;
  43202. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43203. var rowComps = width * numComps;
  43204. var max = (1 << bpc) - 1;
  43205. var i = 0, ii, buf;
  43206. if (bpc === 1) {
  43207. var mask, loop1End, loop2End;
  43208. for (var j = 0; j < height; j++) {
  43209. loop1End = i + (rowComps & ~7);
  43210. loop2End = i + rowComps;
  43211. while (i < loop1End) {
  43212. buf = buffer[bufferPos++];
  43213. output[i] = buf >> 7 & 1;
  43214. output[i + 1] = buf >> 6 & 1;
  43215. output[i + 2] = buf >> 5 & 1;
  43216. output[i + 3] = buf >> 4 & 1;
  43217. output[i + 4] = buf >> 3 & 1;
  43218. output[i + 5] = buf >> 2 & 1;
  43219. output[i + 6] = buf >> 1 & 1;
  43220. output[i + 7] = buf & 1;
  43221. i += 8;
  43222. }
  43223. if (i < loop2End) {
  43224. buf = buffer[bufferPos++];
  43225. mask = 128;
  43226. while (i < loop2End) {
  43227. output[i++] = +!!(buf & mask);
  43228. mask >>= 1;
  43229. }
  43230. }
  43231. }
  43232. } else {
  43233. var bits = 0;
  43234. buf = 0;
  43235. for (i = 0, ii = length; i < ii; ++i) {
  43236. if (i % rowComps === 0) {
  43237. buf = 0;
  43238. bits = 0;
  43239. }
  43240. while (bits < bpc) {
  43241. buf = buf << 8 | buffer[bufferPos++];
  43242. bits += 8;
  43243. }
  43244. var remainingBits = bits - bpc;
  43245. var value = buf >> remainingBits;
  43246. output[i] = value < 0 ? 0 : value > max ? max : value;
  43247. buf = buf & (1 << remainingBits) - 1;
  43248. bits = remainingBits;
  43249. }
  43250. }
  43251. return output;
  43252. },
  43253. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43254. var smask = this.smask;
  43255. var mask = this.mask;
  43256. var alphaBuf, sw, sh, i, ii, j;
  43257. if (smask) {
  43258. sw = smask.width;
  43259. sh = smask.height;
  43260. alphaBuf = new Uint8Array(sw * sh);
  43261. smask.fillGrayBuffer(alphaBuf);
  43262. if (sw !== width || sh !== height) {
  43263. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43264. }
  43265. } else if (mask) {
  43266. if (mask instanceof PDFImage) {
  43267. sw = mask.width;
  43268. sh = mask.height;
  43269. alphaBuf = new Uint8Array(sw * sh);
  43270. mask.numComps = 1;
  43271. mask.fillGrayBuffer(alphaBuf);
  43272. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43273. alphaBuf[i] = 255 - alphaBuf[i];
  43274. }
  43275. if (sw !== width || sh !== height) {
  43276. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43277. }
  43278. } else if (isArray(mask)) {
  43279. alphaBuf = new Uint8Array(width * height);
  43280. var numComps = this.numComps;
  43281. for (i = 0, ii = width * height; i < ii; ++i) {
  43282. var opacity = 0;
  43283. var imageOffset = i * numComps;
  43284. for (j = 0; j < numComps; ++j) {
  43285. var color = image[imageOffset + j];
  43286. var maskOffset = j * 2;
  43287. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43288. opacity = 255;
  43289. break;
  43290. }
  43291. }
  43292. alphaBuf[i] = opacity;
  43293. }
  43294. } else {
  43295. error('Unknown mask format.');
  43296. }
  43297. }
  43298. if (alphaBuf) {
  43299. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43300. rgbaBuf[j] = alphaBuf[i];
  43301. }
  43302. } else {
  43303. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43304. rgbaBuf[j] = 255;
  43305. }
  43306. }
  43307. },
  43308. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  43309. var matte = this.smask && this.smask.matte;
  43310. if (!matte) {
  43311. return;
  43312. }
  43313. var matteRgb = this.colorSpace.getRgb(matte, 0);
  43314. var matteR = matteRgb[0];
  43315. var matteG = matteRgb[1];
  43316. var matteB = matteRgb[2];
  43317. var length = width * height * 4;
  43318. var r, g, b;
  43319. for (var i = 0; i < length; i += 4) {
  43320. var alpha = buffer[i + 3];
  43321. if (alpha === 0) {
  43322. buffer[i] = 255;
  43323. buffer[i + 1] = 255;
  43324. buffer[i + 2] = 255;
  43325. continue;
  43326. }
  43327. var k = 255 / alpha;
  43328. r = (buffer[i] - matteR) * k + matteR;
  43329. g = (buffer[i + 1] - matteG) * k + matteG;
  43330. b = (buffer[i + 2] - matteB) * k + matteB;
  43331. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  43332. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  43333. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  43334. }
  43335. },
  43336. createImageData: function PDFImage_createImageData(forceRGBA) {
  43337. var drawWidth = this.drawWidth;
  43338. var drawHeight = this.drawHeight;
  43339. var imgData = {
  43340. width: drawWidth,
  43341. height: drawHeight
  43342. };
  43343. var numComps = this.numComps;
  43344. var originalWidth = this.width;
  43345. var originalHeight = this.height;
  43346. var bpc = this.bpc;
  43347. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43348. var imgArray;
  43349. if (!forceRGBA) {
  43350. var kind;
  43351. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  43352. kind = ImageKind.GRAYSCALE_1BPP;
  43353. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  43354. kind = ImageKind.RGB_24BPP;
  43355. }
  43356. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43357. imgData.kind = kind;
  43358. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43359. if (this.image instanceof DecodeStream) {
  43360. imgData.data = imgArray;
  43361. } else {
  43362. var newArray = new Uint8Array(imgArray.length);
  43363. newArray.set(imgArray);
  43364. imgData.data = newArray;
  43365. }
  43366. if (this.needsDecode) {
  43367. assert(kind === ImageKind.GRAYSCALE_1BPP);
  43368. var buffer = imgData.data;
  43369. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43370. buffer[i] ^= 0xff;
  43371. }
  43372. }
  43373. return imgData;
  43374. }
  43375. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  43376. imgData.kind = ImageKind.RGB_24BPP;
  43377. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  43378. return imgData;
  43379. }
  43380. }
  43381. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43382. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43383. var comps = this.getComponents(imgArray);
  43384. var alpha01, maybeUndoPreblend;
  43385. if (!forceRGBA && !this.smask && !this.mask) {
  43386. imgData.kind = ImageKind.RGB_24BPP;
  43387. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  43388. alpha01 = 0;
  43389. maybeUndoPreblend = false;
  43390. } else {
  43391. imgData.kind = ImageKind.RGBA_32BPP;
  43392. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  43393. alpha01 = 1;
  43394. maybeUndoPreblend = true;
  43395. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43396. }
  43397. if (this.needsDecode) {
  43398. this.decodeBuffer(comps);
  43399. }
  43400. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43401. if (maybeUndoPreblend) {
  43402. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43403. }
  43404. return imgData;
  43405. },
  43406. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  43407. var numComps = this.numComps;
  43408. if (numComps !== 1) {
  43409. error('Reading gray scale from a color image: ' + numComps);
  43410. }
  43411. var width = this.width;
  43412. var height = this.height;
  43413. var bpc = this.bpc;
  43414. var rowBytes = width * numComps * bpc + 7 >> 3;
  43415. var imgArray = this.getImageBytes(height * rowBytes);
  43416. var comps = this.getComponents(imgArray);
  43417. var i, length;
  43418. if (bpc === 1) {
  43419. length = width * height;
  43420. if (this.needsDecode) {
  43421. for (i = 0; i < length; ++i) {
  43422. buffer[i] = comps[i] - 1 & 255;
  43423. }
  43424. } else {
  43425. for (i = 0; i < length; ++i) {
  43426. buffer[i] = -comps[i] & 255;
  43427. }
  43428. }
  43429. return;
  43430. }
  43431. if (this.needsDecode) {
  43432. this.decodeBuffer(comps);
  43433. }
  43434. length = width * height;
  43435. var scale = 255 / ((1 << bpc) - 1);
  43436. for (i = 0; i < length; ++i) {
  43437. buffer[i] = scale * comps[i] | 0;
  43438. }
  43439. },
  43440. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  43441. this.image.reset();
  43442. this.image.drawWidth = drawWidth || this.width;
  43443. this.image.drawHeight = drawHeight || this.height;
  43444. this.image.forceRGB = !!forceRGB;
  43445. return this.image.getBytes(length);
  43446. }
  43447. };
  43448. return PDFImage;
  43449. }();
  43450. exports.PDFImage = PDFImage;
  43451. /***/ }),
  43452. /* 28 */
  43453. /***/ (function(module, exports, __w_pdfjs_require__) {
  43454. "use strict";
  43455. var sharedUtil = __w_pdfjs_require__(0);
  43456. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  43457. var error = sharedUtil.error;
  43458. var log2 = sharedUtil.log2;
  43459. var readInt8 = sharedUtil.readInt8;
  43460. var readUint16 = sharedUtil.readUint16;
  43461. var readUint32 = sharedUtil.readUint32;
  43462. var shadow = sharedUtil.shadow;
  43463. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  43464. var Jbig2Image = function Jbig2ImageClosure() {
  43465. function ContextCache() {
  43466. }
  43467. ContextCache.prototype = {
  43468. getContexts: function (id) {
  43469. if (id in this) {
  43470. return this[id];
  43471. }
  43472. return this[id] = new Int8Array(1 << 16);
  43473. }
  43474. };
  43475. function DecodingContext(data, start, end) {
  43476. this.data = data;
  43477. this.start = start;
  43478. this.end = end;
  43479. }
  43480. DecodingContext.prototype = {
  43481. get decoder() {
  43482. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  43483. return shadow(this, 'decoder', decoder);
  43484. },
  43485. get contextCache() {
  43486. var cache = new ContextCache();
  43487. return shadow(this, 'contextCache', cache);
  43488. }
  43489. };
  43490. function decodeInteger(contextCache, procedure, decoder) {
  43491. var contexts = contextCache.getContexts(procedure);
  43492. var prev = 1;
  43493. function readBits(length) {
  43494. var v = 0;
  43495. for (var i = 0; i < length; i++) {
  43496. var bit = decoder.readBit(contexts, prev);
  43497. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  43498. v = v << 1 | bit;
  43499. }
  43500. return v >>> 0;
  43501. }
  43502. var sign = readBits(1);
  43503. 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);
  43504. return sign === 0 ? value : value > 0 ? -value : null;
  43505. }
  43506. function decodeIAID(contextCache, decoder, codeLength) {
  43507. var contexts = contextCache.getContexts('IAID');
  43508. var prev = 1;
  43509. for (var i = 0; i < codeLength; i++) {
  43510. var bit = decoder.readBit(contexts, prev);
  43511. prev = prev << 1 | bit;
  43512. }
  43513. if (codeLength < 31) {
  43514. return prev & (1 << codeLength) - 1;
  43515. }
  43516. return prev & 0x7FFFFFFF;
  43517. }
  43518. var SegmentTypes = [
  43519. 'SymbolDictionary',
  43520. null,
  43521. null,
  43522. null,
  43523. 'IntermediateTextRegion',
  43524. null,
  43525. 'ImmediateTextRegion',
  43526. 'ImmediateLosslessTextRegion',
  43527. null,
  43528. null,
  43529. null,
  43530. null,
  43531. null,
  43532. null,
  43533. null,
  43534. null,
  43535. 'patternDictionary',
  43536. null,
  43537. null,
  43538. null,
  43539. 'IntermediateHalftoneRegion',
  43540. null,
  43541. 'ImmediateHalftoneRegion',
  43542. 'ImmediateLosslessHalftoneRegion',
  43543. null,
  43544. null,
  43545. null,
  43546. null,
  43547. null,
  43548. null,
  43549. null,
  43550. null,
  43551. null,
  43552. null,
  43553. null,
  43554. null,
  43555. 'IntermediateGenericRegion',
  43556. null,
  43557. 'ImmediateGenericRegion',
  43558. 'ImmediateLosslessGenericRegion',
  43559. 'IntermediateGenericRefinementRegion',
  43560. null,
  43561. 'ImmediateGenericRefinementRegion',
  43562. 'ImmediateLosslessGenericRefinementRegion',
  43563. null,
  43564. null,
  43565. null,
  43566. null,
  43567. 'PageInformation',
  43568. 'EndOfPage',
  43569. 'EndOfStripe',
  43570. 'EndOfFile',
  43571. 'Profiles',
  43572. 'Tables',
  43573. null,
  43574. null,
  43575. null,
  43576. null,
  43577. null,
  43578. null,
  43579. null,
  43580. null,
  43581. 'Extension'
  43582. ];
  43583. var CodingTemplates = [
  43584. [
  43585. {
  43586. x: -1,
  43587. y: -2
  43588. },
  43589. {
  43590. x: 0,
  43591. y: -2
  43592. },
  43593. {
  43594. x: 1,
  43595. y: -2
  43596. },
  43597. {
  43598. x: -2,
  43599. y: -1
  43600. },
  43601. {
  43602. x: -1,
  43603. y: -1
  43604. },
  43605. {
  43606. x: 0,
  43607. y: -1
  43608. },
  43609. {
  43610. x: 1,
  43611. y: -1
  43612. },
  43613. {
  43614. x: 2,
  43615. y: -1
  43616. },
  43617. {
  43618. x: -4,
  43619. y: 0
  43620. },
  43621. {
  43622. x: -3,
  43623. y: 0
  43624. },
  43625. {
  43626. x: -2,
  43627. y: 0
  43628. },
  43629. {
  43630. x: -1,
  43631. y: 0
  43632. }
  43633. ],
  43634. [
  43635. {
  43636. x: -1,
  43637. y: -2
  43638. },
  43639. {
  43640. x: 0,
  43641. y: -2
  43642. },
  43643. {
  43644. x: 1,
  43645. y: -2
  43646. },
  43647. {
  43648. x: 2,
  43649. y: -2
  43650. },
  43651. {
  43652. x: -2,
  43653. y: -1
  43654. },
  43655. {
  43656. x: -1,
  43657. y: -1
  43658. },
  43659. {
  43660. x: 0,
  43661. y: -1
  43662. },
  43663. {
  43664. x: 1,
  43665. y: -1
  43666. },
  43667. {
  43668. x: 2,
  43669. y: -1
  43670. },
  43671. {
  43672. x: -3,
  43673. y: 0
  43674. },
  43675. {
  43676. x: -2,
  43677. y: 0
  43678. },
  43679. {
  43680. x: -1,
  43681. y: 0
  43682. }
  43683. ],
  43684. [
  43685. {
  43686. x: -1,
  43687. y: -2
  43688. },
  43689. {
  43690. x: 0,
  43691. y: -2
  43692. },
  43693. {
  43694. x: 1,
  43695. y: -2
  43696. },
  43697. {
  43698. x: -2,
  43699. y: -1
  43700. },
  43701. {
  43702. x: -1,
  43703. y: -1
  43704. },
  43705. {
  43706. x: 0,
  43707. y: -1
  43708. },
  43709. {
  43710. x: 1,
  43711. y: -1
  43712. },
  43713. {
  43714. x: -2,
  43715. y: 0
  43716. },
  43717. {
  43718. x: -1,
  43719. y: 0
  43720. }
  43721. ],
  43722. [
  43723. {
  43724. x: -3,
  43725. y: -1
  43726. },
  43727. {
  43728. x: -2,
  43729. y: -1
  43730. },
  43731. {
  43732. x: -1,
  43733. y: -1
  43734. },
  43735. {
  43736. x: 0,
  43737. y: -1
  43738. },
  43739. {
  43740. x: 1,
  43741. y: -1
  43742. },
  43743. {
  43744. x: -4,
  43745. y: 0
  43746. },
  43747. {
  43748. x: -3,
  43749. y: 0
  43750. },
  43751. {
  43752. x: -2,
  43753. y: 0
  43754. },
  43755. {
  43756. x: -1,
  43757. y: 0
  43758. }
  43759. ]
  43760. ];
  43761. var RefinementTemplates = [
  43762. {
  43763. coding: [
  43764. {
  43765. x: 0,
  43766. y: -1
  43767. },
  43768. {
  43769. x: 1,
  43770. y: -1
  43771. },
  43772. {
  43773. x: -1,
  43774. y: 0
  43775. }
  43776. ],
  43777. reference: [
  43778. {
  43779. x: 0,
  43780. y: -1
  43781. },
  43782. {
  43783. x: 1,
  43784. y: -1
  43785. },
  43786. {
  43787. x: -1,
  43788. y: 0
  43789. },
  43790. {
  43791. x: 0,
  43792. y: 0
  43793. },
  43794. {
  43795. x: 1,
  43796. y: 0
  43797. },
  43798. {
  43799. x: -1,
  43800. y: 1
  43801. },
  43802. {
  43803. x: 0,
  43804. y: 1
  43805. },
  43806. {
  43807. x: 1,
  43808. y: 1
  43809. }
  43810. ]
  43811. },
  43812. {
  43813. coding: [
  43814. {
  43815. x: -1,
  43816. y: -1
  43817. },
  43818. {
  43819. x: 0,
  43820. y: -1
  43821. },
  43822. {
  43823. x: 1,
  43824. y: -1
  43825. },
  43826. {
  43827. x: -1,
  43828. y: 0
  43829. }
  43830. ],
  43831. reference: [
  43832. {
  43833. x: 0,
  43834. y: -1
  43835. },
  43836. {
  43837. x: -1,
  43838. y: 0
  43839. },
  43840. {
  43841. x: 0,
  43842. y: 0
  43843. },
  43844. {
  43845. x: 1,
  43846. y: 0
  43847. },
  43848. {
  43849. x: 0,
  43850. y: 1
  43851. },
  43852. {
  43853. x: 1,
  43854. y: 1
  43855. }
  43856. ]
  43857. }
  43858. ];
  43859. var ReusedContexts = [
  43860. 0x9B25,
  43861. 0x0795,
  43862. 0x00E5,
  43863. 0x0195
  43864. ];
  43865. var RefinementReusedContexts = [
  43866. 0x0020,
  43867. 0x0008
  43868. ];
  43869. function decodeBitmapTemplate0(width, height, decodingContext) {
  43870. var decoder = decodingContext.decoder;
  43871. var contexts = decodingContext.contextCache.getContexts('GB');
  43872. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43873. var OLD_PIXEL_MASK = 0x7BF7;
  43874. for (i = 0; i < height; i++) {
  43875. row = bitmap[i] = new Uint8Array(width);
  43876. row1 = i < 1 ? row : bitmap[i - 1];
  43877. row2 = i < 2 ? row : bitmap[i - 2];
  43878. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43879. for (j = 0; j < width; j++) {
  43880. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43881. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43882. }
  43883. }
  43884. return bitmap;
  43885. }
  43886. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43887. if (mmr) {
  43888. error('JBIG2 error: MMR encoding is not supported');
  43889. }
  43890. 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) {
  43891. return decodeBitmapTemplate0(width, height, decodingContext);
  43892. }
  43893. var useskip = !!skip;
  43894. var template = CodingTemplates[templateIndex].concat(at);
  43895. template.sort(function (a, b) {
  43896. return a.y - b.y || a.x - b.x;
  43897. });
  43898. var templateLength = template.length;
  43899. var templateX = new Int8Array(templateLength);
  43900. var templateY = new Int8Array(templateLength);
  43901. var changingTemplateEntries = [];
  43902. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43903. var c, k;
  43904. for (k = 0; k < templateLength; k++) {
  43905. templateX[k] = template[k].x;
  43906. templateY[k] = template[k].y;
  43907. minX = Math.min(minX, template[k].x);
  43908. maxX = Math.max(maxX, template[k].x);
  43909. minY = Math.min(minY, template[k].y);
  43910. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43911. reuseMask |= 1 << templateLength - 1 - k;
  43912. } else {
  43913. changingTemplateEntries.push(k);
  43914. }
  43915. }
  43916. var changingEntriesLength = changingTemplateEntries.length;
  43917. var changingTemplateX = new Int8Array(changingEntriesLength);
  43918. var changingTemplateY = new Int8Array(changingEntriesLength);
  43919. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43920. for (c = 0; c < changingEntriesLength; c++) {
  43921. k = changingTemplateEntries[c];
  43922. changingTemplateX[c] = template[k].x;
  43923. changingTemplateY[c] = template[k].y;
  43924. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43925. }
  43926. var sbb_left = -minX;
  43927. var sbb_top = -minY;
  43928. var sbb_right = width - maxX;
  43929. var pseudoPixelContext = ReusedContexts[templateIndex];
  43930. var row = new Uint8Array(width);
  43931. var bitmap = [];
  43932. var decoder = decodingContext.decoder;
  43933. var contexts = decodingContext.contextCache.getContexts('GB');
  43934. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43935. for (var i = 0; i < height; i++) {
  43936. if (prediction) {
  43937. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43938. ltp ^= sltp;
  43939. if (ltp) {
  43940. bitmap.push(row);
  43941. continue;
  43942. }
  43943. }
  43944. row = new Uint8Array(row);
  43945. bitmap.push(row);
  43946. for (j = 0; j < width; j++) {
  43947. if (useskip && skip[i][j]) {
  43948. row[j] = 0;
  43949. continue;
  43950. }
  43951. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43952. contextLabel = contextLabel << 1 & reuseMask;
  43953. for (k = 0; k < changingEntriesLength; k++) {
  43954. i0 = i + changingTemplateY[k];
  43955. j0 = j + changingTemplateX[k];
  43956. bit = bitmap[i0][j0];
  43957. if (bit) {
  43958. bit = changingTemplateBit[k];
  43959. contextLabel |= bit;
  43960. }
  43961. }
  43962. } else {
  43963. contextLabel = 0;
  43964. shift = templateLength - 1;
  43965. for (k = 0; k < templateLength; k++, shift--) {
  43966. j0 = j + templateX[k];
  43967. if (j0 >= 0 && j0 < width) {
  43968. i0 = i + templateY[k];
  43969. if (i0 >= 0) {
  43970. bit = bitmap[i0][j0];
  43971. if (bit) {
  43972. contextLabel |= bit << shift;
  43973. }
  43974. }
  43975. }
  43976. }
  43977. }
  43978. var pixel = decoder.readBit(contexts, contextLabel);
  43979. row[j] = pixel;
  43980. }
  43981. }
  43982. return bitmap;
  43983. }
  43984. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43985. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43986. if (templateIndex === 0) {
  43987. codingTemplate = codingTemplate.concat([at[0]]);
  43988. }
  43989. var codingTemplateLength = codingTemplate.length;
  43990. var codingTemplateX = new Int32Array(codingTemplateLength);
  43991. var codingTemplateY = new Int32Array(codingTemplateLength);
  43992. var k;
  43993. for (k = 0; k < codingTemplateLength; k++) {
  43994. codingTemplateX[k] = codingTemplate[k].x;
  43995. codingTemplateY[k] = codingTemplate[k].y;
  43996. }
  43997. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  43998. if (templateIndex === 0) {
  43999. referenceTemplate = referenceTemplate.concat([at[1]]);
  44000. }
  44001. var referenceTemplateLength = referenceTemplate.length;
  44002. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  44003. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  44004. for (k = 0; k < referenceTemplateLength; k++) {
  44005. referenceTemplateX[k] = referenceTemplate[k].x;
  44006. referenceTemplateY[k] = referenceTemplate[k].y;
  44007. }
  44008. var referenceWidth = referenceBitmap[0].length;
  44009. var referenceHeight = referenceBitmap.length;
  44010. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  44011. var bitmap = [];
  44012. var decoder = decodingContext.decoder;
  44013. var contexts = decodingContext.contextCache.getContexts('GR');
  44014. var ltp = 0;
  44015. for (var i = 0; i < height; i++) {
  44016. if (prediction) {
  44017. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  44018. ltp ^= sltp;
  44019. if (ltp) {
  44020. error('JBIG2 error: prediction is not supported');
  44021. }
  44022. }
  44023. var row = new Uint8Array(width);
  44024. bitmap.push(row);
  44025. for (var j = 0; j < width; j++) {
  44026. var i0, j0;
  44027. var contextLabel = 0;
  44028. for (k = 0; k < codingTemplateLength; k++) {
  44029. i0 = i + codingTemplateY[k];
  44030. j0 = j + codingTemplateX[k];
  44031. if (i0 < 0 || j0 < 0 || j0 >= width) {
  44032. contextLabel <<= 1;
  44033. } else {
  44034. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  44035. }
  44036. }
  44037. for (k = 0; k < referenceTemplateLength; k++) {
  44038. i0 = i + referenceTemplateY[k] + offsetY;
  44039. j0 = j + referenceTemplateX[k] + offsetX;
  44040. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  44041. contextLabel <<= 1;
  44042. } else {
  44043. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  44044. }
  44045. }
  44046. var pixel = decoder.readBit(contexts, contextLabel);
  44047. row[j] = pixel;
  44048. }
  44049. }
  44050. return bitmap;
  44051. }
  44052. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  44053. if (huffman) {
  44054. error('JBIG2 error: huffman is not supported');
  44055. }
  44056. var newSymbols = [];
  44057. var currentHeight = 0;
  44058. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  44059. var decoder = decodingContext.decoder;
  44060. var contextCache = decodingContext.contextCache;
  44061. while (newSymbols.length < numberOfNewSymbols) {
  44062. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  44063. currentHeight += deltaHeight;
  44064. var currentWidth = 0;
  44065. while (true) {
  44066. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  44067. if (deltaWidth === null) {
  44068. break;
  44069. }
  44070. currentWidth += deltaWidth;
  44071. var bitmap;
  44072. if (refinement) {
  44073. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  44074. if (numberOfInstances > 1) {
  44075. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  44076. } else {
  44077. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44078. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44079. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44080. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  44081. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  44082. }
  44083. } else {
  44084. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  44085. }
  44086. newSymbols.push(bitmap);
  44087. }
  44088. }
  44089. var exportedSymbols = [];
  44090. var flags = [], currentFlag = false;
  44091. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  44092. while (flags.length < totalSymbolsLength) {
  44093. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  44094. while (runLength--) {
  44095. flags.push(currentFlag);
  44096. }
  44097. currentFlag = !currentFlag;
  44098. }
  44099. for (var i = 0, ii = symbols.length; i < ii; i++) {
  44100. if (flags[i]) {
  44101. exportedSymbols.push(symbols[i]);
  44102. }
  44103. }
  44104. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  44105. if (flags[i]) {
  44106. exportedSymbols.push(newSymbols[j]);
  44107. }
  44108. }
  44109. return exportedSymbols;
  44110. }
  44111. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  44112. if (huffman) {
  44113. error('JBIG2 error: huffman is not supported');
  44114. }
  44115. var bitmap = [];
  44116. var i, row;
  44117. for (i = 0; i < height; i++) {
  44118. row = new Uint8Array(width);
  44119. if (defaultPixelValue) {
  44120. for (var j = 0; j < width; j++) {
  44121. row[j] = defaultPixelValue;
  44122. }
  44123. }
  44124. bitmap.push(row);
  44125. }
  44126. var decoder = decodingContext.decoder;
  44127. var contextCache = decodingContext.contextCache;
  44128. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  44129. var firstS = 0;
  44130. i = 0;
  44131. while (i < numberOfSymbolInstances) {
  44132. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  44133. stripT += deltaT;
  44134. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  44135. firstS += deltaFirstS;
  44136. var currentS = firstS;
  44137. do {
  44138. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  44139. var t = stripSize * stripT + currentT;
  44140. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44141. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  44142. var symbolBitmap = inputSymbols[symbolId];
  44143. var symbolWidth = symbolBitmap[0].length;
  44144. var symbolHeight = symbolBitmap.length;
  44145. if (applyRefinement) {
  44146. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  44147. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  44148. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44149. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44150. symbolWidth += rdw;
  44151. symbolHeight += rdh;
  44152. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  44153. }
  44154. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  44155. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  44156. var s2, t2, symbolRow;
  44157. if (transposed) {
  44158. for (s2 = 0; s2 < symbolHeight; s2++) {
  44159. row = bitmap[offsetS + s2];
  44160. if (!row) {
  44161. continue;
  44162. }
  44163. symbolRow = symbolBitmap[s2];
  44164. var maxWidth = Math.min(width - offsetT, symbolWidth);
  44165. switch (combinationOperator) {
  44166. case 0:
  44167. for (t2 = 0; t2 < maxWidth; t2++) {
  44168. row[offsetT + t2] |= symbolRow[t2];
  44169. }
  44170. break;
  44171. case 2:
  44172. for (t2 = 0; t2 < maxWidth; t2++) {
  44173. row[offsetT + t2] ^= symbolRow[t2];
  44174. }
  44175. break;
  44176. default:
  44177. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44178. }
  44179. }
  44180. currentS += symbolHeight - 1;
  44181. } else {
  44182. for (t2 = 0; t2 < symbolHeight; t2++) {
  44183. row = bitmap[offsetT + t2];
  44184. if (!row) {
  44185. continue;
  44186. }
  44187. symbolRow = symbolBitmap[t2];
  44188. switch (combinationOperator) {
  44189. case 0:
  44190. for (s2 = 0; s2 < symbolWidth; s2++) {
  44191. row[offsetS + s2] |= symbolRow[s2];
  44192. }
  44193. break;
  44194. case 2:
  44195. for (s2 = 0; s2 < symbolWidth; s2++) {
  44196. row[offsetS + s2] ^= symbolRow[s2];
  44197. }
  44198. break;
  44199. default:
  44200. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44201. }
  44202. }
  44203. currentS += symbolWidth - 1;
  44204. }
  44205. i++;
  44206. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  44207. if (deltaS === null) {
  44208. break;
  44209. }
  44210. currentS += deltaS + dsOffset;
  44211. } while (true);
  44212. }
  44213. return bitmap;
  44214. }
  44215. function readSegmentHeader(data, start) {
  44216. var segmentHeader = {};
  44217. segmentHeader.number = readUint32(data, start);
  44218. var flags = data[start + 4];
  44219. var segmentType = flags & 0x3F;
  44220. if (!SegmentTypes[segmentType]) {
  44221. error('JBIG2 error: invalid segment type: ' + segmentType);
  44222. }
  44223. segmentHeader.type = segmentType;
  44224. segmentHeader.typeName = SegmentTypes[segmentType];
  44225. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  44226. var pageAssociationFieldSize = !!(flags & 0x40);
  44227. var referredFlags = data[start + 5];
  44228. var referredToCount = referredFlags >> 5 & 7;
  44229. var retainBits = [referredFlags & 31];
  44230. var position = start + 6;
  44231. if (referredFlags === 7) {
  44232. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  44233. position += 3;
  44234. var bytes = referredToCount + 7 >> 3;
  44235. retainBits[0] = data[position++];
  44236. while (--bytes > 0) {
  44237. retainBits.push(data[position++]);
  44238. }
  44239. } else if (referredFlags === 5 || referredFlags === 6) {
  44240. error('JBIG2 error: invalid referred-to flags');
  44241. }
  44242. segmentHeader.retainBits = retainBits;
  44243. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  44244. var referredTo = [];
  44245. var i, ii;
  44246. for (i = 0; i < referredToCount; i++) {
  44247. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  44248. referredTo.push(number);
  44249. position += referredToSegmentNumberSize;
  44250. }
  44251. segmentHeader.referredTo = referredTo;
  44252. if (!pageAssociationFieldSize) {
  44253. segmentHeader.pageAssociation = data[position++];
  44254. } else {
  44255. segmentHeader.pageAssociation = readUint32(data, position);
  44256. position += 4;
  44257. }
  44258. segmentHeader.length = readUint32(data, position);
  44259. position += 4;
  44260. if (segmentHeader.length === 0xFFFFFFFF) {
  44261. if (segmentType === 38) {
  44262. var genericRegionInfo = readRegionSegmentInformation(data, position);
  44263. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  44264. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  44265. var searchPatternLength = 6;
  44266. var searchPattern = new Uint8Array(searchPatternLength);
  44267. if (!genericRegionMmr) {
  44268. searchPattern[0] = 0xFF;
  44269. searchPattern[1] = 0xAC;
  44270. }
  44271. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  44272. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  44273. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  44274. searchPattern[5] = genericRegionInfo.height & 0xFF;
  44275. for (i = position, ii = data.length; i < ii; i++) {
  44276. var j = 0;
  44277. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  44278. j++;
  44279. }
  44280. if (j === searchPatternLength) {
  44281. segmentHeader.length = i + searchPatternLength;
  44282. break;
  44283. }
  44284. }
  44285. if (segmentHeader.length === 0xFFFFFFFF) {
  44286. error('JBIG2 error: segment end was not found');
  44287. }
  44288. } else {
  44289. error('JBIG2 error: invalid unknown segment length');
  44290. }
  44291. }
  44292. segmentHeader.headerEnd = position;
  44293. return segmentHeader;
  44294. }
  44295. function readSegments(header, data, start, end) {
  44296. var segments = [];
  44297. var position = start;
  44298. while (position < end) {
  44299. var segmentHeader = readSegmentHeader(data, position);
  44300. position = segmentHeader.headerEnd;
  44301. var segment = {
  44302. header: segmentHeader,
  44303. data: data
  44304. };
  44305. if (!header.randomAccess) {
  44306. segment.start = position;
  44307. position += segmentHeader.length;
  44308. segment.end = position;
  44309. }
  44310. segments.push(segment);
  44311. if (segmentHeader.type === 51) {
  44312. break;
  44313. }
  44314. }
  44315. if (header.randomAccess) {
  44316. for (var i = 0, ii = segments.length; i < ii; i++) {
  44317. segments[i].start = position;
  44318. position += segments[i].header.length;
  44319. segments[i].end = position;
  44320. }
  44321. }
  44322. return segments;
  44323. }
  44324. function readRegionSegmentInformation(data, start) {
  44325. return {
  44326. width: readUint32(data, start),
  44327. height: readUint32(data, start + 4),
  44328. x: readUint32(data, start + 8),
  44329. y: readUint32(data, start + 12),
  44330. combinationOperator: data[start + 16] & 7
  44331. };
  44332. }
  44333. var RegionSegmentInformationFieldLength = 17;
  44334. function processSegment(segment, visitor) {
  44335. var header = segment.header;
  44336. var data = segment.data, position = segment.start, end = segment.end;
  44337. var args, at, i, atLength;
  44338. switch (header.type) {
  44339. case 0:
  44340. var dictionary = {};
  44341. var dictionaryFlags = readUint16(data, position);
  44342. dictionary.huffman = !!(dictionaryFlags & 1);
  44343. dictionary.refinement = !!(dictionaryFlags & 2);
  44344. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  44345. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  44346. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  44347. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  44348. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  44349. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  44350. dictionary.template = dictionaryFlags >> 10 & 3;
  44351. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  44352. position += 2;
  44353. if (!dictionary.huffman) {
  44354. atLength = dictionary.template === 0 ? 4 : 1;
  44355. at = [];
  44356. for (i = 0; i < atLength; i++) {
  44357. at.push({
  44358. x: readInt8(data, position),
  44359. y: readInt8(data, position + 1)
  44360. });
  44361. position += 2;
  44362. }
  44363. dictionary.at = at;
  44364. }
  44365. if (dictionary.refinement && !dictionary.refinementTemplate) {
  44366. at = [];
  44367. for (i = 0; i < 2; i++) {
  44368. at.push({
  44369. x: readInt8(data, position),
  44370. y: readInt8(data, position + 1)
  44371. });
  44372. position += 2;
  44373. }
  44374. dictionary.refinementAt = at;
  44375. }
  44376. dictionary.numberOfExportedSymbols = readUint32(data, position);
  44377. position += 4;
  44378. dictionary.numberOfNewSymbols = readUint32(data, position);
  44379. position += 4;
  44380. args = [
  44381. dictionary,
  44382. header.number,
  44383. header.referredTo,
  44384. data,
  44385. position,
  44386. end
  44387. ];
  44388. break;
  44389. case 6:
  44390. case 7:
  44391. var textRegion = {};
  44392. textRegion.info = readRegionSegmentInformation(data, position);
  44393. position += RegionSegmentInformationFieldLength;
  44394. var textRegionSegmentFlags = readUint16(data, position);
  44395. position += 2;
  44396. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  44397. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  44398. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  44399. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  44400. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  44401. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  44402. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  44403. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  44404. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  44405. if (textRegion.huffman) {
  44406. var textRegionHuffmanFlags = readUint16(data, position);
  44407. position += 2;
  44408. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  44409. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  44410. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  44411. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  44412. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  44413. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  44414. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  44415. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  44416. }
  44417. if (textRegion.refinement && !textRegion.refinementTemplate) {
  44418. at = [];
  44419. for (i = 0; i < 2; i++) {
  44420. at.push({
  44421. x: readInt8(data, position),
  44422. y: readInt8(data, position + 1)
  44423. });
  44424. position += 2;
  44425. }
  44426. textRegion.refinementAt = at;
  44427. }
  44428. textRegion.numberOfSymbolInstances = readUint32(data, position);
  44429. position += 4;
  44430. if (textRegion.huffman) {
  44431. error('JBIG2 error: huffman is not supported');
  44432. }
  44433. args = [
  44434. textRegion,
  44435. header.referredTo,
  44436. data,
  44437. position,
  44438. end
  44439. ];
  44440. break;
  44441. case 38:
  44442. case 39:
  44443. var genericRegion = {};
  44444. genericRegion.info = readRegionSegmentInformation(data, position);
  44445. position += RegionSegmentInformationFieldLength;
  44446. var genericRegionSegmentFlags = data[position++];
  44447. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  44448. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  44449. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  44450. if (!genericRegion.mmr) {
  44451. atLength = genericRegion.template === 0 ? 4 : 1;
  44452. at = [];
  44453. for (i = 0; i < atLength; i++) {
  44454. at.push({
  44455. x: readInt8(data, position),
  44456. y: readInt8(data, position + 1)
  44457. });
  44458. position += 2;
  44459. }
  44460. genericRegion.at = at;
  44461. }
  44462. args = [
  44463. genericRegion,
  44464. data,
  44465. position,
  44466. end
  44467. ];
  44468. break;
  44469. case 48:
  44470. var pageInfo = {
  44471. width: readUint32(data, position),
  44472. height: readUint32(data, position + 4),
  44473. resolutionX: readUint32(data, position + 8),
  44474. resolutionY: readUint32(data, position + 12)
  44475. };
  44476. if (pageInfo.height === 0xFFFFFFFF) {
  44477. delete pageInfo.height;
  44478. }
  44479. var pageSegmentFlags = data[position + 16];
  44480. readUint16(data, position + 17);
  44481. pageInfo.lossless = !!(pageSegmentFlags & 1);
  44482. pageInfo.refinement = !!(pageSegmentFlags & 2);
  44483. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  44484. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  44485. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  44486. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  44487. args = [pageInfo];
  44488. break;
  44489. case 49:
  44490. break;
  44491. case 50:
  44492. break;
  44493. case 51:
  44494. break;
  44495. case 62:
  44496. break;
  44497. default:
  44498. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  44499. }
  44500. var callbackName = 'on' + header.typeName;
  44501. if (callbackName in visitor) {
  44502. visitor[callbackName].apply(visitor, args);
  44503. }
  44504. }
  44505. function processSegments(segments, visitor) {
  44506. for (var i = 0, ii = segments.length; i < ii; i++) {
  44507. processSegment(segments[i], visitor);
  44508. }
  44509. }
  44510. function parseJbig2(data, start, end) {
  44511. var position = start;
  44512. 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) {
  44513. error('JBIG2 error: invalid header');
  44514. }
  44515. var header = {};
  44516. position += 8;
  44517. var flags = data[position++];
  44518. header.randomAccess = !(flags & 1);
  44519. if (!(flags & 2)) {
  44520. header.numberOfPages = readUint32(data, position);
  44521. position += 4;
  44522. }
  44523. readSegments(header, data, position, end);
  44524. error('Not implemented');
  44525. }
  44526. function parseJbig2Chunks(chunks) {
  44527. var visitor = new SimpleSegmentVisitor();
  44528. for (var i = 0, ii = chunks.length; i < ii; i++) {
  44529. var chunk = chunks[i];
  44530. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  44531. processSegments(segments, visitor);
  44532. }
  44533. return visitor.buffer;
  44534. }
  44535. function SimpleSegmentVisitor() {
  44536. }
  44537. SimpleSegmentVisitor.prototype = {
  44538. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  44539. this.currentPageInfo = info;
  44540. var rowSize = info.width + 7 >> 3;
  44541. var buffer = new Uint8Array(rowSize * info.height);
  44542. if (info.defaultPixelValue) {
  44543. for (var i = 0, ii = buffer.length; i < ii; i++) {
  44544. buffer[i] = 0xFF;
  44545. }
  44546. }
  44547. this.buffer = buffer;
  44548. },
  44549. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  44550. var pageInfo = this.currentPageInfo;
  44551. var width = regionInfo.width, height = regionInfo.height;
  44552. var rowSize = pageInfo.width + 7 >> 3;
  44553. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  44554. var buffer = this.buffer;
  44555. var mask0 = 128 >> (regionInfo.x & 7);
  44556. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  44557. var i, j, mask, offset;
  44558. switch (combinationOperator) {
  44559. case 0:
  44560. for (i = 0; i < height; i++) {
  44561. mask = mask0;
  44562. offset = offset0;
  44563. for (j = 0; j < width; j++) {
  44564. if (bitmap[i][j]) {
  44565. buffer[offset] |= mask;
  44566. }
  44567. mask >>= 1;
  44568. if (!mask) {
  44569. mask = 128;
  44570. offset++;
  44571. }
  44572. }
  44573. offset0 += rowSize;
  44574. }
  44575. break;
  44576. case 2:
  44577. for (i = 0; i < height; i++) {
  44578. mask = mask0;
  44579. offset = offset0;
  44580. for (j = 0; j < width; j++) {
  44581. if (bitmap[i][j]) {
  44582. buffer[offset] ^= mask;
  44583. }
  44584. mask >>= 1;
  44585. if (!mask) {
  44586. mask = 128;
  44587. offset++;
  44588. }
  44589. }
  44590. offset0 += rowSize;
  44591. }
  44592. break;
  44593. default:
  44594. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44595. }
  44596. },
  44597. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  44598. var regionInfo = region.info;
  44599. var decodingContext = new DecodingContext(data, start, end);
  44600. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  44601. this.drawBitmap(regionInfo, bitmap);
  44602. },
  44603. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  44604. this.onImmediateGenericRegion.apply(this, arguments);
  44605. },
  44606. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  44607. var huffmanTables;
  44608. if (dictionary.huffman) {
  44609. error('JBIG2 error: huffman is not supported');
  44610. }
  44611. var symbols = this.symbols;
  44612. if (!symbols) {
  44613. this.symbols = symbols = {};
  44614. }
  44615. var inputSymbols = [];
  44616. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44617. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44618. }
  44619. var decodingContext = new DecodingContext(data, start, end);
  44620. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  44621. },
  44622. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  44623. var regionInfo = region.info;
  44624. var huffmanTables;
  44625. var symbols = this.symbols;
  44626. var inputSymbols = [];
  44627. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44628. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44629. }
  44630. var symbolCodeLength = log2(inputSymbols.length);
  44631. var decodingContext = new DecodingContext(data, start, end);
  44632. 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);
  44633. this.drawBitmap(regionInfo, bitmap);
  44634. },
  44635. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  44636. this.onImmediateTextRegion.apply(this, arguments);
  44637. }
  44638. };
  44639. function Jbig2Image() {
  44640. }
  44641. Jbig2Image.prototype = {
  44642. parseChunks: function Jbig2Image_parseChunks(chunks) {
  44643. return parseJbig2Chunks(chunks);
  44644. }
  44645. };
  44646. return Jbig2Image;
  44647. }();
  44648. exports.Jbig2Image = Jbig2Image;
  44649. /***/ }),
  44650. /* 29 */
  44651. /***/ (function(module, exports, __w_pdfjs_require__) {
  44652. "use strict";
  44653. var sharedUtil = __w_pdfjs_require__(0);
  44654. var error = sharedUtil.error;
  44655. var JpegImage = function JpegImageClosure() {
  44656. var dctZigZag = new Uint8Array([
  44657. 0,
  44658. 1,
  44659. 8,
  44660. 16,
  44661. 9,
  44662. 2,
  44663. 3,
  44664. 10,
  44665. 17,
  44666. 24,
  44667. 32,
  44668. 25,
  44669. 18,
  44670. 11,
  44671. 4,
  44672. 5,
  44673. 12,
  44674. 19,
  44675. 26,
  44676. 33,
  44677. 40,
  44678. 48,
  44679. 41,
  44680. 34,
  44681. 27,
  44682. 20,
  44683. 13,
  44684. 6,
  44685. 7,
  44686. 14,
  44687. 21,
  44688. 28,
  44689. 35,
  44690. 42,
  44691. 49,
  44692. 56,
  44693. 57,
  44694. 50,
  44695. 43,
  44696. 36,
  44697. 29,
  44698. 22,
  44699. 15,
  44700. 23,
  44701. 30,
  44702. 37,
  44703. 44,
  44704. 51,
  44705. 58,
  44706. 59,
  44707. 52,
  44708. 45,
  44709. 38,
  44710. 31,
  44711. 39,
  44712. 46,
  44713. 53,
  44714. 60,
  44715. 61,
  44716. 54,
  44717. 47,
  44718. 55,
  44719. 62,
  44720. 63
  44721. ]);
  44722. var dctCos1 = 4017;
  44723. var dctSin1 = 799;
  44724. var dctCos3 = 3406;
  44725. var dctSin3 = 2276;
  44726. var dctCos6 = 1567;
  44727. var dctSin6 = 3784;
  44728. var dctSqrt2 = 5793;
  44729. var dctSqrt1d2 = 2896;
  44730. function JpegImage() {
  44731. this.decodeTransform = null;
  44732. this.colorTransform = -1;
  44733. }
  44734. function buildHuffmanTable(codeLengths, values) {
  44735. var k = 0, code = [], i, j, length = 16;
  44736. while (length > 0 && !codeLengths[length - 1]) {
  44737. length--;
  44738. }
  44739. code.push({
  44740. children: [],
  44741. index: 0
  44742. });
  44743. var p = code[0], q;
  44744. for (i = 0; i < length; i++) {
  44745. for (j = 0; j < codeLengths[i]; j++) {
  44746. p = code.pop();
  44747. p.children[p.index] = values[k];
  44748. while (p.index > 0) {
  44749. p = code.pop();
  44750. }
  44751. p.index++;
  44752. code.push(p);
  44753. while (code.length <= i) {
  44754. code.push(q = {
  44755. children: [],
  44756. index: 0
  44757. });
  44758. p.children[p.index] = q.children;
  44759. p = q;
  44760. }
  44761. k++;
  44762. }
  44763. if (i + 1 < length) {
  44764. code.push(q = {
  44765. children: [],
  44766. index: 0
  44767. });
  44768. p.children[p.index] = q.children;
  44769. p = q;
  44770. }
  44771. }
  44772. return code[0].children;
  44773. }
  44774. function getBlockBufferOffset(component, row, col) {
  44775. return 64 * ((component.blocksPerLine + 1) * row + col);
  44776. }
  44777. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  44778. var mcusPerLine = frame.mcusPerLine;
  44779. var progressive = frame.progressive;
  44780. var startOffset = offset, bitsData = 0, bitsCount = 0;
  44781. function readBit() {
  44782. if (bitsCount > 0) {
  44783. bitsCount--;
  44784. return bitsData >> bitsCount & 1;
  44785. }
  44786. bitsData = data[offset++];
  44787. if (bitsData === 0xFF) {
  44788. var nextByte = data[offset++];
  44789. if (nextByte) {
  44790. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  44791. }
  44792. }
  44793. bitsCount = 7;
  44794. return bitsData >>> 7;
  44795. }
  44796. function decodeHuffman(tree) {
  44797. var node = tree;
  44798. while (true) {
  44799. node = node[readBit()];
  44800. if (typeof node === 'number') {
  44801. return node;
  44802. }
  44803. if (typeof node !== 'object') {
  44804. error('JPEG error: invalid huffman sequence');
  44805. }
  44806. }
  44807. }
  44808. function receive(length) {
  44809. var n = 0;
  44810. while (length > 0) {
  44811. n = n << 1 | readBit();
  44812. length--;
  44813. }
  44814. return n;
  44815. }
  44816. function receiveAndExtend(length) {
  44817. if (length === 1) {
  44818. return readBit() === 1 ? 1 : -1;
  44819. }
  44820. var n = receive(length);
  44821. if (n >= 1 << length - 1) {
  44822. return n;
  44823. }
  44824. return n + (-1 << length) + 1;
  44825. }
  44826. function decodeBaseline(component, offset) {
  44827. var t = decodeHuffman(component.huffmanTableDC);
  44828. var diff = t === 0 ? 0 : receiveAndExtend(t);
  44829. component.blockData[offset] = component.pred += diff;
  44830. var k = 1;
  44831. while (k < 64) {
  44832. var rs = decodeHuffman(component.huffmanTableAC);
  44833. var s = rs & 15, r = rs >> 4;
  44834. if (s === 0) {
  44835. if (r < 15) {
  44836. break;
  44837. }
  44838. k += 16;
  44839. continue;
  44840. }
  44841. k += r;
  44842. var z = dctZigZag[k];
  44843. component.blockData[offset + z] = receiveAndExtend(s);
  44844. k++;
  44845. }
  44846. }
  44847. function decodeDCFirst(component, offset) {
  44848. var t = decodeHuffman(component.huffmanTableDC);
  44849. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44850. component.blockData[offset] = component.pred += diff;
  44851. }
  44852. function decodeDCSuccessive(component, offset) {
  44853. component.blockData[offset] |= readBit() << successive;
  44854. }
  44855. var eobrun = 0;
  44856. function decodeACFirst(component, offset) {
  44857. if (eobrun > 0) {
  44858. eobrun--;
  44859. return;
  44860. }
  44861. var k = spectralStart, e = spectralEnd;
  44862. while (k <= e) {
  44863. var rs = decodeHuffman(component.huffmanTableAC);
  44864. var s = rs & 15, r = rs >> 4;
  44865. if (s === 0) {
  44866. if (r < 15) {
  44867. eobrun = receive(r) + (1 << r) - 1;
  44868. break;
  44869. }
  44870. k += 16;
  44871. continue;
  44872. }
  44873. k += r;
  44874. var z = dctZigZag[k];
  44875. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44876. k++;
  44877. }
  44878. }
  44879. var successiveACState = 0, successiveACNextValue;
  44880. function decodeACSuccessive(component, offset) {
  44881. var k = spectralStart;
  44882. var e = spectralEnd;
  44883. var r = 0;
  44884. var s;
  44885. var rs;
  44886. while (k <= e) {
  44887. var z = dctZigZag[k];
  44888. switch (successiveACState) {
  44889. case 0:
  44890. rs = decodeHuffman(component.huffmanTableAC);
  44891. s = rs & 15;
  44892. r = rs >> 4;
  44893. if (s === 0) {
  44894. if (r < 15) {
  44895. eobrun = receive(r) + (1 << r);
  44896. successiveACState = 4;
  44897. } else {
  44898. r = 16;
  44899. successiveACState = 1;
  44900. }
  44901. } else {
  44902. if (s !== 1) {
  44903. error('JPEG error: invalid ACn encoding');
  44904. }
  44905. successiveACNextValue = receiveAndExtend(s);
  44906. successiveACState = r ? 2 : 3;
  44907. }
  44908. continue;
  44909. case 1:
  44910. case 2:
  44911. if (component.blockData[offset + z]) {
  44912. component.blockData[offset + z] += readBit() << successive;
  44913. } else {
  44914. r--;
  44915. if (r === 0) {
  44916. successiveACState = successiveACState === 2 ? 3 : 0;
  44917. }
  44918. }
  44919. break;
  44920. case 3:
  44921. if (component.blockData[offset + z]) {
  44922. component.blockData[offset + z] += readBit() << successive;
  44923. } else {
  44924. component.blockData[offset + z] = successiveACNextValue << successive;
  44925. successiveACState = 0;
  44926. }
  44927. break;
  44928. case 4:
  44929. if (component.blockData[offset + z]) {
  44930. component.blockData[offset + z] += readBit() << successive;
  44931. }
  44932. break;
  44933. }
  44934. k++;
  44935. }
  44936. if (successiveACState === 4) {
  44937. eobrun--;
  44938. if (eobrun === 0) {
  44939. successiveACState = 0;
  44940. }
  44941. }
  44942. }
  44943. function decodeMcu(component, decode, mcu, row, col) {
  44944. var mcuRow = mcu / mcusPerLine | 0;
  44945. var mcuCol = mcu % mcusPerLine;
  44946. var blockRow = mcuRow * component.v + row;
  44947. var blockCol = mcuCol * component.h + col;
  44948. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44949. decode(component, offset);
  44950. }
  44951. function decodeBlock(component, decode, mcu) {
  44952. var blockRow = mcu / component.blocksPerLine | 0;
  44953. var blockCol = mcu % component.blocksPerLine;
  44954. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44955. decode(component, offset);
  44956. }
  44957. var componentsLength = components.length;
  44958. var component, i, j, k, n;
  44959. var decodeFn;
  44960. if (progressive) {
  44961. if (spectralStart === 0) {
  44962. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44963. } else {
  44964. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44965. }
  44966. } else {
  44967. decodeFn = decodeBaseline;
  44968. }
  44969. var mcu = 0, marker;
  44970. var mcuExpected;
  44971. if (componentsLength === 1) {
  44972. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44973. } else {
  44974. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44975. }
  44976. if (!resetInterval) {
  44977. resetInterval = mcuExpected;
  44978. }
  44979. var h, v;
  44980. while (mcu < mcuExpected) {
  44981. for (i = 0; i < componentsLength; i++) {
  44982. components[i].pred = 0;
  44983. }
  44984. eobrun = 0;
  44985. if (componentsLength === 1) {
  44986. component = components[0];
  44987. for (n = 0; n < resetInterval; n++) {
  44988. decodeBlock(component, decodeFn, mcu);
  44989. mcu++;
  44990. }
  44991. } else {
  44992. for (n = 0; n < resetInterval; n++) {
  44993. for (i = 0; i < componentsLength; i++) {
  44994. component = components[i];
  44995. h = component.h;
  44996. v = component.v;
  44997. for (j = 0; j < v; j++) {
  44998. for (k = 0; k < h; k++) {
  44999. decodeMcu(component, decodeFn, mcu, j, k);
  45000. }
  45001. }
  45002. }
  45003. mcu++;
  45004. }
  45005. }
  45006. bitsCount = 0;
  45007. marker = data[offset] << 8 | data[offset + 1];
  45008. while (data[offset] === 0x00 && offset < data.length - 1) {
  45009. offset++;
  45010. marker = data[offset] << 8 | data[offset + 1];
  45011. }
  45012. if (marker <= 0xFF00) {
  45013. error('JPEG error: marker was not found');
  45014. }
  45015. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  45016. offset += 2;
  45017. } else {
  45018. break;
  45019. }
  45020. }
  45021. return offset - startOffset;
  45022. }
  45023. function quantizeAndInverse(component, blockBufferOffset, p) {
  45024. var qt = component.quantizationTable, blockData = component.blockData;
  45025. var v0, v1, v2, v3, v4, v5, v6, v7;
  45026. var p0, p1, p2, p3, p4, p5, p6, p7;
  45027. var t;
  45028. if (!qt) {
  45029. error('JPEG error: missing required Quantization Table.');
  45030. }
  45031. for (var row = 0; row < 64; row += 8) {
  45032. p0 = blockData[blockBufferOffset + row];
  45033. p1 = blockData[blockBufferOffset + row + 1];
  45034. p2 = blockData[blockBufferOffset + row + 2];
  45035. p3 = blockData[blockBufferOffset + row + 3];
  45036. p4 = blockData[blockBufferOffset + row + 4];
  45037. p5 = blockData[blockBufferOffset + row + 5];
  45038. p6 = blockData[blockBufferOffset + row + 6];
  45039. p7 = blockData[blockBufferOffset + row + 7];
  45040. p0 *= qt[row];
  45041. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45042. t = dctSqrt2 * p0 + 512 >> 10;
  45043. p[row] = t;
  45044. p[row + 1] = t;
  45045. p[row + 2] = t;
  45046. p[row + 3] = t;
  45047. p[row + 4] = t;
  45048. p[row + 5] = t;
  45049. p[row + 6] = t;
  45050. p[row + 7] = t;
  45051. continue;
  45052. }
  45053. p1 *= qt[row + 1];
  45054. p2 *= qt[row + 2];
  45055. p3 *= qt[row + 3];
  45056. p4 *= qt[row + 4];
  45057. p5 *= qt[row + 5];
  45058. p6 *= qt[row + 6];
  45059. p7 *= qt[row + 7];
  45060. v0 = dctSqrt2 * p0 + 128 >> 8;
  45061. v1 = dctSqrt2 * p4 + 128 >> 8;
  45062. v2 = p2;
  45063. v3 = p6;
  45064. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  45065. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  45066. v5 = p3 << 4;
  45067. v6 = p5 << 4;
  45068. v0 = v0 + v1 + 1 >> 1;
  45069. v1 = v0 - v1;
  45070. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  45071. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  45072. v3 = t;
  45073. v4 = v4 + v6 + 1 >> 1;
  45074. v6 = v4 - v6;
  45075. v7 = v7 + v5 + 1 >> 1;
  45076. v5 = v7 - v5;
  45077. v0 = v0 + v3 + 1 >> 1;
  45078. v3 = v0 - v3;
  45079. v1 = v1 + v2 + 1 >> 1;
  45080. v2 = v1 - v2;
  45081. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45082. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45083. v7 = t;
  45084. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45085. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45086. v6 = t;
  45087. p[row] = v0 + v7;
  45088. p[row + 7] = v0 - v7;
  45089. p[row + 1] = v1 + v6;
  45090. p[row + 6] = v1 - v6;
  45091. p[row + 2] = v2 + v5;
  45092. p[row + 5] = v2 - v5;
  45093. p[row + 3] = v3 + v4;
  45094. p[row + 4] = v3 - v4;
  45095. }
  45096. for (var col = 0; col < 8; ++col) {
  45097. p0 = p[col];
  45098. p1 = p[col + 8];
  45099. p2 = p[col + 16];
  45100. p3 = p[col + 24];
  45101. p4 = p[col + 32];
  45102. p5 = p[col + 40];
  45103. p6 = p[col + 48];
  45104. p7 = p[col + 56];
  45105. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45106. t = dctSqrt2 * p0 + 8192 >> 14;
  45107. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  45108. blockData[blockBufferOffset + col] = t;
  45109. blockData[blockBufferOffset + col + 8] = t;
  45110. blockData[blockBufferOffset + col + 16] = t;
  45111. blockData[blockBufferOffset + col + 24] = t;
  45112. blockData[blockBufferOffset + col + 32] = t;
  45113. blockData[blockBufferOffset + col + 40] = t;
  45114. blockData[blockBufferOffset + col + 48] = t;
  45115. blockData[blockBufferOffset + col + 56] = t;
  45116. continue;
  45117. }
  45118. v0 = dctSqrt2 * p0 + 2048 >> 12;
  45119. v1 = dctSqrt2 * p4 + 2048 >> 12;
  45120. v2 = p2;
  45121. v3 = p6;
  45122. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  45123. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  45124. v5 = p3;
  45125. v6 = p5;
  45126. v0 = (v0 + v1 + 1 >> 1) + 4112;
  45127. v1 = v0 - v1;
  45128. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  45129. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  45130. v3 = t;
  45131. v4 = v4 + v6 + 1 >> 1;
  45132. v6 = v4 - v6;
  45133. v7 = v7 + v5 + 1 >> 1;
  45134. v5 = v7 - v5;
  45135. v0 = v0 + v3 + 1 >> 1;
  45136. v3 = v0 - v3;
  45137. v1 = v1 + v2 + 1 >> 1;
  45138. v2 = v1 - v2;
  45139. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45140. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45141. v7 = t;
  45142. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45143. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45144. v6 = t;
  45145. p0 = v0 + v7;
  45146. p7 = v0 - v7;
  45147. p1 = v1 + v6;
  45148. p6 = v1 - v6;
  45149. p2 = v2 + v5;
  45150. p5 = v2 - v5;
  45151. p3 = v3 + v4;
  45152. p4 = v3 - v4;
  45153. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  45154. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  45155. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  45156. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  45157. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  45158. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  45159. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  45160. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  45161. blockData[blockBufferOffset + col] = p0;
  45162. blockData[blockBufferOffset + col + 8] = p1;
  45163. blockData[blockBufferOffset + col + 16] = p2;
  45164. blockData[blockBufferOffset + col + 24] = p3;
  45165. blockData[blockBufferOffset + col + 32] = p4;
  45166. blockData[blockBufferOffset + col + 40] = p5;
  45167. blockData[blockBufferOffset + col + 48] = p6;
  45168. blockData[blockBufferOffset + col + 56] = p7;
  45169. }
  45170. }
  45171. function buildComponentData(frame, component) {
  45172. var blocksPerLine = component.blocksPerLine;
  45173. var blocksPerColumn = component.blocksPerColumn;
  45174. var computationBuffer = new Int16Array(64);
  45175. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  45176. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  45177. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  45178. quantizeAndInverse(component, offset, computationBuffer);
  45179. }
  45180. }
  45181. return component.blockData;
  45182. }
  45183. function clamp0to255(a) {
  45184. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  45185. }
  45186. JpegImage.prototype = {
  45187. parse: function parse(data) {
  45188. function readUint16() {
  45189. var value = data[offset] << 8 | data[offset + 1];
  45190. offset += 2;
  45191. return value;
  45192. }
  45193. function readDataBlock() {
  45194. var length = readUint16();
  45195. var array = data.subarray(offset, offset + length - 2);
  45196. offset += array.length;
  45197. return array;
  45198. }
  45199. function prepareComponents(frame) {
  45200. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  45201. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  45202. for (var i = 0; i < frame.components.length; i++) {
  45203. component = frame.components[i];
  45204. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  45205. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  45206. var blocksPerLineForMcu = mcusPerLine * component.h;
  45207. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  45208. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  45209. component.blockData = new Int16Array(blocksBufferSize);
  45210. component.blocksPerLine = blocksPerLine;
  45211. component.blocksPerColumn = blocksPerColumn;
  45212. }
  45213. frame.mcusPerLine = mcusPerLine;
  45214. frame.mcusPerColumn = mcusPerColumn;
  45215. }
  45216. var offset = 0;
  45217. var jfif = null;
  45218. var adobe = null;
  45219. var frame, resetInterval;
  45220. var quantizationTables = [];
  45221. var huffmanTablesAC = [], huffmanTablesDC = [];
  45222. var fileMarker = readUint16();
  45223. if (fileMarker !== 0xFFD8) {
  45224. error('JPEG error: SOI not found');
  45225. }
  45226. fileMarker = readUint16();
  45227. while (fileMarker !== 0xFFD9) {
  45228. var i, j, l;
  45229. switch (fileMarker) {
  45230. case 0xFFE0:
  45231. case 0xFFE1:
  45232. case 0xFFE2:
  45233. case 0xFFE3:
  45234. case 0xFFE4:
  45235. case 0xFFE5:
  45236. case 0xFFE6:
  45237. case 0xFFE7:
  45238. case 0xFFE8:
  45239. case 0xFFE9:
  45240. case 0xFFEA:
  45241. case 0xFFEB:
  45242. case 0xFFEC:
  45243. case 0xFFED:
  45244. case 0xFFEE:
  45245. case 0xFFEF:
  45246. case 0xFFFE:
  45247. var appData = readDataBlock();
  45248. if (fileMarker === 0xFFE0) {
  45249. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  45250. jfif = {
  45251. version: {
  45252. major: appData[5],
  45253. minor: appData[6]
  45254. },
  45255. densityUnits: appData[7],
  45256. xDensity: appData[8] << 8 | appData[9],
  45257. yDensity: appData[10] << 8 | appData[11],
  45258. thumbWidth: appData[12],
  45259. thumbHeight: appData[13],
  45260. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  45261. };
  45262. }
  45263. }
  45264. if (fileMarker === 0xFFEE) {
  45265. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  45266. adobe = {
  45267. version: appData[5] << 8 | appData[6],
  45268. flags0: appData[7] << 8 | appData[8],
  45269. flags1: appData[9] << 8 | appData[10],
  45270. transformCode: appData[11]
  45271. };
  45272. }
  45273. }
  45274. break;
  45275. case 0xFFDB:
  45276. var quantizationTablesLength = readUint16();
  45277. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  45278. var z;
  45279. while (offset < quantizationTablesEnd) {
  45280. var quantizationTableSpec = data[offset++];
  45281. var tableData = new Uint16Array(64);
  45282. if (quantizationTableSpec >> 4 === 0) {
  45283. for (j = 0; j < 64; j++) {
  45284. z = dctZigZag[j];
  45285. tableData[z] = data[offset++];
  45286. }
  45287. } else if (quantizationTableSpec >> 4 === 1) {
  45288. for (j = 0; j < 64; j++) {
  45289. z = dctZigZag[j];
  45290. tableData[z] = readUint16();
  45291. }
  45292. } else {
  45293. error('JPEG error: DQT - invalid table spec');
  45294. }
  45295. quantizationTables[quantizationTableSpec & 15] = tableData;
  45296. }
  45297. break;
  45298. case 0xFFC0:
  45299. case 0xFFC1:
  45300. case 0xFFC2:
  45301. if (frame) {
  45302. error('JPEG error: Only single frame JPEGs supported');
  45303. }
  45304. readUint16();
  45305. frame = {};
  45306. frame.extended = fileMarker === 0xFFC1;
  45307. frame.progressive = fileMarker === 0xFFC2;
  45308. frame.precision = data[offset++];
  45309. frame.scanLines = readUint16();
  45310. frame.samplesPerLine = readUint16();
  45311. frame.components = [];
  45312. frame.componentIds = {};
  45313. var componentsCount = data[offset++], componentId;
  45314. var maxH = 0, maxV = 0;
  45315. for (i = 0; i < componentsCount; i++) {
  45316. componentId = data[offset];
  45317. var h = data[offset + 1] >> 4;
  45318. var v = data[offset + 1] & 15;
  45319. if (maxH < h) {
  45320. maxH = h;
  45321. }
  45322. if (maxV < v) {
  45323. maxV = v;
  45324. }
  45325. var qId = data[offset + 2];
  45326. l = frame.components.push({
  45327. h: h,
  45328. v: v,
  45329. quantizationId: qId,
  45330. quantizationTable: null
  45331. });
  45332. frame.componentIds[componentId] = l - 1;
  45333. offset += 3;
  45334. }
  45335. frame.maxH = maxH;
  45336. frame.maxV = maxV;
  45337. prepareComponents(frame);
  45338. break;
  45339. case 0xFFC4:
  45340. var huffmanLength = readUint16();
  45341. for (i = 2; i < huffmanLength;) {
  45342. var huffmanTableSpec = data[offset++];
  45343. var codeLengths = new Uint8Array(16);
  45344. var codeLengthSum = 0;
  45345. for (j = 0; j < 16; j++, offset++) {
  45346. codeLengthSum += codeLengths[j] = data[offset];
  45347. }
  45348. var huffmanValues = new Uint8Array(codeLengthSum);
  45349. for (j = 0; j < codeLengthSum; j++, offset++) {
  45350. huffmanValues[j] = data[offset];
  45351. }
  45352. i += 17 + codeLengthSum;
  45353. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  45354. }
  45355. break;
  45356. case 0xFFDD:
  45357. readUint16();
  45358. resetInterval = readUint16();
  45359. break;
  45360. case 0xFFDA:
  45361. readUint16();
  45362. var selectorsCount = data[offset++];
  45363. var components = [], component;
  45364. for (i = 0; i < selectorsCount; i++) {
  45365. var componentIndex = frame.componentIds[data[offset++]];
  45366. component = frame.components[componentIndex];
  45367. var tableSpec = data[offset++];
  45368. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  45369. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  45370. components.push(component);
  45371. }
  45372. var spectralStart = data[offset++];
  45373. var spectralEnd = data[offset++];
  45374. var successiveApproximation = data[offset++];
  45375. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  45376. offset += processed;
  45377. break;
  45378. case 0xFFFF:
  45379. if (data[offset] !== 0xFF) {
  45380. offset--;
  45381. }
  45382. break;
  45383. default:
  45384. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  45385. offset -= 3;
  45386. break;
  45387. }
  45388. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  45389. }
  45390. fileMarker = readUint16();
  45391. }
  45392. this.width = frame.samplesPerLine;
  45393. this.height = frame.scanLines;
  45394. this.jfif = jfif;
  45395. this.adobe = adobe;
  45396. this.components = [];
  45397. for (i = 0; i < frame.components.length; i++) {
  45398. component = frame.components[i];
  45399. var quantizationTable = quantizationTables[component.quantizationId];
  45400. if (quantizationTable) {
  45401. component.quantizationTable = quantizationTable;
  45402. }
  45403. this.components.push({
  45404. output: buildComponentData(frame, component),
  45405. scaleX: component.h / frame.maxH,
  45406. scaleY: component.v / frame.maxV,
  45407. blocksPerLine: component.blocksPerLine,
  45408. blocksPerColumn: component.blocksPerColumn
  45409. });
  45410. }
  45411. this.numComponents = this.components.length;
  45412. },
  45413. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  45414. var scaleX = this.width / width, scaleY = this.height / height;
  45415. var component, componentScaleX, componentScaleY, blocksPerScanline;
  45416. var x, y, i, j, k;
  45417. var index;
  45418. var offset = 0;
  45419. var output;
  45420. var numComponents = this.components.length;
  45421. var dataLength = width * height * numComponents;
  45422. var data = new Uint8Array(dataLength);
  45423. var xScaleBlockOffset = new Uint32Array(width);
  45424. var mask3LSB = 0xfffffff8;
  45425. for (i = 0; i < numComponents; i++) {
  45426. component = this.components[i];
  45427. componentScaleX = component.scaleX * scaleX;
  45428. componentScaleY = component.scaleY * scaleY;
  45429. offset = i;
  45430. output = component.output;
  45431. blocksPerScanline = component.blocksPerLine + 1 << 3;
  45432. for (x = 0; x < width; x++) {
  45433. j = 0 | x * componentScaleX;
  45434. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  45435. }
  45436. for (y = 0; y < height; y++) {
  45437. j = 0 | y * componentScaleY;
  45438. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  45439. for (x = 0; x < width; x++) {
  45440. data[offset] = output[index + xScaleBlockOffset[x]];
  45441. offset += numComponents;
  45442. }
  45443. }
  45444. }
  45445. var transform = this.decodeTransform;
  45446. if (transform) {
  45447. for (i = 0; i < dataLength;) {
  45448. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  45449. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  45450. }
  45451. }
  45452. }
  45453. return data;
  45454. },
  45455. _isColorConversionNeeded: function isColorConversionNeeded() {
  45456. if (this.adobe && this.adobe.transformCode) {
  45457. return true;
  45458. } else if (this.numComponents === 3) {
  45459. if (!this.adobe && this.colorTransform === 0) {
  45460. return false;
  45461. }
  45462. return true;
  45463. }
  45464. if (!this.adobe && this.colorTransform === 1) {
  45465. return true;
  45466. }
  45467. return false;
  45468. },
  45469. _convertYccToRgb: function convertYccToRgb(data) {
  45470. var Y, Cb, Cr;
  45471. for (var i = 0, length = data.length; i < length; i += 3) {
  45472. Y = data[i];
  45473. Cb = data[i + 1];
  45474. Cr = data[i + 2];
  45475. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  45476. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  45477. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  45478. }
  45479. return data;
  45480. },
  45481. _convertYcckToRgb: function convertYcckToRgb(data) {
  45482. var Y, Cb, Cr, k;
  45483. var offset = 0;
  45484. for (var i = 0, length = data.length; i < length; i += 4) {
  45485. Y = data[i];
  45486. Cb = data[i + 1];
  45487. Cr = data[i + 2];
  45488. k = data[i + 3];
  45489. 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);
  45490. 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);
  45491. 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);
  45492. data[offset++] = clamp0to255(r);
  45493. data[offset++] = clamp0to255(g);
  45494. data[offset++] = clamp0to255(b);
  45495. }
  45496. return data;
  45497. },
  45498. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  45499. var Y, Cb, Cr;
  45500. for (var i = 0, length = data.length; i < length; i += 4) {
  45501. Y = data[i];
  45502. Cb = data[i + 1];
  45503. Cr = data[i + 2];
  45504. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  45505. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  45506. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  45507. }
  45508. return data;
  45509. },
  45510. _convertCmykToRgb: function convertCmykToRgb(data) {
  45511. var c, m, y, k;
  45512. var offset = 0;
  45513. var min = -255 * 255 * 255;
  45514. var scale = 1 / 255 / 255;
  45515. for (var i = 0, length = data.length; i < length; i += 4) {
  45516. c = data[i];
  45517. m = data[i + 1];
  45518. y = data[i + 2];
  45519. k = data[i + 3];
  45520. 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);
  45521. 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);
  45522. 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);
  45523. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  45524. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  45525. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  45526. }
  45527. return data;
  45528. },
  45529. getData: function getData(width, height, forceRGBoutput) {
  45530. if (this.numComponents > 4) {
  45531. error('JPEG error: Unsupported color mode');
  45532. }
  45533. var data = this._getLinearizedBlockData(width, height);
  45534. if (this.numComponents === 1 && forceRGBoutput) {
  45535. var dataLength = data.length;
  45536. var rgbData = new Uint8Array(dataLength * 3);
  45537. var offset = 0;
  45538. for (var i = 0; i < dataLength; i++) {
  45539. var grayColor = data[i];
  45540. rgbData[offset++] = grayColor;
  45541. rgbData[offset++] = grayColor;
  45542. rgbData[offset++] = grayColor;
  45543. }
  45544. return rgbData;
  45545. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  45546. return this._convertYccToRgb(data);
  45547. } else if (this.numComponents === 4) {
  45548. if (this._isColorConversionNeeded()) {
  45549. if (forceRGBoutput) {
  45550. return this._convertYcckToRgb(data);
  45551. }
  45552. return this._convertYcckToCmyk(data);
  45553. } else if (forceRGBoutput) {
  45554. return this._convertCmykToRgb(data);
  45555. }
  45556. }
  45557. return data;
  45558. }
  45559. };
  45560. return JpegImage;
  45561. }();
  45562. exports.JpegImage = JpegImage;
  45563. /***/ }),
  45564. /* 30 */
  45565. /***/ (function(module, exports, __w_pdfjs_require__) {
  45566. "use strict";
  45567. var sharedUtil = __w_pdfjs_require__(0);
  45568. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  45569. var getMetrics = getLookupTableFactory(function (t) {
  45570. t['Courier'] = 600;
  45571. t['Courier-Bold'] = 600;
  45572. t['Courier-BoldOblique'] = 600;
  45573. t['Courier-Oblique'] = 600;
  45574. t['Helvetica'] = getLookupTableFactory(function (t) {
  45575. t['space'] = 278;
  45576. t['exclam'] = 278;
  45577. t['quotedbl'] = 355;
  45578. t['numbersign'] = 556;
  45579. t['dollar'] = 556;
  45580. t['percent'] = 889;
  45581. t['ampersand'] = 667;
  45582. t['quoteright'] = 222;
  45583. t['parenleft'] = 333;
  45584. t['parenright'] = 333;
  45585. t['asterisk'] = 389;
  45586. t['plus'] = 584;
  45587. t['comma'] = 278;
  45588. t['hyphen'] = 333;
  45589. t['period'] = 278;
  45590. t['slash'] = 278;
  45591. t['zero'] = 556;
  45592. t['one'] = 556;
  45593. t['two'] = 556;
  45594. t['three'] = 556;
  45595. t['four'] = 556;
  45596. t['five'] = 556;
  45597. t['six'] = 556;
  45598. t['seven'] = 556;
  45599. t['eight'] = 556;
  45600. t['nine'] = 556;
  45601. t['colon'] = 278;
  45602. t['semicolon'] = 278;
  45603. t['less'] = 584;
  45604. t['equal'] = 584;
  45605. t['greater'] = 584;
  45606. t['question'] = 556;
  45607. t['at'] = 1015;
  45608. t['A'] = 667;
  45609. t['B'] = 667;
  45610. t['C'] = 722;
  45611. t['D'] = 722;
  45612. t['E'] = 667;
  45613. t['F'] = 611;
  45614. t['G'] = 778;
  45615. t['H'] = 722;
  45616. t['I'] = 278;
  45617. t['J'] = 500;
  45618. t['K'] = 667;
  45619. t['L'] = 556;
  45620. t['M'] = 833;
  45621. t['N'] = 722;
  45622. t['O'] = 778;
  45623. t['P'] = 667;
  45624. t['Q'] = 778;
  45625. t['R'] = 722;
  45626. t['S'] = 667;
  45627. t['T'] = 611;
  45628. t['U'] = 722;
  45629. t['V'] = 667;
  45630. t['W'] = 944;
  45631. t['X'] = 667;
  45632. t['Y'] = 667;
  45633. t['Z'] = 611;
  45634. t['bracketleft'] = 278;
  45635. t['backslash'] = 278;
  45636. t['bracketright'] = 278;
  45637. t['asciicircum'] = 469;
  45638. t['underscore'] = 556;
  45639. t['quoteleft'] = 222;
  45640. t['a'] = 556;
  45641. t['b'] = 556;
  45642. t['c'] = 500;
  45643. t['d'] = 556;
  45644. t['e'] = 556;
  45645. t['f'] = 278;
  45646. t['g'] = 556;
  45647. t['h'] = 556;
  45648. t['i'] = 222;
  45649. t['j'] = 222;
  45650. t['k'] = 500;
  45651. t['l'] = 222;
  45652. t['m'] = 833;
  45653. t['n'] = 556;
  45654. t['o'] = 556;
  45655. t['p'] = 556;
  45656. t['q'] = 556;
  45657. t['r'] = 333;
  45658. t['s'] = 500;
  45659. t['t'] = 278;
  45660. t['u'] = 556;
  45661. t['v'] = 500;
  45662. t['w'] = 722;
  45663. t['x'] = 500;
  45664. t['y'] = 500;
  45665. t['z'] = 500;
  45666. t['braceleft'] = 334;
  45667. t['bar'] = 260;
  45668. t['braceright'] = 334;
  45669. t['asciitilde'] = 584;
  45670. t['exclamdown'] = 333;
  45671. t['cent'] = 556;
  45672. t['sterling'] = 556;
  45673. t['fraction'] = 167;
  45674. t['yen'] = 556;
  45675. t['florin'] = 556;
  45676. t['section'] = 556;
  45677. t['currency'] = 556;
  45678. t['quotesingle'] = 191;
  45679. t['quotedblleft'] = 333;
  45680. t['guillemotleft'] = 556;
  45681. t['guilsinglleft'] = 333;
  45682. t['guilsinglright'] = 333;
  45683. t['fi'] = 500;
  45684. t['fl'] = 500;
  45685. t['endash'] = 556;
  45686. t['dagger'] = 556;
  45687. t['daggerdbl'] = 556;
  45688. t['periodcentered'] = 278;
  45689. t['paragraph'] = 537;
  45690. t['bullet'] = 350;
  45691. t['quotesinglbase'] = 222;
  45692. t['quotedblbase'] = 333;
  45693. t['quotedblright'] = 333;
  45694. t['guillemotright'] = 556;
  45695. t['ellipsis'] = 1000;
  45696. t['perthousand'] = 1000;
  45697. t['questiondown'] = 611;
  45698. t['grave'] = 333;
  45699. t['acute'] = 333;
  45700. t['circumflex'] = 333;
  45701. t['tilde'] = 333;
  45702. t['macron'] = 333;
  45703. t['breve'] = 333;
  45704. t['dotaccent'] = 333;
  45705. t['dieresis'] = 333;
  45706. t['ring'] = 333;
  45707. t['cedilla'] = 333;
  45708. t['hungarumlaut'] = 333;
  45709. t['ogonek'] = 333;
  45710. t['caron'] = 333;
  45711. t['emdash'] = 1000;
  45712. t['AE'] = 1000;
  45713. t['ordfeminine'] = 370;
  45714. t['Lslash'] = 556;
  45715. t['Oslash'] = 778;
  45716. t['OE'] = 1000;
  45717. t['ordmasculine'] = 365;
  45718. t['ae'] = 889;
  45719. t['dotlessi'] = 278;
  45720. t['lslash'] = 222;
  45721. t['oslash'] = 611;
  45722. t['oe'] = 944;
  45723. t['germandbls'] = 611;
  45724. t['Idieresis'] = 278;
  45725. t['eacute'] = 556;
  45726. t['abreve'] = 556;
  45727. t['uhungarumlaut'] = 556;
  45728. t['ecaron'] = 556;
  45729. t['Ydieresis'] = 667;
  45730. t['divide'] = 584;
  45731. t['Yacute'] = 667;
  45732. t['Acircumflex'] = 667;
  45733. t['aacute'] = 556;
  45734. t['Ucircumflex'] = 722;
  45735. t['yacute'] = 500;
  45736. t['scommaaccent'] = 500;
  45737. t['ecircumflex'] = 556;
  45738. t['Uring'] = 722;
  45739. t['Udieresis'] = 722;
  45740. t['aogonek'] = 556;
  45741. t['Uacute'] = 722;
  45742. t['uogonek'] = 556;
  45743. t['Edieresis'] = 667;
  45744. t['Dcroat'] = 722;
  45745. t['commaaccent'] = 250;
  45746. t['copyright'] = 737;
  45747. t['Emacron'] = 667;
  45748. t['ccaron'] = 500;
  45749. t['aring'] = 556;
  45750. t['Ncommaaccent'] = 722;
  45751. t['lacute'] = 222;
  45752. t['agrave'] = 556;
  45753. t['Tcommaaccent'] = 611;
  45754. t['Cacute'] = 722;
  45755. t['atilde'] = 556;
  45756. t['Edotaccent'] = 667;
  45757. t['scaron'] = 500;
  45758. t['scedilla'] = 500;
  45759. t['iacute'] = 278;
  45760. t['lozenge'] = 471;
  45761. t['Rcaron'] = 722;
  45762. t['Gcommaaccent'] = 778;
  45763. t['ucircumflex'] = 556;
  45764. t['acircumflex'] = 556;
  45765. t['Amacron'] = 667;
  45766. t['rcaron'] = 333;
  45767. t['ccedilla'] = 500;
  45768. t['Zdotaccent'] = 611;
  45769. t['Thorn'] = 667;
  45770. t['Omacron'] = 778;
  45771. t['Racute'] = 722;
  45772. t['Sacute'] = 667;
  45773. t['dcaron'] = 643;
  45774. t['Umacron'] = 722;
  45775. t['uring'] = 556;
  45776. t['threesuperior'] = 333;
  45777. t['Ograve'] = 778;
  45778. t['Agrave'] = 667;
  45779. t['Abreve'] = 667;
  45780. t['multiply'] = 584;
  45781. t['uacute'] = 556;
  45782. t['Tcaron'] = 611;
  45783. t['partialdiff'] = 476;
  45784. t['ydieresis'] = 500;
  45785. t['Nacute'] = 722;
  45786. t['icircumflex'] = 278;
  45787. t['Ecircumflex'] = 667;
  45788. t['adieresis'] = 556;
  45789. t['edieresis'] = 556;
  45790. t['cacute'] = 500;
  45791. t['nacute'] = 556;
  45792. t['umacron'] = 556;
  45793. t['Ncaron'] = 722;
  45794. t['Iacute'] = 278;
  45795. t['plusminus'] = 584;
  45796. t['brokenbar'] = 260;
  45797. t['registered'] = 737;
  45798. t['Gbreve'] = 778;
  45799. t['Idotaccent'] = 278;
  45800. t['summation'] = 600;
  45801. t['Egrave'] = 667;
  45802. t['racute'] = 333;
  45803. t['omacron'] = 556;
  45804. t['Zacute'] = 611;
  45805. t['Zcaron'] = 611;
  45806. t['greaterequal'] = 549;
  45807. t['Eth'] = 722;
  45808. t['Ccedilla'] = 722;
  45809. t['lcommaaccent'] = 222;
  45810. t['tcaron'] = 317;
  45811. t['eogonek'] = 556;
  45812. t['Uogonek'] = 722;
  45813. t['Aacute'] = 667;
  45814. t['Adieresis'] = 667;
  45815. t['egrave'] = 556;
  45816. t['zacute'] = 500;
  45817. t['iogonek'] = 222;
  45818. t['Oacute'] = 778;
  45819. t['oacute'] = 556;
  45820. t['amacron'] = 556;
  45821. t['sacute'] = 500;
  45822. t['idieresis'] = 278;
  45823. t['Ocircumflex'] = 778;
  45824. t['Ugrave'] = 722;
  45825. t['Delta'] = 612;
  45826. t['thorn'] = 556;
  45827. t['twosuperior'] = 333;
  45828. t['Odieresis'] = 778;
  45829. t['mu'] = 556;
  45830. t['igrave'] = 278;
  45831. t['ohungarumlaut'] = 556;
  45832. t['Eogonek'] = 667;
  45833. t['dcroat'] = 556;
  45834. t['threequarters'] = 834;
  45835. t['Scedilla'] = 667;
  45836. t['lcaron'] = 299;
  45837. t['Kcommaaccent'] = 667;
  45838. t['Lacute'] = 556;
  45839. t['trademark'] = 1000;
  45840. t['edotaccent'] = 556;
  45841. t['Igrave'] = 278;
  45842. t['Imacron'] = 278;
  45843. t['Lcaron'] = 556;
  45844. t['onehalf'] = 834;
  45845. t['lessequal'] = 549;
  45846. t['ocircumflex'] = 556;
  45847. t['ntilde'] = 556;
  45848. t['Uhungarumlaut'] = 722;
  45849. t['Eacute'] = 667;
  45850. t['emacron'] = 556;
  45851. t['gbreve'] = 556;
  45852. t['onequarter'] = 834;
  45853. t['Scaron'] = 667;
  45854. t['Scommaaccent'] = 667;
  45855. t['Ohungarumlaut'] = 778;
  45856. t['degree'] = 400;
  45857. t['ograve'] = 556;
  45858. t['Ccaron'] = 722;
  45859. t['ugrave'] = 556;
  45860. t['radical'] = 453;
  45861. t['Dcaron'] = 722;
  45862. t['rcommaaccent'] = 333;
  45863. t['Ntilde'] = 722;
  45864. t['otilde'] = 556;
  45865. t['Rcommaaccent'] = 722;
  45866. t['Lcommaaccent'] = 556;
  45867. t['Atilde'] = 667;
  45868. t['Aogonek'] = 667;
  45869. t['Aring'] = 667;
  45870. t['Otilde'] = 778;
  45871. t['zdotaccent'] = 500;
  45872. t['Ecaron'] = 667;
  45873. t['Iogonek'] = 278;
  45874. t['kcommaaccent'] = 500;
  45875. t['minus'] = 584;
  45876. t['Icircumflex'] = 278;
  45877. t['ncaron'] = 556;
  45878. t['tcommaaccent'] = 278;
  45879. t['logicalnot'] = 584;
  45880. t['odieresis'] = 556;
  45881. t['udieresis'] = 556;
  45882. t['notequal'] = 549;
  45883. t['gcommaaccent'] = 556;
  45884. t['eth'] = 556;
  45885. t['zcaron'] = 500;
  45886. t['ncommaaccent'] = 556;
  45887. t['onesuperior'] = 333;
  45888. t['imacron'] = 278;
  45889. t['Euro'] = 556;
  45890. });
  45891. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45892. t['space'] = 278;
  45893. t['exclam'] = 333;
  45894. t['quotedbl'] = 474;
  45895. t['numbersign'] = 556;
  45896. t['dollar'] = 556;
  45897. t['percent'] = 889;
  45898. t['ampersand'] = 722;
  45899. t['quoteright'] = 278;
  45900. t['parenleft'] = 333;
  45901. t['parenright'] = 333;
  45902. t['asterisk'] = 389;
  45903. t['plus'] = 584;
  45904. t['comma'] = 278;
  45905. t['hyphen'] = 333;
  45906. t['period'] = 278;
  45907. t['slash'] = 278;
  45908. t['zero'] = 556;
  45909. t['one'] = 556;
  45910. t['two'] = 556;
  45911. t['three'] = 556;
  45912. t['four'] = 556;
  45913. t['five'] = 556;
  45914. t['six'] = 556;
  45915. t['seven'] = 556;
  45916. t['eight'] = 556;
  45917. t['nine'] = 556;
  45918. t['colon'] = 333;
  45919. t['semicolon'] = 333;
  45920. t['less'] = 584;
  45921. t['equal'] = 584;
  45922. t['greater'] = 584;
  45923. t['question'] = 611;
  45924. t['at'] = 975;
  45925. t['A'] = 722;
  45926. t['B'] = 722;
  45927. t['C'] = 722;
  45928. t['D'] = 722;
  45929. t['E'] = 667;
  45930. t['F'] = 611;
  45931. t['G'] = 778;
  45932. t['H'] = 722;
  45933. t['I'] = 278;
  45934. t['J'] = 556;
  45935. t['K'] = 722;
  45936. t['L'] = 611;
  45937. t['M'] = 833;
  45938. t['N'] = 722;
  45939. t['O'] = 778;
  45940. t['P'] = 667;
  45941. t['Q'] = 778;
  45942. t['R'] = 722;
  45943. t['S'] = 667;
  45944. t['T'] = 611;
  45945. t['U'] = 722;
  45946. t['V'] = 667;
  45947. t['W'] = 944;
  45948. t['X'] = 667;
  45949. t['Y'] = 667;
  45950. t['Z'] = 611;
  45951. t['bracketleft'] = 333;
  45952. t['backslash'] = 278;
  45953. t['bracketright'] = 333;
  45954. t['asciicircum'] = 584;
  45955. t['underscore'] = 556;
  45956. t['quoteleft'] = 278;
  45957. t['a'] = 556;
  45958. t['b'] = 611;
  45959. t['c'] = 556;
  45960. t['d'] = 611;
  45961. t['e'] = 556;
  45962. t['f'] = 333;
  45963. t['g'] = 611;
  45964. t['h'] = 611;
  45965. t['i'] = 278;
  45966. t['j'] = 278;
  45967. t['k'] = 556;
  45968. t['l'] = 278;
  45969. t['m'] = 889;
  45970. t['n'] = 611;
  45971. t['o'] = 611;
  45972. t['p'] = 611;
  45973. t['q'] = 611;
  45974. t['r'] = 389;
  45975. t['s'] = 556;
  45976. t['t'] = 333;
  45977. t['u'] = 611;
  45978. t['v'] = 556;
  45979. t['w'] = 778;
  45980. t['x'] = 556;
  45981. t['y'] = 556;
  45982. t['z'] = 500;
  45983. t['braceleft'] = 389;
  45984. t['bar'] = 280;
  45985. t['braceright'] = 389;
  45986. t['asciitilde'] = 584;
  45987. t['exclamdown'] = 333;
  45988. t['cent'] = 556;
  45989. t['sterling'] = 556;
  45990. t['fraction'] = 167;
  45991. t['yen'] = 556;
  45992. t['florin'] = 556;
  45993. t['section'] = 556;
  45994. t['currency'] = 556;
  45995. t['quotesingle'] = 238;
  45996. t['quotedblleft'] = 500;
  45997. t['guillemotleft'] = 556;
  45998. t['guilsinglleft'] = 333;
  45999. t['guilsinglright'] = 333;
  46000. t['fi'] = 611;
  46001. t['fl'] = 611;
  46002. t['endash'] = 556;
  46003. t['dagger'] = 556;
  46004. t['daggerdbl'] = 556;
  46005. t['periodcentered'] = 278;
  46006. t['paragraph'] = 556;
  46007. t['bullet'] = 350;
  46008. t['quotesinglbase'] = 278;
  46009. t['quotedblbase'] = 500;
  46010. t['quotedblright'] = 500;
  46011. t['guillemotright'] = 556;
  46012. t['ellipsis'] = 1000;
  46013. t['perthousand'] = 1000;
  46014. t['questiondown'] = 611;
  46015. t['grave'] = 333;
  46016. t['acute'] = 333;
  46017. t['circumflex'] = 333;
  46018. t['tilde'] = 333;
  46019. t['macron'] = 333;
  46020. t['breve'] = 333;
  46021. t['dotaccent'] = 333;
  46022. t['dieresis'] = 333;
  46023. t['ring'] = 333;
  46024. t['cedilla'] = 333;
  46025. t['hungarumlaut'] = 333;
  46026. t['ogonek'] = 333;
  46027. t['caron'] = 333;
  46028. t['emdash'] = 1000;
  46029. t['AE'] = 1000;
  46030. t['ordfeminine'] = 370;
  46031. t['Lslash'] = 611;
  46032. t['Oslash'] = 778;
  46033. t['OE'] = 1000;
  46034. t['ordmasculine'] = 365;
  46035. t['ae'] = 889;
  46036. t['dotlessi'] = 278;
  46037. t['lslash'] = 278;
  46038. t['oslash'] = 611;
  46039. t['oe'] = 944;
  46040. t['germandbls'] = 611;
  46041. t['Idieresis'] = 278;
  46042. t['eacute'] = 556;
  46043. t['abreve'] = 556;
  46044. t['uhungarumlaut'] = 611;
  46045. t['ecaron'] = 556;
  46046. t['Ydieresis'] = 667;
  46047. t['divide'] = 584;
  46048. t['Yacute'] = 667;
  46049. t['Acircumflex'] = 722;
  46050. t['aacute'] = 556;
  46051. t['Ucircumflex'] = 722;
  46052. t['yacute'] = 556;
  46053. t['scommaaccent'] = 556;
  46054. t['ecircumflex'] = 556;
  46055. t['Uring'] = 722;
  46056. t['Udieresis'] = 722;
  46057. t['aogonek'] = 556;
  46058. t['Uacute'] = 722;
  46059. t['uogonek'] = 611;
  46060. t['Edieresis'] = 667;
  46061. t['Dcroat'] = 722;
  46062. t['commaaccent'] = 250;
  46063. t['copyright'] = 737;
  46064. t['Emacron'] = 667;
  46065. t['ccaron'] = 556;
  46066. t['aring'] = 556;
  46067. t['Ncommaaccent'] = 722;
  46068. t['lacute'] = 278;
  46069. t['agrave'] = 556;
  46070. t['Tcommaaccent'] = 611;
  46071. t['Cacute'] = 722;
  46072. t['atilde'] = 556;
  46073. t['Edotaccent'] = 667;
  46074. t['scaron'] = 556;
  46075. t['scedilla'] = 556;
  46076. t['iacute'] = 278;
  46077. t['lozenge'] = 494;
  46078. t['Rcaron'] = 722;
  46079. t['Gcommaaccent'] = 778;
  46080. t['ucircumflex'] = 611;
  46081. t['acircumflex'] = 556;
  46082. t['Amacron'] = 722;
  46083. t['rcaron'] = 389;
  46084. t['ccedilla'] = 556;
  46085. t['Zdotaccent'] = 611;
  46086. t['Thorn'] = 667;
  46087. t['Omacron'] = 778;
  46088. t['Racute'] = 722;
  46089. t['Sacute'] = 667;
  46090. t['dcaron'] = 743;
  46091. t['Umacron'] = 722;
  46092. t['uring'] = 611;
  46093. t['threesuperior'] = 333;
  46094. t['Ograve'] = 778;
  46095. t['Agrave'] = 722;
  46096. t['Abreve'] = 722;
  46097. t['multiply'] = 584;
  46098. t['uacute'] = 611;
  46099. t['Tcaron'] = 611;
  46100. t['partialdiff'] = 494;
  46101. t['ydieresis'] = 556;
  46102. t['Nacute'] = 722;
  46103. t['icircumflex'] = 278;
  46104. t['Ecircumflex'] = 667;
  46105. t['adieresis'] = 556;
  46106. t['edieresis'] = 556;
  46107. t['cacute'] = 556;
  46108. t['nacute'] = 611;
  46109. t['umacron'] = 611;
  46110. t['Ncaron'] = 722;
  46111. t['Iacute'] = 278;
  46112. t['plusminus'] = 584;
  46113. t['brokenbar'] = 280;
  46114. t['registered'] = 737;
  46115. t['Gbreve'] = 778;
  46116. t['Idotaccent'] = 278;
  46117. t['summation'] = 600;
  46118. t['Egrave'] = 667;
  46119. t['racute'] = 389;
  46120. t['omacron'] = 611;
  46121. t['Zacute'] = 611;
  46122. t['Zcaron'] = 611;
  46123. t['greaterequal'] = 549;
  46124. t['Eth'] = 722;
  46125. t['Ccedilla'] = 722;
  46126. t['lcommaaccent'] = 278;
  46127. t['tcaron'] = 389;
  46128. t['eogonek'] = 556;
  46129. t['Uogonek'] = 722;
  46130. t['Aacute'] = 722;
  46131. t['Adieresis'] = 722;
  46132. t['egrave'] = 556;
  46133. t['zacute'] = 500;
  46134. t['iogonek'] = 278;
  46135. t['Oacute'] = 778;
  46136. t['oacute'] = 611;
  46137. t['amacron'] = 556;
  46138. t['sacute'] = 556;
  46139. t['idieresis'] = 278;
  46140. t['Ocircumflex'] = 778;
  46141. t['Ugrave'] = 722;
  46142. t['Delta'] = 612;
  46143. t['thorn'] = 611;
  46144. t['twosuperior'] = 333;
  46145. t['Odieresis'] = 778;
  46146. t['mu'] = 611;
  46147. t['igrave'] = 278;
  46148. t['ohungarumlaut'] = 611;
  46149. t['Eogonek'] = 667;
  46150. t['dcroat'] = 611;
  46151. t['threequarters'] = 834;
  46152. t['Scedilla'] = 667;
  46153. t['lcaron'] = 400;
  46154. t['Kcommaaccent'] = 722;
  46155. t['Lacute'] = 611;
  46156. t['trademark'] = 1000;
  46157. t['edotaccent'] = 556;
  46158. t['Igrave'] = 278;
  46159. t['Imacron'] = 278;
  46160. t['Lcaron'] = 611;
  46161. t['onehalf'] = 834;
  46162. t['lessequal'] = 549;
  46163. t['ocircumflex'] = 611;
  46164. t['ntilde'] = 611;
  46165. t['Uhungarumlaut'] = 722;
  46166. t['Eacute'] = 667;
  46167. t['emacron'] = 556;
  46168. t['gbreve'] = 611;
  46169. t['onequarter'] = 834;
  46170. t['Scaron'] = 667;
  46171. t['Scommaaccent'] = 667;
  46172. t['Ohungarumlaut'] = 778;
  46173. t['degree'] = 400;
  46174. t['ograve'] = 611;
  46175. t['Ccaron'] = 722;
  46176. t['ugrave'] = 611;
  46177. t['radical'] = 549;
  46178. t['Dcaron'] = 722;
  46179. t['rcommaaccent'] = 389;
  46180. t['Ntilde'] = 722;
  46181. t['otilde'] = 611;
  46182. t['Rcommaaccent'] = 722;
  46183. t['Lcommaaccent'] = 611;
  46184. t['Atilde'] = 722;
  46185. t['Aogonek'] = 722;
  46186. t['Aring'] = 722;
  46187. t['Otilde'] = 778;
  46188. t['zdotaccent'] = 500;
  46189. t['Ecaron'] = 667;
  46190. t['Iogonek'] = 278;
  46191. t['kcommaaccent'] = 556;
  46192. t['minus'] = 584;
  46193. t['Icircumflex'] = 278;
  46194. t['ncaron'] = 611;
  46195. t['tcommaaccent'] = 333;
  46196. t['logicalnot'] = 584;
  46197. t['odieresis'] = 611;
  46198. t['udieresis'] = 611;
  46199. t['notequal'] = 549;
  46200. t['gcommaaccent'] = 611;
  46201. t['eth'] = 611;
  46202. t['zcaron'] = 500;
  46203. t['ncommaaccent'] = 611;
  46204. t['onesuperior'] = 333;
  46205. t['imacron'] = 278;
  46206. t['Euro'] = 556;
  46207. });
  46208. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  46209. t['space'] = 278;
  46210. t['exclam'] = 333;
  46211. t['quotedbl'] = 474;
  46212. t['numbersign'] = 556;
  46213. t['dollar'] = 556;
  46214. t['percent'] = 889;
  46215. t['ampersand'] = 722;
  46216. t['quoteright'] = 278;
  46217. t['parenleft'] = 333;
  46218. t['parenright'] = 333;
  46219. t['asterisk'] = 389;
  46220. t['plus'] = 584;
  46221. t['comma'] = 278;
  46222. t['hyphen'] = 333;
  46223. t['period'] = 278;
  46224. t['slash'] = 278;
  46225. t['zero'] = 556;
  46226. t['one'] = 556;
  46227. t['two'] = 556;
  46228. t['three'] = 556;
  46229. t['four'] = 556;
  46230. t['five'] = 556;
  46231. t['six'] = 556;
  46232. t['seven'] = 556;
  46233. t['eight'] = 556;
  46234. t['nine'] = 556;
  46235. t['colon'] = 333;
  46236. t['semicolon'] = 333;
  46237. t['less'] = 584;
  46238. t['equal'] = 584;
  46239. t['greater'] = 584;
  46240. t['question'] = 611;
  46241. t['at'] = 975;
  46242. t['A'] = 722;
  46243. t['B'] = 722;
  46244. t['C'] = 722;
  46245. t['D'] = 722;
  46246. t['E'] = 667;
  46247. t['F'] = 611;
  46248. t['G'] = 778;
  46249. t['H'] = 722;
  46250. t['I'] = 278;
  46251. t['J'] = 556;
  46252. t['K'] = 722;
  46253. t['L'] = 611;
  46254. t['M'] = 833;
  46255. t['N'] = 722;
  46256. t['O'] = 778;
  46257. t['P'] = 667;
  46258. t['Q'] = 778;
  46259. t['R'] = 722;
  46260. t['S'] = 667;
  46261. t['T'] = 611;
  46262. t['U'] = 722;
  46263. t['V'] = 667;
  46264. t['W'] = 944;
  46265. t['X'] = 667;
  46266. t['Y'] = 667;
  46267. t['Z'] = 611;
  46268. t['bracketleft'] = 333;
  46269. t['backslash'] = 278;
  46270. t['bracketright'] = 333;
  46271. t['asciicircum'] = 584;
  46272. t['underscore'] = 556;
  46273. t['quoteleft'] = 278;
  46274. t['a'] = 556;
  46275. t['b'] = 611;
  46276. t['c'] = 556;
  46277. t['d'] = 611;
  46278. t['e'] = 556;
  46279. t['f'] = 333;
  46280. t['g'] = 611;
  46281. t['h'] = 611;
  46282. t['i'] = 278;
  46283. t['j'] = 278;
  46284. t['k'] = 556;
  46285. t['l'] = 278;
  46286. t['m'] = 889;
  46287. t['n'] = 611;
  46288. t['o'] = 611;
  46289. t['p'] = 611;
  46290. t['q'] = 611;
  46291. t['r'] = 389;
  46292. t['s'] = 556;
  46293. t['t'] = 333;
  46294. t['u'] = 611;
  46295. t['v'] = 556;
  46296. t['w'] = 778;
  46297. t['x'] = 556;
  46298. t['y'] = 556;
  46299. t['z'] = 500;
  46300. t['braceleft'] = 389;
  46301. t['bar'] = 280;
  46302. t['braceright'] = 389;
  46303. t['asciitilde'] = 584;
  46304. t['exclamdown'] = 333;
  46305. t['cent'] = 556;
  46306. t['sterling'] = 556;
  46307. t['fraction'] = 167;
  46308. t['yen'] = 556;
  46309. t['florin'] = 556;
  46310. t['section'] = 556;
  46311. t['currency'] = 556;
  46312. t['quotesingle'] = 238;
  46313. t['quotedblleft'] = 500;
  46314. t['guillemotleft'] = 556;
  46315. t['guilsinglleft'] = 333;
  46316. t['guilsinglright'] = 333;
  46317. t['fi'] = 611;
  46318. t['fl'] = 611;
  46319. t['endash'] = 556;
  46320. t['dagger'] = 556;
  46321. t['daggerdbl'] = 556;
  46322. t['periodcentered'] = 278;
  46323. t['paragraph'] = 556;
  46324. t['bullet'] = 350;
  46325. t['quotesinglbase'] = 278;
  46326. t['quotedblbase'] = 500;
  46327. t['quotedblright'] = 500;
  46328. t['guillemotright'] = 556;
  46329. t['ellipsis'] = 1000;
  46330. t['perthousand'] = 1000;
  46331. t['questiondown'] = 611;
  46332. t['grave'] = 333;
  46333. t['acute'] = 333;
  46334. t['circumflex'] = 333;
  46335. t['tilde'] = 333;
  46336. t['macron'] = 333;
  46337. t['breve'] = 333;
  46338. t['dotaccent'] = 333;
  46339. t['dieresis'] = 333;
  46340. t['ring'] = 333;
  46341. t['cedilla'] = 333;
  46342. t['hungarumlaut'] = 333;
  46343. t['ogonek'] = 333;
  46344. t['caron'] = 333;
  46345. t['emdash'] = 1000;
  46346. t['AE'] = 1000;
  46347. t['ordfeminine'] = 370;
  46348. t['Lslash'] = 611;
  46349. t['Oslash'] = 778;
  46350. t['OE'] = 1000;
  46351. t['ordmasculine'] = 365;
  46352. t['ae'] = 889;
  46353. t['dotlessi'] = 278;
  46354. t['lslash'] = 278;
  46355. t['oslash'] = 611;
  46356. t['oe'] = 944;
  46357. t['germandbls'] = 611;
  46358. t['Idieresis'] = 278;
  46359. t['eacute'] = 556;
  46360. t['abreve'] = 556;
  46361. t['uhungarumlaut'] = 611;
  46362. t['ecaron'] = 556;
  46363. t['Ydieresis'] = 667;
  46364. t['divide'] = 584;
  46365. t['Yacute'] = 667;
  46366. t['Acircumflex'] = 722;
  46367. t['aacute'] = 556;
  46368. t['Ucircumflex'] = 722;
  46369. t['yacute'] = 556;
  46370. t['scommaaccent'] = 556;
  46371. t['ecircumflex'] = 556;
  46372. t['Uring'] = 722;
  46373. t['Udieresis'] = 722;
  46374. t['aogonek'] = 556;
  46375. t['Uacute'] = 722;
  46376. t['uogonek'] = 611;
  46377. t['Edieresis'] = 667;
  46378. t['Dcroat'] = 722;
  46379. t['commaaccent'] = 250;
  46380. t['copyright'] = 737;
  46381. t['Emacron'] = 667;
  46382. t['ccaron'] = 556;
  46383. t['aring'] = 556;
  46384. t['Ncommaaccent'] = 722;
  46385. t['lacute'] = 278;
  46386. t['agrave'] = 556;
  46387. t['Tcommaaccent'] = 611;
  46388. t['Cacute'] = 722;
  46389. t['atilde'] = 556;
  46390. t['Edotaccent'] = 667;
  46391. t['scaron'] = 556;
  46392. t['scedilla'] = 556;
  46393. t['iacute'] = 278;
  46394. t['lozenge'] = 494;
  46395. t['Rcaron'] = 722;
  46396. t['Gcommaaccent'] = 778;
  46397. t['ucircumflex'] = 611;
  46398. t['acircumflex'] = 556;
  46399. t['Amacron'] = 722;
  46400. t['rcaron'] = 389;
  46401. t['ccedilla'] = 556;
  46402. t['Zdotaccent'] = 611;
  46403. t['Thorn'] = 667;
  46404. t['Omacron'] = 778;
  46405. t['Racute'] = 722;
  46406. t['Sacute'] = 667;
  46407. t['dcaron'] = 743;
  46408. t['Umacron'] = 722;
  46409. t['uring'] = 611;
  46410. t['threesuperior'] = 333;
  46411. t['Ograve'] = 778;
  46412. t['Agrave'] = 722;
  46413. t['Abreve'] = 722;
  46414. t['multiply'] = 584;
  46415. t['uacute'] = 611;
  46416. t['Tcaron'] = 611;
  46417. t['partialdiff'] = 494;
  46418. t['ydieresis'] = 556;
  46419. t['Nacute'] = 722;
  46420. t['icircumflex'] = 278;
  46421. t['Ecircumflex'] = 667;
  46422. t['adieresis'] = 556;
  46423. t['edieresis'] = 556;
  46424. t['cacute'] = 556;
  46425. t['nacute'] = 611;
  46426. t['umacron'] = 611;
  46427. t['Ncaron'] = 722;
  46428. t['Iacute'] = 278;
  46429. t['plusminus'] = 584;
  46430. t['brokenbar'] = 280;
  46431. t['registered'] = 737;
  46432. t['Gbreve'] = 778;
  46433. t['Idotaccent'] = 278;
  46434. t['summation'] = 600;
  46435. t['Egrave'] = 667;
  46436. t['racute'] = 389;
  46437. t['omacron'] = 611;
  46438. t['Zacute'] = 611;
  46439. t['Zcaron'] = 611;
  46440. t['greaterequal'] = 549;
  46441. t['Eth'] = 722;
  46442. t['Ccedilla'] = 722;
  46443. t['lcommaaccent'] = 278;
  46444. t['tcaron'] = 389;
  46445. t['eogonek'] = 556;
  46446. t['Uogonek'] = 722;
  46447. t['Aacute'] = 722;
  46448. t['Adieresis'] = 722;
  46449. t['egrave'] = 556;
  46450. t['zacute'] = 500;
  46451. t['iogonek'] = 278;
  46452. t['Oacute'] = 778;
  46453. t['oacute'] = 611;
  46454. t['amacron'] = 556;
  46455. t['sacute'] = 556;
  46456. t['idieresis'] = 278;
  46457. t['Ocircumflex'] = 778;
  46458. t['Ugrave'] = 722;
  46459. t['Delta'] = 612;
  46460. t['thorn'] = 611;
  46461. t['twosuperior'] = 333;
  46462. t['Odieresis'] = 778;
  46463. t['mu'] = 611;
  46464. t['igrave'] = 278;
  46465. t['ohungarumlaut'] = 611;
  46466. t['Eogonek'] = 667;
  46467. t['dcroat'] = 611;
  46468. t['threequarters'] = 834;
  46469. t['Scedilla'] = 667;
  46470. t['lcaron'] = 400;
  46471. t['Kcommaaccent'] = 722;
  46472. t['Lacute'] = 611;
  46473. t['trademark'] = 1000;
  46474. t['edotaccent'] = 556;
  46475. t['Igrave'] = 278;
  46476. t['Imacron'] = 278;
  46477. t['Lcaron'] = 611;
  46478. t['onehalf'] = 834;
  46479. t['lessequal'] = 549;
  46480. t['ocircumflex'] = 611;
  46481. t['ntilde'] = 611;
  46482. t['Uhungarumlaut'] = 722;
  46483. t['Eacute'] = 667;
  46484. t['emacron'] = 556;
  46485. t['gbreve'] = 611;
  46486. t['onequarter'] = 834;
  46487. t['Scaron'] = 667;
  46488. t['Scommaaccent'] = 667;
  46489. t['Ohungarumlaut'] = 778;
  46490. t['degree'] = 400;
  46491. t['ograve'] = 611;
  46492. t['Ccaron'] = 722;
  46493. t['ugrave'] = 611;
  46494. t['radical'] = 549;
  46495. t['Dcaron'] = 722;
  46496. t['rcommaaccent'] = 389;
  46497. t['Ntilde'] = 722;
  46498. t['otilde'] = 611;
  46499. t['Rcommaaccent'] = 722;
  46500. t['Lcommaaccent'] = 611;
  46501. t['Atilde'] = 722;
  46502. t['Aogonek'] = 722;
  46503. t['Aring'] = 722;
  46504. t['Otilde'] = 778;
  46505. t['zdotaccent'] = 500;
  46506. t['Ecaron'] = 667;
  46507. t['Iogonek'] = 278;
  46508. t['kcommaaccent'] = 556;
  46509. t['minus'] = 584;
  46510. t['Icircumflex'] = 278;
  46511. t['ncaron'] = 611;
  46512. t['tcommaaccent'] = 333;
  46513. t['logicalnot'] = 584;
  46514. t['odieresis'] = 611;
  46515. t['udieresis'] = 611;
  46516. t['notequal'] = 549;
  46517. t['gcommaaccent'] = 611;
  46518. t['eth'] = 611;
  46519. t['zcaron'] = 500;
  46520. t['ncommaaccent'] = 611;
  46521. t['onesuperior'] = 333;
  46522. t['imacron'] = 278;
  46523. t['Euro'] = 556;
  46524. });
  46525. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  46526. t['space'] = 278;
  46527. t['exclam'] = 278;
  46528. t['quotedbl'] = 355;
  46529. t['numbersign'] = 556;
  46530. t['dollar'] = 556;
  46531. t['percent'] = 889;
  46532. t['ampersand'] = 667;
  46533. t['quoteright'] = 222;
  46534. t['parenleft'] = 333;
  46535. t['parenright'] = 333;
  46536. t['asterisk'] = 389;
  46537. t['plus'] = 584;
  46538. t['comma'] = 278;
  46539. t['hyphen'] = 333;
  46540. t['period'] = 278;
  46541. t['slash'] = 278;
  46542. t['zero'] = 556;
  46543. t['one'] = 556;
  46544. t['two'] = 556;
  46545. t['three'] = 556;
  46546. t['four'] = 556;
  46547. t['five'] = 556;
  46548. t['six'] = 556;
  46549. t['seven'] = 556;
  46550. t['eight'] = 556;
  46551. t['nine'] = 556;
  46552. t['colon'] = 278;
  46553. t['semicolon'] = 278;
  46554. t['less'] = 584;
  46555. t['equal'] = 584;
  46556. t['greater'] = 584;
  46557. t['question'] = 556;
  46558. t['at'] = 1015;
  46559. t['A'] = 667;
  46560. t['B'] = 667;
  46561. t['C'] = 722;
  46562. t['D'] = 722;
  46563. t['E'] = 667;
  46564. t['F'] = 611;
  46565. t['G'] = 778;
  46566. t['H'] = 722;
  46567. t['I'] = 278;
  46568. t['J'] = 500;
  46569. t['K'] = 667;
  46570. t['L'] = 556;
  46571. t['M'] = 833;
  46572. t['N'] = 722;
  46573. t['O'] = 778;
  46574. t['P'] = 667;
  46575. t['Q'] = 778;
  46576. t['R'] = 722;
  46577. t['S'] = 667;
  46578. t['T'] = 611;
  46579. t['U'] = 722;
  46580. t['V'] = 667;
  46581. t['W'] = 944;
  46582. t['X'] = 667;
  46583. t['Y'] = 667;
  46584. t['Z'] = 611;
  46585. t['bracketleft'] = 278;
  46586. t['backslash'] = 278;
  46587. t['bracketright'] = 278;
  46588. t['asciicircum'] = 469;
  46589. t['underscore'] = 556;
  46590. t['quoteleft'] = 222;
  46591. t['a'] = 556;
  46592. t['b'] = 556;
  46593. t['c'] = 500;
  46594. t['d'] = 556;
  46595. t['e'] = 556;
  46596. t['f'] = 278;
  46597. t['g'] = 556;
  46598. t['h'] = 556;
  46599. t['i'] = 222;
  46600. t['j'] = 222;
  46601. t['k'] = 500;
  46602. t['l'] = 222;
  46603. t['m'] = 833;
  46604. t['n'] = 556;
  46605. t['o'] = 556;
  46606. t['p'] = 556;
  46607. t['q'] = 556;
  46608. t['r'] = 333;
  46609. t['s'] = 500;
  46610. t['t'] = 278;
  46611. t['u'] = 556;
  46612. t['v'] = 500;
  46613. t['w'] = 722;
  46614. t['x'] = 500;
  46615. t['y'] = 500;
  46616. t['z'] = 500;
  46617. t['braceleft'] = 334;
  46618. t['bar'] = 260;
  46619. t['braceright'] = 334;
  46620. t['asciitilde'] = 584;
  46621. t['exclamdown'] = 333;
  46622. t['cent'] = 556;
  46623. t['sterling'] = 556;
  46624. t['fraction'] = 167;
  46625. t['yen'] = 556;
  46626. t['florin'] = 556;
  46627. t['section'] = 556;
  46628. t['currency'] = 556;
  46629. t['quotesingle'] = 191;
  46630. t['quotedblleft'] = 333;
  46631. t['guillemotleft'] = 556;
  46632. t['guilsinglleft'] = 333;
  46633. t['guilsinglright'] = 333;
  46634. t['fi'] = 500;
  46635. t['fl'] = 500;
  46636. t['endash'] = 556;
  46637. t['dagger'] = 556;
  46638. t['daggerdbl'] = 556;
  46639. t['periodcentered'] = 278;
  46640. t['paragraph'] = 537;
  46641. t['bullet'] = 350;
  46642. t['quotesinglbase'] = 222;
  46643. t['quotedblbase'] = 333;
  46644. t['quotedblright'] = 333;
  46645. t['guillemotright'] = 556;
  46646. t['ellipsis'] = 1000;
  46647. t['perthousand'] = 1000;
  46648. t['questiondown'] = 611;
  46649. t['grave'] = 333;
  46650. t['acute'] = 333;
  46651. t['circumflex'] = 333;
  46652. t['tilde'] = 333;
  46653. t['macron'] = 333;
  46654. t['breve'] = 333;
  46655. t['dotaccent'] = 333;
  46656. t['dieresis'] = 333;
  46657. t['ring'] = 333;
  46658. t['cedilla'] = 333;
  46659. t['hungarumlaut'] = 333;
  46660. t['ogonek'] = 333;
  46661. t['caron'] = 333;
  46662. t['emdash'] = 1000;
  46663. t['AE'] = 1000;
  46664. t['ordfeminine'] = 370;
  46665. t['Lslash'] = 556;
  46666. t['Oslash'] = 778;
  46667. t['OE'] = 1000;
  46668. t['ordmasculine'] = 365;
  46669. t['ae'] = 889;
  46670. t['dotlessi'] = 278;
  46671. t['lslash'] = 222;
  46672. t['oslash'] = 611;
  46673. t['oe'] = 944;
  46674. t['germandbls'] = 611;
  46675. t['Idieresis'] = 278;
  46676. t['eacute'] = 556;
  46677. t['abreve'] = 556;
  46678. t['uhungarumlaut'] = 556;
  46679. t['ecaron'] = 556;
  46680. t['Ydieresis'] = 667;
  46681. t['divide'] = 584;
  46682. t['Yacute'] = 667;
  46683. t['Acircumflex'] = 667;
  46684. t['aacute'] = 556;
  46685. t['Ucircumflex'] = 722;
  46686. t['yacute'] = 500;
  46687. t['scommaaccent'] = 500;
  46688. t['ecircumflex'] = 556;
  46689. t['Uring'] = 722;
  46690. t['Udieresis'] = 722;
  46691. t['aogonek'] = 556;
  46692. t['Uacute'] = 722;
  46693. t['uogonek'] = 556;
  46694. t['Edieresis'] = 667;
  46695. t['Dcroat'] = 722;
  46696. t['commaaccent'] = 250;
  46697. t['copyright'] = 737;
  46698. t['Emacron'] = 667;
  46699. t['ccaron'] = 500;
  46700. t['aring'] = 556;
  46701. t['Ncommaaccent'] = 722;
  46702. t['lacute'] = 222;
  46703. t['agrave'] = 556;
  46704. t['Tcommaaccent'] = 611;
  46705. t['Cacute'] = 722;
  46706. t['atilde'] = 556;
  46707. t['Edotaccent'] = 667;
  46708. t['scaron'] = 500;
  46709. t['scedilla'] = 500;
  46710. t['iacute'] = 278;
  46711. t['lozenge'] = 471;
  46712. t['Rcaron'] = 722;
  46713. t['Gcommaaccent'] = 778;
  46714. t['ucircumflex'] = 556;
  46715. t['acircumflex'] = 556;
  46716. t['Amacron'] = 667;
  46717. t['rcaron'] = 333;
  46718. t['ccedilla'] = 500;
  46719. t['Zdotaccent'] = 611;
  46720. t['Thorn'] = 667;
  46721. t['Omacron'] = 778;
  46722. t['Racute'] = 722;
  46723. t['Sacute'] = 667;
  46724. t['dcaron'] = 643;
  46725. t['Umacron'] = 722;
  46726. t['uring'] = 556;
  46727. t['threesuperior'] = 333;
  46728. t['Ograve'] = 778;
  46729. t['Agrave'] = 667;
  46730. t['Abreve'] = 667;
  46731. t['multiply'] = 584;
  46732. t['uacute'] = 556;
  46733. t['Tcaron'] = 611;
  46734. t['partialdiff'] = 476;
  46735. t['ydieresis'] = 500;
  46736. t['Nacute'] = 722;
  46737. t['icircumflex'] = 278;
  46738. t['Ecircumflex'] = 667;
  46739. t['adieresis'] = 556;
  46740. t['edieresis'] = 556;
  46741. t['cacute'] = 500;
  46742. t['nacute'] = 556;
  46743. t['umacron'] = 556;
  46744. t['Ncaron'] = 722;
  46745. t['Iacute'] = 278;
  46746. t['plusminus'] = 584;
  46747. t['brokenbar'] = 260;
  46748. t['registered'] = 737;
  46749. t['Gbreve'] = 778;
  46750. t['Idotaccent'] = 278;
  46751. t['summation'] = 600;
  46752. t['Egrave'] = 667;
  46753. t['racute'] = 333;
  46754. t['omacron'] = 556;
  46755. t['Zacute'] = 611;
  46756. t['Zcaron'] = 611;
  46757. t['greaterequal'] = 549;
  46758. t['Eth'] = 722;
  46759. t['Ccedilla'] = 722;
  46760. t['lcommaaccent'] = 222;
  46761. t['tcaron'] = 317;
  46762. t['eogonek'] = 556;
  46763. t['Uogonek'] = 722;
  46764. t['Aacute'] = 667;
  46765. t['Adieresis'] = 667;
  46766. t['egrave'] = 556;
  46767. t['zacute'] = 500;
  46768. t['iogonek'] = 222;
  46769. t['Oacute'] = 778;
  46770. t['oacute'] = 556;
  46771. t['amacron'] = 556;
  46772. t['sacute'] = 500;
  46773. t['idieresis'] = 278;
  46774. t['Ocircumflex'] = 778;
  46775. t['Ugrave'] = 722;
  46776. t['Delta'] = 612;
  46777. t['thorn'] = 556;
  46778. t['twosuperior'] = 333;
  46779. t['Odieresis'] = 778;
  46780. t['mu'] = 556;
  46781. t['igrave'] = 278;
  46782. t['ohungarumlaut'] = 556;
  46783. t['Eogonek'] = 667;
  46784. t['dcroat'] = 556;
  46785. t['threequarters'] = 834;
  46786. t['Scedilla'] = 667;
  46787. t['lcaron'] = 299;
  46788. t['Kcommaaccent'] = 667;
  46789. t['Lacute'] = 556;
  46790. t['trademark'] = 1000;
  46791. t['edotaccent'] = 556;
  46792. t['Igrave'] = 278;
  46793. t['Imacron'] = 278;
  46794. t['Lcaron'] = 556;
  46795. t['onehalf'] = 834;
  46796. t['lessequal'] = 549;
  46797. t['ocircumflex'] = 556;
  46798. t['ntilde'] = 556;
  46799. t['Uhungarumlaut'] = 722;
  46800. t['Eacute'] = 667;
  46801. t['emacron'] = 556;
  46802. t['gbreve'] = 556;
  46803. t['onequarter'] = 834;
  46804. t['Scaron'] = 667;
  46805. t['Scommaaccent'] = 667;
  46806. t['Ohungarumlaut'] = 778;
  46807. t['degree'] = 400;
  46808. t['ograve'] = 556;
  46809. t['Ccaron'] = 722;
  46810. t['ugrave'] = 556;
  46811. t['radical'] = 453;
  46812. t['Dcaron'] = 722;
  46813. t['rcommaaccent'] = 333;
  46814. t['Ntilde'] = 722;
  46815. t['otilde'] = 556;
  46816. t['Rcommaaccent'] = 722;
  46817. t['Lcommaaccent'] = 556;
  46818. t['Atilde'] = 667;
  46819. t['Aogonek'] = 667;
  46820. t['Aring'] = 667;
  46821. t['Otilde'] = 778;
  46822. t['zdotaccent'] = 500;
  46823. t['Ecaron'] = 667;
  46824. t['Iogonek'] = 278;
  46825. t['kcommaaccent'] = 500;
  46826. t['minus'] = 584;
  46827. t['Icircumflex'] = 278;
  46828. t['ncaron'] = 556;
  46829. t['tcommaaccent'] = 278;
  46830. t['logicalnot'] = 584;
  46831. t['odieresis'] = 556;
  46832. t['udieresis'] = 556;
  46833. t['notequal'] = 549;
  46834. t['gcommaaccent'] = 556;
  46835. t['eth'] = 556;
  46836. t['zcaron'] = 500;
  46837. t['ncommaaccent'] = 556;
  46838. t['onesuperior'] = 333;
  46839. t['imacron'] = 278;
  46840. t['Euro'] = 556;
  46841. });
  46842. t['Symbol'] = getLookupTableFactory(function (t) {
  46843. t['space'] = 250;
  46844. t['exclam'] = 333;
  46845. t['universal'] = 713;
  46846. t['numbersign'] = 500;
  46847. t['existential'] = 549;
  46848. t['percent'] = 833;
  46849. t['ampersand'] = 778;
  46850. t['suchthat'] = 439;
  46851. t['parenleft'] = 333;
  46852. t['parenright'] = 333;
  46853. t['asteriskmath'] = 500;
  46854. t['plus'] = 549;
  46855. t['comma'] = 250;
  46856. t['minus'] = 549;
  46857. t['period'] = 250;
  46858. t['slash'] = 278;
  46859. t['zero'] = 500;
  46860. t['one'] = 500;
  46861. t['two'] = 500;
  46862. t['three'] = 500;
  46863. t['four'] = 500;
  46864. t['five'] = 500;
  46865. t['six'] = 500;
  46866. t['seven'] = 500;
  46867. t['eight'] = 500;
  46868. t['nine'] = 500;
  46869. t['colon'] = 278;
  46870. t['semicolon'] = 278;
  46871. t['less'] = 549;
  46872. t['equal'] = 549;
  46873. t['greater'] = 549;
  46874. t['question'] = 444;
  46875. t['congruent'] = 549;
  46876. t['Alpha'] = 722;
  46877. t['Beta'] = 667;
  46878. t['Chi'] = 722;
  46879. t['Delta'] = 612;
  46880. t['Epsilon'] = 611;
  46881. t['Phi'] = 763;
  46882. t['Gamma'] = 603;
  46883. t['Eta'] = 722;
  46884. t['Iota'] = 333;
  46885. t['theta1'] = 631;
  46886. t['Kappa'] = 722;
  46887. t['Lambda'] = 686;
  46888. t['Mu'] = 889;
  46889. t['Nu'] = 722;
  46890. t['Omicron'] = 722;
  46891. t['Pi'] = 768;
  46892. t['Theta'] = 741;
  46893. t['Rho'] = 556;
  46894. t['Sigma'] = 592;
  46895. t['Tau'] = 611;
  46896. t['Upsilon'] = 690;
  46897. t['sigma1'] = 439;
  46898. t['Omega'] = 768;
  46899. t['Xi'] = 645;
  46900. t['Psi'] = 795;
  46901. t['Zeta'] = 611;
  46902. t['bracketleft'] = 333;
  46903. t['therefore'] = 863;
  46904. t['bracketright'] = 333;
  46905. t['perpendicular'] = 658;
  46906. t['underscore'] = 500;
  46907. t['radicalex'] = 500;
  46908. t['alpha'] = 631;
  46909. t['beta'] = 549;
  46910. t['chi'] = 549;
  46911. t['delta'] = 494;
  46912. t['epsilon'] = 439;
  46913. t['phi'] = 521;
  46914. t['gamma'] = 411;
  46915. t['eta'] = 603;
  46916. t['iota'] = 329;
  46917. t['phi1'] = 603;
  46918. t['kappa'] = 549;
  46919. t['lambda'] = 549;
  46920. t['mu'] = 576;
  46921. t['nu'] = 521;
  46922. t['omicron'] = 549;
  46923. t['pi'] = 549;
  46924. t['theta'] = 521;
  46925. t['rho'] = 549;
  46926. t['sigma'] = 603;
  46927. t['tau'] = 439;
  46928. t['upsilon'] = 576;
  46929. t['omega1'] = 713;
  46930. t['omega'] = 686;
  46931. t['xi'] = 493;
  46932. t['psi'] = 686;
  46933. t['zeta'] = 494;
  46934. t['braceleft'] = 480;
  46935. t['bar'] = 200;
  46936. t['braceright'] = 480;
  46937. t['similar'] = 549;
  46938. t['Euro'] = 750;
  46939. t['Upsilon1'] = 620;
  46940. t['minute'] = 247;
  46941. t['lessequal'] = 549;
  46942. t['fraction'] = 167;
  46943. t['infinity'] = 713;
  46944. t['florin'] = 500;
  46945. t['club'] = 753;
  46946. t['diamond'] = 753;
  46947. t['heart'] = 753;
  46948. t['spade'] = 753;
  46949. t['arrowboth'] = 1042;
  46950. t['arrowleft'] = 987;
  46951. t['arrowup'] = 603;
  46952. t['arrowright'] = 987;
  46953. t['arrowdown'] = 603;
  46954. t['degree'] = 400;
  46955. t['plusminus'] = 549;
  46956. t['second'] = 411;
  46957. t['greaterequal'] = 549;
  46958. t['multiply'] = 549;
  46959. t['proportional'] = 713;
  46960. t['partialdiff'] = 494;
  46961. t['bullet'] = 460;
  46962. t['divide'] = 549;
  46963. t['notequal'] = 549;
  46964. t['equivalence'] = 549;
  46965. t['approxequal'] = 549;
  46966. t['ellipsis'] = 1000;
  46967. t['arrowvertex'] = 603;
  46968. t['arrowhorizex'] = 1000;
  46969. t['carriagereturn'] = 658;
  46970. t['aleph'] = 823;
  46971. t['Ifraktur'] = 686;
  46972. t['Rfraktur'] = 795;
  46973. t['weierstrass'] = 987;
  46974. t['circlemultiply'] = 768;
  46975. t['circleplus'] = 768;
  46976. t['emptyset'] = 823;
  46977. t['intersection'] = 768;
  46978. t['union'] = 768;
  46979. t['propersuperset'] = 713;
  46980. t['reflexsuperset'] = 713;
  46981. t['notsubset'] = 713;
  46982. t['propersubset'] = 713;
  46983. t['reflexsubset'] = 713;
  46984. t['element'] = 713;
  46985. t['notelement'] = 713;
  46986. t['angle'] = 768;
  46987. t['gradient'] = 713;
  46988. t['registerserif'] = 790;
  46989. t['copyrightserif'] = 790;
  46990. t['trademarkserif'] = 890;
  46991. t['product'] = 823;
  46992. t['radical'] = 549;
  46993. t['dotmath'] = 250;
  46994. t['logicalnot'] = 713;
  46995. t['logicaland'] = 603;
  46996. t['logicalor'] = 603;
  46997. t['arrowdblboth'] = 1042;
  46998. t['arrowdblleft'] = 987;
  46999. t['arrowdblup'] = 603;
  47000. t['arrowdblright'] = 987;
  47001. t['arrowdbldown'] = 603;
  47002. t['lozenge'] = 494;
  47003. t['angleleft'] = 329;
  47004. t['registersans'] = 790;
  47005. t['copyrightsans'] = 790;
  47006. t['trademarksans'] = 786;
  47007. t['summation'] = 713;
  47008. t['parenlefttp'] = 384;
  47009. t['parenleftex'] = 384;
  47010. t['parenleftbt'] = 384;
  47011. t['bracketlefttp'] = 384;
  47012. t['bracketleftex'] = 384;
  47013. t['bracketleftbt'] = 384;
  47014. t['bracelefttp'] = 494;
  47015. t['braceleftmid'] = 494;
  47016. t['braceleftbt'] = 494;
  47017. t['braceex'] = 494;
  47018. t['angleright'] = 329;
  47019. t['integral'] = 274;
  47020. t['integraltp'] = 686;
  47021. t['integralex'] = 686;
  47022. t['integralbt'] = 686;
  47023. t['parenrighttp'] = 384;
  47024. t['parenrightex'] = 384;
  47025. t['parenrightbt'] = 384;
  47026. t['bracketrighttp'] = 384;
  47027. t['bracketrightex'] = 384;
  47028. t['bracketrightbt'] = 384;
  47029. t['bracerighttp'] = 494;
  47030. t['bracerightmid'] = 494;
  47031. t['bracerightbt'] = 494;
  47032. t['apple'] = 790;
  47033. });
  47034. t['Times-Roman'] = getLookupTableFactory(function (t) {
  47035. t['space'] = 250;
  47036. t['exclam'] = 333;
  47037. t['quotedbl'] = 408;
  47038. t['numbersign'] = 500;
  47039. t['dollar'] = 500;
  47040. t['percent'] = 833;
  47041. t['ampersand'] = 778;
  47042. t['quoteright'] = 333;
  47043. t['parenleft'] = 333;
  47044. t['parenright'] = 333;
  47045. t['asterisk'] = 500;
  47046. t['plus'] = 564;
  47047. t['comma'] = 250;
  47048. t['hyphen'] = 333;
  47049. t['period'] = 250;
  47050. t['slash'] = 278;
  47051. t['zero'] = 500;
  47052. t['one'] = 500;
  47053. t['two'] = 500;
  47054. t['three'] = 500;
  47055. t['four'] = 500;
  47056. t['five'] = 500;
  47057. t['six'] = 500;
  47058. t['seven'] = 500;
  47059. t['eight'] = 500;
  47060. t['nine'] = 500;
  47061. t['colon'] = 278;
  47062. t['semicolon'] = 278;
  47063. t['less'] = 564;
  47064. t['equal'] = 564;
  47065. t['greater'] = 564;
  47066. t['question'] = 444;
  47067. t['at'] = 921;
  47068. t['A'] = 722;
  47069. t['B'] = 667;
  47070. t['C'] = 667;
  47071. t['D'] = 722;
  47072. t['E'] = 611;
  47073. t['F'] = 556;
  47074. t['G'] = 722;
  47075. t['H'] = 722;
  47076. t['I'] = 333;
  47077. t['J'] = 389;
  47078. t['K'] = 722;
  47079. t['L'] = 611;
  47080. t['M'] = 889;
  47081. t['N'] = 722;
  47082. t['O'] = 722;
  47083. t['P'] = 556;
  47084. t['Q'] = 722;
  47085. t['R'] = 667;
  47086. t['S'] = 556;
  47087. t['T'] = 611;
  47088. t['U'] = 722;
  47089. t['V'] = 722;
  47090. t['W'] = 944;
  47091. t['X'] = 722;
  47092. t['Y'] = 722;
  47093. t['Z'] = 611;
  47094. t['bracketleft'] = 333;
  47095. t['backslash'] = 278;
  47096. t['bracketright'] = 333;
  47097. t['asciicircum'] = 469;
  47098. t['underscore'] = 500;
  47099. t['quoteleft'] = 333;
  47100. t['a'] = 444;
  47101. t['b'] = 500;
  47102. t['c'] = 444;
  47103. t['d'] = 500;
  47104. t['e'] = 444;
  47105. t['f'] = 333;
  47106. t['g'] = 500;
  47107. t['h'] = 500;
  47108. t['i'] = 278;
  47109. t['j'] = 278;
  47110. t['k'] = 500;
  47111. t['l'] = 278;
  47112. t['m'] = 778;
  47113. t['n'] = 500;
  47114. t['o'] = 500;
  47115. t['p'] = 500;
  47116. t['q'] = 500;
  47117. t['r'] = 333;
  47118. t['s'] = 389;
  47119. t['t'] = 278;
  47120. t['u'] = 500;
  47121. t['v'] = 500;
  47122. t['w'] = 722;
  47123. t['x'] = 500;
  47124. t['y'] = 500;
  47125. t['z'] = 444;
  47126. t['braceleft'] = 480;
  47127. t['bar'] = 200;
  47128. t['braceright'] = 480;
  47129. t['asciitilde'] = 541;
  47130. t['exclamdown'] = 333;
  47131. t['cent'] = 500;
  47132. t['sterling'] = 500;
  47133. t['fraction'] = 167;
  47134. t['yen'] = 500;
  47135. t['florin'] = 500;
  47136. t['section'] = 500;
  47137. t['currency'] = 500;
  47138. t['quotesingle'] = 180;
  47139. t['quotedblleft'] = 444;
  47140. t['guillemotleft'] = 500;
  47141. t['guilsinglleft'] = 333;
  47142. t['guilsinglright'] = 333;
  47143. t['fi'] = 556;
  47144. t['fl'] = 556;
  47145. t['endash'] = 500;
  47146. t['dagger'] = 500;
  47147. t['daggerdbl'] = 500;
  47148. t['periodcentered'] = 250;
  47149. t['paragraph'] = 453;
  47150. t['bullet'] = 350;
  47151. t['quotesinglbase'] = 333;
  47152. t['quotedblbase'] = 444;
  47153. t['quotedblright'] = 444;
  47154. t['guillemotright'] = 500;
  47155. t['ellipsis'] = 1000;
  47156. t['perthousand'] = 1000;
  47157. t['questiondown'] = 444;
  47158. t['grave'] = 333;
  47159. t['acute'] = 333;
  47160. t['circumflex'] = 333;
  47161. t['tilde'] = 333;
  47162. t['macron'] = 333;
  47163. t['breve'] = 333;
  47164. t['dotaccent'] = 333;
  47165. t['dieresis'] = 333;
  47166. t['ring'] = 333;
  47167. t['cedilla'] = 333;
  47168. t['hungarumlaut'] = 333;
  47169. t['ogonek'] = 333;
  47170. t['caron'] = 333;
  47171. t['emdash'] = 1000;
  47172. t['AE'] = 889;
  47173. t['ordfeminine'] = 276;
  47174. t['Lslash'] = 611;
  47175. t['Oslash'] = 722;
  47176. t['OE'] = 889;
  47177. t['ordmasculine'] = 310;
  47178. t['ae'] = 667;
  47179. t['dotlessi'] = 278;
  47180. t['lslash'] = 278;
  47181. t['oslash'] = 500;
  47182. t['oe'] = 722;
  47183. t['germandbls'] = 500;
  47184. t['Idieresis'] = 333;
  47185. t['eacute'] = 444;
  47186. t['abreve'] = 444;
  47187. t['uhungarumlaut'] = 500;
  47188. t['ecaron'] = 444;
  47189. t['Ydieresis'] = 722;
  47190. t['divide'] = 564;
  47191. t['Yacute'] = 722;
  47192. t['Acircumflex'] = 722;
  47193. t['aacute'] = 444;
  47194. t['Ucircumflex'] = 722;
  47195. t['yacute'] = 500;
  47196. t['scommaaccent'] = 389;
  47197. t['ecircumflex'] = 444;
  47198. t['Uring'] = 722;
  47199. t['Udieresis'] = 722;
  47200. t['aogonek'] = 444;
  47201. t['Uacute'] = 722;
  47202. t['uogonek'] = 500;
  47203. t['Edieresis'] = 611;
  47204. t['Dcroat'] = 722;
  47205. t['commaaccent'] = 250;
  47206. t['copyright'] = 760;
  47207. t['Emacron'] = 611;
  47208. t['ccaron'] = 444;
  47209. t['aring'] = 444;
  47210. t['Ncommaaccent'] = 722;
  47211. t['lacute'] = 278;
  47212. t['agrave'] = 444;
  47213. t['Tcommaaccent'] = 611;
  47214. t['Cacute'] = 667;
  47215. t['atilde'] = 444;
  47216. t['Edotaccent'] = 611;
  47217. t['scaron'] = 389;
  47218. t['scedilla'] = 389;
  47219. t['iacute'] = 278;
  47220. t['lozenge'] = 471;
  47221. t['Rcaron'] = 667;
  47222. t['Gcommaaccent'] = 722;
  47223. t['ucircumflex'] = 500;
  47224. t['acircumflex'] = 444;
  47225. t['Amacron'] = 722;
  47226. t['rcaron'] = 333;
  47227. t['ccedilla'] = 444;
  47228. t['Zdotaccent'] = 611;
  47229. t['Thorn'] = 556;
  47230. t['Omacron'] = 722;
  47231. t['Racute'] = 667;
  47232. t['Sacute'] = 556;
  47233. t['dcaron'] = 588;
  47234. t['Umacron'] = 722;
  47235. t['uring'] = 500;
  47236. t['threesuperior'] = 300;
  47237. t['Ograve'] = 722;
  47238. t['Agrave'] = 722;
  47239. t['Abreve'] = 722;
  47240. t['multiply'] = 564;
  47241. t['uacute'] = 500;
  47242. t['Tcaron'] = 611;
  47243. t['partialdiff'] = 476;
  47244. t['ydieresis'] = 500;
  47245. t['Nacute'] = 722;
  47246. t['icircumflex'] = 278;
  47247. t['Ecircumflex'] = 611;
  47248. t['adieresis'] = 444;
  47249. t['edieresis'] = 444;
  47250. t['cacute'] = 444;
  47251. t['nacute'] = 500;
  47252. t['umacron'] = 500;
  47253. t['Ncaron'] = 722;
  47254. t['Iacute'] = 333;
  47255. t['plusminus'] = 564;
  47256. t['brokenbar'] = 200;
  47257. t['registered'] = 760;
  47258. t['Gbreve'] = 722;
  47259. t['Idotaccent'] = 333;
  47260. t['summation'] = 600;
  47261. t['Egrave'] = 611;
  47262. t['racute'] = 333;
  47263. t['omacron'] = 500;
  47264. t['Zacute'] = 611;
  47265. t['Zcaron'] = 611;
  47266. t['greaterequal'] = 549;
  47267. t['Eth'] = 722;
  47268. t['Ccedilla'] = 667;
  47269. t['lcommaaccent'] = 278;
  47270. t['tcaron'] = 326;
  47271. t['eogonek'] = 444;
  47272. t['Uogonek'] = 722;
  47273. t['Aacute'] = 722;
  47274. t['Adieresis'] = 722;
  47275. t['egrave'] = 444;
  47276. t['zacute'] = 444;
  47277. t['iogonek'] = 278;
  47278. t['Oacute'] = 722;
  47279. t['oacute'] = 500;
  47280. t['amacron'] = 444;
  47281. t['sacute'] = 389;
  47282. t['idieresis'] = 278;
  47283. t['Ocircumflex'] = 722;
  47284. t['Ugrave'] = 722;
  47285. t['Delta'] = 612;
  47286. t['thorn'] = 500;
  47287. t['twosuperior'] = 300;
  47288. t['Odieresis'] = 722;
  47289. t['mu'] = 500;
  47290. t['igrave'] = 278;
  47291. t['ohungarumlaut'] = 500;
  47292. t['Eogonek'] = 611;
  47293. t['dcroat'] = 500;
  47294. t['threequarters'] = 750;
  47295. t['Scedilla'] = 556;
  47296. t['lcaron'] = 344;
  47297. t['Kcommaaccent'] = 722;
  47298. t['Lacute'] = 611;
  47299. t['trademark'] = 980;
  47300. t['edotaccent'] = 444;
  47301. t['Igrave'] = 333;
  47302. t['Imacron'] = 333;
  47303. t['Lcaron'] = 611;
  47304. t['onehalf'] = 750;
  47305. t['lessequal'] = 549;
  47306. t['ocircumflex'] = 500;
  47307. t['ntilde'] = 500;
  47308. t['Uhungarumlaut'] = 722;
  47309. t['Eacute'] = 611;
  47310. t['emacron'] = 444;
  47311. t['gbreve'] = 500;
  47312. t['onequarter'] = 750;
  47313. t['Scaron'] = 556;
  47314. t['Scommaaccent'] = 556;
  47315. t['Ohungarumlaut'] = 722;
  47316. t['degree'] = 400;
  47317. t['ograve'] = 500;
  47318. t['Ccaron'] = 667;
  47319. t['ugrave'] = 500;
  47320. t['radical'] = 453;
  47321. t['Dcaron'] = 722;
  47322. t['rcommaaccent'] = 333;
  47323. t['Ntilde'] = 722;
  47324. t['otilde'] = 500;
  47325. t['Rcommaaccent'] = 667;
  47326. t['Lcommaaccent'] = 611;
  47327. t['Atilde'] = 722;
  47328. t['Aogonek'] = 722;
  47329. t['Aring'] = 722;
  47330. t['Otilde'] = 722;
  47331. t['zdotaccent'] = 444;
  47332. t['Ecaron'] = 611;
  47333. t['Iogonek'] = 333;
  47334. t['kcommaaccent'] = 500;
  47335. t['minus'] = 564;
  47336. t['Icircumflex'] = 333;
  47337. t['ncaron'] = 500;
  47338. t['tcommaaccent'] = 278;
  47339. t['logicalnot'] = 564;
  47340. t['odieresis'] = 500;
  47341. t['udieresis'] = 500;
  47342. t['notequal'] = 549;
  47343. t['gcommaaccent'] = 500;
  47344. t['eth'] = 500;
  47345. t['zcaron'] = 444;
  47346. t['ncommaaccent'] = 500;
  47347. t['onesuperior'] = 300;
  47348. t['imacron'] = 278;
  47349. t['Euro'] = 500;
  47350. });
  47351. t['Times-Bold'] = getLookupTableFactory(function (t) {
  47352. t['space'] = 250;
  47353. t['exclam'] = 333;
  47354. t['quotedbl'] = 555;
  47355. t['numbersign'] = 500;
  47356. t['dollar'] = 500;
  47357. t['percent'] = 1000;
  47358. t['ampersand'] = 833;
  47359. t['quoteright'] = 333;
  47360. t['parenleft'] = 333;
  47361. t['parenright'] = 333;
  47362. t['asterisk'] = 500;
  47363. t['plus'] = 570;
  47364. t['comma'] = 250;
  47365. t['hyphen'] = 333;
  47366. t['period'] = 250;
  47367. t['slash'] = 278;
  47368. t['zero'] = 500;
  47369. t['one'] = 500;
  47370. t['two'] = 500;
  47371. t['three'] = 500;
  47372. t['four'] = 500;
  47373. t['five'] = 500;
  47374. t['six'] = 500;
  47375. t['seven'] = 500;
  47376. t['eight'] = 500;
  47377. t['nine'] = 500;
  47378. t['colon'] = 333;
  47379. t['semicolon'] = 333;
  47380. t['less'] = 570;
  47381. t['equal'] = 570;
  47382. t['greater'] = 570;
  47383. t['question'] = 500;
  47384. t['at'] = 930;
  47385. t['A'] = 722;
  47386. t['B'] = 667;
  47387. t['C'] = 722;
  47388. t['D'] = 722;
  47389. t['E'] = 667;
  47390. t['F'] = 611;
  47391. t['G'] = 778;
  47392. t['H'] = 778;
  47393. t['I'] = 389;
  47394. t['J'] = 500;
  47395. t['K'] = 778;
  47396. t['L'] = 667;
  47397. t['M'] = 944;
  47398. t['N'] = 722;
  47399. t['O'] = 778;
  47400. t['P'] = 611;
  47401. t['Q'] = 778;
  47402. t['R'] = 722;
  47403. t['S'] = 556;
  47404. t['T'] = 667;
  47405. t['U'] = 722;
  47406. t['V'] = 722;
  47407. t['W'] = 1000;
  47408. t['X'] = 722;
  47409. t['Y'] = 722;
  47410. t['Z'] = 667;
  47411. t['bracketleft'] = 333;
  47412. t['backslash'] = 278;
  47413. t['bracketright'] = 333;
  47414. t['asciicircum'] = 581;
  47415. t['underscore'] = 500;
  47416. t['quoteleft'] = 333;
  47417. t['a'] = 500;
  47418. t['b'] = 556;
  47419. t['c'] = 444;
  47420. t['d'] = 556;
  47421. t['e'] = 444;
  47422. t['f'] = 333;
  47423. t['g'] = 500;
  47424. t['h'] = 556;
  47425. t['i'] = 278;
  47426. t['j'] = 333;
  47427. t['k'] = 556;
  47428. t['l'] = 278;
  47429. t['m'] = 833;
  47430. t['n'] = 556;
  47431. t['o'] = 500;
  47432. t['p'] = 556;
  47433. t['q'] = 556;
  47434. t['r'] = 444;
  47435. t['s'] = 389;
  47436. t['t'] = 333;
  47437. t['u'] = 556;
  47438. t['v'] = 500;
  47439. t['w'] = 722;
  47440. t['x'] = 500;
  47441. t['y'] = 500;
  47442. t['z'] = 444;
  47443. t['braceleft'] = 394;
  47444. t['bar'] = 220;
  47445. t['braceright'] = 394;
  47446. t['asciitilde'] = 520;
  47447. t['exclamdown'] = 333;
  47448. t['cent'] = 500;
  47449. t['sterling'] = 500;
  47450. t['fraction'] = 167;
  47451. t['yen'] = 500;
  47452. t['florin'] = 500;
  47453. t['section'] = 500;
  47454. t['currency'] = 500;
  47455. t['quotesingle'] = 278;
  47456. t['quotedblleft'] = 500;
  47457. t['guillemotleft'] = 500;
  47458. t['guilsinglleft'] = 333;
  47459. t['guilsinglright'] = 333;
  47460. t['fi'] = 556;
  47461. t['fl'] = 556;
  47462. t['endash'] = 500;
  47463. t['dagger'] = 500;
  47464. t['daggerdbl'] = 500;
  47465. t['periodcentered'] = 250;
  47466. t['paragraph'] = 540;
  47467. t['bullet'] = 350;
  47468. t['quotesinglbase'] = 333;
  47469. t['quotedblbase'] = 500;
  47470. t['quotedblright'] = 500;
  47471. t['guillemotright'] = 500;
  47472. t['ellipsis'] = 1000;
  47473. t['perthousand'] = 1000;
  47474. t['questiondown'] = 500;
  47475. t['grave'] = 333;
  47476. t['acute'] = 333;
  47477. t['circumflex'] = 333;
  47478. t['tilde'] = 333;
  47479. t['macron'] = 333;
  47480. t['breve'] = 333;
  47481. t['dotaccent'] = 333;
  47482. t['dieresis'] = 333;
  47483. t['ring'] = 333;
  47484. t['cedilla'] = 333;
  47485. t['hungarumlaut'] = 333;
  47486. t['ogonek'] = 333;
  47487. t['caron'] = 333;
  47488. t['emdash'] = 1000;
  47489. t['AE'] = 1000;
  47490. t['ordfeminine'] = 300;
  47491. t['Lslash'] = 667;
  47492. t['Oslash'] = 778;
  47493. t['OE'] = 1000;
  47494. t['ordmasculine'] = 330;
  47495. t['ae'] = 722;
  47496. t['dotlessi'] = 278;
  47497. t['lslash'] = 278;
  47498. t['oslash'] = 500;
  47499. t['oe'] = 722;
  47500. t['germandbls'] = 556;
  47501. t['Idieresis'] = 389;
  47502. t['eacute'] = 444;
  47503. t['abreve'] = 500;
  47504. t['uhungarumlaut'] = 556;
  47505. t['ecaron'] = 444;
  47506. t['Ydieresis'] = 722;
  47507. t['divide'] = 570;
  47508. t['Yacute'] = 722;
  47509. t['Acircumflex'] = 722;
  47510. t['aacute'] = 500;
  47511. t['Ucircumflex'] = 722;
  47512. t['yacute'] = 500;
  47513. t['scommaaccent'] = 389;
  47514. t['ecircumflex'] = 444;
  47515. t['Uring'] = 722;
  47516. t['Udieresis'] = 722;
  47517. t['aogonek'] = 500;
  47518. t['Uacute'] = 722;
  47519. t['uogonek'] = 556;
  47520. t['Edieresis'] = 667;
  47521. t['Dcroat'] = 722;
  47522. t['commaaccent'] = 250;
  47523. t['copyright'] = 747;
  47524. t['Emacron'] = 667;
  47525. t['ccaron'] = 444;
  47526. t['aring'] = 500;
  47527. t['Ncommaaccent'] = 722;
  47528. t['lacute'] = 278;
  47529. t['agrave'] = 500;
  47530. t['Tcommaaccent'] = 667;
  47531. t['Cacute'] = 722;
  47532. t['atilde'] = 500;
  47533. t['Edotaccent'] = 667;
  47534. t['scaron'] = 389;
  47535. t['scedilla'] = 389;
  47536. t['iacute'] = 278;
  47537. t['lozenge'] = 494;
  47538. t['Rcaron'] = 722;
  47539. t['Gcommaaccent'] = 778;
  47540. t['ucircumflex'] = 556;
  47541. t['acircumflex'] = 500;
  47542. t['Amacron'] = 722;
  47543. t['rcaron'] = 444;
  47544. t['ccedilla'] = 444;
  47545. t['Zdotaccent'] = 667;
  47546. t['Thorn'] = 611;
  47547. t['Omacron'] = 778;
  47548. t['Racute'] = 722;
  47549. t['Sacute'] = 556;
  47550. t['dcaron'] = 672;
  47551. t['Umacron'] = 722;
  47552. t['uring'] = 556;
  47553. t['threesuperior'] = 300;
  47554. t['Ograve'] = 778;
  47555. t['Agrave'] = 722;
  47556. t['Abreve'] = 722;
  47557. t['multiply'] = 570;
  47558. t['uacute'] = 556;
  47559. t['Tcaron'] = 667;
  47560. t['partialdiff'] = 494;
  47561. t['ydieresis'] = 500;
  47562. t['Nacute'] = 722;
  47563. t['icircumflex'] = 278;
  47564. t['Ecircumflex'] = 667;
  47565. t['adieresis'] = 500;
  47566. t['edieresis'] = 444;
  47567. t['cacute'] = 444;
  47568. t['nacute'] = 556;
  47569. t['umacron'] = 556;
  47570. t['Ncaron'] = 722;
  47571. t['Iacute'] = 389;
  47572. t['plusminus'] = 570;
  47573. t['brokenbar'] = 220;
  47574. t['registered'] = 747;
  47575. t['Gbreve'] = 778;
  47576. t['Idotaccent'] = 389;
  47577. t['summation'] = 600;
  47578. t['Egrave'] = 667;
  47579. t['racute'] = 444;
  47580. t['omacron'] = 500;
  47581. t['Zacute'] = 667;
  47582. t['Zcaron'] = 667;
  47583. t['greaterequal'] = 549;
  47584. t['Eth'] = 722;
  47585. t['Ccedilla'] = 722;
  47586. t['lcommaaccent'] = 278;
  47587. t['tcaron'] = 416;
  47588. t['eogonek'] = 444;
  47589. t['Uogonek'] = 722;
  47590. t['Aacute'] = 722;
  47591. t['Adieresis'] = 722;
  47592. t['egrave'] = 444;
  47593. t['zacute'] = 444;
  47594. t['iogonek'] = 278;
  47595. t['Oacute'] = 778;
  47596. t['oacute'] = 500;
  47597. t['amacron'] = 500;
  47598. t['sacute'] = 389;
  47599. t['idieresis'] = 278;
  47600. t['Ocircumflex'] = 778;
  47601. t['Ugrave'] = 722;
  47602. t['Delta'] = 612;
  47603. t['thorn'] = 556;
  47604. t['twosuperior'] = 300;
  47605. t['Odieresis'] = 778;
  47606. t['mu'] = 556;
  47607. t['igrave'] = 278;
  47608. t['ohungarumlaut'] = 500;
  47609. t['Eogonek'] = 667;
  47610. t['dcroat'] = 556;
  47611. t['threequarters'] = 750;
  47612. t['Scedilla'] = 556;
  47613. t['lcaron'] = 394;
  47614. t['Kcommaaccent'] = 778;
  47615. t['Lacute'] = 667;
  47616. t['trademark'] = 1000;
  47617. t['edotaccent'] = 444;
  47618. t['Igrave'] = 389;
  47619. t['Imacron'] = 389;
  47620. t['Lcaron'] = 667;
  47621. t['onehalf'] = 750;
  47622. t['lessequal'] = 549;
  47623. t['ocircumflex'] = 500;
  47624. t['ntilde'] = 556;
  47625. t['Uhungarumlaut'] = 722;
  47626. t['Eacute'] = 667;
  47627. t['emacron'] = 444;
  47628. t['gbreve'] = 500;
  47629. t['onequarter'] = 750;
  47630. t['Scaron'] = 556;
  47631. t['Scommaaccent'] = 556;
  47632. t['Ohungarumlaut'] = 778;
  47633. t['degree'] = 400;
  47634. t['ograve'] = 500;
  47635. t['Ccaron'] = 722;
  47636. t['ugrave'] = 556;
  47637. t['radical'] = 549;
  47638. t['Dcaron'] = 722;
  47639. t['rcommaaccent'] = 444;
  47640. t['Ntilde'] = 722;
  47641. t['otilde'] = 500;
  47642. t['Rcommaaccent'] = 722;
  47643. t['Lcommaaccent'] = 667;
  47644. t['Atilde'] = 722;
  47645. t['Aogonek'] = 722;
  47646. t['Aring'] = 722;
  47647. t['Otilde'] = 778;
  47648. t['zdotaccent'] = 444;
  47649. t['Ecaron'] = 667;
  47650. t['Iogonek'] = 389;
  47651. t['kcommaaccent'] = 556;
  47652. t['minus'] = 570;
  47653. t['Icircumflex'] = 389;
  47654. t['ncaron'] = 556;
  47655. t['tcommaaccent'] = 333;
  47656. t['logicalnot'] = 570;
  47657. t['odieresis'] = 500;
  47658. t['udieresis'] = 556;
  47659. t['notequal'] = 549;
  47660. t['gcommaaccent'] = 500;
  47661. t['eth'] = 500;
  47662. t['zcaron'] = 444;
  47663. t['ncommaaccent'] = 556;
  47664. t['onesuperior'] = 300;
  47665. t['imacron'] = 278;
  47666. t['Euro'] = 500;
  47667. });
  47668. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  47669. t['space'] = 250;
  47670. t['exclam'] = 389;
  47671. t['quotedbl'] = 555;
  47672. t['numbersign'] = 500;
  47673. t['dollar'] = 500;
  47674. t['percent'] = 833;
  47675. t['ampersand'] = 778;
  47676. t['quoteright'] = 333;
  47677. t['parenleft'] = 333;
  47678. t['parenright'] = 333;
  47679. t['asterisk'] = 500;
  47680. t['plus'] = 570;
  47681. t['comma'] = 250;
  47682. t['hyphen'] = 333;
  47683. t['period'] = 250;
  47684. t['slash'] = 278;
  47685. t['zero'] = 500;
  47686. t['one'] = 500;
  47687. t['two'] = 500;
  47688. t['three'] = 500;
  47689. t['four'] = 500;
  47690. t['five'] = 500;
  47691. t['six'] = 500;
  47692. t['seven'] = 500;
  47693. t['eight'] = 500;
  47694. t['nine'] = 500;
  47695. t['colon'] = 333;
  47696. t['semicolon'] = 333;
  47697. t['less'] = 570;
  47698. t['equal'] = 570;
  47699. t['greater'] = 570;
  47700. t['question'] = 500;
  47701. t['at'] = 832;
  47702. t['A'] = 667;
  47703. t['B'] = 667;
  47704. t['C'] = 667;
  47705. t['D'] = 722;
  47706. t['E'] = 667;
  47707. t['F'] = 667;
  47708. t['G'] = 722;
  47709. t['H'] = 778;
  47710. t['I'] = 389;
  47711. t['J'] = 500;
  47712. t['K'] = 667;
  47713. t['L'] = 611;
  47714. t['M'] = 889;
  47715. t['N'] = 722;
  47716. t['O'] = 722;
  47717. t['P'] = 611;
  47718. t['Q'] = 722;
  47719. t['R'] = 667;
  47720. t['S'] = 556;
  47721. t['T'] = 611;
  47722. t['U'] = 722;
  47723. t['V'] = 667;
  47724. t['W'] = 889;
  47725. t['X'] = 667;
  47726. t['Y'] = 611;
  47727. t['Z'] = 611;
  47728. t['bracketleft'] = 333;
  47729. t['backslash'] = 278;
  47730. t['bracketright'] = 333;
  47731. t['asciicircum'] = 570;
  47732. t['underscore'] = 500;
  47733. t['quoteleft'] = 333;
  47734. t['a'] = 500;
  47735. t['b'] = 500;
  47736. t['c'] = 444;
  47737. t['d'] = 500;
  47738. t['e'] = 444;
  47739. t['f'] = 333;
  47740. t['g'] = 500;
  47741. t['h'] = 556;
  47742. t['i'] = 278;
  47743. t['j'] = 278;
  47744. t['k'] = 500;
  47745. t['l'] = 278;
  47746. t['m'] = 778;
  47747. t['n'] = 556;
  47748. t['o'] = 500;
  47749. t['p'] = 500;
  47750. t['q'] = 500;
  47751. t['r'] = 389;
  47752. t['s'] = 389;
  47753. t['t'] = 278;
  47754. t['u'] = 556;
  47755. t['v'] = 444;
  47756. t['w'] = 667;
  47757. t['x'] = 500;
  47758. t['y'] = 444;
  47759. t['z'] = 389;
  47760. t['braceleft'] = 348;
  47761. t['bar'] = 220;
  47762. t['braceright'] = 348;
  47763. t['asciitilde'] = 570;
  47764. t['exclamdown'] = 389;
  47765. t['cent'] = 500;
  47766. t['sterling'] = 500;
  47767. t['fraction'] = 167;
  47768. t['yen'] = 500;
  47769. t['florin'] = 500;
  47770. t['section'] = 500;
  47771. t['currency'] = 500;
  47772. t['quotesingle'] = 278;
  47773. t['quotedblleft'] = 500;
  47774. t['guillemotleft'] = 500;
  47775. t['guilsinglleft'] = 333;
  47776. t['guilsinglright'] = 333;
  47777. t['fi'] = 556;
  47778. t['fl'] = 556;
  47779. t['endash'] = 500;
  47780. t['dagger'] = 500;
  47781. t['daggerdbl'] = 500;
  47782. t['periodcentered'] = 250;
  47783. t['paragraph'] = 500;
  47784. t['bullet'] = 350;
  47785. t['quotesinglbase'] = 333;
  47786. t['quotedblbase'] = 500;
  47787. t['quotedblright'] = 500;
  47788. t['guillemotright'] = 500;
  47789. t['ellipsis'] = 1000;
  47790. t['perthousand'] = 1000;
  47791. t['questiondown'] = 500;
  47792. t['grave'] = 333;
  47793. t['acute'] = 333;
  47794. t['circumflex'] = 333;
  47795. t['tilde'] = 333;
  47796. t['macron'] = 333;
  47797. t['breve'] = 333;
  47798. t['dotaccent'] = 333;
  47799. t['dieresis'] = 333;
  47800. t['ring'] = 333;
  47801. t['cedilla'] = 333;
  47802. t['hungarumlaut'] = 333;
  47803. t['ogonek'] = 333;
  47804. t['caron'] = 333;
  47805. t['emdash'] = 1000;
  47806. t['AE'] = 944;
  47807. t['ordfeminine'] = 266;
  47808. t['Lslash'] = 611;
  47809. t['Oslash'] = 722;
  47810. t['OE'] = 944;
  47811. t['ordmasculine'] = 300;
  47812. t['ae'] = 722;
  47813. t['dotlessi'] = 278;
  47814. t['lslash'] = 278;
  47815. t['oslash'] = 500;
  47816. t['oe'] = 722;
  47817. t['germandbls'] = 500;
  47818. t['Idieresis'] = 389;
  47819. t['eacute'] = 444;
  47820. t['abreve'] = 500;
  47821. t['uhungarumlaut'] = 556;
  47822. t['ecaron'] = 444;
  47823. t['Ydieresis'] = 611;
  47824. t['divide'] = 570;
  47825. t['Yacute'] = 611;
  47826. t['Acircumflex'] = 667;
  47827. t['aacute'] = 500;
  47828. t['Ucircumflex'] = 722;
  47829. t['yacute'] = 444;
  47830. t['scommaaccent'] = 389;
  47831. t['ecircumflex'] = 444;
  47832. t['Uring'] = 722;
  47833. t['Udieresis'] = 722;
  47834. t['aogonek'] = 500;
  47835. t['Uacute'] = 722;
  47836. t['uogonek'] = 556;
  47837. t['Edieresis'] = 667;
  47838. t['Dcroat'] = 722;
  47839. t['commaaccent'] = 250;
  47840. t['copyright'] = 747;
  47841. t['Emacron'] = 667;
  47842. t['ccaron'] = 444;
  47843. t['aring'] = 500;
  47844. t['Ncommaaccent'] = 722;
  47845. t['lacute'] = 278;
  47846. t['agrave'] = 500;
  47847. t['Tcommaaccent'] = 611;
  47848. t['Cacute'] = 667;
  47849. t['atilde'] = 500;
  47850. t['Edotaccent'] = 667;
  47851. t['scaron'] = 389;
  47852. t['scedilla'] = 389;
  47853. t['iacute'] = 278;
  47854. t['lozenge'] = 494;
  47855. t['Rcaron'] = 667;
  47856. t['Gcommaaccent'] = 722;
  47857. t['ucircumflex'] = 556;
  47858. t['acircumflex'] = 500;
  47859. t['Amacron'] = 667;
  47860. t['rcaron'] = 389;
  47861. t['ccedilla'] = 444;
  47862. t['Zdotaccent'] = 611;
  47863. t['Thorn'] = 611;
  47864. t['Omacron'] = 722;
  47865. t['Racute'] = 667;
  47866. t['Sacute'] = 556;
  47867. t['dcaron'] = 608;
  47868. t['Umacron'] = 722;
  47869. t['uring'] = 556;
  47870. t['threesuperior'] = 300;
  47871. t['Ograve'] = 722;
  47872. t['Agrave'] = 667;
  47873. t['Abreve'] = 667;
  47874. t['multiply'] = 570;
  47875. t['uacute'] = 556;
  47876. t['Tcaron'] = 611;
  47877. t['partialdiff'] = 494;
  47878. t['ydieresis'] = 444;
  47879. t['Nacute'] = 722;
  47880. t['icircumflex'] = 278;
  47881. t['Ecircumflex'] = 667;
  47882. t['adieresis'] = 500;
  47883. t['edieresis'] = 444;
  47884. t['cacute'] = 444;
  47885. t['nacute'] = 556;
  47886. t['umacron'] = 556;
  47887. t['Ncaron'] = 722;
  47888. t['Iacute'] = 389;
  47889. t['plusminus'] = 570;
  47890. t['brokenbar'] = 220;
  47891. t['registered'] = 747;
  47892. t['Gbreve'] = 722;
  47893. t['Idotaccent'] = 389;
  47894. t['summation'] = 600;
  47895. t['Egrave'] = 667;
  47896. t['racute'] = 389;
  47897. t['omacron'] = 500;
  47898. t['Zacute'] = 611;
  47899. t['Zcaron'] = 611;
  47900. t['greaterequal'] = 549;
  47901. t['Eth'] = 722;
  47902. t['Ccedilla'] = 667;
  47903. t['lcommaaccent'] = 278;
  47904. t['tcaron'] = 366;
  47905. t['eogonek'] = 444;
  47906. t['Uogonek'] = 722;
  47907. t['Aacute'] = 667;
  47908. t['Adieresis'] = 667;
  47909. t['egrave'] = 444;
  47910. t['zacute'] = 389;
  47911. t['iogonek'] = 278;
  47912. t['Oacute'] = 722;
  47913. t['oacute'] = 500;
  47914. t['amacron'] = 500;
  47915. t['sacute'] = 389;
  47916. t['idieresis'] = 278;
  47917. t['Ocircumflex'] = 722;
  47918. t['Ugrave'] = 722;
  47919. t['Delta'] = 612;
  47920. t['thorn'] = 500;
  47921. t['twosuperior'] = 300;
  47922. t['Odieresis'] = 722;
  47923. t['mu'] = 576;
  47924. t['igrave'] = 278;
  47925. t['ohungarumlaut'] = 500;
  47926. t['Eogonek'] = 667;
  47927. t['dcroat'] = 500;
  47928. t['threequarters'] = 750;
  47929. t['Scedilla'] = 556;
  47930. t['lcaron'] = 382;
  47931. t['Kcommaaccent'] = 667;
  47932. t['Lacute'] = 611;
  47933. t['trademark'] = 1000;
  47934. t['edotaccent'] = 444;
  47935. t['Igrave'] = 389;
  47936. t['Imacron'] = 389;
  47937. t['Lcaron'] = 611;
  47938. t['onehalf'] = 750;
  47939. t['lessequal'] = 549;
  47940. t['ocircumflex'] = 500;
  47941. t['ntilde'] = 556;
  47942. t['Uhungarumlaut'] = 722;
  47943. t['Eacute'] = 667;
  47944. t['emacron'] = 444;
  47945. t['gbreve'] = 500;
  47946. t['onequarter'] = 750;
  47947. t['Scaron'] = 556;
  47948. t['Scommaaccent'] = 556;
  47949. t['Ohungarumlaut'] = 722;
  47950. t['degree'] = 400;
  47951. t['ograve'] = 500;
  47952. t['Ccaron'] = 667;
  47953. t['ugrave'] = 556;
  47954. t['radical'] = 549;
  47955. t['Dcaron'] = 722;
  47956. t['rcommaaccent'] = 389;
  47957. t['Ntilde'] = 722;
  47958. t['otilde'] = 500;
  47959. t['Rcommaaccent'] = 667;
  47960. t['Lcommaaccent'] = 611;
  47961. t['Atilde'] = 667;
  47962. t['Aogonek'] = 667;
  47963. t['Aring'] = 667;
  47964. t['Otilde'] = 722;
  47965. t['zdotaccent'] = 389;
  47966. t['Ecaron'] = 667;
  47967. t['Iogonek'] = 389;
  47968. t['kcommaaccent'] = 500;
  47969. t['minus'] = 606;
  47970. t['Icircumflex'] = 389;
  47971. t['ncaron'] = 556;
  47972. t['tcommaaccent'] = 278;
  47973. t['logicalnot'] = 606;
  47974. t['odieresis'] = 500;
  47975. t['udieresis'] = 556;
  47976. t['notequal'] = 549;
  47977. t['gcommaaccent'] = 500;
  47978. t['eth'] = 500;
  47979. t['zcaron'] = 389;
  47980. t['ncommaaccent'] = 556;
  47981. t['onesuperior'] = 300;
  47982. t['imacron'] = 278;
  47983. t['Euro'] = 500;
  47984. });
  47985. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47986. t['space'] = 250;
  47987. t['exclam'] = 333;
  47988. t['quotedbl'] = 420;
  47989. t['numbersign'] = 500;
  47990. t['dollar'] = 500;
  47991. t['percent'] = 833;
  47992. t['ampersand'] = 778;
  47993. t['quoteright'] = 333;
  47994. t['parenleft'] = 333;
  47995. t['parenright'] = 333;
  47996. t['asterisk'] = 500;
  47997. t['plus'] = 675;
  47998. t['comma'] = 250;
  47999. t['hyphen'] = 333;
  48000. t['period'] = 250;
  48001. t['slash'] = 278;
  48002. t['zero'] = 500;
  48003. t['one'] = 500;
  48004. t['two'] = 500;
  48005. t['three'] = 500;
  48006. t['four'] = 500;
  48007. t['five'] = 500;
  48008. t['six'] = 500;
  48009. t['seven'] = 500;
  48010. t['eight'] = 500;
  48011. t['nine'] = 500;
  48012. t['colon'] = 333;
  48013. t['semicolon'] = 333;
  48014. t['less'] = 675;
  48015. t['equal'] = 675;
  48016. t['greater'] = 675;
  48017. t['question'] = 500;
  48018. t['at'] = 920;
  48019. t['A'] = 611;
  48020. t['B'] = 611;
  48021. t['C'] = 667;
  48022. t['D'] = 722;
  48023. t['E'] = 611;
  48024. t['F'] = 611;
  48025. t['G'] = 722;
  48026. t['H'] = 722;
  48027. t['I'] = 333;
  48028. t['J'] = 444;
  48029. t['K'] = 667;
  48030. t['L'] = 556;
  48031. t['M'] = 833;
  48032. t['N'] = 667;
  48033. t['O'] = 722;
  48034. t['P'] = 611;
  48035. t['Q'] = 722;
  48036. t['R'] = 611;
  48037. t['S'] = 500;
  48038. t['T'] = 556;
  48039. t['U'] = 722;
  48040. t['V'] = 611;
  48041. t['W'] = 833;
  48042. t['X'] = 611;
  48043. t['Y'] = 556;
  48044. t['Z'] = 556;
  48045. t['bracketleft'] = 389;
  48046. t['backslash'] = 278;
  48047. t['bracketright'] = 389;
  48048. t['asciicircum'] = 422;
  48049. t['underscore'] = 500;
  48050. t['quoteleft'] = 333;
  48051. t['a'] = 500;
  48052. t['b'] = 500;
  48053. t['c'] = 444;
  48054. t['d'] = 500;
  48055. t['e'] = 444;
  48056. t['f'] = 278;
  48057. t['g'] = 500;
  48058. t['h'] = 500;
  48059. t['i'] = 278;
  48060. t['j'] = 278;
  48061. t['k'] = 444;
  48062. t['l'] = 278;
  48063. t['m'] = 722;
  48064. t['n'] = 500;
  48065. t['o'] = 500;
  48066. t['p'] = 500;
  48067. t['q'] = 500;
  48068. t['r'] = 389;
  48069. t['s'] = 389;
  48070. t['t'] = 278;
  48071. t['u'] = 500;
  48072. t['v'] = 444;
  48073. t['w'] = 667;
  48074. t['x'] = 444;
  48075. t['y'] = 444;
  48076. t['z'] = 389;
  48077. t['braceleft'] = 400;
  48078. t['bar'] = 275;
  48079. t['braceright'] = 400;
  48080. t['asciitilde'] = 541;
  48081. t['exclamdown'] = 389;
  48082. t['cent'] = 500;
  48083. t['sterling'] = 500;
  48084. t['fraction'] = 167;
  48085. t['yen'] = 500;
  48086. t['florin'] = 500;
  48087. t['section'] = 500;
  48088. t['currency'] = 500;
  48089. t['quotesingle'] = 214;
  48090. t['quotedblleft'] = 556;
  48091. t['guillemotleft'] = 500;
  48092. t['guilsinglleft'] = 333;
  48093. t['guilsinglright'] = 333;
  48094. t['fi'] = 500;
  48095. t['fl'] = 500;
  48096. t['endash'] = 500;
  48097. t['dagger'] = 500;
  48098. t['daggerdbl'] = 500;
  48099. t['periodcentered'] = 250;
  48100. t['paragraph'] = 523;
  48101. t['bullet'] = 350;
  48102. t['quotesinglbase'] = 333;
  48103. t['quotedblbase'] = 556;
  48104. t['quotedblright'] = 556;
  48105. t['guillemotright'] = 500;
  48106. t['ellipsis'] = 889;
  48107. t['perthousand'] = 1000;
  48108. t['questiondown'] = 500;
  48109. t['grave'] = 333;
  48110. t['acute'] = 333;
  48111. t['circumflex'] = 333;
  48112. t['tilde'] = 333;
  48113. t['macron'] = 333;
  48114. t['breve'] = 333;
  48115. t['dotaccent'] = 333;
  48116. t['dieresis'] = 333;
  48117. t['ring'] = 333;
  48118. t['cedilla'] = 333;
  48119. t['hungarumlaut'] = 333;
  48120. t['ogonek'] = 333;
  48121. t['caron'] = 333;
  48122. t['emdash'] = 889;
  48123. t['AE'] = 889;
  48124. t['ordfeminine'] = 276;
  48125. t['Lslash'] = 556;
  48126. t['Oslash'] = 722;
  48127. t['OE'] = 944;
  48128. t['ordmasculine'] = 310;
  48129. t['ae'] = 667;
  48130. t['dotlessi'] = 278;
  48131. t['lslash'] = 278;
  48132. t['oslash'] = 500;
  48133. t['oe'] = 667;
  48134. t['germandbls'] = 500;
  48135. t['Idieresis'] = 333;
  48136. t['eacute'] = 444;
  48137. t['abreve'] = 500;
  48138. t['uhungarumlaut'] = 500;
  48139. t['ecaron'] = 444;
  48140. t['Ydieresis'] = 556;
  48141. t['divide'] = 675;
  48142. t['Yacute'] = 556;
  48143. t['Acircumflex'] = 611;
  48144. t['aacute'] = 500;
  48145. t['Ucircumflex'] = 722;
  48146. t['yacute'] = 444;
  48147. t['scommaaccent'] = 389;
  48148. t['ecircumflex'] = 444;
  48149. t['Uring'] = 722;
  48150. t['Udieresis'] = 722;
  48151. t['aogonek'] = 500;
  48152. t['Uacute'] = 722;
  48153. t['uogonek'] = 500;
  48154. t['Edieresis'] = 611;
  48155. t['Dcroat'] = 722;
  48156. t['commaaccent'] = 250;
  48157. t['copyright'] = 760;
  48158. t['Emacron'] = 611;
  48159. t['ccaron'] = 444;
  48160. t['aring'] = 500;
  48161. t['Ncommaaccent'] = 667;
  48162. t['lacute'] = 278;
  48163. t['agrave'] = 500;
  48164. t['Tcommaaccent'] = 556;
  48165. t['Cacute'] = 667;
  48166. t['atilde'] = 500;
  48167. t['Edotaccent'] = 611;
  48168. t['scaron'] = 389;
  48169. t['scedilla'] = 389;
  48170. t['iacute'] = 278;
  48171. t['lozenge'] = 471;
  48172. t['Rcaron'] = 611;
  48173. t['Gcommaaccent'] = 722;
  48174. t['ucircumflex'] = 500;
  48175. t['acircumflex'] = 500;
  48176. t['Amacron'] = 611;
  48177. t['rcaron'] = 389;
  48178. t['ccedilla'] = 444;
  48179. t['Zdotaccent'] = 556;
  48180. t['Thorn'] = 611;
  48181. t['Omacron'] = 722;
  48182. t['Racute'] = 611;
  48183. t['Sacute'] = 500;
  48184. t['dcaron'] = 544;
  48185. t['Umacron'] = 722;
  48186. t['uring'] = 500;
  48187. t['threesuperior'] = 300;
  48188. t['Ograve'] = 722;
  48189. t['Agrave'] = 611;
  48190. t['Abreve'] = 611;
  48191. t['multiply'] = 675;
  48192. t['uacute'] = 500;
  48193. t['Tcaron'] = 556;
  48194. t['partialdiff'] = 476;
  48195. t['ydieresis'] = 444;
  48196. t['Nacute'] = 667;
  48197. t['icircumflex'] = 278;
  48198. t['Ecircumflex'] = 611;
  48199. t['adieresis'] = 500;
  48200. t['edieresis'] = 444;
  48201. t['cacute'] = 444;
  48202. t['nacute'] = 500;
  48203. t['umacron'] = 500;
  48204. t['Ncaron'] = 667;
  48205. t['Iacute'] = 333;
  48206. t['plusminus'] = 675;
  48207. t['brokenbar'] = 275;
  48208. t['registered'] = 760;
  48209. t['Gbreve'] = 722;
  48210. t['Idotaccent'] = 333;
  48211. t['summation'] = 600;
  48212. t['Egrave'] = 611;
  48213. t['racute'] = 389;
  48214. t['omacron'] = 500;
  48215. t['Zacute'] = 556;
  48216. t['Zcaron'] = 556;
  48217. t['greaterequal'] = 549;
  48218. t['Eth'] = 722;
  48219. t['Ccedilla'] = 667;
  48220. t['lcommaaccent'] = 278;
  48221. t['tcaron'] = 300;
  48222. t['eogonek'] = 444;
  48223. t['Uogonek'] = 722;
  48224. t['Aacute'] = 611;
  48225. t['Adieresis'] = 611;
  48226. t['egrave'] = 444;
  48227. t['zacute'] = 389;
  48228. t['iogonek'] = 278;
  48229. t['Oacute'] = 722;
  48230. t['oacute'] = 500;
  48231. t['amacron'] = 500;
  48232. t['sacute'] = 389;
  48233. t['idieresis'] = 278;
  48234. t['Ocircumflex'] = 722;
  48235. t['Ugrave'] = 722;
  48236. t['Delta'] = 612;
  48237. t['thorn'] = 500;
  48238. t['twosuperior'] = 300;
  48239. t['Odieresis'] = 722;
  48240. t['mu'] = 500;
  48241. t['igrave'] = 278;
  48242. t['ohungarumlaut'] = 500;
  48243. t['Eogonek'] = 611;
  48244. t['dcroat'] = 500;
  48245. t['threequarters'] = 750;
  48246. t['Scedilla'] = 500;
  48247. t['lcaron'] = 300;
  48248. t['Kcommaaccent'] = 667;
  48249. t['Lacute'] = 556;
  48250. t['trademark'] = 980;
  48251. t['edotaccent'] = 444;
  48252. t['Igrave'] = 333;
  48253. t['Imacron'] = 333;
  48254. t['Lcaron'] = 611;
  48255. t['onehalf'] = 750;
  48256. t['lessequal'] = 549;
  48257. t['ocircumflex'] = 500;
  48258. t['ntilde'] = 500;
  48259. t['Uhungarumlaut'] = 722;
  48260. t['Eacute'] = 611;
  48261. t['emacron'] = 444;
  48262. t['gbreve'] = 500;
  48263. t['onequarter'] = 750;
  48264. t['Scaron'] = 500;
  48265. t['Scommaaccent'] = 500;
  48266. t['Ohungarumlaut'] = 722;
  48267. t['degree'] = 400;
  48268. t['ograve'] = 500;
  48269. t['Ccaron'] = 667;
  48270. t['ugrave'] = 500;
  48271. t['radical'] = 453;
  48272. t['Dcaron'] = 722;
  48273. t['rcommaaccent'] = 389;
  48274. t['Ntilde'] = 667;
  48275. t['otilde'] = 500;
  48276. t['Rcommaaccent'] = 611;
  48277. t['Lcommaaccent'] = 556;
  48278. t['Atilde'] = 611;
  48279. t['Aogonek'] = 611;
  48280. t['Aring'] = 611;
  48281. t['Otilde'] = 722;
  48282. t['zdotaccent'] = 389;
  48283. t['Ecaron'] = 611;
  48284. t['Iogonek'] = 333;
  48285. t['kcommaaccent'] = 444;
  48286. t['minus'] = 675;
  48287. t['Icircumflex'] = 333;
  48288. t['ncaron'] = 500;
  48289. t['tcommaaccent'] = 278;
  48290. t['logicalnot'] = 675;
  48291. t['odieresis'] = 500;
  48292. t['udieresis'] = 500;
  48293. t['notequal'] = 549;
  48294. t['gcommaaccent'] = 500;
  48295. t['eth'] = 500;
  48296. t['zcaron'] = 389;
  48297. t['ncommaaccent'] = 500;
  48298. t['onesuperior'] = 300;
  48299. t['imacron'] = 278;
  48300. t['Euro'] = 500;
  48301. });
  48302. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  48303. t['space'] = 278;
  48304. t['a1'] = 974;
  48305. t['a2'] = 961;
  48306. t['a202'] = 974;
  48307. t['a3'] = 980;
  48308. t['a4'] = 719;
  48309. t['a5'] = 789;
  48310. t['a119'] = 790;
  48311. t['a118'] = 791;
  48312. t['a117'] = 690;
  48313. t['a11'] = 960;
  48314. t['a12'] = 939;
  48315. t['a13'] = 549;
  48316. t['a14'] = 855;
  48317. t['a15'] = 911;
  48318. t['a16'] = 933;
  48319. t['a105'] = 911;
  48320. t['a17'] = 945;
  48321. t['a18'] = 974;
  48322. t['a19'] = 755;
  48323. t['a20'] = 846;
  48324. t['a21'] = 762;
  48325. t['a22'] = 761;
  48326. t['a23'] = 571;
  48327. t['a24'] = 677;
  48328. t['a25'] = 763;
  48329. t['a26'] = 760;
  48330. t['a27'] = 759;
  48331. t['a28'] = 754;
  48332. t['a6'] = 494;
  48333. t['a7'] = 552;
  48334. t['a8'] = 537;
  48335. t['a9'] = 577;
  48336. t['a10'] = 692;
  48337. t['a29'] = 786;
  48338. t['a30'] = 788;
  48339. t['a31'] = 788;
  48340. t['a32'] = 790;
  48341. t['a33'] = 793;
  48342. t['a34'] = 794;
  48343. t['a35'] = 816;
  48344. t['a36'] = 823;
  48345. t['a37'] = 789;
  48346. t['a38'] = 841;
  48347. t['a39'] = 823;
  48348. t['a40'] = 833;
  48349. t['a41'] = 816;
  48350. t['a42'] = 831;
  48351. t['a43'] = 923;
  48352. t['a44'] = 744;
  48353. t['a45'] = 723;
  48354. t['a46'] = 749;
  48355. t['a47'] = 790;
  48356. t['a48'] = 792;
  48357. t['a49'] = 695;
  48358. t['a50'] = 776;
  48359. t['a51'] = 768;
  48360. t['a52'] = 792;
  48361. t['a53'] = 759;
  48362. t['a54'] = 707;
  48363. t['a55'] = 708;
  48364. t['a56'] = 682;
  48365. t['a57'] = 701;
  48366. t['a58'] = 826;
  48367. t['a59'] = 815;
  48368. t['a60'] = 789;
  48369. t['a61'] = 789;
  48370. t['a62'] = 707;
  48371. t['a63'] = 687;
  48372. t['a64'] = 696;
  48373. t['a65'] = 689;
  48374. t['a66'] = 786;
  48375. t['a67'] = 787;
  48376. t['a68'] = 713;
  48377. t['a69'] = 791;
  48378. t['a70'] = 785;
  48379. t['a71'] = 791;
  48380. t['a72'] = 873;
  48381. t['a73'] = 761;
  48382. t['a74'] = 762;
  48383. t['a203'] = 762;
  48384. t['a75'] = 759;
  48385. t['a204'] = 759;
  48386. t['a76'] = 892;
  48387. t['a77'] = 892;
  48388. t['a78'] = 788;
  48389. t['a79'] = 784;
  48390. t['a81'] = 438;
  48391. t['a82'] = 138;
  48392. t['a83'] = 277;
  48393. t['a84'] = 415;
  48394. t['a97'] = 392;
  48395. t['a98'] = 392;
  48396. t['a99'] = 668;
  48397. t['a100'] = 668;
  48398. t['a89'] = 390;
  48399. t['a90'] = 390;
  48400. t['a93'] = 317;
  48401. t['a94'] = 317;
  48402. t['a91'] = 276;
  48403. t['a92'] = 276;
  48404. t['a205'] = 509;
  48405. t['a85'] = 509;
  48406. t['a206'] = 410;
  48407. t['a86'] = 410;
  48408. t['a87'] = 234;
  48409. t['a88'] = 234;
  48410. t['a95'] = 334;
  48411. t['a96'] = 334;
  48412. t['a101'] = 732;
  48413. t['a102'] = 544;
  48414. t['a103'] = 544;
  48415. t['a104'] = 910;
  48416. t['a106'] = 667;
  48417. t['a107'] = 760;
  48418. t['a108'] = 760;
  48419. t['a112'] = 776;
  48420. t['a111'] = 595;
  48421. t['a110'] = 694;
  48422. t['a109'] = 626;
  48423. t['a120'] = 788;
  48424. t['a121'] = 788;
  48425. t['a122'] = 788;
  48426. t['a123'] = 788;
  48427. t['a124'] = 788;
  48428. t['a125'] = 788;
  48429. t['a126'] = 788;
  48430. t['a127'] = 788;
  48431. t['a128'] = 788;
  48432. t['a129'] = 788;
  48433. t['a130'] = 788;
  48434. t['a131'] = 788;
  48435. t['a132'] = 788;
  48436. t['a133'] = 788;
  48437. t['a134'] = 788;
  48438. t['a135'] = 788;
  48439. t['a136'] = 788;
  48440. t['a137'] = 788;
  48441. t['a138'] = 788;
  48442. t['a139'] = 788;
  48443. t['a140'] = 788;
  48444. t['a141'] = 788;
  48445. t['a142'] = 788;
  48446. t['a143'] = 788;
  48447. t['a144'] = 788;
  48448. t['a145'] = 788;
  48449. t['a146'] = 788;
  48450. t['a147'] = 788;
  48451. t['a148'] = 788;
  48452. t['a149'] = 788;
  48453. t['a150'] = 788;
  48454. t['a151'] = 788;
  48455. t['a152'] = 788;
  48456. t['a153'] = 788;
  48457. t['a154'] = 788;
  48458. t['a155'] = 788;
  48459. t['a156'] = 788;
  48460. t['a157'] = 788;
  48461. t['a158'] = 788;
  48462. t['a159'] = 788;
  48463. t['a160'] = 894;
  48464. t['a161'] = 838;
  48465. t['a163'] = 1016;
  48466. t['a164'] = 458;
  48467. t['a196'] = 748;
  48468. t['a165'] = 924;
  48469. t['a192'] = 748;
  48470. t['a166'] = 918;
  48471. t['a167'] = 927;
  48472. t['a168'] = 928;
  48473. t['a169'] = 928;
  48474. t['a170'] = 834;
  48475. t['a171'] = 873;
  48476. t['a172'] = 828;
  48477. t['a173'] = 924;
  48478. t['a162'] = 924;
  48479. t['a174'] = 917;
  48480. t['a175'] = 930;
  48481. t['a176'] = 931;
  48482. t['a177'] = 463;
  48483. t['a178'] = 883;
  48484. t['a179'] = 836;
  48485. t['a193'] = 836;
  48486. t['a180'] = 867;
  48487. t['a199'] = 867;
  48488. t['a181'] = 696;
  48489. t['a200'] = 696;
  48490. t['a182'] = 874;
  48491. t['a201'] = 874;
  48492. t['a183'] = 760;
  48493. t['a184'] = 946;
  48494. t['a197'] = 771;
  48495. t['a185'] = 865;
  48496. t['a194'] = 771;
  48497. t['a198'] = 888;
  48498. t['a186'] = 967;
  48499. t['a195'] = 888;
  48500. t['a187'] = 831;
  48501. t['a188'] = 873;
  48502. t['a189'] = 927;
  48503. t['a190'] = 970;
  48504. t['a191'] = 918;
  48505. });
  48506. });
  48507. exports.getMetrics = getMetrics;
  48508. /***/ }),
  48509. /* 31 */
  48510. /***/ (function(module, exports, __w_pdfjs_require__) {
  48511. "use strict";
  48512. var sharedUtil = __w_pdfjs_require__(0);
  48513. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  48514. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  48515. var MASK_HIGH = 0xffff0000;
  48516. var MASK_LOW = 0xffff;
  48517. function MurmurHash3_64(seed) {
  48518. var SEED = 0xc3d2e1f0;
  48519. this.h1 = seed ? seed & 0xffffffff : SEED;
  48520. this.h2 = seed ? seed & 0xffffffff : SEED;
  48521. }
  48522. var alwaysUseUint32ArrayView = false;
  48523. try {
  48524. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  48525. } catch (e) {
  48526. alwaysUseUint32ArrayView = true;
  48527. }
  48528. MurmurHash3_64.prototype = {
  48529. update: function MurmurHash3_64_update(input) {
  48530. var useUint32ArrayView = alwaysUseUint32ArrayView;
  48531. var i;
  48532. if (typeof input === 'string') {
  48533. var data = new Uint8Array(input.length * 2);
  48534. var length = 0;
  48535. for (i = 0; i < input.length; i++) {
  48536. var code = input.charCodeAt(i);
  48537. if (code <= 0xff) {
  48538. data[length++] = code;
  48539. } else {
  48540. data[length++] = code >>> 8;
  48541. data[length++] = code & 0xff;
  48542. }
  48543. }
  48544. } else if (input instanceof Uint8Array) {
  48545. data = input;
  48546. length = data.length;
  48547. } else if (typeof input === 'object' && 'length' in input) {
  48548. data = input;
  48549. length = data.length;
  48550. useUint32ArrayView = true;
  48551. } else {
  48552. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  48553. }
  48554. var blockCounts = length >> 2;
  48555. var tailLength = length - blockCounts * 4;
  48556. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  48557. var k1 = 0;
  48558. var k2 = 0;
  48559. var h1 = this.h1;
  48560. var h2 = this.h2;
  48561. var C1 = 0xcc9e2d51;
  48562. var C2 = 0x1b873593;
  48563. var C1_LOW = C1 & MASK_LOW;
  48564. var C2_LOW = C2 & MASK_LOW;
  48565. for (i = 0; i < blockCounts; i++) {
  48566. if (i & 1) {
  48567. k1 = dataUint32[i];
  48568. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48569. k1 = k1 << 15 | k1 >>> 17;
  48570. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48571. h1 ^= k1;
  48572. h1 = h1 << 13 | h1 >>> 19;
  48573. h1 = h1 * 5 + 0xe6546b64;
  48574. } else {
  48575. k2 = dataUint32[i];
  48576. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  48577. k2 = k2 << 15 | k2 >>> 17;
  48578. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  48579. h2 ^= k2;
  48580. h2 = h2 << 13 | h2 >>> 19;
  48581. h2 = h2 * 5 + 0xe6546b64;
  48582. }
  48583. }
  48584. k1 = 0;
  48585. switch (tailLength) {
  48586. case 3:
  48587. k1 ^= data[blockCounts * 4 + 2] << 16;
  48588. case 2:
  48589. k1 ^= data[blockCounts * 4 + 1] << 8;
  48590. case 1:
  48591. k1 ^= data[blockCounts * 4];
  48592. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48593. k1 = k1 << 15 | k1 >>> 17;
  48594. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48595. if (blockCounts & 1) {
  48596. h1 ^= k1;
  48597. } else {
  48598. h2 ^= k1;
  48599. }
  48600. }
  48601. this.h1 = h1;
  48602. this.h2 = h2;
  48603. return this;
  48604. },
  48605. hexdigest: function MurmurHash3_64_hexdigest() {
  48606. var h1 = this.h1;
  48607. var h2 = this.h2;
  48608. h1 ^= h2 >>> 1;
  48609. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  48610. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  48611. h1 ^= h2 >>> 1;
  48612. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  48613. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  48614. h1 ^= h2 >>> 1;
  48615. for (var i = 0, arr = [
  48616. h1,
  48617. h2
  48618. ], str = ''; i < arr.length; i++) {
  48619. var hex = (arr[i] >>> 0).toString(16);
  48620. while (hex.length < 8) {
  48621. hex = '0' + hex;
  48622. }
  48623. str += hex;
  48624. }
  48625. return str;
  48626. }
  48627. };
  48628. return MurmurHash3_64;
  48629. }();
  48630. exports.MurmurHash3_64 = MurmurHash3_64;
  48631. /***/ }),
  48632. /* 32 */
  48633. /***/ (function(module, exports, __w_pdfjs_require__) {
  48634. "use strict";
  48635. var sharedUtil = __w_pdfjs_require__(0);
  48636. var corePrimitives = __w_pdfjs_require__(1);
  48637. var coreFunction = __w_pdfjs_require__(6);
  48638. var coreColorSpace = __w_pdfjs_require__(3);
  48639. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  48640. var MissingDataException = sharedUtil.MissingDataException;
  48641. var Util = sharedUtil.Util;
  48642. var assert = sharedUtil.assert;
  48643. var error = sharedUtil.error;
  48644. var info = sharedUtil.info;
  48645. var warn = sharedUtil.warn;
  48646. var isStream = corePrimitives.isStream;
  48647. var PDFFunction = coreFunction.PDFFunction;
  48648. var ColorSpace = coreColorSpace.ColorSpace;
  48649. var ShadingType = {
  48650. FUNCTION_BASED: 1,
  48651. AXIAL: 2,
  48652. RADIAL: 3,
  48653. FREE_FORM_MESH: 4,
  48654. LATTICE_FORM_MESH: 5,
  48655. COONS_PATCH_MESH: 6,
  48656. TENSOR_PATCH_MESH: 7
  48657. };
  48658. var Pattern = function PatternClosure() {
  48659. function Pattern() {
  48660. error('should not call Pattern constructor');
  48661. }
  48662. Pattern.prototype = {
  48663. getPattern: function Pattern_getPattern(ctx) {
  48664. error('Should not call Pattern.getStyle: ' + ctx);
  48665. }
  48666. };
  48667. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  48668. var dict = isStream(shading) ? shading.dict : shading;
  48669. var type = dict.get('ShadingType');
  48670. try {
  48671. switch (type) {
  48672. case ShadingType.AXIAL:
  48673. case ShadingType.RADIAL:
  48674. return new Shadings.RadialAxial(dict, matrix, xref, res);
  48675. case ShadingType.FREE_FORM_MESH:
  48676. case ShadingType.LATTICE_FORM_MESH:
  48677. case ShadingType.COONS_PATCH_MESH:
  48678. case ShadingType.TENSOR_PATCH_MESH:
  48679. return new Shadings.Mesh(shading, matrix, xref, res);
  48680. default:
  48681. throw new Error('Unsupported ShadingType: ' + type);
  48682. }
  48683. } catch (ex) {
  48684. if (ex instanceof MissingDataException) {
  48685. throw ex;
  48686. }
  48687. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  48688. warn(ex);
  48689. return new Shadings.Dummy();
  48690. }
  48691. };
  48692. return Pattern;
  48693. }();
  48694. var Shadings = {};
  48695. Shadings.SMALL_NUMBER = 1e-6;
  48696. Shadings.RadialAxial = function RadialAxialClosure() {
  48697. function RadialAxial(dict, matrix, xref, res) {
  48698. this.matrix = matrix;
  48699. this.coordsArr = dict.getArray('Coords');
  48700. this.shadingType = dict.get('ShadingType');
  48701. this.type = 'Pattern';
  48702. var cs = dict.get('ColorSpace', 'CS');
  48703. cs = ColorSpace.parse(cs, xref, res);
  48704. this.cs = cs;
  48705. var t0 = 0.0, t1 = 1.0;
  48706. if (dict.has('Domain')) {
  48707. var domainArr = dict.getArray('Domain');
  48708. t0 = domainArr[0];
  48709. t1 = domainArr[1];
  48710. }
  48711. var extendStart = false, extendEnd = false;
  48712. if (dict.has('Extend')) {
  48713. var extendArr = dict.getArray('Extend');
  48714. extendStart = extendArr[0];
  48715. extendEnd = extendArr[1];
  48716. }
  48717. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  48718. var x1 = this.coordsArr[0];
  48719. var y1 = this.coordsArr[1];
  48720. var r1 = this.coordsArr[2];
  48721. var x2 = this.coordsArr[3];
  48722. var y2 = this.coordsArr[4];
  48723. var r2 = this.coordsArr[5];
  48724. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  48725. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  48726. warn('Unsupported radial gradient.');
  48727. }
  48728. }
  48729. this.extendStart = extendStart;
  48730. this.extendEnd = extendEnd;
  48731. var fnObj = dict.get('Function');
  48732. var fn = PDFFunction.parseArray(xref, fnObj);
  48733. var diff = t1 - t0;
  48734. var step = diff / 10;
  48735. var colorStops = this.colorStops = [];
  48736. if (t0 >= t1 || step <= 0) {
  48737. info('Bad shading domain.');
  48738. return;
  48739. }
  48740. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  48741. var rgbColor;
  48742. for (var i = t0; i <= t1; i += step) {
  48743. ratio[0] = i;
  48744. fn(ratio, 0, color, 0);
  48745. rgbColor = cs.getRgb(color, 0);
  48746. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48747. colorStops.push([
  48748. (i - t0) / diff,
  48749. cssColor
  48750. ]);
  48751. }
  48752. var background = 'transparent';
  48753. if (dict.has('Background')) {
  48754. rgbColor = cs.getRgb(dict.get('Background'), 0);
  48755. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48756. }
  48757. if (!extendStart) {
  48758. colorStops.unshift([
  48759. 0,
  48760. background
  48761. ]);
  48762. colorStops[1][0] += Shadings.SMALL_NUMBER;
  48763. }
  48764. if (!extendEnd) {
  48765. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  48766. colorStops.push([
  48767. 1,
  48768. background
  48769. ]);
  48770. }
  48771. this.colorStops = colorStops;
  48772. }
  48773. RadialAxial.prototype = {
  48774. getIR: function RadialAxial_getIR() {
  48775. var coordsArr = this.coordsArr;
  48776. var shadingType = this.shadingType;
  48777. var type, p0, p1, r0, r1;
  48778. if (shadingType === ShadingType.AXIAL) {
  48779. p0 = [
  48780. coordsArr[0],
  48781. coordsArr[1]
  48782. ];
  48783. p1 = [
  48784. coordsArr[2],
  48785. coordsArr[3]
  48786. ];
  48787. r0 = null;
  48788. r1 = null;
  48789. type = 'axial';
  48790. } else if (shadingType === ShadingType.RADIAL) {
  48791. p0 = [
  48792. coordsArr[0],
  48793. coordsArr[1]
  48794. ];
  48795. p1 = [
  48796. coordsArr[3],
  48797. coordsArr[4]
  48798. ];
  48799. r0 = coordsArr[2];
  48800. r1 = coordsArr[5];
  48801. type = 'radial';
  48802. } else {
  48803. error('getPattern type unknown: ' + shadingType);
  48804. }
  48805. var matrix = this.matrix;
  48806. if (matrix) {
  48807. p0 = Util.applyTransform(p0, matrix);
  48808. p1 = Util.applyTransform(p1, matrix);
  48809. if (shadingType === ShadingType.RADIAL) {
  48810. var scale = Util.singularValueDecompose2dScale(matrix);
  48811. r0 *= scale[0];
  48812. r1 *= scale[1];
  48813. }
  48814. }
  48815. return [
  48816. 'RadialAxial',
  48817. type,
  48818. this.colorStops,
  48819. p0,
  48820. p1,
  48821. r0,
  48822. r1
  48823. ];
  48824. }
  48825. };
  48826. return RadialAxial;
  48827. }();
  48828. Shadings.Mesh = function MeshClosure() {
  48829. function MeshStreamReader(stream, context) {
  48830. this.stream = stream;
  48831. this.context = context;
  48832. this.buffer = 0;
  48833. this.bufferLength = 0;
  48834. var numComps = context.numComps;
  48835. this.tmpCompsBuf = new Float32Array(numComps);
  48836. var csNumComps = context.colorSpace.numComps;
  48837. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48838. }
  48839. MeshStreamReader.prototype = {
  48840. get hasData() {
  48841. if (this.stream.end) {
  48842. return this.stream.pos < this.stream.end;
  48843. }
  48844. if (this.bufferLength > 0) {
  48845. return true;
  48846. }
  48847. var nextByte = this.stream.getByte();
  48848. if (nextByte < 0) {
  48849. return false;
  48850. }
  48851. this.buffer = nextByte;
  48852. this.bufferLength = 8;
  48853. return true;
  48854. },
  48855. readBits: function MeshStreamReader_readBits(n) {
  48856. var buffer = this.buffer;
  48857. var bufferLength = this.bufferLength;
  48858. if (n === 32) {
  48859. if (bufferLength === 0) {
  48860. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48861. }
  48862. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48863. var nextByte = this.stream.getByte();
  48864. this.buffer = nextByte & (1 << bufferLength) - 1;
  48865. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48866. }
  48867. if (n === 8 && bufferLength === 0) {
  48868. return this.stream.getByte();
  48869. }
  48870. while (bufferLength < n) {
  48871. buffer = buffer << 8 | this.stream.getByte();
  48872. bufferLength += 8;
  48873. }
  48874. bufferLength -= n;
  48875. this.bufferLength = bufferLength;
  48876. this.buffer = buffer & (1 << bufferLength) - 1;
  48877. return buffer >> bufferLength;
  48878. },
  48879. align: function MeshStreamReader_align() {
  48880. this.buffer = 0;
  48881. this.bufferLength = 0;
  48882. },
  48883. readFlag: function MeshStreamReader_readFlag() {
  48884. return this.readBits(this.context.bitsPerFlag);
  48885. },
  48886. readCoordinate: function MeshStreamReader_readCoordinate() {
  48887. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48888. var xi = this.readBits(bitsPerCoordinate);
  48889. var yi = this.readBits(bitsPerCoordinate);
  48890. var decode = this.context.decode;
  48891. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48892. return [
  48893. xi * scale * (decode[1] - decode[0]) + decode[0],
  48894. yi * scale * (decode[3] - decode[2]) + decode[2]
  48895. ];
  48896. },
  48897. readComponents: function MeshStreamReader_readComponents() {
  48898. var numComps = this.context.numComps;
  48899. var bitsPerComponent = this.context.bitsPerComponent;
  48900. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48901. var decode = this.context.decode;
  48902. var components = this.tmpCompsBuf;
  48903. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48904. var ci = this.readBits(bitsPerComponent);
  48905. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48906. }
  48907. var color = this.tmpCsCompsBuf;
  48908. if (this.context.colorFn) {
  48909. this.context.colorFn(components, 0, color, 0);
  48910. }
  48911. return this.context.colorSpace.getRgb(color, 0);
  48912. }
  48913. };
  48914. function decodeType4Shading(mesh, reader) {
  48915. var coords = mesh.coords;
  48916. var colors = mesh.colors;
  48917. var operators = [];
  48918. var ps = [];
  48919. var verticesLeft = 0;
  48920. while (reader.hasData) {
  48921. var f = reader.readFlag();
  48922. var coord = reader.readCoordinate();
  48923. var color = reader.readComponents();
  48924. if (verticesLeft === 0) {
  48925. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48926. switch (f) {
  48927. case 0:
  48928. verticesLeft = 3;
  48929. break;
  48930. case 1:
  48931. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48932. verticesLeft = 1;
  48933. break;
  48934. case 2:
  48935. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48936. verticesLeft = 1;
  48937. break;
  48938. }
  48939. operators.push(f);
  48940. }
  48941. ps.push(coords.length);
  48942. coords.push(coord);
  48943. colors.push(color);
  48944. verticesLeft--;
  48945. reader.align();
  48946. }
  48947. mesh.figures.push({
  48948. type: 'triangles',
  48949. coords: new Int32Array(ps),
  48950. colors: new Int32Array(ps)
  48951. });
  48952. }
  48953. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48954. var coords = mesh.coords;
  48955. var colors = mesh.colors;
  48956. var ps = [];
  48957. while (reader.hasData) {
  48958. var coord = reader.readCoordinate();
  48959. var color = reader.readComponents();
  48960. ps.push(coords.length);
  48961. coords.push(coord);
  48962. colors.push(color);
  48963. }
  48964. mesh.figures.push({
  48965. type: 'lattice',
  48966. coords: new Int32Array(ps),
  48967. colors: new Int32Array(ps),
  48968. verticesPerRow: verticesPerRow
  48969. });
  48970. }
  48971. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48972. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48973. var TRIANGLE_DENSITY = 20;
  48974. var getB = function getBClosure() {
  48975. function buildB(count) {
  48976. var lut = [];
  48977. for (var i = 0; i <= count; i++) {
  48978. var t = i / count, t_ = 1 - t;
  48979. lut.push(new Float32Array([
  48980. t_ * t_ * t_,
  48981. 3 * t * t_ * t_,
  48982. 3 * t * t * t_,
  48983. t * t * t
  48984. ]));
  48985. }
  48986. return lut;
  48987. }
  48988. var cache = [];
  48989. return function getB(count) {
  48990. if (!cache[count]) {
  48991. cache[count] = buildB(count);
  48992. }
  48993. return cache[count];
  48994. };
  48995. }();
  48996. function buildFigureFromPatch(mesh, index) {
  48997. var figure = mesh.figures[index];
  48998. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  48999. var coords = mesh.coords, colors = mesh.colors;
  49000. var pi = figure.coords;
  49001. var ci = figure.colors;
  49002. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49003. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49004. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49005. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49006. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  49007. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  49008. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  49009. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  49010. var verticesPerRow = splitXBy + 1;
  49011. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  49012. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  49013. var k = 0;
  49014. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  49015. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  49016. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  49017. for (var row = 0; row <= splitYBy; row++) {
  49018. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  49019. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  49020. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  49021. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  49022. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  49023. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  49024. for (var col = 0; col <= splitXBy; col++, k++) {
  49025. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  49026. continue;
  49027. }
  49028. var x = 0, y = 0;
  49029. var q = 0;
  49030. for (var i = 0; i <= 3; i++) {
  49031. for (var j = 0; j <= 3; j++, q++) {
  49032. var m = bRow[row][i] * bCol[col][j];
  49033. x += coords[pi[q]][0] * m;
  49034. y += coords[pi[q]][1] * m;
  49035. }
  49036. }
  49037. figureCoords[k] = coords.length;
  49038. coords.push([
  49039. x,
  49040. y
  49041. ]);
  49042. figureColors[k] = colors.length;
  49043. var newColor = new Uint8Array(3);
  49044. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  49045. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  49046. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  49047. colors.push(newColor);
  49048. }
  49049. }
  49050. figureCoords[0] = pi[0];
  49051. figureColors[0] = ci[0];
  49052. figureCoords[splitXBy] = pi[3];
  49053. figureColors[splitXBy] = ci[1];
  49054. figureCoords[verticesPerRow * splitYBy] = pi[12];
  49055. figureColors[verticesPerRow * splitYBy] = ci[2];
  49056. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  49057. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  49058. mesh.figures[index] = {
  49059. type: 'lattice',
  49060. coords: figureCoords,
  49061. colors: figureColors,
  49062. verticesPerRow: verticesPerRow
  49063. };
  49064. }
  49065. function decodeType6Shading(mesh, reader) {
  49066. var coords = mesh.coords;
  49067. var colors = mesh.colors;
  49068. var ps = new Int32Array(16);
  49069. var cs = new Int32Array(4);
  49070. while (reader.hasData) {
  49071. var f = reader.readFlag();
  49072. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  49073. var i, ii;
  49074. var pi = coords.length;
  49075. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  49076. coords.push(reader.readCoordinate());
  49077. }
  49078. var ci = colors.length;
  49079. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49080. colors.push(reader.readComponents());
  49081. }
  49082. var tmp1, tmp2, tmp3, tmp4;
  49083. switch (f) {
  49084. case 0:
  49085. ps[12] = pi + 3;
  49086. ps[13] = pi + 4;
  49087. ps[14] = pi + 5;
  49088. ps[15] = pi + 6;
  49089. ps[8] = pi + 2;
  49090. ps[11] = pi + 7;
  49091. ps[4] = pi + 1;
  49092. ps[7] = pi + 8;
  49093. ps[0] = pi;
  49094. ps[1] = pi + 11;
  49095. ps[2] = pi + 10;
  49096. ps[3] = pi + 9;
  49097. cs[2] = ci + 1;
  49098. cs[3] = ci + 2;
  49099. cs[0] = ci;
  49100. cs[1] = ci + 3;
  49101. break;
  49102. case 1:
  49103. tmp1 = ps[12];
  49104. tmp2 = ps[13];
  49105. tmp3 = ps[14];
  49106. tmp4 = ps[15];
  49107. ps[12] = tmp4;
  49108. ps[13] = pi + 0;
  49109. ps[14] = pi + 1;
  49110. ps[15] = pi + 2;
  49111. ps[8] = tmp3;
  49112. ps[11] = pi + 3;
  49113. ps[4] = tmp2;
  49114. ps[7] = pi + 4;
  49115. ps[0] = tmp1;
  49116. ps[1] = pi + 7;
  49117. ps[2] = pi + 6;
  49118. ps[3] = pi + 5;
  49119. tmp1 = cs[2];
  49120. tmp2 = cs[3];
  49121. cs[2] = tmp2;
  49122. cs[3] = ci;
  49123. cs[0] = tmp1;
  49124. cs[1] = ci + 1;
  49125. break;
  49126. case 2:
  49127. tmp1 = ps[15];
  49128. tmp2 = ps[11];
  49129. ps[12] = ps[3];
  49130. ps[13] = pi + 0;
  49131. ps[14] = pi + 1;
  49132. ps[15] = pi + 2;
  49133. ps[8] = ps[7];
  49134. ps[11] = pi + 3;
  49135. ps[4] = tmp2;
  49136. ps[7] = pi + 4;
  49137. ps[0] = tmp1;
  49138. ps[1] = pi + 7;
  49139. ps[2] = pi + 6;
  49140. ps[3] = pi + 5;
  49141. tmp1 = cs[3];
  49142. cs[2] = cs[1];
  49143. cs[3] = ci;
  49144. cs[0] = tmp1;
  49145. cs[1] = ci + 1;
  49146. break;
  49147. case 3:
  49148. ps[12] = ps[0];
  49149. ps[13] = pi + 0;
  49150. ps[14] = pi + 1;
  49151. ps[15] = pi + 2;
  49152. ps[8] = ps[1];
  49153. ps[11] = pi + 3;
  49154. ps[4] = ps[2];
  49155. ps[7] = pi + 4;
  49156. ps[0] = ps[3];
  49157. ps[1] = pi + 7;
  49158. ps[2] = pi + 6;
  49159. ps[3] = pi + 5;
  49160. cs[2] = cs[0];
  49161. cs[3] = ci;
  49162. cs[0] = cs[1];
  49163. cs[1] = ci + 1;
  49164. break;
  49165. }
  49166. ps[5] = coords.length;
  49167. coords.push([
  49168. (-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,
  49169. (-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
  49170. ]);
  49171. ps[6] = coords.length;
  49172. coords.push([
  49173. (-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,
  49174. (-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
  49175. ]);
  49176. ps[9] = coords.length;
  49177. coords.push([
  49178. (-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,
  49179. (-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
  49180. ]);
  49181. ps[10] = coords.length;
  49182. coords.push([
  49183. (-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,
  49184. (-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
  49185. ]);
  49186. mesh.figures.push({
  49187. type: 'patch',
  49188. coords: new Int32Array(ps),
  49189. colors: new Int32Array(cs)
  49190. });
  49191. }
  49192. }
  49193. function decodeType7Shading(mesh, reader) {
  49194. var coords = mesh.coords;
  49195. var colors = mesh.colors;
  49196. var ps = new Int32Array(16);
  49197. var cs = new Int32Array(4);
  49198. while (reader.hasData) {
  49199. var f = reader.readFlag();
  49200. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  49201. var i, ii;
  49202. var pi = coords.length;
  49203. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  49204. coords.push(reader.readCoordinate());
  49205. }
  49206. var ci = colors.length;
  49207. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49208. colors.push(reader.readComponents());
  49209. }
  49210. var tmp1, tmp2, tmp3, tmp4;
  49211. switch (f) {
  49212. case 0:
  49213. ps[12] = pi + 3;
  49214. ps[13] = pi + 4;
  49215. ps[14] = pi + 5;
  49216. ps[15] = pi + 6;
  49217. ps[8] = pi + 2;
  49218. ps[9] = pi + 13;
  49219. ps[10] = pi + 14;
  49220. ps[11] = pi + 7;
  49221. ps[4] = pi + 1;
  49222. ps[5] = pi + 12;
  49223. ps[6] = pi + 15;
  49224. ps[7] = pi + 8;
  49225. ps[0] = pi;
  49226. ps[1] = pi + 11;
  49227. ps[2] = pi + 10;
  49228. ps[3] = pi + 9;
  49229. cs[2] = ci + 1;
  49230. cs[3] = ci + 2;
  49231. cs[0] = ci;
  49232. cs[1] = ci + 3;
  49233. break;
  49234. case 1:
  49235. tmp1 = ps[12];
  49236. tmp2 = ps[13];
  49237. tmp3 = ps[14];
  49238. tmp4 = ps[15];
  49239. ps[12] = tmp4;
  49240. ps[13] = pi + 0;
  49241. ps[14] = pi + 1;
  49242. ps[15] = pi + 2;
  49243. ps[8] = tmp3;
  49244. ps[9] = pi + 9;
  49245. ps[10] = pi + 10;
  49246. ps[11] = pi + 3;
  49247. ps[4] = tmp2;
  49248. ps[5] = pi + 8;
  49249. ps[6] = pi + 11;
  49250. ps[7] = pi + 4;
  49251. ps[0] = tmp1;
  49252. ps[1] = pi + 7;
  49253. ps[2] = pi + 6;
  49254. ps[3] = pi + 5;
  49255. tmp1 = cs[2];
  49256. tmp2 = cs[3];
  49257. cs[2] = tmp2;
  49258. cs[3] = ci;
  49259. cs[0] = tmp1;
  49260. cs[1] = ci + 1;
  49261. break;
  49262. case 2:
  49263. tmp1 = ps[15];
  49264. tmp2 = ps[11];
  49265. ps[12] = ps[3];
  49266. ps[13] = pi + 0;
  49267. ps[14] = pi + 1;
  49268. ps[15] = pi + 2;
  49269. ps[8] = ps[7];
  49270. ps[9] = pi + 9;
  49271. ps[10] = pi + 10;
  49272. ps[11] = pi + 3;
  49273. ps[4] = tmp2;
  49274. ps[5] = pi + 8;
  49275. ps[6] = pi + 11;
  49276. ps[7] = pi + 4;
  49277. ps[0] = tmp1;
  49278. ps[1] = pi + 7;
  49279. ps[2] = pi + 6;
  49280. ps[3] = pi + 5;
  49281. tmp1 = cs[3];
  49282. cs[2] = cs[1];
  49283. cs[3] = ci;
  49284. cs[0] = tmp1;
  49285. cs[1] = ci + 1;
  49286. break;
  49287. case 3:
  49288. ps[12] = ps[0];
  49289. ps[13] = pi + 0;
  49290. ps[14] = pi + 1;
  49291. ps[15] = pi + 2;
  49292. ps[8] = ps[1];
  49293. ps[9] = pi + 9;
  49294. ps[10] = pi + 10;
  49295. ps[11] = pi + 3;
  49296. ps[4] = ps[2];
  49297. ps[5] = pi + 8;
  49298. ps[6] = pi + 11;
  49299. ps[7] = pi + 4;
  49300. ps[0] = ps[3];
  49301. ps[1] = pi + 7;
  49302. ps[2] = pi + 6;
  49303. ps[3] = pi + 5;
  49304. cs[2] = cs[0];
  49305. cs[3] = ci;
  49306. cs[0] = cs[1];
  49307. cs[1] = ci + 1;
  49308. break;
  49309. }
  49310. mesh.figures.push({
  49311. type: 'patch',
  49312. coords: new Int32Array(ps),
  49313. colors: new Int32Array(cs)
  49314. });
  49315. }
  49316. }
  49317. function updateBounds(mesh) {
  49318. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  49319. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  49320. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  49321. minX = minX > x ? x : minX;
  49322. minY = minY > y ? y : minY;
  49323. maxX = maxX < x ? x : maxX;
  49324. maxY = maxY < y ? y : maxY;
  49325. }
  49326. mesh.bounds = [
  49327. minX,
  49328. minY,
  49329. maxX,
  49330. maxY
  49331. ];
  49332. }
  49333. function packData(mesh) {
  49334. var i, ii, j, jj;
  49335. var coords = mesh.coords;
  49336. var coordsPacked = new Float32Array(coords.length * 2);
  49337. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  49338. var xy = coords[i];
  49339. coordsPacked[j++] = xy[0];
  49340. coordsPacked[j++] = xy[1];
  49341. }
  49342. mesh.coords = coordsPacked;
  49343. var colors = mesh.colors;
  49344. var colorsPacked = new Uint8Array(colors.length * 3);
  49345. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  49346. var c = colors[i];
  49347. colorsPacked[j++] = c[0];
  49348. colorsPacked[j++] = c[1];
  49349. colorsPacked[j++] = c[2];
  49350. }
  49351. mesh.colors = colorsPacked;
  49352. var figures = mesh.figures;
  49353. for (i = 0, ii = figures.length; i < ii; i++) {
  49354. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  49355. for (j = 0, jj = ps.length; j < jj; j++) {
  49356. ps[j] *= 2;
  49357. cs[j] *= 3;
  49358. }
  49359. }
  49360. }
  49361. function Mesh(stream, matrix, xref, res) {
  49362. assert(isStream(stream), 'Mesh data is not a stream');
  49363. var dict = stream.dict;
  49364. this.matrix = matrix;
  49365. this.shadingType = dict.get('ShadingType');
  49366. this.type = 'Pattern';
  49367. this.bbox = dict.getArray('BBox');
  49368. var cs = dict.get('ColorSpace', 'CS');
  49369. cs = ColorSpace.parse(cs, xref, res);
  49370. this.cs = cs;
  49371. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  49372. var fnObj = dict.get('Function');
  49373. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  49374. this.coords = [];
  49375. this.colors = [];
  49376. this.figures = [];
  49377. var decodeContext = {
  49378. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  49379. bitsPerComponent: dict.get('BitsPerComponent'),
  49380. bitsPerFlag: dict.get('BitsPerFlag'),
  49381. decode: dict.getArray('Decode'),
  49382. colorFn: fn,
  49383. colorSpace: cs,
  49384. numComps: fn ? 1 : cs.numComps
  49385. };
  49386. var reader = new MeshStreamReader(stream, decodeContext);
  49387. var patchMesh = false;
  49388. switch (this.shadingType) {
  49389. case ShadingType.FREE_FORM_MESH:
  49390. decodeType4Shading(this, reader);
  49391. break;
  49392. case ShadingType.LATTICE_FORM_MESH:
  49393. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  49394. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  49395. decodeType5Shading(this, reader, verticesPerRow);
  49396. break;
  49397. case ShadingType.COONS_PATCH_MESH:
  49398. decodeType6Shading(this, reader);
  49399. patchMesh = true;
  49400. break;
  49401. case ShadingType.TENSOR_PATCH_MESH:
  49402. decodeType7Shading(this, reader);
  49403. patchMesh = true;
  49404. break;
  49405. default:
  49406. error('Unsupported mesh type.');
  49407. break;
  49408. }
  49409. if (patchMesh) {
  49410. updateBounds(this);
  49411. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  49412. buildFigureFromPatch(this, i);
  49413. }
  49414. }
  49415. updateBounds(this);
  49416. packData(this);
  49417. }
  49418. Mesh.prototype = {
  49419. getIR: function Mesh_getIR() {
  49420. return [
  49421. 'Mesh',
  49422. this.shadingType,
  49423. this.coords,
  49424. this.colors,
  49425. this.figures,
  49426. this.bounds,
  49427. this.matrix,
  49428. this.bbox,
  49429. this.background
  49430. ];
  49431. }
  49432. };
  49433. return Mesh;
  49434. }();
  49435. Shadings.Dummy = function DummyClosure() {
  49436. function Dummy() {
  49437. this.type = 'Pattern';
  49438. }
  49439. Dummy.prototype = {
  49440. getIR: function Dummy_getIR() {
  49441. return ['Dummy'];
  49442. }
  49443. };
  49444. return Dummy;
  49445. }();
  49446. function getTilingPatternIR(operatorList, dict, args) {
  49447. var matrix = dict.getArray('Matrix');
  49448. var bbox = dict.getArray('BBox');
  49449. var xstep = dict.get('XStep');
  49450. var ystep = dict.get('YStep');
  49451. var paintType = dict.get('PaintType');
  49452. var tilingType = dict.get('TilingType');
  49453. return [
  49454. 'TilingPattern',
  49455. args,
  49456. operatorList,
  49457. matrix,
  49458. bbox,
  49459. xstep,
  49460. ystep,
  49461. paintType,
  49462. tilingType
  49463. ];
  49464. }
  49465. exports.Pattern = Pattern;
  49466. exports.getTilingPatternIR = getTilingPatternIR;
  49467. /***/ }),
  49468. /* 33 */
  49469. /***/ (function(module, exports, __w_pdfjs_require__) {
  49470. "use strict";
  49471. var sharedUtil = __w_pdfjs_require__(0);
  49472. var coreStream = __w_pdfjs_require__(2);
  49473. var coreChunkedStream = __w_pdfjs_require__(11);
  49474. var coreDocument = __w_pdfjs_require__(24);
  49475. var warn = sharedUtil.warn;
  49476. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  49477. var shadow = sharedUtil.shadow;
  49478. var NotImplementedException = sharedUtil.NotImplementedException;
  49479. var MissingDataException = sharedUtil.MissingDataException;
  49480. var createPromiseCapability = sharedUtil.createPromiseCapability;
  49481. var Util = sharedUtil.Util;
  49482. var Stream = coreStream.Stream;
  49483. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  49484. var PDFDocument = coreDocument.PDFDocument;
  49485. var BasePdfManager = function BasePdfManagerClosure() {
  49486. function BasePdfManager() {
  49487. throw new Error('Cannot initialize BaseManagerManager');
  49488. }
  49489. BasePdfManager.prototype = {
  49490. get docId() {
  49491. return this._docId;
  49492. },
  49493. get password() {
  49494. return this._password;
  49495. },
  49496. get docBaseUrl() {
  49497. var docBaseUrl = null;
  49498. if (this._docBaseUrl) {
  49499. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  49500. if (absoluteUrl) {
  49501. docBaseUrl = absoluteUrl.href;
  49502. } else {
  49503. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  49504. }
  49505. }
  49506. return shadow(this, 'docBaseUrl', docBaseUrl);
  49507. },
  49508. onLoadedStream: function BasePdfManager_onLoadedStream() {
  49509. throw new NotImplementedException();
  49510. },
  49511. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  49512. return this.ensure(this.pdfDocument, prop, args);
  49513. },
  49514. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  49515. return this.ensure(this.pdfDocument.xref, prop, args);
  49516. },
  49517. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  49518. return this.ensure(this.pdfDocument.catalog, prop, args);
  49519. },
  49520. getPage: function BasePdfManager_getPage(pageIndex) {
  49521. return this.pdfDocument.getPage(pageIndex);
  49522. },
  49523. cleanup: function BasePdfManager_cleanup() {
  49524. return this.pdfDocument.cleanup();
  49525. },
  49526. ensure: function BasePdfManager_ensure(obj, prop, args) {
  49527. return new NotImplementedException();
  49528. },
  49529. requestRange: function BasePdfManager_requestRange(begin, end) {
  49530. return new NotImplementedException();
  49531. },
  49532. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  49533. return new NotImplementedException();
  49534. },
  49535. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  49536. return new NotImplementedException();
  49537. },
  49538. updatePassword: function BasePdfManager_updatePassword(password) {
  49539. this._password = password;
  49540. },
  49541. terminate: function BasePdfManager_terminate() {
  49542. return new NotImplementedException();
  49543. }
  49544. };
  49545. return BasePdfManager;
  49546. }();
  49547. var LocalPdfManager = function LocalPdfManagerClosure() {
  49548. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  49549. this._docId = docId;
  49550. this._password = password;
  49551. this._docBaseUrl = docBaseUrl;
  49552. this.evaluatorOptions = evaluatorOptions;
  49553. var stream = new Stream(data);
  49554. this.pdfDocument = new PDFDocument(this, stream);
  49555. this._loadedStreamCapability = createPromiseCapability();
  49556. this._loadedStreamCapability.resolve(stream);
  49557. }
  49558. Util.inherit(LocalPdfManager, BasePdfManager, {
  49559. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  49560. return new Promise(function (resolve, reject) {
  49561. try {
  49562. var value = obj[prop];
  49563. var result;
  49564. if (typeof value === 'function') {
  49565. result = value.apply(obj, args);
  49566. } else {
  49567. result = value;
  49568. }
  49569. resolve(result);
  49570. } catch (e) {
  49571. reject(e);
  49572. }
  49573. });
  49574. },
  49575. requestRange: function LocalPdfManager_requestRange(begin, end) {
  49576. return Promise.resolve();
  49577. },
  49578. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  49579. },
  49580. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  49581. return this._loadedStreamCapability.promise;
  49582. },
  49583. terminate: function LocalPdfManager_terminate() {
  49584. }
  49585. });
  49586. return LocalPdfManager;
  49587. }();
  49588. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  49589. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  49590. this._docId = docId;
  49591. this._password = args.password;
  49592. this._docBaseUrl = docBaseUrl;
  49593. this.msgHandler = args.msgHandler;
  49594. this.evaluatorOptions = evaluatorOptions;
  49595. var params = {
  49596. msgHandler: args.msgHandler,
  49597. url: args.url,
  49598. length: args.length,
  49599. disableAutoFetch: args.disableAutoFetch,
  49600. rangeChunkSize: args.rangeChunkSize
  49601. };
  49602. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  49603. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  49604. }
  49605. Util.inherit(NetworkPdfManager, BasePdfManager, {
  49606. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  49607. var pdfManager = this;
  49608. return new Promise(function (resolve, reject) {
  49609. function ensureHelper() {
  49610. try {
  49611. var result;
  49612. var value = obj[prop];
  49613. if (typeof value === 'function') {
  49614. result = value.apply(obj, args);
  49615. } else {
  49616. result = value;
  49617. }
  49618. resolve(result);
  49619. } catch (e) {
  49620. if (!(e instanceof MissingDataException)) {
  49621. reject(e);
  49622. return;
  49623. }
  49624. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  49625. }
  49626. }
  49627. ensureHelper();
  49628. });
  49629. },
  49630. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  49631. return this.streamManager.requestRange(begin, end);
  49632. },
  49633. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  49634. this.streamManager.requestAllChunks();
  49635. },
  49636. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  49637. this.streamManager.onReceiveData({ chunk: chunk });
  49638. },
  49639. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  49640. return this.streamManager.onLoadedStream();
  49641. },
  49642. terminate: function NetworkPdfManager_terminate() {
  49643. this.streamManager.abort();
  49644. }
  49645. });
  49646. return NetworkPdfManager;
  49647. }();
  49648. exports.LocalPdfManager = LocalPdfManager;
  49649. exports.NetworkPdfManager = NetworkPdfManager;
  49650. /***/ }),
  49651. /* 34 */
  49652. /***/ (function(module, exports, __w_pdfjs_require__) {
  49653. "use strict";
  49654. var sharedUtil = __w_pdfjs_require__(0);
  49655. var corePrimitives = __w_pdfjs_require__(1);
  49656. var error = sharedUtil.error;
  49657. var isSpace = sharedUtil.isSpace;
  49658. var EOF = corePrimitives.EOF;
  49659. var PostScriptParser = function PostScriptParserClosure() {
  49660. function PostScriptParser(lexer) {
  49661. this.lexer = lexer;
  49662. this.operators = [];
  49663. this.token = null;
  49664. this.prev = null;
  49665. }
  49666. PostScriptParser.prototype = {
  49667. nextToken: function PostScriptParser_nextToken() {
  49668. this.prev = this.token;
  49669. this.token = this.lexer.getToken();
  49670. },
  49671. accept: function PostScriptParser_accept(type) {
  49672. if (this.token.type === type) {
  49673. this.nextToken();
  49674. return true;
  49675. }
  49676. return false;
  49677. },
  49678. expect: function PostScriptParser_expect(type) {
  49679. if (this.accept(type)) {
  49680. return true;
  49681. }
  49682. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  49683. },
  49684. parse: function PostScriptParser_parse() {
  49685. this.nextToken();
  49686. this.expect(PostScriptTokenTypes.LBRACE);
  49687. this.parseBlock();
  49688. this.expect(PostScriptTokenTypes.RBRACE);
  49689. return this.operators;
  49690. },
  49691. parseBlock: function PostScriptParser_parseBlock() {
  49692. while (true) {
  49693. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  49694. this.operators.push(this.prev.value);
  49695. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  49696. this.operators.push(this.prev.value);
  49697. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49698. this.parseCondition();
  49699. } else {
  49700. return;
  49701. }
  49702. }
  49703. },
  49704. parseCondition: function PostScriptParser_parseCondition() {
  49705. var conditionLocation = this.operators.length;
  49706. this.operators.push(null, null);
  49707. this.parseBlock();
  49708. this.expect(PostScriptTokenTypes.RBRACE);
  49709. if (this.accept(PostScriptTokenTypes.IF)) {
  49710. this.operators[conditionLocation] = this.operators.length;
  49711. this.operators[conditionLocation + 1] = 'jz';
  49712. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49713. var jumpLocation = this.operators.length;
  49714. this.operators.push(null, null);
  49715. var endOfTrue = this.operators.length;
  49716. this.parseBlock();
  49717. this.expect(PostScriptTokenTypes.RBRACE);
  49718. this.expect(PostScriptTokenTypes.IFELSE);
  49719. this.operators[jumpLocation] = this.operators.length;
  49720. this.operators[jumpLocation + 1] = 'j';
  49721. this.operators[conditionLocation] = endOfTrue;
  49722. this.operators[conditionLocation + 1] = 'jz';
  49723. } else {
  49724. error('PS Function: error parsing conditional.');
  49725. }
  49726. }
  49727. };
  49728. return PostScriptParser;
  49729. }();
  49730. var PostScriptTokenTypes = {
  49731. LBRACE: 0,
  49732. RBRACE: 1,
  49733. NUMBER: 2,
  49734. OPERATOR: 3,
  49735. IF: 4,
  49736. IFELSE: 5
  49737. };
  49738. var PostScriptToken = function PostScriptTokenClosure() {
  49739. function PostScriptToken(type, value) {
  49740. this.type = type;
  49741. this.value = value;
  49742. }
  49743. var opCache = Object.create(null);
  49744. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  49745. var opValue = opCache[op];
  49746. if (opValue) {
  49747. return opValue;
  49748. }
  49749. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49750. };
  49751. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  49752. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  49753. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  49754. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  49755. return PostScriptToken;
  49756. }();
  49757. var PostScriptLexer = function PostScriptLexerClosure() {
  49758. function PostScriptLexer(stream) {
  49759. this.stream = stream;
  49760. this.nextChar();
  49761. this.strBuf = [];
  49762. }
  49763. PostScriptLexer.prototype = {
  49764. nextChar: function PostScriptLexer_nextChar() {
  49765. return this.currentChar = this.stream.getByte();
  49766. },
  49767. getToken: function PostScriptLexer_getToken() {
  49768. var comment = false;
  49769. var ch = this.currentChar;
  49770. while (true) {
  49771. if (ch < 0) {
  49772. return EOF;
  49773. }
  49774. if (comment) {
  49775. if (ch === 0x0A || ch === 0x0D) {
  49776. comment = false;
  49777. }
  49778. } else if (ch === 0x25) {
  49779. comment = true;
  49780. } else if (!isSpace(ch)) {
  49781. break;
  49782. }
  49783. ch = this.nextChar();
  49784. }
  49785. switch (ch | 0) {
  49786. case 0x30:
  49787. case 0x31:
  49788. case 0x32:
  49789. case 0x33:
  49790. case 0x34:
  49791. case 0x35:
  49792. case 0x36:
  49793. case 0x37:
  49794. case 0x38:
  49795. case 0x39:
  49796. case 0x2B:
  49797. case 0x2D:
  49798. case 0x2E:
  49799. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49800. case 0x7B:
  49801. this.nextChar();
  49802. return PostScriptToken.LBRACE;
  49803. case 0x7D:
  49804. this.nextChar();
  49805. return PostScriptToken.RBRACE;
  49806. }
  49807. var strBuf = this.strBuf;
  49808. strBuf.length = 0;
  49809. strBuf[0] = String.fromCharCode(ch);
  49810. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  49811. strBuf.push(String.fromCharCode(ch));
  49812. }
  49813. var str = strBuf.join('');
  49814. switch (str.toLowerCase()) {
  49815. case 'if':
  49816. return PostScriptToken.IF;
  49817. case 'ifelse':
  49818. return PostScriptToken.IFELSE;
  49819. default:
  49820. return PostScriptToken.getOperator(str);
  49821. }
  49822. },
  49823. getNumber: function PostScriptLexer_getNumber() {
  49824. var ch = this.currentChar;
  49825. var strBuf = this.strBuf;
  49826. strBuf.length = 0;
  49827. strBuf[0] = String.fromCharCode(ch);
  49828. while ((ch = this.nextChar()) >= 0) {
  49829. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49830. strBuf.push(String.fromCharCode(ch));
  49831. } else {
  49832. break;
  49833. }
  49834. }
  49835. var value = parseFloat(strBuf.join(''));
  49836. if (isNaN(value)) {
  49837. error('Invalid floating point number: ' + value);
  49838. }
  49839. return value;
  49840. }
  49841. };
  49842. return PostScriptLexer;
  49843. }();
  49844. exports.PostScriptLexer = PostScriptLexer;
  49845. exports.PostScriptParser = PostScriptParser;
  49846. /***/ }),
  49847. /* 35 */
  49848. /***/ (function(module, exports, __w_pdfjs_require__) {
  49849. "use strict";
  49850. var sharedUtil = __w_pdfjs_require__(0);
  49851. var coreStream = __w_pdfjs_require__(2);
  49852. var coreEncodings = __w_pdfjs_require__(4);
  49853. var warn = sharedUtil.warn;
  49854. var isSpace = sharedUtil.isSpace;
  49855. var Stream = coreStream.Stream;
  49856. var getEncoding = coreEncodings.getEncoding;
  49857. var HINTING_ENABLED = false;
  49858. var Type1CharString = function Type1CharStringClosure() {
  49859. var COMMAND_MAP = {
  49860. 'hstem': [1],
  49861. 'vstem': [3],
  49862. 'vmoveto': [4],
  49863. 'rlineto': [5],
  49864. 'hlineto': [6],
  49865. 'vlineto': [7],
  49866. 'rrcurveto': [8],
  49867. 'callsubr': [10],
  49868. 'flex': [
  49869. 12,
  49870. 35
  49871. ],
  49872. 'drop': [
  49873. 12,
  49874. 18
  49875. ],
  49876. 'endchar': [14],
  49877. 'rmoveto': [21],
  49878. 'hmoveto': [22],
  49879. 'vhcurveto': [30],
  49880. 'hvcurveto': [31]
  49881. };
  49882. function Type1CharString() {
  49883. this.width = 0;
  49884. this.lsb = 0;
  49885. this.flexing = false;
  49886. this.output = [];
  49887. this.stack = [];
  49888. }
  49889. Type1CharString.prototype = {
  49890. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49891. var count = encoded.length;
  49892. var error = false;
  49893. var wx, sbx, subrNumber;
  49894. for (var i = 0; i < count; i++) {
  49895. var value = encoded[i];
  49896. if (value < 32) {
  49897. if (value === 12) {
  49898. value = (value << 8) + encoded[++i];
  49899. }
  49900. switch (value) {
  49901. case 1:
  49902. if (!HINTING_ENABLED) {
  49903. this.stack = [];
  49904. break;
  49905. }
  49906. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49907. break;
  49908. case 3:
  49909. if (!HINTING_ENABLED) {
  49910. this.stack = [];
  49911. break;
  49912. }
  49913. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49914. break;
  49915. case 4:
  49916. if (this.flexing) {
  49917. if (this.stack.length < 1) {
  49918. error = true;
  49919. break;
  49920. }
  49921. var dy = this.stack.pop();
  49922. this.stack.push(0, dy);
  49923. break;
  49924. }
  49925. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49926. break;
  49927. case 5:
  49928. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49929. break;
  49930. case 6:
  49931. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49932. break;
  49933. case 7:
  49934. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49935. break;
  49936. case 8:
  49937. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49938. break;
  49939. case 9:
  49940. this.stack = [];
  49941. break;
  49942. case 10:
  49943. if (this.stack.length < 1) {
  49944. error = true;
  49945. break;
  49946. }
  49947. subrNumber = this.stack.pop();
  49948. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49949. break;
  49950. case 11:
  49951. return error;
  49952. case 13:
  49953. if (this.stack.length < 2) {
  49954. error = true;
  49955. break;
  49956. }
  49957. wx = this.stack.pop();
  49958. sbx = this.stack.pop();
  49959. this.lsb = sbx;
  49960. this.width = wx;
  49961. this.stack.push(wx, sbx);
  49962. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49963. break;
  49964. case 14:
  49965. this.output.push(COMMAND_MAP.endchar[0]);
  49966. break;
  49967. case 21:
  49968. if (this.flexing) {
  49969. break;
  49970. }
  49971. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49972. break;
  49973. case 22:
  49974. if (this.flexing) {
  49975. this.stack.push(0);
  49976. break;
  49977. }
  49978. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49979. break;
  49980. case 30:
  49981. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49982. break;
  49983. case 31:
  49984. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49985. break;
  49986. case (12 << 8) + 0:
  49987. this.stack = [];
  49988. break;
  49989. case (12 << 8) + 1:
  49990. if (!HINTING_ENABLED) {
  49991. this.stack = [];
  49992. break;
  49993. }
  49994. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49995. break;
  49996. case (12 << 8) + 2:
  49997. if (!HINTING_ENABLED) {
  49998. this.stack = [];
  49999. break;
  50000. }
  50001. error = this.executeCommand(2, COMMAND_MAP.hstem);
  50002. break;
  50003. case (12 << 8) + 6:
  50004. if (seacAnalysisEnabled) {
  50005. this.seac = this.stack.splice(-4, 4);
  50006. error = this.executeCommand(0, COMMAND_MAP.endchar);
  50007. } else {
  50008. error = this.executeCommand(4, COMMAND_MAP.endchar);
  50009. }
  50010. break;
  50011. case (12 << 8) + 7:
  50012. if (this.stack.length < 4) {
  50013. error = true;
  50014. break;
  50015. }
  50016. this.stack.pop();
  50017. wx = this.stack.pop();
  50018. var sby = this.stack.pop();
  50019. sbx = this.stack.pop();
  50020. this.lsb = sbx;
  50021. this.width = wx;
  50022. this.stack.push(wx, sbx, sby);
  50023. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  50024. break;
  50025. case (12 << 8) + 12:
  50026. if (this.stack.length < 2) {
  50027. error = true;
  50028. break;
  50029. }
  50030. var num2 = this.stack.pop();
  50031. var num1 = this.stack.pop();
  50032. this.stack.push(num1 / num2);
  50033. break;
  50034. case (12 << 8) + 16:
  50035. if (this.stack.length < 2) {
  50036. error = true;
  50037. break;
  50038. }
  50039. subrNumber = this.stack.pop();
  50040. var numArgs = this.stack.pop();
  50041. if (subrNumber === 0 && numArgs === 3) {
  50042. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  50043. 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]);
  50044. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  50045. this.flexing = false;
  50046. this.stack.push(flexArgs[15], flexArgs[16]);
  50047. } else if (subrNumber === 1 && numArgs === 0) {
  50048. this.flexing = true;
  50049. }
  50050. break;
  50051. case (12 << 8) + 17:
  50052. break;
  50053. case (12 << 8) + 33:
  50054. this.stack = [];
  50055. break;
  50056. default:
  50057. warn('Unknown type 1 charstring command of "' + value + '"');
  50058. break;
  50059. }
  50060. if (error) {
  50061. break;
  50062. }
  50063. continue;
  50064. } else if (value <= 246) {
  50065. value = value - 139;
  50066. } else if (value <= 250) {
  50067. value = (value - 247) * 256 + encoded[++i] + 108;
  50068. } else if (value <= 254) {
  50069. value = -((value - 251) * 256) - encoded[++i] - 108;
  50070. } else {
  50071. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  50072. }
  50073. this.stack.push(value);
  50074. }
  50075. return error;
  50076. },
  50077. executeCommand: function (howManyArgs, command, keepStack) {
  50078. var stackLength = this.stack.length;
  50079. if (howManyArgs > stackLength) {
  50080. return true;
  50081. }
  50082. var start = stackLength - howManyArgs;
  50083. for (var i = start; i < stackLength; i++) {
  50084. var value = this.stack[i];
  50085. if (value === (value | 0)) {
  50086. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  50087. } else {
  50088. value = 65536 * value | 0;
  50089. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  50090. }
  50091. }
  50092. this.output.push.apply(this.output, command);
  50093. if (keepStack) {
  50094. this.stack.splice(start, howManyArgs);
  50095. } else {
  50096. this.stack.length = 0;
  50097. }
  50098. return false;
  50099. }
  50100. };
  50101. return Type1CharString;
  50102. }();
  50103. var Type1Parser = function Type1ParserClosure() {
  50104. var EEXEC_ENCRYPT_KEY = 55665;
  50105. var CHAR_STRS_ENCRYPT_KEY = 4330;
  50106. function isHexDigit(code) {
  50107. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  50108. }
  50109. function decrypt(data, key, discardNumber) {
  50110. if (discardNumber >= data.length) {
  50111. return new Uint8Array(0);
  50112. }
  50113. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  50114. for (i = 0; i < discardNumber; i++) {
  50115. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  50116. }
  50117. var count = data.length - discardNumber;
  50118. var decrypted = new Uint8Array(count);
  50119. for (i = discardNumber, j = 0; j < count; i++, j++) {
  50120. var value = data[i];
  50121. decrypted[j] = value ^ r >> 8;
  50122. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50123. }
  50124. return decrypted;
  50125. }
  50126. function decryptAscii(data, key, discardNumber) {
  50127. var r = key | 0, c1 = 52845, c2 = 22719;
  50128. var count = data.length, maybeLength = count >>> 1;
  50129. var decrypted = new Uint8Array(maybeLength);
  50130. var i, j;
  50131. for (i = 0, j = 0; i < count; i++) {
  50132. var digit1 = data[i];
  50133. if (!isHexDigit(digit1)) {
  50134. continue;
  50135. }
  50136. i++;
  50137. var digit2;
  50138. while (i < count && !isHexDigit(digit2 = data[i])) {
  50139. i++;
  50140. }
  50141. if (i < count) {
  50142. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  50143. decrypted[j++] = value ^ r >> 8;
  50144. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50145. }
  50146. }
  50147. return Array.prototype.slice.call(decrypted, discardNumber, j);
  50148. }
  50149. function isSpecial(c) {
  50150. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  50151. }
  50152. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  50153. if (encrypted) {
  50154. var data = stream.getBytes();
  50155. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  50156. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  50157. }
  50158. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  50159. this.stream = stream;
  50160. this.nextChar();
  50161. }
  50162. Type1Parser.prototype = {
  50163. readNumberArray: function Type1Parser_readNumberArray() {
  50164. this.getToken();
  50165. var array = [];
  50166. while (true) {
  50167. var token = this.getToken();
  50168. if (token === null || token === ']' || token === '}') {
  50169. break;
  50170. }
  50171. array.push(parseFloat(token || 0));
  50172. }
  50173. return array;
  50174. },
  50175. readNumber: function Type1Parser_readNumber() {
  50176. var token = this.getToken();
  50177. return parseFloat(token || 0);
  50178. },
  50179. readInt: function Type1Parser_readInt() {
  50180. var token = this.getToken();
  50181. return parseInt(token || 0, 10) | 0;
  50182. },
  50183. readBoolean: function Type1Parser_readBoolean() {
  50184. var token = this.getToken();
  50185. return token === 'true' ? 1 : 0;
  50186. },
  50187. nextChar: function Type1_nextChar() {
  50188. return this.currentChar = this.stream.getByte();
  50189. },
  50190. getToken: function Type1Parser_getToken() {
  50191. var comment = false;
  50192. var ch = this.currentChar;
  50193. while (true) {
  50194. if (ch === -1) {
  50195. return null;
  50196. }
  50197. if (comment) {
  50198. if (ch === 0x0A || ch === 0x0D) {
  50199. comment = false;
  50200. }
  50201. } else if (ch === 0x25) {
  50202. comment = true;
  50203. } else if (!isSpace(ch)) {
  50204. break;
  50205. }
  50206. ch = this.nextChar();
  50207. }
  50208. if (isSpecial(ch)) {
  50209. this.nextChar();
  50210. return String.fromCharCode(ch);
  50211. }
  50212. var token = '';
  50213. do {
  50214. token += String.fromCharCode(ch);
  50215. ch = this.nextChar();
  50216. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  50217. return token;
  50218. },
  50219. extractFontProgram: function Type1Parser_extractFontProgram() {
  50220. var stream = this.stream;
  50221. var subrs = [], charstrings = [];
  50222. var privateData = Object.create(null);
  50223. privateData['lenIV'] = 4;
  50224. var program = {
  50225. subrs: [],
  50226. charstrings: [],
  50227. properties: { 'privateData': privateData }
  50228. };
  50229. var token, length, data, lenIV, encoded;
  50230. while ((token = this.getToken()) !== null) {
  50231. if (token !== '/') {
  50232. continue;
  50233. }
  50234. token = this.getToken();
  50235. switch (token) {
  50236. case 'CharStrings':
  50237. this.getToken();
  50238. this.getToken();
  50239. this.getToken();
  50240. this.getToken();
  50241. while (true) {
  50242. token = this.getToken();
  50243. if (token === null || token === 'end') {
  50244. break;
  50245. }
  50246. if (token !== '/') {
  50247. continue;
  50248. }
  50249. var glyph = this.getToken();
  50250. length = this.readInt();
  50251. this.getToken();
  50252. data = stream.makeSubStream(stream.pos, length);
  50253. lenIV = program.properties.privateData['lenIV'];
  50254. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50255. stream.skip(length);
  50256. this.nextChar();
  50257. token = this.getToken();
  50258. if (token === 'noaccess') {
  50259. this.getToken();
  50260. }
  50261. charstrings.push({
  50262. glyph: glyph,
  50263. encoded: encoded
  50264. });
  50265. }
  50266. break;
  50267. case 'Subrs':
  50268. this.readInt();
  50269. this.getToken();
  50270. while ((token = this.getToken()) === 'dup') {
  50271. var index = this.readInt();
  50272. length = this.readInt();
  50273. this.getToken();
  50274. data = stream.makeSubStream(stream.pos, length);
  50275. lenIV = program.properties.privateData['lenIV'];
  50276. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50277. stream.skip(length);
  50278. this.nextChar();
  50279. token = this.getToken();
  50280. if (token === 'noaccess') {
  50281. this.getToken();
  50282. }
  50283. subrs[index] = encoded;
  50284. }
  50285. break;
  50286. case 'BlueValues':
  50287. case 'OtherBlues':
  50288. case 'FamilyBlues':
  50289. case 'FamilyOtherBlues':
  50290. var blueArray = this.readNumberArray();
  50291. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  50292. program.properties.privateData[token] = blueArray;
  50293. }
  50294. break;
  50295. case 'StemSnapH':
  50296. case 'StemSnapV':
  50297. program.properties.privateData[token] = this.readNumberArray();
  50298. break;
  50299. case 'StdHW':
  50300. case 'StdVW':
  50301. program.properties.privateData[token] = this.readNumberArray()[0];
  50302. break;
  50303. case 'BlueShift':
  50304. case 'lenIV':
  50305. case 'BlueFuzz':
  50306. case 'BlueScale':
  50307. case 'LanguageGroup':
  50308. case 'ExpansionFactor':
  50309. program.properties.privateData[token] = this.readNumber();
  50310. break;
  50311. case 'ForceBold':
  50312. program.properties.privateData[token] = this.readBoolean();
  50313. break;
  50314. }
  50315. }
  50316. for (var i = 0; i < charstrings.length; i++) {
  50317. glyph = charstrings[i].glyph;
  50318. encoded = charstrings[i].encoded;
  50319. var charString = new Type1CharString();
  50320. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  50321. var output = charString.output;
  50322. if (error) {
  50323. output = [14];
  50324. }
  50325. program.charstrings.push({
  50326. glyphName: glyph,
  50327. charstring: output,
  50328. width: charString.width,
  50329. lsb: charString.lsb,
  50330. seac: charString.seac
  50331. });
  50332. }
  50333. return program;
  50334. },
  50335. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  50336. var token;
  50337. while ((token = this.getToken()) !== null) {
  50338. if (token !== '/') {
  50339. continue;
  50340. }
  50341. token = this.getToken();
  50342. switch (token) {
  50343. case 'FontMatrix':
  50344. var matrix = this.readNumberArray();
  50345. properties.fontMatrix = matrix;
  50346. break;
  50347. case 'Encoding':
  50348. var encodingArg = this.getToken();
  50349. var encoding;
  50350. if (!/^\d+$/.test(encodingArg)) {
  50351. encoding = getEncoding(encodingArg);
  50352. } else {
  50353. encoding = [];
  50354. var size = parseInt(encodingArg, 10) | 0;
  50355. this.getToken();
  50356. for (var j = 0; j < size; j++) {
  50357. token = this.getToken();
  50358. while (token !== 'dup' && token !== 'def') {
  50359. token = this.getToken();
  50360. if (token === null) {
  50361. return;
  50362. }
  50363. }
  50364. if (token === 'def') {
  50365. break;
  50366. }
  50367. var index = this.readInt();
  50368. this.getToken();
  50369. var glyph = this.getToken();
  50370. encoding[index] = glyph;
  50371. this.getToken();
  50372. }
  50373. }
  50374. properties.builtInEncoding = encoding;
  50375. break;
  50376. case 'FontBBox':
  50377. var fontBBox = this.readNumberArray();
  50378. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  50379. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  50380. properties.ascentScaled = true;
  50381. break;
  50382. }
  50383. }
  50384. }
  50385. };
  50386. return Type1Parser;
  50387. }();
  50388. exports.Type1Parser = Type1Parser;
  50389. /***/ }),
  50390. /* 36 */
  50391. /***/ (function(module, exports, __w_pdfjs_require__) {
  50392. "use strict";
  50393. var pdfjsVersion = '1.7.314';
  50394. var pdfjsBuild = '912c952d';
  50395. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50396. {
  50397. __w_pdfjs_require__(18);
  50398. }
  50399. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50400. /***/ })
  50401. /******/ ]);
  50402. });