pdf.worker.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554
  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 = 37);
  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 OPS = {
  208. dependency: 1,
  209. setLineWidth: 2,
  210. setLineCap: 3,
  211. setLineJoin: 4,
  212. setMiterLimit: 5,
  213. setDash: 6,
  214. setRenderingIntent: 7,
  215. setFlatness: 8,
  216. setGState: 9,
  217. save: 10,
  218. restore: 11,
  219. transform: 12,
  220. moveTo: 13,
  221. lineTo: 14,
  222. curveTo: 15,
  223. curveTo2: 16,
  224. curveTo3: 17,
  225. closePath: 18,
  226. rectangle: 19,
  227. stroke: 20,
  228. closeStroke: 21,
  229. fill: 22,
  230. eoFill: 23,
  231. fillStroke: 24,
  232. eoFillStroke: 25,
  233. closeFillStroke: 26,
  234. closeEOFillStroke: 27,
  235. endPath: 28,
  236. clip: 29,
  237. eoClip: 30,
  238. beginText: 31,
  239. endText: 32,
  240. setCharSpacing: 33,
  241. setWordSpacing: 34,
  242. setHScale: 35,
  243. setLeading: 36,
  244. setFont: 37,
  245. setTextRenderingMode: 38,
  246. setTextRise: 39,
  247. moveText: 40,
  248. setLeadingMoveText: 41,
  249. setTextMatrix: 42,
  250. nextLine: 43,
  251. showText: 44,
  252. showSpacedText: 45,
  253. nextLineShowText: 46,
  254. nextLineSetSpacingShowText: 47,
  255. setCharWidth: 48,
  256. setCharWidthAndBounds: 49,
  257. setStrokeColorSpace: 50,
  258. setFillColorSpace: 51,
  259. setStrokeColor: 52,
  260. setStrokeColorN: 53,
  261. setFillColor: 54,
  262. setFillColorN: 55,
  263. setStrokeGray: 56,
  264. setFillGray: 57,
  265. setStrokeRGBColor: 58,
  266. setFillRGBColor: 59,
  267. setStrokeCMYKColor: 60,
  268. setFillCMYKColor: 61,
  269. shadingFill: 62,
  270. beginInlineImage: 63,
  271. beginImageData: 64,
  272. endInlineImage: 65,
  273. paintXObject: 66,
  274. markPoint: 67,
  275. markPointProps: 68,
  276. beginMarkedContent: 69,
  277. beginMarkedContentProps: 70,
  278. endMarkedContent: 71,
  279. beginCompat: 72,
  280. endCompat: 73,
  281. paintFormXObjectBegin: 74,
  282. paintFormXObjectEnd: 75,
  283. beginGroup: 76,
  284. endGroup: 77,
  285. beginAnnotations: 78,
  286. endAnnotations: 79,
  287. beginAnnotation: 80,
  288. endAnnotation: 81,
  289. paintJpegXObject: 82,
  290. paintImageMaskXObject: 83,
  291. paintImageMaskXObjectGroup: 84,
  292. paintImageXObject: 85,
  293. paintInlineImageXObject: 86,
  294. paintInlineImageXObjectGroup: 87,
  295. paintImageXObjectRepeat: 88,
  296. paintImageMaskXObjectRepeat: 89,
  297. paintSolidColorImageMask: 90,
  298. constructPath: 91
  299. };
  300. var verbosity = VERBOSITY_LEVELS.warnings;
  301. function setVerbosityLevel(level) {
  302. verbosity = level;
  303. }
  304. function getVerbosityLevel() {
  305. return verbosity;
  306. }
  307. function info(msg) {
  308. if (verbosity >= VERBOSITY_LEVELS.infos) {
  309. console.log('Info: ' + msg);
  310. }
  311. }
  312. function warn(msg) {
  313. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  314. console.log('Warning: ' + msg);
  315. }
  316. }
  317. function deprecated(details) {
  318. console.log('Deprecated API usage: ' + details);
  319. }
  320. function error(msg) {
  321. if (verbosity >= VERBOSITY_LEVELS.errors) {
  322. console.log('Error: ' + msg);
  323. console.log(backtrace());
  324. }
  325. throw new Error(msg);
  326. }
  327. function backtrace() {
  328. try {
  329. throw new Error();
  330. } catch (e) {
  331. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  332. }
  333. }
  334. function assert(cond, msg) {
  335. if (!cond) {
  336. error(msg);
  337. }
  338. }
  339. var UNSUPPORTED_FEATURES = {
  340. unknown: 'unknown',
  341. forms: 'forms',
  342. javaScript: 'javaScript',
  343. smask: 'smask',
  344. shadingPattern: 'shadingPattern',
  345. font: 'font'
  346. };
  347. function isSameOrigin(baseUrl, otherUrl) {
  348. try {
  349. var base = new URL(baseUrl);
  350. if (!base.origin || base.origin === 'null') {
  351. return false;
  352. }
  353. } catch (e) {
  354. return false;
  355. }
  356. var other = new URL(otherUrl, base);
  357. return base.origin === other.origin;
  358. }
  359. function isValidProtocol(url) {
  360. if (!url) {
  361. return false;
  362. }
  363. switch (url.protocol) {
  364. case 'http:':
  365. case 'https:':
  366. case 'ftp:':
  367. case 'mailto:':
  368. case 'tel:':
  369. return true;
  370. default:
  371. return false;
  372. }
  373. }
  374. function createValidAbsoluteUrl(url, baseUrl) {
  375. if (!url) {
  376. return null;
  377. }
  378. try {
  379. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  380. if (isValidProtocol(absoluteUrl)) {
  381. return absoluteUrl;
  382. }
  383. } catch (ex) {
  384. }
  385. return null;
  386. }
  387. function shadow(obj, prop, value) {
  388. Object.defineProperty(obj, prop, {
  389. value: value,
  390. enumerable: true,
  391. configurable: true,
  392. writable: false
  393. });
  394. return value;
  395. }
  396. function getLookupTableFactory(initializer) {
  397. var lookup;
  398. return function () {
  399. if (initializer) {
  400. lookup = Object.create(null);
  401. initializer(lookup);
  402. initializer = null;
  403. }
  404. return lookup;
  405. };
  406. }
  407. var PasswordResponses = {
  408. NEED_PASSWORD: 1,
  409. INCORRECT_PASSWORD: 2
  410. };
  411. var PasswordException = function PasswordExceptionClosure() {
  412. function PasswordException(msg, code) {
  413. this.name = 'PasswordException';
  414. this.message = msg;
  415. this.code = code;
  416. }
  417. PasswordException.prototype = new Error();
  418. PasswordException.constructor = PasswordException;
  419. return PasswordException;
  420. }();
  421. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  422. function UnknownErrorException(msg, details) {
  423. this.name = 'UnknownErrorException';
  424. this.message = msg;
  425. this.details = details;
  426. }
  427. UnknownErrorException.prototype = new Error();
  428. UnknownErrorException.constructor = UnknownErrorException;
  429. return UnknownErrorException;
  430. }();
  431. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  432. function InvalidPDFException(msg) {
  433. this.name = 'InvalidPDFException';
  434. this.message = msg;
  435. }
  436. InvalidPDFException.prototype = new Error();
  437. InvalidPDFException.constructor = InvalidPDFException;
  438. return InvalidPDFException;
  439. }();
  440. var MissingPDFException = function MissingPDFExceptionClosure() {
  441. function MissingPDFException(msg) {
  442. this.name = 'MissingPDFException';
  443. this.message = msg;
  444. }
  445. MissingPDFException.prototype = new Error();
  446. MissingPDFException.constructor = MissingPDFException;
  447. return MissingPDFException;
  448. }();
  449. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  450. function UnexpectedResponseException(msg, status) {
  451. this.name = 'UnexpectedResponseException';
  452. this.message = msg;
  453. this.status = status;
  454. }
  455. UnexpectedResponseException.prototype = new Error();
  456. UnexpectedResponseException.constructor = UnexpectedResponseException;
  457. return UnexpectedResponseException;
  458. }();
  459. var NotImplementedException = function NotImplementedExceptionClosure() {
  460. function NotImplementedException(msg) {
  461. this.message = msg;
  462. }
  463. NotImplementedException.prototype = new Error();
  464. NotImplementedException.prototype.name = 'NotImplementedException';
  465. NotImplementedException.constructor = NotImplementedException;
  466. return NotImplementedException;
  467. }();
  468. var MissingDataException = function MissingDataExceptionClosure() {
  469. function MissingDataException(begin, end) {
  470. this.begin = begin;
  471. this.end = end;
  472. this.message = 'Missing data [' + begin + ', ' + end + ')';
  473. }
  474. MissingDataException.prototype = new Error();
  475. MissingDataException.prototype.name = 'MissingDataException';
  476. MissingDataException.constructor = MissingDataException;
  477. return MissingDataException;
  478. }();
  479. var XRefParseException = function XRefParseExceptionClosure() {
  480. function XRefParseException(msg) {
  481. this.message = msg;
  482. }
  483. XRefParseException.prototype = new Error();
  484. XRefParseException.prototype.name = 'XRefParseException';
  485. XRefParseException.constructor = XRefParseException;
  486. return XRefParseException;
  487. }();
  488. var NullCharactersRegExp = /\x00/g;
  489. function removeNullCharacters(str) {
  490. if (typeof str !== 'string') {
  491. warn('The argument for removeNullCharacters must be a string.');
  492. return str;
  493. }
  494. return str.replace(NullCharactersRegExp, '');
  495. }
  496. function bytesToString(bytes) {
  497. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  498. var length = bytes.length;
  499. var MAX_ARGUMENT_COUNT = 8192;
  500. if (length < MAX_ARGUMENT_COUNT) {
  501. return String.fromCharCode.apply(null, bytes);
  502. }
  503. var strBuf = [];
  504. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  505. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  506. var chunk = bytes.subarray(i, chunkEnd);
  507. strBuf.push(String.fromCharCode.apply(null, chunk));
  508. }
  509. return strBuf.join('');
  510. }
  511. function stringToBytes(str) {
  512. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  513. var length = str.length;
  514. var bytes = new Uint8Array(length);
  515. for (var i = 0; i < length; ++i) {
  516. bytes[i] = str.charCodeAt(i) & 0xFF;
  517. }
  518. return bytes;
  519. }
  520. function arrayByteLength(arr) {
  521. if (arr.length !== undefined) {
  522. return arr.length;
  523. }
  524. assert(arr.byteLength !== undefined);
  525. return arr.byteLength;
  526. }
  527. function arraysToBytes(arr) {
  528. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  529. return arr[0];
  530. }
  531. var resultLength = 0;
  532. var i, ii = arr.length;
  533. var item, itemLength;
  534. for (i = 0; i < ii; i++) {
  535. item = arr[i];
  536. itemLength = arrayByteLength(item);
  537. resultLength += itemLength;
  538. }
  539. var pos = 0;
  540. var data = new Uint8Array(resultLength);
  541. for (i = 0; i < ii; i++) {
  542. item = arr[i];
  543. if (!(item instanceof Uint8Array)) {
  544. if (typeof item === 'string') {
  545. item = stringToBytes(item);
  546. } else {
  547. item = new Uint8Array(item);
  548. }
  549. }
  550. itemLength = item.byteLength;
  551. data.set(item, pos);
  552. pos += itemLength;
  553. }
  554. return data;
  555. }
  556. function string32(value) {
  557. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  558. }
  559. function log2(x) {
  560. var n = 1, i = 0;
  561. while (x > n) {
  562. n <<= 1;
  563. i++;
  564. }
  565. return i;
  566. }
  567. function readInt8(data, start) {
  568. return data[start] << 24 >> 24;
  569. }
  570. function readUint16(data, offset) {
  571. return data[offset] << 8 | data[offset + 1];
  572. }
  573. function readUint32(data, offset) {
  574. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  575. }
  576. function isLittleEndian() {
  577. var buffer8 = new Uint8Array(2);
  578. buffer8[0] = 1;
  579. var buffer16 = new Uint16Array(buffer8.buffer);
  580. return buffer16[0] === 1;
  581. }
  582. function isEvalSupported() {
  583. try {
  584. new Function('');
  585. return true;
  586. } catch (e) {
  587. return false;
  588. }
  589. }
  590. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  591. function Uint32ArrayView(buffer, length) {
  592. this.buffer = buffer;
  593. this.byteLength = buffer.length;
  594. this.length = length === undefined ? this.byteLength >> 2 : length;
  595. ensureUint32ArrayViewProps(this.length);
  596. }
  597. Uint32ArrayView.prototype = Object.create(null);
  598. var uint32ArrayViewSetters = 0;
  599. function createUint32ArrayProp(index) {
  600. return {
  601. get: function () {
  602. var buffer = this.buffer, offset = index << 2;
  603. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  604. },
  605. set: function (value) {
  606. var buffer = this.buffer, offset = index << 2;
  607. buffer[offset] = value & 255;
  608. buffer[offset + 1] = value >> 8 & 255;
  609. buffer[offset + 2] = value >> 16 & 255;
  610. buffer[offset + 3] = value >>> 24 & 255;
  611. }
  612. };
  613. }
  614. function ensureUint32ArrayViewProps(length) {
  615. while (uint32ArrayViewSetters < length) {
  616. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  617. uint32ArrayViewSetters++;
  618. }
  619. }
  620. return Uint32ArrayView;
  621. }();
  622. exports.Uint32ArrayView = Uint32ArrayView;
  623. var IDENTITY_MATRIX = [
  624. 1,
  625. 0,
  626. 0,
  627. 1,
  628. 0,
  629. 0
  630. ];
  631. var Util = function UtilClosure() {
  632. function Util() {
  633. }
  634. var rgbBuf = [
  635. 'rgb(',
  636. 0,
  637. ',',
  638. 0,
  639. ',',
  640. 0,
  641. ')'
  642. ];
  643. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  644. rgbBuf[1] = r;
  645. rgbBuf[3] = g;
  646. rgbBuf[5] = b;
  647. return rgbBuf.join('');
  648. };
  649. Util.transform = function Util_transform(m1, m2) {
  650. return [
  651. m1[0] * m2[0] + m1[2] * m2[1],
  652. m1[1] * m2[0] + m1[3] * m2[1],
  653. m1[0] * m2[2] + m1[2] * m2[3],
  654. m1[1] * m2[2] + m1[3] * m2[3],
  655. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  656. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  657. ];
  658. };
  659. Util.applyTransform = function Util_applyTransform(p, m) {
  660. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  661. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  662. return [
  663. xt,
  664. yt
  665. ];
  666. };
  667. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  668. var d = m[0] * m[3] - m[1] * m[2];
  669. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  670. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  671. return [
  672. xt,
  673. yt
  674. ];
  675. };
  676. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  677. var p1 = Util.applyTransform(r, m);
  678. var p2 = Util.applyTransform(r.slice(2, 4), m);
  679. var p3 = Util.applyTransform([
  680. r[0],
  681. r[3]
  682. ], m);
  683. var p4 = Util.applyTransform([
  684. r[2],
  685. r[1]
  686. ], m);
  687. return [
  688. Math.min(p1[0], p2[0], p3[0], p4[0]),
  689. Math.min(p1[1], p2[1], p3[1], p4[1]),
  690. Math.max(p1[0], p2[0], p3[0], p4[0]),
  691. Math.max(p1[1], p2[1], p3[1], p4[1])
  692. ];
  693. };
  694. Util.inverseTransform = function Util_inverseTransform(m) {
  695. var d = m[0] * m[3] - m[1] * m[2];
  696. return [
  697. m[3] / d,
  698. -m[1] / d,
  699. -m[2] / d,
  700. m[0] / d,
  701. (m[2] * m[5] - m[4] * m[3]) / d,
  702. (m[4] * m[1] - m[5] * m[0]) / d
  703. ];
  704. };
  705. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  706. return [
  707. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  708. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  709. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  710. ];
  711. };
  712. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  713. var transpose = [
  714. m[0],
  715. m[2],
  716. m[1],
  717. m[3]
  718. ];
  719. var a = m[0] * transpose[0] + m[1] * transpose[2];
  720. var b = m[0] * transpose[1] + m[1] * transpose[3];
  721. var c = m[2] * transpose[0] + m[3] * transpose[2];
  722. var d = m[2] * transpose[1] + m[3] * transpose[3];
  723. var first = (a + d) / 2;
  724. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  725. var sx = first + second || 1;
  726. var sy = first - second || 1;
  727. return [
  728. Math.sqrt(sx),
  729. Math.sqrt(sy)
  730. ];
  731. };
  732. Util.normalizeRect = function Util_normalizeRect(rect) {
  733. var r = rect.slice(0);
  734. if (rect[0] > rect[2]) {
  735. r[0] = rect[2];
  736. r[2] = rect[0];
  737. }
  738. if (rect[1] > rect[3]) {
  739. r[1] = rect[3];
  740. r[3] = rect[1];
  741. }
  742. return r;
  743. };
  744. Util.intersect = function Util_intersect(rect1, rect2) {
  745. function compare(a, b) {
  746. return a - b;
  747. }
  748. var orderedX = [
  749. rect1[0],
  750. rect1[2],
  751. rect2[0],
  752. rect2[2]
  753. ].sort(compare), orderedY = [
  754. rect1[1],
  755. rect1[3],
  756. rect2[1],
  757. rect2[3]
  758. ].sort(compare), result = [];
  759. rect1 = Util.normalizeRect(rect1);
  760. rect2 = Util.normalizeRect(rect2);
  761. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  762. result[0] = orderedX[1];
  763. result[2] = orderedX[2];
  764. } else {
  765. return false;
  766. }
  767. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  768. result[1] = orderedY[1];
  769. result[3] = orderedY[2];
  770. } else {
  771. return false;
  772. }
  773. return result;
  774. };
  775. Util.sign = function Util_sign(num) {
  776. return num < 0 ? -1 : 1;
  777. };
  778. var ROMAN_NUMBER_MAP = [
  779. '',
  780. 'C',
  781. 'CC',
  782. 'CCC',
  783. 'CD',
  784. 'D',
  785. 'DC',
  786. 'DCC',
  787. 'DCCC',
  788. 'CM',
  789. '',
  790. 'X',
  791. 'XX',
  792. 'XXX',
  793. 'XL',
  794. 'L',
  795. 'LX',
  796. 'LXX',
  797. 'LXXX',
  798. 'XC',
  799. '',
  800. 'I',
  801. 'II',
  802. 'III',
  803. 'IV',
  804. 'V',
  805. 'VI',
  806. 'VII',
  807. 'VIII',
  808. 'IX'
  809. ];
  810. Util.toRoman = function Util_toRoman(number, lowerCase) {
  811. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  812. var pos, romanBuf = [];
  813. while (number >= 1000) {
  814. number -= 1000;
  815. romanBuf.push('M');
  816. }
  817. pos = number / 100 | 0;
  818. number %= 100;
  819. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  820. pos = number / 10 | 0;
  821. number %= 10;
  822. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  823. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  824. var romanStr = romanBuf.join('');
  825. return lowerCase ? romanStr.toLowerCase() : romanStr;
  826. };
  827. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  828. Array.prototype.push.apply(arr1, arr2);
  829. };
  830. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  831. Array.prototype.unshift.apply(arr1, arr2);
  832. };
  833. Util.extendObj = function extendObj(obj1, obj2) {
  834. for (var key in obj2) {
  835. obj1[key] = obj2[key];
  836. }
  837. };
  838. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  839. while (dict && !dict.has(name)) {
  840. dict = dict.get('Parent');
  841. }
  842. if (!dict) {
  843. return null;
  844. }
  845. return getArray ? dict.getArray(name) : dict.get(name);
  846. };
  847. Util.inherit = function Util_inherit(sub, base, prototype) {
  848. sub.prototype = Object.create(base.prototype);
  849. sub.prototype.constructor = sub;
  850. for (var prop in prototype) {
  851. sub.prototype[prop] = prototype[prop];
  852. }
  853. };
  854. Util.loadScript = function Util_loadScript(src, callback) {
  855. var script = document.createElement('script');
  856. var loaded = false;
  857. script.setAttribute('src', src);
  858. if (callback) {
  859. script.onload = function () {
  860. if (!loaded) {
  861. callback();
  862. }
  863. loaded = true;
  864. };
  865. }
  866. document.getElementsByTagName('head')[0].appendChild(script);
  867. };
  868. return Util;
  869. }();
  870. var PageViewport = function PageViewportClosure() {
  871. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  872. this.viewBox = viewBox;
  873. this.scale = scale;
  874. this.rotation = rotation;
  875. this.offsetX = offsetX;
  876. this.offsetY = offsetY;
  877. var centerX = (viewBox[2] + viewBox[0]) / 2;
  878. var centerY = (viewBox[3] + viewBox[1]) / 2;
  879. var rotateA, rotateB, rotateC, rotateD;
  880. rotation = rotation % 360;
  881. rotation = rotation < 0 ? rotation + 360 : rotation;
  882. switch (rotation) {
  883. case 180:
  884. rotateA = -1;
  885. rotateB = 0;
  886. rotateC = 0;
  887. rotateD = 1;
  888. break;
  889. case 90:
  890. rotateA = 0;
  891. rotateB = 1;
  892. rotateC = 1;
  893. rotateD = 0;
  894. break;
  895. case 270:
  896. rotateA = 0;
  897. rotateB = -1;
  898. rotateC = -1;
  899. rotateD = 0;
  900. break;
  901. default:
  902. rotateA = 1;
  903. rotateB = 0;
  904. rotateC = 0;
  905. rotateD = -1;
  906. break;
  907. }
  908. if (dontFlip) {
  909. rotateC = -rotateC;
  910. rotateD = -rotateD;
  911. }
  912. var offsetCanvasX, offsetCanvasY;
  913. var width, height;
  914. if (rotateA === 0) {
  915. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  916. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  917. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  918. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  919. } else {
  920. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  921. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  922. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  923. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  924. }
  925. this.transform = [
  926. rotateA * scale,
  927. rotateB * scale,
  928. rotateC * scale,
  929. rotateD * scale,
  930. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  931. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  932. ];
  933. this.width = width;
  934. this.height = height;
  935. this.fontScale = scale;
  936. }
  937. PageViewport.prototype = {
  938. clone: function PageViewPort_clone(args) {
  939. args = args || {};
  940. var scale = 'scale' in args ? args.scale : this.scale;
  941. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  942. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  943. },
  944. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  945. return Util.applyTransform([
  946. x,
  947. y
  948. ], this.transform);
  949. },
  950. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  951. var tl = Util.applyTransform([
  952. rect[0],
  953. rect[1]
  954. ], this.transform);
  955. var br = Util.applyTransform([
  956. rect[2],
  957. rect[3]
  958. ], this.transform);
  959. return [
  960. tl[0],
  961. tl[1],
  962. br[0],
  963. br[1]
  964. ];
  965. },
  966. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  967. return Util.applyInverseTransform([
  968. x,
  969. y
  970. ], this.transform);
  971. }
  972. };
  973. return PageViewport;
  974. }();
  975. var PDFStringTranslateTable = [
  976. 0,
  977. 0,
  978. 0,
  979. 0,
  980. 0,
  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. 0x2D8,
  1001. 0x2C7,
  1002. 0x2C6,
  1003. 0x2D9,
  1004. 0x2DD,
  1005. 0x2DB,
  1006. 0x2DA,
  1007. 0x2DC,
  1008. 0,
  1009. 0,
  1010. 0,
  1011. 0,
  1012. 0,
  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. 0x2022,
  1105. 0x2020,
  1106. 0x2021,
  1107. 0x2026,
  1108. 0x2014,
  1109. 0x2013,
  1110. 0x192,
  1111. 0x2044,
  1112. 0x2039,
  1113. 0x203A,
  1114. 0x2212,
  1115. 0x2030,
  1116. 0x201E,
  1117. 0x201C,
  1118. 0x201D,
  1119. 0x2018,
  1120. 0x2019,
  1121. 0x201A,
  1122. 0x2122,
  1123. 0xFB01,
  1124. 0xFB02,
  1125. 0x141,
  1126. 0x152,
  1127. 0x160,
  1128. 0x178,
  1129. 0x17D,
  1130. 0x131,
  1131. 0x142,
  1132. 0x153,
  1133. 0x161,
  1134. 0x17E,
  1135. 0,
  1136. 0x20AC
  1137. ];
  1138. function stringToPDFString(str) {
  1139. var i, n = str.length, strBuf = [];
  1140. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1141. for (i = 2; i < n; i += 2) {
  1142. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1143. }
  1144. } else {
  1145. for (i = 0; i < n; ++i) {
  1146. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1147. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1148. }
  1149. }
  1150. return strBuf.join('');
  1151. }
  1152. function stringToUTF8String(str) {
  1153. return decodeURIComponent(escape(str));
  1154. }
  1155. function utf8StringToString(str) {
  1156. return unescape(encodeURIComponent(str));
  1157. }
  1158. function isEmptyObj(obj) {
  1159. for (var key in obj) {
  1160. return false;
  1161. }
  1162. return true;
  1163. }
  1164. function isBool(v) {
  1165. return typeof v === 'boolean';
  1166. }
  1167. function isInt(v) {
  1168. return typeof v === 'number' && (v | 0) === v;
  1169. }
  1170. function isNum(v) {
  1171. return typeof v === 'number';
  1172. }
  1173. function isString(v) {
  1174. return typeof v === 'string';
  1175. }
  1176. function isArray(v) {
  1177. return v instanceof Array;
  1178. }
  1179. function isArrayBuffer(v) {
  1180. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1181. }
  1182. function isSpace(ch) {
  1183. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1184. }
  1185. function createPromiseCapability() {
  1186. var capability = {};
  1187. capability.promise = new Promise(function (resolve, reject) {
  1188. capability.resolve = resolve;
  1189. capability.reject = reject;
  1190. });
  1191. return capability;
  1192. }
  1193. (function PromiseClosure() {
  1194. if (globalScope.Promise) {
  1195. if (typeof globalScope.Promise.all !== 'function') {
  1196. globalScope.Promise.all = function (iterable) {
  1197. var count = 0, results = [], resolve, reject;
  1198. var promise = new globalScope.Promise(function (resolve_, reject_) {
  1199. resolve = resolve_;
  1200. reject = reject_;
  1201. });
  1202. iterable.forEach(function (p, i) {
  1203. count++;
  1204. p.then(function (result) {
  1205. results[i] = result;
  1206. count--;
  1207. if (count === 0) {
  1208. resolve(results);
  1209. }
  1210. }, reject);
  1211. });
  1212. if (count === 0) {
  1213. resolve(results);
  1214. }
  1215. return promise;
  1216. };
  1217. }
  1218. if (typeof globalScope.Promise.resolve !== 'function') {
  1219. globalScope.Promise.resolve = function (value) {
  1220. return new globalScope.Promise(function (resolve) {
  1221. resolve(value);
  1222. });
  1223. };
  1224. }
  1225. if (typeof globalScope.Promise.reject !== 'function') {
  1226. globalScope.Promise.reject = function (reason) {
  1227. return new globalScope.Promise(function (resolve, reject) {
  1228. reject(reason);
  1229. });
  1230. };
  1231. }
  1232. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  1233. globalScope.Promise.prototype.catch = function (onReject) {
  1234. return globalScope.Promise.prototype.then(undefined, onReject);
  1235. };
  1236. }
  1237. return;
  1238. }
  1239. var STATUS_PENDING = 0;
  1240. var STATUS_RESOLVED = 1;
  1241. var STATUS_REJECTED = 2;
  1242. var REJECTION_TIMEOUT = 500;
  1243. var HandlerManager = {
  1244. handlers: [],
  1245. running: false,
  1246. unhandledRejections: [],
  1247. pendingRejectionCheck: false,
  1248. scheduleHandlers: function scheduleHandlers(promise) {
  1249. if (promise._status === STATUS_PENDING) {
  1250. return;
  1251. }
  1252. this.handlers = this.handlers.concat(promise._handlers);
  1253. promise._handlers = [];
  1254. if (this.running) {
  1255. return;
  1256. }
  1257. this.running = true;
  1258. setTimeout(this.runHandlers.bind(this), 0);
  1259. },
  1260. runHandlers: function runHandlers() {
  1261. var RUN_TIMEOUT = 1;
  1262. var timeoutAt = Date.now() + RUN_TIMEOUT;
  1263. while (this.handlers.length > 0) {
  1264. var handler = this.handlers.shift();
  1265. var nextStatus = handler.thisPromise._status;
  1266. var nextValue = handler.thisPromise._value;
  1267. try {
  1268. if (nextStatus === STATUS_RESOLVED) {
  1269. if (typeof handler.onResolve === 'function') {
  1270. nextValue = handler.onResolve(nextValue);
  1271. }
  1272. } else if (typeof handler.onReject === 'function') {
  1273. nextValue = handler.onReject(nextValue);
  1274. nextStatus = STATUS_RESOLVED;
  1275. if (handler.thisPromise._unhandledRejection) {
  1276. this.removeUnhandeledRejection(handler.thisPromise);
  1277. }
  1278. }
  1279. } catch (ex) {
  1280. nextStatus = STATUS_REJECTED;
  1281. nextValue = ex;
  1282. }
  1283. handler.nextPromise._updateStatus(nextStatus, nextValue);
  1284. if (Date.now() >= timeoutAt) {
  1285. break;
  1286. }
  1287. }
  1288. if (this.handlers.length > 0) {
  1289. setTimeout(this.runHandlers.bind(this), 0);
  1290. return;
  1291. }
  1292. this.running = false;
  1293. },
  1294. addUnhandledRejection: function addUnhandledRejection(promise) {
  1295. this.unhandledRejections.push({
  1296. promise: promise,
  1297. time: Date.now()
  1298. });
  1299. this.scheduleRejectionCheck();
  1300. },
  1301. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  1302. promise._unhandledRejection = false;
  1303. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1304. if (this.unhandledRejections[i].promise === promise) {
  1305. this.unhandledRejections.splice(i);
  1306. i--;
  1307. }
  1308. }
  1309. },
  1310. scheduleRejectionCheck: function scheduleRejectionCheck() {
  1311. if (this.pendingRejectionCheck) {
  1312. return;
  1313. }
  1314. this.pendingRejectionCheck = true;
  1315. setTimeout(function rejectionCheck() {
  1316. this.pendingRejectionCheck = false;
  1317. var now = Date.now();
  1318. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1319. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  1320. var unhandled = this.unhandledRejections[i].promise._value;
  1321. var msg = 'Unhandled rejection: ' + unhandled;
  1322. if (unhandled.stack) {
  1323. msg += '\n' + unhandled.stack;
  1324. }
  1325. warn(msg);
  1326. this.unhandledRejections.splice(i);
  1327. i--;
  1328. }
  1329. }
  1330. if (this.unhandledRejections.length) {
  1331. this.scheduleRejectionCheck();
  1332. }
  1333. }.bind(this), REJECTION_TIMEOUT);
  1334. }
  1335. };
  1336. var Promise = function Promise(resolver) {
  1337. this._status = STATUS_PENDING;
  1338. this._handlers = [];
  1339. try {
  1340. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  1341. } catch (e) {
  1342. this._reject(e);
  1343. }
  1344. };
  1345. Promise.all = function Promise_all(promises) {
  1346. var resolveAll, rejectAll;
  1347. var deferred = new Promise(function (resolve, reject) {
  1348. resolveAll = resolve;
  1349. rejectAll = reject;
  1350. });
  1351. var unresolved = promises.length;
  1352. var results = [];
  1353. if (unresolved === 0) {
  1354. resolveAll(results);
  1355. return deferred;
  1356. }
  1357. function reject(reason) {
  1358. if (deferred._status === STATUS_REJECTED) {
  1359. return;
  1360. }
  1361. results = [];
  1362. rejectAll(reason);
  1363. }
  1364. for (var i = 0, ii = promises.length; i < ii; ++i) {
  1365. var promise = promises[i];
  1366. var resolve = function (i) {
  1367. return function (value) {
  1368. if (deferred._status === STATUS_REJECTED) {
  1369. return;
  1370. }
  1371. results[i] = value;
  1372. unresolved--;
  1373. if (unresolved === 0) {
  1374. resolveAll(results);
  1375. }
  1376. };
  1377. }(i);
  1378. if (Promise.isPromise(promise)) {
  1379. promise.then(resolve, reject);
  1380. } else {
  1381. resolve(promise);
  1382. }
  1383. }
  1384. return deferred;
  1385. };
  1386. Promise.isPromise = function Promise_isPromise(value) {
  1387. return value && typeof value.then === 'function';
  1388. };
  1389. Promise.resolve = function Promise_resolve(value) {
  1390. return new Promise(function (resolve) {
  1391. resolve(value);
  1392. });
  1393. };
  1394. Promise.reject = function Promise_reject(reason) {
  1395. return new Promise(function (resolve, reject) {
  1396. reject(reason);
  1397. });
  1398. };
  1399. Promise.prototype = {
  1400. _status: null,
  1401. _value: null,
  1402. _handlers: null,
  1403. _unhandledRejection: null,
  1404. _updateStatus: function Promise__updateStatus(status, value) {
  1405. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  1406. return;
  1407. }
  1408. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  1409. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  1410. return;
  1411. }
  1412. this._status = status;
  1413. this._value = value;
  1414. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  1415. this._unhandledRejection = true;
  1416. HandlerManager.addUnhandledRejection(this);
  1417. }
  1418. HandlerManager.scheduleHandlers(this);
  1419. },
  1420. _resolve: function Promise_resolve(value) {
  1421. this._updateStatus(STATUS_RESOLVED, value);
  1422. },
  1423. _reject: function Promise_reject(reason) {
  1424. this._updateStatus(STATUS_REJECTED, reason);
  1425. },
  1426. then: function Promise_then(onResolve, onReject) {
  1427. var nextPromise = new Promise(function (resolve, reject) {
  1428. this.resolve = resolve;
  1429. this.reject = reject;
  1430. });
  1431. this._handlers.push({
  1432. thisPromise: this,
  1433. onResolve: onResolve,
  1434. onReject: onReject,
  1435. nextPromise: nextPromise
  1436. });
  1437. HandlerManager.scheduleHandlers(this);
  1438. return nextPromise;
  1439. },
  1440. catch: function Promise_catch(onReject) {
  1441. return this.then(undefined, onReject);
  1442. }
  1443. };
  1444. globalScope.Promise = Promise;
  1445. }());
  1446. (function WeakMapClosure() {
  1447. if (globalScope.WeakMap) {
  1448. return;
  1449. }
  1450. var id = 0;
  1451. function WeakMap() {
  1452. this.id = '$weakmap' + id++;
  1453. }
  1454. WeakMap.prototype = {
  1455. has: function (obj) {
  1456. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  1457. },
  1458. get: function (obj, defaultValue) {
  1459. return this.has(obj) ? obj[this.id] : defaultValue;
  1460. },
  1461. set: function (obj, value) {
  1462. Object.defineProperty(obj, this.id, {
  1463. value: value,
  1464. enumerable: false,
  1465. configurable: true
  1466. });
  1467. },
  1468. delete: function (obj) {
  1469. delete obj[this.id];
  1470. }
  1471. };
  1472. globalScope.WeakMap = WeakMap;
  1473. }());
  1474. var StatTimer = function StatTimerClosure() {
  1475. function rpad(str, pad, length) {
  1476. while (str.length < length) {
  1477. str += pad;
  1478. }
  1479. return str;
  1480. }
  1481. function StatTimer() {
  1482. this.started = Object.create(null);
  1483. this.times = [];
  1484. this.enabled = true;
  1485. }
  1486. StatTimer.prototype = {
  1487. time: function StatTimer_time(name) {
  1488. if (!this.enabled) {
  1489. return;
  1490. }
  1491. if (name in this.started) {
  1492. warn('Timer is already running for ' + name);
  1493. }
  1494. this.started[name] = Date.now();
  1495. },
  1496. timeEnd: function StatTimer_timeEnd(name) {
  1497. if (!this.enabled) {
  1498. return;
  1499. }
  1500. if (!(name in this.started)) {
  1501. warn('Timer has not been started for ' + name);
  1502. }
  1503. this.times.push({
  1504. 'name': name,
  1505. 'start': this.started[name],
  1506. 'end': Date.now()
  1507. });
  1508. delete this.started[name];
  1509. },
  1510. toString: function StatTimer_toString() {
  1511. var i, ii;
  1512. var times = this.times;
  1513. var out = '';
  1514. var longest = 0;
  1515. for (i = 0, ii = times.length; i < ii; ++i) {
  1516. var name = times[i]['name'];
  1517. if (name.length > longest) {
  1518. longest = name.length;
  1519. }
  1520. }
  1521. for (i = 0, ii = times.length; i < ii; ++i) {
  1522. var span = times[i];
  1523. var duration = span.end - span.start;
  1524. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1525. }
  1526. return out;
  1527. }
  1528. };
  1529. return StatTimer;
  1530. }();
  1531. var createBlob = function createBlob(data, contentType) {
  1532. if (typeof Blob !== 'undefined') {
  1533. return new Blob([data], { type: contentType });
  1534. }
  1535. warn('The "Blob" constructor is not supported.');
  1536. };
  1537. var createObjectURL = function createObjectURLClosure() {
  1538. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1539. return function createObjectURL(data, contentType, forceDataSchema) {
  1540. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1541. var blob = createBlob(data, contentType);
  1542. return URL.createObjectURL(blob);
  1543. }
  1544. var buffer = 'data:' + contentType + ';base64,';
  1545. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1546. var b1 = data[i] & 0xFF;
  1547. var b2 = data[i + 1] & 0xFF;
  1548. var b3 = data[i + 2] & 0xFF;
  1549. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1550. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1551. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1552. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1553. }
  1554. return buffer;
  1555. };
  1556. }();
  1557. function MessageHandler(sourceName, targetName, comObj) {
  1558. this.sourceName = sourceName;
  1559. this.targetName = targetName;
  1560. this.comObj = comObj;
  1561. this.callbackIndex = 1;
  1562. this.postMessageTransfers = true;
  1563. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1564. var ah = this.actionHandler = Object.create(null);
  1565. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1566. var data = event.data;
  1567. if (data.targetName !== this.sourceName) {
  1568. return;
  1569. }
  1570. if (data.isReply) {
  1571. var callbackId = data.callbackId;
  1572. if (data.callbackId in callbacksCapabilities) {
  1573. var callback = callbacksCapabilities[callbackId];
  1574. delete callbacksCapabilities[callbackId];
  1575. if ('error' in data) {
  1576. callback.reject(data.error);
  1577. } else {
  1578. callback.resolve(data.data);
  1579. }
  1580. } else {
  1581. error('Cannot resolve callback ' + callbackId);
  1582. }
  1583. } else if (data.action in ah) {
  1584. var action = ah[data.action];
  1585. if (data.callbackId) {
  1586. var sourceName = this.sourceName;
  1587. var targetName = data.sourceName;
  1588. Promise.resolve().then(function () {
  1589. return action[0].call(action[1], data.data);
  1590. }).then(function (result) {
  1591. comObj.postMessage({
  1592. sourceName: sourceName,
  1593. targetName: targetName,
  1594. isReply: true,
  1595. callbackId: data.callbackId,
  1596. data: result
  1597. });
  1598. }, function (reason) {
  1599. if (reason instanceof Error) {
  1600. reason = reason + '';
  1601. }
  1602. comObj.postMessage({
  1603. sourceName: sourceName,
  1604. targetName: targetName,
  1605. isReply: true,
  1606. callbackId: data.callbackId,
  1607. error: reason
  1608. });
  1609. });
  1610. } else {
  1611. action[0].call(action[1], data.data);
  1612. }
  1613. } else {
  1614. error('Unknown action from worker: ' + data.action);
  1615. }
  1616. }.bind(this);
  1617. comObj.addEventListener('message', this._onComObjOnMessage);
  1618. }
  1619. MessageHandler.prototype = {
  1620. on: function messageHandlerOn(actionName, handler, scope) {
  1621. var ah = this.actionHandler;
  1622. if (ah[actionName]) {
  1623. error('There is already an actionName called "' + actionName + '"');
  1624. }
  1625. ah[actionName] = [
  1626. handler,
  1627. scope
  1628. ];
  1629. },
  1630. send: function messageHandlerSend(actionName, data, transfers) {
  1631. var message = {
  1632. sourceName: this.sourceName,
  1633. targetName: this.targetName,
  1634. action: actionName,
  1635. data: data
  1636. };
  1637. this.postMessage(message, transfers);
  1638. },
  1639. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1640. var callbackId = this.callbackIndex++;
  1641. var message = {
  1642. sourceName: this.sourceName,
  1643. targetName: this.targetName,
  1644. action: actionName,
  1645. data: data,
  1646. callbackId: callbackId
  1647. };
  1648. var capability = createPromiseCapability();
  1649. this.callbacksCapabilities[callbackId] = capability;
  1650. try {
  1651. this.postMessage(message, transfers);
  1652. } catch (e) {
  1653. capability.reject(e);
  1654. }
  1655. return capability.promise;
  1656. },
  1657. postMessage: function (message, transfers) {
  1658. if (transfers && this.postMessageTransfers) {
  1659. this.comObj.postMessage(message, transfers);
  1660. } else {
  1661. this.comObj.postMessage(message);
  1662. }
  1663. },
  1664. destroy: function () {
  1665. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1666. }
  1667. };
  1668. function loadJpegStream(id, imageUrl, objs) {
  1669. var img = new Image();
  1670. img.onload = function loadJpegStream_onloadClosure() {
  1671. objs.resolve(id, img);
  1672. };
  1673. img.onerror = function loadJpegStream_onerrorClosure() {
  1674. objs.resolve(id, null);
  1675. warn('Error during JPEG image loading');
  1676. };
  1677. img.src = imageUrl;
  1678. }
  1679. (function checkURLConstructor(scope) {
  1680. var hasWorkingUrl = false;
  1681. try {
  1682. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  1683. var u = new URL('b', 'http://a');
  1684. u.pathname = 'c%20d';
  1685. hasWorkingUrl = u.href === 'http://a/c%20d';
  1686. }
  1687. } catch (e) {
  1688. }
  1689. if (hasWorkingUrl) {
  1690. return;
  1691. }
  1692. var relative = Object.create(null);
  1693. relative['ftp'] = 21;
  1694. relative['file'] = 0;
  1695. relative['gopher'] = 70;
  1696. relative['http'] = 80;
  1697. relative['https'] = 443;
  1698. relative['ws'] = 80;
  1699. relative['wss'] = 443;
  1700. var relativePathDotMapping = Object.create(null);
  1701. relativePathDotMapping['%2e'] = '.';
  1702. relativePathDotMapping['.%2e'] = '..';
  1703. relativePathDotMapping['%2e.'] = '..';
  1704. relativePathDotMapping['%2e%2e'] = '..';
  1705. function isRelativeScheme(scheme) {
  1706. return relative[scheme] !== undefined;
  1707. }
  1708. function invalid() {
  1709. clear.call(this);
  1710. this._isInvalid = true;
  1711. }
  1712. function IDNAToASCII(h) {
  1713. if (h === '') {
  1714. invalid.call(this);
  1715. }
  1716. return h.toLowerCase();
  1717. }
  1718. function percentEscape(c) {
  1719. var unicode = c.charCodeAt(0);
  1720. if (unicode > 0x20 && unicode < 0x7F && [
  1721. 0x22,
  1722. 0x23,
  1723. 0x3C,
  1724. 0x3E,
  1725. 0x3F,
  1726. 0x60
  1727. ].indexOf(unicode) === -1) {
  1728. return c;
  1729. }
  1730. return encodeURIComponent(c);
  1731. }
  1732. function percentEscapeQuery(c) {
  1733. var unicode = c.charCodeAt(0);
  1734. if (unicode > 0x20 && unicode < 0x7F && [
  1735. 0x22,
  1736. 0x23,
  1737. 0x3C,
  1738. 0x3E,
  1739. 0x60
  1740. ].indexOf(unicode) === -1) {
  1741. return c;
  1742. }
  1743. return encodeURIComponent(c);
  1744. }
  1745. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  1746. function parse(input, stateOverride, base) {
  1747. function err(message) {
  1748. errors.push(message);
  1749. }
  1750. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  1751. loop:
  1752. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  1753. var c = input[cursor];
  1754. switch (state) {
  1755. case 'scheme start':
  1756. if (c && ALPHA.test(c)) {
  1757. buffer += c.toLowerCase();
  1758. state = 'scheme';
  1759. } else if (!stateOverride) {
  1760. buffer = '';
  1761. state = 'no scheme';
  1762. continue;
  1763. } else {
  1764. err('Invalid scheme.');
  1765. break loop;
  1766. }
  1767. break;
  1768. case 'scheme':
  1769. if (c && ALPHANUMERIC.test(c)) {
  1770. buffer += c.toLowerCase();
  1771. } else if (c === ':') {
  1772. this._scheme = buffer;
  1773. buffer = '';
  1774. if (stateOverride) {
  1775. break loop;
  1776. }
  1777. if (isRelativeScheme(this._scheme)) {
  1778. this._isRelative = true;
  1779. }
  1780. if (this._scheme === 'file') {
  1781. state = 'relative';
  1782. } else if (this._isRelative && base && base._scheme === this._scheme) {
  1783. state = 'relative or authority';
  1784. } else if (this._isRelative) {
  1785. state = 'authority first slash';
  1786. } else {
  1787. state = 'scheme data';
  1788. }
  1789. } else if (!stateOverride) {
  1790. buffer = '';
  1791. cursor = 0;
  1792. state = 'no scheme';
  1793. continue;
  1794. } else if (EOF === c) {
  1795. break loop;
  1796. } else {
  1797. err('Code point not allowed in scheme: ' + c);
  1798. break loop;
  1799. }
  1800. break;
  1801. case 'scheme data':
  1802. if (c === '?') {
  1803. this._query = '?';
  1804. state = 'query';
  1805. } else if (c === '#') {
  1806. this._fragment = '#';
  1807. state = 'fragment';
  1808. } else {
  1809. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  1810. this._schemeData += percentEscape(c);
  1811. }
  1812. }
  1813. break;
  1814. case 'no scheme':
  1815. if (!base || !isRelativeScheme(base._scheme)) {
  1816. err('Missing scheme.');
  1817. invalid.call(this);
  1818. } else {
  1819. state = 'relative';
  1820. continue;
  1821. }
  1822. break;
  1823. case 'relative or authority':
  1824. if (c === '/' && input[cursor + 1] === '/') {
  1825. state = 'authority ignore slashes';
  1826. } else {
  1827. err('Expected /, got: ' + c);
  1828. state = 'relative';
  1829. continue;
  1830. }
  1831. break;
  1832. case 'relative':
  1833. this._isRelative = true;
  1834. if ('file' !== this._scheme) {
  1835. this._scheme = base._scheme;
  1836. }
  1837. if (EOF === c) {
  1838. this._host = base._host;
  1839. this._port = base._port;
  1840. this._path = base._path.slice();
  1841. this._query = base._query;
  1842. this._username = base._username;
  1843. this._password = base._password;
  1844. break loop;
  1845. } else if (c === '/' || c === '\\') {
  1846. if (c === '\\') {
  1847. err('\\ is an invalid code point.');
  1848. }
  1849. state = 'relative slash';
  1850. } else if (c === '?') {
  1851. this._host = base._host;
  1852. this._port = base._port;
  1853. this._path = base._path.slice();
  1854. this._query = '?';
  1855. this._username = base._username;
  1856. this._password = base._password;
  1857. state = 'query';
  1858. } else if (c === '#') {
  1859. this._host = base._host;
  1860. this._port = base._port;
  1861. this._path = base._path.slice();
  1862. this._query = base._query;
  1863. this._fragment = '#';
  1864. this._username = base._username;
  1865. this._password = base._password;
  1866. state = 'fragment';
  1867. } else {
  1868. var nextC = input[cursor + 1];
  1869. var nextNextC = input[cursor + 2];
  1870. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  1871. this._host = base._host;
  1872. this._port = base._port;
  1873. this._username = base._username;
  1874. this._password = base._password;
  1875. this._path = base._path.slice();
  1876. this._path.pop();
  1877. }
  1878. state = 'relative path';
  1879. continue;
  1880. }
  1881. break;
  1882. case 'relative slash':
  1883. if (c === '/' || c === '\\') {
  1884. if (c === '\\') {
  1885. err('\\ is an invalid code point.');
  1886. }
  1887. if (this._scheme === 'file') {
  1888. state = 'file host';
  1889. } else {
  1890. state = 'authority ignore slashes';
  1891. }
  1892. } else {
  1893. if ('file' !== this._scheme) {
  1894. this._host = base._host;
  1895. this._port = base._port;
  1896. this._username = base._username;
  1897. this._password = base._password;
  1898. }
  1899. state = 'relative path';
  1900. continue;
  1901. }
  1902. break;
  1903. case 'authority first slash':
  1904. if (c === '/') {
  1905. state = 'authority second slash';
  1906. } else {
  1907. err('Expected \'/\', got: ' + c);
  1908. state = 'authority ignore slashes';
  1909. continue;
  1910. }
  1911. break;
  1912. case 'authority second slash':
  1913. state = 'authority ignore slashes';
  1914. if ('/' !== c) {
  1915. err('Expected \'/\', got: ' + c);
  1916. continue;
  1917. }
  1918. break;
  1919. case 'authority ignore slashes':
  1920. if ('/' !== c && '\\' !== c) {
  1921. state = 'authority';
  1922. continue;
  1923. } else {
  1924. err('Expected authority, got: ' + c);
  1925. }
  1926. break;
  1927. case 'authority':
  1928. if (c === '@') {
  1929. if (seenAt) {
  1930. err('@ already seen.');
  1931. buffer += '%40';
  1932. }
  1933. seenAt = true;
  1934. for (var i = 0; i < buffer.length; i++) {
  1935. var cp = buffer[i];
  1936. if (cp === '\t' || cp === '\n' || cp === '\r') {
  1937. err('Invalid whitespace in authority.');
  1938. continue;
  1939. }
  1940. if (cp === ':' && this._password === null) {
  1941. this._password = '';
  1942. continue;
  1943. }
  1944. var tempC = percentEscape(cp);
  1945. if (null !== this._password) {
  1946. this._password += tempC;
  1947. } else {
  1948. this._username += tempC;
  1949. }
  1950. }
  1951. buffer = '';
  1952. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1953. cursor -= buffer.length;
  1954. buffer = '';
  1955. state = 'host';
  1956. continue;
  1957. } else {
  1958. buffer += c;
  1959. }
  1960. break;
  1961. case 'file host':
  1962. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1963. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  1964. state = 'relative path';
  1965. } else if (buffer.length === 0) {
  1966. state = 'relative path start';
  1967. } else {
  1968. this._host = IDNAToASCII.call(this, buffer);
  1969. buffer = '';
  1970. state = 'relative path start';
  1971. }
  1972. continue;
  1973. } else if (c === '\t' || c === '\n' || c === '\r') {
  1974. err('Invalid whitespace in file host.');
  1975. } else {
  1976. buffer += c;
  1977. }
  1978. break;
  1979. case 'host':
  1980. case 'hostname':
  1981. if (c === ':' && !seenBracket) {
  1982. this._host = IDNAToASCII.call(this, buffer);
  1983. buffer = '';
  1984. state = 'port';
  1985. if (stateOverride === 'hostname') {
  1986. break loop;
  1987. }
  1988. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1989. this._host = IDNAToASCII.call(this, buffer);
  1990. buffer = '';
  1991. state = 'relative path start';
  1992. if (stateOverride) {
  1993. break loop;
  1994. }
  1995. continue;
  1996. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  1997. if (c === '[') {
  1998. seenBracket = true;
  1999. } else if (c === ']') {
  2000. seenBracket = false;
  2001. }
  2002. buffer += c;
  2003. } else {
  2004. err('Invalid code point in host/hostname: ' + c);
  2005. }
  2006. break;
  2007. case 'port':
  2008. if (/[0-9]/.test(c)) {
  2009. buffer += c;
  2010. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  2011. if ('' !== buffer) {
  2012. var temp = parseInt(buffer, 10);
  2013. if (temp !== relative[this._scheme]) {
  2014. this._port = temp + '';
  2015. }
  2016. buffer = '';
  2017. }
  2018. if (stateOverride) {
  2019. break loop;
  2020. }
  2021. state = 'relative path start';
  2022. continue;
  2023. } else if (c === '\t' || c === '\n' || c === '\r') {
  2024. err('Invalid code point in port: ' + c);
  2025. } else {
  2026. invalid.call(this);
  2027. }
  2028. break;
  2029. case 'relative path start':
  2030. if (c === '\\') {
  2031. err('\'\\\' not allowed in path.');
  2032. }
  2033. state = 'relative path';
  2034. if ('/' !== c && '\\' !== c) {
  2035. continue;
  2036. }
  2037. break;
  2038. case 'relative path':
  2039. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  2040. if (c === '\\') {
  2041. err('\\ not allowed in relative path.');
  2042. }
  2043. var tmp;
  2044. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  2045. buffer = tmp;
  2046. }
  2047. if (buffer === '..') {
  2048. this._path.pop();
  2049. if ('/' !== c && '\\' !== c) {
  2050. this._path.push('');
  2051. }
  2052. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  2053. this._path.push('');
  2054. } else if ('.' !== buffer) {
  2055. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  2056. buffer = buffer[0] + ':';
  2057. }
  2058. this._path.push(buffer);
  2059. }
  2060. buffer = '';
  2061. if (c === '?') {
  2062. this._query = '?';
  2063. state = 'query';
  2064. } else if (c === '#') {
  2065. this._fragment = '#';
  2066. state = 'fragment';
  2067. }
  2068. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  2069. buffer += percentEscape(c);
  2070. }
  2071. break;
  2072. case 'query':
  2073. if (!stateOverride && c === '#') {
  2074. this._fragment = '#';
  2075. state = 'fragment';
  2076. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2077. this._query += percentEscapeQuery(c);
  2078. }
  2079. break;
  2080. case 'fragment':
  2081. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2082. this._fragment += c;
  2083. }
  2084. break;
  2085. }
  2086. cursor++;
  2087. }
  2088. }
  2089. function clear() {
  2090. this._scheme = '';
  2091. this._schemeData = '';
  2092. this._username = '';
  2093. this._password = null;
  2094. this._host = '';
  2095. this._port = '';
  2096. this._path = [];
  2097. this._query = '';
  2098. this._fragment = '';
  2099. this._isInvalid = false;
  2100. this._isRelative = false;
  2101. }
  2102. function JURL(url, base) {
  2103. if (base !== undefined && !(base instanceof JURL)) {
  2104. base = new JURL(String(base));
  2105. }
  2106. this._url = url;
  2107. clear.call(this);
  2108. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  2109. parse.call(this, input, null, base);
  2110. }
  2111. JURL.prototype = {
  2112. toString: function () {
  2113. return this.href;
  2114. },
  2115. get href() {
  2116. if (this._isInvalid) {
  2117. return this._url;
  2118. }
  2119. var authority = '';
  2120. if ('' !== this._username || null !== this._password) {
  2121. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  2122. }
  2123. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  2124. },
  2125. set href(href) {
  2126. clear.call(this);
  2127. parse.call(this, href);
  2128. },
  2129. get protocol() {
  2130. return this._scheme + ':';
  2131. },
  2132. set protocol(protocol) {
  2133. if (this._isInvalid) {
  2134. return;
  2135. }
  2136. parse.call(this, protocol + ':', 'scheme start');
  2137. },
  2138. get host() {
  2139. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  2140. },
  2141. set host(host) {
  2142. if (this._isInvalid || !this._isRelative) {
  2143. return;
  2144. }
  2145. parse.call(this, host, 'host');
  2146. },
  2147. get hostname() {
  2148. return this._host;
  2149. },
  2150. set hostname(hostname) {
  2151. if (this._isInvalid || !this._isRelative) {
  2152. return;
  2153. }
  2154. parse.call(this, hostname, 'hostname');
  2155. },
  2156. get port() {
  2157. return this._port;
  2158. },
  2159. set port(port) {
  2160. if (this._isInvalid || !this._isRelative) {
  2161. return;
  2162. }
  2163. parse.call(this, port, 'port');
  2164. },
  2165. get pathname() {
  2166. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  2167. },
  2168. set pathname(pathname) {
  2169. if (this._isInvalid || !this._isRelative) {
  2170. return;
  2171. }
  2172. this._path = [];
  2173. parse.call(this, pathname, 'relative path start');
  2174. },
  2175. get search() {
  2176. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  2177. },
  2178. set search(search) {
  2179. if (this._isInvalid || !this._isRelative) {
  2180. return;
  2181. }
  2182. this._query = '?';
  2183. if (search[0] === '?') {
  2184. search = search.slice(1);
  2185. }
  2186. parse.call(this, search, 'query');
  2187. },
  2188. get hash() {
  2189. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  2190. },
  2191. set hash(hash) {
  2192. if (this._isInvalid) {
  2193. return;
  2194. }
  2195. this._fragment = '#';
  2196. if (hash[0] === '#') {
  2197. hash = hash.slice(1);
  2198. }
  2199. parse.call(this, hash, 'fragment');
  2200. },
  2201. get origin() {
  2202. var host;
  2203. if (this._isInvalid || !this._scheme) {
  2204. return '';
  2205. }
  2206. switch (this._scheme) {
  2207. case 'data':
  2208. case 'file':
  2209. case 'javascript':
  2210. case 'mailto':
  2211. return 'null';
  2212. }
  2213. host = this.host;
  2214. if (!host) {
  2215. return '';
  2216. }
  2217. return this._scheme + '://' + host;
  2218. }
  2219. };
  2220. var OriginalURL = scope.URL;
  2221. if (OriginalURL) {
  2222. JURL.createObjectURL = function (blob) {
  2223. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  2224. };
  2225. JURL.revokeObjectURL = function (url) {
  2226. OriginalURL.revokeObjectURL(url);
  2227. };
  2228. }
  2229. scope.URL = JURL;
  2230. }(globalScope));
  2231. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  2232. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  2233. exports.OPS = OPS;
  2234. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  2235. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  2236. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  2237. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  2238. exports.AnnotationFlag = AnnotationFlag;
  2239. exports.AnnotationType = AnnotationType;
  2240. exports.FontType = FontType;
  2241. exports.ImageKind = ImageKind;
  2242. exports.InvalidPDFException = InvalidPDFException;
  2243. exports.MessageHandler = MessageHandler;
  2244. exports.MissingDataException = MissingDataException;
  2245. exports.MissingPDFException = MissingPDFException;
  2246. exports.NotImplementedException = NotImplementedException;
  2247. exports.PageViewport = PageViewport;
  2248. exports.PasswordException = PasswordException;
  2249. exports.PasswordResponses = PasswordResponses;
  2250. exports.StatTimer = StatTimer;
  2251. exports.StreamType = StreamType;
  2252. exports.TextRenderingMode = TextRenderingMode;
  2253. exports.UnexpectedResponseException = UnexpectedResponseException;
  2254. exports.UnknownErrorException = UnknownErrorException;
  2255. exports.Util = Util;
  2256. exports.XRefParseException = XRefParseException;
  2257. exports.arrayByteLength = arrayByteLength;
  2258. exports.arraysToBytes = arraysToBytes;
  2259. exports.assert = assert;
  2260. exports.bytesToString = bytesToString;
  2261. exports.createBlob = createBlob;
  2262. exports.createPromiseCapability = createPromiseCapability;
  2263. exports.createObjectURL = createObjectURL;
  2264. exports.deprecated = deprecated;
  2265. exports.error = error;
  2266. exports.getLookupTableFactory = getLookupTableFactory;
  2267. exports.getVerbosityLevel = getVerbosityLevel;
  2268. exports.globalScope = globalScope;
  2269. exports.info = info;
  2270. exports.isArray = isArray;
  2271. exports.isArrayBuffer = isArrayBuffer;
  2272. exports.isBool = isBool;
  2273. exports.isEmptyObj = isEmptyObj;
  2274. exports.isInt = isInt;
  2275. exports.isNum = isNum;
  2276. exports.isString = isString;
  2277. exports.isSpace = isSpace;
  2278. exports.isSameOrigin = isSameOrigin;
  2279. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  2280. exports.isLittleEndian = isLittleEndian;
  2281. exports.isEvalSupported = isEvalSupported;
  2282. exports.loadJpegStream = loadJpegStream;
  2283. exports.log2 = log2;
  2284. exports.readInt8 = readInt8;
  2285. exports.readUint16 = readUint16;
  2286. exports.readUint32 = readUint32;
  2287. exports.removeNullCharacters = removeNullCharacters;
  2288. exports.setVerbosityLevel = setVerbosityLevel;
  2289. exports.shadow = shadow;
  2290. exports.string32 = string32;
  2291. exports.stringToBytes = stringToBytes;
  2292. exports.stringToPDFString = stringToPDFString;
  2293. exports.stringToUTF8String = stringToUTF8String;
  2294. exports.utf8StringToString = utf8StringToString;
  2295. exports.warn = warn;
  2296. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(19)))
  2297. /***/ }),
  2298. /* 1 */
  2299. /***/ (function(module, exports, __w_pdfjs_require__) {
  2300. "use strict";
  2301. var sharedUtil = __w_pdfjs_require__(0);
  2302. var isArray = sharedUtil.isArray;
  2303. var EOF = {};
  2304. var Name = function NameClosure() {
  2305. function Name(name) {
  2306. this.name = name;
  2307. }
  2308. Name.prototype = {};
  2309. var nameCache = Object.create(null);
  2310. Name.get = function Name_get(name) {
  2311. var nameValue = nameCache[name];
  2312. return nameValue ? nameValue : nameCache[name] = new Name(name);
  2313. };
  2314. return Name;
  2315. }();
  2316. var Cmd = function CmdClosure() {
  2317. function Cmd(cmd) {
  2318. this.cmd = cmd;
  2319. }
  2320. Cmd.prototype = {};
  2321. var cmdCache = Object.create(null);
  2322. Cmd.get = function Cmd_get(cmd) {
  2323. var cmdValue = cmdCache[cmd];
  2324. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  2325. };
  2326. return Cmd;
  2327. }();
  2328. var Dict = function DictClosure() {
  2329. var nonSerializable = function nonSerializableClosure() {
  2330. return nonSerializable;
  2331. };
  2332. function Dict(xref) {
  2333. this.map = Object.create(null);
  2334. this.xref = xref;
  2335. this.objId = null;
  2336. this.suppressEncryption = false;
  2337. this.__nonSerializable__ = nonSerializable;
  2338. }
  2339. Dict.prototype = {
  2340. assignXref: function Dict_assignXref(newXref) {
  2341. this.xref = newXref;
  2342. },
  2343. get: function Dict_get(key1, key2, key3) {
  2344. var value;
  2345. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2346. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2347. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2348. }
  2349. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2350. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2351. }
  2352. value = this.map[key3] || null;
  2353. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2354. },
  2355. getAsync: function Dict_getAsync(key1, key2, key3) {
  2356. var value;
  2357. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2358. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2359. if (xref) {
  2360. return xref.fetchIfRefAsync(value, suppressEncryption);
  2361. }
  2362. return Promise.resolve(value);
  2363. }
  2364. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2365. if (xref) {
  2366. return xref.fetchIfRefAsync(value, suppressEncryption);
  2367. }
  2368. return Promise.resolve(value);
  2369. }
  2370. value = this.map[key3] || null;
  2371. if (xref) {
  2372. return xref.fetchIfRefAsync(value, suppressEncryption);
  2373. }
  2374. return Promise.resolve(value);
  2375. },
  2376. getArray: function Dict_getArray(key1, key2, key3) {
  2377. var value = this.get(key1, key2, key3);
  2378. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2379. if (!isArray(value) || !xref) {
  2380. return value;
  2381. }
  2382. value = value.slice();
  2383. for (var i = 0, ii = value.length; i < ii; i++) {
  2384. if (!isRef(value[i])) {
  2385. continue;
  2386. }
  2387. value[i] = xref.fetch(value[i], suppressEncryption);
  2388. }
  2389. return value;
  2390. },
  2391. getRaw: function Dict_getRaw(key) {
  2392. return this.map[key];
  2393. },
  2394. getKeys: function Dict_getKeys() {
  2395. return Object.keys(this.map);
  2396. },
  2397. set: function Dict_set(key, value) {
  2398. this.map[key] = value;
  2399. },
  2400. has: function Dict_has(key) {
  2401. return key in this.map;
  2402. },
  2403. forEach: function Dict_forEach(callback) {
  2404. for (var key in this.map) {
  2405. callback(key, this.get(key));
  2406. }
  2407. }
  2408. };
  2409. Dict.empty = new Dict(null);
  2410. Dict.merge = function Dict_merge(xref, dictArray) {
  2411. var mergedDict = new Dict(xref);
  2412. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  2413. var dict = dictArray[i];
  2414. if (!isDict(dict)) {
  2415. continue;
  2416. }
  2417. for (var keyName in dict.map) {
  2418. if (mergedDict.map[keyName]) {
  2419. continue;
  2420. }
  2421. mergedDict.map[keyName] = dict.map[keyName];
  2422. }
  2423. }
  2424. return mergedDict;
  2425. };
  2426. return Dict;
  2427. }();
  2428. var Ref = function RefClosure() {
  2429. function Ref(num, gen) {
  2430. this.num = num;
  2431. this.gen = gen;
  2432. }
  2433. Ref.prototype = {
  2434. toString: function Ref_toString() {
  2435. var str = this.num + 'R';
  2436. if (this.gen !== 0) {
  2437. str += this.gen;
  2438. }
  2439. return str;
  2440. }
  2441. };
  2442. return Ref;
  2443. }();
  2444. var RefSet = function RefSetClosure() {
  2445. function RefSet() {
  2446. this.dict = Object.create(null);
  2447. }
  2448. RefSet.prototype = {
  2449. has: function RefSet_has(ref) {
  2450. return ref.toString() in this.dict;
  2451. },
  2452. put: function RefSet_put(ref) {
  2453. this.dict[ref.toString()] = true;
  2454. },
  2455. remove: function RefSet_remove(ref) {
  2456. delete this.dict[ref.toString()];
  2457. }
  2458. };
  2459. return RefSet;
  2460. }();
  2461. var RefSetCache = function RefSetCacheClosure() {
  2462. function RefSetCache() {
  2463. this.dict = Object.create(null);
  2464. }
  2465. RefSetCache.prototype = {
  2466. get: function RefSetCache_get(ref) {
  2467. return this.dict[ref.toString()];
  2468. },
  2469. has: function RefSetCache_has(ref) {
  2470. return ref.toString() in this.dict;
  2471. },
  2472. put: function RefSetCache_put(ref, obj) {
  2473. this.dict[ref.toString()] = obj;
  2474. },
  2475. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  2476. this.dict[ref.toString()] = this.get(aliasRef);
  2477. },
  2478. forEach: function RefSetCache_forEach(fn, thisArg) {
  2479. for (var i in this.dict) {
  2480. fn.call(thisArg, this.dict[i]);
  2481. }
  2482. },
  2483. clear: function RefSetCache_clear() {
  2484. this.dict = Object.create(null);
  2485. }
  2486. };
  2487. return RefSetCache;
  2488. }();
  2489. function isEOF(v) {
  2490. return v === EOF;
  2491. }
  2492. function isName(v, name) {
  2493. return v instanceof Name && (name === undefined || v.name === name);
  2494. }
  2495. function isCmd(v, cmd) {
  2496. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  2497. }
  2498. function isDict(v, type) {
  2499. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  2500. }
  2501. function isRef(v) {
  2502. return v instanceof Ref;
  2503. }
  2504. function isRefsEqual(v1, v2) {
  2505. return v1.num === v2.num && v1.gen === v2.gen;
  2506. }
  2507. function isStream(v) {
  2508. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  2509. }
  2510. exports.EOF = EOF;
  2511. exports.Cmd = Cmd;
  2512. exports.Dict = Dict;
  2513. exports.Name = Name;
  2514. exports.Ref = Ref;
  2515. exports.RefSet = RefSet;
  2516. exports.RefSetCache = RefSetCache;
  2517. exports.isEOF = isEOF;
  2518. exports.isCmd = isCmd;
  2519. exports.isDict = isDict;
  2520. exports.isName = isName;
  2521. exports.isRef = isRef;
  2522. exports.isRefsEqual = isRefsEqual;
  2523. exports.isStream = isStream;
  2524. /***/ }),
  2525. /* 2 */
  2526. /***/ (function(module, exports, __w_pdfjs_require__) {
  2527. "use strict";
  2528. var sharedUtil = __w_pdfjs_require__(0);
  2529. var corePrimitives = __w_pdfjs_require__(1);
  2530. var coreJbig2 = __w_pdfjs_require__(29);
  2531. var coreJpg = __w_pdfjs_require__(30);
  2532. var coreJpx = __w_pdfjs_require__(14);
  2533. var Util = sharedUtil.Util;
  2534. var error = sharedUtil.error;
  2535. var info = sharedUtil.info;
  2536. var isInt = sharedUtil.isInt;
  2537. var isArray = sharedUtil.isArray;
  2538. var createObjectURL = sharedUtil.createObjectURL;
  2539. var shadow = sharedUtil.shadow;
  2540. var isSpace = sharedUtil.isSpace;
  2541. var Dict = corePrimitives.Dict;
  2542. var isDict = corePrimitives.isDict;
  2543. var isStream = corePrimitives.isStream;
  2544. var Jbig2Image = coreJbig2.Jbig2Image;
  2545. var JpegImage = coreJpg.JpegImage;
  2546. var JpxImage = coreJpx.JpxImage;
  2547. var Stream = function StreamClosure() {
  2548. function Stream(arrayBuffer, start, length, dict) {
  2549. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2550. this.start = start || 0;
  2551. this.pos = this.start;
  2552. this.end = start + length || this.bytes.length;
  2553. this.dict = dict;
  2554. }
  2555. Stream.prototype = {
  2556. get length() {
  2557. return this.end - this.start;
  2558. },
  2559. get isEmpty() {
  2560. return this.length === 0;
  2561. },
  2562. getByte: function Stream_getByte() {
  2563. if (this.pos >= this.end) {
  2564. return -1;
  2565. }
  2566. return this.bytes[this.pos++];
  2567. },
  2568. getUint16: function Stream_getUint16() {
  2569. var b0 = this.getByte();
  2570. var b1 = this.getByte();
  2571. if (b0 === -1 || b1 === -1) {
  2572. return -1;
  2573. }
  2574. return (b0 << 8) + b1;
  2575. },
  2576. getInt32: function Stream_getInt32() {
  2577. var b0 = this.getByte();
  2578. var b1 = this.getByte();
  2579. var b2 = this.getByte();
  2580. var b3 = this.getByte();
  2581. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2582. },
  2583. getBytes: function Stream_getBytes(length) {
  2584. var bytes = this.bytes;
  2585. var pos = this.pos;
  2586. var strEnd = this.end;
  2587. if (!length) {
  2588. return bytes.subarray(pos, strEnd);
  2589. }
  2590. var end = pos + length;
  2591. if (end > strEnd) {
  2592. end = strEnd;
  2593. }
  2594. this.pos = end;
  2595. return bytes.subarray(pos, end);
  2596. },
  2597. peekByte: function Stream_peekByte() {
  2598. var peekedByte = this.getByte();
  2599. this.pos--;
  2600. return peekedByte;
  2601. },
  2602. peekBytes: function Stream_peekBytes(length) {
  2603. var bytes = this.getBytes(length);
  2604. this.pos -= bytes.length;
  2605. return bytes;
  2606. },
  2607. skip: function Stream_skip(n) {
  2608. if (!n) {
  2609. n = 1;
  2610. }
  2611. this.pos += n;
  2612. },
  2613. reset: function Stream_reset() {
  2614. this.pos = this.start;
  2615. },
  2616. moveStart: function Stream_moveStart() {
  2617. this.start = this.pos;
  2618. },
  2619. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  2620. return new Stream(this.bytes.buffer, start, length, dict);
  2621. }
  2622. };
  2623. return Stream;
  2624. }();
  2625. var StringStream = function StringStreamClosure() {
  2626. function StringStream(str) {
  2627. var length = str.length;
  2628. var bytes = new Uint8Array(length);
  2629. for (var n = 0; n < length; ++n) {
  2630. bytes[n] = str.charCodeAt(n);
  2631. }
  2632. Stream.call(this, bytes);
  2633. }
  2634. StringStream.prototype = Stream.prototype;
  2635. return StringStream;
  2636. }();
  2637. var DecodeStream = function DecodeStreamClosure() {
  2638. var emptyBuffer = new Uint8Array(0);
  2639. function DecodeStream(maybeMinBufferLength) {
  2640. this.pos = 0;
  2641. this.bufferLength = 0;
  2642. this.eof = false;
  2643. this.buffer = emptyBuffer;
  2644. this.minBufferLength = 512;
  2645. if (maybeMinBufferLength) {
  2646. while (this.minBufferLength < maybeMinBufferLength) {
  2647. this.minBufferLength *= 2;
  2648. }
  2649. }
  2650. }
  2651. DecodeStream.prototype = {
  2652. get isEmpty() {
  2653. while (!this.eof && this.bufferLength === 0) {
  2654. this.readBlock();
  2655. }
  2656. return this.bufferLength === 0;
  2657. },
  2658. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  2659. var buffer = this.buffer;
  2660. if (requested <= buffer.byteLength) {
  2661. return buffer;
  2662. }
  2663. var size = this.minBufferLength;
  2664. while (size < requested) {
  2665. size *= 2;
  2666. }
  2667. var buffer2 = new Uint8Array(size);
  2668. buffer2.set(buffer);
  2669. return this.buffer = buffer2;
  2670. },
  2671. getByte: function DecodeStream_getByte() {
  2672. var pos = this.pos;
  2673. while (this.bufferLength <= pos) {
  2674. if (this.eof) {
  2675. return -1;
  2676. }
  2677. this.readBlock();
  2678. }
  2679. return this.buffer[this.pos++];
  2680. },
  2681. getUint16: function DecodeStream_getUint16() {
  2682. var b0 = this.getByte();
  2683. var b1 = this.getByte();
  2684. if (b0 === -1 || b1 === -1) {
  2685. return -1;
  2686. }
  2687. return (b0 << 8) + b1;
  2688. },
  2689. getInt32: function DecodeStream_getInt32() {
  2690. var b0 = this.getByte();
  2691. var b1 = this.getByte();
  2692. var b2 = this.getByte();
  2693. var b3 = this.getByte();
  2694. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2695. },
  2696. getBytes: function DecodeStream_getBytes(length) {
  2697. var end, pos = this.pos;
  2698. if (length) {
  2699. this.ensureBuffer(pos + length);
  2700. end = pos + length;
  2701. while (!this.eof && this.bufferLength < end) {
  2702. this.readBlock();
  2703. }
  2704. var bufEnd = this.bufferLength;
  2705. if (end > bufEnd) {
  2706. end = bufEnd;
  2707. }
  2708. } else {
  2709. while (!this.eof) {
  2710. this.readBlock();
  2711. }
  2712. end = this.bufferLength;
  2713. }
  2714. this.pos = end;
  2715. return this.buffer.subarray(pos, end);
  2716. },
  2717. peekByte: function DecodeStream_peekByte() {
  2718. var peekedByte = this.getByte();
  2719. this.pos--;
  2720. return peekedByte;
  2721. },
  2722. peekBytes: function DecodeStream_peekBytes(length) {
  2723. var bytes = this.getBytes(length);
  2724. this.pos -= bytes.length;
  2725. return bytes;
  2726. },
  2727. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  2728. var end = start + length;
  2729. while (this.bufferLength <= end && !this.eof) {
  2730. this.readBlock();
  2731. }
  2732. return new Stream(this.buffer, start, length, dict);
  2733. },
  2734. skip: function DecodeStream_skip(n) {
  2735. if (!n) {
  2736. n = 1;
  2737. }
  2738. this.pos += n;
  2739. },
  2740. reset: function DecodeStream_reset() {
  2741. this.pos = 0;
  2742. },
  2743. getBaseStreams: function DecodeStream_getBaseStreams() {
  2744. if (this.str && this.str.getBaseStreams) {
  2745. return this.str.getBaseStreams();
  2746. }
  2747. return [];
  2748. }
  2749. };
  2750. return DecodeStream;
  2751. }();
  2752. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  2753. function StreamsSequenceStream(streams) {
  2754. this.streams = streams;
  2755. DecodeStream.call(this, null);
  2756. }
  2757. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  2758. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  2759. var streams = this.streams;
  2760. if (streams.length === 0) {
  2761. this.eof = true;
  2762. return;
  2763. }
  2764. var stream = streams.shift();
  2765. var chunk = stream.getBytes();
  2766. var bufferLength = this.bufferLength;
  2767. var newLength = bufferLength + chunk.length;
  2768. var buffer = this.ensureBuffer(newLength);
  2769. buffer.set(chunk, bufferLength);
  2770. this.bufferLength = newLength;
  2771. };
  2772. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  2773. var baseStreams = [];
  2774. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  2775. var stream = this.streams[i];
  2776. if (stream.getBaseStreams) {
  2777. Util.appendToArray(baseStreams, stream.getBaseStreams());
  2778. }
  2779. }
  2780. return baseStreams;
  2781. };
  2782. return StreamsSequenceStream;
  2783. }();
  2784. var FlateStream = function FlateStreamClosure() {
  2785. var codeLenCodeMap = new Int32Array([
  2786. 16,
  2787. 17,
  2788. 18,
  2789. 0,
  2790. 8,
  2791. 7,
  2792. 9,
  2793. 6,
  2794. 10,
  2795. 5,
  2796. 11,
  2797. 4,
  2798. 12,
  2799. 3,
  2800. 13,
  2801. 2,
  2802. 14,
  2803. 1,
  2804. 15
  2805. ]);
  2806. var lengthDecode = new Int32Array([
  2807. 0x00003,
  2808. 0x00004,
  2809. 0x00005,
  2810. 0x00006,
  2811. 0x00007,
  2812. 0x00008,
  2813. 0x00009,
  2814. 0x0000a,
  2815. 0x1000b,
  2816. 0x1000d,
  2817. 0x1000f,
  2818. 0x10011,
  2819. 0x20013,
  2820. 0x20017,
  2821. 0x2001b,
  2822. 0x2001f,
  2823. 0x30023,
  2824. 0x3002b,
  2825. 0x30033,
  2826. 0x3003b,
  2827. 0x40043,
  2828. 0x40053,
  2829. 0x40063,
  2830. 0x40073,
  2831. 0x50083,
  2832. 0x500a3,
  2833. 0x500c3,
  2834. 0x500e3,
  2835. 0x00102,
  2836. 0x00102,
  2837. 0x00102
  2838. ]);
  2839. var distDecode = new Int32Array([
  2840. 0x00001,
  2841. 0x00002,
  2842. 0x00003,
  2843. 0x00004,
  2844. 0x10005,
  2845. 0x10007,
  2846. 0x20009,
  2847. 0x2000d,
  2848. 0x30011,
  2849. 0x30019,
  2850. 0x40021,
  2851. 0x40031,
  2852. 0x50041,
  2853. 0x50061,
  2854. 0x60081,
  2855. 0x600c1,
  2856. 0x70101,
  2857. 0x70181,
  2858. 0x80201,
  2859. 0x80301,
  2860. 0x90401,
  2861. 0x90601,
  2862. 0xa0801,
  2863. 0xa0c01,
  2864. 0xb1001,
  2865. 0xb1801,
  2866. 0xc2001,
  2867. 0xc3001,
  2868. 0xd4001,
  2869. 0xd6001
  2870. ]);
  2871. var fixedLitCodeTab = [
  2872. new Int32Array([
  2873. 0x70100,
  2874. 0x80050,
  2875. 0x80010,
  2876. 0x80118,
  2877. 0x70110,
  2878. 0x80070,
  2879. 0x80030,
  2880. 0x900c0,
  2881. 0x70108,
  2882. 0x80060,
  2883. 0x80020,
  2884. 0x900a0,
  2885. 0x80000,
  2886. 0x80080,
  2887. 0x80040,
  2888. 0x900e0,
  2889. 0x70104,
  2890. 0x80058,
  2891. 0x80018,
  2892. 0x90090,
  2893. 0x70114,
  2894. 0x80078,
  2895. 0x80038,
  2896. 0x900d0,
  2897. 0x7010c,
  2898. 0x80068,
  2899. 0x80028,
  2900. 0x900b0,
  2901. 0x80008,
  2902. 0x80088,
  2903. 0x80048,
  2904. 0x900f0,
  2905. 0x70102,
  2906. 0x80054,
  2907. 0x80014,
  2908. 0x8011c,
  2909. 0x70112,
  2910. 0x80074,
  2911. 0x80034,
  2912. 0x900c8,
  2913. 0x7010a,
  2914. 0x80064,
  2915. 0x80024,
  2916. 0x900a8,
  2917. 0x80004,
  2918. 0x80084,
  2919. 0x80044,
  2920. 0x900e8,
  2921. 0x70106,
  2922. 0x8005c,
  2923. 0x8001c,
  2924. 0x90098,
  2925. 0x70116,
  2926. 0x8007c,
  2927. 0x8003c,
  2928. 0x900d8,
  2929. 0x7010e,
  2930. 0x8006c,
  2931. 0x8002c,
  2932. 0x900b8,
  2933. 0x8000c,
  2934. 0x8008c,
  2935. 0x8004c,
  2936. 0x900f8,
  2937. 0x70101,
  2938. 0x80052,
  2939. 0x80012,
  2940. 0x8011a,
  2941. 0x70111,
  2942. 0x80072,
  2943. 0x80032,
  2944. 0x900c4,
  2945. 0x70109,
  2946. 0x80062,
  2947. 0x80022,
  2948. 0x900a4,
  2949. 0x80002,
  2950. 0x80082,
  2951. 0x80042,
  2952. 0x900e4,
  2953. 0x70105,
  2954. 0x8005a,
  2955. 0x8001a,
  2956. 0x90094,
  2957. 0x70115,
  2958. 0x8007a,
  2959. 0x8003a,
  2960. 0x900d4,
  2961. 0x7010d,
  2962. 0x8006a,
  2963. 0x8002a,
  2964. 0x900b4,
  2965. 0x8000a,
  2966. 0x8008a,
  2967. 0x8004a,
  2968. 0x900f4,
  2969. 0x70103,
  2970. 0x80056,
  2971. 0x80016,
  2972. 0x8011e,
  2973. 0x70113,
  2974. 0x80076,
  2975. 0x80036,
  2976. 0x900cc,
  2977. 0x7010b,
  2978. 0x80066,
  2979. 0x80026,
  2980. 0x900ac,
  2981. 0x80006,
  2982. 0x80086,
  2983. 0x80046,
  2984. 0x900ec,
  2985. 0x70107,
  2986. 0x8005e,
  2987. 0x8001e,
  2988. 0x9009c,
  2989. 0x70117,
  2990. 0x8007e,
  2991. 0x8003e,
  2992. 0x900dc,
  2993. 0x7010f,
  2994. 0x8006e,
  2995. 0x8002e,
  2996. 0x900bc,
  2997. 0x8000e,
  2998. 0x8008e,
  2999. 0x8004e,
  3000. 0x900fc,
  3001. 0x70100,
  3002. 0x80051,
  3003. 0x80011,
  3004. 0x80119,
  3005. 0x70110,
  3006. 0x80071,
  3007. 0x80031,
  3008. 0x900c2,
  3009. 0x70108,
  3010. 0x80061,
  3011. 0x80021,
  3012. 0x900a2,
  3013. 0x80001,
  3014. 0x80081,
  3015. 0x80041,
  3016. 0x900e2,
  3017. 0x70104,
  3018. 0x80059,
  3019. 0x80019,
  3020. 0x90092,
  3021. 0x70114,
  3022. 0x80079,
  3023. 0x80039,
  3024. 0x900d2,
  3025. 0x7010c,
  3026. 0x80069,
  3027. 0x80029,
  3028. 0x900b2,
  3029. 0x80009,
  3030. 0x80089,
  3031. 0x80049,
  3032. 0x900f2,
  3033. 0x70102,
  3034. 0x80055,
  3035. 0x80015,
  3036. 0x8011d,
  3037. 0x70112,
  3038. 0x80075,
  3039. 0x80035,
  3040. 0x900ca,
  3041. 0x7010a,
  3042. 0x80065,
  3043. 0x80025,
  3044. 0x900aa,
  3045. 0x80005,
  3046. 0x80085,
  3047. 0x80045,
  3048. 0x900ea,
  3049. 0x70106,
  3050. 0x8005d,
  3051. 0x8001d,
  3052. 0x9009a,
  3053. 0x70116,
  3054. 0x8007d,
  3055. 0x8003d,
  3056. 0x900da,
  3057. 0x7010e,
  3058. 0x8006d,
  3059. 0x8002d,
  3060. 0x900ba,
  3061. 0x8000d,
  3062. 0x8008d,
  3063. 0x8004d,
  3064. 0x900fa,
  3065. 0x70101,
  3066. 0x80053,
  3067. 0x80013,
  3068. 0x8011b,
  3069. 0x70111,
  3070. 0x80073,
  3071. 0x80033,
  3072. 0x900c6,
  3073. 0x70109,
  3074. 0x80063,
  3075. 0x80023,
  3076. 0x900a6,
  3077. 0x80003,
  3078. 0x80083,
  3079. 0x80043,
  3080. 0x900e6,
  3081. 0x70105,
  3082. 0x8005b,
  3083. 0x8001b,
  3084. 0x90096,
  3085. 0x70115,
  3086. 0x8007b,
  3087. 0x8003b,
  3088. 0x900d6,
  3089. 0x7010d,
  3090. 0x8006b,
  3091. 0x8002b,
  3092. 0x900b6,
  3093. 0x8000b,
  3094. 0x8008b,
  3095. 0x8004b,
  3096. 0x900f6,
  3097. 0x70103,
  3098. 0x80057,
  3099. 0x80017,
  3100. 0x8011f,
  3101. 0x70113,
  3102. 0x80077,
  3103. 0x80037,
  3104. 0x900ce,
  3105. 0x7010b,
  3106. 0x80067,
  3107. 0x80027,
  3108. 0x900ae,
  3109. 0x80007,
  3110. 0x80087,
  3111. 0x80047,
  3112. 0x900ee,
  3113. 0x70107,
  3114. 0x8005f,
  3115. 0x8001f,
  3116. 0x9009e,
  3117. 0x70117,
  3118. 0x8007f,
  3119. 0x8003f,
  3120. 0x900de,
  3121. 0x7010f,
  3122. 0x8006f,
  3123. 0x8002f,
  3124. 0x900be,
  3125. 0x8000f,
  3126. 0x8008f,
  3127. 0x8004f,
  3128. 0x900fe,
  3129. 0x70100,
  3130. 0x80050,
  3131. 0x80010,
  3132. 0x80118,
  3133. 0x70110,
  3134. 0x80070,
  3135. 0x80030,
  3136. 0x900c1,
  3137. 0x70108,
  3138. 0x80060,
  3139. 0x80020,
  3140. 0x900a1,
  3141. 0x80000,
  3142. 0x80080,
  3143. 0x80040,
  3144. 0x900e1,
  3145. 0x70104,
  3146. 0x80058,
  3147. 0x80018,
  3148. 0x90091,
  3149. 0x70114,
  3150. 0x80078,
  3151. 0x80038,
  3152. 0x900d1,
  3153. 0x7010c,
  3154. 0x80068,
  3155. 0x80028,
  3156. 0x900b1,
  3157. 0x80008,
  3158. 0x80088,
  3159. 0x80048,
  3160. 0x900f1,
  3161. 0x70102,
  3162. 0x80054,
  3163. 0x80014,
  3164. 0x8011c,
  3165. 0x70112,
  3166. 0x80074,
  3167. 0x80034,
  3168. 0x900c9,
  3169. 0x7010a,
  3170. 0x80064,
  3171. 0x80024,
  3172. 0x900a9,
  3173. 0x80004,
  3174. 0x80084,
  3175. 0x80044,
  3176. 0x900e9,
  3177. 0x70106,
  3178. 0x8005c,
  3179. 0x8001c,
  3180. 0x90099,
  3181. 0x70116,
  3182. 0x8007c,
  3183. 0x8003c,
  3184. 0x900d9,
  3185. 0x7010e,
  3186. 0x8006c,
  3187. 0x8002c,
  3188. 0x900b9,
  3189. 0x8000c,
  3190. 0x8008c,
  3191. 0x8004c,
  3192. 0x900f9,
  3193. 0x70101,
  3194. 0x80052,
  3195. 0x80012,
  3196. 0x8011a,
  3197. 0x70111,
  3198. 0x80072,
  3199. 0x80032,
  3200. 0x900c5,
  3201. 0x70109,
  3202. 0x80062,
  3203. 0x80022,
  3204. 0x900a5,
  3205. 0x80002,
  3206. 0x80082,
  3207. 0x80042,
  3208. 0x900e5,
  3209. 0x70105,
  3210. 0x8005a,
  3211. 0x8001a,
  3212. 0x90095,
  3213. 0x70115,
  3214. 0x8007a,
  3215. 0x8003a,
  3216. 0x900d5,
  3217. 0x7010d,
  3218. 0x8006a,
  3219. 0x8002a,
  3220. 0x900b5,
  3221. 0x8000a,
  3222. 0x8008a,
  3223. 0x8004a,
  3224. 0x900f5,
  3225. 0x70103,
  3226. 0x80056,
  3227. 0x80016,
  3228. 0x8011e,
  3229. 0x70113,
  3230. 0x80076,
  3231. 0x80036,
  3232. 0x900cd,
  3233. 0x7010b,
  3234. 0x80066,
  3235. 0x80026,
  3236. 0x900ad,
  3237. 0x80006,
  3238. 0x80086,
  3239. 0x80046,
  3240. 0x900ed,
  3241. 0x70107,
  3242. 0x8005e,
  3243. 0x8001e,
  3244. 0x9009d,
  3245. 0x70117,
  3246. 0x8007e,
  3247. 0x8003e,
  3248. 0x900dd,
  3249. 0x7010f,
  3250. 0x8006e,
  3251. 0x8002e,
  3252. 0x900bd,
  3253. 0x8000e,
  3254. 0x8008e,
  3255. 0x8004e,
  3256. 0x900fd,
  3257. 0x70100,
  3258. 0x80051,
  3259. 0x80011,
  3260. 0x80119,
  3261. 0x70110,
  3262. 0x80071,
  3263. 0x80031,
  3264. 0x900c3,
  3265. 0x70108,
  3266. 0x80061,
  3267. 0x80021,
  3268. 0x900a3,
  3269. 0x80001,
  3270. 0x80081,
  3271. 0x80041,
  3272. 0x900e3,
  3273. 0x70104,
  3274. 0x80059,
  3275. 0x80019,
  3276. 0x90093,
  3277. 0x70114,
  3278. 0x80079,
  3279. 0x80039,
  3280. 0x900d3,
  3281. 0x7010c,
  3282. 0x80069,
  3283. 0x80029,
  3284. 0x900b3,
  3285. 0x80009,
  3286. 0x80089,
  3287. 0x80049,
  3288. 0x900f3,
  3289. 0x70102,
  3290. 0x80055,
  3291. 0x80015,
  3292. 0x8011d,
  3293. 0x70112,
  3294. 0x80075,
  3295. 0x80035,
  3296. 0x900cb,
  3297. 0x7010a,
  3298. 0x80065,
  3299. 0x80025,
  3300. 0x900ab,
  3301. 0x80005,
  3302. 0x80085,
  3303. 0x80045,
  3304. 0x900eb,
  3305. 0x70106,
  3306. 0x8005d,
  3307. 0x8001d,
  3308. 0x9009b,
  3309. 0x70116,
  3310. 0x8007d,
  3311. 0x8003d,
  3312. 0x900db,
  3313. 0x7010e,
  3314. 0x8006d,
  3315. 0x8002d,
  3316. 0x900bb,
  3317. 0x8000d,
  3318. 0x8008d,
  3319. 0x8004d,
  3320. 0x900fb,
  3321. 0x70101,
  3322. 0x80053,
  3323. 0x80013,
  3324. 0x8011b,
  3325. 0x70111,
  3326. 0x80073,
  3327. 0x80033,
  3328. 0x900c7,
  3329. 0x70109,
  3330. 0x80063,
  3331. 0x80023,
  3332. 0x900a7,
  3333. 0x80003,
  3334. 0x80083,
  3335. 0x80043,
  3336. 0x900e7,
  3337. 0x70105,
  3338. 0x8005b,
  3339. 0x8001b,
  3340. 0x90097,
  3341. 0x70115,
  3342. 0x8007b,
  3343. 0x8003b,
  3344. 0x900d7,
  3345. 0x7010d,
  3346. 0x8006b,
  3347. 0x8002b,
  3348. 0x900b7,
  3349. 0x8000b,
  3350. 0x8008b,
  3351. 0x8004b,
  3352. 0x900f7,
  3353. 0x70103,
  3354. 0x80057,
  3355. 0x80017,
  3356. 0x8011f,
  3357. 0x70113,
  3358. 0x80077,
  3359. 0x80037,
  3360. 0x900cf,
  3361. 0x7010b,
  3362. 0x80067,
  3363. 0x80027,
  3364. 0x900af,
  3365. 0x80007,
  3366. 0x80087,
  3367. 0x80047,
  3368. 0x900ef,
  3369. 0x70107,
  3370. 0x8005f,
  3371. 0x8001f,
  3372. 0x9009f,
  3373. 0x70117,
  3374. 0x8007f,
  3375. 0x8003f,
  3376. 0x900df,
  3377. 0x7010f,
  3378. 0x8006f,
  3379. 0x8002f,
  3380. 0x900bf,
  3381. 0x8000f,
  3382. 0x8008f,
  3383. 0x8004f,
  3384. 0x900ff
  3385. ]),
  3386. 9
  3387. ];
  3388. var fixedDistCodeTab = [
  3389. new Int32Array([
  3390. 0x50000,
  3391. 0x50010,
  3392. 0x50008,
  3393. 0x50018,
  3394. 0x50004,
  3395. 0x50014,
  3396. 0x5000c,
  3397. 0x5001c,
  3398. 0x50002,
  3399. 0x50012,
  3400. 0x5000a,
  3401. 0x5001a,
  3402. 0x50006,
  3403. 0x50016,
  3404. 0x5000e,
  3405. 0x00000,
  3406. 0x50001,
  3407. 0x50011,
  3408. 0x50009,
  3409. 0x50019,
  3410. 0x50005,
  3411. 0x50015,
  3412. 0x5000d,
  3413. 0x5001d,
  3414. 0x50003,
  3415. 0x50013,
  3416. 0x5000b,
  3417. 0x5001b,
  3418. 0x50007,
  3419. 0x50017,
  3420. 0x5000f,
  3421. 0x00000
  3422. ]),
  3423. 5
  3424. ];
  3425. function FlateStream(str, maybeLength) {
  3426. this.str = str;
  3427. this.dict = str.dict;
  3428. var cmf = str.getByte();
  3429. var flg = str.getByte();
  3430. if (cmf === -1 || flg === -1) {
  3431. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  3432. }
  3433. if ((cmf & 0x0f) !== 0x08) {
  3434. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  3435. }
  3436. if (((cmf << 8) + flg) % 31 !== 0) {
  3437. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  3438. }
  3439. if (flg & 0x20) {
  3440. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  3441. }
  3442. this.codeSize = 0;
  3443. this.codeBuf = 0;
  3444. DecodeStream.call(this, maybeLength);
  3445. }
  3446. FlateStream.prototype = Object.create(DecodeStream.prototype);
  3447. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  3448. var str = this.str;
  3449. var codeSize = this.codeSize;
  3450. var codeBuf = this.codeBuf;
  3451. var b;
  3452. while (codeSize < bits) {
  3453. if ((b = str.getByte()) === -1) {
  3454. error('Bad encoding in flate stream');
  3455. }
  3456. codeBuf |= b << codeSize;
  3457. codeSize += 8;
  3458. }
  3459. b = codeBuf & (1 << bits) - 1;
  3460. this.codeBuf = codeBuf >> bits;
  3461. this.codeSize = codeSize -= bits;
  3462. return b;
  3463. };
  3464. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  3465. var str = this.str;
  3466. var codes = table[0];
  3467. var maxLen = table[1];
  3468. var codeSize = this.codeSize;
  3469. var codeBuf = this.codeBuf;
  3470. var b;
  3471. while (codeSize < maxLen) {
  3472. if ((b = str.getByte()) === -1) {
  3473. break;
  3474. }
  3475. codeBuf |= b << codeSize;
  3476. codeSize += 8;
  3477. }
  3478. var code = codes[codeBuf & (1 << maxLen) - 1];
  3479. var codeLen = code >> 16;
  3480. var codeVal = code & 0xffff;
  3481. if (codeLen < 1 || codeSize < codeLen) {
  3482. error('Bad encoding in flate stream');
  3483. }
  3484. this.codeBuf = codeBuf >> codeLen;
  3485. this.codeSize = codeSize - codeLen;
  3486. return codeVal;
  3487. };
  3488. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  3489. var n = lengths.length;
  3490. var maxLen = 0;
  3491. var i;
  3492. for (i = 0; i < n; ++i) {
  3493. if (lengths[i] > maxLen) {
  3494. maxLen = lengths[i];
  3495. }
  3496. }
  3497. var size = 1 << maxLen;
  3498. var codes = new Int32Array(size);
  3499. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  3500. for (var val = 0; val < n; ++val) {
  3501. if (lengths[val] === len) {
  3502. var code2 = 0;
  3503. var t = code;
  3504. for (i = 0; i < len; ++i) {
  3505. code2 = code2 << 1 | t & 1;
  3506. t >>= 1;
  3507. }
  3508. for (i = code2; i < size; i += skip) {
  3509. codes[i] = len << 16 | val;
  3510. }
  3511. ++code;
  3512. }
  3513. }
  3514. }
  3515. return [
  3516. codes,
  3517. maxLen
  3518. ];
  3519. };
  3520. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  3521. var buffer, len;
  3522. var str = this.str;
  3523. var hdr = this.getBits(3);
  3524. if (hdr & 1) {
  3525. this.eof = true;
  3526. }
  3527. hdr >>= 1;
  3528. if (hdr === 0) {
  3529. var b;
  3530. if ((b = str.getByte()) === -1) {
  3531. error('Bad block header in flate stream');
  3532. }
  3533. var blockLen = b;
  3534. if ((b = str.getByte()) === -1) {
  3535. error('Bad block header in flate stream');
  3536. }
  3537. blockLen |= b << 8;
  3538. if ((b = str.getByte()) === -1) {
  3539. error('Bad block header in flate stream');
  3540. }
  3541. var check = b;
  3542. if ((b = str.getByte()) === -1) {
  3543. error('Bad block header in flate stream');
  3544. }
  3545. check |= b << 8;
  3546. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  3547. error('Bad uncompressed block length in flate stream');
  3548. }
  3549. this.codeBuf = 0;
  3550. this.codeSize = 0;
  3551. var bufferLength = this.bufferLength;
  3552. buffer = this.ensureBuffer(bufferLength + blockLen);
  3553. var end = bufferLength + blockLen;
  3554. this.bufferLength = end;
  3555. if (blockLen === 0) {
  3556. if (str.peekByte() === -1) {
  3557. this.eof = true;
  3558. }
  3559. } else {
  3560. for (var n = bufferLength; n < end; ++n) {
  3561. if ((b = str.getByte()) === -1) {
  3562. this.eof = true;
  3563. break;
  3564. }
  3565. buffer[n] = b;
  3566. }
  3567. }
  3568. return;
  3569. }
  3570. var litCodeTable;
  3571. var distCodeTable;
  3572. if (hdr === 1) {
  3573. litCodeTable = fixedLitCodeTab;
  3574. distCodeTable = fixedDistCodeTab;
  3575. } else if (hdr === 2) {
  3576. var numLitCodes = this.getBits(5) + 257;
  3577. var numDistCodes = this.getBits(5) + 1;
  3578. var numCodeLenCodes = this.getBits(4) + 4;
  3579. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  3580. var i;
  3581. for (i = 0; i < numCodeLenCodes; ++i) {
  3582. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  3583. }
  3584. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  3585. len = 0;
  3586. i = 0;
  3587. var codes = numLitCodes + numDistCodes;
  3588. var codeLengths = new Uint8Array(codes);
  3589. var bitsLength, bitsOffset, what;
  3590. while (i < codes) {
  3591. var code = this.getCode(codeLenCodeTab);
  3592. if (code === 16) {
  3593. bitsLength = 2;
  3594. bitsOffset = 3;
  3595. what = len;
  3596. } else if (code === 17) {
  3597. bitsLength = 3;
  3598. bitsOffset = 3;
  3599. what = len = 0;
  3600. } else if (code === 18) {
  3601. bitsLength = 7;
  3602. bitsOffset = 11;
  3603. what = len = 0;
  3604. } else {
  3605. codeLengths[i++] = len = code;
  3606. continue;
  3607. }
  3608. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  3609. while (repeatLength-- > 0) {
  3610. codeLengths[i++] = what;
  3611. }
  3612. }
  3613. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  3614. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  3615. } else {
  3616. error('Unknown block type in flate stream');
  3617. }
  3618. buffer = this.buffer;
  3619. var limit = buffer ? buffer.length : 0;
  3620. var pos = this.bufferLength;
  3621. while (true) {
  3622. var code1 = this.getCode(litCodeTable);
  3623. if (code1 < 256) {
  3624. if (pos + 1 >= limit) {
  3625. buffer = this.ensureBuffer(pos + 1);
  3626. limit = buffer.length;
  3627. }
  3628. buffer[pos++] = code1;
  3629. continue;
  3630. }
  3631. if (code1 === 256) {
  3632. this.bufferLength = pos;
  3633. return;
  3634. }
  3635. code1 -= 257;
  3636. code1 = lengthDecode[code1];
  3637. var code2 = code1 >> 16;
  3638. if (code2 > 0) {
  3639. code2 = this.getBits(code2);
  3640. }
  3641. len = (code1 & 0xffff) + code2;
  3642. code1 = this.getCode(distCodeTable);
  3643. code1 = distDecode[code1];
  3644. code2 = code1 >> 16;
  3645. if (code2 > 0) {
  3646. code2 = this.getBits(code2);
  3647. }
  3648. var dist = (code1 & 0xffff) + code2;
  3649. if (pos + len >= limit) {
  3650. buffer = this.ensureBuffer(pos + len);
  3651. limit = buffer.length;
  3652. }
  3653. for (var k = 0; k < len; ++k, ++pos) {
  3654. buffer[pos] = buffer[pos - dist];
  3655. }
  3656. }
  3657. };
  3658. return FlateStream;
  3659. }();
  3660. var PredictorStream = function PredictorStreamClosure() {
  3661. function PredictorStream(str, maybeLength, params) {
  3662. if (!isDict(params)) {
  3663. return str;
  3664. }
  3665. var predictor = this.predictor = params.get('Predictor') || 1;
  3666. if (predictor <= 1) {
  3667. return str;
  3668. }
  3669. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  3670. error('Unsupported predictor: ' + predictor);
  3671. }
  3672. if (predictor === 2) {
  3673. this.readBlock = this.readBlockTiff;
  3674. } else {
  3675. this.readBlock = this.readBlockPng;
  3676. }
  3677. this.str = str;
  3678. this.dict = str.dict;
  3679. var colors = this.colors = params.get('Colors') || 1;
  3680. var bits = this.bits = params.get('BitsPerComponent') || 8;
  3681. var columns = this.columns = params.get('Columns') || 1;
  3682. this.pixBytes = colors * bits + 7 >> 3;
  3683. this.rowBytes = columns * colors * bits + 7 >> 3;
  3684. DecodeStream.call(this, maybeLength);
  3685. return this;
  3686. }
  3687. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  3688. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  3689. var rowBytes = this.rowBytes;
  3690. var bufferLength = this.bufferLength;
  3691. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3692. var bits = this.bits;
  3693. var colors = this.colors;
  3694. var rawBytes = this.str.getBytes(rowBytes);
  3695. this.eof = !rawBytes.length;
  3696. if (this.eof) {
  3697. return;
  3698. }
  3699. var inbuf = 0, outbuf = 0;
  3700. var inbits = 0, outbits = 0;
  3701. var pos = bufferLength;
  3702. var i;
  3703. if (bits === 1 && colors === 1) {
  3704. for (i = 0; i < rowBytes; ++i) {
  3705. var c = rawBytes[i] ^ inbuf;
  3706. c ^= c >> 1;
  3707. c ^= c >> 2;
  3708. c ^= c >> 4;
  3709. inbuf = (c & 1) << 7;
  3710. buffer[pos++] = c;
  3711. }
  3712. } else if (bits === 8) {
  3713. for (i = 0; i < colors; ++i) {
  3714. buffer[pos++] = rawBytes[i];
  3715. }
  3716. for (; i < rowBytes; ++i) {
  3717. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  3718. pos++;
  3719. }
  3720. } else {
  3721. var compArray = new Uint8Array(colors + 1);
  3722. var bitMask = (1 << bits) - 1;
  3723. var j = 0, k = bufferLength;
  3724. var columns = this.columns;
  3725. for (i = 0; i < columns; ++i) {
  3726. for (var kk = 0; kk < colors; ++kk) {
  3727. if (inbits < bits) {
  3728. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  3729. inbits += 8;
  3730. }
  3731. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  3732. inbits -= bits;
  3733. outbuf = outbuf << bits | compArray[kk];
  3734. outbits += bits;
  3735. if (outbits >= 8) {
  3736. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  3737. outbits -= 8;
  3738. }
  3739. }
  3740. }
  3741. if (outbits > 0) {
  3742. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  3743. }
  3744. }
  3745. this.bufferLength += rowBytes;
  3746. };
  3747. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  3748. var rowBytes = this.rowBytes;
  3749. var pixBytes = this.pixBytes;
  3750. var predictor = this.str.getByte();
  3751. var rawBytes = this.str.getBytes(rowBytes);
  3752. this.eof = !rawBytes.length;
  3753. if (this.eof) {
  3754. return;
  3755. }
  3756. var bufferLength = this.bufferLength;
  3757. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3758. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  3759. if (prevRow.length === 0) {
  3760. prevRow = new Uint8Array(rowBytes);
  3761. }
  3762. var i, j = bufferLength, up, c;
  3763. switch (predictor) {
  3764. case 0:
  3765. for (i = 0; i < rowBytes; ++i) {
  3766. buffer[j++] = rawBytes[i];
  3767. }
  3768. break;
  3769. case 1:
  3770. for (i = 0; i < pixBytes; ++i) {
  3771. buffer[j++] = rawBytes[i];
  3772. }
  3773. for (; i < rowBytes; ++i) {
  3774. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  3775. j++;
  3776. }
  3777. break;
  3778. case 2:
  3779. for (i = 0; i < rowBytes; ++i) {
  3780. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  3781. }
  3782. break;
  3783. case 3:
  3784. for (i = 0; i < pixBytes; ++i) {
  3785. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  3786. }
  3787. for (; i < rowBytes; ++i) {
  3788. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  3789. j++;
  3790. }
  3791. break;
  3792. case 4:
  3793. for (i = 0; i < pixBytes; ++i) {
  3794. up = prevRow[i];
  3795. c = rawBytes[i];
  3796. buffer[j++] = up + c;
  3797. }
  3798. for (; i < rowBytes; ++i) {
  3799. up = prevRow[i];
  3800. var upLeft = prevRow[i - pixBytes];
  3801. var left = buffer[j - pixBytes];
  3802. var p = left + up - upLeft;
  3803. var pa = p - left;
  3804. if (pa < 0) {
  3805. pa = -pa;
  3806. }
  3807. var pb = p - up;
  3808. if (pb < 0) {
  3809. pb = -pb;
  3810. }
  3811. var pc = p - upLeft;
  3812. if (pc < 0) {
  3813. pc = -pc;
  3814. }
  3815. c = rawBytes[i];
  3816. if (pa <= pb && pa <= pc) {
  3817. buffer[j++] = left + c;
  3818. } else if (pb <= pc) {
  3819. buffer[j++] = up + c;
  3820. } else {
  3821. buffer[j++] = upLeft + c;
  3822. }
  3823. }
  3824. break;
  3825. default:
  3826. error('Unsupported predictor: ' + predictor);
  3827. }
  3828. this.bufferLength += rowBytes;
  3829. };
  3830. return PredictorStream;
  3831. }();
  3832. var JpegStream = function JpegStreamClosure() {
  3833. function JpegStream(stream, maybeLength, dict, params) {
  3834. var ch;
  3835. while ((ch = stream.getByte()) !== -1) {
  3836. if (ch === 0xFF) {
  3837. stream.skip(-1);
  3838. break;
  3839. }
  3840. }
  3841. this.stream = stream;
  3842. this.maybeLength = maybeLength;
  3843. this.dict = dict;
  3844. this.params = params;
  3845. DecodeStream.call(this, maybeLength);
  3846. }
  3847. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3848. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3849. get: function JpegStream_bytes() {
  3850. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3851. },
  3852. configurable: true
  3853. });
  3854. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3855. if (this.bufferLength) {
  3856. return;
  3857. }
  3858. var jpegImage = new JpegImage();
  3859. var decodeArr = this.dict.getArray('Decode', 'D');
  3860. if (this.forceRGB && isArray(decodeArr)) {
  3861. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3862. var decodeArrLength = decodeArr.length;
  3863. var transform = new Int32Array(decodeArrLength);
  3864. var transformNeeded = false;
  3865. var maxValue = (1 << bitsPerComponent) - 1;
  3866. for (var i = 0; i < decodeArrLength; i += 2) {
  3867. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3868. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3869. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3870. transformNeeded = true;
  3871. }
  3872. }
  3873. if (transformNeeded) {
  3874. jpegImage.decodeTransform = transform;
  3875. }
  3876. }
  3877. if (isDict(this.params)) {
  3878. var colorTransform = this.params.get('ColorTransform');
  3879. if (isInt(colorTransform)) {
  3880. jpegImage.colorTransform = colorTransform;
  3881. }
  3882. }
  3883. jpegImage.parse(this.bytes);
  3884. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3885. this.buffer = data;
  3886. this.bufferLength = data.length;
  3887. this.eof = true;
  3888. };
  3889. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3890. this.ensureBuffer();
  3891. return this.buffer;
  3892. };
  3893. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3894. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3895. };
  3896. return JpegStream;
  3897. }();
  3898. var JpxStream = function JpxStreamClosure() {
  3899. function JpxStream(stream, maybeLength, dict, params) {
  3900. this.stream = stream;
  3901. this.maybeLength = maybeLength;
  3902. this.dict = dict;
  3903. this.params = params;
  3904. DecodeStream.call(this, maybeLength);
  3905. }
  3906. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3907. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3908. get: function JpxStream_bytes() {
  3909. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3910. },
  3911. configurable: true
  3912. });
  3913. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3914. if (this.bufferLength) {
  3915. return;
  3916. }
  3917. var jpxImage = new JpxImage();
  3918. jpxImage.parse(this.bytes);
  3919. var width = jpxImage.width;
  3920. var height = jpxImage.height;
  3921. var componentsCount = jpxImage.componentsCount;
  3922. var tileCount = jpxImage.tiles.length;
  3923. if (tileCount === 1) {
  3924. this.buffer = jpxImage.tiles[0].items;
  3925. } else {
  3926. var data = new Uint8Array(width * height * componentsCount);
  3927. for (var k = 0; k < tileCount; k++) {
  3928. var tileComponents = jpxImage.tiles[k];
  3929. var tileWidth = tileComponents.width;
  3930. var tileHeight = tileComponents.height;
  3931. var tileLeft = tileComponents.left;
  3932. var tileTop = tileComponents.top;
  3933. var src = tileComponents.items;
  3934. var srcPosition = 0;
  3935. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3936. var imgRowSize = width * componentsCount;
  3937. var tileRowSize = tileWidth * componentsCount;
  3938. for (var j = 0; j < tileHeight; j++) {
  3939. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3940. data.set(rowBytes, dataPosition);
  3941. srcPosition += tileRowSize;
  3942. dataPosition += imgRowSize;
  3943. }
  3944. }
  3945. this.buffer = data;
  3946. }
  3947. this.bufferLength = this.buffer.length;
  3948. this.eof = true;
  3949. };
  3950. return JpxStream;
  3951. }();
  3952. var Jbig2Stream = function Jbig2StreamClosure() {
  3953. function Jbig2Stream(stream, maybeLength, dict, params) {
  3954. this.stream = stream;
  3955. this.maybeLength = maybeLength;
  3956. this.dict = dict;
  3957. this.params = params;
  3958. DecodeStream.call(this, maybeLength);
  3959. }
  3960. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3961. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3962. get: function Jbig2Stream_bytes() {
  3963. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3964. },
  3965. configurable: true
  3966. });
  3967. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3968. if (this.bufferLength) {
  3969. return;
  3970. }
  3971. var jbig2Image = new Jbig2Image();
  3972. var chunks = [];
  3973. if (isDict(this.params)) {
  3974. var globalsStream = this.params.get('JBIG2Globals');
  3975. if (isStream(globalsStream)) {
  3976. var globals = globalsStream.getBytes();
  3977. chunks.push({
  3978. data: globals,
  3979. start: 0,
  3980. end: globals.length
  3981. });
  3982. }
  3983. }
  3984. chunks.push({
  3985. data: this.bytes,
  3986. start: 0,
  3987. end: this.bytes.length
  3988. });
  3989. var data = jbig2Image.parseChunks(chunks);
  3990. var dataLength = data.length;
  3991. for (var i = 0; i < dataLength; i++) {
  3992. data[i] ^= 0xFF;
  3993. }
  3994. this.buffer = data;
  3995. this.bufferLength = dataLength;
  3996. this.eof = true;
  3997. };
  3998. return Jbig2Stream;
  3999. }();
  4000. var DecryptStream = function DecryptStreamClosure() {
  4001. function DecryptStream(str, maybeLength, decrypt) {
  4002. this.str = str;
  4003. this.dict = str.dict;
  4004. this.decrypt = decrypt;
  4005. this.nextChunk = null;
  4006. this.initialized = false;
  4007. DecodeStream.call(this, maybeLength);
  4008. }
  4009. var chunkSize = 512;
  4010. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  4011. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  4012. var chunk;
  4013. if (this.initialized) {
  4014. chunk = this.nextChunk;
  4015. } else {
  4016. chunk = this.str.getBytes(chunkSize);
  4017. this.initialized = true;
  4018. }
  4019. if (!chunk || chunk.length === 0) {
  4020. this.eof = true;
  4021. return;
  4022. }
  4023. this.nextChunk = this.str.getBytes(chunkSize);
  4024. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  4025. var decrypt = this.decrypt;
  4026. chunk = decrypt(chunk, !hasMoreData);
  4027. var bufferLength = this.bufferLength;
  4028. var i, n = chunk.length;
  4029. var buffer = this.ensureBuffer(bufferLength + n);
  4030. for (i = 0; i < n; i++) {
  4031. buffer[bufferLength++] = chunk[i];
  4032. }
  4033. this.bufferLength = bufferLength;
  4034. };
  4035. return DecryptStream;
  4036. }();
  4037. var Ascii85Stream = function Ascii85StreamClosure() {
  4038. function Ascii85Stream(str, maybeLength) {
  4039. this.str = str;
  4040. this.dict = str.dict;
  4041. this.input = new Uint8Array(5);
  4042. if (maybeLength) {
  4043. maybeLength = 0.8 * maybeLength;
  4044. }
  4045. DecodeStream.call(this, maybeLength);
  4046. }
  4047. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  4048. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  4049. var TILDA_CHAR = 0x7E;
  4050. var Z_LOWER_CHAR = 0x7A;
  4051. var EOF = -1;
  4052. var str = this.str;
  4053. var c = str.getByte();
  4054. while (isSpace(c)) {
  4055. c = str.getByte();
  4056. }
  4057. if (c === EOF || c === TILDA_CHAR) {
  4058. this.eof = true;
  4059. return;
  4060. }
  4061. var bufferLength = this.bufferLength, buffer;
  4062. var i;
  4063. if (c === Z_LOWER_CHAR) {
  4064. buffer = this.ensureBuffer(bufferLength + 4);
  4065. for (i = 0; i < 4; ++i) {
  4066. buffer[bufferLength + i] = 0;
  4067. }
  4068. this.bufferLength += 4;
  4069. } else {
  4070. var input = this.input;
  4071. input[0] = c;
  4072. for (i = 1; i < 5; ++i) {
  4073. c = str.getByte();
  4074. while (isSpace(c)) {
  4075. c = str.getByte();
  4076. }
  4077. input[i] = c;
  4078. if (c === EOF || c === TILDA_CHAR) {
  4079. break;
  4080. }
  4081. }
  4082. buffer = this.ensureBuffer(bufferLength + i - 1);
  4083. this.bufferLength += i - 1;
  4084. if (i < 5) {
  4085. for (; i < 5; ++i) {
  4086. input[i] = 0x21 + 84;
  4087. }
  4088. this.eof = true;
  4089. }
  4090. var t = 0;
  4091. for (i = 0; i < 5; ++i) {
  4092. t = t * 85 + (input[i] - 0x21);
  4093. }
  4094. for (i = 3; i >= 0; --i) {
  4095. buffer[bufferLength + i] = t & 0xFF;
  4096. t >>= 8;
  4097. }
  4098. }
  4099. };
  4100. return Ascii85Stream;
  4101. }();
  4102. var AsciiHexStream = function AsciiHexStreamClosure() {
  4103. function AsciiHexStream(str, maybeLength) {
  4104. this.str = str;
  4105. this.dict = str.dict;
  4106. this.firstDigit = -1;
  4107. if (maybeLength) {
  4108. maybeLength = 0.5 * maybeLength;
  4109. }
  4110. DecodeStream.call(this, maybeLength);
  4111. }
  4112. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  4113. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  4114. var UPSTREAM_BLOCK_SIZE = 8000;
  4115. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  4116. if (!bytes.length) {
  4117. this.eof = true;
  4118. return;
  4119. }
  4120. var maxDecodeLength = bytes.length + 1 >> 1;
  4121. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  4122. var bufferLength = this.bufferLength;
  4123. var firstDigit = this.firstDigit;
  4124. for (var i = 0, ii = bytes.length; i < ii; i++) {
  4125. var ch = bytes[i], digit;
  4126. if (ch >= 0x30 && ch <= 0x39) {
  4127. digit = ch & 0x0F;
  4128. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  4129. digit = (ch & 0x0F) + 9;
  4130. } else if (ch === 0x3E) {
  4131. this.eof = true;
  4132. break;
  4133. } else {
  4134. continue;
  4135. }
  4136. if (firstDigit < 0) {
  4137. firstDigit = digit;
  4138. } else {
  4139. buffer[bufferLength++] = firstDigit << 4 | digit;
  4140. firstDigit = -1;
  4141. }
  4142. }
  4143. if (firstDigit >= 0 && this.eof) {
  4144. buffer[bufferLength++] = firstDigit << 4;
  4145. firstDigit = -1;
  4146. }
  4147. this.firstDigit = firstDigit;
  4148. this.bufferLength = bufferLength;
  4149. };
  4150. return AsciiHexStream;
  4151. }();
  4152. var RunLengthStream = function RunLengthStreamClosure() {
  4153. function RunLengthStream(str, maybeLength) {
  4154. this.str = str;
  4155. this.dict = str.dict;
  4156. DecodeStream.call(this, maybeLength);
  4157. }
  4158. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  4159. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  4160. var repeatHeader = this.str.getBytes(2);
  4161. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  4162. this.eof = true;
  4163. return;
  4164. }
  4165. var buffer;
  4166. var bufferLength = this.bufferLength;
  4167. var n = repeatHeader[0];
  4168. if (n < 128) {
  4169. buffer = this.ensureBuffer(bufferLength + n + 1);
  4170. buffer[bufferLength++] = repeatHeader[1];
  4171. if (n > 0) {
  4172. var source = this.str.getBytes(n);
  4173. buffer.set(source, bufferLength);
  4174. bufferLength += n;
  4175. }
  4176. } else {
  4177. n = 257 - n;
  4178. var b = repeatHeader[1];
  4179. buffer = this.ensureBuffer(bufferLength + n + 1);
  4180. for (var i = 0; i < n; i++) {
  4181. buffer[bufferLength++] = b;
  4182. }
  4183. }
  4184. this.bufferLength = bufferLength;
  4185. };
  4186. return RunLengthStream;
  4187. }();
  4188. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  4189. var ccittEOL = -2;
  4190. var ccittEOF = -1;
  4191. var twoDimPass = 0;
  4192. var twoDimHoriz = 1;
  4193. var twoDimVert0 = 2;
  4194. var twoDimVertR1 = 3;
  4195. var twoDimVertL1 = 4;
  4196. var twoDimVertR2 = 5;
  4197. var twoDimVertL2 = 6;
  4198. var twoDimVertR3 = 7;
  4199. var twoDimVertL3 = 8;
  4200. var twoDimTable = [
  4201. [
  4202. -1,
  4203. -1
  4204. ],
  4205. [
  4206. -1,
  4207. -1
  4208. ],
  4209. [
  4210. 7,
  4211. twoDimVertL3
  4212. ],
  4213. [
  4214. 7,
  4215. twoDimVertR3
  4216. ],
  4217. [
  4218. 6,
  4219. twoDimVertL2
  4220. ],
  4221. [
  4222. 6,
  4223. twoDimVertL2
  4224. ],
  4225. [
  4226. 6,
  4227. twoDimVertR2
  4228. ],
  4229. [
  4230. 6,
  4231. twoDimVertR2
  4232. ],
  4233. [
  4234. 4,
  4235. twoDimPass
  4236. ],
  4237. [
  4238. 4,
  4239. twoDimPass
  4240. ],
  4241. [
  4242. 4,
  4243. twoDimPass
  4244. ],
  4245. [
  4246. 4,
  4247. twoDimPass
  4248. ],
  4249. [
  4250. 4,
  4251. twoDimPass
  4252. ],
  4253. [
  4254. 4,
  4255. twoDimPass
  4256. ],
  4257. [
  4258. 4,
  4259. twoDimPass
  4260. ],
  4261. [
  4262. 4,
  4263. twoDimPass
  4264. ],
  4265. [
  4266. 3,
  4267. twoDimHoriz
  4268. ],
  4269. [
  4270. 3,
  4271. twoDimHoriz
  4272. ],
  4273. [
  4274. 3,
  4275. twoDimHoriz
  4276. ],
  4277. [
  4278. 3,
  4279. twoDimHoriz
  4280. ],
  4281. [
  4282. 3,
  4283. twoDimHoriz
  4284. ],
  4285. [
  4286. 3,
  4287. twoDimHoriz
  4288. ],
  4289. [
  4290. 3,
  4291. twoDimHoriz
  4292. ],
  4293. [
  4294. 3,
  4295. twoDimHoriz
  4296. ],
  4297. [
  4298. 3,
  4299. twoDimHoriz
  4300. ],
  4301. [
  4302. 3,
  4303. twoDimHoriz
  4304. ],
  4305. [
  4306. 3,
  4307. twoDimHoriz
  4308. ],
  4309. [
  4310. 3,
  4311. twoDimHoriz
  4312. ],
  4313. [
  4314. 3,
  4315. twoDimHoriz
  4316. ],
  4317. [
  4318. 3,
  4319. twoDimHoriz
  4320. ],
  4321. [
  4322. 3,
  4323. twoDimHoriz
  4324. ],
  4325. [
  4326. 3,
  4327. twoDimHoriz
  4328. ],
  4329. [
  4330. 3,
  4331. twoDimVertL1
  4332. ],
  4333. [
  4334. 3,
  4335. twoDimVertL1
  4336. ],
  4337. [
  4338. 3,
  4339. twoDimVertL1
  4340. ],
  4341. [
  4342. 3,
  4343. twoDimVertL1
  4344. ],
  4345. [
  4346. 3,
  4347. twoDimVertL1
  4348. ],
  4349. [
  4350. 3,
  4351. twoDimVertL1
  4352. ],
  4353. [
  4354. 3,
  4355. twoDimVertL1
  4356. ],
  4357. [
  4358. 3,
  4359. twoDimVertL1
  4360. ],
  4361. [
  4362. 3,
  4363. twoDimVertL1
  4364. ],
  4365. [
  4366. 3,
  4367. twoDimVertL1
  4368. ],
  4369. [
  4370. 3,
  4371. twoDimVertL1
  4372. ],
  4373. [
  4374. 3,
  4375. twoDimVertL1
  4376. ],
  4377. [
  4378. 3,
  4379. twoDimVertL1
  4380. ],
  4381. [
  4382. 3,
  4383. twoDimVertL1
  4384. ],
  4385. [
  4386. 3,
  4387. twoDimVertL1
  4388. ],
  4389. [
  4390. 3,
  4391. twoDimVertL1
  4392. ],
  4393. [
  4394. 3,
  4395. twoDimVertR1
  4396. ],
  4397. [
  4398. 3,
  4399. twoDimVertR1
  4400. ],
  4401. [
  4402. 3,
  4403. twoDimVertR1
  4404. ],
  4405. [
  4406. 3,
  4407. twoDimVertR1
  4408. ],
  4409. [
  4410. 3,
  4411. twoDimVertR1
  4412. ],
  4413. [
  4414. 3,
  4415. twoDimVertR1
  4416. ],
  4417. [
  4418. 3,
  4419. twoDimVertR1
  4420. ],
  4421. [
  4422. 3,
  4423. twoDimVertR1
  4424. ],
  4425. [
  4426. 3,
  4427. twoDimVertR1
  4428. ],
  4429. [
  4430. 3,
  4431. twoDimVertR1
  4432. ],
  4433. [
  4434. 3,
  4435. twoDimVertR1
  4436. ],
  4437. [
  4438. 3,
  4439. twoDimVertR1
  4440. ],
  4441. [
  4442. 3,
  4443. twoDimVertR1
  4444. ],
  4445. [
  4446. 3,
  4447. twoDimVertR1
  4448. ],
  4449. [
  4450. 3,
  4451. twoDimVertR1
  4452. ],
  4453. [
  4454. 3,
  4455. twoDimVertR1
  4456. ],
  4457. [
  4458. 1,
  4459. twoDimVert0
  4460. ],
  4461. [
  4462. 1,
  4463. twoDimVert0
  4464. ],
  4465. [
  4466. 1,
  4467. twoDimVert0
  4468. ],
  4469. [
  4470. 1,
  4471. twoDimVert0
  4472. ],
  4473. [
  4474. 1,
  4475. twoDimVert0
  4476. ],
  4477. [
  4478. 1,
  4479. twoDimVert0
  4480. ],
  4481. [
  4482. 1,
  4483. twoDimVert0
  4484. ],
  4485. [
  4486. 1,
  4487. twoDimVert0
  4488. ],
  4489. [
  4490. 1,
  4491. twoDimVert0
  4492. ],
  4493. [
  4494. 1,
  4495. twoDimVert0
  4496. ],
  4497. [
  4498. 1,
  4499. twoDimVert0
  4500. ],
  4501. [
  4502. 1,
  4503. twoDimVert0
  4504. ],
  4505. [
  4506. 1,
  4507. twoDimVert0
  4508. ],
  4509. [
  4510. 1,
  4511. twoDimVert0
  4512. ],
  4513. [
  4514. 1,
  4515. twoDimVert0
  4516. ],
  4517. [
  4518. 1,
  4519. twoDimVert0
  4520. ],
  4521. [
  4522. 1,
  4523. twoDimVert0
  4524. ],
  4525. [
  4526. 1,
  4527. twoDimVert0
  4528. ],
  4529. [
  4530. 1,
  4531. twoDimVert0
  4532. ],
  4533. [
  4534. 1,
  4535. twoDimVert0
  4536. ],
  4537. [
  4538. 1,
  4539. twoDimVert0
  4540. ],
  4541. [
  4542. 1,
  4543. twoDimVert0
  4544. ],
  4545. [
  4546. 1,
  4547. twoDimVert0
  4548. ],
  4549. [
  4550. 1,
  4551. twoDimVert0
  4552. ],
  4553. [
  4554. 1,
  4555. twoDimVert0
  4556. ],
  4557. [
  4558. 1,
  4559. twoDimVert0
  4560. ],
  4561. [
  4562. 1,
  4563. twoDimVert0
  4564. ],
  4565. [
  4566. 1,
  4567. twoDimVert0
  4568. ],
  4569. [
  4570. 1,
  4571. twoDimVert0
  4572. ],
  4573. [
  4574. 1,
  4575. twoDimVert0
  4576. ],
  4577. [
  4578. 1,
  4579. twoDimVert0
  4580. ],
  4581. [
  4582. 1,
  4583. twoDimVert0
  4584. ],
  4585. [
  4586. 1,
  4587. twoDimVert0
  4588. ],
  4589. [
  4590. 1,
  4591. twoDimVert0
  4592. ],
  4593. [
  4594. 1,
  4595. twoDimVert0
  4596. ],
  4597. [
  4598. 1,
  4599. twoDimVert0
  4600. ],
  4601. [
  4602. 1,
  4603. twoDimVert0
  4604. ],
  4605. [
  4606. 1,
  4607. twoDimVert0
  4608. ],
  4609. [
  4610. 1,
  4611. twoDimVert0
  4612. ],
  4613. [
  4614. 1,
  4615. twoDimVert0
  4616. ],
  4617. [
  4618. 1,
  4619. twoDimVert0
  4620. ],
  4621. [
  4622. 1,
  4623. twoDimVert0
  4624. ],
  4625. [
  4626. 1,
  4627. twoDimVert0
  4628. ],
  4629. [
  4630. 1,
  4631. twoDimVert0
  4632. ],
  4633. [
  4634. 1,
  4635. twoDimVert0
  4636. ],
  4637. [
  4638. 1,
  4639. twoDimVert0
  4640. ],
  4641. [
  4642. 1,
  4643. twoDimVert0
  4644. ],
  4645. [
  4646. 1,
  4647. twoDimVert0
  4648. ],
  4649. [
  4650. 1,
  4651. twoDimVert0
  4652. ],
  4653. [
  4654. 1,
  4655. twoDimVert0
  4656. ],
  4657. [
  4658. 1,
  4659. twoDimVert0
  4660. ],
  4661. [
  4662. 1,
  4663. twoDimVert0
  4664. ],
  4665. [
  4666. 1,
  4667. twoDimVert0
  4668. ],
  4669. [
  4670. 1,
  4671. twoDimVert0
  4672. ],
  4673. [
  4674. 1,
  4675. twoDimVert0
  4676. ],
  4677. [
  4678. 1,
  4679. twoDimVert0
  4680. ],
  4681. [
  4682. 1,
  4683. twoDimVert0
  4684. ],
  4685. [
  4686. 1,
  4687. twoDimVert0
  4688. ],
  4689. [
  4690. 1,
  4691. twoDimVert0
  4692. ],
  4693. [
  4694. 1,
  4695. twoDimVert0
  4696. ],
  4697. [
  4698. 1,
  4699. twoDimVert0
  4700. ],
  4701. [
  4702. 1,
  4703. twoDimVert0
  4704. ],
  4705. [
  4706. 1,
  4707. twoDimVert0
  4708. ],
  4709. [
  4710. 1,
  4711. twoDimVert0
  4712. ]
  4713. ];
  4714. var whiteTable1 = [
  4715. [
  4716. -1,
  4717. -1
  4718. ],
  4719. [
  4720. 12,
  4721. ccittEOL
  4722. ],
  4723. [
  4724. -1,
  4725. -1
  4726. ],
  4727. [
  4728. -1,
  4729. -1
  4730. ],
  4731. [
  4732. -1,
  4733. -1
  4734. ],
  4735. [
  4736. -1,
  4737. -1
  4738. ],
  4739. [
  4740. -1,
  4741. -1
  4742. ],
  4743. [
  4744. -1,
  4745. -1
  4746. ],
  4747. [
  4748. -1,
  4749. -1
  4750. ],
  4751. [
  4752. -1,
  4753. -1
  4754. ],
  4755. [
  4756. -1,
  4757. -1
  4758. ],
  4759. [
  4760. -1,
  4761. -1
  4762. ],
  4763. [
  4764. -1,
  4765. -1
  4766. ],
  4767. [
  4768. -1,
  4769. -1
  4770. ],
  4771. [
  4772. -1,
  4773. -1
  4774. ],
  4775. [
  4776. -1,
  4777. -1
  4778. ],
  4779. [
  4780. 11,
  4781. 1792
  4782. ],
  4783. [
  4784. 11,
  4785. 1792
  4786. ],
  4787. [
  4788. 12,
  4789. 1984
  4790. ],
  4791. [
  4792. 12,
  4793. 2048
  4794. ],
  4795. [
  4796. 12,
  4797. 2112
  4798. ],
  4799. [
  4800. 12,
  4801. 2176
  4802. ],
  4803. [
  4804. 12,
  4805. 2240
  4806. ],
  4807. [
  4808. 12,
  4809. 2304
  4810. ],
  4811. [
  4812. 11,
  4813. 1856
  4814. ],
  4815. [
  4816. 11,
  4817. 1856
  4818. ],
  4819. [
  4820. 11,
  4821. 1920
  4822. ],
  4823. [
  4824. 11,
  4825. 1920
  4826. ],
  4827. [
  4828. 12,
  4829. 2368
  4830. ],
  4831. [
  4832. 12,
  4833. 2432
  4834. ],
  4835. [
  4836. 12,
  4837. 2496
  4838. ],
  4839. [
  4840. 12,
  4841. 2560
  4842. ]
  4843. ];
  4844. var whiteTable2 = [
  4845. [
  4846. -1,
  4847. -1
  4848. ],
  4849. [
  4850. -1,
  4851. -1
  4852. ],
  4853. [
  4854. -1,
  4855. -1
  4856. ],
  4857. [
  4858. -1,
  4859. -1
  4860. ],
  4861. [
  4862. 8,
  4863. 29
  4864. ],
  4865. [
  4866. 8,
  4867. 29
  4868. ],
  4869. [
  4870. 8,
  4871. 30
  4872. ],
  4873. [
  4874. 8,
  4875. 30
  4876. ],
  4877. [
  4878. 8,
  4879. 45
  4880. ],
  4881. [
  4882. 8,
  4883. 45
  4884. ],
  4885. [
  4886. 8,
  4887. 46
  4888. ],
  4889. [
  4890. 8,
  4891. 46
  4892. ],
  4893. [
  4894. 7,
  4895. 22
  4896. ],
  4897. [
  4898. 7,
  4899. 22
  4900. ],
  4901. [
  4902. 7,
  4903. 22
  4904. ],
  4905. [
  4906. 7,
  4907. 22
  4908. ],
  4909. [
  4910. 7,
  4911. 23
  4912. ],
  4913. [
  4914. 7,
  4915. 23
  4916. ],
  4917. [
  4918. 7,
  4919. 23
  4920. ],
  4921. [
  4922. 7,
  4923. 23
  4924. ],
  4925. [
  4926. 8,
  4927. 47
  4928. ],
  4929. [
  4930. 8,
  4931. 47
  4932. ],
  4933. [
  4934. 8,
  4935. 48
  4936. ],
  4937. [
  4938. 8,
  4939. 48
  4940. ],
  4941. [
  4942. 6,
  4943. 13
  4944. ],
  4945. [
  4946. 6,
  4947. 13
  4948. ],
  4949. [
  4950. 6,
  4951. 13
  4952. ],
  4953. [
  4954. 6,
  4955. 13
  4956. ],
  4957. [
  4958. 6,
  4959. 13
  4960. ],
  4961. [
  4962. 6,
  4963. 13
  4964. ],
  4965. [
  4966. 6,
  4967. 13
  4968. ],
  4969. [
  4970. 6,
  4971. 13
  4972. ],
  4973. [
  4974. 7,
  4975. 20
  4976. ],
  4977. [
  4978. 7,
  4979. 20
  4980. ],
  4981. [
  4982. 7,
  4983. 20
  4984. ],
  4985. [
  4986. 7,
  4987. 20
  4988. ],
  4989. [
  4990. 8,
  4991. 33
  4992. ],
  4993. [
  4994. 8,
  4995. 33
  4996. ],
  4997. [
  4998. 8,
  4999. 34
  5000. ],
  5001. [
  5002. 8,
  5003. 34
  5004. ],
  5005. [
  5006. 8,
  5007. 35
  5008. ],
  5009. [
  5010. 8,
  5011. 35
  5012. ],
  5013. [
  5014. 8,
  5015. 36
  5016. ],
  5017. [
  5018. 8,
  5019. 36
  5020. ],
  5021. [
  5022. 8,
  5023. 37
  5024. ],
  5025. [
  5026. 8,
  5027. 37
  5028. ],
  5029. [
  5030. 8,
  5031. 38
  5032. ],
  5033. [
  5034. 8,
  5035. 38
  5036. ],
  5037. [
  5038. 7,
  5039. 19
  5040. ],
  5041. [
  5042. 7,
  5043. 19
  5044. ],
  5045. [
  5046. 7,
  5047. 19
  5048. ],
  5049. [
  5050. 7,
  5051. 19
  5052. ],
  5053. [
  5054. 8,
  5055. 31
  5056. ],
  5057. [
  5058. 8,
  5059. 31
  5060. ],
  5061. [
  5062. 8,
  5063. 32
  5064. ],
  5065. [
  5066. 8,
  5067. 32
  5068. ],
  5069. [
  5070. 6,
  5071. 1
  5072. ],
  5073. [
  5074. 6,
  5075. 1
  5076. ],
  5077. [
  5078. 6,
  5079. 1
  5080. ],
  5081. [
  5082. 6,
  5083. 1
  5084. ],
  5085. [
  5086. 6,
  5087. 1
  5088. ],
  5089. [
  5090. 6,
  5091. 1
  5092. ],
  5093. [
  5094. 6,
  5095. 1
  5096. ],
  5097. [
  5098. 6,
  5099. 1
  5100. ],
  5101. [
  5102. 6,
  5103. 12
  5104. ],
  5105. [
  5106. 6,
  5107. 12
  5108. ],
  5109. [
  5110. 6,
  5111. 12
  5112. ],
  5113. [
  5114. 6,
  5115. 12
  5116. ],
  5117. [
  5118. 6,
  5119. 12
  5120. ],
  5121. [
  5122. 6,
  5123. 12
  5124. ],
  5125. [
  5126. 6,
  5127. 12
  5128. ],
  5129. [
  5130. 6,
  5131. 12
  5132. ],
  5133. [
  5134. 8,
  5135. 53
  5136. ],
  5137. [
  5138. 8,
  5139. 53
  5140. ],
  5141. [
  5142. 8,
  5143. 54
  5144. ],
  5145. [
  5146. 8,
  5147. 54
  5148. ],
  5149. [
  5150. 7,
  5151. 26
  5152. ],
  5153. [
  5154. 7,
  5155. 26
  5156. ],
  5157. [
  5158. 7,
  5159. 26
  5160. ],
  5161. [
  5162. 7,
  5163. 26
  5164. ],
  5165. [
  5166. 8,
  5167. 39
  5168. ],
  5169. [
  5170. 8,
  5171. 39
  5172. ],
  5173. [
  5174. 8,
  5175. 40
  5176. ],
  5177. [
  5178. 8,
  5179. 40
  5180. ],
  5181. [
  5182. 8,
  5183. 41
  5184. ],
  5185. [
  5186. 8,
  5187. 41
  5188. ],
  5189. [
  5190. 8,
  5191. 42
  5192. ],
  5193. [
  5194. 8,
  5195. 42
  5196. ],
  5197. [
  5198. 8,
  5199. 43
  5200. ],
  5201. [
  5202. 8,
  5203. 43
  5204. ],
  5205. [
  5206. 8,
  5207. 44
  5208. ],
  5209. [
  5210. 8,
  5211. 44
  5212. ],
  5213. [
  5214. 7,
  5215. 21
  5216. ],
  5217. [
  5218. 7,
  5219. 21
  5220. ],
  5221. [
  5222. 7,
  5223. 21
  5224. ],
  5225. [
  5226. 7,
  5227. 21
  5228. ],
  5229. [
  5230. 7,
  5231. 28
  5232. ],
  5233. [
  5234. 7,
  5235. 28
  5236. ],
  5237. [
  5238. 7,
  5239. 28
  5240. ],
  5241. [
  5242. 7,
  5243. 28
  5244. ],
  5245. [
  5246. 8,
  5247. 61
  5248. ],
  5249. [
  5250. 8,
  5251. 61
  5252. ],
  5253. [
  5254. 8,
  5255. 62
  5256. ],
  5257. [
  5258. 8,
  5259. 62
  5260. ],
  5261. [
  5262. 8,
  5263. 63
  5264. ],
  5265. [
  5266. 8,
  5267. 63
  5268. ],
  5269. [
  5270. 8,
  5271. 0
  5272. ],
  5273. [
  5274. 8,
  5275. 0
  5276. ],
  5277. [
  5278. 8,
  5279. 320
  5280. ],
  5281. [
  5282. 8,
  5283. 320
  5284. ],
  5285. [
  5286. 8,
  5287. 384
  5288. ],
  5289. [
  5290. 8,
  5291. 384
  5292. ],
  5293. [
  5294. 5,
  5295. 10
  5296. ],
  5297. [
  5298. 5,
  5299. 10
  5300. ],
  5301. [
  5302. 5,
  5303. 10
  5304. ],
  5305. [
  5306. 5,
  5307. 10
  5308. ],
  5309. [
  5310. 5,
  5311. 10
  5312. ],
  5313. [
  5314. 5,
  5315. 10
  5316. ],
  5317. [
  5318. 5,
  5319. 10
  5320. ],
  5321. [
  5322. 5,
  5323. 10
  5324. ],
  5325. [
  5326. 5,
  5327. 10
  5328. ],
  5329. [
  5330. 5,
  5331. 10
  5332. ],
  5333. [
  5334. 5,
  5335. 10
  5336. ],
  5337. [
  5338. 5,
  5339. 10
  5340. ],
  5341. [
  5342. 5,
  5343. 10
  5344. ],
  5345. [
  5346. 5,
  5347. 10
  5348. ],
  5349. [
  5350. 5,
  5351. 10
  5352. ],
  5353. [
  5354. 5,
  5355. 10
  5356. ],
  5357. [
  5358. 5,
  5359. 11
  5360. ],
  5361. [
  5362. 5,
  5363. 11
  5364. ],
  5365. [
  5366. 5,
  5367. 11
  5368. ],
  5369. [
  5370. 5,
  5371. 11
  5372. ],
  5373. [
  5374. 5,
  5375. 11
  5376. ],
  5377. [
  5378. 5,
  5379. 11
  5380. ],
  5381. [
  5382. 5,
  5383. 11
  5384. ],
  5385. [
  5386. 5,
  5387. 11
  5388. ],
  5389. [
  5390. 5,
  5391. 11
  5392. ],
  5393. [
  5394. 5,
  5395. 11
  5396. ],
  5397. [
  5398. 5,
  5399. 11
  5400. ],
  5401. [
  5402. 5,
  5403. 11
  5404. ],
  5405. [
  5406. 5,
  5407. 11
  5408. ],
  5409. [
  5410. 5,
  5411. 11
  5412. ],
  5413. [
  5414. 5,
  5415. 11
  5416. ],
  5417. [
  5418. 5,
  5419. 11
  5420. ],
  5421. [
  5422. 7,
  5423. 27
  5424. ],
  5425. [
  5426. 7,
  5427. 27
  5428. ],
  5429. [
  5430. 7,
  5431. 27
  5432. ],
  5433. [
  5434. 7,
  5435. 27
  5436. ],
  5437. [
  5438. 8,
  5439. 59
  5440. ],
  5441. [
  5442. 8,
  5443. 59
  5444. ],
  5445. [
  5446. 8,
  5447. 60
  5448. ],
  5449. [
  5450. 8,
  5451. 60
  5452. ],
  5453. [
  5454. 9,
  5455. 1472
  5456. ],
  5457. [
  5458. 9,
  5459. 1536
  5460. ],
  5461. [
  5462. 9,
  5463. 1600
  5464. ],
  5465. [
  5466. 9,
  5467. 1728
  5468. ],
  5469. [
  5470. 7,
  5471. 18
  5472. ],
  5473. [
  5474. 7,
  5475. 18
  5476. ],
  5477. [
  5478. 7,
  5479. 18
  5480. ],
  5481. [
  5482. 7,
  5483. 18
  5484. ],
  5485. [
  5486. 7,
  5487. 24
  5488. ],
  5489. [
  5490. 7,
  5491. 24
  5492. ],
  5493. [
  5494. 7,
  5495. 24
  5496. ],
  5497. [
  5498. 7,
  5499. 24
  5500. ],
  5501. [
  5502. 8,
  5503. 49
  5504. ],
  5505. [
  5506. 8,
  5507. 49
  5508. ],
  5509. [
  5510. 8,
  5511. 50
  5512. ],
  5513. [
  5514. 8,
  5515. 50
  5516. ],
  5517. [
  5518. 8,
  5519. 51
  5520. ],
  5521. [
  5522. 8,
  5523. 51
  5524. ],
  5525. [
  5526. 8,
  5527. 52
  5528. ],
  5529. [
  5530. 8,
  5531. 52
  5532. ],
  5533. [
  5534. 7,
  5535. 25
  5536. ],
  5537. [
  5538. 7,
  5539. 25
  5540. ],
  5541. [
  5542. 7,
  5543. 25
  5544. ],
  5545. [
  5546. 7,
  5547. 25
  5548. ],
  5549. [
  5550. 8,
  5551. 55
  5552. ],
  5553. [
  5554. 8,
  5555. 55
  5556. ],
  5557. [
  5558. 8,
  5559. 56
  5560. ],
  5561. [
  5562. 8,
  5563. 56
  5564. ],
  5565. [
  5566. 8,
  5567. 57
  5568. ],
  5569. [
  5570. 8,
  5571. 57
  5572. ],
  5573. [
  5574. 8,
  5575. 58
  5576. ],
  5577. [
  5578. 8,
  5579. 58
  5580. ],
  5581. [
  5582. 6,
  5583. 192
  5584. ],
  5585. [
  5586. 6,
  5587. 192
  5588. ],
  5589. [
  5590. 6,
  5591. 192
  5592. ],
  5593. [
  5594. 6,
  5595. 192
  5596. ],
  5597. [
  5598. 6,
  5599. 192
  5600. ],
  5601. [
  5602. 6,
  5603. 192
  5604. ],
  5605. [
  5606. 6,
  5607. 192
  5608. ],
  5609. [
  5610. 6,
  5611. 192
  5612. ],
  5613. [
  5614. 6,
  5615. 1664
  5616. ],
  5617. [
  5618. 6,
  5619. 1664
  5620. ],
  5621. [
  5622. 6,
  5623. 1664
  5624. ],
  5625. [
  5626. 6,
  5627. 1664
  5628. ],
  5629. [
  5630. 6,
  5631. 1664
  5632. ],
  5633. [
  5634. 6,
  5635. 1664
  5636. ],
  5637. [
  5638. 6,
  5639. 1664
  5640. ],
  5641. [
  5642. 6,
  5643. 1664
  5644. ],
  5645. [
  5646. 8,
  5647. 448
  5648. ],
  5649. [
  5650. 8,
  5651. 448
  5652. ],
  5653. [
  5654. 8,
  5655. 512
  5656. ],
  5657. [
  5658. 8,
  5659. 512
  5660. ],
  5661. [
  5662. 9,
  5663. 704
  5664. ],
  5665. [
  5666. 9,
  5667. 768
  5668. ],
  5669. [
  5670. 8,
  5671. 640
  5672. ],
  5673. [
  5674. 8,
  5675. 640
  5676. ],
  5677. [
  5678. 8,
  5679. 576
  5680. ],
  5681. [
  5682. 8,
  5683. 576
  5684. ],
  5685. [
  5686. 9,
  5687. 832
  5688. ],
  5689. [
  5690. 9,
  5691. 896
  5692. ],
  5693. [
  5694. 9,
  5695. 960
  5696. ],
  5697. [
  5698. 9,
  5699. 1024
  5700. ],
  5701. [
  5702. 9,
  5703. 1088
  5704. ],
  5705. [
  5706. 9,
  5707. 1152
  5708. ],
  5709. [
  5710. 9,
  5711. 1216
  5712. ],
  5713. [
  5714. 9,
  5715. 1280
  5716. ],
  5717. [
  5718. 9,
  5719. 1344
  5720. ],
  5721. [
  5722. 9,
  5723. 1408
  5724. ],
  5725. [
  5726. 7,
  5727. 256
  5728. ],
  5729. [
  5730. 7,
  5731. 256
  5732. ],
  5733. [
  5734. 7,
  5735. 256
  5736. ],
  5737. [
  5738. 7,
  5739. 256
  5740. ],
  5741. [
  5742. 4,
  5743. 2
  5744. ],
  5745. [
  5746. 4,
  5747. 2
  5748. ],
  5749. [
  5750. 4,
  5751. 2
  5752. ],
  5753. [
  5754. 4,
  5755. 2
  5756. ],
  5757. [
  5758. 4,
  5759. 2
  5760. ],
  5761. [
  5762. 4,
  5763. 2
  5764. ],
  5765. [
  5766. 4,
  5767. 2
  5768. ],
  5769. [
  5770. 4,
  5771. 2
  5772. ],
  5773. [
  5774. 4,
  5775. 2
  5776. ],
  5777. [
  5778. 4,
  5779. 2
  5780. ],
  5781. [
  5782. 4,
  5783. 2
  5784. ],
  5785. [
  5786. 4,
  5787. 2
  5788. ],
  5789. [
  5790. 4,
  5791. 2
  5792. ],
  5793. [
  5794. 4,
  5795. 2
  5796. ],
  5797. [
  5798. 4,
  5799. 2
  5800. ],
  5801. [
  5802. 4,
  5803. 2
  5804. ],
  5805. [
  5806. 4,
  5807. 2
  5808. ],
  5809. [
  5810. 4,
  5811. 2
  5812. ],
  5813. [
  5814. 4,
  5815. 2
  5816. ],
  5817. [
  5818. 4,
  5819. 2
  5820. ],
  5821. [
  5822. 4,
  5823. 2
  5824. ],
  5825. [
  5826. 4,
  5827. 2
  5828. ],
  5829. [
  5830. 4,
  5831. 2
  5832. ],
  5833. [
  5834. 4,
  5835. 2
  5836. ],
  5837. [
  5838. 4,
  5839. 2
  5840. ],
  5841. [
  5842. 4,
  5843. 2
  5844. ],
  5845. [
  5846. 4,
  5847. 2
  5848. ],
  5849. [
  5850. 4,
  5851. 2
  5852. ],
  5853. [
  5854. 4,
  5855. 2
  5856. ],
  5857. [
  5858. 4,
  5859. 2
  5860. ],
  5861. [
  5862. 4,
  5863. 2
  5864. ],
  5865. [
  5866. 4,
  5867. 2
  5868. ],
  5869. [
  5870. 4,
  5871. 3
  5872. ],
  5873. [
  5874. 4,
  5875. 3
  5876. ],
  5877. [
  5878. 4,
  5879. 3
  5880. ],
  5881. [
  5882. 4,
  5883. 3
  5884. ],
  5885. [
  5886. 4,
  5887. 3
  5888. ],
  5889. [
  5890. 4,
  5891. 3
  5892. ],
  5893. [
  5894. 4,
  5895. 3
  5896. ],
  5897. [
  5898. 4,
  5899. 3
  5900. ],
  5901. [
  5902. 4,
  5903. 3
  5904. ],
  5905. [
  5906. 4,
  5907. 3
  5908. ],
  5909. [
  5910. 4,
  5911. 3
  5912. ],
  5913. [
  5914. 4,
  5915. 3
  5916. ],
  5917. [
  5918. 4,
  5919. 3
  5920. ],
  5921. [
  5922. 4,
  5923. 3
  5924. ],
  5925. [
  5926. 4,
  5927. 3
  5928. ],
  5929. [
  5930. 4,
  5931. 3
  5932. ],
  5933. [
  5934. 4,
  5935. 3
  5936. ],
  5937. [
  5938. 4,
  5939. 3
  5940. ],
  5941. [
  5942. 4,
  5943. 3
  5944. ],
  5945. [
  5946. 4,
  5947. 3
  5948. ],
  5949. [
  5950. 4,
  5951. 3
  5952. ],
  5953. [
  5954. 4,
  5955. 3
  5956. ],
  5957. [
  5958. 4,
  5959. 3
  5960. ],
  5961. [
  5962. 4,
  5963. 3
  5964. ],
  5965. [
  5966. 4,
  5967. 3
  5968. ],
  5969. [
  5970. 4,
  5971. 3
  5972. ],
  5973. [
  5974. 4,
  5975. 3
  5976. ],
  5977. [
  5978. 4,
  5979. 3
  5980. ],
  5981. [
  5982. 4,
  5983. 3
  5984. ],
  5985. [
  5986. 4,
  5987. 3
  5988. ],
  5989. [
  5990. 4,
  5991. 3
  5992. ],
  5993. [
  5994. 4,
  5995. 3
  5996. ],
  5997. [
  5998. 5,
  5999. 128
  6000. ],
  6001. [
  6002. 5,
  6003. 128
  6004. ],
  6005. [
  6006. 5,
  6007. 128
  6008. ],
  6009. [
  6010. 5,
  6011. 128
  6012. ],
  6013. [
  6014. 5,
  6015. 128
  6016. ],
  6017. [
  6018. 5,
  6019. 128
  6020. ],
  6021. [
  6022. 5,
  6023. 128
  6024. ],
  6025. [
  6026. 5,
  6027. 128
  6028. ],
  6029. [
  6030. 5,
  6031. 128
  6032. ],
  6033. [
  6034. 5,
  6035. 128
  6036. ],
  6037. [
  6038. 5,
  6039. 128
  6040. ],
  6041. [
  6042. 5,
  6043. 128
  6044. ],
  6045. [
  6046. 5,
  6047. 128
  6048. ],
  6049. [
  6050. 5,
  6051. 128
  6052. ],
  6053. [
  6054. 5,
  6055. 128
  6056. ],
  6057. [
  6058. 5,
  6059. 128
  6060. ],
  6061. [
  6062. 5,
  6063. 8
  6064. ],
  6065. [
  6066. 5,
  6067. 8
  6068. ],
  6069. [
  6070. 5,
  6071. 8
  6072. ],
  6073. [
  6074. 5,
  6075. 8
  6076. ],
  6077. [
  6078. 5,
  6079. 8
  6080. ],
  6081. [
  6082. 5,
  6083. 8
  6084. ],
  6085. [
  6086. 5,
  6087. 8
  6088. ],
  6089. [
  6090. 5,
  6091. 8
  6092. ],
  6093. [
  6094. 5,
  6095. 8
  6096. ],
  6097. [
  6098. 5,
  6099. 8
  6100. ],
  6101. [
  6102. 5,
  6103. 8
  6104. ],
  6105. [
  6106. 5,
  6107. 8
  6108. ],
  6109. [
  6110. 5,
  6111. 8
  6112. ],
  6113. [
  6114. 5,
  6115. 8
  6116. ],
  6117. [
  6118. 5,
  6119. 8
  6120. ],
  6121. [
  6122. 5,
  6123. 8
  6124. ],
  6125. [
  6126. 5,
  6127. 9
  6128. ],
  6129. [
  6130. 5,
  6131. 9
  6132. ],
  6133. [
  6134. 5,
  6135. 9
  6136. ],
  6137. [
  6138. 5,
  6139. 9
  6140. ],
  6141. [
  6142. 5,
  6143. 9
  6144. ],
  6145. [
  6146. 5,
  6147. 9
  6148. ],
  6149. [
  6150. 5,
  6151. 9
  6152. ],
  6153. [
  6154. 5,
  6155. 9
  6156. ],
  6157. [
  6158. 5,
  6159. 9
  6160. ],
  6161. [
  6162. 5,
  6163. 9
  6164. ],
  6165. [
  6166. 5,
  6167. 9
  6168. ],
  6169. [
  6170. 5,
  6171. 9
  6172. ],
  6173. [
  6174. 5,
  6175. 9
  6176. ],
  6177. [
  6178. 5,
  6179. 9
  6180. ],
  6181. [
  6182. 5,
  6183. 9
  6184. ],
  6185. [
  6186. 5,
  6187. 9
  6188. ],
  6189. [
  6190. 6,
  6191. 16
  6192. ],
  6193. [
  6194. 6,
  6195. 16
  6196. ],
  6197. [
  6198. 6,
  6199. 16
  6200. ],
  6201. [
  6202. 6,
  6203. 16
  6204. ],
  6205. [
  6206. 6,
  6207. 16
  6208. ],
  6209. [
  6210. 6,
  6211. 16
  6212. ],
  6213. [
  6214. 6,
  6215. 16
  6216. ],
  6217. [
  6218. 6,
  6219. 16
  6220. ],
  6221. [
  6222. 6,
  6223. 17
  6224. ],
  6225. [
  6226. 6,
  6227. 17
  6228. ],
  6229. [
  6230. 6,
  6231. 17
  6232. ],
  6233. [
  6234. 6,
  6235. 17
  6236. ],
  6237. [
  6238. 6,
  6239. 17
  6240. ],
  6241. [
  6242. 6,
  6243. 17
  6244. ],
  6245. [
  6246. 6,
  6247. 17
  6248. ],
  6249. [
  6250. 6,
  6251. 17
  6252. ],
  6253. [
  6254. 4,
  6255. 4
  6256. ],
  6257. [
  6258. 4,
  6259. 4
  6260. ],
  6261. [
  6262. 4,
  6263. 4
  6264. ],
  6265. [
  6266. 4,
  6267. 4
  6268. ],
  6269. [
  6270. 4,
  6271. 4
  6272. ],
  6273. [
  6274. 4,
  6275. 4
  6276. ],
  6277. [
  6278. 4,
  6279. 4
  6280. ],
  6281. [
  6282. 4,
  6283. 4
  6284. ],
  6285. [
  6286. 4,
  6287. 4
  6288. ],
  6289. [
  6290. 4,
  6291. 4
  6292. ],
  6293. [
  6294. 4,
  6295. 4
  6296. ],
  6297. [
  6298. 4,
  6299. 4
  6300. ],
  6301. [
  6302. 4,
  6303. 4
  6304. ],
  6305. [
  6306. 4,
  6307. 4
  6308. ],
  6309. [
  6310. 4,
  6311. 4
  6312. ],
  6313. [
  6314. 4,
  6315. 4
  6316. ],
  6317. [
  6318. 4,
  6319. 4
  6320. ],
  6321. [
  6322. 4,
  6323. 4
  6324. ],
  6325. [
  6326. 4,
  6327. 4
  6328. ],
  6329. [
  6330. 4,
  6331. 4
  6332. ],
  6333. [
  6334. 4,
  6335. 4
  6336. ],
  6337. [
  6338. 4,
  6339. 4
  6340. ],
  6341. [
  6342. 4,
  6343. 4
  6344. ],
  6345. [
  6346. 4,
  6347. 4
  6348. ],
  6349. [
  6350. 4,
  6351. 4
  6352. ],
  6353. [
  6354. 4,
  6355. 4
  6356. ],
  6357. [
  6358. 4,
  6359. 4
  6360. ],
  6361. [
  6362. 4,
  6363. 4
  6364. ],
  6365. [
  6366. 4,
  6367. 4
  6368. ],
  6369. [
  6370. 4,
  6371. 4
  6372. ],
  6373. [
  6374. 4,
  6375. 4
  6376. ],
  6377. [
  6378. 4,
  6379. 4
  6380. ],
  6381. [
  6382. 4,
  6383. 5
  6384. ],
  6385. [
  6386. 4,
  6387. 5
  6388. ],
  6389. [
  6390. 4,
  6391. 5
  6392. ],
  6393. [
  6394. 4,
  6395. 5
  6396. ],
  6397. [
  6398. 4,
  6399. 5
  6400. ],
  6401. [
  6402. 4,
  6403. 5
  6404. ],
  6405. [
  6406. 4,
  6407. 5
  6408. ],
  6409. [
  6410. 4,
  6411. 5
  6412. ],
  6413. [
  6414. 4,
  6415. 5
  6416. ],
  6417. [
  6418. 4,
  6419. 5
  6420. ],
  6421. [
  6422. 4,
  6423. 5
  6424. ],
  6425. [
  6426. 4,
  6427. 5
  6428. ],
  6429. [
  6430. 4,
  6431. 5
  6432. ],
  6433. [
  6434. 4,
  6435. 5
  6436. ],
  6437. [
  6438. 4,
  6439. 5
  6440. ],
  6441. [
  6442. 4,
  6443. 5
  6444. ],
  6445. [
  6446. 4,
  6447. 5
  6448. ],
  6449. [
  6450. 4,
  6451. 5
  6452. ],
  6453. [
  6454. 4,
  6455. 5
  6456. ],
  6457. [
  6458. 4,
  6459. 5
  6460. ],
  6461. [
  6462. 4,
  6463. 5
  6464. ],
  6465. [
  6466. 4,
  6467. 5
  6468. ],
  6469. [
  6470. 4,
  6471. 5
  6472. ],
  6473. [
  6474. 4,
  6475. 5
  6476. ],
  6477. [
  6478. 4,
  6479. 5
  6480. ],
  6481. [
  6482. 4,
  6483. 5
  6484. ],
  6485. [
  6486. 4,
  6487. 5
  6488. ],
  6489. [
  6490. 4,
  6491. 5
  6492. ],
  6493. [
  6494. 4,
  6495. 5
  6496. ],
  6497. [
  6498. 4,
  6499. 5
  6500. ],
  6501. [
  6502. 4,
  6503. 5
  6504. ],
  6505. [
  6506. 4,
  6507. 5
  6508. ],
  6509. [
  6510. 6,
  6511. 14
  6512. ],
  6513. [
  6514. 6,
  6515. 14
  6516. ],
  6517. [
  6518. 6,
  6519. 14
  6520. ],
  6521. [
  6522. 6,
  6523. 14
  6524. ],
  6525. [
  6526. 6,
  6527. 14
  6528. ],
  6529. [
  6530. 6,
  6531. 14
  6532. ],
  6533. [
  6534. 6,
  6535. 14
  6536. ],
  6537. [
  6538. 6,
  6539. 14
  6540. ],
  6541. [
  6542. 6,
  6543. 15
  6544. ],
  6545. [
  6546. 6,
  6547. 15
  6548. ],
  6549. [
  6550. 6,
  6551. 15
  6552. ],
  6553. [
  6554. 6,
  6555. 15
  6556. ],
  6557. [
  6558. 6,
  6559. 15
  6560. ],
  6561. [
  6562. 6,
  6563. 15
  6564. ],
  6565. [
  6566. 6,
  6567. 15
  6568. ],
  6569. [
  6570. 6,
  6571. 15
  6572. ],
  6573. [
  6574. 5,
  6575. 64
  6576. ],
  6577. [
  6578. 5,
  6579. 64
  6580. ],
  6581. [
  6582. 5,
  6583. 64
  6584. ],
  6585. [
  6586. 5,
  6587. 64
  6588. ],
  6589. [
  6590. 5,
  6591. 64
  6592. ],
  6593. [
  6594. 5,
  6595. 64
  6596. ],
  6597. [
  6598. 5,
  6599. 64
  6600. ],
  6601. [
  6602. 5,
  6603. 64
  6604. ],
  6605. [
  6606. 5,
  6607. 64
  6608. ],
  6609. [
  6610. 5,
  6611. 64
  6612. ],
  6613. [
  6614. 5,
  6615. 64
  6616. ],
  6617. [
  6618. 5,
  6619. 64
  6620. ],
  6621. [
  6622. 5,
  6623. 64
  6624. ],
  6625. [
  6626. 5,
  6627. 64
  6628. ],
  6629. [
  6630. 5,
  6631. 64
  6632. ],
  6633. [
  6634. 5,
  6635. 64
  6636. ],
  6637. [
  6638. 4,
  6639. 6
  6640. ],
  6641. [
  6642. 4,
  6643. 6
  6644. ],
  6645. [
  6646. 4,
  6647. 6
  6648. ],
  6649. [
  6650. 4,
  6651. 6
  6652. ],
  6653. [
  6654. 4,
  6655. 6
  6656. ],
  6657. [
  6658. 4,
  6659. 6
  6660. ],
  6661. [
  6662. 4,
  6663. 6
  6664. ],
  6665. [
  6666. 4,
  6667. 6
  6668. ],
  6669. [
  6670. 4,
  6671. 6
  6672. ],
  6673. [
  6674. 4,
  6675. 6
  6676. ],
  6677. [
  6678. 4,
  6679. 6
  6680. ],
  6681. [
  6682. 4,
  6683. 6
  6684. ],
  6685. [
  6686. 4,
  6687. 6
  6688. ],
  6689. [
  6690. 4,
  6691. 6
  6692. ],
  6693. [
  6694. 4,
  6695. 6
  6696. ],
  6697. [
  6698. 4,
  6699. 6
  6700. ],
  6701. [
  6702. 4,
  6703. 6
  6704. ],
  6705. [
  6706. 4,
  6707. 6
  6708. ],
  6709. [
  6710. 4,
  6711. 6
  6712. ],
  6713. [
  6714. 4,
  6715. 6
  6716. ],
  6717. [
  6718. 4,
  6719. 6
  6720. ],
  6721. [
  6722. 4,
  6723. 6
  6724. ],
  6725. [
  6726. 4,
  6727. 6
  6728. ],
  6729. [
  6730. 4,
  6731. 6
  6732. ],
  6733. [
  6734. 4,
  6735. 6
  6736. ],
  6737. [
  6738. 4,
  6739. 6
  6740. ],
  6741. [
  6742. 4,
  6743. 6
  6744. ],
  6745. [
  6746. 4,
  6747. 6
  6748. ],
  6749. [
  6750. 4,
  6751. 6
  6752. ],
  6753. [
  6754. 4,
  6755. 6
  6756. ],
  6757. [
  6758. 4,
  6759. 6
  6760. ],
  6761. [
  6762. 4,
  6763. 6
  6764. ],
  6765. [
  6766. 4,
  6767. 7
  6768. ],
  6769. [
  6770. 4,
  6771. 7
  6772. ],
  6773. [
  6774. 4,
  6775. 7
  6776. ],
  6777. [
  6778. 4,
  6779. 7
  6780. ],
  6781. [
  6782. 4,
  6783. 7
  6784. ],
  6785. [
  6786. 4,
  6787. 7
  6788. ],
  6789. [
  6790. 4,
  6791. 7
  6792. ],
  6793. [
  6794. 4,
  6795. 7
  6796. ],
  6797. [
  6798. 4,
  6799. 7
  6800. ],
  6801. [
  6802. 4,
  6803. 7
  6804. ],
  6805. [
  6806. 4,
  6807. 7
  6808. ],
  6809. [
  6810. 4,
  6811. 7
  6812. ],
  6813. [
  6814. 4,
  6815. 7
  6816. ],
  6817. [
  6818. 4,
  6819. 7
  6820. ],
  6821. [
  6822. 4,
  6823. 7
  6824. ],
  6825. [
  6826. 4,
  6827. 7
  6828. ],
  6829. [
  6830. 4,
  6831. 7
  6832. ],
  6833. [
  6834. 4,
  6835. 7
  6836. ],
  6837. [
  6838. 4,
  6839. 7
  6840. ],
  6841. [
  6842. 4,
  6843. 7
  6844. ],
  6845. [
  6846. 4,
  6847. 7
  6848. ],
  6849. [
  6850. 4,
  6851. 7
  6852. ],
  6853. [
  6854. 4,
  6855. 7
  6856. ],
  6857. [
  6858. 4,
  6859. 7
  6860. ],
  6861. [
  6862. 4,
  6863. 7
  6864. ],
  6865. [
  6866. 4,
  6867. 7
  6868. ],
  6869. [
  6870. 4,
  6871. 7
  6872. ],
  6873. [
  6874. 4,
  6875. 7
  6876. ],
  6877. [
  6878. 4,
  6879. 7
  6880. ],
  6881. [
  6882. 4,
  6883. 7
  6884. ],
  6885. [
  6886. 4,
  6887. 7
  6888. ],
  6889. [
  6890. 4,
  6891. 7
  6892. ]
  6893. ];
  6894. var blackTable1 = [
  6895. [
  6896. -1,
  6897. -1
  6898. ],
  6899. [
  6900. -1,
  6901. -1
  6902. ],
  6903. [
  6904. 12,
  6905. ccittEOL
  6906. ],
  6907. [
  6908. 12,
  6909. ccittEOL
  6910. ],
  6911. [
  6912. -1,
  6913. -1
  6914. ],
  6915. [
  6916. -1,
  6917. -1
  6918. ],
  6919. [
  6920. -1,
  6921. -1
  6922. ],
  6923. [
  6924. -1,
  6925. -1
  6926. ],
  6927. [
  6928. -1,
  6929. -1
  6930. ],
  6931. [
  6932. -1,
  6933. -1
  6934. ],
  6935. [
  6936. -1,
  6937. -1
  6938. ],
  6939. [
  6940. -1,
  6941. -1
  6942. ],
  6943. [
  6944. -1,
  6945. -1
  6946. ],
  6947. [
  6948. -1,
  6949. -1
  6950. ],
  6951. [
  6952. -1,
  6953. -1
  6954. ],
  6955. [
  6956. -1,
  6957. -1
  6958. ],
  6959. [
  6960. -1,
  6961. -1
  6962. ],
  6963. [
  6964. -1,
  6965. -1
  6966. ],
  6967. [
  6968. -1,
  6969. -1
  6970. ],
  6971. [
  6972. -1,
  6973. -1
  6974. ],
  6975. [
  6976. -1,
  6977. -1
  6978. ],
  6979. [
  6980. -1,
  6981. -1
  6982. ],
  6983. [
  6984. -1,
  6985. -1
  6986. ],
  6987. [
  6988. -1,
  6989. -1
  6990. ],
  6991. [
  6992. -1,
  6993. -1
  6994. ],
  6995. [
  6996. -1,
  6997. -1
  6998. ],
  6999. [
  7000. -1,
  7001. -1
  7002. ],
  7003. [
  7004. -1,
  7005. -1
  7006. ],
  7007. [
  7008. -1,
  7009. -1
  7010. ],
  7011. [
  7012. -1,
  7013. -1
  7014. ],
  7015. [
  7016. -1,
  7017. -1
  7018. ],
  7019. [
  7020. -1,
  7021. -1
  7022. ],
  7023. [
  7024. 11,
  7025. 1792
  7026. ],
  7027. [
  7028. 11,
  7029. 1792
  7030. ],
  7031. [
  7032. 11,
  7033. 1792
  7034. ],
  7035. [
  7036. 11,
  7037. 1792
  7038. ],
  7039. [
  7040. 12,
  7041. 1984
  7042. ],
  7043. [
  7044. 12,
  7045. 1984
  7046. ],
  7047. [
  7048. 12,
  7049. 2048
  7050. ],
  7051. [
  7052. 12,
  7053. 2048
  7054. ],
  7055. [
  7056. 12,
  7057. 2112
  7058. ],
  7059. [
  7060. 12,
  7061. 2112
  7062. ],
  7063. [
  7064. 12,
  7065. 2176
  7066. ],
  7067. [
  7068. 12,
  7069. 2176
  7070. ],
  7071. [
  7072. 12,
  7073. 2240
  7074. ],
  7075. [
  7076. 12,
  7077. 2240
  7078. ],
  7079. [
  7080. 12,
  7081. 2304
  7082. ],
  7083. [
  7084. 12,
  7085. 2304
  7086. ],
  7087. [
  7088. 11,
  7089. 1856
  7090. ],
  7091. [
  7092. 11,
  7093. 1856
  7094. ],
  7095. [
  7096. 11,
  7097. 1856
  7098. ],
  7099. [
  7100. 11,
  7101. 1856
  7102. ],
  7103. [
  7104. 11,
  7105. 1920
  7106. ],
  7107. [
  7108. 11,
  7109. 1920
  7110. ],
  7111. [
  7112. 11,
  7113. 1920
  7114. ],
  7115. [
  7116. 11,
  7117. 1920
  7118. ],
  7119. [
  7120. 12,
  7121. 2368
  7122. ],
  7123. [
  7124. 12,
  7125. 2368
  7126. ],
  7127. [
  7128. 12,
  7129. 2432
  7130. ],
  7131. [
  7132. 12,
  7133. 2432
  7134. ],
  7135. [
  7136. 12,
  7137. 2496
  7138. ],
  7139. [
  7140. 12,
  7141. 2496
  7142. ],
  7143. [
  7144. 12,
  7145. 2560
  7146. ],
  7147. [
  7148. 12,
  7149. 2560
  7150. ],
  7151. [
  7152. 10,
  7153. 18
  7154. ],
  7155. [
  7156. 10,
  7157. 18
  7158. ],
  7159. [
  7160. 10,
  7161. 18
  7162. ],
  7163. [
  7164. 10,
  7165. 18
  7166. ],
  7167. [
  7168. 10,
  7169. 18
  7170. ],
  7171. [
  7172. 10,
  7173. 18
  7174. ],
  7175. [
  7176. 10,
  7177. 18
  7178. ],
  7179. [
  7180. 10,
  7181. 18
  7182. ],
  7183. [
  7184. 12,
  7185. 52
  7186. ],
  7187. [
  7188. 12,
  7189. 52
  7190. ],
  7191. [
  7192. 13,
  7193. 640
  7194. ],
  7195. [
  7196. 13,
  7197. 704
  7198. ],
  7199. [
  7200. 13,
  7201. 768
  7202. ],
  7203. [
  7204. 13,
  7205. 832
  7206. ],
  7207. [
  7208. 12,
  7209. 55
  7210. ],
  7211. [
  7212. 12,
  7213. 55
  7214. ],
  7215. [
  7216. 12,
  7217. 56
  7218. ],
  7219. [
  7220. 12,
  7221. 56
  7222. ],
  7223. [
  7224. 13,
  7225. 1280
  7226. ],
  7227. [
  7228. 13,
  7229. 1344
  7230. ],
  7231. [
  7232. 13,
  7233. 1408
  7234. ],
  7235. [
  7236. 13,
  7237. 1472
  7238. ],
  7239. [
  7240. 12,
  7241. 59
  7242. ],
  7243. [
  7244. 12,
  7245. 59
  7246. ],
  7247. [
  7248. 12,
  7249. 60
  7250. ],
  7251. [
  7252. 12,
  7253. 60
  7254. ],
  7255. [
  7256. 13,
  7257. 1536
  7258. ],
  7259. [
  7260. 13,
  7261. 1600
  7262. ],
  7263. [
  7264. 11,
  7265. 24
  7266. ],
  7267. [
  7268. 11,
  7269. 24
  7270. ],
  7271. [
  7272. 11,
  7273. 24
  7274. ],
  7275. [
  7276. 11,
  7277. 24
  7278. ],
  7279. [
  7280. 11,
  7281. 25
  7282. ],
  7283. [
  7284. 11,
  7285. 25
  7286. ],
  7287. [
  7288. 11,
  7289. 25
  7290. ],
  7291. [
  7292. 11,
  7293. 25
  7294. ],
  7295. [
  7296. 13,
  7297. 1664
  7298. ],
  7299. [
  7300. 13,
  7301. 1728
  7302. ],
  7303. [
  7304. 12,
  7305. 320
  7306. ],
  7307. [
  7308. 12,
  7309. 320
  7310. ],
  7311. [
  7312. 12,
  7313. 384
  7314. ],
  7315. [
  7316. 12,
  7317. 384
  7318. ],
  7319. [
  7320. 12,
  7321. 448
  7322. ],
  7323. [
  7324. 12,
  7325. 448
  7326. ],
  7327. [
  7328. 13,
  7329. 512
  7330. ],
  7331. [
  7332. 13,
  7333. 576
  7334. ],
  7335. [
  7336. 12,
  7337. 53
  7338. ],
  7339. [
  7340. 12,
  7341. 53
  7342. ],
  7343. [
  7344. 12,
  7345. 54
  7346. ],
  7347. [
  7348. 12,
  7349. 54
  7350. ],
  7351. [
  7352. 13,
  7353. 896
  7354. ],
  7355. [
  7356. 13,
  7357. 960
  7358. ],
  7359. [
  7360. 13,
  7361. 1024
  7362. ],
  7363. [
  7364. 13,
  7365. 1088
  7366. ],
  7367. [
  7368. 13,
  7369. 1152
  7370. ],
  7371. [
  7372. 13,
  7373. 1216
  7374. ],
  7375. [
  7376. 10,
  7377. 64
  7378. ],
  7379. [
  7380. 10,
  7381. 64
  7382. ],
  7383. [
  7384. 10,
  7385. 64
  7386. ],
  7387. [
  7388. 10,
  7389. 64
  7390. ],
  7391. [
  7392. 10,
  7393. 64
  7394. ],
  7395. [
  7396. 10,
  7397. 64
  7398. ],
  7399. [
  7400. 10,
  7401. 64
  7402. ],
  7403. [
  7404. 10,
  7405. 64
  7406. ]
  7407. ];
  7408. var blackTable2 = [
  7409. [
  7410. 8,
  7411. 13
  7412. ],
  7413. [
  7414. 8,
  7415. 13
  7416. ],
  7417. [
  7418. 8,
  7419. 13
  7420. ],
  7421. [
  7422. 8,
  7423. 13
  7424. ],
  7425. [
  7426. 8,
  7427. 13
  7428. ],
  7429. [
  7430. 8,
  7431. 13
  7432. ],
  7433. [
  7434. 8,
  7435. 13
  7436. ],
  7437. [
  7438. 8,
  7439. 13
  7440. ],
  7441. [
  7442. 8,
  7443. 13
  7444. ],
  7445. [
  7446. 8,
  7447. 13
  7448. ],
  7449. [
  7450. 8,
  7451. 13
  7452. ],
  7453. [
  7454. 8,
  7455. 13
  7456. ],
  7457. [
  7458. 8,
  7459. 13
  7460. ],
  7461. [
  7462. 8,
  7463. 13
  7464. ],
  7465. [
  7466. 8,
  7467. 13
  7468. ],
  7469. [
  7470. 8,
  7471. 13
  7472. ],
  7473. [
  7474. 11,
  7475. 23
  7476. ],
  7477. [
  7478. 11,
  7479. 23
  7480. ],
  7481. [
  7482. 12,
  7483. 50
  7484. ],
  7485. [
  7486. 12,
  7487. 51
  7488. ],
  7489. [
  7490. 12,
  7491. 44
  7492. ],
  7493. [
  7494. 12,
  7495. 45
  7496. ],
  7497. [
  7498. 12,
  7499. 46
  7500. ],
  7501. [
  7502. 12,
  7503. 47
  7504. ],
  7505. [
  7506. 12,
  7507. 57
  7508. ],
  7509. [
  7510. 12,
  7511. 58
  7512. ],
  7513. [
  7514. 12,
  7515. 61
  7516. ],
  7517. [
  7518. 12,
  7519. 256
  7520. ],
  7521. [
  7522. 10,
  7523. 16
  7524. ],
  7525. [
  7526. 10,
  7527. 16
  7528. ],
  7529. [
  7530. 10,
  7531. 16
  7532. ],
  7533. [
  7534. 10,
  7535. 16
  7536. ],
  7537. [
  7538. 10,
  7539. 17
  7540. ],
  7541. [
  7542. 10,
  7543. 17
  7544. ],
  7545. [
  7546. 10,
  7547. 17
  7548. ],
  7549. [
  7550. 10,
  7551. 17
  7552. ],
  7553. [
  7554. 12,
  7555. 48
  7556. ],
  7557. [
  7558. 12,
  7559. 49
  7560. ],
  7561. [
  7562. 12,
  7563. 62
  7564. ],
  7565. [
  7566. 12,
  7567. 63
  7568. ],
  7569. [
  7570. 12,
  7571. 30
  7572. ],
  7573. [
  7574. 12,
  7575. 31
  7576. ],
  7577. [
  7578. 12,
  7579. 32
  7580. ],
  7581. [
  7582. 12,
  7583. 33
  7584. ],
  7585. [
  7586. 12,
  7587. 40
  7588. ],
  7589. [
  7590. 12,
  7591. 41
  7592. ],
  7593. [
  7594. 11,
  7595. 22
  7596. ],
  7597. [
  7598. 11,
  7599. 22
  7600. ],
  7601. [
  7602. 8,
  7603. 14
  7604. ],
  7605. [
  7606. 8,
  7607. 14
  7608. ],
  7609. [
  7610. 8,
  7611. 14
  7612. ],
  7613. [
  7614. 8,
  7615. 14
  7616. ],
  7617. [
  7618. 8,
  7619. 14
  7620. ],
  7621. [
  7622. 8,
  7623. 14
  7624. ],
  7625. [
  7626. 8,
  7627. 14
  7628. ],
  7629. [
  7630. 8,
  7631. 14
  7632. ],
  7633. [
  7634. 8,
  7635. 14
  7636. ],
  7637. [
  7638. 8,
  7639. 14
  7640. ],
  7641. [
  7642. 8,
  7643. 14
  7644. ],
  7645. [
  7646. 8,
  7647. 14
  7648. ],
  7649. [
  7650. 8,
  7651. 14
  7652. ],
  7653. [
  7654. 8,
  7655. 14
  7656. ],
  7657. [
  7658. 8,
  7659. 14
  7660. ],
  7661. [
  7662. 8,
  7663. 14
  7664. ],
  7665. [
  7666. 7,
  7667. 10
  7668. ],
  7669. [
  7670. 7,
  7671. 10
  7672. ],
  7673. [
  7674. 7,
  7675. 10
  7676. ],
  7677. [
  7678. 7,
  7679. 10
  7680. ],
  7681. [
  7682. 7,
  7683. 10
  7684. ],
  7685. [
  7686. 7,
  7687. 10
  7688. ],
  7689. [
  7690. 7,
  7691. 10
  7692. ],
  7693. [
  7694. 7,
  7695. 10
  7696. ],
  7697. [
  7698. 7,
  7699. 10
  7700. ],
  7701. [
  7702. 7,
  7703. 10
  7704. ],
  7705. [
  7706. 7,
  7707. 10
  7708. ],
  7709. [
  7710. 7,
  7711. 10
  7712. ],
  7713. [
  7714. 7,
  7715. 10
  7716. ],
  7717. [
  7718. 7,
  7719. 10
  7720. ],
  7721. [
  7722. 7,
  7723. 10
  7724. ],
  7725. [
  7726. 7,
  7727. 10
  7728. ],
  7729. [
  7730. 7,
  7731. 10
  7732. ],
  7733. [
  7734. 7,
  7735. 10
  7736. ],
  7737. [
  7738. 7,
  7739. 10
  7740. ],
  7741. [
  7742. 7,
  7743. 10
  7744. ],
  7745. [
  7746. 7,
  7747. 10
  7748. ],
  7749. [
  7750. 7,
  7751. 10
  7752. ],
  7753. [
  7754. 7,
  7755. 10
  7756. ],
  7757. [
  7758. 7,
  7759. 10
  7760. ],
  7761. [
  7762. 7,
  7763. 10
  7764. ],
  7765. [
  7766. 7,
  7767. 10
  7768. ],
  7769. [
  7770. 7,
  7771. 10
  7772. ],
  7773. [
  7774. 7,
  7775. 10
  7776. ],
  7777. [
  7778. 7,
  7779. 10
  7780. ],
  7781. [
  7782. 7,
  7783. 10
  7784. ],
  7785. [
  7786. 7,
  7787. 10
  7788. ],
  7789. [
  7790. 7,
  7791. 10
  7792. ],
  7793. [
  7794. 7,
  7795. 11
  7796. ],
  7797. [
  7798. 7,
  7799. 11
  7800. ],
  7801. [
  7802. 7,
  7803. 11
  7804. ],
  7805. [
  7806. 7,
  7807. 11
  7808. ],
  7809. [
  7810. 7,
  7811. 11
  7812. ],
  7813. [
  7814. 7,
  7815. 11
  7816. ],
  7817. [
  7818. 7,
  7819. 11
  7820. ],
  7821. [
  7822. 7,
  7823. 11
  7824. ],
  7825. [
  7826. 7,
  7827. 11
  7828. ],
  7829. [
  7830. 7,
  7831. 11
  7832. ],
  7833. [
  7834. 7,
  7835. 11
  7836. ],
  7837. [
  7838. 7,
  7839. 11
  7840. ],
  7841. [
  7842. 7,
  7843. 11
  7844. ],
  7845. [
  7846. 7,
  7847. 11
  7848. ],
  7849. [
  7850. 7,
  7851. 11
  7852. ],
  7853. [
  7854. 7,
  7855. 11
  7856. ],
  7857. [
  7858. 7,
  7859. 11
  7860. ],
  7861. [
  7862. 7,
  7863. 11
  7864. ],
  7865. [
  7866. 7,
  7867. 11
  7868. ],
  7869. [
  7870. 7,
  7871. 11
  7872. ],
  7873. [
  7874. 7,
  7875. 11
  7876. ],
  7877. [
  7878. 7,
  7879. 11
  7880. ],
  7881. [
  7882. 7,
  7883. 11
  7884. ],
  7885. [
  7886. 7,
  7887. 11
  7888. ],
  7889. [
  7890. 7,
  7891. 11
  7892. ],
  7893. [
  7894. 7,
  7895. 11
  7896. ],
  7897. [
  7898. 7,
  7899. 11
  7900. ],
  7901. [
  7902. 7,
  7903. 11
  7904. ],
  7905. [
  7906. 7,
  7907. 11
  7908. ],
  7909. [
  7910. 7,
  7911. 11
  7912. ],
  7913. [
  7914. 7,
  7915. 11
  7916. ],
  7917. [
  7918. 7,
  7919. 11
  7920. ],
  7921. [
  7922. 9,
  7923. 15
  7924. ],
  7925. [
  7926. 9,
  7927. 15
  7928. ],
  7929. [
  7930. 9,
  7931. 15
  7932. ],
  7933. [
  7934. 9,
  7935. 15
  7936. ],
  7937. [
  7938. 9,
  7939. 15
  7940. ],
  7941. [
  7942. 9,
  7943. 15
  7944. ],
  7945. [
  7946. 9,
  7947. 15
  7948. ],
  7949. [
  7950. 9,
  7951. 15
  7952. ],
  7953. [
  7954. 12,
  7955. 128
  7956. ],
  7957. [
  7958. 12,
  7959. 192
  7960. ],
  7961. [
  7962. 12,
  7963. 26
  7964. ],
  7965. [
  7966. 12,
  7967. 27
  7968. ],
  7969. [
  7970. 12,
  7971. 28
  7972. ],
  7973. [
  7974. 12,
  7975. 29
  7976. ],
  7977. [
  7978. 11,
  7979. 19
  7980. ],
  7981. [
  7982. 11,
  7983. 19
  7984. ],
  7985. [
  7986. 11,
  7987. 20
  7988. ],
  7989. [
  7990. 11,
  7991. 20
  7992. ],
  7993. [
  7994. 12,
  7995. 34
  7996. ],
  7997. [
  7998. 12,
  7999. 35
  8000. ],
  8001. [
  8002. 12,
  8003. 36
  8004. ],
  8005. [
  8006. 12,
  8007. 37
  8008. ],
  8009. [
  8010. 12,
  8011. 38
  8012. ],
  8013. [
  8014. 12,
  8015. 39
  8016. ],
  8017. [
  8018. 11,
  8019. 21
  8020. ],
  8021. [
  8022. 11,
  8023. 21
  8024. ],
  8025. [
  8026. 12,
  8027. 42
  8028. ],
  8029. [
  8030. 12,
  8031. 43
  8032. ],
  8033. [
  8034. 10,
  8035. 0
  8036. ],
  8037. [
  8038. 10,
  8039. 0
  8040. ],
  8041. [
  8042. 10,
  8043. 0
  8044. ],
  8045. [
  8046. 10,
  8047. 0
  8048. ],
  8049. [
  8050. 7,
  8051. 12
  8052. ],
  8053. [
  8054. 7,
  8055. 12
  8056. ],
  8057. [
  8058. 7,
  8059. 12
  8060. ],
  8061. [
  8062. 7,
  8063. 12
  8064. ],
  8065. [
  8066. 7,
  8067. 12
  8068. ],
  8069. [
  8070. 7,
  8071. 12
  8072. ],
  8073. [
  8074. 7,
  8075. 12
  8076. ],
  8077. [
  8078. 7,
  8079. 12
  8080. ],
  8081. [
  8082. 7,
  8083. 12
  8084. ],
  8085. [
  8086. 7,
  8087. 12
  8088. ],
  8089. [
  8090. 7,
  8091. 12
  8092. ],
  8093. [
  8094. 7,
  8095. 12
  8096. ],
  8097. [
  8098. 7,
  8099. 12
  8100. ],
  8101. [
  8102. 7,
  8103. 12
  8104. ],
  8105. [
  8106. 7,
  8107. 12
  8108. ],
  8109. [
  8110. 7,
  8111. 12
  8112. ],
  8113. [
  8114. 7,
  8115. 12
  8116. ],
  8117. [
  8118. 7,
  8119. 12
  8120. ],
  8121. [
  8122. 7,
  8123. 12
  8124. ],
  8125. [
  8126. 7,
  8127. 12
  8128. ],
  8129. [
  8130. 7,
  8131. 12
  8132. ],
  8133. [
  8134. 7,
  8135. 12
  8136. ],
  8137. [
  8138. 7,
  8139. 12
  8140. ],
  8141. [
  8142. 7,
  8143. 12
  8144. ],
  8145. [
  8146. 7,
  8147. 12
  8148. ],
  8149. [
  8150. 7,
  8151. 12
  8152. ],
  8153. [
  8154. 7,
  8155. 12
  8156. ],
  8157. [
  8158. 7,
  8159. 12
  8160. ],
  8161. [
  8162. 7,
  8163. 12
  8164. ],
  8165. [
  8166. 7,
  8167. 12
  8168. ],
  8169. [
  8170. 7,
  8171. 12
  8172. ],
  8173. [
  8174. 7,
  8175. 12
  8176. ]
  8177. ];
  8178. var blackTable3 = [
  8179. [
  8180. -1,
  8181. -1
  8182. ],
  8183. [
  8184. -1,
  8185. -1
  8186. ],
  8187. [
  8188. -1,
  8189. -1
  8190. ],
  8191. [
  8192. -1,
  8193. -1
  8194. ],
  8195. [
  8196. 6,
  8197. 9
  8198. ],
  8199. [
  8200. 6,
  8201. 8
  8202. ],
  8203. [
  8204. 5,
  8205. 7
  8206. ],
  8207. [
  8208. 5,
  8209. 7
  8210. ],
  8211. [
  8212. 4,
  8213. 6
  8214. ],
  8215. [
  8216. 4,
  8217. 6
  8218. ],
  8219. [
  8220. 4,
  8221. 6
  8222. ],
  8223. [
  8224. 4,
  8225. 6
  8226. ],
  8227. [
  8228. 4,
  8229. 5
  8230. ],
  8231. [
  8232. 4,
  8233. 5
  8234. ],
  8235. [
  8236. 4,
  8237. 5
  8238. ],
  8239. [
  8240. 4,
  8241. 5
  8242. ],
  8243. [
  8244. 3,
  8245. 1
  8246. ],
  8247. [
  8248. 3,
  8249. 1
  8250. ],
  8251. [
  8252. 3,
  8253. 1
  8254. ],
  8255. [
  8256. 3,
  8257. 1
  8258. ],
  8259. [
  8260. 3,
  8261. 1
  8262. ],
  8263. [
  8264. 3,
  8265. 1
  8266. ],
  8267. [
  8268. 3,
  8269. 1
  8270. ],
  8271. [
  8272. 3,
  8273. 1
  8274. ],
  8275. [
  8276. 3,
  8277. 4
  8278. ],
  8279. [
  8280. 3,
  8281. 4
  8282. ],
  8283. [
  8284. 3,
  8285. 4
  8286. ],
  8287. [
  8288. 3,
  8289. 4
  8290. ],
  8291. [
  8292. 3,
  8293. 4
  8294. ],
  8295. [
  8296. 3,
  8297. 4
  8298. ],
  8299. [
  8300. 3,
  8301. 4
  8302. ],
  8303. [
  8304. 3,
  8305. 4
  8306. ],
  8307. [
  8308. 2,
  8309. 3
  8310. ],
  8311. [
  8312. 2,
  8313. 3
  8314. ],
  8315. [
  8316. 2,
  8317. 3
  8318. ],
  8319. [
  8320. 2,
  8321. 3
  8322. ],
  8323. [
  8324. 2,
  8325. 3
  8326. ],
  8327. [
  8328. 2,
  8329. 3
  8330. ],
  8331. [
  8332. 2,
  8333. 3
  8334. ],
  8335. [
  8336. 2,
  8337. 3
  8338. ],
  8339. [
  8340. 2,
  8341. 3
  8342. ],
  8343. [
  8344. 2,
  8345. 3
  8346. ],
  8347. [
  8348. 2,
  8349. 3
  8350. ],
  8351. [
  8352. 2,
  8353. 3
  8354. ],
  8355. [
  8356. 2,
  8357. 3
  8358. ],
  8359. [
  8360. 2,
  8361. 3
  8362. ],
  8363. [
  8364. 2,
  8365. 3
  8366. ],
  8367. [
  8368. 2,
  8369. 3
  8370. ],
  8371. [
  8372. 2,
  8373. 2
  8374. ],
  8375. [
  8376. 2,
  8377. 2
  8378. ],
  8379. [
  8380. 2,
  8381. 2
  8382. ],
  8383. [
  8384. 2,
  8385. 2
  8386. ],
  8387. [
  8388. 2,
  8389. 2
  8390. ],
  8391. [
  8392. 2,
  8393. 2
  8394. ],
  8395. [
  8396. 2,
  8397. 2
  8398. ],
  8399. [
  8400. 2,
  8401. 2
  8402. ],
  8403. [
  8404. 2,
  8405. 2
  8406. ],
  8407. [
  8408. 2,
  8409. 2
  8410. ],
  8411. [
  8412. 2,
  8413. 2
  8414. ],
  8415. [
  8416. 2,
  8417. 2
  8418. ],
  8419. [
  8420. 2,
  8421. 2
  8422. ],
  8423. [
  8424. 2,
  8425. 2
  8426. ],
  8427. [
  8428. 2,
  8429. 2
  8430. ],
  8431. [
  8432. 2,
  8433. 2
  8434. ]
  8435. ];
  8436. function CCITTFaxStream(str, maybeLength, params) {
  8437. this.str = str;
  8438. this.dict = str.dict;
  8439. params = params || Dict.empty;
  8440. this.encoding = params.get('K') || 0;
  8441. this.eoline = params.get('EndOfLine') || false;
  8442. this.byteAlign = params.get('EncodedByteAlign') || false;
  8443. this.columns = params.get('Columns') || 1728;
  8444. this.rows = params.get('Rows') || 0;
  8445. var eoblock = params.get('EndOfBlock');
  8446. if (eoblock === null || eoblock === undefined) {
  8447. eoblock = true;
  8448. }
  8449. this.eoblock = eoblock;
  8450. this.black = params.get('BlackIs1') || false;
  8451. this.codingLine = new Uint32Array(this.columns + 1);
  8452. this.refLine = new Uint32Array(this.columns + 2);
  8453. this.codingLine[0] = this.columns;
  8454. this.codingPos = 0;
  8455. this.row = 0;
  8456. this.nextLine2D = this.encoding < 0;
  8457. this.inputBits = 0;
  8458. this.inputBuf = 0;
  8459. this.outputBits = 0;
  8460. var code1;
  8461. while ((code1 = this.lookBits(12)) === 0) {
  8462. this.eatBits(1);
  8463. }
  8464. if (code1 === 1) {
  8465. this.eatBits(12);
  8466. }
  8467. if (this.encoding > 0) {
  8468. this.nextLine2D = !this.lookBits(1);
  8469. this.eatBits(1);
  8470. }
  8471. DecodeStream.call(this, maybeLength);
  8472. }
  8473. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  8474. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  8475. while (!this.eof) {
  8476. var c = this.lookChar();
  8477. this.ensureBuffer(this.bufferLength + 1);
  8478. this.buffer[this.bufferLength++] = c;
  8479. }
  8480. };
  8481. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  8482. var codingLine = this.codingLine;
  8483. var codingPos = this.codingPos;
  8484. if (a1 > codingLine[codingPos]) {
  8485. if (a1 > this.columns) {
  8486. info('row is wrong length');
  8487. this.err = true;
  8488. a1 = this.columns;
  8489. }
  8490. if (codingPos & 1 ^ blackPixels) {
  8491. ++codingPos;
  8492. }
  8493. codingLine[codingPos] = a1;
  8494. }
  8495. this.codingPos = codingPos;
  8496. };
  8497. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  8498. var codingLine = this.codingLine;
  8499. var codingPos = this.codingPos;
  8500. if (a1 > codingLine[codingPos]) {
  8501. if (a1 > this.columns) {
  8502. info('row is wrong length');
  8503. this.err = true;
  8504. a1 = this.columns;
  8505. }
  8506. if (codingPos & 1 ^ blackPixels) {
  8507. ++codingPos;
  8508. }
  8509. codingLine[codingPos] = a1;
  8510. } else if (a1 < codingLine[codingPos]) {
  8511. if (a1 < 0) {
  8512. info('invalid code');
  8513. this.err = true;
  8514. a1 = 0;
  8515. }
  8516. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  8517. --codingPos;
  8518. }
  8519. codingLine[codingPos] = a1;
  8520. }
  8521. this.codingPos = codingPos;
  8522. };
  8523. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  8524. var refLine = this.refLine;
  8525. var codingLine = this.codingLine;
  8526. var columns = this.columns;
  8527. var refPos, blackPixels, bits, i;
  8528. if (this.outputBits === 0) {
  8529. if (this.eof) {
  8530. return null;
  8531. }
  8532. this.err = false;
  8533. var code1, code2, code3;
  8534. if (this.nextLine2D) {
  8535. for (i = 0; codingLine[i] < columns; ++i) {
  8536. refLine[i] = codingLine[i];
  8537. }
  8538. refLine[i++] = columns;
  8539. refLine[i] = columns;
  8540. codingLine[0] = 0;
  8541. this.codingPos = 0;
  8542. refPos = 0;
  8543. blackPixels = 0;
  8544. while (codingLine[this.codingPos] < columns) {
  8545. code1 = this.getTwoDimCode();
  8546. switch (code1) {
  8547. case twoDimPass:
  8548. this.addPixels(refLine[refPos + 1], blackPixels);
  8549. if (refLine[refPos + 1] < columns) {
  8550. refPos += 2;
  8551. }
  8552. break;
  8553. case twoDimHoriz:
  8554. code1 = code2 = 0;
  8555. if (blackPixels) {
  8556. do {
  8557. code1 += code3 = this.getBlackCode();
  8558. } while (code3 >= 64);
  8559. do {
  8560. code2 += code3 = this.getWhiteCode();
  8561. } while (code3 >= 64);
  8562. } else {
  8563. do {
  8564. code1 += code3 = this.getWhiteCode();
  8565. } while (code3 >= 64);
  8566. do {
  8567. code2 += code3 = this.getBlackCode();
  8568. } while (code3 >= 64);
  8569. }
  8570. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8571. if (codingLine[this.codingPos] < columns) {
  8572. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  8573. }
  8574. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8575. refPos += 2;
  8576. }
  8577. break;
  8578. case twoDimVertR3:
  8579. this.addPixels(refLine[refPos] + 3, blackPixels);
  8580. blackPixels ^= 1;
  8581. if (codingLine[this.codingPos] < columns) {
  8582. ++refPos;
  8583. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8584. refPos += 2;
  8585. }
  8586. }
  8587. break;
  8588. case twoDimVertR2:
  8589. this.addPixels(refLine[refPos] + 2, blackPixels);
  8590. blackPixels ^= 1;
  8591. if (codingLine[this.codingPos] < columns) {
  8592. ++refPos;
  8593. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8594. refPos += 2;
  8595. }
  8596. }
  8597. break;
  8598. case twoDimVertR1:
  8599. this.addPixels(refLine[refPos] + 1, blackPixels);
  8600. blackPixels ^= 1;
  8601. if (codingLine[this.codingPos] < columns) {
  8602. ++refPos;
  8603. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8604. refPos += 2;
  8605. }
  8606. }
  8607. break;
  8608. case twoDimVert0:
  8609. this.addPixels(refLine[refPos], blackPixels);
  8610. blackPixels ^= 1;
  8611. if (codingLine[this.codingPos] < columns) {
  8612. ++refPos;
  8613. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8614. refPos += 2;
  8615. }
  8616. }
  8617. break;
  8618. case twoDimVertL3:
  8619. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  8620. blackPixels ^= 1;
  8621. if (codingLine[this.codingPos] < columns) {
  8622. if (refPos > 0) {
  8623. --refPos;
  8624. } else {
  8625. ++refPos;
  8626. }
  8627. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8628. refPos += 2;
  8629. }
  8630. }
  8631. break;
  8632. case twoDimVertL2:
  8633. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  8634. blackPixels ^= 1;
  8635. if (codingLine[this.codingPos] < columns) {
  8636. if (refPos > 0) {
  8637. --refPos;
  8638. } else {
  8639. ++refPos;
  8640. }
  8641. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8642. refPos += 2;
  8643. }
  8644. }
  8645. break;
  8646. case twoDimVertL1:
  8647. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  8648. blackPixels ^= 1;
  8649. if (codingLine[this.codingPos] < columns) {
  8650. if (refPos > 0) {
  8651. --refPos;
  8652. } else {
  8653. ++refPos;
  8654. }
  8655. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8656. refPos += 2;
  8657. }
  8658. }
  8659. break;
  8660. case ccittEOF:
  8661. this.addPixels(columns, 0);
  8662. this.eof = true;
  8663. break;
  8664. default:
  8665. info('bad 2d code');
  8666. this.addPixels(columns, 0);
  8667. this.err = true;
  8668. }
  8669. }
  8670. } else {
  8671. codingLine[0] = 0;
  8672. this.codingPos = 0;
  8673. blackPixels = 0;
  8674. while (codingLine[this.codingPos] < columns) {
  8675. code1 = 0;
  8676. if (blackPixels) {
  8677. do {
  8678. code1 += code3 = this.getBlackCode();
  8679. } while (code3 >= 64);
  8680. } else {
  8681. do {
  8682. code1 += code3 = this.getWhiteCode();
  8683. } while (code3 >= 64);
  8684. }
  8685. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8686. blackPixels ^= 1;
  8687. }
  8688. }
  8689. var gotEOL = false;
  8690. if (this.byteAlign) {
  8691. this.inputBits &= ~7;
  8692. }
  8693. if (!this.eoblock && this.row === this.rows - 1) {
  8694. this.eof = true;
  8695. } else {
  8696. code1 = this.lookBits(12);
  8697. if (this.eoline) {
  8698. while (code1 !== ccittEOF && code1 !== 1) {
  8699. this.eatBits(1);
  8700. code1 = this.lookBits(12);
  8701. }
  8702. } else {
  8703. while (code1 === 0) {
  8704. this.eatBits(1);
  8705. code1 = this.lookBits(12);
  8706. }
  8707. }
  8708. if (code1 === 1) {
  8709. this.eatBits(12);
  8710. gotEOL = true;
  8711. } else if (code1 === ccittEOF) {
  8712. this.eof = true;
  8713. }
  8714. }
  8715. if (!this.eof && this.encoding > 0) {
  8716. this.nextLine2D = !this.lookBits(1);
  8717. this.eatBits(1);
  8718. }
  8719. if (this.eoblock && gotEOL && this.byteAlign) {
  8720. code1 = this.lookBits(12);
  8721. if (code1 === 1) {
  8722. this.eatBits(12);
  8723. if (this.encoding > 0) {
  8724. this.lookBits(1);
  8725. this.eatBits(1);
  8726. }
  8727. if (this.encoding >= 0) {
  8728. for (i = 0; i < 4; ++i) {
  8729. code1 = this.lookBits(12);
  8730. if (code1 !== 1) {
  8731. info('bad rtc code: ' + code1);
  8732. }
  8733. this.eatBits(12);
  8734. if (this.encoding > 0) {
  8735. this.lookBits(1);
  8736. this.eatBits(1);
  8737. }
  8738. }
  8739. }
  8740. this.eof = true;
  8741. }
  8742. } else if (this.err && this.eoline) {
  8743. while (true) {
  8744. code1 = this.lookBits(13);
  8745. if (code1 === ccittEOF) {
  8746. this.eof = true;
  8747. return null;
  8748. }
  8749. if (code1 >> 1 === 1) {
  8750. break;
  8751. }
  8752. this.eatBits(1);
  8753. }
  8754. this.eatBits(12);
  8755. if (this.encoding > 0) {
  8756. this.eatBits(1);
  8757. this.nextLine2D = !(code1 & 1);
  8758. }
  8759. }
  8760. if (codingLine[0] > 0) {
  8761. this.outputBits = codingLine[this.codingPos = 0];
  8762. } else {
  8763. this.outputBits = codingLine[this.codingPos = 1];
  8764. }
  8765. this.row++;
  8766. }
  8767. var c;
  8768. if (this.outputBits >= 8) {
  8769. c = this.codingPos & 1 ? 0 : 0xFF;
  8770. this.outputBits -= 8;
  8771. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  8772. this.codingPos++;
  8773. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8774. }
  8775. } else {
  8776. bits = 8;
  8777. c = 0;
  8778. do {
  8779. if (this.outputBits > bits) {
  8780. c <<= bits;
  8781. if (!(this.codingPos & 1)) {
  8782. c |= 0xFF >> 8 - bits;
  8783. }
  8784. this.outputBits -= bits;
  8785. bits = 0;
  8786. } else {
  8787. c <<= this.outputBits;
  8788. if (!(this.codingPos & 1)) {
  8789. c |= 0xFF >> 8 - this.outputBits;
  8790. }
  8791. bits -= this.outputBits;
  8792. this.outputBits = 0;
  8793. if (codingLine[this.codingPos] < columns) {
  8794. this.codingPos++;
  8795. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8796. } else if (bits > 0) {
  8797. c <<= bits;
  8798. bits = 0;
  8799. }
  8800. }
  8801. } while (bits);
  8802. }
  8803. if (this.black) {
  8804. c ^= 0xFF;
  8805. }
  8806. return c;
  8807. };
  8808. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  8809. var limitValue = limit || 0;
  8810. for (var i = start; i <= end; ++i) {
  8811. var code = this.lookBits(i);
  8812. if (code === ccittEOF) {
  8813. return [
  8814. true,
  8815. 1,
  8816. false
  8817. ];
  8818. }
  8819. if (i < end) {
  8820. code <<= end - i;
  8821. }
  8822. if (!limitValue || code >= limitValue) {
  8823. var p = table[code - limitValue];
  8824. if (p[0] === i) {
  8825. this.eatBits(i);
  8826. return [
  8827. true,
  8828. p[1],
  8829. true
  8830. ];
  8831. }
  8832. }
  8833. }
  8834. return [
  8835. false,
  8836. 0,
  8837. false
  8838. ];
  8839. };
  8840. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8841. var code = 0;
  8842. var p;
  8843. if (this.eoblock) {
  8844. code = this.lookBits(7);
  8845. p = twoDimTable[code];
  8846. if (p && p[0] > 0) {
  8847. this.eatBits(p[0]);
  8848. return p[1];
  8849. }
  8850. } else {
  8851. var result = this.findTableCode(1, 7, twoDimTable);
  8852. if (result[0] && result[2]) {
  8853. return result[1];
  8854. }
  8855. }
  8856. info('Bad two dim code');
  8857. return ccittEOF;
  8858. };
  8859. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8860. var code = 0;
  8861. var p;
  8862. if (this.eoblock) {
  8863. code = this.lookBits(12);
  8864. if (code === ccittEOF) {
  8865. return 1;
  8866. }
  8867. if (code >> 5 === 0) {
  8868. p = whiteTable1[code];
  8869. } else {
  8870. p = whiteTable2[code >> 3];
  8871. }
  8872. if (p[0] > 0) {
  8873. this.eatBits(p[0]);
  8874. return p[1];
  8875. }
  8876. } else {
  8877. var result = this.findTableCode(1, 9, whiteTable2);
  8878. if (result[0]) {
  8879. return result[1];
  8880. }
  8881. result = this.findTableCode(11, 12, whiteTable1);
  8882. if (result[0]) {
  8883. return result[1];
  8884. }
  8885. }
  8886. info('bad white code');
  8887. this.eatBits(1);
  8888. return 1;
  8889. };
  8890. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8891. var code, p;
  8892. if (this.eoblock) {
  8893. code = this.lookBits(13);
  8894. if (code === ccittEOF) {
  8895. return 1;
  8896. }
  8897. if (code >> 7 === 0) {
  8898. p = blackTable1[code];
  8899. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8900. p = blackTable2[(code >> 1) - 64];
  8901. } else {
  8902. p = blackTable3[code >> 7];
  8903. }
  8904. if (p[0] > 0) {
  8905. this.eatBits(p[0]);
  8906. return p[1];
  8907. }
  8908. } else {
  8909. var result = this.findTableCode(2, 6, blackTable3);
  8910. if (result[0]) {
  8911. return result[1];
  8912. }
  8913. result = this.findTableCode(7, 12, blackTable2, 64);
  8914. if (result[0]) {
  8915. return result[1];
  8916. }
  8917. result = this.findTableCode(10, 13, blackTable1);
  8918. if (result[0]) {
  8919. return result[1];
  8920. }
  8921. }
  8922. info('bad black code');
  8923. this.eatBits(1);
  8924. return 1;
  8925. };
  8926. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8927. var c;
  8928. while (this.inputBits < n) {
  8929. if ((c = this.str.getByte()) === -1) {
  8930. if (this.inputBits === 0) {
  8931. return ccittEOF;
  8932. }
  8933. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8934. }
  8935. this.inputBuf = this.inputBuf << 8 | c;
  8936. this.inputBits += 8;
  8937. }
  8938. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8939. };
  8940. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8941. if ((this.inputBits -= n) < 0) {
  8942. this.inputBits = 0;
  8943. }
  8944. };
  8945. return CCITTFaxStream;
  8946. }();
  8947. var LZWStream = function LZWStreamClosure() {
  8948. function LZWStream(str, maybeLength, earlyChange) {
  8949. this.str = str;
  8950. this.dict = str.dict;
  8951. this.cachedData = 0;
  8952. this.bitsCached = 0;
  8953. var maxLzwDictionarySize = 4096;
  8954. var lzwState = {
  8955. earlyChange: earlyChange,
  8956. codeLength: 9,
  8957. nextCode: 258,
  8958. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8959. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8960. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8961. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8962. currentSequenceLength: 0
  8963. };
  8964. for (var i = 0; i < 256; ++i) {
  8965. lzwState.dictionaryValues[i] = i;
  8966. lzwState.dictionaryLengths[i] = 1;
  8967. }
  8968. this.lzwState = lzwState;
  8969. DecodeStream.call(this, maybeLength);
  8970. }
  8971. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8972. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8973. var bitsCached = this.bitsCached;
  8974. var cachedData = this.cachedData;
  8975. while (bitsCached < n) {
  8976. var c = this.str.getByte();
  8977. if (c === -1) {
  8978. this.eof = true;
  8979. return null;
  8980. }
  8981. cachedData = cachedData << 8 | c;
  8982. bitsCached += 8;
  8983. }
  8984. this.bitsCached = bitsCached -= n;
  8985. this.cachedData = cachedData;
  8986. this.lastCode = null;
  8987. return cachedData >>> bitsCached & (1 << n) - 1;
  8988. };
  8989. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  8990. var blockSize = 512;
  8991. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  8992. var i, j, q;
  8993. var lzwState = this.lzwState;
  8994. if (!lzwState) {
  8995. return;
  8996. }
  8997. var earlyChange = lzwState.earlyChange;
  8998. var nextCode = lzwState.nextCode;
  8999. var dictionaryValues = lzwState.dictionaryValues;
  9000. var dictionaryLengths = lzwState.dictionaryLengths;
  9001. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  9002. var codeLength = lzwState.codeLength;
  9003. var prevCode = lzwState.prevCode;
  9004. var currentSequence = lzwState.currentSequence;
  9005. var currentSequenceLength = lzwState.currentSequenceLength;
  9006. var decodedLength = 0;
  9007. var currentBufferLength = this.bufferLength;
  9008. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9009. for (i = 0; i < blockSize; i++) {
  9010. var code = this.readBits(codeLength);
  9011. var hasPrev = currentSequenceLength > 0;
  9012. if (code < 256) {
  9013. currentSequence[0] = code;
  9014. currentSequenceLength = 1;
  9015. } else if (code >= 258) {
  9016. if (code < nextCode) {
  9017. currentSequenceLength = dictionaryLengths[code];
  9018. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  9019. currentSequence[j] = dictionaryValues[q];
  9020. q = dictionaryPrevCodes[q];
  9021. }
  9022. } else {
  9023. currentSequence[currentSequenceLength++] = currentSequence[0];
  9024. }
  9025. } else if (code === 256) {
  9026. codeLength = 9;
  9027. nextCode = 258;
  9028. currentSequenceLength = 0;
  9029. continue;
  9030. } else {
  9031. this.eof = true;
  9032. delete this.lzwState;
  9033. break;
  9034. }
  9035. if (hasPrev) {
  9036. dictionaryPrevCodes[nextCode] = prevCode;
  9037. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  9038. dictionaryValues[nextCode] = currentSequence[0];
  9039. nextCode++;
  9040. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  9041. }
  9042. prevCode = code;
  9043. decodedLength += currentSequenceLength;
  9044. if (estimatedDecodedSize < decodedLength) {
  9045. do {
  9046. estimatedDecodedSize += decodedSizeDelta;
  9047. } while (estimatedDecodedSize < decodedLength);
  9048. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9049. }
  9050. for (j = 0; j < currentSequenceLength; j++) {
  9051. buffer[currentBufferLength++] = currentSequence[j];
  9052. }
  9053. }
  9054. lzwState.nextCode = nextCode;
  9055. lzwState.codeLength = codeLength;
  9056. lzwState.prevCode = prevCode;
  9057. lzwState.currentSequenceLength = currentSequenceLength;
  9058. this.bufferLength = currentBufferLength;
  9059. };
  9060. return LZWStream;
  9061. }();
  9062. var NullStream = function NullStreamClosure() {
  9063. function NullStream() {
  9064. Stream.call(this, new Uint8Array(0));
  9065. }
  9066. NullStream.prototype = Stream.prototype;
  9067. return NullStream;
  9068. }();
  9069. exports.Ascii85Stream = Ascii85Stream;
  9070. exports.AsciiHexStream = AsciiHexStream;
  9071. exports.CCITTFaxStream = CCITTFaxStream;
  9072. exports.DecryptStream = DecryptStream;
  9073. exports.DecodeStream = DecodeStream;
  9074. exports.FlateStream = FlateStream;
  9075. exports.Jbig2Stream = Jbig2Stream;
  9076. exports.JpegStream = JpegStream;
  9077. exports.JpxStream = JpxStream;
  9078. exports.NullStream = NullStream;
  9079. exports.PredictorStream = PredictorStream;
  9080. exports.RunLengthStream = RunLengthStream;
  9081. exports.Stream = Stream;
  9082. exports.StreamsSequenceStream = StreamsSequenceStream;
  9083. exports.StringStream = StringStream;
  9084. exports.LZWStream = LZWStream;
  9085. /***/ }),
  9086. /* 3 */
  9087. /***/ (function(module, exports, __w_pdfjs_require__) {
  9088. "use strict";
  9089. var sharedUtil = __w_pdfjs_require__(0);
  9090. var corePrimitives = __w_pdfjs_require__(1);
  9091. var coreFunction = __w_pdfjs_require__(6);
  9092. var error = sharedUtil.error;
  9093. var info = sharedUtil.info;
  9094. var isArray = sharedUtil.isArray;
  9095. var isString = sharedUtil.isString;
  9096. var shadow = sharedUtil.shadow;
  9097. var warn = sharedUtil.warn;
  9098. var isDict = corePrimitives.isDict;
  9099. var isName = corePrimitives.isName;
  9100. var isStream = corePrimitives.isStream;
  9101. var PDFFunction = coreFunction.PDFFunction;
  9102. var ColorSpace = function ColorSpaceClosure() {
  9103. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  9104. var COMPONENTS = 3;
  9105. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  9106. var xRatio = w1 / w2;
  9107. var yRatio = h1 / h2;
  9108. var i, j, py, newIndex = 0, oldIndex;
  9109. var xScaled = new Uint16Array(w2);
  9110. var w1Scanline = w1 * COMPONENTS;
  9111. for (i = 0; i < w2; i++) {
  9112. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  9113. }
  9114. for (i = 0; i < h2; i++) {
  9115. py = Math.floor(i * yRatio) * w1Scanline;
  9116. for (j = 0; j < w2; j++) {
  9117. oldIndex = py + xScaled[j];
  9118. dest[newIndex++] = src[oldIndex++];
  9119. dest[newIndex++] = src[oldIndex++];
  9120. dest[newIndex++] = src[oldIndex++];
  9121. newIndex += alpha01;
  9122. }
  9123. }
  9124. }
  9125. function ColorSpace() {
  9126. error('should not call ColorSpace constructor');
  9127. }
  9128. ColorSpace.prototype = {
  9129. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  9130. var rgb = new Uint8Array(3);
  9131. this.getRgbItem(src, srcOffset, rgb, 0);
  9132. return rgb;
  9133. },
  9134. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  9135. error('Should not call ColorSpace.getRgbItem');
  9136. },
  9137. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9138. error('Should not call ColorSpace.getRgbBuffer');
  9139. },
  9140. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  9141. error('Should not call ColorSpace.getOutputLength');
  9142. },
  9143. isPassthrough: function ColorSpace_isPassthrough(bits) {
  9144. return false;
  9145. },
  9146. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  9147. var count = originalWidth * originalHeight;
  9148. var rgbBuf = null;
  9149. var numComponentColors = 1 << bpc;
  9150. var needsResizing = originalHeight !== height || originalWidth !== width;
  9151. var i, ii;
  9152. if (this.isPassthrough(bpc)) {
  9153. rgbBuf = comps;
  9154. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  9155. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  9156. var key;
  9157. for (i = 0; i < numComponentColors; i++) {
  9158. allColors[i] = i;
  9159. }
  9160. var colorMap = new Uint8Array(numComponentColors * 3);
  9161. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  9162. var destPos, rgbPos;
  9163. if (!needsResizing) {
  9164. destPos = 0;
  9165. for (i = 0; i < count; ++i) {
  9166. key = comps[i] * 3;
  9167. dest[destPos++] = colorMap[key];
  9168. dest[destPos++] = colorMap[key + 1];
  9169. dest[destPos++] = colorMap[key + 2];
  9170. destPos += alpha01;
  9171. }
  9172. } else {
  9173. rgbBuf = new Uint8Array(count * 3);
  9174. rgbPos = 0;
  9175. for (i = 0; i < count; ++i) {
  9176. key = comps[i] * 3;
  9177. rgbBuf[rgbPos++] = colorMap[key];
  9178. rgbBuf[rgbPos++] = colorMap[key + 1];
  9179. rgbBuf[rgbPos++] = colorMap[key + 2];
  9180. }
  9181. }
  9182. } else {
  9183. if (!needsResizing) {
  9184. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  9185. } else {
  9186. rgbBuf = new Uint8Array(count * 3);
  9187. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  9188. }
  9189. }
  9190. if (rgbBuf) {
  9191. if (needsResizing) {
  9192. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  9193. } else {
  9194. rgbPos = 0;
  9195. destPos = 0;
  9196. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  9197. dest[destPos++] = rgbBuf[rgbPos++];
  9198. dest[destPos++] = rgbBuf[rgbPos++];
  9199. dest[destPos++] = rgbBuf[rgbPos++];
  9200. destPos += alpha01;
  9201. }
  9202. }
  9203. }
  9204. },
  9205. usesZeroToOneRange: true
  9206. };
  9207. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  9208. var IR = ColorSpace.parseToIR(cs, xref, res);
  9209. if (IR instanceof AlternateCS) {
  9210. return IR;
  9211. }
  9212. return ColorSpace.fromIR(IR);
  9213. };
  9214. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  9215. var name = isArray(IR) ? IR[0] : IR;
  9216. var whitePoint, blackPoint, gamma;
  9217. switch (name) {
  9218. case 'DeviceGrayCS':
  9219. return this.singletons.gray;
  9220. case 'DeviceRgbCS':
  9221. return this.singletons.rgb;
  9222. case 'DeviceCmykCS':
  9223. return this.singletons.cmyk;
  9224. case 'CalGrayCS':
  9225. whitePoint = IR[1];
  9226. blackPoint = IR[2];
  9227. gamma = IR[3];
  9228. return new CalGrayCS(whitePoint, blackPoint, gamma);
  9229. case 'CalRGBCS':
  9230. whitePoint = IR[1];
  9231. blackPoint = IR[2];
  9232. gamma = IR[3];
  9233. var matrix = IR[4];
  9234. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  9235. case 'PatternCS':
  9236. var basePatternCS = IR[1];
  9237. if (basePatternCS) {
  9238. basePatternCS = ColorSpace.fromIR(basePatternCS);
  9239. }
  9240. return new PatternCS(basePatternCS);
  9241. case 'IndexedCS':
  9242. var baseIndexedCS = IR[1];
  9243. var hiVal = IR[2];
  9244. var lookup = IR[3];
  9245. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  9246. case 'AlternateCS':
  9247. var numComps = IR[1];
  9248. var alt = IR[2];
  9249. var tintFnIR = IR[3];
  9250. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  9251. case 'LabCS':
  9252. whitePoint = IR[1];
  9253. blackPoint = IR[2];
  9254. var range = IR[3];
  9255. return new LabCS(whitePoint, blackPoint, range);
  9256. default:
  9257. error('Unknown name ' + name);
  9258. }
  9259. return null;
  9260. };
  9261. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  9262. if (isName(cs)) {
  9263. var colorSpaces = res.get('ColorSpace');
  9264. if (isDict(colorSpaces)) {
  9265. var refcs = colorSpaces.get(cs.name);
  9266. if (refcs) {
  9267. cs = refcs;
  9268. }
  9269. }
  9270. }
  9271. cs = xref.fetchIfRef(cs);
  9272. if (isName(cs)) {
  9273. switch (cs.name) {
  9274. case 'DeviceGray':
  9275. case 'G':
  9276. return 'DeviceGrayCS';
  9277. case 'DeviceRGB':
  9278. case 'RGB':
  9279. return 'DeviceRgbCS';
  9280. case 'DeviceCMYK':
  9281. case 'CMYK':
  9282. return 'DeviceCmykCS';
  9283. case 'Pattern':
  9284. return [
  9285. 'PatternCS',
  9286. null
  9287. ];
  9288. default:
  9289. error('unrecognized colorspace ' + cs.name);
  9290. }
  9291. } else if (isArray(cs)) {
  9292. var mode = xref.fetchIfRef(cs[0]).name;
  9293. var numComps, params, alt, whitePoint, blackPoint, gamma;
  9294. switch (mode) {
  9295. case 'DeviceGray':
  9296. case 'G':
  9297. return 'DeviceGrayCS';
  9298. case 'DeviceRGB':
  9299. case 'RGB':
  9300. return 'DeviceRgbCS';
  9301. case 'DeviceCMYK':
  9302. case 'CMYK':
  9303. return 'DeviceCmykCS';
  9304. case 'CalGray':
  9305. params = xref.fetchIfRef(cs[1]);
  9306. whitePoint = params.getArray('WhitePoint');
  9307. blackPoint = params.getArray('BlackPoint');
  9308. gamma = params.get('Gamma');
  9309. return [
  9310. 'CalGrayCS',
  9311. whitePoint,
  9312. blackPoint,
  9313. gamma
  9314. ];
  9315. case 'CalRGB':
  9316. params = xref.fetchIfRef(cs[1]);
  9317. whitePoint = params.getArray('WhitePoint');
  9318. blackPoint = params.getArray('BlackPoint');
  9319. gamma = params.getArray('Gamma');
  9320. var matrix = params.getArray('Matrix');
  9321. return [
  9322. 'CalRGBCS',
  9323. whitePoint,
  9324. blackPoint,
  9325. gamma,
  9326. matrix
  9327. ];
  9328. case 'ICCBased':
  9329. var stream = xref.fetchIfRef(cs[1]);
  9330. var dict = stream.dict;
  9331. numComps = dict.get('N');
  9332. alt = dict.get('Alternate');
  9333. if (alt) {
  9334. var altIR = ColorSpace.parseToIR(alt, xref, res);
  9335. var altCS = ColorSpace.fromIR(altIR);
  9336. if (altCS.numComps === numComps) {
  9337. return altIR;
  9338. }
  9339. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  9340. }
  9341. if (numComps === 1) {
  9342. return 'DeviceGrayCS';
  9343. } else if (numComps === 3) {
  9344. return 'DeviceRgbCS';
  9345. } else if (numComps === 4) {
  9346. return 'DeviceCmykCS';
  9347. }
  9348. break;
  9349. case 'Pattern':
  9350. var basePatternCS = cs[1] || null;
  9351. if (basePatternCS) {
  9352. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  9353. }
  9354. return [
  9355. 'PatternCS',
  9356. basePatternCS
  9357. ];
  9358. case 'Indexed':
  9359. case 'I':
  9360. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  9361. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  9362. var lookup = xref.fetchIfRef(cs[3]);
  9363. if (isStream(lookup)) {
  9364. lookup = lookup.getBytes();
  9365. }
  9366. return [
  9367. 'IndexedCS',
  9368. baseIndexedCS,
  9369. hiVal,
  9370. lookup
  9371. ];
  9372. case 'Separation':
  9373. case 'DeviceN':
  9374. var name = xref.fetchIfRef(cs[1]);
  9375. numComps = isArray(name) ? name.length : 1;
  9376. alt = ColorSpace.parseToIR(cs[2], xref, res);
  9377. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  9378. return [
  9379. 'AlternateCS',
  9380. numComps,
  9381. alt,
  9382. tintFnIR
  9383. ];
  9384. case 'Lab':
  9385. params = xref.fetchIfRef(cs[1]);
  9386. whitePoint = params.getArray('WhitePoint');
  9387. blackPoint = params.getArray('BlackPoint');
  9388. var range = params.getArray('Range');
  9389. return [
  9390. 'LabCS',
  9391. whitePoint,
  9392. blackPoint,
  9393. range
  9394. ];
  9395. default:
  9396. error('unimplemented color space object "' + mode + '"');
  9397. }
  9398. } else {
  9399. error('unrecognized color space object: "' + cs + '"');
  9400. }
  9401. return null;
  9402. };
  9403. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  9404. if (!isArray(decode)) {
  9405. return true;
  9406. }
  9407. if (n * 2 !== decode.length) {
  9408. warn('The decode map is not the correct length');
  9409. return true;
  9410. }
  9411. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  9412. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  9413. return false;
  9414. }
  9415. }
  9416. return true;
  9417. };
  9418. ColorSpace.singletons = {
  9419. get gray() {
  9420. return shadow(this, 'gray', new DeviceGrayCS());
  9421. },
  9422. get rgb() {
  9423. return shadow(this, 'rgb', new DeviceRgbCS());
  9424. },
  9425. get cmyk() {
  9426. return shadow(this, 'cmyk', new DeviceCmykCS());
  9427. }
  9428. };
  9429. return ColorSpace;
  9430. }();
  9431. var AlternateCS = function AlternateCSClosure() {
  9432. function AlternateCS(numComps, base, tintFn) {
  9433. this.name = 'Alternate';
  9434. this.numComps = numComps;
  9435. this.defaultColor = new Float32Array(numComps);
  9436. for (var i = 0; i < numComps; ++i) {
  9437. this.defaultColor[i] = 1;
  9438. }
  9439. this.base = base;
  9440. this.tintFn = tintFn;
  9441. this.tmpBuf = new Float32Array(base.numComps);
  9442. }
  9443. AlternateCS.prototype = {
  9444. getRgb: ColorSpace.prototype.getRgb,
  9445. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9446. var tmpBuf = this.tmpBuf;
  9447. this.tintFn(src, srcOffset, tmpBuf, 0);
  9448. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  9449. },
  9450. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9451. var tintFn = this.tintFn;
  9452. var base = this.base;
  9453. var scale = 1 / ((1 << bits) - 1);
  9454. var baseNumComps = base.numComps;
  9455. var usesZeroToOneRange = base.usesZeroToOneRange;
  9456. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  9457. var pos = isPassthrough ? destOffset : 0;
  9458. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  9459. var numComps = this.numComps;
  9460. var scaled = new Float32Array(numComps);
  9461. var tinted = new Float32Array(baseNumComps);
  9462. var i, j;
  9463. for (i = 0; i < count; i++) {
  9464. for (j = 0; j < numComps; j++) {
  9465. scaled[j] = src[srcOffset++] * scale;
  9466. }
  9467. tintFn(scaled, 0, tinted, 0);
  9468. if (usesZeroToOneRange) {
  9469. for (j = 0; j < baseNumComps; j++) {
  9470. baseBuf[pos++] = tinted[j] * 255;
  9471. }
  9472. } else {
  9473. base.getRgbItem(tinted, 0, baseBuf, pos);
  9474. pos += baseNumComps;
  9475. }
  9476. }
  9477. if (!isPassthrough) {
  9478. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  9479. }
  9480. },
  9481. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  9482. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  9483. },
  9484. isPassthrough: ColorSpace.prototype.isPassthrough,
  9485. fillRgb: ColorSpace.prototype.fillRgb,
  9486. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  9487. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9488. },
  9489. usesZeroToOneRange: true
  9490. };
  9491. return AlternateCS;
  9492. }();
  9493. var PatternCS = function PatternCSClosure() {
  9494. function PatternCS(baseCS) {
  9495. this.name = 'Pattern';
  9496. this.base = baseCS;
  9497. }
  9498. PatternCS.prototype = {};
  9499. return PatternCS;
  9500. }();
  9501. var IndexedCS = function IndexedCSClosure() {
  9502. function IndexedCS(base, highVal, lookup) {
  9503. this.name = 'Indexed';
  9504. this.numComps = 1;
  9505. this.defaultColor = new Uint8Array(this.numComps);
  9506. this.base = base;
  9507. this.highVal = highVal;
  9508. var baseNumComps = base.numComps;
  9509. var length = baseNumComps * highVal;
  9510. if (isStream(lookup)) {
  9511. this.lookup = new Uint8Array(length);
  9512. var bytes = lookup.getBytes(length);
  9513. this.lookup.set(bytes);
  9514. } else if (isString(lookup)) {
  9515. this.lookup = new Uint8Array(length);
  9516. for (var i = 0; i < length; ++i) {
  9517. this.lookup[i] = lookup.charCodeAt(i);
  9518. }
  9519. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  9520. this.lookup = lookup;
  9521. } else {
  9522. error('Unrecognized lookup table: ' + lookup);
  9523. }
  9524. }
  9525. IndexedCS.prototype = {
  9526. getRgb: ColorSpace.prototype.getRgb,
  9527. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9528. var numComps = this.base.numComps;
  9529. var start = src[srcOffset] * numComps;
  9530. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  9531. },
  9532. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9533. var base = this.base;
  9534. var numComps = base.numComps;
  9535. var outputDelta = base.getOutputLength(numComps, alpha01);
  9536. var lookup = this.lookup;
  9537. for (var i = 0; i < count; ++i) {
  9538. var lookupPos = src[srcOffset++] * numComps;
  9539. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  9540. destOffset += outputDelta;
  9541. }
  9542. },
  9543. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  9544. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  9545. },
  9546. isPassthrough: ColorSpace.prototype.isPassthrough,
  9547. fillRgb: ColorSpace.prototype.fillRgb,
  9548. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  9549. return true;
  9550. },
  9551. usesZeroToOneRange: true
  9552. };
  9553. return IndexedCS;
  9554. }();
  9555. var DeviceGrayCS = function DeviceGrayCSClosure() {
  9556. function DeviceGrayCS() {
  9557. this.name = 'DeviceGray';
  9558. this.numComps = 1;
  9559. this.defaultColor = new Float32Array(this.numComps);
  9560. }
  9561. DeviceGrayCS.prototype = {
  9562. getRgb: ColorSpace.prototype.getRgb,
  9563. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9564. var c = src[srcOffset] * 255 | 0;
  9565. c = c < 0 ? 0 : c > 255 ? 255 : c;
  9566. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  9567. },
  9568. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9569. var scale = 255 / ((1 << bits) - 1);
  9570. var j = srcOffset, q = destOffset;
  9571. for (var i = 0; i < count; ++i) {
  9572. var c = scale * src[j++] | 0;
  9573. dest[q++] = c;
  9574. dest[q++] = c;
  9575. dest[q++] = c;
  9576. q += alpha01;
  9577. }
  9578. },
  9579. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  9580. return inputLength * (3 + alpha01);
  9581. },
  9582. isPassthrough: ColorSpace.prototype.isPassthrough,
  9583. fillRgb: ColorSpace.prototype.fillRgb,
  9584. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  9585. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9586. },
  9587. usesZeroToOneRange: true
  9588. };
  9589. return DeviceGrayCS;
  9590. }();
  9591. var DeviceRgbCS = function DeviceRgbCSClosure() {
  9592. function DeviceRgbCS() {
  9593. this.name = 'DeviceRGB';
  9594. this.numComps = 3;
  9595. this.defaultColor = new Float32Array(this.numComps);
  9596. }
  9597. DeviceRgbCS.prototype = {
  9598. getRgb: ColorSpace.prototype.getRgb,
  9599. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9600. var r = src[srcOffset] * 255 | 0;
  9601. var g = src[srcOffset + 1] * 255 | 0;
  9602. var b = src[srcOffset + 2] * 255 | 0;
  9603. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  9604. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  9605. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  9606. },
  9607. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9608. if (bits === 8 && alpha01 === 0) {
  9609. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  9610. return;
  9611. }
  9612. var scale = 255 / ((1 << bits) - 1);
  9613. var j = srcOffset, q = destOffset;
  9614. for (var i = 0; i < count; ++i) {
  9615. dest[q++] = scale * src[j++] | 0;
  9616. dest[q++] = scale * src[j++] | 0;
  9617. dest[q++] = scale * src[j++] | 0;
  9618. q += alpha01;
  9619. }
  9620. },
  9621. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  9622. return inputLength * (3 + alpha01) / 3 | 0;
  9623. },
  9624. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  9625. return bits === 8;
  9626. },
  9627. fillRgb: ColorSpace.prototype.fillRgb,
  9628. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  9629. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9630. },
  9631. usesZeroToOneRange: true
  9632. };
  9633. return DeviceRgbCS;
  9634. }();
  9635. var DeviceCmykCS = function DeviceCmykCSClosure() {
  9636. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  9637. var c = src[srcOffset + 0] * srcScale;
  9638. var m = src[srcOffset + 1] * srcScale;
  9639. var y = src[srcOffset + 2] * srcScale;
  9640. var k = src[srcOffset + 3] * srcScale;
  9641. 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;
  9642. 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;
  9643. 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;
  9644. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  9645. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  9646. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  9647. }
  9648. function DeviceCmykCS() {
  9649. this.name = 'DeviceCMYK';
  9650. this.numComps = 4;
  9651. this.defaultColor = new Float32Array(this.numComps);
  9652. this.defaultColor[3] = 1;
  9653. }
  9654. DeviceCmykCS.prototype = {
  9655. getRgb: ColorSpace.prototype.getRgb,
  9656. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9657. convertToRgb(src, srcOffset, 1, dest, destOffset);
  9658. },
  9659. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9660. var scale = 1 / ((1 << bits) - 1);
  9661. for (var i = 0; i < count; i++) {
  9662. convertToRgb(src, srcOffset, scale, dest, destOffset);
  9663. srcOffset += 4;
  9664. destOffset += 3 + alpha01;
  9665. }
  9666. },
  9667. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  9668. return inputLength / 4 * (3 + alpha01) | 0;
  9669. },
  9670. isPassthrough: ColorSpace.prototype.isPassthrough,
  9671. fillRgb: ColorSpace.prototype.fillRgb,
  9672. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  9673. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9674. },
  9675. usesZeroToOneRange: true
  9676. };
  9677. return DeviceCmykCS;
  9678. }();
  9679. var CalGrayCS = function CalGrayCSClosure() {
  9680. function CalGrayCS(whitePoint, blackPoint, gamma) {
  9681. this.name = 'CalGray';
  9682. this.numComps = 1;
  9683. this.defaultColor = new Float32Array(this.numComps);
  9684. if (!whitePoint) {
  9685. error('WhitePoint missing - required for color space CalGray');
  9686. }
  9687. blackPoint = blackPoint || [
  9688. 0,
  9689. 0,
  9690. 0
  9691. ];
  9692. gamma = gamma || 1;
  9693. this.XW = whitePoint[0];
  9694. this.YW = whitePoint[1];
  9695. this.ZW = whitePoint[2];
  9696. this.XB = blackPoint[0];
  9697. this.YB = blackPoint[1];
  9698. this.ZB = blackPoint[2];
  9699. this.G = gamma;
  9700. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9701. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9702. }
  9703. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9704. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  9705. this.XB = this.YB = this.ZB = 0;
  9706. }
  9707. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  9708. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  9709. }
  9710. if (this.G < 1) {
  9711. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  9712. this.G = 1;
  9713. }
  9714. }
  9715. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9716. var A = src[srcOffset] * scale;
  9717. var AG = Math.pow(A, cs.G);
  9718. var L = cs.YW * AG;
  9719. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  9720. dest[destOffset] = val;
  9721. dest[destOffset + 1] = val;
  9722. dest[destOffset + 2] = val;
  9723. }
  9724. CalGrayCS.prototype = {
  9725. getRgb: ColorSpace.prototype.getRgb,
  9726. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9727. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9728. },
  9729. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9730. var scale = 1 / ((1 << bits) - 1);
  9731. for (var i = 0; i < count; ++i) {
  9732. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9733. srcOffset += 1;
  9734. destOffset += 3 + alpha01;
  9735. }
  9736. },
  9737. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  9738. return inputLength * (3 + alpha01);
  9739. },
  9740. isPassthrough: ColorSpace.prototype.isPassthrough,
  9741. fillRgb: ColorSpace.prototype.fillRgb,
  9742. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  9743. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9744. },
  9745. usesZeroToOneRange: true
  9746. };
  9747. return CalGrayCS;
  9748. }();
  9749. var CalRGBCS = function CalRGBCSClosure() {
  9750. var BRADFORD_SCALE_MATRIX = new Float32Array([
  9751. 0.8951,
  9752. 0.2664,
  9753. -0.1614,
  9754. -0.7502,
  9755. 1.7135,
  9756. 0.0367,
  9757. 0.0389,
  9758. -0.0685,
  9759. 1.0296
  9760. ]);
  9761. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  9762. 0.9869929,
  9763. -0.1470543,
  9764. 0.1599627,
  9765. 0.4323053,
  9766. 0.5183603,
  9767. 0.0492912,
  9768. -0.0085287,
  9769. 0.0400428,
  9770. 0.9684867
  9771. ]);
  9772. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  9773. 3.2404542,
  9774. -1.5371385,
  9775. -0.4985314,
  9776. -0.9692660,
  9777. 1.8760108,
  9778. 0.0415560,
  9779. 0.0556434,
  9780. -0.2040259,
  9781. 1.0572252
  9782. ]);
  9783. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  9784. 1,
  9785. 1,
  9786. 1
  9787. ]);
  9788. var tempNormalizeMatrix = new Float32Array(3);
  9789. var tempConvertMatrix1 = new Float32Array(3);
  9790. var tempConvertMatrix2 = new Float32Array(3);
  9791. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  9792. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  9793. this.name = 'CalRGB';
  9794. this.numComps = 3;
  9795. this.defaultColor = new Float32Array(this.numComps);
  9796. if (!whitePoint) {
  9797. error('WhitePoint missing - required for color space CalRGB');
  9798. }
  9799. blackPoint = blackPoint || new Float32Array(3);
  9800. gamma = gamma || new Float32Array([
  9801. 1,
  9802. 1,
  9803. 1
  9804. ]);
  9805. matrix = matrix || new Float32Array([
  9806. 1,
  9807. 0,
  9808. 0,
  9809. 0,
  9810. 1,
  9811. 0,
  9812. 0,
  9813. 0,
  9814. 1
  9815. ]);
  9816. var XW = whitePoint[0];
  9817. var YW = whitePoint[1];
  9818. var ZW = whitePoint[2];
  9819. this.whitePoint = whitePoint;
  9820. var XB = blackPoint[0];
  9821. var YB = blackPoint[1];
  9822. var ZB = blackPoint[2];
  9823. this.blackPoint = blackPoint;
  9824. this.GR = gamma[0];
  9825. this.GG = gamma[1];
  9826. this.GB = gamma[2];
  9827. this.MXA = matrix[0];
  9828. this.MYA = matrix[1];
  9829. this.MZA = matrix[2];
  9830. this.MXB = matrix[3];
  9831. this.MYB = matrix[4];
  9832. this.MZB = matrix[5];
  9833. this.MXC = matrix[6];
  9834. this.MYC = matrix[7];
  9835. this.MZC = matrix[8];
  9836. if (XW < 0 || ZW < 0 || YW !== 1) {
  9837. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9838. }
  9839. if (XB < 0 || YB < 0 || ZB < 0) {
  9840. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9841. this.blackPoint = new Float32Array(3);
  9842. }
  9843. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9844. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9845. this.GR = this.GG = this.GB = 1;
  9846. }
  9847. 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) {
  9848. 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');
  9849. this.MXA = this.MYB = this.MZC = 1;
  9850. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9851. }
  9852. }
  9853. function matrixProduct(a, b, result) {
  9854. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9855. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9856. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9857. }
  9858. function convertToFlat(sourceWhitePoint, LMS, result) {
  9859. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9860. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9861. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9862. }
  9863. function convertToD65(sourceWhitePoint, LMS, result) {
  9864. var D65X = 0.95047;
  9865. var D65Y = 1;
  9866. var D65Z = 1.08883;
  9867. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9868. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9869. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9870. }
  9871. function sRGBTransferFunction(color) {
  9872. if (color <= 0.0031308) {
  9873. return adjustToRange(0, 1, 12.92 * color);
  9874. }
  9875. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9876. }
  9877. function adjustToRange(min, max, value) {
  9878. return Math.max(min, Math.min(max, value));
  9879. }
  9880. function decodeL(L) {
  9881. if (L < 0) {
  9882. return -decodeL(-L);
  9883. }
  9884. if (L > 8.0) {
  9885. return Math.pow((L + 16) / 116, 3);
  9886. }
  9887. return L * DECODE_L_CONSTANT;
  9888. }
  9889. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9890. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9891. result[0] = XYZ_Flat[0];
  9892. result[1] = XYZ_Flat[1];
  9893. result[2] = XYZ_Flat[2];
  9894. return;
  9895. }
  9896. var zeroDecodeL = decodeL(0);
  9897. var X_DST = zeroDecodeL;
  9898. var X_SRC = decodeL(sourceBlackPoint[0]);
  9899. var Y_DST = zeroDecodeL;
  9900. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9901. var Z_DST = zeroDecodeL;
  9902. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9903. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9904. var X_Offset = 1 - X_Scale;
  9905. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9906. var Y_Offset = 1 - Y_Scale;
  9907. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9908. var Z_Offset = 1 - Z_Scale;
  9909. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9910. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9911. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9912. }
  9913. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9914. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9915. result[0] = XYZ_In[0];
  9916. result[1] = XYZ_In[1];
  9917. result[2] = XYZ_In[2];
  9918. return;
  9919. }
  9920. var LMS = result;
  9921. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9922. var LMS_Flat = tempNormalizeMatrix;
  9923. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9924. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9925. }
  9926. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9927. var LMS = result;
  9928. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9929. var LMS_D65 = tempNormalizeMatrix;
  9930. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9931. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9932. }
  9933. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9934. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9935. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9936. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9937. var AGR = Math.pow(A, cs.GR);
  9938. var BGG = Math.pow(B, cs.GG);
  9939. var CGB = Math.pow(C, cs.GB);
  9940. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9941. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9942. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9943. var XYZ = tempConvertMatrix1;
  9944. XYZ[0] = X;
  9945. XYZ[1] = Y;
  9946. XYZ[2] = Z;
  9947. var XYZ_Flat = tempConvertMatrix2;
  9948. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9949. var XYZ_Black = tempConvertMatrix1;
  9950. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9951. var XYZ_D65 = tempConvertMatrix2;
  9952. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9953. var SRGB = tempConvertMatrix1;
  9954. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9955. var sR = sRGBTransferFunction(SRGB[0]);
  9956. var sG = sRGBTransferFunction(SRGB[1]);
  9957. var sB = sRGBTransferFunction(SRGB[2]);
  9958. dest[destOffset] = Math.round(sR * 255);
  9959. dest[destOffset + 1] = Math.round(sG * 255);
  9960. dest[destOffset + 2] = Math.round(sB * 255);
  9961. }
  9962. CalRGBCS.prototype = {
  9963. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9964. var rgb = new Uint8Array(3);
  9965. this.getRgbItem(src, srcOffset, rgb, 0);
  9966. return rgb;
  9967. },
  9968. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9969. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9970. },
  9971. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9972. var scale = 1 / ((1 << bits) - 1);
  9973. for (var i = 0; i < count; ++i) {
  9974. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9975. srcOffset += 3;
  9976. destOffset += 3 + alpha01;
  9977. }
  9978. },
  9979. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9980. return inputLength * (3 + alpha01) / 3 | 0;
  9981. },
  9982. isPassthrough: ColorSpace.prototype.isPassthrough,
  9983. fillRgb: ColorSpace.prototype.fillRgb,
  9984. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9985. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9986. },
  9987. usesZeroToOneRange: true
  9988. };
  9989. return CalRGBCS;
  9990. }();
  9991. var LabCS = function LabCSClosure() {
  9992. function LabCS(whitePoint, blackPoint, range) {
  9993. this.name = 'Lab';
  9994. this.numComps = 3;
  9995. this.defaultColor = new Float32Array(this.numComps);
  9996. if (!whitePoint) {
  9997. error('WhitePoint missing - required for color space Lab');
  9998. }
  9999. blackPoint = blackPoint || [
  10000. 0,
  10001. 0,
  10002. 0
  10003. ];
  10004. range = range || [
  10005. -100,
  10006. 100,
  10007. -100,
  10008. 100
  10009. ];
  10010. this.XW = whitePoint[0];
  10011. this.YW = whitePoint[1];
  10012. this.ZW = whitePoint[2];
  10013. this.amin = range[0];
  10014. this.amax = range[1];
  10015. this.bmin = range[2];
  10016. this.bmax = range[3];
  10017. this.XB = blackPoint[0];
  10018. this.YB = blackPoint[1];
  10019. this.ZB = blackPoint[2];
  10020. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10021. error('Invalid WhitePoint components, no fallback available');
  10022. }
  10023. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10024. info('Invalid BlackPoint, falling back to default');
  10025. this.XB = this.YB = this.ZB = 0;
  10026. }
  10027. if (this.amin > this.amax || this.bmin > this.bmax) {
  10028. info('Invalid Range, falling back to defaults');
  10029. this.amin = -100;
  10030. this.amax = 100;
  10031. this.bmin = -100;
  10032. this.bmax = 100;
  10033. }
  10034. }
  10035. function fn_g(x) {
  10036. var result;
  10037. if (x >= 6 / 29) {
  10038. result = x * x * x;
  10039. } else {
  10040. result = 108 / 841 * (x - 4 / 29);
  10041. }
  10042. return result;
  10043. }
  10044. function decode(value, high1, low2, high2) {
  10045. return low2 + value * (high2 - low2) / high1;
  10046. }
  10047. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  10048. var Ls = src[srcOffset];
  10049. var as = src[srcOffset + 1];
  10050. var bs = src[srcOffset + 2];
  10051. if (maxVal !== false) {
  10052. Ls = decode(Ls, maxVal, 0, 100);
  10053. as = decode(as, maxVal, cs.amin, cs.amax);
  10054. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  10055. }
  10056. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  10057. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  10058. var M = (Ls + 16) / 116;
  10059. var L = M + as / 500;
  10060. var N = M - bs / 200;
  10061. var X = cs.XW * fn_g(L);
  10062. var Y = cs.YW * fn_g(M);
  10063. var Z = cs.ZW * fn_g(N);
  10064. var r, g, b;
  10065. if (cs.ZW < 1) {
  10066. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  10067. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  10068. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  10069. } else {
  10070. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  10071. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  10072. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  10073. }
  10074. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  10075. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  10076. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  10077. }
  10078. LabCS.prototype = {
  10079. getRgb: ColorSpace.prototype.getRgb,
  10080. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  10081. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  10082. },
  10083. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10084. var maxVal = (1 << bits) - 1;
  10085. for (var i = 0; i < count; i++) {
  10086. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  10087. srcOffset += 3;
  10088. destOffset += 3 + alpha01;
  10089. }
  10090. },
  10091. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  10092. return inputLength * (3 + alpha01) / 3 | 0;
  10093. },
  10094. isPassthrough: ColorSpace.prototype.isPassthrough,
  10095. fillRgb: ColorSpace.prototype.fillRgb,
  10096. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  10097. return true;
  10098. },
  10099. usesZeroToOneRange: false
  10100. };
  10101. return LabCS;
  10102. }();
  10103. exports.ColorSpace = ColorSpace;
  10104. /***/ }),
  10105. /* 4 */
  10106. /***/ (function(module, exports, __w_pdfjs_require__) {
  10107. "use strict";
  10108. var ExpertEncoding = [
  10109. '',
  10110. '',
  10111. '',
  10112. '',
  10113. '',
  10114. '',
  10115. '',
  10116. '',
  10117. '',
  10118. '',
  10119. '',
  10120. '',
  10121. '',
  10122. '',
  10123. '',
  10124. '',
  10125. '',
  10126. '',
  10127. '',
  10128. '',
  10129. '',
  10130. '',
  10131. '',
  10132. '',
  10133. '',
  10134. '',
  10135. '',
  10136. '',
  10137. '',
  10138. '',
  10139. '',
  10140. '',
  10141. 'space',
  10142. 'exclamsmall',
  10143. 'Hungarumlautsmall',
  10144. '',
  10145. 'dollaroldstyle',
  10146. 'dollarsuperior',
  10147. 'ampersandsmall',
  10148. 'Acutesmall',
  10149. 'parenleftsuperior',
  10150. 'parenrightsuperior',
  10151. 'twodotenleader',
  10152. 'onedotenleader',
  10153. 'comma',
  10154. 'hyphen',
  10155. 'period',
  10156. 'fraction',
  10157. 'zerooldstyle',
  10158. 'oneoldstyle',
  10159. 'twooldstyle',
  10160. 'threeoldstyle',
  10161. 'fouroldstyle',
  10162. 'fiveoldstyle',
  10163. 'sixoldstyle',
  10164. 'sevenoldstyle',
  10165. 'eightoldstyle',
  10166. 'nineoldstyle',
  10167. 'colon',
  10168. 'semicolon',
  10169. 'commasuperior',
  10170. 'threequartersemdash',
  10171. 'periodsuperior',
  10172. 'questionsmall',
  10173. '',
  10174. 'asuperior',
  10175. 'bsuperior',
  10176. 'centsuperior',
  10177. 'dsuperior',
  10178. 'esuperior',
  10179. '',
  10180. '',
  10181. 'isuperior',
  10182. '',
  10183. '',
  10184. 'lsuperior',
  10185. 'msuperior',
  10186. 'nsuperior',
  10187. 'osuperior',
  10188. '',
  10189. '',
  10190. 'rsuperior',
  10191. 'ssuperior',
  10192. 'tsuperior',
  10193. '',
  10194. 'ff',
  10195. 'fi',
  10196. 'fl',
  10197. 'ffi',
  10198. 'ffl',
  10199. 'parenleftinferior',
  10200. '',
  10201. 'parenrightinferior',
  10202. 'Circumflexsmall',
  10203. 'hyphensuperior',
  10204. 'Gravesmall',
  10205. 'Asmall',
  10206. 'Bsmall',
  10207. 'Csmall',
  10208. 'Dsmall',
  10209. 'Esmall',
  10210. 'Fsmall',
  10211. 'Gsmall',
  10212. 'Hsmall',
  10213. 'Ismall',
  10214. 'Jsmall',
  10215. 'Ksmall',
  10216. 'Lsmall',
  10217. 'Msmall',
  10218. 'Nsmall',
  10219. 'Osmall',
  10220. 'Psmall',
  10221. 'Qsmall',
  10222. 'Rsmall',
  10223. 'Ssmall',
  10224. 'Tsmall',
  10225. 'Usmall',
  10226. 'Vsmall',
  10227. 'Wsmall',
  10228. 'Xsmall',
  10229. 'Ysmall',
  10230. 'Zsmall',
  10231. 'colonmonetary',
  10232. 'onefitted',
  10233. 'rupiah',
  10234. 'Tildesmall',
  10235. '',
  10236. '',
  10237. '',
  10238. '',
  10239. '',
  10240. '',
  10241. '',
  10242. '',
  10243. '',
  10244. '',
  10245. '',
  10246. '',
  10247. '',
  10248. '',
  10249. '',
  10250. '',
  10251. '',
  10252. '',
  10253. '',
  10254. '',
  10255. '',
  10256. '',
  10257. '',
  10258. '',
  10259. '',
  10260. '',
  10261. '',
  10262. '',
  10263. '',
  10264. '',
  10265. '',
  10266. '',
  10267. '',
  10268. '',
  10269. 'exclamdownsmall',
  10270. 'centoldstyle',
  10271. 'Lslashsmall',
  10272. '',
  10273. '',
  10274. 'Scaronsmall',
  10275. 'Zcaronsmall',
  10276. 'Dieresissmall',
  10277. 'Brevesmall',
  10278. 'Caronsmall',
  10279. '',
  10280. 'Dotaccentsmall',
  10281. '',
  10282. '',
  10283. 'Macronsmall',
  10284. '',
  10285. '',
  10286. 'figuredash',
  10287. 'hypheninferior',
  10288. '',
  10289. '',
  10290. 'Ogoneksmall',
  10291. 'Ringsmall',
  10292. 'Cedillasmall',
  10293. '',
  10294. '',
  10295. '',
  10296. 'onequarter',
  10297. 'onehalf',
  10298. 'threequarters',
  10299. 'questiondownsmall',
  10300. 'oneeighth',
  10301. 'threeeighths',
  10302. 'fiveeighths',
  10303. 'seveneighths',
  10304. 'onethird',
  10305. 'twothirds',
  10306. '',
  10307. '',
  10308. 'zerosuperior',
  10309. 'onesuperior',
  10310. 'twosuperior',
  10311. 'threesuperior',
  10312. 'foursuperior',
  10313. 'fivesuperior',
  10314. 'sixsuperior',
  10315. 'sevensuperior',
  10316. 'eightsuperior',
  10317. 'ninesuperior',
  10318. 'zeroinferior',
  10319. 'oneinferior',
  10320. 'twoinferior',
  10321. 'threeinferior',
  10322. 'fourinferior',
  10323. 'fiveinferior',
  10324. 'sixinferior',
  10325. 'seveninferior',
  10326. 'eightinferior',
  10327. 'nineinferior',
  10328. 'centinferior',
  10329. 'dollarinferior',
  10330. 'periodinferior',
  10331. 'commainferior',
  10332. 'Agravesmall',
  10333. 'Aacutesmall',
  10334. 'Acircumflexsmall',
  10335. 'Atildesmall',
  10336. 'Adieresissmall',
  10337. 'Aringsmall',
  10338. 'AEsmall',
  10339. 'Ccedillasmall',
  10340. 'Egravesmall',
  10341. 'Eacutesmall',
  10342. 'Ecircumflexsmall',
  10343. 'Edieresissmall',
  10344. 'Igravesmall',
  10345. 'Iacutesmall',
  10346. 'Icircumflexsmall',
  10347. 'Idieresissmall',
  10348. 'Ethsmall',
  10349. 'Ntildesmall',
  10350. 'Ogravesmall',
  10351. 'Oacutesmall',
  10352. 'Ocircumflexsmall',
  10353. 'Otildesmall',
  10354. 'Odieresissmall',
  10355. 'OEsmall',
  10356. 'Oslashsmall',
  10357. 'Ugravesmall',
  10358. 'Uacutesmall',
  10359. 'Ucircumflexsmall',
  10360. 'Udieresissmall',
  10361. 'Yacutesmall',
  10362. 'Thornsmall',
  10363. 'Ydieresissmall'
  10364. ];
  10365. var MacExpertEncoding = [
  10366. '',
  10367. '',
  10368. '',
  10369. '',
  10370. '',
  10371. '',
  10372. '',
  10373. '',
  10374. '',
  10375. '',
  10376. '',
  10377. '',
  10378. '',
  10379. '',
  10380. '',
  10381. '',
  10382. '',
  10383. '',
  10384. '',
  10385. '',
  10386. '',
  10387. '',
  10388. '',
  10389. '',
  10390. '',
  10391. '',
  10392. '',
  10393. '',
  10394. '',
  10395. '',
  10396. '',
  10397. '',
  10398. 'space',
  10399. 'exclamsmall',
  10400. 'Hungarumlautsmall',
  10401. 'centoldstyle',
  10402. 'dollaroldstyle',
  10403. 'dollarsuperior',
  10404. 'ampersandsmall',
  10405. 'Acutesmall',
  10406. 'parenleftsuperior',
  10407. 'parenrightsuperior',
  10408. 'twodotenleader',
  10409. 'onedotenleader',
  10410. 'comma',
  10411. 'hyphen',
  10412. 'period',
  10413. 'fraction',
  10414. 'zerooldstyle',
  10415. 'oneoldstyle',
  10416. 'twooldstyle',
  10417. 'threeoldstyle',
  10418. 'fouroldstyle',
  10419. 'fiveoldstyle',
  10420. 'sixoldstyle',
  10421. 'sevenoldstyle',
  10422. 'eightoldstyle',
  10423. 'nineoldstyle',
  10424. 'colon',
  10425. 'semicolon',
  10426. '',
  10427. 'threequartersemdash',
  10428. '',
  10429. 'questionsmall',
  10430. '',
  10431. '',
  10432. '',
  10433. '',
  10434. 'Ethsmall',
  10435. '',
  10436. '',
  10437. 'onequarter',
  10438. 'onehalf',
  10439. 'threequarters',
  10440. 'oneeighth',
  10441. 'threeeighths',
  10442. 'fiveeighths',
  10443. 'seveneighths',
  10444. 'onethird',
  10445. 'twothirds',
  10446. '',
  10447. '',
  10448. '',
  10449. '',
  10450. '',
  10451. '',
  10452. 'ff',
  10453. 'fi',
  10454. 'fl',
  10455. 'ffi',
  10456. 'ffl',
  10457. 'parenleftinferior',
  10458. '',
  10459. 'parenrightinferior',
  10460. 'Circumflexsmall',
  10461. 'hypheninferior',
  10462. 'Gravesmall',
  10463. 'Asmall',
  10464. 'Bsmall',
  10465. 'Csmall',
  10466. 'Dsmall',
  10467. 'Esmall',
  10468. 'Fsmall',
  10469. 'Gsmall',
  10470. 'Hsmall',
  10471. 'Ismall',
  10472. 'Jsmall',
  10473. 'Ksmall',
  10474. 'Lsmall',
  10475. 'Msmall',
  10476. 'Nsmall',
  10477. 'Osmall',
  10478. 'Psmall',
  10479. 'Qsmall',
  10480. 'Rsmall',
  10481. 'Ssmall',
  10482. 'Tsmall',
  10483. 'Usmall',
  10484. 'Vsmall',
  10485. 'Wsmall',
  10486. 'Xsmall',
  10487. 'Ysmall',
  10488. 'Zsmall',
  10489. 'colonmonetary',
  10490. 'onefitted',
  10491. 'rupiah',
  10492. 'Tildesmall',
  10493. '',
  10494. '',
  10495. 'asuperior',
  10496. 'centsuperior',
  10497. '',
  10498. '',
  10499. '',
  10500. '',
  10501. 'Aacutesmall',
  10502. 'Agravesmall',
  10503. 'Acircumflexsmall',
  10504. 'Adieresissmall',
  10505. 'Atildesmall',
  10506. 'Aringsmall',
  10507. 'Ccedillasmall',
  10508. 'Eacutesmall',
  10509. 'Egravesmall',
  10510. 'Ecircumflexsmall',
  10511. 'Edieresissmall',
  10512. 'Iacutesmall',
  10513. 'Igravesmall',
  10514. 'Icircumflexsmall',
  10515. 'Idieresissmall',
  10516. 'Ntildesmall',
  10517. 'Oacutesmall',
  10518. 'Ogravesmall',
  10519. 'Ocircumflexsmall',
  10520. 'Odieresissmall',
  10521. 'Otildesmall',
  10522. 'Uacutesmall',
  10523. 'Ugravesmall',
  10524. 'Ucircumflexsmall',
  10525. 'Udieresissmall',
  10526. '',
  10527. 'eightsuperior',
  10528. 'fourinferior',
  10529. 'threeinferior',
  10530. 'sixinferior',
  10531. 'eightinferior',
  10532. 'seveninferior',
  10533. 'Scaronsmall',
  10534. '',
  10535. 'centinferior',
  10536. 'twoinferior',
  10537. '',
  10538. 'Dieresissmall',
  10539. '',
  10540. 'Caronsmall',
  10541. 'osuperior',
  10542. 'fiveinferior',
  10543. '',
  10544. 'commainferior',
  10545. 'periodinferior',
  10546. 'Yacutesmall',
  10547. '',
  10548. 'dollarinferior',
  10549. '',
  10550. 'Thornsmall',
  10551. '',
  10552. 'nineinferior',
  10553. 'zeroinferior',
  10554. 'Zcaronsmall',
  10555. 'AEsmall',
  10556. 'Oslashsmall',
  10557. 'questiondownsmall',
  10558. 'oneinferior',
  10559. 'Lslashsmall',
  10560. '',
  10561. '',
  10562. '',
  10563. '',
  10564. '',
  10565. '',
  10566. 'Cedillasmall',
  10567. '',
  10568. '',
  10569. '',
  10570. '',
  10571. '',
  10572. 'OEsmall',
  10573. 'figuredash',
  10574. 'hyphensuperior',
  10575. '',
  10576. '',
  10577. '',
  10578. '',
  10579. 'exclamdownsmall',
  10580. '',
  10581. 'Ydieresissmall',
  10582. '',
  10583. 'onesuperior',
  10584. 'twosuperior',
  10585. 'threesuperior',
  10586. 'foursuperior',
  10587. 'fivesuperior',
  10588. 'sixsuperior',
  10589. 'sevensuperior',
  10590. 'ninesuperior',
  10591. 'zerosuperior',
  10592. '',
  10593. 'esuperior',
  10594. 'rsuperior',
  10595. 'tsuperior',
  10596. '',
  10597. '',
  10598. 'isuperior',
  10599. 'ssuperior',
  10600. 'dsuperior',
  10601. '',
  10602. '',
  10603. '',
  10604. '',
  10605. '',
  10606. 'lsuperior',
  10607. 'Ogoneksmall',
  10608. 'Brevesmall',
  10609. 'Macronsmall',
  10610. 'bsuperior',
  10611. 'nsuperior',
  10612. 'msuperior',
  10613. 'commasuperior',
  10614. 'periodsuperior',
  10615. 'Dotaccentsmall',
  10616. 'Ringsmall'
  10617. ];
  10618. var MacRomanEncoding = [
  10619. '',
  10620. '',
  10621. '',
  10622. '',
  10623. '',
  10624. '',
  10625. '',
  10626. '',
  10627. '',
  10628. '',
  10629. '',
  10630. '',
  10631. '',
  10632. '',
  10633. '',
  10634. '',
  10635. '',
  10636. '',
  10637. '',
  10638. '',
  10639. '',
  10640. '',
  10641. '',
  10642. '',
  10643. '',
  10644. '',
  10645. '',
  10646. '',
  10647. '',
  10648. '',
  10649. '',
  10650. '',
  10651. 'space',
  10652. 'exclam',
  10653. 'quotedbl',
  10654. 'numbersign',
  10655. 'dollar',
  10656. 'percent',
  10657. 'ampersand',
  10658. 'quotesingle',
  10659. 'parenleft',
  10660. 'parenright',
  10661. 'asterisk',
  10662. 'plus',
  10663. 'comma',
  10664. 'hyphen',
  10665. 'period',
  10666. 'slash',
  10667. 'zero',
  10668. 'one',
  10669. 'two',
  10670. 'three',
  10671. 'four',
  10672. 'five',
  10673. 'six',
  10674. 'seven',
  10675. 'eight',
  10676. 'nine',
  10677. 'colon',
  10678. 'semicolon',
  10679. 'less',
  10680. 'equal',
  10681. 'greater',
  10682. 'question',
  10683. 'at',
  10684. 'A',
  10685. 'B',
  10686. 'C',
  10687. 'D',
  10688. 'E',
  10689. 'F',
  10690. 'G',
  10691. 'H',
  10692. 'I',
  10693. 'J',
  10694. 'K',
  10695. 'L',
  10696. 'M',
  10697. 'N',
  10698. 'O',
  10699. 'P',
  10700. 'Q',
  10701. 'R',
  10702. 'S',
  10703. 'T',
  10704. 'U',
  10705. 'V',
  10706. 'W',
  10707. 'X',
  10708. 'Y',
  10709. 'Z',
  10710. 'bracketleft',
  10711. 'backslash',
  10712. 'bracketright',
  10713. 'asciicircum',
  10714. 'underscore',
  10715. 'grave',
  10716. 'a',
  10717. 'b',
  10718. 'c',
  10719. 'd',
  10720. 'e',
  10721. 'f',
  10722. 'g',
  10723. 'h',
  10724. 'i',
  10725. 'j',
  10726. 'k',
  10727. 'l',
  10728. 'm',
  10729. 'n',
  10730. 'o',
  10731. 'p',
  10732. 'q',
  10733. 'r',
  10734. 's',
  10735. 't',
  10736. 'u',
  10737. 'v',
  10738. 'w',
  10739. 'x',
  10740. 'y',
  10741. 'z',
  10742. 'braceleft',
  10743. 'bar',
  10744. 'braceright',
  10745. 'asciitilde',
  10746. '',
  10747. 'Adieresis',
  10748. 'Aring',
  10749. 'Ccedilla',
  10750. 'Eacute',
  10751. 'Ntilde',
  10752. 'Odieresis',
  10753. 'Udieresis',
  10754. 'aacute',
  10755. 'agrave',
  10756. 'acircumflex',
  10757. 'adieresis',
  10758. 'atilde',
  10759. 'aring',
  10760. 'ccedilla',
  10761. 'eacute',
  10762. 'egrave',
  10763. 'ecircumflex',
  10764. 'edieresis',
  10765. 'iacute',
  10766. 'igrave',
  10767. 'icircumflex',
  10768. 'idieresis',
  10769. 'ntilde',
  10770. 'oacute',
  10771. 'ograve',
  10772. 'ocircumflex',
  10773. 'odieresis',
  10774. 'otilde',
  10775. 'uacute',
  10776. 'ugrave',
  10777. 'ucircumflex',
  10778. 'udieresis',
  10779. 'dagger',
  10780. 'degree',
  10781. 'cent',
  10782. 'sterling',
  10783. 'section',
  10784. 'bullet',
  10785. 'paragraph',
  10786. 'germandbls',
  10787. 'registered',
  10788. 'copyright',
  10789. 'trademark',
  10790. 'acute',
  10791. 'dieresis',
  10792. 'notequal',
  10793. 'AE',
  10794. 'Oslash',
  10795. 'infinity',
  10796. 'plusminus',
  10797. 'lessequal',
  10798. 'greaterequal',
  10799. 'yen',
  10800. 'mu',
  10801. 'partialdiff',
  10802. 'summation',
  10803. 'product',
  10804. 'pi',
  10805. 'integral',
  10806. 'ordfeminine',
  10807. 'ordmasculine',
  10808. 'Omega',
  10809. 'ae',
  10810. 'oslash',
  10811. 'questiondown',
  10812. 'exclamdown',
  10813. 'logicalnot',
  10814. 'radical',
  10815. 'florin',
  10816. 'approxequal',
  10817. 'Delta',
  10818. 'guillemotleft',
  10819. 'guillemotright',
  10820. 'ellipsis',
  10821. 'space',
  10822. 'Agrave',
  10823. 'Atilde',
  10824. 'Otilde',
  10825. 'OE',
  10826. 'oe',
  10827. 'endash',
  10828. 'emdash',
  10829. 'quotedblleft',
  10830. 'quotedblright',
  10831. 'quoteleft',
  10832. 'quoteright',
  10833. 'divide',
  10834. 'lozenge',
  10835. 'ydieresis',
  10836. 'Ydieresis',
  10837. 'fraction',
  10838. 'currency',
  10839. 'guilsinglleft',
  10840. 'guilsinglright',
  10841. 'fi',
  10842. 'fl',
  10843. 'daggerdbl',
  10844. 'periodcentered',
  10845. 'quotesinglbase',
  10846. 'quotedblbase',
  10847. 'perthousand',
  10848. 'Acircumflex',
  10849. 'Ecircumflex',
  10850. 'Aacute',
  10851. 'Edieresis',
  10852. 'Egrave',
  10853. 'Iacute',
  10854. 'Icircumflex',
  10855. 'Idieresis',
  10856. 'Igrave',
  10857. 'Oacute',
  10858. 'Ocircumflex',
  10859. 'apple',
  10860. 'Ograve',
  10861. 'Uacute',
  10862. 'Ucircumflex',
  10863. 'Ugrave',
  10864. 'dotlessi',
  10865. 'circumflex',
  10866. 'tilde',
  10867. 'macron',
  10868. 'breve',
  10869. 'dotaccent',
  10870. 'ring',
  10871. 'cedilla',
  10872. 'hungarumlaut',
  10873. 'ogonek',
  10874. 'caron'
  10875. ];
  10876. var StandardEncoding = [
  10877. '',
  10878. '',
  10879. '',
  10880. '',
  10881. '',
  10882. '',
  10883. '',
  10884. '',
  10885. '',
  10886. '',
  10887. '',
  10888. '',
  10889. '',
  10890. '',
  10891. '',
  10892. '',
  10893. '',
  10894. '',
  10895. '',
  10896. '',
  10897. '',
  10898. '',
  10899. '',
  10900. '',
  10901. '',
  10902. '',
  10903. '',
  10904. '',
  10905. '',
  10906. '',
  10907. '',
  10908. '',
  10909. 'space',
  10910. 'exclam',
  10911. 'quotedbl',
  10912. 'numbersign',
  10913. 'dollar',
  10914. 'percent',
  10915. 'ampersand',
  10916. 'quoteright',
  10917. 'parenleft',
  10918. 'parenright',
  10919. 'asterisk',
  10920. 'plus',
  10921. 'comma',
  10922. 'hyphen',
  10923. 'period',
  10924. 'slash',
  10925. 'zero',
  10926. 'one',
  10927. 'two',
  10928. 'three',
  10929. 'four',
  10930. 'five',
  10931. 'six',
  10932. 'seven',
  10933. 'eight',
  10934. 'nine',
  10935. 'colon',
  10936. 'semicolon',
  10937. 'less',
  10938. 'equal',
  10939. 'greater',
  10940. 'question',
  10941. 'at',
  10942. 'A',
  10943. 'B',
  10944. 'C',
  10945. 'D',
  10946. 'E',
  10947. 'F',
  10948. 'G',
  10949. 'H',
  10950. 'I',
  10951. 'J',
  10952. 'K',
  10953. 'L',
  10954. 'M',
  10955. 'N',
  10956. 'O',
  10957. 'P',
  10958. 'Q',
  10959. 'R',
  10960. 'S',
  10961. 'T',
  10962. 'U',
  10963. 'V',
  10964. 'W',
  10965. 'X',
  10966. 'Y',
  10967. 'Z',
  10968. 'bracketleft',
  10969. 'backslash',
  10970. 'bracketright',
  10971. 'asciicircum',
  10972. 'underscore',
  10973. 'quoteleft',
  10974. 'a',
  10975. 'b',
  10976. 'c',
  10977. 'd',
  10978. 'e',
  10979. 'f',
  10980. 'g',
  10981. 'h',
  10982. 'i',
  10983. 'j',
  10984. 'k',
  10985. 'l',
  10986. 'm',
  10987. 'n',
  10988. 'o',
  10989. 'p',
  10990. 'q',
  10991. 'r',
  10992. 's',
  10993. 't',
  10994. 'u',
  10995. 'v',
  10996. 'w',
  10997. 'x',
  10998. 'y',
  10999. 'z',
  11000. 'braceleft',
  11001. 'bar',
  11002. 'braceright',
  11003. 'asciitilde',
  11004. '',
  11005. '',
  11006. '',
  11007. '',
  11008. '',
  11009. '',
  11010. '',
  11011. '',
  11012. '',
  11013. '',
  11014. '',
  11015. '',
  11016. '',
  11017. '',
  11018. '',
  11019. '',
  11020. '',
  11021. '',
  11022. '',
  11023. '',
  11024. '',
  11025. '',
  11026. '',
  11027. '',
  11028. '',
  11029. '',
  11030. '',
  11031. '',
  11032. '',
  11033. '',
  11034. '',
  11035. '',
  11036. '',
  11037. '',
  11038. 'exclamdown',
  11039. 'cent',
  11040. 'sterling',
  11041. 'fraction',
  11042. 'yen',
  11043. 'florin',
  11044. 'section',
  11045. 'currency',
  11046. 'quotesingle',
  11047. 'quotedblleft',
  11048. 'guillemotleft',
  11049. 'guilsinglleft',
  11050. 'guilsinglright',
  11051. 'fi',
  11052. 'fl',
  11053. '',
  11054. 'endash',
  11055. 'dagger',
  11056. 'daggerdbl',
  11057. 'periodcentered',
  11058. '',
  11059. 'paragraph',
  11060. 'bullet',
  11061. 'quotesinglbase',
  11062. 'quotedblbase',
  11063. 'quotedblright',
  11064. 'guillemotright',
  11065. 'ellipsis',
  11066. 'perthousand',
  11067. '',
  11068. 'questiondown',
  11069. '',
  11070. 'grave',
  11071. 'acute',
  11072. 'circumflex',
  11073. 'tilde',
  11074. 'macron',
  11075. 'breve',
  11076. 'dotaccent',
  11077. 'dieresis',
  11078. '',
  11079. 'ring',
  11080. 'cedilla',
  11081. '',
  11082. 'hungarumlaut',
  11083. 'ogonek',
  11084. 'caron',
  11085. 'emdash',
  11086. '',
  11087. '',
  11088. '',
  11089. '',
  11090. '',
  11091. '',
  11092. '',
  11093. '',
  11094. '',
  11095. '',
  11096. '',
  11097. '',
  11098. '',
  11099. '',
  11100. '',
  11101. '',
  11102. 'AE',
  11103. '',
  11104. 'ordfeminine',
  11105. '',
  11106. '',
  11107. '',
  11108. '',
  11109. 'Lslash',
  11110. 'Oslash',
  11111. 'OE',
  11112. 'ordmasculine',
  11113. '',
  11114. '',
  11115. '',
  11116. '',
  11117. '',
  11118. 'ae',
  11119. '',
  11120. '',
  11121. '',
  11122. 'dotlessi',
  11123. '',
  11124. '',
  11125. 'lslash',
  11126. 'oslash',
  11127. 'oe',
  11128. 'germandbls'
  11129. ];
  11130. var WinAnsiEncoding = [
  11131. '',
  11132. '',
  11133. '',
  11134. '',
  11135. '',
  11136. '',
  11137. '',
  11138. '',
  11139. '',
  11140. '',
  11141. '',
  11142. '',
  11143. '',
  11144. '',
  11145. '',
  11146. '',
  11147. '',
  11148. '',
  11149. '',
  11150. '',
  11151. '',
  11152. '',
  11153. '',
  11154. '',
  11155. '',
  11156. '',
  11157. '',
  11158. '',
  11159. '',
  11160. '',
  11161. '',
  11162. '',
  11163. 'space',
  11164. 'exclam',
  11165. 'quotedbl',
  11166. 'numbersign',
  11167. 'dollar',
  11168. 'percent',
  11169. 'ampersand',
  11170. 'quotesingle',
  11171. 'parenleft',
  11172. 'parenright',
  11173. 'asterisk',
  11174. 'plus',
  11175. 'comma',
  11176. 'hyphen',
  11177. 'period',
  11178. 'slash',
  11179. 'zero',
  11180. 'one',
  11181. 'two',
  11182. 'three',
  11183. 'four',
  11184. 'five',
  11185. 'six',
  11186. 'seven',
  11187. 'eight',
  11188. 'nine',
  11189. 'colon',
  11190. 'semicolon',
  11191. 'less',
  11192. 'equal',
  11193. 'greater',
  11194. 'question',
  11195. 'at',
  11196. 'A',
  11197. 'B',
  11198. 'C',
  11199. 'D',
  11200. 'E',
  11201. 'F',
  11202. 'G',
  11203. 'H',
  11204. 'I',
  11205. 'J',
  11206. 'K',
  11207. 'L',
  11208. 'M',
  11209. 'N',
  11210. 'O',
  11211. 'P',
  11212. 'Q',
  11213. 'R',
  11214. 'S',
  11215. 'T',
  11216. 'U',
  11217. 'V',
  11218. 'W',
  11219. 'X',
  11220. 'Y',
  11221. 'Z',
  11222. 'bracketleft',
  11223. 'backslash',
  11224. 'bracketright',
  11225. 'asciicircum',
  11226. 'underscore',
  11227. 'grave',
  11228. 'a',
  11229. 'b',
  11230. 'c',
  11231. 'd',
  11232. 'e',
  11233. 'f',
  11234. 'g',
  11235. 'h',
  11236. 'i',
  11237. 'j',
  11238. 'k',
  11239. 'l',
  11240. 'm',
  11241. 'n',
  11242. 'o',
  11243. 'p',
  11244. 'q',
  11245. 'r',
  11246. 's',
  11247. 't',
  11248. 'u',
  11249. 'v',
  11250. 'w',
  11251. 'x',
  11252. 'y',
  11253. 'z',
  11254. 'braceleft',
  11255. 'bar',
  11256. 'braceright',
  11257. 'asciitilde',
  11258. 'bullet',
  11259. 'Euro',
  11260. 'bullet',
  11261. 'quotesinglbase',
  11262. 'florin',
  11263. 'quotedblbase',
  11264. 'ellipsis',
  11265. 'dagger',
  11266. 'daggerdbl',
  11267. 'circumflex',
  11268. 'perthousand',
  11269. 'Scaron',
  11270. 'guilsinglleft',
  11271. 'OE',
  11272. 'bullet',
  11273. 'Zcaron',
  11274. 'bullet',
  11275. 'bullet',
  11276. 'quoteleft',
  11277. 'quoteright',
  11278. 'quotedblleft',
  11279. 'quotedblright',
  11280. 'bullet',
  11281. 'endash',
  11282. 'emdash',
  11283. 'tilde',
  11284. 'trademark',
  11285. 'scaron',
  11286. 'guilsinglright',
  11287. 'oe',
  11288. 'bullet',
  11289. 'zcaron',
  11290. 'Ydieresis',
  11291. 'space',
  11292. 'exclamdown',
  11293. 'cent',
  11294. 'sterling',
  11295. 'currency',
  11296. 'yen',
  11297. 'brokenbar',
  11298. 'section',
  11299. 'dieresis',
  11300. 'copyright',
  11301. 'ordfeminine',
  11302. 'guillemotleft',
  11303. 'logicalnot',
  11304. 'hyphen',
  11305. 'registered',
  11306. 'macron',
  11307. 'degree',
  11308. 'plusminus',
  11309. 'twosuperior',
  11310. 'threesuperior',
  11311. 'acute',
  11312. 'mu',
  11313. 'paragraph',
  11314. 'periodcentered',
  11315. 'cedilla',
  11316. 'onesuperior',
  11317. 'ordmasculine',
  11318. 'guillemotright',
  11319. 'onequarter',
  11320. 'onehalf',
  11321. 'threequarters',
  11322. 'questiondown',
  11323. 'Agrave',
  11324. 'Aacute',
  11325. 'Acircumflex',
  11326. 'Atilde',
  11327. 'Adieresis',
  11328. 'Aring',
  11329. 'AE',
  11330. 'Ccedilla',
  11331. 'Egrave',
  11332. 'Eacute',
  11333. 'Ecircumflex',
  11334. 'Edieresis',
  11335. 'Igrave',
  11336. 'Iacute',
  11337. 'Icircumflex',
  11338. 'Idieresis',
  11339. 'Eth',
  11340. 'Ntilde',
  11341. 'Ograve',
  11342. 'Oacute',
  11343. 'Ocircumflex',
  11344. 'Otilde',
  11345. 'Odieresis',
  11346. 'multiply',
  11347. 'Oslash',
  11348. 'Ugrave',
  11349. 'Uacute',
  11350. 'Ucircumflex',
  11351. 'Udieresis',
  11352. 'Yacute',
  11353. 'Thorn',
  11354. 'germandbls',
  11355. 'agrave',
  11356. 'aacute',
  11357. 'acircumflex',
  11358. 'atilde',
  11359. 'adieresis',
  11360. 'aring',
  11361. 'ae',
  11362. 'ccedilla',
  11363. 'egrave',
  11364. 'eacute',
  11365. 'ecircumflex',
  11366. 'edieresis',
  11367. 'igrave',
  11368. 'iacute',
  11369. 'icircumflex',
  11370. 'idieresis',
  11371. 'eth',
  11372. 'ntilde',
  11373. 'ograve',
  11374. 'oacute',
  11375. 'ocircumflex',
  11376. 'otilde',
  11377. 'odieresis',
  11378. 'divide',
  11379. 'oslash',
  11380. 'ugrave',
  11381. 'uacute',
  11382. 'ucircumflex',
  11383. 'udieresis',
  11384. 'yacute',
  11385. 'thorn',
  11386. 'ydieresis'
  11387. ];
  11388. var SymbolSetEncoding = [
  11389. '',
  11390. '',
  11391. '',
  11392. '',
  11393. '',
  11394. '',
  11395. '',
  11396. '',
  11397. '',
  11398. '',
  11399. '',
  11400. '',
  11401. '',
  11402. '',
  11403. '',
  11404. '',
  11405. '',
  11406. '',
  11407. '',
  11408. '',
  11409. '',
  11410. '',
  11411. '',
  11412. '',
  11413. '',
  11414. '',
  11415. '',
  11416. '',
  11417. '',
  11418. '',
  11419. '',
  11420. '',
  11421. 'space',
  11422. 'exclam',
  11423. 'universal',
  11424. 'numbersign',
  11425. 'existential',
  11426. 'percent',
  11427. 'ampersand',
  11428. 'suchthat',
  11429. 'parenleft',
  11430. 'parenright',
  11431. 'asteriskmath',
  11432. 'plus',
  11433. 'comma',
  11434. 'minus',
  11435. 'period',
  11436. 'slash',
  11437. 'zero',
  11438. 'one',
  11439. 'two',
  11440. 'three',
  11441. 'four',
  11442. 'five',
  11443. 'six',
  11444. 'seven',
  11445. 'eight',
  11446. 'nine',
  11447. 'colon',
  11448. 'semicolon',
  11449. 'less',
  11450. 'equal',
  11451. 'greater',
  11452. 'question',
  11453. 'congruent',
  11454. 'Alpha',
  11455. 'Beta',
  11456. 'Chi',
  11457. 'Delta',
  11458. 'Epsilon',
  11459. 'Phi',
  11460. 'Gamma',
  11461. 'Eta',
  11462. 'Iota',
  11463. 'theta1',
  11464. 'Kappa',
  11465. 'Lambda',
  11466. 'Mu',
  11467. 'Nu',
  11468. 'Omicron',
  11469. 'Pi',
  11470. 'Theta',
  11471. 'Rho',
  11472. 'Sigma',
  11473. 'Tau',
  11474. 'Upsilon',
  11475. 'sigma1',
  11476. 'Omega',
  11477. 'Xi',
  11478. 'Psi',
  11479. 'Zeta',
  11480. 'bracketleft',
  11481. 'therefore',
  11482. 'bracketright',
  11483. 'perpendicular',
  11484. 'underscore',
  11485. 'radicalex',
  11486. 'alpha',
  11487. 'beta',
  11488. 'chi',
  11489. 'delta',
  11490. 'epsilon',
  11491. 'phi',
  11492. 'gamma',
  11493. 'eta',
  11494. 'iota',
  11495. 'phi1',
  11496. 'kappa',
  11497. 'lambda',
  11498. 'mu',
  11499. 'nu',
  11500. 'omicron',
  11501. 'pi',
  11502. 'theta',
  11503. 'rho',
  11504. 'sigma',
  11505. 'tau',
  11506. 'upsilon',
  11507. 'omega1',
  11508. 'omega',
  11509. 'xi',
  11510. 'psi',
  11511. 'zeta',
  11512. 'braceleft',
  11513. 'bar',
  11514. 'braceright',
  11515. 'similar',
  11516. '',
  11517. '',
  11518. '',
  11519. '',
  11520. '',
  11521. '',
  11522. '',
  11523. '',
  11524. '',
  11525. '',
  11526. '',
  11527. '',
  11528. '',
  11529. '',
  11530. '',
  11531. '',
  11532. '',
  11533. '',
  11534. '',
  11535. '',
  11536. '',
  11537. '',
  11538. '',
  11539. '',
  11540. '',
  11541. '',
  11542. '',
  11543. '',
  11544. '',
  11545. '',
  11546. '',
  11547. '',
  11548. '',
  11549. 'Euro',
  11550. 'Upsilon1',
  11551. 'minute',
  11552. 'lessequal',
  11553. 'fraction',
  11554. 'infinity',
  11555. 'florin',
  11556. 'club',
  11557. 'diamond',
  11558. 'heart',
  11559. 'spade',
  11560. 'arrowboth',
  11561. 'arrowleft',
  11562. 'arrowup',
  11563. 'arrowright',
  11564. 'arrowdown',
  11565. 'degree',
  11566. 'plusminus',
  11567. 'second',
  11568. 'greaterequal',
  11569. 'multiply',
  11570. 'proportional',
  11571. 'partialdiff',
  11572. 'bullet',
  11573. 'divide',
  11574. 'notequal',
  11575. 'equivalence',
  11576. 'approxequal',
  11577. 'ellipsis',
  11578. 'arrowvertex',
  11579. 'arrowhorizex',
  11580. 'carriagereturn',
  11581. 'aleph',
  11582. 'Ifraktur',
  11583. 'Rfraktur',
  11584. 'weierstrass',
  11585. 'circlemultiply',
  11586. 'circleplus',
  11587. 'emptyset',
  11588. 'intersection',
  11589. 'union',
  11590. 'propersuperset',
  11591. 'reflexsuperset',
  11592. 'notsubset',
  11593. 'propersubset',
  11594. 'reflexsubset',
  11595. 'element',
  11596. 'notelement',
  11597. 'angle',
  11598. 'gradient',
  11599. 'registerserif',
  11600. 'copyrightserif',
  11601. 'trademarkserif',
  11602. 'product',
  11603. 'radical',
  11604. 'dotmath',
  11605. 'logicalnot',
  11606. 'logicaland',
  11607. 'logicalor',
  11608. 'arrowdblboth',
  11609. 'arrowdblleft',
  11610. 'arrowdblup',
  11611. 'arrowdblright',
  11612. 'arrowdbldown',
  11613. 'lozenge',
  11614. 'angleleft',
  11615. 'registersans',
  11616. 'copyrightsans',
  11617. 'trademarksans',
  11618. 'summation',
  11619. 'parenlefttp',
  11620. 'parenleftex',
  11621. 'parenleftbt',
  11622. 'bracketlefttp',
  11623. 'bracketleftex',
  11624. 'bracketleftbt',
  11625. 'bracelefttp',
  11626. 'braceleftmid',
  11627. 'braceleftbt',
  11628. 'braceex',
  11629. '',
  11630. 'angleright',
  11631. 'integral',
  11632. 'integraltp',
  11633. 'integralex',
  11634. 'integralbt',
  11635. 'parenrighttp',
  11636. 'parenrightex',
  11637. 'parenrightbt',
  11638. 'bracketrighttp',
  11639. 'bracketrightex',
  11640. 'bracketrightbt',
  11641. 'bracerighttp',
  11642. 'bracerightmid',
  11643. 'bracerightbt'
  11644. ];
  11645. var ZapfDingbatsEncoding = [
  11646. '',
  11647. '',
  11648. '',
  11649. '',
  11650. '',
  11651. '',
  11652. '',
  11653. '',
  11654. '',
  11655. '',
  11656. '',
  11657. '',
  11658. '',
  11659. '',
  11660. '',
  11661. '',
  11662. '',
  11663. '',
  11664. '',
  11665. '',
  11666. '',
  11667. '',
  11668. '',
  11669. '',
  11670. '',
  11671. '',
  11672. '',
  11673. '',
  11674. '',
  11675. '',
  11676. '',
  11677. '',
  11678. 'space',
  11679. 'a1',
  11680. 'a2',
  11681. 'a202',
  11682. 'a3',
  11683. 'a4',
  11684. 'a5',
  11685. 'a119',
  11686. 'a118',
  11687. 'a117',
  11688. 'a11',
  11689. 'a12',
  11690. 'a13',
  11691. 'a14',
  11692. 'a15',
  11693. 'a16',
  11694. 'a105',
  11695. 'a17',
  11696. 'a18',
  11697. 'a19',
  11698. 'a20',
  11699. 'a21',
  11700. 'a22',
  11701. 'a23',
  11702. 'a24',
  11703. 'a25',
  11704. 'a26',
  11705. 'a27',
  11706. 'a28',
  11707. 'a6',
  11708. 'a7',
  11709. 'a8',
  11710. 'a9',
  11711. 'a10',
  11712. 'a29',
  11713. 'a30',
  11714. 'a31',
  11715. 'a32',
  11716. 'a33',
  11717. 'a34',
  11718. 'a35',
  11719. 'a36',
  11720. 'a37',
  11721. 'a38',
  11722. 'a39',
  11723. 'a40',
  11724. 'a41',
  11725. 'a42',
  11726. 'a43',
  11727. 'a44',
  11728. 'a45',
  11729. 'a46',
  11730. 'a47',
  11731. 'a48',
  11732. 'a49',
  11733. 'a50',
  11734. 'a51',
  11735. 'a52',
  11736. 'a53',
  11737. 'a54',
  11738. 'a55',
  11739. 'a56',
  11740. 'a57',
  11741. 'a58',
  11742. 'a59',
  11743. 'a60',
  11744. 'a61',
  11745. 'a62',
  11746. 'a63',
  11747. 'a64',
  11748. 'a65',
  11749. 'a66',
  11750. 'a67',
  11751. 'a68',
  11752. 'a69',
  11753. 'a70',
  11754. 'a71',
  11755. 'a72',
  11756. 'a73',
  11757. 'a74',
  11758. 'a203',
  11759. 'a75',
  11760. 'a204',
  11761. 'a76',
  11762. 'a77',
  11763. 'a78',
  11764. 'a79',
  11765. 'a81',
  11766. 'a82',
  11767. 'a83',
  11768. 'a84',
  11769. 'a97',
  11770. 'a98',
  11771. 'a99',
  11772. 'a100',
  11773. '',
  11774. 'a89',
  11775. 'a90',
  11776. 'a93',
  11777. 'a94',
  11778. 'a91',
  11779. 'a92',
  11780. 'a205',
  11781. 'a85',
  11782. 'a206',
  11783. 'a86',
  11784. 'a87',
  11785. 'a88',
  11786. 'a95',
  11787. 'a96',
  11788. '',
  11789. '',
  11790. '',
  11791. '',
  11792. '',
  11793. '',
  11794. '',
  11795. '',
  11796. '',
  11797. '',
  11798. '',
  11799. '',
  11800. '',
  11801. '',
  11802. '',
  11803. '',
  11804. '',
  11805. '',
  11806. '',
  11807. 'a101',
  11808. 'a102',
  11809. 'a103',
  11810. 'a104',
  11811. 'a106',
  11812. 'a107',
  11813. 'a108',
  11814. 'a112',
  11815. 'a111',
  11816. 'a110',
  11817. 'a109',
  11818. 'a120',
  11819. 'a121',
  11820. 'a122',
  11821. 'a123',
  11822. 'a124',
  11823. 'a125',
  11824. 'a126',
  11825. 'a127',
  11826. 'a128',
  11827. 'a129',
  11828. 'a130',
  11829. 'a131',
  11830. 'a132',
  11831. 'a133',
  11832. 'a134',
  11833. 'a135',
  11834. 'a136',
  11835. 'a137',
  11836. 'a138',
  11837. 'a139',
  11838. 'a140',
  11839. 'a141',
  11840. 'a142',
  11841. 'a143',
  11842. 'a144',
  11843. 'a145',
  11844. 'a146',
  11845. 'a147',
  11846. 'a148',
  11847. 'a149',
  11848. 'a150',
  11849. 'a151',
  11850. 'a152',
  11851. 'a153',
  11852. 'a154',
  11853. 'a155',
  11854. 'a156',
  11855. 'a157',
  11856. 'a158',
  11857. 'a159',
  11858. 'a160',
  11859. 'a161',
  11860. 'a163',
  11861. 'a164',
  11862. 'a196',
  11863. 'a165',
  11864. 'a192',
  11865. 'a166',
  11866. 'a167',
  11867. 'a168',
  11868. 'a169',
  11869. 'a170',
  11870. 'a171',
  11871. 'a172',
  11872. 'a173',
  11873. 'a162',
  11874. 'a174',
  11875. 'a175',
  11876. 'a176',
  11877. 'a177',
  11878. 'a178',
  11879. 'a179',
  11880. 'a193',
  11881. 'a180',
  11882. 'a199',
  11883. 'a181',
  11884. 'a200',
  11885. 'a182',
  11886. '',
  11887. 'a201',
  11888. 'a183',
  11889. 'a184',
  11890. 'a197',
  11891. 'a185',
  11892. 'a194',
  11893. 'a198',
  11894. 'a186',
  11895. 'a195',
  11896. 'a187',
  11897. 'a188',
  11898. 'a189',
  11899. 'a190',
  11900. 'a191'
  11901. ];
  11902. function getEncoding(encodingName) {
  11903. switch (encodingName) {
  11904. case 'WinAnsiEncoding':
  11905. return WinAnsiEncoding;
  11906. case 'StandardEncoding':
  11907. return StandardEncoding;
  11908. case 'MacRomanEncoding':
  11909. return MacRomanEncoding;
  11910. case 'SymbolSetEncoding':
  11911. return SymbolSetEncoding;
  11912. case 'ZapfDingbatsEncoding':
  11913. return ZapfDingbatsEncoding;
  11914. case 'ExpertEncoding':
  11915. return ExpertEncoding;
  11916. case 'MacExpertEncoding':
  11917. return MacExpertEncoding;
  11918. default:
  11919. return null;
  11920. }
  11921. }
  11922. exports.WinAnsiEncoding = WinAnsiEncoding;
  11923. exports.StandardEncoding = StandardEncoding;
  11924. exports.MacRomanEncoding = MacRomanEncoding;
  11925. exports.SymbolSetEncoding = SymbolSetEncoding;
  11926. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11927. exports.ExpertEncoding = ExpertEncoding;
  11928. exports.getEncoding = getEncoding;
  11929. /***/ }),
  11930. /* 5 */
  11931. /***/ (function(module, exports, __w_pdfjs_require__) {
  11932. "use strict";
  11933. var sharedUtil = __w_pdfjs_require__(0);
  11934. var corePrimitives = __w_pdfjs_require__(1);
  11935. var coreStream = __w_pdfjs_require__(2);
  11936. var MissingDataException = sharedUtil.MissingDataException;
  11937. var StreamType = sharedUtil.StreamType;
  11938. var assert = sharedUtil.assert;
  11939. var error = sharedUtil.error;
  11940. var info = sharedUtil.info;
  11941. var isArray = sharedUtil.isArray;
  11942. var isInt = sharedUtil.isInt;
  11943. var isNum = sharedUtil.isNum;
  11944. var isString = sharedUtil.isString;
  11945. var warn = sharedUtil.warn;
  11946. var EOF = corePrimitives.EOF;
  11947. var Cmd = corePrimitives.Cmd;
  11948. var Dict = corePrimitives.Dict;
  11949. var Name = corePrimitives.Name;
  11950. var Ref = corePrimitives.Ref;
  11951. var isEOF = corePrimitives.isEOF;
  11952. var isCmd = corePrimitives.isCmd;
  11953. var isDict = corePrimitives.isDict;
  11954. var isName = corePrimitives.isName;
  11955. var Ascii85Stream = coreStream.Ascii85Stream;
  11956. var AsciiHexStream = coreStream.AsciiHexStream;
  11957. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11958. var FlateStream = coreStream.FlateStream;
  11959. var Jbig2Stream = coreStream.Jbig2Stream;
  11960. var JpegStream = coreStream.JpegStream;
  11961. var JpxStream = coreStream.JpxStream;
  11962. var LZWStream = coreStream.LZWStream;
  11963. var NullStream = coreStream.NullStream;
  11964. var PredictorStream = coreStream.PredictorStream;
  11965. var RunLengthStream = coreStream.RunLengthStream;
  11966. var MAX_LENGTH_TO_CACHE = 1000;
  11967. var Parser = function ParserClosure() {
  11968. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11969. this.lexer = lexer;
  11970. this.allowStreams = allowStreams;
  11971. this.xref = xref;
  11972. this.recoveryMode = recoveryMode || false;
  11973. this.imageCache = Object.create(null);
  11974. this.refill();
  11975. }
  11976. Parser.prototype = {
  11977. refill: function Parser_refill() {
  11978. this.buf1 = this.lexer.getObj();
  11979. this.buf2 = this.lexer.getObj();
  11980. },
  11981. shift: function Parser_shift() {
  11982. if (isCmd(this.buf2, 'ID')) {
  11983. this.buf1 = this.buf2;
  11984. this.buf2 = null;
  11985. } else {
  11986. this.buf1 = this.buf2;
  11987. this.buf2 = this.lexer.getObj();
  11988. }
  11989. },
  11990. tryShift: function Parser_tryShift() {
  11991. try {
  11992. this.shift();
  11993. return true;
  11994. } catch (e) {
  11995. if (e instanceof MissingDataException) {
  11996. throw e;
  11997. }
  11998. return false;
  11999. }
  12000. },
  12001. getObj: function Parser_getObj(cipherTransform) {
  12002. var buf1 = this.buf1;
  12003. this.shift();
  12004. if (buf1 instanceof Cmd) {
  12005. switch (buf1.cmd) {
  12006. case 'BI':
  12007. return this.makeInlineImage(cipherTransform);
  12008. case '[':
  12009. var array = [];
  12010. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  12011. array.push(this.getObj(cipherTransform));
  12012. }
  12013. if (isEOF(this.buf1)) {
  12014. if (!this.recoveryMode) {
  12015. error('End of file inside array');
  12016. }
  12017. return array;
  12018. }
  12019. this.shift();
  12020. return array;
  12021. case '<<':
  12022. var dict = new Dict(this.xref);
  12023. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  12024. if (!isName(this.buf1)) {
  12025. info('Malformed dictionary: key must be a name object');
  12026. this.shift();
  12027. continue;
  12028. }
  12029. var key = this.buf1.name;
  12030. this.shift();
  12031. if (isEOF(this.buf1)) {
  12032. break;
  12033. }
  12034. dict.set(key, this.getObj(cipherTransform));
  12035. }
  12036. if (isEOF(this.buf1)) {
  12037. if (!this.recoveryMode) {
  12038. error('End of file inside dictionary');
  12039. }
  12040. return dict;
  12041. }
  12042. if (isCmd(this.buf2, 'stream')) {
  12043. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12044. }
  12045. this.shift();
  12046. return dict;
  12047. default:
  12048. return buf1;
  12049. }
  12050. }
  12051. if (isInt(buf1)) {
  12052. var num = buf1;
  12053. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  12054. var ref = new Ref(num, this.buf1);
  12055. this.shift();
  12056. this.shift();
  12057. return ref;
  12058. }
  12059. return num;
  12060. }
  12061. if (isString(buf1)) {
  12062. var str = buf1;
  12063. if (cipherTransform) {
  12064. str = cipherTransform.decryptString(str);
  12065. }
  12066. return str;
  12067. }
  12068. return buf1;
  12069. },
  12070. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  12071. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  12072. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  12073. while ((ch = stream.getByte()) !== -1) {
  12074. if (state === 0) {
  12075. state = ch === E ? 1 : 0;
  12076. } else if (state === 1) {
  12077. state = ch === I ? 2 : 0;
  12078. } else {
  12079. assert(state === 2);
  12080. if (ch === SPACE || ch === LF || ch === CR) {
  12081. n = 5;
  12082. followingBytes = stream.peekBytes(n);
  12083. for (i = 0; i < n; i++) {
  12084. ch = followingBytes[i];
  12085. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  12086. state = 0;
  12087. break;
  12088. }
  12089. }
  12090. if (state === 2) {
  12091. break;
  12092. }
  12093. } else {
  12094. state = 0;
  12095. }
  12096. }
  12097. }
  12098. return stream.pos - 4 - startPos;
  12099. },
  12100. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  12101. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  12102. while ((b = stream.getByte()) !== -1) {
  12103. if (b !== 0xFF) {
  12104. continue;
  12105. }
  12106. switch (stream.getByte()) {
  12107. case 0x00:
  12108. break;
  12109. case 0xFF:
  12110. stream.skip(-1);
  12111. break;
  12112. case 0xD9:
  12113. foundEOI = true;
  12114. break;
  12115. case 0xC0:
  12116. case 0xC1:
  12117. case 0xC2:
  12118. case 0xC3:
  12119. case 0xC5:
  12120. case 0xC6:
  12121. case 0xC7:
  12122. case 0xC9:
  12123. case 0xCA:
  12124. case 0xCB:
  12125. case 0xCD:
  12126. case 0xCE:
  12127. case 0xCF:
  12128. case 0xC4:
  12129. case 0xCC:
  12130. case 0xDA:
  12131. case 0xDB:
  12132. case 0xDC:
  12133. case 0xDD:
  12134. case 0xDE:
  12135. case 0xDF:
  12136. case 0xE0:
  12137. case 0xE1:
  12138. case 0xE2:
  12139. case 0xE3:
  12140. case 0xE4:
  12141. case 0xE5:
  12142. case 0xE6:
  12143. case 0xE7:
  12144. case 0xE8:
  12145. case 0xE9:
  12146. case 0xEA:
  12147. case 0xEB:
  12148. case 0xEC:
  12149. case 0xED:
  12150. case 0xEE:
  12151. case 0xEF:
  12152. case 0xFE:
  12153. markerLength = stream.getUint16();
  12154. if (markerLength > 2) {
  12155. stream.skip(markerLength - 2);
  12156. } else {
  12157. stream.skip(-2);
  12158. }
  12159. break;
  12160. }
  12161. if (foundEOI) {
  12162. break;
  12163. }
  12164. }
  12165. length = stream.pos - startPos;
  12166. if (b === -1) {
  12167. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  12168. stream.skip(-length);
  12169. return this.findDefaultInlineStreamEnd(stream);
  12170. }
  12171. this.inlineStreamSkipEI(stream);
  12172. return length;
  12173. },
  12174. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  12175. var TILDE = 0x7E, GT = 0x3E;
  12176. var startPos = stream.pos, ch, length;
  12177. while ((ch = stream.getByte()) !== -1) {
  12178. if (ch === TILDE && stream.peekByte() === GT) {
  12179. stream.skip();
  12180. break;
  12181. }
  12182. }
  12183. length = stream.pos - startPos;
  12184. if (ch === -1) {
  12185. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12186. stream.skip(-length);
  12187. return this.findDefaultInlineStreamEnd(stream);
  12188. }
  12189. this.inlineStreamSkipEI(stream);
  12190. return length;
  12191. },
  12192. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  12193. var GT = 0x3E;
  12194. var startPos = stream.pos, ch, length;
  12195. while ((ch = stream.getByte()) !== -1) {
  12196. if (ch === GT) {
  12197. break;
  12198. }
  12199. }
  12200. length = stream.pos - startPos;
  12201. if (ch === -1) {
  12202. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12203. stream.skip(-length);
  12204. return this.findDefaultInlineStreamEnd(stream);
  12205. }
  12206. this.inlineStreamSkipEI(stream);
  12207. return length;
  12208. },
  12209. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  12210. var E = 0x45, I = 0x49;
  12211. var state = 0, ch;
  12212. while ((ch = stream.getByte()) !== -1) {
  12213. if (state === 0) {
  12214. state = ch === E ? 1 : 0;
  12215. } else if (state === 1) {
  12216. state = ch === I ? 2 : 0;
  12217. } else if (state === 2) {
  12218. break;
  12219. }
  12220. }
  12221. },
  12222. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  12223. var lexer = this.lexer;
  12224. var stream = lexer.stream;
  12225. var dict = new Dict(this.xref);
  12226. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  12227. if (!isName(this.buf1)) {
  12228. error('Dictionary key must be a name object');
  12229. }
  12230. var key = this.buf1.name;
  12231. this.shift();
  12232. if (isEOF(this.buf1)) {
  12233. break;
  12234. }
  12235. dict.set(key, this.getObj(cipherTransform));
  12236. }
  12237. var filter = dict.get('Filter', 'F'), filterName;
  12238. if (isName(filter)) {
  12239. filterName = filter.name;
  12240. } else if (isArray(filter)) {
  12241. var filterZero = this.xref.fetchIfRef(filter[0]);
  12242. if (isName(filterZero)) {
  12243. filterName = filterZero.name;
  12244. }
  12245. }
  12246. var startPos = stream.pos, length, i, ii;
  12247. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  12248. length = this.findDCTDecodeInlineStreamEnd(stream);
  12249. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  12250. length = this.findASCII85DecodeInlineStreamEnd(stream);
  12251. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  12252. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  12253. } else {
  12254. length = this.findDefaultInlineStreamEnd(stream);
  12255. }
  12256. var imageStream = stream.makeSubStream(startPos, length, dict);
  12257. var adler32;
  12258. if (length < MAX_LENGTH_TO_CACHE) {
  12259. var imageBytes = imageStream.getBytes();
  12260. imageStream.reset();
  12261. var a = 1;
  12262. var b = 0;
  12263. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  12264. a += imageBytes[i] & 0xff;
  12265. b += a;
  12266. }
  12267. adler32 = b % 65521 << 16 | a % 65521;
  12268. if (this.imageCache.adler32 === adler32) {
  12269. this.buf2 = Cmd.get('EI');
  12270. this.shift();
  12271. this.imageCache[adler32].reset();
  12272. return this.imageCache[adler32];
  12273. }
  12274. }
  12275. if (cipherTransform) {
  12276. imageStream = cipherTransform.createStream(imageStream, length);
  12277. }
  12278. imageStream = this.filter(imageStream, dict, length);
  12279. imageStream.dict = dict;
  12280. if (adler32 !== undefined) {
  12281. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  12282. this.imageCache[adler32] = imageStream;
  12283. }
  12284. this.buf2 = Cmd.get('EI');
  12285. this.shift();
  12286. return imageStream;
  12287. },
  12288. makeStream: function Parser_makeStream(dict, cipherTransform) {
  12289. var lexer = this.lexer;
  12290. var stream = lexer.stream;
  12291. lexer.skipToNextLine();
  12292. var pos = stream.pos - 1;
  12293. var length = dict.get('Length');
  12294. if (!isInt(length)) {
  12295. info('Bad ' + length + ' attribute in stream');
  12296. length = 0;
  12297. }
  12298. stream.pos = pos + length;
  12299. lexer.nextChar();
  12300. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  12301. this.shift();
  12302. } else {
  12303. stream.pos = pos;
  12304. var SCAN_BLOCK_SIZE = 2048;
  12305. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  12306. var ENDSTREAM_SIGNATURE = [
  12307. 0x65,
  12308. 0x6E,
  12309. 0x64,
  12310. 0x73,
  12311. 0x74,
  12312. 0x72,
  12313. 0x65,
  12314. 0x61,
  12315. 0x6D
  12316. ];
  12317. var skipped = 0, found = false, i, j;
  12318. while (stream.pos < stream.end) {
  12319. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  12320. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  12321. if (scanLength <= 0) {
  12322. break;
  12323. }
  12324. found = false;
  12325. i = 0;
  12326. while (i < scanLength) {
  12327. j = 0;
  12328. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  12329. j++;
  12330. }
  12331. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  12332. found = true;
  12333. break;
  12334. }
  12335. i++;
  12336. }
  12337. if (found) {
  12338. skipped += i;
  12339. stream.pos += i;
  12340. break;
  12341. }
  12342. skipped += scanLength;
  12343. stream.pos += scanLength;
  12344. }
  12345. if (!found) {
  12346. error('Missing endstream');
  12347. }
  12348. length = skipped;
  12349. lexer.nextChar();
  12350. this.shift();
  12351. this.shift();
  12352. }
  12353. this.shift();
  12354. stream = stream.makeSubStream(pos, length, dict);
  12355. if (cipherTransform) {
  12356. stream = cipherTransform.createStream(stream, length);
  12357. }
  12358. stream = this.filter(stream, dict, length);
  12359. stream.dict = dict;
  12360. return stream;
  12361. },
  12362. filter: function Parser_filter(stream, dict, length) {
  12363. var filter = dict.get('Filter', 'F');
  12364. var params = dict.get('DecodeParms', 'DP');
  12365. if (isName(filter)) {
  12366. if (isArray(params)) {
  12367. params = this.xref.fetchIfRef(params[0]);
  12368. }
  12369. return this.makeFilter(stream, filter.name, length, params);
  12370. }
  12371. var maybeLength = length;
  12372. if (isArray(filter)) {
  12373. var filterArray = filter;
  12374. var paramsArray = params;
  12375. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  12376. filter = this.xref.fetchIfRef(filterArray[i]);
  12377. if (!isName(filter)) {
  12378. error('Bad filter name: ' + filter);
  12379. }
  12380. params = null;
  12381. if (isArray(paramsArray) && i in paramsArray) {
  12382. params = this.xref.fetchIfRef(paramsArray[i]);
  12383. }
  12384. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  12385. maybeLength = null;
  12386. }
  12387. }
  12388. return stream;
  12389. },
  12390. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  12391. if (maybeLength === 0) {
  12392. warn('Empty "' + name + '" stream.');
  12393. return new NullStream(stream);
  12394. }
  12395. try {
  12396. var xrefStreamStats = this.xref.stats.streamTypes;
  12397. if (name === 'FlateDecode' || name === 'Fl') {
  12398. xrefStreamStats[StreamType.FLATE] = true;
  12399. if (params) {
  12400. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  12401. }
  12402. return new FlateStream(stream, maybeLength);
  12403. }
  12404. if (name === 'LZWDecode' || name === 'LZW') {
  12405. xrefStreamStats[StreamType.LZW] = true;
  12406. var earlyChange = 1;
  12407. if (params) {
  12408. if (params.has('EarlyChange')) {
  12409. earlyChange = params.get('EarlyChange');
  12410. }
  12411. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  12412. }
  12413. return new LZWStream(stream, maybeLength, earlyChange);
  12414. }
  12415. if (name === 'DCTDecode' || name === 'DCT') {
  12416. xrefStreamStats[StreamType.DCT] = true;
  12417. return new JpegStream(stream, maybeLength, stream.dict, params);
  12418. }
  12419. if (name === 'JPXDecode' || name === 'JPX') {
  12420. xrefStreamStats[StreamType.JPX] = true;
  12421. return new JpxStream(stream, maybeLength, stream.dict, params);
  12422. }
  12423. if (name === 'ASCII85Decode' || name === 'A85') {
  12424. xrefStreamStats[StreamType.A85] = true;
  12425. return new Ascii85Stream(stream, maybeLength);
  12426. }
  12427. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  12428. xrefStreamStats[StreamType.AHX] = true;
  12429. return new AsciiHexStream(stream, maybeLength);
  12430. }
  12431. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  12432. xrefStreamStats[StreamType.CCF] = true;
  12433. return new CCITTFaxStream(stream, maybeLength, params);
  12434. }
  12435. if (name === 'RunLengthDecode' || name === 'RL') {
  12436. xrefStreamStats[StreamType.RL] = true;
  12437. return new RunLengthStream(stream, maybeLength);
  12438. }
  12439. if (name === 'JBIG2Decode') {
  12440. xrefStreamStats[StreamType.JBIG] = true;
  12441. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  12442. }
  12443. warn('filter "' + name + '" not supported yet');
  12444. return stream;
  12445. } catch (ex) {
  12446. if (ex instanceof MissingDataException) {
  12447. throw ex;
  12448. }
  12449. warn('Invalid stream: \"' + ex + '\"');
  12450. return new NullStream(stream);
  12451. }
  12452. }
  12453. };
  12454. return Parser;
  12455. }();
  12456. var Lexer = function LexerClosure() {
  12457. function Lexer(stream, knownCommands) {
  12458. this.stream = stream;
  12459. this.nextChar();
  12460. this.strBuf = [];
  12461. this.knownCommands = knownCommands;
  12462. }
  12463. var specialChars = [
  12464. 1,
  12465. 0,
  12466. 0,
  12467. 0,
  12468. 0,
  12469. 0,
  12470. 0,
  12471. 0,
  12472. 0,
  12473. 1,
  12474. 1,
  12475. 0,
  12476. 1,
  12477. 1,
  12478. 0,
  12479. 0,
  12480. 0,
  12481. 0,
  12482. 0,
  12483. 0,
  12484. 0,
  12485. 0,
  12486. 0,
  12487. 0,
  12488. 0,
  12489. 0,
  12490. 0,
  12491. 0,
  12492. 0,
  12493. 0,
  12494. 0,
  12495. 0,
  12496. 1,
  12497. 0,
  12498. 0,
  12499. 0,
  12500. 0,
  12501. 2,
  12502. 0,
  12503. 0,
  12504. 2,
  12505. 2,
  12506. 0,
  12507. 0,
  12508. 0,
  12509. 0,
  12510. 0,
  12511. 2,
  12512. 0,
  12513. 0,
  12514. 0,
  12515. 0,
  12516. 0,
  12517. 0,
  12518. 0,
  12519. 0,
  12520. 0,
  12521. 0,
  12522. 0,
  12523. 0,
  12524. 2,
  12525. 0,
  12526. 2,
  12527. 0,
  12528. 0,
  12529. 0,
  12530. 0,
  12531. 0,
  12532. 0,
  12533. 0,
  12534. 0,
  12535. 0,
  12536. 0,
  12537. 0,
  12538. 0,
  12539. 0,
  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. 2,
  12556. 0,
  12557. 2,
  12558. 0,
  12559. 0,
  12560. 0,
  12561. 0,
  12562. 0,
  12563. 0,
  12564. 0,
  12565. 0,
  12566. 0,
  12567. 0,
  12568. 0,
  12569. 0,
  12570. 0,
  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. 2,
  12588. 0,
  12589. 2,
  12590. 0,
  12591. 0,
  12592. 0,
  12593. 0,
  12594. 0,
  12595. 0,
  12596. 0,
  12597. 0,
  12598. 0,
  12599. 0,
  12600. 0,
  12601. 0,
  12602. 0,
  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. ];
  12721. function toHexDigit(ch) {
  12722. if (ch >= 0x30 && ch <= 0x39) {
  12723. return ch & 0x0F;
  12724. }
  12725. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  12726. return (ch & 0x0F) + 9;
  12727. }
  12728. return -1;
  12729. }
  12730. Lexer.prototype = {
  12731. nextChar: function Lexer_nextChar() {
  12732. return this.currentChar = this.stream.getByte();
  12733. },
  12734. peekChar: function Lexer_peekChar() {
  12735. return this.stream.peekByte();
  12736. },
  12737. getNumber: function Lexer_getNumber() {
  12738. var ch = this.currentChar;
  12739. var eNotation = false;
  12740. var divideBy = 0;
  12741. var sign = 1;
  12742. if (ch === 0x2D) {
  12743. sign = -1;
  12744. ch = this.nextChar();
  12745. if (ch === 0x2D) {
  12746. ch = this.nextChar();
  12747. }
  12748. } else if (ch === 0x2B) {
  12749. ch = this.nextChar();
  12750. }
  12751. if (ch === 0x2E) {
  12752. divideBy = 10;
  12753. ch = this.nextChar();
  12754. }
  12755. if (ch < 0x30 || ch > 0x39) {
  12756. error('Invalid number: ' + String.fromCharCode(ch));
  12757. return 0;
  12758. }
  12759. var baseValue = ch - 0x30;
  12760. var powerValue = 0;
  12761. var powerValueSign = 1;
  12762. while ((ch = this.nextChar()) >= 0) {
  12763. if (0x30 <= ch && ch <= 0x39) {
  12764. var currentDigit = ch - 0x30;
  12765. if (eNotation) {
  12766. powerValue = powerValue * 10 + currentDigit;
  12767. } else {
  12768. if (divideBy !== 0) {
  12769. divideBy *= 10;
  12770. }
  12771. baseValue = baseValue * 10 + currentDigit;
  12772. }
  12773. } else if (ch === 0x2E) {
  12774. if (divideBy === 0) {
  12775. divideBy = 1;
  12776. } else {
  12777. break;
  12778. }
  12779. } else if (ch === 0x2D) {
  12780. warn('Badly formatted number');
  12781. } else if (ch === 0x45 || ch === 0x65) {
  12782. ch = this.peekChar();
  12783. if (ch === 0x2B || ch === 0x2D) {
  12784. powerValueSign = ch === 0x2D ? -1 : 1;
  12785. this.nextChar();
  12786. } else if (ch < 0x30 || ch > 0x39) {
  12787. break;
  12788. }
  12789. eNotation = true;
  12790. } else {
  12791. break;
  12792. }
  12793. }
  12794. if (divideBy !== 0) {
  12795. baseValue /= divideBy;
  12796. }
  12797. if (eNotation) {
  12798. baseValue *= Math.pow(10, powerValueSign * powerValue);
  12799. }
  12800. return sign * baseValue;
  12801. },
  12802. getString: function Lexer_getString() {
  12803. var numParen = 1;
  12804. var done = false;
  12805. var strBuf = this.strBuf;
  12806. strBuf.length = 0;
  12807. var ch = this.nextChar();
  12808. while (true) {
  12809. var charBuffered = false;
  12810. switch (ch | 0) {
  12811. case -1:
  12812. warn('Unterminated string');
  12813. done = true;
  12814. break;
  12815. case 0x28:
  12816. ++numParen;
  12817. strBuf.push('(');
  12818. break;
  12819. case 0x29:
  12820. if (--numParen === 0) {
  12821. this.nextChar();
  12822. done = true;
  12823. } else {
  12824. strBuf.push(')');
  12825. }
  12826. break;
  12827. case 0x5C:
  12828. ch = this.nextChar();
  12829. switch (ch) {
  12830. case -1:
  12831. warn('Unterminated string');
  12832. done = true;
  12833. break;
  12834. case 0x6E:
  12835. strBuf.push('\n');
  12836. break;
  12837. case 0x72:
  12838. strBuf.push('\r');
  12839. break;
  12840. case 0x74:
  12841. strBuf.push('\t');
  12842. break;
  12843. case 0x62:
  12844. strBuf.push('\b');
  12845. break;
  12846. case 0x66:
  12847. strBuf.push('\f');
  12848. break;
  12849. case 0x5C:
  12850. case 0x28:
  12851. case 0x29:
  12852. strBuf.push(String.fromCharCode(ch));
  12853. break;
  12854. case 0x30:
  12855. case 0x31:
  12856. case 0x32:
  12857. case 0x33:
  12858. case 0x34:
  12859. case 0x35:
  12860. case 0x36:
  12861. case 0x37:
  12862. var x = ch & 0x0F;
  12863. ch = this.nextChar();
  12864. charBuffered = true;
  12865. if (ch >= 0x30 && ch <= 0x37) {
  12866. x = (x << 3) + (ch & 0x0F);
  12867. ch = this.nextChar();
  12868. if (ch >= 0x30 && ch <= 0x37) {
  12869. charBuffered = false;
  12870. x = (x << 3) + (ch & 0x0F);
  12871. }
  12872. }
  12873. strBuf.push(String.fromCharCode(x));
  12874. break;
  12875. case 0x0D:
  12876. if (this.peekChar() === 0x0A) {
  12877. this.nextChar();
  12878. }
  12879. break;
  12880. case 0x0A:
  12881. break;
  12882. default:
  12883. strBuf.push(String.fromCharCode(ch));
  12884. break;
  12885. }
  12886. break;
  12887. default:
  12888. strBuf.push(String.fromCharCode(ch));
  12889. break;
  12890. }
  12891. if (done) {
  12892. break;
  12893. }
  12894. if (!charBuffered) {
  12895. ch = this.nextChar();
  12896. }
  12897. }
  12898. return strBuf.join('');
  12899. },
  12900. getName: function Lexer_getName() {
  12901. var ch, previousCh;
  12902. var strBuf = this.strBuf;
  12903. strBuf.length = 0;
  12904. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12905. if (ch === 0x23) {
  12906. ch = this.nextChar();
  12907. if (specialChars[ch]) {
  12908. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12909. strBuf.push('#');
  12910. break;
  12911. }
  12912. var x = toHexDigit(ch);
  12913. if (x !== -1) {
  12914. previousCh = ch;
  12915. ch = this.nextChar();
  12916. var x2 = toHexDigit(ch);
  12917. if (x2 === -1) {
  12918. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12919. strBuf.push('#', String.fromCharCode(previousCh));
  12920. if (specialChars[ch]) {
  12921. break;
  12922. }
  12923. strBuf.push(String.fromCharCode(ch));
  12924. continue;
  12925. }
  12926. strBuf.push(String.fromCharCode(x << 4 | x2));
  12927. } else {
  12928. strBuf.push('#', String.fromCharCode(ch));
  12929. }
  12930. } else {
  12931. strBuf.push(String.fromCharCode(ch));
  12932. }
  12933. }
  12934. if (strBuf.length > 127) {
  12935. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12936. }
  12937. return Name.get(strBuf.join(''));
  12938. },
  12939. getHexString: function Lexer_getHexString() {
  12940. var strBuf = this.strBuf;
  12941. strBuf.length = 0;
  12942. var ch = this.currentChar;
  12943. var isFirstHex = true;
  12944. var firstDigit;
  12945. var secondDigit;
  12946. while (true) {
  12947. if (ch < 0) {
  12948. warn('Unterminated hex string');
  12949. break;
  12950. } else if (ch === 0x3E) {
  12951. this.nextChar();
  12952. break;
  12953. } else if (specialChars[ch] === 1) {
  12954. ch = this.nextChar();
  12955. continue;
  12956. } else {
  12957. if (isFirstHex) {
  12958. firstDigit = toHexDigit(ch);
  12959. if (firstDigit === -1) {
  12960. warn('Ignoring invalid character "' + ch + '" in hex string');
  12961. ch = this.nextChar();
  12962. continue;
  12963. }
  12964. } else {
  12965. secondDigit = toHexDigit(ch);
  12966. if (secondDigit === -1) {
  12967. warn('Ignoring invalid character "' + ch + '" in hex string');
  12968. ch = this.nextChar();
  12969. continue;
  12970. }
  12971. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12972. }
  12973. isFirstHex = !isFirstHex;
  12974. ch = this.nextChar();
  12975. }
  12976. }
  12977. return strBuf.join('');
  12978. },
  12979. getObj: function Lexer_getObj() {
  12980. var comment = false;
  12981. var ch = this.currentChar;
  12982. while (true) {
  12983. if (ch < 0) {
  12984. return EOF;
  12985. }
  12986. if (comment) {
  12987. if (ch === 0x0A || ch === 0x0D) {
  12988. comment = false;
  12989. }
  12990. } else if (ch === 0x25) {
  12991. comment = true;
  12992. } else if (specialChars[ch] !== 1) {
  12993. break;
  12994. }
  12995. ch = this.nextChar();
  12996. }
  12997. switch (ch | 0) {
  12998. case 0x30:
  12999. case 0x31:
  13000. case 0x32:
  13001. case 0x33:
  13002. case 0x34:
  13003. case 0x35:
  13004. case 0x36:
  13005. case 0x37:
  13006. case 0x38:
  13007. case 0x39:
  13008. case 0x2B:
  13009. case 0x2D:
  13010. case 0x2E:
  13011. return this.getNumber();
  13012. case 0x28:
  13013. return this.getString();
  13014. case 0x2F:
  13015. return this.getName();
  13016. case 0x5B:
  13017. this.nextChar();
  13018. return Cmd.get('[');
  13019. case 0x5D:
  13020. this.nextChar();
  13021. return Cmd.get(']');
  13022. case 0x3C:
  13023. ch = this.nextChar();
  13024. if (ch === 0x3C) {
  13025. this.nextChar();
  13026. return Cmd.get('<<');
  13027. }
  13028. return this.getHexString();
  13029. case 0x3E:
  13030. ch = this.nextChar();
  13031. if (ch === 0x3E) {
  13032. this.nextChar();
  13033. return Cmd.get('>>');
  13034. }
  13035. return Cmd.get('>');
  13036. case 0x7B:
  13037. this.nextChar();
  13038. return Cmd.get('{');
  13039. case 0x7D:
  13040. this.nextChar();
  13041. return Cmd.get('}');
  13042. case 0x29:
  13043. this.nextChar();
  13044. error('Illegal character: ' + ch);
  13045. break;
  13046. }
  13047. var str = String.fromCharCode(ch);
  13048. var knownCommands = this.knownCommands;
  13049. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13050. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13051. var possibleCommand = str + String.fromCharCode(ch);
  13052. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13053. break;
  13054. }
  13055. if (str.length === 128) {
  13056. error('Command token too long: ' + str.length);
  13057. }
  13058. str = possibleCommand;
  13059. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13060. }
  13061. if (str === 'true') {
  13062. return true;
  13063. }
  13064. if (str === 'false') {
  13065. return false;
  13066. }
  13067. if (str === 'null') {
  13068. return null;
  13069. }
  13070. return Cmd.get(str);
  13071. },
  13072. skipToNextLine: function Lexer_skipToNextLine() {
  13073. var ch = this.currentChar;
  13074. while (ch >= 0) {
  13075. if (ch === 0x0D) {
  13076. ch = this.nextChar();
  13077. if (ch === 0x0A) {
  13078. this.nextChar();
  13079. }
  13080. break;
  13081. } else if (ch === 0x0A) {
  13082. this.nextChar();
  13083. break;
  13084. }
  13085. ch = this.nextChar();
  13086. }
  13087. }
  13088. };
  13089. return Lexer;
  13090. }();
  13091. var Linearization = {
  13092. create: function LinearizationCreate(stream) {
  13093. function getInt(name, allowZeroValue) {
  13094. var obj = linDict.get(name);
  13095. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13096. return obj;
  13097. }
  13098. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  13099. }
  13100. function getHints() {
  13101. var hints = linDict.get('H'), hintsLength, item;
  13102. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13103. for (var index = 0; index < hintsLength; index++) {
  13104. if (!(isInt(item = hints[index]) && item > 0)) {
  13105. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  13106. }
  13107. }
  13108. return hints;
  13109. }
  13110. throw new Error('Hint array in the linearization dictionary is invalid.');
  13111. }
  13112. var parser = new Parser(new Lexer(stream), false, null);
  13113. var obj1 = parser.getObj();
  13114. var obj2 = parser.getObj();
  13115. var obj3 = parser.getObj();
  13116. var linDict = parser.getObj();
  13117. var obj, length;
  13118. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  13119. return null;
  13120. } else if ((length = getInt('L')) !== stream.length) {
  13121. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  13122. }
  13123. return {
  13124. length: length,
  13125. hints: getHints(),
  13126. objectNumberFirst: getInt('O'),
  13127. endFirst: getInt('E'),
  13128. numPages: getInt('N'),
  13129. mainXRefEntriesOffset: getInt('T'),
  13130. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  13131. };
  13132. }
  13133. };
  13134. exports.Lexer = Lexer;
  13135. exports.Linearization = Linearization;
  13136. exports.Parser = Parser;
  13137. /***/ }),
  13138. /* 6 */
  13139. /***/ (function(module, exports, __w_pdfjs_require__) {
  13140. "use strict";
  13141. var sharedUtil = __w_pdfjs_require__(0);
  13142. var corePrimitives = __w_pdfjs_require__(1);
  13143. var corePsParser = __w_pdfjs_require__(35);
  13144. var error = sharedUtil.error;
  13145. var info = sharedUtil.info;
  13146. var isArray = sharedUtil.isArray;
  13147. var isBool = sharedUtil.isBool;
  13148. var isDict = corePrimitives.isDict;
  13149. var isStream = corePrimitives.isStream;
  13150. var PostScriptLexer = corePsParser.PostScriptLexer;
  13151. var PostScriptParser = corePsParser.PostScriptParser;
  13152. var PDFFunction = function PDFFunctionClosure() {
  13153. var CONSTRUCT_SAMPLED = 0;
  13154. var CONSTRUCT_INTERPOLATED = 2;
  13155. var CONSTRUCT_STICHED = 3;
  13156. var CONSTRUCT_POSTSCRIPT = 4;
  13157. return {
  13158. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  13159. var i, ii;
  13160. var length = 1;
  13161. for (i = 0, ii = size.length; i < ii; i++) {
  13162. length *= size[i];
  13163. }
  13164. length *= outputSize;
  13165. var array = new Array(length);
  13166. var codeSize = 0;
  13167. var codeBuf = 0;
  13168. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  13169. var strBytes = str.getBytes((length * bps + 7) / 8);
  13170. var strIdx = 0;
  13171. for (i = 0; i < length; i++) {
  13172. while (codeSize < bps) {
  13173. codeBuf <<= 8;
  13174. codeBuf |= strBytes[strIdx++];
  13175. codeSize += 8;
  13176. }
  13177. codeSize -= bps;
  13178. array[i] = (codeBuf >> codeSize) * sampleMul;
  13179. codeBuf &= (1 << codeSize) - 1;
  13180. }
  13181. return array;
  13182. },
  13183. getIR: function PDFFunction_getIR(xref, fn) {
  13184. var dict = fn.dict;
  13185. if (!dict) {
  13186. dict = fn;
  13187. }
  13188. var types = [
  13189. this.constructSampled,
  13190. null,
  13191. this.constructInterpolated,
  13192. this.constructStiched,
  13193. this.constructPostScript
  13194. ];
  13195. var typeNum = dict.get('FunctionType');
  13196. var typeFn = types[typeNum];
  13197. if (!typeFn) {
  13198. error('Unknown type of function');
  13199. }
  13200. return typeFn.call(this, fn, dict, xref);
  13201. },
  13202. fromIR: function PDFFunction_fromIR(IR) {
  13203. var type = IR[0];
  13204. switch (type) {
  13205. case CONSTRUCT_SAMPLED:
  13206. return this.constructSampledFromIR(IR);
  13207. case CONSTRUCT_INTERPOLATED:
  13208. return this.constructInterpolatedFromIR(IR);
  13209. case CONSTRUCT_STICHED:
  13210. return this.constructStichedFromIR(IR);
  13211. default:
  13212. return this.constructPostScriptFromIR(IR);
  13213. }
  13214. },
  13215. parse: function PDFFunction_parse(xref, fn) {
  13216. var IR = this.getIR(xref, fn);
  13217. return this.fromIR(IR);
  13218. },
  13219. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  13220. if (!isArray(fnObj)) {
  13221. return this.parse(xref, fnObj);
  13222. }
  13223. var fnArray = [];
  13224. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  13225. var obj = xref.fetchIfRef(fnObj[j]);
  13226. fnArray.push(PDFFunction.parse(xref, obj));
  13227. }
  13228. return function (src, srcOffset, dest, destOffset) {
  13229. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  13230. fnArray[i](src, srcOffset, dest, destOffset + i);
  13231. }
  13232. };
  13233. },
  13234. constructSampled: function PDFFunction_constructSampled(str, dict) {
  13235. function toMultiArray(arr) {
  13236. var inputLength = arr.length;
  13237. var out = [];
  13238. var index = 0;
  13239. for (var i = 0; i < inputLength; i += 2) {
  13240. out[index] = [
  13241. arr[i],
  13242. arr[i + 1]
  13243. ];
  13244. ++index;
  13245. }
  13246. return out;
  13247. }
  13248. var domain = dict.getArray('Domain');
  13249. var range = dict.getArray('Range');
  13250. if (!domain || !range) {
  13251. error('No domain or range');
  13252. }
  13253. var inputSize = domain.length / 2;
  13254. var outputSize = range.length / 2;
  13255. domain = toMultiArray(domain);
  13256. range = toMultiArray(range);
  13257. var size = dict.get('Size');
  13258. var bps = dict.get('BitsPerSample');
  13259. var order = dict.get('Order') || 1;
  13260. if (order !== 1) {
  13261. info('No support for cubic spline interpolation: ' + order);
  13262. }
  13263. var encode = dict.getArray('Encode');
  13264. if (!encode) {
  13265. encode = [];
  13266. for (var i = 0; i < inputSize; ++i) {
  13267. encode.push(0);
  13268. encode.push(size[i] - 1);
  13269. }
  13270. }
  13271. encode = toMultiArray(encode);
  13272. var decode = dict.getArray('Decode');
  13273. if (!decode) {
  13274. decode = range;
  13275. } else {
  13276. decode = toMultiArray(decode);
  13277. }
  13278. var samples = this.getSampleArray(size, outputSize, bps, str);
  13279. return [
  13280. CONSTRUCT_SAMPLED,
  13281. inputSize,
  13282. domain,
  13283. encode,
  13284. decode,
  13285. samples,
  13286. size,
  13287. outputSize,
  13288. Math.pow(2, bps) - 1,
  13289. range
  13290. ];
  13291. },
  13292. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  13293. function interpolate(x, xmin, xmax, ymin, ymax) {
  13294. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  13295. }
  13296. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  13297. var m = IR[1];
  13298. var domain = IR[2];
  13299. var encode = IR[3];
  13300. var decode = IR[4];
  13301. var samples = IR[5];
  13302. var size = IR[6];
  13303. var n = IR[7];
  13304. var range = IR[9];
  13305. var cubeVertices = 1 << m;
  13306. var cubeN = new Float64Array(cubeVertices);
  13307. var cubeVertex = new Uint32Array(cubeVertices);
  13308. var i, j;
  13309. for (j = 0; j < cubeVertices; j++) {
  13310. cubeN[j] = 1;
  13311. }
  13312. var k = n, pos = 1;
  13313. for (i = 0; i < m; ++i) {
  13314. var domain_2i = domain[i][0];
  13315. var domain_2i_1 = domain[i][1];
  13316. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  13317. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  13318. var size_i = size[i];
  13319. e = Math.min(Math.max(e, 0), size_i - 1);
  13320. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  13321. var n0 = e0 + 1 - e;
  13322. var n1 = e - e0;
  13323. var offset0 = e0 * k;
  13324. var offset1 = offset0 + k;
  13325. for (j = 0; j < cubeVertices; j++) {
  13326. if (j & pos) {
  13327. cubeN[j] *= n1;
  13328. cubeVertex[j] += offset1;
  13329. } else {
  13330. cubeN[j] *= n0;
  13331. cubeVertex[j] += offset0;
  13332. }
  13333. }
  13334. k *= size_i;
  13335. pos <<= 1;
  13336. }
  13337. for (j = 0; j < n; ++j) {
  13338. var rj = 0;
  13339. for (i = 0; i < cubeVertices; i++) {
  13340. rj += samples[cubeVertex[i] + j] * cubeN[i];
  13341. }
  13342. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  13343. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  13344. }
  13345. };
  13346. },
  13347. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  13348. var c0 = dict.getArray('C0') || [0];
  13349. var c1 = dict.getArray('C1') || [1];
  13350. var n = dict.get('N');
  13351. if (!isArray(c0) || !isArray(c1)) {
  13352. error('Illegal dictionary for interpolated function');
  13353. }
  13354. var length = c0.length;
  13355. var diff = [];
  13356. for (var i = 0; i < length; ++i) {
  13357. diff.push(c1[i] - c0[i]);
  13358. }
  13359. return [
  13360. CONSTRUCT_INTERPOLATED,
  13361. c0,
  13362. diff,
  13363. n
  13364. ];
  13365. },
  13366. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  13367. var c0 = IR[1];
  13368. var diff = IR[2];
  13369. var n = IR[3];
  13370. var length = diff.length;
  13371. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  13372. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  13373. for (var j = 0; j < length; ++j) {
  13374. dest[destOffset + j] = c0[j] + x * diff[j];
  13375. }
  13376. };
  13377. },
  13378. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  13379. var domain = dict.getArray('Domain');
  13380. if (!domain) {
  13381. error('No domain');
  13382. }
  13383. var inputSize = domain.length / 2;
  13384. if (inputSize !== 1) {
  13385. error('Bad domain for stiched function');
  13386. }
  13387. var fnRefs = dict.get('Functions');
  13388. var fns = [];
  13389. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  13390. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  13391. }
  13392. var bounds = dict.getArray('Bounds');
  13393. var encode = dict.getArray('Encode');
  13394. return [
  13395. CONSTRUCT_STICHED,
  13396. domain,
  13397. bounds,
  13398. encode,
  13399. fns
  13400. ];
  13401. },
  13402. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  13403. var domain = IR[1];
  13404. var bounds = IR[2];
  13405. var encode = IR[3];
  13406. var fnsIR = IR[4];
  13407. var fns = [];
  13408. var tmpBuf = new Float32Array(1);
  13409. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  13410. fns.push(PDFFunction.fromIR(fnsIR[i]));
  13411. }
  13412. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  13413. var clip = function constructStichedFromIRClip(v, min, max) {
  13414. if (v > max) {
  13415. v = max;
  13416. } else if (v < min) {
  13417. v = min;
  13418. }
  13419. return v;
  13420. };
  13421. var v = clip(src[srcOffset], domain[0], domain[1]);
  13422. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  13423. if (v < bounds[i]) {
  13424. break;
  13425. }
  13426. }
  13427. var dmin = domain[0];
  13428. if (i > 0) {
  13429. dmin = bounds[i - 1];
  13430. }
  13431. var dmax = domain[1];
  13432. if (i < bounds.length) {
  13433. dmax = bounds[i];
  13434. }
  13435. var rmin = encode[2 * i];
  13436. var rmax = encode[2 * i + 1];
  13437. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  13438. fns[i](tmpBuf, 0, dest, destOffset);
  13439. };
  13440. },
  13441. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  13442. var domain = dict.getArray('Domain');
  13443. var range = dict.getArray('Range');
  13444. if (!domain) {
  13445. error('No domain.');
  13446. }
  13447. if (!range) {
  13448. error('No range.');
  13449. }
  13450. var lexer = new PostScriptLexer(fn);
  13451. var parser = new PostScriptParser(lexer);
  13452. var code = parser.parse();
  13453. return [
  13454. CONSTRUCT_POSTSCRIPT,
  13455. domain,
  13456. range,
  13457. code
  13458. ];
  13459. },
  13460. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  13461. var domain = IR[1];
  13462. var range = IR[2];
  13463. var code = IR[3];
  13464. var compiled = new PostScriptCompiler().compile(code, domain, range);
  13465. if (compiled) {
  13466. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  13467. }
  13468. info('Unable to compile PS function');
  13469. var numOutputs = range.length >> 1;
  13470. var numInputs = domain.length >> 1;
  13471. var evaluator = new PostScriptEvaluator(code);
  13472. var cache = Object.create(null);
  13473. var MAX_CACHE_SIZE = 2048 * 4;
  13474. var cache_available = MAX_CACHE_SIZE;
  13475. var tmpBuf = new Float32Array(numInputs);
  13476. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  13477. var i, value;
  13478. var key = '';
  13479. var input = tmpBuf;
  13480. for (i = 0; i < numInputs; i++) {
  13481. value = src[srcOffset + i];
  13482. input[i] = value;
  13483. key += value + '_';
  13484. }
  13485. var cachedValue = cache[key];
  13486. if (cachedValue !== undefined) {
  13487. dest.set(cachedValue, destOffset);
  13488. return;
  13489. }
  13490. var output = new Float32Array(numOutputs);
  13491. var stack = evaluator.execute(input);
  13492. var stackIndex = stack.length - numOutputs;
  13493. for (i = 0; i < numOutputs; i++) {
  13494. value = stack[stackIndex + i];
  13495. var bound = range[i * 2];
  13496. if (value < bound) {
  13497. value = bound;
  13498. } else {
  13499. bound = range[i * 2 + 1];
  13500. if (value > bound) {
  13501. value = bound;
  13502. }
  13503. }
  13504. output[i] = value;
  13505. }
  13506. if (cache_available > 0) {
  13507. cache_available--;
  13508. cache[key] = output;
  13509. }
  13510. dest.set(output, destOffset);
  13511. };
  13512. }
  13513. };
  13514. }();
  13515. function isPDFFunction(v) {
  13516. var fnDict;
  13517. if (typeof v !== 'object') {
  13518. return false;
  13519. } else if (isDict(v)) {
  13520. fnDict = v;
  13521. } else if (isStream(v)) {
  13522. fnDict = v.dict;
  13523. } else {
  13524. return false;
  13525. }
  13526. return fnDict.has('FunctionType');
  13527. }
  13528. var PostScriptStack = function PostScriptStackClosure() {
  13529. var MAX_STACK_SIZE = 100;
  13530. function PostScriptStack(initialStack) {
  13531. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  13532. }
  13533. PostScriptStack.prototype = {
  13534. push: function PostScriptStack_push(value) {
  13535. if (this.stack.length >= MAX_STACK_SIZE) {
  13536. error('PostScript function stack overflow.');
  13537. }
  13538. this.stack.push(value);
  13539. },
  13540. pop: function PostScriptStack_pop() {
  13541. if (this.stack.length <= 0) {
  13542. error('PostScript function stack underflow.');
  13543. }
  13544. return this.stack.pop();
  13545. },
  13546. copy: function PostScriptStack_copy(n) {
  13547. if (this.stack.length + n >= MAX_STACK_SIZE) {
  13548. error('PostScript function stack overflow.');
  13549. }
  13550. var stack = this.stack;
  13551. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  13552. stack.push(stack[i]);
  13553. }
  13554. },
  13555. index: function PostScriptStack_index(n) {
  13556. this.push(this.stack[this.stack.length - n - 1]);
  13557. },
  13558. roll: function PostScriptStack_roll(n, p) {
  13559. var stack = this.stack;
  13560. var l = stack.length - n;
  13561. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  13562. for (i = l, j = r; i < j; i++, j--) {
  13563. t = stack[i];
  13564. stack[i] = stack[j];
  13565. stack[j] = t;
  13566. }
  13567. for (i = l, j = c - 1; i < j; i++, j--) {
  13568. t = stack[i];
  13569. stack[i] = stack[j];
  13570. stack[j] = t;
  13571. }
  13572. for (i = c, j = r; i < j; i++, j--) {
  13573. t = stack[i];
  13574. stack[i] = stack[j];
  13575. stack[j] = t;
  13576. }
  13577. }
  13578. };
  13579. return PostScriptStack;
  13580. }();
  13581. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  13582. function PostScriptEvaluator(operators) {
  13583. this.operators = operators;
  13584. }
  13585. PostScriptEvaluator.prototype = {
  13586. execute: function PostScriptEvaluator_execute(initialStack) {
  13587. var stack = new PostScriptStack(initialStack);
  13588. var counter = 0;
  13589. var operators = this.operators;
  13590. var length = operators.length;
  13591. var operator, a, b;
  13592. while (counter < length) {
  13593. operator = operators[counter++];
  13594. if (typeof operator === 'number') {
  13595. stack.push(operator);
  13596. continue;
  13597. }
  13598. switch (operator) {
  13599. case 'jz':
  13600. b = stack.pop();
  13601. a = stack.pop();
  13602. if (!a) {
  13603. counter = b;
  13604. }
  13605. break;
  13606. case 'j':
  13607. a = stack.pop();
  13608. counter = a;
  13609. break;
  13610. case 'abs':
  13611. a = stack.pop();
  13612. stack.push(Math.abs(a));
  13613. break;
  13614. case 'add':
  13615. b = stack.pop();
  13616. a = stack.pop();
  13617. stack.push(a + b);
  13618. break;
  13619. case 'and':
  13620. b = stack.pop();
  13621. a = stack.pop();
  13622. if (isBool(a) && isBool(b)) {
  13623. stack.push(a && b);
  13624. } else {
  13625. stack.push(a & b);
  13626. }
  13627. break;
  13628. case 'atan':
  13629. a = stack.pop();
  13630. stack.push(Math.atan(a));
  13631. break;
  13632. case 'bitshift':
  13633. b = stack.pop();
  13634. a = stack.pop();
  13635. if (a > 0) {
  13636. stack.push(a << b);
  13637. } else {
  13638. stack.push(a >> b);
  13639. }
  13640. break;
  13641. case 'ceiling':
  13642. a = stack.pop();
  13643. stack.push(Math.ceil(a));
  13644. break;
  13645. case 'copy':
  13646. a = stack.pop();
  13647. stack.copy(a);
  13648. break;
  13649. case 'cos':
  13650. a = stack.pop();
  13651. stack.push(Math.cos(a));
  13652. break;
  13653. case 'cvi':
  13654. a = stack.pop() | 0;
  13655. stack.push(a);
  13656. break;
  13657. case 'cvr':
  13658. break;
  13659. case 'div':
  13660. b = stack.pop();
  13661. a = stack.pop();
  13662. stack.push(a / b);
  13663. break;
  13664. case 'dup':
  13665. stack.copy(1);
  13666. break;
  13667. case 'eq':
  13668. b = stack.pop();
  13669. a = stack.pop();
  13670. stack.push(a === b);
  13671. break;
  13672. case 'exch':
  13673. stack.roll(2, 1);
  13674. break;
  13675. case 'exp':
  13676. b = stack.pop();
  13677. a = stack.pop();
  13678. stack.push(Math.pow(a, b));
  13679. break;
  13680. case 'false':
  13681. stack.push(false);
  13682. break;
  13683. case 'floor':
  13684. a = stack.pop();
  13685. stack.push(Math.floor(a));
  13686. break;
  13687. case 'ge':
  13688. b = stack.pop();
  13689. a = stack.pop();
  13690. stack.push(a >= b);
  13691. break;
  13692. case 'gt':
  13693. b = stack.pop();
  13694. a = stack.pop();
  13695. stack.push(a > b);
  13696. break;
  13697. case 'idiv':
  13698. b = stack.pop();
  13699. a = stack.pop();
  13700. stack.push(a / b | 0);
  13701. break;
  13702. case 'index':
  13703. a = stack.pop();
  13704. stack.index(a);
  13705. break;
  13706. case 'le':
  13707. b = stack.pop();
  13708. a = stack.pop();
  13709. stack.push(a <= b);
  13710. break;
  13711. case 'ln':
  13712. a = stack.pop();
  13713. stack.push(Math.log(a));
  13714. break;
  13715. case 'log':
  13716. a = stack.pop();
  13717. stack.push(Math.log(a) / Math.LN10);
  13718. break;
  13719. case 'lt':
  13720. b = stack.pop();
  13721. a = stack.pop();
  13722. stack.push(a < b);
  13723. break;
  13724. case 'mod':
  13725. b = stack.pop();
  13726. a = stack.pop();
  13727. stack.push(a % b);
  13728. break;
  13729. case 'mul':
  13730. b = stack.pop();
  13731. a = stack.pop();
  13732. stack.push(a * b);
  13733. break;
  13734. case 'ne':
  13735. b = stack.pop();
  13736. a = stack.pop();
  13737. stack.push(a !== b);
  13738. break;
  13739. case 'neg':
  13740. a = stack.pop();
  13741. stack.push(-a);
  13742. break;
  13743. case 'not':
  13744. a = stack.pop();
  13745. if (isBool(a)) {
  13746. stack.push(!a);
  13747. } else {
  13748. stack.push(~a);
  13749. }
  13750. break;
  13751. case 'or':
  13752. b = stack.pop();
  13753. a = stack.pop();
  13754. if (isBool(a) && isBool(b)) {
  13755. stack.push(a || b);
  13756. } else {
  13757. stack.push(a | b);
  13758. }
  13759. break;
  13760. case 'pop':
  13761. stack.pop();
  13762. break;
  13763. case 'roll':
  13764. b = stack.pop();
  13765. a = stack.pop();
  13766. stack.roll(a, b);
  13767. break;
  13768. case 'round':
  13769. a = stack.pop();
  13770. stack.push(Math.round(a));
  13771. break;
  13772. case 'sin':
  13773. a = stack.pop();
  13774. stack.push(Math.sin(a));
  13775. break;
  13776. case 'sqrt':
  13777. a = stack.pop();
  13778. stack.push(Math.sqrt(a));
  13779. break;
  13780. case 'sub':
  13781. b = stack.pop();
  13782. a = stack.pop();
  13783. stack.push(a - b);
  13784. break;
  13785. case 'true':
  13786. stack.push(true);
  13787. break;
  13788. case 'truncate':
  13789. a = stack.pop();
  13790. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  13791. stack.push(a);
  13792. break;
  13793. case 'xor':
  13794. b = stack.pop();
  13795. a = stack.pop();
  13796. if (isBool(a) && isBool(b)) {
  13797. stack.push(a !== b);
  13798. } else {
  13799. stack.push(a ^ b);
  13800. }
  13801. break;
  13802. default:
  13803. error('Unknown operator ' + operator);
  13804. break;
  13805. }
  13806. }
  13807. return stack.stack;
  13808. }
  13809. };
  13810. return PostScriptEvaluator;
  13811. }();
  13812. var PostScriptCompiler = function PostScriptCompilerClosure() {
  13813. function AstNode(type) {
  13814. this.type = type;
  13815. }
  13816. AstNode.prototype.visit = function (visitor) {
  13817. throw new Error('abstract method');
  13818. };
  13819. function AstArgument(index, min, max) {
  13820. AstNode.call(this, 'args');
  13821. this.index = index;
  13822. this.min = min;
  13823. this.max = max;
  13824. }
  13825. AstArgument.prototype = Object.create(AstNode.prototype);
  13826. AstArgument.prototype.visit = function (visitor) {
  13827. visitor.visitArgument(this);
  13828. };
  13829. function AstLiteral(number) {
  13830. AstNode.call(this, 'literal');
  13831. this.number = number;
  13832. this.min = number;
  13833. this.max = number;
  13834. }
  13835. AstLiteral.prototype = Object.create(AstNode.prototype);
  13836. AstLiteral.prototype.visit = function (visitor) {
  13837. visitor.visitLiteral(this);
  13838. };
  13839. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13840. AstNode.call(this, 'binary');
  13841. this.op = op;
  13842. this.arg1 = arg1;
  13843. this.arg2 = arg2;
  13844. this.min = min;
  13845. this.max = max;
  13846. }
  13847. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13848. AstBinaryOperation.prototype.visit = function (visitor) {
  13849. visitor.visitBinaryOperation(this);
  13850. };
  13851. function AstMin(arg, max) {
  13852. AstNode.call(this, 'max');
  13853. this.arg = arg;
  13854. this.min = arg.min;
  13855. this.max = max;
  13856. }
  13857. AstMin.prototype = Object.create(AstNode.prototype);
  13858. AstMin.prototype.visit = function (visitor) {
  13859. visitor.visitMin(this);
  13860. };
  13861. function AstVariable(index, min, max) {
  13862. AstNode.call(this, 'var');
  13863. this.index = index;
  13864. this.min = min;
  13865. this.max = max;
  13866. }
  13867. AstVariable.prototype = Object.create(AstNode.prototype);
  13868. AstVariable.prototype.visit = function (visitor) {
  13869. visitor.visitVariable(this);
  13870. };
  13871. function AstVariableDefinition(variable, arg) {
  13872. AstNode.call(this, 'definition');
  13873. this.variable = variable;
  13874. this.arg = arg;
  13875. }
  13876. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13877. AstVariableDefinition.prototype.visit = function (visitor) {
  13878. visitor.visitVariableDefinition(this);
  13879. };
  13880. function ExpressionBuilderVisitor() {
  13881. this.parts = [];
  13882. }
  13883. ExpressionBuilderVisitor.prototype = {
  13884. visitArgument: function (arg) {
  13885. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13886. },
  13887. visitVariable: function (variable) {
  13888. this.parts.push('v', variable.index);
  13889. },
  13890. visitLiteral: function (literal) {
  13891. this.parts.push(literal.number);
  13892. },
  13893. visitBinaryOperation: function (operation) {
  13894. this.parts.push('(');
  13895. operation.arg1.visit(this);
  13896. this.parts.push(' ', operation.op, ' ');
  13897. operation.arg2.visit(this);
  13898. this.parts.push(')');
  13899. },
  13900. visitVariableDefinition: function (definition) {
  13901. this.parts.push('var ');
  13902. definition.variable.visit(this);
  13903. this.parts.push(' = ');
  13904. definition.arg.visit(this);
  13905. this.parts.push(';');
  13906. },
  13907. visitMin: function (max) {
  13908. this.parts.push('Math.min(');
  13909. max.arg.visit(this);
  13910. this.parts.push(', ', max.max, ')');
  13911. },
  13912. toString: function () {
  13913. return this.parts.join('');
  13914. }
  13915. };
  13916. function buildAddOperation(num1, num2) {
  13917. if (num2.type === 'literal' && num2.number === 0) {
  13918. return num1;
  13919. }
  13920. if (num1.type === 'literal' && num1.number === 0) {
  13921. return num2;
  13922. }
  13923. if (num2.type === 'literal' && num1.type === 'literal') {
  13924. return new AstLiteral(num1.number + num2.number);
  13925. }
  13926. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13927. }
  13928. function buildMulOperation(num1, num2) {
  13929. if (num2.type === 'literal') {
  13930. if (num2.number === 0) {
  13931. return new AstLiteral(0);
  13932. } else if (num2.number === 1) {
  13933. return num1;
  13934. } else if (num1.type === 'literal') {
  13935. return new AstLiteral(num1.number * num2.number);
  13936. }
  13937. }
  13938. if (num1.type === 'literal') {
  13939. if (num1.number === 0) {
  13940. return new AstLiteral(0);
  13941. } else if (num1.number === 1) {
  13942. return num2;
  13943. }
  13944. }
  13945. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13946. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13947. return new AstBinaryOperation('*', num1, num2, min, max);
  13948. }
  13949. function buildSubOperation(num1, num2) {
  13950. if (num2.type === 'literal') {
  13951. if (num2.number === 0) {
  13952. return num1;
  13953. } else if (num1.type === 'literal') {
  13954. return new AstLiteral(num1.number - num2.number);
  13955. }
  13956. }
  13957. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13958. return num2.arg2;
  13959. }
  13960. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13961. }
  13962. function buildMinOperation(num1, max) {
  13963. if (num1.min >= max) {
  13964. return new AstLiteral(max);
  13965. } else if (num1.max <= max) {
  13966. return num1;
  13967. }
  13968. return new AstMin(num1, max);
  13969. }
  13970. function PostScriptCompiler() {
  13971. }
  13972. PostScriptCompiler.prototype = {
  13973. compile: function PostScriptCompiler_compile(code, domain, range) {
  13974. var stack = [];
  13975. var i, ii;
  13976. var instructions = [];
  13977. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13978. var lastRegister = 0;
  13979. var n, j;
  13980. var num1, num2, ast1, ast2, tmpVar, item;
  13981. for (i = 0; i < inputSize; i++) {
  13982. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13983. }
  13984. for (i = 0, ii = code.length; i < ii; i++) {
  13985. item = code[i];
  13986. if (typeof item === 'number') {
  13987. stack.push(new AstLiteral(item));
  13988. continue;
  13989. }
  13990. switch (item) {
  13991. case 'add':
  13992. if (stack.length < 2) {
  13993. return null;
  13994. }
  13995. num2 = stack.pop();
  13996. num1 = stack.pop();
  13997. stack.push(buildAddOperation(num1, num2));
  13998. break;
  13999. case 'cvr':
  14000. if (stack.length < 1) {
  14001. return null;
  14002. }
  14003. break;
  14004. case 'mul':
  14005. if (stack.length < 2) {
  14006. return null;
  14007. }
  14008. num2 = stack.pop();
  14009. num1 = stack.pop();
  14010. stack.push(buildMulOperation(num1, num2));
  14011. break;
  14012. case 'sub':
  14013. if (stack.length < 2) {
  14014. return null;
  14015. }
  14016. num2 = stack.pop();
  14017. num1 = stack.pop();
  14018. stack.push(buildSubOperation(num1, num2));
  14019. break;
  14020. case 'exch':
  14021. if (stack.length < 2) {
  14022. return null;
  14023. }
  14024. ast1 = stack.pop();
  14025. ast2 = stack.pop();
  14026. stack.push(ast1, ast2);
  14027. break;
  14028. case 'pop':
  14029. if (stack.length < 1) {
  14030. return null;
  14031. }
  14032. stack.pop();
  14033. break;
  14034. case 'index':
  14035. if (stack.length < 1) {
  14036. return null;
  14037. }
  14038. num1 = stack.pop();
  14039. if (num1.type !== 'literal') {
  14040. return null;
  14041. }
  14042. n = num1.number;
  14043. if (n < 0 || (n | 0) !== n || stack.length < n) {
  14044. return null;
  14045. }
  14046. ast1 = stack[stack.length - n - 1];
  14047. if (ast1.type === 'literal' || ast1.type === 'var') {
  14048. stack.push(ast1);
  14049. break;
  14050. }
  14051. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14052. stack[stack.length - n - 1] = tmpVar;
  14053. stack.push(tmpVar);
  14054. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14055. break;
  14056. case 'dup':
  14057. if (stack.length < 1) {
  14058. return null;
  14059. }
  14060. 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]) {
  14061. num1 = stack.pop();
  14062. stack.push(buildMinOperation(num1, code[i + 1]));
  14063. i += 6;
  14064. break;
  14065. }
  14066. ast1 = stack[stack.length - 1];
  14067. if (ast1.type === 'literal' || ast1.type === 'var') {
  14068. stack.push(ast1);
  14069. break;
  14070. }
  14071. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14072. stack[stack.length - 1] = tmpVar;
  14073. stack.push(tmpVar);
  14074. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14075. break;
  14076. case 'roll':
  14077. if (stack.length < 2) {
  14078. return null;
  14079. }
  14080. num2 = stack.pop();
  14081. num1 = stack.pop();
  14082. if (num2.type !== 'literal' || num1.type !== 'literal') {
  14083. return null;
  14084. }
  14085. j = num2.number;
  14086. n = num1.number;
  14087. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  14088. return null;
  14089. }
  14090. j = (j % n + n) % n;
  14091. if (j === 0) {
  14092. break;
  14093. }
  14094. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  14095. break;
  14096. default:
  14097. return null;
  14098. }
  14099. }
  14100. if (stack.length !== outputSize) {
  14101. return null;
  14102. }
  14103. var result = [];
  14104. instructions.forEach(function (instruction) {
  14105. var statementBuilder = new ExpressionBuilderVisitor();
  14106. instruction.visit(statementBuilder);
  14107. result.push(statementBuilder.toString());
  14108. });
  14109. stack.forEach(function (expr, i) {
  14110. var statementBuilder = new ExpressionBuilderVisitor();
  14111. expr.visit(statementBuilder);
  14112. var min = range[i * 2], max = range[i * 2 + 1];
  14113. var out = [statementBuilder.toString()];
  14114. if (min > expr.min) {
  14115. out.unshift('Math.max(', min, ', ');
  14116. out.push(')');
  14117. }
  14118. if (max < expr.max) {
  14119. out.unshift('Math.min(', max, ', ');
  14120. out.push(')');
  14121. }
  14122. out.unshift('dest[destOffset + ', i, '] = ');
  14123. out.push(';');
  14124. result.push(out.join(''));
  14125. });
  14126. return result.join('\n');
  14127. }
  14128. };
  14129. return PostScriptCompiler;
  14130. }();
  14131. exports.isPDFFunction = isPDFFunction;
  14132. exports.PDFFunction = PDFFunction;
  14133. exports.PostScriptEvaluator = PostScriptEvaluator;
  14134. exports.PostScriptCompiler = PostScriptCompiler;
  14135. /***/ }),
  14136. /* 7 */
  14137. /***/ (function(module, exports, __w_pdfjs_require__) {
  14138. "use strict";
  14139. var sharedUtil = __w_pdfjs_require__(0);
  14140. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  14141. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  14142. t['A'] = 0x0041;
  14143. t['AE'] = 0x00C6;
  14144. t['AEacute'] = 0x01FC;
  14145. t['AEmacron'] = 0x01E2;
  14146. t['AEsmall'] = 0xF7E6;
  14147. t['Aacute'] = 0x00C1;
  14148. t['Aacutesmall'] = 0xF7E1;
  14149. t['Abreve'] = 0x0102;
  14150. t['Abreveacute'] = 0x1EAE;
  14151. t['Abrevecyrillic'] = 0x04D0;
  14152. t['Abrevedotbelow'] = 0x1EB6;
  14153. t['Abrevegrave'] = 0x1EB0;
  14154. t['Abrevehookabove'] = 0x1EB2;
  14155. t['Abrevetilde'] = 0x1EB4;
  14156. t['Acaron'] = 0x01CD;
  14157. t['Acircle'] = 0x24B6;
  14158. t['Acircumflex'] = 0x00C2;
  14159. t['Acircumflexacute'] = 0x1EA4;
  14160. t['Acircumflexdotbelow'] = 0x1EAC;
  14161. t['Acircumflexgrave'] = 0x1EA6;
  14162. t['Acircumflexhookabove'] = 0x1EA8;
  14163. t['Acircumflexsmall'] = 0xF7E2;
  14164. t['Acircumflextilde'] = 0x1EAA;
  14165. t['Acute'] = 0xF6C9;
  14166. t['Acutesmall'] = 0xF7B4;
  14167. t['Acyrillic'] = 0x0410;
  14168. t['Adblgrave'] = 0x0200;
  14169. t['Adieresis'] = 0x00C4;
  14170. t['Adieresiscyrillic'] = 0x04D2;
  14171. t['Adieresismacron'] = 0x01DE;
  14172. t['Adieresissmall'] = 0xF7E4;
  14173. t['Adotbelow'] = 0x1EA0;
  14174. t['Adotmacron'] = 0x01E0;
  14175. t['Agrave'] = 0x00C0;
  14176. t['Agravesmall'] = 0xF7E0;
  14177. t['Ahookabove'] = 0x1EA2;
  14178. t['Aiecyrillic'] = 0x04D4;
  14179. t['Ainvertedbreve'] = 0x0202;
  14180. t['Alpha'] = 0x0391;
  14181. t['Alphatonos'] = 0x0386;
  14182. t['Amacron'] = 0x0100;
  14183. t['Amonospace'] = 0xFF21;
  14184. t['Aogonek'] = 0x0104;
  14185. t['Aring'] = 0x00C5;
  14186. t['Aringacute'] = 0x01FA;
  14187. t['Aringbelow'] = 0x1E00;
  14188. t['Aringsmall'] = 0xF7E5;
  14189. t['Asmall'] = 0xF761;
  14190. t['Atilde'] = 0x00C3;
  14191. t['Atildesmall'] = 0xF7E3;
  14192. t['Aybarmenian'] = 0x0531;
  14193. t['B'] = 0x0042;
  14194. t['Bcircle'] = 0x24B7;
  14195. t['Bdotaccent'] = 0x1E02;
  14196. t['Bdotbelow'] = 0x1E04;
  14197. t['Becyrillic'] = 0x0411;
  14198. t['Benarmenian'] = 0x0532;
  14199. t['Beta'] = 0x0392;
  14200. t['Bhook'] = 0x0181;
  14201. t['Blinebelow'] = 0x1E06;
  14202. t['Bmonospace'] = 0xFF22;
  14203. t['Brevesmall'] = 0xF6F4;
  14204. t['Bsmall'] = 0xF762;
  14205. t['Btopbar'] = 0x0182;
  14206. t['C'] = 0x0043;
  14207. t['Caarmenian'] = 0x053E;
  14208. t['Cacute'] = 0x0106;
  14209. t['Caron'] = 0xF6CA;
  14210. t['Caronsmall'] = 0xF6F5;
  14211. t['Ccaron'] = 0x010C;
  14212. t['Ccedilla'] = 0x00C7;
  14213. t['Ccedillaacute'] = 0x1E08;
  14214. t['Ccedillasmall'] = 0xF7E7;
  14215. t['Ccircle'] = 0x24B8;
  14216. t['Ccircumflex'] = 0x0108;
  14217. t['Cdot'] = 0x010A;
  14218. t['Cdotaccent'] = 0x010A;
  14219. t['Cedillasmall'] = 0xF7B8;
  14220. t['Chaarmenian'] = 0x0549;
  14221. t['Cheabkhasiancyrillic'] = 0x04BC;
  14222. t['Checyrillic'] = 0x0427;
  14223. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  14224. t['Chedescendercyrillic'] = 0x04B6;
  14225. t['Chedieresiscyrillic'] = 0x04F4;
  14226. t['Cheharmenian'] = 0x0543;
  14227. t['Chekhakassiancyrillic'] = 0x04CB;
  14228. t['Cheverticalstrokecyrillic'] = 0x04B8;
  14229. t['Chi'] = 0x03A7;
  14230. t['Chook'] = 0x0187;
  14231. t['Circumflexsmall'] = 0xF6F6;
  14232. t['Cmonospace'] = 0xFF23;
  14233. t['Coarmenian'] = 0x0551;
  14234. t['Csmall'] = 0xF763;
  14235. t['D'] = 0x0044;
  14236. t['DZ'] = 0x01F1;
  14237. t['DZcaron'] = 0x01C4;
  14238. t['Daarmenian'] = 0x0534;
  14239. t['Dafrican'] = 0x0189;
  14240. t['Dcaron'] = 0x010E;
  14241. t['Dcedilla'] = 0x1E10;
  14242. t['Dcircle'] = 0x24B9;
  14243. t['Dcircumflexbelow'] = 0x1E12;
  14244. t['Dcroat'] = 0x0110;
  14245. t['Ddotaccent'] = 0x1E0A;
  14246. t['Ddotbelow'] = 0x1E0C;
  14247. t['Decyrillic'] = 0x0414;
  14248. t['Deicoptic'] = 0x03EE;
  14249. t['Delta'] = 0x2206;
  14250. t['Deltagreek'] = 0x0394;
  14251. t['Dhook'] = 0x018A;
  14252. t['Dieresis'] = 0xF6CB;
  14253. t['DieresisAcute'] = 0xF6CC;
  14254. t['DieresisGrave'] = 0xF6CD;
  14255. t['Dieresissmall'] = 0xF7A8;
  14256. t['Digammagreek'] = 0x03DC;
  14257. t['Djecyrillic'] = 0x0402;
  14258. t['Dlinebelow'] = 0x1E0E;
  14259. t['Dmonospace'] = 0xFF24;
  14260. t['Dotaccentsmall'] = 0xF6F7;
  14261. t['Dslash'] = 0x0110;
  14262. t['Dsmall'] = 0xF764;
  14263. t['Dtopbar'] = 0x018B;
  14264. t['Dz'] = 0x01F2;
  14265. t['Dzcaron'] = 0x01C5;
  14266. t['Dzeabkhasiancyrillic'] = 0x04E0;
  14267. t['Dzecyrillic'] = 0x0405;
  14268. t['Dzhecyrillic'] = 0x040F;
  14269. t['E'] = 0x0045;
  14270. t['Eacute'] = 0x00C9;
  14271. t['Eacutesmall'] = 0xF7E9;
  14272. t['Ebreve'] = 0x0114;
  14273. t['Ecaron'] = 0x011A;
  14274. t['Ecedillabreve'] = 0x1E1C;
  14275. t['Echarmenian'] = 0x0535;
  14276. t['Ecircle'] = 0x24BA;
  14277. t['Ecircumflex'] = 0x00CA;
  14278. t['Ecircumflexacute'] = 0x1EBE;
  14279. t['Ecircumflexbelow'] = 0x1E18;
  14280. t['Ecircumflexdotbelow'] = 0x1EC6;
  14281. t['Ecircumflexgrave'] = 0x1EC0;
  14282. t['Ecircumflexhookabove'] = 0x1EC2;
  14283. t['Ecircumflexsmall'] = 0xF7EA;
  14284. t['Ecircumflextilde'] = 0x1EC4;
  14285. t['Ecyrillic'] = 0x0404;
  14286. t['Edblgrave'] = 0x0204;
  14287. t['Edieresis'] = 0x00CB;
  14288. t['Edieresissmall'] = 0xF7EB;
  14289. t['Edot'] = 0x0116;
  14290. t['Edotaccent'] = 0x0116;
  14291. t['Edotbelow'] = 0x1EB8;
  14292. t['Efcyrillic'] = 0x0424;
  14293. t['Egrave'] = 0x00C8;
  14294. t['Egravesmall'] = 0xF7E8;
  14295. t['Eharmenian'] = 0x0537;
  14296. t['Ehookabove'] = 0x1EBA;
  14297. t['Eightroman'] = 0x2167;
  14298. t['Einvertedbreve'] = 0x0206;
  14299. t['Eiotifiedcyrillic'] = 0x0464;
  14300. t['Elcyrillic'] = 0x041B;
  14301. t['Elevenroman'] = 0x216A;
  14302. t['Emacron'] = 0x0112;
  14303. t['Emacronacute'] = 0x1E16;
  14304. t['Emacrongrave'] = 0x1E14;
  14305. t['Emcyrillic'] = 0x041C;
  14306. t['Emonospace'] = 0xFF25;
  14307. t['Encyrillic'] = 0x041D;
  14308. t['Endescendercyrillic'] = 0x04A2;
  14309. t['Eng'] = 0x014A;
  14310. t['Enghecyrillic'] = 0x04A4;
  14311. t['Enhookcyrillic'] = 0x04C7;
  14312. t['Eogonek'] = 0x0118;
  14313. t['Eopen'] = 0x0190;
  14314. t['Epsilon'] = 0x0395;
  14315. t['Epsilontonos'] = 0x0388;
  14316. t['Ercyrillic'] = 0x0420;
  14317. t['Ereversed'] = 0x018E;
  14318. t['Ereversedcyrillic'] = 0x042D;
  14319. t['Escyrillic'] = 0x0421;
  14320. t['Esdescendercyrillic'] = 0x04AA;
  14321. t['Esh'] = 0x01A9;
  14322. t['Esmall'] = 0xF765;
  14323. t['Eta'] = 0x0397;
  14324. t['Etarmenian'] = 0x0538;
  14325. t['Etatonos'] = 0x0389;
  14326. t['Eth'] = 0x00D0;
  14327. t['Ethsmall'] = 0xF7F0;
  14328. t['Etilde'] = 0x1EBC;
  14329. t['Etildebelow'] = 0x1E1A;
  14330. t['Euro'] = 0x20AC;
  14331. t['Ezh'] = 0x01B7;
  14332. t['Ezhcaron'] = 0x01EE;
  14333. t['Ezhreversed'] = 0x01B8;
  14334. t['F'] = 0x0046;
  14335. t['Fcircle'] = 0x24BB;
  14336. t['Fdotaccent'] = 0x1E1E;
  14337. t['Feharmenian'] = 0x0556;
  14338. t['Feicoptic'] = 0x03E4;
  14339. t['Fhook'] = 0x0191;
  14340. t['Fitacyrillic'] = 0x0472;
  14341. t['Fiveroman'] = 0x2164;
  14342. t['Fmonospace'] = 0xFF26;
  14343. t['Fourroman'] = 0x2163;
  14344. t['Fsmall'] = 0xF766;
  14345. t['G'] = 0x0047;
  14346. t['GBsquare'] = 0x3387;
  14347. t['Gacute'] = 0x01F4;
  14348. t['Gamma'] = 0x0393;
  14349. t['Gammaafrican'] = 0x0194;
  14350. t['Gangiacoptic'] = 0x03EA;
  14351. t['Gbreve'] = 0x011E;
  14352. t['Gcaron'] = 0x01E6;
  14353. t['Gcedilla'] = 0x0122;
  14354. t['Gcircle'] = 0x24BC;
  14355. t['Gcircumflex'] = 0x011C;
  14356. t['Gcommaaccent'] = 0x0122;
  14357. t['Gdot'] = 0x0120;
  14358. t['Gdotaccent'] = 0x0120;
  14359. t['Gecyrillic'] = 0x0413;
  14360. t['Ghadarmenian'] = 0x0542;
  14361. t['Ghemiddlehookcyrillic'] = 0x0494;
  14362. t['Ghestrokecyrillic'] = 0x0492;
  14363. t['Gheupturncyrillic'] = 0x0490;
  14364. t['Ghook'] = 0x0193;
  14365. t['Gimarmenian'] = 0x0533;
  14366. t['Gjecyrillic'] = 0x0403;
  14367. t['Gmacron'] = 0x1E20;
  14368. t['Gmonospace'] = 0xFF27;
  14369. t['Grave'] = 0xF6CE;
  14370. t['Gravesmall'] = 0xF760;
  14371. t['Gsmall'] = 0xF767;
  14372. t['Gsmallhook'] = 0x029B;
  14373. t['Gstroke'] = 0x01E4;
  14374. t['H'] = 0x0048;
  14375. t['H18533'] = 0x25CF;
  14376. t['H18543'] = 0x25AA;
  14377. t['H18551'] = 0x25AB;
  14378. t['H22073'] = 0x25A1;
  14379. t['HPsquare'] = 0x33CB;
  14380. t['Haabkhasiancyrillic'] = 0x04A8;
  14381. t['Hadescendercyrillic'] = 0x04B2;
  14382. t['Hardsigncyrillic'] = 0x042A;
  14383. t['Hbar'] = 0x0126;
  14384. t['Hbrevebelow'] = 0x1E2A;
  14385. t['Hcedilla'] = 0x1E28;
  14386. t['Hcircle'] = 0x24BD;
  14387. t['Hcircumflex'] = 0x0124;
  14388. t['Hdieresis'] = 0x1E26;
  14389. t['Hdotaccent'] = 0x1E22;
  14390. t['Hdotbelow'] = 0x1E24;
  14391. t['Hmonospace'] = 0xFF28;
  14392. t['Hoarmenian'] = 0x0540;
  14393. t['Horicoptic'] = 0x03E8;
  14394. t['Hsmall'] = 0xF768;
  14395. t['Hungarumlaut'] = 0xF6CF;
  14396. t['Hungarumlautsmall'] = 0xF6F8;
  14397. t['Hzsquare'] = 0x3390;
  14398. t['I'] = 0x0049;
  14399. t['IAcyrillic'] = 0x042F;
  14400. t['IJ'] = 0x0132;
  14401. t['IUcyrillic'] = 0x042E;
  14402. t['Iacute'] = 0x00CD;
  14403. t['Iacutesmall'] = 0xF7ED;
  14404. t['Ibreve'] = 0x012C;
  14405. t['Icaron'] = 0x01CF;
  14406. t['Icircle'] = 0x24BE;
  14407. t['Icircumflex'] = 0x00CE;
  14408. t['Icircumflexsmall'] = 0xF7EE;
  14409. t['Icyrillic'] = 0x0406;
  14410. t['Idblgrave'] = 0x0208;
  14411. t['Idieresis'] = 0x00CF;
  14412. t['Idieresisacute'] = 0x1E2E;
  14413. t['Idieresiscyrillic'] = 0x04E4;
  14414. t['Idieresissmall'] = 0xF7EF;
  14415. t['Idot'] = 0x0130;
  14416. t['Idotaccent'] = 0x0130;
  14417. t['Idotbelow'] = 0x1ECA;
  14418. t['Iebrevecyrillic'] = 0x04D6;
  14419. t['Iecyrillic'] = 0x0415;
  14420. t['Ifraktur'] = 0x2111;
  14421. t['Igrave'] = 0x00CC;
  14422. t['Igravesmall'] = 0xF7EC;
  14423. t['Ihookabove'] = 0x1EC8;
  14424. t['Iicyrillic'] = 0x0418;
  14425. t['Iinvertedbreve'] = 0x020A;
  14426. t['Iishortcyrillic'] = 0x0419;
  14427. t['Imacron'] = 0x012A;
  14428. t['Imacroncyrillic'] = 0x04E2;
  14429. t['Imonospace'] = 0xFF29;
  14430. t['Iniarmenian'] = 0x053B;
  14431. t['Iocyrillic'] = 0x0401;
  14432. t['Iogonek'] = 0x012E;
  14433. t['Iota'] = 0x0399;
  14434. t['Iotaafrican'] = 0x0196;
  14435. t['Iotadieresis'] = 0x03AA;
  14436. t['Iotatonos'] = 0x038A;
  14437. t['Ismall'] = 0xF769;
  14438. t['Istroke'] = 0x0197;
  14439. t['Itilde'] = 0x0128;
  14440. t['Itildebelow'] = 0x1E2C;
  14441. t['Izhitsacyrillic'] = 0x0474;
  14442. t['Izhitsadblgravecyrillic'] = 0x0476;
  14443. t['J'] = 0x004A;
  14444. t['Jaarmenian'] = 0x0541;
  14445. t['Jcircle'] = 0x24BF;
  14446. t['Jcircumflex'] = 0x0134;
  14447. t['Jecyrillic'] = 0x0408;
  14448. t['Jheharmenian'] = 0x054B;
  14449. t['Jmonospace'] = 0xFF2A;
  14450. t['Jsmall'] = 0xF76A;
  14451. t['K'] = 0x004B;
  14452. t['KBsquare'] = 0x3385;
  14453. t['KKsquare'] = 0x33CD;
  14454. t['Kabashkircyrillic'] = 0x04A0;
  14455. t['Kacute'] = 0x1E30;
  14456. t['Kacyrillic'] = 0x041A;
  14457. t['Kadescendercyrillic'] = 0x049A;
  14458. t['Kahookcyrillic'] = 0x04C3;
  14459. t['Kappa'] = 0x039A;
  14460. t['Kastrokecyrillic'] = 0x049E;
  14461. t['Kaverticalstrokecyrillic'] = 0x049C;
  14462. t['Kcaron'] = 0x01E8;
  14463. t['Kcedilla'] = 0x0136;
  14464. t['Kcircle'] = 0x24C0;
  14465. t['Kcommaaccent'] = 0x0136;
  14466. t['Kdotbelow'] = 0x1E32;
  14467. t['Keharmenian'] = 0x0554;
  14468. t['Kenarmenian'] = 0x053F;
  14469. t['Khacyrillic'] = 0x0425;
  14470. t['Kheicoptic'] = 0x03E6;
  14471. t['Khook'] = 0x0198;
  14472. t['Kjecyrillic'] = 0x040C;
  14473. t['Klinebelow'] = 0x1E34;
  14474. t['Kmonospace'] = 0xFF2B;
  14475. t['Koppacyrillic'] = 0x0480;
  14476. t['Koppagreek'] = 0x03DE;
  14477. t['Ksicyrillic'] = 0x046E;
  14478. t['Ksmall'] = 0xF76B;
  14479. t['L'] = 0x004C;
  14480. t['LJ'] = 0x01C7;
  14481. t['LL'] = 0xF6BF;
  14482. t['Lacute'] = 0x0139;
  14483. t['Lambda'] = 0x039B;
  14484. t['Lcaron'] = 0x013D;
  14485. t['Lcedilla'] = 0x013B;
  14486. t['Lcircle'] = 0x24C1;
  14487. t['Lcircumflexbelow'] = 0x1E3C;
  14488. t['Lcommaaccent'] = 0x013B;
  14489. t['Ldot'] = 0x013F;
  14490. t['Ldotaccent'] = 0x013F;
  14491. t['Ldotbelow'] = 0x1E36;
  14492. t['Ldotbelowmacron'] = 0x1E38;
  14493. t['Liwnarmenian'] = 0x053C;
  14494. t['Lj'] = 0x01C8;
  14495. t['Ljecyrillic'] = 0x0409;
  14496. t['Llinebelow'] = 0x1E3A;
  14497. t['Lmonospace'] = 0xFF2C;
  14498. t['Lslash'] = 0x0141;
  14499. t['Lslashsmall'] = 0xF6F9;
  14500. t['Lsmall'] = 0xF76C;
  14501. t['M'] = 0x004D;
  14502. t['MBsquare'] = 0x3386;
  14503. t['Macron'] = 0xF6D0;
  14504. t['Macronsmall'] = 0xF7AF;
  14505. t['Macute'] = 0x1E3E;
  14506. t['Mcircle'] = 0x24C2;
  14507. t['Mdotaccent'] = 0x1E40;
  14508. t['Mdotbelow'] = 0x1E42;
  14509. t['Menarmenian'] = 0x0544;
  14510. t['Mmonospace'] = 0xFF2D;
  14511. t['Msmall'] = 0xF76D;
  14512. t['Mturned'] = 0x019C;
  14513. t['Mu'] = 0x039C;
  14514. t['N'] = 0x004E;
  14515. t['NJ'] = 0x01CA;
  14516. t['Nacute'] = 0x0143;
  14517. t['Ncaron'] = 0x0147;
  14518. t['Ncedilla'] = 0x0145;
  14519. t['Ncircle'] = 0x24C3;
  14520. t['Ncircumflexbelow'] = 0x1E4A;
  14521. t['Ncommaaccent'] = 0x0145;
  14522. t['Ndotaccent'] = 0x1E44;
  14523. t['Ndotbelow'] = 0x1E46;
  14524. t['Nhookleft'] = 0x019D;
  14525. t['Nineroman'] = 0x2168;
  14526. t['Nj'] = 0x01CB;
  14527. t['Njecyrillic'] = 0x040A;
  14528. t['Nlinebelow'] = 0x1E48;
  14529. t['Nmonospace'] = 0xFF2E;
  14530. t['Nowarmenian'] = 0x0546;
  14531. t['Nsmall'] = 0xF76E;
  14532. t['Ntilde'] = 0x00D1;
  14533. t['Ntildesmall'] = 0xF7F1;
  14534. t['Nu'] = 0x039D;
  14535. t['O'] = 0x004F;
  14536. t['OE'] = 0x0152;
  14537. t['OEsmall'] = 0xF6FA;
  14538. t['Oacute'] = 0x00D3;
  14539. t['Oacutesmall'] = 0xF7F3;
  14540. t['Obarredcyrillic'] = 0x04E8;
  14541. t['Obarreddieresiscyrillic'] = 0x04EA;
  14542. t['Obreve'] = 0x014E;
  14543. t['Ocaron'] = 0x01D1;
  14544. t['Ocenteredtilde'] = 0x019F;
  14545. t['Ocircle'] = 0x24C4;
  14546. t['Ocircumflex'] = 0x00D4;
  14547. t['Ocircumflexacute'] = 0x1ED0;
  14548. t['Ocircumflexdotbelow'] = 0x1ED8;
  14549. t['Ocircumflexgrave'] = 0x1ED2;
  14550. t['Ocircumflexhookabove'] = 0x1ED4;
  14551. t['Ocircumflexsmall'] = 0xF7F4;
  14552. t['Ocircumflextilde'] = 0x1ED6;
  14553. t['Ocyrillic'] = 0x041E;
  14554. t['Odblacute'] = 0x0150;
  14555. t['Odblgrave'] = 0x020C;
  14556. t['Odieresis'] = 0x00D6;
  14557. t['Odieresiscyrillic'] = 0x04E6;
  14558. t['Odieresissmall'] = 0xF7F6;
  14559. t['Odotbelow'] = 0x1ECC;
  14560. t['Ogoneksmall'] = 0xF6FB;
  14561. t['Ograve'] = 0x00D2;
  14562. t['Ogravesmall'] = 0xF7F2;
  14563. t['Oharmenian'] = 0x0555;
  14564. t['Ohm'] = 0x2126;
  14565. t['Ohookabove'] = 0x1ECE;
  14566. t['Ohorn'] = 0x01A0;
  14567. t['Ohornacute'] = 0x1EDA;
  14568. t['Ohorndotbelow'] = 0x1EE2;
  14569. t['Ohorngrave'] = 0x1EDC;
  14570. t['Ohornhookabove'] = 0x1EDE;
  14571. t['Ohorntilde'] = 0x1EE0;
  14572. t['Ohungarumlaut'] = 0x0150;
  14573. t['Oi'] = 0x01A2;
  14574. t['Oinvertedbreve'] = 0x020E;
  14575. t['Omacron'] = 0x014C;
  14576. t['Omacronacute'] = 0x1E52;
  14577. t['Omacrongrave'] = 0x1E50;
  14578. t['Omega'] = 0x2126;
  14579. t['Omegacyrillic'] = 0x0460;
  14580. t['Omegagreek'] = 0x03A9;
  14581. t['Omegaroundcyrillic'] = 0x047A;
  14582. t['Omegatitlocyrillic'] = 0x047C;
  14583. t['Omegatonos'] = 0x038F;
  14584. t['Omicron'] = 0x039F;
  14585. t['Omicrontonos'] = 0x038C;
  14586. t['Omonospace'] = 0xFF2F;
  14587. t['Oneroman'] = 0x2160;
  14588. t['Oogonek'] = 0x01EA;
  14589. t['Oogonekmacron'] = 0x01EC;
  14590. t['Oopen'] = 0x0186;
  14591. t['Oslash'] = 0x00D8;
  14592. t['Oslashacute'] = 0x01FE;
  14593. t['Oslashsmall'] = 0xF7F8;
  14594. t['Osmall'] = 0xF76F;
  14595. t['Ostrokeacute'] = 0x01FE;
  14596. t['Otcyrillic'] = 0x047E;
  14597. t['Otilde'] = 0x00D5;
  14598. t['Otildeacute'] = 0x1E4C;
  14599. t['Otildedieresis'] = 0x1E4E;
  14600. t['Otildesmall'] = 0xF7F5;
  14601. t['P'] = 0x0050;
  14602. t['Pacute'] = 0x1E54;
  14603. t['Pcircle'] = 0x24C5;
  14604. t['Pdotaccent'] = 0x1E56;
  14605. t['Pecyrillic'] = 0x041F;
  14606. t['Peharmenian'] = 0x054A;
  14607. t['Pemiddlehookcyrillic'] = 0x04A6;
  14608. t['Phi'] = 0x03A6;
  14609. t['Phook'] = 0x01A4;
  14610. t['Pi'] = 0x03A0;
  14611. t['Piwrarmenian'] = 0x0553;
  14612. t['Pmonospace'] = 0xFF30;
  14613. t['Psi'] = 0x03A8;
  14614. t['Psicyrillic'] = 0x0470;
  14615. t['Psmall'] = 0xF770;
  14616. t['Q'] = 0x0051;
  14617. t['Qcircle'] = 0x24C6;
  14618. t['Qmonospace'] = 0xFF31;
  14619. t['Qsmall'] = 0xF771;
  14620. t['R'] = 0x0052;
  14621. t['Raarmenian'] = 0x054C;
  14622. t['Racute'] = 0x0154;
  14623. t['Rcaron'] = 0x0158;
  14624. t['Rcedilla'] = 0x0156;
  14625. t['Rcircle'] = 0x24C7;
  14626. t['Rcommaaccent'] = 0x0156;
  14627. t['Rdblgrave'] = 0x0210;
  14628. t['Rdotaccent'] = 0x1E58;
  14629. t['Rdotbelow'] = 0x1E5A;
  14630. t['Rdotbelowmacron'] = 0x1E5C;
  14631. t['Reharmenian'] = 0x0550;
  14632. t['Rfraktur'] = 0x211C;
  14633. t['Rho'] = 0x03A1;
  14634. t['Ringsmall'] = 0xF6FC;
  14635. t['Rinvertedbreve'] = 0x0212;
  14636. t['Rlinebelow'] = 0x1E5E;
  14637. t['Rmonospace'] = 0xFF32;
  14638. t['Rsmall'] = 0xF772;
  14639. t['Rsmallinverted'] = 0x0281;
  14640. t['Rsmallinvertedsuperior'] = 0x02B6;
  14641. t['S'] = 0x0053;
  14642. t['SF010000'] = 0x250C;
  14643. t['SF020000'] = 0x2514;
  14644. t['SF030000'] = 0x2510;
  14645. t['SF040000'] = 0x2518;
  14646. t['SF050000'] = 0x253C;
  14647. t['SF060000'] = 0x252C;
  14648. t['SF070000'] = 0x2534;
  14649. t['SF080000'] = 0x251C;
  14650. t['SF090000'] = 0x2524;
  14651. t['SF100000'] = 0x2500;
  14652. t['SF110000'] = 0x2502;
  14653. t['SF190000'] = 0x2561;
  14654. t['SF200000'] = 0x2562;
  14655. t['SF210000'] = 0x2556;
  14656. t['SF220000'] = 0x2555;
  14657. t['SF230000'] = 0x2563;
  14658. t['SF240000'] = 0x2551;
  14659. t['SF250000'] = 0x2557;
  14660. t['SF260000'] = 0x255D;
  14661. t['SF270000'] = 0x255C;
  14662. t['SF280000'] = 0x255B;
  14663. t['SF360000'] = 0x255E;
  14664. t['SF370000'] = 0x255F;
  14665. t['SF380000'] = 0x255A;
  14666. t['SF390000'] = 0x2554;
  14667. t['SF400000'] = 0x2569;
  14668. t['SF410000'] = 0x2566;
  14669. t['SF420000'] = 0x2560;
  14670. t['SF430000'] = 0x2550;
  14671. t['SF440000'] = 0x256C;
  14672. t['SF450000'] = 0x2567;
  14673. t['SF460000'] = 0x2568;
  14674. t['SF470000'] = 0x2564;
  14675. t['SF480000'] = 0x2565;
  14676. t['SF490000'] = 0x2559;
  14677. t['SF500000'] = 0x2558;
  14678. t['SF510000'] = 0x2552;
  14679. t['SF520000'] = 0x2553;
  14680. t['SF530000'] = 0x256B;
  14681. t['SF540000'] = 0x256A;
  14682. t['Sacute'] = 0x015A;
  14683. t['Sacutedotaccent'] = 0x1E64;
  14684. t['Sampigreek'] = 0x03E0;
  14685. t['Scaron'] = 0x0160;
  14686. t['Scarondotaccent'] = 0x1E66;
  14687. t['Scaronsmall'] = 0xF6FD;
  14688. t['Scedilla'] = 0x015E;
  14689. t['Schwa'] = 0x018F;
  14690. t['Schwacyrillic'] = 0x04D8;
  14691. t['Schwadieresiscyrillic'] = 0x04DA;
  14692. t['Scircle'] = 0x24C8;
  14693. t['Scircumflex'] = 0x015C;
  14694. t['Scommaaccent'] = 0x0218;
  14695. t['Sdotaccent'] = 0x1E60;
  14696. t['Sdotbelow'] = 0x1E62;
  14697. t['Sdotbelowdotaccent'] = 0x1E68;
  14698. t['Seharmenian'] = 0x054D;
  14699. t['Sevenroman'] = 0x2166;
  14700. t['Shaarmenian'] = 0x0547;
  14701. t['Shacyrillic'] = 0x0428;
  14702. t['Shchacyrillic'] = 0x0429;
  14703. t['Sheicoptic'] = 0x03E2;
  14704. t['Shhacyrillic'] = 0x04BA;
  14705. t['Shimacoptic'] = 0x03EC;
  14706. t['Sigma'] = 0x03A3;
  14707. t['Sixroman'] = 0x2165;
  14708. t['Smonospace'] = 0xFF33;
  14709. t['Softsigncyrillic'] = 0x042C;
  14710. t['Ssmall'] = 0xF773;
  14711. t['Stigmagreek'] = 0x03DA;
  14712. t['T'] = 0x0054;
  14713. t['Tau'] = 0x03A4;
  14714. t['Tbar'] = 0x0166;
  14715. t['Tcaron'] = 0x0164;
  14716. t['Tcedilla'] = 0x0162;
  14717. t['Tcircle'] = 0x24C9;
  14718. t['Tcircumflexbelow'] = 0x1E70;
  14719. t['Tcommaaccent'] = 0x0162;
  14720. t['Tdotaccent'] = 0x1E6A;
  14721. t['Tdotbelow'] = 0x1E6C;
  14722. t['Tecyrillic'] = 0x0422;
  14723. t['Tedescendercyrillic'] = 0x04AC;
  14724. t['Tenroman'] = 0x2169;
  14725. t['Tetsecyrillic'] = 0x04B4;
  14726. t['Theta'] = 0x0398;
  14727. t['Thook'] = 0x01AC;
  14728. t['Thorn'] = 0x00DE;
  14729. t['Thornsmall'] = 0xF7FE;
  14730. t['Threeroman'] = 0x2162;
  14731. t['Tildesmall'] = 0xF6FE;
  14732. t['Tiwnarmenian'] = 0x054F;
  14733. t['Tlinebelow'] = 0x1E6E;
  14734. t['Tmonospace'] = 0xFF34;
  14735. t['Toarmenian'] = 0x0539;
  14736. t['Tonefive'] = 0x01BC;
  14737. t['Tonesix'] = 0x0184;
  14738. t['Tonetwo'] = 0x01A7;
  14739. t['Tretroflexhook'] = 0x01AE;
  14740. t['Tsecyrillic'] = 0x0426;
  14741. t['Tshecyrillic'] = 0x040B;
  14742. t['Tsmall'] = 0xF774;
  14743. t['Twelveroman'] = 0x216B;
  14744. t['Tworoman'] = 0x2161;
  14745. t['U'] = 0x0055;
  14746. t['Uacute'] = 0x00DA;
  14747. t['Uacutesmall'] = 0xF7FA;
  14748. t['Ubreve'] = 0x016C;
  14749. t['Ucaron'] = 0x01D3;
  14750. t['Ucircle'] = 0x24CA;
  14751. t['Ucircumflex'] = 0x00DB;
  14752. t['Ucircumflexbelow'] = 0x1E76;
  14753. t['Ucircumflexsmall'] = 0xF7FB;
  14754. t['Ucyrillic'] = 0x0423;
  14755. t['Udblacute'] = 0x0170;
  14756. t['Udblgrave'] = 0x0214;
  14757. t['Udieresis'] = 0x00DC;
  14758. t['Udieresisacute'] = 0x01D7;
  14759. t['Udieresisbelow'] = 0x1E72;
  14760. t['Udieresiscaron'] = 0x01D9;
  14761. t['Udieresiscyrillic'] = 0x04F0;
  14762. t['Udieresisgrave'] = 0x01DB;
  14763. t['Udieresismacron'] = 0x01D5;
  14764. t['Udieresissmall'] = 0xF7FC;
  14765. t['Udotbelow'] = 0x1EE4;
  14766. t['Ugrave'] = 0x00D9;
  14767. t['Ugravesmall'] = 0xF7F9;
  14768. t['Uhookabove'] = 0x1EE6;
  14769. t['Uhorn'] = 0x01AF;
  14770. t['Uhornacute'] = 0x1EE8;
  14771. t['Uhorndotbelow'] = 0x1EF0;
  14772. t['Uhorngrave'] = 0x1EEA;
  14773. t['Uhornhookabove'] = 0x1EEC;
  14774. t['Uhorntilde'] = 0x1EEE;
  14775. t['Uhungarumlaut'] = 0x0170;
  14776. t['Uhungarumlautcyrillic'] = 0x04F2;
  14777. t['Uinvertedbreve'] = 0x0216;
  14778. t['Ukcyrillic'] = 0x0478;
  14779. t['Umacron'] = 0x016A;
  14780. t['Umacroncyrillic'] = 0x04EE;
  14781. t['Umacrondieresis'] = 0x1E7A;
  14782. t['Umonospace'] = 0xFF35;
  14783. t['Uogonek'] = 0x0172;
  14784. t['Upsilon'] = 0x03A5;
  14785. t['Upsilon1'] = 0x03D2;
  14786. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  14787. t['Upsilonafrican'] = 0x01B1;
  14788. t['Upsilondieresis'] = 0x03AB;
  14789. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  14790. t['Upsilonhooksymbol'] = 0x03D2;
  14791. t['Upsilontonos'] = 0x038E;
  14792. t['Uring'] = 0x016E;
  14793. t['Ushortcyrillic'] = 0x040E;
  14794. t['Usmall'] = 0xF775;
  14795. t['Ustraightcyrillic'] = 0x04AE;
  14796. t['Ustraightstrokecyrillic'] = 0x04B0;
  14797. t['Utilde'] = 0x0168;
  14798. t['Utildeacute'] = 0x1E78;
  14799. t['Utildebelow'] = 0x1E74;
  14800. t['V'] = 0x0056;
  14801. t['Vcircle'] = 0x24CB;
  14802. t['Vdotbelow'] = 0x1E7E;
  14803. t['Vecyrillic'] = 0x0412;
  14804. t['Vewarmenian'] = 0x054E;
  14805. t['Vhook'] = 0x01B2;
  14806. t['Vmonospace'] = 0xFF36;
  14807. t['Voarmenian'] = 0x0548;
  14808. t['Vsmall'] = 0xF776;
  14809. t['Vtilde'] = 0x1E7C;
  14810. t['W'] = 0x0057;
  14811. t['Wacute'] = 0x1E82;
  14812. t['Wcircle'] = 0x24CC;
  14813. t['Wcircumflex'] = 0x0174;
  14814. t['Wdieresis'] = 0x1E84;
  14815. t['Wdotaccent'] = 0x1E86;
  14816. t['Wdotbelow'] = 0x1E88;
  14817. t['Wgrave'] = 0x1E80;
  14818. t['Wmonospace'] = 0xFF37;
  14819. t['Wsmall'] = 0xF777;
  14820. t['X'] = 0x0058;
  14821. t['Xcircle'] = 0x24CD;
  14822. t['Xdieresis'] = 0x1E8C;
  14823. t['Xdotaccent'] = 0x1E8A;
  14824. t['Xeharmenian'] = 0x053D;
  14825. t['Xi'] = 0x039E;
  14826. t['Xmonospace'] = 0xFF38;
  14827. t['Xsmall'] = 0xF778;
  14828. t['Y'] = 0x0059;
  14829. t['Yacute'] = 0x00DD;
  14830. t['Yacutesmall'] = 0xF7FD;
  14831. t['Yatcyrillic'] = 0x0462;
  14832. t['Ycircle'] = 0x24CE;
  14833. t['Ycircumflex'] = 0x0176;
  14834. t['Ydieresis'] = 0x0178;
  14835. t['Ydieresissmall'] = 0xF7FF;
  14836. t['Ydotaccent'] = 0x1E8E;
  14837. t['Ydotbelow'] = 0x1EF4;
  14838. t['Yericyrillic'] = 0x042B;
  14839. t['Yerudieresiscyrillic'] = 0x04F8;
  14840. t['Ygrave'] = 0x1EF2;
  14841. t['Yhook'] = 0x01B3;
  14842. t['Yhookabove'] = 0x1EF6;
  14843. t['Yiarmenian'] = 0x0545;
  14844. t['Yicyrillic'] = 0x0407;
  14845. t['Yiwnarmenian'] = 0x0552;
  14846. t['Ymonospace'] = 0xFF39;
  14847. t['Ysmall'] = 0xF779;
  14848. t['Ytilde'] = 0x1EF8;
  14849. t['Yusbigcyrillic'] = 0x046A;
  14850. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14851. t['Yuslittlecyrillic'] = 0x0466;
  14852. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14853. t['Z'] = 0x005A;
  14854. t['Zaarmenian'] = 0x0536;
  14855. t['Zacute'] = 0x0179;
  14856. t['Zcaron'] = 0x017D;
  14857. t['Zcaronsmall'] = 0xF6FF;
  14858. t['Zcircle'] = 0x24CF;
  14859. t['Zcircumflex'] = 0x1E90;
  14860. t['Zdot'] = 0x017B;
  14861. t['Zdotaccent'] = 0x017B;
  14862. t['Zdotbelow'] = 0x1E92;
  14863. t['Zecyrillic'] = 0x0417;
  14864. t['Zedescendercyrillic'] = 0x0498;
  14865. t['Zedieresiscyrillic'] = 0x04DE;
  14866. t['Zeta'] = 0x0396;
  14867. t['Zhearmenian'] = 0x053A;
  14868. t['Zhebrevecyrillic'] = 0x04C1;
  14869. t['Zhecyrillic'] = 0x0416;
  14870. t['Zhedescendercyrillic'] = 0x0496;
  14871. t['Zhedieresiscyrillic'] = 0x04DC;
  14872. t['Zlinebelow'] = 0x1E94;
  14873. t['Zmonospace'] = 0xFF3A;
  14874. t['Zsmall'] = 0xF77A;
  14875. t['Zstroke'] = 0x01B5;
  14876. t['a'] = 0x0061;
  14877. t['aabengali'] = 0x0986;
  14878. t['aacute'] = 0x00E1;
  14879. t['aadeva'] = 0x0906;
  14880. t['aagujarati'] = 0x0A86;
  14881. t['aagurmukhi'] = 0x0A06;
  14882. t['aamatragurmukhi'] = 0x0A3E;
  14883. t['aarusquare'] = 0x3303;
  14884. t['aavowelsignbengali'] = 0x09BE;
  14885. t['aavowelsigndeva'] = 0x093E;
  14886. t['aavowelsigngujarati'] = 0x0ABE;
  14887. t['abbreviationmarkarmenian'] = 0x055F;
  14888. t['abbreviationsigndeva'] = 0x0970;
  14889. t['abengali'] = 0x0985;
  14890. t['abopomofo'] = 0x311A;
  14891. t['abreve'] = 0x0103;
  14892. t['abreveacute'] = 0x1EAF;
  14893. t['abrevecyrillic'] = 0x04D1;
  14894. t['abrevedotbelow'] = 0x1EB7;
  14895. t['abrevegrave'] = 0x1EB1;
  14896. t['abrevehookabove'] = 0x1EB3;
  14897. t['abrevetilde'] = 0x1EB5;
  14898. t['acaron'] = 0x01CE;
  14899. t['acircle'] = 0x24D0;
  14900. t['acircumflex'] = 0x00E2;
  14901. t['acircumflexacute'] = 0x1EA5;
  14902. t['acircumflexdotbelow'] = 0x1EAD;
  14903. t['acircumflexgrave'] = 0x1EA7;
  14904. t['acircumflexhookabove'] = 0x1EA9;
  14905. t['acircumflextilde'] = 0x1EAB;
  14906. t['acute'] = 0x00B4;
  14907. t['acutebelowcmb'] = 0x0317;
  14908. t['acutecmb'] = 0x0301;
  14909. t['acutecomb'] = 0x0301;
  14910. t['acutedeva'] = 0x0954;
  14911. t['acutelowmod'] = 0x02CF;
  14912. t['acutetonecmb'] = 0x0341;
  14913. t['acyrillic'] = 0x0430;
  14914. t['adblgrave'] = 0x0201;
  14915. t['addakgurmukhi'] = 0x0A71;
  14916. t['adeva'] = 0x0905;
  14917. t['adieresis'] = 0x00E4;
  14918. t['adieresiscyrillic'] = 0x04D3;
  14919. t['adieresismacron'] = 0x01DF;
  14920. t['adotbelow'] = 0x1EA1;
  14921. t['adotmacron'] = 0x01E1;
  14922. t['ae'] = 0x00E6;
  14923. t['aeacute'] = 0x01FD;
  14924. t['aekorean'] = 0x3150;
  14925. t['aemacron'] = 0x01E3;
  14926. t['afii00208'] = 0x2015;
  14927. t['afii08941'] = 0x20A4;
  14928. t['afii10017'] = 0x0410;
  14929. t['afii10018'] = 0x0411;
  14930. t['afii10019'] = 0x0412;
  14931. t['afii10020'] = 0x0413;
  14932. t['afii10021'] = 0x0414;
  14933. t['afii10022'] = 0x0415;
  14934. t['afii10023'] = 0x0401;
  14935. t['afii10024'] = 0x0416;
  14936. t['afii10025'] = 0x0417;
  14937. t['afii10026'] = 0x0418;
  14938. t['afii10027'] = 0x0419;
  14939. t['afii10028'] = 0x041A;
  14940. t['afii10029'] = 0x041B;
  14941. t['afii10030'] = 0x041C;
  14942. t['afii10031'] = 0x041D;
  14943. t['afii10032'] = 0x041E;
  14944. t['afii10033'] = 0x041F;
  14945. t['afii10034'] = 0x0420;
  14946. t['afii10035'] = 0x0421;
  14947. t['afii10036'] = 0x0422;
  14948. t['afii10037'] = 0x0423;
  14949. t['afii10038'] = 0x0424;
  14950. t['afii10039'] = 0x0425;
  14951. t['afii10040'] = 0x0426;
  14952. t['afii10041'] = 0x0427;
  14953. t['afii10042'] = 0x0428;
  14954. t['afii10043'] = 0x0429;
  14955. t['afii10044'] = 0x042A;
  14956. t['afii10045'] = 0x042B;
  14957. t['afii10046'] = 0x042C;
  14958. t['afii10047'] = 0x042D;
  14959. t['afii10048'] = 0x042E;
  14960. t['afii10049'] = 0x042F;
  14961. t['afii10050'] = 0x0490;
  14962. t['afii10051'] = 0x0402;
  14963. t['afii10052'] = 0x0403;
  14964. t['afii10053'] = 0x0404;
  14965. t['afii10054'] = 0x0405;
  14966. t['afii10055'] = 0x0406;
  14967. t['afii10056'] = 0x0407;
  14968. t['afii10057'] = 0x0408;
  14969. t['afii10058'] = 0x0409;
  14970. t['afii10059'] = 0x040A;
  14971. t['afii10060'] = 0x040B;
  14972. t['afii10061'] = 0x040C;
  14973. t['afii10062'] = 0x040E;
  14974. t['afii10063'] = 0xF6C4;
  14975. t['afii10064'] = 0xF6C5;
  14976. t['afii10065'] = 0x0430;
  14977. t['afii10066'] = 0x0431;
  14978. t['afii10067'] = 0x0432;
  14979. t['afii10068'] = 0x0433;
  14980. t['afii10069'] = 0x0434;
  14981. t['afii10070'] = 0x0435;
  14982. t['afii10071'] = 0x0451;
  14983. t['afii10072'] = 0x0436;
  14984. t['afii10073'] = 0x0437;
  14985. t['afii10074'] = 0x0438;
  14986. t['afii10075'] = 0x0439;
  14987. t['afii10076'] = 0x043A;
  14988. t['afii10077'] = 0x043B;
  14989. t['afii10078'] = 0x043C;
  14990. t['afii10079'] = 0x043D;
  14991. t['afii10080'] = 0x043E;
  14992. t['afii10081'] = 0x043F;
  14993. t['afii10082'] = 0x0440;
  14994. t['afii10083'] = 0x0441;
  14995. t['afii10084'] = 0x0442;
  14996. t['afii10085'] = 0x0443;
  14997. t['afii10086'] = 0x0444;
  14998. t['afii10087'] = 0x0445;
  14999. t['afii10088'] = 0x0446;
  15000. t['afii10089'] = 0x0447;
  15001. t['afii10090'] = 0x0448;
  15002. t['afii10091'] = 0x0449;
  15003. t['afii10092'] = 0x044A;
  15004. t['afii10093'] = 0x044B;
  15005. t['afii10094'] = 0x044C;
  15006. t['afii10095'] = 0x044D;
  15007. t['afii10096'] = 0x044E;
  15008. t['afii10097'] = 0x044F;
  15009. t['afii10098'] = 0x0491;
  15010. t['afii10099'] = 0x0452;
  15011. t['afii10100'] = 0x0453;
  15012. t['afii10101'] = 0x0454;
  15013. t['afii10102'] = 0x0455;
  15014. t['afii10103'] = 0x0456;
  15015. t['afii10104'] = 0x0457;
  15016. t['afii10105'] = 0x0458;
  15017. t['afii10106'] = 0x0459;
  15018. t['afii10107'] = 0x045A;
  15019. t['afii10108'] = 0x045B;
  15020. t['afii10109'] = 0x045C;
  15021. t['afii10110'] = 0x045E;
  15022. t['afii10145'] = 0x040F;
  15023. t['afii10146'] = 0x0462;
  15024. t['afii10147'] = 0x0472;
  15025. t['afii10148'] = 0x0474;
  15026. t['afii10192'] = 0xF6C6;
  15027. t['afii10193'] = 0x045F;
  15028. t['afii10194'] = 0x0463;
  15029. t['afii10195'] = 0x0473;
  15030. t['afii10196'] = 0x0475;
  15031. t['afii10831'] = 0xF6C7;
  15032. t['afii10832'] = 0xF6C8;
  15033. t['afii10846'] = 0x04D9;
  15034. t['afii299'] = 0x200E;
  15035. t['afii300'] = 0x200F;
  15036. t['afii301'] = 0x200D;
  15037. t['afii57381'] = 0x066A;
  15038. t['afii57388'] = 0x060C;
  15039. t['afii57392'] = 0x0660;
  15040. t['afii57393'] = 0x0661;
  15041. t['afii57394'] = 0x0662;
  15042. t['afii57395'] = 0x0663;
  15043. t['afii57396'] = 0x0664;
  15044. t['afii57397'] = 0x0665;
  15045. t['afii57398'] = 0x0666;
  15046. t['afii57399'] = 0x0667;
  15047. t['afii57400'] = 0x0668;
  15048. t['afii57401'] = 0x0669;
  15049. t['afii57403'] = 0x061B;
  15050. t['afii57407'] = 0x061F;
  15051. t['afii57409'] = 0x0621;
  15052. t['afii57410'] = 0x0622;
  15053. t['afii57411'] = 0x0623;
  15054. t['afii57412'] = 0x0624;
  15055. t['afii57413'] = 0x0625;
  15056. t['afii57414'] = 0x0626;
  15057. t['afii57415'] = 0x0627;
  15058. t['afii57416'] = 0x0628;
  15059. t['afii57417'] = 0x0629;
  15060. t['afii57418'] = 0x062A;
  15061. t['afii57419'] = 0x062B;
  15062. t['afii57420'] = 0x062C;
  15063. t['afii57421'] = 0x062D;
  15064. t['afii57422'] = 0x062E;
  15065. t['afii57423'] = 0x062F;
  15066. t['afii57424'] = 0x0630;
  15067. t['afii57425'] = 0x0631;
  15068. t['afii57426'] = 0x0632;
  15069. t['afii57427'] = 0x0633;
  15070. t['afii57428'] = 0x0634;
  15071. t['afii57429'] = 0x0635;
  15072. t['afii57430'] = 0x0636;
  15073. t['afii57431'] = 0x0637;
  15074. t['afii57432'] = 0x0638;
  15075. t['afii57433'] = 0x0639;
  15076. t['afii57434'] = 0x063A;
  15077. t['afii57440'] = 0x0640;
  15078. t['afii57441'] = 0x0641;
  15079. t['afii57442'] = 0x0642;
  15080. t['afii57443'] = 0x0643;
  15081. t['afii57444'] = 0x0644;
  15082. t['afii57445'] = 0x0645;
  15083. t['afii57446'] = 0x0646;
  15084. t['afii57448'] = 0x0648;
  15085. t['afii57449'] = 0x0649;
  15086. t['afii57450'] = 0x064A;
  15087. t['afii57451'] = 0x064B;
  15088. t['afii57452'] = 0x064C;
  15089. t['afii57453'] = 0x064D;
  15090. t['afii57454'] = 0x064E;
  15091. t['afii57455'] = 0x064F;
  15092. t['afii57456'] = 0x0650;
  15093. t['afii57457'] = 0x0651;
  15094. t['afii57458'] = 0x0652;
  15095. t['afii57470'] = 0x0647;
  15096. t['afii57505'] = 0x06A4;
  15097. t['afii57506'] = 0x067E;
  15098. t['afii57507'] = 0x0686;
  15099. t['afii57508'] = 0x0698;
  15100. t['afii57509'] = 0x06AF;
  15101. t['afii57511'] = 0x0679;
  15102. t['afii57512'] = 0x0688;
  15103. t['afii57513'] = 0x0691;
  15104. t['afii57514'] = 0x06BA;
  15105. t['afii57519'] = 0x06D2;
  15106. t['afii57534'] = 0x06D5;
  15107. t['afii57636'] = 0x20AA;
  15108. t['afii57645'] = 0x05BE;
  15109. t['afii57658'] = 0x05C3;
  15110. t['afii57664'] = 0x05D0;
  15111. t['afii57665'] = 0x05D1;
  15112. t['afii57666'] = 0x05D2;
  15113. t['afii57667'] = 0x05D3;
  15114. t['afii57668'] = 0x05D4;
  15115. t['afii57669'] = 0x05D5;
  15116. t['afii57670'] = 0x05D6;
  15117. t['afii57671'] = 0x05D7;
  15118. t['afii57672'] = 0x05D8;
  15119. t['afii57673'] = 0x05D9;
  15120. t['afii57674'] = 0x05DA;
  15121. t['afii57675'] = 0x05DB;
  15122. t['afii57676'] = 0x05DC;
  15123. t['afii57677'] = 0x05DD;
  15124. t['afii57678'] = 0x05DE;
  15125. t['afii57679'] = 0x05DF;
  15126. t['afii57680'] = 0x05E0;
  15127. t['afii57681'] = 0x05E1;
  15128. t['afii57682'] = 0x05E2;
  15129. t['afii57683'] = 0x05E3;
  15130. t['afii57684'] = 0x05E4;
  15131. t['afii57685'] = 0x05E5;
  15132. t['afii57686'] = 0x05E6;
  15133. t['afii57687'] = 0x05E7;
  15134. t['afii57688'] = 0x05E8;
  15135. t['afii57689'] = 0x05E9;
  15136. t['afii57690'] = 0x05EA;
  15137. t['afii57694'] = 0xFB2A;
  15138. t['afii57695'] = 0xFB2B;
  15139. t['afii57700'] = 0xFB4B;
  15140. t['afii57705'] = 0xFB1F;
  15141. t['afii57716'] = 0x05F0;
  15142. t['afii57717'] = 0x05F1;
  15143. t['afii57718'] = 0x05F2;
  15144. t['afii57723'] = 0xFB35;
  15145. t['afii57793'] = 0x05B4;
  15146. t['afii57794'] = 0x05B5;
  15147. t['afii57795'] = 0x05B6;
  15148. t['afii57796'] = 0x05BB;
  15149. t['afii57797'] = 0x05B8;
  15150. t['afii57798'] = 0x05B7;
  15151. t['afii57799'] = 0x05B0;
  15152. t['afii57800'] = 0x05B2;
  15153. t['afii57801'] = 0x05B1;
  15154. t['afii57802'] = 0x05B3;
  15155. t['afii57803'] = 0x05C2;
  15156. t['afii57804'] = 0x05C1;
  15157. t['afii57806'] = 0x05B9;
  15158. t['afii57807'] = 0x05BC;
  15159. t['afii57839'] = 0x05BD;
  15160. t['afii57841'] = 0x05BF;
  15161. t['afii57842'] = 0x05C0;
  15162. t['afii57929'] = 0x02BC;
  15163. t['afii61248'] = 0x2105;
  15164. t['afii61289'] = 0x2113;
  15165. t['afii61352'] = 0x2116;
  15166. t['afii61573'] = 0x202C;
  15167. t['afii61574'] = 0x202D;
  15168. t['afii61575'] = 0x202E;
  15169. t['afii61664'] = 0x200C;
  15170. t['afii63167'] = 0x066D;
  15171. t['afii64937'] = 0x02BD;
  15172. t['agrave'] = 0x00E0;
  15173. t['agujarati'] = 0x0A85;
  15174. t['agurmukhi'] = 0x0A05;
  15175. t['ahiragana'] = 0x3042;
  15176. t['ahookabove'] = 0x1EA3;
  15177. t['aibengali'] = 0x0990;
  15178. t['aibopomofo'] = 0x311E;
  15179. t['aideva'] = 0x0910;
  15180. t['aiecyrillic'] = 0x04D5;
  15181. t['aigujarati'] = 0x0A90;
  15182. t['aigurmukhi'] = 0x0A10;
  15183. t['aimatragurmukhi'] = 0x0A48;
  15184. t['ainarabic'] = 0x0639;
  15185. t['ainfinalarabic'] = 0xFECA;
  15186. t['aininitialarabic'] = 0xFECB;
  15187. t['ainmedialarabic'] = 0xFECC;
  15188. t['ainvertedbreve'] = 0x0203;
  15189. t['aivowelsignbengali'] = 0x09C8;
  15190. t['aivowelsigndeva'] = 0x0948;
  15191. t['aivowelsigngujarati'] = 0x0AC8;
  15192. t['akatakana'] = 0x30A2;
  15193. t['akatakanahalfwidth'] = 0xFF71;
  15194. t['akorean'] = 0x314F;
  15195. t['alef'] = 0x05D0;
  15196. t['alefarabic'] = 0x0627;
  15197. t['alefdageshhebrew'] = 0xFB30;
  15198. t['aleffinalarabic'] = 0xFE8E;
  15199. t['alefhamzaabovearabic'] = 0x0623;
  15200. t['alefhamzaabovefinalarabic'] = 0xFE84;
  15201. t['alefhamzabelowarabic'] = 0x0625;
  15202. t['alefhamzabelowfinalarabic'] = 0xFE88;
  15203. t['alefhebrew'] = 0x05D0;
  15204. t['aleflamedhebrew'] = 0xFB4F;
  15205. t['alefmaddaabovearabic'] = 0x0622;
  15206. t['alefmaddaabovefinalarabic'] = 0xFE82;
  15207. t['alefmaksuraarabic'] = 0x0649;
  15208. t['alefmaksurafinalarabic'] = 0xFEF0;
  15209. t['alefmaksurainitialarabic'] = 0xFEF3;
  15210. t['alefmaksuramedialarabic'] = 0xFEF4;
  15211. t['alefpatahhebrew'] = 0xFB2E;
  15212. t['alefqamatshebrew'] = 0xFB2F;
  15213. t['aleph'] = 0x2135;
  15214. t['allequal'] = 0x224C;
  15215. t['alpha'] = 0x03B1;
  15216. t['alphatonos'] = 0x03AC;
  15217. t['amacron'] = 0x0101;
  15218. t['amonospace'] = 0xFF41;
  15219. t['ampersand'] = 0x0026;
  15220. t['ampersandmonospace'] = 0xFF06;
  15221. t['ampersandsmall'] = 0xF726;
  15222. t['amsquare'] = 0x33C2;
  15223. t['anbopomofo'] = 0x3122;
  15224. t['angbopomofo'] = 0x3124;
  15225. t['angbracketleft'] = 0x3008;
  15226. t['angbracketright'] = 0x3009;
  15227. t['angkhankhuthai'] = 0x0E5A;
  15228. t['angle'] = 0x2220;
  15229. t['anglebracketleft'] = 0x3008;
  15230. t['anglebracketleftvertical'] = 0xFE3F;
  15231. t['anglebracketright'] = 0x3009;
  15232. t['anglebracketrightvertical'] = 0xFE40;
  15233. t['angleleft'] = 0x2329;
  15234. t['angleright'] = 0x232A;
  15235. t['angstrom'] = 0x212B;
  15236. t['anoteleia'] = 0x0387;
  15237. t['anudattadeva'] = 0x0952;
  15238. t['anusvarabengali'] = 0x0982;
  15239. t['anusvaradeva'] = 0x0902;
  15240. t['anusvaragujarati'] = 0x0A82;
  15241. t['aogonek'] = 0x0105;
  15242. t['apaatosquare'] = 0x3300;
  15243. t['aparen'] = 0x249C;
  15244. t['apostrophearmenian'] = 0x055A;
  15245. t['apostrophemod'] = 0x02BC;
  15246. t['apple'] = 0xF8FF;
  15247. t['approaches'] = 0x2250;
  15248. t['approxequal'] = 0x2248;
  15249. t['approxequalorimage'] = 0x2252;
  15250. t['approximatelyequal'] = 0x2245;
  15251. t['araeaekorean'] = 0x318E;
  15252. t['araeakorean'] = 0x318D;
  15253. t['arc'] = 0x2312;
  15254. t['arighthalfring'] = 0x1E9A;
  15255. t['aring'] = 0x00E5;
  15256. t['aringacute'] = 0x01FB;
  15257. t['aringbelow'] = 0x1E01;
  15258. t['arrowboth'] = 0x2194;
  15259. t['arrowdashdown'] = 0x21E3;
  15260. t['arrowdashleft'] = 0x21E0;
  15261. t['arrowdashright'] = 0x21E2;
  15262. t['arrowdashup'] = 0x21E1;
  15263. t['arrowdblboth'] = 0x21D4;
  15264. t['arrowdbldown'] = 0x21D3;
  15265. t['arrowdblleft'] = 0x21D0;
  15266. t['arrowdblright'] = 0x21D2;
  15267. t['arrowdblup'] = 0x21D1;
  15268. t['arrowdown'] = 0x2193;
  15269. t['arrowdownleft'] = 0x2199;
  15270. t['arrowdownright'] = 0x2198;
  15271. t['arrowdownwhite'] = 0x21E9;
  15272. t['arrowheaddownmod'] = 0x02C5;
  15273. t['arrowheadleftmod'] = 0x02C2;
  15274. t['arrowheadrightmod'] = 0x02C3;
  15275. t['arrowheadupmod'] = 0x02C4;
  15276. t['arrowhorizex'] = 0xF8E7;
  15277. t['arrowleft'] = 0x2190;
  15278. t['arrowleftdbl'] = 0x21D0;
  15279. t['arrowleftdblstroke'] = 0x21CD;
  15280. t['arrowleftoverright'] = 0x21C6;
  15281. t['arrowleftwhite'] = 0x21E6;
  15282. t['arrowright'] = 0x2192;
  15283. t['arrowrightdblstroke'] = 0x21CF;
  15284. t['arrowrightheavy'] = 0x279E;
  15285. t['arrowrightoverleft'] = 0x21C4;
  15286. t['arrowrightwhite'] = 0x21E8;
  15287. t['arrowtableft'] = 0x21E4;
  15288. t['arrowtabright'] = 0x21E5;
  15289. t['arrowup'] = 0x2191;
  15290. t['arrowupdn'] = 0x2195;
  15291. t['arrowupdnbse'] = 0x21A8;
  15292. t['arrowupdownbase'] = 0x21A8;
  15293. t['arrowupleft'] = 0x2196;
  15294. t['arrowupleftofdown'] = 0x21C5;
  15295. t['arrowupright'] = 0x2197;
  15296. t['arrowupwhite'] = 0x21E7;
  15297. t['arrowvertex'] = 0xF8E6;
  15298. t['asciicircum'] = 0x005E;
  15299. t['asciicircummonospace'] = 0xFF3E;
  15300. t['asciitilde'] = 0x007E;
  15301. t['asciitildemonospace'] = 0xFF5E;
  15302. t['ascript'] = 0x0251;
  15303. t['ascriptturned'] = 0x0252;
  15304. t['asmallhiragana'] = 0x3041;
  15305. t['asmallkatakana'] = 0x30A1;
  15306. t['asmallkatakanahalfwidth'] = 0xFF67;
  15307. t['asterisk'] = 0x002A;
  15308. t['asteriskaltonearabic'] = 0x066D;
  15309. t['asteriskarabic'] = 0x066D;
  15310. t['asteriskmath'] = 0x2217;
  15311. t['asteriskmonospace'] = 0xFF0A;
  15312. t['asterisksmall'] = 0xFE61;
  15313. t['asterism'] = 0x2042;
  15314. t['asuperior'] = 0xF6E9;
  15315. t['asymptoticallyequal'] = 0x2243;
  15316. t['at'] = 0x0040;
  15317. t['atilde'] = 0x00E3;
  15318. t['atmonospace'] = 0xFF20;
  15319. t['atsmall'] = 0xFE6B;
  15320. t['aturned'] = 0x0250;
  15321. t['aubengali'] = 0x0994;
  15322. t['aubopomofo'] = 0x3120;
  15323. t['audeva'] = 0x0914;
  15324. t['augujarati'] = 0x0A94;
  15325. t['augurmukhi'] = 0x0A14;
  15326. t['aulengthmarkbengali'] = 0x09D7;
  15327. t['aumatragurmukhi'] = 0x0A4C;
  15328. t['auvowelsignbengali'] = 0x09CC;
  15329. t['auvowelsigndeva'] = 0x094C;
  15330. t['auvowelsigngujarati'] = 0x0ACC;
  15331. t['avagrahadeva'] = 0x093D;
  15332. t['aybarmenian'] = 0x0561;
  15333. t['ayin'] = 0x05E2;
  15334. t['ayinaltonehebrew'] = 0xFB20;
  15335. t['ayinhebrew'] = 0x05E2;
  15336. t['b'] = 0x0062;
  15337. t['babengali'] = 0x09AC;
  15338. t['backslash'] = 0x005C;
  15339. t['backslashmonospace'] = 0xFF3C;
  15340. t['badeva'] = 0x092C;
  15341. t['bagujarati'] = 0x0AAC;
  15342. t['bagurmukhi'] = 0x0A2C;
  15343. t['bahiragana'] = 0x3070;
  15344. t['bahtthai'] = 0x0E3F;
  15345. t['bakatakana'] = 0x30D0;
  15346. t['bar'] = 0x007C;
  15347. t['barmonospace'] = 0xFF5C;
  15348. t['bbopomofo'] = 0x3105;
  15349. t['bcircle'] = 0x24D1;
  15350. t['bdotaccent'] = 0x1E03;
  15351. t['bdotbelow'] = 0x1E05;
  15352. t['beamedsixteenthnotes'] = 0x266C;
  15353. t['because'] = 0x2235;
  15354. t['becyrillic'] = 0x0431;
  15355. t['beharabic'] = 0x0628;
  15356. t['behfinalarabic'] = 0xFE90;
  15357. t['behinitialarabic'] = 0xFE91;
  15358. t['behiragana'] = 0x3079;
  15359. t['behmedialarabic'] = 0xFE92;
  15360. t['behmeeminitialarabic'] = 0xFC9F;
  15361. t['behmeemisolatedarabic'] = 0xFC08;
  15362. t['behnoonfinalarabic'] = 0xFC6D;
  15363. t['bekatakana'] = 0x30D9;
  15364. t['benarmenian'] = 0x0562;
  15365. t['bet'] = 0x05D1;
  15366. t['beta'] = 0x03B2;
  15367. t['betasymbolgreek'] = 0x03D0;
  15368. t['betdagesh'] = 0xFB31;
  15369. t['betdageshhebrew'] = 0xFB31;
  15370. t['bethebrew'] = 0x05D1;
  15371. t['betrafehebrew'] = 0xFB4C;
  15372. t['bhabengali'] = 0x09AD;
  15373. t['bhadeva'] = 0x092D;
  15374. t['bhagujarati'] = 0x0AAD;
  15375. t['bhagurmukhi'] = 0x0A2D;
  15376. t['bhook'] = 0x0253;
  15377. t['bihiragana'] = 0x3073;
  15378. t['bikatakana'] = 0x30D3;
  15379. t['bilabialclick'] = 0x0298;
  15380. t['bindigurmukhi'] = 0x0A02;
  15381. t['birusquare'] = 0x3331;
  15382. t['blackcircle'] = 0x25CF;
  15383. t['blackdiamond'] = 0x25C6;
  15384. t['blackdownpointingtriangle'] = 0x25BC;
  15385. t['blackleftpointingpointer'] = 0x25C4;
  15386. t['blackleftpointingtriangle'] = 0x25C0;
  15387. t['blacklenticularbracketleft'] = 0x3010;
  15388. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  15389. t['blacklenticularbracketright'] = 0x3011;
  15390. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  15391. t['blacklowerlefttriangle'] = 0x25E3;
  15392. t['blacklowerrighttriangle'] = 0x25E2;
  15393. t['blackrectangle'] = 0x25AC;
  15394. t['blackrightpointingpointer'] = 0x25BA;
  15395. t['blackrightpointingtriangle'] = 0x25B6;
  15396. t['blacksmallsquare'] = 0x25AA;
  15397. t['blacksmilingface'] = 0x263B;
  15398. t['blacksquare'] = 0x25A0;
  15399. t['blackstar'] = 0x2605;
  15400. t['blackupperlefttriangle'] = 0x25E4;
  15401. t['blackupperrighttriangle'] = 0x25E5;
  15402. t['blackuppointingsmalltriangle'] = 0x25B4;
  15403. t['blackuppointingtriangle'] = 0x25B2;
  15404. t['blank'] = 0x2423;
  15405. t['blinebelow'] = 0x1E07;
  15406. t['block'] = 0x2588;
  15407. t['bmonospace'] = 0xFF42;
  15408. t['bobaimaithai'] = 0x0E1A;
  15409. t['bohiragana'] = 0x307C;
  15410. t['bokatakana'] = 0x30DC;
  15411. t['bparen'] = 0x249D;
  15412. t['bqsquare'] = 0x33C3;
  15413. t['braceex'] = 0xF8F4;
  15414. t['braceleft'] = 0x007B;
  15415. t['braceleftbt'] = 0xF8F3;
  15416. t['braceleftmid'] = 0xF8F2;
  15417. t['braceleftmonospace'] = 0xFF5B;
  15418. t['braceleftsmall'] = 0xFE5B;
  15419. t['bracelefttp'] = 0xF8F1;
  15420. t['braceleftvertical'] = 0xFE37;
  15421. t['braceright'] = 0x007D;
  15422. t['bracerightbt'] = 0xF8FE;
  15423. t['bracerightmid'] = 0xF8FD;
  15424. t['bracerightmonospace'] = 0xFF5D;
  15425. t['bracerightsmall'] = 0xFE5C;
  15426. t['bracerighttp'] = 0xF8FC;
  15427. t['bracerightvertical'] = 0xFE38;
  15428. t['bracketleft'] = 0x005B;
  15429. t['bracketleftbt'] = 0xF8F0;
  15430. t['bracketleftex'] = 0xF8EF;
  15431. t['bracketleftmonospace'] = 0xFF3B;
  15432. t['bracketlefttp'] = 0xF8EE;
  15433. t['bracketright'] = 0x005D;
  15434. t['bracketrightbt'] = 0xF8FB;
  15435. t['bracketrightex'] = 0xF8FA;
  15436. t['bracketrightmonospace'] = 0xFF3D;
  15437. t['bracketrighttp'] = 0xF8F9;
  15438. t['breve'] = 0x02D8;
  15439. t['brevebelowcmb'] = 0x032E;
  15440. t['brevecmb'] = 0x0306;
  15441. t['breveinvertedbelowcmb'] = 0x032F;
  15442. t['breveinvertedcmb'] = 0x0311;
  15443. t['breveinverteddoublecmb'] = 0x0361;
  15444. t['bridgebelowcmb'] = 0x032A;
  15445. t['bridgeinvertedbelowcmb'] = 0x033A;
  15446. t['brokenbar'] = 0x00A6;
  15447. t['bstroke'] = 0x0180;
  15448. t['bsuperior'] = 0xF6EA;
  15449. t['btopbar'] = 0x0183;
  15450. t['buhiragana'] = 0x3076;
  15451. t['bukatakana'] = 0x30D6;
  15452. t['bullet'] = 0x2022;
  15453. t['bulletinverse'] = 0x25D8;
  15454. t['bulletoperator'] = 0x2219;
  15455. t['bullseye'] = 0x25CE;
  15456. t['c'] = 0x0063;
  15457. t['caarmenian'] = 0x056E;
  15458. t['cabengali'] = 0x099A;
  15459. t['cacute'] = 0x0107;
  15460. t['cadeva'] = 0x091A;
  15461. t['cagujarati'] = 0x0A9A;
  15462. t['cagurmukhi'] = 0x0A1A;
  15463. t['calsquare'] = 0x3388;
  15464. t['candrabindubengali'] = 0x0981;
  15465. t['candrabinducmb'] = 0x0310;
  15466. t['candrabindudeva'] = 0x0901;
  15467. t['candrabindugujarati'] = 0x0A81;
  15468. t['capslock'] = 0x21EA;
  15469. t['careof'] = 0x2105;
  15470. t['caron'] = 0x02C7;
  15471. t['caronbelowcmb'] = 0x032C;
  15472. t['caroncmb'] = 0x030C;
  15473. t['carriagereturn'] = 0x21B5;
  15474. t['cbopomofo'] = 0x3118;
  15475. t['ccaron'] = 0x010D;
  15476. t['ccedilla'] = 0x00E7;
  15477. t['ccedillaacute'] = 0x1E09;
  15478. t['ccircle'] = 0x24D2;
  15479. t['ccircumflex'] = 0x0109;
  15480. t['ccurl'] = 0x0255;
  15481. t['cdot'] = 0x010B;
  15482. t['cdotaccent'] = 0x010B;
  15483. t['cdsquare'] = 0x33C5;
  15484. t['cedilla'] = 0x00B8;
  15485. t['cedillacmb'] = 0x0327;
  15486. t['cent'] = 0x00A2;
  15487. t['centigrade'] = 0x2103;
  15488. t['centinferior'] = 0xF6DF;
  15489. t['centmonospace'] = 0xFFE0;
  15490. t['centoldstyle'] = 0xF7A2;
  15491. t['centsuperior'] = 0xF6E0;
  15492. t['chaarmenian'] = 0x0579;
  15493. t['chabengali'] = 0x099B;
  15494. t['chadeva'] = 0x091B;
  15495. t['chagujarati'] = 0x0A9B;
  15496. t['chagurmukhi'] = 0x0A1B;
  15497. t['chbopomofo'] = 0x3114;
  15498. t['cheabkhasiancyrillic'] = 0x04BD;
  15499. t['checkmark'] = 0x2713;
  15500. t['checyrillic'] = 0x0447;
  15501. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  15502. t['chedescendercyrillic'] = 0x04B7;
  15503. t['chedieresiscyrillic'] = 0x04F5;
  15504. t['cheharmenian'] = 0x0573;
  15505. t['chekhakassiancyrillic'] = 0x04CC;
  15506. t['cheverticalstrokecyrillic'] = 0x04B9;
  15507. t['chi'] = 0x03C7;
  15508. t['chieuchacirclekorean'] = 0x3277;
  15509. t['chieuchaparenkorean'] = 0x3217;
  15510. t['chieuchcirclekorean'] = 0x3269;
  15511. t['chieuchkorean'] = 0x314A;
  15512. t['chieuchparenkorean'] = 0x3209;
  15513. t['chochangthai'] = 0x0E0A;
  15514. t['chochanthai'] = 0x0E08;
  15515. t['chochingthai'] = 0x0E09;
  15516. t['chochoethai'] = 0x0E0C;
  15517. t['chook'] = 0x0188;
  15518. t['cieucacirclekorean'] = 0x3276;
  15519. t['cieucaparenkorean'] = 0x3216;
  15520. t['cieuccirclekorean'] = 0x3268;
  15521. t['cieuckorean'] = 0x3148;
  15522. t['cieucparenkorean'] = 0x3208;
  15523. t['cieucuparenkorean'] = 0x321C;
  15524. t['circle'] = 0x25CB;
  15525. t['circlecopyrt'] = 0x00A9;
  15526. t['circlemultiply'] = 0x2297;
  15527. t['circleot'] = 0x2299;
  15528. t['circleplus'] = 0x2295;
  15529. t['circlepostalmark'] = 0x3036;
  15530. t['circlewithlefthalfblack'] = 0x25D0;
  15531. t['circlewithrighthalfblack'] = 0x25D1;
  15532. t['circumflex'] = 0x02C6;
  15533. t['circumflexbelowcmb'] = 0x032D;
  15534. t['circumflexcmb'] = 0x0302;
  15535. t['clear'] = 0x2327;
  15536. t['clickalveolar'] = 0x01C2;
  15537. t['clickdental'] = 0x01C0;
  15538. t['clicklateral'] = 0x01C1;
  15539. t['clickretroflex'] = 0x01C3;
  15540. t['club'] = 0x2663;
  15541. t['clubsuitblack'] = 0x2663;
  15542. t['clubsuitwhite'] = 0x2667;
  15543. t['cmcubedsquare'] = 0x33A4;
  15544. t['cmonospace'] = 0xFF43;
  15545. t['cmsquaredsquare'] = 0x33A0;
  15546. t['coarmenian'] = 0x0581;
  15547. t['colon'] = 0x003A;
  15548. t['colonmonetary'] = 0x20A1;
  15549. t['colonmonospace'] = 0xFF1A;
  15550. t['colonsign'] = 0x20A1;
  15551. t['colonsmall'] = 0xFE55;
  15552. t['colontriangularhalfmod'] = 0x02D1;
  15553. t['colontriangularmod'] = 0x02D0;
  15554. t['comma'] = 0x002C;
  15555. t['commaabovecmb'] = 0x0313;
  15556. t['commaaboverightcmb'] = 0x0315;
  15557. t['commaaccent'] = 0xF6C3;
  15558. t['commaarabic'] = 0x060C;
  15559. t['commaarmenian'] = 0x055D;
  15560. t['commainferior'] = 0xF6E1;
  15561. t['commamonospace'] = 0xFF0C;
  15562. t['commareversedabovecmb'] = 0x0314;
  15563. t['commareversedmod'] = 0x02BD;
  15564. t['commasmall'] = 0xFE50;
  15565. t['commasuperior'] = 0xF6E2;
  15566. t['commaturnedabovecmb'] = 0x0312;
  15567. t['commaturnedmod'] = 0x02BB;
  15568. t['compass'] = 0x263C;
  15569. t['congruent'] = 0x2245;
  15570. t['contourintegral'] = 0x222E;
  15571. t['control'] = 0x2303;
  15572. t['controlACK'] = 0x0006;
  15573. t['controlBEL'] = 0x0007;
  15574. t['controlBS'] = 0x0008;
  15575. t['controlCAN'] = 0x0018;
  15576. t['controlCR'] = 0x000D;
  15577. t['controlDC1'] = 0x0011;
  15578. t['controlDC2'] = 0x0012;
  15579. t['controlDC3'] = 0x0013;
  15580. t['controlDC4'] = 0x0014;
  15581. t['controlDEL'] = 0x007F;
  15582. t['controlDLE'] = 0x0010;
  15583. t['controlEM'] = 0x0019;
  15584. t['controlENQ'] = 0x0005;
  15585. t['controlEOT'] = 0x0004;
  15586. t['controlESC'] = 0x001B;
  15587. t['controlETB'] = 0x0017;
  15588. t['controlETX'] = 0x0003;
  15589. t['controlFF'] = 0x000C;
  15590. t['controlFS'] = 0x001C;
  15591. t['controlGS'] = 0x001D;
  15592. t['controlHT'] = 0x0009;
  15593. t['controlLF'] = 0x000A;
  15594. t['controlNAK'] = 0x0015;
  15595. t['controlNULL'] = 0x0000;
  15596. t['controlRS'] = 0x001E;
  15597. t['controlSI'] = 0x000F;
  15598. t['controlSO'] = 0x000E;
  15599. t['controlSOT'] = 0x0002;
  15600. t['controlSTX'] = 0x0001;
  15601. t['controlSUB'] = 0x001A;
  15602. t['controlSYN'] = 0x0016;
  15603. t['controlUS'] = 0x001F;
  15604. t['controlVT'] = 0x000B;
  15605. t['copyright'] = 0x00A9;
  15606. t['copyrightsans'] = 0xF8E9;
  15607. t['copyrightserif'] = 0xF6D9;
  15608. t['cornerbracketleft'] = 0x300C;
  15609. t['cornerbracketlefthalfwidth'] = 0xFF62;
  15610. t['cornerbracketleftvertical'] = 0xFE41;
  15611. t['cornerbracketright'] = 0x300D;
  15612. t['cornerbracketrighthalfwidth'] = 0xFF63;
  15613. t['cornerbracketrightvertical'] = 0xFE42;
  15614. t['corporationsquare'] = 0x337F;
  15615. t['cosquare'] = 0x33C7;
  15616. t['coverkgsquare'] = 0x33C6;
  15617. t['cparen'] = 0x249E;
  15618. t['cruzeiro'] = 0x20A2;
  15619. t['cstretched'] = 0x0297;
  15620. t['curlyand'] = 0x22CF;
  15621. t['curlyor'] = 0x22CE;
  15622. t['currency'] = 0x00A4;
  15623. t['cyrBreve'] = 0xF6D1;
  15624. t['cyrFlex'] = 0xF6D2;
  15625. t['cyrbreve'] = 0xF6D4;
  15626. t['cyrflex'] = 0xF6D5;
  15627. t['d'] = 0x0064;
  15628. t['daarmenian'] = 0x0564;
  15629. t['dabengali'] = 0x09A6;
  15630. t['dadarabic'] = 0x0636;
  15631. t['dadeva'] = 0x0926;
  15632. t['dadfinalarabic'] = 0xFEBE;
  15633. t['dadinitialarabic'] = 0xFEBF;
  15634. t['dadmedialarabic'] = 0xFEC0;
  15635. t['dagesh'] = 0x05BC;
  15636. t['dageshhebrew'] = 0x05BC;
  15637. t['dagger'] = 0x2020;
  15638. t['daggerdbl'] = 0x2021;
  15639. t['dagujarati'] = 0x0AA6;
  15640. t['dagurmukhi'] = 0x0A26;
  15641. t['dahiragana'] = 0x3060;
  15642. t['dakatakana'] = 0x30C0;
  15643. t['dalarabic'] = 0x062F;
  15644. t['dalet'] = 0x05D3;
  15645. t['daletdagesh'] = 0xFB33;
  15646. t['daletdageshhebrew'] = 0xFB33;
  15647. t['dalethebrew'] = 0x05D3;
  15648. t['dalfinalarabic'] = 0xFEAA;
  15649. t['dammaarabic'] = 0x064F;
  15650. t['dammalowarabic'] = 0x064F;
  15651. t['dammatanaltonearabic'] = 0x064C;
  15652. t['dammatanarabic'] = 0x064C;
  15653. t['danda'] = 0x0964;
  15654. t['dargahebrew'] = 0x05A7;
  15655. t['dargalefthebrew'] = 0x05A7;
  15656. t['dasiapneumatacyrilliccmb'] = 0x0485;
  15657. t['dblGrave'] = 0xF6D3;
  15658. t['dblanglebracketleft'] = 0x300A;
  15659. t['dblanglebracketleftvertical'] = 0xFE3D;
  15660. t['dblanglebracketright'] = 0x300B;
  15661. t['dblanglebracketrightvertical'] = 0xFE3E;
  15662. t['dblarchinvertedbelowcmb'] = 0x032B;
  15663. t['dblarrowleft'] = 0x21D4;
  15664. t['dblarrowright'] = 0x21D2;
  15665. t['dbldanda'] = 0x0965;
  15666. t['dblgrave'] = 0xF6D6;
  15667. t['dblgravecmb'] = 0x030F;
  15668. t['dblintegral'] = 0x222C;
  15669. t['dbllowline'] = 0x2017;
  15670. t['dbllowlinecmb'] = 0x0333;
  15671. t['dbloverlinecmb'] = 0x033F;
  15672. t['dblprimemod'] = 0x02BA;
  15673. t['dblverticalbar'] = 0x2016;
  15674. t['dblverticallineabovecmb'] = 0x030E;
  15675. t['dbopomofo'] = 0x3109;
  15676. t['dbsquare'] = 0x33C8;
  15677. t['dcaron'] = 0x010F;
  15678. t['dcedilla'] = 0x1E11;
  15679. t['dcircle'] = 0x24D3;
  15680. t['dcircumflexbelow'] = 0x1E13;
  15681. t['dcroat'] = 0x0111;
  15682. t['ddabengali'] = 0x09A1;
  15683. t['ddadeva'] = 0x0921;
  15684. t['ddagujarati'] = 0x0AA1;
  15685. t['ddagurmukhi'] = 0x0A21;
  15686. t['ddalarabic'] = 0x0688;
  15687. t['ddalfinalarabic'] = 0xFB89;
  15688. t['dddhadeva'] = 0x095C;
  15689. t['ddhabengali'] = 0x09A2;
  15690. t['ddhadeva'] = 0x0922;
  15691. t['ddhagujarati'] = 0x0AA2;
  15692. t['ddhagurmukhi'] = 0x0A22;
  15693. t['ddotaccent'] = 0x1E0B;
  15694. t['ddotbelow'] = 0x1E0D;
  15695. t['decimalseparatorarabic'] = 0x066B;
  15696. t['decimalseparatorpersian'] = 0x066B;
  15697. t['decyrillic'] = 0x0434;
  15698. t['degree'] = 0x00B0;
  15699. t['dehihebrew'] = 0x05AD;
  15700. t['dehiragana'] = 0x3067;
  15701. t['deicoptic'] = 0x03EF;
  15702. t['dekatakana'] = 0x30C7;
  15703. t['deleteleft'] = 0x232B;
  15704. t['deleteright'] = 0x2326;
  15705. t['delta'] = 0x03B4;
  15706. t['deltaturned'] = 0x018D;
  15707. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  15708. t['dezh'] = 0x02A4;
  15709. t['dhabengali'] = 0x09A7;
  15710. t['dhadeva'] = 0x0927;
  15711. t['dhagujarati'] = 0x0AA7;
  15712. t['dhagurmukhi'] = 0x0A27;
  15713. t['dhook'] = 0x0257;
  15714. t['dialytikatonos'] = 0x0385;
  15715. t['dialytikatonoscmb'] = 0x0344;
  15716. t['diamond'] = 0x2666;
  15717. t['diamondsuitwhite'] = 0x2662;
  15718. t['dieresis'] = 0x00A8;
  15719. t['dieresisacute'] = 0xF6D7;
  15720. t['dieresisbelowcmb'] = 0x0324;
  15721. t['dieresiscmb'] = 0x0308;
  15722. t['dieresisgrave'] = 0xF6D8;
  15723. t['dieresistonos'] = 0x0385;
  15724. t['dihiragana'] = 0x3062;
  15725. t['dikatakana'] = 0x30C2;
  15726. t['dittomark'] = 0x3003;
  15727. t['divide'] = 0x00F7;
  15728. t['divides'] = 0x2223;
  15729. t['divisionslash'] = 0x2215;
  15730. t['djecyrillic'] = 0x0452;
  15731. t['dkshade'] = 0x2593;
  15732. t['dlinebelow'] = 0x1E0F;
  15733. t['dlsquare'] = 0x3397;
  15734. t['dmacron'] = 0x0111;
  15735. t['dmonospace'] = 0xFF44;
  15736. t['dnblock'] = 0x2584;
  15737. t['dochadathai'] = 0x0E0E;
  15738. t['dodekthai'] = 0x0E14;
  15739. t['dohiragana'] = 0x3069;
  15740. t['dokatakana'] = 0x30C9;
  15741. t['dollar'] = 0x0024;
  15742. t['dollarinferior'] = 0xF6E3;
  15743. t['dollarmonospace'] = 0xFF04;
  15744. t['dollaroldstyle'] = 0xF724;
  15745. t['dollarsmall'] = 0xFE69;
  15746. t['dollarsuperior'] = 0xF6E4;
  15747. t['dong'] = 0x20AB;
  15748. t['dorusquare'] = 0x3326;
  15749. t['dotaccent'] = 0x02D9;
  15750. t['dotaccentcmb'] = 0x0307;
  15751. t['dotbelowcmb'] = 0x0323;
  15752. t['dotbelowcomb'] = 0x0323;
  15753. t['dotkatakana'] = 0x30FB;
  15754. t['dotlessi'] = 0x0131;
  15755. t['dotlessj'] = 0xF6BE;
  15756. t['dotlessjstrokehook'] = 0x0284;
  15757. t['dotmath'] = 0x22C5;
  15758. t['dottedcircle'] = 0x25CC;
  15759. t['doubleyodpatah'] = 0xFB1F;
  15760. t['doubleyodpatahhebrew'] = 0xFB1F;
  15761. t['downtackbelowcmb'] = 0x031E;
  15762. t['downtackmod'] = 0x02D5;
  15763. t['dparen'] = 0x249F;
  15764. t['dsuperior'] = 0xF6EB;
  15765. t['dtail'] = 0x0256;
  15766. t['dtopbar'] = 0x018C;
  15767. t['duhiragana'] = 0x3065;
  15768. t['dukatakana'] = 0x30C5;
  15769. t['dz'] = 0x01F3;
  15770. t['dzaltone'] = 0x02A3;
  15771. t['dzcaron'] = 0x01C6;
  15772. t['dzcurl'] = 0x02A5;
  15773. t['dzeabkhasiancyrillic'] = 0x04E1;
  15774. t['dzecyrillic'] = 0x0455;
  15775. t['dzhecyrillic'] = 0x045F;
  15776. t['e'] = 0x0065;
  15777. t['eacute'] = 0x00E9;
  15778. t['earth'] = 0x2641;
  15779. t['ebengali'] = 0x098F;
  15780. t['ebopomofo'] = 0x311C;
  15781. t['ebreve'] = 0x0115;
  15782. t['ecandradeva'] = 0x090D;
  15783. t['ecandragujarati'] = 0x0A8D;
  15784. t['ecandravowelsigndeva'] = 0x0945;
  15785. t['ecandravowelsigngujarati'] = 0x0AC5;
  15786. t['ecaron'] = 0x011B;
  15787. t['ecedillabreve'] = 0x1E1D;
  15788. t['echarmenian'] = 0x0565;
  15789. t['echyiwnarmenian'] = 0x0587;
  15790. t['ecircle'] = 0x24D4;
  15791. t['ecircumflex'] = 0x00EA;
  15792. t['ecircumflexacute'] = 0x1EBF;
  15793. t['ecircumflexbelow'] = 0x1E19;
  15794. t['ecircumflexdotbelow'] = 0x1EC7;
  15795. t['ecircumflexgrave'] = 0x1EC1;
  15796. t['ecircumflexhookabove'] = 0x1EC3;
  15797. t['ecircumflextilde'] = 0x1EC5;
  15798. t['ecyrillic'] = 0x0454;
  15799. t['edblgrave'] = 0x0205;
  15800. t['edeva'] = 0x090F;
  15801. t['edieresis'] = 0x00EB;
  15802. t['edot'] = 0x0117;
  15803. t['edotaccent'] = 0x0117;
  15804. t['edotbelow'] = 0x1EB9;
  15805. t['eegurmukhi'] = 0x0A0F;
  15806. t['eematragurmukhi'] = 0x0A47;
  15807. t['efcyrillic'] = 0x0444;
  15808. t['egrave'] = 0x00E8;
  15809. t['egujarati'] = 0x0A8F;
  15810. t['eharmenian'] = 0x0567;
  15811. t['ehbopomofo'] = 0x311D;
  15812. t['ehiragana'] = 0x3048;
  15813. t['ehookabove'] = 0x1EBB;
  15814. t['eibopomofo'] = 0x311F;
  15815. t['eight'] = 0x0038;
  15816. t['eightarabic'] = 0x0668;
  15817. t['eightbengali'] = 0x09EE;
  15818. t['eightcircle'] = 0x2467;
  15819. t['eightcircleinversesansserif'] = 0x2791;
  15820. t['eightdeva'] = 0x096E;
  15821. t['eighteencircle'] = 0x2471;
  15822. t['eighteenparen'] = 0x2485;
  15823. t['eighteenperiod'] = 0x2499;
  15824. t['eightgujarati'] = 0x0AEE;
  15825. t['eightgurmukhi'] = 0x0A6E;
  15826. t['eighthackarabic'] = 0x0668;
  15827. t['eighthangzhou'] = 0x3028;
  15828. t['eighthnotebeamed'] = 0x266B;
  15829. t['eightideographicparen'] = 0x3227;
  15830. t['eightinferior'] = 0x2088;
  15831. t['eightmonospace'] = 0xFF18;
  15832. t['eightoldstyle'] = 0xF738;
  15833. t['eightparen'] = 0x247B;
  15834. t['eightperiod'] = 0x248F;
  15835. t['eightpersian'] = 0x06F8;
  15836. t['eightroman'] = 0x2177;
  15837. t['eightsuperior'] = 0x2078;
  15838. t['eightthai'] = 0x0E58;
  15839. t['einvertedbreve'] = 0x0207;
  15840. t['eiotifiedcyrillic'] = 0x0465;
  15841. t['ekatakana'] = 0x30A8;
  15842. t['ekatakanahalfwidth'] = 0xFF74;
  15843. t['ekonkargurmukhi'] = 0x0A74;
  15844. t['ekorean'] = 0x3154;
  15845. t['elcyrillic'] = 0x043B;
  15846. t['element'] = 0x2208;
  15847. t['elevencircle'] = 0x246A;
  15848. t['elevenparen'] = 0x247E;
  15849. t['elevenperiod'] = 0x2492;
  15850. t['elevenroman'] = 0x217A;
  15851. t['ellipsis'] = 0x2026;
  15852. t['ellipsisvertical'] = 0x22EE;
  15853. t['emacron'] = 0x0113;
  15854. t['emacronacute'] = 0x1E17;
  15855. t['emacrongrave'] = 0x1E15;
  15856. t['emcyrillic'] = 0x043C;
  15857. t['emdash'] = 0x2014;
  15858. t['emdashvertical'] = 0xFE31;
  15859. t['emonospace'] = 0xFF45;
  15860. t['emphasismarkarmenian'] = 0x055B;
  15861. t['emptyset'] = 0x2205;
  15862. t['enbopomofo'] = 0x3123;
  15863. t['encyrillic'] = 0x043D;
  15864. t['endash'] = 0x2013;
  15865. t['endashvertical'] = 0xFE32;
  15866. t['endescendercyrillic'] = 0x04A3;
  15867. t['eng'] = 0x014B;
  15868. t['engbopomofo'] = 0x3125;
  15869. t['enghecyrillic'] = 0x04A5;
  15870. t['enhookcyrillic'] = 0x04C8;
  15871. t['enspace'] = 0x2002;
  15872. t['eogonek'] = 0x0119;
  15873. t['eokorean'] = 0x3153;
  15874. t['eopen'] = 0x025B;
  15875. t['eopenclosed'] = 0x029A;
  15876. t['eopenreversed'] = 0x025C;
  15877. t['eopenreversedclosed'] = 0x025E;
  15878. t['eopenreversedhook'] = 0x025D;
  15879. t['eparen'] = 0x24A0;
  15880. t['epsilon'] = 0x03B5;
  15881. t['epsilontonos'] = 0x03AD;
  15882. t['equal'] = 0x003D;
  15883. t['equalmonospace'] = 0xFF1D;
  15884. t['equalsmall'] = 0xFE66;
  15885. t['equalsuperior'] = 0x207C;
  15886. t['equivalence'] = 0x2261;
  15887. t['erbopomofo'] = 0x3126;
  15888. t['ercyrillic'] = 0x0440;
  15889. t['ereversed'] = 0x0258;
  15890. t['ereversedcyrillic'] = 0x044D;
  15891. t['escyrillic'] = 0x0441;
  15892. t['esdescendercyrillic'] = 0x04AB;
  15893. t['esh'] = 0x0283;
  15894. t['eshcurl'] = 0x0286;
  15895. t['eshortdeva'] = 0x090E;
  15896. t['eshortvowelsigndeva'] = 0x0946;
  15897. t['eshreversedloop'] = 0x01AA;
  15898. t['eshsquatreversed'] = 0x0285;
  15899. t['esmallhiragana'] = 0x3047;
  15900. t['esmallkatakana'] = 0x30A7;
  15901. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15902. t['estimated'] = 0x212E;
  15903. t['esuperior'] = 0xF6EC;
  15904. t['eta'] = 0x03B7;
  15905. t['etarmenian'] = 0x0568;
  15906. t['etatonos'] = 0x03AE;
  15907. t['eth'] = 0x00F0;
  15908. t['etilde'] = 0x1EBD;
  15909. t['etildebelow'] = 0x1E1B;
  15910. t['etnahtafoukhhebrew'] = 0x0591;
  15911. t['etnahtafoukhlefthebrew'] = 0x0591;
  15912. t['etnahtahebrew'] = 0x0591;
  15913. t['etnahtalefthebrew'] = 0x0591;
  15914. t['eturned'] = 0x01DD;
  15915. t['eukorean'] = 0x3161;
  15916. t['euro'] = 0x20AC;
  15917. t['evowelsignbengali'] = 0x09C7;
  15918. t['evowelsigndeva'] = 0x0947;
  15919. t['evowelsigngujarati'] = 0x0AC7;
  15920. t['exclam'] = 0x0021;
  15921. t['exclamarmenian'] = 0x055C;
  15922. t['exclamdbl'] = 0x203C;
  15923. t['exclamdown'] = 0x00A1;
  15924. t['exclamdownsmall'] = 0xF7A1;
  15925. t['exclammonospace'] = 0xFF01;
  15926. t['exclamsmall'] = 0xF721;
  15927. t['existential'] = 0x2203;
  15928. t['ezh'] = 0x0292;
  15929. t['ezhcaron'] = 0x01EF;
  15930. t['ezhcurl'] = 0x0293;
  15931. t['ezhreversed'] = 0x01B9;
  15932. t['ezhtail'] = 0x01BA;
  15933. t['f'] = 0x0066;
  15934. t['fadeva'] = 0x095E;
  15935. t['fagurmukhi'] = 0x0A5E;
  15936. t['fahrenheit'] = 0x2109;
  15937. t['fathaarabic'] = 0x064E;
  15938. t['fathalowarabic'] = 0x064E;
  15939. t['fathatanarabic'] = 0x064B;
  15940. t['fbopomofo'] = 0x3108;
  15941. t['fcircle'] = 0x24D5;
  15942. t['fdotaccent'] = 0x1E1F;
  15943. t['feharabic'] = 0x0641;
  15944. t['feharmenian'] = 0x0586;
  15945. t['fehfinalarabic'] = 0xFED2;
  15946. t['fehinitialarabic'] = 0xFED3;
  15947. t['fehmedialarabic'] = 0xFED4;
  15948. t['feicoptic'] = 0x03E5;
  15949. t['female'] = 0x2640;
  15950. t['ff'] = 0xFB00;
  15951. t['ffi'] = 0xFB03;
  15952. t['ffl'] = 0xFB04;
  15953. t['fi'] = 0xFB01;
  15954. t['fifteencircle'] = 0x246E;
  15955. t['fifteenparen'] = 0x2482;
  15956. t['fifteenperiod'] = 0x2496;
  15957. t['figuredash'] = 0x2012;
  15958. t['filledbox'] = 0x25A0;
  15959. t['filledrect'] = 0x25AC;
  15960. t['finalkaf'] = 0x05DA;
  15961. t['finalkafdagesh'] = 0xFB3A;
  15962. t['finalkafdageshhebrew'] = 0xFB3A;
  15963. t['finalkafhebrew'] = 0x05DA;
  15964. t['finalmem'] = 0x05DD;
  15965. t['finalmemhebrew'] = 0x05DD;
  15966. t['finalnun'] = 0x05DF;
  15967. t['finalnunhebrew'] = 0x05DF;
  15968. t['finalpe'] = 0x05E3;
  15969. t['finalpehebrew'] = 0x05E3;
  15970. t['finaltsadi'] = 0x05E5;
  15971. t['finaltsadihebrew'] = 0x05E5;
  15972. t['firsttonechinese'] = 0x02C9;
  15973. t['fisheye'] = 0x25C9;
  15974. t['fitacyrillic'] = 0x0473;
  15975. t['five'] = 0x0035;
  15976. t['fivearabic'] = 0x0665;
  15977. t['fivebengali'] = 0x09EB;
  15978. t['fivecircle'] = 0x2464;
  15979. t['fivecircleinversesansserif'] = 0x278E;
  15980. t['fivedeva'] = 0x096B;
  15981. t['fiveeighths'] = 0x215D;
  15982. t['fivegujarati'] = 0x0AEB;
  15983. t['fivegurmukhi'] = 0x0A6B;
  15984. t['fivehackarabic'] = 0x0665;
  15985. t['fivehangzhou'] = 0x3025;
  15986. t['fiveideographicparen'] = 0x3224;
  15987. t['fiveinferior'] = 0x2085;
  15988. t['fivemonospace'] = 0xFF15;
  15989. t['fiveoldstyle'] = 0xF735;
  15990. t['fiveparen'] = 0x2478;
  15991. t['fiveperiod'] = 0x248C;
  15992. t['fivepersian'] = 0x06F5;
  15993. t['fiveroman'] = 0x2174;
  15994. t['fivesuperior'] = 0x2075;
  15995. t['fivethai'] = 0x0E55;
  15996. t['fl'] = 0xFB02;
  15997. t['florin'] = 0x0192;
  15998. t['fmonospace'] = 0xFF46;
  15999. t['fmsquare'] = 0x3399;
  16000. t['fofanthai'] = 0x0E1F;
  16001. t['fofathai'] = 0x0E1D;
  16002. t['fongmanthai'] = 0x0E4F;
  16003. t['forall'] = 0x2200;
  16004. t['four'] = 0x0034;
  16005. t['fourarabic'] = 0x0664;
  16006. t['fourbengali'] = 0x09EA;
  16007. t['fourcircle'] = 0x2463;
  16008. t['fourcircleinversesansserif'] = 0x278D;
  16009. t['fourdeva'] = 0x096A;
  16010. t['fourgujarati'] = 0x0AEA;
  16011. t['fourgurmukhi'] = 0x0A6A;
  16012. t['fourhackarabic'] = 0x0664;
  16013. t['fourhangzhou'] = 0x3024;
  16014. t['fourideographicparen'] = 0x3223;
  16015. t['fourinferior'] = 0x2084;
  16016. t['fourmonospace'] = 0xFF14;
  16017. t['fournumeratorbengali'] = 0x09F7;
  16018. t['fouroldstyle'] = 0xF734;
  16019. t['fourparen'] = 0x2477;
  16020. t['fourperiod'] = 0x248B;
  16021. t['fourpersian'] = 0x06F4;
  16022. t['fourroman'] = 0x2173;
  16023. t['foursuperior'] = 0x2074;
  16024. t['fourteencircle'] = 0x246D;
  16025. t['fourteenparen'] = 0x2481;
  16026. t['fourteenperiod'] = 0x2495;
  16027. t['fourthai'] = 0x0E54;
  16028. t['fourthtonechinese'] = 0x02CB;
  16029. t['fparen'] = 0x24A1;
  16030. t['fraction'] = 0x2044;
  16031. t['franc'] = 0x20A3;
  16032. t['g'] = 0x0067;
  16033. t['gabengali'] = 0x0997;
  16034. t['gacute'] = 0x01F5;
  16035. t['gadeva'] = 0x0917;
  16036. t['gafarabic'] = 0x06AF;
  16037. t['gaffinalarabic'] = 0xFB93;
  16038. t['gafinitialarabic'] = 0xFB94;
  16039. t['gafmedialarabic'] = 0xFB95;
  16040. t['gagujarati'] = 0x0A97;
  16041. t['gagurmukhi'] = 0x0A17;
  16042. t['gahiragana'] = 0x304C;
  16043. t['gakatakana'] = 0x30AC;
  16044. t['gamma'] = 0x03B3;
  16045. t['gammalatinsmall'] = 0x0263;
  16046. t['gammasuperior'] = 0x02E0;
  16047. t['gangiacoptic'] = 0x03EB;
  16048. t['gbopomofo'] = 0x310D;
  16049. t['gbreve'] = 0x011F;
  16050. t['gcaron'] = 0x01E7;
  16051. t['gcedilla'] = 0x0123;
  16052. t['gcircle'] = 0x24D6;
  16053. t['gcircumflex'] = 0x011D;
  16054. t['gcommaaccent'] = 0x0123;
  16055. t['gdot'] = 0x0121;
  16056. t['gdotaccent'] = 0x0121;
  16057. t['gecyrillic'] = 0x0433;
  16058. t['gehiragana'] = 0x3052;
  16059. t['gekatakana'] = 0x30B2;
  16060. t['geometricallyequal'] = 0x2251;
  16061. t['gereshaccenthebrew'] = 0x059C;
  16062. t['gereshhebrew'] = 0x05F3;
  16063. t['gereshmuqdamhebrew'] = 0x059D;
  16064. t['germandbls'] = 0x00DF;
  16065. t['gershayimaccenthebrew'] = 0x059E;
  16066. t['gershayimhebrew'] = 0x05F4;
  16067. t['getamark'] = 0x3013;
  16068. t['ghabengali'] = 0x0998;
  16069. t['ghadarmenian'] = 0x0572;
  16070. t['ghadeva'] = 0x0918;
  16071. t['ghagujarati'] = 0x0A98;
  16072. t['ghagurmukhi'] = 0x0A18;
  16073. t['ghainarabic'] = 0x063A;
  16074. t['ghainfinalarabic'] = 0xFECE;
  16075. t['ghaininitialarabic'] = 0xFECF;
  16076. t['ghainmedialarabic'] = 0xFED0;
  16077. t['ghemiddlehookcyrillic'] = 0x0495;
  16078. t['ghestrokecyrillic'] = 0x0493;
  16079. t['gheupturncyrillic'] = 0x0491;
  16080. t['ghhadeva'] = 0x095A;
  16081. t['ghhagurmukhi'] = 0x0A5A;
  16082. t['ghook'] = 0x0260;
  16083. t['ghzsquare'] = 0x3393;
  16084. t['gihiragana'] = 0x304E;
  16085. t['gikatakana'] = 0x30AE;
  16086. t['gimarmenian'] = 0x0563;
  16087. t['gimel'] = 0x05D2;
  16088. t['gimeldagesh'] = 0xFB32;
  16089. t['gimeldageshhebrew'] = 0xFB32;
  16090. t['gimelhebrew'] = 0x05D2;
  16091. t['gjecyrillic'] = 0x0453;
  16092. t['glottalinvertedstroke'] = 0x01BE;
  16093. t['glottalstop'] = 0x0294;
  16094. t['glottalstopinverted'] = 0x0296;
  16095. t['glottalstopmod'] = 0x02C0;
  16096. t['glottalstopreversed'] = 0x0295;
  16097. t['glottalstopreversedmod'] = 0x02C1;
  16098. t['glottalstopreversedsuperior'] = 0x02E4;
  16099. t['glottalstopstroke'] = 0x02A1;
  16100. t['glottalstopstrokereversed'] = 0x02A2;
  16101. t['gmacron'] = 0x1E21;
  16102. t['gmonospace'] = 0xFF47;
  16103. t['gohiragana'] = 0x3054;
  16104. t['gokatakana'] = 0x30B4;
  16105. t['gparen'] = 0x24A2;
  16106. t['gpasquare'] = 0x33AC;
  16107. t['gradient'] = 0x2207;
  16108. t['grave'] = 0x0060;
  16109. t['gravebelowcmb'] = 0x0316;
  16110. t['gravecmb'] = 0x0300;
  16111. t['gravecomb'] = 0x0300;
  16112. t['gravedeva'] = 0x0953;
  16113. t['gravelowmod'] = 0x02CE;
  16114. t['gravemonospace'] = 0xFF40;
  16115. t['gravetonecmb'] = 0x0340;
  16116. t['greater'] = 0x003E;
  16117. t['greaterequal'] = 0x2265;
  16118. t['greaterequalorless'] = 0x22DB;
  16119. t['greatermonospace'] = 0xFF1E;
  16120. t['greaterorequivalent'] = 0x2273;
  16121. t['greaterorless'] = 0x2277;
  16122. t['greateroverequal'] = 0x2267;
  16123. t['greatersmall'] = 0xFE65;
  16124. t['gscript'] = 0x0261;
  16125. t['gstroke'] = 0x01E5;
  16126. t['guhiragana'] = 0x3050;
  16127. t['guillemotleft'] = 0x00AB;
  16128. t['guillemotright'] = 0x00BB;
  16129. t['guilsinglleft'] = 0x2039;
  16130. t['guilsinglright'] = 0x203A;
  16131. t['gukatakana'] = 0x30B0;
  16132. t['guramusquare'] = 0x3318;
  16133. t['gysquare'] = 0x33C9;
  16134. t['h'] = 0x0068;
  16135. t['haabkhasiancyrillic'] = 0x04A9;
  16136. t['haaltonearabic'] = 0x06C1;
  16137. t['habengali'] = 0x09B9;
  16138. t['hadescendercyrillic'] = 0x04B3;
  16139. t['hadeva'] = 0x0939;
  16140. t['hagujarati'] = 0x0AB9;
  16141. t['hagurmukhi'] = 0x0A39;
  16142. t['haharabic'] = 0x062D;
  16143. t['hahfinalarabic'] = 0xFEA2;
  16144. t['hahinitialarabic'] = 0xFEA3;
  16145. t['hahiragana'] = 0x306F;
  16146. t['hahmedialarabic'] = 0xFEA4;
  16147. t['haitusquare'] = 0x332A;
  16148. t['hakatakana'] = 0x30CF;
  16149. t['hakatakanahalfwidth'] = 0xFF8A;
  16150. t['halantgurmukhi'] = 0x0A4D;
  16151. t['hamzaarabic'] = 0x0621;
  16152. t['hamzalowarabic'] = 0x0621;
  16153. t['hangulfiller'] = 0x3164;
  16154. t['hardsigncyrillic'] = 0x044A;
  16155. t['harpoonleftbarbup'] = 0x21BC;
  16156. t['harpoonrightbarbup'] = 0x21C0;
  16157. t['hasquare'] = 0x33CA;
  16158. t['hatafpatah'] = 0x05B2;
  16159. t['hatafpatah16'] = 0x05B2;
  16160. t['hatafpatah23'] = 0x05B2;
  16161. t['hatafpatah2f'] = 0x05B2;
  16162. t['hatafpatahhebrew'] = 0x05B2;
  16163. t['hatafpatahnarrowhebrew'] = 0x05B2;
  16164. t['hatafpatahquarterhebrew'] = 0x05B2;
  16165. t['hatafpatahwidehebrew'] = 0x05B2;
  16166. t['hatafqamats'] = 0x05B3;
  16167. t['hatafqamats1b'] = 0x05B3;
  16168. t['hatafqamats28'] = 0x05B3;
  16169. t['hatafqamats34'] = 0x05B3;
  16170. t['hatafqamatshebrew'] = 0x05B3;
  16171. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  16172. t['hatafqamatsquarterhebrew'] = 0x05B3;
  16173. t['hatafqamatswidehebrew'] = 0x05B3;
  16174. t['hatafsegol'] = 0x05B1;
  16175. t['hatafsegol17'] = 0x05B1;
  16176. t['hatafsegol24'] = 0x05B1;
  16177. t['hatafsegol30'] = 0x05B1;
  16178. t['hatafsegolhebrew'] = 0x05B1;
  16179. t['hatafsegolnarrowhebrew'] = 0x05B1;
  16180. t['hatafsegolquarterhebrew'] = 0x05B1;
  16181. t['hatafsegolwidehebrew'] = 0x05B1;
  16182. t['hbar'] = 0x0127;
  16183. t['hbopomofo'] = 0x310F;
  16184. t['hbrevebelow'] = 0x1E2B;
  16185. t['hcedilla'] = 0x1E29;
  16186. t['hcircle'] = 0x24D7;
  16187. t['hcircumflex'] = 0x0125;
  16188. t['hdieresis'] = 0x1E27;
  16189. t['hdotaccent'] = 0x1E23;
  16190. t['hdotbelow'] = 0x1E25;
  16191. t['he'] = 0x05D4;
  16192. t['heart'] = 0x2665;
  16193. t['heartsuitblack'] = 0x2665;
  16194. t['heartsuitwhite'] = 0x2661;
  16195. t['hedagesh'] = 0xFB34;
  16196. t['hedageshhebrew'] = 0xFB34;
  16197. t['hehaltonearabic'] = 0x06C1;
  16198. t['heharabic'] = 0x0647;
  16199. t['hehebrew'] = 0x05D4;
  16200. t['hehfinalaltonearabic'] = 0xFBA7;
  16201. t['hehfinalalttwoarabic'] = 0xFEEA;
  16202. t['hehfinalarabic'] = 0xFEEA;
  16203. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  16204. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  16205. t['hehinitialaltonearabic'] = 0xFBA8;
  16206. t['hehinitialarabic'] = 0xFEEB;
  16207. t['hehiragana'] = 0x3078;
  16208. t['hehmedialaltonearabic'] = 0xFBA9;
  16209. t['hehmedialarabic'] = 0xFEEC;
  16210. t['heiseierasquare'] = 0x337B;
  16211. t['hekatakana'] = 0x30D8;
  16212. t['hekatakanahalfwidth'] = 0xFF8D;
  16213. t['hekutaarusquare'] = 0x3336;
  16214. t['henghook'] = 0x0267;
  16215. t['herutusquare'] = 0x3339;
  16216. t['het'] = 0x05D7;
  16217. t['hethebrew'] = 0x05D7;
  16218. t['hhook'] = 0x0266;
  16219. t['hhooksuperior'] = 0x02B1;
  16220. t['hieuhacirclekorean'] = 0x327B;
  16221. t['hieuhaparenkorean'] = 0x321B;
  16222. t['hieuhcirclekorean'] = 0x326D;
  16223. t['hieuhkorean'] = 0x314E;
  16224. t['hieuhparenkorean'] = 0x320D;
  16225. t['hihiragana'] = 0x3072;
  16226. t['hikatakana'] = 0x30D2;
  16227. t['hikatakanahalfwidth'] = 0xFF8B;
  16228. t['hiriq'] = 0x05B4;
  16229. t['hiriq14'] = 0x05B4;
  16230. t['hiriq21'] = 0x05B4;
  16231. t['hiriq2d'] = 0x05B4;
  16232. t['hiriqhebrew'] = 0x05B4;
  16233. t['hiriqnarrowhebrew'] = 0x05B4;
  16234. t['hiriqquarterhebrew'] = 0x05B4;
  16235. t['hiriqwidehebrew'] = 0x05B4;
  16236. t['hlinebelow'] = 0x1E96;
  16237. t['hmonospace'] = 0xFF48;
  16238. t['hoarmenian'] = 0x0570;
  16239. t['hohipthai'] = 0x0E2B;
  16240. t['hohiragana'] = 0x307B;
  16241. t['hokatakana'] = 0x30DB;
  16242. t['hokatakanahalfwidth'] = 0xFF8E;
  16243. t['holam'] = 0x05B9;
  16244. t['holam19'] = 0x05B9;
  16245. t['holam26'] = 0x05B9;
  16246. t['holam32'] = 0x05B9;
  16247. t['holamhebrew'] = 0x05B9;
  16248. t['holamnarrowhebrew'] = 0x05B9;
  16249. t['holamquarterhebrew'] = 0x05B9;
  16250. t['holamwidehebrew'] = 0x05B9;
  16251. t['honokhukthai'] = 0x0E2E;
  16252. t['hookabovecomb'] = 0x0309;
  16253. t['hookcmb'] = 0x0309;
  16254. t['hookpalatalizedbelowcmb'] = 0x0321;
  16255. t['hookretroflexbelowcmb'] = 0x0322;
  16256. t['hoonsquare'] = 0x3342;
  16257. t['horicoptic'] = 0x03E9;
  16258. t['horizontalbar'] = 0x2015;
  16259. t['horncmb'] = 0x031B;
  16260. t['hotsprings'] = 0x2668;
  16261. t['house'] = 0x2302;
  16262. t['hparen'] = 0x24A3;
  16263. t['hsuperior'] = 0x02B0;
  16264. t['hturned'] = 0x0265;
  16265. t['huhiragana'] = 0x3075;
  16266. t['huiitosquare'] = 0x3333;
  16267. t['hukatakana'] = 0x30D5;
  16268. t['hukatakanahalfwidth'] = 0xFF8C;
  16269. t['hungarumlaut'] = 0x02DD;
  16270. t['hungarumlautcmb'] = 0x030B;
  16271. t['hv'] = 0x0195;
  16272. t['hyphen'] = 0x002D;
  16273. t['hypheninferior'] = 0xF6E5;
  16274. t['hyphenmonospace'] = 0xFF0D;
  16275. t['hyphensmall'] = 0xFE63;
  16276. t['hyphensuperior'] = 0xF6E6;
  16277. t['hyphentwo'] = 0x2010;
  16278. t['i'] = 0x0069;
  16279. t['iacute'] = 0x00ED;
  16280. t['iacyrillic'] = 0x044F;
  16281. t['ibengali'] = 0x0987;
  16282. t['ibopomofo'] = 0x3127;
  16283. t['ibreve'] = 0x012D;
  16284. t['icaron'] = 0x01D0;
  16285. t['icircle'] = 0x24D8;
  16286. t['icircumflex'] = 0x00EE;
  16287. t['icyrillic'] = 0x0456;
  16288. t['idblgrave'] = 0x0209;
  16289. t['ideographearthcircle'] = 0x328F;
  16290. t['ideographfirecircle'] = 0x328B;
  16291. t['ideographicallianceparen'] = 0x323F;
  16292. t['ideographiccallparen'] = 0x323A;
  16293. t['ideographiccentrecircle'] = 0x32A5;
  16294. t['ideographicclose'] = 0x3006;
  16295. t['ideographiccomma'] = 0x3001;
  16296. t['ideographiccommaleft'] = 0xFF64;
  16297. t['ideographiccongratulationparen'] = 0x3237;
  16298. t['ideographiccorrectcircle'] = 0x32A3;
  16299. t['ideographicearthparen'] = 0x322F;
  16300. t['ideographicenterpriseparen'] = 0x323D;
  16301. t['ideographicexcellentcircle'] = 0x329D;
  16302. t['ideographicfestivalparen'] = 0x3240;
  16303. t['ideographicfinancialcircle'] = 0x3296;
  16304. t['ideographicfinancialparen'] = 0x3236;
  16305. t['ideographicfireparen'] = 0x322B;
  16306. t['ideographichaveparen'] = 0x3232;
  16307. t['ideographichighcircle'] = 0x32A4;
  16308. t['ideographiciterationmark'] = 0x3005;
  16309. t['ideographiclaborcircle'] = 0x3298;
  16310. t['ideographiclaborparen'] = 0x3238;
  16311. t['ideographicleftcircle'] = 0x32A7;
  16312. t['ideographiclowcircle'] = 0x32A6;
  16313. t['ideographicmedicinecircle'] = 0x32A9;
  16314. t['ideographicmetalparen'] = 0x322E;
  16315. t['ideographicmoonparen'] = 0x322A;
  16316. t['ideographicnameparen'] = 0x3234;
  16317. t['ideographicperiod'] = 0x3002;
  16318. t['ideographicprintcircle'] = 0x329E;
  16319. t['ideographicreachparen'] = 0x3243;
  16320. t['ideographicrepresentparen'] = 0x3239;
  16321. t['ideographicresourceparen'] = 0x323E;
  16322. t['ideographicrightcircle'] = 0x32A8;
  16323. t['ideographicsecretcircle'] = 0x3299;
  16324. t['ideographicselfparen'] = 0x3242;
  16325. t['ideographicsocietyparen'] = 0x3233;
  16326. t['ideographicspace'] = 0x3000;
  16327. t['ideographicspecialparen'] = 0x3235;
  16328. t['ideographicstockparen'] = 0x3231;
  16329. t['ideographicstudyparen'] = 0x323B;
  16330. t['ideographicsunparen'] = 0x3230;
  16331. t['ideographicsuperviseparen'] = 0x323C;
  16332. t['ideographicwaterparen'] = 0x322C;
  16333. t['ideographicwoodparen'] = 0x322D;
  16334. t['ideographiczero'] = 0x3007;
  16335. t['ideographmetalcircle'] = 0x328E;
  16336. t['ideographmooncircle'] = 0x328A;
  16337. t['ideographnamecircle'] = 0x3294;
  16338. t['ideographsuncircle'] = 0x3290;
  16339. t['ideographwatercircle'] = 0x328C;
  16340. t['ideographwoodcircle'] = 0x328D;
  16341. t['ideva'] = 0x0907;
  16342. t['idieresis'] = 0x00EF;
  16343. t['idieresisacute'] = 0x1E2F;
  16344. t['idieresiscyrillic'] = 0x04E5;
  16345. t['idotbelow'] = 0x1ECB;
  16346. t['iebrevecyrillic'] = 0x04D7;
  16347. t['iecyrillic'] = 0x0435;
  16348. t['ieungacirclekorean'] = 0x3275;
  16349. t['ieungaparenkorean'] = 0x3215;
  16350. t['ieungcirclekorean'] = 0x3267;
  16351. t['ieungkorean'] = 0x3147;
  16352. t['ieungparenkorean'] = 0x3207;
  16353. t['igrave'] = 0x00EC;
  16354. t['igujarati'] = 0x0A87;
  16355. t['igurmukhi'] = 0x0A07;
  16356. t['ihiragana'] = 0x3044;
  16357. t['ihookabove'] = 0x1EC9;
  16358. t['iibengali'] = 0x0988;
  16359. t['iicyrillic'] = 0x0438;
  16360. t['iideva'] = 0x0908;
  16361. t['iigujarati'] = 0x0A88;
  16362. t['iigurmukhi'] = 0x0A08;
  16363. t['iimatragurmukhi'] = 0x0A40;
  16364. t['iinvertedbreve'] = 0x020B;
  16365. t['iishortcyrillic'] = 0x0439;
  16366. t['iivowelsignbengali'] = 0x09C0;
  16367. t['iivowelsigndeva'] = 0x0940;
  16368. t['iivowelsigngujarati'] = 0x0AC0;
  16369. t['ij'] = 0x0133;
  16370. t['ikatakana'] = 0x30A4;
  16371. t['ikatakanahalfwidth'] = 0xFF72;
  16372. t['ikorean'] = 0x3163;
  16373. t['ilde'] = 0x02DC;
  16374. t['iluyhebrew'] = 0x05AC;
  16375. t['imacron'] = 0x012B;
  16376. t['imacroncyrillic'] = 0x04E3;
  16377. t['imageorapproximatelyequal'] = 0x2253;
  16378. t['imatragurmukhi'] = 0x0A3F;
  16379. t['imonospace'] = 0xFF49;
  16380. t['increment'] = 0x2206;
  16381. t['infinity'] = 0x221E;
  16382. t['iniarmenian'] = 0x056B;
  16383. t['integral'] = 0x222B;
  16384. t['integralbottom'] = 0x2321;
  16385. t['integralbt'] = 0x2321;
  16386. t['integralex'] = 0xF8F5;
  16387. t['integraltop'] = 0x2320;
  16388. t['integraltp'] = 0x2320;
  16389. t['intersection'] = 0x2229;
  16390. t['intisquare'] = 0x3305;
  16391. t['invbullet'] = 0x25D8;
  16392. t['invcircle'] = 0x25D9;
  16393. t['invsmileface'] = 0x263B;
  16394. t['iocyrillic'] = 0x0451;
  16395. t['iogonek'] = 0x012F;
  16396. t['iota'] = 0x03B9;
  16397. t['iotadieresis'] = 0x03CA;
  16398. t['iotadieresistonos'] = 0x0390;
  16399. t['iotalatin'] = 0x0269;
  16400. t['iotatonos'] = 0x03AF;
  16401. t['iparen'] = 0x24A4;
  16402. t['irigurmukhi'] = 0x0A72;
  16403. t['ismallhiragana'] = 0x3043;
  16404. t['ismallkatakana'] = 0x30A3;
  16405. t['ismallkatakanahalfwidth'] = 0xFF68;
  16406. t['issharbengali'] = 0x09FA;
  16407. t['istroke'] = 0x0268;
  16408. t['isuperior'] = 0xF6ED;
  16409. t['iterationhiragana'] = 0x309D;
  16410. t['iterationkatakana'] = 0x30FD;
  16411. t['itilde'] = 0x0129;
  16412. t['itildebelow'] = 0x1E2D;
  16413. t['iubopomofo'] = 0x3129;
  16414. t['iucyrillic'] = 0x044E;
  16415. t['ivowelsignbengali'] = 0x09BF;
  16416. t['ivowelsigndeva'] = 0x093F;
  16417. t['ivowelsigngujarati'] = 0x0ABF;
  16418. t['izhitsacyrillic'] = 0x0475;
  16419. t['izhitsadblgravecyrillic'] = 0x0477;
  16420. t['j'] = 0x006A;
  16421. t['jaarmenian'] = 0x0571;
  16422. t['jabengali'] = 0x099C;
  16423. t['jadeva'] = 0x091C;
  16424. t['jagujarati'] = 0x0A9C;
  16425. t['jagurmukhi'] = 0x0A1C;
  16426. t['jbopomofo'] = 0x3110;
  16427. t['jcaron'] = 0x01F0;
  16428. t['jcircle'] = 0x24D9;
  16429. t['jcircumflex'] = 0x0135;
  16430. t['jcrossedtail'] = 0x029D;
  16431. t['jdotlessstroke'] = 0x025F;
  16432. t['jecyrillic'] = 0x0458;
  16433. t['jeemarabic'] = 0x062C;
  16434. t['jeemfinalarabic'] = 0xFE9E;
  16435. t['jeeminitialarabic'] = 0xFE9F;
  16436. t['jeemmedialarabic'] = 0xFEA0;
  16437. t['jeharabic'] = 0x0698;
  16438. t['jehfinalarabic'] = 0xFB8B;
  16439. t['jhabengali'] = 0x099D;
  16440. t['jhadeva'] = 0x091D;
  16441. t['jhagujarati'] = 0x0A9D;
  16442. t['jhagurmukhi'] = 0x0A1D;
  16443. t['jheharmenian'] = 0x057B;
  16444. t['jis'] = 0x3004;
  16445. t['jmonospace'] = 0xFF4A;
  16446. t['jparen'] = 0x24A5;
  16447. t['jsuperior'] = 0x02B2;
  16448. t['k'] = 0x006B;
  16449. t['kabashkircyrillic'] = 0x04A1;
  16450. t['kabengali'] = 0x0995;
  16451. t['kacute'] = 0x1E31;
  16452. t['kacyrillic'] = 0x043A;
  16453. t['kadescendercyrillic'] = 0x049B;
  16454. t['kadeva'] = 0x0915;
  16455. t['kaf'] = 0x05DB;
  16456. t['kafarabic'] = 0x0643;
  16457. t['kafdagesh'] = 0xFB3B;
  16458. t['kafdageshhebrew'] = 0xFB3B;
  16459. t['kaffinalarabic'] = 0xFEDA;
  16460. t['kafhebrew'] = 0x05DB;
  16461. t['kafinitialarabic'] = 0xFEDB;
  16462. t['kafmedialarabic'] = 0xFEDC;
  16463. t['kafrafehebrew'] = 0xFB4D;
  16464. t['kagujarati'] = 0x0A95;
  16465. t['kagurmukhi'] = 0x0A15;
  16466. t['kahiragana'] = 0x304B;
  16467. t['kahookcyrillic'] = 0x04C4;
  16468. t['kakatakana'] = 0x30AB;
  16469. t['kakatakanahalfwidth'] = 0xFF76;
  16470. t['kappa'] = 0x03BA;
  16471. t['kappasymbolgreek'] = 0x03F0;
  16472. t['kapyeounmieumkorean'] = 0x3171;
  16473. t['kapyeounphieuphkorean'] = 0x3184;
  16474. t['kapyeounpieupkorean'] = 0x3178;
  16475. t['kapyeounssangpieupkorean'] = 0x3179;
  16476. t['karoriisquare'] = 0x330D;
  16477. t['kashidaautoarabic'] = 0x0640;
  16478. t['kashidaautonosidebearingarabic'] = 0x0640;
  16479. t['kasmallkatakana'] = 0x30F5;
  16480. t['kasquare'] = 0x3384;
  16481. t['kasraarabic'] = 0x0650;
  16482. t['kasratanarabic'] = 0x064D;
  16483. t['kastrokecyrillic'] = 0x049F;
  16484. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  16485. t['kaverticalstrokecyrillic'] = 0x049D;
  16486. t['kbopomofo'] = 0x310E;
  16487. t['kcalsquare'] = 0x3389;
  16488. t['kcaron'] = 0x01E9;
  16489. t['kcedilla'] = 0x0137;
  16490. t['kcircle'] = 0x24DA;
  16491. t['kcommaaccent'] = 0x0137;
  16492. t['kdotbelow'] = 0x1E33;
  16493. t['keharmenian'] = 0x0584;
  16494. t['kehiragana'] = 0x3051;
  16495. t['kekatakana'] = 0x30B1;
  16496. t['kekatakanahalfwidth'] = 0xFF79;
  16497. t['kenarmenian'] = 0x056F;
  16498. t['kesmallkatakana'] = 0x30F6;
  16499. t['kgreenlandic'] = 0x0138;
  16500. t['khabengali'] = 0x0996;
  16501. t['khacyrillic'] = 0x0445;
  16502. t['khadeva'] = 0x0916;
  16503. t['khagujarati'] = 0x0A96;
  16504. t['khagurmukhi'] = 0x0A16;
  16505. t['khaharabic'] = 0x062E;
  16506. t['khahfinalarabic'] = 0xFEA6;
  16507. t['khahinitialarabic'] = 0xFEA7;
  16508. t['khahmedialarabic'] = 0xFEA8;
  16509. t['kheicoptic'] = 0x03E7;
  16510. t['khhadeva'] = 0x0959;
  16511. t['khhagurmukhi'] = 0x0A59;
  16512. t['khieukhacirclekorean'] = 0x3278;
  16513. t['khieukhaparenkorean'] = 0x3218;
  16514. t['khieukhcirclekorean'] = 0x326A;
  16515. t['khieukhkorean'] = 0x314B;
  16516. t['khieukhparenkorean'] = 0x320A;
  16517. t['khokhaithai'] = 0x0E02;
  16518. t['khokhonthai'] = 0x0E05;
  16519. t['khokhuatthai'] = 0x0E03;
  16520. t['khokhwaithai'] = 0x0E04;
  16521. t['khomutthai'] = 0x0E5B;
  16522. t['khook'] = 0x0199;
  16523. t['khorakhangthai'] = 0x0E06;
  16524. t['khzsquare'] = 0x3391;
  16525. t['kihiragana'] = 0x304D;
  16526. t['kikatakana'] = 0x30AD;
  16527. t['kikatakanahalfwidth'] = 0xFF77;
  16528. t['kiroguramusquare'] = 0x3315;
  16529. t['kiromeetorusquare'] = 0x3316;
  16530. t['kirosquare'] = 0x3314;
  16531. t['kiyeokacirclekorean'] = 0x326E;
  16532. t['kiyeokaparenkorean'] = 0x320E;
  16533. t['kiyeokcirclekorean'] = 0x3260;
  16534. t['kiyeokkorean'] = 0x3131;
  16535. t['kiyeokparenkorean'] = 0x3200;
  16536. t['kiyeoksioskorean'] = 0x3133;
  16537. t['kjecyrillic'] = 0x045C;
  16538. t['klinebelow'] = 0x1E35;
  16539. t['klsquare'] = 0x3398;
  16540. t['kmcubedsquare'] = 0x33A6;
  16541. t['kmonospace'] = 0xFF4B;
  16542. t['kmsquaredsquare'] = 0x33A2;
  16543. t['kohiragana'] = 0x3053;
  16544. t['kohmsquare'] = 0x33C0;
  16545. t['kokaithai'] = 0x0E01;
  16546. t['kokatakana'] = 0x30B3;
  16547. t['kokatakanahalfwidth'] = 0xFF7A;
  16548. t['kooposquare'] = 0x331E;
  16549. t['koppacyrillic'] = 0x0481;
  16550. t['koreanstandardsymbol'] = 0x327F;
  16551. t['koroniscmb'] = 0x0343;
  16552. t['kparen'] = 0x24A6;
  16553. t['kpasquare'] = 0x33AA;
  16554. t['ksicyrillic'] = 0x046F;
  16555. t['ktsquare'] = 0x33CF;
  16556. t['kturned'] = 0x029E;
  16557. t['kuhiragana'] = 0x304F;
  16558. t['kukatakana'] = 0x30AF;
  16559. t['kukatakanahalfwidth'] = 0xFF78;
  16560. t['kvsquare'] = 0x33B8;
  16561. t['kwsquare'] = 0x33BE;
  16562. t['l'] = 0x006C;
  16563. t['labengali'] = 0x09B2;
  16564. t['lacute'] = 0x013A;
  16565. t['ladeva'] = 0x0932;
  16566. t['lagujarati'] = 0x0AB2;
  16567. t['lagurmukhi'] = 0x0A32;
  16568. t['lakkhangyaothai'] = 0x0E45;
  16569. t['lamaleffinalarabic'] = 0xFEFC;
  16570. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  16571. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  16572. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  16573. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  16574. t['lamalefisolatedarabic'] = 0xFEFB;
  16575. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  16576. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  16577. t['lamarabic'] = 0x0644;
  16578. t['lambda'] = 0x03BB;
  16579. t['lambdastroke'] = 0x019B;
  16580. t['lamed'] = 0x05DC;
  16581. t['lameddagesh'] = 0xFB3C;
  16582. t['lameddageshhebrew'] = 0xFB3C;
  16583. t['lamedhebrew'] = 0x05DC;
  16584. t['lamfinalarabic'] = 0xFEDE;
  16585. t['lamhahinitialarabic'] = 0xFCCA;
  16586. t['laminitialarabic'] = 0xFEDF;
  16587. t['lamjeeminitialarabic'] = 0xFCC9;
  16588. t['lamkhahinitialarabic'] = 0xFCCB;
  16589. t['lamlamhehisolatedarabic'] = 0xFDF2;
  16590. t['lammedialarabic'] = 0xFEE0;
  16591. t['lammeemhahinitialarabic'] = 0xFD88;
  16592. t['lammeeminitialarabic'] = 0xFCCC;
  16593. t['largecircle'] = 0x25EF;
  16594. t['lbar'] = 0x019A;
  16595. t['lbelt'] = 0x026C;
  16596. t['lbopomofo'] = 0x310C;
  16597. t['lcaron'] = 0x013E;
  16598. t['lcedilla'] = 0x013C;
  16599. t['lcircle'] = 0x24DB;
  16600. t['lcircumflexbelow'] = 0x1E3D;
  16601. t['lcommaaccent'] = 0x013C;
  16602. t['ldot'] = 0x0140;
  16603. t['ldotaccent'] = 0x0140;
  16604. t['ldotbelow'] = 0x1E37;
  16605. t['ldotbelowmacron'] = 0x1E39;
  16606. t['leftangleabovecmb'] = 0x031A;
  16607. t['lefttackbelowcmb'] = 0x0318;
  16608. t['less'] = 0x003C;
  16609. t['lessequal'] = 0x2264;
  16610. t['lessequalorgreater'] = 0x22DA;
  16611. t['lessmonospace'] = 0xFF1C;
  16612. t['lessorequivalent'] = 0x2272;
  16613. t['lessorgreater'] = 0x2276;
  16614. t['lessoverequal'] = 0x2266;
  16615. t['lesssmall'] = 0xFE64;
  16616. t['lezh'] = 0x026E;
  16617. t['lfblock'] = 0x258C;
  16618. t['lhookretroflex'] = 0x026D;
  16619. t['lira'] = 0x20A4;
  16620. t['liwnarmenian'] = 0x056C;
  16621. t['lj'] = 0x01C9;
  16622. t['ljecyrillic'] = 0x0459;
  16623. t['ll'] = 0xF6C0;
  16624. t['lladeva'] = 0x0933;
  16625. t['llagujarati'] = 0x0AB3;
  16626. t['llinebelow'] = 0x1E3B;
  16627. t['llladeva'] = 0x0934;
  16628. t['llvocalicbengali'] = 0x09E1;
  16629. t['llvocalicdeva'] = 0x0961;
  16630. t['llvocalicvowelsignbengali'] = 0x09E3;
  16631. t['llvocalicvowelsigndeva'] = 0x0963;
  16632. t['lmiddletilde'] = 0x026B;
  16633. t['lmonospace'] = 0xFF4C;
  16634. t['lmsquare'] = 0x33D0;
  16635. t['lochulathai'] = 0x0E2C;
  16636. t['logicaland'] = 0x2227;
  16637. t['logicalnot'] = 0x00AC;
  16638. t['logicalnotreversed'] = 0x2310;
  16639. t['logicalor'] = 0x2228;
  16640. t['lolingthai'] = 0x0E25;
  16641. t['longs'] = 0x017F;
  16642. t['lowlinecenterline'] = 0xFE4E;
  16643. t['lowlinecmb'] = 0x0332;
  16644. t['lowlinedashed'] = 0xFE4D;
  16645. t['lozenge'] = 0x25CA;
  16646. t['lparen'] = 0x24A7;
  16647. t['lslash'] = 0x0142;
  16648. t['lsquare'] = 0x2113;
  16649. t['lsuperior'] = 0xF6EE;
  16650. t['ltshade'] = 0x2591;
  16651. t['luthai'] = 0x0E26;
  16652. t['lvocalicbengali'] = 0x098C;
  16653. t['lvocalicdeva'] = 0x090C;
  16654. t['lvocalicvowelsignbengali'] = 0x09E2;
  16655. t['lvocalicvowelsigndeva'] = 0x0962;
  16656. t['lxsquare'] = 0x33D3;
  16657. t['m'] = 0x006D;
  16658. t['mabengali'] = 0x09AE;
  16659. t['macron'] = 0x00AF;
  16660. t['macronbelowcmb'] = 0x0331;
  16661. t['macroncmb'] = 0x0304;
  16662. t['macronlowmod'] = 0x02CD;
  16663. t['macronmonospace'] = 0xFFE3;
  16664. t['macute'] = 0x1E3F;
  16665. t['madeva'] = 0x092E;
  16666. t['magujarati'] = 0x0AAE;
  16667. t['magurmukhi'] = 0x0A2E;
  16668. t['mahapakhhebrew'] = 0x05A4;
  16669. t['mahapakhlefthebrew'] = 0x05A4;
  16670. t['mahiragana'] = 0x307E;
  16671. t['maichattawalowleftthai'] = 0xF895;
  16672. t['maichattawalowrightthai'] = 0xF894;
  16673. t['maichattawathai'] = 0x0E4B;
  16674. t['maichattawaupperleftthai'] = 0xF893;
  16675. t['maieklowleftthai'] = 0xF88C;
  16676. t['maieklowrightthai'] = 0xF88B;
  16677. t['maiekthai'] = 0x0E48;
  16678. t['maiekupperleftthai'] = 0xF88A;
  16679. t['maihanakatleftthai'] = 0xF884;
  16680. t['maihanakatthai'] = 0x0E31;
  16681. t['maitaikhuleftthai'] = 0xF889;
  16682. t['maitaikhuthai'] = 0x0E47;
  16683. t['maitholowleftthai'] = 0xF88F;
  16684. t['maitholowrightthai'] = 0xF88E;
  16685. t['maithothai'] = 0x0E49;
  16686. t['maithoupperleftthai'] = 0xF88D;
  16687. t['maitrilowleftthai'] = 0xF892;
  16688. t['maitrilowrightthai'] = 0xF891;
  16689. t['maitrithai'] = 0x0E4A;
  16690. t['maitriupperleftthai'] = 0xF890;
  16691. t['maiyamokthai'] = 0x0E46;
  16692. t['makatakana'] = 0x30DE;
  16693. t['makatakanahalfwidth'] = 0xFF8F;
  16694. t['male'] = 0x2642;
  16695. t['mansyonsquare'] = 0x3347;
  16696. t['maqafhebrew'] = 0x05BE;
  16697. t['mars'] = 0x2642;
  16698. t['masoracirclehebrew'] = 0x05AF;
  16699. t['masquare'] = 0x3383;
  16700. t['mbopomofo'] = 0x3107;
  16701. t['mbsquare'] = 0x33D4;
  16702. t['mcircle'] = 0x24DC;
  16703. t['mcubedsquare'] = 0x33A5;
  16704. t['mdotaccent'] = 0x1E41;
  16705. t['mdotbelow'] = 0x1E43;
  16706. t['meemarabic'] = 0x0645;
  16707. t['meemfinalarabic'] = 0xFEE2;
  16708. t['meeminitialarabic'] = 0xFEE3;
  16709. t['meemmedialarabic'] = 0xFEE4;
  16710. t['meemmeeminitialarabic'] = 0xFCD1;
  16711. t['meemmeemisolatedarabic'] = 0xFC48;
  16712. t['meetorusquare'] = 0x334D;
  16713. t['mehiragana'] = 0x3081;
  16714. t['meizierasquare'] = 0x337E;
  16715. t['mekatakana'] = 0x30E1;
  16716. t['mekatakanahalfwidth'] = 0xFF92;
  16717. t['mem'] = 0x05DE;
  16718. t['memdagesh'] = 0xFB3E;
  16719. t['memdageshhebrew'] = 0xFB3E;
  16720. t['memhebrew'] = 0x05DE;
  16721. t['menarmenian'] = 0x0574;
  16722. t['merkhahebrew'] = 0x05A5;
  16723. t['merkhakefulahebrew'] = 0x05A6;
  16724. t['merkhakefulalefthebrew'] = 0x05A6;
  16725. t['merkhalefthebrew'] = 0x05A5;
  16726. t['mhook'] = 0x0271;
  16727. t['mhzsquare'] = 0x3392;
  16728. t['middledotkatakanahalfwidth'] = 0xFF65;
  16729. t['middot'] = 0x00B7;
  16730. t['mieumacirclekorean'] = 0x3272;
  16731. t['mieumaparenkorean'] = 0x3212;
  16732. t['mieumcirclekorean'] = 0x3264;
  16733. t['mieumkorean'] = 0x3141;
  16734. t['mieumpansioskorean'] = 0x3170;
  16735. t['mieumparenkorean'] = 0x3204;
  16736. t['mieumpieupkorean'] = 0x316E;
  16737. t['mieumsioskorean'] = 0x316F;
  16738. t['mihiragana'] = 0x307F;
  16739. t['mikatakana'] = 0x30DF;
  16740. t['mikatakanahalfwidth'] = 0xFF90;
  16741. t['minus'] = 0x2212;
  16742. t['minusbelowcmb'] = 0x0320;
  16743. t['minuscircle'] = 0x2296;
  16744. t['minusmod'] = 0x02D7;
  16745. t['minusplus'] = 0x2213;
  16746. t['minute'] = 0x2032;
  16747. t['miribaarusquare'] = 0x334A;
  16748. t['mirisquare'] = 0x3349;
  16749. t['mlonglegturned'] = 0x0270;
  16750. t['mlsquare'] = 0x3396;
  16751. t['mmcubedsquare'] = 0x33A3;
  16752. t['mmonospace'] = 0xFF4D;
  16753. t['mmsquaredsquare'] = 0x339F;
  16754. t['mohiragana'] = 0x3082;
  16755. t['mohmsquare'] = 0x33C1;
  16756. t['mokatakana'] = 0x30E2;
  16757. t['mokatakanahalfwidth'] = 0xFF93;
  16758. t['molsquare'] = 0x33D6;
  16759. t['momathai'] = 0x0E21;
  16760. t['moverssquare'] = 0x33A7;
  16761. t['moverssquaredsquare'] = 0x33A8;
  16762. t['mparen'] = 0x24A8;
  16763. t['mpasquare'] = 0x33AB;
  16764. t['mssquare'] = 0x33B3;
  16765. t['msuperior'] = 0xF6EF;
  16766. t['mturned'] = 0x026F;
  16767. t['mu'] = 0x00B5;
  16768. t['mu1'] = 0x00B5;
  16769. t['muasquare'] = 0x3382;
  16770. t['muchgreater'] = 0x226B;
  16771. t['muchless'] = 0x226A;
  16772. t['mufsquare'] = 0x338C;
  16773. t['mugreek'] = 0x03BC;
  16774. t['mugsquare'] = 0x338D;
  16775. t['muhiragana'] = 0x3080;
  16776. t['mukatakana'] = 0x30E0;
  16777. t['mukatakanahalfwidth'] = 0xFF91;
  16778. t['mulsquare'] = 0x3395;
  16779. t['multiply'] = 0x00D7;
  16780. t['mumsquare'] = 0x339B;
  16781. t['munahhebrew'] = 0x05A3;
  16782. t['munahlefthebrew'] = 0x05A3;
  16783. t['musicalnote'] = 0x266A;
  16784. t['musicalnotedbl'] = 0x266B;
  16785. t['musicflatsign'] = 0x266D;
  16786. t['musicsharpsign'] = 0x266F;
  16787. t['mussquare'] = 0x33B2;
  16788. t['muvsquare'] = 0x33B6;
  16789. t['muwsquare'] = 0x33BC;
  16790. t['mvmegasquare'] = 0x33B9;
  16791. t['mvsquare'] = 0x33B7;
  16792. t['mwmegasquare'] = 0x33BF;
  16793. t['mwsquare'] = 0x33BD;
  16794. t['n'] = 0x006E;
  16795. t['nabengali'] = 0x09A8;
  16796. t['nabla'] = 0x2207;
  16797. t['nacute'] = 0x0144;
  16798. t['nadeva'] = 0x0928;
  16799. t['nagujarati'] = 0x0AA8;
  16800. t['nagurmukhi'] = 0x0A28;
  16801. t['nahiragana'] = 0x306A;
  16802. t['nakatakana'] = 0x30CA;
  16803. t['nakatakanahalfwidth'] = 0xFF85;
  16804. t['napostrophe'] = 0x0149;
  16805. t['nasquare'] = 0x3381;
  16806. t['nbopomofo'] = 0x310B;
  16807. t['nbspace'] = 0x00A0;
  16808. t['ncaron'] = 0x0148;
  16809. t['ncedilla'] = 0x0146;
  16810. t['ncircle'] = 0x24DD;
  16811. t['ncircumflexbelow'] = 0x1E4B;
  16812. t['ncommaaccent'] = 0x0146;
  16813. t['ndotaccent'] = 0x1E45;
  16814. t['ndotbelow'] = 0x1E47;
  16815. t['nehiragana'] = 0x306D;
  16816. t['nekatakana'] = 0x30CD;
  16817. t['nekatakanahalfwidth'] = 0xFF88;
  16818. t['newsheqelsign'] = 0x20AA;
  16819. t['nfsquare'] = 0x338B;
  16820. t['ngabengali'] = 0x0999;
  16821. t['ngadeva'] = 0x0919;
  16822. t['ngagujarati'] = 0x0A99;
  16823. t['ngagurmukhi'] = 0x0A19;
  16824. t['ngonguthai'] = 0x0E07;
  16825. t['nhiragana'] = 0x3093;
  16826. t['nhookleft'] = 0x0272;
  16827. t['nhookretroflex'] = 0x0273;
  16828. t['nieunacirclekorean'] = 0x326F;
  16829. t['nieunaparenkorean'] = 0x320F;
  16830. t['nieuncieuckorean'] = 0x3135;
  16831. t['nieuncirclekorean'] = 0x3261;
  16832. t['nieunhieuhkorean'] = 0x3136;
  16833. t['nieunkorean'] = 0x3134;
  16834. t['nieunpansioskorean'] = 0x3168;
  16835. t['nieunparenkorean'] = 0x3201;
  16836. t['nieunsioskorean'] = 0x3167;
  16837. t['nieuntikeutkorean'] = 0x3166;
  16838. t['nihiragana'] = 0x306B;
  16839. t['nikatakana'] = 0x30CB;
  16840. t['nikatakanahalfwidth'] = 0xFF86;
  16841. t['nikhahitleftthai'] = 0xF899;
  16842. t['nikhahitthai'] = 0x0E4D;
  16843. t['nine'] = 0x0039;
  16844. t['ninearabic'] = 0x0669;
  16845. t['ninebengali'] = 0x09EF;
  16846. t['ninecircle'] = 0x2468;
  16847. t['ninecircleinversesansserif'] = 0x2792;
  16848. t['ninedeva'] = 0x096F;
  16849. t['ninegujarati'] = 0x0AEF;
  16850. t['ninegurmukhi'] = 0x0A6F;
  16851. t['ninehackarabic'] = 0x0669;
  16852. t['ninehangzhou'] = 0x3029;
  16853. t['nineideographicparen'] = 0x3228;
  16854. t['nineinferior'] = 0x2089;
  16855. t['ninemonospace'] = 0xFF19;
  16856. t['nineoldstyle'] = 0xF739;
  16857. t['nineparen'] = 0x247C;
  16858. t['nineperiod'] = 0x2490;
  16859. t['ninepersian'] = 0x06F9;
  16860. t['nineroman'] = 0x2178;
  16861. t['ninesuperior'] = 0x2079;
  16862. t['nineteencircle'] = 0x2472;
  16863. t['nineteenparen'] = 0x2486;
  16864. t['nineteenperiod'] = 0x249A;
  16865. t['ninethai'] = 0x0E59;
  16866. t['nj'] = 0x01CC;
  16867. t['njecyrillic'] = 0x045A;
  16868. t['nkatakana'] = 0x30F3;
  16869. t['nkatakanahalfwidth'] = 0xFF9D;
  16870. t['nlegrightlong'] = 0x019E;
  16871. t['nlinebelow'] = 0x1E49;
  16872. t['nmonospace'] = 0xFF4E;
  16873. t['nmsquare'] = 0x339A;
  16874. t['nnabengali'] = 0x09A3;
  16875. t['nnadeva'] = 0x0923;
  16876. t['nnagujarati'] = 0x0AA3;
  16877. t['nnagurmukhi'] = 0x0A23;
  16878. t['nnnadeva'] = 0x0929;
  16879. t['nohiragana'] = 0x306E;
  16880. t['nokatakana'] = 0x30CE;
  16881. t['nokatakanahalfwidth'] = 0xFF89;
  16882. t['nonbreakingspace'] = 0x00A0;
  16883. t['nonenthai'] = 0x0E13;
  16884. t['nonuthai'] = 0x0E19;
  16885. t['noonarabic'] = 0x0646;
  16886. t['noonfinalarabic'] = 0xFEE6;
  16887. t['noonghunnaarabic'] = 0x06BA;
  16888. t['noonghunnafinalarabic'] = 0xFB9F;
  16889. t['nooninitialarabic'] = 0xFEE7;
  16890. t['noonjeeminitialarabic'] = 0xFCD2;
  16891. t['noonjeemisolatedarabic'] = 0xFC4B;
  16892. t['noonmedialarabic'] = 0xFEE8;
  16893. t['noonmeeminitialarabic'] = 0xFCD5;
  16894. t['noonmeemisolatedarabic'] = 0xFC4E;
  16895. t['noonnoonfinalarabic'] = 0xFC8D;
  16896. t['notcontains'] = 0x220C;
  16897. t['notelement'] = 0x2209;
  16898. t['notelementof'] = 0x2209;
  16899. t['notequal'] = 0x2260;
  16900. t['notgreater'] = 0x226F;
  16901. t['notgreaternorequal'] = 0x2271;
  16902. t['notgreaternorless'] = 0x2279;
  16903. t['notidentical'] = 0x2262;
  16904. t['notless'] = 0x226E;
  16905. t['notlessnorequal'] = 0x2270;
  16906. t['notparallel'] = 0x2226;
  16907. t['notprecedes'] = 0x2280;
  16908. t['notsubset'] = 0x2284;
  16909. t['notsucceeds'] = 0x2281;
  16910. t['notsuperset'] = 0x2285;
  16911. t['nowarmenian'] = 0x0576;
  16912. t['nparen'] = 0x24A9;
  16913. t['nssquare'] = 0x33B1;
  16914. t['nsuperior'] = 0x207F;
  16915. t['ntilde'] = 0x00F1;
  16916. t['nu'] = 0x03BD;
  16917. t['nuhiragana'] = 0x306C;
  16918. t['nukatakana'] = 0x30CC;
  16919. t['nukatakanahalfwidth'] = 0xFF87;
  16920. t['nuktabengali'] = 0x09BC;
  16921. t['nuktadeva'] = 0x093C;
  16922. t['nuktagujarati'] = 0x0ABC;
  16923. t['nuktagurmukhi'] = 0x0A3C;
  16924. t['numbersign'] = 0x0023;
  16925. t['numbersignmonospace'] = 0xFF03;
  16926. t['numbersignsmall'] = 0xFE5F;
  16927. t['numeralsigngreek'] = 0x0374;
  16928. t['numeralsignlowergreek'] = 0x0375;
  16929. t['numero'] = 0x2116;
  16930. t['nun'] = 0x05E0;
  16931. t['nundagesh'] = 0xFB40;
  16932. t['nundageshhebrew'] = 0xFB40;
  16933. t['nunhebrew'] = 0x05E0;
  16934. t['nvsquare'] = 0x33B5;
  16935. t['nwsquare'] = 0x33BB;
  16936. t['nyabengali'] = 0x099E;
  16937. t['nyadeva'] = 0x091E;
  16938. t['nyagujarati'] = 0x0A9E;
  16939. t['nyagurmukhi'] = 0x0A1E;
  16940. t['o'] = 0x006F;
  16941. t['oacute'] = 0x00F3;
  16942. t['oangthai'] = 0x0E2D;
  16943. t['obarred'] = 0x0275;
  16944. t['obarredcyrillic'] = 0x04E9;
  16945. t['obarreddieresiscyrillic'] = 0x04EB;
  16946. t['obengali'] = 0x0993;
  16947. t['obopomofo'] = 0x311B;
  16948. t['obreve'] = 0x014F;
  16949. t['ocandradeva'] = 0x0911;
  16950. t['ocandragujarati'] = 0x0A91;
  16951. t['ocandravowelsigndeva'] = 0x0949;
  16952. t['ocandravowelsigngujarati'] = 0x0AC9;
  16953. t['ocaron'] = 0x01D2;
  16954. t['ocircle'] = 0x24DE;
  16955. t['ocircumflex'] = 0x00F4;
  16956. t['ocircumflexacute'] = 0x1ED1;
  16957. t['ocircumflexdotbelow'] = 0x1ED9;
  16958. t['ocircumflexgrave'] = 0x1ED3;
  16959. t['ocircumflexhookabove'] = 0x1ED5;
  16960. t['ocircumflextilde'] = 0x1ED7;
  16961. t['ocyrillic'] = 0x043E;
  16962. t['odblacute'] = 0x0151;
  16963. t['odblgrave'] = 0x020D;
  16964. t['odeva'] = 0x0913;
  16965. t['odieresis'] = 0x00F6;
  16966. t['odieresiscyrillic'] = 0x04E7;
  16967. t['odotbelow'] = 0x1ECD;
  16968. t['oe'] = 0x0153;
  16969. t['oekorean'] = 0x315A;
  16970. t['ogonek'] = 0x02DB;
  16971. t['ogonekcmb'] = 0x0328;
  16972. t['ograve'] = 0x00F2;
  16973. t['ogujarati'] = 0x0A93;
  16974. t['oharmenian'] = 0x0585;
  16975. t['ohiragana'] = 0x304A;
  16976. t['ohookabove'] = 0x1ECF;
  16977. t['ohorn'] = 0x01A1;
  16978. t['ohornacute'] = 0x1EDB;
  16979. t['ohorndotbelow'] = 0x1EE3;
  16980. t['ohorngrave'] = 0x1EDD;
  16981. t['ohornhookabove'] = 0x1EDF;
  16982. t['ohorntilde'] = 0x1EE1;
  16983. t['ohungarumlaut'] = 0x0151;
  16984. t['oi'] = 0x01A3;
  16985. t['oinvertedbreve'] = 0x020F;
  16986. t['okatakana'] = 0x30AA;
  16987. t['okatakanahalfwidth'] = 0xFF75;
  16988. t['okorean'] = 0x3157;
  16989. t['olehebrew'] = 0x05AB;
  16990. t['omacron'] = 0x014D;
  16991. t['omacronacute'] = 0x1E53;
  16992. t['omacrongrave'] = 0x1E51;
  16993. t['omdeva'] = 0x0950;
  16994. t['omega'] = 0x03C9;
  16995. t['omega1'] = 0x03D6;
  16996. t['omegacyrillic'] = 0x0461;
  16997. t['omegalatinclosed'] = 0x0277;
  16998. t['omegaroundcyrillic'] = 0x047B;
  16999. t['omegatitlocyrillic'] = 0x047D;
  17000. t['omegatonos'] = 0x03CE;
  17001. t['omgujarati'] = 0x0AD0;
  17002. t['omicron'] = 0x03BF;
  17003. t['omicrontonos'] = 0x03CC;
  17004. t['omonospace'] = 0xFF4F;
  17005. t['one'] = 0x0031;
  17006. t['onearabic'] = 0x0661;
  17007. t['onebengali'] = 0x09E7;
  17008. t['onecircle'] = 0x2460;
  17009. t['onecircleinversesansserif'] = 0x278A;
  17010. t['onedeva'] = 0x0967;
  17011. t['onedotenleader'] = 0x2024;
  17012. t['oneeighth'] = 0x215B;
  17013. t['onefitted'] = 0xF6DC;
  17014. t['onegujarati'] = 0x0AE7;
  17015. t['onegurmukhi'] = 0x0A67;
  17016. t['onehackarabic'] = 0x0661;
  17017. t['onehalf'] = 0x00BD;
  17018. t['onehangzhou'] = 0x3021;
  17019. t['oneideographicparen'] = 0x3220;
  17020. t['oneinferior'] = 0x2081;
  17021. t['onemonospace'] = 0xFF11;
  17022. t['onenumeratorbengali'] = 0x09F4;
  17023. t['oneoldstyle'] = 0xF731;
  17024. t['oneparen'] = 0x2474;
  17025. t['oneperiod'] = 0x2488;
  17026. t['onepersian'] = 0x06F1;
  17027. t['onequarter'] = 0x00BC;
  17028. t['oneroman'] = 0x2170;
  17029. t['onesuperior'] = 0x00B9;
  17030. t['onethai'] = 0x0E51;
  17031. t['onethird'] = 0x2153;
  17032. t['oogonek'] = 0x01EB;
  17033. t['oogonekmacron'] = 0x01ED;
  17034. t['oogurmukhi'] = 0x0A13;
  17035. t['oomatragurmukhi'] = 0x0A4B;
  17036. t['oopen'] = 0x0254;
  17037. t['oparen'] = 0x24AA;
  17038. t['openbullet'] = 0x25E6;
  17039. t['option'] = 0x2325;
  17040. t['ordfeminine'] = 0x00AA;
  17041. t['ordmasculine'] = 0x00BA;
  17042. t['orthogonal'] = 0x221F;
  17043. t['oshortdeva'] = 0x0912;
  17044. t['oshortvowelsigndeva'] = 0x094A;
  17045. t['oslash'] = 0x00F8;
  17046. t['oslashacute'] = 0x01FF;
  17047. t['osmallhiragana'] = 0x3049;
  17048. t['osmallkatakana'] = 0x30A9;
  17049. t['osmallkatakanahalfwidth'] = 0xFF6B;
  17050. t['ostrokeacute'] = 0x01FF;
  17051. t['osuperior'] = 0xF6F0;
  17052. t['otcyrillic'] = 0x047F;
  17053. t['otilde'] = 0x00F5;
  17054. t['otildeacute'] = 0x1E4D;
  17055. t['otildedieresis'] = 0x1E4F;
  17056. t['oubopomofo'] = 0x3121;
  17057. t['overline'] = 0x203E;
  17058. t['overlinecenterline'] = 0xFE4A;
  17059. t['overlinecmb'] = 0x0305;
  17060. t['overlinedashed'] = 0xFE49;
  17061. t['overlinedblwavy'] = 0xFE4C;
  17062. t['overlinewavy'] = 0xFE4B;
  17063. t['overscore'] = 0x00AF;
  17064. t['ovowelsignbengali'] = 0x09CB;
  17065. t['ovowelsigndeva'] = 0x094B;
  17066. t['ovowelsigngujarati'] = 0x0ACB;
  17067. t['p'] = 0x0070;
  17068. t['paampssquare'] = 0x3380;
  17069. t['paasentosquare'] = 0x332B;
  17070. t['pabengali'] = 0x09AA;
  17071. t['pacute'] = 0x1E55;
  17072. t['padeva'] = 0x092A;
  17073. t['pagedown'] = 0x21DF;
  17074. t['pageup'] = 0x21DE;
  17075. t['pagujarati'] = 0x0AAA;
  17076. t['pagurmukhi'] = 0x0A2A;
  17077. t['pahiragana'] = 0x3071;
  17078. t['paiyannoithai'] = 0x0E2F;
  17079. t['pakatakana'] = 0x30D1;
  17080. t['palatalizationcyrilliccmb'] = 0x0484;
  17081. t['palochkacyrillic'] = 0x04C0;
  17082. t['pansioskorean'] = 0x317F;
  17083. t['paragraph'] = 0x00B6;
  17084. t['parallel'] = 0x2225;
  17085. t['parenleft'] = 0x0028;
  17086. t['parenleftaltonearabic'] = 0xFD3E;
  17087. t['parenleftbt'] = 0xF8ED;
  17088. t['parenleftex'] = 0xF8EC;
  17089. t['parenleftinferior'] = 0x208D;
  17090. t['parenleftmonospace'] = 0xFF08;
  17091. t['parenleftsmall'] = 0xFE59;
  17092. t['parenleftsuperior'] = 0x207D;
  17093. t['parenlefttp'] = 0xF8EB;
  17094. t['parenleftvertical'] = 0xFE35;
  17095. t['parenright'] = 0x0029;
  17096. t['parenrightaltonearabic'] = 0xFD3F;
  17097. t['parenrightbt'] = 0xF8F8;
  17098. t['parenrightex'] = 0xF8F7;
  17099. t['parenrightinferior'] = 0x208E;
  17100. t['parenrightmonospace'] = 0xFF09;
  17101. t['parenrightsmall'] = 0xFE5A;
  17102. t['parenrightsuperior'] = 0x207E;
  17103. t['parenrighttp'] = 0xF8F6;
  17104. t['parenrightvertical'] = 0xFE36;
  17105. t['partialdiff'] = 0x2202;
  17106. t['paseqhebrew'] = 0x05C0;
  17107. t['pashtahebrew'] = 0x0599;
  17108. t['pasquare'] = 0x33A9;
  17109. t['patah'] = 0x05B7;
  17110. t['patah11'] = 0x05B7;
  17111. t['patah1d'] = 0x05B7;
  17112. t['patah2a'] = 0x05B7;
  17113. t['patahhebrew'] = 0x05B7;
  17114. t['patahnarrowhebrew'] = 0x05B7;
  17115. t['patahquarterhebrew'] = 0x05B7;
  17116. t['patahwidehebrew'] = 0x05B7;
  17117. t['pazerhebrew'] = 0x05A1;
  17118. t['pbopomofo'] = 0x3106;
  17119. t['pcircle'] = 0x24DF;
  17120. t['pdotaccent'] = 0x1E57;
  17121. t['pe'] = 0x05E4;
  17122. t['pecyrillic'] = 0x043F;
  17123. t['pedagesh'] = 0xFB44;
  17124. t['pedageshhebrew'] = 0xFB44;
  17125. t['peezisquare'] = 0x333B;
  17126. t['pefinaldageshhebrew'] = 0xFB43;
  17127. t['peharabic'] = 0x067E;
  17128. t['peharmenian'] = 0x057A;
  17129. t['pehebrew'] = 0x05E4;
  17130. t['pehfinalarabic'] = 0xFB57;
  17131. t['pehinitialarabic'] = 0xFB58;
  17132. t['pehiragana'] = 0x307A;
  17133. t['pehmedialarabic'] = 0xFB59;
  17134. t['pekatakana'] = 0x30DA;
  17135. t['pemiddlehookcyrillic'] = 0x04A7;
  17136. t['perafehebrew'] = 0xFB4E;
  17137. t['percent'] = 0x0025;
  17138. t['percentarabic'] = 0x066A;
  17139. t['percentmonospace'] = 0xFF05;
  17140. t['percentsmall'] = 0xFE6A;
  17141. t['period'] = 0x002E;
  17142. t['periodarmenian'] = 0x0589;
  17143. t['periodcentered'] = 0x00B7;
  17144. t['periodhalfwidth'] = 0xFF61;
  17145. t['periodinferior'] = 0xF6E7;
  17146. t['periodmonospace'] = 0xFF0E;
  17147. t['periodsmall'] = 0xFE52;
  17148. t['periodsuperior'] = 0xF6E8;
  17149. t['perispomenigreekcmb'] = 0x0342;
  17150. t['perpendicular'] = 0x22A5;
  17151. t['perthousand'] = 0x2030;
  17152. t['peseta'] = 0x20A7;
  17153. t['pfsquare'] = 0x338A;
  17154. t['phabengali'] = 0x09AB;
  17155. t['phadeva'] = 0x092B;
  17156. t['phagujarati'] = 0x0AAB;
  17157. t['phagurmukhi'] = 0x0A2B;
  17158. t['phi'] = 0x03C6;
  17159. t['phi1'] = 0x03D5;
  17160. t['phieuphacirclekorean'] = 0x327A;
  17161. t['phieuphaparenkorean'] = 0x321A;
  17162. t['phieuphcirclekorean'] = 0x326C;
  17163. t['phieuphkorean'] = 0x314D;
  17164. t['phieuphparenkorean'] = 0x320C;
  17165. t['philatin'] = 0x0278;
  17166. t['phinthuthai'] = 0x0E3A;
  17167. t['phisymbolgreek'] = 0x03D5;
  17168. t['phook'] = 0x01A5;
  17169. t['phophanthai'] = 0x0E1E;
  17170. t['phophungthai'] = 0x0E1C;
  17171. t['phosamphaothai'] = 0x0E20;
  17172. t['pi'] = 0x03C0;
  17173. t['pieupacirclekorean'] = 0x3273;
  17174. t['pieupaparenkorean'] = 0x3213;
  17175. t['pieupcieuckorean'] = 0x3176;
  17176. t['pieupcirclekorean'] = 0x3265;
  17177. t['pieupkiyeokkorean'] = 0x3172;
  17178. t['pieupkorean'] = 0x3142;
  17179. t['pieupparenkorean'] = 0x3205;
  17180. t['pieupsioskiyeokkorean'] = 0x3174;
  17181. t['pieupsioskorean'] = 0x3144;
  17182. t['pieupsiostikeutkorean'] = 0x3175;
  17183. t['pieupthieuthkorean'] = 0x3177;
  17184. t['pieuptikeutkorean'] = 0x3173;
  17185. t['pihiragana'] = 0x3074;
  17186. t['pikatakana'] = 0x30D4;
  17187. t['pisymbolgreek'] = 0x03D6;
  17188. t['piwrarmenian'] = 0x0583;
  17189. t['plus'] = 0x002B;
  17190. t['plusbelowcmb'] = 0x031F;
  17191. t['pluscircle'] = 0x2295;
  17192. t['plusminus'] = 0x00B1;
  17193. t['plusmod'] = 0x02D6;
  17194. t['plusmonospace'] = 0xFF0B;
  17195. t['plussmall'] = 0xFE62;
  17196. t['plussuperior'] = 0x207A;
  17197. t['pmonospace'] = 0xFF50;
  17198. t['pmsquare'] = 0x33D8;
  17199. t['pohiragana'] = 0x307D;
  17200. t['pointingindexdownwhite'] = 0x261F;
  17201. t['pointingindexleftwhite'] = 0x261C;
  17202. t['pointingindexrightwhite'] = 0x261E;
  17203. t['pointingindexupwhite'] = 0x261D;
  17204. t['pokatakana'] = 0x30DD;
  17205. t['poplathai'] = 0x0E1B;
  17206. t['postalmark'] = 0x3012;
  17207. t['postalmarkface'] = 0x3020;
  17208. t['pparen'] = 0x24AB;
  17209. t['precedes'] = 0x227A;
  17210. t['prescription'] = 0x211E;
  17211. t['primemod'] = 0x02B9;
  17212. t['primereversed'] = 0x2035;
  17213. t['product'] = 0x220F;
  17214. t['projective'] = 0x2305;
  17215. t['prolongedkana'] = 0x30FC;
  17216. t['propellor'] = 0x2318;
  17217. t['propersubset'] = 0x2282;
  17218. t['propersuperset'] = 0x2283;
  17219. t['proportion'] = 0x2237;
  17220. t['proportional'] = 0x221D;
  17221. t['psi'] = 0x03C8;
  17222. t['psicyrillic'] = 0x0471;
  17223. t['psilipneumatacyrilliccmb'] = 0x0486;
  17224. t['pssquare'] = 0x33B0;
  17225. t['puhiragana'] = 0x3077;
  17226. t['pukatakana'] = 0x30D7;
  17227. t['pvsquare'] = 0x33B4;
  17228. t['pwsquare'] = 0x33BA;
  17229. t['q'] = 0x0071;
  17230. t['qadeva'] = 0x0958;
  17231. t['qadmahebrew'] = 0x05A8;
  17232. t['qafarabic'] = 0x0642;
  17233. t['qaffinalarabic'] = 0xFED6;
  17234. t['qafinitialarabic'] = 0xFED7;
  17235. t['qafmedialarabic'] = 0xFED8;
  17236. t['qamats'] = 0x05B8;
  17237. t['qamats10'] = 0x05B8;
  17238. t['qamats1a'] = 0x05B8;
  17239. t['qamats1c'] = 0x05B8;
  17240. t['qamats27'] = 0x05B8;
  17241. t['qamats29'] = 0x05B8;
  17242. t['qamats33'] = 0x05B8;
  17243. t['qamatsde'] = 0x05B8;
  17244. t['qamatshebrew'] = 0x05B8;
  17245. t['qamatsnarrowhebrew'] = 0x05B8;
  17246. t['qamatsqatanhebrew'] = 0x05B8;
  17247. t['qamatsqatannarrowhebrew'] = 0x05B8;
  17248. t['qamatsqatanquarterhebrew'] = 0x05B8;
  17249. t['qamatsqatanwidehebrew'] = 0x05B8;
  17250. t['qamatsquarterhebrew'] = 0x05B8;
  17251. t['qamatswidehebrew'] = 0x05B8;
  17252. t['qarneyparahebrew'] = 0x059F;
  17253. t['qbopomofo'] = 0x3111;
  17254. t['qcircle'] = 0x24E0;
  17255. t['qhook'] = 0x02A0;
  17256. t['qmonospace'] = 0xFF51;
  17257. t['qof'] = 0x05E7;
  17258. t['qofdagesh'] = 0xFB47;
  17259. t['qofdageshhebrew'] = 0xFB47;
  17260. t['qofhebrew'] = 0x05E7;
  17261. t['qparen'] = 0x24AC;
  17262. t['quarternote'] = 0x2669;
  17263. t['qubuts'] = 0x05BB;
  17264. t['qubuts18'] = 0x05BB;
  17265. t['qubuts25'] = 0x05BB;
  17266. t['qubuts31'] = 0x05BB;
  17267. t['qubutshebrew'] = 0x05BB;
  17268. t['qubutsnarrowhebrew'] = 0x05BB;
  17269. t['qubutsquarterhebrew'] = 0x05BB;
  17270. t['qubutswidehebrew'] = 0x05BB;
  17271. t['question'] = 0x003F;
  17272. t['questionarabic'] = 0x061F;
  17273. t['questionarmenian'] = 0x055E;
  17274. t['questiondown'] = 0x00BF;
  17275. t['questiondownsmall'] = 0xF7BF;
  17276. t['questiongreek'] = 0x037E;
  17277. t['questionmonospace'] = 0xFF1F;
  17278. t['questionsmall'] = 0xF73F;
  17279. t['quotedbl'] = 0x0022;
  17280. t['quotedblbase'] = 0x201E;
  17281. t['quotedblleft'] = 0x201C;
  17282. t['quotedblmonospace'] = 0xFF02;
  17283. t['quotedblprime'] = 0x301E;
  17284. t['quotedblprimereversed'] = 0x301D;
  17285. t['quotedblright'] = 0x201D;
  17286. t['quoteleft'] = 0x2018;
  17287. t['quoteleftreversed'] = 0x201B;
  17288. t['quotereversed'] = 0x201B;
  17289. t['quoteright'] = 0x2019;
  17290. t['quoterightn'] = 0x0149;
  17291. t['quotesinglbase'] = 0x201A;
  17292. t['quotesingle'] = 0x0027;
  17293. t['quotesinglemonospace'] = 0xFF07;
  17294. t['r'] = 0x0072;
  17295. t['raarmenian'] = 0x057C;
  17296. t['rabengali'] = 0x09B0;
  17297. t['racute'] = 0x0155;
  17298. t['radeva'] = 0x0930;
  17299. t['radical'] = 0x221A;
  17300. t['radicalex'] = 0xF8E5;
  17301. t['radoverssquare'] = 0x33AE;
  17302. t['radoverssquaredsquare'] = 0x33AF;
  17303. t['radsquare'] = 0x33AD;
  17304. t['rafe'] = 0x05BF;
  17305. t['rafehebrew'] = 0x05BF;
  17306. t['ragujarati'] = 0x0AB0;
  17307. t['ragurmukhi'] = 0x0A30;
  17308. t['rahiragana'] = 0x3089;
  17309. t['rakatakana'] = 0x30E9;
  17310. t['rakatakanahalfwidth'] = 0xFF97;
  17311. t['ralowerdiagonalbengali'] = 0x09F1;
  17312. t['ramiddlediagonalbengali'] = 0x09F0;
  17313. t['ramshorn'] = 0x0264;
  17314. t['ratio'] = 0x2236;
  17315. t['rbopomofo'] = 0x3116;
  17316. t['rcaron'] = 0x0159;
  17317. t['rcedilla'] = 0x0157;
  17318. t['rcircle'] = 0x24E1;
  17319. t['rcommaaccent'] = 0x0157;
  17320. t['rdblgrave'] = 0x0211;
  17321. t['rdotaccent'] = 0x1E59;
  17322. t['rdotbelow'] = 0x1E5B;
  17323. t['rdotbelowmacron'] = 0x1E5D;
  17324. t['referencemark'] = 0x203B;
  17325. t['reflexsubset'] = 0x2286;
  17326. t['reflexsuperset'] = 0x2287;
  17327. t['registered'] = 0x00AE;
  17328. t['registersans'] = 0xF8E8;
  17329. t['registerserif'] = 0xF6DA;
  17330. t['reharabic'] = 0x0631;
  17331. t['reharmenian'] = 0x0580;
  17332. t['rehfinalarabic'] = 0xFEAE;
  17333. t['rehiragana'] = 0x308C;
  17334. t['rekatakana'] = 0x30EC;
  17335. t['rekatakanahalfwidth'] = 0xFF9A;
  17336. t['resh'] = 0x05E8;
  17337. t['reshdageshhebrew'] = 0xFB48;
  17338. t['reshhebrew'] = 0x05E8;
  17339. t['reversedtilde'] = 0x223D;
  17340. t['reviahebrew'] = 0x0597;
  17341. t['reviamugrashhebrew'] = 0x0597;
  17342. t['revlogicalnot'] = 0x2310;
  17343. t['rfishhook'] = 0x027E;
  17344. t['rfishhookreversed'] = 0x027F;
  17345. t['rhabengali'] = 0x09DD;
  17346. t['rhadeva'] = 0x095D;
  17347. t['rho'] = 0x03C1;
  17348. t['rhook'] = 0x027D;
  17349. t['rhookturned'] = 0x027B;
  17350. t['rhookturnedsuperior'] = 0x02B5;
  17351. t['rhosymbolgreek'] = 0x03F1;
  17352. t['rhotichookmod'] = 0x02DE;
  17353. t['rieulacirclekorean'] = 0x3271;
  17354. t['rieulaparenkorean'] = 0x3211;
  17355. t['rieulcirclekorean'] = 0x3263;
  17356. t['rieulhieuhkorean'] = 0x3140;
  17357. t['rieulkiyeokkorean'] = 0x313A;
  17358. t['rieulkiyeoksioskorean'] = 0x3169;
  17359. t['rieulkorean'] = 0x3139;
  17360. t['rieulmieumkorean'] = 0x313B;
  17361. t['rieulpansioskorean'] = 0x316C;
  17362. t['rieulparenkorean'] = 0x3203;
  17363. t['rieulphieuphkorean'] = 0x313F;
  17364. t['rieulpieupkorean'] = 0x313C;
  17365. t['rieulpieupsioskorean'] = 0x316B;
  17366. t['rieulsioskorean'] = 0x313D;
  17367. t['rieulthieuthkorean'] = 0x313E;
  17368. t['rieultikeutkorean'] = 0x316A;
  17369. t['rieulyeorinhieuhkorean'] = 0x316D;
  17370. t['rightangle'] = 0x221F;
  17371. t['righttackbelowcmb'] = 0x0319;
  17372. t['righttriangle'] = 0x22BF;
  17373. t['rihiragana'] = 0x308A;
  17374. t['rikatakana'] = 0x30EA;
  17375. t['rikatakanahalfwidth'] = 0xFF98;
  17376. t['ring'] = 0x02DA;
  17377. t['ringbelowcmb'] = 0x0325;
  17378. t['ringcmb'] = 0x030A;
  17379. t['ringhalfleft'] = 0x02BF;
  17380. t['ringhalfleftarmenian'] = 0x0559;
  17381. t['ringhalfleftbelowcmb'] = 0x031C;
  17382. t['ringhalfleftcentered'] = 0x02D3;
  17383. t['ringhalfright'] = 0x02BE;
  17384. t['ringhalfrightbelowcmb'] = 0x0339;
  17385. t['ringhalfrightcentered'] = 0x02D2;
  17386. t['rinvertedbreve'] = 0x0213;
  17387. t['rittorusquare'] = 0x3351;
  17388. t['rlinebelow'] = 0x1E5F;
  17389. t['rlongleg'] = 0x027C;
  17390. t['rlonglegturned'] = 0x027A;
  17391. t['rmonospace'] = 0xFF52;
  17392. t['rohiragana'] = 0x308D;
  17393. t['rokatakana'] = 0x30ED;
  17394. t['rokatakanahalfwidth'] = 0xFF9B;
  17395. t['roruathai'] = 0x0E23;
  17396. t['rparen'] = 0x24AD;
  17397. t['rrabengali'] = 0x09DC;
  17398. t['rradeva'] = 0x0931;
  17399. t['rragurmukhi'] = 0x0A5C;
  17400. t['rreharabic'] = 0x0691;
  17401. t['rrehfinalarabic'] = 0xFB8D;
  17402. t['rrvocalicbengali'] = 0x09E0;
  17403. t['rrvocalicdeva'] = 0x0960;
  17404. t['rrvocalicgujarati'] = 0x0AE0;
  17405. t['rrvocalicvowelsignbengali'] = 0x09C4;
  17406. t['rrvocalicvowelsigndeva'] = 0x0944;
  17407. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  17408. t['rsuperior'] = 0xF6F1;
  17409. t['rtblock'] = 0x2590;
  17410. t['rturned'] = 0x0279;
  17411. t['rturnedsuperior'] = 0x02B4;
  17412. t['ruhiragana'] = 0x308B;
  17413. t['rukatakana'] = 0x30EB;
  17414. t['rukatakanahalfwidth'] = 0xFF99;
  17415. t['rupeemarkbengali'] = 0x09F2;
  17416. t['rupeesignbengali'] = 0x09F3;
  17417. t['rupiah'] = 0xF6DD;
  17418. t['ruthai'] = 0x0E24;
  17419. t['rvocalicbengali'] = 0x098B;
  17420. t['rvocalicdeva'] = 0x090B;
  17421. t['rvocalicgujarati'] = 0x0A8B;
  17422. t['rvocalicvowelsignbengali'] = 0x09C3;
  17423. t['rvocalicvowelsigndeva'] = 0x0943;
  17424. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  17425. t['s'] = 0x0073;
  17426. t['sabengali'] = 0x09B8;
  17427. t['sacute'] = 0x015B;
  17428. t['sacutedotaccent'] = 0x1E65;
  17429. t['sadarabic'] = 0x0635;
  17430. t['sadeva'] = 0x0938;
  17431. t['sadfinalarabic'] = 0xFEBA;
  17432. t['sadinitialarabic'] = 0xFEBB;
  17433. t['sadmedialarabic'] = 0xFEBC;
  17434. t['sagujarati'] = 0x0AB8;
  17435. t['sagurmukhi'] = 0x0A38;
  17436. t['sahiragana'] = 0x3055;
  17437. t['sakatakana'] = 0x30B5;
  17438. t['sakatakanahalfwidth'] = 0xFF7B;
  17439. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  17440. t['samekh'] = 0x05E1;
  17441. t['samekhdagesh'] = 0xFB41;
  17442. t['samekhdageshhebrew'] = 0xFB41;
  17443. t['samekhhebrew'] = 0x05E1;
  17444. t['saraaathai'] = 0x0E32;
  17445. t['saraaethai'] = 0x0E41;
  17446. t['saraaimaimalaithai'] = 0x0E44;
  17447. t['saraaimaimuanthai'] = 0x0E43;
  17448. t['saraamthai'] = 0x0E33;
  17449. t['saraathai'] = 0x0E30;
  17450. t['saraethai'] = 0x0E40;
  17451. t['saraiileftthai'] = 0xF886;
  17452. t['saraiithai'] = 0x0E35;
  17453. t['saraileftthai'] = 0xF885;
  17454. t['saraithai'] = 0x0E34;
  17455. t['saraothai'] = 0x0E42;
  17456. t['saraueeleftthai'] = 0xF888;
  17457. t['saraueethai'] = 0x0E37;
  17458. t['saraueleftthai'] = 0xF887;
  17459. t['sarauethai'] = 0x0E36;
  17460. t['sarauthai'] = 0x0E38;
  17461. t['sarauuthai'] = 0x0E39;
  17462. t['sbopomofo'] = 0x3119;
  17463. t['scaron'] = 0x0161;
  17464. t['scarondotaccent'] = 0x1E67;
  17465. t['scedilla'] = 0x015F;
  17466. t['schwa'] = 0x0259;
  17467. t['schwacyrillic'] = 0x04D9;
  17468. t['schwadieresiscyrillic'] = 0x04DB;
  17469. t['schwahook'] = 0x025A;
  17470. t['scircle'] = 0x24E2;
  17471. t['scircumflex'] = 0x015D;
  17472. t['scommaaccent'] = 0x0219;
  17473. t['sdotaccent'] = 0x1E61;
  17474. t['sdotbelow'] = 0x1E63;
  17475. t['sdotbelowdotaccent'] = 0x1E69;
  17476. t['seagullbelowcmb'] = 0x033C;
  17477. t['second'] = 0x2033;
  17478. t['secondtonechinese'] = 0x02CA;
  17479. t['section'] = 0x00A7;
  17480. t['seenarabic'] = 0x0633;
  17481. t['seenfinalarabic'] = 0xFEB2;
  17482. t['seeninitialarabic'] = 0xFEB3;
  17483. t['seenmedialarabic'] = 0xFEB4;
  17484. t['segol'] = 0x05B6;
  17485. t['segol13'] = 0x05B6;
  17486. t['segol1f'] = 0x05B6;
  17487. t['segol2c'] = 0x05B6;
  17488. t['segolhebrew'] = 0x05B6;
  17489. t['segolnarrowhebrew'] = 0x05B6;
  17490. t['segolquarterhebrew'] = 0x05B6;
  17491. t['segoltahebrew'] = 0x0592;
  17492. t['segolwidehebrew'] = 0x05B6;
  17493. t['seharmenian'] = 0x057D;
  17494. t['sehiragana'] = 0x305B;
  17495. t['sekatakana'] = 0x30BB;
  17496. t['sekatakanahalfwidth'] = 0xFF7E;
  17497. t['semicolon'] = 0x003B;
  17498. t['semicolonarabic'] = 0x061B;
  17499. t['semicolonmonospace'] = 0xFF1B;
  17500. t['semicolonsmall'] = 0xFE54;
  17501. t['semivoicedmarkkana'] = 0x309C;
  17502. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  17503. t['sentisquare'] = 0x3322;
  17504. t['sentosquare'] = 0x3323;
  17505. t['seven'] = 0x0037;
  17506. t['sevenarabic'] = 0x0667;
  17507. t['sevenbengali'] = 0x09ED;
  17508. t['sevencircle'] = 0x2466;
  17509. t['sevencircleinversesansserif'] = 0x2790;
  17510. t['sevendeva'] = 0x096D;
  17511. t['seveneighths'] = 0x215E;
  17512. t['sevengujarati'] = 0x0AED;
  17513. t['sevengurmukhi'] = 0x0A6D;
  17514. t['sevenhackarabic'] = 0x0667;
  17515. t['sevenhangzhou'] = 0x3027;
  17516. t['sevenideographicparen'] = 0x3226;
  17517. t['seveninferior'] = 0x2087;
  17518. t['sevenmonospace'] = 0xFF17;
  17519. t['sevenoldstyle'] = 0xF737;
  17520. t['sevenparen'] = 0x247A;
  17521. t['sevenperiod'] = 0x248E;
  17522. t['sevenpersian'] = 0x06F7;
  17523. t['sevenroman'] = 0x2176;
  17524. t['sevensuperior'] = 0x2077;
  17525. t['seventeencircle'] = 0x2470;
  17526. t['seventeenparen'] = 0x2484;
  17527. t['seventeenperiod'] = 0x2498;
  17528. t['seventhai'] = 0x0E57;
  17529. t['sfthyphen'] = 0x00AD;
  17530. t['shaarmenian'] = 0x0577;
  17531. t['shabengali'] = 0x09B6;
  17532. t['shacyrillic'] = 0x0448;
  17533. t['shaddaarabic'] = 0x0651;
  17534. t['shaddadammaarabic'] = 0xFC61;
  17535. t['shaddadammatanarabic'] = 0xFC5E;
  17536. t['shaddafathaarabic'] = 0xFC60;
  17537. t['shaddakasraarabic'] = 0xFC62;
  17538. t['shaddakasratanarabic'] = 0xFC5F;
  17539. t['shade'] = 0x2592;
  17540. t['shadedark'] = 0x2593;
  17541. t['shadelight'] = 0x2591;
  17542. t['shademedium'] = 0x2592;
  17543. t['shadeva'] = 0x0936;
  17544. t['shagujarati'] = 0x0AB6;
  17545. t['shagurmukhi'] = 0x0A36;
  17546. t['shalshelethebrew'] = 0x0593;
  17547. t['shbopomofo'] = 0x3115;
  17548. t['shchacyrillic'] = 0x0449;
  17549. t['sheenarabic'] = 0x0634;
  17550. t['sheenfinalarabic'] = 0xFEB6;
  17551. t['sheeninitialarabic'] = 0xFEB7;
  17552. t['sheenmedialarabic'] = 0xFEB8;
  17553. t['sheicoptic'] = 0x03E3;
  17554. t['sheqel'] = 0x20AA;
  17555. t['sheqelhebrew'] = 0x20AA;
  17556. t['sheva'] = 0x05B0;
  17557. t['sheva115'] = 0x05B0;
  17558. t['sheva15'] = 0x05B0;
  17559. t['sheva22'] = 0x05B0;
  17560. t['sheva2e'] = 0x05B0;
  17561. t['shevahebrew'] = 0x05B0;
  17562. t['shevanarrowhebrew'] = 0x05B0;
  17563. t['shevaquarterhebrew'] = 0x05B0;
  17564. t['shevawidehebrew'] = 0x05B0;
  17565. t['shhacyrillic'] = 0x04BB;
  17566. t['shimacoptic'] = 0x03ED;
  17567. t['shin'] = 0x05E9;
  17568. t['shindagesh'] = 0xFB49;
  17569. t['shindageshhebrew'] = 0xFB49;
  17570. t['shindageshshindot'] = 0xFB2C;
  17571. t['shindageshshindothebrew'] = 0xFB2C;
  17572. t['shindageshsindot'] = 0xFB2D;
  17573. t['shindageshsindothebrew'] = 0xFB2D;
  17574. t['shindothebrew'] = 0x05C1;
  17575. t['shinhebrew'] = 0x05E9;
  17576. t['shinshindot'] = 0xFB2A;
  17577. t['shinshindothebrew'] = 0xFB2A;
  17578. t['shinsindot'] = 0xFB2B;
  17579. t['shinsindothebrew'] = 0xFB2B;
  17580. t['shook'] = 0x0282;
  17581. t['sigma'] = 0x03C3;
  17582. t['sigma1'] = 0x03C2;
  17583. t['sigmafinal'] = 0x03C2;
  17584. t['sigmalunatesymbolgreek'] = 0x03F2;
  17585. t['sihiragana'] = 0x3057;
  17586. t['sikatakana'] = 0x30B7;
  17587. t['sikatakanahalfwidth'] = 0xFF7C;
  17588. t['siluqhebrew'] = 0x05BD;
  17589. t['siluqlefthebrew'] = 0x05BD;
  17590. t['similar'] = 0x223C;
  17591. t['sindothebrew'] = 0x05C2;
  17592. t['siosacirclekorean'] = 0x3274;
  17593. t['siosaparenkorean'] = 0x3214;
  17594. t['sioscieuckorean'] = 0x317E;
  17595. t['sioscirclekorean'] = 0x3266;
  17596. t['sioskiyeokkorean'] = 0x317A;
  17597. t['sioskorean'] = 0x3145;
  17598. t['siosnieunkorean'] = 0x317B;
  17599. t['siosparenkorean'] = 0x3206;
  17600. t['siospieupkorean'] = 0x317D;
  17601. t['siostikeutkorean'] = 0x317C;
  17602. t['six'] = 0x0036;
  17603. t['sixarabic'] = 0x0666;
  17604. t['sixbengali'] = 0x09EC;
  17605. t['sixcircle'] = 0x2465;
  17606. t['sixcircleinversesansserif'] = 0x278F;
  17607. t['sixdeva'] = 0x096C;
  17608. t['sixgujarati'] = 0x0AEC;
  17609. t['sixgurmukhi'] = 0x0A6C;
  17610. t['sixhackarabic'] = 0x0666;
  17611. t['sixhangzhou'] = 0x3026;
  17612. t['sixideographicparen'] = 0x3225;
  17613. t['sixinferior'] = 0x2086;
  17614. t['sixmonospace'] = 0xFF16;
  17615. t['sixoldstyle'] = 0xF736;
  17616. t['sixparen'] = 0x2479;
  17617. t['sixperiod'] = 0x248D;
  17618. t['sixpersian'] = 0x06F6;
  17619. t['sixroman'] = 0x2175;
  17620. t['sixsuperior'] = 0x2076;
  17621. t['sixteencircle'] = 0x246F;
  17622. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  17623. t['sixteenparen'] = 0x2483;
  17624. t['sixteenperiod'] = 0x2497;
  17625. t['sixthai'] = 0x0E56;
  17626. t['slash'] = 0x002F;
  17627. t['slashmonospace'] = 0xFF0F;
  17628. t['slong'] = 0x017F;
  17629. t['slongdotaccent'] = 0x1E9B;
  17630. t['smileface'] = 0x263A;
  17631. t['smonospace'] = 0xFF53;
  17632. t['sofpasuqhebrew'] = 0x05C3;
  17633. t['softhyphen'] = 0x00AD;
  17634. t['softsigncyrillic'] = 0x044C;
  17635. t['sohiragana'] = 0x305D;
  17636. t['sokatakana'] = 0x30BD;
  17637. t['sokatakanahalfwidth'] = 0xFF7F;
  17638. t['soliduslongoverlaycmb'] = 0x0338;
  17639. t['solidusshortoverlaycmb'] = 0x0337;
  17640. t['sorusithai'] = 0x0E29;
  17641. t['sosalathai'] = 0x0E28;
  17642. t['sosothai'] = 0x0E0B;
  17643. t['sosuathai'] = 0x0E2A;
  17644. t['space'] = 0x0020;
  17645. t['spacehackarabic'] = 0x0020;
  17646. t['spade'] = 0x2660;
  17647. t['spadesuitblack'] = 0x2660;
  17648. t['spadesuitwhite'] = 0x2664;
  17649. t['sparen'] = 0x24AE;
  17650. t['squarebelowcmb'] = 0x033B;
  17651. t['squarecc'] = 0x33C4;
  17652. t['squarecm'] = 0x339D;
  17653. t['squarediagonalcrosshatchfill'] = 0x25A9;
  17654. t['squarehorizontalfill'] = 0x25A4;
  17655. t['squarekg'] = 0x338F;
  17656. t['squarekm'] = 0x339E;
  17657. t['squarekmcapital'] = 0x33CE;
  17658. t['squareln'] = 0x33D1;
  17659. t['squarelog'] = 0x33D2;
  17660. t['squaremg'] = 0x338E;
  17661. t['squaremil'] = 0x33D5;
  17662. t['squaremm'] = 0x339C;
  17663. t['squaremsquared'] = 0x33A1;
  17664. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  17665. t['squareupperlefttolowerrightfill'] = 0x25A7;
  17666. t['squareupperrighttolowerleftfill'] = 0x25A8;
  17667. t['squareverticalfill'] = 0x25A5;
  17668. t['squarewhitewithsmallblack'] = 0x25A3;
  17669. t['srsquare'] = 0x33DB;
  17670. t['ssabengali'] = 0x09B7;
  17671. t['ssadeva'] = 0x0937;
  17672. t['ssagujarati'] = 0x0AB7;
  17673. t['ssangcieuckorean'] = 0x3149;
  17674. t['ssanghieuhkorean'] = 0x3185;
  17675. t['ssangieungkorean'] = 0x3180;
  17676. t['ssangkiyeokkorean'] = 0x3132;
  17677. t['ssangnieunkorean'] = 0x3165;
  17678. t['ssangpieupkorean'] = 0x3143;
  17679. t['ssangsioskorean'] = 0x3146;
  17680. t['ssangtikeutkorean'] = 0x3138;
  17681. t['ssuperior'] = 0xF6F2;
  17682. t['sterling'] = 0x00A3;
  17683. t['sterlingmonospace'] = 0xFFE1;
  17684. t['strokelongoverlaycmb'] = 0x0336;
  17685. t['strokeshortoverlaycmb'] = 0x0335;
  17686. t['subset'] = 0x2282;
  17687. t['subsetnotequal'] = 0x228A;
  17688. t['subsetorequal'] = 0x2286;
  17689. t['succeeds'] = 0x227B;
  17690. t['suchthat'] = 0x220B;
  17691. t['suhiragana'] = 0x3059;
  17692. t['sukatakana'] = 0x30B9;
  17693. t['sukatakanahalfwidth'] = 0xFF7D;
  17694. t['sukunarabic'] = 0x0652;
  17695. t['summation'] = 0x2211;
  17696. t['sun'] = 0x263C;
  17697. t['superset'] = 0x2283;
  17698. t['supersetnotequal'] = 0x228B;
  17699. t['supersetorequal'] = 0x2287;
  17700. t['svsquare'] = 0x33DC;
  17701. t['syouwaerasquare'] = 0x337C;
  17702. t['t'] = 0x0074;
  17703. t['tabengali'] = 0x09A4;
  17704. t['tackdown'] = 0x22A4;
  17705. t['tackleft'] = 0x22A3;
  17706. t['tadeva'] = 0x0924;
  17707. t['tagujarati'] = 0x0AA4;
  17708. t['tagurmukhi'] = 0x0A24;
  17709. t['taharabic'] = 0x0637;
  17710. t['tahfinalarabic'] = 0xFEC2;
  17711. t['tahinitialarabic'] = 0xFEC3;
  17712. t['tahiragana'] = 0x305F;
  17713. t['tahmedialarabic'] = 0xFEC4;
  17714. t['taisyouerasquare'] = 0x337D;
  17715. t['takatakana'] = 0x30BF;
  17716. t['takatakanahalfwidth'] = 0xFF80;
  17717. t['tatweelarabic'] = 0x0640;
  17718. t['tau'] = 0x03C4;
  17719. t['tav'] = 0x05EA;
  17720. t['tavdages'] = 0xFB4A;
  17721. t['tavdagesh'] = 0xFB4A;
  17722. t['tavdageshhebrew'] = 0xFB4A;
  17723. t['tavhebrew'] = 0x05EA;
  17724. t['tbar'] = 0x0167;
  17725. t['tbopomofo'] = 0x310A;
  17726. t['tcaron'] = 0x0165;
  17727. t['tccurl'] = 0x02A8;
  17728. t['tcedilla'] = 0x0163;
  17729. t['tcheharabic'] = 0x0686;
  17730. t['tchehfinalarabic'] = 0xFB7B;
  17731. t['tchehinitialarabic'] = 0xFB7C;
  17732. t['tchehmedialarabic'] = 0xFB7D;
  17733. t['tcircle'] = 0x24E3;
  17734. t['tcircumflexbelow'] = 0x1E71;
  17735. t['tcommaaccent'] = 0x0163;
  17736. t['tdieresis'] = 0x1E97;
  17737. t['tdotaccent'] = 0x1E6B;
  17738. t['tdotbelow'] = 0x1E6D;
  17739. t['tecyrillic'] = 0x0442;
  17740. t['tedescendercyrillic'] = 0x04AD;
  17741. t['teharabic'] = 0x062A;
  17742. t['tehfinalarabic'] = 0xFE96;
  17743. t['tehhahinitialarabic'] = 0xFCA2;
  17744. t['tehhahisolatedarabic'] = 0xFC0C;
  17745. t['tehinitialarabic'] = 0xFE97;
  17746. t['tehiragana'] = 0x3066;
  17747. t['tehjeeminitialarabic'] = 0xFCA1;
  17748. t['tehjeemisolatedarabic'] = 0xFC0B;
  17749. t['tehmarbutaarabic'] = 0x0629;
  17750. t['tehmarbutafinalarabic'] = 0xFE94;
  17751. t['tehmedialarabic'] = 0xFE98;
  17752. t['tehmeeminitialarabic'] = 0xFCA4;
  17753. t['tehmeemisolatedarabic'] = 0xFC0E;
  17754. t['tehnoonfinalarabic'] = 0xFC73;
  17755. t['tekatakana'] = 0x30C6;
  17756. t['tekatakanahalfwidth'] = 0xFF83;
  17757. t['telephone'] = 0x2121;
  17758. t['telephoneblack'] = 0x260E;
  17759. t['telishagedolahebrew'] = 0x05A0;
  17760. t['telishaqetanahebrew'] = 0x05A9;
  17761. t['tencircle'] = 0x2469;
  17762. t['tenideographicparen'] = 0x3229;
  17763. t['tenparen'] = 0x247D;
  17764. t['tenperiod'] = 0x2491;
  17765. t['tenroman'] = 0x2179;
  17766. t['tesh'] = 0x02A7;
  17767. t['tet'] = 0x05D8;
  17768. t['tetdagesh'] = 0xFB38;
  17769. t['tetdageshhebrew'] = 0xFB38;
  17770. t['tethebrew'] = 0x05D8;
  17771. t['tetsecyrillic'] = 0x04B5;
  17772. t['tevirhebrew'] = 0x059B;
  17773. t['tevirlefthebrew'] = 0x059B;
  17774. t['thabengali'] = 0x09A5;
  17775. t['thadeva'] = 0x0925;
  17776. t['thagujarati'] = 0x0AA5;
  17777. t['thagurmukhi'] = 0x0A25;
  17778. t['thalarabic'] = 0x0630;
  17779. t['thalfinalarabic'] = 0xFEAC;
  17780. t['thanthakhatlowleftthai'] = 0xF898;
  17781. t['thanthakhatlowrightthai'] = 0xF897;
  17782. t['thanthakhatthai'] = 0x0E4C;
  17783. t['thanthakhatupperleftthai'] = 0xF896;
  17784. t['theharabic'] = 0x062B;
  17785. t['thehfinalarabic'] = 0xFE9A;
  17786. t['thehinitialarabic'] = 0xFE9B;
  17787. t['thehmedialarabic'] = 0xFE9C;
  17788. t['thereexists'] = 0x2203;
  17789. t['therefore'] = 0x2234;
  17790. t['theta'] = 0x03B8;
  17791. t['theta1'] = 0x03D1;
  17792. t['thetasymbolgreek'] = 0x03D1;
  17793. t['thieuthacirclekorean'] = 0x3279;
  17794. t['thieuthaparenkorean'] = 0x3219;
  17795. t['thieuthcirclekorean'] = 0x326B;
  17796. t['thieuthkorean'] = 0x314C;
  17797. t['thieuthparenkorean'] = 0x320B;
  17798. t['thirteencircle'] = 0x246C;
  17799. t['thirteenparen'] = 0x2480;
  17800. t['thirteenperiod'] = 0x2494;
  17801. t['thonangmonthothai'] = 0x0E11;
  17802. t['thook'] = 0x01AD;
  17803. t['thophuthaothai'] = 0x0E12;
  17804. t['thorn'] = 0x00FE;
  17805. t['thothahanthai'] = 0x0E17;
  17806. t['thothanthai'] = 0x0E10;
  17807. t['thothongthai'] = 0x0E18;
  17808. t['thothungthai'] = 0x0E16;
  17809. t['thousandcyrillic'] = 0x0482;
  17810. t['thousandsseparatorarabic'] = 0x066C;
  17811. t['thousandsseparatorpersian'] = 0x066C;
  17812. t['three'] = 0x0033;
  17813. t['threearabic'] = 0x0663;
  17814. t['threebengali'] = 0x09E9;
  17815. t['threecircle'] = 0x2462;
  17816. t['threecircleinversesansserif'] = 0x278C;
  17817. t['threedeva'] = 0x0969;
  17818. t['threeeighths'] = 0x215C;
  17819. t['threegujarati'] = 0x0AE9;
  17820. t['threegurmukhi'] = 0x0A69;
  17821. t['threehackarabic'] = 0x0663;
  17822. t['threehangzhou'] = 0x3023;
  17823. t['threeideographicparen'] = 0x3222;
  17824. t['threeinferior'] = 0x2083;
  17825. t['threemonospace'] = 0xFF13;
  17826. t['threenumeratorbengali'] = 0x09F6;
  17827. t['threeoldstyle'] = 0xF733;
  17828. t['threeparen'] = 0x2476;
  17829. t['threeperiod'] = 0x248A;
  17830. t['threepersian'] = 0x06F3;
  17831. t['threequarters'] = 0x00BE;
  17832. t['threequartersemdash'] = 0xF6DE;
  17833. t['threeroman'] = 0x2172;
  17834. t['threesuperior'] = 0x00B3;
  17835. t['threethai'] = 0x0E53;
  17836. t['thzsquare'] = 0x3394;
  17837. t['tihiragana'] = 0x3061;
  17838. t['tikatakana'] = 0x30C1;
  17839. t['tikatakanahalfwidth'] = 0xFF81;
  17840. t['tikeutacirclekorean'] = 0x3270;
  17841. t['tikeutaparenkorean'] = 0x3210;
  17842. t['tikeutcirclekorean'] = 0x3262;
  17843. t['tikeutkorean'] = 0x3137;
  17844. t['tikeutparenkorean'] = 0x3202;
  17845. t['tilde'] = 0x02DC;
  17846. t['tildebelowcmb'] = 0x0330;
  17847. t['tildecmb'] = 0x0303;
  17848. t['tildecomb'] = 0x0303;
  17849. t['tildedoublecmb'] = 0x0360;
  17850. t['tildeoperator'] = 0x223C;
  17851. t['tildeoverlaycmb'] = 0x0334;
  17852. t['tildeverticalcmb'] = 0x033E;
  17853. t['timescircle'] = 0x2297;
  17854. t['tipehahebrew'] = 0x0596;
  17855. t['tipehalefthebrew'] = 0x0596;
  17856. t['tippigurmukhi'] = 0x0A70;
  17857. t['titlocyrilliccmb'] = 0x0483;
  17858. t['tiwnarmenian'] = 0x057F;
  17859. t['tlinebelow'] = 0x1E6F;
  17860. t['tmonospace'] = 0xFF54;
  17861. t['toarmenian'] = 0x0569;
  17862. t['tohiragana'] = 0x3068;
  17863. t['tokatakana'] = 0x30C8;
  17864. t['tokatakanahalfwidth'] = 0xFF84;
  17865. t['tonebarextrahighmod'] = 0x02E5;
  17866. t['tonebarextralowmod'] = 0x02E9;
  17867. t['tonebarhighmod'] = 0x02E6;
  17868. t['tonebarlowmod'] = 0x02E8;
  17869. t['tonebarmidmod'] = 0x02E7;
  17870. t['tonefive'] = 0x01BD;
  17871. t['tonesix'] = 0x0185;
  17872. t['tonetwo'] = 0x01A8;
  17873. t['tonos'] = 0x0384;
  17874. t['tonsquare'] = 0x3327;
  17875. t['topatakthai'] = 0x0E0F;
  17876. t['tortoiseshellbracketleft'] = 0x3014;
  17877. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17878. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17879. t['tortoiseshellbracketright'] = 0x3015;
  17880. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17881. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17882. t['totaothai'] = 0x0E15;
  17883. t['tpalatalhook'] = 0x01AB;
  17884. t['tparen'] = 0x24AF;
  17885. t['trademark'] = 0x2122;
  17886. t['trademarksans'] = 0xF8EA;
  17887. t['trademarkserif'] = 0xF6DB;
  17888. t['tretroflexhook'] = 0x0288;
  17889. t['triagdn'] = 0x25BC;
  17890. t['triaglf'] = 0x25C4;
  17891. t['triagrt'] = 0x25BA;
  17892. t['triagup'] = 0x25B2;
  17893. t['ts'] = 0x02A6;
  17894. t['tsadi'] = 0x05E6;
  17895. t['tsadidagesh'] = 0xFB46;
  17896. t['tsadidageshhebrew'] = 0xFB46;
  17897. t['tsadihebrew'] = 0x05E6;
  17898. t['tsecyrillic'] = 0x0446;
  17899. t['tsere'] = 0x05B5;
  17900. t['tsere12'] = 0x05B5;
  17901. t['tsere1e'] = 0x05B5;
  17902. t['tsere2b'] = 0x05B5;
  17903. t['tserehebrew'] = 0x05B5;
  17904. t['tserenarrowhebrew'] = 0x05B5;
  17905. t['tserequarterhebrew'] = 0x05B5;
  17906. t['tserewidehebrew'] = 0x05B5;
  17907. t['tshecyrillic'] = 0x045B;
  17908. t['tsuperior'] = 0xF6F3;
  17909. t['ttabengali'] = 0x099F;
  17910. t['ttadeva'] = 0x091F;
  17911. t['ttagujarati'] = 0x0A9F;
  17912. t['ttagurmukhi'] = 0x0A1F;
  17913. t['tteharabic'] = 0x0679;
  17914. t['ttehfinalarabic'] = 0xFB67;
  17915. t['ttehinitialarabic'] = 0xFB68;
  17916. t['ttehmedialarabic'] = 0xFB69;
  17917. t['tthabengali'] = 0x09A0;
  17918. t['tthadeva'] = 0x0920;
  17919. t['tthagujarati'] = 0x0AA0;
  17920. t['tthagurmukhi'] = 0x0A20;
  17921. t['tturned'] = 0x0287;
  17922. t['tuhiragana'] = 0x3064;
  17923. t['tukatakana'] = 0x30C4;
  17924. t['tukatakanahalfwidth'] = 0xFF82;
  17925. t['tusmallhiragana'] = 0x3063;
  17926. t['tusmallkatakana'] = 0x30C3;
  17927. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17928. t['twelvecircle'] = 0x246B;
  17929. t['twelveparen'] = 0x247F;
  17930. t['twelveperiod'] = 0x2493;
  17931. t['twelveroman'] = 0x217B;
  17932. t['twentycircle'] = 0x2473;
  17933. t['twentyhangzhou'] = 0x5344;
  17934. t['twentyparen'] = 0x2487;
  17935. t['twentyperiod'] = 0x249B;
  17936. t['two'] = 0x0032;
  17937. t['twoarabic'] = 0x0662;
  17938. t['twobengali'] = 0x09E8;
  17939. t['twocircle'] = 0x2461;
  17940. t['twocircleinversesansserif'] = 0x278B;
  17941. t['twodeva'] = 0x0968;
  17942. t['twodotenleader'] = 0x2025;
  17943. t['twodotleader'] = 0x2025;
  17944. t['twodotleadervertical'] = 0xFE30;
  17945. t['twogujarati'] = 0x0AE8;
  17946. t['twogurmukhi'] = 0x0A68;
  17947. t['twohackarabic'] = 0x0662;
  17948. t['twohangzhou'] = 0x3022;
  17949. t['twoideographicparen'] = 0x3221;
  17950. t['twoinferior'] = 0x2082;
  17951. t['twomonospace'] = 0xFF12;
  17952. t['twonumeratorbengali'] = 0x09F5;
  17953. t['twooldstyle'] = 0xF732;
  17954. t['twoparen'] = 0x2475;
  17955. t['twoperiod'] = 0x2489;
  17956. t['twopersian'] = 0x06F2;
  17957. t['tworoman'] = 0x2171;
  17958. t['twostroke'] = 0x01BB;
  17959. t['twosuperior'] = 0x00B2;
  17960. t['twothai'] = 0x0E52;
  17961. t['twothirds'] = 0x2154;
  17962. t['u'] = 0x0075;
  17963. t['uacute'] = 0x00FA;
  17964. t['ubar'] = 0x0289;
  17965. t['ubengali'] = 0x0989;
  17966. t['ubopomofo'] = 0x3128;
  17967. t['ubreve'] = 0x016D;
  17968. t['ucaron'] = 0x01D4;
  17969. t['ucircle'] = 0x24E4;
  17970. t['ucircumflex'] = 0x00FB;
  17971. t['ucircumflexbelow'] = 0x1E77;
  17972. t['ucyrillic'] = 0x0443;
  17973. t['udattadeva'] = 0x0951;
  17974. t['udblacute'] = 0x0171;
  17975. t['udblgrave'] = 0x0215;
  17976. t['udeva'] = 0x0909;
  17977. t['udieresis'] = 0x00FC;
  17978. t['udieresisacute'] = 0x01D8;
  17979. t['udieresisbelow'] = 0x1E73;
  17980. t['udieresiscaron'] = 0x01DA;
  17981. t['udieresiscyrillic'] = 0x04F1;
  17982. t['udieresisgrave'] = 0x01DC;
  17983. t['udieresismacron'] = 0x01D6;
  17984. t['udotbelow'] = 0x1EE5;
  17985. t['ugrave'] = 0x00F9;
  17986. t['ugujarati'] = 0x0A89;
  17987. t['ugurmukhi'] = 0x0A09;
  17988. t['uhiragana'] = 0x3046;
  17989. t['uhookabove'] = 0x1EE7;
  17990. t['uhorn'] = 0x01B0;
  17991. t['uhornacute'] = 0x1EE9;
  17992. t['uhorndotbelow'] = 0x1EF1;
  17993. t['uhorngrave'] = 0x1EEB;
  17994. t['uhornhookabove'] = 0x1EED;
  17995. t['uhorntilde'] = 0x1EEF;
  17996. t['uhungarumlaut'] = 0x0171;
  17997. t['uhungarumlautcyrillic'] = 0x04F3;
  17998. t['uinvertedbreve'] = 0x0217;
  17999. t['ukatakana'] = 0x30A6;
  18000. t['ukatakanahalfwidth'] = 0xFF73;
  18001. t['ukcyrillic'] = 0x0479;
  18002. t['ukorean'] = 0x315C;
  18003. t['umacron'] = 0x016B;
  18004. t['umacroncyrillic'] = 0x04EF;
  18005. t['umacrondieresis'] = 0x1E7B;
  18006. t['umatragurmukhi'] = 0x0A41;
  18007. t['umonospace'] = 0xFF55;
  18008. t['underscore'] = 0x005F;
  18009. t['underscoredbl'] = 0x2017;
  18010. t['underscoremonospace'] = 0xFF3F;
  18011. t['underscorevertical'] = 0xFE33;
  18012. t['underscorewavy'] = 0xFE4F;
  18013. t['union'] = 0x222A;
  18014. t['universal'] = 0x2200;
  18015. t['uogonek'] = 0x0173;
  18016. t['uparen'] = 0x24B0;
  18017. t['upblock'] = 0x2580;
  18018. t['upperdothebrew'] = 0x05C4;
  18019. t['upsilon'] = 0x03C5;
  18020. t['upsilondieresis'] = 0x03CB;
  18021. t['upsilondieresistonos'] = 0x03B0;
  18022. t['upsilonlatin'] = 0x028A;
  18023. t['upsilontonos'] = 0x03CD;
  18024. t['uptackbelowcmb'] = 0x031D;
  18025. t['uptackmod'] = 0x02D4;
  18026. t['uragurmukhi'] = 0x0A73;
  18027. t['uring'] = 0x016F;
  18028. t['ushortcyrillic'] = 0x045E;
  18029. t['usmallhiragana'] = 0x3045;
  18030. t['usmallkatakana'] = 0x30A5;
  18031. t['usmallkatakanahalfwidth'] = 0xFF69;
  18032. t['ustraightcyrillic'] = 0x04AF;
  18033. t['ustraightstrokecyrillic'] = 0x04B1;
  18034. t['utilde'] = 0x0169;
  18035. t['utildeacute'] = 0x1E79;
  18036. t['utildebelow'] = 0x1E75;
  18037. t['uubengali'] = 0x098A;
  18038. t['uudeva'] = 0x090A;
  18039. t['uugujarati'] = 0x0A8A;
  18040. t['uugurmukhi'] = 0x0A0A;
  18041. t['uumatragurmukhi'] = 0x0A42;
  18042. t['uuvowelsignbengali'] = 0x09C2;
  18043. t['uuvowelsigndeva'] = 0x0942;
  18044. t['uuvowelsigngujarati'] = 0x0AC2;
  18045. t['uvowelsignbengali'] = 0x09C1;
  18046. t['uvowelsigndeva'] = 0x0941;
  18047. t['uvowelsigngujarati'] = 0x0AC1;
  18048. t['v'] = 0x0076;
  18049. t['vadeva'] = 0x0935;
  18050. t['vagujarati'] = 0x0AB5;
  18051. t['vagurmukhi'] = 0x0A35;
  18052. t['vakatakana'] = 0x30F7;
  18053. t['vav'] = 0x05D5;
  18054. t['vavdagesh'] = 0xFB35;
  18055. t['vavdagesh65'] = 0xFB35;
  18056. t['vavdageshhebrew'] = 0xFB35;
  18057. t['vavhebrew'] = 0x05D5;
  18058. t['vavholam'] = 0xFB4B;
  18059. t['vavholamhebrew'] = 0xFB4B;
  18060. t['vavvavhebrew'] = 0x05F0;
  18061. t['vavyodhebrew'] = 0x05F1;
  18062. t['vcircle'] = 0x24E5;
  18063. t['vdotbelow'] = 0x1E7F;
  18064. t['vecyrillic'] = 0x0432;
  18065. t['veharabic'] = 0x06A4;
  18066. t['vehfinalarabic'] = 0xFB6B;
  18067. t['vehinitialarabic'] = 0xFB6C;
  18068. t['vehmedialarabic'] = 0xFB6D;
  18069. t['vekatakana'] = 0x30F9;
  18070. t['venus'] = 0x2640;
  18071. t['verticalbar'] = 0x007C;
  18072. t['verticallineabovecmb'] = 0x030D;
  18073. t['verticallinebelowcmb'] = 0x0329;
  18074. t['verticallinelowmod'] = 0x02CC;
  18075. t['verticallinemod'] = 0x02C8;
  18076. t['vewarmenian'] = 0x057E;
  18077. t['vhook'] = 0x028B;
  18078. t['vikatakana'] = 0x30F8;
  18079. t['viramabengali'] = 0x09CD;
  18080. t['viramadeva'] = 0x094D;
  18081. t['viramagujarati'] = 0x0ACD;
  18082. t['visargabengali'] = 0x0983;
  18083. t['visargadeva'] = 0x0903;
  18084. t['visargagujarati'] = 0x0A83;
  18085. t['vmonospace'] = 0xFF56;
  18086. t['voarmenian'] = 0x0578;
  18087. t['voicediterationhiragana'] = 0x309E;
  18088. t['voicediterationkatakana'] = 0x30FE;
  18089. t['voicedmarkkana'] = 0x309B;
  18090. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  18091. t['vokatakana'] = 0x30FA;
  18092. t['vparen'] = 0x24B1;
  18093. t['vtilde'] = 0x1E7D;
  18094. t['vturned'] = 0x028C;
  18095. t['vuhiragana'] = 0x3094;
  18096. t['vukatakana'] = 0x30F4;
  18097. t['w'] = 0x0077;
  18098. t['wacute'] = 0x1E83;
  18099. t['waekorean'] = 0x3159;
  18100. t['wahiragana'] = 0x308F;
  18101. t['wakatakana'] = 0x30EF;
  18102. t['wakatakanahalfwidth'] = 0xFF9C;
  18103. t['wakorean'] = 0x3158;
  18104. t['wasmallhiragana'] = 0x308E;
  18105. t['wasmallkatakana'] = 0x30EE;
  18106. t['wattosquare'] = 0x3357;
  18107. t['wavedash'] = 0x301C;
  18108. t['wavyunderscorevertical'] = 0xFE34;
  18109. t['wawarabic'] = 0x0648;
  18110. t['wawfinalarabic'] = 0xFEEE;
  18111. t['wawhamzaabovearabic'] = 0x0624;
  18112. t['wawhamzaabovefinalarabic'] = 0xFE86;
  18113. t['wbsquare'] = 0x33DD;
  18114. t['wcircle'] = 0x24E6;
  18115. t['wcircumflex'] = 0x0175;
  18116. t['wdieresis'] = 0x1E85;
  18117. t['wdotaccent'] = 0x1E87;
  18118. t['wdotbelow'] = 0x1E89;
  18119. t['wehiragana'] = 0x3091;
  18120. t['weierstrass'] = 0x2118;
  18121. t['wekatakana'] = 0x30F1;
  18122. t['wekorean'] = 0x315E;
  18123. t['weokorean'] = 0x315D;
  18124. t['wgrave'] = 0x1E81;
  18125. t['whitebullet'] = 0x25E6;
  18126. t['whitecircle'] = 0x25CB;
  18127. t['whitecircleinverse'] = 0x25D9;
  18128. t['whitecornerbracketleft'] = 0x300E;
  18129. t['whitecornerbracketleftvertical'] = 0xFE43;
  18130. t['whitecornerbracketright'] = 0x300F;
  18131. t['whitecornerbracketrightvertical'] = 0xFE44;
  18132. t['whitediamond'] = 0x25C7;
  18133. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  18134. t['whitedownpointingsmalltriangle'] = 0x25BF;
  18135. t['whitedownpointingtriangle'] = 0x25BD;
  18136. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  18137. t['whiteleftpointingtriangle'] = 0x25C1;
  18138. t['whitelenticularbracketleft'] = 0x3016;
  18139. t['whitelenticularbracketright'] = 0x3017;
  18140. t['whiterightpointingsmalltriangle'] = 0x25B9;
  18141. t['whiterightpointingtriangle'] = 0x25B7;
  18142. t['whitesmallsquare'] = 0x25AB;
  18143. t['whitesmilingface'] = 0x263A;
  18144. t['whitesquare'] = 0x25A1;
  18145. t['whitestar'] = 0x2606;
  18146. t['whitetelephone'] = 0x260F;
  18147. t['whitetortoiseshellbracketleft'] = 0x3018;
  18148. t['whitetortoiseshellbracketright'] = 0x3019;
  18149. t['whiteuppointingsmalltriangle'] = 0x25B5;
  18150. t['whiteuppointingtriangle'] = 0x25B3;
  18151. t['wihiragana'] = 0x3090;
  18152. t['wikatakana'] = 0x30F0;
  18153. t['wikorean'] = 0x315F;
  18154. t['wmonospace'] = 0xFF57;
  18155. t['wohiragana'] = 0x3092;
  18156. t['wokatakana'] = 0x30F2;
  18157. t['wokatakanahalfwidth'] = 0xFF66;
  18158. t['won'] = 0x20A9;
  18159. t['wonmonospace'] = 0xFFE6;
  18160. t['wowaenthai'] = 0x0E27;
  18161. t['wparen'] = 0x24B2;
  18162. t['wring'] = 0x1E98;
  18163. t['wsuperior'] = 0x02B7;
  18164. t['wturned'] = 0x028D;
  18165. t['wynn'] = 0x01BF;
  18166. t['x'] = 0x0078;
  18167. t['xabovecmb'] = 0x033D;
  18168. t['xbopomofo'] = 0x3112;
  18169. t['xcircle'] = 0x24E7;
  18170. t['xdieresis'] = 0x1E8D;
  18171. t['xdotaccent'] = 0x1E8B;
  18172. t['xeharmenian'] = 0x056D;
  18173. t['xi'] = 0x03BE;
  18174. t['xmonospace'] = 0xFF58;
  18175. t['xparen'] = 0x24B3;
  18176. t['xsuperior'] = 0x02E3;
  18177. t['y'] = 0x0079;
  18178. t['yaadosquare'] = 0x334E;
  18179. t['yabengali'] = 0x09AF;
  18180. t['yacute'] = 0x00FD;
  18181. t['yadeva'] = 0x092F;
  18182. t['yaekorean'] = 0x3152;
  18183. t['yagujarati'] = 0x0AAF;
  18184. t['yagurmukhi'] = 0x0A2F;
  18185. t['yahiragana'] = 0x3084;
  18186. t['yakatakana'] = 0x30E4;
  18187. t['yakatakanahalfwidth'] = 0xFF94;
  18188. t['yakorean'] = 0x3151;
  18189. t['yamakkanthai'] = 0x0E4E;
  18190. t['yasmallhiragana'] = 0x3083;
  18191. t['yasmallkatakana'] = 0x30E3;
  18192. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  18193. t['yatcyrillic'] = 0x0463;
  18194. t['ycircle'] = 0x24E8;
  18195. t['ycircumflex'] = 0x0177;
  18196. t['ydieresis'] = 0x00FF;
  18197. t['ydotaccent'] = 0x1E8F;
  18198. t['ydotbelow'] = 0x1EF5;
  18199. t['yeharabic'] = 0x064A;
  18200. t['yehbarreearabic'] = 0x06D2;
  18201. t['yehbarreefinalarabic'] = 0xFBAF;
  18202. t['yehfinalarabic'] = 0xFEF2;
  18203. t['yehhamzaabovearabic'] = 0x0626;
  18204. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  18205. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  18206. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  18207. t['yehinitialarabic'] = 0xFEF3;
  18208. t['yehmedialarabic'] = 0xFEF4;
  18209. t['yehmeeminitialarabic'] = 0xFCDD;
  18210. t['yehmeemisolatedarabic'] = 0xFC58;
  18211. t['yehnoonfinalarabic'] = 0xFC94;
  18212. t['yehthreedotsbelowarabic'] = 0x06D1;
  18213. t['yekorean'] = 0x3156;
  18214. t['yen'] = 0x00A5;
  18215. t['yenmonospace'] = 0xFFE5;
  18216. t['yeokorean'] = 0x3155;
  18217. t['yeorinhieuhkorean'] = 0x3186;
  18218. t['yerahbenyomohebrew'] = 0x05AA;
  18219. t['yerahbenyomolefthebrew'] = 0x05AA;
  18220. t['yericyrillic'] = 0x044B;
  18221. t['yerudieresiscyrillic'] = 0x04F9;
  18222. t['yesieungkorean'] = 0x3181;
  18223. t['yesieungpansioskorean'] = 0x3183;
  18224. t['yesieungsioskorean'] = 0x3182;
  18225. t['yetivhebrew'] = 0x059A;
  18226. t['ygrave'] = 0x1EF3;
  18227. t['yhook'] = 0x01B4;
  18228. t['yhookabove'] = 0x1EF7;
  18229. t['yiarmenian'] = 0x0575;
  18230. t['yicyrillic'] = 0x0457;
  18231. t['yikorean'] = 0x3162;
  18232. t['yinyang'] = 0x262F;
  18233. t['yiwnarmenian'] = 0x0582;
  18234. t['ymonospace'] = 0xFF59;
  18235. t['yod'] = 0x05D9;
  18236. t['yoddagesh'] = 0xFB39;
  18237. t['yoddageshhebrew'] = 0xFB39;
  18238. t['yodhebrew'] = 0x05D9;
  18239. t['yodyodhebrew'] = 0x05F2;
  18240. t['yodyodpatahhebrew'] = 0xFB1F;
  18241. t['yohiragana'] = 0x3088;
  18242. t['yoikorean'] = 0x3189;
  18243. t['yokatakana'] = 0x30E8;
  18244. t['yokatakanahalfwidth'] = 0xFF96;
  18245. t['yokorean'] = 0x315B;
  18246. t['yosmallhiragana'] = 0x3087;
  18247. t['yosmallkatakana'] = 0x30E7;
  18248. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  18249. t['yotgreek'] = 0x03F3;
  18250. t['yoyaekorean'] = 0x3188;
  18251. t['yoyakorean'] = 0x3187;
  18252. t['yoyakthai'] = 0x0E22;
  18253. t['yoyingthai'] = 0x0E0D;
  18254. t['yparen'] = 0x24B4;
  18255. t['ypogegrammeni'] = 0x037A;
  18256. t['ypogegrammenigreekcmb'] = 0x0345;
  18257. t['yr'] = 0x01A6;
  18258. t['yring'] = 0x1E99;
  18259. t['ysuperior'] = 0x02B8;
  18260. t['ytilde'] = 0x1EF9;
  18261. t['yturned'] = 0x028E;
  18262. t['yuhiragana'] = 0x3086;
  18263. t['yuikorean'] = 0x318C;
  18264. t['yukatakana'] = 0x30E6;
  18265. t['yukatakanahalfwidth'] = 0xFF95;
  18266. t['yukorean'] = 0x3160;
  18267. t['yusbigcyrillic'] = 0x046B;
  18268. t['yusbigiotifiedcyrillic'] = 0x046D;
  18269. t['yuslittlecyrillic'] = 0x0467;
  18270. t['yuslittleiotifiedcyrillic'] = 0x0469;
  18271. t['yusmallhiragana'] = 0x3085;
  18272. t['yusmallkatakana'] = 0x30E5;
  18273. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  18274. t['yuyekorean'] = 0x318B;
  18275. t['yuyeokorean'] = 0x318A;
  18276. t['yyabengali'] = 0x09DF;
  18277. t['yyadeva'] = 0x095F;
  18278. t['z'] = 0x007A;
  18279. t['zaarmenian'] = 0x0566;
  18280. t['zacute'] = 0x017A;
  18281. t['zadeva'] = 0x095B;
  18282. t['zagurmukhi'] = 0x0A5B;
  18283. t['zaharabic'] = 0x0638;
  18284. t['zahfinalarabic'] = 0xFEC6;
  18285. t['zahinitialarabic'] = 0xFEC7;
  18286. t['zahiragana'] = 0x3056;
  18287. t['zahmedialarabic'] = 0xFEC8;
  18288. t['zainarabic'] = 0x0632;
  18289. t['zainfinalarabic'] = 0xFEB0;
  18290. t['zakatakana'] = 0x30B6;
  18291. t['zaqefgadolhebrew'] = 0x0595;
  18292. t['zaqefqatanhebrew'] = 0x0594;
  18293. t['zarqahebrew'] = 0x0598;
  18294. t['zayin'] = 0x05D6;
  18295. t['zayindagesh'] = 0xFB36;
  18296. t['zayindageshhebrew'] = 0xFB36;
  18297. t['zayinhebrew'] = 0x05D6;
  18298. t['zbopomofo'] = 0x3117;
  18299. t['zcaron'] = 0x017E;
  18300. t['zcircle'] = 0x24E9;
  18301. t['zcircumflex'] = 0x1E91;
  18302. t['zcurl'] = 0x0291;
  18303. t['zdot'] = 0x017C;
  18304. t['zdotaccent'] = 0x017C;
  18305. t['zdotbelow'] = 0x1E93;
  18306. t['zecyrillic'] = 0x0437;
  18307. t['zedescendercyrillic'] = 0x0499;
  18308. t['zedieresiscyrillic'] = 0x04DF;
  18309. t['zehiragana'] = 0x305C;
  18310. t['zekatakana'] = 0x30BC;
  18311. t['zero'] = 0x0030;
  18312. t['zeroarabic'] = 0x0660;
  18313. t['zerobengali'] = 0x09E6;
  18314. t['zerodeva'] = 0x0966;
  18315. t['zerogujarati'] = 0x0AE6;
  18316. t['zerogurmukhi'] = 0x0A66;
  18317. t['zerohackarabic'] = 0x0660;
  18318. t['zeroinferior'] = 0x2080;
  18319. t['zeromonospace'] = 0xFF10;
  18320. t['zerooldstyle'] = 0xF730;
  18321. t['zeropersian'] = 0x06F0;
  18322. t['zerosuperior'] = 0x2070;
  18323. t['zerothai'] = 0x0E50;
  18324. t['zerowidthjoiner'] = 0xFEFF;
  18325. t['zerowidthnonjoiner'] = 0x200C;
  18326. t['zerowidthspace'] = 0x200B;
  18327. t['zeta'] = 0x03B6;
  18328. t['zhbopomofo'] = 0x3113;
  18329. t['zhearmenian'] = 0x056A;
  18330. t['zhebrevecyrillic'] = 0x04C2;
  18331. t['zhecyrillic'] = 0x0436;
  18332. t['zhedescendercyrillic'] = 0x0497;
  18333. t['zhedieresiscyrillic'] = 0x04DD;
  18334. t['zihiragana'] = 0x3058;
  18335. t['zikatakana'] = 0x30B8;
  18336. t['zinorhebrew'] = 0x05AE;
  18337. t['zlinebelow'] = 0x1E95;
  18338. t['zmonospace'] = 0xFF5A;
  18339. t['zohiragana'] = 0x305E;
  18340. t['zokatakana'] = 0x30BE;
  18341. t['zparen'] = 0x24B5;
  18342. t['zretroflexhook'] = 0x0290;
  18343. t['zstroke'] = 0x01B6;
  18344. t['zuhiragana'] = 0x305A;
  18345. t['zukatakana'] = 0x30BA;
  18346. t['.notdef'] = 0x0000;
  18347. t['angbracketleftbig'] = 0x2329;
  18348. t['angbracketleftBig'] = 0x2329;
  18349. t['angbracketleftbigg'] = 0x2329;
  18350. t['angbracketleftBigg'] = 0x2329;
  18351. t['angbracketrightBig'] = 0x232A;
  18352. t['angbracketrightbig'] = 0x232A;
  18353. t['angbracketrightBigg'] = 0x232A;
  18354. t['angbracketrightbigg'] = 0x232A;
  18355. t['arrowhookleft'] = 0x21AA;
  18356. t['arrowhookright'] = 0x21A9;
  18357. t['arrowlefttophalf'] = 0x21BC;
  18358. t['arrowleftbothalf'] = 0x21BD;
  18359. t['arrownortheast'] = 0x2197;
  18360. t['arrownorthwest'] = 0x2196;
  18361. t['arrowrighttophalf'] = 0x21C0;
  18362. t['arrowrightbothalf'] = 0x21C1;
  18363. t['arrowsoutheast'] = 0x2198;
  18364. t['arrowsouthwest'] = 0x2199;
  18365. t['backslashbig'] = 0x2216;
  18366. t['backslashBig'] = 0x2216;
  18367. t['backslashBigg'] = 0x2216;
  18368. t['backslashbigg'] = 0x2216;
  18369. t['bardbl'] = 0x2016;
  18370. t['bracehtipdownleft'] = 0xFE37;
  18371. t['bracehtipdownright'] = 0xFE37;
  18372. t['bracehtipupleft'] = 0xFE38;
  18373. t['bracehtipupright'] = 0xFE38;
  18374. t['braceleftBig'] = 0x007B;
  18375. t['braceleftbig'] = 0x007B;
  18376. t['braceleftbigg'] = 0x007B;
  18377. t['braceleftBigg'] = 0x007B;
  18378. t['bracerightBig'] = 0x007D;
  18379. t['bracerightbig'] = 0x007D;
  18380. t['bracerightbigg'] = 0x007D;
  18381. t['bracerightBigg'] = 0x007D;
  18382. t['bracketleftbig'] = 0x005B;
  18383. t['bracketleftBig'] = 0x005B;
  18384. t['bracketleftbigg'] = 0x005B;
  18385. t['bracketleftBigg'] = 0x005B;
  18386. t['bracketrightBig'] = 0x005D;
  18387. t['bracketrightbig'] = 0x005D;
  18388. t['bracketrightbigg'] = 0x005D;
  18389. t['bracketrightBigg'] = 0x005D;
  18390. t['ceilingleftbig'] = 0x2308;
  18391. t['ceilingleftBig'] = 0x2308;
  18392. t['ceilingleftBigg'] = 0x2308;
  18393. t['ceilingleftbigg'] = 0x2308;
  18394. t['ceilingrightbig'] = 0x2309;
  18395. t['ceilingrightBig'] = 0x2309;
  18396. t['ceilingrightbigg'] = 0x2309;
  18397. t['ceilingrightBigg'] = 0x2309;
  18398. t['circledotdisplay'] = 0x2299;
  18399. t['circledottext'] = 0x2299;
  18400. t['circlemultiplydisplay'] = 0x2297;
  18401. t['circlemultiplytext'] = 0x2297;
  18402. t['circleplusdisplay'] = 0x2295;
  18403. t['circleplustext'] = 0x2295;
  18404. t['contintegraldisplay'] = 0x222E;
  18405. t['contintegraltext'] = 0x222E;
  18406. t['coproductdisplay'] = 0x2210;
  18407. t['coproducttext'] = 0x2210;
  18408. t['floorleftBig'] = 0x230A;
  18409. t['floorleftbig'] = 0x230A;
  18410. t['floorleftbigg'] = 0x230A;
  18411. t['floorleftBigg'] = 0x230A;
  18412. t['floorrightbig'] = 0x230B;
  18413. t['floorrightBig'] = 0x230B;
  18414. t['floorrightBigg'] = 0x230B;
  18415. t['floorrightbigg'] = 0x230B;
  18416. t['hatwide'] = 0x0302;
  18417. t['hatwider'] = 0x0302;
  18418. t['hatwidest'] = 0x0302;
  18419. t['intercal'] = 0x1D40;
  18420. t['integraldisplay'] = 0x222B;
  18421. t['integraltext'] = 0x222B;
  18422. t['intersectiondisplay'] = 0x22C2;
  18423. t['intersectiontext'] = 0x22C2;
  18424. t['logicalanddisplay'] = 0x2227;
  18425. t['logicalandtext'] = 0x2227;
  18426. t['logicalordisplay'] = 0x2228;
  18427. t['logicalortext'] = 0x2228;
  18428. t['parenleftBig'] = 0x0028;
  18429. t['parenleftbig'] = 0x0028;
  18430. t['parenleftBigg'] = 0x0028;
  18431. t['parenleftbigg'] = 0x0028;
  18432. t['parenrightBig'] = 0x0029;
  18433. t['parenrightbig'] = 0x0029;
  18434. t['parenrightBigg'] = 0x0029;
  18435. t['parenrightbigg'] = 0x0029;
  18436. t['prime'] = 0x2032;
  18437. t['productdisplay'] = 0x220F;
  18438. t['producttext'] = 0x220F;
  18439. t['radicalbig'] = 0x221A;
  18440. t['radicalBig'] = 0x221A;
  18441. t['radicalBigg'] = 0x221A;
  18442. t['radicalbigg'] = 0x221A;
  18443. t['radicalbt'] = 0x221A;
  18444. t['radicaltp'] = 0x221A;
  18445. t['radicalvertex'] = 0x221A;
  18446. t['slashbig'] = 0x002F;
  18447. t['slashBig'] = 0x002F;
  18448. t['slashBigg'] = 0x002F;
  18449. t['slashbigg'] = 0x002F;
  18450. t['summationdisplay'] = 0x2211;
  18451. t['summationtext'] = 0x2211;
  18452. t['tildewide'] = 0x02DC;
  18453. t['tildewider'] = 0x02DC;
  18454. t['tildewidest'] = 0x02DC;
  18455. t['uniondisplay'] = 0x22C3;
  18456. t['unionmultidisplay'] = 0x228E;
  18457. t['unionmultitext'] = 0x228E;
  18458. t['unionsqdisplay'] = 0x2294;
  18459. t['unionsqtext'] = 0x2294;
  18460. t['uniontext'] = 0x22C3;
  18461. t['vextenddouble'] = 0x2225;
  18462. t['vextendsingle'] = 0x2223;
  18463. });
  18464. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  18465. t['space'] = 0x0020;
  18466. t['a1'] = 0x2701;
  18467. t['a2'] = 0x2702;
  18468. t['a202'] = 0x2703;
  18469. t['a3'] = 0x2704;
  18470. t['a4'] = 0x260E;
  18471. t['a5'] = 0x2706;
  18472. t['a119'] = 0x2707;
  18473. t['a118'] = 0x2708;
  18474. t['a117'] = 0x2709;
  18475. t['a11'] = 0x261B;
  18476. t['a12'] = 0x261E;
  18477. t['a13'] = 0x270C;
  18478. t['a14'] = 0x270D;
  18479. t['a15'] = 0x270E;
  18480. t['a16'] = 0x270F;
  18481. t['a105'] = 0x2710;
  18482. t['a17'] = 0x2711;
  18483. t['a18'] = 0x2712;
  18484. t['a19'] = 0x2713;
  18485. t['a20'] = 0x2714;
  18486. t['a21'] = 0x2715;
  18487. t['a22'] = 0x2716;
  18488. t['a23'] = 0x2717;
  18489. t['a24'] = 0x2718;
  18490. t['a25'] = 0x2719;
  18491. t['a26'] = 0x271A;
  18492. t['a27'] = 0x271B;
  18493. t['a28'] = 0x271C;
  18494. t['a6'] = 0x271D;
  18495. t['a7'] = 0x271E;
  18496. t['a8'] = 0x271F;
  18497. t['a9'] = 0x2720;
  18498. t['a10'] = 0x2721;
  18499. t['a29'] = 0x2722;
  18500. t['a30'] = 0x2723;
  18501. t['a31'] = 0x2724;
  18502. t['a32'] = 0x2725;
  18503. t['a33'] = 0x2726;
  18504. t['a34'] = 0x2727;
  18505. t['a35'] = 0x2605;
  18506. t['a36'] = 0x2729;
  18507. t['a37'] = 0x272A;
  18508. t['a38'] = 0x272B;
  18509. t['a39'] = 0x272C;
  18510. t['a40'] = 0x272D;
  18511. t['a41'] = 0x272E;
  18512. t['a42'] = 0x272F;
  18513. t['a43'] = 0x2730;
  18514. t['a44'] = 0x2731;
  18515. t['a45'] = 0x2732;
  18516. t['a46'] = 0x2733;
  18517. t['a47'] = 0x2734;
  18518. t['a48'] = 0x2735;
  18519. t['a49'] = 0x2736;
  18520. t['a50'] = 0x2737;
  18521. t['a51'] = 0x2738;
  18522. t['a52'] = 0x2739;
  18523. t['a53'] = 0x273A;
  18524. t['a54'] = 0x273B;
  18525. t['a55'] = 0x273C;
  18526. t['a56'] = 0x273D;
  18527. t['a57'] = 0x273E;
  18528. t['a58'] = 0x273F;
  18529. t['a59'] = 0x2740;
  18530. t['a60'] = 0x2741;
  18531. t['a61'] = 0x2742;
  18532. t['a62'] = 0x2743;
  18533. t['a63'] = 0x2744;
  18534. t['a64'] = 0x2745;
  18535. t['a65'] = 0x2746;
  18536. t['a66'] = 0x2747;
  18537. t['a67'] = 0x2748;
  18538. t['a68'] = 0x2749;
  18539. t['a69'] = 0x274A;
  18540. t['a70'] = 0x274B;
  18541. t['a71'] = 0x25CF;
  18542. t['a72'] = 0x274D;
  18543. t['a73'] = 0x25A0;
  18544. t['a74'] = 0x274F;
  18545. t['a203'] = 0x2750;
  18546. t['a75'] = 0x2751;
  18547. t['a204'] = 0x2752;
  18548. t['a76'] = 0x25B2;
  18549. t['a77'] = 0x25BC;
  18550. t['a78'] = 0x25C6;
  18551. t['a79'] = 0x2756;
  18552. t['a81'] = 0x25D7;
  18553. t['a82'] = 0x2758;
  18554. t['a83'] = 0x2759;
  18555. t['a84'] = 0x275A;
  18556. t['a97'] = 0x275B;
  18557. t['a98'] = 0x275C;
  18558. t['a99'] = 0x275D;
  18559. t['a100'] = 0x275E;
  18560. t['a101'] = 0x2761;
  18561. t['a102'] = 0x2762;
  18562. t['a103'] = 0x2763;
  18563. t['a104'] = 0x2764;
  18564. t['a106'] = 0x2765;
  18565. t['a107'] = 0x2766;
  18566. t['a108'] = 0x2767;
  18567. t['a112'] = 0x2663;
  18568. t['a111'] = 0x2666;
  18569. t['a110'] = 0x2665;
  18570. t['a109'] = 0x2660;
  18571. t['a120'] = 0x2460;
  18572. t['a121'] = 0x2461;
  18573. t['a122'] = 0x2462;
  18574. t['a123'] = 0x2463;
  18575. t['a124'] = 0x2464;
  18576. t['a125'] = 0x2465;
  18577. t['a126'] = 0x2466;
  18578. t['a127'] = 0x2467;
  18579. t['a128'] = 0x2468;
  18580. t['a129'] = 0x2469;
  18581. t['a130'] = 0x2776;
  18582. t['a131'] = 0x2777;
  18583. t['a132'] = 0x2778;
  18584. t['a133'] = 0x2779;
  18585. t['a134'] = 0x277A;
  18586. t['a135'] = 0x277B;
  18587. t['a136'] = 0x277C;
  18588. t['a137'] = 0x277D;
  18589. t['a138'] = 0x277E;
  18590. t['a139'] = 0x277F;
  18591. t['a140'] = 0x2780;
  18592. t['a141'] = 0x2781;
  18593. t['a142'] = 0x2782;
  18594. t['a143'] = 0x2783;
  18595. t['a144'] = 0x2784;
  18596. t['a145'] = 0x2785;
  18597. t['a146'] = 0x2786;
  18598. t['a147'] = 0x2787;
  18599. t['a148'] = 0x2788;
  18600. t['a149'] = 0x2789;
  18601. t['a150'] = 0x278A;
  18602. t['a151'] = 0x278B;
  18603. t['a152'] = 0x278C;
  18604. t['a153'] = 0x278D;
  18605. t['a154'] = 0x278E;
  18606. t['a155'] = 0x278F;
  18607. t['a156'] = 0x2790;
  18608. t['a157'] = 0x2791;
  18609. t['a158'] = 0x2792;
  18610. t['a159'] = 0x2793;
  18611. t['a160'] = 0x2794;
  18612. t['a161'] = 0x2192;
  18613. t['a163'] = 0x2194;
  18614. t['a164'] = 0x2195;
  18615. t['a196'] = 0x2798;
  18616. t['a165'] = 0x2799;
  18617. t['a192'] = 0x279A;
  18618. t['a166'] = 0x279B;
  18619. t['a167'] = 0x279C;
  18620. t['a168'] = 0x279D;
  18621. t['a169'] = 0x279E;
  18622. t['a170'] = 0x279F;
  18623. t['a171'] = 0x27A0;
  18624. t['a172'] = 0x27A1;
  18625. t['a173'] = 0x27A2;
  18626. t['a162'] = 0x27A3;
  18627. t['a174'] = 0x27A4;
  18628. t['a175'] = 0x27A5;
  18629. t['a176'] = 0x27A6;
  18630. t['a177'] = 0x27A7;
  18631. t['a178'] = 0x27A8;
  18632. t['a179'] = 0x27A9;
  18633. t['a193'] = 0x27AA;
  18634. t['a180'] = 0x27AB;
  18635. t['a199'] = 0x27AC;
  18636. t['a181'] = 0x27AD;
  18637. t['a200'] = 0x27AE;
  18638. t['a182'] = 0x27AF;
  18639. t['a201'] = 0x27B1;
  18640. t['a183'] = 0x27B2;
  18641. t['a184'] = 0x27B3;
  18642. t['a197'] = 0x27B4;
  18643. t['a185'] = 0x27B5;
  18644. t['a194'] = 0x27B6;
  18645. t['a198'] = 0x27B7;
  18646. t['a186'] = 0x27B8;
  18647. t['a195'] = 0x27B9;
  18648. t['a187'] = 0x27BA;
  18649. t['a188'] = 0x27BB;
  18650. t['a189'] = 0x27BC;
  18651. t['a190'] = 0x27BD;
  18652. t['a191'] = 0x27BE;
  18653. t['a89'] = 0x2768;
  18654. t['a90'] = 0x2769;
  18655. t['a93'] = 0x276A;
  18656. t['a94'] = 0x276B;
  18657. t['a91'] = 0x276C;
  18658. t['a92'] = 0x276D;
  18659. t['a205'] = 0x276E;
  18660. t['a85'] = 0x276F;
  18661. t['a206'] = 0x2770;
  18662. t['a86'] = 0x2771;
  18663. t['a87'] = 0x2772;
  18664. t['a88'] = 0x2773;
  18665. t['a95'] = 0x2774;
  18666. t['a96'] = 0x2775;
  18667. t['.notdef'] = 0x0000;
  18668. });
  18669. exports.getGlyphsUnicode = getGlyphsUnicode;
  18670. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  18671. /***/ }),
  18672. /* 8 */
  18673. /***/ (function(module, exports, __w_pdfjs_require__) {
  18674. "use strict";
  18675. /* WEBPACK VAR INJECTION */(function(module) {
  18676. var sharedUtil = __w_pdfjs_require__(0);
  18677. var corePrimitives = __w_pdfjs_require__(1);
  18678. var corePdfManager = __w_pdfjs_require__(34);
  18679. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  18680. var InvalidPDFException = sharedUtil.InvalidPDFException;
  18681. var MessageHandler = sharedUtil.MessageHandler;
  18682. var MissingPDFException = sharedUtil.MissingPDFException;
  18683. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  18684. var PasswordException = sharedUtil.PasswordException;
  18685. var UnknownErrorException = sharedUtil.UnknownErrorException;
  18686. var XRefParseException = sharedUtil.XRefParseException;
  18687. var arrayByteLength = sharedUtil.arrayByteLength;
  18688. var arraysToBytes = sharedUtil.arraysToBytes;
  18689. var assert = sharedUtil.assert;
  18690. var createPromiseCapability = sharedUtil.createPromiseCapability;
  18691. var error = sharedUtil.error;
  18692. var info = sharedUtil.info;
  18693. var warn = sharedUtil.warn;
  18694. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  18695. var Ref = corePrimitives.Ref;
  18696. var LocalPdfManager = corePdfManager.LocalPdfManager;
  18697. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  18698. var globalScope = sharedUtil.globalScope;
  18699. var WorkerTask = function WorkerTaskClosure() {
  18700. function WorkerTask(name) {
  18701. this.name = name;
  18702. this.terminated = false;
  18703. this._capability = createPromiseCapability();
  18704. }
  18705. WorkerTask.prototype = {
  18706. get finished() {
  18707. return this._capability.promise;
  18708. },
  18709. finish: function () {
  18710. this._capability.resolve();
  18711. },
  18712. terminate: function () {
  18713. this.terminated = true;
  18714. },
  18715. ensureNotTerminated: function () {
  18716. if (this.terminated) {
  18717. throw new Error('Worker task was terminated');
  18718. }
  18719. }
  18720. };
  18721. return WorkerTask;
  18722. }();
  18723. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  18724. function PDFWorkerStream(params, msgHandler) {
  18725. this._queuedChunks = [];
  18726. var initialData = params.initialData;
  18727. if (initialData && initialData.length > 0) {
  18728. this._queuedChunks.push(initialData);
  18729. }
  18730. this._msgHandler = msgHandler;
  18731. this._isRangeSupported = !params.disableRange;
  18732. this._isStreamingSupported = !params.disableStream;
  18733. this._contentLength = params.length;
  18734. this._fullRequestReader = null;
  18735. this._rangeReaders = [];
  18736. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  18737. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  18738. }
  18739. PDFWorkerStream.prototype = {
  18740. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  18741. if (args.begin === undefined) {
  18742. if (this._fullRequestReader) {
  18743. this._fullRequestReader._enqueue(args.chunk);
  18744. } else {
  18745. this._queuedChunks.push(args.chunk);
  18746. }
  18747. } else {
  18748. var found = this._rangeReaders.some(function (rangeReader) {
  18749. if (rangeReader._begin !== args.begin) {
  18750. return false;
  18751. }
  18752. rangeReader._enqueue(args.chunk);
  18753. return true;
  18754. });
  18755. assert(found);
  18756. }
  18757. },
  18758. _onProgress: function PDFWorkerStream_onProgress(evt) {
  18759. if (this._rangeReaders.length > 0) {
  18760. var firstReader = this._rangeReaders[0];
  18761. if (firstReader.onProgress) {
  18762. firstReader.onProgress({ loaded: evt.loaded });
  18763. }
  18764. }
  18765. },
  18766. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  18767. var i = this._rangeReaders.indexOf(reader);
  18768. if (i >= 0) {
  18769. this._rangeReaders.splice(i, 1);
  18770. }
  18771. },
  18772. getFullReader: function PDFWorkerStream_getFullReader() {
  18773. assert(!this._fullRequestReader);
  18774. var queuedChunks = this._queuedChunks;
  18775. this._queuedChunks = null;
  18776. return new PDFWorkerStreamReader(this, queuedChunks);
  18777. },
  18778. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  18779. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  18780. this._msgHandler.send('RequestDataRange', {
  18781. begin: begin,
  18782. end: end
  18783. });
  18784. this._rangeReaders.push(reader);
  18785. return reader;
  18786. },
  18787. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  18788. if (this._fullRequestReader) {
  18789. this._fullRequestReader.cancel(reason);
  18790. }
  18791. var readers = this._rangeReaders.slice(0);
  18792. readers.forEach(function (rangeReader) {
  18793. rangeReader.cancel(reason);
  18794. });
  18795. }
  18796. };
  18797. function PDFWorkerStreamReader(stream, queuedChunks) {
  18798. this._stream = stream;
  18799. this._done = false;
  18800. this._queuedChunks = queuedChunks || [];
  18801. this._requests = [];
  18802. this._headersReady = Promise.resolve();
  18803. stream._fullRequestReader = this;
  18804. this.onProgress = null;
  18805. }
  18806. PDFWorkerStreamReader.prototype = {
  18807. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  18808. if (this._done) {
  18809. return;
  18810. }
  18811. if (this._requests.length > 0) {
  18812. var requestCapability = this._requests.shift();
  18813. requestCapability.resolve({
  18814. value: chunk,
  18815. done: false
  18816. });
  18817. return;
  18818. }
  18819. this._queuedChunks.push(chunk);
  18820. },
  18821. get headersReady() {
  18822. return this._headersReady;
  18823. },
  18824. get isRangeSupported() {
  18825. return this._stream._isRangeSupported;
  18826. },
  18827. get isStreamingSupported() {
  18828. return this._stream._isStreamingSupported;
  18829. },
  18830. get contentLength() {
  18831. return this._stream._contentLength;
  18832. },
  18833. read: function PDFWorkerStreamReader_read() {
  18834. if (this._queuedChunks.length > 0) {
  18835. var chunk = this._queuedChunks.shift();
  18836. return Promise.resolve({
  18837. value: chunk,
  18838. done: false
  18839. });
  18840. }
  18841. if (this._done) {
  18842. return Promise.resolve({
  18843. value: undefined,
  18844. done: true
  18845. });
  18846. }
  18847. var requestCapability = createPromiseCapability();
  18848. this._requests.push(requestCapability);
  18849. return requestCapability.promise;
  18850. },
  18851. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18852. this._done = true;
  18853. this._requests.forEach(function (requestCapability) {
  18854. requestCapability.resolve({
  18855. value: undefined,
  18856. done: true
  18857. });
  18858. });
  18859. this._requests = [];
  18860. }
  18861. };
  18862. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18863. this._stream = stream;
  18864. this._begin = begin;
  18865. this._end = end;
  18866. this._queuedChunk = null;
  18867. this._requests = [];
  18868. this._done = false;
  18869. this.onProgress = null;
  18870. }
  18871. PDFWorkerStreamRangeReader.prototype = {
  18872. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18873. if (this._done) {
  18874. return;
  18875. }
  18876. if (this._requests.length === 0) {
  18877. this._queuedChunk = chunk;
  18878. } else {
  18879. var requestsCapability = this._requests.shift();
  18880. requestsCapability.resolve({
  18881. value: chunk,
  18882. done: false
  18883. });
  18884. this._requests.forEach(function (requestCapability) {
  18885. requestCapability.resolve({
  18886. value: undefined,
  18887. done: true
  18888. });
  18889. });
  18890. this._requests = [];
  18891. }
  18892. this._done = true;
  18893. this._stream._removeRangeReader(this);
  18894. },
  18895. get isStreamingSupported() {
  18896. return false;
  18897. },
  18898. read: function PDFWorkerStreamRangeReader_read() {
  18899. if (this._queuedChunk) {
  18900. return Promise.resolve({
  18901. value: this._queuedChunk,
  18902. done: false
  18903. });
  18904. }
  18905. if (this._done) {
  18906. return Promise.resolve({
  18907. value: undefined,
  18908. done: true
  18909. });
  18910. }
  18911. var requestCapability = createPromiseCapability();
  18912. this._requests.push(requestCapability);
  18913. return requestCapability.promise;
  18914. },
  18915. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18916. this._done = true;
  18917. this._requests.forEach(function (requestCapability) {
  18918. requestCapability.resolve({
  18919. value: undefined,
  18920. done: true
  18921. });
  18922. });
  18923. this._requests = [];
  18924. this._stream._removeRangeReader(this);
  18925. }
  18926. };
  18927. return PDFWorkerStream;
  18928. }();
  18929. var PDFNetworkStream;
  18930. function setPDFNetworkStreamClass(cls) {
  18931. PDFNetworkStream = cls;
  18932. }
  18933. var WorkerMessageHandler = {
  18934. setup: function wphSetup(handler, port) {
  18935. var testMessageProcessed = false;
  18936. handler.on('test', function wphSetupTest(data) {
  18937. if (testMessageProcessed) {
  18938. return;
  18939. }
  18940. testMessageProcessed = true;
  18941. if (!(data instanceof Uint8Array)) {
  18942. handler.send('test', 'main', false);
  18943. return;
  18944. }
  18945. var supportTransfers = data[0] === 255;
  18946. handler.postMessageTransfers = supportTransfers;
  18947. var xhr = new XMLHttpRequest();
  18948. var responseExists = 'response' in xhr;
  18949. try {
  18950. xhr.responseType;
  18951. } catch (e) {
  18952. responseExists = false;
  18953. }
  18954. if (!responseExists) {
  18955. handler.send('test', false);
  18956. return;
  18957. }
  18958. handler.send('test', {
  18959. supportTypedArray: true,
  18960. supportTransfers: supportTransfers
  18961. });
  18962. });
  18963. handler.on('configure', function wphConfigure(data) {
  18964. setVerbosityLevel(data.verbosity);
  18965. });
  18966. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18967. return WorkerMessageHandler.createDocumentHandler(data, port);
  18968. });
  18969. },
  18970. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18971. var pdfManager;
  18972. var terminated = false;
  18973. var cancelXHRs = null;
  18974. var WorkerTasks = [];
  18975. var docId = docParams.docId;
  18976. var docBaseUrl = docParams.docBaseUrl;
  18977. var workerHandlerName = docParams.docId + '_worker';
  18978. var handler = new MessageHandler(workerHandlerName, docId, port);
  18979. handler.postMessageTransfers = docParams.postMessageTransfers;
  18980. function ensureNotTerminated() {
  18981. if (terminated) {
  18982. throw new Error('Worker was terminated');
  18983. }
  18984. }
  18985. function startWorkerTask(task) {
  18986. WorkerTasks.push(task);
  18987. }
  18988. function finishWorkerTask(task) {
  18989. task.finish();
  18990. var i = WorkerTasks.indexOf(task);
  18991. WorkerTasks.splice(i, 1);
  18992. }
  18993. function loadDocument(recoveryMode) {
  18994. var loadDocumentCapability = createPromiseCapability();
  18995. var parseSuccess = function parseSuccess() {
  18996. var numPagesPromise = pdfManager.ensureDoc('numPages');
  18997. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  18998. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  18999. Promise.all([
  19000. numPagesPromise,
  19001. fingerprintPromise,
  19002. encryptedPromise
  19003. ]).then(function onDocReady(results) {
  19004. var doc = {
  19005. numPages: results[0],
  19006. fingerprint: results[1],
  19007. encrypted: !!results[2]
  19008. };
  19009. loadDocumentCapability.resolve(doc);
  19010. }, parseFailure);
  19011. };
  19012. var parseFailure = function parseFailure(e) {
  19013. loadDocumentCapability.reject(e);
  19014. };
  19015. pdfManager.ensureDoc('checkHeader', []).then(function () {
  19016. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  19017. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  19018. }, parseFailure);
  19019. }, parseFailure);
  19020. return loadDocumentCapability.promise;
  19021. }
  19022. function getPdfManager(data, evaluatorOptions) {
  19023. var pdfManagerCapability = createPromiseCapability();
  19024. var pdfManager;
  19025. var source = data.source;
  19026. if (source.data) {
  19027. try {
  19028. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  19029. pdfManagerCapability.resolve(pdfManager);
  19030. } catch (ex) {
  19031. pdfManagerCapability.reject(ex);
  19032. }
  19033. return pdfManagerCapability.promise;
  19034. }
  19035. var pdfStream;
  19036. try {
  19037. if (source.chunkedViewerLoading) {
  19038. pdfStream = new PDFWorkerStream(source, handler);
  19039. } else {
  19040. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  19041. pdfStream = new PDFNetworkStream(data);
  19042. }
  19043. } catch (ex) {
  19044. pdfManagerCapability.reject(ex);
  19045. return pdfManagerCapability.promise;
  19046. }
  19047. var fullRequest = pdfStream.getFullReader();
  19048. fullRequest.headersReady.then(function () {
  19049. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  19050. fullRequest.onProgress = function (evt) {
  19051. handler.send('DocProgress', {
  19052. loaded: evt.loaded,
  19053. total: evt.total
  19054. });
  19055. };
  19056. }
  19057. if (!fullRequest.isRangeSupported) {
  19058. return;
  19059. }
  19060. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  19061. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  19062. msgHandler: handler,
  19063. url: source.url,
  19064. password: source.password,
  19065. length: fullRequest.contentLength,
  19066. disableAutoFetch: disableAutoFetch,
  19067. rangeChunkSize: source.rangeChunkSize
  19068. }, evaluatorOptions, docBaseUrl);
  19069. pdfManagerCapability.resolve(pdfManager);
  19070. cancelXHRs = null;
  19071. }).catch(function (reason) {
  19072. pdfManagerCapability.reject(reason);
  19073. cancelXHRs = null;
  19074. });
  19075. var cachedChunks = [], loaded = 0;
  19076. var flushChunks = function () {
  19077. var pdfFile = arraysToBytes(cachedChunks);
  19078. if (source.length && pdfFile.length !== source.length) {
  19079. warn('reported HTTP length is different from actual');
  19080. }
  19081. try {
  19082. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  19083. pdfManagerCapability.resolve(pdfManager);
  19084. } catch (ex) {
  19085. pdfManagerCapability.reject(ex);
  19086. }
  19087. cachedChunks = [];
  19088. };
  19089. var readPromise = new Promise(function (resolve, reject) {
  19090. var readChunk = function (chunk) {
  19091. try {
  19092. ensureNotTerminated();
  19093. if (chunk.done) {
  19094. if (!pdfManager) {
  19095. flushChunks();
  19096. }
  19097. cancelXHRs = null;
  19098. return;
  19099. }
  19100. var data = chunk.value;
  19101. loaded += arrayByteLength(data);
  19102. if (!fullRequest.isStreamingSupported) {
  19103. handler.send('DocProgress', {
  19104. loaded: loaded,
  19105. total: Math.max(loaded, fullRequest.contentLength || 0)
  19106. });
  19107. }
  19108. if (pdfManager) {
  19109. pdfManager.sendProgressiveData(data);
  19110. } else {
  19111. cachedChunks.push(data);
  19112. }
  19113. fullRequest.read().then(readChunk, reject);
  19114. } catch (e) {
  19115. reject(e);
  19116. }
  19117. };
  19118. fullRequest.read().then(readChunk, reject);
  19119. });
  19120. readPromise.catch(function (e) {
  19121. pdfManagerCapability.reject(e);
  19122. cancelXHRs = null;
  19123. });
  19124. cancelXHRs = function () {
  19125. pdfStream.cancelAllRequests('abort');
  19126. };
  19127. return pdfManagerCapability.promise;
  19128. }
  19129. function setupDoc(data) {
  19130. function onSuccess(doc) {
  19131. ensureNotTerminated();
  19132. handler.send('GetDoc', { pdfInfo: doc });
  19133. }
  19134. function onFailure(e) {
  19135. if (e instanceof PasswordException) {
  19136. var task = new WorkerTask('PasswordException: response ' + e.code);
  19137. startWorkerTask(task);
  19138. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  19139. finishWorkerTask(task);
  19140. pdfManager.updatePassword(data.password);
  19141. pdfManagerReady();
  19142. }).catch(function (ex) {
  19143. finishWorkerTask(task);
  19144. handler.send('PasswordException', ex);
  19145. }.bind(null, e));
  19146. } else if (e instanceof InvalidPDFException) {
  19147. handler.send('InvalidPDF', e);
  19148. } else if (e instanceof MissingPDFException) {
  19149. handler.send('MissingPDF', e);
  19150. } else if (e instanceof UnexpectedResponseException) {
  19151. handler.send('UnexpectedResponse', e);
  19152. } else {
  19153. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  19154. }
  19155. }
  19156. function pdfManagerReady() {
  19157. ensureNotTerminated();
  19158. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  19159. ensureNotTerminated();
  19160. if (!(ex instanceof XRefParseException)) {
  19161. onFailure(ex);
  19162. return;
  19163. }
  19164. pdfManager.requestLoadedStream();
  19165. pdfManager.onLoadedStream().then(function () {
  19166. ensureNotTerminated();
  19167. loadDocument(true).then(onSuccess, onFailure);
  19168. });
  19169. }, onFailure);
  19170. }
  19171. ensureNotTerminated();
  19172. var cMapOptions = {
  19173. url: data.cMapUrl === undefined ? null : data.cMapUrl,
  19174. packed: data.cMapPacked === true
  19175. };
  19176. var evaluatorOptions = {
  19177. forceDataSchema: data.disableCreateObjectURL,
  19178. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  19179. disableFontFace: data.disableFontFace,
  19180. cMapOptions: cMapOptions,
  19181. disableNativeImageDecoder: data.disableNativeImageDecoder
  19182. };
  19183. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  19184. if (terminated) {
  19185. newPdfManager.terminate();
  19186. throw new Error('Worker was terminated');
  19187. }
  19188. pdfManager = newPdfManager;
  19189. handler.send('PDFManagerReady', null);
  19190. pdfManager.onLoadedStream().then(function (stream) {
  19191. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  19192. });
  19193. }).then(pdfManagerReady, onFailure);
  19194. }
  19195. handler.on('GetPage', function wphSetupGetPage(data) {
  19196. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19197. var rotatePromise = pdfManager.ensure(page, 'rotate');
  19198. var refPromise = pdfManager.ensure(page, 'ref');
  19199. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  19200. var viewPromise = pdfManager.ensure(page, 'view');
  19201. return Promise.all([
  19202. rotatePromise,
  19203. refPromise,
  19204. userUnitPromise,
  19205. viewPromise
  19206. ]).then(function (results) {
  19207. return {
  19208. rotate: results[0],
  19209. ref: results[1],
  19210. userUnit: results[2],
  19211. view: results[3]
  19212. };
  19213. });
  19214. });
  19215. });
  19216. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  19217. var ref = new Ref(data.ref.num, data.ref.gen);
  19218. var catalog = pdfManager.pdfDocument.catalog;
  19219. return catalog.getPageIndex(ref);
  19220. });
  19221. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  19222. return pdfManager.ensureCatalog('destinations');
  19223. });
  19224. handler.on('GetDestination', function wphSetupGetDestination(data) {
  19225. return pdfManager.ensureCatalog('getDestination', [data.id]);
  19226. });
  19227. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  19228. return pdfManager.ensureCatalog('pageLabels');
  19229. });
  19230. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  19231. return pdfManager.ensureCatalog('attachments');
  19232. });
  19233. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  19234. return pdfManager.ensureCatalog('javaScript');
  19235. });
  19236. handler.on('GetOutline', function wphSetupGetOutline(data) {
  19237. return pdfManager.ensureCatalog('documentOutline');
  19238. });
  19239. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  19240. return Promise.all([
  19241. pdfManager.ensureDoc('documentInfo'),
  19242. pdfManager.ensureCatalog('metadata')
  19243. ]);
  19244. });
  19245. handler.on('GetData', function wphSetupGetData(data) {
  19246. pdfManager.requestLoadedStream();
  19247. return pdfManager.onLoadedStream().then(function (stream) {
  19248. return stream.bytes;
  19249. });
  19250. });
  19251. handler.on('GetStats', function wphSetupGetStats(data) {
  19252. return pdfManager.pdfDocument.xref.stats;
  19253. });
  19254. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  19255. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19256. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  19257. });
  19258. });
  19259. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  19260. var pageIndex = data.pageIndex;
  19261. pdfManager.getPage(pageIndex).then(function (page) {
  19262. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  19263. startWorkerTask(task);
  19264. var pageNum = pageIndex + 1;
  19265. var start = Date.now();
  19266. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  19267. finishWorkerTask(task);
  19268. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  19269. }, function (e) {
  19270. finishWorkerTask(task);
  19271. if (task.terminated) {
  19272. return;
  19273. }
  19274. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  19275. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  19276. var wrappedException;
  19277. if (typeof e === 'string') {
  19278. wrappedException = {
  19279. message: e,
  19280. stack: minimumStackMessage
  19281. };
  19282. } else if (typeof e === 'object') {
  19283. wrappedException = {
  19284. message: e.message || e.toString(),
  19285. stack: e.stack || minimumStackMessage
  19286. };
  19287. } else {
  19288. wrappedException = {
  19289. message: 'Unknown exception type: ' + typeof e,
  19290. stack: minimumStackMessage
  19291. };
  19292. }
  19293. handler.send('PageError', {
  19294. pageNum: pageNum,
  19295. error: wrappedException,
  19296. intent: data.intent
  19297. });
  19298. });
  19299. });
  19300. }, this);
  19301. handler.on('GetTextContent', function wphExtractText(data) {
  19302. var pageIndex = data.pageIndex;
  19303. var normalizeWhitespace = data.normalizeWhitespace;
  19304. var combineTextItems = data.combineTextItems;
  19305. return pdfManager.getPage(pageIndex).then(function (page) {
  19306. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  19307. startWorkerTask(task);
  19308. var pageNum = pageIndex + 1;
  19309. var start = Date.now();
  19310. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  19311. finishWorkerTask(task);
  19312. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  19313. return textContent;
  19314. }, function (reason) {
  19315. finishWorkerTask(task);
  19316. if (task.terminated) {
  19317. return;
  19318. }
  19319. throw reason;
  19320. });
  19321. });
  19322. });
  19323. handler.on('Cleanup', function wphCleanup(data) {
  19324. return pdfManager.cleanup();
  19325. });
  19326. handler.on('Terminate', function wphTerminate(data) {
  19327. terminated = true;
  19328. if (pdfManager) {
  19329. pdfManager.terminate();
  19330. pdfManager = null;
  19331. }
  19332. if (cancelXHRs) {
  19333. cancelXHRs();
  19334. }
  19335. var waitOn = [];
  19336. WorkerTasks.forEach(function (task) {
  19337. waitOn.push(task.finished);
  19338. task.terminate();
  19339. });
  19340. return Promise.all(waitOn).then(function () {
  19341. handler.destroy();
  19342. handler = null;
  19343. });
  19344. });
  19345. handler.on('Ready', function wphReady(data) {
  19346. setupDoc(docParams);
  19347. docParams = null;
  19348. });
  19349. return workerHandlerName;
  19350. }
  19351. };
  19352. function initializeWorker() {
  19353. if (!('console' in globalScope)) {
  19354. var consoleTimer = {};
  19355. var workerConsole = {
  19356. log: function log() {
  19357. var args = Array.prototype.slice.call(arguments);
  19358. globalScope.postMessage({
  19359. targetName: 'main',
  19360. action: 'console_log',
  19361. data: args
  19362. });
  19363. },
  19364. error: function error() {
  19365. var args = Array.prototype.slice.call(arguments);
  19366. globalScope.postMessage({
  19367. targetName: 'main',
  19368. action: 'console_error',
  19369. data: args
  19370. });
  19371. throw 'pdf.js execution error';
  19372. },
  19373. time: function time(name) {
  19374. consoleTimer[name] = Date.now();
  19375. },
  19376. timeEnd: function timeEnd(name) {
  19377. var time = consoleTimer[name];
  19378. if (!time) {
  19379. error('Unknown timer name ' + name);
  19380. }
  19381. this.log('Timer:', name, Date.now() - time);
  19382. }
  19383. };
  19384. globalScope.console = workerConsole;
  19385. }
  19386. var handler = new MessageHandler('worker', 'main', self);
  19387. WorkerMessageHandler.setup(handler, self);
  19388. handler.send('ready', null);
  19389. }
  19390. if (typeof window === 'undefined' && !(typeof module !== 'undefined' && module.require)) {
  19391. initializeWorker();
  19392. }
  19393. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  19394. exports.WorkerTask = WorkerTask;
  19395. exports.WorkerMessageHandler = WorkerMessageHandler;
  19396. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(20)(module)))
  19397. /***/ }),
  19398. /* 9 */
  19399. /***/ (function(module, exports, __w_pdfjs_require__) {
  19400. "use strict";
  19401. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  19402. var QeTable = [
  19403. {
  19404. qe: 0x5601,
  19405. nmps: 1,
  19406. nlps: 1,
  19407. switchFlag: 1
  19408. },
  19409. {
  19410. qe: 0x3401,
  19411. nmps: 2,
  19412. nlps: 6,
  19413. switchFlag: 0
  19414. },
  19415. {
  19416. qe: 0x1801,
  19417. nmps: 3,
  19418. nlps: 9,
  19419. switchFlag: 0
  19420. },
  19421. {
  19422. qe: 0x0AC1,
  19423. nmps: 4,
  19424. nlps: 12,
  19425. switchFlag: 0
  19426. },
  19427. {
  19428. qe: 0x0521,
  19429. nmps: 5,
  19430. nlps: 29,
  19431. switchFlag: 0
  19432. },
  19433. {
  19434. qe: 0x0221,
  19435. nmps: 38,
  19436. nlps: 33,
  19437. switchFlag: 0
  19438. },
  19439. {
  19440. qe: 0x5601,
  19441. nmps: 7,
  19442. nlps: 6,
  19443. switchFlag: 1
  19444. },
  19445. {
  19446. qe: 0x5401,
  19447. nmps: 8,
  19448. nlps: 14,
  19449. switchFlag: 0
  19450. },
  19451. {
  19452. qe: 0x4801,
  19453. nmps: 9,
  19454. nlps: 14,
  19455. switchFlag: 0
  19456. },
  19457. {
  19458. qe: 0x3801,
  19459. nmps: 10,
  19460. nlps: 14,
  19461. switchFlag: 0
  19462. },
  19463. {
  19464. qe: 0x3001,
  19465. nmps: 11,
  19466. nlps: 17,
  19467. switchFlag: 0
  19468. },
  19469. {
  19470. qe: 0x2401,
  19471. nmps: 12,
  19472. nlps: 18,
  19473. switchFlag: 0
  19474. },
  19475. {
  19476. qe: 0x1C01,
  19477. nmps: 13,
  19478. nlps: 20,
  19479. switchFlag: 0
  19480. },
  19481. {
  19482. qe: 0x1601,
  19483. nmps: 29,
  19484. nlps: 21,
  19485. switchFlag: 0
  19486. },
  19487. {
  19488. qe: 0x5601,
  19489. nmps: 15,
  19490. nlps: 14,
  19491. switchFlag: 1
  19492. },
  19493. {
  19494. qe: 0x5401,
  19495. nmps: 16,
  19496. nlps: 14,
  19497. switchFlag: 0
  19498. },
  19499. {
  19500. qe: 0x5101,
  19501. nmps: 17,
  19502. nlps: 15,
  19503. switchFlag: 0
  19504. },
  19505. {
  19506. qe: 0x4801,
  19507. nmps: 18,
  19508. nlps: 16,
  19509. switchFlag: 0
  19510. },
  19511. {
  19512. qe: 0x3801,
  19513. nmps: 19,
  19514. nlps: 17,
  19515. switchFlag: 0
  19516. },
  19517. {
  19518. qe: 0x3401,
  19519. nmps: 20,
  19520. nlps: 18,
  19521. switchFlag: 0
  19522. },
  19523. {
  19524. qe: 0x3001,
  19525. nmps: 21,
  19526. nlps: 19,
  19527. switchFlag: 0
  19528. },
  19529. {
  19530. qe: 0x2801,
  19531. nmps: 22,
  19532. nlps: 19,
  19533. switchFlag: 0
  19534. },
  19535. {
  19536. qe: 0x2401,
  19537. nmps: 23,
  19538. nlps: 20,
  19539. switchFlag: 0
  19540. },
  19541. {
  19542. qe: 0x2201,
  19543. nmps: 24,
  19544. nlps: 21,
  19545. switchFlag: 0
  19546. },
  19547. {
  19548. qe: 0x1C01,
  19549. nmps: 25,
  19550. nlps: 22,
  19551. switchFlag: 0
  19552. },
  19553. {
  19554. qe: 0x1801,
  19555. nmps: 26,
  19556. nlps: 23,
  19557. switchFlag: 0
  19558. },
  19559. {
  19560. qe: 0x1601,
  19561. nmps: 27,
  19562. nlps: 24,
  19563. switchFlag: 0
  19564. },
  19565. {
  19566. qe: 0x1401,
  19567. nmps: 28,
  19568. nlps: 25,
  19569. switchFlag: 0
  19570. },
  19571. {
  19572. qe: 0x1201,
  19573. nmps: 29,
  19574. nlps: 26,
  19575. switchFlag: 0
  19576. },
  19577. {
  19578. qe: 0x1101,
  19579. nmps: 30,
  19580. nlps: 27,
  19581. switchFlag: 0
  19582. },
  19583. {
  19584. qe: 0x0AC1,
  19585. nmps: 31,
  19586. nlps: 28,
  19587. switchFlag: 0
  19588. },
  19589. {
  19590. qe: 0x09C1,
  19591. nmps: 32,
  19592. nlps: 29,
  19593. switchFlag: 0
  19594. },
  19595. {
  19596. qe: 0x08A1,
  19597. nmps: 33,
  19598. nlps: 30,
  19599. switchFlag: 0
  19600. },
  19601. {
  19602. qe: 0x0521,
  19603. nmps: 34,
  19604. nlps: 31,
  19605. switchFlag: 0
  19606. },
  19607. {
  19608. qe: 0x0441,
  19609. nmps: 35,
  19610. nlps: 32,
  19611. switchFlag: 0
  19612. },
  19613. {
  19614. qe: 0x02A1,
  19615. nmps: 36,
  19616. nlps: 33,
  19617. switchFlag: 0
  19618. },
  19619. {
  19620. qe: 0x0221,
  19621. nmps: 37,
  19622. nlps: 34,
  19623. switchFlag: 0
  19624. },
  19625. {
  19626. qe: 0x0141,
  19627. nmps: 38,
  19628. nlps: 35,
  19629. switchFlag: 0
  19630. },
  19631. {
  19632. qe: 0x0111,
  19633. nmps: 39,
  19634. nlps: 36,
  19635. switchFlag: 0
  19636. },
  19637. {
  19638. qe: 0x0085,
  19639. nmps: 40,
  19640. nlps: 37,
  19641. switchFlag: 0
  19642. },
  19643. {
  19644. qe: 0x0049,
  19645. nmps: 41,
  19646. nlps: 38,
  19647. switchFlag: 0
  19648. },
  19649. {
  19650. qe: 0x0025,
  19651. nmps: 42,
  19652. nlps: 39,
  19653. switchFlag: 0
  19654. },
  19655. {
  19656. qe: 0x0015,
  19657. nmps: 43,
  19658. nlps: 40,
  19659. switchFlag: 0
  19660. },
  19661. {
  19662. qe: 0x0009,
  19663. nmps: 44,
  19664. nlps: 41,
  19665. switchFlag: 0
  19666. },
  19667. {
  19668. qe: 0x0005,
  19669. nmps: 45,
  19670. nlps: 42,
  19671. switchFlag: 0
  19672. },
  19673. {
  19674. qe: 0x0001,
  19675. nmps: 45,
  19676. nlps: 43,
  19677. switchFlag: 0
  19678. },
  19679. {
  19680. qe: 0x5601,
  19681. nmps: 46,
  19682. nlps: 46,
  19683. switchFlag: 0
  19684. }
  19685. ];
  19686. function ArithmeticDecoder(data, start, end) {
  19687. this.data = data;
  19688. this.bp = start;
  19689. this.dataEnd = end;
  19690. this.chigh = data[start];
  19691. this.clow = 0;
  19692. this.byteIn();
  19693. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  19694. this.clow = this.clow << 7 & 0xFFFF;
  19695. this.ct -= 7;
  19696. this.a = 0x8000;
  19697. }
  19698. ArithmeticDecoder.prototype = {
  19699. byteIn: function ArithmeticDecoder_byteIn() {
  19700. var data = this.data;
  19701. var bp = this.bp;
  19702. if (data[bp] === 0xFF) {
  19703. var b1 = data[bp + 1];
  19704. if (b1 > 0x8F) {
  19705. this.clow += 0xFF00;
  19706. this.ct = 8;
  19707. } else {
  19708. bp++;
  19709. this.clow += data[bp] << 9;
  19710. this.ct = 7;
  19711. this.bp = bp;
  19712. }
  19713. } else {
  19714. bp++;
  19715. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  19716. this.ct = 8;
  19717. this.bp = bp;
  19718. }
  19719. if (this.clow > 0xFFFF) {
  19720. this.chigh += this.clow >> 16;
  19721. this.clow &= 0xFFFF;
  19722. }
  19723. },
  19724. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  19725. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  19726. var qeTableIcx = QeTable[cx_index];
  19727. var qeIcx = qeTableIcx.qe;
  19728. var d;
  19729. var a = this.a - qeIcx;
  19730. if (this.chigh < qeIcx) {
  19731. if (a < qeIcx) {
  19732. a = qeIcx;
  19733. d = cx_mps;
  19734. cx_index = qeTableIcx.nmps;
  19735. } else {
  19736. a = qeIcx;
  19737. d = 1 ^ cx_mps;
  19738. if (qeTableIcx.switchFlag === 1) {
  19739. cx_mps = d;
  19740. }
  19741. cx_index = qeTableIcx.nlps;
  19742. }
  19743. } else {
  19744. this.chigh -= qeIcx;
  19745. if ((a & 0x8000) !== 0) {
  19746. this.a = a;
  19747. return cx_mps;
  19748. }
  19749. if (a < qeIcx) {
  19750. d = 1 ^ cx_mps;
  19751. if (qeTableIcx.switchFlag === 1) {
  19752. cx_mps = d;
  19753. }
  19754. cx_index = qeTableIcx.nlps;
  19755. } else {
  19756. d = cx_mps;
  19757. cx_index = qeTableIcx.nmps;
  19758. }
  19759. }
  19760. do {
  19761. if (this.ct === 0) {
  19762. this.byteIn();
  19763. }
  19764. a <<= 1;
  19765. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  19766. this.clow = this.clow << 1 & 0xFFFF;
  19767. this.ct--;
  19768. } while ((a & 0x8000) === 0);
  19769. this.a = a;
  19770. contexts[pos] = cx_index << 1 | cx_mps;
  19771. return d;
  19772. }
  19773. };
  19774. return ArithmeticDecoder;
  19775. }();
  19776. exports.ArithmeticDecoder = ArithmeticDecoder;
  19777. /***/ }),
  19778. /* 10 */
  19779. /***/ (function(module, exports, __w_pdfjs_require__) {
  19780. "use strict";
  19781. var sharedUtil = __w_pdfjs_require__(0);
  19782. var coreCharsets = __w_pdfjs_require__(23);
  19783. var coreEncodings = __w_pdfjs_require__(4);
  19784. var error = sharedUtil.error;
  19785. var info = sharedUtil.info;
  19786. var bytesToString = sharedUtil.bytesToString;
  19787. var warn = sharedUtil.warn;
  19788. var isArray = sharedUtil.isArray;
  19789. var Util = sharedUtil.Util;
  19790. var stringToBytes = sharedUtil.stringToBytes;
  19791. var assert = sharedUtil.assert;
  19792. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  19793. var ExpertCharset = coreCharsets.ExpertCharset;
  19794. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  19795. var StandardEncoding = coreEncodings.StandardEncoding;
  19796. var ExpertEncoding = coreEncodings.ExpertEncoding;
  19797. var MAX_SUBR_NESTING = 10;
  19798. var CFFStandardStrings = [
  19799. '.notdef',
  19800. 'space',
  19801. 'exclam',
  19802. 'quotedbl',
  19803. 'numbersign',
  19804. 'dollar',
  19805. 'percent',
  19806. 'ampersand',
  19807. 'quoteright',
  19808. 'parenleft',
  19809. 'parenright',
  19810. 'asterisk',
  19811. 'plus',
  19812. 'comma',
  19813. 'hyphen',
  19814. 'period',
  19815. 'slash',
  19816. 'zero',
  19817. 'one',
  19818. 'two',
  19819. 'three',
  19820. 'four',
  19821. 'five',
  19822. 'six',
  19823. 'seven',
  19824. 'eight',
  19825. 'nine',
  19826. 'colon',
  19827. 'semicolon',
  19828. 'less',
  19829. 'equal',
  19830. 'greater',
  19831. 'question',
  19832. 'at',
  19833. 'A',
  19834. 'B',
  19835. 'C',
  19836. 'D',
  19837. 'E',
  19838. 'F',
  19839. 'G',
  19840. 'H',
  19841. 'I',
  19842. 'J',
  19843. 'K',
  19844. 'L',
  19845. 'M',
  19846. 'N',
  19847. 'O',
  19848. 'P',
  19849. 'Q',
  19850. 'R',
  19851. 'S',
  19852. 'T',
  19853. 'U',
  19854. 'V',
  19855. 'W',
  19856. 'X',
  19857. 'Y',
  19858. 'Z',
  19859. 'bracketleft',
  19860. 'backslash',
  19861. 'bracketright',
  19862. 'asciicircum',
  19863. 'underscore',
  19864. 'quoteleft',
  19865. 'a',
  19866. 'b',
  19867. 'c',
  19868. 'd',
  19869. 'e',
  19870. 'f',
  19871. 'g',
  19872. 'h',
  19873. 'i',
  19874. 'j',
  19875. 'k',
  19876. 'l',
  19877. 'm',
  19878. 'n',
  19879. 'o',
  19880. 'p',
  19881. 'q',
  19882. 'r',
  19883. 's',
  19884. 't',
  19885. 'u',
  19886. 'v',
  19887. 'w',
  19888. 'x',
  19889. 'y',
  19890. 'z',
  19891. 'braceleft',
  19892. 'bar',
  19893. 'braceright',
  19894. 'asciitilde',
  19895. 'exclamdown',
  19896. 'cent',
  19897. 'sterling',
  19898. 'fraction',
  19899. 'yen',
  19900. 'florin',
  19901. 'section',
  19902. 'currency',
  19903. 'quotesingle',
  19904. 'quotedblleft',
  19905. 'guillemotleft',
  19906. 'guilsinglleft',
  19907. 'guilsinglright',
  19908. 'fi',
  19909. 'fl',
  19910. 'endash',
  19911. 'dagger',
  19912. 'daggerdbl',
  19913. 'periodcentered',
  19914. 'paragraph',
  19915. 'bullet',
  19916. 'quotesinglbase',
  19917. 'quotedblbase',
  19918. 'quotedblright',
  19919. 'guillemotright',
  19920. 'ellipsis',
  19921. 'perthousand',
  19922. 'questiondown',
  19923. 'grave',
  19924. 'acute',
  19925. 'circumflex',
  19926. 'tilde',
  19927. 'macron',
  19928. 'breve',
  19929. 'dotaccent',
  19930. 'dieresis',
  19931. 'ring',
  19932. 'cedilla',
  19933. 'hungarumlaut',
  19934. 'ogonek',
  19935. 'caron',
  19936. 'emdash',
  19937. 'AE',
  19938. 'ordfeminine',
  19939. 'Lslash',
  19940. 'Oslash',
  19941. 'OE',
  19942. 'ordmasculine',
  19943. 'ae',
  19944. 'dotlessi',
  19945. 'lslash',
  19946. 'oslash',
  19947. 'oe',
  19948. 'germandbls',
  19949. 'onesuperior',
  19950. 'logicalnot',
  19951. 'mu',
  19952. 'trademark',
  19953. 'Eth',
  19954. 'onehalf',
  19955. 'plusminus',
  19956. 'Thorn',
  19957. 'onequarter',
  19958. 'divide',
  19959. 'brokenbar',
  19960. 'degree',
  19961. 'thorn',
  19962. 'threequarters',
  19963. 'twosuperior',
  19964. 'registered',
  19965. 'minus',
  19966. 'eth',
  19967. 'multiply',
  19968. 'threesuperior',
  19969. 'copyright',
  19970. 'Aacute',
  19971. 'Acircumflex',
  19972. 'Adieresis',
  19973. 'Agrave',
  19974. 'Aring',
  19975. 'Atilde',
  19976. 'Ccedilla',
  19977. 'Eacute',
  19978. 'Ecircumflex',
  19979. 'Edieresis',
  19980. 'Egrave',
  19981. 'Iacute',
  19982. 'Icircumflex',
  19983. 'Idieresis',
  19984. 'Igrave',
  19985. 'Ntilde',
  19986. 'Oacute',
  19987. 'Ocircumflex',
  19988. 'Odieresis',
  19989. 'Ograve',
  19990. 'Otilde',
  19991. 'Scaron',
  19992. 'Uacute',
  19993. 'Ucircumflex',
  19994. 'Udieresis',
  19995. 'Ugrave',
  19996. 'Yacute',
  19997. 'Ydieresis',
  19998. 'Zcaron',
  19999. 'aacute',
  20000. 'acircumflex',
  20001. 'adieresis',
  20002. 'agrave',
  20003. 'aring',
  20004. 'atilde',
  20005. 'ccedilla',
  20006. 'eacute',
  20007. 'ecircumflex',
  20008. 'edieresis',
  20009. 'egrave',
  20010. 'iacute',
  20011. 'icircumflex',
  20012. 'idieresis',
  20013. 'igrave',
  20014. 'ntilde',
  20015. 'oacute',
  20016. 'ocircumflex',
  20017. 'odieresis',
  20018. 'ograve',
  20019. 'otilde',
  20020. 'scaron',
  20021. 'uacute',
  20022. 'ucircumflex',
  20023. 'udieresis',
  20024. 'ugrave',
  20025. 'yacute',
  20026. 'ydieresis',
  20027. 'zcaron',
  20028. 'exclamsmall',
  20029. 'Hungarumlautsmall',
  20030. 'dollaroldstyle',
  20031. 'dollarsuperior',
  20032. 'ampersandsmall',
  20033. 'Acutesmall',
  20034. 'parenleftsuperior',
  20035. 'parenrightsuperior',
  20036. 'twodotenleader',
  20037. 'onedotenleader',
  20038. 'zerooldstyle',
  20039. 'oneoldstyle',
  20040. 'twooldstyle',
  20041. 'threeoldstyle',
  20042. 'fouroldstyle',
  20043. 'fiveoldstyle',
  20044. 'sixoldstyle',
  20045. 'sevenoldstyle',
  20046. 'eightoldstyle',
  20047. 'nineoldstyle',
  20048. 'commasuperior',
  20049. 'threequartersemdash',
  20050. 'periodsuperior',
  20051. 'questionsmall',
  20052. 'asuperior',
  20053. 'bsuperior',
  20054. 'centsuperior',
  20055. 'dsuperior',
  20056. 'esuperior',
  20057. 'isuperior',
  20058. 'lsuperior',
  20059. 'msuperior',
  20060. 'nsuperior',
  20061. 'osuperior',
  20062. 'rsuperior',
  20063. 'ssuperior',
  20064. 'tsuperior',
  20065. 'ff',
  20066. 'ffi',
  20067. 'ffl',
  20068. 'parenleftinferior',
  20069. 'parenrightinferior',
  20070. 'Circumflexsmall',
  20071. 'hyphensuperior',
  20072. 'Gravesmall',
  20073. 'Asmall',
  20074. 'Bsmall',
  20075. 'Csmall',
  20076. 'Dsmall',
  20077. 'Esmall',
  20078. 'Fsmall',
  20079. 'Gsmall',
  20080. 'Hsmall',
  20081. 'Ismall',
  20082. 'Jsmall',
  20083. 'Ksmall',
  20084. 'Lsmall',
  20085. 'Msmall',
  20086. 'Nsmall',
  20087. 'Osmall',
  20088. 'Psmall',
  20089. 'Qsmall',
  20090. 'Rsmall',
  20091. 'Ssmall',
  20092. 'Tsmall',
  20093. 'Usmall',
  20094. 'Vsmall',
  20095. 'Wsmall',
  20096. 'Xsmall',
  20097. 'Ysmall',
  20098. 'Zsmall',
  20099. 'colonmonetary',
  20100. 'onefitted',
  20101. 'rupiah',
  20102. 'Tildesmall',
  20103. 'exclamdownsmall',
  20104. 'centoldstyle',
  20105. 'Lslashsmall',
  20106. 'Scaronsmall',
  20107. 'Zcaronsmall',
  20108. 'Dieresissmall',
  20109. 'Brevesmall',
  20110. 'Caronsmall',
  20111. 'Dotaccentsmall',
  20112. 'Macronsmall',
  20113. 'figuredash',
  20114. 'hypheninferior',
  20115. 'Ogoneksmall',
  20116. 'Ringsmall',
  20117. 'Cedillasmall',
  20118. 'questiondownsmall',
  20119. 'oneeighth',
  20120. 'threeeighths',
  20121. 'fiveeighths',
  20122. 'seveneighths',
  20123. 'onethird',
  20124. 'twothirds',
  20125. 'zerosuperior',
  20126. 'foursuperior',
  20127. 'fivesuperior',
  20128. 'sixsuperior',
  20129. 'sevensuperior',
  20130. 'eightsuperior',
  20131. 'ninesuperior',
  20132. 'zeroinferior',
  20133. 'oneinferior',
  20134. 'twoinferior',
  20135. 'threeinferior',
  20136. 'fourinferior',
  20137. 'fiveinferior',
  20138. 'sixinferior',
  20139. 'seveninferior',
  20140. 'eightinferior',
  20141. 'nineinferior',
  20142. 'centinferior',
  20143. 'dollarinferior',
  20144. 'periodinferior',
  20145. 'commainferior',
  20146. 'Agravesmall',
  20147. 'Aacutesmall',
  20148. 'Acircumflexsmall',
  20149. 'Atildesmall',
  20150. 'Adieresissmall',
  20151. 'Aringsmall',
  20152. 'AEsmall',
  20153. 'Ccedillasmall',
  20154. 'Egravesmall',
  20155. 'Eacutesmall',
  20156. 'Ecircumflexsmall',
  20157. 'Edieresissmall',
  20158. 'Igravesmall',
  20159. 'Iacutesmall',
  20160. 'Icircumflexsmall',
  20161. 'Idieresissmall',
  20162. 'Ethsmall',
  20163. 'Ntildesmall',
  20164. 'Ogravesmall',
  20165. 'Oacutesmall',
  20166. 'Ocircumflexsmall',
  20167. 'Otildesmall',
  20168. 'Odieresissmall',
  20169. 'OEsmall',
  20170. 'Oslashsmall',
  20171. 'Ugravesmall',
  20172. 'Uacutesmall',
  20173. 'Ucircumflexsmall',
  20174. 'Udieresissmall',
  20175. 'Yacutesmall',
  20176. 'Thornsmall',
  20177. 'Ydieresissmall',
  20178. '001.000',
  20179. '001.001',
  20180. '001.002',
  20181. '001.003',
  20182. 'Black',
  20183. 'Bold',
  20184. 'Book',
  20185. 'Light',
  20186. 'Medium',
  20187. 'Regular',
  20188. 'Roman',
  20189. 'Semibold'
  20190. ];
  20191. var CFFParser = function CFFParserClosure() {
  20192. var CharstringValidationData = [
  20193. null,
  20194. {
  20195. id: 'hstem',
  20196. min: 2,
  20197. stackClearing: true,
  20198. stem: true
  20199. },
  20200. null,
  20201. {
  20202. id: 'vstem',
  20203. min: 2,
  20204. stackClearing: true,
  20205. stem: true
  20206. },
  20207. {
  20208. id: 'vmoveto',
  20209. min: 1,
  20210. stackClearing: true
  20211. },
  20212. {
  20213. id: 'rlineto',
  20214. min: 2,
  20215. resetStack: true
  20216. },
  20217. {
  20218. id: 'hlineto',
  20219. min: 1,
  20220. resetStack: true
  20221. },
  20222. {
  20223. id: 'vlineto',
  20224. min: 1,
  20225. resetStack: true
  20226. },
  20227. {
  20228. id: 'rrcurveto',
  20229. min: 6,
  20230. resetStack: true
  20231. },
  20232. null,
  20233. {
  20234. id: 'callsubr',
  20235. min: 1,
  20236. undefStack: true
  20237. },
  20238. {
  20239. id: 'return',
  20240. min: 0,
  20241. undefStack: true
  20242. },
  20243. null,
  20244. null,
  20245. {
  20246. id: 'endchar',
  20247. min: 0,
  20248. stackClearing: true
  20249. },
  20250. null,
  20251. null,
  20252. null,
  20253. {
  20254. id: 'hstemhm',
  20255. min: 2,
  20256. stackClearing: true,
  20257. stem: true
  20258. },
  20259. {
  20260. id: 'hintmask',
  20261. min: 0,
  20262. stackClearing: true
  20263. },
  20264. {
  20265. id: 'cntrmask',
  20266. min: 0,
  20267. stackClearing: true
  20268. },
  20269. {
  20270. id: 'rmoveto',
  20271. min: 2,
  20272. stackClearing: true
  20273. },
  20274. {
  20275. id: 'hmoveto',
  20276. min: 1,
  20277. stackClearing: true
  20278. },
  20279. {
  20280. id: 'vstemhm',
  20281. min: 2,
  20282. stackClearing: true,
  20283. stem: true
  20284. },
  20285. {
  20286. id: 'rcurveline',
  20287. min: 8,
  20288. resetStack: true
  20289. },
  20290. {
  20291. id: 'rlinecurve',
  20292. min: 8,
  20293. resetStack: true
  20294. },
  20295. {
  20296. id: 'vvcurveto',
  20297. min: 4,
  20298. resetStack: true
  20299. },
  20300. {
  20301. id: 'hhcurveto',
  20302. min: 4,
  20303. resetStack: true
  20304. },
  20305. null,
  20306. {
  20307. id: 'callgsubr',
  20308. min: 1,
  20309. undefStack: true
  20310. },
  20311. {
  20312. id: 'vhcurveto',
  20313. min: 4,
  20314. resetStack: true
  20315. },
  20316. {
  20317. id: 'hvcurveto',
  20318. min: 4,
  20319. resetStack: true
  20320. }
  20321. ];
  20322. var CharstringValidationData12 = [
  20323. null,
  20324. null,
  20325. null,
  20326. {
  20327. id: 'and',
  20328. min: 2,
  20329. stackDelta: -1
  20330. },
  20331. {
  20332. id: 'or',
  20333. min: 2,
  20334. stackDelta: -1
  20335. },
  20336. {
  20337. id: 'not',
  20338. min: 1,
  20339. stackDelta: 0
  20340. },
  20341. null,
  20342. null,
  20343. null,
  20344. {
  20345. id: 'abs',
  20346. min: 1,
  20347. stackDelta: 0
  20348. },
  20349. {
  20350. id: 'add',
  20351. min: 2,
  20352. stackDelta: -1,
  20353. stackFn: function stack_div(stack, index) {
  20354. stack[index - 2] = stack[index - 2] + stack[index - 1];
  20355. }
  20356. },
  20357. {
  20358. id: 'sub',
  20359. min: 2,
  20360. stackDelta: -1,
  20361. stackFn: function stack_div(stack, index) {
  20362. stack[index - 2] = stack[index - 2] - stack[index - 1];
  20363. }
  20364. },
  20365. {
  20366. id: 'div',
  20367. min: 2,
  20368. stackDelta: -1,
  20369. stackFn: function stack_div(stack, index) {
  20370. stack[index - 2] = stack[index - 2] / stack[index - 1];
  20371. }
  20372. },
  20373. null,
  20374. {
  20375. id: 'neg',
  20376. min: 1,
  20377. stackDelta: 0,
  20378. stackFn: function stack_div(stack, index) {
  20379. stack[index - 1] = -stack[index - 1];
  20380. }
  20381. },
  20382. {
  20383. id: 'eq',
  20384. min: 2,
  20385. stackDelta: -1
  20386. },
  20387. null,
  20388. null,
  20389. {
  20390. id: 'drop',
  20391. min: 1,
  20392. stackDelta: -1
  20393. },
  20394. null,
  20395. {
  20396. id: 'put',
  20397. min: 2,
  20398. stackDelta: -2
  20399. },
  20400. {
  20401. id: 'get',
  20402. min: 1,
  20403. stackDelta: 0
  20404. },
  20405. {
  20406. id: 'ifelse',
  20407. min: 4,
  20408. stackDelta: -3
  20409. },
  20410. {
  20411. id: 'random',
  20412. min: 0,
  20413. stackDelta: 1
  20414. },
  20415. {
  20416. id: 'mul',
  20417. min: 2,
  20418. stackDelta: -1,
  20419. stackFn: function stack_div(stack, index) {
  20420. stack[index - 2] = stack[index - 2] * stack[index - 1];
  20421. }
  20422. },
  20423. null,
  20424. {
  20425. id: 'sqrt',
  20426. min: 1,
  20427. stackDelta: 0
  20428. },
  20429. {
  20430. id: 'dup',
  20431. min: 1,
  20432. stackDelta: 1
  20433. },
  20434. {
  20435. id: 'exch',
  20436. min: 2,
  20437. stackDelta: 0
  20438. },
  20439. {
  20440. id: 'index',
  20441. min: 2,
  20442. stackDelta: 0
  20443. },
  20444. {
  20445. id: 'roll',
  20446. min: 3,
  20447. stackDelta: -2
  20448. },
  20449. null,
  20450. null,
  20451. null,
  20452. {
  20453. id: 'hflex',
  20454. min: 7,
  20455. resetStack: true
  20456. },
  20457. {
  20458. id: 'flex',
  20459. min: 13,
  20460. resetStack: true
  20461. },
  20462. {
  20463. id: 'hflex1',
  20464. min: 9,
  20465. resetStack: true
  20466. },
  20467. {
  20468. id: 'flex1',
  20469. min: 11,
  20470. resetStack: true
  20471. }
  20472. ];
  20473. function CFFParser(file, properties, seacAnalysisEnabled) {
  20474. this.bytes = file.getBytes();
  20475. this.properties = properties;
  20476. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  20477. }
  20478. CFFParser.prototype = {
  20479. parse: function CFFParser_parse() {
  20480. var properties = this.properties;
  20481. var cff = new CFF();
  20482. this.cff = cff;
  20483. var header = this.parseHeader();
  20484. var nameIndex = this.parseIndex(header.endPos);
  20485. var topDictIndex = this.parseIndex(nameIndex.endPos);
  20486. var stringIndex = this.parseIndex(topDictIndex.endPos);
  20487. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  20488. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  20489. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  20490. cff.header = header.obj;
  20491. cff.names = this.parseNameIndex(nameIndex.obj);
  20492. cff.strings = this.parseStringIndex(stringIndex.obj);
  20493. cff.topDict = topDict;
  20494. cff.globalSubrIndex = globalSubrIndex.obj;
  20495. this.parsePrivateDict(cff.topDict);
  20496. cff.isCIDFont = topDict.hasName('ROS');
  20497. var charStringOffset = topDict.getByName('CharStrings');
  20498. var charStringIndex = this.parseIndex(charStringOffset).obj;
  20499. var fontMatrix = topDict.getByName('FontMatrix');
  20500. if (fontMatrix) {
  20501. properties.fontMatrix = fontMatrix;
  20502. }
  20503. var fontBBox = topDict.getByName('FontBBox');
  20504. if (fontBBox) {
  20505. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  20506. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  20507. properties.ascentScaled = true;
  20508. }
  20509. var charset, encoding;
  20510. if (cff.isCIDFont) {
  20511. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  20512. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  20513. var dictRaw = fdArrayIndex.get(i);
  20514. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  20515. this.parsePrivateDict(fontDict);
  20516. cff.fdArray.push(fontDict);
  20517. }
  20518. encoding = null;
  20519. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  20520. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  20521. } else {
  20522. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  20523. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  20524. }
  20525. cff.charset = charset;
  20526. cff.encoding = encoding;
  20527. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  20528. cff.charStrings = charStringsAndSeacs.charStrings;
  20529. cff.seacs = charStringsAndSeacs.seacs;
  20530. cff.widths = charStringsAndSeacs.widths;
  20531. return cff;
  20532. },
  20533. parseHeader: function CFFParser_parseHeader() {
  20534. var bytes = this.bytes;
  20535. var bytesLength = bytes.length;
  20536. var offset = 0;
  20537. while (offset < bytesLength && bytes[offset] !== 1) {
  20538. ++offset;
  20539. }
  20540. if (offset >= bytesLength) {
  20541. error('Invalid CFF header');
  20542. } else if (offset !== 0) {
  20543. info('cff data is shifted');
  20544. bytes = bytes.subarray(offset);
  20545. this.bytes = bytes;
  20546. }
  20547. var major = bytes[0];
  20548. var minor = bytes[1];
  20549. var hdrSize = bytes[2];
  20550. var offSize = bytes[3];
  20551. var header = new CFFHeader(major, minor, hdrSize, offSize);
  20552. return {
  20553. obj: header,
  20554. endPos: hdrSize
  20555. };
  20556. },
  20557. parseDict: function CFFParser_parseDict(dict) {
  20558. var pos = 0;
  20559. function parseOperand() {
  20560. var value = dict[pos++];
  20561. if (value === 30) {
  20562. return parseFloatOperand();
  20563. } else if (value === 28) {
  20564. value = dict[pos++];
  20565. value = (value << 24 | dict[pos++] << 16) >> 16;
  20566. return value;
  20567. } else if (value === 29) {
  20568. value = dict[pos++];
  20569. value = value << 8 | dict[pos++];
  20570. value = value << 8 | dict[pos++];
  20571. value = value << 8 | dict[pos++];
  20572. return value;
  20573. } else if (value >= 32 && value <= 246) {
  20574. return value - 139;
  20575. } else if (value >= 247 && value <= 250) {
  20576. return (value - 247) * 256 + dict[pos++] + 108;
  20577. } else if (value >= 251 && value <= 254) {
  20578. return -((value - 251) * 256) - dict[pos++] - 108;
  20579. }
  20580. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  20581. return NaN;
  20582. }
  20583. function parseFloatOperand() {
  20584. var str = '';
  20585. var eof = 15;
  20586. var lookup = [
  20587. '0',
  20588. '1',
  20589. '2',
  20590. '3',
  20591. '4',
  20592. '5',
  20593. '6',
  20594. '7',
  20595. '8',
  20596. '9',
  20597. '.',
  20598. 'E',
  20599. 'E-',
  20600. null,
  20601. '-'
  20602. ];
  20603. var length = dict.length;
  20604. while (pos < length) {
  20605. var b = dict[pos++];
  20606. var b1 = b >> 4;
  20607. var b2 = b & 15;
  20608. if (b1 === eof) {
  20609. break;
  20610. }
  20611. str += lookup[b1];
  20612. if (b2 === eof) {
  20613. break;
  20614. }
  20615. str += lookup[b2];
  20616. }
  20617. return parseFloat(str);
  20618. }
  20619. var operands = [];
  20620. var entries = [];
  20621. pos = 0;
  20622. var end = dict.length;
  20623. while (pos < end) {
  20624. var b = dict[pos];
  20625. if (b <= 21) {
  20626. if (b === 12) {
  20627. b = b << 8 | dict[++pos];
  20628. }
  20629. entries.push([
  20630. b,
  20631. operands
  20632. ]);
  20633. operands = [];
  20634. ++pos;
  20635. } else {
  20636. operands.push(parseOperand());
  20637. }
  20638. }
  20639. return entries;
  20640. },
  20641. parseIndex: function CFFParser_parseIndex(pos) {
  20642. var cffIndex = new CFFIndex();
  20643. var bytes = this.bytes;
  20644. var count = bytes[pos++] << 8 | bytes[pos++];
  20645. var offsets = [];
  20646. var end = pos;
  20647. var i, ii;
  20648. if (count !== 0) {
  20649. var offsetSize = bytes[pos++];
  20650. var startPos = pos + (count + 1) * offsetSize - 1;
  20651. for (i = 0, ii = count + 1; i < ii; ++i) {
  20652. var offset = 0;
  20653. for (var j = 0; j < offsetSize; ++j) {
  20654. offset <<= 8;
  20655. offset += bytes[pos++];
  20656. }
  20657. offsets.push(startPos + offset);
  20658. }
  20659. end = offsets[count];
  20660. }
  20661. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  20662. var offsetStart = offsets[i];
  20663. var offsetEnd = offsets[i + 1];
  20664. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  20665. }
  20666. return {
  20667. obj: cffIndex,
  20668. endPos: end
  20669. };
  20670. },
  20671. parseNameIndex: function CFFParser_parseNameIndex(index) {
  20672. var names = [];
  20673. for (var i = 0, ii = index.count; i < ii; ++i) {
  20674. var name = index.get(i);
  20675. var length = Math.min(name.length, 127);
  20676. var data = [];
  20677. for (var j = 0; j < length; ++j) {
  20678. var c = name[j];
  20679. if (j === 0 && c === 0) {
  20680. data[j] = c;
  20681. continue;
  20682. }
  20683. 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) {
  20684. data[j] = 95;
  20685. continue;
  20686. }
  20687. data[j] = c;
  20688. }
  20689. names.push(bytesToString(data));
  20690. }
  20691. return names;
  20692. },
  20693. parseStringIndex: function CFFParser_parseStringIndex(index) {
  20694. var strings = new CFFStrings();
  20695. for (var i = 0, ii = index.count; i < ii; ++i) {
  20696. var data = index.get(i);
  20697. strings.add(bytesToString(data));
  20698. }
  20699. return strings;
  20700. },
  20701. createDict: function CFFParser_createDict(Type, dict, strings) {
  20702. var cffDict = new Type(strings);
  20703. for (var i = 0, ii = dict.length; i < ii; ++i) {
  20704. var pair = dict[i];
  20705. var key = pair[0];
  20706. var value = pair[1];
  20707. cffDict.setByKey(key, value);
  20708. }
  20709. return cffDict;
  20710. },
  20711. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  20712. if (state.callDepth > MAX_SUBR_NESTING) {
  20713. return false;
  20714. }
  20715. var stackSize = state.stackSize;
  20716. var stack = state.stack;
  20717. var length = data.length;
  20718. for (var j = 0; j < length;) {
  20719. var value = data[j++];
  20720. var validationCommand = null;
  20721. if (value === 12) {
  20722. var q = data[j++];
  20723. if (q === 0) {
  20724. data[j - 2] = 139;
  20725. data[j - 1] = 22;
  20726. stackSize = 0;
  20727. } else {
  20728. validationCommand = CharstringValidationData12[q];
  20729. }
  20730. } else if (value === 28) {
  20731. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  20732. j += 2;
  20733. stackSize++;
  20734. } else if (value === 14) {
  20735. if (stackSize >= 4) {
  20736. stackSize -= 4;
  20737. if (this.seacAnalysisEnabled) {
  20738. state.seac = stack.slice(stackSize, stackSize + 4);
  20739. return false;
  20740. }
  20741. }
  20742. validationCommand = CharstringValidationData[value];
  20743. } else if (value >= 32 && value <= 246) {
  20744. stack[stackSize] = value - 139;
  20745. stackSize++;
  20746. } else if (value >= 247 && value <= 254) {
  20747. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  20748. j++;
  20749. stackSize++;
  20750. } else if (value === 255) {
  20751. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  20752. j += 4;
  20753. stackSize++;
  20754. } else if (value === 19 || value === 20) {
  20755. state.hints += stackSize >> 1;
  20756. j += state.hints + 7 >> 3;
  20757. stackSize %= 2;
  20758. validationCommand = CharstringValidationData[value];
  20759. } else if (value === 10 || value === 29) {
  20760. var subrsIndex;
  20761. if (value === 10) {
  20762. subrsIndex = localSubrIndex;
  20763. } else {
  20764. subrsIndex = globalSubrIndex;
  20765. }
  20766. if (!subrsIndex) {
  20767. validationCommand = CharstringValidationData[value];
  20768. warn('Missing subrsIndex for ' + validationCommand.id);
  20769. return false;
  20770. }
  20771. var bias = 32768;
  20772. if (subrsIndex.count < 1240) {
  20773. bias = 107;
  20774. } else if (subrsIndex.count < 33900) {
  20775. bias = 1131;
  20776. }
  20777. var subrNumber = stack[--stackSize] + bias;
  20778. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  20779. validationCommand = CharstringValidationData[value];
  20780. warn('Out of bounds subrIndex for ' + validationCommand.id);
  20781. return false;
  20782. }
  20783. state.stackSize = stackSize;
  20784. state.callDepth++;
  20785. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  20786. if (!valid) {
  20787. return false;
  20788. }
  20789. state.callDepth--;
  20790. stackSize = state.stackSize;
  20791. continue;
  20792. } else if (value === 11) {
  20793. state.stackSize = stackSize;
  20794. return true;
  20795. } else {
  20796. validationCommand = CharstringValidationData[value];
  20797. }
  20798. if (validationCommand) {
  20799. if (validationCommand.stem) {
  20800. state.hints += stackSize >> 1;
  20801. }
  20802. if ('min' in validationCommand) {
  20803. if (!state.undefStack && stackSize < validationCommand.min) {
  20804. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  20805. return false;
  20806. }
  20807. }
  20808. if (state.firstStackClearing && validationCommand.stackClearing) {
  20809. state.firstStackClearing = false;
  20810. stackSize -= validationCommand.min;
  20811. if (stackSize >= 2 && validationCommand.stem) {
  20812. stackSize %= 2;
  20813. } else if (stackSize > 1) {
  20814. warn('Found too many parameters for stack-clearing command');
  20815. }
  20816. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  20817. state.width = stack[stackSize - 1];
  20818. }
  20819. }
  20820. if ('stackDelta' in validationCommand) {
  20821. if ('stackFn' in validationCommand) {
  20822. validationCommand.stackFn(stack, stackSize);
  20823. }
  20824. stackSize += validationCommand.stackDelta;
  20825. } else if (validationCommand.stackClearing) {
  20826. stackSize = 0;
  20827. } else if (validationCommand.resetStack) {
  20828. stackSize = 0;
  20829. state.undefStack = false;
  20830. } else if (validationCommand.undefStack) {
  20831. stackSize = 0;
  20832. state.undefStack = true;
  20833. state.firstStackClearing = false;
  20834. }
  20835. }
  20836. }
  20837. state.stackSize = stackSize;
  20838. return true;
  20839. },
  20840. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20841. var seacs = [];
  20842. var widths = [];
  20843. var count = charStrings.count;
  20844. for (var i = 0; i < count; i++) {
  20845. var charstring = charStrings.get(i);
  20846. var state = {
  20847. callDepth: 0,
  20848. stackSize: 0,
  20849. stack: [],
  20850. undefStack: true,
  20851. hints: 0,
  20852. firstStackClearing: true,
  20853. seac: null,
  20854. width: null
  20855. };
  20856. var valid = true;
  20857. var localSubrToUse = null;
  20858. if (fdSelect && fdArray.length) {
  20859. var fdIndex = fdSelect.getFDIndex(i);
  20860. if (fdIndex === -1) {
  20861. warn('Glyph index is not in fd select.');
  20862. valid = false;
  20863. }
  20864. if (fdIndex >= fdArray.length) {
  20865. warn('Invalid fd index for glyph index.');
  20866. valid = false;
  20867. }
  20868. if (valid) {
  20869. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20870. }
  20871. } else if (localSubrIndex) {
  20872. localSubrToUse = localSubrIndex;
  20873. }
  20874. if (valid) {
  20875. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20876. }
  20877. if (state.width !== null) {
  20878. widths[i] = state.width;
  20879. }
  20880. if (state.seac !== null) {
  20881. seacs[i] = state.seac;
  20882. }
  20883. if (!valid) {
  20884. charStrings.set(i, new Uint8Array([14]));
  20885. }
  20886. }
  20887. return {
  20888. charStrings: charStrings,
  20889. seacs: seacs,
  20890. widths: widths
  20891. };
  20892. },
  20893. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20894. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20895. parentDict.setByKey(18, [
  20896. 0,
  20897. 0
  20898. ]);
  20899. parentDict.privateDict = privateDict;
  20900. },
  20901. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20902. if (!parentDict.hasName('Private')) {
  20903. this.emptyPrivateDictionary(parentDict);
  20904. return;
  20905. }
  20906. var privateOffset = parentDict.getByName('Private');
  20907. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20908. parentDict.removeByName('Private');
  20909. return;
  20910. }
  20911. var size = privateOffset[0];
  20912. var offset = privateOffset[1];
  20913. if (size === 0 || offset >= this.bytes.length) {
  20914. this.emptyPrivateDictionary(parentDict);
  20915. return;
  20916. }
  20917. var privateDictEnd = offset + size;
  20918. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20919. var dict = this.parseDict(dictData);
  20920. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20921. parentDict.privateDict = privateDict;
  20922. if (!privateDict.getByName('Subrs')) {
  20923. return;
  20924. }
  20925. var subrsOffset = privateDict.getByName('Subrs');
  20926. var relativeOffset = offset + subrsOffset;
  20927. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20928. this.emptyPrivateDictionary(parentDict);
  20929. return;
  20930. }
  20931. var subrsIndex = this.parseIndex(relativeOffset);
  20932. privateDict.subrsIndex = subrsIndex.obj;
  20933. },
  20934. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20935. if (pos === 0) {
  20936. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20937. } else if (pos === 1) {
  20938. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20939. } else if (pos === 2) {
  20940. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20941. }
  20942. var bytes = this.bytes;
  20943. var start = pos;
  20944. var format = bytes[pos++];
  20945. var charset = ['.notdef'];
  20946. var id, count, i;
  20947. length -= 1;
  20948. switch (format) {
  20949. case 0:
  20950. for (i = 0; i < length; i++) {
  20951. id = bytes[pos++] << 8 | bytes[pos++];
  20952. charset.push(cid ? id : strings.get(id));
  20953. }
  20954. break;
  20955. case 1:
  20956. while (charset.length <= length) {
  20957. id = bytes[pos++] << 8 | bytes[pos++];
  20958. count = bytes[pos++];
  20959. for (i = 0; i <= count; i++) {
  20960. charset.push(cid ? id++ : strings.get(id++));
  20961. }
  20962. }
  20963. break;
  20964. case 2:
  20965. while (charset.length <= length) {
  20966. id = bytes[pos++] << 8 | bytes[pos++];
  20967. count = bytes[pos++] << 8 | bytes[pos++];
  20968. for (i = 0; i <= count; i++) {
  20969. charset.push(cid ? id++ : strings.get(id++));
  20970. }
  20971. }
  20972. break;
  20973. default:
  20974. error('Unknown charset format');
  20975. }
  20976. var end = pos;
  20977. var raw = bytes.subarray(start, end);
  20978. return new CFFCharset(false, format, charset, raw);
  20979. },
  20980. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20981. var encoding = Object.create(null);
  20982. var bytes = this.bytes;
  20983. var predefined = false;
  20984. var format, i, ii;
  20985. var raw = null;
  20986. function readSupplement() {
  20987. var supplementsCount = bytes[pos++];
  20988. for (i = 0; i < supplementsCount; i++) {
  20989. var code = bytes[pos++];
  20990. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20991. encoding[code] = charset.indexOf(strings.get(sid));
  20992. }
  20993. }
  20994. if (pos === 0 || pos === 1) {
  20995. predefined = true;
  20996. format = pos;
  20997. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  20998. for (i = 0, ii = charset.length; i < ii; i++) {
  20999. var index = baseEncoding.indexOf(charset[i]);
  21000. if (index !== -1) {
  21001. encoding[index] = i;
  21002. }
  21003. }
  21004. } else {
  21005. var dataStart = pos;
  21006. format = bytes[pos++];
  21007. switch (format & 0x7f) {
  21008. case 0:
  21009. var glyphsCount = bytes[pos++];
  21010. for (i = 1; i <= glyphsCount; i++) {
  21011. encoding[bytes[pos++]] = i;
  21012. }
  21013. break;
  21014. case 1:
  21015. var rangesCount = bytes[pos++];
  21016. var gid = 1;
  21017. for (i = 0; i < rangesCount; i++) {
  21018. var start = bytes[pos++];
  21019. var left = bytes[pos++];
  21020. for (var j = start; j <= start + left; j++) {
  21021. encoding[j] = gid++;
  21022. }
  21023. }
  21024. break;
  21025. default:
  21026. error('Unknown encoding format: ' + format + ' in CFF');
  21027. break;
  21028. }
  21029. var dataEnd = pos;
  21030. if (format & 0x80) {
  21031. bytes[dataStart] &= 0x7f;
  21032. readSupplement();
  21033. }
  21034. raw = bytes.subarray(dataStart, dataEnd);
  21035. }
  21036. format = format & 0x7f;
  21037. return new CFFEncoding(predefined, format, encoding, raw);
  21038. },
  21039. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  21040. var start = pos;
  21041. var bytes = this.bytes;
  21042. var format = bytes[pos++];
  21043. var fdSelect = [], rawBytes;
  21044. var i, invalidFirstGID = false;
  21045. switch (format) {
  21046. case 0:
  21047. for (i = 0; i < length; ++i) {
  21048. var id = bytes[pos++];
  21049. fdSelect.push(id);
  21050. }
  21051. rawBytes = bytes.subarray(start, pos);
  21052. break;
  21053. case 3:
  21054. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21055. for (i = 0; i < rangesCount; ++i) {
  21056. var first = bytes[pos++] << 8 | bytes[pos++];
  21057. if (i === 0 && first !== 0) {
  21058. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  21059. invalidFirstGID = true;
  21060. first = 0;
  21061. }
  21062. var fdIndex = bytes[pos++];
  21063. var next = bytes[pos] << 8 | bytes[pos + 1];
  21064. for (var j = first; j < next; ++j) {
  21065. fdSelect.push(fdIndex);
  21066. }
  21067. }
  21068. pos += 2;
  21069. rawBytes = bytes.subarray(start, pos);
  21070. if (invalidFirstGID) {
  21071. rawBytes[3] = rawBytes[4] = 0;
  21072. }
  21073. break;
  21074. default:
  21075. error('parseFDSelect: Unknown format "' + format + '".');
  21076. break;
  21077. }
  21078. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  21079. return new CFFFDSelect(fdSelect, rawBytes);
  21080. }
  21081. };
  21082. return CFFParser;
  21083. }();
  21084. var CFF = function CFFClosure() {
  21085. function CFF() {
  21086. this.header = null;
  21087. this.names = [];
  21088. this.topDict = null;
  21089. this.strings = new CFFStrings();
  21090. this.globalSubrIndex = null;
  21091. this.encoding = null;
  21092. this.charset = null;
  21093. this.charStrings = null;
  21094. this.fdArray = [];
  21095. this.fdSelect = null;
  21096. this.isCIDFont = false;
  21097. }
  21098. return CFF;
  21099. }();
  21100. var CFFHeader = function CFFHeaderClosure() {
  21101. function CFFHeader(major, minor, hdrSize, offSize) {
  21102. this.major = major;
  21103. this.minor = minor;
  21104. this.hdrSize = hdrSize;
  21105. this.offSize = offSize;
  21106. }
  21107. return CFFHeader;
  21108. }();
  21109. var CFFStrings = function CFFStringsClosure() {
  21110. function CFFStrings() {
  21111. this.strings = [];
  21112. }
  21113. CFFStrings.prototype = {
  21114. get: function CFFStrings_get(index) {
  21115. if (index >= 0 && index <= 390) {
  21116. return CFFStandardStrings[index];
  21117. }
  21118. if (index - 391 <= this.strings.length) {
  21119. return this.strings[index - 391];
  21120. }
  21121. return CFFStandardStrings[0];
  21122. },
  21123. add: function CFFStrings_add(value) {
  21124. this.strings.push(value);
  21125. },
  21126. get count() {
  21127. return this.strings.length;
  21128. }
  21129. };
  21130. return CFFStrings;
  21131. }();
  21132. var CFFIndex = function CFFIndexClosure() {
  21133. function CFFIndex() {
  21134. this.objects = [];
  21135. this.length = 0;
  21136. }
  21137. CFFIndex.prototype = {
  21138. add: function CFFIndex_add(data) {
  21139. this.length += data.length;
  21140. this.objects.push(data);
  21141. },
  21142. set: function CFFIndex_set(index, data) {
  21143. this.length += data.length - this.objects[index].length;
  21144. this.objects[index] = data;
  21145. },
  21146. get: function CFFIndex_get(index) {
  21147. return this.objects[index];
  21148. },
  21149. get count() {
  21150. return this.objects.length;
  21151. }
  21152. };
  21153. return CFFIndex;
  21154. }();
  21155. var CFFDict = function CFFDictClosure() {
  21156. function CFFDict(tables, strings) {
  21157. this.keyToNameMap = tables.keyToNameMap;
  21158. this.nameToKeyMap = tables.nameToKeyMap;
  21159. this.defaults = tables.defaults;
  21160. this.types = tables.types;
  21161. this.opcodes = tables.opcodes;
  21162. this.order = tables.order;
  21163. this.strings = strings;
  21164. this.values = Object.create(null);
  21165. }
  21166. CFFDict.prototype = {
  21167. setByKey: function CFFDict_setByKey(key, value) {
  21168. if (!(key in this.keyToNameMap)) {
  21169. return false;
  21170. }
  21171. var valueLength = value.length;
  21172. if (valueLength === 0) {
  21173. return true;
  21174. }
  21175. for (var i = 0; i < valueLength; i++) {
  21176. if (isNaN(value[i])) {
  21177. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21178. return true;
  21179. }
  21180. }
  21181. var type = this.types[key];
  21182. if (type === 'num' || type === 'sid' || type === 'offset') {
  21183. value = value[0];
  21184. }
  21185. this.values[key] = value;
  21186. return true;
  21187. },
  21188. setByName: function CFFDict_setByName(name, value) {
  21189. if (!(name in this.nameToKeyMap)) {
  21190. error('Invalid dictionary name "' + name + '"');
  21191. }
  21192. this.values[this.nameToKeyMap[name]] = value;
  21193. },
  21194. hasName: function CFFDict_hasName(name) {
  21195. return this.nameToKeyMap[name] in this.values;
  21196. },
  21197. getByName: function CFFDict_getByName(name) {
  21198. if (!(name in this.nameToKeyMap)) {
  21199. error('Invalid dictionary name "' + name + '"');
  21200. }
  21201. var key = this.nameToKeyMap[name];
  21202. if (!(key in this.values)) {
  21203. return this.defaults[key];
  21204. }
  21205. return this.values[key];
  21206. },
  21207. removeByName: function CFFDict_removeByName(name) {
  21208. delete this.values[this.nameToKeyMap[name]];
  21209. }
  21210. };
  21211. CFFDict.createTables = function CFFDict_createTables(layout) {
  21212. var tables = {
  21213. keyToNameMap: {},
  21214. nameToKeyMap: {},
  21215. defaults: {},
  21216. types: {},
  21217. opcodes: {},
  21218. order: []
  21219. };
  21220. for (var i = 0, ii = layout.length; i < ii; ++i) {
  21221. var entry = layout[i];
  21222. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21223. tables.keyToNameMap[key] = entry[1];
  21224. tables.nameToKeyMap[entry[1]] = key;
  21225. tables.types[key] = entry[2];
  21226. tables.defaults[key] = entry[3];
  21227. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  21228. tables.order.push(key);
  21229. }
  21230. return tables;
  21231. };
  21232. return CFFDict;
  21233. }();
  21234. var CFFTopDict = function CFFTopDictClosure() {
  21235. var layout = [
  21236. [
  21237. [
  21238. 12,
  21239. 30
  21240. ],
  21241. 'ROS',
  21242. [
  21243. 'sid',
  21244. 'sid',
  21245. 'num'
  21246. ],
  21247. null
  21248. ],
  21249. [
  21250. [
  21251. 12,
  21252. 20
  21253. ],
  21254. 'SyntheticBase',
  21255. 'num',
  21256. null
  21257. ],
  21258. [
  21259. 0,
  21260. 'version',
  21261. 'sid',
  21262. null
  21263. ],
  21264. [
  21265. 1,
  21266. 'Notice',
  21267. 'sid',
  21268. null
  21269. ],
  21270. [
  21271. [
  21272. 12,
  21273. 0
  21274. ],
  21275. 'Copyright',
  21276. 'sid',
  21277. null
  21278. ],
  21279. [
  21280. 2,
  21281. 'FullName',
  21282. 'sid',
  21283. null
  21284. ],
  21285. [
  21286. 3,
  21287. 'FamilyName',
  21288. 'sid',
  21289. null
  21290. ],
  21291. [
  21292. 4,
  21293. 'Weight',
  21294. 'sid',
  21295. null
  21296. ],
  21297. [
  21298. [
  21299. 12,
  21300. 1
  21301. ],
  21302. 'isFixedPitch',
  21303. 'num',
  21304. 0
  21305. ],
  21306. [
  21307. [
  21308. 12,
  21309. 2
  21310. ],
  21311. 'ItalicAngle',
  21312. 'num',
  21313. 0
  21314. ],
  21315. [
  21316. [
  21317. 12,
  21318. 3
  21319. ],
  21320. 'UnderlinePosition',
  21321. 'num',
  21322. -100
  21323. ],
  21324. [
  21325. [
  21326. 12,
  21327. 4
  21328. ],
  21329. 'UnderlineThickness',
  21330. 'num',
  21331. 50
  21332. ],
  21333. [
  21334. [
  21335. 12,
  21336. 5
  21337. ],
  21338. 'PaintType',
  21339. 'num',
  21340. 0
  21341. ],
  21342. [
  21343. [
  21344. 12,
  21345. 6
  21346. ],
  21347. 'CharstringType',
  21348. 'num',
  21349. 2
  21350. ],
  21351. [
  21352. [
  21353. 12,
  21354. 7
  21355. ],
  21356. 'FontMatrix',
  21357. [
  21358. 'num',
  21359. 'num',
  21360. 'num',
  21361. 'num',
  21362. 'num',
  21363. 'num'
  21364. ],
  21365. [
  21366. 0.001,
  21367. 0,
  21368. 0,
  21369. 0.001,
  21370. 0,
  21371. 0
  21372. ]
  21373. ],
  21374. [
  21375. 13,
  21376. 'UniqueID',
  21377. 'num',
  21378. null
  21379. ],
  21380. [
  21381. 5,
  21382. 'FontBBox',
  21383. [
  21384. 'num',
  21385. 'num',
  21386. 'num',
  21387. 'num'
  21388. ],
  21389. [
  21390. 0,
  21391. 0,
  21392. 0,
  21393. 0
  21394. ]
  21395. ],
  21396. [
  21397. [
  21398. 12,
  21399. 8
  21400. ],
  21401. 'StrokeWidth',
  21402. 'num',
  21403. 0
  21404. ],
  21405. [
  21406. 14,
  21407. 'XUID',
  21408. 'array',
  21409. null
  21410. ],
  21411. [
  21412. 15,
  21413. 'charset',
  21414. 'offset',
  21415. 0
  21416. ],
  21417. [
  21418. 16,
  21419. 'Encoding',
  21420. 'offset',
  21421. 0
  21422. ],
  21423. [
  21424. 17,
  21425. 'CharStrings',
  21426. 'offset',
  21427. 0
  21428. ],
  21429. [
  21430. 18,
  21431. 'Private',
  21432. [
  21433. 'offset',
  21434. 'offset'
  21435. ],
  21436. null
  21437. ],
  21438. [
  21439. [
  21440. 12,
  21441. 21
  21442. ],
  21443. 'PostScript',
  21444. 'sid',
  21445. null
  21446. ],
  21447. [
  21448. [
  21449. 12,
  21450. 22
  21451. ],
  21452. 'BaseFontName',
  21453. 'sid',
  21454. null
  21455. ],
  21456. [
  21457. [
  21458. 12,
  21459. 23
  21460. ],
  21461. 'BaseFontBlend',
  21462. 'delta',
  21463. null
  21464. ],
  21465. [
  21466. [
  21467. 12,
  21468. 31
  21469. ],
  21470. 'CIDFontVersion',
  21471. 'num',
  21472. 0
  21473. ],
  21474. [
  21475. [
  21476. 12,
  21477. 32
  21478. ],
  21479. 'CIDFontRevision',
  21480. 'num',
  21481. 0
  21482. ],
  21483. [
  21484. [
  21485. 12,
  21486. 33
  21487. ],
  21488. 'CIDFontType',
  21489. 'num',
  21490. 0
  21491. ],
  21492. [
  21493. [
  21494. 12,
  21495. 34
  21496. ],
  21497. 'CIDCount',
  21498. 'num',
  21499. 8720
  21500. ],
  21501. [
  21502. [
  21503. 12,
  21504. 35
  21505. ],
  21506. 'UIDBase',
  21507. 'num',
  21508. null
  21509. ],
  21510. [
  21511. [
  21512. 12,
  21513. 37
  21514. ],
  21515. 'FDSelect',
  21516. 'offset',
  21517. null
  21518. ],
  21519. [
  21520. [
  21521. 12,
  21522. 36
  21523. ],
  21524. 'FDArray',
  21525. 'offset',
  21526. null
  21527. ],
  21528. [
  21529. [
  21530. 12,
  21531. 38
  21532. ],
  21533. 'FontName',
  21534. 'sid',
  21535. null
  21536. ]
  21537. ];
  21538. var tables = null;
  21539. function CFFTopDict(strings) {
  21540. if (tables === null) {
  21541. tables = CFFDict.createTables(layout);
  21542. }
  21543. CFFDict.call(this, tables, strings);
  21544. this.privateDict = null;
  21545. }
  21546. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  21547. return CFFTopDict;
  21548. }();
  21549. var CFFPrivateDict = function CFFPrivateDictClosure() {
  21550. var layout = [
  21551. [
  21552. 6,
  21553. 'BlueValues',
  21554. 'delta',
  21555. null
  21556. ],
  21557. [
  21558. 7,
  21559. 'OtherBlues',
  21560. 'delta',
  21561. null
  21562. ],
  21563. [
  21564. 8,
  21565. 'FamilyBlues',
  21566. 'delta',
  21567. null
  21568. ],
  21569. [
  21570. 9,
  21571. 'FamilyOtherBlues',
  21572. 'delta',
  21573. null
  21574. ],
  21575. [
  21576. [
  21577. 12,
  21578. 9
  21579. ],
  21580. 'BlueScale',
  21581. 'num',
  21582. 0.039625
  21583. ],
  21584. [
  21585. [
  21586. 12,
  21587. 10
  21588. ],
  21589. 'BlueShift',
  21590. 'num',
  21591. 7
  21592. ],
  21593. [
  21594. [
  21595. 12,
  21596. 11
  21597. ],
  21598. 'BlueFuzz',
  21599. 'num',
  21600. 1
  21601. ],
  21602. [
  21603. 10,
  21604. 'StdHW',
  21605. 'num',
  21606. null
  21607. ],
  21608. [
  21609. 11,
  21610. 'StdVW',
  21611. 'num',
  21612. null
  21613. ],
  21614. [
  21615. [
  21616. 12,
  21617. 12
  21618. ],
  21619. 'StemSnapH',
  21620. 'delta',
  21621. null
  21622. ],
  21623. [
  21624. [
  21625. 12,
  21626. 13
  21627. ],
  21628. 'StemSnapV',
  21629. 'delta',
  21630. null
  21631. ],
  21632. [
  21633. [
  21634. 12,
  21635. 14
  21636. ],
  21637. 'ForceBold',
  21638. 'num',
  21639. 0
  21640. ],
  21641. [
  21642. [
  21643. 12,
  21644. 17
  21645. ],
  21646. 'LanguageGroup',
  21647. 'num',
  21648. 0
  21649. ],
  21650. [
  21651. [
  21652. 12,
  21653. 18
  21654. ],
  21655. 'ExpansionFactor',
  21656. 'num',
  21657. 0.06
  21658. ],
  21659. [
  21660. [
  21661. 12,
  21662. 19
  21663. ],
  21664. 'initialRandomSeed',
  21665. 'num',
  21666. 0
  21667. ],
  21668. [
  21669. 20,
  21670. 'defaultWidthX',
  21671. 'num',
  21672. 0
  21673. ],
  21674. [
  21675. 21,
  21676. 'nominalWidthX',
  21677. 'num',
  21678. 0
  21679. ],
  21680. [
  21681. 19,
  21682. 'Subrs',
  21683. 'offset',
  21684. null
  21685. ]
  21686. ];
  21687. var tables = null;
  21688. function CFFPrivateDict(strings) {
  21689. if (tables === null) {
  21690. tables = CFFDict.createTables(layout);
  21691. }
  21692. CFFDict.call(this, tables, strings);
  21693. this.subrsIndex = null;
  21694. }
  21695. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  21696. return CFFPrivateDict;
  21697. }();
  21698. var CFFCharsetPredefinedTypes = {
  21699. ISO_ADOBE: 0,
  21700. EXPERT: 1,
  21701. EXPERT_SUBSET: 2
  21702. };
  21703. var CFFCharset = function CFFCharsetClosure() {
  21704. function CFFCharset(predefined, format, charset, raw) {
  21705. this.predefined = predefined;
  21706. this.format = format;
  21707. this.charset = charset;
  21708. this.raw = raw;
  21709. }
  21710. return CFFCharset;
  21711. }();
  21712. var CFFEncoding = function CFFEncodingClosure() {
  21713. function CFFEncoding(predefined, format, encoding, raw) {
  21714. this.predefined = predefined;
  21715. this.format = format;
  21716. this.encoding = encoding;
  21717. this.raw = raw;
  21718. }
  21719. return CFFEncoding;
  21720. }();
  21721. var CFFFDSelect = function CFFFDSelectClosure() {
  21722. function CFFFDSelect(fdSelect, raw) {
  21723. this.fdSelect = fdSelect;
  21724. this.raw = raw;
  21725. }
  21726. CFFFDSelect.prototype = {
  21727. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  21728. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21729. return -1;
  21730. }
  21731. return this.fdSelect[glyphIndex];
  21732. }
  21733. };
  21734. return CFFFDSelect;
  21735. }();
  21736. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  21737. function CFFOffsetTracker() {
  21738. this.offsets = Object.create(null);
  21739. }
  21740. CFFOffsetTracker.prototype = {
  21741. isTracking: function CFFOffsetTracker_isTracking(key) {
  21742. return key in this.offsets;
  21743. },
  21744. track: function CFFOffsetTracker_track(key, location) {
  21745. if (key in this.offsets) {
  21746. error('Already tracking location of ' + key);
  21747. }
  21748. this.offsets[key] = location;
  21749. },
  21750. offset: function CFFOffsetTracker_offset(value) {
  21751. for (var key in this.offsets) {
  21752. this.offsets[key] += value;
  21753. }
  21754. },
  21755. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  21756. if (!(key in this.offsets)) {
  21757. error('Not tracking location of ' + key);
  21758. }
  21759. var data = output.data;
  21760. var dataOffset = this.offsets[key];
  21761. var size = 5;
  21762. for (var i = 0, ii = values.length; i < ii; ++i) {
  21763. var offset0 = i * size + dataOffset;
  21764. var offset1 = offset0 + 1;
  21765. var offset2 = offset0 + 2;
  21766. var offset3 = offset0 + 3;
  21767. var offset4 = offset0 + 4;
  21768. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  21769. error('writing to an offset that is not empty');
  21770. }
  21771. var value = values[i];
  21772. data[offset0] = 0x1d;
  21773. data[offset1] = value >> 24 & 0xFF;
  21774. data[offset2] = value >> 16 & 0xFF;
  21775. data[offset3] = value >> 8 & 0xFF;
  21776. data[offset4] = value & 0xFF;
  21777. }
  21778. }
  21779. };
  21780. return CFFOffsetTracker;
  21781. }();
  21782. var CFFCompiler = function CFFCompilerClosure() {
  21783. function CFFCompiler(cff) {
  21784. this.cff = cff;
  21785. }
  21786. CFFCompiler.prototype = {
  21787. compile: function CFFCompiler_compile() {
  21788. var cff = this.cff;
  21789. var output = {
  21790. data: [],
  21791. length: 0,
  21792. add: function CFFCompiler_add(data) {
  21793. this.data = this.data.concat(data);
  21794. this.length = this.data.length;
  21795. }
  21796. };
  21797. var header = this.compileHeader(cff.header);
  21798. output.add(header);
  21799. var nameIndex = this.compileNameIndex(cff.names);
  21800. output.add(nameIndex);
  21801. if (cff.isCIDFont) {
  21802. if (cff.topDict.hasName('FontMatrix')) {
  21803. var base = cff.topDict.getByName('FontMatrix');
  21804. cff.topDict.removeByName('FontMatrix');
  21805. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  21806. var subDict = cff.fdArray[i];
  21807. var matrix = base.slice(0);
  21808. if (subDict.hasName('FontMatrix')) {
  21809. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  21810. }
  21811. subDict.setByName('FontMatrix', matrix);
  21812. }
  21813. }
  21814. }
  21815. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  21816. output.add(compiled.output);
  21817. var topDictTracker = compiled.trackers[0];
  21818. var stringIndex = this.compileStringIndex(cff.strings.strings);
  21819. output.add(stringIndex);
  21820. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  21821. output.add(globalSubrIndex);
  21822. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  21823. if (cff.encoding.predefined) {
  21824. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  21825. } else {
  21826. var encoding = this.compileEncoding(cff.encoding);
  21827. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  21828. output.add(encoding);
  21829. }
  21830. }
  21831. if (cff.charset && cff.topDict.hasName('charset')) {
  21832. if (cff.charset.predefined) {
  21833. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21834. } else {
  21835. var charset = this.compileCharset(cff.charset);
  21836. topDictTracker.setEntryLocation('charset', [output.length], output);
  21837. output.add(charset);
  21838. }
  21839. }
  21840. var charStrings = this.compileCharStrings(cff.charStrings);
  21841. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21842. output.add(charStrings);
  21843. if (cff.isCIDFont) {
  21844. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21845. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21846. output.add(fdSelect);
  21847. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21848. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21849. output.add(compiled.output);
  21850. var fontDictTrackers = compiled.trackers;
  21851. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21852. }
  21853. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21854. output.add([0]);
  21855. return output.data;
  21856. },
  21857. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21858. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21859. return this.encodeInteger(value);
  21860. }
  21861. return this.encodeFloat(value);
  21862. },
  21863. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21864. var value = num.toString();
  21865. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21866. if (m) {
  21867. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21868. value = (Math.round(num * epsilon) / epsilon).toString();
  21869. }
  21870. var nibbles = '';
  21871. var i, ii;
  21872. for (i = 0, ii = value.length; i < ii; ++i) {
  21873. var a = value[i];
  21874. if (a === 'e') {
  21875. nibbles += value[++i] === '-' ? 'c' : 'b';
  21876. } else if (a === '.') {
  21877. nibbles += 'a';
  21878. } else if (a === '-') {
  21879. nibbles += 'e';
  21880. } else {
  21881. nibbles += a;
  21882. }
  21883. }
  21884. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21885. var out = [30];
  21886. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21887. out.push(parseInt(nibbles.substr(i, 2), 16));
  21888. }
  21889. return out;
  21890. },
  21891. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21892. var code;
  21893. if (value >= -107 && value <= 107) {
  21894. code = [value + 139];
  21895. } else if (value >= 108 && value <= 1131) {
  21896. value = value - 108;
  21897. code = [
  21898. (value >> 8) + 247,
  21899. value & 0xFF
  21900. ];
  21901. } else if (value >= -1131 && value <= -108) {
  21902. value = -value - 108;
  21903. code = [
  21904. (value >> 8) + 251,
  21905. value & 0xFF
  21906. ];
  21907. } else if (value >= -32768 && value <= 32767) {
  21908. code = [
  21909. 0x1c,
  21910. value >> 8 & 0xFF,
  21911. value & 0xFF
  21912. ];
  21913. } else {
  21914. code = [
  21915. 0x1d,
  21916. value >> 24 & 0xFF,
  21917. value >> 16 & 0xFF,
  21918. value >> 8 & 0xFF,
  21919. value & 0xFF
  21920. ];
  21921. }
  21922. return code;
  21923. },
  21924. compileHeader: function CFFCompiler_compileHeader(header) {
  21925. return [
  21926. header.major,
  21927. header.minor,
  21928. header.hdrSize,
  21929. header.offSize
  21930. ];
  21931. },
  21932. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21933. var nameIndex = new CFFIndex();
  21934. for (var i = 0, ii = names.length; i < ii; ++i) {
  21935. nameIndex.add(stringToBytes(names[i]));
  21936. }
  21937. return this.compileIndex(nameIndex);
  21938. },
  21939. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21940. var fontDictTrackers = [];
  21941. var fdArrayIndex = new CFFIndex();
  21942. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21943. var fontDict = dicts[i];
  21944. if (removeCidKeys) {
  21945. fontDict.removeByName('CIDFontVersion');
  21946. fontDict.removeByName('CIDFontRevision');
  21947. fontDict.removeByName('CIDFontType');
  21948. fontDict.removeByName('CIDCount');
  21949. fontDict.removeByName('UIDBase');
  21950. }
  21951. var fontDictTracker = new CFFOffsetTracker();
  21952. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21953. fontDictTrackers.push(fontDictTracker);
  21954. fdArrayIndex.add(fontDictData);
  21955. fontDictTracker.offset(length);
  21956. }
  21957. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21958. return {
  21959. trackers: fontDictTrackers,
  21960. output: fdArrayIndex
  21961. };
  21962. },
  21963. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21964. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21965. var fontDict = dicts[i];
  21966. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21967. var privateDict = fontDict.privateDict;
  21968. var privateDictTracker = new CFFOffsetTracker();
  21969. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21970. var outputLength = output.length;
  21971. privateDictTracker.offset(outputLength);
  21972. if (!privateDictData.length) {
  21973. outputLength = 0;
  21974. }
  21975. trackers[i].setEntryLocation('Private', [
  21976. privateDictData.length,
  21977. outputLength
  21978. ], output);
  21979. output.add(privateDictData);
  21980. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21981. var subrs = this.compileIndex(privateDict.subrsIndex);
  21982. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21983. output.add(subrs);
  21984. }
  21985. }
  21986. },
  21987. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21988. var out = [];
  21989. var order = dict.order;
  21990. for (var i = 0; i < order.length; ++i) {
  21991. var key = order[i];
  21992. if (!(key in dict.values)) {
  21993. continue;
  21994. }
  21995. var values = dict.values[key];
  21996. var types = dict.types[key];
  21997. if (!isArray(types)) {
  21998. types = [types];
  21999. }
  22000. if (!isArray(values)) {
  22001. values = [values];
  22002. }
  22003. if (values.length === 0) {
  22004. continue;
  22005. }
  22006. for (var j = 0, jj = types.length; j < jj; ++j) {
  22007. var type = types[j];
  22008. var value = values[j];
  22009. switch (type) {
  22010. case 'num':
  22011. case 'sid':
  22012. out = out.concat(this.encodeNumber(value));
  22013. break;
  22014. case 'offset':
  22015. var name = dict.keyToNameMap[key];
  22016. if (!offsetTracker.isTracking(name)) {
  22017. offsetTracker.track(name, out.length);
  22018. }
  22019. out = out.concat([
  22020. 0x1d,
  22021. 0,
  22022. 0,
  22023. 0,
  22024. 0
  22025. ]);
  22026. break;
  22027. case 'array':
  22028. case 'delta':
  22029. out = out.concat(this.encodeNumber(value));
  22030. for (var k = 1, kk = values.length; k < kk; ++k) {
  22031. out = out.concat(this.encodeNumber(values[k]));
  22032. }
  22033. break;
  22034. default:
  22035. error('Unknown data type of ' + type);
  22036. break;
  22037. }
  22038. }
  22039. out = out.concat(dict.opcodes[key]);
  22040. }
  22041. return out;
  22042. },
  22043. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  22044. var stringIndex = new CFFIndex();
  22045. for (var i = 0, ii = strings.length; i < ii; ++i) {
  22046. stringIndex.add(stringToBytes(strings[i]));
  22047. }
  22048. return this.compileIndex(stringIndex);
  22049. },
  22050. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  22051. var globalSubrIndex = this.cff.globalSubrIndex;
  22052. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  22053. },
  22054. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  22055. return this.compileIndex(charStrings);
  22056. },
  22057. compileCharset: function CFFCompiler_compileCharset(charset) {
  22058. return this.compileTypedArray(charset.raw);
  22059. },
  22060. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  22061. return this.compileTypedArray(encoding.raw);
  22062. },
  22063. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  22064. return this.compileTypedArray(fdSelect);
  22065. },
  22066. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  22067. var out = [];
  22068. for (var i = 0, ii = data.length; i < ii; ++i) {
  22069. out[i] = data[i];
  22070. }
  22071. return out;
  22072. },
  22073. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  22074. trackers = trackers || [];
  22075. var objects = index.objects;
  22076. var count = objects.length;
  22077. if (count === 0) {
  22078. return [
  22079. 0,
  22080. 0,
  22081. 0
  22082. ];
  22083. }
  22084. var data = [
  22085. count >> 8 & 0xFF,
  22086. count & 0xff
  22087. ];
  22088. var lastOffset = 1, i;
  22089. for (i = 0; i < count; ++i) {
  22090. lastOffset += objects[i].length;
  22091. }
  22092. var offsetSize;
  22093. if (lastOffset < 0x100) {
  22094. offsetSize = 1;
  22095. } else if (lastOffset < 0x10000) {
  22096. offsetSize = 2;
  22097. } else if (lastOffset < 0x1000000) {
  22098. offsetSize = 3;
  22099. } else {
  22100. offsetSize = 4;
  22101. }
  22102. data.push(offsetSize);
  22103. var relativeOffset = 1;
  22104. for (i = 0; i < count + 1; i++) {
  22105. if (offsetSize === 1) {
  22106. data.push(relativeOffset & 0xFF);
  22107. } else if (offsetSize === 2) {
  22108. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22109. } else if (offsetSize === 3) {
  22110. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22111. } else {
  22112. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22113. }
  22114. if (objects[i]) {
  22115. relativeOffset += objects[i].length;
  22116. }
  22117. }
  22118. for (i = 0; i < count; i++) {
  22119. if (trackers[i]) {
  22120. trackers[i].offset(data.length);
  22121. }
  22122. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  22123. data.push(objects[i][j]);
  22124. }
  22125. }
  22126. return data;
  22127. }
  22128. };
  22129. return CFFCompiler;
  22130. }();
  22131. exports.CFFStandardStrings = CFFStandardStrings;
  22132. exports.CFFParser = CFFParser;
  22133. exports.CFF = CFF;
  22134. exports.CFFHeader = CFFHeader;
  22135. exports.CFFStrings = CFFStrings;
  22136. exports.CFFIndex = CFFIndex;
  22137. exports.CFFCharset = CFFCharset;
  22138. exports.CFFTopDict = CFFTopDict;
  22139. exports.CFFPrivateDict = CFFPrivateDict;
  22140. exports.CFFCompiler = CFFCompiler;
  22141. /***/ }),
  22142. /* 11 */
  22143. /***/ (function(module, exports, __w_pdfjs_require__) {
  22144. "use strict";
  22145. var sharedUtil = __w_pdfjs_require__(0);
  22146. var MissingDataException = sharedUtil.MissingDataException;
  22147. var arrayByteLength = sharedUtil.arrayByteLength;
  22148. var arraysToBytes = sharedUtil.arraysToBytes;
  22149. var assert = sharedUtil.assert;
  22150. var createPromiseCapability = sharedUtil.createPromiseCapability;
  22151. var isInt = sharedUtil.isInt;
  22152. var isEmptyObj = sharedUtil.isEmptyObj;
  22153. var ChunkedStream = function ChunkedStreamClosure() {
  22154. function ChunkedStream(length, chunkSize, manager) {
  22155. this.bytes = new Uint8Array(length);
  22156. this.start = 0;
  22157. this.pos = 0;
  22158. this.end = length;
  22159. this.chunkSize = chunkSize;
  22160. this.loadedChunks = [];
  22161. this.numChunksLoaded = 0;
  22162. this.numChunks = Math.ceil(length / chunkSize);
  22163. this.manager = manager;
  22164. this.progressiveDataLength = 0;
  22165. this.lastSuccessfulEnsureByteChunk = -1;
  22166. }
  22167. ChunkedStream.prototype = {
  22168. getMissingChunks: function ChunkedStream_getMissingChunks() {
  22169. var chunks = [];
  22170. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  22171. if (!this.loadedChunks[chunk]) {
  22172. chunks.push(chunk);
  22173. }
  22174. }
  22175. return chunks;
  22176. },
  22177. getBaseStreams: function ChunkedStream_getBaseStreams() {
  22178. return [this];
  22179. },
  22180. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  22181. return this.numChunksLoaded === this.numChunks;
  22182. },
  22183. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  22184. var end = begin + chunk.byteLength;
  22185. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  22186. var length = this.bytes.length;
  22187. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  22188. this.bytes.set(new Uint8Array(chunk), begin);
  22189. var chunkSize = this.chunkSize;
  22190. var beginChunk = Math.floor(begin / chunkSize);
  22191. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22192. var curChunk;
  22193. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22194. if (!this.loadedChunks[curChunk]) {
  22195. this.loadedChunks[curChunk] = true;
  22196. ++this.numChunksLoaded;
  22197. }
  22198. }
  22199. },
  22200. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  22201. var position = this.progressiveDataLength;
  22202. var beginChunk = Math.floor(position / this.chunkSize);
  22203. this.bytes.set(new Uint8Array(data), position);
  22204. position += data.byteLength;
  22205. this.progressiveDataLength = position;
  22206. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  22207. var curChunk;
  22208. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22209. if (!this.loadedChunks[curChunk]) {
  22210. this.loadedChunks[curChunk] = true;
  22211. ++this.numChunksLoaded;
  22212. }
  22213. }
  22214. },
  22215. ensureByte: function ChunkedStream_ensureByte(pos) {
  22216. var chunk = Math.floor(pos / this.chunkSize);
  22217. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  22218. return;
  22219. }
  22220. if (!this.loadedChunks[chunk]) {
  22221. throw new MissingDataException(pos, pos + 1);
  22222. }
  22223. this.lastSuccessfulEnsureByteChunk = chunk;
  22224. },
  22225. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  22226. if (begin >= end) {
  22227. return;
  22228. }
  22229. if (end <= this.progressiveDataLength) {
  22230. return;
  22231. }
  22232. var chunkSize = this.chunkSize;
  22233. var beginChunk = Math.floor(begin / chunkSize);
  22234. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22235. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22236. if (!this.loadedChunks[chunk]) {
  22237. throw new MissingDataException(begin, end);
  22238. }
  22239. }
  22240. },
  22241. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  22242. var chunk, numChunks = this.numChunks;
  22243. for (var i = 0; i < numChunks; ++i) {
  22244. chunk = (beginChunk + i) % numChunks;
  22245. if (!this.loadedChunks[chunk]) {
  22246. return chunk;
  22247. }
  22248. }
  22249. return null;
  22250. },
  22251. hasChunk: function ChunkedStream_hasChunk(chunk) {
  22252. return !!this.loadedChunks[chunk];
  22253. },
  22254. get length() {
  22255. return this.end - this.start;
  22256. },
  22257. get isEmpty() {
  22258. return this.length === 0;
  22259. },
  22260. getByte: function ChunkedStream_getByte() {
  22261. var pos = this.pos;
  22262. if (pos >= this.end) {
  22263. return -1;
  22264. }
  22265. this.ensureByte(pos);
  22266. return this.bytes[this.pos++];
  22267. },
  22268. getUint16: function ChunkedStream_getUint16() {
  22269. var b0 = this.getByte();
  22270. var b1 = this.getByte();
  22271. if (b0 === -1 || b1 === -1) {
  22272. return -1;
  22273. }
  22274. return (b0 << 8) + b1;
  22275. },
  22276. getInt32: function ChunkedStream_getInt32() {
  22277. var b0 = this.getByte();
  22278. var b1 = this.getByte();
  22279. var b2 = this.getByte();
  22280. var b3 = this.getByte();
  22281. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22282. },
  22283. getBytes: function ChunkedStream_getBytes(length) {
  22284. var bytes = this.bytes;
  22285. var pos = this.pos;
  22286. var strEnd = this.end;
  22287. if (!length) {
  22288. this.ensureRange(pos, strEnd);
  22289. return bytes.subarray(pos, strEnd);
  22290. }
  22291. var end = pos + length;
  22292. if (end > strEnd) {
  22293. end = strEnd;
  22294. }
  22295. this.ensureRange(pos, end);
  22296. this.pos = end;
  22297. return bytes.subarray(pos, end);
  22298. },
  22299. peekByte: function ChunkedStream_peekByte() {
  22300. var peekedByte = this.getByte();
  22301. this.pos--;
  22302. return peekedByte;
  22303. },
  22304. peekBytes: function ChunkedStream_peekBytes(length) {
  22305. var bytes = this.getBytes(length);
  22306. this.pos -= bytes.length;
  22307. return bytes;
  22308. },
  22309. getByteRange: function ChunkedStream_getBytes(begin, end) {
  22310. this.ensureRange(begin, end);
  22311. return this.bytes.subarray(begin, end);
  22312. },
  22313. skip: function ChunkedStream_skip(n) {
  22314. if (!n) {
  22315. n = 1;
  22316. }
  22317. this.pos += n;
  22318. },
  22319. reset: function ChunkedStream_reset() {
  22320. this.pos = this.start;
  22321. },
  22322. moveStart: function ChunkedStream_moveStart() {
  22323. this.start = this.pos;
  22324. },
  22325. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  22326. this.ensureRange(start, start + length);
  22327. function ChunkedStreamSubstream() {
  22328. }
  22329. ChunkedStreamSubstream.prototype = Object.create(this);
  22330. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  22331. var chunkSize = this.chunkSize;
  22332. var beginChunk = Math.floor(this.start / chunkSize);
  22333. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  22334. var missingChunks = [];
  22335. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22336. if (!this.loadedChunks[chunk]) {
  22337. missingChunks.push(chunk);
  22338. }
  22339. }
  22340. return missingChunks;
  22341. };
  22342. var subStream = new ChunkedStreamSubstream();
  22343. subStream.pos = subStream.start = start;
  22344. subStream.end = start + length || this.end;
  22345. subStream.dict = dict;
  22346. return subStream;
  22347. }
  22348. };
  22349. return ChunkedStream;
  22350. }();
  22351. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  22352. function ChunkedStreamManager(pdfNetworkStream, args) {
  22353. var chunkSize = args.rangeChunkSize;
  22354. var length = args.length;
  22355. this.stream = new ChunkedStream(length, chunkSize, this);
  22356. this.length = length;
  22357. this.chunkSize = chunkSize;
  22358. this.pdfNetworkStream = pdfNetworkStream;
  22359. this.url = args.url;
  22360. this.disableAutoFetch = args.disableAutoFetch;
  22361. this.msgHandler = args.msgHandler;
  22362. this.currRequestId = 0;
  22363. this.chunksNeededByRequest = Object.create(null);
  22364. this.requestsByChunk = Object.create(null);
  22365. this.promisesByRequest = Object.create(null);
  22366. this.progressiveDataLength = 0;
  22367. this.aborted = false;
  22368. this._loadedStreamCapability = createPromiseCapability();
  22369. }
  22370. ChunkedStreamManager.prototype = {
  22371. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  22372. return this._loadedStreamCapability.promise;
  22373. },
  22374. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  22375. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  22376. if (!rangeReader.isStreamingSupported) {
  22377. rangeReader.onProgress = this.onProgress.bind(this);
  22378. }
  22379. var chunks = [], loaded = 0;
  22380. var manager = this;
  22381. var promise = new Promise(function (resolve, reject) {
  22382. var readChunk = function (chunk) {
  22383. try {
  22384. if (!chunk.done) {
  22385. var data = chunk.value;
  22386. chunks.push(data);
  22387. loaded += arrayByteLength(data);
  22388. if (rangeReader.isStreamingSupported) {
  22389. manager.onProgress({ loaded: loaded });
  22390. }
  22391. rangeReader.read().then(readChunk, reject);
  22392. return;
  22393. }
  22394. var chunkData = arraysToBytes(chunks);
  22395. chunks = null;
  22396. resolve(chunkData);
  22397. } catch (e) {
  22398. reject(e);
  22399. }
  22400. };
  22401. rangeReader.read().then(readChunk, reject);
  22402. });
  22403. promise.then(function (data) {
  22404. if (this.aborted) {
  22405. return;
  22406. }
  22407. this.onReceiveData({
  22408. chunk: data,
  22409. begin: begin
  22410. });
  22411. }.bind(this));
  22412. },
  22413. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  22414. var missingChunks = this.stream.getMissingChunks();
  22415. this._requestChunks(missingChunks);
  22416. return this._loadedStreamCapability.promise;
  22417. },
  22418. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  22419. var requestId = this.currRequestId++;
  22420. var i, ii;
  22421. var chunksNeeded = Object.create(null);
  22422. this.chunksNeededByRequest[requestId] = chunksNeeded;
  22423. for (i = 0, ii = chunks.length; i < ii; i++) {
  22424. if (!this.stream.hasChunk(chunks[i])) {
  22425. chunksNeeded[chunks[i]] = true;
  22426. }
  22427. }
  22428. if (isEmptyObj(chunksNeeded)) {
  22429. return Promise.resolve();
  22430. }
  22431. var capability = createPromiseCapability();
  22432. this.promisesByRequest[requestId] = capability;
  22433. var chunksToRequest = [];
  22434. for (var chunk in chunksNeeded) {
  22435. chunk = chunk | 0;
  22436. if (!(chunk in this.requestsByChunk)) {
  22437. this.requestsByChunk[chunk] = [];
  22438. chunksToRequest.push(chunk);
  22439. }
  22440. this.requestsByChunk[chunk].push(requestId);
  22441. }
  22442. if (!chunksToRequest.length) {
  22443. return capability.promise;
  22444. }
  22445. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  22446. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  22447. var groupedChunk = groupedChunksToRequest[i];
  22448. var begin = groupedChunk.beginChunk * this.chunkSize;
  22449. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  22450. this.sendRequest(begin, end);
  22451. }
  22452. return capability.promise;
  22453. },
  22454. getStream: function ChunkedStreamManager_getStream() {
  22455. return this.stream;
  22456. },
  22457. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  22458. end = Math.min(end, this.length);
  22459. var beginChunk = this.getBeginChunk(begin);
  22460. var endChunk = this.getEndChunk(end);
  22461. var chunks = [];
  22462. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22463. chunks.push(chunk);
  22464. }
  22465. return this._requestChunks(chunks);
  22466. },
  22467. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  22468. ranges = ranges || [];
  22469. var chunksToRequest = [];
  22470. for (var i = 0; i < ranges.length; i++) {
  22471. var beginChunk = this.getBeginChunk(ranges[i].begin);
  22472. var endChunk = this.getEndChunk(ranges[i].end);
  22473. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22474. if (chunksToRequest.indexOf(chunk) < 0) {
  22475. chunksToRequest.push(chunk);
  22476. }
  22477. }
  22478. }
  22479. chunksToRequest.sort(function (a, b) {
  22480. return a - b;
  22481. });
  22482. return this._requestChunks(chunksToRequest);
  22483. },
  22484. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  22485. var groupedChunks = [];
  22486. var beginChunk = -1;
  22487. var prevChunk = -1;
  22488. for (var i = 0; i < chunks.length; ++i) {
  22489. var chunk = chunks[i];
  22490. if (beginChunk < 0) {
  22491. beginChunk = chunk;
  22492. }
  22493. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  22494. groupedChunks.push({
  22495. beginChunk: beginChunk,
  22496. endChunk: prevChunk + 1
  22497. });
  22498. beginChunk = chunk;
  22499. }
  22500. if (i + 1 === chunks.length) {
  22501. groupedChunks.push({
  22502. beginChunk: beginChunk,
  22503. endChunk: chunk + 1
  22504. });
  22505. }
  22506. prevChunk = chunk;
  22507. }
  22508. return groupedChunks;
  22509. },
  22510. onProgress: function ChunkedStreamManager_onProgress(args) {
  22511. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  22512. this.msgHandler.send('DocProgress', {
  22513. loaded: bytesLoaded,
  22514. total: this.length
  22515. });
  22516. },
  22517. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  22518. var chunk = args.chunk;
  22519. var isProgressive = args.begin === undefined;
  22520. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  22521. var end = begin + chunk.byteLength;
  22522. var beginChunk = Math.floor(begin / this.chunkSize);
  22523. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  22524. if (isProgressive) {
  22525. this.stream.onReceiveProgressiveData(chunk);
  22526. this.progressiveDataLength = end;
  22527. } else {
  22528. this.stream.onReceiveData(begin, chunk);
  22529. }
  22530. if (this.stream.allChunksLoaded()) {
  22531. this._loadedStreamCapability.resolve(this.stream);
  22532. }
  22533. var loadedRequests = [];
  22534. var i, requestId;
  22535. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  22536. var requestIds = this.requestsByChunk[chunk] || [];
  22537. delete this.requestsByChunk[chunk];
  22538. for (i = 0; i < requestIds.length; ++i) {
  22539. requestId = requestIds[i];
  22540. var chunksNeeded = this.chunksNeededByRequest[requestId];
  22541. if (chunk in chunksNeeded) {
  22542. delete chunksNeeded[chunk];
  22543. }
  22544. if (!isEmptyObj(chunksNeeded)) {
  22545. continue;
  22546. }
  22547. loadedRequests.push(requestId);
  22548. }
  22549. }
  22550. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  22551. var nextEmptyChunk;
  22552. if (this.stream.numChunksLoaded === 1) {
  22553. var lastChunk = this.stream.numChunks - 1;
  22554. if (!this.stream.hasChunk(lastChunk)) {
  22555. nextEmptyChunk = lastChunk;
  22556. }
  22557. } else {
  22558. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  22559. }
  22560. if (isInt(nextEmptyChunk)) {
  22561. this._requestChunks([nextEmptyChunk]);
  22562. }
  22563. }
  22564. for (i = 0; i < loadedRequests.length; ++i) {
  22565. requestId = loadedRequests[i];
  22566. var capability = this.promisesByRequest[requestId];
  22567. delete this.promisesByRequest[requestId];
  22568. capability.resolve();
  22569. }
  22570. this.msgHandler.send('DocProgress', {
  22571. loaded: this.stream.numChunksLoaded * this.chunkSize,
  22572. total: this.length
  22573. });
  22574. },
  22575. onError: function ChunkedStreamManager_onError(err) {
  22576. this._loadedStreamCapability.reject(err);
  22577. },
  22578. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  22579. var chunk = Math.floor(begin / this.chunkSize);
  22580. return chunk;
  22581. },
  22582. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  22583. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  22584. return chunk;
  22585. },
  22586. abort: function ChunkedStreamManager_abort() {
  22587. this.aborted = true;
  22588. if (this.pdfNetworkStream) {
  22589. this.pdfNetworkStream.cancelAllRequests('abort');
  22590. }
  22591. for (var requestId in this.promisesByRequest) {
  22592. var capability = this.promisesByRequest[requestId];
  22593. capability.reject(new Error('Request was aborted'));
  22594. }
  22595. }
  22596. };
  22597. return ChunkedStreamManager;
  22598. }();
  22599. exports.ChunkedStream = ChunkedStream;
  22600. exports.ChunkedStreamManager = ChunkedStreamManager;
  22601. /***/ }),
  22602. /* 12 */
  22603. /***/ (function(module, exports, __w_pdfjs_require__) {
  22604. "use strict";
  22605. var sharedUtil = __w_pdfjs_require__(0);
  22606. var corePrimitives = __w_pdfjs_require__(1);
  22607. var coreStream = __w_pdfjs_require__(2);
  22608. var PasswordException = sharedUtil.PasswordException;
  22609. var PasswordResponses = sharedUtil.PasswordResponses;
  22610. var bytesToString = sharedUtil.bytesToString;
  22611. var warn = sharedUtil.warn;
  22612. var error = sharedUtil.error;
  22613. var assert = sharedUtil.assert;
  22614. var isInt = sharedUtil.isInt;
  22615. var stringToBytes = sharedUtil.stringToBytes;
  22616. var utf8StringToString = sharedUtil.utf8StringToString;
  22617. var Name = corePrimitives.Name;
  22618. var isName = corePrimitives.isName;
  22619. var isDict = corePrimitives.isDict;
  22620. var DecryptStream = coreStream.DecryptStream;
  22621. var ARCFourCipher = function ARCFourCipherClosure() {
  22622. function ARCFourCipher(key) {
  22623. this.a = 0;
  22624. this.b = 0;
  22625. var s = new Uint8Array(256);
  22626. var i, j = 0, tmp, keyLength = key.length;
  22627. for (i = 0; i < 256; ++i) {
  22628. s[i] = i;
  22629. }
  22630. for (i = 0; i < 256; ++i) {
  22631. tmp = s[i];
  22632. j = j + tmp + key[i % keyLength] & 0xFF;
  22633. s[i] = s[j];
  22634. s[j] = tmp;
  22635. }
  22636. this.s = s;
  22637. }
  22638. ARCFourCipher.prototype = {
  22639. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  22640. var i, n = data.length, tmp, tmp2;
  22641. var a = this.a, b = this.b, s = this.s;
  22642. var output = new Uint8Array(n);
  22643. for (i = 0; i < n; ++i) {
  22644. a = a + 1 & 0xFF;
  22645. tmp = s[a];
  22646. b = b + tmp & 0xFF;
  22647. tmp2 = s[b];
  22648. s[a] = tmp2;
  22649. s[b] = tmp;
  22650. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  22651. }
  22652. this.a = a;
  22653. this.b = b;
  22654. return output;
  22655. }
  22656. };
  22657. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  22658. return ARCFourCipher;
  22659. }();
  22660. var calculateMD5 = function calculateMD5Closure() {
  22661. var r = new Uint8Array([
  22662. 7,
  22663. 12,
  22664. 17,
  22665. 22,
  22666. 7,
  22667. 12,
  22668. 17,
  22669. 22,
  22670. 7,
  22671. 12,
  22672. 17,
  22673. 22,
  22674. 7,
  22675. 12,
  22676. 17,
  22677. 22,
  22678. 5,
  22679. 9,
  22680. 14,
  22681. 20,
  22682. 5,
  22683. 9,
  22684. 14,
  22685. 20,
  22686. 5,
  22687. 9,
  22688. 14,
  22689. 20,
  22690. 5,
  22691. 9,
  22692. 14,
  22693. 20,
  22694. 4,
  22695. 11,
  22696. 16,
  22697. 23,
  22698. 4,
  22699. 11,
  22700. 16,
  22701. 23,
  22702. 4,
  22703. 11,
  22704. 16,
  22705. 23,
  22706. 4,
  22707. 11,
  22708. 16,
  22709. 23,
  22710. 6,
  22711. 10,
  22712. 15,
  22713. 21,
  22714. 6,
  22715. 10,
  22716. 15,
  22717. 21,
  22718. 6,
  22719. 10,
  22720. 15,
  22721. 21,
  22722. 6,
  22723. 10,
  22724. 15,
  22725. 21
  22726. ]);
  22727. var k = new Int32Array([
  22728. -680876936,
  22729. -389564586,
  22730. 606105819,
  22731. -1044525330,
  22732. -176418897,
  22733. 1200080426,
  22734. -1473231341,
  22735. -45705983,
  22736. 1770035416,
  22737. -1958414417,
  22738. -42063,
  22739. -1990404162,
  22740. 1804603682,
  22741. -40341101,
  22742. -1502002290,
  22743. 1236535329,
  22744. -165796510,
  22745. -1069501632,
  22746. 643717713,
  22747. -373897302,
  22748. -701558691,
  22749. 38016083,
  22750. -660478335,
  22751. -405537848,
  22752. 568446438,
  22753. -1019803690,
  22754. -187363961,
  22755. 1163531501,
  22756. -1444681467,
  22757. -51403784,
  22758. 1735328473,
  22759. -1926607734,
  22760. -378558,
  22761. -2022574463,
  22762. 1839030562,
  22763. -35309556,
  22764. -1530992060,
  22765. 1272893353,
  22766. -155497632,
  22767. -1094730640,
  22768. 681279174,
  22769. -358537222,
  22770. -722521979,
  22771. 76029189,
  22772. -640364487,
  22773. -421815835,
  22774. 530742520,
  22775. -995338651,
  22776. -198630844,
  22777. 1126891415,
  22778. -1416354905,
  22779. -57434055,
  22780. 1700485571,
  22781. -1894986606,
  22782. -1051523,
  22783. -2054922799,
  22784. 1873313359,
  22785. -30611744,
  22786. -1560198380,
  22787. 1309151649,
  22788. -145523070,
  22789. -1120210379,
  22790. 718787259,
  22791. -343485551
  22792. ]);
  22793. function hash(data, offset, length) {
  22794. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  22795. var paddedLength = length + 72 & ~63;
  22796. var padded = new Uint8Array(paddedLength);
  22797. var i, j, n;
  22798. for (i = 0; i < length; ++i) {
  22799. padded[i] = data[offset++];
  22800. }
  22801. padded[i++] = 0x80;
  22802. n = paddedLength - 8;
  22803. while (i < n) {
  22804. padded[i++] = 0;
  22805. }
  22806. padded[i++] = length << 3 & 0xFF;
  22807. padded[i++] = length >> 5 & 0xFF;
  22808. padded[i++] = length >> 13 & 0xFF;
  22809. padded[i++] = length >> 21 & 0xFF;
  22810. padded[i++] = length >>> 29 & 0xFF;
  22811. padded[i++] = 0;
  22812. padded[i++] = 0;
  22813. padded[i++] = 0;
  22814. var w = new Int32Array(16);
  22815. for (i = 0; i < paddedLength;) {
  22816. for (j = 0; j < 16; ++j, i += 4) {
  22817. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  22818. }
  22819. var a = h0, b = h1, c = h2, d = h3, f, g;
  22820. for (j = 0; j < 64; ++j) {
  22821. if (j < 16) {
  22822. f = b & c | ~b & d;
  22823. g = j;
  22824. } else if (j < 32) {
  22825. f = d & b | ~d & c;
  22826. g = 5 * j + 1 & 15;
  22827. } else if (j < 48) {
  22828. f = b ^ c ^ d;
  22829. g = 3 * j + 5 & 15;
  22830. } else {
  22831. f = c ^ (b | ~d);
  22832. g = 7 * j & 15;
  22833. }
  22834. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22835. d = c;
  22836. c = b;
  22837. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22838. a = tmp;
  22839. }
  22840. h0 = h0 + a | 0;
  22841. h1 = h1 + b | 0;
  22842. h2 = h2 + c | 0;
  22843. h3 = h3 + d | 0;
  22844. }
  22845. return new Uint8Array([
  22846. h0 & 0xFF,
  22847. h0 >> 8 & 0xFF,
  22848. h0 >> 16 & 0xFF,
  22849. h0 >>> 24 & 0xFF,
  22850. h1 & 0xFF,
  22851. h1 >> 8 & 0xFF,
  22852. h1 >> 16 & 0xFF,
  22853. h1 >>> 24 & 0xFF,
  22854. h2 & 0xFF,
  22855. h2 >> 8 & 0xFF,
  22856. h2 >> 16 & 0xFF,
  22857. h2 >>> 24 & 0xFF,
  22858. h3 & 0xFF,
  22859. h3 >> 8 & 0xFF,
  22860. h3 >> 16 & 0xFF,
  22861. h3 >>> 24 & 0xFF
  22862. ]);
  22863. }
  22864. return hash;
  22865. }();
  22866. var Word64 = function Word64Closure() {
  22867. function Word64(highInteger, lowInteger) {
  22868. this.high = highInteger | 0;
  22869. this.low = lowInteger | 0;
  22870. }
  22871. Word64.prototype = {
  22872. and: function Word64_and(word) {
  22873. this.high &= word.high;
  22874. this.low &= word.low;
  22875. },
  22876. xor: function Word64_xor(word) {
  22877. this.high ^= word.high;
  22878. this.low ^= word.low;
  22879. },
  22880. or: function Word64_or(word) {
  22881. this.high |= word.high;
  22882. this.low |= word.low;
  22883. },
  22884. shiftRight: function Word64_shiftRight(places) {
  22885. if (places >= 32) {
  22886. this.low = this.high >>> places - 32 | 0;
  22887. this.high = 0;
  22888. } else {
  22889. this.low = this.low >>> places | this.high << 32 - places;
  22890. this.high = this.high >>> places | 0;
  22891. }
  22892. },
  22893. shiftLeft: function Word64_shiftLeft(places) {
  22894. if (places >= 32) {
  22895. this.high = this.low << places - 32;
  22896. this.low = 0;
  22897. } else {
  22898. this.high = this.high << places | this.low >>> 32 - places;
  22899. this.low = this.low << places;
  22900. }
  22901. },
  22902. rotateRight: function Word64_rotateRight(places) {
  22903. var low, high;
  22904. if (places & 32) {
  22905. high = this.low;
  22906. low = this.high;
  22907. } else {
  22908. low = this.low;
  22909. high = this.high;
  22910. }
  22911. places &= 31;
  22912. this.low = low >>> places | high << 32 - places;
  22913. this.high = high >>> places | low << 32 - places;
  22914. },
  22915. not: function Word64_not() {
  22916. this.high = ~this.high;
  22917. this.low = ~this.low;
  22918. },
  22919. add: function Word64_add(word) {
  22920. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22921. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22922. if (lowAdd > 0xFFFFFFFF) {
  22923. highAdd += 1;
  22924. }
  22925. this.low = lowAdd | 0;
  22926. this.high = highAdd | 0;
  22927. },
  22928. copyTo: function Word64_copyTo(bytes, offset) {
  22929. bytes[offset] = this.high >>> 24 & 0xFF;
  22930. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22931. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22932. bytes[offset + 3] = this.high & 0xFF;
  22933. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22934. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22935. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22936. bytes[offset + 7] = this.low & 0xFF;
  22937. },
  22938. assign: function Word64_assign(word) {
  22939. this.high = word.high;
  22940. this.low = word.low;
  22941. }
  22942. };
  22943. return Word64;
  22944. }();
  22945. var calculateSHA256 = function calculateSHA256Closure() {
  22946. function rotr(x, n) {
  22947. return x >>> n | x << 32 - n;
  22948. }
  22949. function ch(x, y, z) {
  22950. return x & y ^ ~x & z;
  22951. }
  22952. function maj(x, y, z) {
  22953. return x & y ^ x & z ^ y & z;
  22954. }
  22955. function sigma(x) {
  22956. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22957. }
  22958. function sigmaPrime(x) {
  22959. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22960. }
  22961. function littleSigma(x) {
  22962. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22963. }
  22964. function littleSigmaPrime(x) {
  22965. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22966. }
  22967. var k = [
  22968. 0x428a2f98,
  22969. 0x71374491,
  22970. 0xb5c0fbcf,
  22971. 0xe9b5dba5,
  22972. 0x3956c25b,
  22973. 0x59f111f1,
  22974. 0x923f82a4,
  22975. 0xab1c5ed5,
  22976. 0xd807aa98,
  22977. 0x12835b01,
  22978. 0x243185be,
  22979. 0x550c7dc3,
  22980. 0x72be5d74,
  22981. 0x80deb1fe,
  22982. 0x9bdc06a7,
  22983. 0xc19bf174,
  22984. 0xe49b69c1,
  22985. 0xefbe4786,
  22986. 0x0fc19dc6,
  22987. 0x240ca1cc,
  22988. 0x2de92c6f,
  22989. 0x4a7484aa,
  22990. 0x5cb0a9dc,
  22991. 0x76f988da,
  22992. 0x983e5152,
  22993. 0xa831c66d,
  22994. 0xb00327c8,
  22995. 0xbf597fc7,
  22996. 0xc6e00bf3,
  22997. 0xd5a79147,
  22998. 0x06ca6351,
  22999. 0x14292967,
  23000. 0x27b70a85,
  23001. 0x2e1b2138,
  23002. 0x4d2c6dfc,
  23003. 0x53380d13,
  23004. 0x650a7354,
  23005. 0x766a0abb,
  23006. 0x81c2c92e,
  23007. 0x92722c85,
  23008. 0xa2bfe8a1,
  23009. 0xa81a664b,
  23010. 0xc24b8b70,
  23011. 0xc76c51a3,
  23012. 0xd192e819,
  23013. 0xd6990624,
  23014. 0xf40e3585,
  23015. 0x106aa070,
  23016. 0x19a4c116,
  23017. 0x1e376c08,
  23018. 0x2748774c,
  23019. 0x34b0bcb5,
  23020. 0x391c0cb3,
  23021. 0x4ed8aa4a,
  23022. 0x5b9cca4f,
  23023. 0x682e6ff3,
  23024. 0x748f82ee,
  23025. 0x78a5636f,
  23026. 0x84c87814,
  23027. 0x8cc70208,
  23028. 0x90befffa,
  23029. 0xa4506ceb,
  23030. 0xbef9a3f7,
  23031. 0xc67178f2
  23032. ];
  23033. function hash(data, offset, length) {
  23034. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  23035. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  23036. var padded = new Uint8Array(paddedLength);
  23037. var i, j, n;
  23038. for (i = 0; i < length; ++i) {
  23039. padded[i] = data[offset++];
  23040. }
  23041. padded[i++] = 0x80;
  23042. n = paddedLength - 8;
  23043. while (i < n) {
  23044. padded[i++] = 0;
  23045. }
  23046. padded[i++] = 0;
  23047. padded[i++] = 0;
  23048. padded[i++] = 0;
  23049. padded[i++] = length >>> 29 & 0xFF;
  23050. padded[i++] = length >> 21 & 0xFF;
  23051. padded[i++] = length >> 13 & 0xFF;
  23052. padded[i++] = length >> 5 & 0xFF;
  23053. padded[i++] = length << 3 & 0xFF;
  23054. var w = new Uint32Array(64);
  23055. for (i = 0; i < paddedLength;) {
  23056. for (j = 0; j < 16; ++j) {
  23057. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23058. i += 4;
  23059. }
  23060. for (j = 16; j < 64; ++j) {
  23061. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  23062. }
  23063. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  23064. for (j = 0; j < 64; ++j) {
  23065. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  23066. t2 = sigma(a) + maj(a, b, c);
  23067. h = g;
  23068. g = f;
  23069. f = e;
  23070. e = d + t1 | 0;
  23071. d = c;
  23072. c = b;
  23073. b = a;
  23074. a = t1 + t2 | 0;
  23075. }
  23076. h0 = h0 + a | 0;
  23077. h1 = h1 + b | 0;
  23078. h2 = h2 + c | 0;
  23079. h3 = h3 + d | 0;
  23080. h4 = h4 + e | 0;
  23081. h5 = h5 + f | 0;
  23082. h6 = h6 + g | 0;
  23083. h7 = h7 + h | 0;
  23084. }
  23085. return new Uint8Array([
  23086. h0 >> 24 & 0xFF,
  23087. h0 >> 16 & 0xFF,
  23088. h0 >> 8 & 0xFF,
  23089. h0 & 0xFF,
  23090. h1 >> 24 & 0xFF,
  23091. h1 >> 16 & 0xFF,
  23092. h1 >> 8 & 0xFF,
  23093. h1 & 0xFF,
  23094. h2 >> 24 & 0xFF,
  23095. h2 >> 16 & 0xFF,
  23096. h2 >> 8 & 0xFF,
  23097. h2 & 0xFF,
  23098. h3 >> 24 & 0xFF,
  23099. h3 >> 16 & 0xFF,
  23100. h3 >> 8 & 0xFF,
  23101. h3 & 0xFF,
  23102. h4 >> 24 & 0xFF,
  23103. h4 >> 16 & 0xFF,
  23104. h4 >> 8 & 0xFF,
  23105. h4 & 0xFF,
  23106. h5 >> 24 & 0xFF,
  23107. h5 >> 16 & 0xFF,
  23108. h5 >> 8 & 0xFF,
  23109. h5 & 0xFF,
  23110. h6 >> 24 & 0xFF,
  23111. h6 >> 16 & 0xFF,
  23112. h6 >> 8 & 0xFF,
  23113. h6 & 0xFF,
  23114. h7 >> 24 & 0xFF,
  23115. h7 >> 16 & 0xFF,
  23116. h7 >> 8 & 0xFF,
  23117. h7 & 0xFF
  23118. ]);
  23119. }
  23120. return hash;
  23121. }();
  23122. var calculateSHA512 = function calculateSHA512Closure() {
  23123. function ch(result, x, y, z, tmp) {
  23124. result.assign(x);
  23125. result.and(y);
  23126. tmp.assign(x);
  23127. tmp.not();
  23128. tmp.and(z);
  23129. result.xor(tmp);
  23130. }
  23131. function maj(result, x, y, z, tmp) {
  23132. result.assign(x);
  23133. result.and(y);
  23134. tmp.assign(x);
  23135. tmp.and(z);
  23136. result.xor(tmp);
  23137. tmp.assign(y);
  23138. tmp.and(z);
  23139. result.xor(tmp);
  23140. }
  23141. function sigma(result, x, tmp) {
  23142. result.assign(x);
  23143. result.rotateRight(28);
  23144. tmp.assign(x);
  23145. tmp.rotateRight(34);
  23146. result.xor(tmp);
  23147. tmp.assign(x);
  23148. tmp.rotateRight(39);
  23149. result.xor(tmp);
  23150. }
  23151. function sigmaPrime(result, x, tmp) {
  23152. result.assign(x);
  23153. result.rotateRight(14);
  23154. tmp.assign(x);
  23155. tmp.rotateRight(18);
  23156. result.xor(tmp);
  23157. tmp.assign(x);
  23158. tmp.rotateRight(41);
  23159. result.xor(tmp);
  23160. }
  23161. function littleSigma(result, x, tmp) {
  23162. result.assign(x);
  23163. result.rotateRight(1);
  23164. tmp.assign(x);
  23165. tmp.rotateRight(8);
  23166. result.xor(tmp);
  23167. tmp.assign(x);
  23168. tmp.shiftRight(7);
  23169. result.xor(tmp);
  23170. }
  23171. function littleSigmaPrime(result, x, tmp) {
  23172. result.assign(x);
  23173. result.rotateRight(19);
  23174. tmp.assign(x);
  23175. tmp.rotateRight(61);
  23176. result.xor(tmp);
  23177. tmp.assign(x);
  23178. tmp.shiftRight(6);
  23179. result.xor(tmp);
  23180. }
  23181. var k = [
  23182. new Word64(0x428a2f98, 0xd728ae22),
  23183. new Word64(0x71374491, 0x23ef65cd),
  23184. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  23185. new Word64(0xe9b5dba5, 0x8189dbbc),
  23186. new Word64(0x3956c25b, 0xf348b538),
  23187. new Word64(0x59f111f1, 0xb605d019),
  23188. new Word64(0x923f82a4, 0xaf194f9b),
  23189. new Word64(0xab1c5ed5, 0xda6d8118),
  23190. new Word64(0xd807aa98, 0xa3030242),
  23191. new Word64(0x12835b01, 0x45706fbe),
  23192. new Word64(0x243185be, 0x4ee4b28c),
  23193. new Word64(0x550c7dc3, 0xd5ffb4e2),
  23194. new Word64(0x72be5d74, 0xf27b896f),
  23195. new Word64(0x80deb1fe, 0x3b1696b1),
  23196. new Word64(0x9bdc06a7, 0x25c71235),
  23197. new Word64(0xc19bf174, 0xcf692694),
  23198. new Word64(0xe49b69c1, 0x9ef14ad2),
  23199. new Word64(0xefbe4786, 0x384f25e3),
  23200. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  23201. new Word64(0x240ca1cc, 0x77ac9c65),
  23202. new Word64(0x2de92c6f, 0x592b0275),
  23203. new Word64(0x4a7484aa, 0x6ea6e483),
  23204. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  23205. new Word64(0x76f988da, 0x831153b5),
  23206. new Word64(0x983e5152, 0xee66dfab),
  23207. new Word64(0xa831c66d, 0x2db43210),
  23208. new Word64(0xb00327c8, 0x98fb213f),
  23209. new Word64(0xbf597fc7, 0xbeef0ee4),
  23210. new Word64(0xc6e00bf3, 0x3da88fc2),
  23211. new Word64(0xd5a79147, 0x930aa725),
  23212. new Word64(0x06ca6351, 0xe003826f),
  23213. new Word64(0x14292967, 0x0a0e6e70),
  23214. new Word64(0x27b70a85, 0x46d22ffc),
  23215. new Word64(0x2e1b2138, 0x5c26c926),
  23216. new Word64(0x4d2c6dfc, 0x5ac42aed),
  23217. new Word64(0x53380d13, 0x9d95b3df),
  23218. new Word64(0x650a7354, 0x8baf63de),
  23219. new Word64(0x766a0abb, 0x3c77b2a8),
  23220. new Word64(0x81c2c92e, 0x47edaee6),
  23221. new Word64(0x92722c85, 0x1482353b),
  23222. new Word64(0xa2bfe8a1, 0x4cf10364),
  23223. new Word64(0xa81a664b, 0xbc423001),
  23224. new Word64(0xc24b8b70, 0xd0f89791),
  23225. new Word64(0xc76c51a3, 0x0654be30),
  23226. new Word64(0xd192e819, 0xd6ef5218),
  23227. new Word64(0xd6990624, 0x5565a910),
  23228. new Word64(0xf40e3585, 0x5771202a),
  23229. new Word64(0x106aa070, 0x32bbd1b8),
  23230. new Word64(0x19a4c116, 0xb8d2d0c8),
  23231. new Word64(0x1e376c08, 0x5141ab53),
  23232. new Word64(0x2748774c, 0xdf8eeb99),
  23233. new Word64(0x34b0bcb5, 0xe19b48a8),
  23234. new Word64(0x391c0cb3, 0xc5c95a63),
  23235. new Word64(0x4ed8aa4a, 0xe3418acb),
  23236. new Word64(0x5b9cca4f, 0x7763e373),
  23237. new Word64(0x682e6ff3, 0xd6b2b8a3),
  23238. new Word64(0x748f82ee, 0x5defb2fc),
  23239. new Word64(0x78a5636f, 0x43172f60),
  23240. new Word64(0x84c87814, 0xa1f0ab72),
  23241. new Word64(0x8cc70208, 0x1a6439ec),
  23242. new Word64(0x90befffa, 0x23631e28),
  23243. new Word64(0xa4506ceb, 0xde82bde9),
  23244. new Word64(0xbef9a3f7, 0xb2c67915),
  23245. new Word64(0xc67178f2, 0xe372532b),
  23246. new Word64(0xca273ece, 0xea26619c),
  23247. new Word64(0xd186b8c7, 0x21c0c207),
  23248. new Word64(0xeada7dd6, 0xcde0eb1e),
  23249. new Word64(0xf57d4f7f, 0xee6ed178),
  23250. new Word64(0x06f067aa, 0x72176fba),
  23251. new Word64(0x0a637dc5, 0xa2c898a6),
  23252. new Word64(0x113f9804, 0xbef90dae),
  23253. new Word64(0x1b710b35, 0x131c471b),
  23254. new Word64(0x28db77f5, 0x23047d84),
  23255. new Word64(0x32caab7b, 0x40c72493),
  23256. new Word64(0x3c9ebe0a, 0x15c9bebc),
  23257. new Word64(0x431d67c4, 0x9c100d4c),
  23258. new Word64(0x4cc5d4be, 0xcb3e42b6),
  23259. new Word64(0x597f299c, 0xfc657e2a),
  23260. new Word64(0x5fcb6fab, 0x3ad6faec),
  23261. new Word64(0x6c44198c, 0x4a475817)
  23262. ];
  23263. function hash(data, offset, length, mode384) {
  23264. mode384 = !!mode384;
  23265. var h0, h1, h2, h3, h4, h5, h6, h7;
  23266. if (!mode384) {
  23267. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  23268. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  23269. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  23270. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  23271. h4 = new Word64(0x510e527f, 0xade682d1);
  23272. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  23273. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  23274. h7 = new Word64(0x5be0cd19, 0x137e2179);
  23275. } else {
  23276. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  23277. h1 = new Word64(0x629a292a, 0x367cd507);
  23278. h2 = new Word64(0x9159015a, 0x3070dd17);
  23279. h3 = new Word64(0x152fecd8, 0xf70e5939);
  23280. h4 = new Word64(0x67332667, 0xffc00b31);
  23281. h5 = new Word64(0x8eb44a87, 0x68581511);
  23282. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  23283. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  23284. }
  23285. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  23286. var padded = new Uint8Array(paddedLength);
  23287. var i, j, n;
  23288. for (i = 0; i < length; ++i) {
  23289. padded[i] = data[offset++];
  23290. }
  23291. padded[i++] = 0x80;
  23292. n = paddedLength - 16;
  23293. while (i < n) {
  23294. padded[i++] = 0;
  23295. }
  23296. padded[i++] = 0;
  23297. padded[i++] = 0;
  23298. padded[i++] = 0;
  23299. padded[i++] = 0;
  23300. padded[i++] = 0;
  23301. padded[i++] = 0;
  23302. padded[i++] = 0;
  23303. padded[i++] = 0;
  23304. padded[i++] = 0;
  23305. padded[i++] = 0;
  23306. padded[i++] = 0;
  23307. padded[i++] = length >>> 29 & 0xFF;
  23308. padded[i++] = length >> 21 & 0xFF;
  23309. padded[i++] = length >> 13 & 0xFF;
  23310. padded[i++] = length >> 5 & 0xFF;
  23311. padded[i++] = length << 3 & 0xFF;
  23312. var w = new Array(80);
  23313. for (i = 0; i < 80; i++) {
  23314. w[i] = new Word64(0, 0);
  23315. }
  23316. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  23317. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  23318. var g = new Word64(0, 0), h = new Word64(0, 0);
  23319. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  23320. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  23321. for (i = 0; i < paddedLength;) {
  23322. for (j = 0; j < 16; ++j) {
  23323. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23324. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  23325. i += 8;
  23326. }
  23327. for (j = 16; j < 80; ++j) {
  23328. tmp3 = w[j];
  23329. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  23330. tmp3.add(w[j - 7]);
  23331. littleSigma(tmp1, w[j - 15], tmp2);
  23332. tmp3.add(tmp1);
  23333. tmp3.add(w[j - 16]);
  23334. }
  23335. a.assign(h0);
  23336. b.assign(h1);
  23337. c.assign(h2);
  23338. d.assign(h3);
  23339. e.assign(h4);
  23340. f.assign(h5);
  23341. g.assign(h6);
  23342. h.assign(h7);
  23343. for (j = 0; j < 80; ++j) {
  23344. t1.assign(h);
  23345. sigmaPrime(tmp1, e, tmp2);
  23346. t1.add(tmp1);
  23347. ch(tmp1, e, f, g, tmp2);
  23348. t1.add(tmp1);
  23349. t1.add(k[j]);
  23350. t1.add(w[j]);
  23351. sigma(t2, a, tmp2);
  23352. maj(tmp1, a, b, c, tmp2);
  23353. t2.add(tmp1);
  23354. tmp3 = h;
  23355. h = g;
  23356. g = f;
  23357. f = e;
  23358. d.add(t1);
  23359. e = d;
  23360. d = c;
  23361. c = b;
  23362. b = a;
  23363. tmp3.assign(t1);
  23364. tmp3.add(t2);
  23365. a = tmp3;
  23366. }
  23367. h0.add(a);
  23368. h1.add(b);
  23369. h2.add(c);
  23370. h3.add(d);
  23371. h4.add(e);
  23372. h5.add(f);
  23373. h6.add(g);
  23374. h7.add(h);
  23375. }
  23376. var result;
  23377. if (!mode384) {
  23378. result = new Uint8Array(64);
  23379. h0.copyTo(result, 0);
  23380. h1.copyTo(result, 8);
  23381. h2.copyTo(result, 16);
  23382. h3.copyTo(result, 24);
  23383. h4.copyTo(result, 32);
  23384. h5.copyTo(result, 40);
  23385. h6.copyTo(result, 48);
  23386. h7.copyTo(result, 56);
  23387. } else {
  23388. result = new Uint8Array(48);
  23389. h0.copyTo(result, 0);
  23390. h1.copyTo(result, 8);
  23391. h2.copyTo(result, 16);
  23392. h3.copyTo(result, 24);
  23393. h4.copyTo(result, 32);
  23394. h5.copyTo(result, 40);
  23395. }
  23396. return result;
  23397. }
  23398. return hash;
  23399. }();
  23400. var calculateSHA384 = function calculateSHA384Closure() {
  23401. function hash(data, offset, length) {
  23402. return calculateSHA512(data, offset, length, true);
  23403. }
  23404. return hash;
  23405. }();
  23406. var NullCipher = function NullCipherClosure() {
  23407. function NullCipher() {
  23408. }
  23409. NullCipher.prototype = {
  23410. decryptBlock: function NullCipher_decryptBlock(data) {
  23411. return data;
  23412. }
  23413. };
  23414. return NullCipher;
  23415. }();
  23416. var AES128Cipher = function AES128CipherClosure() {
  23417. var rcon = new Uint8Array([
  23418. 0x8d,
  23419. 0x01,
  23420. 0x02,
  23421. 0x04,
  23422. 0x08,
  23423. 0x10,
  23424. 0x20,
  23425. 0x40,
  23426. 0x80,
  23427. 0x1b,
  23428. 0x36,
  23429. 0x6c,
  23430. 0xd8,
  23431. 0xab,
  23432. 0x4d,
  23433. 0x9a,
  23434. 0x2f,
  23435. 0x5e,
  23436. 0xbc,
  23437. 0x63,
  23438. 0xc6,
  23439. 0x97,
  23440. 0x35,
  23441. 0x6a,
  23442. 0xd4,
  23443. 0xb3,
  23444. 0x7d,
  23445. 0xfa,
  23446. 0xef,
  23447. 0xc5,
  23448. 0x91,
  23449. 0x39,
  23450. 0x72,
  23451. 0xe4,
  23452. 0xd3,
  23453. 0xbd,
  23454. 0x61,
  23455. 0xc2,
  23456. 0x9f,
  23457. 0x25,
  23458. 0x4a,
  23459. 0x94,
  23460. 0x33,
  23461. 0x66,
  23462. 0xcc,
  23463. 0x83,
  23464. 0x1d,
  23465. 0x3a,
  23466. 0x74,
  23467. 0xe8,
  23468. 0xcb,
  23469. 0x8d,
  23470. 0x01,
  23471. 0x02,
  23472. 0x04,
  23473. 0x08,
  23474. 0x10,
  23475. 0x20,
  23476. 0x40,
  23477. 0x80,
  23478. 0x1b,
  23479. 0x36,
  23480. 0x6c,
  23481. 0xd8,
  23482. 0xab,
  23483. 0x4d,
  23484. 0x9a,
  23485. 0x2f,
  23486. 0x5e,
  23487. 0xbc,
  23488. 0x63,
  23489. 0xc6,
  23490. 0x97,
  23491. 0x35,
  23492. 0x6a,
  23493. 0xd4,
  23494. 0xb3,
  23495. 0x7d,
  23496. 0xfa,
  23497. 0xef,
  23498. 0xc5,
  23499. 0x91,
  23500. 0x39,
  23501. 0x72,
  23502. 0xe4,
  23503. 0xd3,
  23504. 0xbd,
  23505. 0x61,
  23506. 0xc2,
  23507. 0x9f,
  23508. 0x25,
  23509. 0x4a,
  23510. 0x94,
  23511. 0x33,
  23512. 0x66,
  23513. 0xcc,
  23514. 0x83,
  23515. 0x1d,
  23516. 0x3a,
  23517. 0x74,
  23518. 0xe8,
  23519. 0xcb,
  23520. 0x8d,
  23521. 0x01,
  23522. 0x02,
  23523. 0x04,
  23524. 0x08,
  23525. 0x10,
  23526. 0x20,
  23527. 0x40,
  23528. 0x80,
  23529. 0x1b,
  23530. 0x36,
  23531. 0x6c,
  23532. 0xd8,
  23533. 0xab,
  23534. 0x4d,
  23535. 0x9a,
  23536. 0x2f,
  23537. 0x5e,
  23538. 0xbc,
  23539. 0x63,
  23540. 0xc6,
  23541. 0x97,
  23542. 0x35,
  23543. 0x6a,
  23544. 0xd4,
  23545. 0xb3,
  23546. 0x7d,
  23547. 0xfa,
  23548. 0xef,
  23549. 0xc5,
  23550. 0x91,
  23551. 0x39,
  23552. 0x72,
  23553. 0xe4,
  23554. 0xd3,
  23555. 0xbd,
  23556. 0x61,
  23557. 0xc2,
  23558. 0x9f,
  23559. 0x25,
  23560. 0x4a,
  23561. 0x94,
  23562. 0x33,
  23563. 0x66,
  23564. 0xcc,
  23565. 0x83,
  23566. 0x1d,
  23567. 0x3a,
  23568. 0x74,
  23569. 0xe8,
  23570. 0xcb,
  23571. 0x8d,
  23572. 0x01,
  23573. 0x02,
  23574. 0x04,
  23575. 0x08,
  23576. 0x10,
  23577. 0x20,
  23578. 0x40,
  23579. 0x80,
  23580. 0x1b,
  23581. 0x36,
  23582. 0x6c,
  23583. 0xd8,
  23584. 0xab,
  23585. 0x4d,
  23586. 0x9a,
  23587. 0x2f,
  23588. 0x5e,
  23589. 0xbc,
  23590. 0x63,
  23591. 0xc6,
  23592. 0x97,
  23593. 0x35,
  23594. 0x6a,
  23595. 0xd4,
  23596. 0xb3,
  23597. 0x7d,
  23598. 0xfa,
  23599. 0xef,
  23600. 0xc5,
  23601. 0x91,
  23602. 0x39,
  23603. 0x72,
  23604. 0xe4,
  23605. 0xd3,
  23606. 0xbd,
  23607. 0x61,
  23608. 0xc2,
  23609. 0x9f,
  23610. 0x25,
  23611. 0x4a,
  23612. 0x94,
  23613. 0x33,
  23614. 0x66,
  23615. 0xcc,
  23616. 0x83,
  23617. 0x1d,
  23618. 0x3a,
  23619. 0x74,
  23620. 0xe8,
  23621. 0xcb,
  23622. 0x8d,
  23623. 0x01,
  23624. 0x02,
  23625. 0x04,
  23626. 0x08,
  23627. 0x10,
  23628. 0x20,
  23629. 0x40,
  23630. 0x80,
  23631. 0x1b,
  23632. 0x36,
  23633. 0x6c,
  23634. 0xd8,
  23635. 0xab,
  23636. 0x4d,
  23637. 0x9a,
  23638. 0x2f,
  23639. 0x5e,
  23640. 0xbc,
  23641. 0x63,
  23642. 0xc6,
  23643. 0x97,
  23644. 0x35,
  23645. 0x6a,
  23646. 0xd4,
  23647. 0xb3,
  23648. 0x7d,
  23649. 0xfa,
  23650. 0xef,
  23651. 0xc5,
  23652. 0x91,
  23653. 0x39,
  23654. 0x72,
  23655. 0xe4,
  23656. 0xd3,
  23657. 0xbd,
  23658. 0x61,
  23659. 0xc2,
  23660. 0x9f,
  23661. 0x25,
  23662. 0x4a,
  23663. 0x94,
  23664. 0x33,
  23665. 0x66,
  23666. 0xcc,
  23667. 0x83,
  23668. 0x1d,
  23669. 0x3a,
  23670. 0x74,
  23671. 0xe8,
  23672. 0xcb,
  23673. 0x8d
  23674. ]);
  23675. var s = new Uint8Array([
  23676. 0x63,
  23677. 0x7c,
  23678. 0x77,
  23679. 0x7b,
  23680. 0xf2,
  23681. 0x6b,
  23682. 0x6f,
  23683. 0xc5,
  23684. 0x30,
  23685. 0x01,
  23686. 0x67,
  23687. 0x2b,
  23688. 0xfe,
  23689. 0xd7,
  23690. 0xab,
  23691. 0x76,
  23692. 0xca,
  23693. 0x82,
  23694. 0xc9,
  23695. 0x7d,
  23696. 0xfa,
  23697. 0x59,
  23698. 0x47,
  23699. 0xf0,
  23700. 0xad,
  23701. 0xd4,
  23702. 0xa2,
  23703. 0xaf,
  23704. 0x9c,
  23705. 0xa4,
  23706. 0x72,
  23707. 0xc0,
  23708. 0xb7,
  23709. 0xfd,
  23710. 0x93,
  23711. 0x26,
  23712. 0x36,
  23713. 0x3f,
  23714. 0xf7,
  23715. 0xcc,
  23716. 0x34,
  23717. 0xa5,
  23718. 0xe5,
  23719. 0xf1,
  23720. 0x71,
  23721. 0xd8,
  23722. 0x31,
  23723. 0x15,
  23724. 0x04,
  23725. 0xc7,
  23726. 0x23,
  23727. 0xc3,
  23728. 0x18,
  23729. 0x96,
  23730. 0x05,
  23731. 0x9a,
  23732. 0x07,
  23733. 0x12,
  23734. 0x80,
  23735. 0xe2,
  23736. 0xeb,
  23737. 0x27,
  23738. 0xb2,
  23739. 0x75,
  23740. 0x09,
  23741. 0x83,
  23742. 0x2c,
  23743. 0x1a,
  23744. 0x1b,
  23745. 0x6e,
  23746. 0x5a,
  23747. 0xa0,
  23748. 0x52,
  23749. 0x3b,
  23750. 0xd6,
  23751. 0xb3,
  23752. 0x29,
  23753. 0xe3,
  23754. 0x2f,
  23755. 0x84,
  23756. 0x53,
  23757. 0xd1,
  23758. 0x00,
  23759. 0xed,
  23760. 0x20,
  23761. 0xfc,
  23762. 0xb1,
  23763. 0x5b,
  23764. 0x6a,
  23765. 0xcb,
  23766. 0xbe,
  23767. 0x39,
  23768. 0x4a,
  23769. 0x4c,
  23770. 0x58,
  23771. 0xcf,
  23772. 0xd0,
  23773. 0xef,
  23774. 0xaa,
  23775. 0xfb,
  23776. 0x43,
  23777. 0x4d,
  23778. 0x33,
  23779. 0x85,
  23780. 0x45,
  23781. 0xf9,
  23782. 0x02,
  23783. 0x7f,
  23784. 0x50,
  23785. 0x3c,
  23786. 0x9f,
  23787. 0xa8,
  23788. 0x51,
  23789. 0xa3,
  23790. 0x40,
  23791. 0x8f,
  23792. 0x92,
  23793. 0x9d,
  23794. 0x38,
  23795. 0xf5,
  23796. 0xbc,
  23797. 0xb6,
  23798. 0xda,
  23799. 0x21,
  23800. 0x10,
  23801. 0xff,
  23802. 0xf3,
  23803. 0xd2,
  23804. 0xcd,
  23805. 0x0c,
  23806. 0x13,
  23807. 0xec,
  23808. 0x5f,
  23809. 0x97,
  23810. 0x44,
  23811. 0x17,
  23812. 0xc4,
  23813. 0xa7,
  23814. 0x7e,
  23815. 0x3d,
  23816. 0x64,
  23817. 0x5d,
  23818. 0x19,
  23819. 0x73,
  23820. 0x60,
  23821. 0x81,
  23822. 0x4f,
  23823. 0xdc,
  23824. 0x22,
  23825. 0x2a,
  23826. 0x90,
  23827. 0x88,
  23828. 0x46,
  23829. 0xee,
  23830. 0xb8,
  23831. 0x14,
  23832. 0xde,
  23833. 0x5e,
  23834. 0x0b,
  23835. 0xdb,
  23836. 0xe0,
  23837. 0x32,
  23838. 0x3a,
  23839. 0x0a,
  23840. 0x49,
  23841. 0x06,
  23842. 0x24,
  23843. 0x5c,
  23844. 0xc2,
  23845. 0xd3,
  23846. 0xac,
  23847. 0x62,
  23848. 0x91,
  23849. 0x95,
  23850. 0xe4,
  23851. 0x79,
  23852. 0xe7,
  23853. 0xc8,
  23854. 0x37,
  23855. 0x6d,
  23856. 0x8d,
  23857. 0xd5,
  23858. 0x4e,
  23859. 0xa9,
  23860. 0x6c,
  23861. 0x56,
  23862. 0xf4,
  23863. 0xea,
  23864. 0x65,
  23865. 0x7a,
  23866. 0xae,
  23867. 0x08,
  23868. 0xba,
  23869. 0x78,
  23870. 0x25,
  23871. 0x2e,
  23872. 0x1c,
  23873. 0xa6,
  23874. 0xb4,
  23875. 0xc6,
  23876. 0xe8,
  23877. 0xdd,
  23878. 0x74,
  23879. 0x1f,
  23880. 0x4b,
  23881. 0xbd,
  23882. 0x8b,
  23883. 0x8a,
  23884. 0x70,
  23885. 0x3e,
  23886. 0xb5,
  23887. 0x66,
  23888. 0x48,
  23889. 0x03,
  23890. 0xf6,
  23891. 0x0e,
  23892. 0x61,
  23893. 0x35,
  23894. 0x57,
  23895. 0xb9,
  23896. 0x86,
  23897. 0xc1,
  23898. 0x1d,
  23899. 0x9e,
  23900. 0xe1,
  23901. 0xf8,
  23902. 0x98,
  23903. 0x11,
  23904. 0x69,
  23905. 0xd9,
  23906. 0x8e,
  23907. 0x94,
  23908. 0x9b,
  23909. 0x1e,
  23910. 0x87,
  23911. 0xe9,
  23912. 0xce,
  23913. 0x55,
  23914. 0x28,
  23915. 0xdf,
  23916. 0x8c,
  23917. 0xa1,
  23918. 0x89,
  23919. 0x0d,
  23920. 0xbf,
  23921. 0xe6,
  23922. 0x42,
  23923. 0x68,
  23924. 0x41,
  23925. 0x99,
  23926. 0x2d,
  23927. 0x0f,
  23928. 0xb0,
  23929. 0x54,
  23930. 0xbb,
  23931. 0x16
  23932. ]);
  23933. var inv_s = new Uint8Array([
  23934. 0x52,
  23935. 0x09,
  23936. 0x6a,
  23937. 0xd5,
  23938. 0x30,
  23939. 0x36,
  23940. 0xa5,
  23941. 0x38,
  23942. 0xbf,
  23943. 0x40,
  23944. 0xa3,
  23945. 0x9e,
  23946. 0x81,
  23947. 0xf3,
  23948. 0xd7,
  23949. 0xfb,
  23950. 0x7c,
  23951. 0xe3,
  23952. 0x39,
  23953. 0x82,
  23954. 0x9b,
  23955. 0x2f,
  23956. 0xff,
  23957. 0x87,
  23958. 0x34,
  23959. 0x8e,
  23960. 0x43,
  23961. 0x44,
  23962. 0xc4,
  23963. 0xde,
  23964. 0xe9,
  23965. 0xcb,
  23966. 0x54,
  23967. 0x7b,
  23968. 0x94,
  23969. 0x32,
  23970. 0xa6,
  23971. 0xc2,
  23972. 0x23,
  23973. 0x3d,
  23974. 0xee,
  23975. 0x4c,
  23976. 0x95,
  23977. 0x0b,
  23978. 0x42,
  23979. 0xfa,
  23980. 0xc3,
  23981. 0x4e,
  23982. 0x08,
  23983. 0x2e,
  23984. 0xa1,
  23985. 0x66,
  23986. 0x28,
  23987. 0xd9,
  23988. 0x24,
  23989. 0xb2,
  23990. 0x76,
  23991. 0x5b,
  23992. 0xa2,
  23993. 0x49,
  23994. 0x6d,
  23995. 0x8b,
  23996. 0xd1,
  23997. 0x25,
  23998. 0x72,
  23999. 0xf8,
  24000. 0xf6,
  24001. 0x64,
  24002. 0x86,
  24003. 0x68,
  24004. 0x98,
  24005. 0x16,
  24006. 0xd4,
  24007. 0xa4,
  24008. 0x5c,
  24009. 0xcc,
  24010. 0x5d,
  24011. 0x65,
  24012. 0xb6,
  24013. 0x92,
  24014. 0x6c,
  24015. 0x70,
  24016. 0x48,
  24017. 0x50,
  24018. 0xfd,
  24019. 0xed,
  24020. 0xb9,
  24021. 0xda,
  24022. 0x5e,
  24023. 0x15,
  24024. 0x46,
  24025. 0x57,
  24026. 0xa7,
  24027. 0x8d,
  24028. 0x9d,
  24029. 0x84,
  24030. 0x90,
  24031. 0xd8,
  24032. 0xab,
  24033. 0x00,
  24034. 0x8c,
  24035. 0xbc,
  24036. 0xd3,
  24037. 0x0a,
  24038. 0xf7,
  24039. 0xe4,
  24040. 0x58,
  24041. 0x05,
  24042. 0xb8,
  24043. 0xb3,
  24044. 0x45,
  24045. 0x06,
  24046. 0xd0,
  24047. 0x2c,
  24048. 0x1e,
  24049. 0x8f,
  24050. 0xca,
  24051. 0x3f,
  24052. 0x0f,
  24053. 0x02,
  24054. 0xc1,
  24055. 0xaf,
  24056. 0xbd,
  24057. 0x03,
  24058. 0x01,
  24059. 0x13,
  24060. 0x8a,
  24061. 0x6b,
  24062. 0x3a,
  24063. 0x91,
  24064. 0x11,
  24065. 0x41,
  24066. 0x4f,
  24067. 0x67,
  24068. 0xdc,
  24069. 0xea,
  24070. 0x97,
  24071. 0xf2,
  24072. 0xcf,
  24073. 0xce,
  24074. 0xf0,
  24075. 0xb4,
  24076. 0xe6,
  24077. 0x73,
  24078. 0x96,
  24079. 0xac,
  24080. 0x74,
  24081. 0x22,
  24082. 0xe7,
  24083. 0xad,
  24084. 0x35,
  24085. 0x85,
  24086. 0xe2,
  24087. 0xf9,
  24088. 0x37,
  24089. 0xe8,
  24090. 0x1c,
  24091. 0x75,
  24092. 0xdf,
  24093. 0x6e,
  24094. 0x47,
  24095. 0xf1,
  24096. 0x1a,
  24097. 0x71,
  24098. 0x1d,
  24099. 0x29,
  24100. 0xc5,
  24101. 0x89,
  24102. 0x6f,
  24103. 0xb7,
  24104. 0x62,
  24105. 0x0e,
  24106. 0xaa,
  24107. 0x18,
  24108. 0xbe,
  24109. 0x1b,
  24110. 0xfc,
  24111. 0x56,
  24112. 0x3e,
  24113. 0x4b,
  24114. 0xc6,
  24115. 0xd2,
  24116. 0x79,
  24117. 0x20,
  24118. 0x9a,
  24119. 0xdb,
  24120. 0xc0,
  24121. 0xfe,
  24122. 0x78,
  24123. 0xcd,
  24124. 0x5a,
  24125. 0xf4,
  24126. 0x1f,
  24127. 0xdd,
  24128. 0xa8,
  24129. 0x33,
  24130. 0x88,
  24131. 0x07,
  24132. 0xc7,
  24133. 0x31,
  24134. 0xb1,
  24135. 0x12,
  24136. 0x10,
  24137. 0x59,
  24138. 0x27,
  24139. 0x80,
  24140. 0xec,
  24141. 0x5f,
  24142. 0x60,
  24143. 0x51,
  24144. 0x7f,
  24145. 0xa9,
  24146. 0x19,
  24147. 0xb5,
  24148. 0x4a,
  24149. 0x0d,
  24150. 0x2d,
  24151. 0xe5,
  24152. 0x7a,
  24153. 0x9f,
  24154. 0x93,
  24155. 0xc9,
  24156. 0x9c,
  24157. 0xef,
  24158. 0xa0,
  24159. 0xe0,
  24160. 0x3b,
  24161. 0x4d,
  24162. 0xae,
  24163. 0x2a,
  24164. 0xf5,
  24165. 0xb0,
  24166. 0xc8,
  24167. 0xeb,
  24168. 0xbb,
  24169. 0x3c,
  24170. 0x83,
  24171. 0x53,
  24172. 0x99,
  24173. 0x61,
  24174. 0x17,
  24175. 0x2b,
  24176. 0x04,
  24177. 0x7e,
  24178. 0xba,
  24179. 0x77,
  24180. 0xd6,
  24181. 0x26,
  24182. 0xe1,
  24183. 0x69,
  24184. 0x14,
  24185. 0x63,
  24186. 0x55,
  24187. 0x21,
  24188. 0x0c,
  24189. 0x7d
  24190. ]);
  24191. var mixCol = new Uint8Array(256);
  24192. for (var i = 0; i < 256; i++) {
  24193. if (i < 128) {
  24194. mixCol[i] = i << 1;
  24195. } else {
  24196. mixCol[i] = i << 1 ^ 0x1b;
  24197. }
  24198. }
  24199. var mix = new Uint32Array([
  24200. 0x00000000,
  24201. 0x0e090d0b,
  24202. 0x1c121a16,
  24203. 0x121b171d,
  24204. 0x3824342c,
  24205. 0x362d3927,
  24206. 0x24362e3a,
  24207. 0x2a3f2331,
  24208. 0x70486858,
  24209. 0x7e416553,
  24210. 0x6c5a724e,
  24211. 0x62537f45,
  24212. 0x486c5c74,
  24213. 0x4665517f,
  24214. 0x547e4662,
  24215. 0x5a774b69,
  24216. 0xe090d0b0,
  24217. 0xee99ddbb,
  24218. 0xfc82caa6,
  24219. 0xf28bc7ad,
  24220. 0xd8b4e49c,
  24221. 0xd6bde997,
  24222. 0xc4a6fe8a,
  24223. 0xcaaff381,
  24224. 0x90d8b8e8,
  24225. 0x9ed1b5e3,
  24226. 0x8ccaa2fe,
  24227. 0x82c3aff5,
  24228. 0xa8fc8cc4,
  24229. 0xa6f581cf,
  24230. 0xb4ee96d2,
  24231. 0xbae79bd9,
  24232. 0xdb3bbb7b,
  24233. 0xd532b670,
  24234. 0xc729a16d,
  24235. 0xc920ac66,
  24236. 0xe31f8f57,
  24237. 0xed16825c,
  24238. 0xff0d9541,
  24239. 0xf104984a,
  24240. 0xab73d323,
  24241. 0xa57ade28,
  24242. 0xb761c935,
  24243. 0xb968c43e,
  24244. 0x9357e70f,
  24245. 0x9d5eea04,
  24246. 0x8f45fd19,
  24247. 0x814cf012,
  24248. 0x3bab6bcb,
  24249. 0x35a266c0,
  24250. 0x27b971dd,
  24251. 0x29b07cd6,
  24252. 0x038f5fe7,
  24253. 0x0d8652ec,
  24254. 0x1f9d45f1,
  24255. 0x119448fa,
  24256. 0x4be30393,
  24257. 0x45ea0e98,
  24258. 0x57f11985,
  24259. 0x59f8148e,
  24260. 0x73c737bf,
  24261. 0x7dce3ab4,
  24262. 0x6fd52da9,
  24263. 0x61dc20a2,
  24264. 0xad766df6,
  24265. 0xa37f60fd,
  24266. 0xb16477e0,
  24267. 0xbf6d7aeb,
  24268. 0x955259da,
  24269. 0x9b5b54d1,
  24270. 0x894043cc,
  24271. 0x87494ec7,
  24272. 0xdd3e05ae,
  24273. 0xd33708a5,
  24274. 0xc12c1fb8,
  24275. 0xcf2512b3,
  24276. 0xe51a3182,
  24277. 0xeb133c89,
  24278. 0xf9082b94,
  24279. 0xf701269f,
  24280. 0x4de6bd46,
  24281. 0x43efb04d,
  24282. 0x51f4a750,
  24283. 0x5ffdaa5b,
  24284. 0x75c2896a,
  24285. 0x7bcb8461,
  24286. 0x69d0937c,
  24287. 0x67d99e77,
  24288. 0x3daed51e,
  24289. 0x33a7d815,
  24290. 0x21bccf08,
  24291. 0x2fb5c203,
  24292. 0x058ae132,
  24293. 0x0b83ec39,
  24294. 0x1998fb24,
  24295. 0x1791f62f,
  24296. 0x764dd68d,
  24297. 0x7844db86,
  24298. 0x6a5fcc9b,
  24299. 0x6456c190,
  24300. 0x4e69e2a1,
  24301. 0x4060efaa,
  24302. 0x527bf8b7,
  24303. 0x5c72f5bc,
  24304. 0x0605bed5,
  24305. 0x080cb3de,
  24306. 0x1a17a4c3,
  24307. 0x141ea9c8,
  24308. 0x3e218af9,
  24309. 0x302887f2,
  24310. 0x223390ef,
  24311. 0x2c3a9de4,
  24312. 0x96dd063d,
  24313. 0x98d40b36,
  24314. 0x8acf1c2b,
  24315. 0x84c61120,
  24316. 0xaef93211,
  24317. 0xa0f03f1a,
  24318. 0xb2eb2807,
  24319. 0xbce2250c,
  24320. 0xe6956e65,
  24321. 0xe89c636e,
  24322. 0xfa877473,
  24323. 0xf48e7978,
  24324. 0xdeb15a49,
  24325. 0xd0b85742,
  24326. 0xc2a3405f,
  24327. 0xccaa4d54,
  24328. 0x41ecdaf7,
  24329. 0x4fe5d7fc,
  24330. 0x5dfec0e1,
  24331. 0x53f7cdea,
  24332. 0x79c8eedb,
  24333. 0x77c1e3d0,
  24334. 0x65daf4cd,
  24335. 0x6bd3f9c6,
  24336. 0x31a4b2af,
  24337. 0x3fadbfa4,
  24338. 0x2db6a8b9,
  24339. 0x23bfa5b2,
  24340. 0x09808683,
  24341. 0x07898b88,
  24342. 0x15929c95,
  24343. 0x1b9b919e,
  24344. 0xa17c0a47,
  24345. 0xaf75074c,
  24346. 0xbd6e1051,
  24347. 0xb3671d5a,
  24348. 0x99583e6b,
  24349. 0x97513360,
  24350. 0x854a247d,
  24351. 0x8b432976,
  24352. 0xd134621f,
  24353. 0xdf3d6f14,
  24354. 0xcd267809,
  24355. 0xc32f7502,
  24356. 0xe9105633,
  24357. 0xe7195b38,
  24358. 0xf5024c25,
  24359. 0xfb0b412e,
  24360. 0x9ad7618c,
  24361. 0x94de6c87,
  24362. 0x86c57b9a,
  24363. 0x88cc7691,
  24364. 0xa2f355a0,
  24365. 0xacfa58ab,
  24366. 0xbee14fb6,
  24367. 0xb0e842bd,
  24368. 0xea9f09d4,
  24369. 0xe49604df,
  24370. 0xf68d13c2,
  24371. 0xf8841ec9,
  24372. 0xd2bb3df8,
  24373. 0xdcb230f3,
  24374. 0xcea927ee,
  24375. 0xc0a02ae5,
  24376. 0x7a47b13c,
  24377. 0x744ebc37,
  24378. 0x6655ab2a,
  24379. 0x685ca621,
  24380. 0x42638510,
  24381. 0x4c6a881b,
  24382. 0x5e719f06,
  24383. 0x5078920d,
  24384. 0x0a0fd964,
  24385. 0x0406d46f,
  24386. 0x161dc372,
  24387. 0x1814ce79,
  24388. 0x322bed48,
  24389. 0x3c22e043,
  24390. 0x2e39f75e,
  24391. 0x2030fa55,
  24392. 0xec9ab701,
  24393. 0xe293ba0a,
  24394. 0xf088ad17,
  24395. 0xfe81a01c,
  24396. 0xd4be832d,
  24397. 0xdab78e26,
  24398. 0xc8ac993b,
  24399. 0xc6a59430,
  24400. 0x9cd2df59,
  24401. 0x92dbd252,
  24402. 0x80c0c54f,
  24403. 0x8ec9c844,
  24404. 0xa4f6eb75,
  24405. 0xaaffe67e,
  24406. 0xb8e4f163,
  24407. 0xb6edfc68,
  24408. 0x0c0a67b1,
  24409. 0x02036aba,
  24410. 0x10187da7,
  24411. 0x1e1170ac,
  24412. 0x342e539d,
  24413. 0x3a275e96,
  24414. 0x283c498b,
  24415. 0x26354480,
  24416. 0x7c420fe9,
  24417. 0x724b02e2,
  24418. 0x605015ff,
  24419. 0x6e5918f4,
  24420. 0x44663bc5,
  24421. 0x4a6f36ce,
  24422. 0x587421d3,
  24423. 0x567d2cd8,
  24424. 0x37a10c7a,
  24425. 0x39a80171,
  24426. 0x2bb3166c,
  24427. 0x25ba1b67,
  24428. 0x0f853856,
  24429. 0x018c355d,
  24430. 0x13972240,
  24431. 0x1d9e2f4b,
  24432. 0x47e96422,
  24433. 0x49e06929,
  24434. 0x5bfb7e34,
  24435. 0x55f2733f,
  24436. 0x7fcd500e,
  24437. 0x71c45d05,
  24438. 0x63df4a18,
  24439. 0x6dd64713,
  24440. 0xd731dcca,
  24441. 0xd938d1c1,
  24442. 0xcb23c6dc,
  24443. 0xc52acbd7,
  24444. 0xef15e8e6,
  24445. 0xe11ce5ed,
  24446. 0xf307f2f0,
  24447. 0xfd0efffb,
  24448. 0xa779b492,
  24449. 0xa970b999,
  24450. 0xbb6bae84,
  24451. 0xb562a38f,
  24452. 0x9f5d80be,
  24453. 0x91548db5,
  24454. 0x834f9aa8,
  24455. 0x8d4697a3
  24456. ]);
  24457. function expandKey128(cipherKey) {
  24458. var b = 176, result = new Uint8Array(b);
  24459. result.set(cipherKey);
  24460. for (var j = 16, i = 1; j < b; ++i) {
  24461. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24462. t1 = s[t1];
  24463. t2 = s[t2];
  24464. t3 = s[t3];
  24465. t4 = s[t4];
  24466. t1 = t1 ^ rcon[i];
  24467. for (var n = 0; n < 4; ++n) {
  24468. result[j] = t1 ^= result[j - 16];
  24469. j++;
  24470. result[j] = t2 ^= result[j - 16];
  24471. j++;
  24472. result[j] = t3 ^= result[j - 16];
  24473. j++;
  24474. result[j] = t4 ^= result[j - 16];
  24475. j++;
  24476. }
  24477. }
  24478. return result;
  24479. }
  24480. function decrypt128(input, key) {
  24481. var state = new Uint8Array(16);
  24482. state.set(input);
  24483. var i, j, k;
  24484. var t, u, v;
  24485. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24486. state[j] ^= key[k];
  24487. }
  24488. for (i = 9; i >= 1; --i) {
  24489. t = state[13];
  24490. state[13] = state[9];
  24491. state[9] = state[5];
  24492. state[5] = state[1];
  24493. state[1] = t;
  24494. t = state[14];
  24495. u = state[10];
  24496. state[14] = state[6];
  24497. state[10] = state[2];
  24498. state[6] = t;
  24499. state[2] = u;
  24500. t = state[15];
  24501. u = state[11];
  24502. v = state[7];
  24503. state[15] = state[3];
  24504. state[11] = t;
  24505. state[7] = u;
  24506. state[3] = v;
  24507. for (j = 0; j < 16; ++j) {
  24508. state[j] = inv_s[state[j]];
  24509. }
  24510. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24511. state[j] ^= key[k];
  24512. }
  24513. for (j = 0; j < 16; j += 4) {
  24514. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24515. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24516. state[j] = t >>> 24 & 0xFF;
  24517. state[j + 1] = t >> 16 & 0xFF;
  24518. state[j + 2] = t >> 8 & 0xFF;
  24519. state[j + 3] = t & 0xFF;
  24520. }
  24521. }
  24522. t = state[13];
  24523. state[13] = state[9];
  24524. state[9] = state[5];
  24525. state[5] = state[1];
  24526. state[1] = t;
  24527. t = state[14];
  24528. u = state[10];
  24529. state[14] = state[6];
  24530. state[10] = state[2];
  24531. state[6] = t;
  24532. state[2] = u;
  24533. t = state[15];
  24534. u = state[11];
  24535. v = state[7];
  24536. state[15] = state[3];
  24537. state[11] = t;
  24538. state[7] = u;
  24539. state[3] = v;
  24540. for (j = 0; j < 16; ++j) {
  24541. state[j] = inv_s[state[j]];
  24542. state[j] ^= key[j];
  24543. }
  24544. return state;
  24545. }
  24546. function encrypt128(input, key) {
  24547. var t, u, v, k;
  24548. var state = new Uint8Array(16);
  24549. state.set(input);
  24550. for (j = 0; j < 16; ++j) {
  24551. state[j] ^= key[j];
  24552. }
  24553. for (i = 1; i < 10; i++) {
  24554. for (j = 0; j < 16; ++j) {
  24555. state[j] = s[state[j]];
  24556. }
  24557. v = state[1];
  24558. state[1] = state[5];
  24559. state[5] = state[9];
  24560. state[9] = state[13];
  24561. state[13] = v;
  24562. v = state[2];
  24563. u = state[6];
  24564. state[2] = state[10];
  24565. state[6] = state[14];
  24566. state[10] = v;
  24567. state[14] = u;
  24568. v = state[3];
  24569. u = state[7];
  24570. t = state[11];
  24571. state[3] = state[15];
  24572. state[7] = v;
  24573. state[11] = u;
  24574. state[15] = t;
  24575. for (var j = 0; j < 16; j += 4) {
  24576. var s0 = state[j + 0], s1 = state[j + 1];
  24577. var s2 = state[j + 2], s3 = state[j + 3];
  24578. t = s0 ^ s1 ^ s2 ^ s3;
  24579. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24580. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24581. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24582. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24583. }
  24584. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24585. state[j] ^= key[k];
  24586. }
  24587. }
  24588. for (j = 0; j < 16; ++j) {
  24589. state[j] = s[state[j]];
  24590. }
  24591. v = state[1];
  24592. state[1] = state[5];
  24593. state[5] = state[9];
  24594. state[9] = state[13];
  24595. state[13] = v;
  24596. v = state[2];
  24597. u = state[6];
  24598. state[2] = state[10];
  24599. state[6] = state[14];
  24600. state[10] = v;
  24601. state[14] = u;
  24602. v = state[3];
  24603. u = state[7];
  24604. t = state[11];
  24605. state[3] = state[15];
  24606. state[7] = v;
  24607. state[11] = u;
  24608. state[15] = t;
  24609. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24610. state[j] ^= key[k];
  24611. }
  24612. return state;
  24613. }
  24614. function AES128Cipher(key) {
  24615. this.key = expandKey128(key);
  24616. this.buffer = new Uint8Array(16);
  24617. this.bufferPosition = 0;
  24618. }
  24619. function decryptBlock2(data, finalize) {
  24620. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24621. for (i = 0; i < sourceLength; ++i) {
  24622. buffer[bufferLength] = data[i];
  24623. ++bufferLength;
  24624. if (bufferLength < 16) {
  24625. continue;
  24626. }
  24627. var plain = decrypt128(buffer, this.key);
  24628. for (j = 0; j < 16; ++j) {
  24629. plain[j] ^= iv[j];
  24630. }
  24631. iv = buffer;
  24632. result.push(plain);
  24633. buffer = new Uint8Array(16);
  24634. bufferLength = 0;
  24635. }
  24636. this.buffer = buffer;
  24637. this.bufferLength = bufferLength;
  24638. this.iv = iv;
  24639. if (result.length === 0) {
  24640. return new Uint8Array([]);
  24641. }
  24642. var outputLength = 16 * result.length;
  24643. if (finalize) {
  24644. var lastBlock = result[result.length - 1];
  24645. var psLen = lastBlock[15];
  24646. if (psLen <= 16) {
  24647. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24648. if (lastBlock[i] !== psLen) {
  24649. psLen = 0;
  24650. break;
  24651. }
  24652. }
  24653. outputLength -= psLen;
  24654. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24655. }
  24656. }
  24657. var output = new Uint8Array(outputLength);
  24658. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24659. output.set(result[i], j);
  24660. }
  24661. return output;
  24662. }
  24663. AES128Cipher.prototype = {
  24664. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  24665. var i, sourceLength = data.length;
  24666. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24667. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24668. buffer[bufferLength] = data[i];
  24669. }
  24670. if (bufferLength < 16) {
  24671. this.bufferLength = bufferLength;
  24672. return new Uint8Array([]);
  24673. }
  24674. this.iv = buffer;
  24675. this.buffer = new Uint8Array(16);
  24676. this.bufferLength = 0;
  24677. this.decryptBlock = decryptBlock2;
  24678. return this.decryptBlock(data.subarray(16), finalize);
  24679. },
  24680. encrypt: function AES128Cipher_encrypt(data, iv) {
  24681. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24682. if (!iv) {
  24683. iv = new Uint8Array(16);
  24684. }
  24685. for (i = 0; i < sourceLength; ++i) {
  24686. buffer[bufferLength] = data[i];
  24687. ++bufferLength;
  24688. if (bufferLength < 16) {
  24689. continue;
  24690. }
  24691. for (j = 0; j < 16; ++j) {
  24692. buffer[j] ^= iv[j];
  24693. }
  24694. var cipher = encrypt128(buffer, this.key);
  24695. iv = cipher;
  24696. result.push(cipher);
  24697. buffer = new Uint8Array(16);
  24698. bufferLength = 0;
  24699. }
  24700. this.buffer = buffer;
  24701. this.bufferLength = bufferLength;
  24702. this.iv = iv;
  24703. if (result.length === 0) {
  24704. return new Uint8Array([]);
  24705. }
  24706. var outputLength = 16 * result.length;
  24707. var output = new Uint8Array(outputLength);
  24708. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24709. output.set(result[i], j);
  24710. }
  24711. return output;
  24712. }
  24713. };
  24714. return AES128Cipher;
  24715. }();
  24716. var AES256Cipher = function AES256CipherClosure() {
  24717. var s = new Uint8Array([
  24718. 0x63,
  24719. 0x7c,
  24720. 0x77,
  24721. 0x7b,
  24722. 0xf2,
  24723. 0x6b,
  24724. 0x6f,
  24725. 0xc5,
  24726. 0x30,
  24727. 0x01,
  24728. 0x67,
  24729. 0x2b,
  24730. 0xfe,
  24731. 0xd7,
  24732. 0xab,
  24733. 0x76,
  24734. 0xca,
  24735. 0x82,
  24736. 0xc9,
  24737. 0x7d,
  24738. 0xfa,
  24739. 0x59,
  24740. 0x47,
  24741. 0xf0,
  24742. 0xad,
  24743. 0xd4,
  24744. 0xa2,
  24745. 0xaf,
  24746. 0x9c,
  24747. 0xa4,
  24748. 0x72,
  24749. 0xc0,
  24750. 0xb7,
  24751. 0xfd,
  24752. 0x93,
  24753. 0x26,
  24754. 0x36,
  24755. 0x3f,
  24756. 0xf7,
  24757. 0xcc,
  24758. 0x34,
  24759. 0xa5,
  24760. 0xe5,
  24761. 0xf1,
  24762. 0x71,
  24763. 0xd8,
  24764. 0x31,
  24765. 0x15,
  24766. 0x04,
  24767. 0xc7,
  24768. 0x23,
  24769. 0xc3,
  24770. 0x18,
  24771. 0x96,
  24772. 0x05,
  24773. 0x9a,
  24774. 0x07,
  24775. 0x12,
  24776. 0x80,
  24777. 0xe2,
  24778. 0xeb,
  24779. 0x27,
  24780. 0xb2,
  24781. 0x75,
  24782. 0x09,
  24783. 0x83,
  24784. 0x2c,
  24785. 0x1a,
  24786. 0x1b,
  24787. 0x6e,
  24788. 0x5a,
  24789. 0xa0,
  24790. 0x52,
  24791. 0x3b,
  24792. 0xd6,
  24793. 0xb3,
  24794. 0x29,
  24795. 0xe3,
  24796. 0x2f,
  24797. 0x84,
  24798. 0x53,
  24799. 0xd1,
  24800. 0x00,
  24801. 0xed,
  24802. 0x20,
  24803. 0xfc,
  24804. 0xb1,
  24805. 0x5b,
  24806. 0x6a,
  24807. 0xcb,
  24808. 0xbe,
  24809. 0x39,
  24810. 0x4a,
  24811. 0x4c,
  24812. 0x58,
  24813. 0xcf,
  24814. 0xd0,
  24815. 0xef,
  24816. 0xaa,
  24817. 0xfb,
  24818. 0x43,
  24819. 0x4d,
  24820. 0x33,
  24821. 0x85,
  24822. 0x45,
  24823. 0xf9,
  24824. 0x02,
  24825. 0x7f,
  24826. 0x50,
  24827. 0x3c,
  24828. 0x9f,
  24829. 0xa8,
  24830. 0x51,
  24831. 0xa3,
  24832. 0x40,
  24833. 0x8f,
  24834. 0x92,
  24835. 0x9d,
  24836. 0x38,
  24837. 0xf5,
  24838. 0xbc,
  24839. 0xb6,
  24840. 0xda,
  24841. 0x21,
  24842. 0x10,
  24843. 0xff,
  24844. 0xf3,
  24845. 0xd2,
  24846. 0xcd,
  24847. 0x0c,
  24848. 0x13,
  24849. 0xec,
  24850. 0x5f,
  24851. 0x97,
  24852. 0x44,
  24853. 0x17,
  24854. 0xc4,
  24855. 0xa7,
  24856. 0x7e,
  24857. 0x3d,
  24858. 0x64,
  24859. 0x5d,
  24860. 0x19,
  24861. 0x73,
  24862. 0x60,
  24863. 0x81,
  24864. 0x4f,
  24865. 0xdc,
  24866. 0x22,
  24867. 0x2a,
  24868. 0x90,
  24869. 0x88,
  24870. 0x46,
  24871. 0xee,
  24872. 0xb8,
  24873. 0x14,
  24874. 0xde,
  24875. 0x5e,
  24876. 0x0b,
  24877. 0xdb,
  24878. 0xe0,
  24879. 0x32,
  24880. 0x3a,
  24881. 0x0a,
  24882. 0x49,
  24883. 0x06,
  24884. 0x24,
  24885. 0x5c,
  24886. 0xc2,
  24887. 0xd3,
  24888. 0xac,
  24889. 0x62,
  24890. 0x91,
  24891. 0x95,
  24892. 0xe4,
  24893. 0x79,
  24894. 0xe7,
  24895. 0xc8,
  24896. 0x37,
  24897. 0x6d,
  24898. 0x8d,
  24899. 0xd5,
  24900. 0x4e,
  24901. 0xa9,
  24902. 0x6c,
  24903. 0x56,
  24904. 0xf4,
  24905. 0xea,
  24906. 0x65,
  24907. 0x7a,
  24908. 0xae,
  24909. 0x08,
  24910. 0xba,
  24911. 0x78,
  24912. 0x25,
  24913. 0x2e,
  24914. 0x1c,
  24915. 0xa6,
  24916. 0xb4,
  24917. 0xc6,
  24918. 0xe8,
  24919. 0xdd,
  24920. 0x74,
  24921. 0x1f,
  24922. 0x4b,
  24923. 0xbd,
  24924. 0x8b,
  24925. 0x8a,
  24926. 0x70,
  24927. 0x3e,
  24928. 0xb5,
  24929. 0x66,
  24930. 0x48,
  24931. 0x03,
  24932. 0xf6,
  24933. 0x0e,
  24934. 0x61,
  24935. 0x35,
  24936. 0x57,
  24937. 0xb9,
  24938. 0x86,
  24939. 0xc1,
  24940. 0x1d,
  24941. 0x9e,
  24942. 0xe1,
  24943. 0xf8,
  24944. 0x98,
  24945. 0x11,
  24946. 0x69,
  24947. 0xd9,
  24948. 0x8e,
  24949. 0x94,
  24950. 0x9b,
  24951. 0x1e,
  24952. 0x87,
  24953. 0xe9,
  24954. 0xce,
  24955. 0x55,
  24956. 0x28,
  24957. 0xdf,
  24958. 0x8c,
  24959. 0xa1,
  24960. 0x89,
  24961. 0x0d,
  24962. 0xbf,
  24963. 0xe6,
  24964. 0x42,
  24965. 0x68,
  24966. 0x41,
  24967. 0x99,
  24968. 0x2d,
  24969. 0x0f,
  24970. 0xb0,
  24971. 0x54,
  24972. 0xbb,
  24973. 0x16
  24974. ]);
  24975. var inv_s = new Uint8Array([
  24976. 0x52,
  24977. 0x09,
  24978. 0x6a,
  24979. 0xd5,
  24980. 0x30,
  24981. 0x36,
  24982. 0xa5,
  24983. 0x38,
  24984. 0xbf,
  24985. 0x40,
  24986. 0xa3,
  24987. 0x9e,
  24988. 0x81,
  24989. 0xf3,
  24990. 0xd7,
  24991. 0xfb,
  24992. 0x7c,
  24993. 0xe3,
  24994. 0x39,
  24995. 0x82,
  24996. 0x9b,
  24997. 0x2f,
  24998. 0xff,
  24999. 0x87,
  25000. 0x34,
  25001. 0x8e,
  25002. 0x43,
  25003. 0x44,
  25004. 0xc4,
  25005. 0xde,
  25006. 0xe9,
  25007. 0xcb,
  25008. 0x54,
  25009. 0x7b,
  25010. 0x94,
  25011. 0x32,
  25012. 0xa6,
  25013. 0xc2,
  25014. 0x23,
  25015. 0x3d,
  25016. 0xee,
  25017. 0x4c,
  25018. 0x95,
  25019. 0x0b,
  25020. 0x42,
  25021. 0xfa,
  25022. 0xc3,
  25023. 0x4e,
  25024. 0x08,
  25025. 0x2e,
  25026. 0xa1,
  25027. 0x66,
  25028. 0x28,
  25029. 0xd9,
  25030. 0x24,
  25031. 0xb2,
  25032. 0x76,
  25033. 0x5b,
  25034. 0xa2,
  25035. 0x49,
  25036. 0x6d,
  25037. 0x8b,
  25038. 0xd1,
  25039. 0x25,
  25040. 0x72,
  25041. 0xf8,
  25042. 0xf6,
  25043. 0x64,
  25044. 0x86,
  25045. 0x68,
  25046. 0x98,
  25047. 0x16,
  25048. 0xd4,
  25049. 0xa4,
  25050. 0x5c,
  25051. 0xcc,
  25052. 0x5d,
  25053. 0x65,
  25054. 0xb6,
  25055. 0x92,
  25056. 0x6c,
  25057. 0x70,
  25058. 0x48,
  25059. 0x50,
  25060. 0xfd,
  25061. 0xed,
  25062. 0xb9,
  25063. 0xda,
  25064. 0x5e,
  25065. 0x15,
  25066. 0x46,
  25067. 0x57,
  25068. 0xa7,
  25069. 0x8d,
  25070. 0x9d,
  25071. 0x84,
  25072. 0x90,
  25073. 0xd8,
  25074. 0xab,
  25075. 0x00,
  25076. 0x8c,
  25077. 0xbc,
  25078. 0xd3,
  25079. 0x0a,
  25080. 0xf7,
  25081. 0xe4,
  25082. 0x58,
  25083. 0x05,
  25084. 0xb8,
  25085. 0xb3,
  25086. 0x45,
  25087. 0x06,
  25088. 0xd0,
  25089. 0x2c,
  25090. 0x1e,
  25091. 0x8f,
  25092. 0xca,
  25093. 0x3f,
  25094. 0x0f,
  25095. 0x02,
  25096. 0xc1,
  25097. 0xaf,
  25098. 0xbd,
  25099. 0x03,
  25100. 0x01,
  25101. 0x13,
  25102. 0x8a,
  25103. 0x6b,
  25104. 0x3a,
  25105. 0x91,
  25106. 0x11,
  25107. 0x41,
  25108. 0x4f,
  25109. 0x67,
  25110. 0xdc,
  25111. 0xea,
  25112. 0x97,
  25113. 0xf2,
  25114. 0xcf,
  25115. 0xce,
  25116. 0xf0,
  25117. 0xb4,
  25118. 0xe6,
  25119. 0x73,
  25120. 0x96,
  25121. 0xac,
  25122. 0x74,
  25123. 0x22,
  25124. 0xe7,
  25125. 0xad,
  25126. 0x35,
  25127. 0x85,
  25128. 0xe2,
  25129. 0xf9,
  25130. 0x37,
  25131. 0xe8,
  25132. 0x1c,
  25133. 0x75,
  25134. 0xdf,
  25135. 0x6e,
  25136. 0x47,
  25137. 0xf1,
  25138. 0x1a,
  25139. 0x71,
  25140. 0x1d,
  25141. 0x29,
  25142. 0xc5,
  25143. 0x89,
  25144. 0x6f,
  25145. 0xb7,
  25146. 0x62,
  25147. 0x0e,
  25148. 0xaa,
  25149. 0x18,
  25150. 0xbe,
  25151. 0x1b,
  25152. 0xfc,
  25153. 0x56,
  25154. 0x3e,
  25155. 0x4b,
  25156. 0xc6,
  25157. 0xd2,
  25158. 0x79,
  25159. 0x20,
  25160. 0x9a,
  25161. 0xdb,
  25162. 0xc0,
  25163. 0xfe,
  25164. 0x78,
  25165. 0xcd,
  25166. 0x5a,
  25167. 0xf4,
  25168. 0x1f,
  25169. 0xdd,
  25170. 0xa8,
  25171. 0x33,
  25172. 0x88,
  25173. 0x07,
  25174. 0xc7,
  25175. 0x31,
  25176. 0xb1,
  25177. 0x12,
  25178. 0x10,
  25179. 0x59,
  25180. 0x27,
  25181. 0x80,
  25182. 0xec,
  25183. 0x5f,
  25184. 0x60,
  25185. 0x51,
  25186. 0x7f,
  25187. 0xa9,
  25188. 0x19,
  25189. 0xb5,
  25190. 0x4a,
  25191. 0x0d,
  25192. 0x2d,
  25193. 0xe5,
  25194. 0x7a,
  25195. 0x9f,
  25196. 0x93,
  25197. 0xc9,
  25198. 0x9c,
  25199. 0xef,
  25200. 0xa0,
  25201. 0xe0,
  25202. 0x3b,
  25203. 0x4d,
  25204. 0xae,
  25205. 0x2a,
  25206. 0xf5,
  25207. 0xb0,
  25208. 0xc8,
  25209. 0xeb,
  25210. 0xbb,
  25211. 0x3c,
  25212. 0x83,
  25213. 0x53,
  25214. 0x99,
  25215. 0x61,
  25216. 0x17,
  25217. 0x2b,
  25218. 0x04,
  25219. 0x7e,
  25220. 0xba,
  25221. 0x77,
  25222. 0xd6,
  25223. 0x26,
  25224. 0xe1,
  25225. 0x69,
  25226. 0x14,
  25227. 0x63,
  25228. 0x55,
  25229. 0x21,
  25230. 0x0c,
  25231. 0x7d
  25232. ]);
  25233. var mixCol = new Uint8Array(256);
  25234. for (var i = 0; i < 256; i++) {
  25235. if (i < 128) {
  25236. mixCol[i] = i << 1;
  25237. } else {
  25238. mixCol[i] = i << 1 ^ 0x1b;
  25239. }
  25240. }
  25241. var mix = new Uint32Array([
  25242. 0x00000000,
  25243. 0x0e090d0b,
  25244. 0x1c121a16,
  25245. 0x121b171d,
  25246. 0x3824342c,
  25247. 0x362d3927,
  25248. 0x24362e3a,
  25249. 0x2a3f2331,
  25250. 0x70486858,
  25251. 0x7e416553,
  25252. 0x6c5a724e,
  25253. 0x62537f45,
  25254. 0x486c5c74,
  25255. 0x4665517f,
  25256. 0x547e4662,
  25257. 0x5a774b69,
  25258. 0xe090d0b0,
  25259. 0xee99ddbb,
  25260. 0xfc82caa6,
  25261. 0xf28bc7ad,
  25262. 0xd8b4e49c,
  25263. 0xd6bde997,
  25264. 0xc4a6fe8a,
  25265. 0xcaaff381,
  25266. 0x90d8b8e8,
  25267. 0x9ed1b5e3,
  25268. 0x8ccaa2fe,
  25269. 0x82c3aff5,
  25270. 0xa8fc8cc4,
  25271. 0xa6f581cf,
  25272. 0xb4ee96d2,
  25273. 0xbae79bd9,
  25274. 0xdb3bbb7b,
  25275. 0xd532b670,
  25276. 0xc729a16d,
  25277. 0xc920ac66,
  25278. 0xe31f8f57,
  25279. 0xed16825c,
  25280. 0xff0d9541,
  25281. 0xf104984a,
  25282. 0xab73d323,
  25283. 0xa57ade28,
  25284. 0xb761c935,
  25285. 0xb968c43e,
  25286. 0x9357e70f,
  25287. 0x9d5eea04,
  25288. 0x8f45fd19,
  25289. 0x814cf012,
  25290. 0x3bab6bcb,
  25291. 0x35a266c0,
  25292. 0x27b971dd,
  25293. 0x29b07cd6,
  25294. 0x038f5fe7,
  25295. 0x0d8652ec,
  25296. 0x1f9d45f1,
  25297. 0x119448fa,
  25298. 0x4be30393,
  25299. 0x45ea0e98,
  25300. 0x57f11985,
  25301. 0x59f8148e,
  25302. 0x73c737bf,
  25303. 0x7dce3ab4,
  25304. 0x6fd52da9,
  25305. 0x61dc20a2,
  25306. 0xad766df6,
  25307. 0xa37f60fd,
  25308. 0xb16477e0,
  25309. 0xbf6d7aeb,
  25310. 0x955259da,
  25311. 0x9b5b54d1,
  25312. 0x894043cc,
  25313. 0x87494ec7,
  25314. 0xdd3e05ae,
  25315. 0xd33708a5,
  25316. 0xc12c1fb8,
  25317. 0xcf2512b3,
  25318. 0xe51a3182,
  25319. 0xeb133c89,
  25320. 0xf9082b94,
  25321. 0xf701269f,
  25322. 0x4de6bd46,
  25323. 0x43efb04d,
  25324. 0x51f4a750,
  25325. 0x5ffdaa5b,
  25326. 0x75c2896a,
  25327. 0x7bcb8461,
  25328. 0x69d0937c,
  25329. 0x67d99e77,
  25330. 0x3daed51e,
  25331. 0x33a7d815,
  25332. 0x21bccf08,
  25333. 0x2fb5c203,
  25334. 0x058ae132,
  25335. 0x0b83ec39,
  25336. 0x1998fb24,
  25337. 0x1791f62f,
  25338. 0x764dd68d,
  25339. 0x7844db86,
  25340. 0x6a5fcc9b,
  25341. 0x6456c190,
  25342. 0x4e69e2a1,
  25343. 0x4060efaa,
  25344. 0x527bf8b7,
  25345. 0x5c72f5bc,
  25346. 0x0605bed5,
  25347. 0x080cb3de,
  25348. 0x1a17a4c3,
  25349. 0x141ea9c8,
  25350. 0x3e218af9,
  25351. 0x302887f2,
  25352. 0x223390ef,
  25353. 0x2c3a9de4,
  25354. 0x96dd063d,
  25355. 0x98d40b36,
  25356. 0x8acf1c2b,
  25357. 0x84c61120,
  25358. 0xaef93211,
  25359. 0xa0f03f1a,
  25360. 0xb2eb2807,
  25361. 0xbce2250c,
  25362. 0xe6956e65,
  25363. 0xe89c636e,
  25364. 0xfa877473,
  25365. 0xf48e7978,
  25366. 0xdeb15a49,
  25367. 0xd0b85742,
  25368. 0xc2a3405f,
  25369. 0xccaa4d54,
  25370. 0x41ecdaf7,
  25371. 0x4fe5d7fc,
  25372. 0x5dfec0e1,
  25373. 0x53f7cdea,
  25374. 0x79c8eedb,
  25375. 0x77c1e3d0,
  25376. 0x65daf4cd,
  25377. 0x6bd3f9c6,
  25378. 0x31a4b2af,
  25379. 0x3fadbfa4,
  25380. 0x2db6a8b9,
  25381. 0x23bfa5b2,
  25382. 0x09808683,
  25383. 0x07898b88,
  25384. 0x15929c95,
  25385. 0x1b9b919e,
  25386. 0xa17c0a47,
  25387. 0xaf75074c,
  25388. 0xbd6e1051,
  25389. 0xb3671d5a,
  25390. 0x99583e6b,
  25391. 0x97513360,
  25392. 0x854a247d,
  25393. 0x8b432976,
  25394. 0xd134621f,
  25395. 0xdf3d6f14,
  25396. 0xcd267809,
  25397. 0xc32f7502,
  25398. 0xe9105633,
  25399. 0xe7195b38,
  25400. 0xf5024c25,
  25401. 0xfb0b412e,
  25402. 0x9ad7618c,
  25403. 0x94de6c87,
  25404. 0x86c57b9a,
  25405. 0x88cc7691,
  25406. 0xa2f355a0,
  25407. 0xacfa58ab,
  25408. 0xbee14fb6,
  25409. 0xb0e842bd,
  25410. 0xea9f09d4,
  25411. 0xe49604df,
  25412. 0xf68d13c2,
  25413. 0xf8841ec9,
  25414. 0xd2bb3df8,
  25415. 0xdcb230f3,
  25416. 0xcea927ee,
  25417. 0xc0a02ae5,
  25418. 0x7a47b13c,
  25419. 0x744ebc37,
  25420. 0x6655ab2a,
  25421. 0x685ca621,
  25422. 0x42638510,
  25423. 0x4c6a881b,
  25424. 0x5e719f06,
  25425. 0x5078920d,
  25426. 0x0a0fd964,
  25427. 0x0406d46f,
  25428. 0x161dc372,
  25429. 0x1814ce79,
  25430. 0x322bed48,
  25431. 0x3c22e043,
  25432. 0x2e39f75e,
  25433. 0x2030fa55,
  25434. 0xec9ab701,
  25435. 0xe293ba0a,
  25436. 0xf088ad17,
  25437. 0xfe81a01c,
  25438. 0xd4be832d,
  25439. 0xdab78e26,
  25440. 0xc8ac993b,
  25441. 0xc6a59430,
  25442. 0x9cd2df59,
  25443. 0x92dbd252,
  25444. 0x80c0c54f,
  25445. 0x8ec9c844,
  25446. 0xa4f6eb75,
  25447. 0xaaffe67e,
  25448. 0xb8e4f163,
  25449. 0xb6edfc68,
  25450. 0x0c0a67b1,
  25451. 0x02036aba,
  25452. 0x10187da7,
  25453. 0x1e1170ac,
  25454. 0x342e539d,
  25455. 0x3a275e96,
  25456. 0x283c498b,
  25457. 0x26354480,
  25458. 0x7c420fe9,
  25459. 0x724b02e2,
  25460. 0x605015ff,
  25461. 0x6e5918f4,
  25462. 0x44663bc5,
  25463. 0x4a6f36ce,
  25464. 0x587421d3,
  25465. 0x567d2cd8,
  25466. 0x37a10c7a,
  25467. 0x39a80171,
  25468. 0x2bb3166c,
  25469. 0x25ba1b67,
  25470. 0x0f853856,
  25471. 0x018c355d,
  25472. 0x13972240,
  25473. 0x1d9e2f4b,
  25474. 0x47e96422,
  25475. 0x49e06929,
  25476. 0x5bfb7e34,
  25477. 0x55f2733f,
  25478. 0x7fcd500e,
  25479. 0x71c45d05,
  25480. 0x63df4a18,
  25481. 0x6dd64713,
  25482. 0xd731dcca,
  25483. 0xd938d1c1,
  25484. 0xcb23c6dc,
  25485. 0xc52acbd7,
  25486. 0xef15e8e6,
  25487. 0xe11ce5ed,
  25488. 0xf307f2f0,
  25489. 0xfd0efffb,
  25490. 0xa779b492,
  25491. 0xa970b999,
  25492. 0xbb6bae84,
  25493. 0xb562a38f,
  25494. 0x9f5d80be,
  25495. 0x91548db5,
  25496. 0x834f9aa8,
  25497. 0x8d4697a3
  25498. ]);
  25499. function expandKey256(cipherKey) {
  25500. var b = 240, result = new Uint8Array(b);
  25501. var r = 1;
  25502. result.set(cipherKey);
  25503. for (var j = 32, i = 1; j < b; ++i) {
  25504. if (j % 32 === 16) {
  25505. t1 = s[t1];
  25506. t2 = s[t2];
  25507. t3 = s[t3];
  25508. t4 = s[t4];
  25509. } else if (j % 32 === 0) {
  25510. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  25511. t1 = s[t1];
  25512. t2 = s[t2];
  25513. t3 = s[t3];
  25514. t4 = s[t4];
  25515. t1 = t1 ^ r;
  25516. if ((r <<= 1) >= 256) {
  25517. r = (r ^ 0x1b) & 0xFF;
  25518. }
  25519. }
  25520. for (var n = 0; n < 4; ++n) {
  25521. result[j] = t1 ^= result[j - 32];
  25522. j++;
  25523. result[j] = t2 ^= result[j - 32];
  25524. j++;
  25525. result[j] = t3 ^= result[j - 32];
  25526. j++;
  25527. result[j] = t4 ^= result[j - 32];
  25528. j++;
  25529. }
  25530. }
  25531. return result;
  25532. }
  25533. function decrypt256(input, key) {
  25534. var state = new Uint8Array(16);
  25535. state.set(input);
  25536. var i, j, k;
  25537. var t, u, v;
  25538. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25539. state[j] ^= key[k];
  25540. }
  25541. for (i = 13; i >= 1; --i) {
  25542. t = state[13];
  25543. state[13] = state[9];
  25544. state[9] = state[5];
  25545. state[5] = state[1];
  25546. state[1] = t;
  25547. t = state[14];
  25548. u = state[10];
  25549. state[14] = state[6];
  25550. state[10] = state[2];
  25551. state[6] = t;
  25552. state[2] = u;
  25553. t = state[15];
  25554. u = state[11];
  25555. v = state[7];
  25556. state[15] = state[3];
  25557. state[11] = t;
  25558. state[7] = u;
  25559. state[3] = v;
  25560. for (j = 0; j < 16; ++j) {
  25561. state[j] = inv_s[state[j]];
  25562. }
  25563. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25564. state[j] ^= key[k];
  25565. }
  25566. for (j = 0; j < 16; j += 4) {
  25567. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  25568. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  25569. state[j] = t >>> 24 & 0xFF;
  25570. state[j + 1] = t >> 16 & 0xFF;
  25571. state[j + 2] = t >> 8 & 0xFF;
  25572. state[j + 3] = t & 0xFF;
  25573. }
  25574. }
  25575. t = state[13];
  25576. state[13] = state[9];
  25577. state[9] = state[5];
  25578. state[5] = state[1];
  25579. state[1] = t;
  25580. t = state[14];
  25581. u = state[10];
  25582. state[14] = state[6];
  25583. state[10] = state[2];
  25584. state[6] = t;
  25585. state[2] = u;
  25586. t = state[15];
  25587. u = state[11];
  25588. v = state[7];
  25589. state[15] = state[3];
  25590. state[11] = t;
  25591. state[7] = u;
  25592. state[3] = v;
  25593. for (j = 0; j < 16; ++j) {
  25594. state[j] = inv_s[state[j]];
  25595. state[j] ^= key[j];
  25596. }
  25597. return state;
  25598. }
  25599. function encrypt256(input, key) {
  25600. var t, u, v, k;
  25601. var state = new Uint8Array(16);
  25602. state.set(input);
  25603. for (j = 0; j < 16; ++j) {
  25604. state[j] ^= key[j];
  25605. }
  25606. for (i = 1; i < 14; i++) {
  25607. for (j = 0; j < 16; ++j) {
  25608. state[j] = s[state[j]];
  25609. }
  25610. v = state[1];
  25611. state[1] = state[5];
  25612. state[5] = state[9];
  25613. state[9] = state[13];
  25614. state[13] = v;
  25615. v = state[2];
  25616. u = state[6];
  25617. state[2] = state[10];
  25618. state[6] = state[14];
  25619. state[10] = v;
  25620. state[14] = u;
  25621. v = state[3];
  25622. u = state[7];
  25623. t = state[11];
  25624. state[3] = state[15];
  25625. state[7] = v;
  25626. state[11] = u;
  25627. state[15] = t;
  25628. for (var j = 0; j < 16; j += 4) {
  25629. var s0 = state[j + 0], s1 = state[j + 1];
  25630. var s2 = state[j + 2], s3 = state[j + 3];
  25631. t = s0 ^ s1 ^ s2 ^ s3;
  25632. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  25633. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  25634. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  25635. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  25636. }
  25637. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25638. state[j] ^= key[k];
  25639. }
  25640. }
  25641. for (j = 0; j < 16; ++j) {
  25642. state[j] = s[state[j]];
  25643. }
  25644. v = state[1];
  25645. state[1] = state[5];
  25646. state[5] = state[9];
  25647. state[9] = state[13];
  25648. state[13] = v;
  25649. v = state[2];
  25650. u = state[6];
  25651. state[2] = state[10];
  25652. state[6] = state[14];
  25653. state[10] = v;
  25654. state[14] = u;
  25655. v = state[3];
  25656. u = state[7];
  25657. t = state[11];
  25658. state[3] = state[15];
  25659. state[7] = v;
  25660. state[11] = u;
  25661. state[15] = t;
  25662. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25663. state[j] ^= key[k];
  25664. }
  25665. return state;
  25666. }
  25667. function AES256Cipher(key) {
  25668. this.key = expandKey256(key);
  25669. this.buffer = new Uint8Array(16);
  25670. this.bufferPosition = 0;
  25671. }
  25672. function decryptBlock2(data, finalize) {
  25673. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  25674. for (i = 0; i < sourceLength; ++i) {
  25675. buffer[bufferLength] = data[i];
  25676. ++bufferLength;
  25677. if (bufferLength < 16) {
  25678. continue;
  25679. }
  25680. var plain = decrypt256(buffer, this.key);
  25681. for (j = 0; j < 16; ++j) {
  25682. plain[j] ^= iv[j];
  25683. }
  25684. iv = buffer;
  25685. result.push(plain);
  25686. buffer = new Uint8Array(16);
  25687. bufferLength = 0;
  25688. }
  25689. this.buffer = buffer;
  25690. this.bufferLength = bufferLength;
  25691. this.iv = iv;
  25692. if (result.length === 0) {
  25693. return new Uint8Array([]);
  25694. }
  25695. var outputLength = 16 * result.length;
  25696. if (finalize) {
  25697. var lastBlock = result[result.length - 1];
  25698. var psLen = lastBlock[15];
  25699. if (psLen <= 16) {
  25700. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  25701. if (lastBlock[i] !== psLen) {
  25702. psLen = 0;
  25703. break;
  25704. }
  25705. }
  25706. outputLength -= psLen;
  25707. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  25708. }
  25709. }
  25710. var output = new Uint8Array(outputLength);
  25711. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25712. output.set(result[i], j);
  25713. }
  25714. return output;
  25715. }
  25716. AES256Cipher.prototype = {
  25717. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  25718. var i, sourceLength = data.length;
  25719. var buffer = this.buffer, bufferLength = this.bufferPosition;
  25720. if (iv) {
  25721. this.iv = iv;
  25722. } else {
  25723. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  25724. buffer[bufferLength] = data[i];
  25725. }
  25726. if (bufferLength < 16) {
  25727. this.bufferLength = bufferLength;
  25728. return new Uint8Array([]);
  25729. }
  25730. this.iv = buffer;
  25731. data = data.subarray(16);
  25732. }
  25733. this.buffer = new Uint8Array(16);
  25734. this.bufferLength = 0;
  25735. this.decryptBlock = decryptBlock2;
  25736. return this.decryptBlock(data, finalize);
  25737. },
  25738. encrypt: function AES256Cipher_encrypt(data, iv) {
  25739. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  25740. if (!iv) {
  25741. iv = new Uint8Array(16);
  25742. }
  25743. for (i = 0; i < sourceLength; ++i) {
  25744. buffer[bufferLength] = data[i];
  25745. ++bufferLength;
  25746. if (bufferLength < 16) {
  25747. continue;
  25748. }
  25749. for (j = 0; j < 16; ++j) {
  25750. buffer[j] ^= iv[j];
  25751. }
  25752. var cipher = encrypt256(buffer, this.key);
  25753. this.iv = cipher;
  25754. result.push(cipher);
  25755. buffer = new Uint8Array(16);
  25756. bufferLength = 0;
  25757. }
  25758. this.buffer = buffer;
  25759. this.bufferLength = bufferLength;
  25760. this.iv = iv;
  25761. if (result.length === 0) {
  25762. return new Uint8Array([]);
  25763. }
  25764. var outputLength = 16 * result.length;
  25765. var output = new Uint8Array(outputLength);
  25766. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25767. output.set(result[i], j);
  25768. }
  25769. return output;
  25770. }
  25771. };
  25772. return AES256Cipher;
  25773. }();
  25774. var PDF17 = function PDF17Closure() {
  25775. function compareByteArrays(array1, array2) {
  25776. if (array1.length !== array2.length) {
  25777. return false;
  25778. }
  25779. for (var i = 0; i < array1.length; i++) {
  25780. if (array1[i] !== array2[i]) {
  25781. return false;
  25782. }
  25783. }
  25784. return true;
  25785. }
  25786. function PDF17() {
  25787. }
  25788. PDF17.prototype = {
  25789. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25790. var hashData = new Uint8Array(password.length + 56);
  25791. hashData.set(password, 0);
  25792. hashData.set(ownerValidationSalt, password.length);
  25793. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25794. var result = calculateSHA256(hashData, 0, hashData.length);
  25795. return compareByteArrays(result, ownerPassword);
  25796. },
  25797. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  25798. var hashData = new Uint8Array(password.length + 8);
  25799. hashData.set(password, 0);
  25800. hashData.set(userValidationSalt, password.length);
  25801. var result = calculateSHA256(hashData, 0, hashData.length);
  25802. return compareByteArrays(result, userPassword);
  25803. },
  25804. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25805. var hashData = new Uint8Array(password.length + 56);
  25806. hashData.set(password, 0);
  25807. hashData.set(ownerKeySalt, password.length);
  25808. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25809. var key = calculateSHA256(hashData, 0, hashData.length);
  25810. var cipher = new AES256Cipher(key);
  25811. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25812. },
  25813. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  25814. var hashData = new Uint8Array(password.length + 8);
  25815. hashData.set(password, 0);
  25816. hashData.set(userKeySalt, password.length);
  25817. var key = calculateSHA256(hashData, 0, hashData.length);
  25818. var cipher = new AES256Cipher(key);
  25819. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25820. }
  25821. };
  25822. return PDF17;
  25823. }();
  25824. var PDF20 = function PDF20Closure() {
  25825. function concatArrays(array1, array2) {
  25826. var t = new Uint8Array(array1.length + array2.length);
  25827. t.set(array1, 0);
  25828. t.set(array2, array1.length);
  25829. return t;
  25830. }
  25831. function calculatePDF20Hash(password, input, userBytes) {
  25832. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25833. var e = [0];
  25834. var i = 0;
  25835. while (i < 64 || e[e.length - 1] > i - 32) {
  25836. var arrayLength = password.length + k.length + userBytes.length;
  25837. var k1 = new Uint8Array(arrayLength * 64);
  25838. var array = concatArrays(password, k);
  25839. array = concatArrays(array, userBytes);
  25840. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25841. k1.set(array, pos);
  25842. }
  25843. var cipher = new AES128Cipher(k.subarray(0, 16));
  25844. e = cipher.encrypt(k1, k.subarray(16, 32));
  25845. var remainder = 0;
  25846. for (var z = 0; z < 16; z++) {
  25847. remainder *= 256 % 3;
  25848. remainder %= 3;
  25849. remainder += (e[z] >>> 0) % 3;
  25850. remainder %= 3;
  25851. }
  25852. if (remainder === 0) {
  25853. k = calculateSHA256(e, 0, e.length);
  25854. } else if (remainder === 1) {
  25855. k = calculateSHA384(e, 0, e.length);
  25856. } else if (remainder === 2) {
  25857. k = calculateSHA512(e, 0, e.length);
  25858. }
  25859. i++;
  25860. }
  25861. return k.subarray(0, 32);
  25862. }
  25863. function PDF20() {
  25864. }
  25865. function compareByteArrays(array1, array2) {
  25866. if (array1.length !== array2.length) {
  25867. return false;
  25868. }
  25869. for (var i = 0; i < array1.length; i++) {
  25870. if (array1[i] !== array2[i]) {
  25871. return false;
  25872. }
  25873. }
  25874. return true;
  25875. }
  25876. PDF20.prototype = {
  25877. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25878. return calculatePDF20Hash(password, concatBytes, userBytes);
  25879. },
  25880. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25881. var hashData = new Uint8Array(password.length + 56);
  25882. hashData.set(password, 0);
  25883. hashData.set(ownerValidationSalt, password.length);
  25884. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25885. var result = calculatePDF20Hash(password, hashData, userBytes);
  25886. return compareByteArrays(result, ownerPassword);
  25887. },
  25888. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25889. var hashData = new Uint8Array(password.length + 8);
  25890. hashData.set(password, 0);
  25891. hashData.set(userValidationSalt, password.length);
  25892. var result = calculatePDF20Hash(password, hashData, []);
  25893. return compareByteArrays(result, userPassword);
  25894. },
  25895. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25896. var hashData = new Uint8Array(password.length + 56);
  25897. hashData.set(password, 0);
  25898. hashData.set(ownerKeySalt, password.length);
  25899. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25900. var key = calculatePDF20Hash(password, hashData, userBytes);
  25901. var cipher = new AES256Cipher(key);
  25902. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25903. },
  25904. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25905. var hashData = new Uint8Array(password.length + 8);
  25906. hashData.set(password, 0);
  25907. hashData.set(userKeySalt, password.length);
  25908. var key = calculatePDF20Hash(password, hashData, []);
  25909. var cipher = new AES256Cipher(key);
  25910. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25911. }
  25912. };
  25913. return PDF20;
  25914. }();
  25915. var CipherTransform = function CipherTransformClosure() {
  25916. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25917. this.StringCipherConstructor = stringCipherConstructor;
  25918. this.StreamCipherConstructor = streamCipherConstructor;
  25919. }
  25920. CipherTransform.prototype = {
  25921. createStream: function CipherTransform_createStream(stream, length) {
  25922. var cipher = new this.StreamCipherConstructor();
  25923. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25924. return cipher.decryptBlock(data, finalize);
  25925. });
  25926. },
  25927. decryptString: function CipherTransform_decryptString(s) {
  25928. var cipher = new this.StringCipherConstructor();
  25929. var data = stringToBytes(s);
  25930. data = cipher.decryptBlock(data, true);
  25931. return bytesToString(data);
  25932. }
  25933. };
  25934. return CipherTransform;
  25935. }();
  25936. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25937. var defaultPasswordBytes = new Uint8Array([
  25938. 0x28,
  25939. 0xBF,
  25940. 0x4E,
  25941. 0x5E,
  25942. 0x4E,
  25943. 0x75,
  25944. 0x8A,
  25945. 0x41,
  25946. 0x64,
  25947. 0x00,
  25948. 0x4E,
  25949. 0x56,
  25950. 0xFF,
  25951. 0xFA,
  25952. 0x01,
  25953. 0x08,
  25954. 0x2E,
  25955. 0x2E,
  25956. 0x00,
  25957. 0xB6,
  25958. 0xD0,
  25959. 0x68,
  25960. 0x3E,
  25961. 0x80,
  25962. 0x2F,
  25963. 0x0C,
  25964. 0xA9,
  25965. 0xFE,
  25966. 0x64,
  25967. 0x53,
  25968. 0x69,
  25969. 0x7A
  25970. ]);
  25971. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25972. if (password) {
  25973. var passwordLength = Math.min(127, password.length);
  25974. password = password.subarray(0, passwordLength);
  25975. } else {
  25976. password = [];
  25977. }
  25978. var pdfAlgorithm;
  25979. if (revision === 6) {
  25980. pdfAlgorithm = new PDF20();
  25981. } else {
  25982. pdfAlgorithm = new PDF17();
  25983. }
  25984. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25985. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25986. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25987. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25988. }
  25989. return null;
  25990. }
  25991. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25992. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25993. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25994. if (password) {
  25995. n = Math.min(32, password.length);
  25996. for (; i < n; ++i) {
  25997. hashData[i] = password[i];
  25998. }
  25999. }
  26000. j = 0;
  26001. while (i < 32) {
  26002. hashData[i++] = defaultPasswordBytes[j++];
  26003. }
  26004. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  26005. hashData[i++] = ownerPassword[j];
  26006. }
  26007. hashData[i++] = flags & 0xFF;
  26008. hashData[i++] = flags >> 8 & 0xFF;
  26009. hashData[i++] = flags >> 16 & 0xFF;
  26010. hashData[i++] = flags >>> 24 & 0xFF;
  26011. for (j = 0, n = fileId.length; j < n; ++j) {
  26012. hashData[i++] = fileId[j];
  26013. }
  26014. if (revision >= 4 && !encryptMetadata) {
  26015. hashData[i++] = 0xFF;
  26016. hashData[i++] = 0xFF;
  26017. hashData[i++] = 0xFF;
  26018. hashData[i++] = 0xFF;
  26019. }
  26020. var hash = calculateMD5(hashData, 0, i);
  26021. var keyLengthInBytes = keyLength >> 3;
  26022. if (revision >= 3) {
  26023. for (j = 0; j < 50; ++j) {
  26024. hash = calculateMD5(hash, 0, keyLengthInBytes);
  26025. }
  26026. }
  26027. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  26028. var cipher, checkData;
  26029. if (revision >= 3) {
  26030. for (i = 0; i < 32; ++i) {
  26031. hashData[i] = defaultPasswordBytes[i];
  26032. }
  26033. for (j = 0, n = fileId.length; j < n; ++j) {
  26034. hashData[i++] = fileId[j];
  26035. }
  26036. cipher = new ARCFourCipher(encryptionKey);
  26037. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  26038. n = encryptionKey.length;
  26039. var derivedKey = new Uint8Array(n), k;
  26040. for (j = 1; j <= 19; ++j) {
  26041. for (k = 0; k < n; ++k) {
  26042. derivedKey[k] = encryptionKey[k] ^ j;
  26043. }
  26044. cipher = new ARCFourCipher(derivedKey);
  26045. checkData = cipher.encryptBlock(checkData);
  26046. }
  26047. for (j = 0, n = checkData.length; j < n; ++j) {
  26048. if (userPassword[j] !== checkData[j]) {
  26049. return null;
  26050. }
  26051. }
  26052. } else {
  26053. cipher = new ARCFourCipher(encryptionKey);
  26054. checkData = cipher.encryptBlock(defaultPasswordBytes);
  26055. for (j = 0, n = checkData.length; j < n; ++j) {
  26056. if (userPassword[j] !== checkData[j]) {
  26057. return null;
  26058. }
  26059. }
  26060. }
  26061. return encryptionKey;
  26062. }
  26063. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  26064. var hashData = new Uint8Array(32), i = 0, j, n;
  26065. n = Math.min(32, password.length);
  26066. for (; i < n; ++i) {
  26067. hashData[i] = password[i];
  26068. }
  26069. j = 0;
  26070. while (i < 32) {
  26071. hashData[i++] = defaultPasswordBytes[j++];
  26072. }
  26073. var hash = calculateMD5(hashData, 0, i);
  26074. var keyLengthInBytes = keyLength >> 3;
  26075. if (revision >= 3) {
  26076. for (j = 0; j < 50; ++j) {
  26077. hash = calculateMD5(hash, 0, hash.length);
  26078. }
  26079. }
  26080. var cipher, userPassword;
  26081. if (revision >= 3) {
  26082. userPassword = ownerPassword;
  26083. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  26084. for (j = 19; j >= 0; j--) {
  26085. for (k = 0; k < keyLengthInBytes; ++k) {
  26086. derivedKey[k] = hash[k] ^ j;
  26087. }
  26088. cipher = new ARCFourCipher(derivedKey);
  26089. userPassword = cipher.encryptBlock(userPassword);
  26090. }
  26091. } else {
  26092. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  26093. userPassword = cipher.encryptBlock(ownerPassword);
  26094. }
  26095. return userPassword;
  26096. }
  26097. var identityName = Name.get('Identity');
  26098. function CipherTransformFactory(dict, fileId, password) {
  26099. var filter = dict.get('Filter');
  26100. if (!isName(filter, 'Standard')) {
  26101. error('unknown encryption method');
  26102. }
  26103. this.dict = dict;
  26104. var algorithm = dict.get('V');
  26105. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  26106. error('unsupported encryption algorithm');
  26107. }
  26108. this.algorithm = algorithm;
  26109. var keyLength = dict.get('Length');
  26110. if (!keyLength) {
  26111. if (algorithm <= 3) {
  26112. keyLength = 40;
  26113. } else {
  26114. var cfDict = dict.get('CF');
  26115. var streamCryptoName = dict.get('StmF');
  26116. if (isDict(cfDict) && isName(streamCryptoName)) {
  26117. cfDict.suppressEncryption = true;
  26118. var handlerDict = cfDict.get(streamCryptoName.name);
  26119. keyLength = handlerDict && handlerDict.get('Length') || 128;
  26120. if (keyLength < 40) {
  26121. keyLength <<= 3;
  26122. }
  26123. }
  26124. }
  26125. }
  26126. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  26127. error('invalid key length');
  26128. }
  26129. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  26130. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  26131. var flags = dict.get('P');
  26132. var revision = dict.get('R');
  26133. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  26134. this.encryptMetadata = encryptMetadata;
  26135. var fileIdBytes = stringToBytes(fileId);
  26136. var passwordBytes;
  26137. if (password) {
  26138. if (revision === 6) {
  26139. try {
  26140. password = utf8StringToString(password);
  26141. } catch (ex) {
  26142. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  26143. }
  26144. }
  26145. passwordBytes = stringToBytes(password);
  26146. }
  26147. var encryptionKey;
  26148. if (algorithm !== 5) {
  26149. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26150. } else {
  26151. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  26152. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  26153. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  26154. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  26155. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  26156. var ownerEncryption = stringToBytes(dict.get('OE'));
  26157. var userEncryption = stringToBytes(dict.get('UE'));
  26158. var perms = stringToBytes(dict.get('Perms'));
  26159. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  26160. }
  26161. if (!encryptionKey && !password) {
  26162. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  26163. } else if (!encryptionKey && password) {
  26164. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  26165. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26166. }
  26167. if (!encryptionKey) {
  26168. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  26169. }
  26170. this.encryptionKey = encryptionKey;
  26171. if (algorithm >= 4) {
  26172. var cf = dict.get('CF');
  26173. if (isDict(cf)) {
  26174. cf.suppressEncryption = true;
  26175. }
  26176. this.cf = cf;
  26177. this.stmf = dict.get('StmF') || identityName;
  26178. this.strf = dict.get('StrF') || identityName;
  26179. this.eff = dict.get('EFF') || this.stmf;
  26180. }
  26181. }
  26182. function buildObjectKey(num, gen, encryptionKey, isAes) {
  26183. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  26184. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  26185. key[i] = encryptionKey[i];
  26186. }
  26187. key[i++] = num & 0xFF;
  26188. key[i++] = num >> 8 & 0xFF;
  26189. key[i++] = num >> 16 & 0xFF;
  26190. key[i++] = gen & 0xFF;
  26191. key[i++] = gen >> 8 & 0xFF;
  26192. if (isAes) {
  26193. key[i++] = 0x73;
  26194. key[i++] = 0x41;
  26195. key[i++] = 0x6C;
  26196. key[i++] = 0x54;
  26197. }
  26198. var hash = calculateMD5(key, 0, i);
  26199. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  26200. }
  26201. function buildCipherConstructor(cf, name, num, gen, key) {
  26202. assert(isName(name), 'Invalid crypt filter name.');
  26203. var cryptFilter = cf.get(name.name);
  26204. var cfm;
  26205. if (cryptFilter !== null && cryptFilter !== undefined) {
  26206. cfm = cryptFilter.get('CFM');
  26207. }
  26208. if (!cfm || cfm.name === 'None') {
  26209. return function cipherTransformFactoryBuildCipherConstructorNone() {
  26210. return new NullCipher();
  26211. };
  26212. }
  26213. if (cfm.name === 'V2') {
  26214. return function cipherTransformFactoryBuildCipherConstructorV2() {
  26215. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  26216. };
  26217. }
  26218. if (cfm.name === 'AESV2') {
  26219. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  26220. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  26221. };
  26222. }
  26223. if (cfm.name === 'AESV3') {
  26224. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  26225. return new AES256Cipher(key);
  26226. };
  26227. }
  26228. error('Unknown crypto method');
  26229. }
  26230. CipherTransformFactory.prototype = {
  26231. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  26232. if (this.algorithm === 4 || this.algorithm === 5) {
  26233. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  26234. }
  26235. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  26236. var cipherConstructor = function buildCipherCipherConstructor() {
  26237. return new ARCFourCipher(key);
  26238. };
  26239. return new CipherTransform(cipherConstructor, cipherConstructor);
  26240. }
  26241. };
  26242. return CipherTransformFactory;
  26243. }();
  26244. exports.AES128Cipher = AES128Cipher;
  26245. exports.AES256Cipher = AES256Cipher;
  26246. exports.ARCFourCipher = ARCFourCipher;
  26247. exports.CipherTransformFactory = CipherTransformFactory;
  26248. exports.PDF17 = PDF17;
  26249. exports.PDF20 = PDF20;
  26250. exports.calculateMD5 = calculateMD5;
  26251. exports.calculateSHA256 = calculateSHA256;
  26252. exports.calculateSHA384 = calculateSHA384;
  26253. exports.calculateSHA512 = calculateSHA512;
  26254. /***/ }),
  26255. /* 13 */
  26256. /***/ (function(module, exports, __w_pdfjs_require__) {
  26257. "use strict";
  26258. var sharedUtil = __w_pdfjs_require__(0);
  26259. var corePrimitives = __w_pdfjs_require__(1);
  26260. var coreStream = __w_pdfjs_require__(2);
  26261. var coreParser = __w_pdfjs_require__(5);
  26262. var coreImage = __w_pdfjs_require__(28);
  26263. var coreColorSpace = __w_pdfjs_require__(3);
  26264. var coreMurmurHash3 = __w_pdfjs_require__(32);
  26265. var coreFonts = __w_pdfjs_require__(27);
  26266. var coreFunction = __w_pdfjs_require__(6);
  26267. var corePattern = __w_pdfjs_require__(33);
  26268. var coreCMap = __w_pdfjs_require__(24);
  26269. var coreMetrics = __w_pdfjs_require__(31);
  26270. var coreBidi = __w_pdfjs_require__(22);
  26271. var coreEncodings = __w_pdfjs_require__(4);
  26272. var coreStandardFonts = __w_pdfjs_require__(16);
  26273. var coreUnicode = __w_pdfjs_require__(17);
  26274. var coreGlyphList = __w_pdfjs_require__(7);
  26275. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  26276. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  26277. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  26278. var ImageKind = sharedUtil.ImageKind;
  26279. var OPS = sharedUtil.OPS;
  26280. var TextRenderingMode = sharedUtil.TextRenderingMode;
  26281. var Util = sharedUtil.Util;
  26282. var assert = sharedUtil.assert;
  26283. var createPromiseCapability = sharedUtil.createPromiseCapability;
  26284. var error = sharedUtil.error;
  26285. var info = sharedUtil.info;
  26286. var isArray = sharedUtil.isArray;
  26287. var isNum = sharedUtil.isNum;
  26288. var isString = sharedUtil.isString;
  26289. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  26290. var warn = sharedUtil.warn;
  26291. var Dict = corePrimitives.Dict;
  26292. var Name = corePrimitives.Name;
  26293. var isEOF = corePrimitives.isEOF;
  26294. var isCmd = corePrimitives.isCmd;
  26295. var isDict = corePrimitives.isDict;
  26296. var isName = corePrimitives.isName;
  26297. var isRef = corePrimitives.isRef;
  26298. var isStream = corePrimitives.isStream;
  26299. var DecodeStream = coreStream.DecodeStream;
  26300. var JpegStream = coreStream.JpegStream;
  26301. var Stream = coreStream.Stream;
  26302. var Lexer = coreParser.Lexer;
  26303. var Parser = coreParser.Parser;
  26304. var PDFImage = coreImage.PDFImage;
  26305. var ColorSpace = coreColorSpace.ColorSpace;
  26306. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  26307. var ErrorFont = coreFonts.ErrorFont;
  26308. var FontFlags = coreFonts.FontFlags;
  26309. var Font = coreFonts.Font;
  26310. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  26311. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  26312. var getFontType = coreFonts.getFontType;
  26313. var isPDFFunction = coreFunction.isPDFFunction;
  26314. var PDFFunction = coreFunction.PDFFunction;
  26315. var Pattern = corePattern.Pattern;
  26316. var getTilingPatternIR = corePattern.getTilingPatternIR;
  26317. var CMapFactory = coreCMap.CMapFactory;
  26318. var IdentityCMap = coreCMap.IdentityCMap;
  26319. var getMetrics = coreMetrics.getMetrics;
  26320. var bidi = coreBidi.bidi;
  26321. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  26322. var StandardEncoding = coreEncodings.StandardEncoding;
  26323. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  26324. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  26325. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  26326. var getEncoding = coreEncodings.getEncoding;
  26327. var getStdFontMap = coreStandardFonts.getStdFontMap;
  26328. var getSerifFonts = coreStandardFonts.getSerifFonts;
  26329. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  26330. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  26331. var reverseIfRtl = coreUnicode.reverseIfRtl;
  26332. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  26333. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  26334. var PartialEvaluator = function PartialEvaluatorClosure() {
  26335. var DefaultPartialEvaluatorOptions = {
  26336. forceDataSchema: false,
  26337. maxImageSize: -1,
  26338. disableFontFace: false,
  26339. cMapOptions: {
  26340. url: null,
  26341. packed: false
  26342. },
  26343. disableNativeImageDecoder: false
  26344. };
  26345. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  26346. this.xref = xref;
  26347. this.resources = resources;
  26348. this.handler = handler;
  26349. this.forceDataSchema = forceDataSchema;
  26350. }
  26351. NativeImageDecoder.prototype = {
  26352. canDecode: function (image) {
  26353. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  26354. },
  26355. decode: function (image) {
  26356. var dict = image.dict;
  26357. var colorSpace = dict.get('ColorSpace', 'CS');
  26358. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  26359. var numComps = colorSpace.numComps;
  26360. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  26361. image.getIR(this.forceDataSchema),
  26362. numComps
  26363. ]);
  26364. return decodePromise.then(function (message) {
  26365. var data = message.data;
  26366. return new Stream(data, 0, data.length, image.dict);
  26367. });
  26368. }
  26369. };
  26370. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  26371. var dict = image.dict;
  26372. if (dict.has('DecodeParms') || dict.has('DP')) {
  26373. return false;
  26374. }
  26375. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26376. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26377. };
  26378. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  26379. var dict = image.dict;
  26380. if (dict.has('DecodeParms') || dict.has('DP')) {
  26381. return false;
  26382. }
  26383. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26384. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26385. };
  26386. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, options) {
  26387. this.pdfManager = pdfManager;
  26388. this.xref = xref;
  26389. this.handler = handler;
  26390. this.pageIndex = pageIndex;
  26391. this.idFactory = idFactory;
  26392. this.fontCache = fontCache;
  26393. this.options = options || DefaultPartialEvaluatorOptions;
  26394. }
  26395. var TIME_SLOT_DURATION_MS = 20;
  26396. var CHECK_TIME_EVERY = 100;
  26397. function TimeSlotManager() {
  26398. this.reset();
  26399. }
  26400. TimeSlotManager.prototype = {
  26401. check: function TimeSlotManager_check() {
  26402. if (++this.checked < CHECK_TIME_EVERY) {
  26403. return false;
  26404. }
  26405. this.checked = 0;
  26406. return this.endTime <= Date.now();
  26407. },
  26408. reset: function TimeSlotManager_reset() {
  26409. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  26410. this.checked = 0;
  26411. }
  26412. };
  26413. var deferred = Promise.resolve();
  26414. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  26415. PartialEvaluator.prototype = {
  26416. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  26417. if (!isDict(resources)) {
  26418. return false;
  26419. }
  26420. var processed = Object.create(null);
  26421. if (resources.objId) {
  26422. processed[resources.objId] = true;
  26423. }
  26424. var nodes = [resources], xref = this.xref;
  26425. while (nodes.length) {
  26426. var key, i, ii;
  26427. var node = nodes.shift();
  26428. var graphicStates = node.get('ExtGState');
  26429. if (isDict(graphicStates)) {
  26430. var graphicStatesKeys = graphicStates.getKeys();
  26431. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  26432. key = graphicStatesKeys[i];
  26433. var graphicState = graphicStates.get(key);
  26434. var bm = graphicState.get('BM');
  26435. if (isName(bm) && bm.name !== 'Normal') {
  26436. return true;
  26437. }
  26438. }
  26439. }
  26440. var xObjects = node.get('XObject');
  26441. if (!isDict(xObjects)) {
  26442. continue;
  26443. }
  26444. var xObjectsKeys = xObjects.getKeys();
  26445. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  26446. key = xObjectsKeys[i];
  26447. var xObject = xObjects.getRaw(key);
  26448. if (isRef(xObject)) {
  26449. if (processed[xObject.toString()]) {
  26450. continue;
  26451. }
  26452. xObject = xref.fetch(xObject);
  26453. }
  26454. if (!isStream(xObject)) {
  26455. continue;
  26456. }
  26457. if (xObject.dict.objId) {
  26458. if (processed[xObject.dict.objId]) {
  26459. continue;
  26460. }
  26461. processed[xObject.dict.objId] = true;
  26462. }
  26463. var xResources = xObject.dict.get('Resources');
  26464. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  26465. nodes.push(xResources);
  26466. if (xResources.objId) {
  26467. processed[xResources.objId] = true;
  26468. }
  26469. }
  26470. }
  26471. }
  26472. return false;
  26473. },
  26474. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  26475. var matrix = xobj.dict.getArray('Matrix');
  26476. var bbox = xobj.dict.getArray('BBox');
  26477. var group = xobj.dict.get('Group');
  26478. if (group) {
  26479. var groupOptions = {
  26480. matrix: matrix,
  26481. bbox: bbox,
  26482. smask: smask,
  26483. isolated: false,
  26484. knockout: false
  26485. };
  26486. var groupSubtype = group.get('S');
  26487. var colorSpace;
  26488. if (isName(groupSubtype, 'Transparency')) {
  26489. groupOptions.isolated = group.get('I') || false;
  26490. groupOptions.knockout = group.get('K') || false;
  26491. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  26492. }
  26493. if (smask && smask.backdrop) {
  26494. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  26495. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  26496. }
  26497. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  26498. }
  26499. operatorList.addOp(OPS.paintFormXObjectBegin, [
  26500. matrix,
  26501. bbox
  26502. ]);
  26503. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  26504. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  26505. if (group) {
  26506. operatorList.addOp(OPS.endGroup, [groupOptions]);
  26507. }
  26508. });
  26509. },
  26510. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  26511. var self = this;
  26512. var dict = image.dict;
  26513. var w = dict.get('Width', 'W');
  26514. var h = dict.get('Height', 'H');
  26515. if (!(w && isNum(w)) || !(h && isNum(h))) {
  26516. warn('Image dimensions are missing, or not numbers.');
  26517. return;
  26518. }
  26519. var maxImageSize = this.options.maxImageSize;
  26520. if (maxImageSize !== -1 && w * h > maxImageSize) {
  26521. warn('Image exceeded maximum allowed size and was removed.');
  26522. return;
  26523. }
  26524. var imageMask = dict.get('ImageMask', 'IM') || false;
  26525. var imgData, args;
  26526. if (imageMask) {
  26527. var width = dict.get('Width', 'W');
  26528. var height = dict.get('Height', 'H');
  26529. var bitStrideLength = width + 7 >> 3;
  26530. var imgArray = image.getBytes(bitStrideLength * height);
  26531. var decode = dict.getArray('Decode', 'D');
  26532. var inverseDecode = !!decode && decode[0] > 0;
  26533. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  26534. imgData.cached = true;
  26535. args = [imgData];
  26536. operatorList.addOp(OPS.paintImageMaskXObject, args);
  26537. if (cacheKey) {
  26538. imageCache[cacheKey] = {
  26539. fn: OPS.paintImageMaskXObject,
  26540. args: args
  26541. };
  26542. }
  26543. return;
  26544. }
  26545. var softMask = dict.get('SMask', 'SM') || false;
  26546. var mask = dict.get('Mask') || false;
  26547. var SMALL_IMAGE_DIMENSIONS = 200;
  26548. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  26549. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  26550. imgData = imageObj.createImageData(true);
  26551. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  26552. return;
  26553. }
  26554. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  26555. var objId = 'img_' + this.idFactory.createObjId();
  26556. operatorList.addDependency(objId);
  26557. args = [
  26558. objId,
  26559. w,
  26560. h
  26561. ];
  26562. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  26563. operatorList.addOp(OPS.paintJpegXObject, args);
  26564. this.handler.send('obj', [
  26565. objId,
  26566. this.pageIndex,
  26567. 'JpegStream',
  26568. image.getIR(this.options.forceDataSchema)
  26569. ]);
  26570. return;
  26571. }
  26572. var nativeImageDecoder = null;
  26573. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  26574. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  26575. }
  26576. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  26577. var imgData = imageObj.createImageData(false);
  26578. self.handler.send('obj', [
  26579. objId,
  26580. self.pageIndex,
  26581. 'Image',
  26582. imgData
  26583. ], [imgData.data.buffer]);
  26584. }).then(undefined, function (reason) {
  26585. warn('Unable to decode image: ' + reason);
  26586. self.handler.send('obj', [
  26587. objId,
  26588. self.pageIndex,
  26589. 'Image',
  26590. null
  26591. ]);
  26592. });
  26593. operatorList.addOp(OPS.paintImageXObject, args);
  26594. if (cacheKey) {
  26595. imageCache[cacheKey] = {
  26596. fn: OPS.paintImageXObject,
  26597. args: args
  26598. };
  26599. }
  26600. },
  26601. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  26602. var smaskContent = smask.get('G');
  26603. var smaskOptions = {
  26604. subtype: smask.get('S').name,
  26605. backdrop: smask.get('BC')
  26606. };
  26607. var transferObj = smask.get('TR');
  26608. if (isPDFFunction(transferObj)) {
  26609. var transferFn = PDFFunction.parse(this.xref, transferObj);
  26610. var transferMap = new Uint8Array(256);
  26611. var tmp = new Float32Array(1);
  26612. for (var i = 0; i < 256; i++) {
  26613. tmp[0] = i / 255;
  26614. transferFn(tmp, 0, tmp, 0);
  26615. transferMap[i] = tmp[0] * 255 | 0;
  26616. }
  26617. smaskOptions.transferMap = transferMap;
  26618. }
  26619. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  26620. },
  26621. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  26622. var tilingOpList = new OperatorList();
  26623. var resourcesArray = [
  26624. patternDict.get('Resources'),
  26625. resources
  26626. ];
  26627. var patternResources = Dict.merge(this.xref, resourcesArray);
  26628. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  26629. operatorList.addDependencies(tilingOpList.dependencies);
  26630. operatorList.addOp(fn, getTilingPatternIR({
  26631. fnArray: tilingOpList.fnArray,
  26632. argsArray: tilingOpList.argsArray
  26633. }, patternDict, args));
  26634. });
  26635. },
  26636. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  26637. var fontName;
  26638. if (fontArgs) {
  26639. fontArgs = fontArgs.slice();
  26640. fontName = fontArgs[0].name;
  26641. }
  26642. var self = this;
  26643. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  26644. if (!translated.font.isType3Font) {
  26645. return translated;
  26646. }
  26647. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  26648. return translated;
  26649. }, function (reason) {
  26650. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26651. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  26652. });
  26653. }).then(function (translated) {
  26654. state.font = translated.font;
  26655. translated.send(self.handler);
  26656. return translated.loadedName;
  26657. });
  26658. },
  26659. handleText: function PartialEvaluator_handleText(chars, state) {
  26660. var font = state.font;
  26661. var glyphs = font.charsToGlyphs(chars);
  26662. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  26663. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  26664. var buildPath = function (fontChar) {
  26665. if (!font.renderer.hasBuiltPath(fontChar)) {
  26666. var path = font.renderer.getPathJs(fontChar);
  26667. this.handler.send('commonobj', [
  26668. font.loadedName + '_path_' + fontChar,
  26669. 'FontPath',
  26670. path
  26671. ]);
  26672. }
  26673. }.bind(this);
  26674. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  26675. var glyph = glyphs[i];
  26676. buildPath(glyph.fontChar);
  26677. var accent = glyph.accent;
  26678. if (accent && accent.fontChar) {
  26679. buildPath(accent.fontChar);
  26680. }
  26681. }
  26682. }
  26683. return glyphs;
  26684. },
  26685. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  26686. var gStateObj = [];
  26687. var gStateKeys = gState.getKeys();
  26688. var self = this;
  26689. var promise = Promise.resolve();
  26690. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  26691. var key = gStateKeys[i];
  26692. var value = gState.get(key);
  26693. switch (key) {
  26694. case 'Type':
  26695. break;
  26696. case 'LW':
  26697. case 'LC':
  26698. case 'LJ':
  26699. case 'ML':
  26700. case 'D':
  26701. case 'RI':
  26702. case 'FL':
  26703. case 'CA':
  26704. case 'ca':
  26705. gStateObj.push([
  26706. key,
  26707. value
  26708. ]);
  26709. break;
  26710. case 'Font':
  26711. promise = promise.then(function () {
  26712. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  26713. operatorList.addDependency(loadedName);
  26714. gStateObj.push([
  26715. key,
  26716. [
  26717. loadedName,
  26718. value[1]
  26719. ]
  26720. ]);
  26721. });
  26722. });
  26723. break;
  26724. case 'BM':
  26725. gStateObj.push([
  26726. key,
  26727. value
  26728. ]);
  26729. break;
  26730. case 'SMask':
  26731. if (isName(value, 'None')) {
  26732. gStateObj.push([
  26733. key,
  26734. false
  26735. ]);
  26736. break;
  26737. }
  26738. if (isDict(value)) {
  26739. promise = promise.then(function (dict) {
  26740. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  26741. }.bind(this, value));
  26742. gStateObj.push([
  26743. key,
  26744. true
  26745. ]);
  26746. } else {
  26747. warn('Unsupported SMask type');
  26748. }
  26749. break;
  26750. case 'OP':
  26751. case 'op':
  26752. case 'OPM':
  26753. case 'BG':
  26754. case 'BG2':
  26755. case 'UCR':
  26756. case 'UCR2':
  26757. case 'TR':
  26758. case 'TR2':
  26759. case 'HT':
  26760. case 'SM':
  26761. case 'SA':
  26762. case 'AIS':
  26763. case 'TK':
  26764. info('graphic state operator ' + key);
  26765. break;
  26766. default:
  26767. info('Unknown graphic state operator ' + key);
  26768. break;
  26769. }
  26770. }
  26771. return promise.then(function () {
  26772. if (gStateObj.length > 0) {
  26773. operatorList.addOp(OPS.setGState, [gStateObj]);
  26774. }
  26775. });
  26776. },
  26777. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  26778. function errorFont() {
  26779. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  26780. }
  26781. var fontRef;
  26782. if (font) {
  26783. assert(isRef(font));
  26784. fontRef = font;
  26785. } else {
  26786. var fontRes = resources.get('Font');
  26787. if (fontRes) {
  26788. fontRef = fontRes.getRaw(fontName);
  26789. } else {
  26790. warn('fontRes not available');
  26791. return errorFont();
  26792. }
  26793. }
  26794. if (!fontRef) {
  26795. warn('fontRef not available');
  26796. return errorFont();
  26797. }
  26798. if (this.fontCache.has(fontRef)) {
  26799. return this.fontCache.get(fontRef);
  26800. }
  26801. font = xref.fetchIfRef(fontRef);
  26802. if (!isDict(font)) {
  26803. return errorFont();
  26804. }
  26805. if (font.translated) {
  26806. return font.translated;
  26807. }
  26808. var fontCapability = createPromiseCapability();
  26809. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  26810. var descriptor = preEvaluatedFont.descriptor;
  26811. var fontRefIsRef = isRef(fontRef), fontID;
  26812. if (fontRefIsRef) {
  26813. fontID = fontRef.toString();
  26814. }
  26815. if (isDict(descriptor)) {
  26816. if (!descriptor.fontAliases) {
  26817. descriptor.fontAliases = Object.create(null);
  26818. }
  26819. var fontAliases = descriptor.fontAliases;
  26820. var hash = preEvaluatedFont.hash;
  26821. if (fontAliases[hash]) {
  26822. var aliasFontRef = fontAliases[hash].aliasRef;
  26823. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26824. this.fontCache.putAlias(fontRef, aliasFontRef);
  26825. return this.fontCache.get(fontRef);
  26826. }
  26827. } else {
  26828. fontAliases[hash] = { fontID: Font.getFontID() };
  26829. }
  26830. if (fontRefIsRef) {
  26831. fontAliases[hash].aliasRef = fontRef;
  26832. }
  26833. fontID = fontAliases[hash].fontID;
  26834. }
  26835. if (fontRefIsRef) {
  26836. this.fontCache.put(fontRef, fontCapability.promise);
  26837. } else {
  26838. if (!fontID) {
  26839. fontID = this.idFactory.createObjId();
  26840. }
  26841. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26842. }
  26843. assert(fontID, 'The "fontID" must be defined.');
  26844. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26845. font.translated = fontCapability.promise;
  26846. var translatedPromise;
  26847. try {
  26848. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26849. } catch (e) {
  26850. translatedPromise = Promise.reject(e);
  26851. }
  26852. var self = this;
  26853. translatedPromise.then(function (translatedFont) {
  26854. if (translatedFont.fontType !== undefined) {
  26855. var xrefFontStats = xref.stats.fontTypes;
  26856. xrefFontStats[translatedFont.fontType] = true;
  26857. }
  26858. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26859. }, function (reason) {
  26860. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26861. try {
  26862. var descriptor = preEvaluatedFont.descriptor;
  26863. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26864. var subtype = fontFile3 && fontFile3.get('Subtype');
  26865. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26866. var xrefFontStats = xref.stats.fontTypes;
  26867. xrefFontStats[fontType] = true;
  26868. } catch (ex) {
  26869. }
  26870. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26871. });
  26872. return fontCapability.promise;
  26873. },
  26874. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26875. var lastIndex = operatorList.length - 1;
  26876. if (!args) {
  26877. args = [];
  26878. }
  26879. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26880. operatorList.addOp(OPS.constructPath, [
  26881. [fn],
  26882. args
  26883. ]);
  26884. } else {
  26885. var opArgs = operatorList.argsArray[lastIndex];
  26886. opArgs[0].push(fn);
  26887. Array.prototype.push.apply(opArgs[1], args);
  26888. }
  26889. },
  26890. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26891. var patternName = args[args.length - 1];
  26892. var pattern;
  26893. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26894. var dict = isStream(pattern) ? pattern.dict : pattern;
  26895. var typeNum = dict.get('PatternType');
  26896. if (typeNum === TILING_PATTERN) {
  26897. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26898. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26899. } else if (typeNum === SHADING_PATTERN) {
  26900. var shading = dict.get('Shading');
  26901. var matrix = dict.getArray('Matrix');
  26902. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26903. operatorList.addOp(fn, pattern.getIR());
  26904. return Promise.resolve();
  26905. }
  26906. return Promise.reject('Unknown PatternType: ' + typeNum);
  26907. }
  26908. operatorList.addOp(fn, args);
  26909. return Promise.resolve();
  26910. },
  26911. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26912. var self = this;
  26913. var xref = this.xref;
  26914. var imageCache = Object.create(null);
  26915. assert(operatorList);
  26916. resources = resources || Dict.empty;
  26917. var xobjs = resources.get('XObject') || Dict.empty;
  26918. var patterns = resources.get('Pattern') || Dict.empty;
  26919. var stateManager = new StateManager(initialState || new EvalState());
  26920. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26921. var timeSlotManager = new TimeSlotManager();
  26922. return new Promise(function promiseBody(resolve, reject) {
  26923. var next = function (promise) {
  26924. promise.then(function () {
  26925. try {
  26926. promiseBody(resolve, reject);
  26927. } catch (ex) {
  26928. reject(ex);
  26929. }
  26930. }, reject);
  26931. };
  26932. task.ensureNotTerminated();
  26933. timeSlotManager.reset();
  26934. var stop, operation = {}, i, ii, cs;
  26935. while (!(stop = timeSlotManager.check())) {
  26936. operation.args = null;
  26937. if (!preprocessor.read(operation)) {
  26938. break;
  26939. }
  26940. var args = operation.args;
  26941. var fn = operation.fn;
  26942. switch (fn | 0) {
  26943. case OPS.paintXObject:
  26944. if (args[0].code) {
  26945. break;
  26946. }
  26947. var name = args[0].name;
  26948. if (!name) {
  26949. warn('XObject must be referred to by name.');
  26950. continue;
  26951. }
  26952. if (imageCache[name] !== undefined) {
  26953. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26954. args = null;
  26955. continue;
  26956. }
  26957. var xobj = xobjs.get(name);
  26958. if (xobj) {
  26959. assert(isStream(xobj), 'XObject should be a stream');
  26960. var type = xobj.dict.get('Subtype');
  26961. assert(isName(type), 'XObject should have a Name subtype');
  26962. if (type.name === 'Form') {
  26963. stateManager.save();
  26964. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26965. stateManager.restore();
  26966. }));
  26967. return;
  26968. } else if (type.name === 'Image') {
  26969. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26970. args = null;
  26971. continue;
  26972. } else if (type.name === 'PS') {
  26973. info('Ignored XObject subtype PS');
  26974. continue;
  26975. } else {
  26976. error('Unhandled XObject subtype ' + type.name);
  26977. }
  26978. }
  26979. break;
  26980. case OPS.setFont:
  26981. var fontSize = args[1];
  26982. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26983. operatorList.addDependency(loadedName);
  26984. operatorList.addOp(OPS.setFont, [
  26985. loadedName,
  26986. fontSize
  26987. ]);
  26988. }));
  26989. return;
  26990. case OPS.endInlineImage:
  26991. var cacheKey = args[0].cacheKey;
  26992. if (cacheKey) {
  26993. var cacheEntry = imageCache[cacheKey];
  26994. if (cacheEntry !== undefined) {
  26995. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  26996. args = null;
  26997. continue;
  26998. }
  26999. }
  27000. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  27001. args = null;
  27002. continue;
  27003. case OPS.showText:
  27004. args[0] = self.handleText(args[0], stateManager.state);
  27005. break;
  27006. case OPS.showSpacedText:
  27007. var arr = args[0];
  27008. var combinedGlyphs = [];
  27009. var arrLength = arr.length;
  27010. var state = stateManager.state;
  27011. for (i = 0; i < arrLength; ++i) {
  27012. var arrItem = arr[i];
  27013. if (isString(arrItem)) {
  27014. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  27015. } else if (isNum(arrItem)) {
  27016. combinedGlyphs.push(arrItem);
  27017. }
  27018. }
  27019. args[0] = combinedGlyphs;
  27020. fn = OPS.showText;
  27021. break;
  27022. case OPS.nextLineShowText:
  27023. operatorList.addOp(OPS.nextLine);
  27024. args[0] = self.handleText(args[0], stateManager.state);
  27025. fn = OPS.showText;
  27026. break;
  27027. case OPS.nextLineSetSpacingShowText:
  27028. operatorList.addOp(OPS.nextLine);
  27029. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  27030. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  27031. args[0] = self.handleText(args[0], stateManager.state);
  27032. fn = OPS.showText;
  27033. break;
  27034. case OPS.setTextRenderingMode:
  27035. stateManager.state.textRenderingMode = args[0];
  27036. break;
  27037. case OPS.setFillColorSpace:
  27038. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  27039. continue;
  27040. case OPS.setStrokeColorSpace:
  27041. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  27042. continue;
  27043. case OPS.setFillColor:
  27044. cs = stateManager.state.fillColorSpace;
  27045. args = cs.getRgb(args, 0);
  27046. fn = OPS.setFillRGBColor;
  27047. break;
  27048. case OPS.setStrokeColor:
  27049. cs = stateManager.state.strokeColorSpace;
  27050. args = cs.getRgb(args, 0);
  27051. fn = OPS.setStrokeRGBColor;
  27052. break;
  27053. case OPS.setFillGray:
  27054. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  27055. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27056. fn = OPS.setFillRGBColor;
  27057. break;
  27058. case OPS.setStrokeGray:
  27059. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  27060. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27061. fn = OPS.setStrokeRGBColor;
  27062. break;
  27063. case OPS.setFillCMYKColor:
  27064. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  27065. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27066. fn = OPS.setFillRGBColor;
  27067. break;
  27068. case OPS.setStrokeCMYKColor:
  27069. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  27070. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27071. fn = OPS.setStrokeRGBColor;
  27072. break;
  27073. case OPS.setFillRGBColor:
  27074. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  27075. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27076. break;
  27077. case OPS.setStrokeRGBColor:
  27078. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  27079. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27080. break;
  27081. case OPS.setFillColorN:
  27082. cs = stateManager.state.fillColorSpace;
  27083. if (cs.name === 'Pattern') {
  27084. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  27085. return;
  27086. }
  27087. args = cs.getRgb(args, 0);
  27088. fn = OPS.setFillRGBColor;
  27089. break;
  27090. case OPS.setStrokeColorN:
  27091. cs = stateManager.state.strokeColorSpace;
  27092. if (cs.name === 'Pattern') {
  27093. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  27094. return;
  27095. }
  27096. args = cs.getRgb(args, 0);
  27097. fn = OPS.setStrokeRGBColor;
  27098. break;
  27099. case OPS.shadingFill:
  27100. var shadingRes = resources.get('Shading');
  27101. if (!shadingRes) {
  27102. error('No shading resource found');
  27103. }
  27104. var shading = shadingRes.get(args[0].name);
  27105. if (!shading) {
  27106. error('No shading object found');
  27107. }
  27108. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  27109. var patternIR = shadingFill.getIR();
  27110. args = [patternIR];
  27111. fn = OPS.shadingFill;
  27112. break;
  27113. case OPS.setGState:
  27114. var dictName = args[0];
  27115. var extGState = resources.get('ExtGState');
  27116. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  27117. break;
  27118. }
  27119. var gState = extGState.get(dictName.name);
  27120. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  27121. return;
  27122. case OPS.moveTo:
  27123. case OPS.lineTo:
  27124. case OPS.curveTo:
  27125. case OPS.curveTo2:
  27126. case OPS.curveTo3:
  27127. case OPS.closePath:
  27128. self.buildPath(operatorList, fn, args);
  27129. continue;
  27130. case OPS.rectangle:
  27131. self.buildPath(operatorList, fn, args);
  27132. continue;
  27133. case OPS.markPoint:
  27134. case OPS.markPointProps:
  27135. case OPS.beginMarkedContent:
  27136. case OPS.beginMarkedContentProps:
  27137. case OPS.endMarkedContent:
  27138. case OPS.beginCompat:
  27139. case OPS.endCompat:
  27140. continue;
  27141. default:
  27142. if (args !== null) {
  27143. for (i = 0, ii = args.length; i < ii; i++) {
  27144. if (args[i] instanceof Dict) {
  27145. break;
  27146. }
  27147. }
  27148. if (i < ii) {
  27149. warn('getOperatorList - ignoring operator: ' + fn);
  27150. continue;
  27151. }
  27152. }
  27153. }
  27154. operatorList.addOp(fn, args);
  27155. }
  27156. if (stop) {
  27157. next(deferred);
  27158. return;
  27159. }
  27160. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  27161. operatorList.addOp(OPS.restore, []);
  27162. }
  27163. resolve();
  27164. });
  27165. },
  27166. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  27167. stateManager = stateManager || new StateManager(new TextState());
  27168. var WhitespaceRegexp = /\s/g;
  27169. var textContent = {
  27170. items: [],
  27171. styles: Object.create(null)
  27172. };
  27173. var textContentItem = {
  27174. initialized: false,
  27175. str: [],
  27176. width: 0,
  27177. height: 0,
  27178. vertical: false,
  27179. lastAdvanceWidth: 0,
  27180. lastAdvanceHeight: 0,
  27181. textAdvanceScale: 0,
  27182. spaceWidth: 0,
  27183. fakeSpaceMin: Infinity,
  27184. fakeMultiSpaceMin: Infinity,
  27185. fakeMultiSpaceMax: -0,
  27186. textRunBreakAllowed: false,
  27187. transform: null,
  27188. fontName: null
  27189. };
  27190. var SPACE_FACTOR = 0.3;
  27191. var MULTI_SPACE_FACTOR = 1.5;
  27192. var MULTI_SPACE_FACTOR_MAX = 4;
  27193. var self = this;
  27194. var xref = this.xref;
  27195. resources = xref.fetchIfRef(resources) || Dict.empty;
  27196. var xobjs = null;
  27197. var xobjsCache = Object.create(null);
  27198. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  27199. var textState;
  27200. function ensureTextContentItem() {
  27201. if (textContentItem.initialized) {
  27202. return textContentItem;
  27203. }
  27204. var font = textState.font;
  27205. if (!(font.loadedName in textContent.styles)) {
  27206. textContent.styles[font.loadedName] = {
  27207. fontFamily: font.fallbackName,
  27208. ascent: font.ascent,
  27209. descent: font.descent,
  27210. vertical: font.vertical
  27211. };
  27212. }
  27213. textContentItem.fontName = font.loadedName;
  27214. var tsm = [
  27215. textState.fontSize * textState.textHScale,
  27216. 0,
  27217. 0,
  27218. textState.fontSize,
  27219. 0,
  27220. textState.textRise
  27221. ];
  27222. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  27223. var glyphHeight = font.bbox[3] - font.bbox[1];
  27224. if (glyphHeight > 0) {
  27225. glyphHeight = glyphHeight * textState.fontMatrix[3];
  27226. tsm[3] *= glyphHeight;
  27227. }
  27228. }
  27229. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  27230. textContentItem.transform = trm;
  27231. if (!font.vertical) {
  27232. textContentItem.width = 0;
  27233. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  27234. textContentItem.vertical = false;
  27235. } else {
  27236. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  27237. textContentItem.height = 0;
  27238. textContentItem.vertical = true;
  27239. }
  27240. var a = textState.textLineMatrix[0];
  27241. var b = textState.textLineMatrix[1];
  27242. var scaleLineX = Math.sqrt(a * a + b * b);
  27243. a = textState.ctm[0];
  27244. b = textState.ctm[1];
  27245. var scaleCtmX = Math.sqrt(a * a + b * b);
  27246. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  27247. textContentItem.lastAdvanceWidth = 0;
  27248. textContentItem.lastAdvanceHeight = 0;
  27249. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  27250. if (spaceWidth) {
  27251. textContentItem.spaceWidth = spaceWidth;
  27252. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  27253. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  27254. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  27255. textContentItem.textRunBreakAllowed = !font.isMonospace;
  27256. } else {
  27257. textContentItem.spaceWidth = 0;
  27258. textContentItem.fakeSpaceMin = Infinity;
  27259. textContentItem.fakeMultiSpaceMin = Infinity;
  27260. textContentItem.fakeMultiSpaceMax = 0;
  27261. textContentItem.textRunBreakAllowed = false;
  27262. }
  27263. textContentItem.initialized = true;
  27264. return textContentItem;
  27265. }
  27266. function replaceWhitespace(str) {
  27267. var i = 0, ii = str.length, code;
  27268. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  27269. i++;
  27270. }
  27271. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  27272. }
  27273. function runBidiTransform(textChunk) {
  27274. var str = textChunk.str.join('');
  27275. var bidiResult = bidi(str, -1, textChunk.vertical);
  27276. return {
  27277. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  27278. dir: bidiResult.dir,
  27279. width: textChunk.width,
  27280. height: textChunk.height,
  27281. transform: textChunk.transform,
  27282. fontName: textChunk.fontName
  27283. };
  27284. }
  27285. function handleSetFont(fontName, fontRef) {
  27286. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  27287. textState.font = translated.font;
  27288. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  27289. });
  27290. }
  27291. function buildTextContentItem(chars) {
  27292. var font = textState.font;
  27293. var textChunk = ensureTextContentItem();
  27294. var width = 0;
  27295. var height = 0;
  27296. var glyphs = font.charsToGlyphs(chars);
  27297. for (var i = 0; i < glyphs.length; i++) {
  27298. var glyph = glyphs[i];
  27299. var glyphWidth = null;
  27300. if (font.vertical && glyph.vmetric) {
  27301. glyphWidth = glyph.vmetric[0];
  27302. } else {
  27303. glyphWidth = glyph.width;
  27304. }
  27305. var glyphUnicode = glyph.unicode;
  27306. var NormalizedUnicodes = getNormalizedUnicodes();
  27307. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  27308. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  27309. }
  27310. glyphUnicode = reverseIfRtl(glyphUnicode);
  27311. var charSpacing = textState.charSpacing;
  27312. if (glyph.isSpace) {
  27313. var wordSpacing = textState.wordSpacing;
  27314. charSpacing += wordSpacing;
  27315. if (wordSpacing > 0) {
  27316. addFakeSpaces(wordSpacing, textChunk.str);
  27317. }
  27318. }
  27319. var tx = 0;
  27320. var ty = 0;
  27321. if (!font.vertical) {
  27322. var w0 = glyphWidth * textState.fontMatrix[0];
  27323. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  27324. width += tx;
  27325. } else {
  27326. var w1 = glyphWidth * textState.fontMatrix[0];
  27327. ty = w1 * textState.fontSize + charSpacing;
  27328. height += ty;
  27329. }
  27330. textState.translateTextMatrix(tx, ty);
  27331. textChunk.str.push(glyphUnicode);
  27332. }
  27333. if (!font.vertical) {
  27334. textChunk.lastAdvanceWidth = width;
  27335. textChunk.width += width;
  27336. } else {
  27337. textChunk.lastAdvanceHeight = height;
  27338. textChunk.height += Math.abs(height);
  27339. }
  27340. return textChunk;
  27341. }
  27342. function addFakeSpaces(width, strBuf) {
  27343. if (width < textContentItem.fakeSpaceMin) {
  27344. return;
  27345. }
  27346. if (width < textContentItem.fakeMultiSpaceMin) {
  27347. strBuf.push(' ');
  27348. return;
  27349. }
  27350. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  27351. while (fakeSpaces-- > 0) {
  27352. strBuf.push(' ');
  27353. }
  27354. }
  27355. function flushTextContentItem() {
  27356. if (!textContentItem.initialized) {
  27357. return;
  27358. }
  27359. textContentItem.width *= textContentItem.textAdvanceScale;
  27360. textContentItem.height *= textContentItem.textAdvanceScale;
  27361. textContent.items.push(runBidiTransform(textContentItem));
  27362. textContentItem.initialized = false;
  27363. textContentItem.str.length = 0;
  27364. }
  27365. var timeSlotManager = new TimeSlotManager();
  27366. return new Promise(function promiseBody(resolve, reject) {
  27367. var next = function (promise) {
  27368. promise.then(function () {
  27369. try {
  27370. promiseBody(resolve, reject);
  27371. } catch (ex) {
  27372. reject(ex);
  27373. }
  27374. }, reject);
  27375. };
  27376. task.ensureNotTerminated();
  27377. timeSlotManager.reset();
  27378. var stop, operation = {}, args = [];
  27379. while (!(stop = timeSlotManager.check())) {
  27380. args.length = 0;
  27381. operation.args = args;
  27382. if (!preprocessor.read(operation)) {
  27383. break;
  27384. }
  27385. textState = stateManager.state;
  27386. var fn = operation.fn;
  27387. args = operation.args;
  27388. var advance, diff;
  27389. switch (fn | 0) {
  27390. case OPS.setFont:
  27391. var fontNameArg = args[0].name, fontSizeArg = args[1];
  27392. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  27393. break;
  27394. }
  27395. flushTextContentItem();
  27396. textState.fontName = fontNameArg;
  27397. textState.fontSize = fontSizeArg;
  27398. next(handleSetFont(fontNameArg, null));
  27399. return;
  27400. case OPS.setTextRise:
  27401. flushTextContentItem();
  27402. textState.textRise = args[0];
  27403. break;
  27404. case OPS.setHScale:
  27405. flushTextContentItem();
  27406. textState.textHScale = args[0] / 100;
  27407. break;
  27408. case OPS.setLeading:
  27409. flushTextContentItem();
  27410. textState.leading = args[0];
  27411. break;
  27412. case OPS.moveText:
  27413. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  27414. advance = args[0] - args[1];
  27415. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  27416. textState.translateTextLineMatrix(args[0], args[1]);
  27417. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  27418. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  27419. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  27420. addFakeSpaces(diff, textContentItem.str);
  27421. break;
  27422. }
  27423. flushTextContentItem();
  27424. textState.translateTextLineMatrix(args[0], args[1]);
  27425. textState.textMatrix = textState.textLineMatrix.slice();
  27426. break;
  27427. case OPS.setLeadingMoveText:
  27428. flushTextContentItem();
  27429. textState.leading = -args[1];
  27430. textState.translateTextLineMatrix(args[0], args[1]);
  27431. textState.textMatrix = textState.textLineMatrix.slice();
  27432. break;
  27433. case OPS.nextLine:
  27434. flushTextContentItem();
  27435. textState.carriageReturn();
  27436. break;
  27437. case OPS.setTextMatrix:
  27438. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  27439. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  27440. textState.translateTextLineMatrix(advance.width, advance.height);
  27441. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  27442. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  27443. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  27444. addFakeSpaces(diff, textContentItem.str);
  27445. break;
  27446. }
  27447. flushTextContentItem();
  27448. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27449. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27450. break;
  27451. case OPS.setCharSpacing:
  27452. textState.charSpacing = args[0];
  27453. break;
  27454. case OPS.setWordSpacing:
  27455. textState.wordSpacing = args[0];
  27456. break;
  27457. case OPS.beginText:
  27458. flushTextContentItem();
  27459. textState.textMatrix = IDENTITY_MATRIX.slice();
  27460. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  27461. break;
  27462. case OPS.showSpacedText:
  27463. var items = args[0];
  27464. var offset;
  27465. for (var j = 0, jj = items.length; j < jj; j++) {
  27466. if (typeof items[j] === 'string') {
  27467. buildTextContentItem(items[j]);
  27468. } else if (isNum(items[j])) {
  27469. ensureTextContentItem();
  27470. advance = items[j] * textState.fontSize / 1000;
  27471. var breakTextRun = false;
  27472. if (textState.font.vertical) {
  27473. offset = advance;
  27474. textState.translateTextMatrix(0, offset);
  27475. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27476. if (!breakTextRun) {
  27477. textContentItem.height += offset;
  27478. }
  27479. } else {
  27480. advance = -advance;
  27481. offset = advance * textState.textHScale;
  27482. textState.translateTextMatrix(offset, 0);
  27483. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27484. if (!breakTextRun) {
  27485. textContentItem.width += offset;
  27486. }
  27487. }
  27488. if (breakTextRun) {
  27489. flushTextContentItem();
  27490. } else if (advance > 0) {
  27491. addFakeSpaces(advance, textContentItem.str);
  27492. }
  27493. }
  27494. }
  27495. break;
  27496. case OPS.showText:
  27497. buildTextContentItem(args[0]);
  27498. break;
  27499. case OPS.nextLineShowText:
  27500. flushTextContentItem();
  27501. textState.carriageReturn();
  27502. buildTextContentItem(args[0]);
  27503. break;
  27504. case OPS.nextLineSetSpacingShowText:
  27505. flushTextContentItem();
  27506. textState.wordSpacing = args[0];
  27507. textState.charSpacing = args[1];
  27508. textState.carriageReturn();
  27509. buildTextContentItem(args[2]);
  27510. break;
  27511. case OPS.paintXObject:
  27512. flushTextContentItem();
  27513. if (args[0].code) {
  27514. break;
  27515. }
  27516. if (!xobjs) {
  27517. xobjs = resources.get('XObject') || Dict.empty;
  27518. }
  27519. var name = args[0].name;
  27520. if (xobjsCache.key === name) {
  27521. if (xobjsCache.texts) {
  27522. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  27523. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  27524. }
  27525. break;
  27526. }
  27527. var xobj = xobjs.get(name);
  27528. if (!xobj) {
  27529. break;
  27530. }
  27531. assert(isStream(xobj), 'XObject should be a stream');
  27532. var type = xobj.dict.get('Subtype');
  27533. assert(isName(type), 'XObject should have a Name subtype');
  27534. if ('Form' !== type.name) {
  27535. xobjsCache.key = name;
  27536. xobjsCache.texts = null;
  27537. break;
  27538. }
  27539. stateManager.save();
  27540. var matrix = xobj.dict.getArray('Matrix');
  27541. if (isArray(matrix) && matrix.length === 6) {
  27542. stateManager.transform(matrix);
  27543. }
  27544. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  27545. Util.appendToArray(textContent.items, formTextContent.items);
  27546. Util.extendObj(textContent.styles, formTextContent.styles);
  27547. stateManager.restore();
  27548. xobjsCache.key = name;
  27549. xobjsCache.texts = formTextContent;
  27550. }));
  27551. return;
  27552. case OPS.setGState:
  27553. flushTextContentItem();
  27554. var dictName = args[0];
  27555. var extGState = resources.get('ExtGState');
  27556. if (!isDict(extGState) || !isName(dictName)) {
  27557. break;
  27558. }
  27559. var gState = extGState.get(dictName.name);
  27560. if (!isDict(gState)) {
  27561. break;
  27562. }
  27563. var gStateFont = gState.get('Font');
  27564. if (gStateFont) {
  27565. textState.fontName = null;
  27566. textState.fontSize = gStateFont[1];
  27567. next(handleSetFont(null, gStateFont[0]));
  27568. return;
  27569. }
  27570. break;
  27571. }
  27572. }
  27573. if (stop) {
  27574. next(deferred);
  27575. return;
  27576. }
  27577. flushTextContentItem();
  27578. resolve(textContent);
  27579. });
  27580. },
  27581. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  27582. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27583. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  27584. if (properties.composite) {
  27585. var cidSystemInfo = dict.get('CIDSystemInfo');
  27586. if (isDict(cidSystemInfo)) {
  27587. properties.cidSystemInfo = {
  27588. registry: cidSystemInfo.get('Registry'),
  27589. ordering: cidSystemInfo.get('Ordering'),
  27590. supplement: cidSystemInfo.get('Supplement')
  27591. };
  27592. }
  27593. var cidToGidMap = dict.get('CIDToGIDMap');
  27594. if (isStream(cidToGidMap)) {
  27595. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  27596. }
  27597. }
  27598. var differences = [];
  27599. var baseEncodingName = null;
  27600. var encoding;
  27601. if (dict.has('Encoding')) {
  27602. encoding = dict.get('Encoding');
  27603. if (isDict(encoding)) {
  27604. baseEncodingName = encoding.get('BaseEncoding');
  27605. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  27606. if (encoding.has('Differences')) {
  27607. var diffEncoding = encoding.get('Differences');
  27608. var index = 0;
  27609. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  27610. var data = xref.fetchIfRef(diffEncoding[j]);
  27611. if (isNum(data)) {
  27612. index = data;
  27613. } else if (isName(data)) {
  27614. differences[index++] = data.name;
  27615. } else {
  27616. error('Invalid entry in \'Differences\' array: ' + data);
  27617. }
  27618. }
  27619. }
  27620. } else if (isName(encoding)) {
  27621. baseEncodingName = encoding.name;
  27622. } else {
  27623. error('Encoding is not a Name nor a Dict');
  27624. }
  27625. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  27626. baseEncodingName = null;
  27627. }
  27628. }
  27629. if (baseEncodingName) {
  27630. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  27631. } else {
  27632. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27633. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  27634. encoding = StandardEncoding;
  27635. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  27636. encoding = WinAnsiEncoding;
  27637. }
  27638. if (isSymbolicFont) {
  27639. encoding = MacRomanEncoding;
  27640. if (!properties.file) {
  27641. if (/Symbol/i.test(properties.name)) {
  27642. encoding = SymbolSetEncoding;
  27643. } else if (/Dingbats/i.test(properties.name)) {
  27644. encoding = ZapfDingbatsEncoding;
  27645. }
  27646. }
  27647. }
  27648. properties.defaultEncoding = encoding;
  27649. }
  27650. properties.differences = differences;
  27651. properties.baseEncodingName = baseEncodingName;
  27652. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  27653. properties.dict = dict;
  27654. return toUnicodePromise.then(function (toUnicode) {
  27655. properties.toUnicode = toUnicode;
  27656. return this.buildToUnicode(properties);
  27657. }.bind(this)).then(function (toUnicode) {
  27658. properties.toUnicode = toUnicode;
  27659. return properties;
  27660. });
  27661. },
  27662. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  27663. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  27664. if (properties.hasIncludedToUnicodeMap) {
  27665. return Promise.resolve(properties.toUnicode);
  27666. }
  27667. var toUnicode, charcode, glyphName;
  27668. if (!properties.composite) {
  27669. toUnicode = [];
  27670. var encoding = properties.defaultEncoding.slice();
  27671. var baseEncodingName = properties.baseEncodingName;
  27672. var differences = properties.differences;
  27673. for (charcode in differences) {
  27674. glyphName = differences[charcode];
  27675. if (glyphName === '.notdef') {
  27676. continue;
  27677. }
  27678. encoding[charcode] = glyphName;
  27679. }
  27680. var glyphsUnicodeMap = getGlyphsUnicode();
  27681. for (charcode in encoding) {
  27682. glyphName = encoding[charcode];
  27683. if (glyphName === '') {
  27684. continue;
  27685. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  27686. var code = 0;
  27687. switch (glyphName[0]) {
  27688. case 'G':
  27689. if (glyphName.length === 3) {
  27690. code = parseInt(glyphName.substr(1), 16);
  27691. }
  27692. break;
  27693. case 'g':
  27694. if (glyphName.length === 5) {
  27695. code = parseInt(glyphName.substr(1), 16);
  27696. }
  27697. break;
  27698. case 'C':
  27699. case 'c':
  27700. if (glyphName.length >= 3) {
  27701. code = +glyphName.substr(1);
  27702. }
  27703. break;
  27704. default:
  27705. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  27706. if (unicode !== -1) {
  27707. code = unicode;
  27708. }
  27709. }
  27710. if (code) {
  27711. if (baseEncodingName && code === +charcode) {
  27712. var baseEncoding = getEncoding(baseEncodingName);
  27713. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  27714. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27715. continue;
  27716. }
  27717. }
  27718. toUnicode[charcode] = String.fromCharCode(code);
  27719. }
  27720. continue;
  27721. }
  27722. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27723. }
  27724. return Promise.resolve(new ToUnicodeMap(toUnicode));
  27725. }
  27726. 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'))) {
  27727. var registry = properties.cidSystemInfo.registry;
  27728. var ordering = properties.cidSystemInfo.ordering;
  27729. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  27730. return CMapFactory.create(ucs2CMapName, this.options.cMapOptions, null).then(function (ucs2CMap) {
  27731. var cMap = properties.cMap;
  27732. toUnicode = [];
  27733. cMap.forEach(function (charcode, cid) {
  27734. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  27735. var ucs2 = ucs2CMap.lookup(cid);
  27736. if (ucs2) {
  27737. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  27738. }
  27739. });
  27740. return new ToUnicodeMap(toUnicode);
  27741. });
  27742. }
  27743. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  27744. },
  27745. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  27746. var cmapObj = toUnicode;
  27747. if (isName(cmapObj)) {
  27748. return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) {
  27749. if (cmap instanceof IdentityCMap) {
  27750. return new IdentityToUnicodeMap(0, 0xFFFF);
  27751. }
  27752. return new ToUnicodeMap(cmap.getMap());
  27753. });
  27754. } else if (isStream(cmapObj)) {
  27755. return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) {
  27756. if (cmap instanceof IdentityCMap) {
  27757. return new IdentityToUnicodeMap(0, 0xFFFF);
  27758. }
  27759. var map = new Array(cmap.length);
  27760. cmap.forEach(function (charCode, token) {
  27761. var str = [];
  27762. for (var k = 0; k < token.length; k += 2) {
  27763. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27764. if ((w1 & 0xF800) !== 0xD800) {
  27765. str.push(w1);
  27766. continue;
  27767. }
  27768. k += 2;
  27769. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27770. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  27771. }
  27772. map[charCode] = String.fromCharCode.apply(String, str);
  27773. });
  27774. return new ToUnicodeMap(map);
  27775. });
  27776. }
  27777. return Promise.resolve(null);
  27778. },
  27779. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  27780. var glyphsData = cidToGidStream.getBytes();
  27781. var result = [];
  27782. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  27783. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  27784. if (glyphID === 0) {
  27785. continue;
  27786. }
  27787. var code = j >> 1;
  27788. result[code] = glyphID;
  27789. }
  27790. return result;
  27791. },
  27792. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  27793. var glyphsWidths = [];
  27794. var defaultWidth = 0;
  27795. var glyphsVMetrics = [];
  27796. var defaultVMetrics;
  27797. var i, ii, j, jj, start, code, widths;
  27798. if (properties.composite) {
  27799. defaultWidth = dict.get('DW') || 1000;
  27800. widths = dict.get('W');
  27801. if (widths) {
  27802. for (i = 0, ii = widths.length; i < ii; i++) {
  27803. start = xref.fetchIfRef(widths[i++]);
  27804. code = xref.fetchIfRef(widths[i]);
  27805. if (isArray(code)) {
  27806. for (j = 0, jj = code.length; j < jj; j++) {
  27807. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  27808. }
  27809. } else {
  27810. var width = xref.fetchIfRef(widths[++i]);
  27811. for (j = start; j <= code; j++) {
  27812. glyphsWidths[j] = width;
  27813. }
  27814. }
  27815. }
  27816. }
  27817. if (properties.vertical) {
  27818. var vmetrics = dict.getArray('DW2') || [
  27819. 880,
  27820. -1000
  27821. ];
  27822. defaultVMetrics = [
  27823. vmetrics[1],
  27824. defaultWidth * 0.5,
  27825. vmetrics[0]
  27826. ];
  27827. vmetrics = dict.get('W2');
  27828. if (vmetrics) {
  27829. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27830. start = xref.fetchIfRef(vmetrics[i++]);
  27831. code = xref.fetchIfRef(vmetrics[i]);
  27832. if (isArray(code)) {
  27833. for (j = 0, jj = code.length; j < jj; j++) {
  27834. glyphsVMetrics[start++] = [
  27835. xref.fetchIfRef(code[j++]),
  27836. xref.fetchIfRef(code[j++]),
  27837. xref.fetchIfRef(code[j])
  27838. ];
  27839. }
  27840. } else {
  27841. var vmetric = [
  27842. xref.fetchIfRef(vmetrics[++i]),
  27843. xref.fetchIfRef(vmetrics[++i]),
  27844. xref.fetchIfRef(vmetrics[++i])
  27845. ];
  27846. for (j = start; j <= code; j++) {
  27847. glyphsVMetrics[j] = vmetric;
  27848. }
  27849. }
  27850. }
  27851. }
  27852. }
  27853. } else {
  27854. var firstChar = properties.firstChar;
  27855. widths = dict.get('Widths');
  27856. if (widths) {
  27857. j = firstChar;
  27858. for (i = 0, ii = widths.length; i < ii; i++) {
  27859. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27860. }
  27861. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27862. } else {
  27863. var baseFontName = dict.get('BaseFont');
  27864. if (isName(baseFontName)) {
  27865. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27866. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27867. defaultWidth = metrics.defaultWidth;
  27868. }
  27869. }
  27870. }
  27871. var isMonospace = true;
  27872. var firstWidth = defaultWidth;
  27873. for (var glyph in glyphsWidths) {
  27874. var glyphWidth = glyphsWidths[glyph];
  27875. if (!glyphWidth) {
  27876. continue;
  27877. }
  27878. if (!firstWidth) {
  27879. firstWidth = glyphWidth;
  27880. continue;
  27881. }
  27882. if (firstWidth !== glyphWidth) {
  27883. isMonospace = false;
  27884. break;
  27885. }
  27886. }
  27887. if (isMonospace) {
  27888. properties.flags |= FontFlags.FixedPitch;
  27889. }
  27890. properties.defaultWidth = defaultWidth;
  27891. properties.widths = glyphsWidths;
  27892. properties.defaultVMetrics = defaultVMetrics;
  27893. properties.vmetrics = glyphsVMetrics;
  27894. },
  27895. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27896. var fontNameWoStyle = baseFontName.split('-')[0];
  27897. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27898. },
  27899. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27900. var defaultWidth = 0;
  27901. var widths = [];
  27902. var monospace = false;
  27903. var stdFontMap = getStdFontMap();
  27904. var lookupName = stdFontMap[name] || name;
  27905. var Metrics = getMetrics();
  27906. if (!(lookupName in Metrics)) {
  27907. if (this.isSerifFont(name)) {
  27908. lookupName = 'Times-Roman';
  27909. } else {
  27910. lookupName = 'Helvetica';
  27911. }
  27912. }
  27913. var glyphWidths = Metrics[lookupName];
  27914. if (isNum(glyphWidths)) {
  27915. defaultWidth = glyphWidths;
  27916. monospace = true;
  27917. } else {
  27918. widths = glyphWidths();
  27919. }
  27920. return {
  27921. defaultWidth: defaultWidth,
  27922. monospace: monospace,
  27923. widths: widths
  27924. };
  27925. },
  27926. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27927. var widths = Object.create(null);
  27928. var differences = properties.differences;
  27929. var encoding = properties.defaultEncoding;
  27930. for (var charCode = 0; charCode < 256; charCode++) {
  27931. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27932. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27933. continue;
  27934. }
  27935. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27936. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27937. continue;
  27938. }
  27939. }
  27940. return widths;
  27941. },
  27942. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27943. var baseDict = dict;
  27944. var type = dict.get('Subtype');
  27945. assert(isName(type), 'invalid font Subtype');
  27946. var composite = false;
  27947. var uint8array;
  27948. if (type.name === 'Type0') {
  27949. var df = dict.get('DescendantFonts');
  27950. if (!df) {
  27951. error('Descendant fonts are not specified');
  27952. }
  27953. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27954. type = dict.get('Subtype');
  27955. assert(isName(type), 'invalid font Subtype');
  27956. composite = true;
  27957. }
  27958. var descriptor = dict.get('FontDescriptor');
  27959. if (descriptor) {
  27960. var hash = new MurmurHash3_64();
  27961. var encoding = baseDict.getRaw('Encoding');
  27962. if (isName(encoding)) {
  27963. hash.update(encoding.name);
  27964. } else if (isRef(encoding)) {
  27965. hash.update(encoding.toString());
  27966. } else if (isDict(encoding)) {
  27967. var keys = encoding.getKeys();
  27968. for (var i = 0, ii = keys.length; i < ii; i++) {
  27969. var entry = encoding.getRaw(keys[i]);
  27970. if (isName(entry)) {
  27971. hash.update(entry.name);
  27972. } else if (isRef(entry)) {
  27973. hash.update(entry.toString());
  27974. } else if (isArray(entry)) {
  27975. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27976. for (var j = 0; j < diffLength; j++) {
  27977. var diffEntry = entry[j];
  27978. if (isName(diffEntry)) {
  27979. diffBuf[j] = diffEntry.name;
  27980. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27981. diffBuf[j] = diffEntry.toString();
  27982. }
  27983. }
  27984. hash.update(diffBuf.join());
  27985. }
  27986. }
  27987. }
  27988. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27989. if (isStream(toUnicode)) {
  27990. var stream = toUnicode.str || toUnicode;
  27991. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27992. hash.update(uint8array);
  27993. } else if (isName(toUnicode)) {
  27994. hash.update(toUnicode.name);
  27995. }
  27996. var widths = dict.get('Widths') || baseDict.get('Widths');
  27997. if (widths) {
  27998. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  27999. hash.update(uint8array);
  28000. }
  28001. }
  28002. return {
  28003. descriptor: descriptor,
  28004. dict: dict,
  28005. baseDict: baseDict,
  28006. composite: composite,
  28007. type: type.name,
  28008. hash: hash ? hash.hexdigest() : ''
  28009. };
  28010. },
  28011. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  28012. var baseDict = preEvaluatedFont.baseDict;
  28013. var dict = preEvaluatedFont.dict;
  28014. var composite = preEvaluatedFont.composite;
  28015. var descriptor = preEvaluatedFont.descriptor;
  28016. var type = preEvaluatedFont.type;
  28017. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  28018. var cMapOptions = this.options.cMapOptions;
  28019. var properties;
  28020. if (!descriptor) {
  28021. if (type === 'Type3') {
  28022. descriptor = new Dict(null);
  28023. descriptor.set('FontName', Name.get(type));
  28024. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  28025. } else {
  28026. var baseFontName = dict.get('BaseFont');
  28027. if (!isName(baseFontName)) {
  28028. error('Base font is not specified');
  28029. }
  28030. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  28031. var metrics = this.getBaseFontMetrics(baseFontName);
  28032. var fontNameWoStyle = baseFontName.split('-')[0];
  28033. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  28034. properties = {
  28035. type: type,
  28036. name: baseFontName,
  28037. widths: metrics.widths,
  28038. defaultWidth: metrics.defaultWidth,
  28039. flags: flags,
  28040. firstChar: 0,
  28041. lastChar: maxCharIndex
  28042. };
  28043. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  28044. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  28045. return new Font(baseFontName, null, properties);
  28046. }.bind(this));
  28047. }
  28048. }
  28049. var firstChar = dict.get('FirstChar') || 0;
  28050. var lastChar = dict.get('LastChar') || maxCharIndex;
  28051. var fontName = descriptor.get('FontName');
  28052. var baseFont = dict.get('BaseFont');
  28053. if (isString(fontName)) {
  28054. fontName = Name.get(fontName);
  28055. }
  28056. if (isString(baseFont)) {
  28057. baseFont = Name.get(baseFont);
  28058. }
  28059. if (type !== 'Type3') {
  28060. var fontNameStr = fontName && fontName.name;
  28061. var baseFontStr = baseFont && baseFont.name;
  28062. if (fontNameStr !== baseFontStr) {
  28063. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  28064. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  28065. fontName = baseFont;
  28066. }
  28067. }
  28068. }
  28069. fontName = fontName || baseFont;
  28070. assert(isName(fontName), 'invalid font name');
  28071. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  28072. if (fontFile) {
  28073. if (fontFile.dict) {
  28074. var subtype = fontFile.dict.get('Subtype');
  28075. if (subtype) {
  28076. subtype = subtype.name;
  28077. }
  28078. var length1 = fontFile.dict.get('Length1');
  28079. var length2 = fontFile.dict.get('Length2');
  28080. var length3 = fontFile.dict.get('Length3');
  28081. }
  28082. }
  28083. properties = {
  28084. type: type,
  28085. name: fontName.name,
  28086. subtype: subtype,
  28087. file: fontFile,
  28088. length1: length1,
  28089. length2: length2,
  28090. length3: length3,
  28091. loadedName: baseDict.loadedName,
  28092. composite: composite,
  28093. wideChars: composite,
  28094. fixedPitch: false,
  28095. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  28096. firstChar: firstChar || 0,
  28097. lastChar: lastChar || maxCharIndex,
  28098. bbox: descriptor.getArray('FontBBox'),
  28099. ascent: descriptor.get('Ascent'),
  28100. descent: descriptor.get('Descent'),
  28101. xHeight: descriptor.get('XHeight'),
  28102. capHeight: descriptor.get('CapHeight'),
  28103. flags: descriptor.get('Flags'),
  28104. italicAngle: descriptor.get('ItalicAngle'),
  28105. coded: false
  28106. };
  28107. var cMapPromise;
  28108. if (composite) {
  28109. var cidEncoding = baseDict.get('Encoding');
  28110. if (isName(cidEncoding)) {
  28111. properties.cidEncoding = cidEncoding.name;
  28112. }
  28113. cMapPromise = CMapFactory.create(cidEncoding, cMapOptions, null).then(function (cMap) {
  28114. properties.cMap = cMap;
  28115. properties.vertical = properties.cMap.vertical;
  28116. });
  28117. } else {
  28118. cMapPromise = Promise.resolve(undefined);
  28119. }
  28120. return cMapPromise.then(function () {
  28121. return this.extractDataStructures(dict, baseDict, xref, properties);
  28122. }.bind(this)).then(function (properties) {
  28123. this.extractWidths(dict, xref, descriptor, properties);
  28124. if (type === 'Type3') {
  28125. properties.isType3Font = true;
  28126. }
  28127. return new Font(fontName.name, fontFile, properties);
  28128. }.bind(this));
  28129. }
  28130. };
  28131. return PartialEvaluator;
  28132. }();
  28133. var TranslatedFont = function TranslatedFontClosure() {
  28134. function TranslatedFont(loadedName, font, dict) {
  28135. this.loadedName = loadedName;
  28136. this.font = font;
  28137. this.dict = dict;
  28138. this.type3Loaded = null;
  28139. this.sent = false;
  28140. }
  28141. TranslatedFont.prototype = {
  28142. send: function (handler) {
  28143. if (this.sent) {
  28144. return;
  28145. }
  28146. var fontData = this.font.exportData();
  28147. handler.send('commonobj', [
  28148. this.loadedName,
  28149. 'Font',
  28150. fontData
  28151. ]);
  28152. this.sent = true;
  28153. },
  28154. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  28155. assert(this.font.isType3Font);
  28156. if (this.type3Loaded) {
  28157. return this.type3Loaded;
  28158. }
  28159. var translatedFont = this.font;
  28160. var loadCharProcsPromise = Promise.resolve();
  28161. var charProcs = this.dict.get('CharProcs');
  28162. var fontResources = this.dict.get('Resources') || resources;
  28163. var charProcKeys = charProcs.getKeys();
  28164. var charProcOperatorList = Object.create(null);
  28165. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  28166. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  28167. var glyphStream = charProcs.get(key);
  28168. var operatorList = new OperatorList();
  28169. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  28170. charProcOperatorList[key] = operatorList.getIR();
  28171. parentOperatorList.addDependencies(operatorList.dependencies);
  28172. }, function (reason) {
  28173. warn('Type3 font resource \"' + key + '\" is not available');
  28174. var operatorList = new OperatorList();
  28175. charProcOperatorList[key] = operatorList.getIR();
  28176. });
  28177. }.bind(this, charProcKeys[i]));
  28178. }
  28179. this.type3Loaded = loadCharProcsPromise.then(function () {
  28180. translatedFont.charProcOperatorList = charProcOperatorList;
  28181. });
  28182. return this.type3Loaded;
  28183. }
  28184. };
  28185. return TranslatedFont;
  28186. }();
  28187. var OperatorList = function OperatorListClosure() {
  28188. var CHUNK_SIZE = 1000;
  28189. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  28190. function getTransfers(queue) {
  28191. var transfers = [];
  28192. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28193. for (var i = 0, ii = queue.length; i < ii; i++) {
  28194. switch (fnArray[i]) {
  28195. case OPS.paintInlineImageXObject:
  28196. case OPS.paintInlineImageXObjectGroup:
  28197. case OPS.paintImageMaskXObject:
  28198. var arg = argsArray[i][0];
  28199. if (!arg.cached) {
  28200. transfers.push(arg.data.buffer);
  28201. }
  28202. break;
  28203. }
  28204. }
  28205. return transfers;
  28206. }
  28207. function OperatorList(intent, messageHandler, pageIndex) {
  28208. this.messageHandler = messageHandler;
  28209. this.fnArray = [];
  28210. this.argsArray = [];
  28211. this.dependencies = Object.create(null);
  28212. this._totalLength = 0;
  28213. this.pageIndex = pageIndex;
  28214. this.intent = intent;
  28215. }
  28216. OperatorList.prototype = {
  28217. get length() {
  28218. return this.argsArray.length;
  28219. },
  28220. get totalLength() {
  28221. return this._totalLength + this.length;
  28222. },
  28223. addOp: function (fn, args) {
  28224. this.fnArray.push(fn);
  28225. this.argsArray.push(args);
  28226. if (this.messageHandler) {
  28227. if (this.fnArray.length >= CHUNK_SIZE) {
  28228. this.flush();
  28229. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  28230. this.flush();
  28231. }
  28232. }
  28233. },
  28234. addDependency: function (dependency) {
  28235. if (dependency in this.dependencies) {
  28236. return;
  28237. }
  28238. this.dependencies[dependency] = true;
  28239. this.addOp(OPS.dependency, [dependency]);
  28240. },
  28241. addDependencies: function (dependencies) {
  28242. for (var key in dependencies) {
  28243. this.addDependency(key);
  28244. }
  28245. },
  28246. addOpList: function (opList) {
  28247. Util.extendObj(this.dependencies, opList.dependencies);
  28248. for (var i = 0, ii = opList.length; i < ii; i++) {
  28249. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  28250. }
  28251. },
  28252. getIR: function () {
  28253. return {
  28254. fnArray: this.fnArray,
  28255. argsArray: this.argsArray,
  28256. length: this.length
  28257. };
  28258. },
  28259. flush: function (lastChunk) {
  28260. if (this.intent !== 'oplist') {
  28261. new QueueOptimizer().optimize(this);
  28262. }
  28263. var transfers = getTransfers(this);
  28264. var length = this.length;
  28265. this._totalLength += length;
  28266. this.messageHandler.send('RenderPageChunk', {
  28267. operatorList: {
  28268. fnArray: this.fnArray,
  28269. argsArray: this.argsArray,
  28270. lastChunk: lastChunk,
  28271. length: length
  28272. },
  28273. pageIndex: this.pageIndex,
  28274. intent: this.intent
  28275. }, transfers);
  28276. this.dependencies = Object.create(null);
  28277. this.fnArray.length = 0;
  28278. this.argsArray.length = 0;
  28279. }
  28280. };
  28281. return OperatorList;
  28282. }();
  28283. var StateManager = function StateManagerClosure() {
  28284. function StateManager(initialState) {
  28285. this.state = initialState;
  28286. this.stateStack = [];
  28287. }
  28288. StateManager.prototype = {
  28289. save: function () {
  28290. var old = this.state;
  28291. this.stateStack.push(this.state);
  28292. this.state = old.clone();
  28293. },
  28294. restore: function () {
  28295. var prev = this.stateStack.pop();
  28296. if (prev) {
  28297. this.state = prev;
  28298. }
  28299. },
  28300. transform: function (args) {
  28301. this.state.ctm = Util.transform(this.state.ctm, args);
  28302. }
  28303. };
  28304. return StateManager;
  28305. }();
  28306. var TextState = function TextStateClosure() {
  28307. function TextState() {
  28308. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28309. this.fontName = null;
  28310. this.fontSize = 0;
  28311. this.font = null;
  28312. this.fontMatrix = FONT_IDENTITY_MATRIX;
  28313. this.textMatrix = IDENTITY_MATRIX.slice();
  28314. this.textLineMatrix = IDENTITY_MATRIX.slice();
  28315. this.charSpacing = 0;
  28316. this.wordSpacing = 0;
  28317. this.leading = 0;
  28318. this.textHScale = 1;
  28319. this.textRise = 0;
  28320. }
  28321. TextState.prototype = {
  28322. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28323. var m = this.textMatrix;
  28324. m[0] = a;
  28325. m[1] = b;
  28326. m[2] = c;
  28327. m[3] = d;
  28328. m[4] = e;
  28329. m[5] = f;
  28330. },
  28331. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28332. var m = this.textLineMatrix;
  28333. m[0] = a;
  28334. m[1] = b;
  28335. m[2] = c;
  28336. m[3] = d;
  28337. m[4] = e;
  28338. m[5] = f;
  28339. },
  28340. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  28341. var m = this.textMatrix;
  28342. m[4] = m[0] * x + m[2] * y + m[4];
  28343. m[5] = m[1] * x + m[3] * y + m[5];
  28344. },
  28345. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  28346. var m = this.textLineMatrix;
  28347. m[4] = m[0] * x + m[2] * y + m[4];
  28348. m[5] = m[1] * x + m[3] * y + m[5];
  28349. },
  28350. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  28351. var font = this.font;
  28352. if (!font) {
  28353. return null;
  28354. }
  28355. var m = this.textLineMatrix;
  28356. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  28357. return null;
  28358. }
  28359. var txDiff = e - m[4], tyDiff = f - m[5];
  28360. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  28361. return null;
  28362. }
  28363. var tx, ty, denominator = a * d - b * c;
  28364. if (font.vertical) {
  28365. tx = -tyDiff * c / denominator;
  28366. ty = tyDiff * a / denominator;
  28367. } else {
  28368. tx = txDiff * d / denominator;
  28369. ty = -txDiff * b / denominator;
  28370. }
  28371. return {
  28372. width: tx,
  28373. height: ty,
  28374. value: font.vertical ? ty : tx
  28375. };
  28376. },
  28377. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  28378. var tsm = [
  28379. this.fontSize * this.textHScale,
  28380. 0,
  28381. 0,
  28382. this.fontSize,
  28383. 0,
  28384. this.textRise
  28385. ];
  28386. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  28387. },
  28388. carriageReturn: function TextState_carriageReturn() {
  28389. this.translateTextLineMatrix(0, -this.leading);
  28390. this.textMatrix = this.textLineMatrix.slice();
  28391. },
  28392. clone: function TextState_clone() {
  28393. var clone = Object.create(this);
  28394. clone.textMatrix = this.textMatrix.slice();
  28395. clone.textLineMatrix = this.textLineMatrix.slice();
  28396. clone.fontMatrix = this.fontMatrix.slice();
  28397. return clone;
  28398. }
  28399. };
  28400. return TextState;
  28401. }();
  28402. var EvalState = function EvalStateClosure() {
  28403. function EvalState() {
  28404. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28405. this.font = null;
  28406. this.textRenderingMode = TextRenderingMode.FILL;
  28407. this.fillColorSpace = ColorSpace.singletons.gray;
  28408. this.strokeColorSpace = ColorSpace.singletons.gray;
  28409. }
  28410. EvalState.prototype = {
  28411. clone: function CanvasExtraState_clone() {
  28412. return Object.create(this);
  28413. }
  28414. };
  28415. return EvalState;
  28416. }();
  28417. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  28418. var getOPMap = getLookupTableFactory(function (t) {
  28419. t['w'] = {
  28420. id: OPS.setLineWidth,
  28421. numArgs: 1,
  28422. variableArgs: false
  28423. };
  28424. t['J'] = {
  28425. id: OPS.setLineCap,
  28426. numArgs: 1,
  28427. variableArgs: false
  28428. };
  28429. t['j'] = {
  28430. id: OPS.setLineJoin,
  28431. numArgs: 1,
  28432. variableArgs: false
  28433. };
  28434. t['M'] = {
  28435. id: OPS.setMiterLimit,
  28436. numArgs: 1,
  28437. variableArgs: false
  28438. };
  28439. t['d'] = {
  28440. id: OPS.setDash,
  28441. numArgs: 2,
  28442. variableArgs: false
  28443. };
  28444. t['ri'] = {
  28445. id: OPS.setRenderingIntent,
  28446. numArgs: 1,
  28447. variableArgs: false
  28448. };
  28449. t['i'] = {
  28450. id: OPS.setFlatness,
  28451. numArgs: 1,
  28452. variableArgs: false
  28453. };
  28454. t['gs'] = {
  28455. id: OPS.setGState,
  28456. numArgs: 1,
  28457. variableArgs: false
  28458. };
  28459. t['q'] = {
  28460. id: OPS.save,
  28461. numArgs: 0,
  28462. variableArgs: false
  28463. };
  28464. t['Q'] = {
  28465. id: OPS.restore,
  28466. numArgs: 0,
  28467. variableArgs: false
  28468. };
  28469. t['cm'] = {
  28470. id: OPS.transform,
  28471. numArgs: 6,
  28472. variableArgs: false
  28473. };
  28474. t['m'] = {
  28475. id: OPS.moveTo,
  28476. numArgs: 2,
  28477. variableArgs: false
  28478. };
  28479. t['l'] = {
  28480. id: OPS.lineTo,
  28481. numArgs: 2,
  28482. variableArgs: false
  28483. };
  28484. t['c'] = {
  28485. id: OPS.curveTo,
  28486. numArgs: 6,
  28487. variableArgs: false
  28488. };
  28489. t['v'] = {
  28490. id: OPS.curveTo2,
  28491. numArgs: 4,
  28492. variableArgs: false
  28493. };
  28494. t['y'] = {
  28495. id: OPS.curveTo3,
  28496. numArgs: 4,
  28497. variableArgs: false
  28498. };
  28499. t['h'] = {
  28500. id: OPS.closePath,
  28501. numArgs: 0,
  28502. variableArgs: false
  28503. };
  28504. t['re'] = {
  28505. id: OPS.rectangle,
  28506. numArgs: 4,
  28507. variableArgs: false
  28508. };
  28509. t['S'] = {
  28510. id: OPS.stroke,
  28511. numArgs: 0,
  28512. variableArgs: false
  28513. };
  28514. t['s'] = {
  28515. id: OPS.closeStroke,
  28516. numArgs: 0,
  28517. variableArgs: false
  28518. };
  28519. t['f'] = {
  28520. id: OPS.fill,
  28521. numArgs: 0,
  28522. variableArgs: false
  28523. };
  28524. t['F'] = {
  28525. id: OPS.fill,
  28526. numArgs: 0,
  28527. variableArgs: false
  28528. };
  28529. t['f*'] = {
  28530. id: OPS.eoFill,
  28531. numArgs: 0,
  28532. variableArgs: false
  28533. };
  28534. t['B'] = {
  28535. id: OPS.fillStroke,
  28536. numArgs: 0,
  28537. variableArgs: false
  28538. };
  28539. t['B*'] = {
  28540. id: OPS.eoFillStroke,
  28541. numArgs: 0,
  28542. variableArgs: false
  28543. };
  28544. t['b'] = {
  28545. id: OPS.closeFillStroke,
  28546. numArgs: 0,
  28547. variableArgs: false
  28548. };
  28549. t['b*'] = {
  28550. id: OPS.closeEOFillStroke,
  28551. numArgs: 0,
  28552. variableArgs: false
  28553. };
  28554. t['n'] = {
  28555. id: OPS.endPath,
  28556. numArgs: 0,
  28557. variableArgs: false
  28558. };
  28559. t['W'] = {
  28560. id: OPS.clip,
  28561. numArgs: 0,
  28562. variableArgs: false
  28563. };
  28564. t['W*'] = {
  28565. id: OPS.eoClip,
  28566. numArgs: 0,
  28567. variableArgs: false
  28568. };
  28569. t['BT'] = {
  28570. id: OPS.beginText,
  28571. numArgs: 0,
  28572. variableArgs: false
  28573. };
  28574. t['ET'] = {
  28575. id: OPS.endText,
  28576. numArgs: 0,
  28577. variableArgs: false
  28578. };
  28579. t['Tc'] = {
  28580. id: OPS.setCharSpacing,
  28581. numArgs: 1,
  28582. variableArgs: false
  28583. };
  28584. t['Tw'] = {
  28585. id: OPS.setWordSpacing,
  28586. numArgs: 1,
  28587. variableArgs: false
  28588. };
  28589. t['Tz'] = {
  28590. id: OPS.setHScale,
  28591. numArgs: 1,
  28592. variableArgs: false
  28593. };
  28594. t['TL'] = {
  28595. id: OPS.setLeading,
  28596. numArgs: 1,
  28597. variableArgs: false
  28598. };
  28599. t['Tf'] = {
  28600. id: OPS.setFont,
  28601. numArgs: 2,
  28602. variableArgs: false
  28603. };
  28604. t['Tr'] = {
  28605. id: OPS.setTextRenderingMode,
  28606. numArgs: 1,
  28607. variableArgs: false
  28608. };
  28609. t['Ts'] = {
  28610. id: OPS.setTextRise,
  28611. numArgs: 1,
  28612. variableArgs: false
  28613. };
  28614. t['Td'] = {
  28615. id: OPS.moveText,
  28616. numArgs: 2,
  28617. variableArgs: false
  28618. };
  28619. t['TD'] = {
  28620. id: OPS.setLeadingMoveText,
  28621. numArgs: 2,
  28622. variableArgs: false
  28623. };
  28624. t['Tm'] = {
  28625. id: OPS.setTextMatrix,
  28626. numArgs: 6,
  28627. variableArgs: false
  28628. };
  28629. t['T*'] = {
  28630. id: OPS.nextLine,
  28631. numArgs: 0,
  28632. variableArgs: false
  28633. };
  28634. t['Tj'] = {
  28635. id: OPS.showText,
  28636. numArgs: 1,
  28637. variableArgs: false
  28638. };
  28639. t['TJ'] = {
  28640. id: OPS.showSpacedText,
  28641. numArgs: 1,
  28642. variableArgs: false
  28643. };
  28644. t['\''] = {
  28645. id: OPS.nextLineShowText,
  28646. numArgs: 1,
  28647. variableArgs: false
  28648. };
  28649. t['"'] = {
  28650. id: OPS.nextLineSetSpacingShowText,
  28651. numArgs: 3,
  28652. variableArgs: false
  28653. };
  28654. t['d0'] = {
  28655. id: OPS.setCharWidth,
  28656. numArgs: 2,
  28657. variableArgs: false
  28658. };
  28659. t['d1'] = {
  28660. id: OPS.setCharWidthAndBounds,
  28661. numArgs: 6,
  28662. variableArgs: false
  28663. };
  28664. t['CS'] = {
  28665. id: OPS.setStrokeColorSpace,
  28666. numArgs: 1,
  28667. variableArgs: false
  28668. };
  28669. t['cs'] = {
  28670. id: OPS.setFillColorSpace,
  28671. numArgs: 1,
  28672. variableArgs: false
  28673. };
  28674. t['SC'] = {
  28675. id: OPS.setStrokeColor,
  28676. numArgs: 4,
  28677. variableArgs: true
  28678. };
  28679. t['SCN'] = {
  28680. id: OPS.setStrokeColorN,
  28681. numArgs: 33,
  28682. variableArgs: true
  28683. };
  28684. t['sc'] = {
  28685. id: OPS.setFillColor,
  28686. numArgs: 4,
  28687. variableArgs: true
  28688. };
  28689. t['scn'] = {
  28690. id: OPS.setFillColorN,
  28691. numArgs: 33,
  28692. variableArgs: true
  28693. };
  28694. t['G'] = {
  28695. id: OPS.setStrokeGray,
  28696. numArgs: 1,
  28697. variableArgs: false
  28698. };
  28699. t['g'] = {
  28700. id: OPS.setFillGray,
  28701. numArgs: 1,
  28702. variableArgs: false
  28703. };
  28704. t['RG'] = {
  28705. id: OPS.setStrokeRGBColor,
  28706. numArgs: 3,
  28707. variableArgs: false
  28708. };
  28709. t['rg'] = {
  28710. id: OPS.setFillRGBColor,
  28711. numArgs: 3,
  28712. variableArgs: false
  28713. };
  28714. t['K'] = {
  28715. id: OPS.setStrokeCMYKColor,
  28716. numArgs: 4,
  28717. variableArgs: false
  28718. };
  28719. t['k'] = {
  28720. id: OPS.setFillCMYKColor,
  28721. numArgs: 4,
  28722. variableArgs: false
  28723. };
  28724. t['sh'] = {
  28725. id: OPS.shadingFill,
  28726. numArgs: 1,
  28727. variableArgs: false
  28728. };
  28729. t['BI'] = {
  28730. id: OPS.beginInlineImage,
  28731. numArgs: 0,
  28732. variableArgs: false
  28733. };
  28734. t['ID'] = {
  28735. id: OPS.beginImageData,
  28736. numArgs: 0,
  28737. variableArgs: false
  28738. };
  28739. t['EI'] = {
  28740. id: OPS.endInlineImage,
  28741. numArgs: 1,
  28742. variableArgs: false
  28743. };
  28744. t['Do'] = {
  28745. id: OPS.paintXObject,
  28746. numArgs: 1,
  28747. variableArgs: false
  28748. };
  28749. t['MP'] = {
  28750. id: OPS.markPoint,
  28751. numArgs: 1,
  28752. variableArgs: false
  28753. };
  28754. t['DP'] = {
  28755. id: OPS.markPointProps,
  28756. numArgs: 2,
  28757. variableArgs: false
  28758. };
  28759. t['BMC'] = {
  28760. id: OPS.beginMarkedContent,
  28761. numArgs: 1,
  28762. variableArgs: false
  28763. };
  28764. t['BDC'] = {
  28765. id: OPS.beginMarkedContentProps,
  28766. numArgs: 2,
  28767. variableArgs: false
  28768. };
  28769. t['EMC'] = {
  28770. id: OPS.endMarkedContent,
  28771. numArgs: 0,
  28772. variableArgs: false
  28773. };
  28774. t['BX'] = {
  28775. id: OPS.beginCompat,
  28776. numArgs: 0,
  28777. variableArgs: false
  28778. };
  28779. t['EX'] = {
  28780. id: OPS.endCompat,
  28781. numArgs: 0,
  28782. variableArgs: false
  28783. };
  28784. t['BM'] = null;
  28785. t['BD'] = null;
  28786. t['true'] = null;
  28787. t['fa'] = null;
  28788. t['fal'] = null;
  28789. t['fals'] = null;
  28790. t['false'] = null;
  28791. t['nu'] = null;
  28792. t['nul'] = null;
  28793. t['null'] = null;
  28794. });
  28795. function EvaluatorPreprocessor(stream, xref, stateManager) {
  28796. this.opMap = getOPMap();
  28797. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  28798. this.stateManager = stateManager;
  28799. this.nonProcessedArgs = [];
  28800. }
  28801. EvaluatorPreprocessor.prototype = {
  28802. get savedStatesDepth() {
  28803. return this.stateManager.stateStack.length;
  28804. },
  28805. read: function EvaluatorPreprocessor_read(operation) {
  28806. var args = operation.args;
  28807. while (true) {
  28808. var obj = this.parser.getObj();
  28809. if (isCmd(obj)) {
  28810. var cmd = obj.cmd;
  28811. var opSpec = this.opMap[cmd];
  28812. if (!opSpec) {
  28813. warn('Unknown command "' + cmd + '"');
  28814. continue;
  28815. }
  28816. var fn = opSpec.id;
  28817. var numArgs = opSpec.numArgs;
  28818. var argsLength = args !== null ? args.length : 0;
  28819. if (!opSpec.variableArgs) {
  28820. if (argsLength !== numArgs) {
  28821. var nonProcessedArgs = this.nonProcessedArgs;
  28822. while (argsLength > numArgs) {
  28823. nonProcessedArgs.push(args.shift());
  28824. argsLength--;
  28825. }
  28826. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28827. if (args === null) {
  28828. args = [];
  28829. }
  28830. args.unshift(nonProcessedArgs.pop());
  28831. argsLength++;
  28832. }
  28833. }
  28834. if (argsLength < numArgs) {
  28835. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28836. if (args !== null) {
  28837. args.length = 0;
  28838. }
  28839. continue;
  28840. }
  28841. } else if (argsLength > numArgs) {
  28842. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28843. }
  28844. this.preprocessCommand(fn, args);
  28845. operation.fn = fn;
  28846. operation.args = args;
  28847. return true;
  28848. }
  28849. if (isEOF(obj)) {
  28850. return false;
  28851. }
  28852. if (obj !== null) {
  28853. if (args === null) {
  28854. args = [];
  28855. }
  28856. args.push(obj);
  28857. assert(args.length <= 33, 'Too many arguments');
  28858. }
  28859. }
  28860. },
  28861. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28862. switch (fn | 0) {
  28863. case OPS.save:
  28864. this.stateManager.save();
  28865. break;
  28866. case OPS.restore:
  28867. this.stateManager.restore();
  28868. break;
  28869. case OPS.transform:
  28870. this.stateManager.transform(args);
  28871. break;
  28872. }
  28873. }
  28874. };
  28875. return EvaluatorPreprocessor;
  28876. }();
  28877. var QueueOptimizer = function QueueOptimizerClosure() {
  28878. function addState(parentState, pattern, fn) {
  28879. var state = parentState;
  28880. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28881. var item = pattern[i];
  28882. state = state[item] || (state[item] = []);
  28883. }
  28884. state[pattern[pattern.length - 1]] = fn;
  28885. }
  28886. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28887. var iFirstPIMXO = iFirstSave + 2;
  28888. for (var i = 0; i < count; i++) {
  28889. var arg = argsArray[iFirstPIMXO + 4 * i];
  28890. var imageMask = arg.length === 1 && arg[0];
  28891. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28892. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28893. continue;
  28894. }
  28895. break;
  28896. }
  28897. return count - i;
  28898. }
  28899. var InitialState = [];
  28900. addState(InitialState, [
  28901. OPS.save,
  28902. OPS.transform,
  28903. OPS.paintInlineImageXObject,
  28904. OPS.restore
  28905. ], function foundInlineImageGroup(context) {
  28906. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28907. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28908. var MAX_WIDTH = 1000;
  28909. var IMAGE_PADDING = 1;
  28910. var fnArray = context.fnArray, argsArray = context.argsArray;
  28911. var curr = context.iCurr;
  28912. var iFirstSave = curr - 3;
  28913. var iFirstTransform = curr - 2;
  28914. var iFirstPIIXO = curr - 1;
  28915. var i = iFirstSave + 4;
  28916. var ii = fnArray.length;
  28917. while (i + 3 < ii) {
  28918. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28919. break;
  28920. }
  28921. i += 4;
  28922. }
  28923. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28924. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28925. return i;
  28926. }
  28927. var maxX = 0;
  28928. var map = [], maxLineHeight = 0;
  28929. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28930. var q;
  28931. for (q = 0; q < count; q++) {
  28932. var transform = argsArray[iFirstTransform + (q << 2)];
  28933. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28934. if (currentX + img.width > MAX_WIDTH) {
  28935. maxX = Math.max(maxX, currentX);
  28936. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28937. currentX = 0;
  28938. maxLineHeight = 0;
  28939. }
  28940. map.push({
  28941. transform: transform,
  28942. x: currentX,
  28943. y: currentY,
  28944. w: img.width,
  28945. h: img.height
  28946. });
  28947. currentX += img.width + 2 * IMAGE_PADDING;
  28948. maxLineHeight = Math.max(maxLineHeight, img.height);
  28949. }
  28950. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28951. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28952. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28953. var imgRowSize = imgWidth << 2;
  28954. for (q = 0; q < count; q++) {
  28955. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28956. var rowSize = map[q].w << 2;
  28957. var dataOffset = 0;
  28958. var offset = map[q].x + map[q].y * imgWidth << 2;
  28959. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28960. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28961. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28962. dataOffset += rowSize;
  28963. offset += imgRowSize;
  28964. }
  28965. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28966. while (offset >= 0) {
  28967. data[offset - 4] = data[offset];
  28968. data[offset - 3] = data[offset + 1];
  28969. data[offset - 2] = data[offset + 2];
  28970. data[offset - 1] = data[offset + 3];
  28971. data[offset + rowSize] = data[offset + rowSize - 4];
  28972. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28973. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28974. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28975. offset -= imgRowSize;
  28976. }
  28977. }
  28978. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28979. argsArray.splice(iFirstSave, count * 4, [
  28980. {
  28981. width: imgWidth,
  28982. height: imgHeight,
  28983. kind: ImageKind.RGBA_32BPP,
  28984. data: imgData
  28985. },
  28986. map
  28987. ]);
  28988. return iFirstSave + 1;
  28989. });
  28990. addState(InitialState, [
  28991. OPS.save,
  28992. OPS.transform,
  28993. OPS.paintImageMaskXObject,
  28994. OPS.restore
  28995. ], function foundImageMaskGroup(context) {
  28996. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28997. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28998. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28999. var fnArray = context.fnArray, argsArray = context.argsArray;
  29000. var curr = context.iCurr;
  29001. var iFirstSave = curr - 3;
  29002. var iFirstTransform = curr - 2;
  29003. var iFirstPIMXO = curr - 1;
  29004. var i = iFirstSave + 4;
  29005. var ii = fnArray.length;
  29006. while (i + 3 < ii) {
  29007. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  29008. break;
  29009. }
  29010. i += 4;
  29011. }
  29012. var count = (i - iFirstSave) / 4;
  29013. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  29014. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  29015. return i;
  29016. }
  29017. var q;
  29018. var isSameImage = false;
  29019. var iTransform, transformArgs;
  29020. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  29021. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  29022. isSameImage = true;
  29023. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29024. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29025. iTransform = iFirstTransform + 4;
  29026. var iPIMXO = iFirstPIMXO + 4;
  29027. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  29028. transformArgs = argsArray[iTransform];
  29029. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  29030. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  29031. isSameImage = false;
  29032. } else {
  29033. count = q;
  29034. }
  29035. break;
  29036. }
  29037. }
  29038. }
  29039. if (isSameImage) {
  29040. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  29041. var positions = new Float32Array(count * 2);
  29042. iTransform = iFirstTransform;
  29043. for (q = 0; q < count; q++, iTransform += 4) {
  29044. transformArgs = argsArray[iTransform];
  29045. positions[q << 1] = transformArgs[4];
  29046. positions[(q << 1) + 1] = transformArgs[5];
  29047. }
  29048. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  29049. argsArray.splice(iFirstSave, count * 4, [
  29050. firstPIMXOArg0,
  29051. firstTransformArg0,
  29052. firstTransformArg3,
  29053. positions
  29054. ]);
  29055. } else {
  29056. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  29057. var images = [];
  29058. for (q = 0; q < count; q++) {
  29059. transformArgs = argsArray[iFirstTransform + (q << 2)];
  29060. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  29061. images.push({
  29062. data: maskParams.data,
  29063. width: maskParams.width,
  29064. height: maskParams.height,
  29065. transform: transformArgs
  29066. });
  29067. }
  29068. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  29069. argsArray.splice(iFirstSave, count * 4, [images]);
  29070. }
  29071. return iFirstSave + 1;
  29072. });
  29073. addState(InitialState, [
  29074. OPS.save,
  29075. OPS.transform,
  29076. OPS.paintImageXObject,
  29077. OPS.restore
  29078. ], function (context) {
  29079. var MIN_IMAGES_IN_BLOCK = 3;
  29080. var MAX_IMAGES_IN_BLOCK = 1000;
  29081. var fnArray = context.fnArray, argsArray = context.argsArray;
  29082. var curr = context.iCurr;
  29083. var iFirstSave = curr - 3;
  29084. var iFirstTransform = curr - 2;
  29085. var iFirstPIXO = curr - 1;
  29086. var iFirstRestore = curr;
  29087. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  29088. return iFirstRestore + 1;
  29089. }
  29090. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  29091. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29092. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29093. var i = iFirstSave + 4;
  29094. var ii = fnArray.length;
  29095. while (i + 3 < ii) {
  29096. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  29097. break;
  29098. }
  29099. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  29100. break;
  29101. }
  29102. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  29103. break;
  29104. }
  29105. i += 4;
  29106. }
  29107. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  29108. if (count < MIN_IMAGES_IN_BLOCK) {
  29109. return i;
  29110. }
  29111. var positions = new Float32Array(count * 2);
  29112. var iTransform = iFirstTransform;
  29113. for (var q = 0; q < count; q++, iTransform += 4) {
  29114. var transformArgs = argsArray[iTransform];
  29115. positions[q << 1] = transformArgs[4];
  29116. positions[(q << 1) + 1] = transformArgs[5];
  29117. }
  29118. var args = [
  29119. firstPIXOArg0,
  29120. firstTransformArg0,
  29121. firstTransformArg3,
  29122. positions
  29123. ];
  29124. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  29125. argsArray.splice(iFirstSave, count * 4, args);
  29126. return iFirstSave + 1;
  29127. });
  29128. addState(InitialState, [
  29129. OPS.beginText,
  29130. OPS.setFont,
  29131. OPS.setTextMatrix,
  29132. OPS.showText,
  29133. OPS.endText
  29134. ], function (context) {
  29135. var MIN_CHARS_IN_BLOCK = 3;
  29136. var MAX_CHARS_IN_BLOCK = 1000;
  29137. var fnArray = context.fnArray, argsArray = context.argsArray;
  29138. var curr = context.iCurr;
  29139. var iFirstBeginText = curr - 4;
  29140. var iFirstSetFont = curr - 3;
  29141. var iFirstSetTextMatrix = curr - 2;
  29142. var iFirstShowText = curr - 1;
  29143. var iFirstEndText = curr;
  29144. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  29145. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  29146. var i = iFirstBeginText + 5;
  29147. var ii = fnArray.length;
  29148. while (i + 4 < ii) {
  29149. 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) {
  29150. break;
  29151. }
  29152. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  29153. break;
  29154. }
  29155. i += 5;
  29156. }
  29157. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  29158. if (count < MIN_CHARS_IN_BLOCK) {
  29159. return i;
  29160. }
  29161. var iFirst = iFirstBeginText;
  29162. 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) {
  29163. count++;
  29164. iFirst -= 5;
  29165. }
  29166. var iEndText = iFirst + 4;
  29167. for (var q = 1; q < count; q++) {
  29168. fnArray.splice(iEndText, 3);
  29169. argsArray.splice(iEndText, 3);
  29170. iEndText += 2;
  29171. }
  29172. return iEndText + 1;
  29173. });
  29174. function QueueOptimizer() {
  29175. }
  29176. QueueOptimizer.prototype = {
  29177. optimize: function QueueOptimizer_optimize(queue) {
  29178. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  29179. var context = {
  29180. iCurr: 0,
  29181. fnArray: fnArray,
  29182. argsArray: argsArray
  29183. };
  29184. var state;
  29185. var i = 0, ii = fnArray.length;
  29186. while (i < ii) {
  29187. state = (state || InitialState)[fnArray[i]];
  29188. if (typeof state === 'function') {
  29189. context.iCurr = i;
  29190. i = state(context);
  29191. state = undefined;
  29192. ii = context.fnArray.length;
  29193. } else {
  29194. i++;
  29195. }
  29196. }
  29197. }
  29198. };
  29199. return QueueOptimizer;
  29200. }();
  29201. exports.OperatorList = OperatorList;
  29202. exports.PartialEvaluator = PartialEvaluator;
  29203. /***/ }),
  29204. /* 14 */
  29205. /***/ (function(module, exports, __w_pdfjs_require__) {
  29206. "use strict";
  29207. var sharedUtil = __w_pdfjs_require__(0);
  29208. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  29209. var info = sharedUtil.info;
  29210. var warn = sharedUtil.warn;
  29211. var error = sharedUtil.error;
  29212. var log2 = sharedUtil.log2;
  29213. var readUint16 = sharedUtil.readUint16;
  29214. var readUint32 = sharedUtil.readUint32;
  29215. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  29216. var JpxImage = function JpxImageClosure() {
  29217. var SubbandsGainLog2 = {
  29218. 'LL': 0,
  29219. 'LH': 1,
  29220. 'HL': 1,
  29221. 'HH': 2
  29222. };
  29223. function JpxImage() {
  29224. this.failOnCorruptedImage = false;
  29225. }
  29226. JpxImage.prototype = {
  29227. parse: function JpxImage_parse(data) {
  29228. var head = readUint16(data, 0);
  29229. if (head === 0xFF4F) {
  29230. this.parseCodestream(data, 0, data.length);
  29231. return;
  29232. }
  29233. var position = 0, length = data.length;
  29234. while (position < length) {
  29235. var headerSize = 8;
  29236. var lbox = readUint32(data, position);
  29237. var tbox = readUint32(data, position + 4);
  29238. position += headerSize;
  29239. if (lbox === 1) {
  29240. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  29241. position += 8;
  29242. headerSize += 8;
  29243. }
  29244. if (lbox === 0) {
  29245. lbox = length - position + headerSize;
  29246. }
  29247. if (lbox < headerSize) {
  29248. error('JPX Error: Invalid box field size');
  29249. }
  29250. var dataLength = lbox - headerSize;
  29251. var jumpDataLength = true;
  29252. switch (tbox) {
  29253. case 0x6A703268:
  29254. jumpDataLength = false;
  29255. break;
  29256. case 0x636F6C72:
  29257. var method = data[position];
  29258. if (method === 1) {
  29259. var colorspace = readUint32(data, position + 3);
  29260. switch (colorspace) {
  29261. case 16:
  29262. case 17:
  29263. case 18:
  29264. break;
  29265. default:
  29266. warn('Unknown colorspace ' + colorspace);
  29267. break;
  29268. }
  29269. } else if (method === 2) {
  29270. info('ICC profile not supported');
  29271. }
  29272. break;
  29273. case 0x6A703263:
  29274. this.parseCodestream(data, position, position + dataLength);
  29275. break;
  29276. case 0x6A502020:
  29277. if (0x0d0a870a !== readUint32(data, position)) {
  29278. warn('Invalid JP2 signature');
  29279. }
  29280. break;
  29281. case 0x6A501A1A:
  29282. case 0x66747970:
  29283. case 0x72726571:
  29284. case 0x72657320:
  29285. case 0x69686472:
  29286. break;
  29287. default:
  29288. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  29289. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  29290. break;
  29291. }
  29292. if (jumpDataLength) {
  29293. position += dataLength;
  29294. }
  29295. }
  29296. },
  29297. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  29298. var newByte = stream.getByte();
  29299. while (newByte >= 0) {
  29300. var oldByte = newByte;
  29301. newByte = stream.getByte();
  29302. var code = oldByte << 8 | newByte;
  29303. if (code === 0xFF51) {
  29304. stream.skip(4);
  29305. var Xsiz = stream.getInt32() >>> 0;
  29306. var Ysiz = stream.getInt32() >>> 0;
  29307. var XOsiz = stream.getInt32() >>> 0;
  29308. var YOsiz = stream.getInt32() >>> 0;
  29309. stream.skip(16);
  29310. var Csiz = stream.getUint16();
  29311. this.width = Xsiz - XOsiz;
  29312. this.height = Ysiz - YOsiz;
  29313. this.componentsCount = Csiz;
  29314. this.bitsPerComponent = 8;
  29315. return;
  29316. }
  29317. }
  29318. error('JPX Error: No size marker found in JPX stream');
  29319. },
  29320. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  29321. var context = {};
  29322. var doNotRecover = false;
  29323. try {
  29324. var position = start;
  29325. while (position + 1 < end) {
  29326. var code = readUint16(data, position);
  29327. position += 2;
  29328. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  29329. switch (code) {
  29330. case 0xFF4F:
  29331. context.mainHeader = true;
  29332. break;
  29333. case 0xFFD9:
  29334. break;
  29335. case 0xFF51:
  29336. length = readUint16(data, position);
  29337. var siz = {};
  29338. siz.Xsiz = readUint32(data, position + 4);
  29339. siz.Ysiz = readUint32(data, position + 8);
  29340. siz.XOsiz = readUint32(data, position + 12);
  29341. siz.YOsiz = readUint32(data, position + 16);
  29342. siz.XTsiz = readUint32(data, position + 20);
  29343. siz.YTsiz = readUint32(data, position + 24);
  29344. siz.XTOsiz = readUint32(data, position + 28);
  29345. siz.YTOsiz = readUint32(data, position + 32);
  29346. var componentsCount = readUint16(data, position + 36);
  29347. siz.Csiz = componentsCount;
  29348. var components = [];
  29349. j = position + 38;
  29350. for (var i = 0; i < componentsCount; i++) {
  29351. var component = {
  29352. precision: (data[j] & 0x7F) + 1,
  29353. isSigned: !!(data[j] & 0x80),
  29354. XRsiz: data[j + 1],
  29355. YRsiz: data[j + 1]
  29356. };
  29357. calculateComponentDimensions(component, siz);
  29358. components.push(component);
  29359. }
  29360. context.SIZ = siz;
  29361. context.components = components;
  29362. calculateTileGrids(context, components);
  29363. context.QCC = [];
  29364. context.COC = [];
  29365. break;
  29366. case 0xFF5C:
  29367. length = readUint16(data, position);
  29368. var qcd = {};
  29369. j = position + 2;
  29370. sqcd = data[j++];
  29371. switch (sqcd & 0x1F) {
  29372. case 0:
  29373. spqcdSize = 8;
  29374. scalarExpounded = true;
  29375. break;
  29376. case 1:
  29377. spqcdSize = 16;
  29378. scalarExpounded = false;
  29379. break;
  29380. case 2:
  29381. spqcdSize = 16;
  29382. scalarExpounded = true;
  29383. break;
  29384. default:
  29385. throw new Error('Invalid SQcd value ' + sqcd);
  29386. }
  29387. qcd.noQuantization = spqcdSize === 8;
  29388. qcd.scalarExpounded = scalarExpounded;
  29389. qcd.guardBits = sqcd >> 5;
  29390. spqcds = [];
  29391. while (j < length + position) {
  29392. var spqcd = {};
  29393. if (spqcdSize === 8) {
  29394. spqcd.epsilon = data[j++] >> 3;
  29395. spqcd.mu = 0;
  29396. } else {
  29397. spqcd.epsilon = data[j] >> 3;
  29398. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29399. j += 2;
  29400. }
  29401. spqcds.push(spqcd);
  29402. }
  29403. qcd.SPqcds = spqcds;
  29404. if (context.mainHeader) {
  29405. context.QCD = qcd;
  29406. } else {
  29407. context.currentTile.QCD = qcd;
  29408. context.currentTile.QCC = [];
  29409. }
  29410. break;
  29411. case 0xFF5D:
  29412. length = readUint16(data, position);
  29413. var qcc = {};
  29414. j = position + 2;
  29415. var cqcc;
  29416. if (context.SIZ.Csiz < 257) {
  29417. cqcc = data[j++];
  29418. } else {
  29419. cqcc = readUint16(data, j);
  29420. j += 2;
  29421. }
  29422. sqcd = data[j++];
  29423. switch (sqcd & 0x1F) {
  29424. case 0:
  29425. spqcdSize = 8;
  29426. scalarExpounded = true;
  29427. break;
  29428. case 1:
  29429. spqcdSize = 16;
  29430. scalarExpounded = false;
  29431. break;
  29432. case 2:
  29433. spqcdSize = 16;
  29434. scalarExpounded = true;
  29435. break;
  29436. default:
  29437. throw new Error('Invalid SQcd value ' + sqcd);
  29438. }
  29439. qcc.noQuantization = spqcdSize === 8;
  29440. qcc.scalarExpounded = scalarExpounded;
  29441. qcc.guardBits = sqcd >> 5;
  29442. spqcds = [];
  29443. while (j < length + position) {
  29444. spqcd = {};
  29445. if (spqcdSize === 8) {
  29446. spqcd.epsilon = data[j++] >> 3;
  29447. spqcd.mu = 0;
  29448. } else {
  29449. spqcd.epsilon = data[j] >> 3;
  29450. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29451. j += 2;
  29452. }
  29453. spqcds.push(spqcd);
  29454. }
  29455. qcc.SPqcds = spqcds;
  29456. if (context.mainHeader) {
  29457. context.QCC[cqcc] = qcc;
  29458. } else {
  29459. context.currentTile.QCC[cqcc] = qcc;
  29460. }
  29461. break;
  29462. case 0xFF52:
  29463. length = readUint16(data, position);
  29464. var cod = {};
  29465. j = position + 2;
  29466. var scod = data[j++];
  29467. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  29468. cod.sopMarkerUsed = !!(scod & 2);
  29469. cod.ephMarkerUsed = !!(scod & 4);
  29470. cod.progressionOrder = data[j++];
  29471. cod.layersCount = readUint16(data, j);
  29472. j += 2;
  29473. cod.multipleComponentTransform = data[j++];
  29474. cod.decompositionLevelsCount = data[j++];
  29475. cod.xcb = (data[j++] & 0xF) + 2;
  29476. cod.ycb = (data[j++] & 0xF) + 2;
  29477. var blockStyle = data[j++];
  29478. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  29479. cod.resetContextProbabilities = !!(blockStyle & 2);
  29480. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  29481. cod.verticalyStripe = !!(blockStyle & 8);
  29482. cod.predictableTermination = !!(blockStyle & 16);
  29483. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  29484. cod.reversibleTransformation = data[j++];
  29485. if (cod.entropyCoderWithCustomPrecincts) {
  29486. var precinctsSizes = [];
  29487. while (j < length + position) {
  29488. var precinctsSize = data[j++];
  29489. precinctsSizes.push({
  29490. PPx: precinctsSize & 0xF,
  29491. PPy: precinctsSize >> 4
  29492. });
  29493. }
  29494. cod.precinctsSizes = precinctsSizes;
  29495. }
  29496. var unsupported = [];
  29497. if (cod.selectiveArithmeticCodingBypass) {
  29498. unsupported.push('selectiveArithmeticCodingBypass');
  29499. }
  29500. if (cod.resetContextProbabilities) {
  29501. unsupported.push('resetContextProbabilities');
  29502. }
  29503. if (cod.terminationOnEachCodingPass) {
  29504. unsupported.push('terminationOnEachCodingPass');
  29505. }
  29506. if (cod.verticalyStripe) {
  29507. unsupported.push('verticalyStripe');
  29508. }
  29509. if (cod.predictableTermination) {
  29510. unsupported.push('predictableTermination');
  29511. }
  29512. if (unsupported.length > 0) {
  29513. doNotRecover = true;
  29514. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  29515. }
  29516. if (context.mainHeader) {
  29517. context.COD = cod;
  29518. } else {
  29519. context.currentTile.COD = cod;
  29520. context.currentTile.COC = [];
  29521. }
  29522. break;
  29523. case 0xFF90:
  29524. length = readUint16(data, position);
  29525. tile = {};
  29526. tile.index = readUint16(data, position + 2);
  29527. tile.length = readUint32(data, position + 4);
  29528. tile.dataEnd = tile.length + position - 2;
  29529. tile.partIndex = data[position + 8];
  29530. tile.partsCount = data[position + 9];
  29531. context.mainHeader = false;
  29532. if (tile.partIndex === 0) {
  29533. tile.COD = context.COD;
  29534. tile.COC = context.COC.slice(0);
  29535. tile.QCD = context.QCD;
  29536. tile.QCC = context.QCC.slice(0);
  29537. }
  29538. context.currentTile = tile;
  29539. break;
  29540. case 0xFF93:
  29541. tile = context.currentTile;
  29542. if (tile.partIndex === 0) {
  29543. initializeTile(context, tile.index);
  29544. buildPackets(context);
  29545. }
  29546. length = tile.dataEnd - position;
  29547. parseTilePackets(context, data, position, length);
  29548. break;
  29549. case 0xFF55:
  29550. case 0xFF57:
  29551. case 0xFF58:
  29552. case 0xFF64:
  29553. length = readUint16(data, position);
  29554. break;
  29555. case 0xFF53:
  29556. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  29557. default:
  29558. throw new Error('Unknown codestream code: ' + code.toString(16));
  29559. }
  29560. position += length;
  29561. }
  29562. } catch (e) {
  29563. if (doNotRecover || this.failOnCorruptedImage) {
  29564. error('JPX Error: ' + e.message);
  29565. } else {
  29566. warn('JPX: Trying to recover from: ' + e.message);
  29567. }
  29568. }
  29569. this.tiles = transformComponents(context);
  29570. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  29571. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  29572. this.componentsCount = context.SIZ.Csiz;
  29573. }
  29574. };
  29575. function calculateComponentDimensions(component, siz) {
  29576. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  29577. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  29578. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  29579. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  29580. component.width = component.x1 - component.x0;
  29581. component.height = component.y1 - component.y0;
  29582. }
  29583. function calculateTileGrids(context, components) {
  29584. var siz = context.SIZ;
  29585. var tile, tiles = [];
  29586. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  29587. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  29588. for (var q = 0; q < numYtiles; q++) {
  29589. for (var p = 0; p < numXtiles; p++) {
  29590. tile = {};
  29591. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  29592. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  29593. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  29594. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  29595. tile.width = tile.tx1 - tile.tx0;
  29596. tile.height = tile.ty1 - tile.ty0;
  29597. tile.components = [];
  29598. tiles.push(tile);
  29599. }
  29600. }
  29601. context.tiles = tiles;
  29602. var componentsCount = siz.Csiz;
  29603. for (var i = 0, ii = componentsCount; i < ii; i++) {
  29604. var component = components[i];
  29605. for (var j = 0, jj = tiles.length; j < jj; j++) {
  29606. var tileComponent = {};
  29607. tile = tiles[j];
  29608. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  29609. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  29610. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  29611. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  29612. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  29613. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  29614. tile.components[i] = tileComponent;
  29615. }
  29616. }
  29617. }
  29618. function getBlocksDimensions(context, component, r) {
  29619. var codOrCoc = component.codingStyleParameters;
  29620. var result = {};
  29621. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  29622. result.PPx = 15;
  29623. result.PPy = 15;
  29624. } else {
  29625. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  29626. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  29627. }
  29628. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  29629. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  29630. return result;
  29631. }
  29632. function buildPrecincts(context, resolution, dimensions) {
  29633. var precinctWidth = 1 << dimensions.PPx;
  29634. var precinctHeight = 1 << dimensions.PPy;
  29635. var isZeroRes = resolution.resLevel === 0;
  29636. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  29637. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  29638. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  29639. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  29640. var numprecincts = numprecinctswide * numprecinctshigh;
  29641. resolution.precinctParameters = {
  29642. precinctWidth: precinctWidth,
  29643. precinctHeight: precinctHeight,
  29644. numprecinctswide: numprecinctswide,
  29645. numprecinctshigh: numprecinctshigh,
  29646. numprecincts: numprecincts,
  29647. precinctWidthInSubband: precinctWidthInSubband,
  29648. precinctHeightInSubband: precinctHeightInSubband
  29649. };
  29650. }
  29651. function buildCodeblocks(context, subband, dimensions) {
  29652. var xcb_ = dimensions.xcb_;
  29653. var ycb_ = dimensions.ycb_;
  29654. var codeblockWidth = 1 << xcb_;
  29655. var codeblockHeight = 1 << ycb_;
  29656. var cbx0 = subband.tbx0 >> xcb_;
  29657. var cby0 = subband.tby0 >> ycb_;
  29658. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  29659. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  29660. var precinctParameters = subband.resolution.precinctParameters;
  29661. var codeblocks = [];
  29662. var precincts = [];
  29663. var i, j, codeblock, precinctNumber;
  29664. for (j = cby0; j < cby1; j++) {
  29665. for (i = cbx0; i < cbx1; i++) {
  29666. codeblock = {
  29667. cbx: i,
  29668. cby: j,
  29669. tbx0: codeblockWidth * i,
  29670. tby0: codeblockHeight * j,
  29671. tbx1: codeblockWidth * (i + 1),
  29672. tby1: codeblockHeight * (j + 1)
  29673. };
  29674. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  29675. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  29676. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  29677. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  29678. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  29679. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  29680. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  29681. codeblock.precinctNumber = precinctNumber;
  29682. codeblock.subbandType = subband.type;
  29683. codeblock.Lblock = 3;
  29684. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  29685. continue;
  29686. }
  29687. codeblocks.push(codeblock);
  29688. var precinct = precincts[precinctNumber];
  29689. if (precinct !== undefined) {
  29690. if (i < precinct.cbxMin) {
  29691. precinct.cbxMin = i;
  29692. } else if (i > precinct.cbxMax) {
  29693. precinct.cbxMax = i;
  29694. }
  29695. if (j < precinct.cbyMin) {
  29696. precinct.cbxMin = j;
  29697. } else if (j > precinct.cbyMax) {
  29698. precinct.cbyMax = j;
  29699. }
  29700. } else {
  29701. precincts[precinctNumber] = precinct = {
  29702. cbxMin: i,
  29703. cbyMin: j,
  29704. cbxMax: i,
  29705. cbyMax: j
  29706. };
  29707. }
  29708. codeblock.precinct = precinct;
  29709. }
  29710. }
  29711. subband.codeblockParameters = {
  29712. codeblockWidth: xcb_,
  29713. codeblockHeight: ycb_,
  29714. numcodeblockwide: cbx1 - cbx0 + 1,
  29715. numcodeblockhigh: cby1 - cby0 + 1
  29716. };
  29717. subband.codeblocks = codeblocks;
  29718. subband.precincts = precincts;
  29719. }
  29720. function createPacket(resolution, precinctNumber, layerNumber) {
  29721. var precinctCodeblocks = [];
  29722. var subbands = resolution.subbands;
  29723. for (var i = 0, ii = subbands.length; i < ii; i++) {
  29724. var subband = subbands[i];
  29725. var codeblocks = subband.codeblocks;
  29726. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  29727. var codeblock = codeblocks[j];
  29728. if (codeblock.precinctNumber !== precinctNumber) {
  29729. continue;
  29730. }
  29731. precinctCodeblocks.push(codeblock);
  29732. }
  29733. }
  29734. return {
  29735. layerNumber: layerNumber,
  29736. codeblocks: precinctCodeblocks
  29737. };
  29738. }
  29739. function LayerResolutionComponentPositionIterator(context) {
  29740. var siz = context.SIZ;
  29741. var tileIndex = context.currentTile.index;
  29742. var tile = context.tiles[tileIndex];
  29743. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29744. var componentsCount = siz.Csiz;
  29745. var maxDecompositionLevelsCount = 0;
  29746. for (var q = 0; q < componentsCount; q++) {
  29747. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29748. }
  29749. var l = 0, r = 0, i = 0, k = 0;
  29750. this.nextPacket = function JpxImage_nextPacket() {
  29751. for (; l < layersCount; l++) {
  29752. for (; r <= maxDecompositionLevelsCount; r++) {
  29753. for (; i < componentsCount; i++) {
  29754. var component = tile.components[i];
  29755. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29756. continue;
  29757. }
  29758. var resolution = component.resolutions[r];
  29759. var numprecincts = resolution.precinctParameters.numprecincts;
  29760. for (; k < numprecincts;) {
  29761. var packet = createPacket(resolution, k, l);
  29762. k++;
  29763. return packet;
  29764. }
  29765. k = 0;
  29766. }
  29767. i = 0;
  29768. }
  29769. r = 0;
  29770. }
  29771. error('JPX Error: Out of packets');
  29772. };
  29773. }
  29774. function ResolutionLayerComponentPositionIterator(context) {
  29775. var siz = context.SIZ;
  29776. var tileIndex = context.currentTile.index;
  29777. var tile = context.tiles[tileIndex];
  29778. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29779. var componentsCount = siz.Csiz;
  29780. var maxDecompositionLevelsCount = 0;
  29781. for (var q = 0; q < componentsCount; q++) {
  29782. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29783. }
  29784. var r = 0, l = 0, i = 0, k = 0;
  29785. this.nextPacket = function JpxImage_nextPacket() {
  29786. for (; r <= maxDecompositionLevelsCount; r++) {
  29787. for (; l < layersCount; l++) {
  29788. for (; i < componentsCount; i++) {
  29789. var component = tile.components[i];
  29790. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29791. continue;
  29792. }
  29793. var resolution = component.resolutions[r];
  29794. var numprecincts = resolution.precinctParameters.numprecincts;
  29795. for (; k < numprecincts;) {
  29796. var packet = createPacket(resolution, k, l);
  29797. k++;
  29798. return packet;
  29799. }
  29800. k = 0;
  29801. }
  29802. i = 0;
  29803. }
  29804. l = 0;
  29805. }
  29806. error('JPX Error: Out of packets');
  29807. };
  29808. }
  29809. function ResolutionPositionComponentLayerIterator(context) {
  29810. var siz = context.SIZ;
  29811. var tileIndex = context.currentTile.index;
  29812. var tile = context.tiles[tileIndex];
  29813. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29814. var componentsCount = siz.Csiz;
  29815. var l, r, c, p;
  29816. var maxDecompositionLevelsCount = 0;
  29817. for (c = 0; c < componentsCount; c++) {
  29818. var component = tile.components[c];
  29819. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29820. }
  29821. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29822. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29823. var maxNumPrecincts = 0;
  29824. for (c = 0; c < componentsCount; ++c) {
  29825. var resolutions = tile.components[c].resolutions;
  29826. if (r < resolutions.length) {
  29827. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29828. }
  29829. }
  29830. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29831. }
  29832. l = 0;
  29833. r = 0;
  29834. c = 0;
  29835. p = 0;
  29836. this.nextPacket = function JpxImage_nextPacket() {
  29837. for (; r <= maxDecompositionLevelsCount; r++) {
  29838. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29839. for (; c < componentsCount; c++) {
  29840. var component = tile.components[c];
  29841. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29842. continue;
  29843. }
  29844. var resolution = component.resolutions[r];
  29845. var numprecincts = resolution.precinctParameters.numprecincts;
  29846. if (p >= numprecincts) {
  29847. continue;
  29848. }
  29849. for (; l < layersCount;) {
  29850. var packet = createPacket(resolution, p, l);
  29851. l++;
  29852. return packet;
  29853. }
  29854. l = 0;
  29855. }
  29856. c = 0;
  29857. }
  29858. p = 0;
  29859. }
  29860. error('JPX Error: Out of packets');
  29861. };
  29862. }
  29863. function PositionComponentResolutionLayerIterator(context) {
  29864. var siz = context.SIZ;
  29865. var tileIndex = context.currentTile.index;
  29866. var tile = context.tiles[tileIndex];
  29867. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29868. var componentsCount = siz.Csiz;
  29869. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29870. var precinctsIterationSizes = precinctsSizes;
  29871. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29872. this.nextPacket = function JpxImage_nextPacket() {
  29873. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29874. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29875. for (; c < componentsCount; c++) {
  29876. var component = tile.components[c];
  29877. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29878. for (; r <= decompositionLevelsCount; r++) {
  29879. var resolution = component.resolutions[r];
  29880. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29881. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29882. if (k === null) {
  29883. continue;
  29884. }
  29885. for (; l < layersCount;) {
  29886. var packet = createPacket(resolution, k, l);
  29887. l++;
  29888. return packet;
  29889. }
  29890. l = 0;
  29891. }
  29892. r = 0;
  29893. }
  29894. c = 0;
  29895. }
  29896. px = 0;
  29897. }
  29898. error('JPX Error: Out of packets');
  29899. };
  29900. }
  29901. function ComponentPositionResolutionLayerIterator(context) {
  29902. var siz = context.SIZ;
  29903. var tileIndex = context.currentTile.index;
  29904. var tile = context.tiles[tileIndex];
  29905. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29906. var componentsCount = siz.Csiz;
  29907. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29908. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29909. this.nextPacket = function JpxImage_nextPacket() {
  29910. for (; c < componentsCount; ++c) {
  29911. var component = tile.components[c];
  29912. var precinctsIterationSizes = precinctsSizes.components[c];
  29913. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29914. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29915. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29916. for (; r <= decompositionLevelsCount; r++) {
  29917. var resolution = component.resolutions[r];
  29918. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29919. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29920. if (k === null) {
  29921. continue;
  29922. }
  29923. for (; l < layersCount;) {
  29924. var packet = createPacket(resolution, k, l);
  29925. l++;
  29926. return packet;
  29927. }
  29928. l = 0;
  29929. }
  29930. r = 0;
  29931. }
  29932. px = 0;
  29933. }
  29934. py = 0;
  29935. }
  29936. error('JPX Error: Out of packets');
  29937. };
  29938. }
  29939. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29940. var posX = pxIndex * precinctIterationSizes.minWidth;
  29941. var posY = pyIndex * precinctIterationSizes.minHeight;
  29942. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29943. return null;
  29944. }
  29945. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29946. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29947. }
  29948. function getPrecinctSizesInImageScale(tile) {
  29949. var componentsCount = tile.components.length;
  29950. var minWidth = Number.MAX_VALUE;
  29951. var minHeight = Number.MAX_VALUE;
  29952. var maxNumWide = 0;
  29953. var maxNumHigh = 0;
  29954. var sizePerComponent = new Array(componentsCount);
  29955. for (var c = 0; c < componentsCount; c++) {
  29956. var component = tile.components[c];
  29957. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29958. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29959. var minWidthCurrentComponent = Number.MAX_VALUE;
  29960. var minHeightCurrentComponent = Number.MAX_VALUE;
  29961. var maxNumWideCurrentComponent = 0;
  29962. var maxNumHighCurrentComponent = 0;
  29963. var scale = 1;
  29964. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29965. var resolution = component.resolutions[r];
  29966. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29967. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29968. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29969. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29970. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29971. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29972. sizePerResolution[r] = {
  29973. width: widthCurrentResolution,
  29974. height: heightCurrentResolution
  29975. };
  29976. scale <<= 1;
  29977. }
  29978. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29979. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29980. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29981. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29982. sizePerComponent[c] = {
  29983. resolutions: sizePerResolution,
  29984. minWidth: minWidthCurrentComponent,
  29985. minHeight: minHeightCurrentComponent,
  29986. maxNumWide: maxNumWideCurrentComponent,
  29987. maxNumHigh: maxNumHighCurrentComponent
  29988. };
  29989. }
  29990. return {
  29991. components: sizePerComponent,
  29992. minWidth: minWidth,
  29993. minHeight: minHeight,
  29994. maxNumWide: maxNumWide,
  29995. maxNumHigh: maxNumHigh
  29996. };
  29997. }
  29998. function buildPackets(context) {
  29999. var siz = context.SIZ;
  30000. var tileIndex = context.currentTile.index;
  30001. var tile = context.tiles[tileIndex];
  30002. var componentsCount = siz.Csiz;
  30003. for (var c = 0; c < componentsCount; c++) {
  30004. var component = tile.components[c];
  30005. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30006. var resolutions = [];
  30007. var subbands = [];
  30008. for (var r = 0; r <= decompositionLevelsCount; r++) {
  30009. var blocksDimensions = getBlocksDimensions(context, component, r);
  30010. var resolution = {};
  30011. var scale = 1 << decompositionLevelsCount - r;
  30012. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30013. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30014. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30015. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30016. resolution.resLevel = r;
  30017. buildPrecincts(context, resolution, blocksDimensions);
  30018. resolutions.push(resolution);
  30019. var subband;
  30020. if (r === 0) {
  30021. subband = {};
  30022. subband.type = 'LL';
  30023. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30024. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30025. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30026. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30027. subband.resolution = resolution;
  30028. buildCodeblocks(context, subband, blocksDimensions);
  30029. subbands.push(subband);
  30030. resolution.subbands = [subband];
  30031. } else {
  30032. var bscale = 1 << decompositionLevelsCount - r + 1;
  30033. var resolutionSubbands = [];
  30034. subband = {};
  30035. subband.type = 'HL';
  30036. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30037. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30038. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30039. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30040. subband.resolution = resolution;
  30041. buildCodeblocks(context, subband, blocksDimensions);
  30042. subbands.push(subband);
  30043. resolutionSubbands.push(subband);
  30044. subband = {};
  30045. subband.type = 'LH';
  30046. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30047. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30048. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30049. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30050. subband.resolution = resolution;
  30051. buildCodeblocks(context, subband, blocksDimensions);
  30052. subbands.push(subband);
  30053. resolutionSubbands.push(subband);
  30054. subband = {};
  30055. subband.type = 'HH';
  30056. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30057. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30058. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30059. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30060. subband.resolution = resolution;
  30061. buildCodeblocks(context, subband, blocksDimensions);
  30062. subbands.push(subband);
  30063. resolutionSubbands.push(subband);
  30064. resolution.subbands = resolutionSubbands;
  30065. }
  30066. }
  30067. component.resolutions = resolutions;
  30068. component.subbands = subbands;
  30069. }
  30070. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30071. switch (progressionOrder) {
  30072. case 0:
  30073. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30074. break;
  30075. case 1:
  30076. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30077. break;
  30078. case 2:
  30079. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30080. break;
  30081. case 3:
  30082. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30083. break;
  30084. case 4:
  30085. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30086. break;
  30087. default:
  30088. error('JPX Error: Unsupported progression order ' + progressionOrder);
  30089. }
  30090. }
  30091. function parseTilePackets(context, data, offset, dataLength) {
  30092. var position = 0;
  30093. var buffer, bufferSize = 0, skipNextBit = false;
  30094. function readBits(count) {
  30095. while (bufferSize < count) {
  30096. var b = data[offset + position];
  30097. position++;
  30098. if (skipNextBit) {
  30099. buffer = buffer << 7 | b;
  30100. bufferSize += 7;
  30101. skipNextBit = false;
  30102. } else {
  30103. buffer = buffer << 8 | b;
  30104. bufferSize += 8;
  30105. }
  30106. if (b === 0xFF) {
  30107. skipNextBit = true;
  30108. }
  30109. }
  30110. bufferSize -= count;
  30111. return buffer >>> bufferSize & (1 << count) - 1;
  30112. }
  30113. function skipMarkerIfEqual(value) {
  30114. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  30115. skipBytes(1);
  30116. return true;
  30117. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  30118. skipBytes(2);
  30119. return true;
  30120. }
  30121. return false;
  30122. }
  30123. function skipBytes(count) {
  30124. position += count;
  30125. }
  30126. function alignToByte() {
  30127. bufferSize = 0;
  30128. if (skipNextBit) {
  30129. position++;
  30130. skipNextBit = false;
  30131. }
  30132. }
  30133. function readCodingpasses() {
  30134. if (readBits(1) === 0) {
  30135. return 1;
  30136. }
  30137. if (readBits(1) === 0) {
  30138. return 2;
  30139. }
  30140. var value = readBits(2);
  30141. if (value < 3) {
  30142. return value + 3;
  30143. }
  30144. value = readBits(5);
  30145. if (value < 31) {
  30146. return value + 6;
  30147. }
  30148. value = readBits(7);
  30149. return value + 37;
  30150. }
  30151. var tileIndex = context.currentTile.index;
  30152. var tile = context.tiles[tileIndex];
  30153. var sopMarkerUsed = context.COD.sopMarkerUsed;
  30154. var ephMarkerUsed = context.COD.ephMarkerUsed;
  30155. var packetsIterator = tile.packetsIterator;
  30156. while (position < dataLength) {
  30157. alignToByte();
  30158. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30159. skipBytes(4);
  30160. }
  30161. var packet = packetsIterator.nextPacket();
  30162. if (!readBits(1)) {
  30163. continue;
  30164. }
  30165. var layerNumber = packet.layerNumber;
  30166. var queue = [], codeblock;
  30167. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30168. codeblock = packet.codeblocks[i];
  30169. var precinct = codeblock.precinct;
  30170. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30171. var codeblockRow = codeblock.cby - precinct.cbyMin;
  30172. var codeblockIncluded = false;
  30173. var firstTimeInclusion = false;
  30174. var valueReady;
  30175. if (codeblock['included'] !== undefined) {
  30176. codeblockIncluded = !!readBits(1);
  30177. } else {
  30178. precinct = codeblock.precinct;
  30179. var inclusionTree, zeroBitPlanesTree;
  30180. if (precinct['inclusionTree'] !== undefined) {
  30181. inclusionTree = precinct.inclusionTree;
  30182. } else {
  30183. var width = precinct.cbxMax - precinct.cbxMin + 1;
  30184. var height = precinct.cbyMax - precinct.cbyMin + 1;
  30185. inclusionTree = new InclusionTree(width, height, layerNumber);
  30186. zeroBitPlanesTree = new TagTree(width, height);
  30187. precinct.inclusionTree = inclusionTree;
  30188. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30189. }
  30190. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30191. while (true) {
  30192. if (readBits(1)) {
  30193. valueReady = !inclusionTree.nextLevel();
  30194. if (valueReady) {
  30195. codeblock.included = true;
  30196. codeblockIncluded = firstTimeInclusion = true;
  30197. break;
  30198. }
  30199. } else {
  30200. inclusionTree.incrementValue(layerNumber);
  30201. break;
  30202. }
  30203. }
  30204. }
  30205. }
  30206. if (!codeblockIncluded) {
  30207. continue;
  30208. }
  30209. if (firstTimeInclusion) {
  30210. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30211. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30212. while (true) {
  30213. if (readBits(1)) {
  30214. valueReady = !zeroBitPlanesTree.nextLevel();
  30215. if (valueReady) {
  30216. break;
  30217. }
  30218. } else {
  30219. zeroBitPlanesTree.incrementValue();
  30220. }
  30221. }
  30222. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30223. }
  30224. var codingpasses = readCodingpasses();
  30225. while (readBits(1)) {
  30226. codeblock.Lblock++;
  30227. }
  30228. var codingpassesLog2 = log2(codingpasses);
  30229. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30230. var codedDataLength = readBits(bits);
  30231. queue.push({
  30232. codeblock: codeblock,
  30233. codingpasses: codingpasses,
  30234. dataLength: codedDataLength
  30235. });
  30236. }
  30237. alignToByte();
  30238. if (ephMarkerUsed) {
  30239. skipMarkerIfEqual(0x92);
  30240. }
  30241. while (queue.length > 0) {
  30242. var packetItem = queue.shift();
  30243. codeblock = packetItem.codeblock;
  30244. if (codeblock['data'] === undefined) {
  30245. codeblock.data = [];
  30246. }
  30247. codeblock.data.push({
  30248. data: data,
  30249. start: offset + position,
  30250. end: offset + position + packetItem.dataLength,
  30251. codingpasses: packetItem.codingpasses
  30252. });
  30253. position += packetItem.dataLength;
  30254. }
  30255. }
  30256. return position;
  30257. }
  30258. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30259. var x0 = subband.tbx0;
  30260. var y0 = subband.tby0;
  30261. var width = subband.tbx1 - subband.tbx0;
  30262. var codeblocks = subband.codeblocks;
  30263. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  30264. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  30265. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  30266. var codeblock = codeblocks[i];
  30267. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30268. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30269. if (blockWidth === 0 || blockHeight === 0) {
  30270. continue;
  30271. }
  30272. if (codeblock['data'] === undefined) {
  30273. continue;
  30274. }
  30275. var bitModel, currentCodingpassType;
  30276. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30277. currentCodingpassType = 2;
  30278. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  30279. var j, jj, dataItem;
  30280. for (j = 0, jj = data.length; j < jj; j++) {
  30281. dataItem = data[j];
  30282. totalLength += dataItem.end - dataItem.start;
  30283. codingpasses += dataItem.codingpasses;
  30284. }
  30285. var encodedData = new Uint8Array(totalLength);
  30286. var position = 0;
  30287. for (j = 0, jj = data.length; j < jj; j++) {
  30288. dataItem = data[j];
  30289. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30290. encodedData.set(chunk, position);
  30291. position += chunk.length;
  30292. }
  30293. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  30294. bitModel.setDecoder(decoder);
  30295. for (j = 0; j < codingpasses; j++) {
  30296. switch (currentCodingpassType) {
  30297. case 0:
  30298. bitModel.runSignificancePropagationPass();
  30299. break;
  30300. case 1:
  30301. bitModel.runMagnitudeRefinementPass();
  30302. break;
  30303. case 2:
  30304. bitModel.runCleanupPass();
  30305. if (segmentationSymbolUsed) {
  30306. bitModel.checkSegmentationSymbol();
  30307. }
  30308. break;
  30309. }
  30310. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30311. }
  30312. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30313. var sign = bitModel.coefficentsSign;
  30314. var magnitude = bitModel.coefficentsMagnitude;
  30315. var bitsDecoded = bitModel.bitsDecoded;
  30316. var magnitudeCorrection = reversible ? 0 : 0.5;
  30317. var k, n, nb;
  30318. position = 0;
  30319. var interleave = subband.type !== 'LL';
  30320. for (j = 0; j < blockHeight; j++) {
  30321. var row = offset / width | 0;
  30322. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30323. for (k = 0; k < blockWidth; k++) {
  30324. n = magnitude[position];
  30325. if (n !== 0) {
  30326. n = (n + magnitudeCorrection) * delta;
  30327. if (sign[position] !== 0) {
  30328. n = -n;
  30329. }
  30330. nb = bitsDecoded[position];
  30331. var pos = interleave ? levelOffset + (offset << 1) : offset;
  30332. if (reversible && nb >= mb) {
  30333. coefficients[pos] = n;
  30334. } else {
  30335. coefficients[pos] = n * (1 << mb - nb);
  30336. }
  30337. }
  30338. offset++;
  30339. position++;
  30340. }
  30341. offset += width - blockWidth;
  30342. }
  30343. }
  30344. }
  30345. function transformTile(context, tile, c) {
  30346. var component = tile.components[c];
  30347. var codingStyleParameters = component.codingStyleParameters;
  30348. var quantizationParameters = component.quantizationParameters;
  30349. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  30350. var spqcds = quantizationParameters.SPqcds;
  30351. var scalarExpounded = quantizationParameters.scalarExpounded;
  30352. var guardBits = quantizationParameters.guardBits;
  30353. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  30354. var precision = context.components[c].precision;
  30355. var reversible = codingStyleParameters.reversibleTransformation;
  30356. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  30357. var subbandCoefficients = [];
  30358. var b = 0;
  30359. for (var i = 0; i <= decompositionLevelsCount; i++) {
  30360. var resolution = component.resolutions[i];
  30361. var width = resolution.trx1 - resolution.trx0;
  30362. var height = resolution.try1 - resolution.try0;
  30363. var coefficients = new Float32Array(width * height);
  30364. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  30365. var mu, epsilon;
  30366. if (!scalarExpounded) {
  30367. mu = spqcds[0].mu;
  30368. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  30369. } else {
  30370. mu = spqcds[b].mu;
  30371. epsilon = spqcds[b].epsilon;
  30372. b++;
  30373. }
  30374. var subband = resolution.subbands[j];
  30375. var gainLog2 = SubbandsGainLog2[subband.type];
  30376. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  30377. var mb = guardBits + epsilon - 1;
  30378. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  30379. }
  30380. subbandCoefficients.push({
  30381. width: width,
  30382. height: height,
  30383. items: coefficients
  30384. });
  30385. }
  30386. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  30387. return {
  30388. left: component.tcx0,
  30389. top: component.tcy0,
  30390. width: result.width,
  30391. height: result.height,
  30392. items: result.items
  30393. };
  30394. }
  30395. function transformComponents(context) {
  30396. var siz = context.SIZ;
  30397. var components = context.components;
  30398. var componentsCount = siz.Csiz;
  30399. var resultImages = [];
  30400. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  30401. var tile = context.tiles[i];
  30402. var transformedTiles = [];
  30403. var c;
  30404. for (c = 0; c < componentsCount; c++) {
  30405. transformedTiles[c] = transformTile(context, tile, c);
  30406. }
  30407. var tile0 = transformedTiles[0];
  30408. var out = new Uint8Array(tile0.items.length * componentsCount);
  30409. var result = {
  30410. left: tile0.left,
  30411. top: tile0.top,
  30412. width: tile0.width,
  30413. height: tile0.height,
  30414. items: out
  30415. };
  30416. var shift, offset, max, min, maxK;
  30417. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  30418. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  30419. var fourComponents = componentsCount === 4;
  30420. var y0items = transformedTiles[0].items;
  30421. var y1items = transformedTiles[1].items;
  30422. var y2items = transformedTiles[2].items;
  30423. var y3items = fourComponents ? transformedTiles[3].items : null;
  30424. shift = components[0].precision - 8;
  30425. offset = (128 << shift) + 0.5;
  30426. max = 255 * (1 << shift);
  30427. maxK = max * 0.5;
  30428. min = -maxK;
  30429. var component0 = tile.components[0];
  30430. var alpha01 = componentsCount - 3;
  30431. jj = y0items.length;
  30432. if (!component0.codingStyleParameters.reversibleTransformation) {
  30433. for (j = 0; j < jj; j++, pos += alpha01) {
  30434. y0 = y0items[j] + offset;
  30435. y1 = y1items[j];
  30436. y2 = y2items[j];
  30437. r = y0 + 1.402 * y2;
  30438. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  30439. b = y0 + 1.772 * y1;
  30440. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30441. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30442. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30443. }
  30444. } else {
  30445. for (j = 0; j < jj; j++, pos += alpha01) {
  30446. y0 = y0items[j] + offset;
  30447. y1 = y1items[j];
  30448. y2 = y2items[j];
  30449. g = y0 - (y2 + y1 >> 2);
  30450. r = g + y2;
  30451. b = g + y1;
  30452. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30453. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30454. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30455. }
  30456. }
  30457. if (fourComponents) {
  30458. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  30459. k = y3items[j];
  30460. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  30461. }
  30462. }
  30463. } else {
  30464. for (c = 0; c < componentsCount; c++) {
  30465. var items = transformedTiles[c].items;
  30466. shift = components[c].precision - 8;
  30467. offset = (128 << shift) + 0.5;
  30468. max = 127.5 * (1 << shift);
  30469. min = -max;
  30470. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  30471. val = items[j];
  30472. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  30473. pos += componentsCount;
  30474. }
  30475. }
  30476. }
  30477. resultImages.push(result);
  30478. }
  30479. return resultImages;
  30480. }
  30481. function initializeTile(context, tileIndex) {
  30482. var siz = context.SIZ;
  30483. var componentsCount = siz.Csiz;
  30484. var tile = context.tiles[tileIndex];
  30485. for (var c = 0; c < componentsCount; c++) {
  30486. var component = tile.components[c];
  30487. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  30488. component.quantizationParameters = qcdOrQcc;
  30489. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  30490. component.codingStyleParameters = codOrCoc;
  30491. }
  30492. tile.codingStyleDefaultParameters = context.currentTile.COD;
  30493. }
  30494. var TagTree = function TagTreeClosure() {
  30495. function TagTree(width, height) {
  30496. var levelsLength = log2(Math.max(width, height)) + 1;
  30497. this.levels = [];
  30498. for (var i = 0; i < levelsLength; i++) {
  30499. var level = {
  30500. width: width,
  30501. height: height,
  30502. items: []
  30503. };
  30504. this.levels.push(level);
  30505. width = Math.ceil(width / 2);
  30506. height = Math.ceil(height / 2);
  30507. }
  30508. }
  30509. TagTree.prototype = {
  30510. reset: function TagTree_reset(i, j) {
  30511. var currentLevel = 0, value = 0, level;
  30512. while (currentLevel < this.levels.length) {
  30513. level = this.levels[currentLevel];
  30514. var index = i + j * level.width;
  30515. if (level.items[index] !== undefined) {
  30516. value = level.items[index];
  30517. break;
  30518. }
  30519. level.index = index;
  30520. i >>= 1;
  30521. j >>= 1;
  30522. currentLevel++;
  30523. }
  30524. currentLevel--;
  30525. level = this.levels[currentLevel];
  30526. level.items[level.index] = value;
  30527. this.currentLevel = currentLevel;
  30528. delete this.value;
  30529. },
  30530. incrementValue: function TagTree_incrementValue() {
  30531. var level = this.levels[this.currentLevel];
  30532. level.items[level.index]++;
  30533. },
  30534. nextLevel: function TagTree_nextLevel() {
  30535. var currentLevel = this.currentLevel;
  30536. var level = this.levels[currentLevel];
  30537. var value = level.items[level.index];
  30538. currentLevel--;
  30539. if (currentLevel < 0) {
  30540. this.value = value;
  30541. return false;
  30542. }
  30543. this.currentLevel = currentLevel;
  30544. level = this.levels[currentLevel];
  30545. level.items[level.index] = value;
  30546. return true;
  30547. }
  30548. };
  30549. return TagTree;
  30550. }();
  30551. var InclusionTree = function InclusionTreeClosure() {
  30552. function InclusionTree(width, height, defaultValue) {
  30553. var levelsLength = log2(Math.max(width, height)) + 1;
  30554. this.levels = [];
  30555. for (var i = 0; i < levelsLength; i++) {
  30556. var items = new Uint8Array(width * height);
  30557. for (var j = 0, jj = items.length; j < jj; j++) {
  30558. items[j] = defaultValue;
  30559. }
  30560. var level = {
  30561. width: width,
  30562. height: height,
  30563. items: items
  30564. };
  30565. this.levels.push(level);
  30566. width = Math.ceil(width / 2);
  30567. height = Math.ceil(height / 2);
  30568. }
  30569. }
  30570. InclusionTree.prototype = {
  30571. reset: function InclusionTree_reset(i, j, stopValue) {
  30572. var currentLevel = 0;
  30573. while (currentLevel < this.levels.length) {
  30574. var level = this.levels[currentLevel];
  30575. var index = i + j * level.width;
  30576. level.index = index;
  30577. var value = level.items[index];
  30578. if (value === 0xFF) {
  30579. break;
  30580. }
  30581. if (value > stopValue) {
  30582. this.currentLevel = currentLevel;
  30583. this.propagateValues();
  30584. return false;
  30585. }
  30586. i >>= 1;
  30587. j >>= 1;
  30588. currentLevel++;
  30589. }
  30590. this.currentLevel = currentLevel - 1;
  30591. return true;
  30592. },
  30593. incrementValue: function InclusionTree_incrementValue(stopValue) {
  30594. var level = this.levels[this.currentLevel];
  30595. level.items[level.index] = stopValue + 1;
  30596. this.propagateValues();
  30597. },
  30598. propagateValues: function InclusionTree_propagateValues() {
  30599. var levelIndex = this.currentLevel;
  30600. var level = this.levels[levelIndex];
  30601. var currentValue = level.items[level.index];
  30602. while (--levelIndex >= 0) {
  30603. level = this.levels[levelIndex];
  30604. level.items[level.index] = currentValue;
  30605. }
  30606. },
  30607. nextLevel: function InclusionTree_nextLevel() {
  30608. var currentLevel = this.currentLevel;
  30609. var level = this.levels[currentLevel];
  30610. var value = level.items[level.index];
  30611. level.items[level.index] = 0xFF;
  30612. currentLevel--;
  30613. if (currentLevel < 0) {
  30614. return false;
  30615. }
  30616. this.currentLevel = currentLevel;
  30617. level = this.levels[currentLevel];
  30618. level.items[level.index] = value;
  30619. return true;
  30620. }
  30621. };
  30622. return InclusionTree;
  30623. }();
  30624. var BitModel = function BitModelClosure() {
  30625. var UNIFORM_CONTEXT = 17;
  30626. var RUNLENGTH_CONTEXT = 18;
  30627. var LLAndLHContextsLabel = new Uint8Array([
  30628. 0,
  30629. 5,
  30630. 8,
  30631. 0,
  30632. 3,
  30633. 7,
  30634. 8,
  30635. 0,
  30636. 4,
  30637. 7,
  30638. 8,
  30639. 0,
  30640. 0,
  30641. 0,
  30642. 0,
  30643. 0,
  30644. 1,
  30645. 6,
  30646. 8,
  30647. 0,
  30648. 3,
  30649. 7,
  30650. 8,
  30651. 0,
  30652. 4,
  30653. 7,
  30654. 8,
  30655. 0,
  30656. 0,
  30657. 0,
  30658. 0,
  30659. 0,
  30660. 2,
  30661. 6,
  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. 2,
  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. ]);
  30704. var HLContextLabel = new Uint8Array([
  30705. 0,
  30706. 3,
  30707. 4,
  30708. 0,
  30709. 5,
  30710. 7,
  30711. 7,
  30712. 0,
  30713. 8,
  30714. 8,
  30715. 8,
  30716. 0,
  30717. 0,
  30718. 0,
  30719. 0,
  30720. 0,
  30721. 1,
  30722. 3,
  30723. 4,
  30724. 0,
  30725. 6,
  30726. 7,
  30727. 7,
  30728. 0,
  30729. 8,
  30730. 8,
  30731. 8,
  30732. 0,
  30733. 0,
  30734. 0,
  30735. 0,
  30736. 0,
  30737. 2,
  30738. 3,
  30739. 4,
  30740. 0,
  30741. 6,
  30742. 7,
  30743. 7,
  30744. 0,
  30745. 8,
  30746. 8,
  30747. 8,
  30748. 0,
  30749. 0,
  30750. 0,
  30751. 0,
  30752. 0,
  30753. 2,
  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. ]);
  30781. var HHContextLabel = new Uint8Array([
  30782. 0,
  30783. 1,
  30784. 2,
  30785. 0,
  30786. 1,
  30787. 2,
  30788. 2,
  30789. 0,
  30790. 2,
  30791. 2,
  30792. 2,
  30793. 0,
  30794. 0,
  30795. 0,
  30796. 0,
  30797. 0,
  30798. 3,
  30799. 4,
  30800. 5,
  30801. 0,
  30802. 4,
  30803. 5,
  30804. 5,
  30805. 0,
  30806. 5,
  30807. 5,
  30808. 5,
  30809. 0,
  30810. 0,
  30811. 0,
  30812. 0,
  30813. 0,
  30814. 6,
  30815. 7,
  30816. 7,
  30817. 0,
  30818. 7,
  30819. 7,
  30820. 7,
  30821. 0,
  30822. 7,
  30823. 7,
  30824. 7,
  30825. 0,
  30826. 0,
  30827. 0,
  30828. 0,
  30829. 0,
  30830. 8,
  30831. 8,
  30832. 8,
  30833. 0,
  30834. 8,
  30835. 8,
  30836. 8,
  30837. 0,
  30838. 8,
  30839. 8,
  30840. 8,
  30841. 0,
  30842. 0,
  30843. 0,
  30844. 0,
  30845. 0,
  30846. 8,
  30847. 8,
  30848. 8,
  30849. 0,
  30850. 8,
  30851. 8,
  30852. 8,
  30853. 0,
  30854. 8,
  30855. 8,
  30856. 8
  30857. ]);
  30858. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30859. this.width = width;
  30860. this.height = height;
  30861. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30862. var coefficientCount = width * height;
  30863. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30864. this.coefficentsSign = new Uint8Array(coefficientCount);
  30865. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30866. this.processingFlags = new Uint8Array(coefficientCount);
  30867. var bitsDecoded = new Uint8Array(coefficientCount);
  30868. if (zeroBitPlanes !== 0) {
  30869. for (var i = 0; i < coefficientCount; i++) {
  30870. bitsDecoded[i] = zeroBitPlanes;
  30871. }
  30872. }
  30873. this.bitsDecoded = bitsDecoded;
  30874. this.reset();
  30875. }
  30876. BitModel.prototype = {
  30877. setDecoder: function BitModel_setDecoder(decoder) {
  30878. this.decoder = decoder;
  30879. },
  30880. reset: function BitModel_reset() {
  30881. this.contexts = new Int8Array(19);
  30882. this.contexts[0] = 4 << 1 | 0;
  30883. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30884. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30885. },
  30886. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30887. var neighborsSignificance = this.neighborsSignificance;
  30888. var width = this.width, height = this.height;
  30889. var left = column > 0;
  30890. var right = column + 1 < width;
  30891. var i;
  30892. if (row > 0) {
  30893. i = index - width;
  30894. if (left) {
  30895. neighborsSignificance[i - 1] += 0x10;
  30896. }
  30897. if (right) {
  30898. neighborsSignificance[i + 1] += 0x10;
  30899. }
  30900. neighborsSignificance[i] += 0x04;
  30901. }
  30902. if (row + 1 < height) {
  30903. i = index + width;
  30904. if (left) {
  30905. neighborsSignificance[i - 1] += 0x10;
  30906. }
  30907. if (right) {
  30908. neighborsSignificance[i + 1] += 0x10;
  30909. }
  30910. neighborsSignificance[i] += 0x04;
  30911. }
  30912. if (left) {
  30913. neighborsSignificance[index - 1] += 0x01;
  30914. }
  30915. if (right) {
  30916. neighborsSignificance[index + 1] += 0x01;
  30917. }
  30918. neighborsSignificance[index] |= 0x80;
  30919. },
  30920. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30921. var decoder = this.decoder;
  30922. var width = this.width, height = this.height;
  30923. var coefficentsMagnitude = this.coefficentsMagnitude;
  30924. var coefficentsSign = this.coefficentsSign;
  30925. var neighborsSignificance = this.neighborsSignificance;
  30926. var processingFlags = this.processingFlags;
  30927. var contexts = this.contexts;
  30928. var labels = this.contextLabelTable;
  30929. var bitsDecoded = this.bitsDecoded;
  30930. var processedInverseMask = ~1;
  30931. var processedMask = 1;
  30932. var firstMagnitudeBitMask = 2;
  30933. for (var i0 = 0; i0 < height; i0 += 4) {
  30934. for (var j = 0; j < width; j++) {
  30935. var index = i0 * width + j;
  30936. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30937. var i = i0 + i1;
  30938. if (i >= height) {
  30939. break;
  30940. }
  30941. processingFlags[index] &= processedInverseMask;
  30942. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30943. continue;
  30944. }
  30945. var contextLabel = labels[neighborsSignificance[index]];
  30946. var decision = decoder.readBit(contexts, contextLabel);
  30947. if (decision) {
  30948. var sign = this.decodeSignBit(i, j, index);
  30949. coefficentsSign[index] = sign;
  30950. coefficentsMagnitude[index] = 1;
  30951. this.setNeighborsSignificance(i, j, index);
  30952. processingFlags[index] |= firstMagnitudeBitMask;
  30953. }
  30954. bitsDecoded[index]++;
  30955. processingFlags[index] |= processedMask;
  30956. }
  30957. }
  30958. }
  30959. },
  30960. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30961. var width = this.width, height = this.height;
  30962. var coefficentsMagnitude = this.coefficentsMagnitude;
  30963. var coefficentsSign = this.coefficentsSign;
  30964. var contribution, sign0, sign1, significance1;
  30965. var contextLabel, decoded;
  30966. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30967. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30968. sign1 = coefficentsSign[index + 1];
  30969. if (significance1) {
  30970. sign0 = coefficentsSign[index - 1];
  30971. contribution = 1 - sign1 - sign0;
  30972. } else {
  30973. contribution = 1 - sign1 - sign1;
  30974. }
  30975. } else if (significance1) {
  30976. sign0 = coefficentsSign[index - 1];
  30977. contribution = 1 - sign0 - sign0;
  30978. } else {
  30979. contribution = 0;
  30980. }
  30981. var horizontalContribution = 3 * contribution;
  30982. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30983. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30984. sign1 = coefficentsSign[index + width];
  30985. if (significance1) {
  30986. sign0 = coefficentsSign[index - width];
  30987. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30988. } else {
  30989. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30990. }
  30991. } else if (significance1) {
  30992. sign0 = coefficentsSign[index - width];
  30993. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30994. } else {
  30995. contribution = horizontalContribution;
  30996. }
  30997. if (contribution >= 0) {
  30998. contextLabel = 9 + contribution;
  30999. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31000. } else {
  31001. contextLabel = 9 - contribution;
  31002. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31003. }
  31004. return decoded;
  31005. },
  31006. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  31007. var decoder = this.decoder;
  31008. var width = this.width, height = this.height;
  31009. var coefficentsMagnitude = this.coefficentsMagnitude;
  31010. var neighborsSignificance = this.neighborsSignificance;
  31011. var contexts = this.contexts;
  31012. var bitsDecoded = this.bitsDecoded;
  31013. var processingFlags = this.processingFlags;
  31014. var processedMask = 1;
  31015. var firstMagnitudeBitMask = 2;
  31016. var length = width * height;
  31017. var width4 = width * 4;
  31018. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31019. indexNext = Math.min(length, index0 + width4);
  31020. for (var j = 0; j < width; j++) {
  31021. for (var index = index0 + j; index < indexNext; index += width) {
  31022. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31023. continue;
  31024. }
  31025. var contextLabel = 16;
  31026. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31027. processingFlags[index] ^= firstMagnitudeBitMask;
  31028. var significance = neighborsSignificance[index] & 127;
  31029. contextLabel = significance === 0 ? 15 : 14;
  31030. }
  31031. var bit = decoder.readBit(contexts, contextLabel);
  31032. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31033. bitsDecoded[index]++;
  31034. processingFlags[index] |= processedMask;
  31035. }
  31036. }
  31037. }
  31038. },
  31039. runCleanupPass: function BitModel_runCleanupPass() {
  31040. var decoder = this.decoder;
  31041. var width = this.width, height = this.height;
  31042. var neighborsSignificance = this.neighborsSignificance;
  31043. var coefficentsMagnitude = this.coefficentsMagnitude;
  31044. var coefficentsSign = this.coefficentsSign;
  31045. var contexts = this.contexts;
  31046. var labels = this.contextLabelTable;
  31047. var bitsDecoded = this.bitsDecoded;
  31048. var processingFlags = this.processingFlags;
  31049. var processedMask = 1;
  31050. var firstMagnitudeBitMask = 2;
  31051. var oneRowDown = width;
  31052. var twoRowsDown = width * 2;
  31053. var threeRowsDown = width * 3;
  31054. var iNext;
  31055. for (var i0 = 0; i0 < height; i0 = iNext) {
  31056. iNext = Math.min(i0 + 4, height);
  31057. var indexBase = i0 * width;
  31058. var checkAllEmpty = i0 + 3 < height;
  31059. for (var j = 0; j < width; j++) {
  31060. var index0 = indexBase + j;
  31061. 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;
  31062. var i1 = 0, index = index0;
  31063. var i = i0, sign;
  31064. if (allEmpty) {
  31065. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31066. if (!hasSignificantCoefficent) {
  31067. bitsDecoded[index0]++;
  31068. bitsDecoded[index0 + oneRowDown]++;
  31069. bitsDecoded[index0 + twoRowsDown]++;
  31070. bitsDecoded[index0 + threeRowsDown]++;
  31071. continue;
  31072. }
  31073. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31074. if (i1 !== 0) {
  31075. i = i0 + i1;
  31076. index += i1 * width;
  31077. }
  31078. sign = this.decodeSignBit(i, j, index);
  31079. coefficentsSign[index] = sign;
  31080. coefficentsMagnitude[index] = 1;
  31081. this.setNeighborsSignificance(i, j, index);
  31082. processingFlags[index] |= firstMagnitudeBitMask;
  31083. index = index0;
  31084. for (var i2 = i0; i2 <= i; i2++, index += width) {
  31085. bitsDecoded[index]++;
  31086. }
  31087. i1++;
  31088. }
  31089. for (i = i0 + i1; i < iNext; i++, index += width) {
  31090. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31091. continue;
  31092. }
  31093. var contextLabel = labels[neighborsSignificance[index]];
  31094. var decision = decoder.readBit(contexts, contextLabel);
  31095. if (decision === 1) {
  31096. sign = this.decodeSignBit(i, j, index);
  31097. coefficentsSign[index] = sign;
  31098. coefficentsMagnitude[index] = 1;
  31099. this.setNeighborsSignificance(i, j, index);
  31100. processingFlags[index] |= firstMagnitudeBitMask;
  31101. }
  31102. bitsDecoded[index]++;
  31103. }
  31104. }
  31105. }
  31106. },
  31107. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  31108. var decoder = this.decoder;
  31109. var contexts = this.contexts;
  31110. 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);
  31111. if (symbol !== 0xA) {
  31112. error('JPX Error: Invalid segmentation symbol');
  31113. }
  31114. }
  31115. };
  31116. return BitModel;
  31117. }();
  31118. var Transform = function TransformClosure() {
  31119. function Transform() {
  31120. }
  31121. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  31122. var ll = subbands[0];
  31123. for (var i = 1, ii = subbands.length; i < ii; i++) {
  31124. ll = this.iterate(ll, subbands[i], u0, v0);
  31125. }
  31126. return ll;
  31127. };
  31128. Transform.prototype.extend = function extend(buffer, offset, size) {
  31129. var i1 = offset - 1, j1 = offset + 1;
  31130. var i2 = offset + size - 2, j2 = offset + size;
  31131. buffer[i1--] = buffer[j1++];
  31132. buffer[j2++] = buffer[i2--];
  31133. buffer[i1--] = buffer[j1++];
  31134. buffer[j2++] = buffer[i2--];
  31135. buffer[i1--] = buffer[j1++];
  31136. buffer[j2++] = buffer[i2--];
  31137. buffer[i1] = buffer[j1];
  31138. buffer[j2] = buffer[i2];
  31139. };
  31140. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  31141. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  31142. var width = hl_lh_hh.width;
  31143. var height = hl_lh_hh.height;
  31144. var items = hl_lh_hh.items;
  31145. var i, j, k, l, u, v;
  31146. for (k = 0, i = 0; i < llHeight; i++) {
  31147. l = i * 2 * width;
  31148. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31149. items[l] = llItems[k];
  31150. }
  31151. }
  31152. llItems = ll.items = null;
  31153. var bufferPadding = 4;
  31154. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31155. if (width === 1) {
  31156. if ((u0 & 1) !== 0) {
  31157. for (v = 0, k = 0; v < height; v++, k += width) {
  31158. items[k] *= 0.5;
  31159. }
  31160. }
  31161. } else {
  31162. for (v = 0, k = 0; v < height; v++, k += width) {
  31163. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31164. this.extend(rowBuffer, bufferPadding, width);
  31165. this.filter(rowBuffer, bufferPadding, width);
  31166. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31167. }
  31168. }
  31169. var numBuffers = 16;
  31170. var colBuffers = [];
  31171. for (i = 0; i < numBuffers; i++) {
  31172. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31173. }
  31174. var b, currentBuffer = 0;
  31175. ll = bufferPadding + height;
  31176. if (height === 1) {
  31177. if ((v0 & 1) !== 0) {
  31178. for (u = 0; u < width; u++) {
  31179. items[u] *= 0.5;
  31180. }
  31181. }
  31182. } else {
  31183. for (u = 0; u < width; u++) {
  31184. if (currentBuffer === 0) {
  31185. numBuffers = Math.min(width - u, numBuffers);
  31186. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31187. for (b = 0; b < numBuffers; b++) {
  31188. colBuffers[b][l] = items[k + b];
  31189. }
  31190. }
  31191. currentBuffer = numBuffers;
  31192. }
  31193. currentBuffer--;
  31194. var buffer = colBuffers[currentBuffer];
  31195. this.extend(buffer, bufferPadding, height);
  31196. this.filter(buffer, bufferPadding, height);
  31197. if (currentBuffer === 0) {
  31198. k = u - numBuffers + 1;
  31199. for (l = bufferPadding; l < ll; k += width, l++) {
  31200. for (b = 0; b < numBuffers; b++) {
  31201. items[k + b] = colBuffers[b][l];
  31202. }
  31203. }
  31204. }
  31205. }
  31206. }
  31207. return {
  31208. width: width,
  31209. height: height,
  31210. items: items
  31211. };
  31212. };
  31213. return Transform;
  31214. }();
  31215. var IrreversibleTransform = function IrreversibleTransformClosure() {
  31216. function IrreversibleTransform() {
  31217. Transform.call(this);
  31218. }
  31219. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  31220. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  31221. var len = length >> 1;
  31222. offset = offset | 0;
  31223. var j, n, current, next;
  31224. var alpha = -1.586134342059924;
  31225. var beta = -0.052980118572961;
  31226. var gamma = 0.882911075530934;
  31227. var delta = 0.443506852043971;
  31228. var K = 1.230174104914001;
  31229. var K_ = 1 / K;
  31230. j = offset - 3;
  31231. for (n = len + 4; n--; j += 2) {
  31232. x[j] *= K_;
  31233. }
  31234. j = offset - 2;
  31235. current = delta * x[j - 1];
  31236. for (n = len + 3; n--; j += 2) {
  31237. next = delta * x[j + 1];
  31238. x[j] = K * x[j] - current - next;
  31239. if (n--) {
  31240. j += 2;
  31241. current = delta * x[j + 1];
  31242. x[j] = K * x[j] - current - next;
  31243. } else {
  31244. break;
  31245. }
  31246. }
  31247. j = offset - 1;
  31248. current = gamma * x[j - 1];
  31249. for (n = len + 2; n--; j += 2) {
  31250. next = gamma * x[j + 1];
  31251. x[j] -= current + next;
  31252. if (n--) {
  31253. j += 2;
  31254. current = gamma * x[j + 1];
  31255. x[j] -= current + next;
  31256. } else {
  31257. break;
  31258. }
  31259. }
  31260. j = offset;
  31261. current = beta * x[j - 1];
  31262. for (n = len + 1; n--; j += 2) {
  31263. next = beta * x[j + 1];
  31264. x[j] -= current + next;
  31265. if (n--) {
  31266. j += 2;
  31267. current = beta * x[j + 1];
  31268. x[j] -= current + next;
  31269. } else {
  31270. break;
  31271. }
  31272. }
  31273. if (len !== 0) {
  31274. j = offset + 1;
  31275. current = alpha * x[j - 1];
  31276. for (n = len; n--; j += 2) {
  31277. next = alpha * x[j + 1];
  31278. x[j] -= current + next;
  31279. if (n--) {
  31280. j += 2;
  31281. current = alpha * x[j + 1];
  31282. x[j] -= current + next;
  31283. } else {
  31284. break;
  31285. }
  31286. }
  31287. }
  31288. };
  31289. return IrreversibleTransform;
  31290. }();
  31291. var ReversibleTransform = function ReversibleTransformClosure() {
  31292. function ReversibleTransform() {
  31293. Transform.call(this);
  31294. }
  31295. ReversibleTransform.prototype = Object.create(Transform.prototype);
  31296. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  31297. var len = length >> 1;
  31298. offset = offset | 0;
  31299. var j, n;
  31300. for (j = offset, n = len + 1; n--; j += 2) {
  31301. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31302. }
  31303. for (j = offset + 1, n = len; n--; j += 2) {
  31304. x[j] += x[j - 1] + x[j + 1] >> 1;
  31305. }
  31306. };
  31307. return ReversibleTransform;
  31308. }();
  31309. return JpxImage;
  31310. }();
  31311. exports.JpxImage = JpxImage;
  31312. /***/ }),
  31313. /* 15 */
  31314. /***/ (function(module, exports, __w_pdfjs_require__) {
  31315. "use strict";
  31316. var sharedUtil = __w_pdfjs_require__(0);
  31317. var corePrimitives = __w_pdfjs_require__(1);
  31318. var coreCrypto = __w_pdfjs_require__(12);
  31319. var coreParser = __w_pdfjs_require__(5);
  31320. var coreChunkedStream = __w_pdfjs_require__(11);
  31321. var coreColorSpace = __w_pdfjs_require__(3);
  31322. var InvalidPDFException = sharedUtil.InvalidPDFException;
  31323. var MissingDataException = sharedUtil.MissingDataException;
  31324. var XRefParseException = sharedUtil.XRefParseException;
  31325. var assert = sharedUtil.assert;
  31326. var bytesToString = sharedUtil.bytesToString;
  31327. var createPromiseCapability = sharedUtil.createPromiseCapability;
  31328. var error = sharedUtil.error;
  31329. var info = sharedUtil.info;
  31330. var isArray = sharedUtil.isArray;
  31331. var isBool = sharedUtil.isBool;
  31332. var isInt = sharedUtil.isInt;
  31333. var isString = sharedUtil.isString;
  31334. var shadow = sharedUtil.shadow;
  31335. var stringToPDFString = sharedUtil.stringToPDFString;
  31336. var stringToUTF8String = sharedUtil.stringToUTF8String;
  31337. var warn = sharedUtil.warn;
  31338. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  31339. var Util = sharedUtil.Util;
  31340. var Ref = corePrimitives.Ref;
  31341. var RefSet = corePrimitives.RefSet;
  31342. var RefSetCache = corePrimitives.RefSetCache;
  31343. var isName = corePrimitives.isName;
  31344. var isCmd = corePrimitives.isCmd;
  31345. var isDict = corePrimitives.isDict;
  31346. var isRef = corePrimitives.isRef;
  31347. var isRefsEqual = corePrimitives.isRefsEqual;
  31348. var isStream = corePrimitives.isStream;
  31349. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  31350. var Lexer = coreParser.Lexer;
  31351. var Parser = coreParser.Parser;
  31352. var ChunkedStream = coreChunkedStream.ChunkedStream;
  31353. var ColorSpace = coreColorSpace.ColorSpace;
  31354. var Catalog = function CatalogClosure() {
  31355. function Catalog(pdfManager, xref, pageFactory) {
  31356. this.pdfManager = pdfManager;
  31357. this.xref = xref;
  31358. this.catDict = xref.getCatalogObj();
  31359. this.fontCache = new RefSetCache();
  31360. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  31361. this.pageFactory = pageFactory;
  31362. this.pagePromises = [];
  31363. }
  31364. Catalog.prototype = {
  31365. get metadata() {
  31366. var streamRef = this.catDict.getRaw('Metadata');
  31367. if (!isRef(streamRef)) {
  31368. return shadow(this, 'metadata', null);
  31369. }
  31370. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  31371. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  31372. var metadata;
  31373. if (stream && isDict(stream.dict)) {
  31374. var type = stream.dict.get('Type');
  31375. var subtype = stream.dict.get('Subtype');
  31376. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  31377. try {
  31378. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  31379. } catch (e) {
  31380. info('Skipping invalid metadata.');
  31381. }
  31382. }
  31383. }
  31384. return shadow(this, 'metadata', metadata);
  31385. },
  31386. get toplevelPagesDict() {
  31387. var pagesObj = this.catDict.get('Pages');
  31388. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  31389. return shadow(this, 'toplevelPagesDict', pagesObj);
  31390. },
  31391. get documentOutline() {
  31392. var obj = null;
  31393. try {
  31394. obj = this.readDocumentOutline();
  31395. } catch (ex) {
  31396. if (ex instanceof MissingDataException) {
  31397. throw ex;
  31398. }
  31399. warn('Unable to read document outline');
  31400. }
  31401. return shadow(this, 'documentOutline', obj);
  31402. },
  31403. readDocumentOutline: function Catalog_readDocumentOutline() {
  31404. var obj = this.catDict.get('Outlines');
  31405. if (!isDict(obj)) {
  31406. return null;
  31407. }
  31408. obj = obj.getRaw('First');
  31409. if (!isRef(obj)) {
  31410. return null;
  31411. }
  31412. var root = { items: [] };
  31413. var queue = [{
  31414. obj: obj,
  31415. parent: root
  31416. }];
  31417. var processed = new RefSet();
  31418. processed.put(obj);
  31419. var xref = this.xref, blackColor = new Uint8Array(3);
  31420. while (queue.length > 0) {
  31421. var i = queue.shift();
  31422. var outlineDict = xref.fetchIfRef(i.obj);
  31423. if (outlineDict === null) {
  31424. continue;
  31425. }
  31426. assert(outlineDict.has('Title'), 'Invalid outline item');
  31427. var data = {
  31428. url: null,
  31429. dest: null
  31430. };
  31431. Catalog.parseDestDictionary({
  31432. destDict: outlineDict,
  31433. resultObj: data,
  31434. docBaseUrl: this.pdfManager.docBaseUrl
  31435. });
  31436. var title = outlineDict.get('Title');
  31437. var flags = outlineDict.get('F') || 0;
  31438. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  31439. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  31440. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  31441. }
  31442. var outlineItem = {
  31443. dest: data.dest,
  31444. url: data.url,
  31445. unsafeUrl: data.unsafeUrl,
  31446. newWindow: data.newWindow,
  31447. title: stringToPDFString(title),
  31448. color: rgbColor,
  31449. count: outlineDict.get('Count'),
  31450. bold: !!(flags & 2),
  31451. italic: !!(flags & 1),
  31452. items: []
  31453. };
  31454. i.parent.items.push(outlineItem);
  31455. obj = outlineDict.getRaw('First');
  31456. if (isRef(obj) && !processed.has(obj)) {
  31457. queue.push({
  31458. obj: obj,
  31459. parent: outlineItem
  31460. });
  31461. processed.put(obj);
  31462. }
  31463. obj = outlineDict.getRaw('Next');
  31464. if (isRef(obj) && !processed.has(obj)) {
  31465. queue.push({
  31466. obj: obj,
  31467. parent: i.parent
  31468. });
  31469. processed.put(obj);
  31470. }
  31471. }
  31472. return root.items.length > 0 ? root.items : null;
  31473. },
  31474. get numPages() {
  31475. var obj = this.toplevelPagesDict.get('Count');
  31476. assert(isInt(obj), 'page count in top level pages object is not an integer');
  31477. return shadow(this, 'num', obj);
  31478. },
  31479. get destinations() {
  31480. function fetchDestination(dest) {
  31481. return isDict(dest) ? dest.get('D') : dest;
  31482. }
  31483. var xref = this.xref;
  31484. var dests = {}, nameTreeRef, nameDictionaryRef;
  31485. var obj = this.catDict.get('Names');
  31486. if (obj && obj.has('Dests')) {
  31487. nameTreeRef = obj.getRaw('Dests');
  31488. } else if (this.catDict.has('Dests')) {
  31489. nameDictionaryRef = this.catDict.get('Dests');
  31490. }
  31491. if (nameDictionaryRef) {
  31492. obj = nameDictionaryRef;
  31493. obj.forEach(function catalogForEach(key, value) {
  31494. if (!value) {
  31495. return;
  31496. }
  31497. dests[key] = fetchDestination(value);
  31498. });
  31499. }
  31500. if (nameTreeRef) {
  31501. var nameTree = new NameTree(nameTreeRef, xref);
  31502. var names = nameTree.getAll();
  31503. for (var name in names) {
  31504. dests[name] = fetchDestination(names[name]);
  31505. }
  31506. }
  31507. return shadow(this, 'destinations', dests);
  31508. },
  31509. getDestination: function Catalog_getDestination(destinationId) {
  31510. function fetchDestination(dest) {
  31511. return isDict(dest) ? dest.get('D') : dest;
  31512. }
  31513. var xref = this.xref;
  31514. var dest = null, nameTreeRef, nameDictionaryRef;
  31515. var obj = this.catDict.get('Names');
  31516. if (obj && obj.has('Dests')) {
  31517. nameTreeRef = obj.getRaw('Dests');
  31518. } else if (this.catDict.has('Dests')) {
  31519. nameDictionaryRef = this.catDict.get('Dests');
  31520. }
  31521. if (nameDictionaryRef) {
  31522. var value = nameDictionaryRef.get(destinationId);
  31523. if (value) {
  31524. dest = fetchDestination(value);
  31525. }
  31526. }
  31527. if (nameTreeRef) {
  31528. var nameTree = new NameTree(nameTreeRef, xref);
  31529. dest = fetchDestination(nameTree.get(destinationId));
  31530. }
  31531. return dest;
  31532. },
  31533. get pageLabels() {
  31534. var obj = null;
  31535. try {
  31536. obj = this.readPageLabels();
  31537. } catch (ex) {
  31538. if (ex instanceof MissingDataException) {
  31539. throw ex;
  31540. }
  31541. warn('Unable to read page labels.');
  31542. }
  31543. return shadow(this, 'pageLabels', obj);
  31544. },
  31545. readPageLabels: function Catalog_readPageLabels() {
  31546. var obj = this.catDict.getRaw('PageLabels');
  31547. if (!obj) {
  31548. return null;
  31549. }
  31550. var pageLabels = new Array(this.numPages);
  31551. var style = null;
  31552. var prefix = '';
  31553. var numberTree = new NumberTree(obj, this.xref);
  31554. var nums = numberTree.getAll();
  31555. var currentLabel = '', currentIndex = 1;
  31556. for (var i = 0, ii = this.numPages; i < ii; i++) {
  31557. if (i in nums) {
  31558. var labelDict = nums[i];
  31559. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  31560. var type = labelDict.get('Type');
  31561. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  31562. var s = labelDict.get('S');
  31563. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  31564. style = s ? s.name : null;
  31565. var p = labelDict.get('P');
  31566. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  31567. prefix = p ? stringToPDFString(p) : '';
  31568. var st = labelDict.get('St');
  31569. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  31570. currentIndex = st || 1;
  31571. }
  31572. switch (style) {
  31573. case 'D':
  31574. currentLabel = currentIndex;
  31575. break;
  31576. case 'R':
  31577. case 'r':
  31578. currentLabel = Util.toRoman(currentIndex, style === 'r');
  31579. break;
  31580. case 'A':
  31581. case 'a':
  31582. var LIMIT = 26;
  31583. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  31584. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  31585. var letterIndex = currentIndex - 1;
  31586. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  31587. var charBuf = [];
  31588. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  31589. charBuf.push(character);
  31590. }
  31591. currentLabel = charBuf.join('');
  31592. break;
  31593. default:
  31594. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  31595. }
  31596. pageLabels[i] = prefix + currentLabel;
  31597. currentLabel = '';
  31598. currentIndex++;
  31599. }
  31600. return pageLabels;
  31601. },
  31602. get attachments() {
  31603. var xref = this.xref;
  31604. var attachments = null, nameTreeRef;
  31605. var obj = this.catDict.get('Names');
  31606. if (obj) {
  31607. nameTreeRef = obj.getRaw('EmbeddedFiles');
  31608. }
  31609. if (nameTreeRef) {
  31610. var nameTree = new NameTree(nameTreeRef, xref);
  31611. var names = nameTree.getAll();
  31612. for (var name in names) {
  31613. var fs = new FileSpec(names[name], xref);
  31614. if (!attachments) {
  31615. attachments = Object.create(null);
  31616. }
  31617. attachments[stringToPDFString(name)] = fs.serializable;
  31618. }
  31619. }
  31620. return shadow(this, 'attachments', attachments);
  31621. },
  31622. get javaScript() {
  31623. var xref = this.xref;
  31624. var obj = this.catDict.get('Names');
  31625. var javaScript = [];
  31626. function appendIfJavaScriptDict(jsDict) {
  31627. var type = jsDict.get('S');
  31628. if (!isName(type, 'JavaScript')) {
  31629. return;
  31630. }
  31631. var js = jsDict.get('JS');
  31632. if (isStream(js)) {
  31633. js = bytesToString(js.getBytes());
  31634. } else if (!isString(js)) {
  31635. return;
  31636. }
  31637. javaScript.push(stringToPDFString(js));
  31638. }
  31639. if (obj && obj.has('JavaScript')) {
  31640. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  31641. var names = nameTree.getAll();
  31642. for (var name in names) {
  31643. var jsDict = names[name];
  31644. if (isDict(jsDict)) {
  31645. appendIfJavaScriptDict(jsDict);
  31646. }
  31647. }
  31648. }
  31649. var openactionDict = this.catDict.get('OpenAction');
  31650. if (isDict(openactionDict, 'Action')) {
  31651. var actionType = openactionDict.get('S');
  31652. if (isName(actionType, 'Named')) {
  31653. var action = openactionDict.get('N');
  31654. if (isName(action, 'Print')) {
  31655. javaScript.push('print({});');
  31656. }
  31657. } else {
  31658. appendIfJavaScriptDict(openactionDict);
  31659. }
  31660. }
  31661. return shadow(this, 'javaScript', javaScript);
  31662. },
  31663. cleanup: function Catalog_cleanup() {
  31664. var promises = [];
  31665. this.fontCache.forEach(function (promise) {
  31666. promises.push(promise);
  31667. });
  31668. return Promise.all(promises).then(function (translatedFonts) {
  31669. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  31670. var font = translatedFonts[i].dict;
  31671. delete font.translated;
  31672. }
  31673. this.fontCache.clear();
  31674. }.bind(this));
  31675. },
  31676. getPage: function Catalog_getPage(pageIndex) {
  31677. if (!(pageIndex in this.pagePromises)) {
  31678. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  31679. var dict = a[0];
  31680. var ref = a[1];
  31681. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache);
  31682. }.bind(this));
  31683. }
  31684. return this.pagePromises[pageIndex];
  31685. },
  31686. getPageDict: function Catalog_getPageDict(pageIndex) {
  31687. var capability = createPromiseCapability();
  31688. var nodesToVisit = [this.catDict.getRaw('Pages')];
  31689. var currentPageIndex = 0;
  31690. var xref = this.xref;
  31691. var checkAllKids = false;
  31692. function next() {
  31693. while (nodesToVisit.length) {
  31694. var currentNode = nodesToVisit.pop();
  31695. if (isRef(currentNode)) {
  31696. xref.fetchAsync(currentNode).then(function (obj) {
  31697. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  31698. if (pageIndex === currentPageIndex) {
  31699. capability.resolve([
  31700. obj,
  31701. currentNode
  31702. ]);
  31703. } else {
  31704. currentPageIndex++;
  31705. next();
  31706. }
  31707. return;
  31708. }
  31709. nodesToVisit.push(obj);
  31710. next();
  31711. }, capability.reject);
  31712. return;
  31713. }
  31714. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  31715. var count = currentNode.get('Count');
  31716. if (count === 0) {
  31717. checkAllKids = true;
  31718. }
  31719. if (currentPageIndex + count <= pageIndex) {
  31720. currentPageIndex += count;
  31721. continue;
  31722. }
  31723. var kids = currentNode.get('Kids');
  31724. assert(isArray(kids), 'page dictionary kids object is not an array');
  31725. if (!checkAllKids && count === kids.length) {
  31726. nodesToVisit = [kids[pageIndex - currentPageIndex]];
  31727. currentPageIndex = pageIndex;
  31728. continue;
  31729. } else {
  31730. for (var last = kids.length - 1; last >= 0; last--) {
  31731. nodesToVisit.push(kids[last]);
  31732. }
  31733. }
  31734. }
  31735. capability.reject('Page index ' + pageIndex + ' not found.');
  31736. }
  31737. next();
  31738. return capability.promise;
  31739. },
  31740. getPageIndex: function Catalog_getPageIndex(pageRef) {
  31741. var xref = this.xref;
  31742. function pagesBeforeRef(kidRef) {
  31743. var total = 0;
  31744. var parentRef;
  31745. return xref.fetchAsync(kidRef).then(function (node) {
  31746. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  31747. throw new Error('The reference does not point to a /Page Dict.');
  31748. }
  31749. if (!node) {
  31750. return null;
  31751. }
  31752. assert(isDict(node), 'node must be a Dict.');
  31753. parentRef = node.getRaw('Parent');
  31754. return node.getAsync('Parent');
  31755. }).then(function (parent) {
  31756. if (!parent) {
  31757. return null;
  31758. }
  31759. assert(isDict(parent), 'parent must be a Dict.');
  31760. return parent.getAsync('Kids');
  31761. }).then(function (kids) {
  31762. if (!kids) {
  31763. return null;
  31764. }
  31765. var kidPromises = [];
  31766. var found = false;
  31767. for (var i = 0; i < kids.length; i++) {
  31768. var kid = kids[i];
  31769. assert(isRef(kid), 'kid must be a Ref.');
  31770. if (kid.num === kidRef.num) {
  31771. found = true;
  31772. break;
  31773. }
  31774. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  31775. if (kid.has('Count')) {
  31776. var count = kid.get('Count');
  31777. total += count;
  31778. } else {
  31779. total++;
  31780. }
  31781. }));
  31782. }
  31783. if (!found) {
  31784. error('kid ref not found in parents kids');
  31785. }
  31786. return Promise.all(kidPromises).then(function () {
  31787. return [
  31788. total,
  31789. parentRef
  31790. ];
  31791. });
  31792. });
  31793. }
  31794. var total = 0;
  31795. function next(ref) {
  31796. return pagesBeforeRef(ref).then(function (args) {
  31797. if (!args) {
  31798. return total;
  31799. }
  31800. var count = args[0];
  31801. var parentRef = args[1];
  31802. total += count;
  31803. return next(parentRef);
  31804. });
  31805. }
  31806. return next(pageRef);
  31807. }
  31808. };
  31809. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  31810. function addDefaultProtocolToUrl(url) {
  31811. if (url.indexOf('www.') === 0) {
  31812. return 'http://' + url;
  31813. }
  31814. return url;
  31815. }
  31816. function tryConvertUrlEncoding(url) {
  31817. try {
  31818. return stringToUTF8String(url);
  31819. } catch (e) {
  31820. return url;
  31821. }
  31822. }
  31823. var destDict = params.destDict;
  31824. if (!isDict(destDict)) {
  31825. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31826. return;
  31827. }
  31828. var resultObj = params.resultObj;
  31829. if (typeof resultObj !== 'object') {
  31830. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31831. return;
  31832. }
  31833. var docBaseUrl = params.docBaseUrl || null;
  31834. var action = destDict.get('A'), url, dest;
  31835. if (isDict(action)) {
  31836. var linkType = action.get('S').name;
  31837. switch (linkType) {
  31838. case 'URI':
  31839. url = action.get('URI');
  31840. if (isName(url)) {
  31841. url = '/' + url.name;
  31842. } else if (isString(url)) {
  31843. url = addDefaultProtocolToUrl(url);
  31844. }
  31845. break;
  31846. case 'GoTo':
  31847. dest = action.get('D');
  31848. break;
  31849. case 'Launch':
  31850. case 'GoToR':
  31851. var urlDict = action.get('F');
  31852. if (isDict(urlDict)) {
  31853. url = urlDict.get('F') || null;
  31854. } else if (isString(urlDict)) {
  31855. url = urlDict;
  31856. }
  31857. var remoteDest = action.get('D');
  31858. if (remoteDest) {
  31859. if (isName(remoteDest)) {
  31860. remoteDest = remoteDest.name;
  31861. }
  31862. if (isString(url)) {
  31863. var baseUrl = url.split('#')[0];
  31864. if (isString(remoteDest)) {
  31865. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31866. } else if (isArray(remoteDest)) {
  31867. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31868. }
  31869. }
  31870. }
  31871. var newWindow = action.get('NewWindow');
  31872. if (isBool(newWindow)) {
  31873. resultObj.newWindow = newWindow;
  31874. }
  31875. break;
  31876. case 'Named':
  31877. var namedAction = action.get('N');
  31878. if (isName(namedAction)) {
  31879. resultObj.action = namedAction.name;
  31880. }
  31881. break;
  31882. case 'JavaScript':
  31883. var jsAction = action.get('JS'), js;
  31884. if (isStream(jsAction)) {
  31885. js = bytesToString(jsAction.getBytes());
  31886. } else if (isString(jsAction)) {
  31887. js = jsAction;
  31888. }
  31889. if (js) {
  31890. var URL_OPEN_METHODS = [
  31891. 'app.launchURL',
  31892. 'window.open'
  31893. ];
  31894. var regex = new RegExp('^(?:' + URL_OPEN_METHODS.join('|') + ')' + '\\((?:\'|\")(\\S+)(?:\'|\")(?:,|\\))');
  31895. var jsUrl = regex.exec(stringToPDFString(js), 'i');
  31896. if (jsUrl && jsUrl[1]) {
  31897. url = jsUrl[1];
  31898. break;
  31899. }
  31900. }
  31901. default:
  31902. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31903. break;
  31904. }
  31905. } else if (destDict.has('Dest')) {
  31906. dest = destDict.get('Dest');
  31907. }
  31908. if (isString(url)) {
  31909. url = tryConvertUrlEncoding(url);
  31910. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31911. if (absoluteUrl) {
  31912. resultObj.url = absoluteUrl.href;
  31913. }
  31914. resultObj.unsafeUrl = url;
  31915. }
  31916. if (dest) {
  31917. if (isName(dest)) {
  31918. dest = dest.name;
  31919. }
  31920. if (isString(dest) || isArray(dest)) {
  31921. resultObj.dest = dest;
  31922. }
  31923. }
  31924. };
  31925. return Catalog;
  31926. }();
  31927. var XRef = function XRefClosure() {
  31928. function XRef(stream, pdfManager) {
  31929. this.stream = stream;
  31930. this.pdfManager = pdfManager;
  31931. this.entries = [];
  31932. this.xrefstms = Object.create(null);
  31933. this.cache = [];
  31934. this.stats = {
  31935. streamTypes: [],
  31936. fontTypes: []
  31937. };
  31938. }
  31939. XRef.prototype = {
  31940. setStartXRef: function XRef_setStartXRef(startXRef) {
  31941. this.startXRefQueue = [startXRef];
  31942. },
  31943. parse: function XRef_parse(recoveryMode) {
  31944. var trailerDict;
  31945. if (!recoveryMode) {
  31946. trailerDict = this.readXRef();
  31947. } else {
  31948. warn('Indexing all PDF objects');
  31949. trailerDict = this.indexObjects();
  31950. }
  31951. trailerDict.assignXref(this);
  31952. this.trailer = trailerDict;
  31953. var encrypt = trailerDict.get('Encrypt');
  31954. if (isDict(encrypt)) {
  31955. var ids = trailerDict.get('ID');
  31956. var fileId = ids && ids.length ? ids[0] : '';
  31957. encrypt.suppressEncryption = true;
  31958. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31959. }
  31960. if (!(this.root = trailerDict.get('Root'))) {
  31961. error('Invalid root reference');
  31962. }
  31963. },
  31964. processXRefTable: function XRef_processXRefTable(parser) {
  31965. if (!('tableState' in this)) {
  31966. this.tableState = {
  31967. entryNum: 0,
  31968. streamPos: parser.lexer.stream.pos,
  31969. parserBuf1: parser.buf1,
  31970. parserBuf2: parser.buf2
  31971. };
  31972. }
  31973. var obj = this.readXRefTable(parser);
  31974. if (!isCmd(obj, 'trailer')) {
  31975. error('Invalid XRef table: could not find trailer dictionary');
  31976. }
  31977. var dict = parser.getObj();
  31978. if (!isDict(dict) && dict.dict) {
  31979. dict = dict.dict;
  31980. }
  31981. if (!isDict(dict)) {
  31982. error('Invalid XRef table: could not parse trailer dictionary');
  31983. }
  31984. delete this.tableState;
  31985. return dict;
  31986. },
  31987. readXRefTable: function XRef_readXRefTable(parser) {
  31988. var stream = parser.lexer.stream;
  31989. var tableState = this.tableState;
  31990. stream.pos = tableState.streamPos;
  31991. parser.buf1 = tableState.parserBuf1;
  31992. parser.buf2 = tableState.parserBuf2;
  31993. var obj;
  31994. while (true) {
  31995. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  31996. if (isCmd(obj = parser.getObj(), 'trailer')) {
  31997. break;
  31998. }
  31999. tableState.firstEntryNum = obj;
  32000. tableState.entryCount = parser.getObj();
  32001. }
  32002. var first = tableState.firstEntryNum;
  32003. var count = tableState.entryCount;
  32004. if (!isInt(first) || !isInt(count)) {
  32005. error('Invalid XRef table: wrong types in subsection header');
  32006. }
  32007. for (var i = tableState.entryNum; i < count; i++) {
  32008. tableState.streamPos = stream.pos;
  32009. tableState.entryNum = i;
  32010. tableState.parserBuf1 = parser.buf1;
  32011. tableState.parserBuf2 = parser.buf2;
  32012. var entry = {};
  32013. entry.offset = parser.getObj();
  32014. entry.gen = parser.getObj();
  32015. var type = parser.getObj();
  32016. if (isCmd(type, 'f')) {
  32017. entry.free = true;
  32018. } else if (isCmd(type, 'n')) {
  32019. entry.uncompressed = true;
  32020. }
  32021. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  32022. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  32023. }
  32024. if (i === 0 && entry.free && first === 1) {
  32025. first = 0;
  32026. }
  32027. if (!this.entries[i + first]) {
  32028. this.entries[i + first] = entry;
  32029. }
  32030. }
  32031. tableState.entryNum = 0;
  32032. tableState.streamPos = stream.pos;
  32033. tableState.parserBuf1 = parser.buf1;
  32034. tableState.parserBuf2 = parser.buf2;
  32035. delete tableState.firstEntryNum;
  32036. delete tableState.entryCount;
  32037. }
  32038. if (this.entries[0] && !this.entries[0].free) {
  32039. error('Invalid XRef table: unexpected first object');
  32040. }
  32041. return obj;
  32042. },
  32043. processXRefStream: function XRef_processXRefStream(stream) {
  32044. if (!('streamState' in this)) {
  32045. var streamParameters = stream.dict;
  32046. var byteWidths = streamParameters.get('W');
  32047. var range = streamParameters.get('Index');
  32048. if (!range) {
  32049. range = [
  32050. 0,
  32051. streamParameters.get('Size')
  32052. ];
  32053. }
  32054. this.streamState = {
  32055. entryRanges: range,
  32056. byteWidths: byteWidths,
  32057. entryNum: 0,
  32058. streamPos: stream.pos
  32059. };
  32060. }
  32061. this.readXRefStream(stream);
  32062. delete this.streamState;
  32063. return stream.dict;
  32064. },
  32065. readXRefStream: function XRef_readXRefStream(stream) {
  32066. var i, j;
  32067. var streamState = this.streamState;
  32068. stream.pos = streamState.streamPos;
  32069. var byteWidths = streamState.byteWidths;
  32070. var typeFieldWidth = byteWidths[0];
  32071. var offsetFieldWidth = byteWidths[1];
  32072. var generationFieldWidth = byteWidths[2];
  32073. var entryRanges = streamState.entryRanges;
  32074. while (entryRanges.length > 0) {
  32075. var first = entryRanges[0];
  32076. var n = entryRanges[1];
  32077. if (!isInt(first) || !isInt(n)) {
  32078. error('Invalid XRef range fields: ' + first + ', ' + n);
  32079. }
  32080. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  32081. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  32082. }
  32083. for (i = streamState.entryNum; i < n; ++i) {
  32084. streamState.entryNum = i;
  32085. streamState.streamPos = stream.pos;
  32086. var type = 0, offset = 0, generation = 0;
  32087. for (j = 0; j < typeFieldWidth; ++j) {
  32088. type = type << 8 | stream.getByte();
  32089. }
  32090. if (typeFieldWidth === 0) {
  32091. type = 1;
  32092. }
  32093. for (j = 0; j < offsetFieldWidth; ++j) {
  32094. offset = offset << 8 | stream.getByte();
  32095. }
  32096. for (j = 0; j < generationFieldWidth; ++j) {
  32097. generation = generation << 8 | stream.getByte();
  32098. }
  32099. var entry = {};
  32100. entry.offset = offset;
  32101. entry.gen = generation;
  32102. switch (type) {
  32103. case 0:
  32104. entry.free = true;
  32105. break;
  32106. case 1:
  32107. entry.uncompressed = true;
  32108. break;
  32109. case 2:
  32110. break;
  32111. default:
  32112. error('Invalid XRef entry type: ' + type);
  32113. }
  32114. if (!this.entries[first + i]) {
  32115. this.entries[first + i] = entry;
  32116. }
  32117. }
  32118. streamState.entryNum = 0;
  32119. streamState.streamPos = stream.pos;
  32120. entryRanges.splice(0, 2);
  32121. }
  32122. },
  32123. indexObjects: function XRef_indexObjects() {
  32124. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  32125. var PERCENT = 0x25, LT = 0x3C;
  32126. function readToken(data, offset) {
  32127. var token = '', ch = data[offset];
  32128. while (ch !== LF && ch !== CR && ch !== LT) {
  32129. if (++offset >= data.length) {
  32130. break;
  32131. }
  32132. token += String.fromCharCode(ch);
  32133. ch = data[offset];
  32134. }
  32135. return token;
  32136. }
  32137. function skipUntil(data, offset, what) {
  32138. var length = what.length, dataLength = data.length;
  32139. var skipped = 0;
  32140. while (offset < dataLength) {
  32141. var i = 0;
  32142. while (i < length && data[offset + i] === what[i]) {
  32143. ++i;
  32144. }
  32145. if (i >= length) {
  32146. break;
  32147. }
  32148. offset++;
  32149. skipped++;
  32150. }
  32151. return skipped;
  32152. }
  32153. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  32154. var trailerBytes = new Uint8Array([
  32155. 116,
  32156. 114,
  32157. 97,
  32158. 105,
  32159. 108,
  32160. 101,
  32161. 114
  32162. ]);
  32163. var startxrefBytes = new Uint8Array([
  32164. 115,
  32165. 116,
  32166. 97,
  32167. 114,
  32168. 116,
  32169. 120,
  32170. 114,
  32171. 101,
  32172. 102
  32173. ]);
  32174. var endobjBytes = new Uint8Array([
  32175. 101,
  32176. 110,
  32177. 100,
  32178. 111,
  32179. 98,
  32180. 106
  32181. ]);
  32182. var xrefBytes = new Uint8Array([
  32183. 47,
  32184. 88,
  32185. 82,
  32186. 101,
  32187. 102
  32188. ]);
  32189. this.entries.length = 0;
  32190. var stream = this.stream;
  32191. stream.pos = 0;
  32192. var buffer = stream.getBytes();
  32193. var position = stream.start, length = buffer.length;
  32194. var trailers = [], xrefStms = [];
  32195. while (position < length) {
  32196. var ch = buffer[position];
  32197. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  32198. ++position;
  32199. continue;
  32200. }
  32201. if (ch === PERCENT) {
  32202. do {
  32203. ++position;
  32204. if (position >= length) {
  32205. break;
  32206. }
  32207. ch = buffer[position];
  32208. } while (ch !== LF && ch !== CR);
  32209. continue;
  32210. }
  32211. var token = readToken(buffer, position);
  32212. var m;
  32213. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  32214. position += skipUntil(buffer, position, trailerBytes);
  32215. trailers.push(position);
  32216. position += skipUntil(buffer, position, startxrefBytes);
  32217. } else if (m = objRegExp.exec(token)) {
  32218. if (typeof this.entries[m[1]] === 'undefined') {
  32219. this.entries[m[1]] = {
  32220. offset: position - stream.start,
  32221. gen: m[2] | 0,
  32222. uncompressed: true
  32223. };
  32224. }
  32225. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  32226. var content = buffer.subarray(position, position + contentLength);
  32227. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  32228. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  32229. xrefStms.push(position - stream.start);
  32230. this.xrefstms[position - stream.start] = 1;
  32231. }
  32232. position += contentLength;
  32233. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  32234. trailers.push(position);
  32235. position += skipUntil(buffer, position, startxrefBytes);
  32236. } else {
  32237. position += token.length + 1;
  32238. }
  32239. }
  32240. var i, ii;
  32241. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  32242. this.startXRefQueue.push(xrefStms[i]);
  32243. this.readXRef(true);
  32244. }
  32245. var dict;
  32246. for (i = 0, ii = trailers.length; i < ii; ++i) {
  32247. stream.pos = trailers[i];
  32248. var parser = new Parser(new Lexer(stream), true, this, true);
  32249. var obj = parser.getObj();
  32250. if (!isCmd(obj, 'trailer')) {
  32251. continue;
  32252. }
  32253. dict = parser.getObj();
  32254. if (!isDict(dict)) {
  32255. continue;
  32256. }
  32257. if (dict.has('ID')) {
  32258. return dict;
  32259. }
  32260. }
  32261. if (dict) {
  32262. return dict;
  32263. }
  32264. throw new InvalidPDFException('Invalid PDF structure');
  32265. },
  32266. readXRef: function XRef_readXRef(recoveryMode) {
  32267. var stream = this.stream;
  32268. try {
  32269. while (this.startXRefQueue.length) {
  32270. var startXRef = this.startXRefQueue[0];
  32271. stream.pos = startXRef + stream.start;
  32272. var parser = new Parser(new Lexer(stream), true, this);
  32273. var obj = parser.getObj();
  32274. var dict;
  32275. if (isCmd(obj, 'xref')) {
  32276. dict = this.processXRefTable(parser);
  32277. if (!this.topDict) {
  32278. this.topDict = dict;
  32279. }
  32280. obj = dict.get('XRefStm');
  32281. if (isInt(obj)) {
  32282. var pos = obj;
  32283. if (!(pos in this.xrefstms)) {
  32284. this.xrefstms[pos] = 1;
  32285. this.startXRefQueue.push(pos);
  32286. }
  32287. }
  32288. } else if (isInt(obj)) {
  32289. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  32290. error('Invalid XRef stream');
  32291. }
  32292. dict = this.processXRefStream(obj);
  32293. if (!this.topDict) {
  32294. this.topDict = dict;
  32295. }
  32296. if (!dict) {
  32297. error('Failed to read XRef stream');
  32298. }
  32299. } else {
  32300. error('Invalid XRef stream header');
  32301. }
  32302. obj = dict.get('Prev');
  32303. if (isInt(obj)) {
  32304. this.startXRefQueue.push(obj);
  32305. } else if (isRef(obj)) {
  32306. this.startXRefQueue.push(obj.num);
  32307. }
  32308. this.startXRefQueue.shift();
  32309. }
  32310. return this.topDict;
  32311. } catch (e) {
  32312. if (e instanceof MissingDataException) {
  32313. throw e;
  32314. }
  32315. info('(while reading XRef): ' + e);
  32316. }
  32317. if (recoveryMode) {
  32318. return;
  32319. }
  32320. throw new XRefParseException();
  32321. },
  32322. getEntry: function XRef_getEntry(i) {
  32323. var xrefEntry = this.entries[i];
  32324. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  32325. return xrefEntry;
  32326. }
  32327. return null;
  32328. },
  32329. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  32330. if (!isRef(obj)) {
  32331. return obj;
  32332. }
  32333. return this.fetch(obj, suppressEncryption);
  32334. },
  32335. fetch: function XRef_fetch(ref, suppressEncryption) {
  32336. assert(isRef(ref), 'ref object is not a reference');
  32337. var num = ref.num;
  32338. if (num in this.cache) {
  32339. var cacheEntry = this.cache[num];
  32340. return cacheEntry;
  32341. }
  32342. var xrefEntry = this.getEntry(num);
  32343. if (xrefEntry === null) {
  32344. return this.cache[num] = null;
  32345. }
  32346. if (xrefEntry.uncompressed) {
  32347. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  32348. } else {
  32349. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  32350. }
  32351. if (isDict(xrefEntry)) {
  32352. xrefEntry.objId = ref.toString();
  32353. } else if (isStream(xrefEntry)) {
  32354. xrefEntry.dict.objId = ref.toString();
  32355. }
  32356. return xrefEntry;
  32357. },
  32358. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  32359. var gen = ref.gen;
  32360. var num = ref.num;
  32361. if (xrefEntry.gen !== gen) {
  32362. error('inconsistent generation in XRef');
  32363. }
  32364. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  32365. var parser = new Parser(new Lexer(stream), true, this);
  32366. var obj1 = parser.getObj();
  32367. var obj2 = parser.getObj();
  32368. var obj3 = parser.getObj();
  32369. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  32370. error('bad XRef entry');
  32371. }
  32372. if (!isCmd(obj3, 'obj')) {
  32373. if (obj3.cmd.indexOf('obj') === 0) {
  32374. num = parseInt(obj3.cmd.substring(3), 10);
  32375. if (!isNaN(num)) {
  32376. return num;
  32377. }
  32378. }
  32379. error('bad XRef entry');
  32380. }
  32381. if (this.encrypt && !suppressEncryption) {
  32382. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  32383. } else {
  32384. xrefEntry = parser.getObj();
  32385. }
  32386. if (!isStream(xrefEntry)) {
  32387. this.cache[num] = xrefEntry;
  32388. }
  32389. return xrefEntry;
  32390. },
  32391. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  32392. var tableOffset = xrefEntry.offset;
  32393. var stream = this.fetch(new Ref(tableOffset, 0));
  32394. if (!isStream(stream)) {
  32395. error('bad ObjStm stream');
  32396. }
  32397. var first = stream.dict.get('First');
  32398. var n = stream.dict.get('N');
  32399. if (!isInt(first) || !isInt(n)) {
  32400. error('invalid first and n parameters for ObjStm stream');
  32401. }
  32402. var parser = new Parser(new Lexer(stream), false, this);
  32403. parser.allowStreams = true;
  32404. var i, entries = [], num, nums = [];
  32405. for (i = 0; i < n; ++i) {
  32406. num = parser.getObj();
  32407. if (!isInt(num)) {
  32408. error('invalid object number in the ObjStm stream: ' + num);
  32409. }
  32410. nums.push(num);
  32411. var offset = parser.getObj();
  32412. if (!isInt(offset)) {
  32413. error('invalid object offset in the ObjStm stream: ' + offset);
  32414. }
  32415. }
  32416. for (i = 0; i < n; ++i) {
  32417. entries.push(parser.getObj());
  32418. if (isCmd(parser.buf1, 'endobj')) {
  32419. parser.shift();
  32420. }
  32421. num = nums[i];
  32422. var entry = this.entries[num];
  32423. if (entry && entry.offset === tableOffset && entry.gen === i) {
  32424. this.cache[num] = entries[i];
  32425. }
  32426. }
  32427. xrefEntry = entries[xrefEntry.gen];
  32428. if (xrefEntry === undefined) {
  32429. error('bad XRef entry for compressed object');
  32430. }
  32431. return xrefEntry;
  32432. },
  32433. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  32434. if (!isRef(obj)) {
  32435. return Promise.resolve(obj);
  32436. }
  32437. return this.fetchAsync(obj, suppressEncryption);
  32438. },
  32439. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  32440. var streamManager = this.stream.manager;
  32441. var xref = this;
  32442. return new Promise(function tryFetch(resolve, reject) {
  32443. try {
  32444. resolve(xref.fetch(ref, suppressEncryption));
  32445. } catch (e) {
  32446. if (e instanceof MissingDataException) {
  32447. streamManager.requestRange(e.begin, e.end).then(function () {
  32448. tryFetch(resolve, reject);
  32449. }, reject);
  32450. return;
  32451. }
  32452. reject(e);
  32453. }
  32454. });
  32455. },
  32456. getCatalogObj: function XRef_getCatalogObj() {
  32457. return this.root;
  32458. }
  32459. };
  32460. return XRef;
  32461. }();
  32462. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  32463. function NameOrNumberTree(root, xref) {
  32464. throw new Error('Cannot initialize NameOrNumberTree.');
  32465. }
  32466. NameOrNumberTree.prototype = {
  32467. getAll: function NameOrNumberTree_getAll() {
  32468. var dict = Object.create(null);
  32469. if (!this.root) {
  32470. return dict;
  32471. }
  32472. var xref = this.xref;
  32473. var processed = new RefSet();
  32474. processed.put(this.root);
  32475. var queue = [this.root];
  32476. while (queue.length > 0) {
  32477. var i, n;
  32478. var obj = xref.fetchIfRef(queue.shift());
  32479. if (!isDict(obj)) {
  32480. continue;
  32481. }
  32482. if (obj.has('Kids')) {
  32483. var kids = obj.get('Kids');
  32484. for (i = 0, n = kids.length; i < n; i++) {
  32485. var kid = kids[i];
  32486. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  32487. queue.push(kid);
  32488. processed.put(kid);
  32489. }
  32490. continue;
  32491. }
  32492. var entries = obj.get(this._type);
  32493. if (isArray(entries)) {
  32494. for (i = 0, n = entries.length; i < n; i += 2) {
  32495. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  32496. }
  32497. }
  32498. }
  32499. return dict;
  32500. },
  32501. get: function NameOrNumberTree_get(key) {
  32502. if (!this.root) {
  32503. return null;
  32504. }
  32505. var xref = this.xref;
  32506. var kidsOrEntries = xref.fetchIfRef(this.root);
  32507. var loopCount = 0;
  32508. var MAX_LEVELS = 10;
  32509. var l, r, m;
  32510. while (kidsOrEntries.has('Kids')) {
  32511. if (++loopCount > MAX_LEVELS) {
  32512. warn('Search depth limit reached for "' + this._type + '" tree.');
  32513. return null;
  32514. }
  32515. var kids = kidsOrEntries.get('Kids');
  32516. if (!isArray(kids)) {
  32517. return null;
  32518. }
  32519. l = 0;
  32520. r = kids.length - 1;
  32521. while (l <= r) {
  32522. m = l + r >> 1;
  32523. var kid = xref.fetchIfRef(kids[m]);
  32524. var limits = kid.get('Limits');
  32525. if (key < xref.fetchIfRef(limits[0])) {
  32526. r = m - 1;
  32527. } else if (key > xref.fetchIfRef(limits[1])) {
  32528. l = m + 1;
  32529. } else {
  32530. kidsOrEntries = xref.fetchIfRef(kids[m]);
  32531. break;
  32532. }
  32533. }
  32534. if (l > r) {
  32535. return null;
  32536. }
  32537. }
  32538. var entries = kidsOrEntries.get(this._type);
  32539. if (isArray(entries)) {
  32540. l = 0;
  32541. r = entries.length - 2;
  32542. while (l <= r) {
  32543. m = l + r & ~1;
  32544. var currentKey = xref.fetchIfRef(entries[m]);
  32545. if (key < currentKey) {
  32546. r = m - 2;
  32547. } else if (key > currentKey) {
  32548. l = m + 2;
  32549. } else {
  32550. return xref.fetchIfRef(entries[m + 1]);
  32551. }
  32552. }
  32553. }
  32554. return null;
  32555. }
  32556. };
  32557. return NameOrNumberTree;
  32558. }();
  32559. var NameTree = function NameTreeClosure() {
  32560. function NameTree(root, xref) {
  32561. this.root = root;
  32562. this.xref = xref;
  32563. this._type = 'Names';
  32564. }
  32565. Util.inherit(NameTree, NameOrNumberTree, {});
  32566. return NameTree;
  32567. }();
  32568. var NumberTree = function NumberTreeClosure() {
  32569. function NumberTree(root, xref) {
  32570. this.root = root;
  32571. this.xref = xref;
  32572. this._type = 'Nums';
  32573. }
  32574. Util.inherit(NumberTree, NameOrNumberTree, {});
  32575. return NumberTree;
  32576. }();
  32577. var FileSpec = function FileSpecClosure() {
  32578. function FileSpec(root, xref) {
  32579. if (!root || !isDict(root)) {
  32580. return;
  32581. }
  32582. this.xref = xref;
  32583. this.root = root;
  32584. if (root.has('FS')) {
  32585. this.fs = root.get('FS');
  32586. }
  32587. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  32588. if (root.has('RF')) {
  32589. warn('Related file specifications are not supported');
  32590. }
  32591. this.contentAvailable = true;
  32592. if (!root.has('EF')) {
  32593. this.contentAvailable = false;
  32594. warn('Non-embedded file specifications are not supported');
  32595. }
  32596. }
  32597. function pickPlatformItem(dict) {
  32598. if (dict.has('UF')) {
  32599. return dict.get('UF');
  32600. } else if (dict.has('F')) {
  32601. return dict.get('F');
  32602. } else if (dict.has('Unix')) {
  32603. return dict.get('Unix');
  32604. } else if (dict.has('Mac')) {
  32605. return dict.get('Mac');
  32606. } else if (dict.has('DOS')) {
  32607. return dict.get('DOS');
  32608. }
  32609. return null;
  32610. }
  32611. FileSpec.prototype = {
  32612. get filename() {
  32613. if (!this._filename && this.root) {
  32614. var filename = pickPlatformItem(this.root) || 'unnamed';
  32615. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  32616. }
  32617. return this._filename;
  32618. },
  32619. get content() {
  32620. if (!this.contentAvailable) {
  32621. return null;
  32622. }
  32623. if (!this.contentRef && this.root) {
  32624. this.contentRef = pickPlatformItem(this.root.get('EF'));
  32625. }
  32626. var content = null;
  32627. if (this.contentRef) {
  32628. var xref = this.xref;
  32629. var fileObj = xref.fetchIfRef(this.contentRef);
  32630. if (fileObj && isStream(fileObj)) {
  32631. content = fileObj.getBytes();
  32632. } else {
  32633. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  32634. }
  32635. } else {
  32636. warn('Embedded file specification does not have a content');
  32637. }
  32638. return content;
  32639. },
  32640. get serializable() {
  32641. return {
  32642. filename: this.filename,
  32643. content: this.content
  32644. };
  32645. }
  32646. };
  32647. return FileSpec;
  32648. }();
  32649. var ObjectLoader = function () {
  32650. function mayHaveChildren(value) {
  32651. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  32652. }
  32653. function addChildren(node, nodesToVisit) {
  32654. var value;
  32655. if (isDict(node) || isStream(node)) {
  32656. var map;
  32657. if (isDict(node)) {
  32658. map = node.map;
  32659. } else {
  32660. map = node.dict.map;
  32661. }
  32662. for (var key in map) {
  32663. value = map[key];
  32664. if (mayHaveChildren(value)) {
  32665. nodesToVisit.push(value);
  32666. }
  32667. }
  32668. } else if (isArray(node)) {
  32669. for (var i = 0, ii = node.length; i < ii; i++) {
  32670. value = node[i];
  32671. if (mayHaveChildren(value)) {
  32672. nodesToVisit.push(value);
  32673. }
  32674. }
  32675. }
  32676. }
  32677. function ObjectLoader(obj, keys, xref) {
  32678. this.obj = obj;
  32679. this.keys = keys;
  32680. this.xref = xref;
  32681. this.refSet = null;
  32682. this.capability = null;
  32683. }
  32684. ObjectLoader.prototype = {
  32685. load: function ObjectLoader_load() {
  32686. var keys = this.keys;
  32687. this.capability = createPromiseCapability();
  32688. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  32689. this.capability.resolve();
  32690. return this.capability.promise;
  32691. }
  32692. this.refSet = new RefSet();
  32693. var nodesToVisit = [];
  32694. for (var i = 0; i < keys.length; i++) {
  32695. nodesToVisit.push(this.obj[keys[i]]);
  32696. }
  32697. this._walk(nodesToVisit);
  32698. return this.capability.promise;
  32699. },
  32700. _walk: function ObjectLoader_walk(nodesToVisit) {
  32701. var nodesToRevisit = [];
  32702. var pendingRequests = [];
  32703. while (nodesToVisit.length) {
  32704. var currentNode = nodesToVisit.pop();
  32705. if (isRef(currentNode)) {
  32706. if (this.refSet.has(currentNode)) {
  32707. continue;
  32708. }
  32709. try {
  32710. var ref = currentNode;
  32711. this.refSet.put(ref);
  32712. currentNode = this.xref.fetch(currentNode);
  32713. } catch (e) {
  32714. if (!(e instanceof MissingDataException)) {
  32715. throw e;
  32716. }
  32717. nodesToRevisit.push(currentNode);
  32718. pendingRequests.push({
  32719. begin: e.begin,
  32720. end: e.end
  32721. });
  32722. }
  32723. }
  32724. if (currentNode && currentNode.getBaseStreams) {
  32725. var baseStreams = currentNode.getBaseStreams();
  32726. var foundMissingData = false;
  32727. for (var i = 0; i < baseStreams.length; i++) {
  32728. var stream = baseStreams[i];
  32729. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  32730. foundMissingData = true;
  32731. pendingRequests.push({
  32732. begin: stream.start,
  32733. end: stream.end
  32734. });
  32735. }
  32736. }
  32737. if (foundMissingData) {
  32738. nodesToRevisit.push(currentNode);
  32739. }
  32740. }
  32741. addChildren(currentNode, nodesToVisit);
  32742. }
  32743. if (pendingRequests.length) {
  32744. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  32745. nodesToVisit = nodesToRevisit;
  32746. for (var i = 0; i < nodesToRevisit.length; i++) {
  32747. var node = nodesToRevisit[i];
  32748. if (isRef(node)) {
  32749. this.refSet.remove(node);
  32750. }
  32751. }
  32752. this._walk(nodesToVisit);
  32753. }.bind(this), this.capability.reject);
  32754. return;
  32755. }
  32756. this.refSet = null;
  32757. this.capability.resolve();
  32758. }
  32759. };
  32760. return ObjectLoader;
  32761. }();
  32762. exports.Catalog = Catalog;
  32763. exports.ObjectLoader = ObjectLoader;
  32764. exports.XRef = XRef;
  32765. exports.FileSpec = FileSpec;
  32766. /***/ }),
  32767. /* 16 */
  32768. /***/ (function(module, exports, __w_pdfjs_require__) {
  32769. "use strict";
  32770. var sharedUtil = __w_pdfjs_require__(0);
  32771. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32772. var getStdFontMap = getLookupTableFactory(function (t) {
  32773. t['ArialNarrow'] = 'Helvetica';
  32774. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  32775. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  32776. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  32777. t['ArialBlack'] = 'Helvetica';
  32778. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  32779. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  32780. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  32781. t['Arial-Black'] = 'Helvetica';
  32782. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  32783. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  32784. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  32785. t['Arial'] = 'Helvetica';
  32786. t['Arial-Bold'] = 'Helvetica-Bold';
  32787. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  32788. t['Arial-Italic'] = 'Helvetica-Oblique';
  32789. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  32790. t['Arial-BoldMT'] = 'Helvetica-Bold';
  32791. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  32792. t['ArialMT'] = 'Helvetica';
  32793. t['Courier-Bold'] = 'Courier-Bold';
  32794. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  32795. t['Courier-Italic'] = 'Courier-Oblique';
  32796. t['CourierNew'] = 'Courier';
  32797. t['CourierNew-Bold'] = 'Courier-Bold';
  32798. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  32799. t['CourierNew-Italic'] = 'Courier-Oblique';
  32800. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  32801. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  32802. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  32803. t['CourierNewPSMT'] = 'Courier';
  32804. t['Helvetica'] = 'Helvetica';
  32805. t['Helvetica-Bold'] = 'Helvetica-Bold';
  32806. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  32807. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32808. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32809. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32810. t['Symbol-Bold'] = 'Symbol';
  32811. t['Symbol-BoldItalic'] = 'Symbol';
  32812. t['Symbol-Italic'] = 'Symbol';
  32813. t['TimesNewRoman'] = 'Times-Roman';
  32814. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32815. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32816. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32817. t['TimesNewRomanPS'] = 'Times-Roman';
  32818. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32819. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32820. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32821. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32822. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32823. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32824. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32825. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32826. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32827. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32828. });
  32829. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32830. t['CenturyGothic'] = 'Helvetica';
  32831. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32832. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32833. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32834. t['ComicSansMS'] = 'Comic Sans MS';
  32835. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32836. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32837. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32838. t['LucidaConsole'] = 'Courier';
  32839. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32840. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32841. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32842. t['MS-Gothic'] = 'MS Gothic';
  32843. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32844. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32845. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32846. t['MS-Mincho'] = 'MS Mincho';
  32847. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32848. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32849. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32850. t['MS-PGothic'] = 'MS PGothic';
  32851. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32852. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32853. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32854. t['MS-PMincho'] = 'MS PMincho';
  32855. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32856. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32857. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32858. t['NuptialScript'] = 'Times-Italic';
  32859. t['Wingdings'] = 'ZapfDingbats';
  32860. });
  32861. var getSerifFonts = getLookupTableFactory(function (t) {
  32862. t['Adobe Jenson'] = true;
  32863. t['Adobe Text'] = true;
  32864. t['Albertus'] = true;
  32865. t['Aldus'] = true;
  32866. t['Alexandria'] = true;
  32867. t['Algerian'] = true;
  32868. t['American Typewriter'] = true;
  32869. t['Antiqua'] = true;
  32870. t['Apex'] = true;
  32871. t['Arno'] = true;
  32872. t['Aster'] = true;
  32873. t['Aurora'] = true;
  32874. t['Baskerville'] = true;
  32875. t['Bell'] = true;
  32876. t['Bembo'] = true;
  32877. t['Bembo Schoolbook'] = true;
  32878. t['Benguiat'] = true;
  32879. t['Berkeley Old Style'] = true;
  32880. t['Bernhard Modern'] = true;
  32881. t['Berthold City'] = true;
  32882. t['Bodoni'] = true;
  32883. t['Bauer Bodoni'] = true;
  32884. t['Book Antiqua'] = true;
  32885. t['Bookman'] = true;
  32886. t['Bordeaux Roman'] = true;
  32887. t['Californian FB'] = true;
  32888. t['Calisto'] = true;
  32889. t['Calvert'] = true;
  32890. t['Capitals'] = true;
  32891. t['Cambria'] = true;
  32892. t['Cartier'] = true;
  32893. t['Caslon'] = true;
  32894. t['Catull'] = true;
  32895. t['Centaur'] = true;
  32896. t['Century Old Style'] = true;
  32897. t['Century Schoolbook'] = true;
  32898. t['Chaparral'] = true;
  32899. t['Charis SIL'] = true;
  32900. t['Cheltenham'] = true;
  32901. t['Cholla Slab'] = true;
  32902. t['Clarendon'] = true;
  32903. t['Clearface'] = true;
  32904. t['Cochin'] = true;
  32905. t['Colonna'] = true;
  32906. t['Computer Modern'] = true;
  32907. t['Concrete Roman'] = true;
  32908. t['Constantia'] = true;
  32909. t['Cooper Black'] = true;
  32910. t['Corona'] = true;
  32911. t['Ecotype'] = true;
  32912. t['Egyptienne'] = true;
  32913. t['Elephant'] = true;
  32914. t['Excelsior'] = true;
  32915. t['Fairfield'] = true;
  32916. t['FF Scala'] = true;
  32917. t['Folkard'] = true;
  32918. t['Footlight'] = true;
  32919. t['FreeSerif'] = true;
  32920. t['Friz Quadrata'] = true;
  32921. t['Garamond'] = true;
  32922. t['Gentium'] = true;
  32923. t['Georgia'] = true;
  32924. t['Gloucester'] = true;
  32925. t['Goudy Old Style'] = true;
  32926. t['Goudy Schoolbook'] = true;
  32927. t['Goudy Pro Font'] = true;
  32928. t['Granjon'] = true;
  32929. t['Guardian Egyptian'] = true;
  32930. t['Heather'] = true;
  32931. t['Hercules'] = true;
  32932. t['High Tower Text'] = true;
  32933. t['Hiroshige'] = true;
  32934. t['Hoefler Text'] = true;
  32935. t['Humana Serif'] = true;
  32936. t['Imprint'] = true;
  32937. t['Ionic No. 5'] = true;
  32938. t['Janson'] = true;
  32939. t['Joanna'] = true;
  32940. t['Korinna'] = true;
  32941. t['Lexicon'] = true;
  32942. t['Liberation Serif'] = true;
  32943. t['Linux Libertine'] = true;
  32944. t['Literaturnaya'] = true;
  32945. t['Lucida'] = true;
  32946. t['Lucida Bright'] = true;
  32947. t['Melior'] = true;
  32948. t['Memphis'] = true;
  32949. t['Miller'] = true;
  32950. t['Minion'] = true;
  32951. t['Modern'] = true;
  32952. t['Mona Lisa'] = true;
  32953. t['Mrs Eaves'] = true;
  32954. t['MS Serif'] = true;
  32955. t['Museo Slab'] = true;
  32956. t['New York'] = true;
  32957. t['Nimbus Roman'] = true;
  32958. t['NPS Rawlinson Roadway'] = true;
  32959. t['NuptialScript'] = true;
  32960. t['Palatino'] = true;
  32961. t['Perpetua'] = true;
  32962. t['Plantin'] = true;
  32963. t['Plantin Schoolbook'] = true;
  32964. t['Playbill'] = true;
  32965. t['Poor Richard'] = true;
  32966. t['Rawlinson Roadway'] = true;
  32967. t['Renault'] = true;
  32968. t['Requiem'] = true;
  32969. t['Rockwell'] = true;
  32970. t['Roman'] = true;
  32971. t['Rotis Serif'] = true;
  32972. t['Sabon'] = true;
  32973. t['Scala'] = true;
  32974. t['Seagull'] = true;
  32975. t['Sistina'] = true;
  32976. t['Souvenir'] = true;
  32977. t['STIX'] = true;
  32978. t['Stone Informal'] = true;
  32979. t['Stone Serif'] = true;
  32980. t['Sylfaen'] = true;
  32981. t['Times'] = true;
  32982. t['Trajan'] = true;
  32983. t['Trinité'] = true;
  32984. t['Trump Mediaeval'] = true;
  32985. t['Utopia'] = true;
  32986. t['Vale Type'] = true;
  32987. t['Bitstream Vera'] = true;
  32988. t['Vera Serif'] = true;
  32989. t['Versailles'] = true;
  32990. t['Wanted'] = true;
  32991. t['Weiss'] = true;
  32992. t['Wide Latin'] = true;
  32993. t['Windsor'] = true;
  32994. t['XITS'] = true;
  32995. });
  32996. var getSymbolsFonts = getLookupTableFactory(function (t) {
  32997. t['Dingbats'] = true;
  32998. t['Symbol'] = true;
  32999. t['ZapfDingbats'] = true;
  33000. });
  33001. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  33002. t[2] = 10;
  33003. t[3] = 32;
  33004. t[4] = 33;
  33005. t[5] = 34;
  33006. t[6] = 35;
  33007. t[7] = 36;
  33008. t[8] = 37;
  33009. t[9] = 38;
  33010. t[10] = 39;
  33011. t[11] = 40;
  33012. t[12] = 41;
  33013. t[13] = 42;
  33014. t[14] = 43;
  33015. t[15] = 44;
  33016. t[16] = 45;
  33017. t[17] = 46;
  33018. t[18] = 47;
  33019. t[19] = 48;
  33020. t[20] = 49;
  33021. t[21] = 50;
  33022. t[22] = 51;
  33023. t[23] = 52;
  33024. t[24] = 53;
  33025. t[25] = 54;
  33026. t[26] = 55;
  33027. t[27] = 56;
  33028. t[28] = 57;
  33029. t[29] = 58;
  33030. t[30] = 894;
  33031. t[31] = 60;
  33032. t[32] = 61;
  33033. t[33] = 62;
  33034. t[34] = 63;
  33035. t[35] = 64;
  33036. t[36] = 65;
  33037. t[37] = 66;
  33038. t[38] = 67;
  33039. t[39] = 68;
  33040. t[40] = 69;
  33041. t[41] = 70;
  33042. t[42] = 71;
  33043. t[43] = 72;
  33044. t[44] = 73;
  33045. t[45] = 74;
  33046. t[46] = 75;
  33047. t[47] = 76;
  33048. t[48] = 77;
  33049. t[49] = 78;
  33050. t[50] = 79;
  33051. t[51] = 80;
  33052. t[52] = 81;
  33053. t[53] = 82;
  33054. t[54] = 83;
  33055. t[55] = 84;
  33056. t[56] = 85;
  33057. t[57] = 86;
  33058. t[58] = 87;
  33059. t[59] = 88;
  33060. t[60] = 89;
  33061. t[61] = 90;
  33062. t[62] = 91;
  33063. t[63] = 92;
  33064. t[64] = 93;
  33065. t[65] = 94;
  33066. t[66] = 95;
  33067. t[67] = 96;
  33068. t[68] = 97;
  33069. t[69] = 98;
  33070. t[70] = 99;
  33071. t[71] = 100;
  33072. t[72] = 101;
  33073. t[73] = 102;
  33074. t[74] = 103;
  33075. t[75] = 104;
  33076. t[76] = 105;
  33077. t[77] = 106;
  33078. t[78] = 107;
  33079. t[79] = 108;
  33080. t[80] = 109;
  33081. t[81] = 110;
  33082. t[82] = 111;
  33083. t[83] = 112;
  33084. t[84] = 113;
  33085. t[85] = 114;
  33086. t[86] = 115;
  33087. t[87] = 116;
  33088. t[88] = 117;
  33089. t[89] = 118;
  33090. t[90] = 119;
  33091. t[91] = 120;
  33092. t[92] = 121;
  33093. t[93] = 122;
  33094. t[94] = 123;
  33095. t[95] = 124;
  33096. t[96] = 125;
  33097. t[97] = 126;
  33098. t[98] = 196;
  33099. t[99] = 197;
  33100. t[100] = 199;
  33101. t[101] = 201;
  33102. t[102] = 209;
  33103. t[103] = 214;
  33104. t[104] = 220;
  33105. t[105] = 225;
  33106. t[106] = 224;
  33107. t[107] = 226;
  33108. t[108] = 228;
  33109. t[109] = 227;
  33110. t[110] = 229;
  33111. t[111] = 231;
  33112. t[112] = 233;
  33113. t[113] = 232;
  33114. t[114] = 234;
  33115. t[115] = 235;
  33116. t[116] = 237;
  33117. t[117] = 236;
  33118. t[118] = 238;
  33119. t[119] = 239;
  33120. t[120] = 241;
  33121. t[121] = 243;
  33122. t[122] = 242;
  33123. t[123] = 244;
  33124. t[124] = 246;
  33125. t[125] = 245;
  33126. t[126] = 250;
  33127. t[127] = 249;
  33128. t[128] = 251;
  33129. t[129] = 252;
  33130. t[130] = 8224;
  33131. t[131] = 176;
  33132. t[132] = 162;
  33133. t[133] = 163;
  33134. t[134] = 167;
  33135. t[135] = 8226;
  33136. t[136] = 182;
  33137. t[137] = 223;
  33138. t[138] = 174;
  33139. t[139] = 169;
  33140. t[140] = 8482;
  33141. t[141] = 180;
  33142. t[142] = 168;
  33143. t[143] = 8800;
  33144. t[144] = 198;
  33145. t[145] = 216;
  33146. t[146] = 8734;
  33147. t[147] = 177;
  33148. t[148] = 8804;
  33149. t[149] = 8805;
  33150. t[150] = 165;
  33151. t[151] = 181;
  33152. t[152] = 8706;
  33153. t[153] = 8721;
  33154. t[154] = 8719;
  33155. t[156] = 8747;
  33156. t[157] = 170;
  33157. t[158] = 186;
  33158. t[159] = 8486;
  33159. t[160] = 230;
  33160. t[161] = 248;
  33161. t[162] = 191;
  33162. t[163] = 161;
  33163. t[164] = 172;
  33164. t[165] = 8730;
  33165. t[166] = 402;
  33166. t[167] = 8776;
  33167. t[168] = 8710;
  33168. t[169] = 171;
  33169. t[170] = 187;
  33170. t[171] = 8230;
  33171. t[210] = 218;
  33172. t[223] = 711;
  33173. t[224] = 321;
  33174. t[225] = 322;
  33175. t[227] = 353;
  33176. t[229] = 382;
  33177. t[234] = 253;
  33178. t[252] = 263;
  33179. t[253] = 268;
  33180. t[254] = 269;
  33181. t[258] = 258;
  33182. t[260] = 260;
  33183. t[261] = 261;
  33184. t[265] = 280;
  33185. t[266] = 281;
  33186. t[268] = 283;
  33187. t[269] = 313;
  33188. t[275] = 323;
  33189. t[276] = 324;
  33190. t[278] = 328;
  33191. t[284] = 345;
  33192. t[285] = 346;
  33193. t[286] = 347;
  33194. t[292] = 367;
  33195. t[295] = 377;
  33196. t[296] = 378;
  33197. t[298] = 380;
  33198. t[305] = 963;
  33199. t[306] = 964;
  33200. t[307] = 966;
  33201. t[308] = 8215;
  33202. t[309] = 8252;
  33203. t[310] = 8319;
  33204. t[311] = 8359;
  33205. t[312] = 8592;
  33206. t[313] = 8593;
  33207. t[337] = 9552;
  33208. t[493] = 1039;
  33209. t[494] = 1040;
  33210. t[705] = 1524;
  33211. t[706] = 8362;
  33212. t[710] = 64288;
  33213. t[711] = 64298;
  33214. t[759] = 1617;
  33215. t[761] = 1776;
  33216. t[763] = 1778;
  33217. t[775] = 1652;
  33218. t[777] = 1764;
  33219. t[778] = 1780;
  33220. t[779] = 1781;
  33221. t[780] = 1782;
  33222. t[782] = 771;
  33223. t[783] = 64726;
  33224. t[786] = 8363;
  33225. t[788] = 8532;
  33226. t[790] = 768;
  33227. t[791] = 769;
  33228. t[792] = 768;
  33229. t[795] = 803;
  33230. t[797] = 64336;
  33231. t[798] = 64337;
  33232. t[799] = 64342;
  33233. t[800] = 64343;
  33234. t[801] = 64344;
  33235. t[802] = 64345;
  33236. t[803] = 64362;
  33237. t[804] = 64363;
  33238. t[805] = 64364;
  33239. t[2424] = 7821;
  33240. t[2425] = 7822;
  33241. t[2426] = 7823;
  33242. t[2427] = 7824;
  33243. t[2428] = 7825;
  33244. t[2429] = 7826;
  33245. t[2430] = 7827;
  33246. t[2433] = 7682;
  33247. t[2678] = 8045;
  33248. t[2679] = 8046;
  33249. t[2830] = 1552;
  33250. t[2838] = 686;
  33251. t[2840] = 751;
  33252. t[2842] = 753;
  33253. t[2843] = 754;
  33254. t[2844] = 755;
  33255. t[2846] = 757;
  33256. t[2856] = 767;
  33257. t[2857] = 848;
  33258. t[2858] = 849;
  33259. t[2862] = 853;
  33260. t[2863] = 854;
  33261. t[2864] = 855;
  33262. t[2865] = 861;
  33263. t[2866] = 862;
  33264. t[2906] = 7460;
  33265. t[2908] = 7462;
  33266. t[2909] = 7463;
  33267. t[2910] = 7464;
  33268. t[2912] = 7466;
  33269. t[2913] = 7467;
  33270. t[2914] = 7468;
  33271. t[2916] = 7470;
  33272. t[2917] = 7471;
  33273. t[2918] = 7472;
  33274. t[2920] = 7474;
  33275. t[2921] = 7475;
  33276. t[2922] = 7476;
  33277. t[2924] = 7478;
  33278. t[2925] = 7479;
  33279. t[2926] = 7480;
  33280. t[2928] = 7482;
  33281. t[2929] = 7483;
  33282. t[2930] = 7484;
  33283. t[2932] = 7486;
  33284. t[2933] = 7487;
  33285. t[2934] = 7488;
  33286. t[2936] = 7490;
  33287. t[2937] = 7491;
  33288. t[2938] = 7492;
  33289. t[2940] = 7494;
  33290. t[2941] = 7495;
  33291. t[2942] = 7496;
  33292. t[2944] = 7498;
  33293. t[2946] = 7500;
  33294. t[2948] = 7502;
  33295. t[2950] = 7504;
  33296. t[2951] = 7505;
  33297. t[2952] = 7506;
  33298. t[2954] = 7508;
  33299. t[2955] = 7509;
  33300. t[2956] = 7510;
  33301. t[2958] = 7512;
  33302. t[2959] = 7513;
  33303. t[2960] = 7514;
  33304. t[2962] = 7516;
  33305. t[2963] = 7517;
  33306. t[2964] = 7518;
  33307. t[2966] = 7520;
  33308. t[2967] = 7521;
  33309. t[2968] = 7522;
  33310. t[2970] = 7524;
  33311. t[2971] = 7525;
  33312. t[2972] = 7526;
  33313. t[2974] = 7528;
  33314. t[2975] = 7529;
  33315. t[2976] = 7530;
  33316. t[2978] = 1537;
  33317. t[2979] = 1538;
  33318. t[2980] = 1539;
  33319. t[2982] = 1549;
  33320. t[2983] = 1551;
  33321. t[2984] = 1552;
  33322. t[2986] = 1554;
  33323. t[2987] = 1555;
  33324. t[2988] = 1556;
  33325. t[2990] = 1623;
  33326. t[2991] = 1624;
  33327. t[2995] = 1775;
  33328. t[2999] = 1791;
  33329. t[3002] = 64290;
  33330. t[3003] = 64291;
  33331. t[3004] = 64292;
  33332. t[3006] = 64294;
  33333. t[3007] = 64295;
  33334. t[3008] = 64296;
  33335. t[3011] = 1900;
  33336. t[3014] = 8223;
  33337. t[3015] = 8244;
  33338. t[3017] = 7532;
  33339. t[3018] = 7533;
  33340. t[3019] = 7534;
  33341. t[3075] = 7590;
  33342. t[3076] = 7591;
  33343. t[3079] = 7594;
  33344. t[3080] = 7595;
  33345. t[3083] = 7598;
  33346. t[3084] = 7599;
  33347. t[3087] = 7602;
  33348. t[3088] = 7603;
  33349. t[3091] = 7606;
  33350. t[3092] = 7607;
  33351. t[3095] = 7610;
  33352. t[3096] = 7611;
  33353. t[3099] = 7614;
  33354. t[3100] = 7615;
  33355. t[3103] = 7618;
  33356. t[3104] = 7619;
  33357. t[3107] = 8337;
  33358. t[3108] = 8338;
  33359. t[3116] = 1884;
  33360. t[3119] = 1885;
  33361. t[3120] = 1885;
  33362. t[3123] = 1886;
  33363. t[3124] = 1886;
  33364. t[3127] = 1887;
  33365. t[3128] = 1887;
  33366. t[3131] = 1888;
  33367. t[3132] = 1888;
  33368. t[3135] = 1889;
  33369. t[3136] = 1889;
  33370. t[3139] = 1890;
  33371. t[3140] = 1890;
  33372. t[3143] = 1891;
  33373. t[3144] = 1891;
  33374. t[3147] = 1892;
  33375. t[3148] = 1892;
  33376. t[3153] = 580;
  33377. t[3154] = 581;
  33378. t[3157] = 584;
  33379. t[3158] = 585;
  33380. t[3161] = 588;
  33381. t[3162] = 589;
  33382. t[3165] = 891;
  33383. t[3166] = 892;
  33384. t[3169] = 1274;
  33385. t[3170] = 1275;
  33386. t[3173] = 1278;
  33387. t[3174] = 1279;
  33388. t[3181] = 7622;
  33389. t[3182] = 7623;
  33390. t[3282] = 11799;
  33391. t[3316] = 578;
  33392. t[3379] = 42785;
  33393. t[3393] = 1159;
  33394. t[3416] = 8377;
  33395. });
  33396. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  33397. t[227] = 322;
  33398. t[264] = 261;
  33399. t[291] = 346;
  33400. });
  33401. exports.getStdFontMap = getStdFontMap;
  33402. exports.getNonStdFontMap = getNonStdFontMap;
  33403. exports.getSerifFonts = getSerifFonts;
  33404. exports.getSymbolsFonts = getSymbolsFonts;
  33405. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  33406. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  33407. /***/ }),
  33408. /* 17 */
  33409. /***/ (function(module, exports, __w_pdfjs_require__) {
  33410. "use strict";
  33411. var sharedUtil = __w_pdfjs_require__(0);
  33412. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  33413. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  33414. t[63721] = 0x00A9;
  33415. t[63193] = 0x00A9;
  33416. t[63720] = 0x00AE;
  33417. t[63194] = 0x00AE;
  33418. t[63722] = 0x2122;
  33419. t[63195] = 0x2122;
  33420. t[63729] = 0x23A7;
  33421. t[63730] = 0x23A8;
  33422. t[63731] = 0x23A9;
  33423. t[63740] = 0x23AB;
  33424. t[63741] = 0x23AC;
  33425. t[63742] = 0x23AD;
  33426. t[63726] = 0x23A1;
  33427. t[63727] = 0x23A2;
  33428. t[63728] = 0x23A3;
  33429. t[63737] = 0x23A4;
  33430. t[63738] = 0x23A5;
  33431. t[63739] = 0x23A6;
  33432. t[63723] = 0x239B;
  33433. t[63724] = 0x239C;
  33434. t[63725] = 0x239D;
  33435. t[63734] = 0x239E;
  33436. t[63735] = 0x239F;
  33437. t[63736] = 0x23A0;
  33438. });
  33439. function mapSpecialUnicodeValues(code) {
  33440. if (code >= 0xFFF0 && code <= 0xFFFF) {
  33441. return 0;
  33442. } else if (code >= 0xF600 && code <= 0xF8FF) {
  33443. return getSpecialPUASymbols()[code] || code;
  33444. }
  33445. return code;
  33446. }
  33447. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33448. var unicode = glyphsUnicodeMap[name];
  33449. if (unicode !== undefined) {
  33450. return unicode;
  33451. }
  33452. if (!name) {
  33453. return -1;
  33454. }
  33455. if (name[0] === 'u') {
  33456. var nameLen = name.length, hexStr;
  33457. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  33458. hexStr = name.substr(3);
  33459. } else if (nameLen >= 5 && nameLen <= 7) {
  33460. hexStr = name.substr(1);
  33461. } else {
  33462. return -1;
  33463. }
  33464. if (hexStr === hexStr.toUpperCase()) {
  33465. unicode = parseInt(hexStr, 16);
  33466. if (unicode >= 0) {
  33467. return unicode;
  33468. }
  33469. }
  33470. }
  33471. return -1;
  33472. }
  33473. var UnicodeRanges = [
  33474. {
  33475. 'begin': 0x0000,
  33476. 'end': 0x007F
  33477. },
  33478. {
  33479. 'begin': 0x0080,
  33480. 'end': 0x00FF
  33481. },
  33482. {
  33483. 'begin': 0x0100,
  33484. 'end': 0x017F
  33485. },
  33486. {
  33487. 'begin': 0x0180,
  33488. 'end': 0x024F
  33489. },
  33490. {
  33491. 'begin': 0x0250,
  33492. 'end': 0x02AF
  33493. },
  33494. {
  33495. 'begin': 0x02B0,
  33496. 'end': 0x02FF
  33497. },
  33498. {
  33499. 'begin': 0x0300,
  33500. 'end': 0x036F
  33501. },
  33502. {
  33503. 'begin': 0x0370,
  33504. 'end': 0x03FF
  33505. },
  33506. {
  33507. 'begin': 0x2C80,
  33508. 'end': 0x2CFF
  33509. },
  33510. {
  33511. 'begin': 0x0400,
  33512. 'end': 0x04FF
  33513. },
  33514. {
  33515. 'begin': 0x0530,
  33516. 'end': 0x058F
  33517. },
  33518. {
  33519. 'begin': 0x0590,
  33520. 'end': 0x05FF
  33521. },
  33522. {
  33523. 'begin': 0xA500,
  33524. 'end': 0xA63F
  33525. },
  33526. {
  33527. 'begin': 0x0600,
  33528. 'end': 0x06FF
  33529. },
  33530. {
  33531. 'begin': 0x07C0,
  33532. 'end': 0x07FF
  33533. },
  33534. {
  33535. 'begin': 0x0900,
  33536. 'end': 0x097F
  33537. },
  33538. {
  33539. 'begin': 0x0980,
  33540. 'end': 0x09FF
  33541. },
  33542. {
  33543. 'begin': 0x0A00,
  33544. 'end': 0x0A7F
  33545. },
  33546. {
  33547. 'begin': 0x0A80,
  33548. 'end': 0x0AFF
  33549. },
  33550. {
  33551. 'begin': 0x0B00,
  33552. 'end': 0x0B7F
  33553. },
  33554. {
  33555. 'begin': 0x0B80,
  33556. 'end': 0x0BFF
  33557. },
  33558. {
  33559. 'begin': 0x0C00,
  33560. 'end': 0x0C7F
  33561. },
  33562. {
  33563. 'begin': 0x0C80,
  33564. 'end': 0x0CFF
  33565. },
  33566. {
  33567. 'begin': 0x0D00,
  33568. 'end': 0x0D7F
  33569. },
  33570. {
  33571. 'begin': 0x0E00,
  33572. 'end': 0x0E7F
  33573. },
  33574. {
  33575. 'begin': 0x0E80,
  33576. 'end': 0x0EFF
  33577. },
  33578. {
  33579. 'begin': 0x10A0,
  33580. 'end': 0x10FF
  33581. },
  33582. {
  33583. 'begin': 0x1B00,
  33584. 'end': 0x1B7F
  33585. },
  33586. {
  33587. 'begin': 0x1100,
  33588. 'end': 0x11FF
  33589. },
  33590. {
  33591. 'begin': 0x1E00,
  33592. 'end': 0x1EFF
  33593. },
  33594. {
  33595. 'begin': 0x1F00,
  33596. 'end': 0x1FFF
  33597. },
  33598. {
  33599. 'begin': 0x2000,
  33600. 'end': 0x206F
  33601. },
  33602. {
  33603. 'begin': 0x2070,
  33604. 'end': 0x209F
  33605. },
  33606. {
  33607. 'begin': 0x20A0,
  33608. 'end': 0x20CF
  33609. },
  33610. {
  33611. 'begin': 0x20D0,
  33612. 'end': 0x20FF
  33613. },
  33614. {
  33615. 'begin': 0x2100,
  33616. 'end': 0x214F
  33617. },
  33618. {
  33619. 'begin': 0x2150,
  33620. 'end': 0x218F
  33621. },
  33622. {
  33623. 'begin': 0x2190,
  33624. 'end': 0x21FF
  33625. },
  33626. {
  33627. 'begin': 0x2200,
  33628. 'end': 0x22FF
  33629. },
  33630. {
  33631. 'begin': 0x2300,
  33632. 'end': 0x23FF
  33633. },
  33634. {
  33635. 'begin': 0x2400,
  33636. 'end': 0x243F
  33637. },
  33638. {
  33639. 'begin': 0x2440,
  33640. 'end': 0x245F
  33641. },
  33642. {
  33643. 'begin': 0x2460,
  33644. 'end': 0x24FF
  33645. },
  33646. {
  33647. 'begin': 0x2500,
  33648. 'end': 0x257F
  33649. },
  33650. {
  33651. 'begin': 0x2580,
  33652. 'end': 0x259F
  33653. },
  33654. {
  33655. 'begin': 0x25A0,
  33656. 'end': 0x25FF
  33657. },
  33658. {
  33659. 'begin': 0x2600,
  33660. 'end': 0x26FF
  33661. },
  33662. {
  33663. 'begin': 0x2700,
  33664. 'end': 0x27BF
  33665. },
  33666. {
  33667. 'begin': 0x3000,
  33668. 'end': 0x303F
  33669. },
  33670. {
  33671. 'begin': 0x3040,
  33672. 'end': 0x309F
  33673. },
  33674. {
  33675. 'begin': 0x30A0,
  33676. 'end': 0x30FF
  33677. },
  33678. {
  33679. 'begin': 0x3100,
  33680. 'end': 0x312F
  33681. },
  33682. {
  33683. 'begin': 0x3130,
  33684. 'end': 0x318F
  33685. },
  33686. {
  33687. 'begin': 0xA840,
  33688. 'end': 0xA87F
  33689. },
  33690. {
  33691. 'begin': 0x3200,
  33692. 'end': 0x32FF
  33693. },
  33694. {
  33695. 'begin': 0x3300,
  33696. 'end': 0x33FF
  33697. },
  33698. {
  33699. 'begin': 0xAC00,
  33700. 'end': 0xD7AF
  33701. },
  33702. {
  33703. 'begin': 0xD800,
  33704. 'end': 0xDFFF
  33705. },
  33706. {
  33707. 'begin': 0x10900,
  33708. 'end': 0x1091F
  33709. },
  33710. {
  33711. 'begin': 0x4E00,
  33712. 'end': 0x9FFF
  33713. },
  33714. {
  33715. 'begin': 0xE000,
  33716. 'end': 0xF8FF
  33717. },
  33718. {
  33719. 'begin': 0x31C0,
  33720. 'end': 0x31EF
  33721. },
  33722. {
  33723. 'begin': 0xFB00,
  33724. 'end': 0xFB4F
  33725. },
  33726. {
  33727. 'begin': 0xFB50,
  33728. 'end': 0xFDFF
  33729. },
  33730. {
  33731. 'begin': 0xFE20,
  33732. 'end': 0xFE2F
  33733. },
  33734. {
  33735. 'begin': 0xFE10,
  33736. 'end': 0xFE1F
  33737. },
  33738. {
  33739. 'begin': 0xFE50,
  33740. 'end': 0xFE6F
  33741. },
  33742. {
  33743. 'begin': 0xFE70,
  33744. 'end': 0xFEFF
  33745. },
  33746. {
  33747. 'begin': 0xFF00,
  33748. 'end': 0xFFEF
  33749. },
  33750. {
  33751. 'begin': 0xFFF0,
  33752. 'end': 0xFFFF
  33753. },
  33754. {
  33755. 'begin': 0x0F00,
  33756. 'end': 0x0FFF
  33757. },
  33758. {
  33759. 'begin': 0x0700,
  33760. 'end': 0x074F
  33761. },
  33762. {
  33763. 'begin': 0x0780,
  33764. 'end': 0x07BF
  33765. },
  33766. {
  33767. 'begin': 0x0D80,
  33768. 'end': 0x0DFF
  33769. },
  33770. {
  33771. 'begin': 0x1000,
  33772. 'end': 0x109F
  33773. },
  33774. {
  33775. 'begin': 0x1200,
  33776. 'end': 0x137F
  33777. },
  33778. {
  33779. 'begin': 0x13A0,
  33780. 'end': 0x13FF
  33781. },
  33782. {
  33783. 'begin': 0x1400,
  33784. 'end': 0x167F
  33785. },
  33786. {
  33787. 'begin': 0x1680,
  33788. 'end': 0x169F
  33789. },
  33790. {
  33791. 'begin': 0x16A0,
  33792. 'end': 0x16FF
  33793. },
  33794. {
  33795. 'begin': 0x1780,
  33796. 'end': 0x17FF
  33797. },
  33798. {
  33799. 'begin': 0x1800,
  33800. 'end': 0x18AF
  33801. },
  33802. {
  33803. 'begin': 0x2800,
  33804. 'end': 0x28FF
  33805. },
  33806. {
  33807. 'begin': 0xA000,
  33808. 'end': 0xA48F
  33809. },
  33810. {
  33811. 'begin': 0x1700,
  33812. 'end': 0x171F
  33813. },
  33814. {
  33815. 'begin': 0x10300,
  33816. 'end': 0x1032F
  33817. },
  33818. {
  33819. 'begin': 0x10330,
  33820. 'end': 0x1034F
  33821. },
  33822. {
  33823. 'begin': 0x10400,
  33824. 'end': 0x1044F
  33825. },
  33826. {
  33827. 'begin': 0x1D000,
  33828. 'end': 0x1D0FF
  33829. },
  33830. {
  33831. 'begin': 0x1D400,
  33832. 'end': 0x1D7FF
  33833. },
  33834. {
  33835. 'begin': 0xFF000,
  33836. 'end': 0xFFFFD
  33837. },
  33838. {
  33839. 'begin': 0xFE00,
  33840. 'end': 0xFE0F
  33841. },
  33842. {
  33843. 'begin': 0xE0000,
  33844. 'end': 0xE007F
  33845. },
  33846. {
  33847. 'begin': 0x1900,
  33848. 'end': 0x194F
  33849. },
  33850. {
  33851. 'begin': 0x1950,
  33852. 'end': 0x197F
  33853. },
  33854. {
  33855. 'begin': 0x1980,
  33856. 'end': 0x19DF
  33857. },
  33858. {
  33859. 'begin': 0x1A00,
  33860. 'end': 0x1A1F
  33861. },
  33862. {
  33863. 'begin': 0x2C00,
  33864. 'end': 0x2C5F
  33865. },
  33866. {
  33867. 'begin': 0x2D30,
  33868. 'end': 0x2D7F
  33869. },
  33870. {
  33871. 'begin': 0x4DC0,
  33872. 'end': 0x4DFF
  33873. },
  33874. {
  33875. 'begin': 0xA800,
  33876. 'end': 0xA82F
  33877. },
  33878. {
  33879. 'begin': 0x10000,
  33880. 'end': 0x1007F
  33881. },
  33882. {
  33883. 'begin': 0x10140,
  33884. 'end': 0x1018F
  33885. },
  33886. {
  33887. 'begin': 0x10380,
  33888. 'end': 0x1039F
  33889. },
  33890. {
  33891. 'begin': 0x103A0,
  33892. 'end': 0x103DF
  33893. },
  33894. {
  33895. 'begin': 0x10450,
  33896. 'end': 0x1047F
  33897. },
  33898. {
  33899. 'begin': 0x10480,
  33900. 'end': 0x104AF
  33901. },
  33902. {
  33903. 'begin': 0x10800,
  33904. 'end': 0x1083F
  33905. },
  33906. {
  33907. 'begin': 0x10A00,
  33908. 'end': 0x10A5F
  33909. },
  33910. {
  33911. 'begin': 0x1D300,
  33912. 'end': 0x1D35F
  33913. },
  33914. {
  33915. 'begin': 0x12000,
  33916. 'end': 0x123FF
  33917. },
  33918. {
  33919. 'begin': 0x1D360,
  33920. 'end': 0x1D37F
  33921. },
  33922. {
  33923. 'begin': 0x1B80,
  33924. 'end': 0x1BBF
  33925. },
  33926. {
  33927. 'begin': 0x1C00,
  33928. 'end': 0x1C4F
  33929. },
  33930. {
  33931. 'begin': 0x1C50,
  33932. 'end': 0x1C7F
  33933. },
  33934. {
  33935. 'begin': 0xA880,
  33936. 'end': 0xA8DF
  33937. },
  33938. {
  33939. 'begin': 0xA900,
  33940. 'end': 0xA92F
  33941. },
  33942. {
  33943. 'begin': 0xA930,
  33944. 'end': 0xA95F
  33945. },
  33946. {
  33947. 'begin': 0xAA00,
  33948. 'end': 0xAA5F
  33949. },
  33950. {
  33951. 'begin': 0x10190,
  33952. 'end': 0x101CF
  33953. },
  33954. {
  33955. 'begin': 0x101D0,
  33956. 'end': 0x101FF
  33957. },
  33958. {
  33959. 'begin': 0x102A0,
  33960. 'end': 0x102DF
  33961. },
  33962. {
  33963. 'begin': 0x1F030,
  33964. 'end': 0x1F09F
  33965. }
  33966. ];
  33967. function getUnicodeRangeFor(value) {
  33968. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33969. var range = UnicodeRanges[i];
  33970. if (value >= range.begin && value < range.end) {
  33971. return i;
  33972. }
  33973. }
  33974. return -1;
  33975. }
  33976. function isRTLRangeFor(value) {
  33977. var range = UnicodeRanges[13];
  33978. if (value >= range.begin && value < range.end) {
  33979. return true;
  33980. }
  33981. range = UnicodeRanges[11];
  33982. if (value >= range.begin && value < range.end) {
  33983. return true;
  33984. }
  33985. return false;
  33986. }
  33987. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33988. t['\u00A8'] = '\u0020\u0308';
  33989. t['\u00AF'] = '\u0020\u0304';
  33990. t['\u00B4'] = '\u0020\u0301';
  33991. t['\u00B5'] = '\u03BC';
  33992. t['\u00B8'] = '\u0020\u0327';
  33993. t['\u0132'] = '\u0049\u004A';
  33994. t['\u0133'] = '\u0069\u006A';
  33995. t['\u013F'] = '\u004C\u00B7';
  33996. t['\u0140'] = '\u006C\u00B7';
  33997. t['\u0149'] = '\u02BC\u006E';
  33998. t['\u017F'] = '\u0073';
  33999. t['\u01C4'] = '\u0044\u017D';
  34000. t['\u01C5'] = '\u0044\u017E';
  34001. t['\u01C6'] = '\u0064\u017E';
  34002. t['\u01C7'] = '\u004C\u004A';
  34003. t['\u01C8'] = '\u004C\u006A';
  34004. t['\u01C9'] = '\u006C\u006A';
  34005. t['\u01CA'] = '\u004E\u004A';
  34006. t['\u01CB'] = '\u004E\u006A';
  34007. t['\u01CC'] = '\u006E\u006A';
  34008. t['\u01F1'] = '\u0044\u005A';
  34009. t['\u01F2'] = '\u0044\u007A';
  34010. t['\u01F3'] = '\u0064\u007A';
  34011. t['\u02D8'] = '\u0020\u0306';
  34012. t['\u02D9'] = '\u0020\u0307';
  34013. t['\u02DA'] = '\u0020\u030A';
  34014. t['\u02DB'] = '\u0020\u0328';
  34015. t['\u02DC'] = '\u0020\u0303';
  34016. t['\u02DD'] = '\u0020\u030B';
  34017. t['\u037A'] = '\u0020\u0345';
  34018. t['\u0384'] = '\u0020\u0301';
  34019. t['\u03D0'] = '\u03B2';
  34020. t['\u03D1'] = '\u03B8';
  34021. t['\u03D2'] = '\u03A5';
  34022. t['\u03D5'] = '\u03C6';
  34023. t['\u03D6'] = '\u03C0';
  34024. t['\u03F0'] = '\u03BA';
  34025. t['\u03F1'] = '\u03C1';
  34026. t['\u03F2'] = '\u03C2';
  34027. t['\u03F4'] = '\u0398';
  34028. t['\u03F5'] = '\u03B5';
  34029. t['\u03F9'] = '\u03A3';
  34030. t['\u0587'] = '\u0565\u0582';
  34031. t['\u0675'] = '\u0627\u0674';
  34032. t['\u0676'] = '\u0648\u0674';
  34033. t['\u0677'] = '\u06C7\u0674';
  34034. t['\u0678'] = '\u064A\u0674';
  34035. t['\u0E33'] = '\u0E4D\u0E32';
  34036. t['\u0EB3'] = '\u0ECD\u0EB2';
  34037. t['\u0EDC'] = '\u0EAB\u0E99';
  34038. t['\u0EDD'] = '\u0EAB\u0EA1';
  34039. t['\u0F77'] = '\u0FB2\u0F81';
  34040. t['\u0F79'] = '\u0FB3\u0F81';
  34041. t['\u1E9A'] = '\u0061\u02BE';
  34042. t['\u1FBD'] = '\u0020\u0313';
  34043. t['\u1FBF'] = '\u0020\u0313';
  34044. t['\u1FC0'] = '\u0020\u0342';
  34045. t['\u1FFE'] = '\u0020\u0314';
  34046. t['\u2002'] = '\u0020';
  34047. t['\u2003'] = '\u0020';
  34048. t['\u2004'] = '\u0020';
  34049. t['\u2005'] = '\u0020';
  34050. t['\u2006'] = '\u0020';
  34051. t['\u2008'] = '\u0020';
  34052. t['\u2009'] = '\u0020';
  34053. t['\u200A'] = '\u0020';
  34054. t['\u2017'] = '\u0020\u0333';
  34055. t['\u2024'] = '\u002E';
  34056. t['\u2025'] = '\u002E\u002E';
  34057. t['\u2026'] = '\u002E\u002E\u002E';
  34058. t['\u2033'] = '\u2032\u2032';
  34059. t['\u2034'] = '\u2032\u2032\u2032';
  34060. t['\u2036'] = '\u2035\u2035';
  34061. t['\u2037'] = '\u2035\u2035\u2035';
  34062. t['\u203C'] = '\u0021\u0021';
  34063. t['\u203E'] = '\u0020\u0305';
  34064. t['\u2047'] = '\u003F\u003F';
  34065. t['\u2048'] = '\u003F\u0021';
  34066. t['\u2049'] = '\u0021\u003F';
  34067. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  34068. t['\u205F'] = '\u0020';
  34069. t['\u20A8'] = '\u0052\u0073';
  34070. t['\u2100'] = '\u0061\u002F\u0063';
  34071. t['\u2101'] = '\u0061\u002F\u0073';
  34072. t['\u2103'] = '\u00B0\u0043';
  34073. t['\u2105'] = '\u0063\u002F\u006F';
  34074. t['\u2106'] = '\u0063\u002F\u0075';
  34075. t['\u2107'] = '\u0190';
  34076. t['\u2109'] = '\u00B0\u0046';
  34077. t['\u2116'] = '\u004E\u006F';
  34078. t['\u2121'] = '\u0054\u0045\u004C';
  34079. t['\u2135'] = '\u05D0';
  34080. t['\u2136'] = '\u05D1';
  34081. t['\u2137'] = '\u05D2';
  34082. t['\u2138'] = '\u05D3';
  34083. t['\u213B'] = '\u0046\u0041\u0058';
  34084. t['\u2160'] = '\u0049';
  34085. t['\u2161'] = '\u0049\u0049';
  34086. t['\u2162'] = '\u0049\u0049\u0049';
  34087. t['\u2163'] = '\u0049\u0056';
  34088. t['\u2164'] = '\u0056';
  34089. t['\u2165'] = '\u0056\u0049';
  34090. t['\u2166'] = '\u0056\u0049\u0049';
  34091. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  34092. t['\u2168'] = '\u0049\u0058';
  34093. t['\u2169'] = '\u0058';
  34094. t['\u216A'] = '\u0058\u0049';
  34095. t['\u216B'] = '\u0058\u0049\u0049';
  34096. t['\u216C'] = '\u004C';
  34097. t['\u216D'] = '\u0043';
  34098. t['\u216E'] = '\u0044';
  34099. t['\u216F'] = '\u004D';
  34100. t['\u2170'] = '\u0069';
  34101. t['\u2171'] = '\u0069\u0069';
  34102. t['\u2172'] = '\u0069\u0069\u0069';
  34103. t['\u2173'] = '\u0069\u0076';
  34104. t['\u2174'] = '\u0076';
  34105. t['\u2175'] = '\u0076\u0069';
  34106. t['\u2176'] = '\u0076\u0069\u0069';
  34107. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  34108. t['\u2178'] = '\u0069\u0078';
  34109. t['\u2179'] = '\u0078';
  34110. t['\u217A'] = '\u0078\u0069';
  34111. t['\u217B'] = '\u0078\u0069\u0069';
  34112. t['\u217C'] = '\u006C';
  34113. t['\u217D'] = '\u0063';
  34114. t['\u217E'] = '\u0064';
  34115. t['\u217F'] = '\u006D';
  34116. t['\u222C'] = '\u222B\u222B';
  34117. t['\u222D'] = '\u222B\u222B\u222B';
  34118. t['\u222F'] = '\u222E\u222E';
  34119. t['\u2230'] = '\u222E\u222E\u222E';
  34120. t['\u2474'] = '\u0028\u0031\u0029';
  34121. t['\u2475'] = '\u0028\u0032\u0029';
  34122. t['\u2476'] = '\u0028\u0033\u0029';
  34123. t['\u2477'] = '\u0028\u0034\u0029';
  34124. t['\u2478'] = '\u0028\u0035\u0029';
  34125. t['\u2479'] = '\u0028\u0036\u0029';
  34126. t['\u247A'] = '\u0028\u0037\u0029';
  34127. t['\u247B'] = '\u0028\u0038\u0029';
  34128. t['\u247C'] = '\u0028\u0039\u0029';
  34129. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  34130. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  34131. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  34132. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  34133. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  34134. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  34135. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  34136. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  34137. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  34138. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  34139. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  34140. t['\u2488'] = '\u0031\u002E';
  34141. t['\u2489'] = '\u0032\u002E';
  34142. t['\u248A'] = '\u0033\u002E';
  34143. t['\u248B'] = '\u0034\u002E';
  34144. t['\u248C'] = '\u0035\u002E';
  34145. t['\u248D'] = '\u0036\u002E';
  34146. t['\u248E'] = '\u0037\u002E';
  34147. t['\u248F'] = '\u0038\u002E';
  34148. t['\u2490'] = '\u0039\u002E';
  34149. t['\u2491'] = '\u0031\u0030\u002E';
  34150. t['\u2492'] = '\u0031\u0031\u002E';
  34151. t['\u2493'] = '\u0031\u0032\u002E';
  34152. t['\u2494'] = '\u0031\u0033\u002E';
  34153. t['\u2495'] = '\u0031\u0034\u002E';
  34154. t['\u2496'] = '\u0031\u0035\u002E';
  34155. t['\u2497'] = '\u0031\u0036\u002E';
  34156. t['\u2498'] = '\u0031\u0037\u002E';
  34157. t['\u2499'] = '\u0031\u0038\u002E';
  34158. t['\u249A'] = '\u0031\u0039\u002E';
  34159. t['\u249B'] = '\u0032\u0030\u002E';
  34160. t['\u249C'] = '\u0028\u0061\u0029';
  34161. t['\u249D'] = '\u0028\u0062\u0029';
  34162. t['\u249E'] = '\u0028\u0063\u0029';
  34163. t['\u249F'] = '\u0028\u0064\u0029';
  34164. t['\u24A0'] = '\u0028\u0065\u0029';
  34165. t['\u24A1'] = '\u0028\u0066\u0029';
  34166. t['\u24A2'] = '\u0028\u0067\u0029';
  34167. t['\u24A3'] = '\u0028\u0068\u0029';
  34168. t['\u24A4'] = '\u0028\u0069\u0029';
  34169. t['\u24A5'] = '\u0028\u006A\u0029';
  34170. t['\u24A6'] = '\u0028\u006B\u0029';
  34171. t['\u24A7'] = '\u0028\u006C\u0029';
  34172. t['\u24A8'] = '\u0028\u006D\u0029';
  34173. t['\u24A9'] = '\u0028\u006E\u0029';
  34174. t['\u24AA'] = '\u0028\u006F\u0029';
  34175. t['\u24AB'] = '\u0028\u0070\u0029';
  34176. t['\u24AC'] = '\u0028\u0071\u0029';
  34177. t['\u24AD'] = '\u0028\u0072\u0029';
  34178. t['\u24AE'] = '\u0028\u0073\u0029';
  34179. t['\u24AF'] = '\u0028\u0074\u0029';
  34180. t['\u24B0'] = '\u0028\u0075\u0029';
  34181. t['\u24B1'] = '\u0028\u0076\u0029';
  34182. t['\u24B2'] = '\u0028\u0077\u0029';
  34183. t['\u24B3'] = '\u0028\u0078\u0029';
  34184. t['\u24B4'] = '\u0028\u0079\u0029';
  34185. t['\u24B5'] = '\u0028\u007A\u0029';
  34186. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  34187. t['\u2A74'] = '\u003A\u003A\u003D';
  34188. t['\u2A75'] = '\u003D\u003D';
  34189. t['\u2A76'] = '\u003D\u003D\u003D';
  34190. t['\u2E9F'] = '\u6BCD';
  34191. t['\u2EF3'] = '\u9F9F';
  34192. t['\u2F00'] = '\u4E00';
  34193. t['\u2F01'] = '\u4E28';
  34194. t['\u2F02'] = '\u4E36';
  34195. t['\u2F03'] = '\u4E3F';
  34196. t['\u2F04'] = '\u4E59';
  34197. t['\u2F05'] = '\u4E85';
  34198. t['\u2F06'] = '\u4E8C';
  34199. t['\u2F07'] = '\u4EA0';
  34200. t['\u2F08'] = '\u4EBA';
  34201. t['\u2F09'] = '\u513F';
  34202. t['\u2F0A'] = '\u5165';
  34203. t['\u2F0B'] = '\u516B';
  34204. t['\u2F0C'] = '\u5182';
  34205. t['\u2F0D'] = '\u5196';
  34206. t['\u2F0E'] = '\u51AB';
  34207. t['\u2F0F'] = '\u51E0';
  34208. t['\u2F10'] = '\u51F5';
  34209. t['\u2F11'] = '\u5200';
  34210. t['\u2F12'] = '\u529B';
  34211. t['\u2F13'] = '\u52F9';
  34212. t['\u2F14'] = '\u5315';
  34213. t['\u2F15'] = '\u531A';
  34214. t['\u2F16'] = '\u5338';
  34215. t['\u2F17'] = '\u5341';
  34216. t['\u2F18'] = '\u535C';
  34217. t['\u2F19'] = '\u5369';
  34218. t['\u2F1A'] = '\u5382';
  34219. t['\u2F1B'] = '\u53B6';
  34220. t['\u2F1C'] = '\u53C8';
  34221. t['\u2F1D'] = '\u53E3';
  34222. t['\u2F1E'] = '\u56D7';
  34223. t['\u2F1F'] = '\u571F';
  34224. t['\u2F20'] = '\u58EB';
  34225. t['\u2F21'] = '\u5902';
  34226. t['\u2F22'] = '\u590A';
  34227. t['\u2F23'] = '\u5915';
  34228. t['\u2F24'] = '\u5927';
  34229. t['\u2F25'] = '\u5973';
  34230. t['\u2F26'] = '\u5B50';
  34231. t['\u2F27'] = '\u5B80';
  34232. t['\u2F28'] = '\u5BF8';
  34233. t['\u2F29'] = '\u5C0F';
  34234. t['\u2F2A'] = '\u5C22';
  34235. t['\u2F2B'] = '\u5C38';
  34236. t['\u2F2C'] = '\u5C6E';
  34237. t['\u2F2D'] = '\u5C71';
  34238. t['\u2F2E'] = '\u5DDB';
  34239. t['\u2F2F'] = '\u5DE5';
  34240. t['\u2F30'] = '\u5DF1';
  34241. t['\u2F31'] = '\u5DFE';
  34242. t['\u2F32'] = '\u5E72';
  34243. t['\u2F33'] = '\u5E7A';
  34244. t['\u2F34'] = '\u5E7F';
  34245. t['\u2F35'] = '\u5EF4';
  34246. t['\u2F36'] = '\u5EFE';
  34247. t['\u2F37'] = '\u5F0B';
  34248. t['\u2F38'] = '\u5F13';
  34249. t['\u2F39'] = '\u5F50';
  34250. t['\u2F3A'] = '\u5F61';
  34251. t['\u2F3B'] = '\u5F73';
  34252. t['\u2F3C'] = '\u5FC3';
  34253. t['\u2F3D'] = '\u6208';
  34254. t['\u2F3E'] = '\u6236';
  34255. t['\u2F3F'] = '\u624B';
  34256. t['\u2F40'] = '\u652F';
  34257. t['\u2F41'] = '\u6534';
  34258. t['\u2F42'] = '\u6587';
  34259. t['\u2F43'] = '\u6597';
  34260. t['\u2F44'] = '\u65A4';
  34261. t['\u2F45'] = '\u65B9';
  34262. t['\u2F46'] = '\u65E0';
  34263. t['\u2F47'] = '\u65E5';
  34264. t['\u2F48'] = '\u66F0';
  34265. t['\u2F49'] = '\u6708';
  34266. t['\u2F4A'] = '\u6728';
  34267. t['\u2F4B'] = '\u6B20';
  34268. t['\u2F4C'] = '\u6B62';
  34269. t['\u2F4D'] = '\u6B79';
  34270. t['\u2F4E'] = '\u6BB3';
  34271. t['\u2F4F'] = '\u6BCB';
  34272. t['\u2F50'] = '\u6BD4';
  34273. t['\u2F51'] = '\u6BDB';
  34274. t['\u2F52'] = '\u6C0F';
  34275. t['\u2F53'] = '\u6C14';
  34276. t['\u2F54'] = '\u6C34';
  34277. t['\u2F55'] = '\u706B';
  34278. t['\u2F56'] = '\u722A';
  34279. t['\u2F57'] = '\u7236';
  34280. t['\u2F58'] = '\u723B';
  34281. t['\u2F59'] = '\u723F';
  34282. t['\u2F5A'] = '\u7247';
  34283. t['\u2F5B'] = '\u7259';
  34284. t['\u2F5C'] = '\u725B';
  34285. t['\u2F5D'] = '\u72AC';
  34286. t['\u2F5E'] = '\u7384';
  34287. t['\u2F5F'] = '\u7389';
  34288. t['\u2F60'] = '\u74DC';
  34289. t['\u2F61'] = '\u74E6';
  34290. t['\u2F62'] = '\u7518';
  34291. t['\u2F63'] = '\u751F';
  34292. t['\u2F64'] = '\u7528';
  34293. t['\u2F65'] = '\u7530';
  34294. t['\u2F66'] = '\u758B';
  34295. t['\u2F67'] = '\u7592';
  34296. t['\u2F68'] = '\u7676';
  34297. t['\u2F69'] = '\u767D';
  34298. t['\u2F6A'] = '\u76AE';
  34299. t['\u2F6B'] = '\u76BF';
  34300. t['\u2F6C'] = '\u76EE';
  34301. t['\u2F6D'] = '\u77DB';
  34302. t['\u2F6E'] = '\u77E2';
  34303. t['\u2F6F'] = '\u77F3';
  34304. t['\u2F70'] = '\u793A';
  34305. t['\u2F71'] = '\u79B8';
  34306. t['\u2F72'] = '\u79BE';
  34307. t['\u2F73'] = '\u7A74';
  34308. t['\u2F74'] = '\u7ACB';
  34309. t['\u2F75'] = '\u7AF9';
  34310. t['\u2F76'] = '\u7C73';
  34311. t['\u2F77'] = '\u7CF8';
  34312. t['\u2F78'] = '\u7F36';
  34313. t['\u2F79'] = '\u7F51';
  34314. t['\u2F7A'] = '\u7F8A';
  34315. t['\u2F7B'] = '\u7FBD';
  34316. t['\u2F7C'] = '\u8001';
  34317. t['\u2F7D'] = '\u800C';
  34318. t['\u2F7E'] = '\u8012';
  34319. t['\u2F7F'] = '\u8033';
  34320. t['\u2F80'] = '\u807F';
  34321. t['\u2F81'] = '\u8089';
  34322. t['\u2F82'] = '\u81E3';
  34323. t['\u2F83'] = '\u81EA';
  34324. t['\u2F84'] = '\u81F3';
  34325. t['\u2F85'] = '\u81FC';
  34326. t['\u2F86'] = '\u820C';
  34327. t['\u2F87'] = '\u821B';
  34328. t['\u2F88'] = '\u821F';
  34329. t['\u2F89'] = '\u826E';
  34330. t['\u2F8A'] = '\u8272';
  34331. t['\u2F8B'] = '\u8278';
  34332. t['\u2F8C'] = '\u864D';
  34333. t['\u2F8D'] = '\u866B';
  34334. t['\u2F8E'] = '\u8840';
  34335. t['\u2F8F'] = '\u884C';
  34336. t['\u2F90'] = '\u8863';
  34337. t['\u2F91'] = '\u897E';
  34338. t['\u2F92'] = '\u898B';
  34339. t['\u2F93'] = '\u89D2';
  34340. t['\u2F94'] = '\u8A00';
  34341. t['\u2F95'] = '\u8C37';
  34342. t['\u2F96'] = '\u8C46';
  34343. t['\u2F97'] = '\u8C55';
  34344. t['\u2F98'] = '\u8C78';
  34345. t['\u2F99'] = '\u8C9D';
  34346. t['\u2F9A'] = '\u8D64';
  34347. t['\u2F9B'] = '\u8D70';
  34348. t['\u2F9C'] = '\u8DB3';
  34349. t['\u2F9D'] = '\u8EAB';
  34350. t['\u2F9E'] = '\u8ECA';
  34351. t['\u2F9F'] = '\u8F9B';
  34352. t['\u2FA0'] = '\u8FB0';
  34353. t['\u2FA1'] = '\u8FB5';
  34354. t['\u2FA2'] = '\u9091';
  34355. t['\u2FA3'] = '\u9149';
  34356. t['\u2FA4'] = '\u91C6';
  34357. t['\u2FA5'] = '\u91CC';
  34358. t['\u2FA6'] = '\u91D1';
  34359. t['\u2FA7'] = '\u9577';
  34360. t['\u2FA8'] = '\u9580';
  34361. t['\u2FA9'] = '\u961C';
  34362. t['\u2FAA'] = '\u96B6';
  34363. t['\u2FAB'] = '\u96B9';
  34364. t['\u2FAC'] = '\u96E8';
  34365. t['\u2FAD'] = '\u9751';
  34366. t['\u2FAE'] = '\u975E';
  34367. t['\u2FAF'] = '\u9762';
  34368. t['\u2FB0'] = '\u9769';
  34369. t['\u2FB1'] = '\u97CB';
  34370. t['\u2FB2'] = '\u97ED';
  34371. t['\u2FB3'] = '\u97F3';
  34372. t['\u2FB4'] = '\u9801';
  34373. t['\u2FB5'] = '\u98A8';
  34374. t['\u2FB6'] = '\u98DB';
  34375. t['\u2FB7'] = '\u98DF';
  34376. t['\u2FB8'] = '\u9996';
  34377. t['\u2FB9'] = '\u9999';
  34378. t['\u2FBA'] = '\u99AC';
  34379. t['\u2FBB'] = '\u9AA8';
  34380. t['\u2FBC'] = '\u9AD8';
  34381. t['\u2FBD'] = '\u9ADF';
  34382. t['\u2FBE'] = '\u9B25';
  34383. t['\u2FBF'] = '\u9B2F';
  34384. t['\u2FC0'] = '\u9B32';
  34385. t['\u2FC1'] = '\u9B3C';
  34386. t['\u2FC2'] = '\u9B5A';
  34387. t['\u2FC3'] = '\u9CE5';
  34388. t['\u2FC4'] = '\u9E75';
  34389. t['\u2FC5'] = '\u9E7F';
  34390. t['\u2FC6'] = '\u9EA5';
  34391. t['\u2FC7'] = '\u9EBB';
  34392. t['\u2FC8'] = '\u9EC3';
  34393. t['\u2FC9'] = '\u9ECD';
  34394. t['\u2FCA'] = '\u9ED1';
  34395. t['\u2FCB'] = '\u9EF9';
  34396. t['\u2FCC'] = '\u9EFD';
  34397. t['\u2FCD'] = '\u9F0E';
  34398. t['\u2FCE'] = '\u9F13';
  34399. t['\u2FCF'] = '\u9F20';
  34400. t['\u2FD0'] = '\u9F3B';
  34401. t['\u2FD1'] = '\u9F4A';
  34402. t['\u2FD2'] = '\u9F52';
  34403. t['\u2FD3'] = '\u9F8D';
  34404. t['\u2FD4'] = '\u9F9C';
  34405. t['\u2FD5'] = '\u9FA0';
  34406. t['\u3036'] = '\u3012';
  34407. t['\u3038'] = '\u5341';
  34408. t['\u3039'] = '\u5344';
  34409. t['\u303A'] = '\u5345';
  34410. t['\u309B'] = '\u0020\u3099';
  34411. t['\u309C'] = '\u0020\u309A';
  34412. t['\u3131'] = '\u1100';
  34413. t['\u3132'] = '\u1101';
  34414. t['\u3133'] = '\u11AA';
  34415. t['\u3134'] = '\u1102';
  34416. t['\u3135'] = '\u11AC';
  34417. t['\u3136'] = '\u11AD';
  34418. t['\u3137'] = '\u1103';
  34419. t['\u3138'] = '\u1104';
  34420. t['\u3139'] = '\u1105';
  34421. t['\u313A'] = '\u11B0';
  34422. t['\u313B'] = '\u11B1';
  34423. t['\u313C'] = '\u11B2';
  34424. t['\u313D'] = '\u11B3';
  34425. t['\u313E'] = '\u11B4';
  34426. t['\u313F'] = '\u11B5';
  34427. t['\u3140'] = '\u111A';
  34428. t['\u3141'] = '\u1106';
  34429. t['\u3142'] = '\u1107';
  34430. t['\u3143'] = '\u1108';
  34431. t['\u3144'] = '\u1121';
  34432. t['\u3145'] = '\u1109';
  34433. t['\u3146'] = '\u110A';
  34434. t['\u3147'] = '\u110B';
  34435. t['\u3148'] = '\u110C';
  34436. t['\u3149'] = '\u110D';
  34437. t['\u314A'] = '\u110E';
  34438. t['\u314B'] = '\u110F';
  34439. t['\u314C'] = '\u1110';
  34440. t['\u314D'] = '\u1111';
  34441. t['\u314E'] = '\u1112';
  34442. t['\u314F'] = '\u1161';
  34443. t['\u3150'] = '\u1162';
  34444. t['\u3151'] = '\u1163';
  34445. t['\u3152'] = '\u1164';
  34446. t['\u3153'] = '\u1165';
  34447. t['\u3154'] = '\u1166';
  34448. t['\u3155'] = '\u1167';
  34449. t['\u3156'] = '\u1168';
  34450. t['\u3157'] = '\u1169';
  34451. t['\u3158'] = '\u116A';
  34452. t['\u3159'] = '\u116B';
  34453. t['\u315A'] = '\u116C';
  34454. t['\u315B'] = '\u116D';
  34455. t['\u315C'] = '\u116E';
  34456. t['\u315D'] = '\u116F';
  34457. t['\u315E'] = '\u1170';
  34458. t['\u315F'] = '\u1171';
  34459. t['\u3160'] = '\u1172';
  34460. t['\u3161'] = '\u1173';
  34461. t['\u3162'] = '\u1174';
  34462. t['\u3163'] = '\u1175';
  34463. t['\u3164'] = '\u1160';
  34464. t['\u3165'] = '\u1114';
  34465. t['\u3166'] = '\u1115';
  34466. t['\u3167'] = '\u11C7';
  34467. t['\u3168'] = '\u11C8';
  34468. t['\u3169'] = '\u11CC';
  34469. t['\u316A'] = '\u11CE';
  34470. t['\u316B'] = '\u11D3';
  34471. t['\u316C'] = '\u11D7';
  34472. t['\u316D'] = '\u11D9';
  34473. t['\u316E'] = '\u111C';
  34474. t['\u316F'] = '\u11DD';
  34475. t['\u3170'] = '\u11DF';
  34476. t['\u3171'] = '\u111D';
  34477. t['\u3172'] = '\u111E';
  34478. t['\u3173'] = '\u1120';
  34479. t['\u3174'] = '\u1122';
  34480. t['\u3175'] = '\u1123';
  34481. t['\u3176'] = '\u1127';
  34482. t['\u3177'] = '\u1129';
  34483. t['\u3178'] = '\u112B';
  34484. t['\u3179'] = '\u112C';
  34485. t['\u317A'] = '\u112D';
  34486. t['\u317B'] = '\u112E';
  34487. t['\u317C'] = '\u112F';
  34488. t['\u317D'] = '\u1132';
  34489. t['\u317E'] = '\u1136';
  34490. t['\u317F'] = '\u1140';
  34491. t['\u3180'] = '\u1147';
  34492. t['\u3181'] = '\u114C';
  34493. t['\u3182'] = '\u11F1';
  34494. t['\u3183'] = '\u11F2';
  34495. t['\u3184'] = '\u1157';
  34496. t['\u3185'] = '\u1158';
  34497. t['\u3186'] = '\u1159';
  34498. t['\u3187'] = '\u1184';
  34499. t['\u3188'] = '\u1185';
  34500. t['\u3189'] = '\u1188';
  34501. t['\u318A'] = '\u1191';
  34502. t['\u318B'] = '\u1192';
  34503. t['\u318C'] = '\u1194';
  34504. t['\u318D'] = '\u119E';
  34505. t['\u318E'] = '\u11A1';
  34506. t['\u3200'] = '\u0028\u1100\u0029';
  34507. t['\u3201'] = '\u0028\u1102\u0029';
  34508. t['\u3202'] = '\u0028\u1103\u0029';
  34509. t['\u3203'] = '\u0028\u1105\u0029';
  34510. t['\u3204'] = '\u0028\u1106\u0029';
  34511. t['\u3205'] = '\u0028\u1107\u0029';
  34512. t['\u3206'] = '\u0028\u1109\u0029';
  34513. t['\u3207'] = '\u0028\u110B\u0029';
  34514. t['\u3208'] = '\u0028\u110C\u0029';
  34515. t['\u3209'] = '\u0028\u110E\u0029';
  34516. t['\u320A'] = '\u0028\u110F\u0029';
  34517. t['\u320B'] = '\u0028\u1110\u0029';
  34518. t['\u320C'] = '\u0028\u1111\u0029';
  34519. t['\u320D'] = '\u0028\u1112\u0029';
  34520. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  34521. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  34522. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  34523. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  34524. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  34525. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  34526. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  34527. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  34528. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  34529. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  34530. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  34531. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  34532. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  34533. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  34534. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  34535. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  34536. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  34537. t['\u3220'] = '\u0028\u4E00\u0029';
  34538. t['\u3221'] = '\u0028\u4E8C\u0029';
  34539. t['\u3222'] = '\u0028\u4E09\u0029';
  34540. t['\u3223'] = '\u0028\u56DB\u0029';
  34541. t['\u3224'] = '\u0028\u4E94\u0029';
  34542. t['\u3225'] = '\u0028\u516D\u0029';
  34543. t['\u3226'] = '\u0028\u4E03\u0029';
  34544. t['\u3227'] = '\u0028\u516B\u0029';
  34545. t['\u3228'] = '\u0028\u4E5D\u0029';
  34546. t['\u3229'] = '\u0028\u5341\u0029';
  34547. t['\u322A'] = '\u0028\u6708\u0029';
  34548. t['\u322B'] = '\u0028\u706B\u0029';
  34549. t['\u322C'] = '\u0028\u6C34\u0029';
  34550. t['\u322D'] = '\u0028\u6728\u0029';
  34551. t['\u322E'] = '\u0028\u91D1\u0029';
  34552. t['\u322F'] = '\u0028\u571F\u0029';
  34553. t['\u3230'] = '\u0028\u65E5\u0029';
  34554. t['\u3231'] = '\u0028\u682A\u0029';
  34555. t['\u3232'] = '\u0028\u6709\u0029';
  34556. t['\u3233'] = '\u0028\u793E\u0029';
  34557. t['\u3234'] = '\u0028\u540D\u0029';
  34558. t['\u3235'] = '\u0028\u7279\u0029';
  34559. t['\u3236'] = '\u0028\u8CA1\u0029';
  34560. t['\u3237'] = '\u0028\u795D\u0029';
  34561. t['\u3238'] = '\u0028\u52B4\u0029';
  34562. t['\u3239'] = '\u0028\u4EE3\u0029';
  34563. t['\u323A'] = '\u0028\u547C\u0029';
  34564. t['\u323B'] = '\u0028\u5B66\u0029';
  34565. t['\u323C'] = '\u0028\u76E3\u0029';
  34566. t['\u323D'] = '\u0028\u4F01\u0029';
  34567. t['\u323E'] = '\u0028\u8CC7\u0029';
  34568. t['\u323F'] = '\u0028\u5354\u0029';
  34569. t['\u3240'] = '\u0028\u796D\u0029';
  34570. t['\u3241'] = '\u0028\u4F11\u0029';
  34571. t['\u3242'] = '\u0028\u81EA\u0029';
  34572. t['\u3243'] = '\u0028\u81F3\u0029';
  34573. t['\u32C0'] = '\u0031\u6708';
  34574. t['\u32C1'] = '\u0032\u6708';
  34575. t['\u32C2'] = '\u0033\u6708';
  34576. t['\u32C3'] = '\u0034\u6708';
  34577. t['\u32C4'] = '\u0035\u6708';
  34578. t['\u32C5'] = '\u0036\u6708';
  34579. t['\u32C6'] = '\u0037\u6708';
  34580. t['\u32C7'] = '\u0038\u6708';
  34581. t['\u32C8'] = '\u0039\u6708';
  34582. t['\u32C9'] = '\u0031\u0030\u6708';
  34583. t['\u32CA'] = '\u0031\u0031\u6708';
  34584. t['\u32CB'] = '\u0031\u0032\u6708';
  34585. t['\u3358'] = '\u0030\u70B9';
  34586. t['\u3359'] = '\u0031\u70B9';
  34587. t['\u335A'] = '\u0032\u70B9';
  34588. t['\u335B'] = '\u0033\u70B9';
  34589. t['\u335C'] = '\u0034\u70B9';
  34590. t['\u335D'] = '\u0035\u70B9';
  34591. t['\u335E'] = '\u0036\u70B9';
  34592. t['\u335F'] = '\u0037\u70B9';
  34593. t['\u3360'] = '\u0038\u70B9';
  34594. t['\u3361'] = '\u0039\u70B9';
  34595. t['\u3362'] = '\u0031\u0030\u70B9';
  34596. t['\u3363'] = '\u0031\u0031\u70B9';
  34597. t['\u3364'] = '\u0031\u0032\u70B9';
  34598. t['\u3365'] = '\u0031\u0033\u70B9';
  34599. t['\u3366'] = '\u0031\u0034\u70B9';
  34600. t['\u3367'] = '\u0031\u0035\u70B9';
  34601. t['\u3368'] = '\u0031\u0036\u70B9';
  34602. t['\u3369'] = '\u0031\u0037\u70B9';
  34603. t['\u336A'] = '\u0031\u0038\u70B9';
  34604. t['\u336B'] = '\u0031\u0039\u70B9';
  34605. t['\u336C'] = '\u0032\u0030\u70B9';
  34606. t['\u336D'] = '\u0032\u0031\u70B9';
  34607. t['\u336E'] = '\u0032\u0032\u70B9';
  34608. t['\u336F'] = '\u0032\u0033\u70B9';
  34609. t['\u3370'] = '\u0032\u0034\u70B9';
  34610. t['\u33E0'] = '\u0031\u65E5';
  34611. t['\u33E1'] = '\u0032\u65E5';
  34612. t['\u33E2'] = '\u0033\u65E5';
  34613. t['\u33E3'] = '\u0034\u65E5';
  34614. t['\u33E4'] = '\u0035\u65E5';
  34615. t['\u33E5'] = '\u0036\u65E5';
  34616. t['\u33E6'] = '\u0037\u65E5';
  34617. t['\u33E7'] = '\u0038\u65E5';
  34618. t['\u33E8'] = '\u0039\u65E5';
  34619. t['\u33E9'] = '\u0031\u0030\u65E5';
  34620. t['\u33EA'] = '\u0031\u0031\u65E5';
  34621. t['\u33EB'] = '\u0031\u0032\u65E5';
  34622. t['\u33EC'] = '\u0031\u0033\u65E5';
  34623. t['\u33ED'] = '\u0031\u0034\u65E5';
  34624. t['\u33EE'] = '\u0031\u0035\u65E5';
  34625. t['\u33EF'] = '\u0031\u0036\u65E5';
  34626. t['\u33F0'] = '\u0031\u0037\u65E5';
  34627. t['\u33F1'] = '\u0031\u0038\u65E5';
  34628. t['\u33F2'] = '\u0031\u0039\u65E5';
  34629. t['\u33F3'] = '\u0032\u0030\u65E5';
  34630. t['\u33F4'] = '\u0032\u0031\u65E5';
  34631. t['\u33F5'] = '\u0032\u0032\u65E5';
  34632. t['\u33F6'] = '\u0032\u0033\u65E5';
  34633. t['\u33F7'] = '\u0032\u0034\u65E5';
  34634. t['\u33F8'] = '\u0032\u0035\u65E5';
  34635. t['\u33F9'] = '\u0032\u0036\u65E5';
  34636. t['\u33FA'] = '\u0032\u0037\u65E5';
  34637. t['\u33FB'] = '\u0032\u0038\u65E5';
  34638. t['\u33FC'] = '\u0032\u0039\u65E5';
  34639. t['\u33FD'] = '\u0033\u0030\u65E5';
  34640. t['\u33FE'] = '\u0033\u0031\u65E5';
  34641. t['\uFB00'] = '\u0066\u0066';
  34642. t['\uFB01'] = '\u0066\u0069';
  34643. t['\uFB02'] = '\u0066\u006C';
  34644. t['\uFB03'] = '\u0066\u0066\u0069';
  34645. t['\uFB04'] = '\u0066\u0066\u006C';
  34646. t['\uFB05'] = '\u017F\u0074';
  34647. t['\uFB06'] = '\u0073\u0074';
  34648. t['\uFB13'] = '\u0574\u0576';
  34649. t['\uFB14'] = '\u0574\u0565';
  34650. t['\uFB15'] = '\u0574\u056B';
  34651. t['\uFB16'] = '\u057E\u0576';
  34652. t['\uFB17'] = '\u0574\u056D';
  34653. t['\uFB4F'] = '\u05D0\u05DC';
  34654. t['\uFB50'] = '\u0671';
  34655. t['\uFB51'] = '\u0671';
  34656. t['\uFB52'] = '\u067B';
  34657. t['\uFB53'] = '\u067B';
  34658. t['\uFB54'] = '\u067B';
  34659. t['\uFB55'] = '\u067B';
  34660. t['\uFB56'] = '\u067E';
  34661. t['\uFB57'] = '\u067E';
  34662. t['\uFB58'] = '\u067E';
  34663. t['\uFB59'] = '\u067E';
  34664. t['\uFB5A'] = '\u0680';
  34665. t['\uFB5B'] = '\u0680';
  34666. t['\uFB5C'] = '\u0680';
  34667. t['\uFB5D'] = '\u0680';
  34668. t['\uFB5E'] = '\u067A';
  34669. t['\uFB5F'] = '\u067A';
  34670. t['\uFB60'] = '\u067A';
  34671. t['\uFB61'] = '\u067A';
  34672. t['\uFB62'] = '\u067F';
  34673. t['\uFB63'] = '\u067F';
  34674. t['\uFB64'] = '\u067F';
  34675. t['\uFB65'] = '\u067F';
  34676. t['\uFB66'] = '\u0679';
  34677. t['\uFB67'] = '\u0679';
  34678. t['\uFB68'] = '\u0679';
  34679. t['\uFB69'] = '\u0679';
  34680. t['\uFB6A'] = '\u06A4';
  34681. t['\uFB6B'] = '\u06A4';
  34682. t['\uFB6C'] = '\u06A4';
  34683. t['\uFB6D'] = '\u06A4';
  34684. t['\uFB6E'] = '\u06A6';
  34685. t['\uFB6F'] = '\u06A6';
  34686. t['\uFB70'] = '\u06A6';
  34687. t['\uFB71'] = '\u06A6';
  34688. t['\uFB72'] = '\u0684';
  34689. t['\uFB73'] = '\u0684';
  34690. t['\uFB74'] = '\u0684';
  34691. t['\uFB75'] = '\u0684';
  34692. t['\uFB76'] = '\u0683';
  34693. t['\uFB77'] = '\u0683';
  34694. t['\uFB78'] = '\u0683';
  34695. t['\uFB79'] = '\u0683';
  34696. t['\uFB7A'] = '\u0686';
  34697. t['\uFB7B'] = '\u0686';
  34698. t['\uFB7C'] = '\u0686';
  34699. t['\uFB7D'] = '\u0686';
  34700. t['\uFB7E'] = '\u0687';
  34701. t['\uFB7F'] = '\u0687';
  34702. t['\uFB80'] = '\u0687';
  34703. t['\uFB81'] = '\u0687';
  34704. t['\uFB82'] = '\u068D';
  34705. t['\uFB83'] = '\u068D';
  34706. t['\uFB84'] = '\u068C';
  34707. t['\uFB85'] = '\u068C';
  34708. t['\uFB86'] = '\u068E';
  34709. t['\uFB87'] = '\u068E';
  34710. t['\uFB88'] = '\u0688';
  34711. t['\uFB89'] = '\u0688';
  34712. t['\uFB8A'] = '\u0698';
  34713. t['\uFB8B'] = '\u0698';
  34714. t['\uFB8C'] = '\u0691';
  34715. t['\uFB8D'] = '\u0691';
  34716. t['\uFB8E'] = '\u06A9';
  34717. t['\uFB8F'] = '\u06A9';
  34718. t['\uFB90'] = '\u06A9';
  34719. t['\uFB91'] = '\u06A9';
  34720. t['\uFB92'] = '\u06AF';
  34721. t['\uFB93'] = '\u06AF';
  34722. t['\uFB94'] = '\u06AF';
  34723. t['\uFB95'] = '\u06AF';
  34724. t['\uFB96'] = '\u06B3';
  34725. t['\uFB97'] = '\u06B3';
  34726. t['\uFB98'] = '\u06B3';
  34727. t['\uFB99'] = '\u06B3';
  34728. t['\uFB9A'] = '\u06B1';
  34729. t['\uFB9B'] = '\u06B1';
  34730. t['\uFB9C'] = '\u06B1';
  34731. t['\uFB9D'] = '\u06B1';
  34732. t['\uFB9E'] = '\u06BA';
  34733. t['\uFB9F'] = '\u06BA';
  34734. t['\uFBA0'] = '\u06BB';
  34735. t['\uFBA1'] = '\u06BB';
  34736. t['\uFBA2'] = '\u06BB';
  34737. t['\uFBA3'] = '\u06BB';
  34738. t['\uFBA4'] = '\u06C0';
  34739. t['\uFBA5'] = '\u06C0';
  34740. t['\uFBA6'] = '\u06C1';
  34741. t['\uFBA7'] = '\u06C1';
  34742. t['\uFBA8'] = '\u06C1';
  34743. t['\uFBA9'] = '\u06C1';
  34744. t['\uFBAA'] = '\u06BE';
  34745. t['\uFBAB'] = '\u06BE';
  34746. t['\uFBAC'] = '\u06BE';
  34747. t['\uFBAD'] = '\u06BE';
  34748. t['\uFBAE'] = '\u06D2';
  34749. t['\uFBAF'] = '\u06D2';
  34750. t['\uFBB0'] = '\u06D3';
  34751. t['\uFBB1'] = '\u06D3';
  34752. t['\uFBD3'] = '\u06AD';
  34753. t['\uFBD4'] = '\u06AD';
  34754. t['\uFBD5'] = '\u06AD';
  34755. t['\uFBD6'] = '\u06AD';
  34756. t['\uFBD7'] = '\u06C7';
  34757. t['\uFBD8'] = '\u06C7';
  34758. t['\uFBD9'] = '\u06C6';
  34759. t['\uFBDA'] = '\u06C6';
  34760. t['\uFBDB'] = '\u06C8';
  34761. t['\uFBDC'] = '\u06C8';
  34762. t['\uFBDD'] = '\u0677';
  34763. t['\uFBDE'] = '\u06CB';
  34764. t['\uFBDF'] = '\u06CB';
  34765. t['\uFBE0'] = '\u06C5';
  34766. t['\uFBE1'] = '\u06C5';
  34767. t['\uFBE2'] = '\u06C9';
  34768. t['\uFBE3'] = '\u06C9';
  34769. t['\uFBE4'] = '\u06D0';
  34770. t['\uFBE5'] = '\u06D0';
  34771. t['\uFBE6'] = '\u06D0';
  34772. t['\uFBE7'] = '\u06D0';
  34773. t['\uFBE8'] = '\u0649';
  34774. t['\uFBE9'] = '\u0649';
  34775. t['\uFBEA'] = '\u0626\u0627';
  34776. t['\uFBEB'] = '\u0626\u0627';
  34777. t['\uFBEC'] = '\u0626\u06D5';
  34778. t['\uFBED'] = '\u0626\u06D5';
  34779. t['\uFBEE'] = '\u0626\u0648';
  34780. t['\uFBEF'] = '\u0626\u0648';
  34781. t['\uFBF0'] = '\u0626\u06C7';
  34782. t['\uFBF1'] = '\u0626\u06C7';
  34783. t['\uFBF2'] = '\u0626\u06C6';
  34784. t['\uFBF3'] = '\u0626\u06C6';
  34785. t['\uFBF4'] = '\u0626\u06C8';
  34786. t['\uFBF5'] = '\u0626\u06C8';
  34787. t['\uFBF6'] = '\u0626\u06D0';
  34788. t['\uFBF7'] = '\u0626\u06D0';
  34789. t['\uFBF8'] = '\u0626\u06D0';
  34790. t['\uFBF9'] = '\u0626\u0649';
  34791. t['\uFBFA'] = '\u0626\u0649';
  34792. t['\uFBFB'] = '\u0626\u0649';
  34793. t['\uFBFC'] = '\u06CC';
  34794. t['\uFBFD'] = '\u06CC';
  34795. t['\uFBFE'] = '\u06CC';
  34796. t['\uFBFF'] = '\u06CC';
  34797. t['\uFC00'] = '\u0626\u062C';
  34798. t['\uFC01'] = '\u0626\u062D';
  34799. t['\uFC02'] = '\u0626\u0645';
  34800. t['\uFC03'] = '\u0626\u0649';
  34801. t['\uFC04'] = '\u0626\u064A';
  34802. t['\uFC05'] = '\u0628\u062C';
  34803. t['\uFC06'] = '\u0628\u062D';
  34804. t['\uFC07'] = '\u0628\u062E';
  34805. t['\uFC08'] = '\u0628\u0645';
  34806. t['\uFC09'] = '\u0628\u0649';
  34807. t['\uFC0A'] = '\u0628\u064A';
  34808. t['\uFC0B'] = '\u062A\u062C';
  34809. t['\uFC0C'] = '\u062A\u062D';
  34810. t['\uFC0D'] = '\u062A\u062E';
  34811. t['\uFC0E'] = '\u062A\u0645';
  34812. t['\uFC0F'] = '\u062A\u0649';
  34813. t['\uFC10'] = '\u062A\u064A';
  34814. t['\uFC11'] = '\u062B\u062C';
  34815. t['\uFC12'] = '\u062B\u0645';
  34816. t['\uFC13'] = '\u062B\u0649';
  34817. t['\uFC14'] = '\u062B\u064A';
  34818. t['\uFC15'] = '\u062C\u062D';
  34819. t['\uFC16'] = '\u062C\u0645';
  34820. t['\uFC17'] = '\u062D\u062C';
  34821. t['\uFC18'] = '\u062D\u0645';
  34822. t['\uFC19'] = '\u062E\u062C';
  34823. t['\uFC1A'] = '\u062E\u062D';
  34824. t['\uFC1B'] = '\u062E\u0645';
  34825. t['\uFC1C'] = '\u0633\u062C';
  34826. t['\uFC1D'] = '\u0633\u062D';
  34827. t['\uFC1E'] = '\u0633\u062E';
  34828. t['\uFC1F'] = '\u0633\u0645';
  34829. t['\uFC20'] = '\u0635\u062D';
  34830. t['\uFC21'] = '\u0635\u0645';
  34831. t['\uFC22'] = '\u0636\u062C';
  34832. t['\uFC23'] = '\u0636\u062D';
  34833. t['\uFC24'] = '\u0636\u062E';
  34834. t['\uFC25'] = '\u0636\u0645';
  34835. t['\uFC26'] = '\u0637\u062D';
  34836. t['\uFC27'] = '\u0637\u0645';
  34837. t['\uFC28'] = '\u0638\u0645';
  34838. t['\uFC29'] = '\u0639\u062C';
  34839. t['\uFC2A'] = '\u0639\u0645';
  34840. t['\uFC2B'] = '\u063A\u062C';
  34841. t['\uFC2C'] = '\u063A\u0645';
  34842. t['\uFC2D'] = '\u0641\u062C';
  34843. t['\uFC2E'] = '\u0641\u062D';
  34844. t['\uFC2F'] = '\u0641\u062E';
  34845. t['\uFC30'] = '\u0641\u0645';
  34846. t['\uFC31'] = '\u0641\u0649';
  34847. t['\uFC32'] = '\u0641\u064A';
  34848. t['\uFC33'] = '\u0642\u062D';
  34849. t['\uFC34'] = '\u0642\u0645';
  34850. t['\uFC35'] = '\u0642\u0649';
  34851. t['\uFC36'] = '\u0642\u064A';
  34852. t['\uFC37'] = '\u0643\u0627';
  34853. t['\uFC38'] = '\u0643\u062C';
  34854. t['\uFC39'] = '\u0643\u062D';
  34855. t['\uFC3A'] = '\u0643\u062E';
  34856. t['\uFC3B'] = '\u0643\u0644';
  34857. t['\uFC3C'] = '\u0643\u0645';
  34858. t['\uFC3D'] = '\u0643\u0649';
  34859. t['\uFC3E'] = '\u0643\u064A';
  34860. t['\uFC3F'] = '\u0644\u062C';
  34861. t['\uFC40'] = '\u0644\u062D';
  34862. t['\uFC41'] = '\u0644\u062E';
  34863. t['\uFC42'] = '\u0644\u0645';
  34864. t['\uFC43'] = '\u0644\u0649';
  34865. t['\uFC44'] = '\u0644\u064A';
  34866. t['\uFC45'] = '\u0645\u062C';
  34867. t['\uFC46'] = '\u0645\u062D';
  34868. t['\uFC47'] = '\u0645\u062E';
  34869. t['\uFC48'] = '\u0645\u0645';
  34870. t['\uFC49'] = '\u0645\u0649';
  34871. t['\uFC4A'] = '\u0645\u064A';
  34872. t['\uFC4B'] = '\u0646\u062C';
  34873. t['\uFC4C'] = '\u0646\u062D';
  34874. t['\uFC4D'] = '\u0646\u062E';
  34875. t['\uFC4E'] = '\u0646\u0645';
  34876. t['\uFC4F'] = '\u0646\u0649';
  34877. t['\uFC50'] = '\u0646\u064A';
  34878. t['\uFC51'] = '\u0647\u062C';
  34879. t['\uFC52'] = '\u0647\u0645';
  34880. t['\uFC53'] = '\u0647\u0649';
  34881. t['\uFC54'] = '\u0647\u064A';
  34882. t['\uFC55'] = '\u064A\u062C';
  34883. t['\uFC56'] = '\u064A\u062D';
  34884. t['\uFC57'] = '\u064A\u062E';
  34885. t['\uFC58'] = '\u064A\u0645';
  34886. t['\uFC59'] = '\u064A\u0649';
  34887. t['\uFC5A'] = '\u064A\u064A';
  34888. t['\uFC5B'] = '\u0630\u0670';
  34889. t['\uFC5C'] = '\u0631\u0670';
  34890. t['\uFC5D'] = '\u0649\u0670';
  34891. t['\uFC5E'] = '\u0020\u064C\u0651';
  34892. t['\uFC5F'] = '\u0020\u064D\u0651';
  34893. t['\uFC60'] = '\u0020\u064E\u0651';
  34894. t['\uFC61'] = '\u0020\u064F\u0651';
  34895. t['\uFC62'] = '\u0020\u0650\u0651';
  34896. t['\uFC63'] = '\u0020\u0651\u0670';
  34897. t['\uFC64'] = '\u0626\u0631';
  34898. t['\uFC65'] = '\u0626\u0632';
  34899. t['\uFC66'] = '\u0626\u0645';
  34900. t['\uFC67'] = '\u0626\u0646';
  34901. t['\uFC68'] = '\u0626\u0649';
  34902. t['\uFC69'] = '\u0626\u064A';
  34903. t['\uFC6A'] = '\u0628\u0631';
  34904. t['\uFC6B'] = '\u0628\u0632';
  34905. t['\uFC6C'] = '\u0628\u0645';
  34906. t['\uFC6D'] = '\u0628\u0646';
  34907. t['\uFC6E'] = '\u0628\u0649';
  34908. t['\uFC6F'] = '\u0628\u064A';
  34909. t['\uFC70'] = '\u062A\u0631';
  34910. t['\uFC71'] = '\u062A\u0632';
  34911. t['\uFC72'] = '\u062A\u0645';
  34912. t['\uFC73'] = '\u062A\u0646';
  34913. t['\uFC74'] = '\u062A\u0649';
  34914. t['\uFC75'] = '\u062A\u064A';
  34915. t['\uFC76'] = '\u062B\u0631';
  34916. t['\uFC77'] = '\u062B\u0632';
  34917. t['\uFC78'] = '\u062B\u0645';
  34918. t['\uFC79'] = '\u062B\u0646';
  34919. t['\uFC7A'] = '\u062B\u0649';
  34920. t['\uFC7B'] = '\u062B\u064A';
  34921. t['\uFC7C'] = '\u0641\u0649';
  34922. t['\uFC7D'] = '\u0641\u064A';
  34923. t['\uFC7E'] = '\u0642\u0649';
  34924. t['\uFC7F'] = '\u0642\u064A';
  34925. t['\uFC80'] = '\u0643\u0627';
  34926. t['\uFC81'] = '\u0643\u0644';
  34927. t['\uFC82'] = '\u0643\u0645';
  34928. t['\uFC83'] = '\u0643\u0649';
  34929. t['\uFC84'] = '\u0643\u064A';
  34930. t['\uFC85'] = '\u0644\u0645';
  34931. t['\uFC86'] = '\u0644\u0649';
  34932. t['\uFC87'] = '\u0644\u064A';
  34933. t['\uFC88'] = '\u0645\u0627';
  34934. t['\uFC89'] = '\u0645\u0645';
  34935. t['\uFC8A'] = '\u0646\u0631';
  34936. t['\uFC8B'] = '\u0646\u0632';
  34937. t['\uFC8C'] = '\u0646\u0645';
  34938. t['\uFC8D'] = '\u0646\u0646';
  34939. t['\uFC8E'] = '\u0646\u0649';
  34940. t['\uFC8F'] = '\u0646\u064A';
  34941. t['\uFC90'] = '\u0649\u0670';
  34942. t['\uFC91'] = '\u064A\u0631';
  34943. t['\uFC92'] = '\u064A\u0632';
  34944. t['\uFC93'] = '\u064A\u0645';
  34945. t['\uFC94'] = '\u064A\u0646';
  34946. t['\uFC95'] = '\u064A\u0649';
  34947. t['\uFC96'] = '\u064A\u064A';
  34948. t['\uFC97'] = '\u0626\u062C';
  34949. t['\uFC98'] = '\u0626\u062D';
  34950. t['\uFC99'] = '\u0626\u062E';
  34951. t['\uFC9A'] = '\u0626\u0645';
  34952. t['\uFC9B'] = '\u0626\u0647';
  34953. t['\uFC9C'] = '\u0628\u062C';
  34954. t['\uFC9D'] = '\u0628\u062D';
  34955. t['\uFC9E'] = '\u0628\u062E';
  34956. t['\uFC9F'] = '\u0628\u0645';
  34957. t['\uFCA0'] = '\u0628\u0647';
  34958. t['\uFCA1'] = '\u062A\u062C';
  34959. t['\uFCA2'] = '\u062A\u062D';
  34960. t['\uFCA3'] = '\u062A\u062E';
  34961. t['\uFCA4'] = '\u062A\u0645';
  34962. t['\uFCA5'] = '\u062A\u0647';
  34963. t['\uFCA6'] = '\u062B\u0645';
  34964. t['\uFCA7'] = '\u062C\u062D';
  34965. t['\uFCA8'] = '\u062C\u0645';
  34966. t['\uFCA9'] = '\u062D\u062C';
  34967. t['\uFCAA'] = '\u062D\u0645';
  34968. t['\uFCAB'] = '\u062E\u062C';
  34969. t['\uFCAC'] = '\u062E\u0645';
  34970. t['\uFCAD'] = '\u0633\u062C';
  34971. t['\uFCAE'] = '\u0633\u062D';
  34972. t['\uFCAF'] = '\u0633\u062E';
  34973. t['\uFCB0'] = '\u0633\u0645';
  34974. t['\uFCB1'] = '\u0635\u062D';
  34975. t['\uFCB2'] = '\u0635\u062E';
  34976. t['\uFCB3'] = '\u0635\u0645';
  34977. t['\uFCB4'] = '\u0636\u062C';
  34978. t['\uFCB5'] = '\u0636\u062D';
  34979. t['\uFCB6'] = '\u0636\u062E';
  34980. t['\uFCB7'] = '\u0636\u0645';
  34981. t['\uFCB8'] = '\u0637\u062D';
  34982. t['\uFCB9'] = '\u0638\u0645';
  34983. t['\uFCBA'] = '\u0639\u062C';
  34984. t['\uFCBB'] = '\u0639\u0645';
  34985. t['\uFCBC'] = '\u063A\u062C';
  34986. t['\uFCBD'] = '\u063A\u0645';
  34987. t['\uFCBE'] = '\u0641\u062C';
  34988. t['\uFCBF'] = '\u0641\u062D';
  34989. t['\uFCC0'] = '\u0641\u062E';
  34990. t['\uFCC1'] = '\u0641\u0645';
  34991. t['\uFCC2'] = '\u0642\u062D';
  34992. t['\uFCC3'] = '\u0642\u0645';
  34993. t['\uFCC4'] = '\u0643\u062C';
  34994. t['\uFCC5'] = '\u0643\u062D';
  34995. t['\uFCC6'] = '\u0643\u062E';
  34996. t['\uFCC7'] = '\u0643\u0644';
  34997. t['\uFCC8'] = '\u0643\u0645';
  34998. t['\uFCC9'] = '\u0644\u062C';
  34999. t['\uFCCA'] = '\u0644\u062D';
  35000. t['\uFCCB'] = '\u0644\u062E';
  35001. t['\uFCCC'] = '\u0644\u0645';
  35002. t['\uFCCD'] = '\u0644\u0647';
  35003. t['\uFCCE'] = '\u0645\u062C';
  35004. t['\uFCCF'] = '\u0645\u062D';
  35005. t['\uFCD0'] = '\u0645\u062E';
  35006. t['\uFCD1'] = '\u0645\u0645';
  35007. t['\uFCD2'] = '\u0646\u062C';
  35008. t['\uFCD3'] = '\u0646\u062D';
  35009. t['\uFCD4'] = '\u0646\u062E';
  35010. t['\uFCD5'] = '\u0646\u0645';
  35011. t['\uFCD6'] = '\u0646\u0647';
  35012. t['\uFCD7'] = '\u0647\u062C';
  35013. t['\uFCD8'] = '\u0647\u0645';
  35014. t['\uFCD9'] = '\u0647\u0670';
  35015. t['\uFCDA'] = '\u064A\u062C';
  35016. t['\uFCDB'] = '\u064A\u062D';
  35017. t['\uFCDC'] = '\u064A\u062E';
  35018. t['\uFCDD'] = '\u064A\u0645';
  35019. t['\uFCDE'] = '\u064A\u0647';
  35020. t['\uFCDF'] = '\u0626\u0645';
  35021. t['\uFCE0'] = '\u0626\u0647';
  35022. t['\uFCE1'] = '\u0628\u0645';
  35023. t['\uFCE2'] = '\u0628\u0647';
  35024. t['\uFCE3'] = '\u062A\u0645';
  35025. t['\uFCE4'] = '\u062A\u0647';
  35026. t['\uFCE5'] = '\u062B\u0645';
  35027. t['\uFCE6'] = '\u062B\u0647';
  35028. t['\uFCE7'] = '\u0633\u0645';
  35029. t['\uFCE8'] = '\u0633\u0647';
  35030. t['\uFCE9'] = '\u0634\u0645';
  35031. t['\uFCEA'] = '\u0634\u0647';
  35032. t['\uFCEB'] = '\u0643\u0644';
  35033. t['\uFCEC'] = '\u0643\u0645';
  35034. t['\uFCED'] = '\u0644\u0645';
  35035. t['\uFCEE'] = '\u0646\u0645';
  35036. t['\uFCEF'] = '\u0646\u0647';
  35037. t['\uFCF0'] = '\u064A\u0645';
  35038. t['\uFCF1'] = '\u064A\u0647';
  35039. t['\uFCF2'] = '\u0640\u064E\u0651';
  35040. t['\uFCF3'] = '\u0640\u064F\u0651';
  35041. t['\uFCF4'] = '\u0640\u0650\u0651';
  35042. t['\uFCF5'] = '\u0637\u0649';
  35043. t['\uFCF6'] = '\u0637\u064A';
  35044. t['\uFCF7'] = '\u0639\u0649';
  35045. t['\uFCF8'] = '\u0639\u064A';
  35046. t['\uFCF9'] = '\u063A\u0649';
  35047. t['\uFCFA'] = '\u063A\u064A';
  35048. t['\uFCFB'] = '\u0633\u0649';
  35049. t['\uFCFC'] = '\u0633\u064A';
  35050. t['\uFCFD'] = '\u0634\u0649';
  35051. t['\uFCFE'] = '\u0634\u064A';
  35052. t['\uFCFF'] = '\u062D\u0649';
  35053. t['\uFD00'] = '\u062D\u064A';
  35054. t['\uFD01'] = '\u062C\u0649';
  35055. t['\uFD02'] = '\u062C\u064A';
  35056. t['\uFD03'] = '\u062E\u0649';
  35057. t['\uFD04'] = '\u062E\u064A';
  35058. t['\uFD05'] = '\u0635\u0649';
  35059. t['\uFD06'] = '\u0635\u064A';
  35060. t['\uFD07'] = '\u0636\u0649';
  35061. t['\uFD08'] = '\u0636\u064A';
  35062. t['\uFD09'] = '\u0634\u062C';
  35063. t['\uFD0A'] = '\u0634\u062D';
  35064. t['\uFD0B'] = '\u0634\u062E';
  35065. t['\uFD0C'] = '\u0634\u0645';
  35066. t['\uFD0D'] = '\u0634\u0631';
  35067. t['\uFD0E'] = '\u0633\u0631';
  35068. t['\uFD0F'] = '\u0635\u0631';
  35069. t['\uFD10'] = '\u0636\u0631';
  35070. t['\uFD11'] = '\u0637\u0649';
  35071. t['\uFD12'] = '\u0637\u064A';
  35072. t['\uFD13'] = '\u0639\u0649';
  35073. t['\uFD14'] = '\u0639\u064A';
  35074. t['\uFD15'] = '\u063A\u0649';
  35075. t['\uFD16'] = '\u063A\u064A';
  35076. t['\uFD17'] = '\u0633\u0649';
  35077. t['\uFD18'] = '\u0633\u064A';
  35078. t['\uFD19'] = '\u0634\u0649';
  35079. t['\uFD1A'] = '\u0634\u064A';
  35080. t['\uFD1B'] = '\u062D\u0649';
  35081. t['\uFD1C'] = '\u062D\u064A';
  35082. t['\uFD1D'] = '\u062C\u0649';
  35083. t['\uFD1E'] = '\u062C\u064A';
  35084. t['\uFD1F'] = '\u062E\u0649';
  35085. t['\uFD20'] = '\u062E\u064A';
  35086. t['\uFD21'] = '\u0635\u0649';
  35087. t['\uFD22'] = '\u0635\u064A';
  35088. t['\uFD23'] = '\u0636\u0649';
  35089. t['\uFD24'] = '\u0636\u064A';
  35090. t['\uFD25'] = '\u0634\u062C';
  35091. t['\uFD26'] = '\u0634\u062D';
  35092. t['\uFD27'] = '\u0634\u062E';
  35093. t['\uFD28'] = '\u0634\u0645';
  35094. t['\uFD29'] = '\u0634\u0631';
  35095. t['\uFD2A'] = '\u0633\u0631';
  35096. t['\uFD2B'] = '\u0635\u0631';
  35097. t['\uFD2C'] = '\u0636\u0631';
  35098. t['\uFD2D'] = '\u0634\u062C';
  35099. t['\uFD2E'] = '\u0634\u062D';
  35100. t['\uFD2F'] = '\u0634\u062E';
  35101. t['\uFD30'] = '\u0634\u0645';
  35102. t['\uFD31'] = '\u0633\u0647';
  35103. t['\uFD32'] = '\u0634\u0647';
  35104. t['\uFD33'] = '\u0637\u0645';
  35105. t['\uFD34'] = '\u0633\u062C';
  35106. t['\uFD35'] = '\u0633\u062D';
  35107. t['\uFD36'] = '\u0633\u062E';
  35108. t['\uFD37'] = '\u0634\u062C';
  35109. t['\uFD38'] = '\u0634\u062D';
  35110. t['\uFD39'] = '\u0634\u062E';
  35111. t['\uFD3A'] = '\u0637\u0645';
  35112. t['\uFD3B'] = '\u0638\u0645';
  35113. t['\uFD3C'] = '\u0627\u064B';
  35114. t['\uFD3D'] = '\u0627\u064B';
  35115. t['\uFD50'] = '\u062A\u062C\u0645';
  35116. t['\uFD51'] = '\u062A\u062D\u062C';
  35117. t['\uFD52'] = '\u062A\u062D\u062C';
  35118. t['\uFD53'] = '\u062A\u062D\u0645';
  35119. t['\uFD54'] = '\u062A\u062E\u0645';
  35120. t['\uFD55'] = '\u062A\u0645\u062C';
  35121. t['\uFD56'] = '\u062A\u0645\u062D';
  35122. t['\uFD57'] = '\u062A\u0645\u062E';
  35123. t['\uFD58'] = '\u062C\u0645\u062D';
  35124. t['\uFD59'] = '\u062C\u0645\u062D';
  35125. t['\uFD5A'] = '\u062D\u0645\u064A';
  35126. t['\uFD5B'] = '\u062D\u0645\u0649';
  35127. t['\uFD5C'] = '\u0633\u062D\u062C';
  35128. t['\uFD5D'] = '\u0633\u062C\u062D';
  35129. t['\uFD5E'] = '\u0633\u062C\u0649';
  35130. t['\uFD5F'] = '\u0633\u0645\u062D';
  35131. t['\uFD60'] = '\u0633\u0645\u062D';
  35132. t['\uFD61'] = '\u0633\u0645\u062C';
  35133. t['\uFD62'] = '\u0633\u0645\u0645';
  35134. t['\uFD63'] = '\u0633\u0645\u0645';
  35135. t['\uFD64'] = '\u0635\u062D\u062D';
  35136. t['\uFD65'] = '\u0635\u062D\u062D';
  35137. t['\uFD66'] = '\u0635\u0645\u0645';
  35138. t['\uFD67'] = '\u0634\u062D\u0645';
  35139. t['\uFD68'] = '\u0634\u062D\u0645';
  35140. t['\uFD69'] = '\u0634\u062C\u064A';
  35141. t['\uFD6A'] = '\u0634\u0645\u062E';
  35142. t['\uFD6B'] = '\u0634\u0645\u062E';
  35143. t['\uFD6C'] = '\u0634\u0645\u0645';
  35144. t['\uFD6D'] = '\u0634\u0645\u0645';
  35145. t['\uFD6E'] = '\u0636\u062D\u0649';
  35146. t['\uFD6F'] = '\u0636\u062E\u0645';
  35147. t['\uFD70'] = '\u0636\u062E\u0645';
  35148. t['\uFD71'] = '\u0637\u0645\u062D';
  35149. t['\uFD72'] = '\u0637\u0645\u062D';
  35150. t['\uFD73'] = '\u0637\u0645\u0645';
  35151. t['\uFD74'] = '\u0637\u0645\u064A';
  35152. t['\uFD75'] = '\u0639\u062C\u0645';
  35153. t['\uFD76'] = '\u0639\u0645\u0645';
  35154. t['\uFD77'] = '\u0639\u0645\u0645';
  35155. t['\uFD78'] = '\u0639\u0645\u0649';
  35156. t['\uFD79'] = '\u063A\u0645\u0645';
  35157. t['\uFD7A'] = '\u063A\u0645\u064A';
  35158. t['\uFD7B'] = '\u063A\u0645\u0649';
  35159. t['\uFD7C'] = '\u0641\u062E\u0645';
  35160. t['\uFD7D'] = '\u0641\u062E\u0645';
  35161. t['\uFD7E'] = '\u0642\u0645\u062D';
  35162. t['\uFD7F'] = '\u0642\u0645\u0645';
  35163. t['\uFD80'] = '\u0644\u062D\u0645';
  35164. t['\uFD81'] = '\u0644\u062D\u064A';
  35165. t['\uFD82'] = '\u0644\u062D\u0649';
  35166. t['\uFD83'] = '\u0644\u062C\u062C';
  35167. t['\uFD84'] = '\u0644\u062C\u062C';
  35168. t['\uFD85'] = '\u0644\u062E\u0645';
  35169. t['\uFD86'] = '\u0644\u062E\u0645';
  35170. t['\uFD87'] = '\u0644\u0645\u062D';
  35171. t['\uFD88'] = '\u0644\u0645\u062D';
  35172. t['\uFD89'] = '\u0645\u062D\u062C';
  35173. t['\uFD8A'] = '\u0645\u062D\u0645';
  35174. t['\uFD8B'] = '\u0645\u062D\u064A';
  35175. t['\uFD8C'] = '\u0645\u062C\u062D';
  35176. t['\uFD8D'] = '\u0645\u062C\u0645';
  35177. t['\uFD8E'] = '\u0645\u062E\u062C';
  35178. t['\uFD8F'] = '\u0645\u062E\u0645';
  35179. t['\uFD92'] = '\u0645\u062C\u062E';
  35180. t['\uFD93'] = '\u0647\u0645\u062C';
  35181. t['\uFD94'] = '\u0647\u0645\u0645';
  35182. t['\uFD95'] = '\u0646\u062D\u0645';
  35183. t['\uFD96'] = '\u0646\u062D\u0649';
  35184. t['\uFD97'] = '\u0646\u062C\u0645';
  35185. t['\uFD98'] = '\u0646\u062C\u0645';
  35186. t['\uFD99'] = '\u0646\u062C\u0649';
  35187. t['\uFD9A'] = '\u0646\u0645\u064A';
  35188. t['\uFD9B'] = '\u0646\u0645\u0649';
  35189. t['\uFD9C'] = '\u064A\u0645\u0645';
  35190. t['\uFD9D'] = '\u064A\u0645\u0645';
  35191. t['\uFD9E'] = '\u0628\u062E\u064A';
  35192. t['\uFD9F'] = '\u062A\u062C\u064A';
  35193. t['\uFDA0'] = '\u062A\u062C\u0649';
  35194. t['\uFDA1'] = '\u062A\u062E\u064A';
  35195. t['\uFDA2'] = '\u062A\u062E\u0649';
  35196. t['\uFDA3'] = '\u062A\u0645\u064A';
  35197. t['\uFDA4'] = '\u062A\u0645\u0649';
  35198. t['\uFDA5'] = '\u062C\u0645\u064A';
  35199. t['\uFDA6'] = '\u062C\u062D\u0649';
  35200. t['\uFDA7'] = '\u062C\u0645\u0649';
  35201. t['\uFDA8'] = '\u0633\u062E\u0649';
  35202. t['\uFDA9'] = '\u0635\u062D\u064A';
  35203. t['\uFDAA'] = '\u0634\u062D\u064A';
  35204. t['\uFDAB'] = '\u0636\u062D\u064A';
  35205. t['\uFDAC'] = '\u0644\u062C\u064A';
  35206. t['\uFDAD'] = '\u0644\u0645\u064A';
  35207. t['\uFDAE'] = '\u064A\u062D\u064A';
  35208. t['\uFDAF'] = '\u064A\u062C\u064A';
  35209. t['\uFDB0'] = '\u064A\u0645\u064A';
  35210. t['\uFDB1'] = '\u0645\u0645\u064A';
  35211. t['\uFDB2'] = '\u0642\u0645\u064A';
  35212. t['\uFDB3'] = '\u0646\u062D\u064A';
  35213. t['\uFDB4'] = '\u0642\u0645\u062D';
  35214. t['\uFDB5'] = '\u0644\u062D\u0645';
  35215. t['\uFDB6'] = '\u0639\u0645\u064A';
  35216. t['\uFDB7'] = '\u0643\u0645\u064A';
  35217. t['\uFDB8'] = '\u0646\u062C\u062D';
  35218. t['\uFDB9'] = '\u0645\u062E\u064A';
  35219. t['\uFDBA'] = '\u0644\u062C\u0645';
  35220. t['\uFDBB'] = '\u0643\u0645\u0645';
  35221. t['\uFDBC'] = '\u0644\u062C\u0645';
  35222. t['\uFDBD'] = '\u0646\u062C\u062D';
  35223. t['\uFDBE'] = '\u062C\u062D\u064A';
  35224. t['\uFDBF'] = '\u062D\u062C\u064A';
  35225. t['\uFDC0'] = '\u0645\u062C\u064A';
  35226. t['\uFDC1'] = '\u0641\u0645\u064A';
  35227. t['\uFDC2'] = '\u0628\u062D\u064A';
  35228. t['\uFDC3'] = '\u0643\u0645\u0645';
  35229. t['\uFDC4'] = '\u0639\u062C\u0645';
  35230. t['\uFDC5'] = '\u0635\u0645\u0645';
  35231. t['\uFDC6'] = '\u0633\u062E\u064A';
  35232. t['\uFDC7'] = '\u0646\u062C\u064A';
  35233. t['\uFE49'] = '\u203E';
  35234. t['\uFE4A'] = '\u203E';
  35235. t['\uFE4B'] = '\u203E';
  35236. t['\uFE4C'] = '\u203E';
  35237. t['\uFE4D'] = '\u005F';
  35238. t['\uFE4E'] = '\u005F';
  35239. t['\uFE4F'] = '\u005F';
  35240. t['\uFE80'] = '\u0621';
  35241. t['\uFE81'] = '\u0622';
  35242. t['\uFE82'] = '\u0622';
  35243. t['\uFE83'] = '\u0623';
  35244. t['\uFE84'] = '\u0623';
  35245. t['\uFE85'] = '\u0624';
  35246. t['\uFE86'] = '\u0624';
  35247. t['\uFE87'] = '\u0625';
  35248. t['\uFE88'] = '\u0625';
  35249. t['\uFE89'] = '\u0626';
  35250. t['\uFE8A'] = '\u0626';
  35251. t['\uFE8B'] = '\u0626';
  35252. t['\uFE8C'] = '\u0626';
  35253. t['\uFE8D'] = '\u0627';
  35254. t['\uFE8E'] = '\u0627';
  35255. t['\uFE8F'] = '\u0628';
  35256. t['\uFE90'] = '\u0628';
  35257. t['\uFE91'] = '\u0628';
  35258. t['\uFE92'] = '\u0628';
  35259. t['\uFE93'] = '\u0629';
  35260. t['\uFE94'] = '\u0629';
  35261. t['\uFE95'] = '\u062A';
  35262. t['\uFE96'] = '\u062A';
  35263. t['\uFE97'] = '\u062A';
  35264. t['\uFE98'] = '\u062A';
  35265. t['\uFE99'] = '\u062B';
  35266. t['\uFE9A'] = '\u062B';
  35267. t['\uFE9B'] = '\u062B';
  35268. t['\uFE9C'] = '\u062B';
  35269. t['\uFE9D'] = '\u062C';
  35270. t['\uFE9E'] = '\u062C';
  35271. t['\uFE9F'] = '\u062C';
  35272. t['\uFEA0'] = '\u062C';
  35273. t['\uFEA1'] = '\u062D';
  35274. t['\uFEA2'] = '\u062D';
  35275. t['\uFEA3'] = '\u062D';
  35276. t['\uFEA4'] = '\u062D';
  35277. t['\uFEA5'] = '\u062E';
  35278. t['\uFEA6'] = '\u062E';
  35279. t['\uFEA7'] = '\u062E';
  35280. t['\uFEA8'] = '\u062E';
  35281. t['\uFEA9'] = '\u062F';
  35282. t['\uFEAA'] = '\u062F';
  35283. t['\uFEAB'] = '\u0630';
  35284. t['\uFEAC'] = '\u0630';
  35285. t['\uFEAD'] = '\u0631';
  35286. t['\uFEAE'] = '\u0631';
  35287. t['\uFEAF'] = '\u0632';
  35288. t['\uFEB0'] = '\u0632';
  35289. t['\uFEB1'] = '\u0633';
  35290. t['\uFEB2'] = '\u0633';
  35291. t['\uFEB3'] = '\u0633';
  35292. t['\uFEB4'] = '\u0633';
  35293. t['\uFEB5'] = '\u0634';
  35294. t['\uFEB6'] = '\u0634';
  35295. t['\uFEB7'] = '\u0634';
  35296. t['\uFEB8'] = '\u0634';
  35297. t['\uFEB9'] = '\u0635';
  35298. t['\uFEBA'] = '\u0635';
  35299. t['\uFEBB'] = '\u0635';
  35300. t['\uFEBC'] = '\u0635';
  35301. t['\uFEBD'] = '\u0636';
  35302. t['\uFEBE'] = '\u0636';
  35303. t['\uFEBF'] = '\u0636';
  35304. t['\uFEC0'] = '\u0636';
  35305. t['\uFEC1'] = '\u0637';
  35306. t['\uFEC2'] = '\u0637';
  35307. t['\uFEC3'] = '\u0637';
  35308. t['\uFEC4'] = '\u0637';
  35309. t['\uFEC5'] = '\u0638';
  35310. t['\uFEC6'] = '\u0638';
  35311. t['\uFEC7'] = '\u0638';
  35312. t['\uFEC8'] = '\u0638';
  35313. t['\uFEC9'] = '\u0639';
  35314. t['\uFECA'] = '\u0639';
  35315. t['\uFECB'] = '\u0639';
  35316. t['\uFECC'] = '\u0639';
  35317. t['\uFECD'] = '\u063A';
  35318. t['\uFECE'] = '\u063A';
  35319. t['\uFECF'] = '\u063A';
  35320. t['\uFED0'] = '\u063A';
  35321. t['\uFED1'] = '\u0641';
  35322. t['\uFED2'] = '\u0641';
  35323. t['\uFED3'] = '\u0641';
  35324. t['\uFED4'] = '\u0641';
  35325. t['\uFED5'] = '\u0642';
  35326. t['\uFED6'] = '\u0642';
  35327. t['\uFED7'] = '\u0642';
  35328. t['\uFED8'] = '\u0642';
  35329. t['\uFED9'] = '\u0643';
  35330. t['\uFEDA'] = '\u0643';
  35331. t['\uFEDB'] = '\u0643';
  35332. t['\uFEDC'] = '\u0643';
  35333. t['\uFEDD'] = '\u0644';
  35334. t['\uFEDE'] = '\u0644';
  35335. t['\uFEDF'] = '\u0644';
  35336. t['\uFEE0'] = '\u0644';
  35337. t['\uFEE1'] = '\u0645';
  35338. t['\uFEE2'] = '\u0645';
  35339. t['\uFEE3'] = '\u0645';
  35340. t['\uFEE4'] = '\u0645';
  35341. t['\uFEE5'] = '\u0646';
  35342. t['\uFEE6'] = '\u0646';
  35343. t['\uFEE7'] = '\u0646';
  35344. t['\uFEE8'] = '\u0646';
  35345. t['\uFEE9'] = '\u0647';
  35346. t['\uFEEA'] = '\u0647';
  35347. t['\uFEEB'] = '\u0647';
  35348. t['\uFEEC'] = '\u0647';
  35349. t['\uFEED'] = '\u0648';
  35350. t['\uFEEE'] = '\u0648';
  35351. t['\uFEEF'] = '\u0649';
  35352. t['\uFEF0'] = '\u0649';
  35353. t['\uFEF1'] = '\u064A';
  35354. t['\uFEF2'] = '\u064A';
  35355. t['\uFEF3'] = '\u064A';
  35356. t['\uFEF4'] = '\u064A';
  35357. t['\uFEF5'] = '\u0644\u0622';
  35358. t['\uFEF6'] = '\u0644\u0622';
  35359. t['\uFEF7'] = '\u0644\u0623';
  35360. t['\uFEF8'] = '\u0644\u0623';
  35361. t['\uFEF9'] = '\u0644\u0625';
  35362. t['\uFEFA'] = '\u0644\u0625';
  35363. t['\uFEFB'] = '\u0644\u0627';
  35364. t['\uFEFC'] = '\u0644\u0627';
  35365. });
  35366. function reverseIfRtl(chars) {
  35367. var charsLength = chars.length;
  35368. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  35369. return chars;
  35370. }
  35371. var s = '';
  35372. for (var ii = charsLength - 1; ii >= 0; ii--) {
  35373. s += chars[ii];
  35374. }
  35375. return s;
  35376. }
  35377. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  35378. exports.reverseIfRtl = reverseIfRtl;
  35379. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  35380. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  35381. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  35382. /***/ }),
  35383. /* 18 */
  35384. /***/ (function(module, exports, __w_pdfjs_require__) {
  35385. "use strict";
  35386. var sharedUtil = __w_pdfjs_require__(0);
  35387. var coreWorker = __w_pdfjs_require__(8);
  35388. var OK_RESPONSE = 200;
  35389. var PARTIAL_CONTENT_RESPONSE = 206;
  35390. function NetworkManager(url, args) {
  35391. this.url = url;
  35392. args = args || {};
  35393. this.isHttp = /^https?:/i.test(url);
  35394. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  35395. this.withCredentials = args.withCredentials || false;
  35396. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  35397. return new XMLHttpRequest();
  35398. };
  35399. this.currXhrId = 0;
  35400. this.pendingRequests = Object.create(null);
  35401. this.loadedRequests = Object.create(null);
  35402. }
  35403. function getArrayBuffer(xhr) {
  35404. var data = xhr.response;
  35405. if (typeof data !== 'string') {
  35406. return data;
  35407. }
  35408. var length = data.length;
  35409. var array = new Uint8Array(length);
  35410. for (var i = 0; i < length; i++) {
  35411. array[i] = data.charCodeAt(i) & 0xFF;
  35412. }
  35413. return array.buffer;
  35414. }
  35415. var supportsMozChunked = function supportsMozChunkedClosure() {
  35416. try {
  35417. var x = new XMLHttpRequest();
  35418. x.open('GET', 'https://example.com');
  35419. x.responseType = 'moz-chunked-arraybuffer';
  35420. return x.responseType === 'moz-chunked-arraybuffer';
  35421. } catch (e) {
  35422. return false;
  35423. }
  35424. }();
  35425. NetworkManager.prototype = {
  35426. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  35427. var args = {
  35428. begin: begin,
  35429. end: end
  35430. };
  35431. for (var prop in listeners) {
  35432. args[prop] = listeners[prop];
  35433. }
  35434. return this.request(args);
  35435. },
  35436. requestFull: function NetworkManager_requestFull(listeners) {
  35437. return this.request(listeners);
  35438. },
  35439. request: function NetworkManager_request(args) {
  35440. var xhr = this.getXhr();
  35441. var xhrId = this.currXhrId++;
  35442. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  35443. xhr.open('GET', this.url);
  35444. xhr.withCredentials = this.withCredentials;
  35445. for (var property in this.httpHeaders) {
  35446. var value = this.httpHeaders[property];
  35447. if (typeof value === 'undefined') {
  35448. continue;
  35449. }
  35450. xhr.setRequestHeader(property, value);
  35451. }
  35452. if (this.isHttp && 'begin' in args && 'end' in args) {
  35453. var rangeStr = args.begin + '-' + (args.end - 1);
  35454. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  35455. pendingRequest.expectedStatus = 206;
  35456. } else {
  35457. pendingRequest.expectedStatus = 200;
  35458. }
  35459. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  35460. if (useMozChunkedLoading) {
  35461. xhr.responseType = 'moz-chunked-arraybuffer';
  35462. pendingRequest.onProgressiveData = args.onProgressiveData;
  35463. pendingRequest.mozChunked = true;
  35464. } else {
  35465. xhr.responseType = 'arraybuffer';
  35466. }
  35467. if (args.onError) {
  35468. xhr.onerror = function (evt) {
  35469. args.onError(xhr.status);
  35470. };
  35471. }
  35472. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  35473. xhr.onprogress = this.onProgress.bind(this, xhrId);
  35474. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  35475. pendingRequest.onDone = args.onDone;
  35476. pendingRequest.onError = args.onError;
  35477. pendingRequest.onProgress = args.onProgress;
  35478. xhr.send(null);
  35479. return xhrId;
  35480. },
  35481. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  35482. var pendingRequest = this.pendingRequests[xhrId];
  35483. if (!pendingRequest) {
  35484. return;
  35485. }
  35486. if (pendingRequest.mozChunked) {
  35487. var chunk = getArrayBuffer(pendingRequest.xhr);
  35488. pendingRequest.onProgressiveData(chunk);
  35489. }
  35490. var onProgress = pendingRequest.onProgress;
  35491. if (onProgress) {
  35492. onProgress(evt);
  35493. }
  35494. },
  35495. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  35496. var pendingRequest = this.pendingRequests[xhrId];
  35497. if (!pendingRequest) {
  35498. return;
  35499. }
  35500. var xhr = pendingRequest.xhr;
  35501. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  35502. pendingRequest.onHeadersReceived();
  35503. delete pendingRequest.onHeadersReceived;
  35504. }
  35505. if (xhr.readyState !== 4) {
  35506. return;
  35507. }
  35508. if (!(xhrId in this.pendingRequests)) {
  35509. return;
  35510. }
  35511. delete this.pendingRequests[xhrId];
  35512. if (xhr.status === 0 && this.isHttp) {
  35513. if (pendingRequest.onError) {
  35514. pendingRequest.onError(xhr.status);
  35515. }
  35516. return;
  35517. }
  35518. var xhrStatus = xhr.status || OK_RESPONSE;
  35519. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  35520. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  35521. if (pendingRequest.onError) {
  35522. pendingRequest.onError(xhr.status);
  35523. }
  35524. return;
  35525. }
  35526. this.loadedRequests[xhrId] = true;
  35527. var chunk = getArrayBuffer(xhr);
  35528. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  35529. var rangeHeader = xhr.getResponseHeader('Content-Range');
  35530. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  35531. var begin = parseInt(matches[1], 10);
  35532. pendingRequest.onDone({
  35533. begin: begin,
  35534. chunk: chunk
  35535. });
  35536. } else if (pendingRequest.onProgressiveData) {
  35537. pendingRequest.onDone(null);
  35538. } else if (chunk) {
  35539. pendingRequest.onDone({
  35540. begin: 0,
  35541. chunk: chunk
  35542. });
  35543. } else if (pendingRequest.onError) {
  35544. pendingRequest.onError(xhr.status);
  35545. }
  35546. },
  35547. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  35548. for (var xhrId in this.pendingRequests) {
  35549. return true;
  35550. }
  35551. return false;
  35552. },
  35553. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  35554. return this.pendingRequests[xhrId].xhr;
  35555. },
  35556. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  35557. return !!this.pendingRequests[xhrId].onProgressiveData;
  35558. },
  35559. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  35560. return xhrId in this.pendingRequests;
  35561. },
  35562. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  35563. return xhrId in this.loadedRequests;
  35564. },
  35565. abortAllRequests: function NetworkManager_abortAllRequests() {
  35566. for (var xhrId in this.pendingRequests) {
  35567. this.abortRequest(xhrId | 0);
  35568. }
  35569. },
  35570. abortRequest: function NetworkManager_abortRequest(xhrId) {
  35571. var xhr = this.pendingRequests[xhrId].xhr;
  35572. delete this.pendingRequests[xhrId];
  35573. xhr.abort();
  35574. }
  35575. };
  35576. var assert = sharedUtil.assert;
  35577. var createPromiseCapability = sharedUtil.createPromiseCapability;
  35578. var isInt = sharedUtil.isInt;
  35579. var MissingPDFException = sharedUtil.MissingPDFException;
  35580. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  35581. function PDFNetworkStream(options) {
  35582. this._options = options;
  35583. var source = options.source;
  35584. this._manager = new NetworkManager(source.url, {
  35585. httpHeaders: source.httpHeaders,
  35586. withCredentials: source.withCredentials
  35587. });
  35588. this._rangeChunkSize = source.rangeChunkSize;
  35589. this._fullRequestReader = null;
  35590. this._rangeRequestReaders = [];
  35591. }
  35592. PDFNetworkStream.prototype = {
  35593. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  35594. var i = this._rangeRequestReaders.indexOf(reader);
  35595. if (i >= 0) {
  35596. this._rangeRequestReaders.splice(i, 1);
  35597. }
  35598. },
  35599. getFullReader: function PDFNetworkStream_getFullReader() {
  35600. assert(!this._fullRequestReader);
  35601. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  35602. return this._fullRequestReader;
  35603. },
  35604. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  35605. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  35606. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  35607. this._rangeRequestReaders.push(reader);
  35608. return reader;
  35609. },
  35610. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  35611. if (this._fullRequestReader) {
  35612. this._fullRequestReader.cancel(reason);
  35613. }
  35614. var readers = this._rangeRequestReaders.slice(0);
  35615. readers.forEach(function (reader) {
  35616. reader.cancel(reason);
  35617. });
  35618. }
  35619. };
  35620. function PDFNetworkStreamFullRequestReader(manager, options) {
  35621. this._manager = manager;
  35622. var source = options.source;
  35623. var args = {
  35624. onHeadersReceived: this._onHeadersReceived.bind(this),
  35625. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  35626. onDone: this._onDone.bind(this),
  35627. onError: this._onError.bind(this),
  35628. onProgress: this._onProgress.bind(this)
  35629. };
  35630. this._url = source.url;
  35631. this._fullRequestId = manager.requestFull(args);
  35632. this._headersReceivedCapability = createPromiseCapability();
  35633. this._disableRange = options.disableRange || false;
  35634. this._contentLength = source.length;
  35635. this._rangeChunkSize = source.rangeChunkSize;
  35636. if (!this._rangeChunkSize && !this._disableRange) {
  35637. this._disableRange = true;
  35638. }
  35639. this._isStreamingSupported = false;
  35640. this._isRangeSupported = false;
  35641. this._cachedChunks = [];
  35642. this._requests = [];
  35643. this._done = false;
  35644. this._storedError = undefined;
  35645. this.onProgress = null;
  35646. }
  35647. PDFNetworkStreamFullRequestReader.prototype = {
  35648. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  35649. if (this._disableRange) {
  35650. return false;
  35651. }
  35652. var networkManager = this._manager;
  35653. if (!networkManager.isHttp) {
  35654. return false;
  35655. }
  35656. var fullRequestXhrId = this._fullRequestId;
  35657. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  35658. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  35659. return false;
  35660. }
  35661. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  35662. if (contentEncoding !== 'identity') {
  35663. return false;
  35664. }
  35665. var length = fullRequestXhr.getResponseHeader('Content-Length');
  35666. length = parseInt(length, 10);
  35667. if (!isInt(length)) {
  35668. return false;
  35669. }
  35670. this._contentLength = length;
  35671. if (length <= 2 * this._rangeChunkSize) {
  35672. return false;
  35673. }
  35674. return true;
  35675. },
  35676. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  35677. if (this._validateRangeRequestCapabilities()) {
  35678. this._isRangeSupported = true;
  35679. }
  35680. var networkManager = this._manager;
  35681. var fullRequestXhrId = this._fullRequestId;
  35682. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  35683. this._isStreamingSupported = true;
  35684. } else if (this._isRangeSupported) {
  35685. networkManager.abortRequest(fullRequestXhrId);
  35686. }
  35687. this._headersReceivedCapability.resolve();
  35688. },
  35689. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  35690. if (this._requests.length > 0) {
  35691. var requestCapability = this._requests.shift();
  35692. requestCapability.resolve({
  35693. value: chunk,
  35694. done: false
  35695. });
  35696. } else {
  35697. this._cachedChunks.push(chunk);
  35698. }
  35699. },
  35700. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  35701. if (args) {
  35702. this._onProgressiveData(args.chunk);
  35703. }
  35704. this._done = true;
  35705. if (this._cachedChunks.length > 0) {
  35706. return;
  35707. }
  35708. this._requests.forEach(function (requestCapability) {
  35709. requestCapability.resolve({
  35710. value: undefined,
  35711. done: true
  35712. });
  35713. });
  35714. this._requests = [];
  35715. },
  35716. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  35717. var url = this._url;
  35718. var exception;
  35719. if (status === 404 || status === 0 && /^file:/.test(url)) {
  35720. exception = new MissingPDFException('Missing PDF "' + url + '".');
  35721. } else {
  35722. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  35723. }
  35724. this._storedError = exception;
  35725. this._headersReceivedCapability.reject(exception);
  35726. this._requests.forEach(function (requestCapability) {
  35727. requestCapability.reject(exception);
  35728. });
  35729. this._requests = [];
  35730. this._cachedChunks = [];
  35731. },
  35732. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  35733. if (this.onProgress) {
  35734. this.onProgress({
  35735. loaded: data.loaded,
  35736. total: data.lengthComputable ? data.total : this._contentLength
  35737. });
  35738. }
  35739. },
  35740. get isRangeSupported() {
  35741. return this._isRangeSupported;
  35742. },
  35743. get isStreamingSupported() {
  35744. return this._isStreamingSupported;
  35745. },
  35746. get contentLength() {
  35747. return this._contentLength;
  35748. },
  35749. get headersReady() {
  35750. return this._headersReceivedCapability.promise;
  35751. },
  35752. read: function PDFNetworkStreamFullRequestReader_read() {
  35753. if (this._storedError) {
  35754. return Promise.reject(this._storedError);
  35755. }
  35756. if (this._cachedChunks.length > 0) {
  35757. var chunk = this._cachedChunks.shift();
  35758. return Promise.resolve(chunk);
  35759. }
  35760. if (this._done) {
  35761. return Promise.resolve({
  35762. value: undefined,
  35763. done: true
  35764. });
  35765. }
  35766. var requestCapability = createPromiseCapability();
  35767. this._requests.push(requestCapability);
  35768. return requestCapability.promise;
  35769. },
  35770. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  35771. this._done = true;
  35772. this._headersReceivedCapability.reject(reason);
  35773. this._requests.forEach(function (requestCapability) {
  35774. requestCapability.resolve({
  35775. value: undefined,
  35776. done: true
  35777. });
  35778. });
  35779. this._requests = [];
  35780. if (this._manager.isPendingRequest(this._fullRequestId)) {
  35781. this._manager.abortRequest(this._fullRequestId);
  35782. }
  35783. this._fullRequestReader = null;
  35784. }
  35785. };
  35786. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  35787. this._manager = manager;
  35788. var args = {
  35789. onDone: this._onDone.bind(this),
  35790. onProgress: this._onProgress.bind(this)
  35791. };
  35792. this._requestId = manager.requestRange(begin, end, args);
  35793. this._requests = [];
  35794. this._queuedChunk = null;
  35795. this._done = false;
  35796. this.onProgress = null;
  35797. this.onClosed = null;
  35798. }
  35799. PDFNetworkStreamRangeRequestReader.prototype = {
  35800. _close: function PDFNetworkStreamRangeRequestReader_close() {
  35801. if (this.onClosed) {
  35802. this.onClosed(this);
  35803. }
  35804. },
  35805. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  35806. var chunk = data.chunk;
  35807. if (this._requests.length > 0) {
  35808. var requestCapability = this._requests.shift();
  35809. requestCapability.resolve({
  35810. value: chunk,
  35811. done: false
  35812. });
  35813. } else {
  35814. this._queuedChunk = chunk;
  35815. }
  35816. this._done = true;
  35817. this._requests.forEach(function (requestCapability) {
  35818. requestCapability.resolve({
  35819. value: undefined,
  35820. done: true
  35821. });
  35822. });
  35823. this._requests = [];
  35824. this._close();
  35825. },
  35826. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35827. if (!this.isStreamingSupported && this.onProgress) {
  35828. this.onProgress({ loaded: evt.loaded });
  35829. }
  35830. },
  35831. get isStreamingSupported() {
  35832. return false;
  35833. },
  35834. read: function PDFNetworkStreamRangeRequestReader_read() {
  35835. if (this._queuedChunk !== null) {
  35836. var chunk = this._queuedChunk;
  35837. this._queuedChunk = null;
  35838. return Promise.resolve({
  35839. value: chunk,
  35840. done: false
  35841. });
  35842. }
  35843. if (this._done) {
  35844. return Promise.resolve({
  35845. value: undefined,
  35846. done: true
  35847. });
  35848. }
  35849. var requestCapability = createPromiseCapability();
  35850. this._requests.push(requestCapability);
  35851. return requestCapability.promise;
  35852. },
  35853. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35854. this._done = true;
  35855. this._requests.forEach(function (requestCapability) {
  35856. requestCapability.resolve({
  35857. value: undefined,
  35858. done: true
  35859. });
  35860. });
  35861. this._requests = [];
  35862. if (this._manager.isPendingRequest(this._requestId)) {
  35863. this._manager.abortRequest(this._requestId);
  35864. }
  35865. this._close();
  35866. }
  35867. };
  35868. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35869. exports.PDFNetworkStream = PDFNetworkStream;
  35870. exports.NetworkManager = NetworkManager;
  35871. /***/ }),
  35872. /* 19 */
  35873. /***/ (function(module, exports) {
  35874. var g;
  35875. g = function () {
  35876. return this;
  35877. }();
  35878. try {
  35879. g = g || Function("return this")() || (1, eval)("this");
  35880. } catch (e) {
  35881. if (typeof window === "object")
  35882. g = window;
  35883. }
  35884. module.exports = g;
  35885. /***/ }),
  35886. /* 20 */
  35887. /***/ (function(module, exports) {
  35888. module.exports = function (module) {
  35889. if (!module.webpackPolyfill) {
  35890. module.deprecate = function () {
  35891. };
  35892. module.paths = [];
  35893. if (!module.children)
  35894. module.children = [];
  35895. Object.defineProperty(module, "loaded", {
  35896. enumerable: true,
  35897. get: function () {
  35898. return module.l;
  35899. }
  35900. });
  35901. Object.defineProperty(module, "id", {
  35902. enumerable: true,
  35903. get: function () {
  35904. return module.i;
  35905. }
  35906. });
  35907. module.webpackPolyfill = 1;
  35908. }
  35909. return module;
  35910. };
  35911. /***/ }),
  35912. /* 21 */
  35913. /***/ (function(module, exports, __w_pdfjs_require__) {
  35914. "use strict";
  35915. var sharedUtil = __w_pdfjs_require__(0);
  35916. var corePrimitives = __w_pdfjs_require__(1);
  35917. var coreStream = __w_pdfjs_require__(2);
  35918. var coreColorSpace = __w_pdfjs_require__(3);
  35919. var coreObj = __w_pdfjs_require__(15);
  35920. var coreEvaluator = __w_pdfjs_require__(13);
  35921. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35922. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35923. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35924. var AnnotationType = sharedUtil.AnnotationType;
  35925. var OPS = sharedUtil.OPS;
  35926. var Util = sharedUtil.Util;
  35927. var isArray = sharedUtil.isArray;
  35928. var isInt = sharedUtil.isInt;
  35929. var stringToBytes = sharedUtil.stringToBytes;
  35930. var stringToPDFString = sharedUtil.stringToPDFString;
  35931. var warn = sharedUtil.warn;
  35932. var Dict = corePrimitives.Dict;
  35933. var isDict = corePrimitives.isDict;
  35934. var isName = corePrimitives.isName;
  35935. var isRef = corePrimitives.isRef;
  35936. var Stream = coreStream.Stream;
  35937. var ColorSpace = coreColorSpace.ColorSpace;
  35938. var Catalog = coreObj.Catalog;
  35939. var ObjectLoader = coreObj.ObjectLoader;
  35940. var FileSpec = coreObj.FileSpec;
  35941. var OperatorList = coreEvaluator.OperatorList;
  35942. function AnnotationFactory() {
  35943. }
  35944. AnnotationFactory.prototype = {
  35945. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35946. var dict = xref.fetchIfRef(ref);
  35947. if (!isDict(dict)) {
  35948. return;
  35949. }
  35950. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35951. var subtype = dict.get('Subtype');
  35952. subtype = isName(subtype) ? subtype.name : null;
  35953. var parameters = {
  35954. xref: xref,
  35955. dict: dict,
  35956. ref: isRef(ref) ? ref : null,
  35957. subtype: subtype,
  35958. id: id,
  35959. pdfManager: pdfManager
  35960. };
  35961. switch (subtype) {
  35962. case 'Link':
  35963. return new LinkAnnotation(parameters);
  35964. case 'Text':
  35965. return new TextAnnotation(parameters);
  35966. case 'Widget':
  35967. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35968. fieldType = isName(fieldType) ? fieldType.name : null;
  35969. switch (fieldType) {
  35970. case 'Tx':
  35971. return new TextWidgetAnnotation(parameters);
  35972. case 'Btn':
  35973. return new ButtonWidgetAnnotation(parameters);
  35974. case 'Ch':
  35975. return new ChoiceWidgetAnnotation(parameters);
  35976. }
  35977. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35978. return new WidgetAnnotation(parameters);
  35979. case 'Popup':
  35980. return new PopupAnnotation(parameters);
  35981. case 'Highlight':
  35982. return new HighlightAnnotation(parameters);
  35983. case 'Underline':
  35984. return new UnderlineAnnotation(parameters);
  35985. case 'Squiggly':
  35986. return new SquigglyAnnotation(parameters);
  35987. case 'StrikeOut':
  35988. return new StrikeOutAnnotation(parameters);
  35989. case 'FileAttachment':
  35990. return new FileAttachmentAnnotation(parameters);
  35991. default:
  35992. if (!subtype) {
  35993. warn('Annotation is missing the required /Subtype.');
  35994. } else {
  35995. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35996. }
  35997. return new Annotation(parameters);
  35998. }
  35999. }
  36000. };
  36001. var Annotation = function AnnotationClosure() {
  36002. function getTransformMatrix(rect, bbox, matrix) {
  36003. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  36004. var minX = bounds[0];
  36005. var minY = bounds[1];
  36006. var maxX = bounds[2];
  36007. var maxY = bounds[3];
  36008. if (minX === maxX || minY === maxY) {
  36009. return [
  36010. 1,
  36011. 0,
  36012. 0,
  36013. 1,
  36014. rect[0],
  36015. rect[1]
  36016. ];
  36017. }
  36018. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  36019. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  36020. return [
  36021. xRatio,
  36022. 0,
  36023. 0,
  36024. yRatio,
  36025. rect[0] - minX * xRatio,
  36026. rect[1] - minY * yRatio
  36027. ];
  36028. }
  36029. function getDefaultAppearance(dict) {
  36030. var appearanceState = dict.get('AP');
  36031. if (!isDict(appearanceState)) {
  36032. return;
  36033. }
  36034. var appearance;
  36035. var appearances = appearanceState.get('N');
  36036. if (isDict(appearances)) {
  36037. var as = dict.get('AS');
  36038. if (as && appearances.has(as.name)) {
  36039. appearance = appearances.get(as.name);
  36040. }
  36041. } else {
  36042. appearance = appearances;
  36043. }
  36044. return appearance;
  36045. }
  36046. function Annotation(params) {
  36047. var dict = params.dict;
  36048. this.setFlags(dict.get('F'));
  36049. this.setRectangle(dict.getArray('Rect'));
  36050. this.setColor(dict.getArray('C'));
  36051. this.setBorderStyle(dict);
  36052. this.appearance = getDefaultAppearance(dict);
  36053. this.data = {};
  36054. this.data.id = params.id;
  36055. this.data.subtype = params.subtype;
  36056. this.data.annotationFlags = this.flags;
  36057. this.data.rect = this.rectangle;
  36058. this.data.color = this.color;
  36059. this.data.borderStyle = this.borderStyle;
  36060. this.data.hasAppearance = !!this.appearance;
  36061. }
  36062. Annotation.prototype = {
  36063. _hasFlag: function Annotation_hasFlag(flags, flag) {
  36064. return !!(flags & flag);
  36065. },
  36066. _isViewable: function Annotation_isViewable(flags) {
  36067. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  36068. },
  36069. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  36070. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  36071. },
  36072. get viewable() {
  36073. if (this.flags === 0) {
  36074. return true;
  36075. }
  36076. return this._isViewable(this.flags);
  36077. },
  36078. get printable() {
  36079. if (this.flags === 0) {
  36080. return false;
  36081. }
  36082. return this._isPrintable(this.flags);
  36083. },
  36084. setFlags: function Annotation_setFlags(flags) {
  36085. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  36086. },
  36087. hasFlag: function Annotation_hasFlag(flag) {
  36088. return this._hasFlag(this.flags, flag);
  36089. },
  36090. setRectangle: function Annotation_setRectangle(rectangle) {
  36091. if (isArray(rectangle) && rectangle.length === 4) {
  36092. this.rectangle = Util.normalizeRect(rectangle);
  36093. } else {
  36094. this.rectangle = [
  36095. 0,
  36096. 0,
  36097. 0,
  36098. 0
  36099. ];
  36100. }
  36101. },
  36102. setColor: function Annotation_setColor(color) {
  36103. var rgbColor = new Uint8Array(3);
  36104. if (!isArray(color)) {
  36105. this.color = rgbColor;
  36106. return;
  36107. }
  36108. switch (color.length) {
  36109. case 0:
  36110. this.color = null;
  36111. break;
  36112. case 1:
  36113. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  36114. this.color = rgbColor;
  36115. break;
  36116. case 3:
  36117. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  36118. this.color = rgbColor;
  36119. break;
  36120. case 4:
  36121. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  36122. this.color = rgbColor;
  36123. break;
  36124. default:
  36125. this.color = rgbColor;
  36126. break;
  36127. }
  36128. },
  36129. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  36130. this.borderStyle = new AnnotationBorderStyle();
  36131. if (!isDict(borderStyle)) {
  36132. return;
  36133. }
  36134. if (borderStyle.has('BS')) {
  36135. var dict = borderStyle.get('BS');
  36136. var dictType = dict.get('Type');
  36137. if (!dictType || isName(dictType, 'Border')) {
  36138. this.borderStyle.setWidth(dict.get('W'));
  36139. this.borderStyle.setStyle(dict.get('S'));
  36140. this.borderStyle.setDashArray(dict.getArray('D'));
  36141. }
  36142. } else if (borderStyle.has('Border')) {
  36143. var array = borderStyle.getArray('Border');
  36144. if (isArray(array) && array.length >= 3) {
  36145. this.borderStyle.setHorizontalCornerRadius(array[0]);
  36146. this.borderStyle.setVerticalCornerRadius(array[1]);
  36147. this.borderStyle.setWidth(array[2]);
  36148. if (array.length === 4) {
  36149. this.borderStyle.setDashArray(array[3]);
  36150. }
  36151. }
  36152. } else {
  36153. this.borderStyle.setWidth(0);
  36154. }
  36155. },
  36156. _preparePopup: function Annotation_preparePopup(dict) {
  36157. if (!dict.has('C')) {
  36158. this.data.color = null;
  36159. }
  36160. this.data.hasPopup = dict.has('Popup');
  36161. this.data.title = stringToPDFString(dict.get('T') || '');
  36162. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  36163. },
  36164. loadResources: function Annotation_loadResources(keys) {
  36165. return new Promise(function (resolve, reject) {
  36166. this.appearance.dict.getAsync('Resources').then(function (resources) {
  36167. if (!resources) {
  36168. resolve();
  36169. return;
  36170. }
  36171. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  36172. objectLoader.load().then(function () {
  36173. resolve(resources);
  36174. }, reject);
  36175. }, reject);
  36176. }.bind(this));
  36177. },
  36178. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  36179. if (!this.appearance) {
  36180. return Promise.resolve(new OperatorList());
  36181. }
  36182. var data = this.data;
  36183. var appearanceDict = this.appearance.dict;
  36184. var resourcesPromise = this.loadResources([
  36185. 'ExtGState',
  36186. 'ColorSpace',
  36187. 'Pattern',
  36188. 'Shading',
  36189. 'XObject',
  36190. 'Font'
  36191. ]);
  36192. var bbox = appearanceDict.getArray('BBox') || [
  36193. 0,
  36194. 0,
  36195. 1,
  36196. 1
  36197. ];
  36198. var matrix = appearanceDict.getArray('Matrix') || [
  36199. 1,
  36200. 0,
  36201. 0,
  36202. 1,
  36203. 0,
  36204. 0
  36205. ];
  36206. var transform = getTransformMatrix(data.rect, bbox, matrix);
  36207. var self = this;
  36208. return resourcesPromise.then(function (resources) {
  36209. var opList = new OperatorList();
  36210. opList.addOp(OPS.beginAnnotation, [
  36211. data.rect,
  36212. transform,
  36213. matrix
  36214. ]);
  36215. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  36216. opList.addOp(OPS.endAnnotation, []);
  36217. self.appearance.reset();
  36218. return opList;
  36219. });
  36220. });
  36221. }
  36222. };
  36223. Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) {
  36224. var annotationPromises = [];
  36225. for (var i = 0, n = annotations.length; i < n; ++i) {
  36226. if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) {
  36227. annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms));
  36228. }
  36229. }
  36230. return Promise.all(annotationPromises).then(function (operatorLists) {
  36231. opList.addOp(OPS.beginAnnotations, []);
  36232. for (var i = 0, n = operatorLists.length; i < n; ++i) {
  36233. opList.addOpList(operatorLists[i]);
  36234. }
  36235. opList.addOp(OPS.endAnnotations, []);
  36236. });
  36237. };
  36238. return Annotation;
  36239. }();
  36240. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  36241. function AnnotationBorderStyle() {
  36242. this.width = 1;
  36243. this.style = AnnotationBorderStyleType.SOLID;
  36244. this.dashArray = [3];
  36245. this.horizontalCornerRadius = 0;
  36246. this.verticalCornerRadius = 0;
  36247. }
  36248. AnnotationBorderStyle.prototype = {
  36249. setWidth: function AnnotationBorderStyle_setWidth(width) {
  36250. if (width === (width | 0)) {
  36251. this.width = width;
  36252. }
  36253. },
  36254. setStyle: function AnnotationBorderStyle_setStyle(style) {
  36255. if (!style) {
  36256. return;
  36257. }
  36258. switch (style.name) {
  36259. case 'S':
  36260. this.style = AnnotationBorderStyleType.SOLID;
  36261. break;
  36262. case 'D':
  36263. this.style = AnnotationBorderStyleType.DASHED;
  36264. break;
  36265. case 'B':
  36266. this.style = AnnotationBorderStyleType.BEVELED;
  36267. break;
  36268. case 'I':
  36269. this.style = AnnotationBorderStyleType.INSET;
  36270. break;
  36271. case 'U':
  36272. this.style = AnnotationBorderStyleType.UNDERLINE;
  36273. break;
  36274. default:
  36275. break;
  36276. }
  36277. },
  36278. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  36279. if (isArray(dashArray) && dashArray.length > 0) {
  36280. var isValid = true;
  36281. var allZeros = true;
  36282. for (var i = 0, len = dashArray.length; i < len; i++) {
  36283. var element = dashArray[i];
  36284. var validNumber = +element >= 0;
  36285. if (!validNumber) {
  36286. isValid = false;
  36287. break;
  36288. } else if (element > 0) {
  36289. allZeros = false;
  36290. }
  36291. }
  36292. if (isValid && !allZeros) {
  36293. this.dashArray = dashArray;
  36294. } else {
  36295. this.width = 0;
  36296. }
  36297. } else if (dashArray) {
  36298. this.width = 0;
  36299. }
  36300. },
  36301. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  36302. if (radius === (radius | 0)) {
  36303. this.horizontalCornerRadius = radius;
  36304. }
  36305. },
  36306. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  36307. if (radius === (radius | 0)) {
  36308. this.verticalCornerRadius = radius;
  36309. }
  36310. }
  36311. };
  36312. return AnnotationBorderStyle;
  36313. }();
  36314. var WidgetAnnotation = function WidgetAnnotationClosure() {
  36315. function WidgetAnnotation(params) {
  36316. Annotation.call(this, params);
  36317. var dict = params.dict;
  36318. var data = this.data;
  36319. data.annotationType = AnnotationType.WIDGET;
  36320. data.fieldName = this._constructFieldName(dict);
  36321. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  36322. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  36323. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  36324. var fieldType = Util.getInheritableProperty(dict, 'FT');
  36325. data.fieldType = isName(fieldType) ? fieldType.name : null;
  36326. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  36327. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  36328. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  36329. data.fieldFlags = 0;
  36330. }
  36331. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  36332. if (data.fieldType === 'Sig') {
  36333. this.setFlags(AnnotationFlag.HIDDEN);
  36334. }
  36335. }
  36336. Util.inherit(WidgetAnnotation, Annotation, {
  36337. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  36338. if (!dict.has('T') && !dict.has('Parent')) {
  36339. warn('Unknown field name, falling back to empty field name.');
  36340. return '';
  36341. }
  36342. if (!dict.has('Parent')) {
  36343. return stringToPDFString(dict.get('T'));
  36344. }
  36345. var fieldName = [];
  36346. if (dict.has('T')) {
  36347. fieldName.unshift(stringToPDFString(dict.get('T')));
  36348. }
  36349. var loopDict = dict;
  36350. while (loopDict.has('Parent')) {
  36351. loopDict = loopDict.get('Parent');
  36352. if (loopDict.has('T')) {
  36353. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  36354. }
  36355. }
  36356. return fieldName.join('.');
  36357. },
  36358. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  36359. return !!(this.data.fieldFlags & flag);
  36360. }
  36361. });
  36362. return WidgetAnnotation;
  36363. }();
  36364. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  36365. function TextWidgetAnnotation(params) {
  36366. WidgetAnnotation.call(this, params);
  36367. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  36368. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  36369. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  36370. alignment = null;
  36371. }
  36372. this.data.textAlignment = alignment;
  36373. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  36374. if (!isInt(maximumLength) || maximumLength < 0) {
  36375. maximumLength = null;
  36376. }
  36377. this.data.maxLen = maximumLength;
  36378. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  36379. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  36380. }
  36381. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  36382. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36383. var operatorList = new OperatorList();
  36384. if (renderForms) {
  36385. return Promise.resolve(operatorList);
  36386. }
  36387. if (this.appearance) {
  36388. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36389. }
  36390. if (!this.data.defaultAppearance) {
  36391. return Promise.resolve(operatorList);
  36392. }
  36393. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  36394. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  36395. return operatorList;
  36396. });
  36397. }
  36398. });
  36399. return TextWidgetAnnotation;
  36400. }();
  36401. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  36402. function ButtonWidgetAnnotation(params) {
  36403. WidgetAnnotation.call(this, params);
  36404. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36405. if (this.data.checkBox) {
  36406. if (!isName(this.data.fieldValue)) {
  36407. return;
  36408. }
  36409. this.data.fieldValue = this.data.fieldValue.name;
  36410. }
  36411. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36412. if (this.data.radioButton) {
  36413. this.data.fieldValue = this.data.buttonValue = null;
  36414. var fieldParent = params.dict.get('Parent');
  36415. if (isDict(fieldParent) && fieldParent.has('V')) {
  36416. var fieldParentValue = fieldParent.get('V');
  36417. if (isName(fieldParentValue)) {
  36418. this.data.fieldValue = fieldParentValue.name;
  36419. }
  36420. }
  36421. var appearanceStates = params.dict.get('AP');
  36422. if (!isDict(appearanceStates)) {
  36423. return;
  36424. }
  36425. var normalAppearanceState = appearanceStates.get('N');
  36426. if (!isDict(normalAppearanceState)) {
  36427. return;
  36428. }
  36429. var keys = normalAppearanceState.getKeys();
  36430. for (var i = 0, ii = keys.length; i < ii; i++) {
  36431. if (keys[i] !== 'Off') {
  36432. this.data.buttonValue = keys[i];
  36433. break;
  36434. }
  36435. }
  36436. }
  36437. }
  36438. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  36439. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36440. var operatorList = new OperatorList();
  36441. if (renderForms) {
  36442. return Promise.resolve(operatorList);
  36443. }
  36444. if (this.appearance) {
  36445. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36446. }
  36447. return Promise.resolve(operatorList);
  36448. }
  36449. });
  36450. return ButtonWidgetAnnotation;
  36451. }();
  36452. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  36453. function ChoiceWidgetAnnotation(params) {
  36454. WidgetAnnotation.call(this, params);
  36455. this.data.options = [];
  36456. var options = params.dict.get('Opt');
  36457. if (isArray(options)) {
  36458. var xref = params.xref;
  36459. for (var i = 0, ii = options.length; i < ii; i++) {
  36460. var option = xref.fetchIfRef(options[i]);
  36461. var isOptionArray = isArray(option);
  36462. this.data.options[i] = {
  36463. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  36464. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  36465. };
  36466. }
  36467. }
  36468. if (!isArray(this.data.fieldValue)) {
  36469. this.data.fieldValue = [this.data.fieldValue];
  36470. }
  36471. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  36472. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  36473. }
  36474. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  36475. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36476. var operatorList = new OperatorList();
  36477. if (renderForms) {
  36478. return Promise.resolve(operatorList);
  36479. }
  36480. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36481. }
  36482. });
  36483. return ChoiceWidgetAnnotation;
  36484. }();
  36485. var TextAnnotation = function TextAnnotationClosure() {
  36486. var DEFAULT_ICON_SIZE = 22;
  36487. function TextAnnotation(parameters) {
  36488. Annotation.call(this, parameters);
  36489. this.data.annotationType = AnnotationType.TEXT;
  36490. if (this.data.hasAppearance) {
  36491. this.data.name = 'NoIcon';
  36492. } else {
  36493. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  36494. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  36495. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  36496. }
  36497. this._preparePopup(parameters.dict);
  36498. }
  36499. Util.inherit(TextAnnotation, Annotation, {});
  36500. return TextAnnotation;
  36501. }();
  36502. var LinkAnnotation = function LinkAnnotationClosure() {
  36503. function LinkAnnotation(params) {
  36504. Annotation.call(this, params);
  36505. var data = this.data;
  36506. data.annotationType = AnnotationType.LINK;
  36507. Catalog.parseDestDictionary({
  36508. destDict: params.dict,
  36509. resultObj: data,
  36510. docBaseUrl: params.pdfManager.docBaseUrl
  36511. });
  36512. }
  36513. Util.inherit(LinkAnnotation, Annotation, {});
  36514. return LinkAnnotation;
  36515. }();
  36516. var PopupAnnotation = function PopupAnnotationClosure() {
  36517. function PopupAnnotation(parameters) {
  36518. Annotation.call(this, parameters);
  36519. this.data.annotationType = AnnotationType.POPUP;
  36520. var dict = parameters.dict;
  36521. var parentItem = dict.get('Parent');
  36522. if (!parentItem) {
  36523. warn('Popup annotation has a missing or invalid parent annotation.');
  36524. return;
  36525. }
  36526. this.data.parentId = dict.getRaw('Parent').toString();
  36527. this.data.title = stringToPDFString(parentItem.get('T') || '');
  36528. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  36529. if (!parentItem.has('C')) {
  36530. this.data.color = null;
  36531. } else {
  36532. this.setColor(parentItem.getArray('C'));
  36533. this.data.color = this.color;
  36534. }
  36535. if (!this.viewable) {
  36536. var parentFlags = parentItem.get('F');
  36537. if (this._isViewable(parentFlags)) {
  36538. this.setFlags(parentFlags);
  36539. }
  36540. }
  36541. }
  36542. Util.inherit(PopupAnnotation, Annotation, {});
  36543. return PopupAnnotation;
  36544. }();
  36545. var HighlightAnnotation = function HighlightAnnotationClosure() {
  36546. function HighlightAnnotation(parameters) {
  36547. Annotation.call(this, parameters);
  36548. this.data.annotationType = AnnotationType.HIGHLIGHT;
  36549. this._preparePopup(parameters.dict);
  36550. this.data.borderStyle.setWidth(0);
  36551. }
  36552. Util.inherit(HighlightAnnotation, Annotation, {});
  36553. return HighlightAnnotation;
  36554. }();
  36555. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  36556. function UnderlineAnnotation(parameters) {
  36557. Annotation.call(this, parameters);
  36558. this.data.annotationType = AnnotationType.UNDERLINE;
  36559. this._preparePopup(parameters.dict);
  36560. this.data.borderStyle.setWidth(0);
  36561. }
  36562. Util.inherit(UnderlineAnnotation, Annotation, {});
  36563. return UnderlineAnnotation;
  36564. }();
  36565. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  36566. function SquigglyAnnotation(parameters) {
  36567. Annotation.call(this, parameters);
  36568. this.data.annotationType = AnnotationType.SQUIGGLY;
  36569. this._preparePopup(parameters.dict);
  36570. this.data.borderStyle.setWidth(0);
  36571. }
  36572. Util.inherit(SquigglyAnnotation, Annotation, {});
  36573. return SquigglyAnnotation;
  36574. }();
  36575. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  36576. function StrikeOutAnnotation(parameters) {
  36577. Annotation.call(this, parameters);
  36578. this.data.annotationType = AnnotationType.STRIKEOUT;
  36579. this._preparePopup(parameters.dict);
  36580. this.data.borderStyle.setWidth(0);
  36581. }
  36582. Util.inherit(StrikeOutAnnotation, Annotation, {});
  36583. return StrikeOutAnnotation;
  36584. }();
  36585. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  36586. function FileAttachmentAnnotation(parameters) {
  36587. Annotation.call(this, parameters);
  36588. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  36589. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  36590. this.data.file = file.serializable;
  36591. this._preparePopup(parameters.dict);
  36592. }
  36593. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  36594. return FileAttachmentAnnotation;
  36595. }();
  36596. exports.Annotation = Annotation;
  36597. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  36598. exports.AnnotationFactory = AnnotationFactory;
  36599. /***/ }),
  36600. /* 22 */
  36601. /***/ (function(module, exports, __w_pdfjs_require__) {
  36602. "use strict";
  36603. var sharedUtil = __w_pdfjs_require__(0);
  36604. var warn = sharedUtil.warn;
  36605. var baseTypes = [
  36606. 'BN',
  36607. 'BN',
  36608. 'BN',
  36609. 'BN',
  36610. 'BN',
  36611. 'BN',
  36612. 'BN',
  36613. 'BN',
  36614. 'BN',
  36615. 'S',
  36616. 'B',
  36617. 'S',
  36618. 'WS',
  36619. 'B',
  36620. 'BN',
  36621. 'BN',
  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. 'B',
  36635. 'B',
  36636. 'B',
  36637. 'S',
  36638. 'WS',
  36639. 'ON',
  36640. 'ON',
  36641. 'ET',
  36642. 'ET',
  36643. 'ET',
  36644. 'ON',
  36645. 'ON',
  36646. 'ON',
  36647. 'ON',
  36648. 'ON',
  36649. 'ES',
  36650. 'CS',
  36651. 'ES',
  36652. 'CS',
  36653. 'CS',
  36654. 'EN',
  36655. 'EN',
  36656. 'EN',
  36657. 'EN',
  36658. 'EN',
  36659. 'EN',
  36660. 'EN',
  36661. 'EN',
  36662. 'EN',
  36663. 'EN',
  36664. 'CS',
  36665. 'ON',
  36666. 'ON',
  36667. 'ON',
  36668. 'ON',
  36669. 'ON',
  36670. 'ON',
  36671. 'L',
  36672. 'L',
  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. 'ON',
  36698. 'ON',
  36699. 'ON',
  36700. 'ON',
  36701. 'ON',
  36702. 'ON',
  36703. 'L',
  36704. 'L',
  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. 'ON',
  36730. 'ON',
  36731. 'ON',
  36732. 'ON',
  36733. 'BN',
  36734. 'BN',
  36735. 'BN',
  36736. 'BN',
  36737. 'BN',
  36738. 'BN',
  36739. 'B',
  36740. 'BN',
  36741. 'BN',
  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. 'CS',
  36767. 'ON',
  36768. 'ET',
  36769. 'ET',
  36770. 'ET',
  36771. 'ET',
  36772. 'ON',
  36773. 'ON',
  36774. 'ON',
  36775. 'ON',
  36776. 'L',
  36777. 'ON',
  36778. 'ON',
  36779. 'BN',
  36780. 'ON',
  36781. 'ON',
  36782. 'ET',
  36783. 'ET',
  36784. 'EN',
  36785. 'EN',
  36786. 'ON',
  36787. 'L',
  36788. 'ON',
  36789. 'ON',
  36790. 'ON',
  36791. 'EN',
  36792. 'L',
  36793. 'ON',
  36794. 'ON',
  36795. 'ON',
  36796. 'ON',
  36797. 'ON',
  36798. 'L',
  36799. 'L',
  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. 'ON',
  36822. 'L',
  36823. 'L',
  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. 'ON',
  36854. 'L',
  36855. 'L',
  36856. 'L',
  36857. 'L',
  36858. 'L',
  36859. 'L',
  36860. 'L',
  36861. 'L'
  36862. ];
  36863. var arabicTypes = [
  36864. 'AN',
  36865. 'AN',
  36866. 'AN',
  36867. 'AN',
  36868. 'AN',
  36869. 'AN',
  36870. 'ON',
  36871. 'ON',
  36872. 'AL',
  36873. 'ET',
  36874. 'ET',
  36875. 'AL',
  36876. 'CS',
  36877. 'AL',
  36878. 'ON',
  36879. 'ON',
  36880. 'NSM',
  36881. 'NSM',
  36882. 'NSM',
  36883. 'NSM',
  36884. 'NSM',
  36885. 'NSM',
  36886. 'NSM',
  36887. 'NSM',
  36888. 'NSM',
  36889. 'NSM',
  36890. 'NSM',
  36891. 'AL',
  36892. 'AL',
  36893. '',
  36894. 'AL',
  36895. 'AL',
  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. 'NSM',
  36940. 'NSM',
  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. 'AN',
  36961. 'AN',
  36962. 'AN',
  36963. 'AN',
  36964. 'AN',
  36965. 'AN',
  36966. 'AN',
  36967. 'AN',
  36968. 'AN',
  36969. 'AN',
  36970. 'ET',
  36971. 'AN',
  36972. 'AN',
  36973. 'AL',
  36974. 'AL',
  36975. 'AL',
  36976. 'NSM',
  36977. 'AL',
  36978. 'AL',
  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. 'NSM',
  37079. 'NSM',
  37080. 'NSM',
  37081. 'NSM',
  37082. 'NSM',
  37083. 'NSM',
  37084. 'NSM',
  37085. 'AN',
  37086. 'ON',
  37087. 'NSM',
  37088. 'NSM',
  37089. 'NSM',
  37090. 'NSM',
  37091. 'NSM',
  37092. 'NSM',
  37093. 'AL',
  37094. 'AL',
  37095. 'NSM',
  37096. 'NSM',
  37097. 'ON',
  37098. 'NSM',
  37099. 'NSM',
  37100. 'NSM',
  37101. 'NSM',
  37102. 'AL',
  37103. 'AL',
  37104. 'EN',
  37105. 'EN',
  37106. 'EN',
  37107. 'EN',
  37108. 'EN',
  37109. 'EN',
  37110. 'EN',
  37111. 'EN',
  37112. 'EN',
  37113. 'EN',
  37114. 'AL',
  37115. 'AL',
  37116. 'AL',
  37117. 'AL',
  37118. 'AL',
  37119. 'AL'
  37120. ];
  37121. function isOdd(i) {
  37122. return (i & 1) !== 0;
  37123. }
  37124. function isEven(i) {
  37125. return (i & 1) === 0;
  37126. }
  37127. function findUnequal(arr, start, value) {
  37128. for (var j = start, jj = arr.length; j < jj; ++j) {
  37129. if (arr[j] !== value) {
  37130. return j;
  37131. }
  37132. }
  37133. return j;
  37134. }
  37135. function setValues(arr, start, end, value) {
  37136. for (var j = start; j < end; ++j) {
  37137. arr[j] = value;
  37138. }
  37139. }
  37140. function reverseValues(arr, start, end) {
  37141. for (var i = start, j = end - 1; i < j; ++i, --j) {
  37142. var temp = arr[i];
  37143. arr[i] = arr[j];
  37144. arr[j] = temp;
  37145. }
  37146. }
  37147. function createBidiText(str, isLTR, vertical) {
  37148. return {
  37149. str: str,
  37150. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  37151. };
  37152. }
  37153. var chars = [];
  37154. var types = [];
  37155. function bidi(str, startLevel, vertical) {
  37156. var isLTR = true;
  37157. var strLength = str.length;
  37158. if (strLength === 0 || vertical) {
  37159. return createBidiText(str, isLTR, vertical);
  37160. }
  37161. chars.length = strLength;
  37162. types.length = strLength;
  37163. var numBidi = 0;
  37164. var i, ii;
  37165. for (i = 0; i < strLength; ++i) {
  37166. chars[i] = str.charAt(i);
  37167. var charCode = str.charCodeAt(i);
  37168. var charType = 'L';
  37169. if (charCode <= 0x00ff) {
  37170. charType = baseTypes[charCode];
  37171. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  37172. charType = 'R';
  37173. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  37174. charType = arabicTypes[charCode & 0xff];
  37175. if (!charType) {
  37176. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  37177. }
  37178. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  37179. charType = 'AL';
  37180. }
  37181. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  37182. numBidi++;
  37183. }
  37184. types[i] = charType;
  37185. }
  37186. if (numBidi === 0) {
  37187. isLTR = true;
  37188. return createBidiText(str, isLTR);
  37189. }
  37190. if (startLevel === -1) {
  37191. if (numBidi / strLength < 0.3) {
  37192. isLTR = true;
  37193. startLevel = 0;
  37194. } else {
  37195. isLTR = false;
  37196. startLevel = 1;
  37197. }
  37198. }
  37199. var levels = [];
  37200. for (i = 0; i < strLength; ++i) {
  37201. levels[i] = startLevel;
  37202. }
  37203. var e = isOdd(startLevel) ? 'R' : 'L';
  37204. var sor = e;
  37205. var eor = sor;
  37206. var lastType = sor;
  37207. for (i = 0; i < strLength; ++i) {
  37208. if (types[i] === 'NSM') {
  37209. types[i] = lastType;
  37210. } else {
  37211. lastType = types[i];
  37212. }
  37213. }
  37214. lastType = sor;
  37215. var t;
  37216. for (i = 0; i < strLength; ++i) {
  37217. t = types[i];
  37218. if (t === 'EN') {
  37219. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  37220. } else if (t === 'R' || t === 'L' || t === 'AL') {
  37221. lastType = t;
  37222. }
  37223. }
  37224. for (i = 0; i < strLength; ++i) {
  37225. t = types[i];
  37226. if (t === 'AL') {
  37227. types[i] = 'R';
  37228. }
  37229. }
  37230. for (i = 1; i < strLength - 1; ++i) {
  37231. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  37232. types[i] = 'EN';
  37233. }
  37234. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  37235. types[i] = types[i - 1];
  37236. }
  37237. }
  37238. for (i = 0; i < strLength; ++i) {
  37239. if (types[i] === 'EN') {
  37240. var j;
  37241. for (j = i - 1; j >= 0; --j) {
  37242. if (types[j] !== 'ET') {
  37243. break;
  37244. }
  37245. types[j] = 'EN';
  37246. }
  37247. for (j = i + 1; j < strLength; ++j) {
  37248. if (types[j] !== 'ET') {
  37249. break;
  37250. }
  37251. types[j] = 'EN';
  37252. }
  37253. }
  37254. }
  37255. for (i = 0; i < strLength; ++i) {
  37256. t = types[i];
  37257. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  37258. types[i] = 'ON';
  37259. }
  37260. }
  37261. lastType = sor;
  37262. for (i = 0; i < strLength; ++i) {
  37263. t = types[i];
  37264. if (t === 'EN') {
  37265. types[i] = lastType === 'L' ? 'L' : 'EN';
  37266. } else if (t === 'R' || t === 'L') {
  37267. lastType = t;
  37268. }
  37269. }
  37270. for (i = 0; i < strLength; ++i) {
  37271. if (types[i] === 'ON') {
  37272. var end = findUnequal(types, i + 1, 'ON');
  37273. var before = sor;
  37274. if (i > 0) {
  37275. before = types[i - 1];
  37276. }
  37277. var after = eor;
  37278. if (end + 1 < strLength) {
  37279. after = types[end + 1];
  37280. }
  37281. if (before !== 'L') {
  37282. before = 'R';
  37283. }
  37284. if (after !== 'L') {
  37285. after = 'R';
  37286. }
  37287. if (before === after) {
  37288. setValues(types, i, end, before);
  37289. }
  37290. i = end - 1;
  37291. }
  37292. }
  37293. for (i = 0; i < strLength; ++i) {
  37294. if (types[i] === 'ON') {
  37295. types[i] = e;
  37296. }
  37297. }
  37298. for (i = 0; i < strLength; ++i) {
  37299. t = types[i];
  37300. if (isEven(levels[i])) {
  37301. if (t === 'R') {
  37302. levels[i] += 1;
  37303. } else if (t === 'AN' || t === 'EN') {
  37304. levels[i] += 2;
  37305. }
  37306. } else {
  37307. if (t === 'L' || t === 'AN' || t === 'EN') {
  37308. levels[i] += 1;
  37309. }
  37310. }
  37311. }
  37312. var highestLevel = -1;
  37313. var lowestOddLevel = 99;
  37314. var level;
  37315. for (i = 0, ii = levels.length; i < ii; ++i) {
  37316. level = levels[i];
  37317. if (highestLevel < level) {
  37318. highestLevel = level;
  37319. }
  37320. if (lowestOddLevel > level && isOdd(level)) {
  37321. lowestOddLevel = level;
  37322. }
  37323. }
  37324. for (level = highestLevel; level >= lowestOddLevel; --level) {
  37325. var start = -1;
  37326. for (i = 0, ii = levels.length; i < ii; ++i) {
  37327. if (levels[i] < level) {
  37328. if (start >= 0) {
  37329. reverseValues(chars, start, i);
  37330. start = -1;
  37331. }
  37332. } else if (start < 0) {
  37333. start = i;
  37334. }
  37335. }
  37336. if (start >= 0) {
  37337. reverseValues(chars, start, levels.length);
  37338. }
  37339. }
  37340. for (i = 0, ii = chars.length; i < ii; ++i) {
  37341. var ch = chars[i];
  37342. if (ch === '<' || ch === '>') {
  37343. chars[i] = '';
  37344. }
  37345. }
  37346. return createBidiText(chars.join(''), isLTR);
  37347. }
  37348. exports.bidi = bidi;
  37349. /***/ }),
  37350. /* 23 */
  37351. /***/ (function(module, exports, __w_pdfjs_require__) {
  37352. "use strict";
  37353. var ISOAdobeCharset = [
  37354. '.notdef',
  37355. 'space',
  37356. 'exclam',
  37357. 'quotedbl',
  37358. 'numbersign',
  37359. 'dollar',
  37360. 'percent',
  37361. 'ampersand',
  37362. 'quoteright',
  37363. 'parenleft',
  37364. 'parenright',
  37365. 'asterisk',
  37366. 'plus',
  37367. 'comma',
  37368. 'hyphen',
  37369. 'period',
  37370. 'slash',
  37371. 'zero',
  37372. 'one',
  37373. 'two',
  37374. 'three',
  37375. 'four',
  37376. 'five',
  37377. 'six',
  37378. 'seven',
  37379. 'eight',
  37380. 'nine',
  37381. 'colon',
  37382. 'semicolon',
  37383. 'less',
  37384. 'equal',
  37385. 'greater',
  37386. 'question',
  37387. 'at',
  37388. 'A',
  37389. 'B',
  37390. 'C',
  37391. 'D',
  37392. 'E',
  37393. 'F',
  37394. 'G',
  37395. 'H',
  37396. 'I',
  37397. 'J',
  37398. 'K',
  37399. 'L',
  37400. 'M',
  37401. 'N',
  37402. 'O',
  37403. 'P',
  37404. 'Q',
  37405. 'R',
  37406. 'S',
  37407. 'T',
  37408. 'U',
  37409. 'V',
  37410. 'W',
  37411. 'X',
  37412. 'Y',
  37413. 'Z',
  37414. 'bracketleft',
  37415. 'backslash',
  37416. 'bracketright',
  37417. 'asciicircum',
  37418. 'underscore',
  37419. 'quoteleft',
  37420. 'a',
  37421. 'b',
  37422. 'c',
  37423. 'd',
  37424. 'e',
  37425. 'f',
  37426. 'g',
  37427. 'h',
  37428. 'i',
  37429. 'j',
  37430. 'k',
  37431. 'l',
  37432. 'm',
  37433. 'n',
  37434. 'o',
  37435. 'p',
  37436. 'q',
  37437. 'r',
  37438. 's',
  37439. 't',
  37440. 'u',
  37441. 'v',
  37442. 'w',
  37443. 'x',
  37444. 'y',
  37445. 'z',
  37446. 'braceleft',
  37447. 'bar',
  37448. 'braceright',
  37449. 'asciitilde',
  37450. 'exclamdown',
  37451. 'cent',
  37452. 'sterling',
  37453. 'fraction',
  37454. 'yen',
  37455. 'florin',
  37456. 'section',
  37457. 'currency',
  37458. 'quotesingle',
  37459. 'quotedblleft',
  37460. 'guillemotleft',
  37461. 'guilsinglleft',
  37462. 'guilsinglright',
  37463. 'fi',
  37464. 'fl',
  37465. 'endash',
  37466. 'dagger',
  37467. 'daggerdbl',
  37468. 'periodcentered',
  37469. 'paragraph',
  37470. 'bullet',
  37471. 'quotesinglbase',
  37472. 'quotedblbase',
  37473. 'quotedblright',
  37474. 'guillemotright',
  37475. 'ellipsis',
  37476. 'perthousand',
  37477. 'questiondown',
  37478. 'grave',
  37479. 'acute',
  37480. 'circumflex',
  37481. 'tilde',
  37482. 'macron',
  37483. 'breve',
  37484. 'dotaccent',
  37485. 'dieresis',
  37486. 'ring',
  37487. 'cedilla',
  37488. 'hungarumlaut',
  37489. 'ogonek',
  37490. 'caron',
  37491. 'emdash',
  37492. 'AE',
  37493. 'ordfeminine',
  37494. 'Lslash',
  37495. 'Oslash',
  37496. 'OE',
  37497. 'ordmasculine',
  37498. 'ae',
  37499. 'dotlessi',
  37500. 'lslash',
  37501. 'oslash',
  37502. 'oe',
  37503. 'germandbls',
  37504. 'onesuperior',
  37505. 'logicalnot',
  37506. 'mu',
  37507. 'trademark',
  37508. 'Eth',
  37509. 'onehalf',
  37510. 'plusminus',
  37511. 'Thorn',
  37512. 'onequarter',
  37513. 'divide',
  37514. 'brokenbar',
  37515. 'degree',
  37516. 'thorn',
  37517. 'threequarters',
  37518. 'twosuperior',
  37519. 'registered',
  37520. 'minus',
  37521. 'eth',
  37522. 'multiply',
  37523. 'threesuperior',
  37524. 'copyright',
  37525. 'Aacute',
  37526. 'Acircumflex',
  37527. 'Adieresis',
  37528. 'Agrave',
  37529. 'Aring',
  37530. 'Atilde',
  37531. 'Ccedilla',
  37532. 'Eacute',
  37533. 'Ecircumflex',
  37534. 'Edieresis',
  37535. 'Egrave',
  37536. 'Iacute',
  37537. 'Icircumflex',
  37538. 'Idieresis',
  37539. 'Igrave',
  37540. 'Ntilde',
  37541. 'Oacute',
  37542. 'Ocircumflex',
  37543. 'Odieresis',
  37544. 'Ograve',
  37545. 'Otilde',
  37546. 'Scaron',
  37547. 'Uacute',
  37548. 'Ucircumflex',
  37549. 'Udieresis',
  37550. 'Ugrave',
  37551. 'Yacute',
  37552. 'Ydieresis',
  37553. 'Zcaron',
  37554. 'aacute',
  37555. 'acircumflex',
  37556. 'adieresis',
  37557. 'agrave',
  37558. 'aring',
  37559. 'atilde',
  37560. 'ccedilla',
  37561. 'eacute',
  37562. 'ecircumflex',
  37563. 'edieresis',
  37564. 'egrave',
  37565. 'iacute',
  37566. 'icircumflex',
  37567. 'idieresis',
  37568. 'igrave',
  37569. 'ntilde',
  37570. 'oacute',
  37571. 'ocircumflex',
  37572. 'odieresis',
  37573. 'ograve',
  37574. 'otilde',
  37575. 'scaron',
  37576. 'uacute',
  37577. 'ucircumflex',
  37578. 'udieresis',
  37579. 'ugrave',
  37580. 'yacute',
  37581. 'ydieresis',
  37582. 'zcaron'
  37583. ];
  37584. var ExpertCharset = [
  37585. '.notdef',
  37586. 'space',
  37587. 'exclamsmall',
  37588. 'Hungarumlautsmall',
  37589. 'dollaroldstyle',
  37590. 'dollarsuperior',
  37591. 'ampersandsmall',
  37592. 'Acutesmall',
  37593. 'parenleftsuperior',
  37594. 'parenrightsuperior',
  37595. 'twodotenleader',
  37596. 'onedotenleader',
  37597. 'comma',
  37598. 'hyphen',
  37599. 'period',
  37600. 'fraction',
  37601. 'zerooldstyle',
  37602. 'oneoldstyle',
  37603. 'twooldstyle',
  37604. 'threeoldstyle',
  37605. 'fouroldstyle',
  37606. 'fiveoldstyle',
  37607. 'sixoldstyle',
  37608. 'sevenoldstyle',
  37609. 'eightoldstyle',
  37610. 'nineoldstyle',
  37611. 'colon',
  37612. 'semicolon',
  37613. 'commasuperior',
  37614. 'threequartersemdash',
  37615. 'periodsuperior',
  37616. 'questionsmall',
  37617. 'asuperior',
  37618. 'bsuperior',
  37619. 'centsuperior',
  37620. 'dsuperior',
  37621. 'esuperior',
  37622. 'isuperior',
  37623. 'lsuperior',
  37624. 'msuperior',
  37625. 'nsuperior',
  37626. 'osuperior',
  37627. 'rsuperior',
  37628. 'ssuperior',
  37629. 'tsuperior',
  37630. 'ff',
  37631. 'fi',
  37632. 'fl',
  37633. 'ffi',
  37634. 'ffl',
  37635. 'parenleftinferior',
  37636. 'parenrightinferior',
  37637. 'Circumflexsmall',
  37638. 'hyphensuperior',
  37639. 'Gravesmall',
  37640. 'Asmall',
  37641. 'Bsmall',
  37642. 'Csmall',
  37643. 'Dsmall',
  37644. 'Esmall',
  37645. 'Fsmall',
  37646. 'Gsmall',
  37647. 'Hsmall',
  37648. 'Ismall',
  37649. 'Jsmall',
  37650. 'Ksmall',
  37651. 'Lsmall',
  37652. 'Msmall',
  37653. 'Nsmall',
  37654. 'Osmall',
  37655. 'Psmall',
  37656. 'Qsmall',
  37657. 'Rsmall',
  37658. 'Ssmall',
  37659. 'Tsmall',
  37660. 'Usmall',
  37661. 'Vsmall',
  37662. 'Wsmall',
  37663. 'Xsmall',
  37664. 'Ysmall',
  37665. 'Zsmall',
  37666. 'colonmonetary',
  37667. 'onefitted',
  37668. 'rupiah',
  37669. 'Tildesmall',
  37670. 'exclamdownsmall',
  37671. 'centoldstyle',
  37672. 'Lslashsmall',
  37673. 'Scaronsmall',
  37674. 'Zcaronsmall',
  37675. 'Dieresissmall',
  37676. 'Brevesmall',
  37677. 'Caronsmall',
  37678. 'Dotaccentsmall',
  37679. 'Macronsmall',
  37680. 'figuredash',
  37681. 'hypheninferior',
  37682. 'Ogoneksmall',
  37683. 'Ringsmall',
  37684. 'Cedillasmall',
  37685. 'onequarter',
  37686. 'onehalf',
  37687. 'threequarters',
  37688. 'questiondownsmall',
  37689. 'oneeighth',
  37690. 'threeeighths',
  37691. 'fiveeighths',
  37692. 'seveneighths',
  37693. 'onethird',
  37694. 'twothirds',
  37695. 'zerosuperior',
  37696. 'onesuperior',
  37697. 'twosuperior',
  37698. 'threesuperior',
  37699. 'foursuperior',
  37700. 'fivesuperior',
  37701. 'sixsuperior',
  37702. 'sevensuperior',
  37703. 'eightsuperior',
  37704. 'ninesuperior',
  37705. 'zeroinferior',
  37706. 'oneinferior',
  37707. 'twoinferior',
  37708. 'threeinferior',
  37709. 'fourinferior',
  37710. 'fiveinferior',
  37711. 'sixinferior',
  37712. 'seveninferior',
  37713. 'eightinferior',
  37714. 'nineinferior',
  37715. 'centinferior',
  37716. 'dollarinferior',
  37717. 'periodinferior',
  37718. 'commainferior',
  37719. 'Agravesmall',
  37720. 'Aacutesmall',
  37721. 'Acircumflexsmall',
  37722. 'Atildesmall',
  37723. 'Adieresissmall',
  37724. 'Aringsmall',
  37725. 'AEsmall',
  37726. 'Ccedillasmall',
  37727. 'Egravesmall',
  37728. 'Eacutesmall',
  37729. 'Ecircumflexsmall',
  37730. 'Edieresissmall',
  37731. 'Igravesmall',
  37732. 'Iacutesmall',
  37733. 'Icircumflexsmall',
  37734. 'Idieresissmall',
  37735. 'Ethsmall',
  37736. 'Ntildesmall',
  37737. 'Ogravesmall',
  37738. 'Oacutesmall',
  37739. 'Ocircumflexsmall',
  37740. 'Otildesmall',
  37741. 'Odieresissmall',
  37742. 'OEsmall',
  37743. 'Oslashsmall',
  37744. 'Ugravesmall',
  37745. 'Uacutesmall',
  37746. 'Ucircumflexsmall',
  37747. 'Udieresissmall',
  37748. 'Yacutesmall',
  37749. 'Thornsmall',
  37750. 'Ydieresissmall'
  37751. ];
  37752. var ExpertSubsetCharset = [
  37753. '.notdef',
  37754. 'space',
  37755. 'dollaroldstyle',
  37756. 'dollarsuperior',
  37757. 'parenleftsuperior',
  37758. 'parenrightsuperior',
  37759. 'twodotenleader',
  37760. 'onedotenleader',
  37761. 'comma',
  37762. 'hyphen',
  37763. 'period',
  37764. 'fraction',
  37765. 'zerooldstyle',
  37766. 'oneoldstyle',
  37767. 'twooldstyle',
  37768. 'threeoldstyle',
  37769. 'fouroldstyle',
  37770. 'fiveoldstyle',
  37771. 'sixoldstyle',
  37772. 'sevenoldstyle',
  37773. 'eightoldstyle',
  37774. 'nineoldstyle',
  37775. 'colon',
  37776. 'semicolon',
  37777. 'commasuperior',
  37778. 'threequartersemdash',
  37779. 'periodsuperior',
  37780. 'asuperior',
  37781. 'bsuperior',
  37782. 'centsuperior',
  37783. 'dsuperior',
  37784. 'esuperior',
  37785. 'isuperior',
  37786. 'lsuperior',
  37787. 'msuperior',
  37788. 'nsuperior',
  37789. 'osuperior',
  37790. 'rsuperior',
  37791. 'ssuperior',
  37792. 'tsuperior',
  37793. 'ff',
  37794. 'fi',
  37795. 'fl',
  37796. 'ffi',
  37797. 'ffl',
  37798. 'parenleftinferior',
  37799. 'parenrightinferior',
  37800. 'hyphensuperior',
  37801. 'colonmonetary',
  37802. 'onefitted',
  37803. 'rupiah',
  37804. 'centoldstyle',
  37805. 'figuredash',
  37806. 'hypheninferior',
  37807. 'onequarter',
  37808. 'onehalf',
  37809. 'threequarters',
  37810. 'oneeighth',
  37811. 'threeeighths',
  37812. 'fiveeighths',
  37813. 'seveneighths',
  37814. 'onethird',
  37815. 'twothirds',
  37816. 'zerosuperior',
  37817. 'onesuperior',
  37818. 'twosuperior',
  37819. 'threesuperior',
  37820. 'foursuperior',
  37821. 'fivesuperior',
  37822. 'sixsuperior',
  37823. 'sevensuperior',
  37824. 'eightsuperior',
  37825. 'ninesuperior',
  37826. 'zeroinferior',
  37827. 'oneinferior',
  37828. 'twoinferior',
  37829. 'threeinferior',
  37830. 'fourinferior',
  37831. 'fiveinferior',
  37832. 'sixinferior',
  37833. 'seveninferior',
  37834. 'eightinferior',
  37835. 'nineinferior',
  37836. 'centinferior',
  37837. 'dollarinferior',
  37838. 'periodinferior',
  37839. 'commainferior'
  37840. ];
  37841. exports.ISOAdobeCharset = ISOAdobeCharset;
  37842. exports.ExpertCharset = ExpertCharset;
  37843. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  37844. /***/ }),
  37845. /* 24 */
  37846. /***/ (function(module, exports, __w_pdfjs_require__) {
  37847. "use strict";
  37848. var sharedUtil = __w_pdfjs_require__(0);
  37849. var corePrimitives = __w_pdfjs_require__(1);
  37850. var coreStream = __w_pdfjs_require__(2);
  37851. var coreParser = __w_pdfjs_require__(5);
  37852. var Util = sharedUtil.Util;
  37853. var assert = sharedUtil.assert;
  37854. var warn = sharedUtil.warn;
  37855. var error = sharedUtil.error;
  37856. var isInt = sharedUtil.isInt;
  37857. var isString = sharedUtil.isString;
  37858. var MissingDataException = sharedUtil.MissingDataException;
  37859. var isEOF = corePrimitives.isEOF;
  37860. var isName = corePrimitives.isName;
  37861. var isCmd = corePrimitives.isCmd;
  37862. var isStream = corePrimitives.isStream;
  37863. var StringStream = coreStream.StringStream;
  37864. var Lexer = coreParser.Lexer;
  37865. var BUILT_IN_CMAPS = [
  37866. 'Adobe-GB1-UCS2',
  37867. 'Adobe-CNS1-UCS2',
  37868. 'Adobe-Japan1-UCS2',
  37869. 'Adobe-Korea1-UCS2',
  37870. '78-EUC-H',
  37871. '78-EUC-V',
  37872. '78-H',
  37873. '78-RKSJ-H',
  37874. '78-RKSJ-V',
  37875. '78-V',
  37876. '78ms-RKSJ-H',
  37877. '78ms-RKSJ-V',
  37878. '83pv-RKSJ-H',
  37879. '90ms-RKSJ-H',
  37880. '90ms-RKSJ-V',
  37881. '90msp-RKSJ-H',
  37882. '90msp-RKSJ-V',
  37883. '90pv-RKSJ-H',
  37884. '90pv-RKSJ-V',
  37885. 'Add-H',
  37886. 'Add-RKSJ-H',
  37887. 'Add-RKSJ-V',
  37888. 'Add-V',
  37889. 'Adobe-CNS1-0',
  37890. 'Adobe-CNS1-1',
  37891. 'Adobe-CNS1-2',
  37892. 'Adobe-CNS1-3',
  37893. 'Adobe-CNS1-4',
  37894. 'Adobe-CNS1-5',
  37895. 'Adobe-CNS1-6',
  37896. 'Adobe-GB1-0',
  37897. 'Adobe-GB1-1',
  37898. 'Adobe-GB1-2',
  37899. 'Adobe-GB1-3',
  37900. 'Adobe-GB1-4',
  37901. 'Adobe-GB1-5',
  37902. 'Adobe-Japan1-0',
  37903. 'Adobe-Japan1-1',
  37904. 'Adobe-Japan1-2',
  37905. 'Adobe-Japan1-3',
  37906. 'Adobe-Japan1-4',
  37907. 'Adobe-Japan1-5',
  37908. 'Adobe-Japan1-6',
  37909. 'Adobe-Korea1-0',
  37910. 'Adobe-Korea1-1',
  37911. 'Adobe-Korea1-2',
  37912. 'B5-H',
  37913. 'B5-V',
  37914. 'B5pc-H',
  37915. 'B5pc-V',
  37916. 'CNS-EUC-H',
  37917. 'CNS-EUC-V',
  37918. 'CNS1-H',
  37919. 'CNS1-V',
  37920. 'CNS2-H',
  37921. 'CNS2-V',
  37922. 'ETHK-B5-H',
  37923. 'ETHK-B5-V',
  37924. 'ETen-B5-H',
  37925. 'ETen-B5-V',
  37926. 'ETenms-B5-H',
  37927. 'ETenms-B5-V',
  37928. 'EUC-H',
  37929. 'EUC-V',
  37930. 'Ext-H',
  37931. 'Ext-RKSJ-H',
  37932. 'Ext-RKSJ-V',
  37933. 'Ext-V',
  37934. 'GB-EUC-H',
  37935. 'GB-EUC-V',
  37936. 'GB-H',
  37937. 'GB-V',
  37938. 'GBK-EUC-H',
  37939. 'GBK-EUC-V',
  37940. 'GBK2K-H',
  37941. 'GBK2K-V',
  37942. 'GBKp-EUC-H',
  37943. 'GBKp-EUC-V',
  37944. 'GBT-EUC-H',
  37945. 'GBT-EUC-V',
  37946. 'GBT-H',
  37947. 'GBT-V',
  37948. 'GBTpc-EUC-H',
  37949. 'GBTpc-EUC-V',
  37950. 'GBpc-EUC-H',
  37951. 'GBpc-EUC-V',
  37952. 'H',
  37953. 'HKdla-B5-H',
  37954. 'HKdla-B5-V',
  37955. 'HKdlb-B5-H',
  37956. 'HKdlb-B5-V',
  37957. 'HKgccs-B5-H',
  37958. 'HKgccs-B5-V',
  37959. 'HKm314-B5-H',
  37960. 'HKm314-B5-V',
  37961. 'HKm471-B5-H',
  37962. 'HKm471-B5-V',
  37963. 'HKscs-B5-H',
  37964. 'HKscs-B5-V',
  37965. 'Hankaku',
  37966. 'Hiragana',
  37967. 'KSC-EUC-H',
  37968. 'KSC-EUC-V',
  37969. 'KSC-H',
  37970. 'KSC-Johab-H',
  37971. 'KSC-Johab-V',
  37972. 'KSC-V',
  37973. 'KSCms-UHC-H',
  37974. 'KSCms-UHC-HW-H',
  37975. 'KSCms-UHC-HW-V',
  37976. 'KSCms-UHC-V',
  37977. 'KSCpc-EUC-H',
  37978. 'KSCpc-EUC-V',
  37979. 'Katakana',
  37980. 'NWP-H',
  37981. 'NWP-V',
  37982. 'RKSJ-H',
  37983. 'RKSJ-V',
  37984. 'Roman',
  37985. 'UniCNS-UCS2-H',
  37986. 'UniCNS-UCS2-V',
  37987. 'UniCNS-UTF16-H',
  37988. 'UniCNS-UTF16-V',
  37989. 'UniCNS-UTF32-H',
  37990. 'UniCNS-UTF32-V',
  37991. 'UniCNS-UTF8-H',
  37992. 'UniCNS-UTF8-V',
  37993. 'UniGB-UCS2-H',
  37994. 'UniGB-UCS2-V',
  37995. 'UniGB-UTF16-H',
  37996. 'UniGB-UTF16-V',
  37997. 'UniGB-UTF32-H',
  37998. 'UniGB-UTF32-V',
  37999. 'UniGB-UTF8-H',
  38000. 'UniGB-UTF8-V',
  38001. 'UniJIS-UCS2-H',
  38002. 'UniJIS-UCS2-HW-H',
  38003. 'UniJIS-UCS2-HW-V',
  38004. 'UniJIS-UCS2-V',
  38005. 'UniJIS-UTF16-H',
  38006. 'UniJIS-UTF16-V',
  38007. 'UniJIS-UTF32-H',
  38008. 'UniJIS-UTF32-V',
  38009. 'UniJIS-UTF8-H',
  38010. 'UniJIS-UTF8-V',
  38011. 'UniJIS2004-UTF16-H',
  38012. 'UniJIS2004-UTF16-V',
  38013. 'UniJIS2004-UTF32-H',
  38014. 'UniJIS2004-UTF32-V',
  38015. 'UniJIS2004-UTF8-H',
  38016. 'UniJIS2004-UTF8-V',
  38017. 'UniJISPro-UCS2-HW-V',
  38018. 'UniJISPro-UCS2-V',
  38019. 'UniJISPro-UTF8-V',
  38020. 'UniJISX0213-UTF32-H',
  38021. 'UniJISX0213-UTF32-V',
  38022. 'UniJISX02132004-UTF32-H',
  38023. 'UniJISX02132004-UTF32-V',
  38024. 'UniKS-UCS2-H',
  38025. 'UniKS-UCS2-V',
  38026. 'UniKS-UTF16-H',
  38027. 'UniKS-UTF16-V',
  38028. 'UniKS-UTF32-H',
  38029. 'UniKS-UTF32-V',
  38030. 'UniKS-UTF8-H',
  38031. 'UniKS-UTF8-V',
  38032. 'V',
  38033. 'WP-Symbol'
  38034. ];
  38035. var CMap = function CMapClosure() {
  38036. function CMap(builtInCMap) {
  38037. this.codespaceRanges = [
  38038. [],
  38039. [],
  38040. [],
  38041. []
  38042. ];
  38043. this.numCodespaceRanges = 0;
  38044. this._map = [];
  38045. this.name = '';
  38046. this.vertical = false;
  38047. this.useCMap = null;
  38048. this.builtInCMap = builtInCMap;
  38049. }
  38050. CMap.prototype = {
  38051. addCodespaceRange: function (n, low, high) {
  38052. this.codespaceRanges[n - 1].push(low, high);
  38053. this.numCodespaceRanges++;
  38054. },
  38055. mapCidRange: function (low, high, dstLow) {
  38056. while (low <= high) {
  38057. this._map[low++] = dstLow++;
  38058. }
  38059. },
  38060. mapBfRange: function (low, high, dstLow) {
  38061. var lastByte = dstLow.length - 1;
  38062. while (low <= high) {
  38063. this._map[low++] = dstLow;
  38064. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  38065. }
  38066. },
  38067. mapBfRangeToArray: function (low, high, array) {
  38068. var i = 0, ii = array.length;
  38069. while (low <= high && i < ii) {
  38070. this._map[low] = array[i++];
  38071. ++low;
  38072. }
  38073. },
  38074. mapOne: function (src, dst) {
  38075. this._map[src] = dst;
  38076. },
  38077. lookup: function (code) {
  38078. return this._map[code];
  38079. },
  38080. contains: function (code) {
  38081. return this._map[code] !== undefined;
  38082. },
  38083. forEach: function (callback) {
  38084. var map = this._map;
  38085. var length = map.length;
  38086. var i;
  38087. if (length <= 0x10000) {
  38088. for (i = 0; i < length; i++) {
  38089. if (map[i] !== undefined) {
  38090. callback(i, map[i]);
  38091. }
  38092. }
  38093. } else {
  38094. for (i in this._map) {
  38095. callback(i, map[i]);
  38096. }
  38097. }
  38098. },
  38099. charCodeOf: function (value) {
  38100. return this._map.indexOf(value);
  38101. },
  38102. getMap: function () {
  38103. return this._map;
  38104. },
  38105. readCharCode: function (str, offset, out) {
  38106. var c = 0;
  38107. var codespaceRanges = this.codespaceRanges;
  38108. var codespaceRangesLen = this.codespaceRanges.length;
  38109. for (var n = 0; n < codespaceRangesLen; n++) {
  38110. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  38111. var codespaceRange = codespaceRanges[n];
  38112. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  38113. var low = codespaceRange[k++];
  38114. var high = codespaceRange[k++];
  38115. if (c >= low && c <= high) {
  38116. out.charcode = c;
  38117. out.length = n + 1;
  38118. return;
  38119. }
  38120. }
  38121. }
  38122. out.charcode = 0;
  38123. out.length = 1;
  38124. },
  38125. get length() {
  38126. return this._map.length;
  38127. },
  38128. get isIdentityCMap() {
  38129. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  38130. return false;
  38131. }
  38132. if (this._map.length !== 0x10000) {
  38133. return false;
  38134. }
  38135. for (var i = 0; i < 0x10000; i++) {
  38136. if (this._map[i] !== i) {
  38137. return false;
  38138. }
  38139. }
  38140. return true;
  38141. }
  38142. };
  38143. return CMap;
  38144. }();
  38145. var IdentityCMap = function IdentityCMapClosure() {
  38146. function IdentityCMap(vertical, n) {
  38147. CMap.call(this);
  38148. this.vertical = vertical;
  38149. this.addCodespaceRange(n, 0, 0xffff);
  38150. }
  38151. Util.inherit(IdentityCMap, CMap, {});
  38152. IdentityCMap.prototype = {
  38153. addCodespaceRange: CMap.prototype.addCodespaceRange,
  38154. mapCidRange: function (low, high, dstLow) {
  38155. error('should not call mapCidRange');
  38156. },
  38157. mapBfRange: function (low, high, dstLow) {
  38158. error('should not call mapBfRange');
  38159. },
  38160. mapBfRangeToArray: function (low, high, array) {
  38161. error('should not call mapBfRangeToArray');
  38162. },
  38163. mapOne: function (src, dst) {
  38164. error('should not call mapCidOne');
  38165. },
  38166. lookup: function (code) {
  38167. return isInt(code) && code <= 0xffff ? code : undefined;
  38168. },
  38169. contains: function (code) {
  38170. return isInt(code) && code <= 0xffff;
  38171. },
  38172. forEach: function (callback) {
  38173. for (var i = 0; i <= 0xffff; i++) {
  38174. callback(i, i);
  38175. }
  38176. },
  38177. charCodeOf: function (value) {
  38178. return isInt(value) && value <= 0xffff ? value : -1;
  38179. },
  38180. getMap: function () {
  38181. var map = new Array(0x10000);
  38182. for (var i = 0; i <= 0xffff; i++) {
  38183. map[i] = i;
  38184. }
  38185. return map;
  38186. },
  38187. readCharCode: CMap.prototype.readCharCode,
  38188. get length() {
  38189. return 0x10000;
  38190. },
  38191. get isIdentityCMap() {
  38192. error('should not access .isIdentityCMap');
  38193. }
  38194. };
  38195. return IdentityCMap;
  38196. }();
  38197. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  38198. function fetchBinaryData(url) {
  38199. return new Promise(function (resolve, reject) {
  38200. var request = new XMLHttpRequest();
  38201. request.open('GET', url, true);
  38202. request.responseType = 'arraybuffer';
  38203. request.onreadystatechange = function () {
  38204. if (request.readyState === XMLHttpRequest.DONE) {
  38205. if (!request.response || request.status !== 200 && request.status !== 0) {
  38206. reject(new Error('Unable to get binary cMap at: ' + url));
  38207. } else {
  38208. resolve(new Uint8Array(request.response));
  38209. }
  38210. }
  38211. };
  38212. request.send(null);
  38213. });
  38214. }
  38215. function hexToInt(a, size) {
  38216. var n = 0;
  38217. for (var i = 0; i <= size; i++) {
  38218. n = n << 8 | a[i];
  38219. }
  38220. return n >>> 0;
  38221. }
  38222. function hexToStr(a, size) {
  38223. if (size === 1) {
  38224. return String.fromCharCode(a[0], a[1]);
  38225. }
  38226. if (size === 3) {
  38227. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  38228. }
  38229. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  38230. }
  38231. function addHex(a, b, size) {
  38232. var c = 0;
  38233. for (var i = size; i >= 0; i--) {
  38234. c += a[i] + b[i];
  38235. a[i] = c & 255;
  38236. c >>= 8;
  38237. }
  38238. }
  38239. function incHex(a, size) {
  38240. var c = 1;
  38241. for (var i = size; i >= 0 && c > 0; i--) {
  38242. c += a[i];
  38243. a[i] = c & 255;
  38244. c >>= 8;
  38245. }
  38246. }
  38247. var MAX_NUM_SIZE = 16;
  38248. var MAX_ENCODED_NUM_SIZE = 19;
  38249. function BinaryCMapStream(data) {
  38250. this.buffer = data;
  38251. this.pos = 0;
  38252. this.end = data.length;
  38253. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  38254. }
  38255. BinaryCMapStream.prototype = {
  38256. readByte: function () {
  38257. if (this.pos >= this.end) {
  38258. return -1;
  38259. }
  38260. return this.buffer[this.pos++];
  38261. },
  38262. readNumber: function () {
  38263. var n = 0;
  38264. var last;
  38265. do {
  38266. var b = this.readByte();
  38267. if (b < 0) {
  38268. error('unexpected EOF in bcmap');
  38269. }
  38270. last = !(b & 0x80);
  38271. n = n << 7 | b & 0x7F;
  38272. } while (!last);
  38273. return n;
  38274. },
  38275. readSigned: function () {
  38276. var n = this.readNumber();
  38277. return n & 1 ? ~(n >>> 1) : n >>> 1;
  38278. },
  38279. readHex: function (num, size) {
  38280. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  38281. this.pos += size + 1;
  38282. },
  38283. readHexNumber: function (num, size) {
  38284. var last;
  38285. var stack = this.tmpBuf, sp = 0;
  38286. do {
  38287. var b = this.readByte();
  38288. if (b < 0) {
  38289. error('unexpected EOF in bcmap');
  38290. }
  38291. last = !(b & 0x80);
  38292. stack[sp++] = b & 0x7F;
  38293. } while (!last);
  38294. var i = size, buffer = 0, bufferSize = 0;
  38295. while (i >= 0) {
  38296. while (bufferSize < 8 && stack.length > 0) {
  38297. buffer = stack[--sp] << bufferSize | buffer;
  38298. bufferSize += 7;
  38299. }
  38300. num[i] = buffer & 255;
  38301. i--;
  38302. buffer >>= 8;
  38303. bufferSize -= 8;
  38304. }
  38305. },
  38306. readHexSigned: function (num, size) {
  38307. this.readHexNumber(num, size);
  38308. var sign = num[size] & 1 ? 255 : 0;
  38309. var c = 0;
  38310. for (var i = 0; i <= size; i++) {
  38311. c = (c & 1) << 8 | num[i];
  38312. num[i] = c >> 1 ^ sign;
  38313. }
  38314. },
  38315. readString: function () {
  38316. var len = this.readNumber();
  38317. var s = '';
  38318. for (var i = 0; i < len; i++) {
  38319. s += String.fromCharCode(this.readNumber());
  38320. }
  38321. return s;
  38322. }
  38323. };
  38324. function processBinaryCMap(url, cMap, extend) {
  38325. return fetchBinaryData(url).then(function (data) {
  38326. var stream = new BinaryCMapStream(data);
  38327. var header = stream.readByte();
  38328. cMap.vertical = !!(header & 1);
  38329. var useCMap = null;
  38330. var start = new Uint8Array(MAX_NUM_SIZE);
  38331. var end = new Uint8Array(MAX_NUM_SIZE);
  38332. var char = new Uint8Array(MAX_NUM_SIZE);
  38333. var charCode = new Uint8Array(MAX_NUM_SIZE);
  38334. var tmp = new Uint8Array(MAX_NUM_SIZE);
  38335. var code;
  38336. var b;
  38337. while ((b = stream.readByte()) >= 0) {
  38338. var type = b >> 5;
  38339. if (type === 7) {
  38340. switch (b & 0x1F) {
  38341. case 0:
  38342. stream.readString();
  38343. break;
  38344. case 1:
  38345. useCMap = stream.readString();
  38346. break;
  38347. }
  38348. continue;
  38349. }
  38350. var sequence = !!(b & 0x10);
  38351. var dataSize = b & 15;
  38352. assert(dataSize + 1 <= MAX_NUM_SIZE);
  38353. var ucs2DataSize = 1;
  38354. var subitemsCount = stream.readNumber();
  38355. var i;
  38356. switch (type) {
  38357. case 0:
  38358. stream.readHex(start, dataSize);
  38359. stream.readHexNumber(end, dataSize);
  38360. addHex(end, start, dataSize);
  38361. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  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. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38369. }
  38370. break;
  38371. case 1:
  38372. stream.readHex(start, dataSize);
  38373. stream.readHexNumber(end, dataSize);
  38374. addHex(end, start, dataSize);
  38375. code = stream.readNumber();
  38376. for (i = 1; i < subitemsCount; i++) {
  38377. incHex(end, dataSize);
  38378. stream.readHexNumber(start, dataSize);
  38379. addHex(start, end, dataSize);
  38380. stream.readHexNumber(end, dataSize);
  38381. addHex(end, start, dataSize);
  38382. code = stream.readNumber();
  38383. }
  38384. break;
  38385. case 2:
  38386. stream.readHex(char, dataSize);
  38387. code = stream.readNumber();
  38388. cMap.mapOne(hexToInt(char, dataSize), code);
  38389. for (i = 1; i < subitemsCount; i++) {
  38390. incHex(char, dataSize);
  38391. if (!sequence) {
  38392. stream.readHexNumber(tmp, dataSize);
  38393. addHex(char, tmp, dataSize);
  38394. }
  38395. code = stream.readSigned() + (code + 1);
  38396. cMap.mapOne(hexToInt(char, dataSize), code);
  38397. }
  38398. break;
  38399. case 3:
  38400. stream.readHex(start, dataSize);
  38401. stream.readHexNumber(end, dataSize);
  38402. addHex(end, start, dataSize);
  38403. code = stream.readNumber();
  38404. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38405. for (i = 1; i < subitemsCount; i++) {
  38406. incHex(end, dataSize);
  38407. if (!sequence) {
  38408. stream.readHexNumber(start, dataSize);
  38409. addHex(start, end, dataSize);
  38410. } else {
  38411. start.set(end);
  38412. }
  38413. stream.readHexNumber(end, dataSize);
  38414. addHex(end, start, dataSize);
  38415. code = stream.readNumber();
  38416. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38417. }
  38418. break;
  38419. case 4:
  38420. stream.readHex(char, ucs2DataSize);
  38421. stream.readHex(charCode, dataSize);
  38422. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38423. for (i = 1; i < subitemsCount; i++) {
  38424. incHex(char, ucs2DataSize);
  38425. if (!sequence) {
  38426. stream.readHexNumber(tmp, ucs2DataSize);
  38427. addHex(char, tmp, ucs2DataSize);
  38428. }
  38429. incHex(charCode, dataSize);
  38430. stream.readHexSigned(tmp, dataSize);
  38431. addHex(charCode, tmp, dataSize);
  38432. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38433. }
  38434. break;
  38435. case 5:
  38436. stream.readHex(start, ucs2DataSize);
  38437. stream.readHexNumber(end, ucs2DataSize);
  38438. addHex(end, start, ucs2DataSize);
  38439. stream.readHex(charCode, dataSize);
  38440. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38441. for (i = 1; i < subitemsCount; i++) {
  38442. incHex(end, ucs2DataSize);
  38443. if (!sequence) {
  38444. stream.readHexNumber(start, ucs2DataSize);
  38445. addHex(start, end, ucs2DataSize);
  38446. } else {
  38447. start.set(end);
  38448. }
  38449. stream.readHexNumber(end, ucs2DataSize);
  38450. addHex(end, start, ucs2DataSize);
  38451. stream.readHex(charCode, dataSize);
  38452. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38453. }
  38454. break;
  38455. default:
  38456. error('Unknown type: ' + type);
  38457. break;
  38458. }
  38459. }
  38460. if (useCMap) {
  38461. return extend(useCMap);
  38462. }
  38463. return cMap;
  38464. });
  38465. }
  38466. function BinaryCMapReader() {
  38467. }
  38468. BinaryCMapReader.prototype = { read: processBinaryCMap };
  38469. return BinaryCMapReader;
  38470. }();
  38471. var CMapFactory = function CMapFactoryClosure() {
  38472. function strToInt(str) {
  38473. var a = 0;
  38474. for (var i = 0; i < str.length; i++) {
  38475. a = a << 8 | str.charCodeAt(i);
  38476. }
  38477. return a >>> 0;
  38478. }
  38479. function expectString(obj) {
  38480. if (!isString(obj)) {
  38481. error('Malformed CMap: expected string.');
  38482. }
  38483. }
  38484. function expectInt(obj) {
  38485. if (!isInt(obj)) {
  38486. error('Malformed CMap: expected int.');
  38487. }
  38488. }
  38489. function parseBfChar(cMap, lexer) {
  38490. while (true) {
  38491. var obj = lexer.getObj();
  38492. if (isEOF(obj)) {
  38493. break;
  38494. }
  38495. if (isCmd(obj, 'endbfchar')) {
  38496. return;
  38497. }
  38498. expectString(obj);
  38499. var src = strToInt(obj);
  38500. obj = lexer.getObj();
  38501. expectString(obj);
  38502. var dst = obj;
  38503. cMap.mapOne(src, dst);
  38504. }
  38505. }
  38506. function parseBfRange(cMap, lexer) {
  38507. while (true) {
  38508. var obj = lexer.getObj();
  38509. if (isEOF(obj)) {
  38510. break;
  38511. }
  38512. if (isCmd(obj, 'endbfrange')) {
  38513. return;
  38514. }
  38515. expectString(obj);
  38516. var low = strToInt(obj);
  38517. obj = lexer.getObj();
  38518. expectString(obj);
  38519. var high = strToInt(obj);
  38520. obj = lexer.getObj();
  38521. if (isInt(obj) || isString(obj)) {
  38522. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  38523. cMap.mapBfRange(low, high, dstLow);
  38524. } else if (isCmd(obj, '[')) {
  38525. obj = lexer.getObj();
  38526. var array = [];
  38527. while (!isCmd(obj, ']') && !isEOF(obj)) {
  38528. array.push(obj);
  38529. obj = lexer.getObj();
  38530. }
  38531. cMap.mapBfRangeToArray(low, high, array);
  38532. } else {
  38533. break;
  38534. }
  38535. }
  38536. error('Invalid bf range.');
  38537. }
  38538. function parseCidChar(cMap, lexer) {
  38539. while (true) {
  38540. var obj = lexer.getObj();
  38541. if (isEOF(obj)) {
  38542. break;
  38543. }
  38544. if (isCmd(obj, 'endcidchar')) {
  38545. return;
  38546. }
  38547. expectString(obj);
  38548. var src = strToInt(obj);
  38549. obj = lexer.getObj();
  38550. expectInt(obj);
  38551. var dst = obj;
  38552. cMap.mapOne(src, dst);
  38553. }
  38554. }
  38555. function parseCidRange(cMap, lexer) {
  38556. while (true) {
  38557. var obj = lexer.getObj();
  38558. if (isEOF(obj)) {
  38559. break;
  38560. }
  38561. if (isCmd(obj, 'endcidrange')) {
  38562. return;
  38563. }
  38564. expectString(obj);
  38565. var low = strToInt(obj);
  38566. obj = lexer.getObj();
  38567. expectString(obj);
  38568. var high = strToInt(obj);
  38569. obj = lexer.getObj();
  38570. expectInt(obj);
  38571. var dstLow = obj;
  38572. cMap.mapCidRange(low, high, dstLow);
  38573. }
  38574. }
  38575. function parseCodespaceRange(cMap, lexer) {
  38576. while (true) {
  38577. var obj = lexer.getObj();
  38578. if (isEOF(obj)) {
  38579. break;
  38580. }
  38581. if (isCmd(obj, 'endcodespacerange')) {
  38582. return;
  38583. }
  38584. if (!isString(obj)) {
  38585. break;
  38586. }
  38587. var low = strToInt(obj);
  38588. obj = lexer.getObj();
  38589. if (!isString(obj)) {
  38590. break;
  38591. }
  38592. var high = strToInt(obj);
  38593. cMap.addCodespaceRange(obj.length, low, high);
  38594. }
  38595. error('Invalid codespace range.');
  38596. }
  38597. function parseWMode(cMap, lexer) {
  38598. var obj = lexer.getObj();
  38599. if (isInt(obj)) {
  38600. cMap.vertical = !!obj;
  38601. }
  38602. }
  38603. function parseCMapName(cMap, lexer) {
  38604. var obj = lexer.getObj();
  38605. if (isName(obj) && isString(obj.name)) {
  38606. cMap.name = obj.name;
  38607. }
  38608. }
  38609. function parseCMap(cMap, lexer, builtInCMapParams, useCMap) {
  38610. var previous;
  38611. var embededUseCMap;
  38612. objLoop:
  38613. while (true) {
  38614. try {
  38615. var obj = lexer.getObj();
  38616. if (isEOF(obj)) {
  38617. break;
  38618. } else if (isName(obj)) {
  38619. if (obj.name === 'WMode') {
  38620. parseWMode(cMap, lexer);
  38621. } else if (obj.name === 'CMapName') {
  38622. parseCMapName(cMap, lexer);
  38623. }
  38624. previous = obj;
  38625. } else if (isCmd(obj)) {
  38626. switch (obj.cmd) {
  38627. case 'endcmap':
  38628. break objLoop;
  38629. case 'usecmap':
  38630. if (isName(previous)) {
  38631. embededUseCMap = previous.name;
  38632. }
  38633. break;
  38634. case 'begincodespacerange':
  38635. parseCodespaceRange(cMap, lexer);
  38636. break;
  38637. case 'beginbfchar':
  38638. parseBfChar(cMap, lexer);
  38639. break;
  38640. case 'begincidchar':
  38641. parseCidChar(cMap, lexer);
  38642. break;
  38643. case 'beginbfrange':
  38644. parseBfRange(cMap, lexer);
  38645. break;
  38646. case 'begincidrange':
  38647. parseCidRange(cMap, lexer);
  38648. break;
  38649. }
  38650. }
  38651. } catch (ex) {
  38652. if (ex instanceof MissingDataException) {
  38653. throw ex;
  38654. }
  38655. warn('Invalid cMap data: ' + ex);
  38656. continue;
  38657. }
  38658. }
  38659. if (!useCMap && embededUseCMap) {
  38660. useCMap = embededUseCMap;
  38661. }
  38662. if (useCMap) {
  38663. return extendCMap(cMap, builtInCMapParams, useCMap);
  38664. }
  38665. return Promise.resolve(cMap);
  38666. }
  38667. function extendCMap(cMap, builtInCMapParams, useCMap) {
  38668. return createBuiltInCMap(useCMap, builtInCMapParams).then(function (newCMap) {
  38669. cMap.useCMap = newCMap;
  38670. if (cMap.numCodespaceRanges === 0) {
  38671. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  38672. for (var i = 0; i < useCodespaceRanges.length; i++) {
  38673. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  38674. }
  38675. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  38676. }
  38677. cMap.useCMap.forEach(function (key, value) {
  38678. if (!cMap.contains(key)) {
  38679. cMap.mapOne(key, cMap.useCMap.lookup(key));
  38680. }
  38681. });
  38682. return cMap;
  38683. });
  38684. }
  38685. function parseBinaryCMap(name, builtInCMapParams) {
  38686. var url = builtInCMapParams.url + name + '.bcmap';
  38687. var cMap = new CMap(true);
  38688. return new BinaryCMapReader().read(url, cMap, function (useCMap) {
  38689. return extendCMap(cMap, builtInCMapParams, useCMap);
  38690. });
  38691. }
  38692. function createBuiltInCMap(name, builtInCMapParams) {
  38693. if (name === 'Identity-H') {
  38694. return Promise.resolve(new IdentityCMap(false, 2));
  38695. } else if (name === 'Identity-V') {
  38696. return Promise.resolve(new IdentityCMap(true, 2));
  38697. }
  38698. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  38699. return Promise.reject(new Error('Unknown cMap name: ' + name));
  38700. }
  38701. assert(builtInCMapParams, 'built-in cMap parameters are not provided');
  38702. if (builtInCMapParams.packed) {
  38703. return parseBinaryCMap(name, builtInCMapParams);
  38704. }
  38705. return new Promise(function (resolve, reject) {
  38706. var url = builtInCMapParams.url + name;
  38707. var request = new XMLHttpRequest();
  38708. request.onreadystatechange = function () {
  38709. if (request.readyState === XMLHttpRequest.DONE) {
  38710. if (request.status === 200 || request.status === 0) {
  38711. var cMap = new CMap(true);
  38712. var lexer = new Lexer(new StringStream(request.responseText));
  38713. parseCMap(cMap, lexer, builtInCMapParams, null).then(function (parsedCMap) {
  38714. resolve(parsedCMap);
  38715. });
  38716. } else {
  38717. reject(new Error('Unable to get cMap at: ' + url));
  38718. }
  38719. }
  38720. };
  38721. request.open('GET', url, true);
  38722. request.send(null);
  38723. });
  38724. }
  38725. return {
  38726. create: function (encoding, builtInCMapParams, useCMap) {
  38727. if (isName(encoding)) {
  38728. return createBuiltInCMap(encoding.name, builtInCMapParams);
  38729. } else if (isStream(encoding)) {
  38730. var cMap = new CMap();
  38731. var lexer = new Lexer(encoding);
  38732. return parseCMap(cMap, lexer, builtInCMapParams, useCMap).then(function (parsedCMap) {
  38733. if (parsedCMap.isIdentityCMap) {
  38734. return createBuiltInCMap(parsedCMap.name, builtInCMapParams);
  38735. }
  38736. return parsedCMap;
  38737. });
  38738. }
  38739. return Promise.reject(new Error('Encoding required.'));
  38740. }
  38741. };
  38742. }();
  38743. exports.CMap = CMap;
  38744. exports.CMapFactory = CMapFactory;
  38745. exports.IdentityCMap = IdentityCMap;
  38746. /***/ }),
  38747. /* 25 */
  38748. /***/ (function(module, exports, __w_pdfjs_require__) {
  38749. "use strict";
  38750. var sharedUtil = __w_pdfjs_require__(0);
  38751. var corePrimitives = __w_pdfjs_require__(1);
  38752. var coreStream = __w_pdfjs_require__(2);
  38753. var coreObj = __w_pdfjs_require__(15);
  38754. var coreParser = __w_pdfjs_require__(5);
  38755. var coreCrypto = __w_pdfjs_require__(12);
  38756. var coreEvaluator = __w_pdfjs_require__(13);
  38757. var coreAnnotation = __w_pdfjs_require__(21);
  38758. var MissingDataException = sharedUtil.MissingDataException;
  38759. var Util = sharedUtil.Util;
  38760. var assert = sharedUtil.assert;
  38761. var error = sharedUtil.error;
  38762. var info = sharedUtil.info;
  38763. var isArray = sharedUtil.isArray;
  38764. var isArrayBuffer = sharedUtil.isArrayBuffer;
  38765. var isNum = sharedUtil.isNum;
  38766. var isString = sharedUtil.isString;
  38767. var shadow = sharedUtil.shadow;
  38768. var stringToBytes = sharedUtil.stringToBytes;
  38769. var stringToPDFString = sharedUtil.stringToPDFString;
  38770. var warn = sharedUtil.warn;
  38771. var isSpace = sharedUtil.isSpace;
  38772. var Dict = corePrimitives.Dict;
  38773. var isDict = corePrimitives.isDict;
  38774. var isName = corePrimitives.isName;
  38775. var isStream = corePrimitives.isStream;
  38776. var NullStream = coreStream.NullStream;
  38777. var Stream = coreStream.Stream;
  38778. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  38779. var Catalog = coreObj.Catalog;
  38780. var ObjectLoader = coreObj.ObjectLoader;
  38781. var XRef = coreObj.XRef;
  38782. var Linearization = coreParser.Linearization;
  38783. var calculateMD5 = coreCrypto.calculateMD5;
  38784. var OperatorList = coreEvaluator.OperatorList;
  38785. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  38786. var Annotation = coreAnnotation.Annotation;
  38787. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  38788. var Page = function PageClosure() {
  38789. var DEFAULT_USER_UNIT = 1.0;
  38790. var LETTER_SIZE_MEDIABOX = [
  38791. 0,
  38792. 0,
  38793. 612,
  38794. 792
  38795. ];
  38796. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) {
  38797. this.pdfManager = pdfManager;
  38798. this.pageIndex = pageIndex;
  38799. this.pageDict = pageDict;
  38800. this.xref = xref;
  38801. this.ref = ref;
  38802. this.fontCache = fontCache;
  38803. this.evaluatorOptions = pdfManager.evaluatorOptions;
  38804. this.resourcesPromise = null;
  38805. var uniquePrefix = 'p' + this.pageIndex + '_';
  38806. var idCounters = { obj: 0 };
  38807. this.idFactory = {
  38808. createObjId: function () {
  38809. return uniquePrefix + ++idCounters.obj;
  38810. }
  38811. };
  38812. }
  38813. Page.prototype = {
  38814. getPageProp: function Page_getPageProp(key) {
  38815. return this.pageDict.get(key);
  38816. },
  38817. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  38818. var dict = this.pageDict, valueArray = null, loopCount = 0;
  38819. var MAX_LOOP_COUNT = 100;
  38820. getArray = getArray || false;
  38821. while (dict) {
  38822. var value = getArray ? dict.getArray(key) : dict.get(key);
  38823. if (value) {
  38824. if (!valueArray) {
  38825. valueArray = [];
  38826. }
  38827. valueArray.push(value);
  38828. }
  38829. if (++loopCount > MAX_LOOP_COUNT) {
  38830. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  38831. break;
  38832. }
  38833. dict = dict.get('Parent');
  38834. }
  38835. if (!valueArray) {
  38836. return Dict.empty;
  38837. }
  38838. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  38839. return valueArray[0];
  38840. }
  38841. return Dict.merge(this.xref, valueArray);
  38842. },
  38843. get content() {
  38844. return this.getPageProp('Contents');
  38845. },
  38846. get resources() {
  38847. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  38848. },
  38849. get mediaBox() {
  38850. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  38851. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  38852. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  38853. }
  38854. return shadow(this, 'mediaBox', mediaBox);
  38855. },
  38856. get cropBox() {
  38857. var cropBox = this.getInheritedPageProp('CropBox', true);
  38858. if (!isArray(cropBox) || cropBox.length !== 4) {
  38859. return shadow(this, 'cropBox', this.mediaBox);
  38860. }
  38861. return shadow(this, 'cropBox', cropBox);
  38862. },
  38863. get userUnit() {
  38864. var obj = this.getPageProp('UserUnit');
  38865. if (!isNum(obj) || obj <= 0) {
  38866. obj = DEFAULT_USER_UNIT;
  38867. }
  38868. return shadow(this, 'userUnit', obj);
  38869. },
  38870. get view() {
  38871. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  38872. if (mediaBox === cropBox) {
  38873. return shadow(this, 'view', mediaBox);
  38874. }
  38875. var intersection = Util.intersect(cropBox, mediaBox);
  38876. return shadow(this, 'view', intersection || mediaBox);
  38877. },
  38878. get rotate() {
  38879. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38880. if (rotate % 90 !== 0) {
  38881. rotate = 0;
  38882. } else if (rotate >= 360) {
  38883. rotate = rotate % 360;
  38884. } else if (rotate < 0) {
  38885. rotate = (rotate % 360 + 360) % 360;
  38886. }
  38887. return shadow(this, 'rotate', rotate);
  38888. },
  38889. getContentStream: function Page_getContentStream() {
  38890. var content = this.content;
  38891. var stream;
  38892. if (isArray(content)) {
  38893. var xref = this.xref;
  38894. var i, n = content.length;
  38895. var streams = [];
  38896. for (i = 0; i < n; ++i) {
  38897. streams.push(xref.fetchIfRef(content[i]));
  38898. }
  38899. stream = new StreamsSequenceStream(streams);
  38900. } else if (isStream(content)) {
  38901. stream = content;
  38902. } else {
  38903. stream = new NullStream();
  38904. }
  38905. return stream;
  38906. },
  38907. loadResources: function Page_loadResources(keys) {
  38908. if (!this.resourcesPromise) {
  38909. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38910. }
  38911. return this.resourcesPromise.then(function resourceSuccess() {
  38912. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38913. return objectLoader.load();
  38914. }.bind(this));
  38915. },
  38916. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38917. var self = this;
  38918. var pdfManager = this.pdfManager;
  38919. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38920. var resourcesPromise = this.loadResources([
  38921. 'ExtGState',
  38922. 'ColorSpace',
  38923. 'Pattern',
  38924. 'Shading',
  38925. 'XObject',
  38926. 'Font'
  38927. ]);
  38928. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.evaluatorOptions);
  38929. var dataPromises = Promise.all([
  38930. contentStreamPromise,
  38931. resourcesPromise
  38932. ]);
  38933. var pageListPromise = dataPromises.then(function (data) {
  38934. var contentStream = data[0];
  38935. var opList = new OperatorList(intent, handler, self.pageIndex);
  38936. handler.send('StartRenderPage', {
  38937. transparency: partialEvaluator.hasBlendModes(self.resources),
  38938. pageIndex: self.pageIndex,
  38939. intent: intent
  38940. });
  38941. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38942. return opList;
  38943. });
  38944. });
  38945. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38946. return Promise.all([
  38947. pageListPromise,
  38948. annotationsPromise
  38949. ]).then(function (datas) {
  38950. var pageOpList = datas[0];
  38951. var annotations = datas[1];
  38952. if (annotations.length === 0) {
  38953. pageOpList.flush(true);
  38954. return pageOpList;
  38955. }
  38956. var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms);
  38957. return annotationsReadyPromise.then(function () {
  38958. pageOpList.flush(true);
  38959. return pageOpList;
  38960. });
  38961. });
  38962. },
  38963. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38964. var handler = {
  38965. on: function nullHandlerOn() {
  38966. },
  38967. send: function nullHandlerSend() {
  38968. }
  38969. };
  38970. var self = this;
  38971. var pdfManager = this.pdfManager;
  38972. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38973. var resourcesPromise = this.loadResources([
  38974. 'ExtGState',
  38975. 'XObject',
  38976. 'Font'
  38977. ]);
  38978. var dataPromises = Promise.all([
  38979. contentStreamPromise,
  38980. resourcesPromise
  38981. ]);
  38982. return dataPromises.then(function (data) {
  38983. var contentStream = data[0];
  38984. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.evaluatorOptions);
  38985. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38986. });
  38987. },
  38988. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38989. var annotations = this.annotations;
  38990. var annotationsData = [];
  38991. for (var i = 0, n = annotations.length; i < n; ++i) {
  38992. if (intent) {
  38993. if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) {
  38994. continue;
  38995. }
  38996. }
  38997. annotationsData.push(annotations[i].data);
  38998. }
  38999. return annotationsData;
  39000. },
  39001. get annotations() {
  39002. var annotations = [];
  39003. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  39004. var annotationFactory = new AnnotationFactory();
  39005. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  39006. var annotationRef = annotationRefs[i];
  39007. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  39008. if (annotation) {
  39009. annotations.push(annotation);
  39010. }
  39011. }
  39012. return shadow(this, 'annotations', annotations);
  39013. }
  39014. };
  39015. return Page;
  39016. }();
  39017. var PDFDocument = function PDFDocumentClosure() {
  39018. var FINGERPRINT_FIRST_BYTES = 1024;
  39019. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  39020. function PDFDocument(pdfManager, arg) {
  39021. var stream;
  39022. if (isStream(arg)) {
  39023. stream = arg;
  39024. } else if (isArrayBuffer(arg)) {
  39025. stream = new Stream(arg);
  39026. } else {
  39027. error('PDFDocument: Unknown argument type');
  39028. }
  39029. assert(stream.length > 0, 'stream must have data');
  39030. this.pdfManager = pdfManager;
  39031. this.stream = stream;
  39032. this.xref = new XRef(stream, pdfManager);
  39033. }
  39034. function find(stream, needle, limit, backwards) {
  39035. var pos = stream.pos;
  39036. var end = stream.end;
  39037. var strBuf = [];
  39038. if (pos + limit > end) {
  39039. limit = end - pos;
  39040. }
  39041. for (var n = 0; n < limit; ++n) {
  39042. strBuf.push(String.fromCharCode(stream.getByte()));
  39043. }
  39044. var str = strBuf.join('');
  39045. stream.pos = pos;
  39046. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  39047. if (index === -1) {
  39048. return false;
  39049. }
  39050. stream.pos += index;
  39051. return true;
  39052. }
  39053. var DocumentInfoValidators = {
  39054. get entries() {
  39055. return shadow(this, 'entries', {
  39056. Title: isString,
  39057. Author: isString,
  39058. Subject: isString,
  39059. Keywords: isString,
  39060. Creator: isString,
  39061. Producer: isString,
  39062. CreationDate: isString,
  39063. ModDate: isString,
  39064. Trapped: isName
  39065. });
  39066. }
  39067. };
  39068. PDFDocument.prototype = {
  39069. parse: function PDFDocument_parse(recoveryMode) {
  39070. this.setup(recoveryMode);
  39071. var version = this.catalog.catDict.get('Version');
  39072. if (isName(version)) {
  39073. this.pdfFormatVersion = version.name;
  39074. }
  39075. try {
  39076. this.acroForm = this.catalog.catDict.get('AcroForm');
  39077. if (this.acroForm) {
  39078. this.xfa = this.acroForm.get('XFA');
  39079. var fields = this.acroForm.get('Fields');
  39080. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  39081. this.acroForm = null;
  39082. }
  39083. }
  39084. } catch (ex) {
  39085. info('Something wrong with AcroForm entry');
  39086. this.acroForm = null;
  39087. }
  39088. },
  39089. get linearization() {
  39090. var linearization = null;
  39091. if (this.stream.length) {
  39092. try {
  39093. linearization = Linearization.create(this.stream);
  39094. } catch (err) {
  39095. if (err instanceof MissingDataException) {
  39096. throw err;
  39097. }
  39098. info(err);
  39099. }
  39100. }
  39101. return shadow(this, 'linearization', linearization);
  39102. },
  39103. get startXRef() {
  39104. var stream = this.stream;
  39105. var startXRef = 0;
  39106. var linearization = this.linearization;
  39107. if (linearization) {
  39108. stream.reset();
  39109. if (find(stream, 'endobj', 1024)) {
  39110. startXRef = stream.pos + 6;
  39111. }
  39112. } else {
  39113. var step = 1024;
  39114. var found = false, pos = stream.end;
  39115. while (!found && pos > 0) {
  39116. pos -= step - 'startxref'.length;
  39117. if (pos < 0) {
  39118. pos = 0;
  39119. }
  39120. stream.pos = pos;
  39121. found = find(stream, 'startxref', step, true);
  39122. }
  39123. if (found) {
  39124. stream.skip(9);
  39125. var ch;
  39126. do {
  39127. ch = stream.getByte();
  39128. } while (isSpace(ch));
  39129. var str = '';
  39130. while (ch >= 0x20 && ch <= 0x39) {
  39131. str += String.fromCharCode(ch);
  39132. ch = stream.getByte();
  39133. }
  39134. startXRef = parseInt(str, 10);
  39135. if (isNaN(startXRef)) {
  39136. startXRef = 0;
  39137. }
  39138. }
  39139. }
  39140. return shadow(this, 'startXRef', startXRef);
  39141. },
  39142. get mainXRefEntriesOffset() {
  39143. var mainXRefEntriesOffset = 0;
  39144. var linearization = this.linearization;
  39145. if (linearization) {
  39146. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  39147. }
  39148. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  39149. },
  39150. checkHeader: function PDFDocument_checkHeader() {
  39151. var stream = this.stream;
  39152. stream.reset();
  39153. if (find(stream, '%PDF-', 1024)) {
  39154. stream.moveStart();
  39155. var MAX_VERSION_LENGTH = 12;
  39156. var version = '', ch;
  39157. while ((ch = stream.getByte()) > 0x20) {
  39158. if (version.length >= MAX_VERSION_LENGTH) {
  39159. break;
  39160. }
  39161. version += String.fromCharCode(ch);
  39162. }
  39163. if (!this.pdfFormatVersion) {
  39164. this.pdfFormatVersion = version.substring(5);
  39165. }
  39166. return;
  39167. }
  39168. },
  39169. parseStartXRef: function PDFDocument_parseStartXRef() {
  39170. var startXRef = this.startXRef;
  39171. this.xref.setStartXRef(startXRef);
  39172. },
  39173. setup: function PDFDocument_setup(recoveryMode) {
  39174. this.xref.parse(recoveryMode);
  39175. var self = this;
  39176. var pageFactory = {
  39177. createPage: function (pageIndex, dict, ref, fontCache) {
  39178. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache);
  39179. }
  39180. };
  39181. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  39182. },
  39183. get numPages() {
  39184. var linearization = this.linearization;
  39185. var num = linearization ? linearization.numPages : this.catalog.numPages;
  39186. return shadow(this, 'numPages', num);
  39187. },
  39188. get documentInfo() {
  39189. var docInfo = {
  39190. PDFFormatVersion: this.pdfFormatVersion,
  39191. IsAcroFormPresent: !!this.acroForm,
  39192. IsXFAPresent: !!this.xfa
  39193. };
  39194. var infoDict;
  39195. try {
  39196. infoDict = this.xref.trailer.get('Info');
  39197. } catch (err) {
  39198. info('The document information dictionary is invalid.');
  39199. }
  39200. if (infoDict) {
  39201. var validEntries = DocumentInfoValidators.entries;
  39202. for (var key in validEntries) {
  39203. if (infoDict.has(key)) {
  39204. var value = infoDict.get(key);
  39205. if (validEntries[key](value)) {
  39206. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  39207. } else {
  39208. info('Bad value in document info for "' + key + '"');
  39209. }
  39210. }
  39211. }
  39212. }
  39213. return shadow(this, 'documentInfo', docInfo);
  39214. },
  39215. get fingerprint() {
  39216. var xref = this.xref, hash, fileID = '';
  39217. var idArray = xref.trailer.get('ID');
  39218. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  39219. hash = stringToBytes(idArray[0]);
  39220. } else {
  39221. if (this.stream.ensureRange) {
  39222. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  39223. }
  39224. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  39225. }
  39226. for (var i = 0, n = hash.length; i < n; i++) {
  39227. var hex = hash[i].toString(16);
  39228. fileID += hex.length === 1 ? '0' + hex : hex;
  39229. }
  39230. return shadow(this, 'fingerprint', fileID);
  39231. },
  39232. getPage: function PDFDocument_getPage(pageIndex) {
  39233. return this.catalog.getPage(pageIndex);
  39234. },
  39235. cleanup: function PDFDocument_cleanup() {
  39236. return this.catalog.cleanup();
  39237. }
  39238. };
  39239. return PDFDocument;
  39240. }();
  39241. exports.Page = Page;
  39242. exports.PDFDocument = PDFDocument;
  39243. /***/ }),
  39244. /* 26 */
  39245. /***/ (function(module, exports, __w_pdfjs_require__) {
  39246. "use strict";
  39247. var sharedUtil = __w_pdfjs_require__(0);
  39248. var coreStream = __w_pdfjs_require__(2);
  39249. var coreGlyphList = __w_pdfjs_require__(7);
  39250. var coreEncodings = __w_pdfjs_require__(4);
  39251. var coreCFFParser = __w_pdfjs_require__(10);
  39252. var Util = sharedUtil.Util;
  39253. var bytesToString = sharedUtil.bytesToString;
  39254. var error = sharedUtil.error;
  39255. var Stream = coreStream.Stream;
  39256. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39257. var StandardEncoding = coreEncodings.StandardEncoding;
  39258. var CFFParser = coreCFFParser.CFFParser;
  39259. var FontRendererFactory = function FontRendererFactoryClosure() {
  39260. function getLong(data, offset) {
  39261. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39262. }
  39263. function getUshort(data, offset) {
  39264. return data[offset] << 8 | data[offset + 1];
  39265. }
  39266. function parseCmap(data, start, end) {
  39267. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39268. var format = getUshort(data, start + offset);
  39269. var ranges, p, i;
  39270. if (format === 4) {
  39271. getUshort(data, start + offset + 2);
  39272. var segCount = getUshort(data, start + offset + 6) >> 1;
  39273. p = start + offset + 14;
  39274. ranges = [];
  39275. for (i = 0; i < segCount; i++, p += 2) {
  39276. ranges[i] = { end: getUshort(data, p) };
  39277. }
  39278. p += 2;
  39279. for (i = 0; i < segCount; i++, p += 2) {
  39280. ranges[i].start = getUshort(data, p);
  39281. }
  39282. for (i = 0; i < segCount; i++, p += 2) {
  39283. ranges[i].idDelta = getUshort(data, p);
  39284. }
  39285. for (i = 0; i < segCount; i++, p += 2) {
  39286. var idOffset = getUshort(data, p);
  39287. if (idOffset === 0) {
  39288. continue;
  39289. }
  39290. ranges[i].ids = [];
  39291. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39292. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39293. idOffset += 2;
  39294. }
  39295. }
  39296. return ranges;
  39297. } else if (format === 12) {
  39298. getLong(data, start + offset + 4);
  39299. var groups = getLong(data, start + offset + 12);
  39300. p = start + offset + 16;
  39301. ranges = [];
  39302. for (i = 0; i < groups; i++) {
  39303. ranges.push({
  39304. start: getLong(data, p),
  39305. end: getLong(data, p + 4),
  39306. idDelta: getLong(data, p + 8) - getLong(data, p)
  39307. });
  39308. p += 12;
  39309. }
  39310. return ranges;
  39311. }
  39312. error('not supported cmap: ' + format);
  39313. }
  39314. function parseCff(data, start, end, seacAnalysisEnabled) {
  39315. var properties = {};
  39316. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39317. var cff = parser.parse();
  39318. return {
  39319. glyphs: cff.charStrings.objects,
  39320. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39321. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  39322. };
  39323. }
  39324. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39325. var itemSize, itemDecode;
  39326. if (isGlyphLocationsLong) {
  39327. itemSize = 4;
  39328. itemDecode = function fontItemDecodeLong(data, offset) {
  39329. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39330. };
  39331. } else {
  39332. itemSize = 2;
  39333. itemDecode = function fontItemDecode(data, offset) {
  39334. return data[offset] << 9 | data[offset + 1] << 1;
  39335. };
  39336. }
  39337. var glyphs = [];
  39338. var startOffset = itemDecode(loca, 0);
  39339. for (var j = itemSize; j < loca.length; j += itemSize) {
  39340. var endOffset = itemDecode(loca, j);
  39341. glyphs.push(glyf.subarray(startOffset, endOffset));
  39342. startOffset = endOffset;
  39343. }
  39344. return glyphs;
  39345. }
  39346. function lookupCmap(ranges, unicode) {
  39347. var code = unicode.charCodeAt(0), gid = 0;
  39348. var l = 0, r = ranges.length - 1;
  39349. while (l < r) {
  39350. var c = l + r + 1 >> 1;
  39351. if (code < ranges[c].start) {
  39352. r = c - 1;
  39353. } else {
  39354. l = c;
  39355. }
  39356. }
  39357. if (ranges[l].start <= code && code <= ranges[l].end) {
  39358. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  39359. }
  39360. return {
  39361. charCode: code,
  39362. glyphId: gid
  39363. };
  39364. }
  39365. function compileGlyf(code, cmds, font) {
  39366. function moveTo(x, y) {
  39367. cmds.push({
  39368. cmd: 'moveTo',
  39369. args: [
  39370. x,
  39371. y
  39372. ]
  39373. });
  39374. }
  39375. function lineTo(x, y) {
  39376. cmds.push({
  39377. cmd: 'lineTo',
  39378. args: [
  39379. x,
  39380. y
  39381. ]
  39382. });
  39383. }
  39384. function quadraticCurveTo(xa, ya, x, y) {
  39385. cmds.push({
  39386. cmd: 'quadraticCurveTo',
  39387. args: [
  39388. xa,
  39389. ya,
  39390. x,
  39391. y
  39392. ]
  39393. });
  39394. }
  39395. var i = 0;
  39396. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39397. var flags;
  39398. var x = 0, y = 0;
  39399. i += 10;
  39400. if (numberOfContours < 0) {
  39401. do {
  39402. flags = code[i] << 8 | code[i + 1];
  39403. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  39404. i += 4;
  39405. var arg1, arg2;
  39406. if (flags & 0x01) {
  39407. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39408. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39409. i += 4;
  39410. } else {
  39411. arg1 = code[i++];
  39412. arg2 = code[i++];
  39413. }
  39414. if (flags & 0x02) {
  39415. x = arg1;
  39416. y = arg2;
  39417. } else {
  39418. x = 0;
  39419. y = 0;
  39420. }
  39421. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  39422. if (flags & 0x08) {
  39423. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39424. i += 2;
  39425. } else if (flags & 0x40) {
  39426. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39427. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39428. i += 4;
  39429. } else if (flags & 0x80) {
  39430. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39431. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39432. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39433. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39434. i += 8;
  39435. }
  39436. var subglyph = font.glyphs[glyphIndex];
  39437. if (subglyph) {
  39438. cmds.push({ cmd: 'save' });
  39439. cmds.push({
  39440. cmd: 'transform',
  39441. args: [
  39442. scaleX,
  39443. scale01,
  39444. scale10,
  39445. scaleY,
  39446. x,
  39447. y
  39448. ]
  39449. });
  39450. compileGlyf(subglyph, cmds, font);
  39451. cmds.push({ cmd: 'restore' });
  39452. }
  39453. } while (flags & 0x20);
  39454. } else {
  39455. var endPtsOfContours = [];
  39456. var j, jj;
  39457. for (j = 0; j < numberOfContours; j++) {
  39458. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39459. i += 2;
  39460. }
  39461. var instructionLength = code[i] << 8 | code[i + 1];
  39462. i += 2 + instructionLength;
  39463. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39464. var points = [];
  39465. while (points.length < numberOfPoints) {
  39466. flags = code[i++];
  39467. var repeat = 1;
  39468. if (flags & 0x08) {
  39469. repeat += code[i++];
  39470. }
  39471. while (repeat-- > 0) {
  39472. points.push({ flags: flags });
  39473. }
  39474. }
  39475. for (j = 0; j < numberOfPoints; j++) {
  39476. switch (points[j].flags & 0x12) {
  39477. case 0x00:
  39478. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39479. i += 2;
  39480. break;
  39481. case 0x02:
  39482. x -= code[i++];
  39483. break;
  39484. case 0x12:
  39485. x += code[i++];
  39486. break;
  39487. }
  39488. points[j].x = x;
  39489. }
  39490. for (j = 0; j < numberOfPoints; j++) {
  39491. switch (points[j].flags & 0x24) {
  39492. case 0x00:
  39493. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39494. i += 2;
  39495. break;
  39496. case 0x04:
  39497. y -= code[i++];
  39498. break;
  39499. case 0x24:
  39500. y += code[i++];
  39501. break;
  39502. }
  39503. points[j].y = y;
  39504. }
  39505. var startPoint = 0;
  39506. for (i = 0; i < numberOfContours; i++) {
  39507. var endPoint = endPtsOfContours[i];
  39508. var contour = points.slice(startPoint, endPoint + 1);
  39509. if (contour[0].flags & 1) {
  39510. contour.push(contour[0]);
  39511. } else if (contour[contour.length - 1].flags & 1) {
  39512. contour.unshift(contour[contour.length - 1]);
  39513. } else {
  39514. var p = {
  39515. flags: 1,
  39516. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39517. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39518. };
  39519. contour.unshift(p);
  39520. contour.push(p);
  39521. }
  39522. moveTo(contour[0].x, contour[0].y);
  39523. for (j = 1, jj = contour.length; j < jj; j++) {
  39524. if (contour[j].flags & 1) {
  39525. lineTo(contour[j].x, contour[j].y);
  39526. } else if (contour[j + 1].flags & 1) {
  39527. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39528. j++;
  39529. } else {
  39530. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39531. }
  39532. }
  39533. startPoint = endPoint + 1;
  39534. }
  39535. }
  39536. }
  39537. function compileCharString(code, cmds, font) {
  39538. var stack = [];
  39539. var x = 0, y = 0;
  39540. var stems = 0;
  39541. function moveTo(x, y) {
  39542. cmds.push({
  39543. cmd: 'moveTo',
  39544. args: [
  39545. x,
  39546. y
  39547. ]
  39548. });
  39549. }
  39550. function lineTo(x, y) {
  39551. cmds.push({
  39552. cmd: 'lineTo',
  39553. args: [
  39554. x,
  39555. y
  39556. ]
  39557. });
  39558. }
  39559. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39560. cmds.push({
  39561. cmd: 'bezierCurveTo',
  39562. args: [
  39563. x1,
  39564. y1,
  39565. x2,
  39566. y2,
  39567. x,
  39568. y
  39569. ]
  39570. });
  39571. }
  39572. function parse(code) {
  39573. var i = 0;
  39574. while (i < code.length) {
  39575. var stackClean = false;
  39576. var v = code[i++];
  39577. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39578. switch (v) {
  39579. case 1:
  39580. stems += stack.length >> 1;
  39581. stackClean = true;
  39582. break;
  39583. case 3:
  39584. stems += stack.length >> 1;
  39585. stackClean = true;
  39586. break;
  39587. case 4:
  39588. y += stack.pop();
  39589. moveTo(x, y);
  39590. stackClean = true;
  39591. break;
  39592. case 5:
  39593. while (stack.length > 0) {
  39594. x += stack.shift();
  39595. y += stack.shift();
  39596. lineTo(x, y);
  39597. }
  39598. break;
  39599. case 6:
  39600. while (stack.length > 0) {
  39601. x += stack.shift();
  39602. lineTo(x, y);
  39603. if (stack.length === 0) {
  39604. break;
  39605. }
  39606. y += stack.shift();
  39607. lineTo(x, y);
  39608. }
  39609. break;
  39610. case 7:
  39611. while (stack.length > 0) {
  39612. y += stack.shift();
  39613. lineTo(x, y);
  39614. if (stack.length === 0) {
  39615. break;
  39616. }
  39617. x += stack.shift();
  39618. lineTo(x, y);
  39619. }
  39620. break;
  39621. case 8:
  39622. while (stack.length > 0) {
  39623. xa = x + stack.shift();
  39624. ya = y + stack.shift();
  39625. xb = xa + stack.shift();
  39626. yb = ya + stack.shift();
  39627. x = xb + stack.shift();
  39628. y = yb + stack.shift();
  39629. bezierCurveTo(xa, ya, xb, yb, x, y);
  39630. }
  39631. break;
  39632. case 10:
  39633. n = stack.pop() + font.subrsBias;
  39634. subrCode = font.subrs[n];
  39635. if (subrCode) {
  39636. parse(subrCode);
  39637. }
  39638. break;
  39639. case 11:
  39640. return;
  39641. case 12:
  39642. v = code[i++];
  39643. switch (v) {
  39644. case 34:
  39645. xa = x + stack.shift();
  39646. xb = xa + stack.shift();
  39647. y1 = y + stack.shift();
  39648. x = xb + stack.shift();
  39649. bezierCurveTo(xa, y, xb, y1, x, y1);
  39650. xa = x + stack.shift();
  39651. xb = xa + stack.shift();
  39652. x = xb + stack.shift();
  39653. bezierCurveTo(xa, y1, xb, y, x, y);
  39654. break;
  39655. case 35:
  39656. xa = x + stack.shift();
  39657. ya = y + stack.shift();
  39658. xb = xa + stack.shift();
  39659. yb = ya + stack.shift();
  39660. x = xb + stack.shift();
  39661. y = yb + stack.shift();
  39662. bezierCurveTo(xa, ya, xb, yb, x, y);
  39663. xa = x + stack.shift();
  39664. ya = y + stack.shift();
  39665. xb = xa + stack.shift();
  39666. yb = ya + stack.shift();
  39667. x = xb + stack.shift();
  39668. y = yb + stack.shift();
  39669. bezierCurveTo(xa, ya, xb, yb, x, y);
  39670. stack.pop();
  39671. break;
  39672. case 36:
  39673. xa = x + stack.shift();
  39674. y1 = y + stack.shift();
  39675. xb = xa + stack.shift();
  39676. y2 = y1 + stack.shift();
  39677. x = xb + stack.shift();
  39678. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39679. xa = x + stack.shift();
  39680. xb = xa + stack.shift();
  39681. y3 = y2 + stack.shift();
  39682. x = xb + stack.shift();
  39683. bezierCurveTo(xa, y2, xb, y3, x, y);
  39684. break;
  39685. case 37:
  39686. var x0 = x, y0 = y;
  39687. xa = x + stack.shift();
  39688. ya = y + stack.shift();
  39689. xb = xa + stack.shift();
  39690. yb = ya + stack.shift();
  39691. x = xb + stack.shift();
  39692. y = yb + stack.shift();
  39693. bezierCurveTo(xa, ya, xb, yb, x, y);
  39694. xa = x + stack.shift();
  39695. ya = y + stack.shift();
  39696. xb = xa + stack.shift();
  39697. yb = ya + stack.shift();
  39698. x = xb;
  39699. y = yb;
  39700. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39701. x += stack.shift();
  39702. } else {
  39703. y += stack.shift();
  39704. }
  39705. bezierCurveTo(xa, ya, xb, yb, x, y);
  39706. break;
  39707. default:
  39708. error('unknown operator: 12 ' + v);
  39709. }
  39710. break;
  39711. case 14:
  39712. if (stack.length >= 4) {
  39713. var achar = stack.pop();
  39714. var bchar = stack.pop();
  39715. y = stack.pop();
  39716. x = stack.pop();
  39717. cmds.push({ cmd: 'save' });
  39718. cmds.push({
  39719. cmd: 'translate',
  39720. args: [
  39721. x,
  39722. y
  39723. ]
  39724. });
  39725. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  39726. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39727. cmds.push({ cmd: 'restore' });
  39728. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  39729. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39730. }
  39731. return;
  39732. case 18:
  39733. stems += stack.length >> 1;
  39734. stackClean = true;
  39735. break;
  39736. case 19:
  39737. stems += stack.length >> 1;
  39738. i += stems + 7 >> 3;
  39739. stackClean = true;
  39740. break;
  39741. case 20:
  39742. stems += stack.length >> 1;
  39743. i += stems + 7 >> 3;
  39744. stackClean = true;
  39745. break;
  39746. case 21:
  39747. y += stack.pop();
  39748. x += stack.pop();
  39749. moveTo(x, y);
  39750. stackClean = true;
  39751. break;
  39752. case 22:
  39753. x += stack.pop();
  39754. moveTo(x, y);
  39755. stackClean = true;
  39756. break;
  39757. case 23:
  39758. stems += stack.length >> 1;
  39759. stackClean = true;
  39760. break;
  39761. case 24:
  39762. while (stack.length > 2) {
  39763. xa = x + stack.shift();
  39764. ya = y + stack.shift();
  39765. xb = xa + stack.shift();
  39766. yb = ya + stack.shift();
  39767. x = xb + stack.shift();
  39768. y = yb + stack.shift();
  39769. bezierCurveTo(xa, ya, xb, yb, x, y);
  39770. }
  39771. x += stack.shift();
  39772. y += stack.shift();
  39773. lineTo(x, y);
  39774. break;
  39775. case 25:
  39776. while (stack.length > 6) {
  39777. x += stack.shift();
  39778. y += stack.shift();
  39779. lineTo(x, y);
  39780. }
  39781. xa = x + stack.shift();
  39782. ya = y + stack.shift();
  39783. xb = xa + stack.shift();
  39784. yb = ya + stack.shift();
  39785. x = xb + stack.shift();
  39786. y = yb + stack.shift();
  39787. bezierCurveTo(xa, ya, xb, yb, x, y);
  39788. break;
  39789. case 26:
  39790. if (stack.length % 2) {
  39791. x += stack.shift();
  39792. }
  39793. while (stack.length > 0) {
  39794. xa = x;
  39795. ya = y + stack.shift();
  39796. xb = xa + stack.shift();
  39797. yb = ya + stack.shift();
  39798. x = xb;
  39799. y = yb + stack.shift();
  39800. bezierCurveTo(xa, ya, xb, yb, x, y);
  39801. }
  39802. break;
  39803. case 27:
  39804. if (stack.length % 2) {
  39805. y += stack.shift();
  39806. }
  39807. while (stack.length > 0) {
  39808. xa = x + stack.shift();
  39809. ya = y;
  39810. xb = xa + stack.shift();
  39811. yb = ya + stack.shift();
  39812. x = xb + stack.shift();
  39813. y = yb;
  39814. bezierCurveTo(xa, ya, xb, yb, x, y);
  39815. }
  39816. break;
  39817. case 28:
  39818. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39819. i += 2;
  39820. break;
  39821. case 29:
  39822. n = stack.pop() + font.gsubrsBias;
  39823. subrCode = font.gsubrs[n];
  39824. if (subrCode) {
  39825. parse(subrCode);
  39826. }
  39827. break;
  39828. case 30:
  39829. while (stack.length > 0) {
  39830. xa = x;
  39831. ya = y + stack.shift();
  39832. xb = xa + stack.shift();
  39833. yb = ya + stack.shift();
  39834. x = xb + stack.shift();
  39835. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39836. bezierCurveTo(xa, ya, xb, yb, x, y);
  39837. if (stack.length === 0) {
  39838. break;
  39839. }
  39840. xa = x + stack.shift();
  39841. ya = y;
  39842. xb = xa + stack.shift();
  39843. yb = ya + stack.shift();
  39844. y = yb + stack.shift();
  39845. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39846. bezierCurveTo(xa, ya, xb, yb, x, y);
  39847. }
  39848. break;
  39849. case 31:
  39850. while (stack.length > 0) {
  39851. xa = x + stack.shift();
  39852. ya = y;
  39853. xb = xa + stack.shift();
  39854. yb = ya + stack.shift();
  39855. y = yb + stack.shift();
  39856. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39857. bezierCurveTo(xa, ya, xb, yb, x, y);
  39858. if (stack.length === 0) {
  39859. break;
  39860. }
  39861. xa = x;
  39862. ya = y + stack.shift();
  39863. xb = xa + stack.shift();
  39864. yb = ya + stack.shift();
  39865. x = xb + stack.shift();
  39866. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39867. bezierCurveTo(xa, ya, xb, yb, x, y);
  39868. }
  39869. break;
  39870. default:
  39871. if (v < 32) {
  39872. error('unknown operator: ' + v);
  39873. }
  39874. if (v < 247) {
  39875. stack.push(v - 139);
  39876. } else if (v < 251) {
  39877. stack.push((v - 247) * 256 + code[i++] + 108);
  39878. } else if (v < 255) {
  39879. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39880. } else {
  39881. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39882. i += 4;
  39883. }
  39884. break;
  39885. }
  39886. if (stackClean) {
  39887. stack.length = 0;
  39888. }
  39889. }
  39890. }
  39891. parse(code);
  39892. }
  39893. var noop = '';
  39894. function CompiledFont(fontMatrix) {
  39895. this.compiledGlyphs = Object.create(null);
  39896. this.compiledCharCodeToGlyphId = Object.create(null);
  39897. this.fontMatrix = fontMatrix;
  39898. }
  39899. CompiledFont.prototype = {
  39900. getPathJs: function (unicode) {
  39901. var cmap = lookupCmap(this.cmap, unicode);
  39902. var fn = this.compiledGlyphs[cmap.glyphId];
  39903. if (!fn) {
  39904. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39905. this.compiledGlyphs[cmap.glyphId] = fn;
  39906. }
  39907. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39908. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39909. }
  39910. return fn;
  39911. },
  39912. compileGlyph: function (code) {
  39913. if (!code || code.length === 0 || code[0] === 14) {
  39914. return noop;
  39915. }
  39916. var cmds = [];
  39917. cmds.push({ cmd: 'save' });
  39918. cmds.push({
  39919. cmd: 'transform',
  39920. args: this.fontMatrix.slice()
  39921. });
  39922. cmds.push({
  39923. cmd: 'scale',
  39924. args: [
  39925. 'size',
  39926. '-size'
  39927. ]
  39928. });
  39929. this.compileGlyphImpl(code, cmds);
  39930. cmds.push({ cmd: 'restore' });
  39931. return cmds;
  39932. },
  39933. compileGlyphImpl: function () {
  39934. error('Children classes should implement this.');
  39935. },
  39936. hasBuiltPath: function (unicode) {
  39937. var cmap = lookupCmap(this.cmap, unicode);
  39938. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39939. }
  39940. };
  39941. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39942. fontMatrix = fontMatrix || [
  39943. 0.000488,
  39944. 0,
  39945. 0,
  39946. 0.000488,
  39947. 0,
  39948. 0
  39949. ];
  39950. CompiledFont.call(this, fontMatrix);
  39951. this.glyphs = glyphs;
  39952. this.cmap = cmap;
  39953. }
  39954. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39955. compileGlyphImpl: function (code, cmds) {
  39956. compileGlyf(code, cmds, this);
  39957. }
  39958. });
  39959. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39960. fontMatrix = fontMatrix || [
  39961. 0.001,
  39962. 0,
  39963. 0,
  39964. 0.001,
  39965. 0,
  39966. 0
  39967. ];
  39968. CompiledFont.call(this, fontMatrix);
  39969. this.glyphs = cffInfo.glyphs;
  39970. this.gsubrs = cffInfo.gsubrs || [];
  39971. this.subrs = cffInfo.subrs || [];
  39972. this.cmap = cmap;
  39973. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39974. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39975. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39976. }
  39977. Util.inherit(Type2Compiled, CompiledFont, {
  39978. compileGlyphImpl: function (code, cmds) {
  39979. compileCharString(code, cmds, this);
  39980. }
  39981. });
  39982. return {
  39983. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39984. var data = new Uint8Array(font.data);
  39985. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39986. var numTables = getUshort(data, 4);
  39987. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39988. var tag = bytesToString(data.subarray(p, p + 4));
  39989. var offset = getLong(data, p + 8);
  39990. var length = getLong(data, p + 12);
  39991. switch (tag) {
  39992. case 'cmap':
  39993. cmap = parseCmap(data, offset, offset + length);
  39994. break;
  39995. case 'glyf':
  39996. glyf = data.subarray(offset, offset + length);
  39997. break;
  39998. case 'loca':
  39999. loca = data.subarray(offset, offset + length);
  40000. break;
  40001. case 'head':
  40002. unitsPerEm = getUshort(data, offset + 18);
  40003. indexToLocFormat = getUshort(data, offset + 50);
  40004. break;
  40005. case 'CFF ':
  40006. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  40007. break;
  40008. }
  40009. }
  40010. if (glyf) {
  40011. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  40012. 1 / unitsPerEm,
  40013. 0,
  40014. 0,
  40015. 1 / unitsPerEm,
  40016. 0,
  40017. 0
  40018. ];
  40019. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  40020. }
  40021. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  40022. }
  40023. };
  40024. }();
  40025. exports.FontRendererFactory = FontRendererFactory;
  40026. /***/ }),
  40027. /* 27 */
  40028. /***/ (function(module, exports, __w_pdfjs_require__) {
  40029. "use strict";
  40030. var sharedUtil = __w_pdfjs_require__(0);
  40031. var corePrimitives = __w_pdfjs_require__(1);
  40032. var coreStream = __w_pdfjs_require__(2);
  40033. var coreGlyphList = __w_pdfjs_require__(7);
  40034. var coreFontRenderer = __w_pdfjs_require__(26);
  40035. var coreEncodings = __w_pdfjs_require__(4);
  40036. var coreStandardFonts = __w_pdfjs_require__(16);
  40037. var coreUnicode = __w_pdfjs_require__(17);
  40038. var coreType1Parser = __w_pdfjs_require__(36);
  40039. var coreCFFParser = __w_pdfjs_require__(10);
  40040. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  40041. var FontType = sharedUtil.FontType;
  40042. var assert = sharedUtil.assert;
  40043. var bytesToString = sharedUtil.bytesToString;
  40044. var error = sharedUtil.error;
  40045. var info = sharedUtil.info;
  40046. var isArray = sharedUtil.isArray;
  40047. var isInt = sharedUtil.isInt;
  40048. var isNum = sharedUtil.isNum;
  40049. var readUint32 = sharedUtil.readUint32;
  40050. var shadow = sharedUtil.shadow;
  40051. var string32 = sharedUtil.string32;
  40052. var warn = sharedUtil.warn;
  40053. var MissingDataException = sharedUtil.MissingDataException;
  40054. var isSpace = sharedUtil.isSpace;
  40055. var Stream = coreStream.Stream;
  40056. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  40057. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  40058. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  40059. var StandardEncoding = coreEncodings.StandardEncoding;
  40060. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  40061. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  40062. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  40063. var getEncoding = coreEncodings.getEncoding;
  40064. var getStdFontMap = coreStandardFonts.getStdFontMap;
  40065. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  40066. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  40067. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  40068. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  40069. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  40070. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  40071. var Type1Parser = coreType1Parser.Type1Parser;
  40072. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  40073. var CFFParser = coreCFFParser.CFFParser;
  40074. var CFFCompiler = coreCFFParser.CFFCompiler;
  40075. var CFF = coreCFFParser.CFF;
  40076. var CFFHeader = coreCFFParser.CFFHeader;
  40077. var CFFTopDict = coreCFFParser.CFFTopDict;
  40078. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  40079. var CFFStrings = coreCFFParser.CFFStrings;
  40080. var CFFIndex = coreCFFParser.CFFIndex;
  40081. var CFFCharset = coreCFFParser.CFFCharset;
  40082. var PRIVATE_USE_OFFSET_START = 0xE000;
  40083. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  40084. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  40085. var PDF_GLYPH_SPACE_UNITS = 1000;
  40086. var SEAC_ANALYSIS_ENABLED = false;
  40087. var FontFlags = {
  40088. FixedPitch: 1,
  40089. Serif: 2,
  40090. Symbolic: 4,
  40091. Script: 8,
  40092. Nonsymbolic: 32,
  40093. Italic: 64,
  40094. AllCap: 65536,
  40095. SmallCap: 131072,
  40096. ForceBold: 262144
  40097. };
  40098. var MacStandardGlyphOrdering = [
  40099. '.notdef',
  40100. '.null',
  40101. 'nonmarkingreturn',
  40102. 'space',
  40103. 'exclam',
  40104. 'quotedbl',
  40105. 'numbersign',
  40106. 'dollar',
  40107. 'percent',
  40108. 'ampersand',
  40109. 'quotesingle',
  40110. 'parenleft',
  40111. 'parenright',
  40112. 'asterisk',
  40113. 'plus',
  40114. 'comma',
  40115. 'hyphen',
  40116. 'period',
  40117. 'slash',
  40118. 'zero',
  40119. 'one',
  40120. 'two',
  40121. 'three',
  40122. 'four',
  40123. 'five',
  40124. 'six',
  40125. 'seven',
  40126. 'eight',
  40127. 'nine',
  40128. 'colon',
  40129. 'semicolon',
  40130. 'less',
  40131. 'equal',
  40132. 'greater',
  40133. 'question',
  40134. 'at',
  40135. 'A',
  40136. 'B',
  40137. 'C',
  40138. 'D',
  40139. 'E',
  40140. 'F',
  40141. 'G',
  40142. 'H',
  40143. 'I',
  40144. 'J',
  40145. 'K',
  40146. 'L',
  40147. 'M',
  40148. 'N',
  40149. 'O',
  40150. 'P',
  40151. 'Q',
  40152. 'R',
  40153. 'S',
  40154. 'T',
  40155. 'U',
  40156. 'V',
  40157. 'W',
  40158. 'X',
  40159. 'Y',
  40160. 'Z',
  40161. 'bracketleft',
  40162. 'backslash',
  40163. 'bracketright',
  40164. 'asciicircum',
  40165. 'underscore',
  40166. 'grave',
  40167. 'a',
  40168. 'b',
  40169. 'c',
  40170. 'd',
  40171. 'e',
  40172. 'f',
  40173. 'g',
  40174. 'h',
  40175. 'i',
  40176. 'j',
  40177. 'k',
  40178. 'l',
  40179. 'm',
  40180. 'n',
  40181. 'o',
  40182. 'p',
  40183. 'q',
  40184. 'r',
  40185. 's',
  40186. 't',
  40187. 'u',
  40188. 'v',
  40189. 'w',
  40190. 'x',
  40191. 'y',
  40192. 'z',
  40193. 'braceleft',
  40194. 'bar',
  40195. 'braceright',
  40196. 'asciitilde',
  40197. 'Adieresis',
  40198. 'Aring',
  40199. 'Ccedilla',
  40200. 'Eacute',
  40201. 'Ntilde',
  40202. 'Odieresis',
  40203. 'Udieresis',
  40204. 'aacute',
  40205. 'agrave',
  40206. 'acircumflex',
  40207. 'adieresis',
  40208. 'atilde',
  40209. 'aring',
  40210. 'ccedilla',
  40211. 'eacute',
  40212. 'egrave',
  40213. 'ecircumflex',
  40214. 'edieresis',
  40215. 'iacute',
  40216. 'igrave',
  40217. 'icircumflex',
  40218. 'idieresis',
  40219. 'ntilde',
  40220. 'oacute',
  40221. 'ograve',
  40222. 'ocircumflex',
  40223. 'odieresis',
  40224. 'otilde',
  40225. 'uacute',
  40226. 'ugrave',
  40227. 'ucircumflex',
  40228. 'udieresis',
  40229. 'dagger',
  40230. 'degree',
  40231. 'cent',
  40232. 'sterling',
  40233. 'section',
  40234. 'bullet',
  40235. 'paragraph',
  40236. 'germandbls',
  40237. 'registered',
  40238. 'copyright',
  40239. 'trademark',
  40240. 'acute',
  40241. 'dieresis',
  40242. 'notequal',
  40243. 'AE',
  40244. 'Oslash',
  40245. 'infinity',
  40246. 'plusminus',
  40247. 'lessequal',
  40248. 'greaterequal',
  40249. 'yen',
  40250. 'mu',
  40251. 'partialdiff',
  40252. 'summation',
  40253. 'product',
  40254. 'pi',
  40255. 'integral',
  40256. 'ordfeminine',
  40257. 'ordmasculine',
  40258. 'Omega',
  40259. 'ae',
  40260. 'oslash',
  40261. 'questiondown',
  40262. 'exclamdown',
  40263. 'logicalnot',
  40264. 'radical',
  40265. 'florin',
  40266. 'approxequal',
  40267. 'Delta',
  40268. 'guillemotleft',
  40269. 'guillemotright',
  40270. 'ellipsis',
  40271. 'nonbreakingspace',
  40272. 'Agrave',
  40273. 'Atilde',
  40274. 'Otilde',
  40275. 'OE',
  40276. 'oe',
  40277. 'endash',
  40278. 'emdash',
  40279. 'quotedblleft',
  40280. 'quotedblright',
  40281. 'quoteleft',
  40282. 'quoteright',
  40283. 'divide',
  40284. 'lozenge',
  40285. 'ydieresis',
  40286. 'Ydieresis',
  40287. 'fraction',
  40288. 'currency',
  40289. 'guilsinglleft',
  40290. 'guilsinglright',
  40291. 'fi',
  40292. 'fl',
  40293. 'daggerdbl',
  40294. 'periodcentered',
  40295. 'quotesinglbase',
  40296. 'quotedblbase',
  40297. 'perthousand',
  40298. 'Acircumflex',
  40299. 'Ecircumflex',
  40300. 'Aacute',
  40301. 'Edieresis',
  40302. 'Egrave',
  40303. 'Iacute',
  40304. 'Icircumflex',
  40305. 'Idieresis',
  40306. 'Igrave',
  40307. 'Oacute',
  40308. 'Ocircumflex',
  40309. 'apple',
  40310. 'Ograve',
  40311. 'Uacute',
  40312. 'Ucircumflex',
  40313. 'Ugrave',
  40314. 'dotlessi',
  40315. 'circumflex',
  40316. 'tilde',
  40317. 'macron',
  40318. 'breve',
  40319. 'dotaccent',
  40320. 'ring',
  40321. 'cedilla',
  40322. 'hungarumlaut',
  40323. 'ogonek',
  40324. 'caron',
  40325. 'Lslash',
  40326. 'lslash',
  40327. 'Scaron',
  40328. 'scaron',
  40329. 'Zcaron',
  40330. 'zcaron',
  40331. 'brokenbar',
  40332. 'Eth',
  40333. 'eth',
  40334. 'Yacute',
  40335. 'yacute',
  40336. 'Thorn',
  40337. 'thorn',
  40338. 'minus',
  40339. 'multiply',
  40340. 'onesuperior',
  40341. 'twosuperior',
  40342. 'threesuperior',
  40343. 'onehalf',
  40344. 'onequarter',
  40345. 'threequarters',
  40346. 'franc',
  40347. 'Gbreve',
  40348. 'gbreve',
  40349. 'Idotaccent',
  40350. 'Scedilla',
  40351. 'scedilla',
  40352. 'Cacute',
  40353. 'cacute',
  40354. 'Ccaron',
  40355. 'ccaron',
  40356. 'dcroat'
  40357. ];
  40358. function adjustWidths(properties) {
  40359. if (!properties.fontMatrix) {
  40360. return;
  40361. }
  40362. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  40363. return;
  40364. }
  40365. var scale = 0.001 / properties.fontMatrix[0];
  40366. var glyphsWidths = properties.widths;
  40367. for (var glyph in glyphsWidths) {
  40368. glyphsWidths[glyph] *= scale;
  40369. }
  40370. properties.defaultWidth *= scale;
  40371. }
  40372. function adjustToUnicode(properties, builtInEncoding) {
  40373. if (properties.hasIncludedToUnicodeMap) {
  40374. return;
  40375. }
  40376. if (properties.hasEncoding) {
  40377. return;
  40378. }
  40379. if (builtInEncoding === properties.defaultEncoding) {
  40380. return;
  40381. }
  40382. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  40383. return;
  40384. }
  40385. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  40386. for (var charCode in builtInEncoding) {
  40387. var glyphName = builtInEncoding[charCode];
  40388. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40389. if (unicode !== -1) {
  40390. toUnicode[charCode] = String.fromCharCode(unicode);
  40391. }
  40392. }
  40393. properties.toUnicode.amend(toUnicode);
  40394. }
  40395. function getFontType(type, subtype) {
  40396. switch (type) {
  40397. case 'Type1':
  40398. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  40399. case 'CIDFontType0':
  40400. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  40401. case 'OpenType':
  40402. return FontType.OPENTYPE;
  40403. case 'TrueType':
  40404. return FontType.TRUETYPE;
  40405. case 'CIDFontType2':
  40406. return FontType.CIDFONTTYPE2;
  40407. case 'MMType1':
  40408. return FontType.MMTYPE1;
  40409. case 'Type0':
  40410. return FontType.TYPE0;
  40411. default:
  40412. return FontType.UNKNOWN;
  40413. }
  40414. }
  40415. function recoverGlyphName(name, glyphsUnicodeMap) {
  40416. if (glyphsUnicodeMap[name] !== undefined) {
  40417. return name;
  40418. }
  40419. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  40420. if (unicode !== -1) {
  40421. for (var key in glyphsUnicodeMap) {
  40422. if (glyphsUnicodeMap[key] === unicode) {
  40423. return key;
  40424. }
  40425. }
  40426. }
  40427. info('Unable to recover a standard glyph name for: ' + name);
  40428. return name;
  40429. }
  40430. var Glyph = function GlyphClosure() {
  40431. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40432. this.fontChar = fontChar;
  40433. this.unicode = unicode;
  40434. this.accent = accent;
  40435. this.width = width;
  40436. this.vmetric = vmetric;
  40437. this.operatorListId = operatorListId;
  40438. this.isSpace = isSpace;
  40439. this.isInFont = isInFont;
  40440. }
  40441. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40442. 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;
  40443. };
  40444. return Glyph;
  40445. }();
  40446. var ToUnicodeMap = function ToUnicodeMapClosure() {
  40447. function ToUnicodeMap(cmap) {
  40448. this._map = cmap;
  40449. }
  40450. ToUnicodeMap.prototype = {
  40451. get length() {
  40452. return this._map.length;
  40453. },
  40454. forEach: function (callback) {
  40455. for (var charCode in this._map) {
  40456. callback(charCode, this._map[charCode].charCodeAt(0));
  40457. }
  40458. },
  40459. has: function (i) {
  40460. return this._map[i] !== undefined;
  40461. },
  40462. get: function (i) {
  40463. return this._map[i];
  40464. },
  40465. charCodeOf: function (v) {
  40466. return this._map.indexOf(v);
  40467. },
  40468. amend: function (map) {
  40469. for (var charCode in map) {
  40470. this._map[charCode] = map[charCode];
  40471. }
  40472. }
  40473. };
  40474. return ToUnicodeMap;
  40475. }();
  40476. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  40477. function IdentityToUnicodeMap(firstChar, lastChar) {
  40478. this.firstChar = firstChar;
  40479. this.lastChar = lastChar;
  40480. }
  40481. IdentityToUnicodeMap.prototype = {
  40482. get length() {
  40483. return this.lastChar + 1 - this.firstChar;
  40484. },
  40485. forEach: function (callback) {
  40486. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40487. callback(i, i);
  40488. }
  40489. },
  40490. has: function (i) {
  40491. return this.firstChar <= i && i <= this.lastChar;
  40492. },
  40493. get: function (i) {
  40494. if (this.firstChar <= i && i <= this.lastChar) {
  40495. return String.fromCharCode(i);
  40496. }
  40497. return undefined;
  40498. },
  40499. charCodeOf: function (v) {
  40500. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40501. },
  40502. amend: function (map) {
  40503. error('Should not call amend()');
  40504. }
  40505. };
  40506. return IdentityToUnicodeMap;
  40507. }();
  40508. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  40509. function writeInt16(dest, offset, num) {
  40510. dest[offset] = num >> 8 & 0xFF;
  40511. dest[offset + 1] = num & 0xFF;
  40512. }
  40513. function writeInt32(dest, offset, num) {
  40514. dest[offset] = num >> 24 & 0xFF;
  40515. dest[offset + 1] = num >> 16 & 0xFF;
  40516. dest[offset + 2] = num >> 8 & 0xFF;
  40517. dest[offset + 3] = num & 0xFF;
  40518. }
  40519. function writeData(dest, offset, data) {
  40520. var i, ii;
  40521. if (data instanceof Uint8Array) {
  40522. dest.set(data, offset);
  40523. } else if (typeof data === 'string') {
  40524. for (i = 0, ii = data.length; i < ii; i++) {
  40525. dest[offset++] = data.charCodeAt(i) & 0xFF;
  40526. }
  40527. } else {
  40528. for (i = 0, ii = data.length; i < ii; i++) {
  40529. dest[offset++] = data[i] & 0xFF;
  40530. }
  40531. }
  40532. }
  40533. function OpenTypeFileBuilder(sfnt) {
  40534. this.sfnt = sfnt;
  40535. this.tables = Object.create(null);
  40536. }
  40537. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  40538. var maxPower2 = 1, log2 = 0;
  40539. while ((maxPower2 ^ entriesCount) > maxPower2) {
  40540. maxPower2 <<= 1;
  40541. log2++;
  40542. }
  40543. var searchRange = maxPower2 * entrySize;
  40544. return {
  40545. range: searchRange,
  40546. entry: log2,
  40547. rangeShift: entrySize * entriesCount - searchRange
  40548. };
  40549. };
  40550. var OTF_HEADER_SIZE = 12;
  40551. var OTF_TABLE_ENTRY_SIZE = 16;
  40552. OpenTypeFileBuilder.prototype = {
  40553. toArray: function OpenTypeFileBuilder_toArray() {
  40554. var sfnt = this.sfnt;
  40555. var tables = this.tables;
  40556. var tablesNames = Object.keys(tables);
  40557. tablesNames.sort();
  40558. var numTables = tablesNames.length;
  40559. var i, j, jj, table, tableName;
  40560. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  40561. var tableOffsets = [offset];
  40562. for (i = 0; i < numTables; i++) {
  40563. table = tables[tablesNames[i]];
  40564. var paddedLength = (table.length + 3 & ~3) >>> 0;
  40565. offset += paddedLength;
  40566. tableOffsets.push(offset);
  40567. }
  40568. var file = new Uint8Array(offset);
  40569. for (i = 0; i < numTables; i++) {
  40570. table = tables[tablesNames[i]];
  40571. writeData(file, tableOffsets[i], table);
  40572. }
  40573. if (sfnt === 'true') {
  40574. sfnt = string32(0x00010000);
  40575. }
  40576. file[0] = sfnt.charCodeAt(0) & 0xFF;
  40577. file[1] = sfnt.charCodeAt(1) & 0xFF;
  40578. file[2] = sfnt.charCodeAt(2) & 0xFF;
  40579. file[3] = sfnt.charCodeAt(3) & 0xFF;
  40580. writeInt16(file, 4, numTables);
  40581. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  40582. writeInt16(file, 6, searchParams.range);
  40583. writeInt16(file, 8, searchParams.entry);
  40584. writeInt16(file, 10, searchParams.rangeShift);
  40585. offset = OTF_HEADER_SIZE;
  40586. for (i = 0; i < numTables; i++) {
  40587. tableName = tablesNames[i];
  40588. file[offset] = tableName.charCodeAt(0) & 0xFF;
  40589. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  40590. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  40591. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  40592. var checksum = 0;
  40593. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  40594. var quad = readUint32(file, j);
  40595. checksum = checksum + quad >>> 0;
  40596. }
  40597. writeInt32(file, offset + 4, checksum);
  40598. writeInt32(file, offset + 8, tableOffsets[i]);
  40599. writeInt32(file, offset + 12, tables[tableName].length);
  40600. offset += OTF_TABLE_ENTRY_SIZE;
  40601. }
  40602. return file;
  40603. },
  40604. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  40605. if (tag in this.tables) {
  40606. throw new Error('Table ' + tag + ' already exists');
  40607. }
  40608. this.tables[tag] = data;
  40609. }
  40610. };
  40611. return OpenTypeFileBuilder;
  40612. }();
  40613. var ProblematicCharRanges = new Int32Array([
  40614. 0x0000,
  40615. 0x0020,
  40616. 0x007F,
  40617. 0x00A1,
  40618. 0x00AD,
  40619. 0x00AE,
  40620. 0x0600,
  40621. 0x0780,
  40622. 0x08A0,
  40623. 0x10A0,
  40624. 0x1780,
  40625. 0x1800,
  40626. 0x1C00,
  40627. 0x1C50,
  40628. 0x2000,
  40629. 0x2010,
  40630. 0x2011,
  40631. 0x2012,
  40632. 0x2028,
  40633. 0x2030,
  40634. 0x205F,
  40635. 0x2070,
  40636. 0x25CC,
  40637. 0x25CD,
  40638. 0x3000,
  40639. 0x3001,
  40640. 0xAA60,
  40641. 0xAA80,
  40642. 0xFFF0,
  40643. 0x10000
  40644. ]);
  40645. var Font = function FontClosure() {
  40646. function Font(name, file, properties) {
  40647. var charCode, glyphName, unicode;
  40648. this.name = name;
  40649. this.loadedName = properties.loadedName;
  40650. this.isType3Font = properties.isType3Font;
  40651. this.sizes = [];
  40652. this.missingFile = false;
  40653. this.glyphCache = Object.create(null);
  40654. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  40655. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  40656. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  40657. var type = properties.type;
  40658. var subtype = properties.subtype;
  40659. this.type = type;
  40660. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  40661. this.differences = properties.differences;
  40662. this.widths = properties.widths;
  40663. this.defaultWidth = properties.defaultWidth;
  40664. this.composite = properties.composite;
  40665. this.wideChars = properties.wideChars;
  40666. this.cMap = properties.cMap;
  40667. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  40668. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  40669. this.fontMatrix = properties.fontMatrix;
  40670. this.bbox = properties.bbox;
  40671. this.toUnicode = properties.toUnicode;
  40672. this.toFontChar = [];
  40673. if (properties.type === 'Type3') {
  40674. for (charCode = 0; charCode < 256; charCode++) {
  40675. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  40676. }
  40677. this.fontType = FontType.TYPE3;
  40678. return;
  40679. }
  40680. this.cidEncoding = properties.cidEncoding;
  40681. this.vertical = properties.vertical;
  40682. if (this.vertical) {
  40683. this.vmetrics = properties.vmetrics;
  40684. this.defaultVMetrics = properties.defaultVMetrics;
  40685. }
  40686. var glyphsUnicodeMap;
  40687. if (!file || file.isEmpty) {
  40688. if (file) {
  40689. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  40690. }
  40691. this.missingFile = true;
  40692. var fontName = name.replace(/[,_]/g, '-');
  40693. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  40694. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  40695. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  40696. this.bold = fontName.search(/bold/gi) !== -1;
  40697. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  40698. this.black = name.search(/Black/g) !== -1;
  40699. this.remeasure = Object.keys(this.widths).length > 0;
  40700. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  40701. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  40702. var map = [];
  40703. for (charCode in GlyphMapForStandardFonts) {
  40704. map[+charCode] = GlyphMapForStandardFonts[charCode];
  40705. }
  40706. if (/Arial-?Black/i.test(name)) {
  40707. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  40708. for (charCode in SupplementalGlyphMapForArialBlack) {
  40709. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  40710. }
  40711. }
  40712. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  40713. if (!isIdentityUnicode) {
  40714. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40715. map[+charCode] = unicodeCharCode;
  40716. });
  40717. }
  40718. this.toFontChar = map;
  40719. this.toUnicode = new ToUnicodeMap(map);
  40720. } else if (/Symbol/i.test(fontName)) {
  40721. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  40722. } else if (/Dingbats/i.test(fontName)) {
  40723. if (/Wingdings/i.test(name)) {
  40724. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  40725. }
  40726. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  40727. } else if (isStandardFont) {
  40728. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  40729. } else {
  40730. glyphsUnicodeMap = getGlyphsUnicode();
  40731. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40732. if (!this.composite) {
  40733. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  40734. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40735. if (unicode !== -1) {
  40736. unicodeCharCode = unicode;
  40737. }
  40738. }
  40739. this.toFontChar[charCode] = unicodeCharCode;
  40740. }.bind(this));
  40741. }
  40742. this.loadedName = fontName.split('-')[0];
  40743. this.loading = false;
  40744. this.fontType = getFontType(type, subtype);
  40745. return;
  40746. }
  40747. if (subtype === 'Type1C') {
  40748. if (type !== 'Type1' && type !== 'MMType1') {
  40749. if (isTrueTypeFile(file)) {
  40750. subtype = 'TrueType';
  40751. } else {
  40752. type = 'Type1';
  40753. }
  40754. } else if (isOpenTypeFile(file)) {
  40755. type = subtype = 'OpenType';
  40756. }
  40757. }
  40758. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  40759. type = 'CIDFontType0';
  40760. }
  40761. if (subtype === 'OpenType') {
  40762. type = 'OpenType';
  40763. }
  40764. if (type === 'CIDFontType0') {
  40765. if (isType1File(file)) {
  40766. subtype = 'CIDFontType0';
  40767. } else if (isOpenTypeFile(file)) {
  40768. type = subtype = 'OpenType';
  40769. } else {
  40770. subtype = 'CIDFontType0C';
  40771. }
  40772. }
  40773. var data;
  40774. switch (type) {
  40775. case 'MMType1':
  40776. info('MMType1 font (' + name + '), falling back to Type1.');
  40777. case 'Type1':
  40778. case 'CIDFontType0':
  40779. this.mimetype = 'font/opentype';
  40780. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  40781. adjustWidths(properties);
  40782. data = this.convert(name, cff, properties);
  40783. break;
  40784. case 'OpenType':
  40785. case 'TrueType':
  40786. case 'CIDFontType2':
  40787. this.mimetype = 'font/opentype';
  40788. data = this.checkAndRepair(name, file, properties);
  40789. if (this.isOpenType) {
  40790. adjustWidths(properties);
  40791. type = 'OpenType';
  40792. }
  40793. break;
  40794. default:
  40795. error('Font ' + type + ' is not supported');
  40796. break;
  40797. }
  40798. this.data = data;
  40799. this.fontType = getFontType(type, subtype);
  40800. this.fontMatrix = properties.fontMatrix;
  40801. this.widths = properties.widths;
  40802. this.defaultWidth = properties.defaultWidth;
  40803. this.toUnicode = properties.toUnicode;
  40804. this.encoding = properties.baseEncoding;
  40805. this.seacMap = properties.seacMap;
  40806. this.loading = true;
  40807. }
  40808. Font.getFontID = function () {
  40809. var ID = 1;
  40810. return function Font_getFontID() {
  40811. return String(ID++);
  40812. };
  40813. }();
  40814. function int16(b0, b1) {
  40815. return (b0 << 8) + b1;
  40816. }
  40817. function signedInt16(b0, b1) {
  40818. var value = (b0 << 8) + b1;
  40819. return value & 1 << 15 ? value - 0x10000 : value;
  40820. }
  40821. function int32(b0, b1, b2, b3) {
  40822. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  40823. }
  40824. function string16(value) {
  40825. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40826. }
  40827. function safeString16(value) {
  40828. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  40829. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40830. }
  40831. function isTrueTypeFile(file) {
  40832. var header = file.peekBytes(4);
  40833. return readUint32(header, 0) === 0x00010000;
  40834. }
  40835. function isOpenTypeFile(file) {
  40836. var header = file.peekBytes(4);
  40837. return bytesToString(header) === 'OTTO';
  40838. }
  40839. function isType1File(file) {
  40840. var header = file.peekBytes(2);
  40841. if (header[0] === 0x25 && header[1] === 0x21) {
  40842. return true;
  40843. }
  40844. if (header[0] === 0x80 && header[1] === 0x01) {
  40845. return true;
  40846. }
  40847. return false;
  40848. }
  40849. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  40850. var toFontChar = [], unicode;
  40851. for (var i = 0, ii = encoding.length; i < ii; i++) {
  40852. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  40853. if (unicode !== -1) {
  40854. toFontChar[i] = unicode;
  40855. }
  40856. }
  40857. for (var charCode in differences) {
  40858. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  40859. if (unicode !== -1) {
  40860. toFontChar[+charCode] = unicode;
  40861. }
  40862. }
  40863. return toFontChar;
  40864. }
  40865. function isProblematicUnicodeLocation(code) {
  40866. var i = 0, j = ProblematicCharRanges.length - 1;
  40867. while (i < j) {
  40868. var c = i + j + 1 >> 1;
  40869. if (code < ProblematicCharRanges[c]) {
  40870. j = c - 1;
  40871. } else {
  40872. i = c;
  40873. }
  40874. }
  40875. return !(i & 1);
  40876. }
  40877. function adjustMapping(charCodeToGlyphId, properties) {
  40878. var toUnicode = properties.toUnicode;
  40879. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40880. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40881. var newMap = Object.create(null);
  40882. var toFontChar = [];
  40883. var usedFontCharCodes = [];
  40884. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40885. for (var originalCharCode in charCodeToGlyphId) {
  40886. originalCharCode |= 0;
  40887. var glyphId = charCodeToGlyphId[originalCharCode];
  40888. var fontCharCode = originalCharCode;
  40889. var hasUnicodeValue = false;
  40890. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40891. hasUnicodeValue = true;
  40892. var unicode = toUnicode.get(fontCharCode);
  40893. if (unicode.length === 1) {
  40894. fontCharCode = unicode.charCodeAt(0);
  40895. }
  40896. }
  40897. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40898. do {
  40899. fontCharCode = nextAvailableFontCharCode++;
  40900. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40901. fontCharCode = 0xF020;
  40902. nextAvailableFontCharCode = fontCharCode + 1;
  40903. }
  40904. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40905. }
  40906. newMap[fontCharCode] = glyphId;
  40907. toFontChar[originalCharCode] = fontCharCode;
  40908. usedFontCharCodes[fontCharCode] = true;
  40909. }
  40910. return {
  40911. toFontChar: toFontChar,
  40912. charCodeToGlyphId: newMap,
  40913. nextAvailableFontCharCode: nextAvailableFontCharCode
  40914. };
  40915. }
  40916. function getRanges(glyphs, numGlyphs) {
  40917. var codes = [];
  40918. for (var charCode in glyphs) {
  40919. if (glyphs[charCode] >= numGlyphs) {
  40920. continue;
  40921. }
  40922. codes.push({
  40923. fontCharCode: charCode | 0,
  40924. glyphId: glyphs[charCode]
  40925. });
  40926. }
  40927. codes.sort(function fontGetRangesSort(a, b) {
  40928. return a.fontCharCode - b.fontCharCode;
  40929. });
  40930. var ranges = [];
  40931. var length = codes.length;
  40932. for (var n = 0; n < length;) {
  40933. var start = codes[n].fontCharCode;
  40934. var codeIndices = [codes[n].glyphId];
  40935. ++n;
  40936. var end = start;
  40937. while (n < length && end + 1 === codes[n].fontCharCode) {
  40938. codeIndices.push(codes[n].glyphId);
  40939. ++end;
  40940. ++n;
  40941. if (end === 0xFFFF) {
  40942. break;
  40943. }
  40944. }
  40945. ranges.push([
  40946. start,
  40947. end,
  40948. codeIndices
  40949. ]);
  40950. }
  40951. return ranges;
  40952. }
  40953. function createCmapTable(glyphs, numGlyphs) {
  40954. var ranges = getRanges(glyphs, numGlyphs);
  40955. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40956. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40957. var i, ii, j, jj;
  40958. for (i = ranges.length - 1; i >= 0; --i) {
  40959. if (ranges[i][0] <= 0xFFFF) {
  40960. break;
  40961. }
  40962. }
  40963. var bmpLength = i + 1;
  40964. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40965. ranges[i][1] = 0xFFFE;
  40966. }
  40967. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40968. var segCount = bmpLength + trailingRangesCount;
  40969. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40970. var startCount = '';
  40971. var endCount = '';
  40972. var idDeltas = '';
  40973. var idRangeOffsets = '';
  40974. var glyphsIds = '';
  40975. var bias = 0;
  40976. var range, start, end, codes;
  40977. for (i = 0, ii = bmpLength; i < ii; i++) {
  40978. range = ranges[i];
  40979. start = range[0];
  40980. end = range[1];
  40981. startCount += string16(start);
  40982. endCount += string16(end);
  40983. codes = range[2];
  40984. var contiguous = true;
  40985. for (j = 1, jj = codes.length; j < jj; ++j) {
  40986. if (codes[j] !== codes[j - 1] + 1) {
  40987. contiguous = false;
  40988. break;
  40989. }
  40990. }
  40991. if (!contiguous) {
  40992. var offset = (segCount - i) * 2 + bias * 2;
  40993. bias += end - start + 1;
  40994. idDeltas += string16(0);
  40995. idRangeOffsets += string16(offset);
  40996. for (j = 0, jj = codes.length; j < jj; ++j) {
  40997. glyphsIds += string16(codes[j]);
  40998. }
  40999. } else {
  41000. var startCode = codes[0];
  41001. idDeltas += string16(startCode - start & 0xFFFF);
  41002. idRangeOffsets += string16(0);
  41003. }
  41004. }
  41005. if (trailingRangesCount > 0) {
  41006. endCount += '\xFF\xFF';
  41007. startCount += '\xFF\xFF';
  41008. idDeltas += '\x00\x01';
  41009. idRangeOffsets += '\x00\x00';
  41010. }
  41011. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  41012. var format31012 = '';
  41013. var header31012 = '';
  41014. if (numTables > 1) {
  41015. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  41016. format31012 = '';
  41017. for (i = 0, ii = ranges.length; i < ii; i++) {
  41018. range = ranges[i];
  41019. start = range[0];
  41020. codes = range[2];
  41021. var code = codes[0];
  41022. for (j = 1, jj = codes.length; j < jj; ++j) {
  41023. if (codes[j] !== codes[j - 1] + 1) {
  41024. end = range[0] + j - 1;
  41025. format31012 += string32(start) + string32(end) + string32(code);
  41026. start = end + 1;
  41027. code = codes[j];
  41028. }
  41029. }
  41030. format31012 += string32(start) + string32(range[1]) + string32(code);
  41031. }
  41032. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  41033. }
  41034. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  41035. }
  41036. function validateOS2Table(os2) {
  41037. var stream = new Stream(os2.data);
  41038. var version = stream.getUint16();
  41039. stream.getBytes(60);
  41040. var selection = stream.getUint16();
  41041. if (version < 4 && selection & 0x0300) {
  41042. return false;
  41043. }
  41044. var firstChar = stream.getUint16();
  41045. var lastChar = stream.getUint16();
  41046. if (firstChar > lastChar) {
  41047. return false;
  41048. }
  41049. stream.getBytes(6);
  41050. var usWinAscent = stream.getUint16();
  41051. if (usWinAscent === 0) {
  41052. return false;
  41053. }
  41054. os2.data[8] = os2.data[9] = 0;
  41055. return true;
  41056. }
  41057. function createOS2Table(properties, charstrings, override) {
  41058. override = override || {
  41059. unitsPerEm: 0,
  41060. yMax: 0,
  41061. yMin: 0,
  41062. ascent: 0,
  41063. descent: 0
  41064. };
  41065. var ulUnicodeRange1 = 0;
  41066. var ulUnicodeRange2 = 0;
  41067. var ulUnicodeRange3 = 0;
  41068. var ulUnicodeRange4 = 0;
  41069. var firstCharIndex = null;
  41070. var lastCharIndex = 0;
  41071. if (charstrings) {
  41072. for (var code in charstrings) {
  41073. code |= 0;
  41074. if (firstCharIndex > code || !firstCharIndex) {
  41075. firstCharIndex = code;
  41076. }
  41077. if (lastCharIndex < code) {
  41078. lastCharIndex = code;
  41079. }
  41080. var position = getUnicodeRangeFor(code);
  41081. if (position < 32) {
  41082. ulUnicodeRange1 |= 1 << position;
  41083. } else if (position < 64) {
  41084. ulUnicodeRange2 |= 1 << position - 32;
  41085. } else if (position < 96) {
  41086. ulUnicodeRange3 |= 1 << position - 64;
  41087. } else if (position < 123) {
  41088. ulUnicodeRange4 |= 1 << position - 96;
  41089. } else {
  41090. error('Unicode ranges Bits > 123 are reserved for internal usage');
  41091. }
  41092. }
  41093. } else {
  41094. firstCharIndex = 0;
  41095. lastCharIndex = 255;
  41096. }
  41097. var bbox = properties.bbox || [
  41098. 0,
  41099. 0,
  41100. 0,
  41101. 0
  41102. ];
  41103. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41104. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  41105. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  41106. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  41107. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  41108. typoDescent = -typoDescent;
  41109. }
  41110. var winAscent = override.yMax || typoAscent;
  41111. var winDescent = -override.yMin || -typoDescent;
  41112. 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';
  41113. }
  41114. function createPostTable(properties) {
  41115. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  41116. 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';
  41117. }
  41118. function createNameTable(name, proto) {
  41119. if (!proto) {
  41120. proto = [
  41121. [],
  41122. []
  41123. ];
  41124. }
  41125. var strings = [
  41126. proto[0][0] || 'Original licence',
  41127. proto[0][1] || name,
  41128. proto[0][2] || 'Unknown',
  41129. proto[0][3] || 'uniqueID',
  41130. proto[0][4] || name,
  41131. proto[0][5] || 'Version 0.11',
  41132. proto[0][6] || '',
  41133. proto[0][7] || 'Unknown',
  41134. proto[0][8] || 'Unknown',
  41135. proto[0][9] || 'Unknown'
  41136. ];
  41137. var stringsUnicode = [];
  41138. var i, ii, j, jj, str;
  41139. for (i = 0, ii = strings.length; i < ii; i++) {
  41140. str = proto[1][i] || strings[i];
  41141. var strBufUnicode = [];
  41142. for (j = 0, jj = str.length; j < jj; j++) {
  41143. strBufUnicode.push(string16(str.charCodeAt(j)));
  41144. }
  41145. stringsUnicode.push(strBufUnicode.join(''));
  41146. }
  41147. var names = [
  41148. strings,
  41149. stringsUnicode
  41150. ];
  41151. var platforms = [
  41152. '\x00\x01',
  41153. '\x00\x03'
  41154. ];
  41155. var encodings = [
  41156. '\x00\x00',
  41157. '\x00\x01'
  41158. ];
  41159. var languages = [
  41160. '\x00\x00',
  41161. '\x04\x09'
  41162. ];
  41163. var namesRecordCount = strings.length * platforms.length;
  41164. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  41165. var strOffset = 0;
  41166. for (i = 0, ii = platforms.length; i < ii; i++) {
  41167. var strs = names[i];
  41168. for (j = 0, jj = strs.length; j < jj; j++) {
  41169. str = strs[j];
  41170. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  41171. nameTable += nameRecord;
  41172. strOffset += str.length;
  41173. }
  41174. }
  41175. nameTable += strings.join('') + stringsUnicode.join('');
  41176. return nameTable;
  41177. }
  41178. Font.prototype = {
  41179. name: null,
  41180. font: null,
  41181. mimetype: null,
  41182. encoding: null,
  41183. get renderer() {
  41184. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  41185. return shadow(this, 'renderer', renderer);
  41186. },
  41187. exportData: function Font_exportData() {
  41188. var data = {};
  41189. for (var i in this) {
  41190. if (this.hasOwnProperty(i)) {
  41191. data[i] = this[i];
  41192. }
  41193. }
  41194. return data;
  41195. },
  41196. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  41197. function readTableEntry(file) {
  41198. var tag = bytesToString(file.getBytes(4));
  41199. var checksum = file.getInt32() >>> 0;
  41200. var offset = file.getInt32() >>> 0;
  41201. var length = file.getInt32() >>> 0;
  41202. var previousPosition = file.pos;
  41203. file.pos = file.start ? file.start : 0;
  41204. file.skip(offset);
  41205. var data = file.getBytes(length);
  41206. file.pos = previousPosition;
  41207. if (tag === 'head') {
  41208. data[8] = data[9] = data[10] = data[11] = 0;
  41209. data[17] |= 0x20;
  41210. }
  41211. return {
  41212. tag: tag,
  41213. checksum: checksum,
  41214. length: length,
  41215. offset: offset,
  41216. data: data
  41217. };
  41218. }
  41219. function readOpenTypeHeader(ttf) {
  41220. return {
  41221. version: bytesToString(ttf.getBytes(4)),
  41222. numTables: ttf.getUint16(),
  41223. searchRange: ttf.getUint16(),
  41224. entrySelector: ttf.getUint16(),
  41225. rangeShift: ttf.getUint16()
  41226. };
  41227. }
  41228. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  41229. if (!cmap) {
  41230. warn('No cmap table available.');
  41231. return {
  41232. platformId: -1,
  41233. encodingId: -1,
  41234. mappings: [],
  41235. hasShortCmap: false
  41236. };
  41237. }
  41238. var segment;
  41239. var start = (font.start ? font.start : 0) + cmap.offset;
  41240. font.pos = start;
  41241. font.getUint16();
  41242. var numTables = font.getUint16();
  41243. var potentialTable;
  41244. var canBreak = false;
  41245. for (var i = 0; i < numTables; i++) {
  41246. var platformId = font.getUint16();
  41247. var encodingId = font.getUint16();
  41248. var offset = font.getInt32() >>> 0;
  41249. var useTable = false;
  41250. if (platformId === 0 && encodingId === 0) {
  41251. useTable = true;
  41252. } else if (platformId === 1 && encodingId === 0) {
  41253. useTable = true;
  41254. } else if (platformId === 3 && encodingId === 1 && (!isSymbolicFont && hasEncoding || !potentialTable)) {
  41255. useTable = true;
  41256. if (!isSymbolicFont) {
  41257. canBreak = true;
  41258. }
  41259. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  41260. useTable = true;
  41261. canBreak = true;
  41262. }
  41263. if (useTable) {
  41264. potentialTable = {
  41265. platformId: platformId,
  41266. encodingId: encodingId,
  41267. offset: offset
  41268. };
  41269. }
  41270. if (canBreak) {
  41271. break;
  41272. }
  41273. }
  41274. if (potentialTable) {
  41275. font.pos = start + potentialTable.offset;
  41276. }
  41277. if (!potentialTable || font.peekByte() === -1) {
  41278. warn('Could not find a preferred cmap table.');
  41279. return {
  41280. platformId: -1,
  41281. encodingId: -1,
  41282. mappings: [],
  41283. hasShortCmap: false
  41284. };
  41285. }
  41286. var format = font.getUint16();
  41287. font.getUint16();
  41288. font.getUint16();
  41289. var hasShortCmap = false;
  41290. var mappings = [];
  41291. var j, glyphId;
  41292. if (format === 0) {
  41293. for (j = 0; j < 256; j++) {
  41294. var index = font.getByte();
  41295. if (!index) {
  41296. continue;
  41297. }
  41298. mappings.push({
  41299. charCode: j,
  41300. glyphId: index
  41301. });
  41302. }
  41303. hasShortCmap = true;
  41304. } else if (format === 4) {
  41305. var segCount = font.getUint16() >> 1;
  41306. font.getBytes(6);
  41307. var segIndex, segments = [];
  41308. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41309. segments.push({ end: font.getUint16() });
  41310. }
  41311. font.getUint16();
  41312. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41313. segments[segIndex].start = font.getUint16();
  41314. }
  41315. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41316. segments[segIndex].delta = font.getUint16();
  41317. }
  41318. var offsetsCount = 0;
  41319. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41320. segment = segments[segIndex];
  41321. var rangeOffset = font.getUint16();
  41322. if (!rangeOffset) {
  41323. segment.offsetIndex = -1;
  41324. continue;
  41325. }
  41326. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  41327. segment.offsetIndex = offsetIndex;
  41328. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  41329. }
  41330. var offsets = [];
  41331. for (j = 0; j < offsetsCount; j++) {
  41332. offsets.push(font.getUint16());
  41333. }
  41334. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41335. segment = segments[segIndex];
  41336. start = segment.start;
  41337. var end = segment.end;
  41338. var delta = segment.delta;
  41339. offsetIndex = segment.offsetIndex;
  41340. for (j = start; j <= end; j++) {
  41341. if (j === 0xFFFF) {
  41342. continue;
  41343. }
  41344. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  41345. glyphId = glyphId + delta & 0xFFFF;
  41346. if (glyphId === 0) {
  41347. continue;
  41348. }
  41349. mappings.push({
  41350. charCode: j,
  41351. glyphId: glyphId
  41352. });
  41353. }
  41354. }
  41355. } else if (format === 6) {
  41356. var firstCode = font.getUint16();
  41357. var entryCount = font.getUint16();
  41358. for (j = 0; j < entryCount; j++) {
  41359. glyphId = font.getUint16();
  41360. var charCode = firstCode + j;
  41361. mappings.push({
  41362. charCode: charCode,
  41363. glyphId: glyphId
  41364. });
  41365. }
  41366. } else {
  41367. warn('cmap table has unsupported format: ' + format);
  41368. return {
  41369. platformId: -1,
  41370. encodingId: -1,
  41371. mappings: [],
  41372. hasShortCmap: false
  41373. };
  41374. }
  41375. mappings.sort(function (a, b) {
  41376. return a.charCode - b.charCode;
  41377. });
  41378. for (i = 1; i < mappings.length; i++) {
  41379. if (mappings[i - 1].charCode === mappings[i].charCode) {
  41380. mappings.splice(i, 1);
  41381. i--;
  41382. }
  41383. }
  41384. return {
  41385. platformId: potentialTable.platformId,
  41386. encodingId: potentialTable.encodingId,
  41387. mappings: mappings,
  41388. hasShortCmap: hasShortCmap
  41389. };
  41390. }
  41391. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  41392. if (!header) {
  41393. if (metrics) {
  41394. metrics.data = null;
  41395. }
  41396. return;
  41397. }
  41398. font.pos = (font.start ? font.start : 0) + header.offset;
  41399. font.pos += header.length - 2;
  41400. var numOfMetrics = font.getUint16();
  41401. if (numOfMetrics > numGlyphs) {
  41402. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  41403. numOfMetrics = numGlyphs;
  41404. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  41405. header.data[35] = numOfMetrics & 0x00ff;
  41406. }
  41407. var numOfSidebearings = numGlyphs - numOfMetrics;
  41408. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  41409. if (numMissing > 0) {
  41410. var entries = new Uint8Array(metrics.length + numMissing * 2);
  41411. entries.set(metrics.data);
  41412. metrics.data = entries;
  41413. }
  41414. }
  41415. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  41416. if (sourceEnd - sourceStart <= 12) {
  41417. return 0;
  41418. }
  41419. var glyf = source.subarray(sourceStart, sourceEnd);
  41420. var contoursCount = glyf[0] << 8 | glyf[1];
  41421. if (contoursCount & 0x8000) {
  41422. dest.set(glyf, destStart);
  41423. return glyf.length;
  41424. }
  41425. var i, j = 10, flagsCount = 0;
  41426. for (i = 0; i < contoursCount; i++) {
  41427. var endPoint = glyf[j] << 8 | glyf[j + 1];
  41428. flagsCount = endPoint + 1;
  41429. j += 2;
  41430. }
  41431. var instructionsStart = j;
  41432. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  41433. j += 2 + instructionsLength;
  41434. var instructionsEnd = j;
  41435. var coordinatesLength = 0;
  41436. for (i = 0; i < flagsCount; i++) {
  41437. var flag = glyf[j++];
  41438. if (flag & 0xC0) {
  41439. glyf[j - 1] = flag & 0x3F;
  41440. }
  41441. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  41442. coordinatesLength += xyLength;
  41443. if (flag & 8) {
  41444. var repeat = glyf[j++];
  41445. i += repeat;
  41446. coordinatesLength += repeat * xyLength;
  41447. }
  41448. }
  41449. if (coordinatesLength === 0) {
  41450. return 0;
  41451. }
  41452. var glyphDataLength = j + coordinatesLength;
  41453. if (glyphDataLength > glyf.length) {
  41454. return 0;
  41455. }
  41456. if (!hintsValid && instructionsLength > 0) {
  41457. dest.set(glyf.subarray(0, instructionsStart), destStart);
  41458. dest.set([
  41459. 0,
  41460. 0
  41461. ], destStart + instructionsStart);
  41462. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  41463. glyphDataLength -= instructionsLength;
  41464. if (glyf.length - glyphDataLength > 3) {
  41465. glyphDataLength = glyphDataLength + 3 & ~3;
  41466. }
  41467. return glyphDataLength;
  41468. }
  41469. if (glyf.length - glyphDataLength > 3) {
  41470. glyphDataLength = glyphDataLength + 3 & ~3;
  41471. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  41472. return glyphDataLength;
  41473. }
  41474. dest.set(glyf, destStart);
  41475. return glyf.length;
  41476. }
  41477. function sanitizeHead(head, numGlyphs, locaLength) {
  41478. var data = head.data;
  41479. var version = int32(data[0], data[1], data[2], data[3]);
  41480. if (version >> 16 !== 1) {
  41481. info('Attempting to fix invalid version in head table: ' + version);
  41482. data[0] = 0;
  41483. data[1] = 1;
  41484. data[2] = 0;
  41485. data[3] = 0;
  41486. }
  41487. var indexToLocFormat = int16(data[50], data[51]);
  41488. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  41489. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  41490. var numGlyphsPlusOne = numGlyphs + 1;
  41491. if (locaLength === numGlyphsPlusOne << 1) {
  41492. data[50] = 0;
  41493. data[51] = 0;
  41494. } else if (locaLength === numGlyphsPlusOne << 2) {
  41495. data[50] = 0;
  41496. data[51] = 1;
  41497. } else {
  41498. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  41499. }
  41500. }
  41501. }
  41502. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  41503. var itemSize, itemDecode, itemEncode;
  41504. if (isGlyphLocationsLong) {
  41505. itemSize = 4;
  41506. itemDecode = function fontItemDecodeLong(data, offset) {
  41507. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  41508. };
  41509. itemEncode = function fontItemEncodeLong(data, offset, value) {
  41510. data[offset] = value >>> 24 & 0xFF;
  41511. data[offset + 1] = value >> 16 & 0xFF;
  41512. data[offset + 2] = value >> 8 & 0xFF;
  41513. data[offset + 3] = value & 0xFF;
  41514. };
  41515. } else {
  41516. itemSize = 2;
  41517. itemDecode = function fontItemDecode(data, offset) {
  41518. return data[offset] << 9 | data[offset + 1] << 1;
  41519. };
  41520. itemEncode = function fontItemEncode(data, offset, value) {
  41521. data[offset] = value >> 9 & 0xFF;
  41522. data[offset + 1] = value >> 1 & 0xFF;
  41523. };
  41524. }
  41525. var locaData = loca.data;
  41526. var locaDataSize = itemSize * (1 + numGlyphs);
  41527. if (locaData.length !== locaDataSize) {
  41528. locaData = new Uint8Array(locaDataSize);
  41529. locaData.set(loca.data.subarray(0, locaDataSize));
  41530. loca.data = locaData;
  41531. }
  41532. var oldGlyfData = glyf.data;
  41533. var oldGlyfDataLength = oldGlyfData.length;
  41534. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  41535. var startOffset = itemDecode(locaData, 0);
  41536. var writeOffset = 0;
  41537. var missingGlyphData = Object.create(null);
  41538. itemEncode(locaData, 0, writeOffset);
  41539. var i, j;
  41540. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41541. var endOffset = itemDecode(locaData, j);
  41542. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  41543. endOffset = oldGlyfDataLength;
  41544. }
  41545. if (endOffset > oldGlyfDataLength) {
  41546. itemEncode(locaData, j, writeOffset);
  41547. startOffset = endOffset;
  41548. continue;
  41549. }
  41550. if (startOffset === endOffset) {
  41551. missingGlyphData[i] = true;
  41552. }
  41553. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  41554. writeOffset += newLength;
  41555. itemEncode(locaData, j, writeOffset);
  41556. startOffset = endOffset;
  41557. }
  41558. if (writeOffset === 0) {
  41559. var simpleGlyph = new Uint8Array([
  41560. 0,
  41561. 1,
  41562. 0,
  41563. 0,
  41564. 0,
  41565. 0,
  41566. 0,
  41567. 0,
  41568. 0,
  41569. 0,
  41570. 0,
  41571. 0,
  41572. 0,
  41573. 0,
  41574. 49,
  41575. 0
  41576. ]);
  41577. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41578. itemEncode(locaData, j, simpleGlyph.length);
  41579. }
  41580. glyf.data = simpleGlyph;
  41581. return missingGlyphData;
  41582. }
  41583. if (dupFirstEntry) {
  41584. var firstEntryLength = itemDecode(locaData, itemSize);
  41585. if (newGlyfData.length > firstEntryLength + writeOffset) {
  41586. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  41587. } else {
  41588. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  41589. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  41590. }
  41591. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  41592. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  41593. } else {
  41594. glyf.data = newGlyfData.subarray(0, writeOffset);
  41595. }
  41596. return missingGlyphData;
  41597. }
  41598. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  41599. var start = (font.start ? font.start : 0) + post.offset;
  41600. font.pos = start;
  41601. var length = post.length, end = start + length;
  41602. var version = font.getInt32();
  41603. font.getBytes(28);
  41604. var glyphNames;
  41605. var valid = true;
  41606. var i;
  41607. switch (version) {
  41608. case 0x00010000:
  41609. glyphNames = MacStandardGlyphOrdering;
  41610. break;
  41611. case 0x00020000:
  41612. var numGlyphs = font.getUint16();
  41613. if (numGlyphs !== maxpNumGlyphs) {
  41614. valid = false;
  41615. break;
  41616. }
  41617. var glyphNameIndexes = [];
  41618. for (i = 0; i < numGlyphs; ++i) {
  41619. var index = font.getUint16();
  41620. if (index >= 32768) {
  41621. valid = false;
  41622. break;
  41623. }
  41624. glyphNameIndexes.push(index);
  41625. }
  41626. if (!valid) {
  41627. break;
  41628. }
  41629. var customNames = [];
  41630. var strBuf = [];
  41631. while (font.pos < end) {
  41632. var stringLength = font.getByte();
  41633. strBuf.length = stringLength;
  41634. for (i = 0; i < stringLength; ++i) {
  41635. strBuf[i] = String.fromCharCode(font.getByte());
  41636. }
  41637. customNames.push(strBuf.join(''));
  41638. }
  41639. glyphNames = [];
  41640. for (i = 0; i < numGlyphs; ++i) {
  41641. var j = glyphNameIndexes[i];
  41642. if (j < 258) {
  41643. glyphNames.push(MacStandardGlyphOrdering[j]);
  41644. continue;
  41645. }
  41646. glyphNames.push(customNames[j - 258]);
  41647. }
  41648. break;
  41649. case 0x00030000:
  41650. break;
  41651. default:
  41652. warn('Unknown/unsupported post table version ' + version);
  41653. valid = false;
  41654. if (properties.defaultEncoding) {
  41655. glyphNames = properties.defaultEncoding;
  41656. }
  41657. break;
  41658. }
  41659. properties.glyphNames = glyphNames;
  41660. return valid;
  41661. }
  41662. function readNameTable(nameTable) {
  41663. var start = (font.start ? font.start : 0) + nameTable.offset;
  41664. font.pos = start;
  41665. var names = [
  41666. [],
  41667. []
  41668. ];
  41669. var length = nameTable.length, end = start + length;
  41670. var format = font.getUint16();
  41671. var FORMAT_0_HEADER_LENGTH = 6;
  41672. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  41673. return names;
  41674. }
  41675. var numRecords = font.getUint16();
  41676. var stringsStart = font.getUint16();
  41677. var records = [];
  41678. var NAME_RECORD_LENGTH = 12;
  41679. var i, ii;
  41680. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  41681. var r = {
  41682. platform: font.getUint16(),
  41683. encoding: font.getUint16(),
  41684. language: font.getUint16(),
  41685. name: font.getUint16(),
  41686. length: font.getUint16(),
  41687. offset: font.getUint16()
  41688. };
  41689. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  41690. records.push(r);
  41691. }
  41692. }
  41693. for (i = 0, ii = records.length; i < ii; i++) {
  41694. var record = records[i];
  41695. if (record.length <= 0) {
  41696. continue;
  41697. }
  41698. var pos = start + stringsStart + record.offset;
  41699. if (pos + record.length > end) {
  41700. continue;
  41701. }
  41702. font.pos = pos;
  41703. var nameIndex = record.name;
  41704. if (record.encoding) {
  41705. var str = '';
  41706. for (var j = 0, jj = record.length; j < jj; j += 2) {
  41707. str += String.fromCharCode(font.getUint16());
  41708. }
  41709. names[1][nameIndex] = str;
  41710. } else {
  41711. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  41712. }
  41713. }
  41714. return names;
  41715. }
  41716. var TTOpsStackDeltas = [
  41717. 0,
  41718. 0,
  41719. 0,
  41720. 0,
  41721. 0,
  41722. 0,
  41723. 0,
  41724. 0,
  41725. -2,
  41726. -2,
  41727. -2,
  41728. -2,
  41729. 0,
  41730. 0,
  41731. -2,
  41732. -5,
  41733. -1,
  41734. -1,
  41735. -1,
  41736. -1,
  41737. -1,
  41738. -1,
  41739. -1,
  41740. -1,
  41741. 0,
  41742. 0,
  41743. -1,
  41744. 0,
  41745. -1,
  41746. -1,
  41747. -1,
  41748. -1,
  41749. 1,
  41750. -1,
  41751. -999,
  41752. 0,
  41753. 1,
  41754. 0,
  41755. -1,
  41756. -2,
  41757. 0,
  41758. -1,
  41759. -2,
  41760. -1,
  41761. -1,
  41762. 0,
  41763. -1,
  41764. -1,
  41765. 0,
  41766. 0,
  41767. -999,
  41768. -999,
  41769. -1,
  41770. -1,
  41771. -1,
  41772. -1,
  41773. -2,
  41774. -999,
  41775. -2,
  41776. -2,
  41777. -999,
  41778. 0,
  41779. -2,
  41780. -2,
  41781. 0,
  41782. 0,
  41783. -2,
  41784. 0,
  41785. -2,
  41786. 0,
  41787. 0,
  41788. 0,
  41789. -2,
  41790. -1,
  41791. -1,
  41792. 1,
  41793. 1,
  41794. 0,
  41795. 0,
  41796. -1,
  41797. -1,
  41798. -1,
  41799. -1,
  41800. -1,
  41801. -1,
  41802. -1,
  41803. 0,
  41804. 0,
  41805. -1,
  41806. 0,
  41807. -1,
  41808. -1,
  41809. 0,
  41810. -999,
  41811. -1,
  41812. -1,
  41813. -1,
  41814. -1,
  41815. -1,
  41816. -1,
  41817. 0,
  41818. 0,
  41819. 0,
  41820. 0,
  41821. 0,
  41822. 0,
  41823. 0,
  41824. 0,
  41825. 0,
  41826. 0,
  41827. 0,
  41828. 0,
  41829. -2,
  41830. -999,
  41831. -999,
  41832. -999,
  41833. -999,
  41834. -999,
  41835. -1,
  41836. -1,
  41837. -2,
  41838. -2,
  41839. 0,
  41840. 0,
  41841. 0,
  41842. 0,
  41843. -1,
  41844. -1,
  41845. -999,
  41846. -2,
  41847. -2,
  41848. 0,
  41849. 0,
  41850. -1,
  41851. -2,
  41852. -2,
  41853. 0,
  41854. 0,
  41855. 0,
  41856. -1,
  41857. -1,
  41858. -1,
  41859. -2
  41860. ];
  41861. function sanitizeTTProgram(table, ttContext) {
  41862. var data = table.data;
  41863. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41864. var stack = [];
  41865. var callstack = [];
  41866. var functionsCalled = [];
  41867. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41868. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41869. for (var ii = data.length; i < ii;) {
  41870. var op = data[i++];
  41871. if (op === 0x40) {
  41872. n = data[i++];
  41873. if (inFDEF || inELSE) {
  41874. i += n;
  41875. } else {
  41876. for (j = 0; j < n; j++) {
  41877. stack.push(data[i++]);
  41878. }
  41879. }
  41880. } else if (op === 0x41) {
  41881. n = data[i++];
  41882. if (inFDEF || inELSE) {
  41883. i += n * 2;
  41884. } else {
  41885. for (j = 0; j < n; j++) {
  41886. b = data[i++];
  41887. stack.push(b << 8 | data[i++]);
  41888. }
  41889. }
  41890. } else if ((op & 0xF8) === 0xB0) {
  41891. n = op - 0xB0 + 1;
  41892. if (inFDEF || inELSE) {
  41893. i += n;
  41894. } else {
  41895. for (j = 0; j < n; j++) {
  41896. stack.push(data[i++]);
  41897. }
  41898. }
  41899. } else if ((op & 0xF8) === 0xB8) {
  41900. n = op - 0xB8 + 1;
  41901. if (inFDEF || inELSE) {
  41902. i += n * 2;
  41903. } else {
  41904. for (j = 0; j < n; j++) {
  41905. b = data[i++];
  41906. stack.push(b << 8 | data[i++]);
  41907. }
  41908. }
  41909. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41910. if (!inFDEF && !inELSE) {
  41911. funcId = stack[stack.length - 1];
  41912. ttContext.functionsUsed[funcId] = true;
  41913. if (funcId in ttContext.functionsStackDeltas) {
  41914. stack.length += ttContext.functionsStackDeltas[funcId];
  41915. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41916. callstack.push({
  41917. data: data,
  41918. i: i,
  41919. stackTop: stack.length - 1
  41920. });
  41921. functionsCalled.push(funcId);
  41922. pc = ttContext.functionsDefined[funcId];
  41923. if (!pc) {
  41924. warn('TT: CALL non-existent function');
  41925. ttContext.hintsValid = false;
  41926. return;
  41927. }
  41928. data = pc.data;
  41929. i = pc.i;
  41930. }
  41931. }
  41932. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41933. if (inFDEF || inELSE) {
  41934. warn('TT: nested FDEFs not allowed');
  41935. tooComplexToFollowFunctions = true;
  41936. }
  41937. inFDEF = true;
  41938. lastDeff = i;
  41939. funcId = stack.pop();
  41940. ttContext.functionsDefined[funcId] = {
  41941. data: data,
  41942. i: i
  41943. };
  41944. } else if (op === 0x2D) {
  41945. if (inFDEF) {
  41946. inFDEF = false;
  41947. lastEndf = i;
  41948. } else {
  41949. pc = callstack.pop();
  41950. if (!pc) {
  41951. warn('TT: ENDF bad stack');
  41952. ttContext.hintsValid = false;
  41953. return;
  41954. }
  41955. funcId = functionsCalled.pop();
  41956. data = pc.data;
  41957. i = pc.i;
  41958. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41959. }
  41960. } else if (op === 0x89) {
  41961. if (inFDEF || inELSE) {
  41962. warn('TT: nested IDEFs not allowed');
  41963. tooComplexToFollowFunctions = true;
  41964. }
  41965. inFDEF = true;
  41966. lastDeff = i;
  41967. } else if (op === 0x58) {
  41968. ++ifLevel;
  41969. } else if (op === 0x1B) {
  41970. inELSE = ifLevel;
  41971. } else if (op === 0x59) {
  41972. if (inELSE === ifLevel) {
  41973. inELSE = 0;
  41974. }
  41975. --ifLevel;
  41976. } else if (op === 0x1C) {
  41977. if (!inFDEF && !inELSE) {
  41978. var offset = stack[stack.length - 1];
  41979. if (offset > 0) {
  41980. i += offset - 1;
  41981. }
  41982. }
  41983. }
  41984. if (!inFDEF && !inELSE) {
  41985. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41986. if (op >= 0x71 && op <= 0x75) {
  41987. n = stack.pop();
  41988. if (!isNaN(n)) {
  41989. stackDelta = -n * 2;
  41990. }
  41991. }
  41992. while (stackDelta < 0 && stack.length > 0) {
  41993. stack.pop();
  41994. stackDelta++;
  41995. }
  41996. while (stackDelta > 0) {
  41997. stack.push(NaN);
  41998. stackDelta--;
  41999. }
  42000. }
  42001. }
  42002. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  42003. var content = [data];
  42004. if (i > data.length) {
  42005. content.push(new Uint8Array(i - data.length));
  42006. }
  42007. if (lastDeff > lastEndf) {
  42008. warn('TT: complementing a missing function tail');
  42009. content.push(new Uint8Array([
  42010. 0x22,
  42011. 0x2D
  42012. ]));
  42013. }
  42014. foldTTTable(table, content);
  42015. }
  42016. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  42017. if (ttContext.tooComplexToFollowFunctions) {
  42018. return;
  42019. }
  42020. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  42021. warn('TT: more functions defined than expected');
  42022. ttContext.hintsValid = false;
  42023. return;
  42024. }
  42025. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  42026. if (j > maxFunctionDefs) {
  42027. warn('TT: invalid function id: ' + j);
  42028. ttContext.hintsValid = false;
  42029. return;
  42030. }
  42031. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  42032. warn('TT: undefined function: ' + j);
  42033. ttContext.hintsValid = false;
  42034. return;
  42035. }
  42036. }
  42037. }
  42038. function foldTTTable(table, content) {
  42039. if (content.length > 1) {
  42040. var newLength = 0;
  42041. var j, jj;
  42042. for (j = 0, jj = content.length; j < jj; j++) {
  42043. newLength += content[j].length;
  42044. }
  42045. newLength = newLength + 3 & ~3;
  42046. var result = new Uint8Array(newLength);
  42047. var pos = 0;
  42048. for (j = 0, jj = content.length; j < jj; j++) {
  42049. result.set(content[j], pos);
  42050. pos += content[j].length;
  42051. }
  42052. table.data = result;
  42053. table.length = newLength;
  42054. }
  42055. }
  42056. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  42057. var ttContext = {
  42058. functionsDefined: [],
  42059. functionsUsed: [],
  42060. functionsStackDeltas: [],
  42061. tooComplexToFollowFunctions: false,
  42062. hintsValid: true
  42063. };
  42064. if (fpgm) {
  42065. sanitizeTTProgram(fpgm, ttContext);
  42066. }
  42067. if (prep) {
  42068. sanitizeTTProgram(prep, ttContext);
  42069. }
  42070. if (fpgm) {
  42071. checkInvalidFunctions(ttContext, maxFunctionDefs);
  42072. }
  42073. if (cvt && cvt.length & 1) {
  42074. var cvtData = new Uint8Array(cvt.length + 1);
  42075. cvtData.set(cvt.data);
  42076. cvt.data = cvtData;
  42077. }
  42078. return ttContext.hintsValid;
  42079. }
  42080. font = new Stream(new Uint8Array(font.getBytes()));
  42081. var VALID_TABLES = [
  42082. 'OS/2',
  42083. 'cmap',
  42084. 'head',
  42085. 'hhea',
  42086. 'hmtx',
  42087. 'maxp',
  42088. 'name',
  42089. 'post',
  42090. 'loca',
  42091. 'glyf',
  42092. 'fpgm',
  42093. 'prep',
  42094. 'cvt ',
  42095. 'CFF '
  42096. ];
  42097. var header = readOpenTypeHeader(font);
  42098. var numTables = header.numTables;
  42099. var cff, cffFile;
  42100. var tables = Object.create(null);
  42101. tables['OS/2'] = null;
  42102. tables['cmap'] = null;
  42103. tables['head'] = null;
  42104. tables['hhea'] = null;
  42105. tables['hmtx'] = null;
  42106. tables['maxp'] = null;
  42107. tables['name'] = null;
  42108. tables['post'] = null;
  42109. var table;
  42110. for (var i = 0; i < numTables; i++) {
  42111. table = readTableEntry(font);
  42112. if (VALID_TABLES.indexOf(table.tag) < 0) {
  42113. continue;
  42114. }
  42115. if (table.length === 0) {
  42116. continue;
  42117. }
  42118. tables[table.tag] = table;
  42119. }
  42120. var isTrueType = !tables['CFF '];
  42121. if (!isTrueType) {
  42122. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  42123. cffFile = new Stream(tables['CFF '].data);
  42124. cff = new CFFFont(cffFile, properties);
  42125. adjustWidths(properties);
  42126. return this.convert(name, cff, properties);
  42127. }
  42128. delete tables['glyf'];
  42129. delete tables['loca'];
  42130. delete tables['fpgm'];
  42131. delete tables['prep'];
  42132. delete tables['cvt '];
  42133. this.isOpenType = true;
  42134. } else {
  42135. if (!tables['loca']) {
  42136. error('Required "loca" table is not found');
  42137. }
  42138. if (!tables['glyf']) {
  42139. warn('Required "glyf" table is not found -- trying to recover.');
  42140. tables['glyf'] = {
  42141. tag: 'glyf',
  42142. data: new Uint8Array(0)
  42143. };
  42144. }
  42145. this.isOpenType = false;
  42146. }
  42147. if (!tables['maxp']) {
  42148. error('Required "maxp" table is not found');
  42149. }
  42150. font.pos = (font.start || 0) + tables['maxp'].offset;
  42151. var version = font.getInt32();
  42152. var numGlyphs = font.getUint16();
  42153. var maxFunctionDefs = 0;
  42154. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  42155. font.pos += 8;
  42156. var maxZones = font.getUint16();
  42157. if (maxZones > 2) {
  42158. tables['maxp'].data[14] = 0;
  42159. tables['maxp'].data[15] = 2;
  42160. }
  42161. font.pos += 4;
  42162. maxFunctionDefs = font.getUint16();
  42163. }
  42164. var dupFirstEntry = false;
  42165. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  42166. dupFirstEntry = true;
  42167. numGlyphs++;
  42168. tables['maxp'].data[4] = numGlyphs >> 8;
  42169. tables['maxp'].data[5] = numGlyphs & 255;
  42170. }
  42171. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  42172. if (!hintsValid) {
  42173. delete tables['fpgm'];
  42174. delete tables['prep'];
  42175. delete tables['cvt '];
  42176. }
  42177. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  42178. if (!tables['head']) {
  42179. error('Required "head" table is not found');
  42180. }
  42181. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  42182. var missingGlyphs = Object.create(null);
  42183. if (isTrueType) {
  42184. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  42185. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  42186. }
  42187. if (!tables['hhea']) {
  42188. error('Required "hhea" table is not found');
  42189. }
  42190. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  42191. tables['hhea'].data[10] = 0xFF;
  42192. tables['hhea'].data[11] = 0xFF;
  42193. }
  42194. var metricsOverride = {
  42195. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  42196. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  42197. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  42198. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  42199. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  42200. };
  42201. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  42202. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  42203. if (tables['post']) {
  42204. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  42205. if (!valid) {
  42206. tables['post'] = null;
  42207. }
  42208. }
  42209. var charCodeToGlyphId = [], charCode;
  42210. var toUnicode = properties.toUnicode, widths = properties.widths;
  42211. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  42212. function hasGlyph(glyphId, charCode, widthCode) {
  42213. if (!missingGlyphs[glyphId]) {
  42214. return true;
  42215. }
  42216. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  42217. return true;
  42218. }
  42219. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  42220. return true;
  42221. }
  42222. return false;
  42223. }
  42224. if (properties.composite) {
  42225. var cidToGidMap = properties.cidToGidMap || [];
  42226. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  42227. properties.cMap.forEach(function (charCode, cid) {
  42228. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  42229. var glyphId = -1;
  42230. if (isCidToGidMapEmpty) {
  42231. glyphId = cid;
  42232. } else if (cidToGidMap[cid] !== undefined) {
  42233. glyphId = cidToGidMap[cid];
  42234. }
  42235. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  42236. charCodeToGlyphId[charCode] = glyphId;
  42237. }
  42238. });
  42239. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  42240. charCodeToGlyphId[0] = numGlyphs - 1;
  42241. }
  42242. } else {
  42243. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  42244. var cmapPlatformId = cmapTable.platformId;
  42245. var cmapEncodingId = cmapTable.encodingId;
  42246. var cmapMappings = cmapTable.mappings;
  42247. var cmapMappingsLength = cmapMappings.length;
  42248. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  42249. var baseEncoding = [];
  42250. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  42251. baseEncoding = getEncoding(properties.baseEncodingName);
  42252. }
  42253. var glyphsUnicodeMap = getGlyphsUnicode();
  42254. for (charCode = 0; charCode < 256; charCode++) {
  42255. var glyphName, standardGlyphName;
  42256. if (this.differences && charCode in this.differences) {
  42257. glyphName = this.differences[charCode];
  42258. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  42259. glyphName = baseEncoding[charCode];
  42260. } else {
  42261. glyphName = StandardEncoding[charCode];
  42262. }
  42263. if (!glyphName) {
  42264. continue;
  42265. }
  42266. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42267. var unicodeOrCharCode, isUnicode = false;
  42268. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  42269. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  42270. isUnicode = true;
  42271. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  42272. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  42273. }
  42274. var found = false;
  42275. for (i = 0; i < cmapMappingsLength; ++i) {
  42276. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  42277. continue;
  42278. }
  42279. var code = isUnicode ? charCode : unicodeOrCharCode;
  42280. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  42281. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42282. found = true;
  42283. break;
  42284. }
  42285. }
  42286. if (!found && properties.glyphNames) {
  42287. var glyphId = properties.glyphNames.indexOf(glyphName);
  42288. if (glyphId === -1 && standardGlyphName !== glyphName) {
  42289. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  42290. }
  42291. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  42292. charCodeToGlyphId[charCode] = glyphId;
  42293. found = true;
  42294. }
  42295. }
  42296. if (!found) {
  42297. charCodeToGlyphId[charCode] = 0;
  42298. }
  42299. }
  42300. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  42301. for (i = 0; i < cmapMappingsLength; ++i) {
  42302. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  42303. }
  42304. } else {
  42305. for (i = 0; i < cmapMappingsLength; ++i) {
  42306. charCode = cmapMappings[i].charCode & 0xFF;
  42307. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42308. }
  42309. }
  42310. }
  42311. if (charCodeToGlyphId.length === 0) {
  42312. charCodeToGlyphId[0] = 0;
  42313. }
  42314. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  42315. this.toFontChar = newMapping.toFontChar;
  42316. tables['cmap'] = {
  42317. tag: 'cmap',
  42318. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  42319. };
  42320. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  42321. tables['OS/2'] = {
  42322. tag: 'OS/2',
  42323. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  42324. };
  42325. }
  42326. if (!tables['post']) {
  42327. tables['post'] = {
  42328. tag: 'post',
  42329. data: createPostTable(properties)
  42330. };
  42331. }
  42332. if (!isTrueType) {
  42333. try {
  42334. cffFile = new Stream(tables['CFF '].data);
  42335. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  42336. cff = parser.parse();
  42337. var compiler = new CFFCompiler(cff);
  42338. tables['CFF '].data = compiler.compile();
  42339. } catch (e) {
  42340. warn('Failed to compile font ' + properties.loadedName);
  42341. }
  42342. }
  42343. if (!tables['name']) {
  42344. tables['name'] = {
  42345. tag: 'name',
  42346. data: createNameTable(this.name)
  42347. };
  42348. } else {
  42349. var namePrototype = readNameTable(tables['name']);
  42350. tables['name'].data = createNameTable(name, namePrototype);
  42351. }
  42352. var builder = new OpenTypeFileBuilder(header.version);
  42353. for (var tableTag in tables) {
  42354. builder.addTable(tableTag, tables[tableTag].data);
  42355. }
  42356. return builder.toArray();
  42357. },
  42358. convert: function Font_convert(fontName, font, properties) {
  42359. properties.fixedPitch = false;
  42360. if (properties.builtInEncoding) {
  42361. adjustToUnicode(properties, properties.builtInEncoding);
  42362. }
  42363. var mapping = font.getGlyphMapping(properties);
  42364. var newMapping = adjustMapping(mapping, properties);
  42365. this.toFontChar = newMapping.toFontChar;
  42366. var numGlyphs = font.numGlyphs;
  42367. function getCharCodes(charCodeToGlyphId, glyphId) {
  42368. var charCodes = null;
  42369. for (var charCode in charCodeToGlyphId) {
  42370. if (glyphId === charCodeToGlyphId[charCode]) {
  42371. if (!charCodes) {
  42372. charCodes = [];
  42373. }
  42374. charCodes.push(charCode | 0);
  42375. }
  42376. }
  42377. return charCodes;
  42378. }
  42379. function createCharCode(charCodeToGlyphId, glyphId) {
  42380. for (var charCode in charCodeToGlyphId) {
  42381. if (glyphId === charCodeToGlyphId[charCode]) {
  42382. return charCode | 0;
  42383. }
  42384. }
  42385. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  42386. return newMapping.nextAvailableFontCharCode++;
  42387. }
  42388. var seacs = font.seacs;
  42389. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  42390. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  42391. var charset = font.getCharset();
  42392. var seacMap = Object.create(null);
  42393. for (var glyphId in seacs) {
  42394. glyphId |= 0;
  42395. var seac = seacs[glyphId];
  42396. var baseGlyphName = StandardEncoding[seac[2]];
  42397. var accentGlyphName = StandardEncoding[seac[3]];
  42398. var baseGlyphId = charset.indexOf(baseGlyphName);
  42399. var accentGlyphId = charset.indexOf(accentGlyphName);
  42400. if (baseGlyphId < 0 || accentGlyphId < 0) {
  42401. continue;
  42402. }
  42403. var accentOffset = {
  42404. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  42405. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  42406. };
  42407. var charCodes = getCharCodes(mapping, glyphId);
  42408. if (!charCodes) {
  42409. continue;
  42410. }
  42411. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  42412. var charCode = charCodes[i];
  42413. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  42414. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  42415. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  42416. seacMap[charCode] = {
  42417. baseFontCharCode: baseFontCharCode,
  42418. accentFontCharCode: accentFontCharCode,
  42419. accentOffset: accentOffset
  42420. };
  42421. }
  42422. }
  42423. properties.seacMap = seacMap;
  42424. }
  42425. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  42426. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  42427. builder.addTable('CFF ', font.data);
  42428. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  42429. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  42430. 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');
  42431. 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));
  42432. builder.addTable('hmtx', function fontFieldsHmtx() {
  42433. var charstrings = font.charstrings;
  42434. var cffWidths = font.cff ? font.cff.widths : null;
  42435. var hmtx = '\x00\x00\x00\x00';
  42436. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  42437. var width = 0;
  42438. if (charstrings) {
  42439. var charstring = charstrings[i - 1];
  42440. width = 'width' in charstring ? charstring.width : 0;
  42441. } else if (cffWidths) {
  42442. width = Math.ceil(cffWidths[i] || 0);
  42443. }
  42444. hmtx += string16(width) + string16(0);
  42445. }
  42446. return hmtx;
  42447. }());
  42448. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  42449. builder.addTable('name', createNameTable(fontName));
  42450. builder.addTable('post', createPostTable(properties));
  42451. return builder.toArray();
  42452. },
  42453. get spaceWidth() {
  42454. if ('_shadowWidth' in this) {
  42455. return this._shadowWidth;
  42456. }
  42457. var possibleSpaceReplacements = [
  42458. 'space',
  42459. 'minus',
  42460. 'one',
  42461. 'i',
  42462. 'I'
  42463. ];
  42464. var width;
  42465. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  42466. var glyphName = possibleSpaceReplacements[i];
  42467. if (glyphName in this.widths) {
  42468. width = this.widths[glyphName];
  42469. break;
  42470. }
  42471. var glyphsUnicodeMap = getGlyphsUnicode();
  42472. var glyphUnicode = glyphsUnicodeMap[glyphName];
  42473. var charcode = 0;
  42474. if (this.composite) {
  42475. if (this.cMap.contains(glyphUnicode)) {
  42476. charcode = this.cMap.lookup(glyphUnicode);
  42477. }
  42478. }
  42479. if (!charcode && this.toUnicode) {
  42480. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  42481. }
  42482. if (charcode <= 0) {
  42483. charcode = glyphUnicode;
  42484. }
  42485. width = this.widths[charcode];
  42486. if (width) {
  42487. break;
  42488. }
  42489. }
  42490. width = width || this.defaultWidth;
  42491. this._shadowWidth = width;
  42492. return width;
  42493. },
  42494. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  42495. var fontCharCode, width, operatorListId;
  42496. var widthCode = charcode;
  42497. if (this.cMap && this.cMap.contains(charcode)) {
  42498. widthCode = this.cMap.lookup(charcode);
  42499. }
  42500. width = this.widths[widthCode];
  42501. width = isNum(width) ? width : this.defaultWidth;
  42502. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  42503. var unicode = this.toUnicode.get(charcode) || charcode;
  42504. if (typeof unicode === 'number') {
  42505. unicode = String.fromCharCode(unicode);
  42506. }
  42507. var isInFont = charcode in this.toFontChar;
  42508. fontCharCode = this.toFontChar[charcode] || charcode;
  42509. if (this.missingFile) {
  42510. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  42511. }
  42512. if (this.isType3Font) {
  42513. operatorListId = fontCharCode;
  42514. }
  42515. var accent = null;
  42516. if (this.seacMap && this.seacMap[charcode]) {
  42517. isInFont = true;
  42518. var seac = this.seacMap[charcode];
  42519. fontCharCode = seac.baseFontCharCode;
  42520. accent = {
  42521. fontChar: String.fromCharCode(seac.accentFontCharCode),
  42522. offset: seac.accentOffset
  42523. };
  42524. }
  42525. var fontChar = String.fromCharCode(fontCharCode);
  42526. var glyph = this.glyphCache[charcode];
  42527. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  42528. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  42529. this.glyphCache[charcode] = glyph;
  42530. }
  42531. return glyph;
  42532. },
  42533. charsToGlyphs: function Font_charsToGlyphs(chars) {
  42534. var charsCache = this.charsCache;
  42535. var glyphs, glyph, charcode;
  42536. if (charsCache) {
  42537. glyphs = charsCache[chars];
  42538. if (glyphs) {
  42539. return glyphs;
  42540. }
  42541. }
  42542. if (!charsCache) {
  42543. charsCache = this.charsCache = Object.create(null);
  42544. }
  42545. glyphs = [];
  42546. var charsCacheKey = chars;
  42547. var i = 0, ii;
  42548. if (this.cMap) {
  42549. var c = Object.create(null);
  42550. while (i < chars.length) {
  42551. this.cMap.readCharCode(chars, i, c);
  42552. charcode = c.charcode;
  42553. var length = c.length;
  42554. i += length;
  42555. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  42556. glyph = this.charToGlyph(charcode, isSpace);
  42557. glyphs.push(glyph);
  42558. }
  42559. } else {
  42560. for (i = 0, ii = chars.length; i < ii; ++i) {
  42561. charcode = chars.charCodeAt(i);
  42562. glyph = this.charToGlyph(charcode, charcode === 0x20);
  42563. glyphs.push(glyph);
  42564. }
  42565. }
  42566. return charsCache[charsCacheKey] = glyphs;
  42567. }
  42568. };
  42569. return Font;
  42570. }();
  42571. var ErrorFont = function ErrorFontClosure() {
  42572. function ErrorFont(error) {
  42573. this.error = error;
  42574. this.loadedName = 'g_font_error';
  42575. this.loading = false;
  42576. }
  42577. ErrorFont.prototype = {
  42578. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  42579. return [];
  42580. },
  42581. exportData: function ErrorFont_exportData() {
  42582. return { error: this.error };
  42583. }
  42584. };
  42585. return ErrorFont;
  42586. }();
  42587. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  42588. var charCodeToGlyphId = Object.create(null);
  42589. var glyphId, charCode, baseEncoding;
  42590. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  42591. if (properties.baseEncodingName) {
  42592. baseEncoding = getEncoding(properties.baseEncodingName);
  42593. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42594. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42595. if (glyphId >= 0) {
  42596. charCodeToGlyphId[charCode] = glyphId;
  42597. } else {
  42598. charCodeToGlyphId[charCode] = 0;
  42599. }
  42600. }
  42601. } else if (isSymbolicFont) {
  42602. for (charCode in builtInEncoding) {
  42603. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  42604. }
  42605. } else {
  42606. baseEncoding = StandardEncoding;
  42607. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42608. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42609. if (glyphId >= 0) {
  42610. charCodeToGlyphId[charCode] = glyphId;
  42611. } else {
  42612. charCodeToGlyphId[charCode] = 0;
  42613. }
  42614. }
  42615. }
  42616. var differences = properties.differences, glyphsUnicodeMap;
  42617. if (differences) {
  42618. for (charCode in differences) {
  42619. var glyphName = differences[charCode];
  42620. glyphId = glyphNames.indexOf(glyphName);
  42621. if (glyphId === -1) {
  42622. if (!glyphsUnicodeMap) {
  42623. glyphsUnicodeMap = getGlyphsUnicode();
  42624. }
  42625. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42626. if (standardGlyphName !== glyphName) {
  42627. glyphId = glyphNames.indexOf(standardGlyphName);
  42628. }
  42629. }
  42630. if (glyphId >= 0) {
  42631. charCodeToGlyphId[charCode] = glyphId;
  42632. } else {
  42633. charCodeToGlyphId[charCode] = 0;
  42634. }
  42635. }
  42636. }
  42637. return charCodeToGlyphId;
  42638. }
  42639. var Type1Font = function Type1FontClosure() {
  42640. function findBlock(streamBytes, signature, startIndex) {
  42641. var streamBytesLength = streamBytes.length;
  42642. var signatureLength = signature.length;
  42643. var scanLength = streamBytesLength - signatureLength;
  42644. var i = startIndex, j, found = false;
  42645. while (i < scanLength) {
  42646. j = 0;
  42647. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42648. j++;
  42649. }
  42650. if (j >= signatureLength) {
  42651. i += j;
  42652. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  42653. i++;
  42654. }
  42655. found = true;
  42656. break;
  42657. }
  42658. i++;
  42659. }
  42660. return {
  42661. found: found,
  42662. length: i
  42663. };
  42664. }
  42665. function getHeaderBlock(stream, suggestedLength) {
  42666. var EEXEC_SIGNATURE = [
  42667. 0x65,
  42668. 0x65,
  42669. 0x78,
  42670. 0x65,
  42671. 0x63
  42672. ];
  42673. var streamStartPos = stream.pos;
  42674. var headerBytes, headerBytesLength, block;
  42675. try {
  42676. headerBytes = stream.getBytes(suggestedLength);
  42677. headerBytesLength = headerBytes.length;
  42678. } catch (ex) {
  42679. if (ex instanceof MissingDataException) {
  42680. throw ex;
  42681. }
  42682. }
  42683. if (headerBytesLength === suggestedLength) {
  42684. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42685. if (block.found && block.length === suggestedLength) {
  42686. return {
  42687. stream: new Stream(headerBytes),
  42688. length: suggestedLength
  42689. };
  42690. }
  42691. }
  42692. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  42693. stream.pos = streamStartPos;
  42694. var SCAN_BLOCK_LENGTH = 2048;
  42695. var actualLength;
  42696. while (true) {
  42697. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42698. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42699. if (block.length === 0) {
  42700. break;
  42701. }
  42702. stream.pos += block.length;
  42703. if (block.found) {
  42704. actualLength = stream.pos - streamStartPos;
  42705. break;
  42706. }
  42707. }
  42708. stream.pos = streamStartPos;
  42709. if (actualLength) {
  42710. return {
  42711. stream: new Stream(stream.getBytes(actualLength)),
  42712. length: actualLength
  42713. };
  42714. }
  42715. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  42716. return {
  42717. stream: new Stream(stream.getBytes(suggestedLength)),
  42718. length: suggestedLength
  42719. };
  42720. }
  42721. function getEexecBlock(stream, suggestedLength) {
  42722. var eexecBytes = stream.getBytes();
  42723. return {
  42724. stream: new Stream(eexecBytes),
  42725. length: eexecBytes.length
  42726. };
  42727. }
  42728. function Type1Font(name, file, properties) {
  42729. var PFB_HEADER_SIZE = 6;
  42730. var headerBlockLength = properties.length1;
  42731. var eexecBlockLength = properties.length2;
  42732. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42733. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42734. if (pfbHeaderPresent) {
  42735. file.skip(PFB_HEADER_SIZE);
  42736. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42737. }
  42738. var headerBlock = getHeaderBlock(file, headerBlockLength);
  42739. headerBlockLength = headerBlock.length;
  42740. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  42741. headerBlockParser.extractFontHeader(properties);
  42742. if (pfbHeaderPresent) {
  42743. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42744. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42745. }
  42746. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  42747. eexecBlockLength = eexecBlock.length;
  42748. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  42749. var data = eexecBlockParser.extractFontProgram();
  42750. for (var info in data.properties) {
  42751. properties[info] = data.properties[info];
  42752. }
  42753. var charstrings = data.charstrings;
  42754. var type2Charstrings = this.getType2Charstrings(charstrings);
  42755. var subrs = this.getType2Subrs(data.subrs);
  42756. this.charstrings = charstrings;
  42757. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42758. this.seacs = this.getSeacs(data.charstrings);
  42759. }
  42760. Type1Font.prototype = {
  42761. get numGlyphs() {
  42762. return this.charstrings.length + 1;
  42763. },
  42764. getCharset: function Type1Font_getCharset() {
  42765. var charset = ['.notdef'];
  42766. var charstrings = this.charstrings;
  42767. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42768. charset.push(charstrings[glyphId].glyphName);
  42769. }
  42770. return charset;
  42771. },
  42772. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  42773. var charstrings = this.charstrings;
  42774. var glyphNames = ['.notdef'], glyphId;
  42775. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42776. glyphNames.push(charstrings[glyphId].glyphName);
  42777. }
  42778. var encoding = properties.builtInEncoding;
  42779. if (encoding) {
  42780. var builtInEncoding = Object.create(null);
  42781. for (var charCode in encoding) {
  42782. glyphId = glyphNames.indexOf(encoding[charCode]);
  42783. if (glyphId >= 0) {
  42784. builtInEncoding[charCode] = glyphId;
  42785. }
  42786. }
  42787. }
  42788. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  42789. },
  42790. getSeacs: function Type1Font_getSeacs(charstrings) {
  42791. var i, ii;
  42792. var seacMap = [];
  42793. for (i = 0, ii = charstrings.length; i < ii; i++) {
  42794. var charstring = charstrings[i];
  42795. if (charstring.seac) {
  42796. seacMap[i + 1] = charstring.seac;
  42797. }
  42798. }
  42799. return seacMap;
  42800. },
  42801. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  42802. var type2Charstrings = [];
  42803. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42804. type2Charstrings.push(type1Charstrings[i].charstring);
  42805. }
  42806. return type2Charstrings;
  42807. },
  42808. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  42809. var bias = 0;
  42810. var count = type1Subrs.length;
  42811. if (count < 1133) {
  42812. bias = 107;
  42813. } else if (count < 33769) {
  42814. bias = 1131;
  42815. } else {
  42816. bias = 32768;
  42817. }
  42818. var type2Subrs = [];
  42819. var i;
  42820. for (i = 0; i < bias; i++) {
  42821. type2Subrs.push([0x0B]);
  42822. }
  42823. for (i = 0; i < count; i++) {
  42824. type2Subrs.push(type1Subrs[i]);
  42825. }
  42826. return type2Subrs;
  42827. },
  42828. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  42829. var cff = new CFF();
  42830. cff.header = new CFFHeader(1, 0, 4, 4);
  42831. cff.names = [name];
  42832. var topDict = new CFFTopDict();
  42833. topDict.setByName('version', 391);
  42834. topDict.setByName('Notice', 392);
  42835. topDict.setByName('FullName', 393);
  42836. topDict.setByName('FamilyName', 394);
  42837. topDict.setByName('Weight', 395);
  42838. topDict.setByName('Encoding', null);
  42839. topDict.setByName('FontMatrix', properties.fontMatrix);
  42840. topDict.setByName('FontBBox', properties.bbox);
  42841. topDict.setByName('charset', null);
  42842. topDict.setByName('CharStrings', null);
  42843. topDict.setByName('Private', null);
  42844. cff.topDict = topDict;
  42845. var strings = new CFFStrings();
  42846. strings.add('Version 0.11');
  42847. strings.add('See original notice');
  42848. strings.add(name);
  42849. strings.add(name);
  42850. strings.add('Medium');
  42851. cff.strings = strings;
  42852. cff.globalSubrIndex = new CFFIndex();
  42853. var count = glyphs.length;
  42854. var charsetArray = [0];
  42855. var i, ii;
  42856. for (i = 0; i < count; i++) {
  42857. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  42858. if (index === -1) {
  42859. index = 0;
  42860. }
  42861. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  42862. }
  42863. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42864. var charStringsIndex = new CFFIndex();
  42865. charStringsIndex.add([
  42866. 0x8B,
  42867. 0x0E
  42868. ]);
  42869. for (i = 0; i < count; i++) {
  42870. var glyph = glyphs[i];
  42871. if (glyph.length === 0) {
  42872. charStringsIndex.add([
  42873. 0x8B,
  42874. 0x0E
  42875. ]);
  42876. continue;
  42877. }
  42878. charStringsIndex.add(glyph);
  42879. }
  42880. cff.charStrings = charStringsIndex;
  42881. var privateDict = new CFFPrivateDict();
  42882. privateDict.setByName('Subrs', null);
  42883. var fields = [
  42884. 'BlueValues',
  42885. 'OtherBlues',
  42886. 'FamilyBlues',
  42887. 'FamilyOtherBlues',
  42888. 'StemSnapH',
  42889. 'StemSnapV',
  42890. 'BlueShift',
  42891. 'BlueFuzz',
  42892. 'BlueScale',
  42893. 'LanguageGroup',
  42894. 'ExpansionFactor',
  42895. 'ForceBold',
  42896. 'StdHW',
  42897. 'StdVW'
  42898. ];
  42899. for (i = 0, ii = fields.length; i < ii; i++) {
  42900. var field = fields[i];
  42901. if (!(field in properties.privateData)) {
  42902. continue;
  42903. }
  42904. var value = properties.privateData[field];
  42905. if (isArray(value)) {
  42906. for (var j = value.length - 1; j > 0; j--) {
  42907. value[j] -= value[j - 1];
  42908. }
  42909. }
  42910. privateDict.setByName(field, value);
  42911. }
  42912. cff.topDict.privateDict = privateDict;
  42913. var subrIndex = new CFFIndex();
  42914. for (i = 0, ii = subrs.length; i < ii; i++) {
  42915. subrIndex.add(subrs[i]);
  42916. }
  42917. privateDict.subrsIndex = subrIndex;
  42918. var compiler = new CFFCompiler(cff);
  42919. return compiler.compile();
  42920. }
  42921. };
  42922. return Type1Font;
  42923. }();
  42924. var CFFFont = function CFFFontClosure() {
  42925. function CFFFont(file, properties) {
  42926. this.properties = properties;
  42927. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42928. this.cff = parser.parse();
  42929. var compiler = new CFFCompiler(this.cff);
  42930. this.seacs = this.cff.seacs;
  42931. try {
  42932. this.data = compiler.compile();
  42933. } catch (e) {
  42934. warn('Failed to compile font ' + properties.loadedName);
  42935. this.data = file;
  42936. }
  42937. }
  42938. CFFFont.prototype = {
  42939. get numGlyphs() {
  42940. return this.cff.charStrings.count;
  42941. },
  42942. getCharset: function CFFFont_getCharset() {
  42943. return this.cff.charset.charset;
  42944. },
  42945. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42946. var cff = this.cff;
  42947. var properties = this.properties;
  42948. var charsets = cff.charset.charset;
  42949. var charCodeToGlyphId;
  42950. var glyphId;
  42951. if (properties.composite) {
  42952. charCodeToGlyphId = Object.create(null);
  42953. if (cff.isCIDFont) {
  42954. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42955. var cid = charsets[glyphId];
  42956. var charCode = properties.cMap.charCodeOf(cid);
  42957. charCodeToGlyphId[charCode] = glyphId;
  42958. }
  42959. } else {
  42960. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42961. charCodeToGlyphId[glyphId] = glyphId;
  42962. }
  42963. }
  42964. return charCodeToGlyphId;
  42965. }
  42966. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42967. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42968. return charCodeToGlyphId;
  42969. }
  42970. };
  42971. return CFFFont;
  42972. }();
  42973. (function checkSeacSupport() {
  42974. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42975. SEAC_ANALYSIS_ENABLED = true;
  42976. }
  42977. }());
  42978. (function checkChromeWindows() {
  42979. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42980. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42981. }
  42982. }());
  42983. exports.ErrorFont = ErrorFont;
  42984. exports.Font = Font;
  42985. exports.FontFlags = FontFlags;
  42986. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42987. exports.ToUnicodeMap = ToUnicodeMap;
  42988. exports.getFontType = getFontType;
  42989. /***/ }),
  42990. /* 28 */
  42991. /***/ (function(module, exports, __w_pdfjs_require__) {
  42992. "use strict";
  42993. var sharedUtil = __w_pdfjs_require__(0);
  42994. var corePrimitives = __w_pdfjs_require__(1);
  42995. var coreColorSpace = __w_pdfjs_require__(3);
  42996. var coreStream = __w_pdfjs_require__(2);
  42997. var coreJpx = __w_pdfjs_require__(14);
  42998. var ImageKind = sharedUtil.ImageKind;
  42999. var assert = sharedUtil.assert;
  43000. var error = sharedUtil.error;
  43001. var info = sharedUtil.info;
  43002. var isArray = sharedUtil.isArray;
  43003. var warn = sharedUtil.warn;
  43004. var Name = corePrimitives.Name;
  43005. var isStream = corePrimitives.isStream;
  43006. var ColorSpace = coreColorSpace.ColorSpace;
  43007. var DecodeStream = coreStream.DecodeStream;
  43008. var JpegStream = coreStream.JpegStream;
  43009. var JpxImage = coreJpx.JpxImage;
  43010. var PDFImage = function PDFImageClosure() {
  43011. function handleImageData(image, nativeDecoder) {
  43012. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  43013. return nativeDecoder.decode(image);
  43014. }
  43015. return Promise.resolve(image);
  43016. }
  43017. function decodeAndClamp(value, addend, coefficient, max) {
  43018. value = addend + value * coefficient;
  43019. return value < 0 ? 0 : value > max ? max : value;
  43020. }
  43021. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  43022. var length = w2 * h2;
  43023. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43024. var xRatio = w1 / w2;
  43025. var yRatio = h1 / h2;
  43026. var i, j, py, newIndex = 0, oldIndex;
  43027. var xScaled = new Uint16Array(w2);
  43028. var w1Scanline = w1;
  43029. for (i = 0; i < w2; i++) {
  43030. xScaled[i] = Math.floor(i * xRatio);
  43031. }
  43032. for (i = 0; i < h2; i++) {
  43033. py = Math.floor(i * yRatio) * w1Scanline;
  43034. for (j = 0; j < w2; j++) {
  43035. oldIndex = py + xScaled[j];
  43036. dest[newIndex++] = src[oldIndex];
  43037. }
  43038. }
  43039. return dest;
  43040. }
  43041. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  43042. this.image = image;
  43043. var dict = image.dict;
  43044. if (dict.has('Filter')) {
  43045. var filter = dict.get('Filter').name;
  43046. if (filter === 'JPXDecode') {
  43047. var jpxImage = new JpxImage();
  43048. jpxImage.parseImageProperties(image.stream);
  43049. image.stream.reset();
  43050. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43051. image.numComps = jpxImage.componentsCount;
  43052. } else if (filter === 'JBIG2Decode') {
  43053. image.bitsPerComponent = 1;
  43054. image.numComps = 1;
  43055. }
  43056. }
  43057. this.width = dict.get('Width', 'W');
  43058. this.height = dict.get('Height', 'H');
  43059. if (this.width < 1 || this.height < 1) {
  43060. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  43061. }
  43062. this.interpolate = dict.get('Interpolate', 'I') || false;
  43063. this.imageMask = dict.get('ImageMask', 'IM') || false;
  43064. this.matte = dict.get('Matte') || false;
  43065. var bitsPerComponent = image.bitsPerComponent;
  43066. if (!bitsPerComponent) {
  43067. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  43068. if (!bitsPerComponent) {
  43069. if (this.imageMask) {
  43070. bitsPerComponent = 1;
  43071. } else {
  43072. error('Bits per component missing in image: ' + this.imageMask);
  43073. }
  43074. }
  43075. }
  43076. this.bpc = bitsPerComponent;
  43077. if (!this.imageMask) {
  43078. var colorSpace = dict.get('ColorSpace', 'CS');
  43079. if (!colorSpace) {
  43080. info('JPX images (which do not require color spaces)');
  43081. switch (image.numComps) {
  43082. case 1:
  43083. colorSpace = Name.get('DeviceGray');
  43084. break;
  43085. case 3:
  43086. colorSpace = Name.get('DeviceRGB');
  43087. break;
  43088. case 4:
  43089. colorSpace = Name.get('DeviceCMYK');
  43090. break;
  43091. default:
  43092. error('JPX images with ' + this.numComps + ' color components not supported.');
  43093. }
  43094. }
  43095. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  43096. this.numComps = this.colorSpace.numComps;
  43097. }
  43098. this.decode = dict.getArray('Decode', 'D');
  43099. this.needsDecode = false;
  43100. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  43101. this.needsDecode = true;
  43102. var max = (1 << bitsPerComponent) - 1;
  43103. this.decodeCoefficients = [];
  43104. this.decodeAddends = [];
  43105. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43106. var dmin = this.decode[i];
  43107. var dmax = this.decode[i + 1];
  43108. this.decodeCoefficients[j] = dmax - dmin;
  43109. this.decodeAddends[j] = max * dmin;
  43110. }
  43111. }
  43112. if (smask) {
  43113. this.smask = new PDFImage(xref, res, smask, false);
  43114. } else if (mask) {
  43115. if (isStream(mask)) {
  43116. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  43117. if (!imageMask) {
  43118. warn('Ignoring /Mask in image without /ImageMask.');
  43119. } else {
  43120. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  43121. }
  43122. } else {
  43123. this.mask = mask;
  43124. }
  43125. }
  43126. }
  43127. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  43128. var imagePromise = handleImageData(image, nativeDecoder);
  43129. var smaskPromise;
  43130. var maskPromise;
  43131. var smask = image.dict.get('SMask');
  43132. var mask = image.dict.get('Mask');
  43133. if (smask) {
  43134. smaskPromise = handleImageData(smask, nativeDecoder);
  43135. maskPromise = Promise.resolve(null);
  43136. } else {
  43137. smaskPromise = Promise.resolve(null);
  43138. if (mask) {
  43139. if (isStream(mask)) {
  43140. maskPromise = handleImageData(mask, nativeDecoder);
  43141. } else if (isArray(mask)) {
  43142. maskPromise = Promise.resolve(mask);
  43143. } else {
  43144. warn('Unsupported mask format.');
  43145. maskPromise = Promise.resolve(null);
  43146. }
  43147. } else {
  43148. maskPromise = Promise.resolve(null);
  43149. }
  43150. }
  43151. return Promise.all([
  43152. imagePromise,
  43153. smaskPromise,
  43154. maskPromise
  43155. ]).then(function (results) {
  43156. var imageData = results[0];
  43157. var smaskData = results[1];
  43158. var maskData = results[2];
  43159. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  43160. });
  43161. };
  43162. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  43163. var computedLength = (width + 7 >> 3) * height;
  43164. var actualLength = imgArray.byteLength;
  43165. var haveFullData = computedLength === actualLength;
  43166. var data, i;
  43167. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43168. data = imgArray;
  43169. } else if (!inverseDecode) {
  43170. data = new Uint8Array(actualLength);
  43171. data.set(imgArray);
  43172. } else {
  43173. data = new Uint8Array(computedLength);
  43174. data.set(imgArray);
  43175. for (i = actualLength; i < computedLength; i++) {
  43176. data[i] = 0xff;
  43177. }
  43178. }
  43179. if (inverseDecode) {
  43180. for (i = 0; i < actualLength; i++) {
  43181. data[i] = ~data[i];
  43182. }
  43183. }
  43184. return {
  43185. data: data,
  43186. width: width,
  43187. height: height
  43188. };
  43189. };
  43190. PDFImage.prototype = {
  43191. get drawWidth() {
  43192. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43193. },
  43194. get drawHeight() {
  43195. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43196. },
  43197. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  43198. var bpc = this.bpc;
  43199. var numComps = this.numComps;
  43200. var decodeAddends = this.decodeAddends;
  43201. var decodeCoefficients = this.decodeCoefficients;
  43202. var max = (1 << bpc) - 1;
  43203. var i, ii;
  43204. if (bpc === 1) {
  43205. for (i = 0, ii = buffer.length; i < ii; i++) {
  43206. buffer[i] = +!buffer[i];
  43207. }
  43208. return;
  43209. }
  43210. var index = 0;
  43211. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43212. for (var j = 0; j < numComps; j++) {
  43213. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43214. index++;
  43215. }
  43216. }
  43217. },
  43218. getComponents: function PDFImage_getComponents(buffer) {
  43219. var bpc = this.bpc;
  43220. if (bpc === 8) {
  43221. return buffer;
  43222. }
  43223. var width = this.width;
  43224. var height = this.height;
  43225. var numComps = this.numComps;
  43226. var length = width * height * numComps;
  43227. var bufferPos = 0;
  43228. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43229. var rowComps = width * numComps;
  43230. var max = (1 << bpc) - 1;
  43231. var i = 0, ii, buf;
  43232. if (bpc === 1) {
  43233. var mask, loop1End, loop2End;
  43234. for (var j = 0; j < height; j++) {
  43235. loop1End = i + (rowComps & ~7);
  43236. loop2End = i + rowComps;
  43237. while (i < loop1End) {
  43238. buf = buffer[bufferPos++];
  43239. output[i] = buf >> 7 & 1;
  43240. output[i + 1] = buf >> 6 & 1;
  43241. output[i + 2] = buf >> 5 & 1;
  43242. output[i + 3] = buf >> 4 & 1;
  43243. output[i + 4] = buf >> 3 & 1;
  43244. output[i + 5] = buf >> 2 & 1;
  43245. output[i + 6] = buf >> 1 & 1;
  43246. output[i + 7] = buf & 1;
  43247. i += 8;
  43248. }
  43249. if (i < loop2End) {
  43250. buf = buffer[bufferPos++];
  43251. mask = 128;
  43252. while (i < loop2End) {
  43253. output[i++] = +!!(buf & mask);
  43254. mask >>= 1;
  43255. }
  43256. }
  43257. }
  43258. } else {
  43259. var bits = 0;
  43260. buf = 0;
  43261. for (i = 0, ii = length; i < ii; ++i) {
  43262. if (i % rowComps === 0) {
  43263. buf = 0;
  43264. bits = 0;
  43265. }
  43266. while (bits < bpc) {
  43267. buf = buf << 8 | buffer[bufferPos++];
  43268. bits += 8;
  43269. }
  43270. var remainingBits = bits - bpc;
  43271. var value = buf >> remainingBits;
  43272. output[i] = value < 0 ? 0 : value > max ? max : value;
  43273. buf = buf & (1 << remainingBits) - 1;
  43274. bits = remainingBits;
  43275. }
  43276. }
  43277. return output;
  43278. },
  43279. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43280. var smask = this.smask;
  43281. var mask = this.mask;
  43282. var alphaBuf, sw, sh, i, ii, j;
  43283. if (smask) {
  43284. sw = smask.width;
  43285. sh = smask.height;
  43286. alphaBuf = new Uint8Array(sw * sh);
  43287. smask.fillGrayBuffer(alphaBuf);
  43288. if (sw !== width || sh !== height) {
  43289. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43290. }
  43291. } else if (mask) {
  43292. if (mask instanceof PDFImage) {
  43293. sw = mask.width;
  43294. sh = mask.height;
  43295. alphaBuf = new Uint8Array(sw * sh);
  43296. mask.numComps = 1;
  43297. mask.fillGrayBuffer(alphaBuf);
  43298. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43299. alphaBuf[i] = 255 - alphaBuf[i];
  43300. }
  43301. if (sw !== width || sh !== height) {
  43302. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43303. }
  43304. } else if (isArray(mask)) {
  43305. alphaBuf = new Uint8Array(width * height);
  43306. var numComps = this.numComps;
  43307. for (i = 0, ii = width * height; i < ii; ++i) {
  43308. var opacity = 0;
  43309. var imageOffset = i * numComps;
  43310. for (j = 0; j < numComps; ++j) {
  43311. var color = image[imageOffset + j];
  43312. var maskOffset = j * 2;
  43313. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43314. opacity = 255;
  43315. break;
  43316. }
  43317. }
  43318. alphaBuf[i] = opacity;
  43319. }
  43320. } else {
  43321. error('Unknown mask format.');
  43322. }
  43323. }
  43324. if (alphaBuf) {
  43325. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43326. rgbaBuf[j] = alphaBuf[i];
  43327. }
  43328. } else {
  43329. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43330. rgbaBuf[j] = 255;
  43331. }
  43332. }
  43333. },
  43334. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  43335. var matte = this.smask && this.smask.matte;
  43336. if (!matte) {
  43337. return;
  43338. }
  43339. var matteRgb = this.colorSpace.getRgb(matte, 0);
  43340. var matteR = matteRgb[0];
  43341. var matteG = matteRgb[1];
  43342. var matteB = matteRgb[2];
  43343. var length = width * height * 4;
  43344. var r, g, b;
  43345. for (var i = 0; i < length; i += 4) {
  43346. var alpha = buffer[i + 3];
  43347. if (alpha === 0) {
  43348. buffer[i] = 255;
  43349. buffer[i + 1] = 255;
  43350. buffer[i + 2] = 255;
  43351. continue;
  43352. }
  43353. var k = 255 / alpha;
  43354. r = (buffer[i] - matteR) * k + matteR;
  43355. g = (buffer[i + 1] - matteG) * k + matteG;
  43356. b = (buffer[i + 2] - matteB) * k + matteB;
  43357. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  43358. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  43359. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  43360. }
  43361. },
  43362. createImageData: function PDFImage_createImageData(forceRGBA) {
  43363. var drawWidth = this.drawWidth;
  43364. var drawHeight = this.drawHeight;
  43365. var imgData = {
  43366. width: drawWidth,
  43367. height: drawHeight
  43368. };
  43369. var numComps = this.numComps;
  43370. var originalWidth = this.width;
  43371. var originalHeight = this.height;
  43372. var bpc = this.bpc;
  43373. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43374. var imgArray;
  43375. if (!forceRGBA) {
  43376. var kind;
  43377. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  43378. kind = ImageKind.GRAYSCALE_1BPP;
  43379. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  43380. kind = ImageKind.RGB_24BPP;
  43381. }
  43382. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43383. imgData.kind = kind;
  43384. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43385. if (this.image instanceof DecodeStream) {
  43386. imgData.data = imgArray;
  43387. } else {
  43388. var newArray = new Uint8Array(imgArray.length);
  43389. newArray.set(imgArray);
  43390. imgData.data = newArray;
  43391. }
  43392. if (this.needsDecode) {
  43393. assert(kind === ImageKind.GRAYSCALE_1BPP);
  43394. var buffer = imgData.data;
  43395. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43396. buffer[i] ^= 0xff;
  43397. }
  43398. }
  43399. return imgData;
  43400. }
  43401. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  43402. imgData.kind = ImageKind.RGB_24BPP;
  43403. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  43404. return imgData;
  43405. }
  43406. }
  43407. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43408. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43409. var comps = this.getComponents(imgArray);
  43410. var alpha01, maybeUndoPreblend;
  43411. if (!forceRGBA && !this.smask && !this.mask) {
  43412. imgData.kind = ImageKind.RGB_24BPP;
  43413. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  43414. alpha01 = 0;
  43415. maybeUndoPreblend = false;
  43416. } else {
  43417. imgData.kind = ImageKind.RGBA_32BPP;
  43418. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  43419. alpha01 = 1;
  43420. maybeUndoPreblend = true;
  43421. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43422. }
  43423. if (this.needsDecode) {
  43424. this.decodeBuffer(comps);
  43425. }
  43426. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43427. if (maybeUndoPreblend) {
  43428. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43429. }
  43430. return imgData;
  43431. },
  43432. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  43433. var numComps = this.numComps;
  43434. if (numComps !== 1) {
  43435. error('Reading gray scale from a color image: ' + numComps);
  43436. }
  43437. var width = this.width;
  43438. var height = this.height;
  43439. var bpc = this.bpc;
  43440. var rowBytes = width * numComps * bpc + 7 >> 3;
  43441. var imgArray = this.getImageBytes(height * rowBytes);
  43442. var comps = this.getComponents(imgArray);
  43443. var i, length;
  43444. if (bpc === 1) {
  43445. length = width * height;
  43446. if (this.needsDecode) {
  43447. for (i = 0; i < length; ++i) {
  43448. buffer[i] = comps[i] - 1 & 255;
  43449. }
  43450. } else {
  43451. for (i = 0; i < length; ++i) {
  43452. buffer[i] = -comps[i] & 255;
  43453. }
  43454. }
  43455. return;
  43456. }
  43457. if (this.needsDecode) {
  43458. this.decodeBuffer(comps);
  43459. }
  43460. length = width * height;
  43461. var scale = 255 / ((1 << bpc) - 1);
  43462. for (i = 0; i < length; ++i) {
  43463. buffer[i] = scale * comps[i] | 0;
  43464. }
  43465. },
  43466. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  43467. this.image.reset();
  43468. this.image.drawWidth = drawWidth || this.width;
  43469. this.image.drawHeight = drawHeight || this.height;
  43470. this.image.forceRGB = !!forceRGB;
  43471. return this.image.getBytes(length);
  43472. }
  43473. };
  43474. return PDFImage;
  43475. }();
  43476. exports.PDFImage = PDFImage;
  43477. /***/ }),
  43478. /* 29 */
  43479. /***/ (function(module, exports, __w_pdfjs_require__) {
  43480. "use strict";
  43481. var sharedUtil = __w_pdfjs_require__(0);
  43482. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  43483. var error = sharedUtil.error;
  43484. var log2 = sharedUtil.log2;
  43485. var readInt8 = sharedUtil.readInt8;
  43486. var readUint16 = sharedUtil.readUint16;
  43487. var readUint32 = sharedUtil.readUint32;
  43488. var shadow = sharedUtil.shadow;
  43489. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  43490. var Jbig2Image = function Jbig2ImageClosure() {
  43491. function ContextCache() {
  43492. }
  43493. ContextCache.prototype = {
  43494. getContexts: function (id) {
  43495. if (id in this) {
  43496. return this[id];
  43497. }
  43498. return this[id] = new Int8Array(1 << 16);
  43499. }
  43500. };
  43501. function DecodingContext(data, start, end) {
  43502. this.data = data;
  43503. this.start = start;
  43504. this.end = end;
  43505. }
  43506. DecodingContext.prototype = {
  43507. get decoder() {
  43508. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  43509. return shadow(this, 'decoder', decoder);
  43510. },
  43511. get contextCache() {
  43512. var cache = new ContextCache();
  43513. return shadow(this, 'contextCache', cache);
  43514. }
  43515. };
  43516. function decodeInteger(contextCache, procedure, decoder) {
  43517. var contexts = contextCache.getContexts(procedure);
  43518. var prev = 1;
  43519. function readBits(length) {
  43520. var v = 0;
  43521. for (var i = 0; i < length; i++) {
  43522. var bit = decoder.readBit(contexts, prev);
  43523. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  43524. v = v << 1 | bit;
  43525. }
  43526. return v >>> 0;
  43527. }
  43528. var sign = readBits(1);
  43529. 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);
  43530. return sign === 0 ? value : value > 0 ? -value : null;
  43531. }
  43532. function decodeIAID(contextCache, decoder, codeLength) {
  43533. var contexts = contextCache.getContexts('IAID');
  43534. var prev = 1;
  43535. for (var i = 0; i < codeLength; i++) {
  43536. var bit = decoder.readBit(contexts, prev);
  43537. prev = prev << 1 | bit;
  43538. }
  43539. if (codeLength < 31) {
  43540. return prev & (1 << codeLength) - 1;
  43541. }
  43542. return prev & 0x7FFFFFFF;
  43543. }
  43544. var SegmentTypes = [
  43545. 'SymbolDictionary',
  43546. null,
  43547. null,
  43548. null,
  43549. 'IntermediateTextRegion',
  43550. null,
  43551. 'ImmediateTextRegion',
  43552. 'ImmediateLosslessTextRegion',
  43553. null,
  43554. null,
  43555. null,
  43556. null,
  43557. null,
  43558. null,
  43559. null,
  43560. null,
  43561. 'patternDictionary',
  43562. null,
  43563. null,
  43564. null,
  43565. 'IntermediateHalftoneRegion',
  43566. null,
  43567. 'ImmediateHalftoneRegion',
  43568. 'ImmediateLosslessHalftoneRegion',
  43569. null,
  43570. null,
  43571. null,
  43572. null,
  43573. null,
  43574. null,
  43575. null,
  43576. null,
  43577. null,
  43578. null,
  43579. null,
  43580. null,
  43581. 'IntermediateGenericRegion',
  43582. null,
  43583. 'ImmediateGenericRegion',
  43584. 'ImmediateLosslessGenericRegion',
  43585. 'IntermediateGenericRefinementRegion',
  43586. null,
  43587. 'ImmediateGenericRefinementRegion',
  43588. 'ImmediateLosslessGenericRefinementRegion',
  43589. null,
  43590. null,
  43591. null,
  43592. null,
  43593. 'PageInformation',
  43594. 'EndOfPage',
  43595. 'EndOfStripe',
  43596. 'EndOfFile',
  43597. 'Profiles',
  43598. 'Tables',
  43599. null,
  43600. null,
  43601. null,
  43602. null,
  43603. null,
  43604. null,
  43605. null,
  43606. null,
  43607. 'Extension'
  43608. ];
  43609. var CodingTemplates = [
  43610. [
  43611. {
  43612. x: -1,
  43613. y: -2
  43614. },
  43615. {
  43616. x: 0,
  43617. y: -2
  43618. },
  43619. {
  43620. x: 1,
  43621. y: -2
  43622. },
  43623. {
  43624. x: -2,
  43625. y: -1
  43626. },
  43627. {
  43628. x: -1,
  43629. y: -1
  43630. },
  43631. {
  43632. x: 0,
  43633. y: -1
  43634. },
  43635. {
  43636. x: 1,
  43637. y: -1
  43638. },
  43639. {
  43640. x: 2,
  43641. y: -1
  43642. },
  43643. {
  43644. x: -4,
  43645. y: 0
  43646. },
  43647. {
  43648. x: -3,
  43649. y: 0
  43650. },
  43651. {
  43652. x: -2,
  43653. y: 0
  43654. },
  43655. {
  43656. x: -1,
  43657. y: 0
  43658. }
  43659. ],
  43660. [
  43661. {
  43662. x: -1,
  43663. y: -2
  43664. },
  43665. {
  43666. x: 0,
  43667. y: -2
  43668. },
  43669. {
  43670. x: 1,
  43671. y: -2
  43672. },
  43673. {
  43674. x: 2,
  43675. y: -2
  43676. },
  43677. {
  43678. x: -2,
  43679. y: -1
  43680. },
  43681. {
  43682. x: -1,
  43683. y: -1
  43684. },
  43685. {
  43686. x: 0,
  43687. y: -1
  43688. },
  43689. {
  43690. x: 1,
  43691. y: -1
  43692. },
  43693. {
  43694. x: 2,
  43695. y: -1
  43696. },
  43697. {
  43698. x: -3,
  43699. y: 0
  43700. },
  43701. {
  43702. x: -2,
  43703. y: 0
  43704. },
  43705. {
  43706. x: -1,
  43707. y: 0
  43708. }
  43709. ],
  43710. [
  43711. {
  43712. x: -1,
  43713. y: -2
  43714. },
  43715. {
  43716. x: 0,
  43717. y: -2
  43718. },
  43719. {
  43720. x: 1,
  43721. y: -2
  43722. },
  43723. {
  43724. x: -2,
  43725. y: -1
  43726. },
  43727. {
  43728. x: -1,
  43729. y: -1
  43730. },
  43731. {
  43732. x: 0,
  43733. y: -1
  43734. },
  43735. {
  43736. x: 1,
  43737. y: -1
  43738. },
  43739. {
  43740. x: -2,
  43741. y: 0
  43742. },
  43743. {
  43744. x: -1,
  43745. y: 0
  43746. }
  43747. ],
  43748. [
  43749. {
  43750. x: -3,
  43751. y: -1
  43752. },
  43753. {
  43754. x: -2,
  43755. y: -1
  43756. },
  43757. {
  43758. x: -1,
  43759. y: -1
  43760. },
  43761. {
  43762. x: 0,
  43763. y: -1
  43764. },
  43765. {
  43766. x: 1,
  43767. y: -1
  43768. },
  43769. {
  43770. x: -4,
  43771. y: 0
  43772. },
  43773. {
  43774. x: -3,
  43775. y: 0
  43776. },
  43777. {
  43778. x: -2,
  43779. y: 0
  43780. },
  43781. {
  43782. x: -1,
  43783. y: 0
  43784. }
  43785. ]
  43786. ];
  43787. var RefinementTemplates = [
  43788. {
  43789. coding: [
  43790. {
  43791. x: 0,
  43792. y: -1
  43793. },
  43794. {
  43795. x: 1,
  43796. y: -1
  43797. },
  43798. {
  43799. x: -1,
  43800. y: 0
  43801. }
  43802. ],
  43803. reference: [
  43804. {
  43805. x: 0,
  43806. y: -1
  43807. },
  43808. {
  43809. x: 1,
  43810. y: -1
  43811. },
  43812. {
  43813. x: -1,
  43814. y: 0
  43815. },
  43816. {
  43817. x: 0,
  43818. y: 0
  43819. },
  43820. {
  43821. x: 1,
  43822. y: 0
  43823. },
  43824. {
  43825. x: -1,
  43826. y: 1
  43827. },
  43828. {
  43829. x: 0,
  43830. y: 1
  43831. },
  43832. {
  43833. x: 1,
  43834. y: 1
  43835. }
  43836. ]
  43837. },
  43838. {
  43839. coding: [
  43840. {
  43841. x: -1,
  43842. y: -1
  43843. },
  43844. {
  43845. x: 0,
  43846. y: -1
  43847. },
  43848. {
  43849. x: 1,
  43850. y: -1
  43851. },
  43852. {
  43853. x: -1,
  43854. y: 0
  43855. }
  43856. ],
  43857. reference: [
  43858. {
  43859. x: 0,
  43860. y: -1
  43861. },
  43862. {
  43863. x: -1,
  43864. y: 0
  43865. },
  43866. {
  43867. x: 0,
  43868. y: 0
  43869. },
  43870. {
  43871. x: 1,
  43872. y: 0
  43873. },
  43874. {
  43875. x: 0,
  43876. y: 1
  43877. },
  43878. {
  43879. x: 1,
  43880. y: 1
  43881. }
  43882. ]
  43883. }
  43884. ];
  43885. var ReusedContexts = [
  43886. 0x9B25,
  43887. 0x0795,
  43888. 0x00E5,
  43889. 0x0195
  43890. ];
  43891. var RefinementReusedContexts = [
  43892. 0x0020,
  43893. 0x0008
  43894. ];
  43895. function decodeBitmapTemplate0(width, height, decodingContext) {
  43896. var decoder = decodingContext.decoder;
  43897. var contexts = decodingContext.contextCache.getContexts('GB');
  43898. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43899. var OLD_PIXEL_MASK = 0x7BF7;
  43900. for (i = 0; i < height; i++) {
  43901. row = bitmap[i] = new Uint8Array(width);
  43902. row1 = i < 1 ? row : bitmap[i - 1];
  43903. row2 = i < 2 ? row : bitmap[i - 2];
  43904. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43905. for (j = 0; j < width; j++) {
  43906. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43907. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43908. }
  43909. }
  43910. return bitmap;
  43911. }
  43912. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43913. if (mmr) {
  43914. error('JBIG2 error: MMR encoding is not supported');
  43915. }
  43916. 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) {
  43917. return decodeBitmapTemplate0(width, height, decodingContext);
  43918. }
  43919. var useskip = !!skip;
  43920. var template = CodingTemplates[templateIndex].concat(at);
  43921. template.sort(function (a, b) {
  43922. return a.y - b.y || a.x - b.x;
  43923. });
  43924. var templateLength = template.length;
  43925. var templateX = new Int8Array(templateLength);
  43926. var templateY = new Int8Array(templateLength);
  43927. var changingTemplateEntries = [];
  43928. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43929. var c, k;
  43930. for (k = 0; k < templateLength; k++) {
  43931. templateX[k] = template[k].x;
  43932. templateY[k] = template[k].y;
  43933. minX = Math.min(minX, template[k].x);
  43934. maxX = Math.max(maxX, template[k].x);
  43935. minY = Math.min(minY, template[k].y);
  43936. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43937. reuseMask |= 1 << templateLength - 1 - k;
  43938. } else {
  43939. changingTemplateEntries.push(k);
  43940. }
  43941. }
  43942. var changingEntriesLength = changingTemplateEntries.length;
  43943. var changingTemplateX = new Int8Array(changingEntriesLength);
  43944. var changingTemplateY = new Int8Array(changingEntriesLength);
  43945. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43946. for (c = 0; c < changingEntriesLength; c++) {
  43947. k = changingTemplateEntries[c];
  43948. changingTemplateX[c] = template[k].x;
  43949. changingTemplateY[c] = template[k].y;
  43950. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43951. }
  43952. var sbb_left = -minX;
  43953. var sbb_top = -minY;
  43954. var sbb_right = width - maxX;
  43955. var pseudoPixelContext = ReusedContexts[templateIndex];
  43956. var row = new Uint8Array(width);
  43957. var bitmap = [];
  43958. var decoder = decodingContext.decoder;
  43959. var contexts = decodingContext.contextCache.getContexts('GB');
  43960. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43961. for (var i = 0; i < height; i++) {
  43962. if (prediction) {
  43963. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43964. ltp ^= sltp;
  43965. if (ltp) {
  43966. bitmap.push(row);
  43967. continue;
  43968. }
  43969. }
  43970. row = new Uint8Array(row);
  43971. bitmap.push(row);
  43972. for (j = 0; j < width; j++) {
  43973. if (useskip && skip[i][j]) {
  43974. row[j] = 0;
  43975. continue;
  43976. }
  43977. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43978. contextLabel = contextLabel << 1 & reuseMask;
  43979. for (k = 0; k < changingEntriesLength; k++) {
  43980. i0 = i + changingTemplateY[k];
  43981. j0 = j + changingTemplateX[k];
  43982. bit = bitmap[i0][j0];
  43983. if (bit) {
  43984. bit = changingTemplateBit[k];
  43985. contextLabel |= bit;
  43986. }
  43987. }
  43988. } else {
  43989. contextLabel = 0;
  43990. shift = templateLength - 1;
  43991. for (k = 0; k < templateLength; k++, shift--) {
  43992. j0 = j + templateX[k];
  43993. if (j0 >= 0 && j0 < width) {
  43994. i0 = i + templateY[k];
  43995. if (i0 >= 0) {
  43996. bit = bitmap[i0][j0];
  43997. if (bit) {
  43998. contextLabel |= bit << shift;
  43999. }
  44000. }
  44001. }
  44002. }
  44003. }
  44004. var pixel = decoder.readBit(contexts, contextLabel);
  44005. row[j] = pixel;
  44006. }
  44007. }
  44008. return bitmap;
  44009. }
  44010. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  44011. var codingTemplate = RefinementTemplates[templateIndex].coding;
  44012. if (templateIndex === 0) {
  44013. codingTemplate = codingTemplate.concat([at[0]]);
  44014. }
  44015. var codingTemplateLength = codingTemplate.length;
  44016. var codingTemplateX = new Int32Array(codingTemplateLength);
  44017. var codingTemplateY = new Int32Array(codingTemplateLength);
  44018. var k;
  44019. for (k = 0; k < codingTemplateLength; k++) {
  44020. codingTemplateX[k] = codingTemplate[k].x;
  44021. codingTemplateY[k] = codingTemplate[k].y;
  44022. }
  44023. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  44024. if (templateIndex === 0) {
  44025. referenceTemplate = referenceTemplate.concat([at[1]]);
  44026. }
  44027. var referenceTemplateLength = referenceTemplate.length;
  44028. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  44029. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  44030. for (k = 0; k < referenceTemplateLength; k++) {
  44031. referenceTemplateX[k] = referenceTemplate[k].x;
  44032. referenceTemplateY[k] = referenceTemplate[k].y;
  44033. }
  44034. var referenceWidth = referenceBitmap[0].length;
  44035. var referenceHeight = referenceBitmap.length;
  44036. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  44037. var bitmap = [];
  44038. var decoder = decodingContext.decoder;
  44039. var contexts = decodingContext.contextCache.getContexts('GR');
  44040. var ltp = 0;
  44041. for (var i = 0; i < height; i++) {
  44042. if (prediction) {
  44043. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  44044. ltp ^= sltp;
  44045. if (ltp) {
  44046. error('JBIG2 error: prediction is not supported');
  44047. }
  44048. }
  44049. var row = new Uint8Array(width);
  44050. bitmap.push(row);
  44051. for (var j = 0; j < width; j++) {
  44052. var i0, j0;
  44053. var contextLabel = 0;
  44054. for (k = 0; k < codingTemplateLength; k++) {
  44055. i0 = i + codingTemplateY[k];
  44056. j0 = j + codingTemplateX[k];
  44057. if (i0 < 0 || j0 < 0 || j0 >= width) {
  44058. contextLabel <<= 1;
  44059. } else {
  44060. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  44061. }
  44062. }
  44063. for (k = 0; k < referenceTemplateLength; k++) {
  44064. i0 = i + referenceTemplateY[k] + offsetY;
  44065. j0 = j + referenceTemplateX[k] + offsetX;
  44066. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  44067. contextLabel <<= 1;
  44068. } else {
  44069. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  44070. }
  44071. }
  44072. var pixel = decoder.readBit(contexts, contextLabel);
  44073. row[j] = pixel;
  44074. }
  44075. }
  44076. return bitmap;
  44077. }
  44078. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  44079. if (huffman) {
  44080. error('JBIG2 error: huffman is not supported');
  44081. }
  44082. var newSymbols = [];
  44083. var currentHeight = 0;
  44084. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  44085. var decoder = decodingContext.decoder;
  44086. var contextCache = decodingContext.contextCache;
  44087. while (newSymbols.length < numberOfNewSymbols) {
  44088. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  44089. currentHeight += deltaHeight;
  44090. var currentWidth = 0;
  44091. while (true) {
  44092. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  44093. if (deltaWidth === null) {
  44094. break;
  44095. }
  44096. currentWidth += deltaWidth;
  44097. var bitmap;
  44098. if (refinement) {
  44099. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  44100. if (numberOfInstances > 1) {
  44101. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  44102. } else {
  44103. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44104. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44105. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44106. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  44107. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  44108. }
  44109. } else {
  44110. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  44111. }
  44112. newSymbols.push(bitmap);
  44113. }
  44114. }
  44115. var exportedSymbols = [];
  44116. var flags = [], currentFlag = false;
  44117. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  44118. while (flags.length < totalSymbolsLength) {
  44119. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  44120. while (runLength--) {
  44121. flags.push(currentFlag);
  44122. }
  44123. currentFlag = !currentFlag;
  44124. }
  44125. for (var i = 0, ii = symbols.length; i < ii; i++) {
  44126. if (flags[i]) {
  44127. exportedSymbols.push(symbols[i]);
  44128. }
  44129. }
  44130. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  44131. if (flags[i]) {
  44132. exportedSymbols.push(newSymbols[j]);
  44133. }
  44134. }
  44135. return exportedSymbols;
  44136. }
  44137. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  44138. if (huffman) {
  44139. error('JBIG2 error: huffman is not supported');
  44140. }
  44141. var bitmap = [];
  44142. var i, row;
  44143. for (i = 0; i < height; i++) {
  44144. row = new Uint8Array(width);
  44145. if (defaultPixelValue) {
  44146. for (var j = 0; j < width; j++) {
  44147. row[j] = defaultPixelValue;
  44148. }
  44149. }
  44150. bitmap.push(row);
  44151. }
  44152. var decoder = decodingContext.decoder;
  44153. var contextCache = decodingContext.contextCache;
  44154. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  44155. var firstS = 0;
  44156. i = 0;
  44157. while (i < numberOfSymbolInstances) {
  44158. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  44159. stripT += deltaT;
  44160. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  44161. firstS += deltaFirstS;
  44162. var currentS = firstS;
  44163. do {
  44164. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  44165. var t = stripSize * stripT + currentT;
  44166. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44167. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  44168. var symbolBitmap = inputSymbols[symbolId];
  44169. var symbolWidth = symbolBitmap[0].length;
  44170. var symbolHeight = symbolBitmap.length;
  44171. if (applyRefinement) {
  44172. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  44173. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  44174. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44175. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44176. symbolWidth += rdw;
  44177. symbolHeight += rdh;
  44178. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  44179. }
  44180. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  44181. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  44182. var s2, t2, symbolRow;
  44183. if (transposed) {
  44184. for (s2 = 0; s2 < symbolHeight; s2++) {
  44185. row = bitmap[offsetS + s2];
  44186. if (!row) {
  44187. continue;
  44188. }
  44189. symbolRow = symbolBitmap[s2];
  44190. var maxWidth = Math.min(width - offsetT, symbolWidth);
  44191. switch (combinationOperator) {
  44192. case 0:
  44193. for (t2 = 0; t2 < maxWidth; t2++) {
  44194. row[offsetT + t2] |= symbolRow[t2];
  44195. }
  44196. break;
  44197. case 2:
  44198. for (t2 = 0; t2 < maxWidth; t2++) {
  44199. row[offsetT + t2] ^= symbolRow[t2];
  44200. }
  44201. break;
  44202. default:
  44203. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44204. }
  44205. }
  44206. currentS += symbolHeight - 1;
  44207. } else {
  44208. for (t2 = 0; t2 < symbolHeight; t2++) {
  44209. row = bitmap[offsetT + t2];
  44210. if (!row) {
  44211. continue;
  44212. }
  44213. symbolRow = symbolBitmap[t2];
  44214. switch (combinationOperator) {
  44215. case 0:
  44216. for (s2 = 0; s2 < symbolWidth; s2++) {
  44217. row[offsetS + s2] |= symbolRow[s2];
  44218. }
  44219. break;
  44220. case 2:
  44221. for (s2 = 0; s2 < symbolWidth; s2++) {
  44222. row[offsetS + s2] ^= symbolRow[s2];
  44223. }
  44224. break;
  44225. default:
  44226. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44227. }
  44228. }
  44229. currentS += symbolWidth - 1;
  44230. }
  44231. i++;
  44232. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  44233. if (deltaS === null) {
  44234. break;
  44235. }
  44236. currentS += deltaS + dsOffset;
  44237. } while (true);
  44238. }
  44239. return bitmap;
  44240. }
  44241. function readSegmentHeader(data, start) {
  44242. var segmentHeader = {};
  44243. segmentHeader.number = readUint32(data, start);
  44244. var flags = data[start + 4];
  44245. var segmentType = flags & 0x3F;
  44246. if (!SegmentTypes[segmentType]) {
  44247. error('JBIG2 error: invalid segment type: ' + segmentType);
  44248. }
  44249. segmentHeader.type = segmentType;
  44250. segmentHeader.typeName = SegmentTypes[segmentType];
  44251. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  44252. var pageAssociationFieldSize = !!(flags & 0x40);
  44253. var referredFlags = data[start + 5];
  44254. var referredToCount = referredFlags >> 5 & 7;
  44255. var retainBits = [referredFlags & 31];
  44256. var position = start + 6;
  44257. if (referredFlags === 7) {
  44258. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  44259. position += 3;
  44260. var bytes = referredToCount + 7 >> 3;
  44261. retainBits[0] = data[position++];
  44262. while (--bytes > 0) {
  44263. retainBits.push(data[position++]);
  44264. }
  44265. } else if (referredFlags === 5 || referredFlags === 6) {
  44266. error('JBIG2 error: invalid referred-to flags');
  44267. }
  44268. segmentHeader.retainBits = retainBits;
  44269. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  44270. var referredTo = [];
  44271. var i, ii;
  44272. for (i = 0; i < referredToCount; i++) {
  44273. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  44274. referredTo.push(number);
  44275. position += referredToSegmentNumberSize;
  44276. }
  44277. segmentHeader.referredTo = referredTo;
  44278. if (!pageAssociationFieldSize) {
  44279. segmentHeader.pageAssociation = data[position++];
  44280. } else {
  44281. segmentHeader.pageAssociation = readUint32(data, position);
  44282. position += 4;
  44283. }
  44284. segmentHeader.length = readUint32(data, position);
  44285. position += 4;
  44286. if (segmentHeader.length === 0xFFFFFFFF) {
  44287. if (segmentType === 38) {
  44288. var genericRegionInfo = readRegionSegmentInformation(data, position);
  44289. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  44290. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  44291. var searchPatternLength = 6;
  44292. var searchPattern = new Uint8Array(searchPatternLength);
  44293. if (!genericRegionMmr) {
  44294. searchPattern[0] = 0xFF;
  44295. searchPattern[1] = 0xAC;
  44296. }
  44297. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  44298. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  44299. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  44300. searchPattern[5] = genericRegionInfo.height & 0xFF;
  44301. for (i = position, ii = data.length; i < ii; i++) {
  44302. var j = 0;
  44303. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  44304. j++;
  44305. }
  44306. if (j === searchPatternLength) {
  44307. segmentHeader.length = i + searchPatternLength;
  44308. break;
  44309. }
  44310. }
  44311. if (segmentHeader.length === 0xFFFFFFFF) {
  44312. error('JBIG2 error: segment end was not found');
  44313. }
  44314. } else {
  44315. error('JBIG2 error: invalid unknown segment length');
  44316. }
  44317. }
  44318. segmentHeader.headerEnd = position;
  44319. return segmentHeader;
  44320. }
  44321. function readSegments(header, data, start, end) {
  44322. var segments = [];
  44323. var position = start;
  44324. while (position < end) {
  44325. var segmentHeader = readSegmentHeader(data, position);
  44326. position = segmentHeader.headerEnd;
  44327. var segment = {
  44328. header: segmentHeader,
  44329. data: data
  44330. };
  44331. if (!header.randomAccess) {
  44332. segment.start = position;
  44333. position += segmentHeader.length;
  44334. segment.end = position;
  44335. }
  44336. segments.push(segment);
  44337. if (segmentHeader.type === 51) {
  44338. break;
  44339. }
  44340. }
  44341. if (header.randomAccess) {
  44342. for (var i = 0, ii = segments.length; i < ii; i++) {
  44343. segments[i].start = position;
  44344. position += segments[i].header.length;
  44345. segments[i].end = position;
  44346. }
  44347. }
  44348. return segments;
  44349. }
  44350. function readRegionSegmentInformation(data, start) {
  44351. return {
  44352. width: readUint32(data, start),
  44353. height: readUint32(data, start + 4),
  44354. x: readUint32(data, start + 8),
  44355. y: readUint32(data, start + 12),
  44356. combinationOperator: data[start + 16] & 7
  44357. };
  44358. }
  44359. var RegionSegmentInformationFieldLength = 17;
  44360. function processSegment(segment, visitor) {
  44361. var header = segment.header;
  44362. var data = segment.data, position = segment.start, end = segment.end;
  44363. var args, at, i, atLength;
  44364. switch (header.type) {
  44365. case 0:
  44366. var dictionary = {};
  44367. var dictionaryFlags = readUint16(data, position);
  44368. dictionary.huffman = !!(dictionaryFlags & 1);
  44369. dictionary.refinement = !!(dictionaryFlags & 2);
  44370. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  44371. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  44372. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  44373. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  44374. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  44375. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  44376. dictionary.template = dictionaryFlags >> 10 & 3;
  44377. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  44378. position += 2;
  44379. if (!dictionary.huffman) {
  44380. atLength = dictionary.template === 0 ? 4 : 1;
  44381. at = [];
  44382. for (i = 0; i < atLength; i++) {
  44383. at.push({
  44384. x: readInt8(data, position),
  44385. y: readInt8(data, position + 1)
  44386. });
  44387. position += 2;
  44388. }
  44389. dictionary.at = at;
  44390. }
  44391. if (dictionary.refinement && !dictionary.refinementTemplate) {
  44392. at = [];
  44393. for (i = 0; i < 2; i++) {
  44394. at.push({
  44395. x: readInt8(data, position),
  44396. y: readInt8(data, position + 1)
  44397. });
  44398. position += 2;
  44399. }
  44400. dictionary.refinementAt = at;
  44401. }
  44402. dictionary.numberOfExportedSymbols = readUint32(data, position);
  44403. position += 4;
  44404. dictionary.numberOfNewSymbols = readUint32(data, position);
  44405. position += 4;
  44406. args = [
  44407. dictionary,
  44408. header.number,
  44409. header.referredTo,
  44410. data,
  44411. position,
  44412. end
  44413. ];
  44414. break;
  44415. case 6:
  44416. case 7:
  44417. var textRegion = {};
  44418. textRegion.info = readRegionSegmentInformation(data, position);
  44419. position += RegionSegmentInformationFieldLength;
  44420. var textRegionSegmentFlags = readUint16(data, position);
  44421. position += 2;
  44422. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  44423. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  44424. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  44425. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  44426. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  44427. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  44428. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  44429. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  44430. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  44431. if (textRegion.huffman) {
  44432. var textRegionHuffmanFlags = readUint16(data, position);
  44433. position += 2;
  44434. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  44435. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  44436. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  44437. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  44438. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  44439. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  44440. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  44441. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  44442. }
  44443. if (textRegion.refinement && !textRegion.refinementTemplate) {
  44444. at = [];
  44445. for (i = 0; i < 2; i++) {
  44446. at.push({
  44447. x: readInt8(data, position),
  44448. y: readInt8(data, position + 1)
  44449. });
  44450. position += 2;
  44451. }
  44452. textRegion.refinementAt = at;
  44453. }
  44454. textRegion.numberOfSymbolInstances = readUint32(data, position);
  44455. position += 4;
  44456. if (textRegion.huffman) {
  44457. error('JBIG2 error: huffman is not supported');
  44458. }
  44459. args = [
  44460. textRegion,
  44461. header.referredTo,
  44462. data,
  44463. position,
  44464. end
  44465. ];
  44466. break;
  44467. case 38:
  44468. case 39:
  44469. var genericRegion = {};
  44470. genericRegion.info = readRegionSegmentInformation(data, position);
  44471. position += RegionSegmentInformationFieldLength;
  44472. var genericRegionSegmentFlags = data[position++];
  44473. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  44474. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  44475. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  44476. if (!genericRegion.mmr) {
  44477. atLength = genericRegion.template === 0 ? 4 : 1;
  44478. at = [];
  44479. for (i = 0; i < atLength; i++) {
  44480. at.push({
  44481. x: readInt8(data, position),
  44482. y: readInt8(data, position + 1)
  44483. });
  44484. position += 2;
  44485. }
  44486. genericRegion.at = at;
  44487. }
  44488. args = [
  44489. genericRegion,
  44490. data,
  44491. position,
  44492. end
  44493. ];
  44494. break;
  44495. case 48:
  44496. var pageInfo = {
  44497. width: readUint32(data, position),
  44498. height: readUint32(data, position + 4),
  44499. resolutionX: readUint32(data, position + 8),
  44500. resolutionY: readUint32(data, position + 12)
  44501. };
  44502. if (pageInfo.height === 0xFFFFFFFF) {
  44503. delete pageInfo.height;
  44504. }
  44505. var pageSegmentFlags = data[position + 16];
  44506. readUint16(data, position + 17);
  44507. pageInfo.lossless = !!(pageSegmentFlags & 1);
  44508. pageInfo.refinement = !!(pageSegmentFlags & 2);
  44509. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  44510. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  44511. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  44512. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  44513. args = [pageInfo];
  44514. break;
  44515. case 49:
  44516. break;
  44517. case 50:
  44518. break;
  44519. case 51:
  44520. break;
  44521. case 62:
  44522. break;
  44523. default:
  44524. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  44525. }
  44526. var callbackName = 'on' + header.typeName;
  44527. if (callbackName in visitor) {
  44528. visitor[callbackName].apply(visitor, args);
  44529. }
  44530. }
  44531. function processSegments(segments, visitor) {
  44532. for (var i = 0, ii = segments.length; i < ii; i++) {
  44533. processSegment(segments[i], visitor);
  44534. }
  44535. }
  44536. function parseJbig2(data, start, end) {
  44537. var position = start;
  44538. 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) {
  44539. error('JBIG2 error: invalid header');
  44540. }
  44541. var header = {};
  44542. position += 8;
  44543. var flags = data[position++];
  44544. header.randomAccess = !(flags & 1);
  44545. if (!(flags & 2)) {
  44546. header.numberOfPages = readUint32(data, position);
  44547. position += 4;
  44548. }
  44549. readSegments(header, data, position, end);
  44550. error('Not implemented');
  44551. }
  44552. function parseJbig2Chunks(chunks) {
  44553. var visitor = new SimpleSegmentVisitor();
  44554. for (var i = 0, ii = chunks.length; i < ii; i++) {
  44555. var chunk = chunks[i];
  44556. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  44557. processSegments(segments, visitor);
  44558. }
  44559. return visitor.buffer;
  44560. }
  44561. function SimpleSegmentVisitor() {
  44562. }
  44563. SimpleSegmentVisitor.prototype = {
  44564. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  44565. this.currentPageInfo = info;
  44566. var rowSize = info.width + 7 >> 3;
  44567. var buffer = new Uint8Array(rowSize * info.height);
  44568. if (info.defaultPixelValue) {
  44569. for (var i = 0, ii = buffer.length; i < ii; i++) {
  44570. buffer[i] = 0xFF;
  44571. }
  44572. }
  44573. this.buffer = buffer;
  44574. },
  44575. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  44576. var pageInfo = this.currentPageInfo;
  44577. var width = regionInfo.width, height = regionInfo.height;
  44578. var rowSize = pageInfo.width + 7 >> 3;
  44579. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  44580. var buffer = this.buffer;
  44581. var mask0 = 128 >> (regionInfo.x & 7);
  44582. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  44583. var i, j, mask, offset;
  44584. switch (combinationOperator) {
  44585. case 0:
  44586. for (i = 0; i < height; i++) {
  44587. mask = mask0;
  44588. offset = offset0;
  44589. for (j = 0; j < width; j++) {
  44590. if (bitmap[i][j]) {
  44591. buffer[offset] |= mask;
  44592. }
  44593. mask >>= 1;
  44594. if (!mask) {
  44595. mask = 128;
  44596. offset++;
  44597. }
  44598. }
  44599. offset0 += rowSize;
  44600. }
  44601. break;
  44602. case 2:
  44603. for (i = 0; i < height; i++) {
  44604. mask = mask0;
  44605. offset = offset0;
  44606. for (j = 0; j < width; j++) {
  44607. if (bitmap[i][j]) {
  44608. buffer[offset] ^= mask;
  44609. }
  44610. mask >>= 1;
  44611. if (!mask) {
  44612. mask = 128;
  44613. offset++;
  44614. }
  44615. }
  44616. offset0 += rowSize;
  44617. }
  44618. break;
  44619. default:
  44620. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44621. }
  44622. },
  44623. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  44624. var regionInfo = region.info;
  44625. var decodingContext = new DecodingContext(data, start, end);
  44626. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  44627. this.drawBitmap(regionInfo, bitmap);
  44628. },
  44629. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  44630. this.onImmediateGenericRegion.apply(this, arguments);
  44631. },
  44632. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  44633. var huffmanTables;
  44634. if (dictionary.huffman) {
  44635. error('JBIG2 error: huffman is not supported');
  44636. }
  44637. var symbols = this.symbols;
  44638. if (!symbols) {
  44639. this.symbols = symbols = {};
  44640. }
  44641. var inputSymbols = [];
  44642. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44643. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44644. }
  44645. var decodingContext = new DecodingContext(data, start, end);
  44646. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  44647. },
  44648. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  44649. var regionInfo = region.info;
  44650. var huffmanTables;
  44651. var symbols = this.symbols;
  44652. var inputSymbols = [];
  44653. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44654. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44655. }
  44656. var symbolCodeLength = log2(inputSymbols.length);
  44657. var decodingContext = new DecodingContext(data, start, end);
  44658. 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);
  44659. this.drawBitmap(regionInfo, bitmap);
  44660. },
  44661. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  44662. this.onImmediateTextRegion.apply(this, arguments);
  44663. }
  44664. };
  44665. function Jbig2Image() {
  44666. }
  44667. Jbig2Image.prototype = {
  44668. parseChunks: function Jbig2Image_parseChunks(chunks) {
  44669. return parseJbig2Chunks(chunks);
  44670. }
  44671. };
  44672. return Jbig2Image;
  44673. }();
  44674. exports.Jbig2Image = Jbig2Image;
  44675. /***/ }),
  44676. /* 30 */
  44677. /***/ (function(module, exports, __w_pdfjs_require__) {
  44678. "use strict";
  44679. var sharedUtil = __w_pdfjs_require__(0);
  44680. var error = sharedUtil.error;
  44681. var JpegImage = function JpegImageClosure() {
  44682. var dctZigZag = new Uint8Array([
  44683. 0,
  44684. 1,
  44685. 8,
  44686. 16,
  44687. 9,
  44688. 2,
  44689. 3,
  44690. 10,
  44691. 17,
  44692. 24,
  44693. 32,
  44694. 25,
  44695. 18,
  44696. 11,
  44697. 4,
  44698. 5,
  44699. 12,
  44700. 19,
  44701. 26,
  44702. 33,
  44703. 40,
  44704. 48,
  44705. 41,
  44706. 34,
  44707. 27,
  44708. 20,
  44709. 13,
  44710. 6,
  44711. 7,
  44712. 14,
  44713. 21,
  44714. 28,
  44715. 35,
  44716. 42,
  44717. 49,
  44718. 56,
  44719. 57,
  44720. 50,
  44721. 43,
  44722. 36,
  44723. 29,
  44724. 22,
  44725. 15,
  44726. 23,
  44727. 30,
  44728. 37,
  44729. 44,
  44730. 51,
  44731. 58,
  44732. 59,
  44733. 52,
  44734. 45,
  44735. 38,
  44736. 31,
  44737. 39,
  44738. 46,
  44739. 53,
  44740. 60,
  44741. 61,
  44742. 54,
  44743. 47,
  44744. 55,
  44745. 62,
  44746. 63
  44747. ]);
  44748. var dctCos1 = 4017;
  44749. var dctSin1 = 799;
  44750. var dctCos3 = 3406;
  44751. var dctSin3 = 2276;
  44752. var dctCos6 = 1567;
  44753. var dctSin6 = 3784;
  44754. var dctSqrt2 = 5793;
  44755. var dctSqrt1d2 = 2896;
  44756. function JpegImage() {
  44757. this.decodeTransform = null;
  44758. this.colorTransform = -1;
  44759. }
  44760. function buildHuffmanTable(codeLengths, values) {
  44761. var k = 0, code = [], i, j, length = 16;
  44762. while (length > 0 && !codeLengths[length - 1]) {
  44763. length--;
  44764. }
  44765. code.push({
  44766. children: [],
  44767. index: 0
  44768. });
  44769. var p = code[0], q;
  44770. for (i = 0; i < length; i++) {
  44771. for (j = 0; j < codeLengths[i]; j++) {
  44772. p = code.pop();
  44773. p.children[p.index] = values[k];
  44774. while (p.index > 0) {
  44775. p = code.pop();
  44776. }
  44777. p.index++;
  44778. code.push(p);
  44779. while (code.length <= i) {
  44780. code.push(q = {
  44781. children: [],
  44782. index: 0
  44783. });
  44784. p.children[p.index] = q.children;
  44785. p = q;
  44786. }
  44787. k++;
  44788. }
  44789. if (i + 1 < length) {
  44790. code.push(q = {
  44791. children: [],
  44792. index: 0
  44793. });
  44794. p.children[p.index] = q.children;
  44795. p = q;
  44796. }
  44797. }
  44798. return code[0].children;
  44799. }
  44800. function getBlockBufferOffset(component, row, col) {
  44801. return 64 * ((component.blocksPerLine + 1) * row + col);
  44802. }
  44803. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  44804. var mcusPerLine = frame.mcusPerLine;
  44805. var progressive = frame.progressive;
  44806. var startOffset = offset, bitsData = 0, bitsCount = 0;
  44807. function readBit() {
  44808. if (bitsCount > 0) {
  44809. bitsCount--;
  44810. return bitsData >> bitsCount & 1;
  44811. }
  44812. bitsData = data[offset++];
  44813. if (bitsData === 0xFF) {
  44814. var nextByte = data[offset++];
  44815. if (nextByte) {
  44816. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  44817. }
  44818. }
  44819. bitsCount = 7;
  44820. return bitsData >>> 7;
  44821. }
  44822. function decodeHuffman(tree) {
  44823. var node = tree;
  44824. while (true) {
  44825. node = node[readBit()];
  44826. if (typeof node === 'number') {
  44827. return node;
  44828. }
  44829. if (typeof node !== 'object') {
  44830. error('JPEG error: invalid huffman sequence');
  44831. }
  44832. }
  44833. }
  44834. function receive(length) {
  44835. var n = 0;
  44836. while (length > 0) {
  44837. n = n << 1 | readBit();
  44838. length--;
  44839. }
  44840. return n;
  44841. }
  44842. function receiveAndExtend(length) {
  44843. if (length === 1) {
  44844. return readBit() === 1 ? 1 : -1;
  44845. }
  44846. var n = receive(length);
  44847. if (n >= 1 << length - 1) {
  44848. return n;
  44849. }
  44850. return n + (-1 << length) + 1;
  44851. }
  44852. function decodeBaseline(component, offset) {
  44853. var t = decodeHuffman(component.huffmanTableDC);
  44854. var diff = t === 0 ? 0 : receiveAndExtend(t);
  44855. component.blockData[offset] = component.pred += diff;
  44856. var k = 1;
  44857. while (k < 64) {
  44858. var rs = decodeHuffman(component.huffmanTableAC);
  44859. var s = rs & 15, r = rs >> 4;
  44860. if (s === 0) {
  44861. if (r < 15) {
  44862. break;
  44863. }
  44864. k += 16;
  44865. continue;
  44866. }
  44867. k += r;
  44868. var z = dctZigZag[k];
  44869. component.blockData[offset + z] = receiveAndExtend(s);
  44870. k++;
  44871. }
  44872. }
  44873. function decodeDCFirst(component, offset) {
  44874. var t = decodeHuffman(component.huffmanTableDC);
  44875. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44876. component.blockData[offset] = component.pred += diff;
  44877. }
  44878. function decodeDCSuccessive(component, offset) {
  44879. component.blockData[offset] |= readBit() << successive;
  44880. }
  44881. var eobrun = 0;
  44882. function decodeACFirst(component, offset) {
  44883. if (eobrun > 0) {
  44884. eobrun--;
  44885. return;
  44886. }
  44887. var k = spectralStart, e = spectralEnd;
  44888. while (k <= e) {
  44889. var rs = decodeHuffman(component.huffmanTableAC);
  44890. var s = rs & 15, r = rs >> 4;
  44891. if (s === 0) {
  44892. if (r < 15) {
  44893. eobrun = receive(r) + (1 << r) - 1;
  44894. break;
  44895. }
  44896. k += 16;
  44897. continue;
  44898. }
  44899. k += r;
  44900. var z = dctZigZag[k];
  44901. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44902. k++;
  44903. }
  44904. }
  44905. var successiveACState = 0, successiveACNextValue;
  44906. function decodeACSuccessive(component, offset) {
  44907. var k = spectralStart;
  44908. var e = spectralEnd;
  44909. var r = 0;
  44910. var s;
  44911. var rs;
  44912. while (k <= e) {
  44913. var z = dctZigZag[k];
  44914. switch (successiveACState) {
  44915. case 0:
  44916. rs = decodeHuffman(component.huffmanTableAC);
  44917. s = rs & 15;
  44918. r = rs >> 4;
  44919. if (s === 0) {
  44920. if (r < 15) {
  44921. eobrun = receive(r) + (1 << r);
  44922. successiveACState = 4;
  44923. } else {
  44924. r = 16;
  44925. successiveACState = 1;
  44926. }
  44927. } else {
  44928. if (s !== 1) {
  44929. error('JPEG error: invalid ACn encoding');
  44930. }
  44931. successiveACNextValue = receiveAndExtend(s);
  44932. successiveACState = r ? 2 : 3;
  44933. }
  44934. continue;
  44935. case 1:
  44936. case 2:
  44937. if (component.blockData[offset + z]) {
  44938. component.blockData[offset + z] += readBit() << successive;
  44939. } else {
  44940. r--;
  44941. if (r === 0) {
  44942. successiveACState = successiveACState === 2 ? 3 : 0;
  44943. }
  44944. }
  44945. break;
  44946. case 3:
  44947. if (component.blockData[offset + z]) {
  44948. component.blockData[offset + z] += readBit() << successive;
  44949. } else {
  44950. component.blockData[offset + z] = successiveACNextValue << successive;
  44951. successiveACState = 0;
  44952. }
  44953. break;
  44954. case 4:
  44955. if (component.blockData[offset + z]) {
  44956. component.blockData[offset + z] += readBit() << successive;
  44957. }
  44958. break;
  44959. }
  44960. k++;
  44961. }
  44962. if (successiveACState === 4) {
  44963. eobrun--;
  44964. if (eobrun === 0) {
  44965. successiveACState = 0;
  44966. }
  44967. }
  44968. }
  44969. function decodeMcu(component, decode, mcu, row, col) {
  44970. var mcuRow = mcu / mcusPerLine | 0;
  44971. var mcuCol = mcu % mcusPerLine;
  44972. var blockRow = mcuRow * component.v + row;
  44973. var blockCol = mcuCol * component.h + col;
  44974. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44975. decode(component, offset);
  44976. }
  44977. function decodeBlock(component, decode, mcu) {
  44978. var blockRow = mcu / component.blocksPerLine | 0;
  44979. var blockCol = mcu % component.blocksPerLine;
  44980. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44981. decode(component, offset);
  44982. }
  44983. var componentsLength = components.length;
  44984. var component, i, j, k, n;
  44985. var decodeFn;
  44986. if (progressive) {
  44987. if (spectralStart === 0) {
  44988. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44989. } else {
  44990. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44991. }
  44992. } else {
  44993. decodeFn = decodeBaseline;
  44994. }
  44995. var mcu = 0, marker;
  44996. var mcuExpected;
  44997. if (componentsLength === 1) {
  44998. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44999. } else {
  45000. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  45001. }
  45002. if (!resetInterval) {
  45003. resetInterval = mcuExpected;
  45004. }
  45005. var h, v;
  45006. while (mcu < mcuExpected) {
  45007. for (i = 0; i < componentsLength; i++) {
  45008. components[i].pred = 0;
  45009. }
  45010. eobrun = 0;
  45011. if (componentsLength === 1) {
  45012. component = components[0];
  45013. for (n = 0; n < resetInterval; n++) {
  45014. decodeBlock(component, decodeFn, mcu);
  45015. mcu++;
  45016. }
  45017. } else {
  45018. for (n = 0; n < resetInterval; n++) {
  45019. for (i = 0; i < componentsLength; i++) {
  45020. component = components[i];
  45021. h = component.h;
  45022. v = component.v;
  45023. for (j = 0; j < v; j++) {
  45024. for (k = 0; k < h; k++) {
  45025. decodeMcu(component, decodeFn, mcu, j, k);
  45026. }
  45027. }
  45028. }
  45029. mcu++;
  45030. }
  45031. }
  45032. bitsCount = 0;
  45033. marker = data[offset] << 8 | data[offset + 1];
  45034. while (data[offset] === 0x00 && offset < data.length - 1) {
  45035. offset++;
  45036. marker = data[offset] << 8 | data[offset + 1];
  45037. }
  45038. if (marker <= 0xFF00) {
  45039. error('JPEG error: marker was not found');
  45040. }
  45041. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  45042. offset += 2;
  45043. } else {
  45044. break;
  45045. }
  45046. }
  45047. return offset - startOffset;
  45048. }
  45049. function quantizeAndInverse(component, blockBufferOffset, p) {
  45050. var qt = component.quantizationTable, blockData = component.blockData;
  45051. var v0, v1, v2, v3, v4, v5, v6, v7;
  45052. var p0, p1, p2, p3, p4, p5, p6, p7;
  45053. var t;
  45054. if (!qt) {
  45055. error('JPEG error: missing required Quantization Table.');
  45056. }
  45057. for (var row = 0; row < 64; row += 8) {
  45058. p0 = blockData[blockBufferOffset + row];
  45059. p1 = blockData[blockBufferOffset + row + 1];
  45060. p2 = blockData[blockBufferOffset + row + 2];
  45061. p3 = blockData[blockBufferOffset + row + 3];
  45062. p4 = blockData[blockBufferOffset + row + 4];
  45063. p5 = blockData[blockBufferOffset + row + 5];
  45064. p6 = blockData[blockBufferOffset + row + 6];
  45065. p7 = blockData[blockBufferOffset + row + 7];
  45066. p0 *= qt[row];
  45067. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45068. t = dctSqrt2 * p0 + 512 >> 10;
  45069. p[row] = t;
  45070. p[row + 1] = t;
  45071. p[row + 2] = t;
  45072. p[row + 3] = t;
  45073. p[row + 4] = t;
  45074. p[row + 5] = t;
  45075. p[row + 6] = t;
  45076. p[row + 7] = t;
  45077. continue;
  45078. }
  45079. p1 *= qt[row + 1];
  45080. p2 *= qt[row + 2];
  45081. p3 *= qt[row + 3];
  45082. p4 *= qt[row + 4];
  45083. p5 *= qt[row + 5];
  45084. p6 *= qt[row + 6];
  45085. p7 *= qt[row + 7];
  45086. v0 = dctSqrt2 * p0 + 128 >> 8;
  45087. v1 = dctSqrt2 * p4 + 128 >> 8;
  45088. v2 = p2;
  45089. v3 = p6;
  45090. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  45091. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  45092. v5 = p3 << 4;
  45093. v6 = p5 << 4;
  45094. v0 = v0 + v1 + 1 >> 1;
  45095. v1 = v0 - v1;
  45096. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  45097. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  45098. v3 = t;
  45099. v4 = v4 + v6 + 1 >> 1;
  45100. v6 = v4 - v6;
  45101. v7 = v7 + v5 + 1 >> 1;
  45102. v5 = v7 - v5;
  45103. v0 = v0 + v3 + 1 >> 1;
  45104. v3 = v0 - v3;
  45105. v1 = v1 + v2 + 1 >> 1;
  45106. v2 = v1 - v2;
  45107. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45108. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45109. v7 = t;
  45110. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45111. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45112. v6 = t;
  45113. p[row] = v0 + v7;
  45114. p[row + 7] = v0 - v7;
  45115. p[row + 1] = v1 + v6;
  45116. p[row + 6] = v1 - v6;
  45117. p[row + 2] = v2 + v5;
  45118. p[row + 5] = v2 - v5;
  45119. p[row + 3] = v3 + v4;
  45120. p[row + 4] = v3 - v4;
  45121. }
  45122. for (var col = 0; col < 8; ++col) {
  45123. p0 = p[col];
  45124. p1 = p[col + 8];
  45125. p2 = p[col + 16];
  45126. p3 = p[col + 24];
  45127. p4 = p[col + 32];
  45128. p5 = p[col + 40];
  45129. p6 = p[col + 48];
  45130. p7 = p[col + 56];
  45131. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45132. t = dctSqrt2 * p0 + 8192 >> 14;
  45133. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  45134. blockData[blockBufferOffset + col] = t;
  45135. blockData[blockBufferOffset + col + 8] = t;
  45136. blockData[blockBufferOffset + col + 16] = t;
  45137. blockData[blockBufferOffset + col + 24] = t;
  45138. blockData[blockBufferOffset + col + 32] = t;
  45139. blockData[blockBufferOffset + col + 40] = t;
  45140. blockData[blockBufferOffset + col + 48] = t;
  45141. blockData[blockBufferOffset + col + 56] = t;
  45142. continue;
  45143. }
  45144. v0 = dctSqrt2 * p0 + 2048 >> 12;
  45145. v1 = dctSqrt2 * p4 + 2048 >> 12;
  45146. v2 = p2;
  45147. v3 = p6;
  45148. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  45149. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  45150. v5 = p3;
  45151. v6 = p5;
  45152. v0 = (v0 + v1 + 1 >> 1) + 4112;
  45153. v1 = v0 - v1;
  45154. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  45155. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  45156. v3 = t;
  45157. v4 = v4 + v6 + 1 >> 1;
  45158. v6 = v4 - v6;
  45159. v7 = v7 + v5 + 1 >> 1;
  45160. v5 = v7 - v5;
  45161. v0 = v0 + v3 + 1 >> 1;
  45162. v3 = v0 - v3;
  45163. v1 = v1 + v2 + 1 >> 1;
  45164. v2 = v1 - v2;
  45165. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45166. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45167. v7 = t;
  45168. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45169. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45170. v6 = t;
  45171. p0 = v0 + v7;
  45172. p7 = v0 - v7;
  45173. p1 = v1 + v6;
  45174. p6 = v1 - v6;
  45175. p2 = v2 + v5;
  45176. p5 = v2 - v5;
  45177. p3 = v3 + v4;
  45178. p4 = v3 - v4;
  45179. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  45180. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  45181. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  45182. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  45183. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  45184. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  45185. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  45186. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  45187. blockData[blockBufferOffset + col] = p0;
  45188. blockData[blockBufferOffset + col + 8] = p1;
  45189. blockData[blockBufferOffset + col + 16] = p2;
  45190. blockData[blockBufferOffset + col + 24] = p3;
  45191. blockData[blockBufferOffset + col + 32] = p4;
  45192. blockData[blockBufferOffset + col + 40] = p5;
  45193. blockData[blockBufferOffset + col + 48] = p6;
  45194. blockData[blockBufferOffset + col + 56] = p7;
  45195. }
  45196. }
  45197. function buildComponentData(frame, component) {
  45198. var blocksPerLine = component.blocksPerLine;
  45199. var blocksPerColumn = component.blocksPerColumn;
  45200. var computationBuffer = new Int16Array(64);
  45201. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  45202. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  45203. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  45204. quantizeAndInverse(component, offset, computationBuffer);
  45205. }
  45206. }
  45207. return component.blockData;
  45208. }
  45209. function clamp0to255(a) {
  45210. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  45211. }
  45212. JpegImage.prototype = {
  45213. parse: function parse(data) {
  45214. function readUint16() {
  45215. var value = data[offset] << 8 | data[offset + 1];
  45216. offset += 2;
  45217. return value;
  45218. }
  45219. function readDataBlock() {
  45220. var length = readUint16();
  45221. var array = data.subarray(offset, offset + length - 2);
  45222. offset += array.length;
  45223. return array;
  45224. }
  45225. function prepareComponents(frame) {
  45226. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  45227. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  45228. for (var i = 0; i < frame.components.length; i++) {
  45229. component = frame.components[i];
  45230. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  45231. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  45232. var blocksPerLineForMcu = mcusPerLine * component.h;
  45233. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  45234. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  45235. component.blockData = new Int16Array(blocksBufferSize);
  45236. component.blocksPerLine = blocksPerLine;
  45237. component.blocksPerColumn = blocksPerColumn;
  45238. }
  45239. frame.mcusPerLine = mcusPerLine;
  45240. frame.mcusPerColumn = mcusPerColumn;
  45241. }
  45242. var offset = 0;
  45243. var jfif = null;
  45244. var adobe = null;
  45245. var frame, resetInterval;
  45246. var quantizationTables = [];
  45247. var huffmanTablesAC = [], huffmanTablesDC = [];
  45248. var fileMarker = readUint16();
  45249. if (fileMarker !== 0xFFD8) {
  45250. error('JPEG error: SOI not found');
  45251. }
  45252. fileMarker = readUint16();
  45253. while (fileMarker !== 0xFFD9) {
  45254. var i, j, l;
  45255. switch (fileMarker) {
  45256. case 0xFFE0:
  45257. case 0xFFE1:
  45258. case 0xFFE2:
  45259. case 0xFFE3:
  45260. case 0xFFE4:
  45261. case 0xFFE5:
  45262. case 0xFFE6:
  45263. case 0xFFE7:
  45264. case 0xFFE8:
  45265. case 0xFFE9:
  45266. case 0xFFEA:
  45267. case 0xFFEB:
  45268. case 0xFFEC:
  45269. case 0xFFED:
  45270. case 0xFFEE:
  45271. case 0xFFEF:
  45272. case 0xFFFE:
  45273. var appData = readDataBlock();
  45274. if (fileMarker === 0xFFE0) {
  45275. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  45276. jfif = {
  45277. version: {
  45278. major: appData[5],
  45279. minor: appData[6]
  45280. },
  45281. densityUnits: appData[7],
  45282. xDensity: appData[8] << 8 | appData[9],
  45283. yDensity: appData[10] << 8 | appData[11],
  45284. thumbWidth: appData[12],
  45285. thumbHeight: appData[13],
  45286. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  45287. };
  45288. }
  45289. }
  45290. if (fileMarker === 0xFFEE) {
  45291. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  45292. adobe = {
  45293. version: appData[5] << 8 | appData[6],
  45294. flags0: appData[7] << 8 | appData[8],
  45295. flags1: appData[9] << 8 | appData[10],
  45296. transformCode: appData[11]
  45297. };
  45298. }
  45299. }
  45300. break;
  45301. case 0xFFDB:
  45302. var quantizationTablesLength = readUint16();
  45303. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  45304. var z;
  45305. while (offset < quantizationTablesEnd) {
  45306. var quantizationTableSpec = data[offset++];
  45307. var tableData = new Uint16Array(64);
  45308. if (quantizationTableSpec >> 4 === 0) {
  45309. for (j = 0; j < 64; j++) {
  45310. z = dctZigZag[j];
  45311. tableData[z] = data[offset++];
  45312. }
  45313. } else if (quantizationTableSpec >> 4 === 1) {
  45314. for (j = 0; j < 64; j++) {
  45315. z = dctZigZag[j];
  45316. tableData[z] = readUint16();
  45317. }
  45318. } else {
  45319. error('JPEG error: DQT - invalid table spec');
  45320. }
  45321. quantizationTables[quantizationTableSpec & 15] = tableData;
  45322. }
  45323. break;
  45324. case 0xFFC0:
  45325. case 0xFFC1:
  45326. case 0xFFC2:
  45327. if (frame) {
  45328. error('JPEG error: Only single frame JPEGs supported');
  45329. }
  45330. readUint16();
  45331. frame = {};
  45332. frame.extended = fileMarker === 0xFFC1;
  45333. frame.progressive = fileMarker === 0xFFC2;
  45334. frame.precision = data[offset++];
  45335. frame.scanLines = readUint16();
  45336. frame.samplesPerLine = readUint16();
  45337. frame.components = [];
  45338. frame.componentIds = {};
  45339. var componentsCount = data[offset++], componentId;
  45340. var maxH = 0, maxV = 0;
  45341. for (i = 0; i < componentsCount; i++) {
  45342. componentId = data[offset];
  45343. var h = data[offset + 1] >> 4;
  45344. var v = data[offset + 1] & 15;
  45345. if (maxH < h) {
  45346. maxH = h;
  45347. }
  45348. if (maxV < v) {
  45349. maxV = v;
  45350. }
  45351. var qId = data[offset + 2];
  45352. l = frame.components.push({
  45353. h: h,
  45354. v: v,
  45355. quantizationId: qId,
  45356. quantizationTable: null
  45357. });
  45358. frame.componentIds[componentId] = l - 1;
  45359. offset += 3;
  45360. }
  45361. frame.maxH = maxH;
  45362. frame.maxV = maxV;
  45363. prepareComponents(frame);
  45364. break;
  45365. case 0xFFC4:
  45366. var huffmanLength = readUint16();
  45367. for (i = 2; i < huffmanLength;) {
  45368. var huffmanTableSpec = data[offset++];
  45369. var codeLengths = new Uint8Array(16);
  45370. var codeLengthSum = 0;
  45371. for (j = 0; j < 16; j++, offset++) {
  45372. codeLengthSum += codeLengths[j] = data[offset];
  45373. }
  45374. var huffmanValues = new Uint8Array(codeLengthSum);
  45375. for (j = 0; j < codeLengthSum; j++, offset++) {
  45376. huffmanValues[j] = data[offset];
  45377. }
  45378. i += 17 + codeLengthSum;
  45379. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  45380. }
  45381. break;
  45382. case 0xFFDD:
  45383. readUint16();
  45384. resetInterval = readUint16();
  45385. break;
  45386. case 0xFFDA:
  45387. readUint16();
  45388. var selectorsCount = data[offset++];
  45389. var components = [], component;
  45390. for (i = 0; i < selectorsCount; i++) {
  45391. var componentIndex = frame.componentIds[data[offset++]];
  45392. component = frame.components[componentIndex];
  45393. var tableSpec = data[offset++];
  45394. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  45395. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  45396. components.push(component);
  45397. }
  45398. var spectralStart = data[offset++];
  45399. var spectralEnd = data[offset++];
  45400. var successiveApproximation = data[offset++];
  45401. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  45402. offset += processed;
  45403. break;
  45404. case 0xFFFF:
  45405. if (data[offset] !== 0xFF) {
  45406. offset--;
  45407. }
  45408. break;
  45409. default:
  45410. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  45411. offset -= 3;
  45412. break;
  45413. }
  45414. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  45415. }
  45416. fileMarker = readUint16();
  45417. }
  45418. this.width = frame.samplesPerLine;
  45419. this.height = frame.scanLines;
  45420. this.jfif = jfif;
  45421. this.adobe = adobe;
  45422. this.components = [];
  45423. for (i = 0; i < frame.components.length; i++) {
  45424. component = frame.components[i];
  45425. var quantizationTable = quantizationTables[component.quantizationId];
  45426. if (quantizationTable) {
  45427. component.quantizationTable = quantizationTable;
  45428. }
  45429. this.components.push({
  45430. output: buildComponentData(frame, component),
  45431. scaleX: component.h / frame.maxH,
  45432. scaleY: component.v / frame.maxV,
  45433. blocksPerLine: component.blocksPerLine,
  45434. blocksPerColumn: component.blocksPerColumn
  45435. });
  45436. }
  45437. this.numComponents = this.components.length;
  45438. },
  45439. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  45440. var scaleX = this.width / width, scaleY = this.height / height;
  45441. var component, componentScaleX, componentScaleY, blocksPerScanline;
  45442. var x, y, i, j, k;
  45443. var index;
  45444. var offset = 0;
  45445. var output;
  45446. var numComponents = this.components.length;
  45447. var dataLength = width * height * numComponents;
  45448. var data = new Uint8Array(dataLength);
  45449. var xScaleBlockOffset = new Uint32Array(width);
  45450. var mask3LSB = 0xfffffff8;
  45451. for (i = 0; i < numComponents; i++) {
  45452. component = this.components[i];
  45453. componentScaleX = component.scaleX * scaleX;
  45454. componentScaleY = component.scaleY * scaleY;
  45455. offset = i;
  45456. output = component.output;
  45457. blocksPerScanline = component.blocksPerLine + 1 << 3;
  45458. for (x = 0; x < width; x++) {
  45459. j = 0 | x * componentScaleX;
  45460. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  45461. }
  45462. for (y = 0; y < height; y++) {
  45463. j = 0 | y * componentScaleY;
  45464. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  45465. for (x = 0; x < width; x++) {
  45466. data[offset] = output[index + xScaleBlockOffset[x]];
  45467. offset += numComponents;
  45468. }
  45469. }
  45470. }
  45471. var transform = this.decodeTransform;
  45472. if (transform) {
  45473. for (i = 0; i < dataLength;) {
  45474. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  45475. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  45476. }
  45477. }
  45478. }
  45479. return data;
  45480. },
  45481. _isColorConversionNeeded: function isColorConversionNeeded() {
  45482. if (this.adobe && this.adobe.transformCode) {
  45483. return true;
  45484. } else if (this.numComponents === 3) {
  45485. if (!this.adobe && this.colorTransform === 0) {
  45486. return false;
  45487. }
  45488. return true;
  45489. }
  45490. if (!this.adobe && this.colorTransform === 1) {
  45491. return true;
  45492. }
  45493. return false;
  45494. },
  45495. _convertYccToRgb: function convertYccToRgb(data) {
  45496. var Y, Cb, Cr;
  45497. for (var i = 0, length = data.length; i < length; i += 3) {
  45498. Y = data[i];
  45499. Cb = data[i + 1];
  45500. Cr = data[i + 2];
  45501. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  45502. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  45503. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  45504. }
  45505. return data;
  45506. },
  45507. _convertYcckToRgb: function convertYcckToRgb(data) {
  45508. var Y, Cb, Cr, k;
  45509. var offset = 0;
  45510. for (var i = 0, length = data.length; i < length; i += 4) {
  45511. Y = data[i];
  45512. Cb = data[i + 1];
  45513. Cr = data[i + 2];
  45514. k = data[i + 3];
  45515. 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);
  45516. 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);
  45517. 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);
  45518. data[offset++] = clamp0to255(r);
  45519. data[offset++] = clamp0to255(g);
  45520. data[offset++] = clamp0to255(b);
  45521. }
  45522. return data;
  45523. },
  45524. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  45525. var Y, Cb, Cr;
  45526. for (var i = 0, length = data.length; i < length; i += 4) {
  45527. Y = data[i];
  45528. Cb = data[i + 1];
  45529. Cr = data[i + 2];
  45530. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  45531. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  45532. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  45533. }
  45534. return data;
  45535. },
  45536. _convertCmykToRgb: function convertCmykToRgb(data) {
  45537. var c, m, y, k;
  45538. var offset = 0;
  45539. var min = -255 * 255 * 255;
  45540. var scale = 1 / 255 / 255;
  45541. for (var i = 0, length = data.length; i < length; i += 4) {
  45542. c = data[i];
  45543. m = data[i + 1];
  45544. y = data[i + 2];
  45545. k = data[i + 3];
  45546. 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);
  45547. 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);
  45548. 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);
  45549. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  45550. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  45551. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  45552. }
  45553. return data;
  45554. },
  45555. getData: function getData(width, height, forceRGBoutput) {
  45556. if (this.numComponents > 4) {
  45557. error('JPEG error: Unsupported color mode');
  45558. }
  45559. var data = this._getLinearizedBlockData(width, height);
  45560. if (this.numComponents === 1 && forceRGBoutput) {
  45561. var dataLength = data.length;
  45562. var rgbData = new Uint8Array(dataLength * 3);
  45563. var offset = 0;
  45564. for (var i = 0; i < dataLength; i++) {
  45565. var grayColor = data[i];
  45566. rgbData[offset++] = grayColor;
  45567. rgbData[offset++] = grayColor;
  45568. rgbData[offset++] = grayColor;
  45569. }
  45570. return rgbData;
  45571. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  45572. return this._convertYccToRgb(data);
  45573. } else if (this.numComponents === 4) {
  45574. if (this._isColorConversionNeeded()) {
  45575. if (forceRGBoutput) {
  45576. return this._convertYcckToRgb(data);
  45577. }
  45578. return this._convertYcckToCmyk(data);
  45579. } else if (forceRGBoutput) {
  45580. return this._convertCmykToRgb(data);
  45581. }
  45582. }
  45583. return data;
  45584. }
  45585. };
  45586. return JpegImage;
  45587. }();
  45588. exports.JpegImage = JpegImage;
  45589. /***/ }),
  45590. /* 31 */
  45591. /***/ (function(module, exports, __w_pdfjs_require__) {
  45592. "use strict";
  45593. var sharedUtil = __w_pdfjs_require__(0);
  45594. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  45595. var getMetrics = getLookupTableFactory(function (t) {
  45596. t['Courier'] = 600;
  45597. t['Courier-Bold'] = 600;
  45598. t['Courier-BoldOblique'] = 600;
  45599. t['Courier-Oblique'] = 600;
  45600. t['Helvetica'] = getLookupTableFactory(function (t) {
  45601. t['space'] = 278;
  45602. t['exclam'] = 278;
  45603. t['quotedbl'] = 355;
  45604. t['numbersign'] = 556;
  45605. t['dollar'] = 556;
  45606. t['percent'] = 889;
  45607. t['ampersand'] = 667;
  45608. t['quoteright'] = 222;
  45609. t['parenleft'] = 333;
  45610. t['parenright'] = 333;
  45611. t['asterisk'] = 389;
  45612. t['plus'] = 584;
  45613. t['comma'] = 278;
  45614. t['hyphen'] = 333;
  45615. t['period'] = 278;
  45616. t['slash'] = 278;
  45617. t['zero'] = 556;
  45618. t['one'] = 556;
  45619. t['two'] = 556;
  45620. t['three'] = 556;
  45621. t['four'] = 556;
  45622. t['five'] = 556;
  45623. t['six'] = 556;
  45624. t['seven'] = 556;
  45625. t['eight'] = 556;
  45626. t['nine'] = 556;
  45627. t['colon'] = 278;
  45628. t['semicolon'] = 278;
  45629. t['less'] = 584;
  45630. t['equal'] = 584;
  45631. t['greater'] = 584;
  45632. t['question'] = 556;
  45633. t['at'] = 1015;
  45634. t['A'] = 667;
  45635. t['B'] = 667;
  45636. t['C'] = 722;
  45637. t['D'] = 722;
  45638. t['E'] = 667;
  45639. t['F'] = 611;
  45640. t['G'] = 778;
  45641. t['H'] = 722;
  45642. t['I'] = 278;
  45643. t['J'] = 500;
  45644. t['K'] = 667;
  45645. t['L'] = 556;
  45646. t['M'] = 833;
  45647. t['N'] = 722;
  45648. t['O'] = 778;
  45649. t['P'] = 667;
  45650. t['Q'] = 778;
  45651. t['R'] = 722;
  45652. t['S'] = 667;
  45653. t['T'] = 611;
  45654. t['U'] = 722;
  45655. t['V'] = 667;
  45656. t['W'] = 944;
  45657. t['X'] = 667;
  45658. t['Y'] = 667;
  45659. t['Z'] = 611;
  45660. t['bracketleft'] = 278;
  45661. t['backslash'] = 278;
  45662. t['bracketright'] = 278;
  45663. t['asciicircum'] = 469;
  45664. t['underscore'] = 556;
  45665. t['quoteleft'] = 222;
  45666. t['a'] = 556;
  45667. t['b'] = 556;
  45668. t['c'] = 500;
  45669. t['d'] = 556;
  45670. t['e'] = 556;
  45671. t['f'] = 278;
  45672. t['g'] = 556;
  45673. t['h'] = 556;
  45674. t['i'] = 222;
  45675. t['j'] = 222;
  45676. t['k'] = 500;
  45677. t['l'] = 222;
  45678. t['m'] = 833;
  45679. t['n'] = 556;
  45680. t['o'] = 556;
  45681. t['p'] = 556;
  45682. t['q'] = 556;
  45683. t['r'] = 333;
  45684. t['s'] = 500;
  45685. t['t'] = 278;
  45686. t['u'] = 556;
  45687. t['v'] = 500;
  45688. t['w'] = 722;
  45689. t['x'] = 500;
  45690. t['y'] = 500;
  45691. t['z'] = 500;
  45692. t['braceleft'] = 334;
  45693. t['bar'] = 260;
  45694. t['braceright'] = 334;
  45695. t['asciitilde'] = 584;
  45696. t['exclamdown'] = 333;
  45697. t['cent'] = 556;
  45698. t['sterling'] = 556;
  45699. t['fraction'] = 167;
  45700. t['yen'] = 556;
  45701. t['florin'] = 556;
  45702. t['section'] = 556;
  45703. t['currency'] = 556;
  45704. t['quotesingle'] = 191;
  45705. t['quotedblleft'] = 333;
  45706. t['guillemotleft'] = 556;
  45707. t['guilsinglleft'] = 333;
  45708. t['guilsinglright'] = 333;
  45709. t['fi'] = 500;
  45710. t['fl'] = 500;
  45711. t['endash'] = 556;
  45712. t['dagger'] = 556;
  45713. t['daggerdbl'] = 556;
  45714. t['periodcentered'] = 278;
  45715. t['paragraph'] = 537;
  45716. t['bullet'] = 350;
  45717. t['quotesinglbase'] = 222;
  45718. t['quotedblbase'] = 333;
  45719. t['quotedblright'] = 333;
  45720. t['guillemotright'] = 556;
  45721. t['ellipsis'] = 1000;
  45722. t['perthousand'] = 1000;
  45723. t['questiondown'] = 611;
  45724. t['grave'] = 333;
  45725. t['acute'] = 333;
  45726. t['circumflex'] = 333;
  45727. t['tilde'] = 333;
  45728. t['macron'] = 333;
  45729. t['breve'] = 333;
  45730. t['dotaccent'] = 333;
  45731. t['dieresis'] = 333;
  45732. t['ring'] = 333;
  45733. t['cedilla'] = 333;
  45734. t['hungarumlaut'] = 333;
  45735. t['ogonek'] = 333;
  45736. t['caron'] = 333;
  45737. t['emdash'] = 1000;
  45738. t['AE'] = 1000;
  45739. t['ordfeminine'] = 370;
  45740. t['Lslash'] = 556;
  45741. t['Oslash'] = 778;
  45742. t['OE'] = 1000;
  45743. t['ordmasculine'] = 365;
  45744. t['ae'] = 889;
  45745. t['dotlessi'] = 278;
  45746. t['lslash'] = 222;
  45747. t['oslash'] = 611;
  45748. t['oe'] = 944;
  45749. t['germandbls'] = 611;
  45750. t['Idieresis'] = 278;
  45751. t['eacute'] = 556;
  45752. t['abreve'] = 556;
  45753. t['uhungarumlaut'] = 556;
  45754. t['ecaron'] = 556;
  45755. t['Ydieresis'] = 667;
  45756. t['divide'] = 584;
  45757. t['Yacute'] = 667;
  45758. t['Acircumflex'] = 667;
  45759. t['aacute'] = 556;
  45760. t['Ucircumflex'] = 722;
  45761. t['yacute'] = 500;
  45762. t['scommaaccent'] = 500;
  45763. t['ecircumflex'] = 556;
  45764. t['Uring'] = 722;
  45765. t['Udieresis'] = 722;
  45766. t['aogonek'] = 556;
  45767. t['Uacute'] = 722;
  45768. t['uogonek'] = 556;
  45769. t['Edieresis'] = 667;
  45770. t['Dcroat'] = 722;
  45771. t['commaaccent'] = 250;
  45772. t['copyright'] = 737;
  45773. t['Emacron'] = 667;
  45774. t['ccaron'] = 500;
  45775. t['aring'] = 556;
  45776. t['Ncommaaccent'] = 722;
  45777. t['lacute'] = 222;
  45778. t['agrave'] = 556;
  45779. t['Tcommaaccent'] = 611;
  45780. t['Cacute'] = 722;
  45781. t['atilde'] = 556;
  45782. t['Edotaccent'] = 667;
  45783. t['scaron'] = 500;
  45784. t['scedilla'] = 500;
  45785. t['iacute'] = 278;
  45786. t['lozenge'] = 471;
  45787. t['Rcaron'] = 722;
  45788. t['Gcommaaccent'] = 778;
  45789. t['ucircumflex'] = 556;
  45790. t['acircumflex'] = 556;
  45791. t['Amacron'] = 667;
  45792. t['rcaron'] = 333;
  45793. t['ccedilla'] = 500;
  45794. t['Zdotaccent'] = 611;
  45795. t['Thorn'] = 667;
  45796. t['Omacron'] = 778;
  45797. t['Racute'] = 722;
  45798. t['Sacute'] = 667;
  45799. t['dcaron'] = 643;
  45800. t['Umacron'] = 722;
  45801. t['uring'] = 556;
  45802. t['threesuperior'] = 333;
  45803. t['Ograve'] = 778;
  45804. t['Agrave'] = 667;
  45805. t['Abreve'] = 667;
  45806. t['multiply'] = 584;
  45807. t['uacute'] = 556;
  45808. t['Tcaron'] = 611;
  45809. t['partialdiff'] = 476;
  45810. t['ydieresis'] = 500;
  45811. t['Nacute'] = 722;
  45812. t['icircumflex'] = 278;
  45813. t['Ecircumflex'] = 667;
  45814. t['adieresis'] = 556;
  45815. t['edieresis'] = 556;
  45816. t['cacute'] = 500;
  45817. t['nacute'] = 556;
  45818. t['umacron'] = 556;
  45819. t['Ncaron'] = 722;
  45820. t['Iacute'] = 278;
  45821. t['plusminus'] = 584;
  45822. t['brokenbar'] = 260;
  45823. t['registered'] = 737;
  45824. t['Gbreve'] = 778;
  45825. t['Idotaccent'] = 278;
  45826. t['summation'] = 600;
  45827. t['Egrave'] = 667;
  45828. t['racute'] = 333;
  45829. t['omacron'] = 556;
  45830. t['Zacute'] = 611;
  45831. t['Zcaron'] = 611;
  45832. t['greaterequal'] = 549;
  45833. t['Eth'] = 722;
  45834. t['Ccedilla'] = 722;
  45835. t['lcommaaccent'] = 222;
  45836. t['tcaron'] = 317;
  45837. t['eogonek'] = 556;
  45838. t['Uogonek'] = 722;
  45839. t['Aacute'] = 667;
  45840. t['Adieresis'] = 667;
  45841. t['egrave'] = 556;
  45842. t['zacute'] = 500;
  45843. t['iogonek'] = 222;
  45844. t['Oacute'] = 778;
  45845. t['oacute'] = 556;
  45846. t['amacron'] = 556;
  45847. t['sacute'] = 500;
  45848. t['idieresis'] = 278;
  45849. t['Ocircumflex'] = 778;
  45850. t['Ugrave'] = 722;
  45851. t['Delta'] = 612;
  45852. t['thorn'] = 556;
  45853. t['twosuperior'] = 333;
  45854. t['Odieresis'] = 778;
  45855. t['mu'] = 556;
  45856. t['igrave'] = 278;
  45857. t['ohungarumlaut'] = 556;
  45858. t['Eogonek'] = 667;
  45859. t['dcroat'] = 556;
  45860. t['threequarters'] = 834;
  45861. t['Scedilla'] = 667;
  45862. t['lcaron'] = 299;
  45863. t['Kcommaaccent'] = 667;
  45864. t['Lacute'] = 556;
  45865. t['trademark'] = 1000;
  45866. t['edotaccent'] = 556;
  45867. t['Igrave'] = 278;
  45868. t['Imacron'] = 278;
  45869. t['Lcaron'] = 556;
  45870. t['onehalf'] = 834;
  45871. t['lessequal'] = 549;
  45872. t['ocircumflex'] = 556;
  45873. t['ntilde'] = 556;
  45874. t['Uhungarumlaut'] = 722;
  45875. t['Eacute'] = 667;
  45876. t['emacron'] = 556;
  45877. t['gbreve'] = 556;
  45878. t['onequarter'] = 834;
  45879. t['Scaron'] = 667;
  45880. t['Scommaaccent'] = 667;
  45881. t['Ohungarumlaut'] = 778;
  45882. t['degree'] = 400;
  45883. t['ograve'] = 556;
  45884. t['Ccaron'] = 722;
  45885. t['ugrave'] = 556;
  45886. t['radical'] = 453;
  45887. t['Dcaron'] = 722;
  45888. t['rcommaaccent'] = 333;
  45889. t['Ntilde'] = 722;
  45890. t['otilde'] = 556;
  45891. t['Rcommaaccent'] = 722;
  45892. t['Lcommaaccent'] = 556;
  45893. t['Atilde'] = 667;
  45894. t['Aogonek'] = 667;
  45895. t['Aring'] = 667;
  45896. t['Otilde'] = 778;
  45897. t['zdotaccent'] = 500;
  45898. t['Ecaron'] = 667;
  45899. t['Iogonek'] = 278;
  45900. t['kcommaaccent'] = 500;
  45901. t['minus'] = 584;
  45902. t['Icircumflex'] = 278;
  45903. t['ncaron'] = 556;
  45904. t['tcommaaccent'] = 278;
  45905. t['logicalnot'] = 584;
  45906. t['odieresis'] = 556;
  45907. t['udieresis'] = 556;
  45908. t['notequal'] = 549;
  45909. t['gcommaaccent'] = 556;
  45910. t['eth'] = 556;
  45911. t['zcaron'] = 500;
  45912. t['ncommaaccent'] = 556;
  45913. t['onesuperior'] = 333;
  45914. t['imacron'] = 278;
  45915. t['Euro'] = 556;
  45916. });
  45917. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45918. t['space'] = 278;
  45919. t['exclam'] = 333;
  45920. t['quotedbl'] = 474;
  45921. t['numbersign'] = 556;
  45922. t['dollar'] = 556;
  45923. t['percent'] = 889;
  45924. t['ampersand'] = 722;
  45925. t['quoteright'] = 278;
  45926. t['parenleft'] = 333;
  45927. t['parenright'] = 333;
  45928. t['asterisk'] = 389;
  45929. t['plus'] = 584;
  45930. t['comma'] = 278;
  45931. t['hyphen'] = 333;
  45932. t['period'] = 278;
  45933. t['slash'] = 278;
  45934. t['zero'] = 556;
  45935. t['one'] = 556;
  45936. t['two'] = 556;
  45937. t['three'] = 556;
  45938. t['four'] = 556;
  45939. t['five'] = 556;
  45940. t['six'] = 556;
  45941. t['seven'] = 556;
  45942. t['eight'] = 556;
  45943. t['nine'] = 556;
  45944. t['colon'] = 333;
  45945. t['semicolon'] = 333;
  45946. t['less'] = 584;
  45947. t['equal'] = 584;
  45948. t['greater'] = 584;
  45949. t['question'] = 611;
  45950. t['at'] = 975;
  45951. t['A'] = 722;
  45952. t['B'] = 722;
  45953. t['C'] = 722;
  45954. t['D'] = 722;
  45955. t['E'] = 667;
  45956. t['F'] = 611;
  45957. t['G'] = 778;
  45958. t['H'] = 722;
  45959. t['I'] = 278;
  45960. t['J'] = 556;
  45961. t['K'] = 722;
  45962. t['L'] = 611;
  45963. t['M'] = 833;
  45964. t['N'] = 722;
  45965. t['O'] = 778;
  45966. t['P'] = 667;
  45967. t['Q'] = 778;
  45968. t['R'] = 722;
  45969. t['S'] = 667;
  45970. t['T'] = 611;
  45971. t['U'] = 722;
  45972. t['V'] = 667;
  45973. t['W'] = 944;
  45974. t['X'] = 667;
  45975. t['Y'] = 667;
  45976. t['Z'] = 611;
  45977. t['bracketleft'] = 333;
  45978. t['backslash'] = 278;
  45979. t['bracketright'] = 333;
  45980. t['asciicircum'] = 584;
  45981. t['underscore'] = 556;
  45982. t['quoteleft'] = 278;
  45983. t['a'] = 556;
  45984. t['b'] = 611;
  45985. t['c'] = 556;
  45986. t['d'] = 611;
  45987. t['e'] = 556;
  45988. t['f'] = 333;
  45989. t['g'] = 611;
  45990. t['h'] = 611;
  45991. t['i'] = 278;
  45992. t['j'] = 278;
  45993. t['k'] = 556;
  45994. t['l'] = 278;
  45995. t['m'] = 889;
  45996. t['n'] = 611;
  45997. t['o'] = 611;
  45998. t['p'] = 611;
  45999. t['q'] = 611;
  46000. t['r'] = 389;
  46001. t['s'] = 556;
  46002. t['t'] = 333;
  46003. t['u'] = 611;
  46004. t['v'] = 556;
  46005. t['w'] = 778;
  46006. t['x'] = 556;
  46007. t['y'] = 556;
  46008. t['z'] = 500;
  46009. t['braceleft'] = 389;
  46010. t['bar'] = 280;
  46011. t['braceright'] = 389;
  46012. t['asciitilde'] = 584;
  46013. t['exclamdown'] = 333;
  46014. t['cent'] = 556;
  46015. t['sterling'] = 556;
  46016. t['fraction'] = 167;
  46017. t['yen'] = 556;
  46018. t['florin'] = 556;
  46019. t['section'] = 556;
  46020. t['currency'] = 556;
  46021. t['quotesingle'] = 238;
  46022. t['quotedblleft'] = 500;
  46023. t['guillemotleft'] = 556;
  46024. t['guilsinglleft'] = 333;
  46025. t['guilsinglright'] = 333;
  46026. t['fi'] = 611;
  46027. t['fl'] = 611;
  46028. t['endash'] = 556;
  46029. t['dagger'] = 556;
  46030. t['daggerdbl'] = 556;
  46031. t['periodcentered'] = 278;
  46032. t['paragraph'] = 556;
  46033. t['bullet'] = 350;
  46034. t['quotesinglbase'] = 278;
  46035. t['quotedblbase'] = 500;
  46036. t['quotedblright'] = 500;
  46037. t['guillemotright'] = 556;
  46038. t['ellipsis'] = 1000;
  46039. t['perthousand'] = 1000;
  46040. t['questiondown'] = 611;
  46041. t['grave'] = 333;
  46042. t['acute'] = 333;
  46043. t['circumflex'] = 333;
  46044. t['tilde'] = 333;
  46045. t['macron'] = 333;
  46046. t['breve'] = 333;
  46047. t['dotaccent'] = 333;
  46048. t['dieresis'] = 333;
  46049. t['ring'] = 333;
  46050. t['cedilla'] = 333;
  46051. t['hungarumlaut'] = 333;
  46052. t['ogonek'] = 333;
  46053. t['caron'] = 333;
  46054. t['emdash'] = 1000;
  46055. t['AE'] = 1000;
  46056. t['ordfeminine'] = 370;
  46057. t['Lslash'] = 611;
  46058. t['Oslash'] = 778;
  46059. t['OE'] = 1000;
  46060. t['ordmasculine'] = 365;
  46061. t['ae'] = 889;
  46062. t['dotlessi'] = 278;
  46063. t['lslash'] = 278;
  46064. t['oslash'] = 611;
  46065. t['oe'] = 944;
  46066. t['germandbls'] = 611;
  46067. t['Idieresis'] = 278;
  46068. t['eacute'] = 556;
  46069. t['abreve'] = 556;
  46070. t['uhungarumlaut'] = 611;
  46071. t['ecaron'] = 556;
  46072. t['Ydieresis'] = 667;
  46073. t['divide'] = 584;
  46074. t['Yacute'] = 667;
  46075. t['Acircumflex'] = 722;
  46076. t['aacute'] = 556;
  46077. t['Ucircumflex'] = 722;
  46078. t['yacute'] = 556;
  46079. t['scommaaccent'] = 556;
  46080. t['ecircumflex'] = 556;
  46081. t['Uring'] = 722;
  46082. t['Udieresis'] = 722;
  46083. t['aogonek'] = 556;
  46084. t['Uacute'] = 722;
  46085. t['uogonek'] = 611;
  46086. t['Edieresis'] = 667;
  46087. t['Dcroat'] = 722;
  46088. t['commaaccent'] = 250;
  46089. t['copyright'] = 737;
  46090. t['Emacron'] = 667;
  46091. t['ccaron'] = 556;
  46092. t['aring'] = 556;
  46093. t['Ncommaaccent'] = 722;
  46094. t['lacute'] = 278;
  46095. t['agrave'] = 556;
  46096. t['Tcommaaccent'] = 611;
  46097. t['Cacute'] = 722;
  46098. t['atilde'] = 556;
  46099. t['Edotaccent'] = 667;
  46100. t['scaron'] = 556;
  46101. t['scedilla'] = 556;
  46102. t['iacute'] = 278;
  46103. t['lozenge'] = 494;
  46104. t['Rcaron'] = 722;
  46105. t['Gcommaaccent'] = 778;
  46106. t['ucircumflex'] = 611;
  46107. t['acircumflex'] = 556;
  46108. t['Amacron'] = 722;
  46109. t['rcaron'] = 389;
  46110. t['ccedilla'] = 556;
  46111. t['Zdotaccent'] = 611;
  46112. t['Thorn'] = 667;
  46113. t['Omacron'] = 778;
  46114. t['Racute'] = 722;
  46115. t['Sacute'] = 667;
  46116. t['dcaron'] = 743;
  46117. t['Umacron'] = 722;
  46118. t['uring'] = 611;
  46119. t['threesuperior'] = 333;
  46120. t['Ograve'] = 778;
  46121. t['Agrave'] = 722;
  46122. t['Abreve'] = 722;
  46123. t['multiply'] = 584;
  46124. t['uacute'] = 611;
  46125. t['Tcaron'] = 611;
  46126. t['partialdiff'] = 494;
  46127. t['ydieresis'] = 556;
  46128. t['Nacute'] = 722;
  46129. t['icircumflex'] = 278;
  46130. t['Ecircumflex'] = 667;
  46131. t['adieresis'] = 556;
  46132. t['edieresis'] = 556;
  46133. t['cacute'] = 556;
  46134. t['nacute'] = 611;
  46135. t['umacron'] = 611;
  46136. t['Ncaron'] = 722;
  46137. t['Iacute'] = 278;
  46138. t['plusminus'] = 584;
  46139. t['brokenbar'] = 280;
  46140. t['registered'] = 737;
  46141. t['Gbreve'] = 778;
  46142. t['Idotaccent'] = 278;
  46143. t['summation'] = 600;
  46144. t['Egrave'] = 667;
  46145. t['racute'] = 389;
  46146. t['omacron'] = 611;
  46147. t['Zacute'] = 611;
  46148. t['Zcaron'] = 611;
  46149. t['greaterequal'] = 549;
  46150. t['Eth'] = 722;
  46151. t['Ccedilla'] = 722;
  46152. t['lcommaaccent'] = 278;
  46153. t['tcaron'] = 389;
  46154. t['eogonek'] = 556;
  46155. t['Uogonek'] = 722;
  46156. t['Aacute'] = 722;
  46157. t['Adieresis'] = 722;
  46158. t['egrave'] = 556;
  46159. t['zacute'] = 500;
  46160. t['iogonek'] = 278;
  46161. t['Oacute'] = 778;
  46162. t['oacute'] = 611;
  46163. t['amacron'] = 556;
  46164. t['sacute'] = 556;
  46165. t['idieresis'] = 278;
  46166. t['Ocircumflex'] = 778;
  46167. t['Ugrave'] = 722;
  46168. t['Delta'] = 612;
  46169. t['thorn'] = 611;
  46170. t['twosuperior'] = 333;
  46171. t['Odieresis'] = 778;
  46172. t['mu'] = 611;
  46173. t['igrave'] = 278;
  46174. t['ohungarumlaut'] = 611;
  46175. t['Eogonek'] = 667;
  46176. t['dcroat'] = 611;
  46177. t['threequarters'] = 834;
  46178. t['Scedilla'] = 667;
  46179. t['lcaron'] = 400;
  46180. t['Kcommaaccent'] = 722;
  46181. t['Lacute'] = 611;
  46182. t['trademark'] = 1000;
  46183. t['edotaccent'] = 556;
  46184. t['Igrave'] = 278;
  46185. t['Imacron'] = 278;
  46186. t['Lcaron'] = 611;
  46187. t['onehalf'] = 834;
  46188. t['lessequal'] = 549;
  46189. t['ocircumflex'] = 611;
  46190. t['ntilde'] = 611;
  46191. t['Uhungarumlaut'] = 722;
  46192. t['Eacute'] = 667;
  46193. t['emacron'] = 556;
  46194. t['gbreve'] = 611;
  46195. t['onequarter'] = 834;
  46196. t['Scaron'] = 667;
  46197. t['Scommaaccent'] = 667;
  46198. t['Ohungarumlaut'] = 778;
  46199. t['degree'] = 400;
  46200. t['ograve'] = 611;
  46201. t['Ccaron'] = 722;
  46202. t['ugrave'] = 611;
  46203. t['radical'] = 549;
  46204. t['Dcaron'] = 722;
  46205. t['rcommaaccent'] = 389;
  46206. t['Ntilde'] = 722;
  46207. t['otilde'] = 611;
  46208. t['Rcommaaccent'] = 722;
  46209. t['Lcommaaccent'] = 611;
  46210. t['Atilde'] = 722;
  46211. t['Aogonek'] = 722;
  46212. t['Aring'] = 722;
  46213. t['Otilde'] = 778;
  46214. t['zdotaccent'] = 500;
  46215. t['Ecaron'] = 667;
  46216. t['Iogonek'] = 278;
  46217. t['kcommaaccent'] = 556;
  46218. t['minus'] = 584;
  46219. t['Icircumflex'] = 278;
  46220. t['ncaron'] = 611;
  46221. t['tcommaaccent'] = 333;
  46222. t['logicalnot'] = 584;
  46223. t['odieresis'] = 611;
  46224. t['udieresis'] = 611;
  46225. t['notequal'] = 549;
  46226. t['gcommaaccent'] = 611;
  46227. t['eth'] = 611;
  46228. t['zcaron'] = 500;
  46229. t['ncommaaccent'] = 611;
  46230. t['onesuperior'] = 333;
  46231. t['imacron'] = 278;
  46232. t['Euro'] = 556;
  46233. });
  46234. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  46235. t['space'] = 278;
  46236. t['exclam'] = 333;
  46237. t['quotedbl'] = 474;
  46238. t['numbersign'] = 556;
  46239. t['dollar'] = 556;
  46240. t['percent'] = 889;
  46241. t['ampersand'] = 722;
  46242. t['quoteright'] = 278;
  46243. t['parenleft'] = 333;
  46244. t['parenright'] = 333;
  46245. t['asterisk'] = 389;
  46246. t['plus'] = 584;
  46247. t['comma'] = 278;
  46248. t['hyphen'] = 333;
  46249. t['period'] = 278;
  46250. t['slash'] = 278;
  46251. t['zero'] = 556;
  46252. t['one'] = 556;
  46253. t['two'] = 556;
  46254. t['three'] = 556;
  46255. t['four'] = 556;
  46256. t['five'] = 556;
  46257. t['six'] = 556;
  46258. t['seven'] = 556;
  46259. t['eight'] = 556;
  46260. t['nine'] = 556;
  46261. t['colon'] = 333;
  46262. t['semicolon'] = 333;
  46263. t['less'] = 584;
  46264. t['equal'] = 584;
  46265. t['greater'] = 584;
  46266. t['question'] = 611;
  46267. t['at'] = 975;
  46268. t['A'] = 722;
  46269. t['B'] = 722;
  46270. t['C'] = 722;
  46271. t['D'] = 722;
  46272. t['E'] = 667;
  46273. t['F'] = 611;
  46274. t['G'] = 778;
  46275. t['H'] = 722;
  46276. t['I'] = 278;
  46277. t['J'] = 556;
  46278. t['K'] = 722;
  46279. t['L'] = 611;
  46280. t['M'] = 833;
  46281. t['N'] = 722;
  46282. t['O'] = 778;
  46283. t['P'] = 667;
  46284. t['Q'] = 778;
  46285. t['R'] = 722;
  46286. t['S'] = 667;
  46287. t['T'] = 611;
  46288. t['U'] = 722;
  46289. t['V'] = 667;
  46290. t['W'] = 944;
  46291. t['X'] = 667;
  46292. t['Y'] = 667;
  46293. t['Z'] = 611;
  46294. t['bracketleft'] = 333;
  46295. t['backslash'] = 278;
  46296. t['bracketright'] = 333;
  46297. t['asciicircum'] = 584;
  46298. t['underscore'] = 556;
  46299. t['quoteleft'] = 278;
  46300. t['a'] = 556;
  46301. t['b'] = 611;
  46302. t['c'] = 556;
  46303. t['d'] = 611;
  46304. t['e'] = 556;
  46305. t['f'] = 333;
  46306. t['g'] = 611;
  46307. t['h'] = 611;
  46308. t['i'] = 278;
  46309. t['j'] = 278;
  46310. t['k'] = 556;
  46311. t['l'] = 278;
  46312. t['m'] = 889;
  46313. t['n'] = 611;
  46314. t['o'] = 611;
  46315. t['p'] = 611;
  46316. t['q'] = 611;
  46317. t['r'] = 389;
  46318. t['s'] = 556;
  46319. t['t'] = 333;
  46320. t['u'] = 611;
  46321. t['v'] = 556;
  46322. t['w'] = 778;
  46323. t['x'] = 556;
  46324. t['y'] = 556;
  46325. t['z'] = 500;
  46326. t['braceleft'] = 389;
  46327. t['bar'] = 280;
  46328. t['braceright'] = 389;
  46329. t['asciitilde'] = 584;
  46330. t['exclamdown'] = 333;
  46331. t['cent'] = 556;
  46332. t['sterling'] = 556;
  46333. t['fraction'] = 167;
  46334. t['yen'] = 556;
  46335. t['florin'] = 556;
  46336. t['section'] = 556;
  46337. t['currency'] = 556;
  46338. t['quotesingle'] = 238;
  46339. t['quotedblleft'] = 500;
  46340. t['guillemotleft'] = 556;
  46341. t['guilsinglleft'] = 333;
  46342. t['guilsinglright'] = 333;
  46343. t['fi'] = 611;
  46344. t['fl'] = 611;
  46345. t['endash'] = 556;
  46346. t['dagger'] = 556;
  46347. t['daggerdbl'] = 556;
  46348. t['periodcentered'] = 278;
  46349. t['paragraph'] = 556;
  46350. t['bullet'] = 350;
  46351. t['quotesinglbase'] = 278;
  46352. t['quotedblbase'] = 500;
  46353. t['quotedblright'] = 500;
  46354. t['guillemotright'] = 556;
  46355. t['ellipsis'] = 1000;
  46356. t['perthousand'] = 1000;
  46357. t['questiondown'] = 611;
  46358. t['grave'] = 333;
  46359. t['acute'] = 333;
  46360. t['circumflex'] = 333;
  46361. t['tilde'] = 333;
  46362. t['macron'] = 333;
  46363. t['breve'] = 333;
  46364. t['dotaccent'] = 333;
  46365. t['dieresis'] = 333;
  46366. t['ring'] = 333;
  46367. t['cedilla'] = 333;
  46368. t['hungarumlaut'] = 333;
  46369. t['ogonek'] = 333;
  46370. t['caron'] = 333;
  46371. t['emdash'] = 1000;
  46372. t['AE'] = 1000;
  46373. t['ordfeminine'] = 370;
  46374. t['Lslash'] = 611;
  46375. t['Oslash'] = 778;
  46376. t['OE'] = 1000;
  46377. t['ordmasculine'] = 365;
  46378. t['ae'] = 889;
  46379. t['dotlessi'] = 278;
  46380. t['lslash'] = 278;
  46381. t['oslash'] = 611;
  46382. t['oe'] = 944;
  46383. t['germandbls'] = 611;
  46384. t['Idieresis'] = 278;
  46385. t['eacute'] = 556;
  46386. t['abreve'] = 556;
  46387. t['uhungarumlaut'] = 611;
  46388. t['ecaron'] = 556;
  46389. t['Ydieresis'] = 667;
  46390. t['divide'] = 584;
  46391. t['Yacute'] = 667;
  46392. t['Acircumflex'] = 722;
  46393. t['aacute'] = 556;
  46394. t['Ucircumflex'] = 722;
  46395. t['yacute'] = 556;
  46396. t['scommaaccent'] = 556;
  46397. t['ecircumflex'] = 556;
  46398. t['Uring'] = 722;
  46399. t['Udieresis'] = 722;
  46400. t['aogonek'] = 556;
  46401. t['Uacute'] = 722;
  46402. t['uogonek'] = 611;
  46403. t['Edieresis'] = 667;
  46404. t['Dcroat'] = 722;
  46405. t['commaaccent'] = 250;
  46406. t['copyright'] = 737;
  46407. t['Emacron'] = 667;
  46408. t['ccaron'] = 556;
  46409. t['aring'] = 556;
  46410. t['Ncommaaccent'] = 722;
  46411. t['lacute'] = 278;
  46412. t['agrave'] = 556;
  46413. t['Tcommaaccent'] = 611;
  46414. t['Cacute'] = 722;
  46415. t['atilde'] = 556;
  46416. t['Edotaccent'] = 667;
  46417. t['scaron'] = 556;
  46418. t['scedilla'] = 556;
  46419. t['iacute'] = 278;
  46420. t['lozenge'] = 494;
  46421. t['Rcaron'] = 722;
  46422. t['Gcommaaccent'] = 778;
  46423. t['ucircumflex'] = 611;
  46424. t['acircumflex'] = 556;
  46425. t['Amacron'] = 722;
  46426. t['rcaron'] = 389;
  46427. t['ccedilla'] = 556;
  46428. t['Zdotaccent'] = 611;
  46429. t['Thorn'] = 667;
  46430. t['Omacron'] = 778;
  46431. t['Racute'] = 722;
  46432. t['Sacute'] = 667;
  46433. t['dcaron'] = 743;
  46434. t['Umacron'] = 722;
  46435. t['uring'] = 611;
  46436. t['threesuperior'] = 333;
  46437. t['Ograve'] = 778;
  46438. t['Agrave'] = 722;
  46439. t['Abreve'] = 722;
  46440. t['multiply'] = 584;
  46441. t['uacute'] = 611;
  46442. t['Tcaron'] = 611;
  46443. t['partialdiff'] = 494;
  46444. t['ydieresis'] = 556;
  46445. t['Nacute'] = 722;
  46446. t['icircumflex'] = 278;
  46447. t['Ecircumflex'] = 667;
  46448. t['adieresis'] = 556;
  46449. t['edieresis'] = 556;
  46450. t['cacute'] = 556;
  46451. t['nacute'] = 611;
  46452. t['umacron'] = 611;
  46453. t['Ncaron'] = 722;
  46454. t['Iacute'] = 278;
  46455. t['plusminus'] = 584;
  46456. t['brokenbar'] = 280;
  46457. t['registered'] = 737;
  46458. t['Gbreve'] = 778;
  46459. t['Idotaccent'] = 278;
  46460. t['summation'] = 600;
  46461. t['Egrave'] = 667;
  46462. t['racute'] = 389;
  46463. t['omacron'] = 611;
  46464. t['Zacute'] = 611;
  46465. t['Zcaron'] = 611;
  46466. t['greaterequal'] = 549;
  46467. t['Eth'] = 722;
  46468. t['Ccedilla'] = 722;
  46469. t['lcommaaccent'] = 278;
  46470. t['tcaron'] = 389;
  46471. t['eogonek'] = 556;
  46472. t['Uogonek'] = 722;
  46473. t['Aacute'] = 722;
  46474. t['Adieresis'] = 722;
  46475. t['egrave'] = 556;
  46476. t['zacute'] = 500;
  46477. t['iogonek'] = 278;
  46478. t['Oacute'] = 778;
  46479. t['oacute'] = 611;
  46480. t['amacron'] = 556;
  46481. t['sacute'] = 556;
  46482. t['idieresis'] = 278;
  46483. t['Ocircumflex'] = 778;
  46484. t['Ugrave'] = 722;
  46485. t['Delta'] = 612;
  46486. t['thorn'] = 611;
  46487. t['twosuperior'] = 333;
  46488. t['Odieresis'] = 778;
  46489. t['mu'] = 611;
  46490. t['igrave'] = 278;
  46491. t['ohungarumlaut'] = 611;
  46492. t['Eogonek'] = 667;
  46493. t['dcroat'] = 611;
  46494. t['threequarters'] = 834;
  46495. t['Scedilla'] = 667;
  46496. t['lcaron'] = 400;
  46497. t['Kcommaaccent'] = 722;
  46498. t['Lacute'] = 611;
  46499. t['trademark'] = 1000;
  46500. t['edotaccent'] = 556;
  46501. t['Igrave'] = 278;
  46502. t['Imacron'] = 278;
  46503. t['Lcaron'] = 611;
  46504. t['onehalf'] = 834;
  46505. t['lessequal'] = 549;
  46506. t['ocircumflex'] = 611;
  46507. t['ntilde'] = 611;
  46508. t['Uhungarumlaut'] = 722;
  46509. t['Eacute'] = 667;
  46510. t['emacron'] = 556;
  46511. t['gbreve'] = 611;
  46512. t['onequarter'] = 834;
  46513. t['Scaron'] = 667;
  46514. t['Scommaaccent'] = 667;
  46515. t['Ohungarumlaut'] = 778;
  46516. t['degree'] = 400;
  46517. t['ograve'] = 611;
  46518. t['Ccaron'] = 722;
  46519. t['ugrave'] = 611;
  46520. t['radical'] = 549;
  46521. t['Dcaron'] = 722;
  46522. t['rcommaaccent'] = 389;
  46523. t['Ntilde'] = 722;
  46524. t['otilde'] = 611;
  46525. t['Rcommaaccent'] = 722;
  46526. t['Lcommaaccent'] = 611;
  46527. t['Atilde'] = 722;
  46528. t['Aogonek'] = 722;
  46529. t['Aring'] = 722;
  46530. t['Otilde'] = 778;
  46531. t['zdotaccent'] = 500;
  46532. t['Ecaron'] = 667;
  46533. t['Iogonek'] = 278;
  46534. t['kcommaaccent'] = 556;
  46535. t['minus'] = 584;
  46536. t['Icircumflex'] = 278;
  46537. t['ncaron'] = 611;
  46538. t['tcommaaccent'] = 333;
  46539. t['logicalnot'] = 584;
  46540. t['odieresis'] = 611;
  46541. t['udieresis'] = 611;
  46542. t['notequal'] = 549;
  46543. t['gcommaaccent'] = 611;
  46544. t['eth'] = 611;
  46545. t['zcaron'] = 500;
  46546. t['ncommaaccent'] = 611;
  46547. t['onesuperior'] = 333;
  46548. t['imacron'] = 278;
  46549. t['Euro'] = 556;
  46550. });
  46551. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  46552. t['space'] = 278;
  46553. t['exclam'] = 278;
  46554. t['quotedbl'] = 355;
  46555. t['numbersign'] = 556;
  46556. t['dollar'] = 556;
  46557. t['percent'] = 889;
  46558. t['ampersand'] = 667;
  46559. t['quoteright'] = 222;
  46560. t['parenleft'] = 333;
  46561. t['parenright'] = 333;
  46562. t['asterisk'] = 389;
  46563. t['plus'] = 584;
  46564. t['comma'] = 278;
  46565. t['hyphen'] = 333;
  46566. t['period'] = 278;
  46567. t['slash'] = 278;
  46568. t['zero'] = 556;
  46569. t['one'] = 556;
  46570. t['two'] = 556;
  46571. t['three'] = 556;
  46572. t['four'] = 556;
  46573. t['five'] = 556;
  46574. t['six'] = 556;
  46575. t['seven'] = 556;
  46576. t['eight'] = 556;
  46577. t['nine'] = 556;
  46578. t['colon'] = 278;
  46579. t['semicolon'] = 278;
  46580. t['less'] = 584;
  46581. t['equal'] = 584;
  46582. t['greater'] = 584;
  46583. t['question'] = 556;
  46584. t['at'] = 1015;
  46585. t['A'] = 667;
  46586. t['B'] = 667;
  46587. t['C'] = 722;
  46588. t['D'] = 722;
  46589. t['E'] = 667;
  46590. t['F'] = 611;
  46591. t['G'] = 778;
  46592. t['H'] = 722;
  46593. t['I'] = 278;
  46594. t['J'] = 500;
  46595. t['K'] = 667;
  46596. t['L'] = 556;
  46597. t['M'] = 833;
  46598. t['N'] = 722;
  46599. t['O'] = 778;
  46600. t['P'] = 667;
  46601. t['Q'] = 778;
  46602. t['R'] = 722;
  46603. t['S'] = 667;
  46604. t['T'] = 611;
  46605. t['U'] = 722;
  46606. t['V'] = 667;
  46607. t['W'] = 944;
  46608. t['X'] = 667;
  46609. t['Y'] = 667;
  46610. t['Z'] = 611;
  46611. t['bracketleft'] = 278;
  46612. t['backslash'] = 278;
  46613. t['bracketright'] = 278;
  46614. t['asciicircum'] = 469;
  46615. t['underscore'] = 556;
  46616. t['quoteleft'] = 222;
  46617. t['a'] = 556;
  46618. t['b'] = 556;
  46619. t['c'] = 500;
  46620. t['d'] = 556;
  46621. t['e'] = 556;
  46622. t['f'] = 278;
  46623. t['g'] = 556;
  46624. t['h'] = 556;
  46625. t['i'] = 222;
  46626. t['j'] = 222;
  46627. t['k'] = 500;
  46628. t['l'] = 222;
  46629. t['m'] = 833;
  46630. t['n'] = 556;
  46631. t['o'] = 556;
  46632. t['p'] = 556;
  46633. t['q'] = 556;
  46634. t['r'] = 333;
  46635. t['s'] = 500;
  46636. t['t'] = 278;
  46637. t['u'] = 556;
  46638. t['v'] = 500;
  46639. t['w'] = 722;
  46640. t['x'] = 500;
  46641. t['y'] = 500;
  46642. t['z'] = 500;
  46643. t['braceleft'] = 334;
  46644. t['bar'] = 260;
  46645. t['braceright'] = 334;
  46646. t['asciitilde'] = 584;
  46647. t['exclamdown'] = 333;
  46648. t['cent'] = 556;
  46649. t['sterling'] = 556;
  46650. t['fraction'] = 167;
  46651. t['yen'] = 556;
  46652. t['florin'] = 556;
  46653. t['section'] = 556;
  46654. t['currency'] = 556;
  46655. t['quotesingle'] = 191;
  46656. t['quotedblleft'] = 333;
  46657. t['guillemotleft'] = 556;
  46658. t['guilsinglleft'] = 333;
  46659. t['guilsinglright'] = 333;
  46660. t['fi'] = 500;
  46661. t['fl'] = 500;
  46662. t['endash'] = 556;
  46663. t['dagger'] = 556;
  46664. t['daggerdbl'] = 556;
  46665. t['periodcentered'] = 278;
  46666. t['paragraph'] = 537;
  46667. t['bullet'] = 350;
  46668. t['quotesinglbase'] = 222;
  46669. t['quotedblbase'] = 333;
  46670. t['quotedblright'] = 333;
  46671. t['guillemotright'] = 556;
  46672. t['ellipsis'] = 1000;
  46673. t['perthousand'] = 1000;
  46674. t['questiondown'] = 611;
  46675. t['grave'] = 333;
  46676. t['acute'] = 333;
  46677. t['circumflex'] = 333;
  46678. t['tilde'] = 333;
  46679. t['macron'] = 333;
  46680. t['breve'] = 333;
  46681. t['dotaccent'] = 333;
  46682. t['dieresis'] = 333;
  46683. t['ring'] = 333;
  46684. t['cedilla'] = 333;
  46685. t['hungarumlaut'] = 333;
  46686. t['ogonek'] = 333;
  46687. t['caron'] = 333;
  46688. t['emdash'] = 1000;
  46689. t['AE'] = 1000;
  46690. t['ordfeminine'] = 370;
  46691. t['Lslash'] = 556;
  46692. t['Oslash'] = 778;
  46693. t['OE'] = 1000;
  46694. t['ordmasculine'] = 365;
  46695. t['ae'] = 889;
  46696. t['dotlessi'] = 278;
  46697. t['lslash'] = 222;
  46698. t['oslash'] = 611;
  46699. t['oe'] = 944;
  46700. t['germandbls'] = 611;
  46701. t['Idieresis'] = 278;
  46702. t['eacute'] = 556;
  46703. t['abreve'] = 556;
  46704. t['uhungarumlaut'] = 556;
  46705. t['ecaron'] = 556;
  46706. t['Ydieresis'] = 667;
  46707. t['divide'] = 584;
  46708. t['Yacute'] = 667;
  46709. t['Acircumflex'] = 667;
  46710. t['aacute'] = 556;
  46711. t['Ucircumflex'] = 722;
  46712. t['yacute'] = 500;
  46713. t['scommaaccent'] = 500;
  46714. t['ecircumflex'] = 556;
  46715. t['Uring'] = 722;
  46716. t['Udieresis'] = 722;
  46717. t['aogonek'] = 556;
  46718. t['Uacute'] = 722;
  46719. t['uogonek'] = 556;
  46720. t['Edieresis'] = 667;
  46721. t['Dcroat'] = 722;
  46722. t['commaaccent'] = 250;
  46723. t['copyright'] = 737;
  46724. t['Emacron'] = 667;
  46725. t['ccaron'] = 500;
  46726. t['aring'] = 556;
  46727. t['Ncommaaccent'] = 722;
  46728. t['lacute'] = 222;
  46729. t['agrave'] = 556;
  46730. t['Tcommaaccent'] = 611;
  46731. t['Cacute'] = 722;
  46732. t['atilde'] = 556;
  46733. t['Edotaccent'] = 667;
  46734. t['scaron'] = 500;
  46735. t['scedilla'] = 500;
  46736. t['iacute'] = 278;
  46737. t['lozenge'] = 471;
  46738. t['Rcaron'] = 722;
  46739. t['Gcommaaccent'] = 778;
  46740. t['ucircumflex'] = 556;
  46741. t['acircumflex'] = 556;
  46742. t['Amacron'] = 667;
  46743. t['rcaron'] = 333;
  46744. t['ccedilla'] = 500;
  46745. t['Zdotaccent'] = 611;
  46746. t['Thorn'] = 667;
  46747. t['Omacron'] = 778;
  46748. t['Racute'] = 722;
  46749. t['Sacute'] = 667;
  46750. t['dcaron'] = 643;
  46751. t['Umacron'] = 722;
  46752. t['uring'] = 556;
  46753. t['threesuperior'] = 333;
  46754. t['Ograve'] = 778;
  46755. t['Agrave'] = 667;
  46756. t['Abreve'] = 667;
  46757. t['multiply'] = 584;
  46758. t['uacute'] = 556;
  46759. t['Tcaron'] = 611;
  46760. t['partialdiff'] = 476;
  46761. t['ydieresis'] = 500;
  46762. t['Nacute'] = 722;
  46763. t['icircumflex'] = 278;
  46764. t['Ecircumflex'] = 667;
  46765. t['adieresis'] = 556;
  46766. t['edieresis'] = 556;
  46767. t['cacute'] = 500;
  46768. t['nacute'] = 556;
  46769. t['umacron'] = 556;
  46770. t['Ncaron'] = 722;
  46771. t['Iacute'] = 278;
  46772. t['plusminus'] = 584;
  46773. t['brokenbar'] = 260;
  46774. t['registered'] = 737;
  46775. t['Gbreve'] = 778;
  46776. t['Idotaccent'] = 278;
  46777. t['summation'] = 600;
  46778. t['Egrave'] = 667;
  46779. t['racute'] = 333;
  46780. t['omacron'] = 556;
  46781. t['Zacute'] = 611;
  46782. t['Zcaron'] = 611;
  46783. t['greaterequal'] = 549;
  46784. t['Eth'] = 722;
  46785. t['Ccedilla'] = 722;
  46786. t['lcommaaccent'] = 222;
  46787. t['tcaron'] = 317;
  46788. t['eogonek'] = 556;
  46789. t['Uogonek'] = 722;
  46790. t['Aacute'] = 667;
  46791. t['Adieresis'] = 667;
  46792. t['egrave'] = 556;
  46793. t['zacute'] = 500;
  46794. t['iogonek'] = 222;
  46795. t['Oacute'] = 778;
  46796. t['oacute'] = 556;
  46797. t['amacron'] = 556;
  46798. t['sacute'] = 500;
  46799. t['idieresis'] = 278;
  46800. t['Ocircumflex'] = 778;
  46801. t['Ugrave'] = 722;
  46802. t['Delta'] = 612;
  46803. t['thorn'] = 556;
  46804. t['twosuperior'] = 333;
  46805. t['Odieresis'] = 778;
  46806. t['mu'] = 556;
  46807. t['igrave'] = 278;
  46808. t['ohungarumlaut'] = 556;
  46809. t['Eogonek'] = 667;
  46810. t['dcroat'] = 556;
  46811. t['threequarters'] = 834;
  46812. t['Scedilla'] = 667;
  46813. t['lcaron'] = 299;
  46814. t['Kcommaaccent'] = 667;
  46815. t['Lacute'] = 556;
  46816. t['trademark'] = 1000;
  46817. t['edotaccent'] = 556;
  46818. t['Igrave'] = 278;
  46819. t['Imacron'] = 278;
  46820. t['Lcaron'] = 556;
  46821. t['onehalf'] = 834;
  46822. t['lessequal'] = 549;
  46823. t['ocircumflex'] = 556;
  46824. t['ntilde'] = 556;
  46825. t['Uhungarumlaut'] = 722;
  46826. t['Eacute'] = 667;
  46827. t['emacron'] = 556;
  46828. t['gbreve'] = 556;
  46829. t['onequarter'] = 834;
  46830. t['Scaron'] = 667;
  46831. t['Scommaaccent'] = 667;
  46832. t['Ohungarumlaut'] = 778;
  46833. t['degree'] = 400;
  46834. t['ograve'] = 556;
  46835. t['Ccaron'] = 722;
  46836. t['ugrave'] = 556;
  46837. t['radical'] = 453;
  46838. t['Dcaron'] = 722;
  46839. t['rcommaaccent'] = 333;
  46840. t['Ntilde'] = 722;
  46841. t['otilde'] = 556;
  46842. t['Rcommaaccent'] = 722;
  46843. t['Lcommaaccent'] = 556;
  46844. t['Atilde'] = 667;
  46845. t['Aogonek'] = 667;
  46846. t['Aring'] = 667;
  46847. t['Otilde'] = 778;
  46848. t['zdotaccent'] = 500;
  46849. t['Ecaron'] = 667;
  46850. t['Iogonek'] = 278;
  46851. t['kcommaaccent'] = 500;
  46852. t['minus'] = 584;
  46853. t['Icircumflex'] = 278;
  46854. t['ncaron'] = 556;
  46855. t['tcommaaccent'] = 278;
  46856. t['logicalnot'] = 584;
  46857. t['odieresis'] = 556;
  46858. t['udieresis'] = 556;
  46859. t['notequal'] = 549;
  46860. t['gcommaaccent'] = 556;
  46861. t['eth'] = 556;
  46862. t['zcaron'] = 500;
  46863. t['ncommaaccent'] = 556;
  46864. t['onesuperior'] = 333;
  46865. t['imacron'] = 278;
  46866. t['Euro'] = 556;
  46867. });
  46868. t['Symbol'] = getLookupTableFactory(function (t) {
  46869. t['space'] = 250;
  46870. t['exclam'] = 333;
  46871. t['universal'] = 713;
  46872. t['numbersign'] = 500;
  46873. t['existential'] = 549;
  46874. t['percent'] = 833;
  46875. t['ampersand'] = 778;
  46876. t['suchthat'] = 439;
  46877. t['parenleft'] = 333;
  46878. t['parenright'] = 333;
  46879. t['asteriskmath'] = 500;
  46880. t['plus'] = 549;
  46881. t['comma'] = 250;
  46882. t['minus'] = 549;
  46883. t['period'] = 250;
  46884. t['slash'] = 278;
  46885. t['zero'] = 500;
  46886. t['one'] = 500;
  46887. t['two'] = 500;
  46888. t['three'] = 500;
  46889. t['four'] = 500;
  46890. t['five'] = 500;
  46891. t['six'] = 500;
  46892. t['seven'] = 500;
  46893. t['eight'] = 500;
  46894. t['nine'] = 500;
  46895. t['colon'] = 278;
  46896. t['semicolon'] = 278;
  46897. t['less'] = 549;
  46898. t['equal'] = 549;
  46899. t['greater'] = 549;
  46900. t['question'] = 444;
  46901. t['congruent'] = 549;
  46902. t['Alpha'] = 722;
  46903. t['Beta'] = 667;
  46904. t['Chi'] = 722;
  46905. t['Delta'] = 612;
  46906. t['Epsilon'] = 611;
  46907. t['Phi'] = 763;
  46908. t['Gamma'] = 603;
  46909. t['Eta'] = 722;
  46910. t['Iota'] = 333;
  46911. t['theta1'] = 631;
  46912. t['Kappa'] = 722;
  46913. t['Lambda'] = 686;
  46914. t['Mu'] = 889;
  46915. t['Nu'] = 722;
  46916. t['Omicron'] = 722;
  46917. t['Pi'] = 768;
  46918. t['Theta'] = 741;
  46919. t['Rho'] = 556;
  46920. t['Sigma'] = 592;
  46921. t['Tau'] = 611;
  46922. t['Upsilon'] = 690;
  46923. t['sigma1'] = 439;
  46924. t['Omega'] = 768;
  46925. t['Xi'] = 645;
  46926. t['Psi'] = 795;
  46927. t['Zeta'] = 611;
  46928. t['bracketleft'] = 333;
  46929. t['therefore'] = 863;
  46930. t['bracketright'] = 333;
  46931. t['perpendicular'] = 658;
  46932. t['underscore'] = 500;
  46933. t['radicalex'] = 500;
  46934. t['alpha'] = 631;
  46935. t['beta'] = 549;
  46936. t['chi'] = 549;
  46937. t['delta'] = 494;
  46938. t['epsilon'] = 439;
  46939. t['phi'] = 521;
  46940. t['gamma'] = 411;
  46941. t['eta'] = 603;
  46942. t['iota'] = 329;
  46943. t['phi1'] = 603;
  46944. t['kappa'] = 549;
  46945. t['lambda'] = 549;
  46946. t['mu'] = 576;
  46947. t['nu'] = 521;
  46948. t['omicron'] = 549;
  46949. t['pi'] = 549;
  46950. t['theta'] = 521;
  46951. t['rho'] = 549;
  46952. t['sigma'] = 603;
  46953. t['tau'] = 439;
  46954. t['upsilon'] = 576;
  46955. t['omega1'] = 713;
  46956. t['omega'] = 686;
  46957. t['xi'] = 493;
  46958. t['psi'] = 686;
  46959. t['zeta'] = 494;
  46960. t['braceleft'] = 480;
  46961. t['bar'] = 200;
  46962. t['braceright'] = 480;
  46963. t['similar'] = 549;
  46964. t['Euro'] = 750;
  46965. t['Upsilon1'] = 620;
  46966. t['minute'] = 247;
  46967. t['lessequal'] = 549;
  46968. t['fraction'] = 167;
  46969. t['infinity'] = 713;
  46970. t['florin'] = 500;
  46971. t['club'] = 753;
  46972. t['diamond'] = 753;
  46973. t['heart'] = 753;
  46974. t['spade'] = 753;
  46975. t['arrowboth'] = 1042;
  46976. t['arrowleft'] = 987;
  46977. t['arrowup'] = 603;
  46978. t['arrowright'] = 987;
  46979. t['arrowdown'] = 603;
  46980. t['degree'] = 400;
  46981. t['plusminus'] = 549;
  46982. t['second'] = 411;
  46983. t['greaterequal'] = 549;
  46984. t['multiply'] = 549;
  46985. t['proportional'] = 713;
  46986. t['partialdiff'] = 494;
  46987. t['bullet'] = 460;
  46988. t['divide'] = 549;
  46989. t['notequal'] = 549;
  46990. t['equivalence'] = 549;
  46991. t['approxequal'] = 549;
  46992. t['ellipsis'] = 1000;
  46993. t['arrowvertex'] = 603;
  46994. t['arrowhorizex'] = 1000;
  46995. t['carriagereturn'] = 658;
  46996. t['aleph'] = 823;
  46997. t['Ifraktur'] = 686;
  46998. t['Rfraktur'] = 795;
  46999. t['weierstrass'] = 987;
  47000. t['circlemultiply'] = 768;
  47001. t['circleplus'] = 768;
  47002. t['emptyset'] = 823;
  47003. t['intersection'] = 768;
  47004. t['union'] = 768;
  47005. t['propersuperset'] = 713;
  47006. t['reflexsuperset'] = 713;
  47007. t['notsubset'] = 713;
  47008. t['propersubset'] = 713;
  47009. t['reflexsubset'] = 713;
  47010. t['element'] = 713;
  47011. t['notelement'] = 713;
  47012. t['angle'] = 768;
  47013. t['gradient'] = 713;
  47014. t['registerserif'] = 790;
  47015. t['copyrightserif'] = 790;
  47016. t['trademarkserif'] = 890;
  47017. t['product'] = 823;
  47018. t['radical'] = 549;
  47019. t['dotmath'] = 250;
  47020. t['logicalnot'] = 713;
  47021. t['logicaland'] = 603;
  47022. t['logicalor'] = 603;
  47023. t['arrowdblboth'] = 1042;
  47024. t['arrowdblleft'] = 987;
  47025. t['arrowdblup'] = 603;
  47026. t['arrowdblright'] = 987;
  47027. t['arrowdbldown'] = 603;
  47028. t['lozenge'] = 494;
  47029. t['angleleft'] = 329;
  47030. t['registersans'] = 790;
  47031. t['copyrightsans'] = 790;
  47032. t['trademarksans'] = 786;
  47033. t['summation'] = 713;
  47034. t['parenlefttp'] = 384;
  47035. t['parenleftex'] = 384;
  47036. t['parenleftbt'] = 384;
  47037. t['bracketlefttp'] = 384;
  47038. t['bracketleftex'] = 384;
  47039. t['bracketleftbt'] = 384;
  47040. t['bracelefttp'] = 494;
  47041. t['braceleftmid'] = 494;
  47042. t['braceleftbt'] = 494;
  47043. t['braceex'] = 494;
  47044. t['angleright'] = 329;
  47045. t['integral'] = 274;
  47046. t['integraltp'] = 686;
  47047. t['integralex'] = 686;
  47048. t['integralbt'] = 686;
  47049. t['parenrighttp'] = 384;
  47050. t['parenrightex'] = 384;
  47051. t['parenrightbt'] = 384;
  47052. t['bracketrighttp'] = 384;
  47053. t['bracketrightex'] = 384;
  47054. t['bracketrightbt'] = 384;
  47055. t['bracerighttp'] = 494;
  47056. t['bracerightmid'] = 494;
  47057. t['bracerightbt'] = 494;
  47058. t['apple'] = 790;
  47059. });
  47060. t['Times-Roman'] = getLookupTableFactory(function (t) {
  47061. t['space'] = 250;
  47062. t['exclam'] = 333;
  47063. t['quotedbl'] = 408;
  47064. t['numbersign'] = 500;
  47065. t['dollar'] = 500;
  47066. t['percent'] = 833;
  47067. t['ampersand'] = 778;
  47068. t['quoteright'] = 333;
  47069. t['parenleft'] = 333;
  47070. t['parenright'] = 333;
  47071. t['asterisk'] = 500;
  47072. t['plus'] = 564;
  47073. t['comma'] = 250;
  47074. t['hyphen'] = 333;
  47075. t['period'] = 250;
  47076. t['slash'] = 278;
  47077. t['zero'] = 500;
  47078. t['one'] = 500;
  47079. t['two'] = 500;
  47080. t['three'] = 500;
  47081. t['four'] = 500;
  47082. t['five'] = 500;
  47083. t['six'] = 500;
  47084. t['seven'] = 500;
  47085. t['eight'] = 500;
  47086. t['nine'] = 500;
  47087. t['colon'] = 278;
  47088. t['semicolon'] = 278;
  47089. t['less'] = 564;
  47090. t['equal'] = 564;
  47091. t['greater'] = 564;
  47092. t['question'] = 444;
  47093. t['at'] = 921;
  47094. t['A'] = 722;
  47095. t['B'] = 667;
  47096. t['C'] = 667;
  47097. t['D'] = 722;
  47098. t['E'] = 611;
  47099. t['F'] = 556;
  47100. t['G'] = 722;
  47101. t['H'] = 722;
  47102. t['I'] = 333;
  47103. t['J'] = 389;
  47104. t['K'] = 722;
  47105. t['L'] = 611;
  47106. t['M'] = 889;
  47107. t['N'] = 722;
  47108. t['O'] = 722;
  47109. t['P'] = 556;
  47110. t['Q'] = 722;
  47111. t['R'] = 667;
  47112. t['S'] = 556;
  47113. t['T'] = 611;
  47114. t['U'] = 722;
  47115. t['V'] = 722;
  47116. t['W'] = 944;
  47117. t['X'] = 722;
  47118. t['Y'] = 722;
  47119. t['Z'] = 611;
  47120. t['bracketleft'] = 333;
  47121. t['backslash'] = 278;
  47122. t['bracketright'] = 333;
  47123. t['asciicircum'] = 469;
  47124. t['underscore'] = 500;
  47125. t['quoteleft'] = 333;
  47126. t['a'] = 444;
  47127. t['b'] = 500;
  47128. t['c'] = 444;
  47129. t['d'] = 500;
  47130. t['e'] = 444;
  47131. t['f'] = 333;
  47132. t['g'] = 500;
  47133. t['h'] = 500;
  47134. t['i'] = 278;
  47135. t['j'] = 278;
  47136. t['k'] = 500;
  47137. t['l'] = 278;
  47138. t['m'] = 778;
  47139. t['n'] = 500;
  47140. t['o'] = 500;
  47141. t['p'] = 500;
  47142. t['q'] = 500;
  47143. t['r'] = 333;
  47144. t['s'] = 389;
  47145. t['t'] = 278;
  47146. t['u'] = 500;
  47147. t['v'] = 500;
  47148. t['w'] = 722;
  47149. t['x'] = 500;
  47150. t['y'] = 500;
  47151. t['z'] = 444;
  47152. t['braceleft'] = 480;
  47153. t['bar'] = 200;
  47154. t['braceright'] = 480;
  47155. t['asciitilde'] = 541;
  47156. t['exclamdown'] = 333;
  47157. t['cent'] = 500;
  47158. t['sterling'] = 500;
  47159. t['fraction'] = 167;
  47160. t['yen'] = 500;
  47161. t['florin'] = 500;
  47162. t['section'] = 500;
  47163. t['currency'] = 500;
  47164. t['quotesingle'] = 180;
  47165. t['quotedblleft'] = 444;
  47166. t['guillemotleft'] = 500;
  47167. t['guilsinglleft'] = 333;
  47168. t['guilsinglright'] = 333;
  47169. t['fi'] = 556;
  47170. t['fl'] = 556;
  47171. t['endash'] = 500;
  47172. t['dagger'] = 500;
  47173. t['daggerdbl'] = 500;
  47174. t['periodcentered'] = 250;
  47175. t['paragraph'] = 453;
  47176. t['bullet'] = 350;
  47177. t['quotesinglbase'] = 333;
  47178. t['quotedblbase'] = 444;
  47179. t['quotedblright'] = 444;
  47180. t['guillemotright'] = 500;
  47181. t['ellipsis'] = 1000;
  47182. t['perthousand'] = 1000;
  47183. t['questiondown'] = 444;
  47184. t['grave'] = 333;
  47185. t['acute'] = 333;
  47186. t['circumflex'] = 333;
  47187. t['tilde'] = 333;
  47188. t['macron'] = 333;
  47189. t['breve'] = 333;
  47190. t['dotaccent'] = 333;
  47191. t['dieresis'] = 333;
  47192. t['ring'] = 333;
  47193. t['cedilla'] = 333;
  47194. t['hungarumlaut'] = 333;
  47195. t['ogonek'] = 333;
  47196. t['caron'] = 333;
  47197. t['emdash'] = 1000;
  47198. t['AE'] = 889;
  47199. t['ordfeminine'] = 276;
  47200. t['Lslash'] = 611;
  47201. t['Oslash'] = 722;
  47202. t['OE'] = 889;
  47203. t['ordmasculine'] = 310;
  47204. t['ae'] = 667;
  47205. t['dotlessi'] = 278;
  47206. t['lslash'] = 278;
  47207. t['oslash'] = 500;
  47208. t['oe'] = 722;
  47209. t['germandbls'] = 500;
  47210. t['Idieresis'] = 333;
  47211. t['eacute'] = 444;
  47212. t['abreve'] = 444;
  47213. t['uhungarumlaut'] = 500;
  47214. t['ecaron'] = 444;
  47215. t['Ydieresis'] = 722;
  47216. t['divide'] = 564;
  47217. t['Yacute'] = 722;
  47218. t['Acircumflex'] = 722;
  47219. t['aacute'] = 444;
  47220. t['Ucircumflex'] = 722;
  47221. t['yacute'] = 500;
  47222. t['scommaaccent'] = 389;
  47223. t['ecircumflex'] = 444;
  47224. t['Uring'] = 722;
  47225. t['Udieresis'] = 722;
  47226. t['aogonek'] = 444;
  47227. t['Uacute'] = 722;
  47228. t['uogonek'] = 500;
  47229. t['Edieresis'] = 611;
  47230. t['Dcroat'] = 722;
  47231. t['commaaccent'] = 250;
  47232. t['copyright'] = 760;
  47233. t['Emacron'] = 611;
  47234. t['ccaron'] = 444;
  47235. t['aring'] = 444;
  47236. t['Ncommaaccent'] = 722;
  47237. t['lacute'] = 278;
  47238. t['agrave'] = 444;
  47239. t['Tcommaaccent'] = 611;
  47240. t['Cacute'] = 667;
  47241. t['atilde'] = 444;
  47242. t['Edotaccent'] = 611;
  47243. t['scaron'] = 389;
  47244. t['scedilla'] = 389;
  47245. t['iacute'] = 278;
  47246. t['lozenge'] = 471;
  47247. t['Rcaron'] = 667;
  47248. t['Gcommaaccent'] = 722;
  47249. t['ucircumflex'] = 500;
  47250. t['acircumflex'] = 444;
  47251. t['Amacron'] = 722;
  47252. t['rcaron'] = 333;
  47253. t['ccedilla'] = 444;
  47254. t['Zdotaccent'] = 611;
  47255. t['Thorn'] = 556;
  47256. t['Omacron'] = 722;
  47257. t['Racute'] = 667;
  47258. t['Sacute'] = 556;
  47259. t['dcaron'] = 588;
  47260. t['Umacron'] = 722;
  47261. t['uring'] = 500;
  47262. t['threesuperior'] = 300;
  47263. t['Ograve'] = 722;
  47264. t['Agrave'] = 722;
  47265. t['Abreve'] = 722;
  47266. t['multiply'] = 564;
  47267. t['uacute'] = 500;
  47268. t['Tcaron'] = 611;
  47269. t['partialdiff'] = 476;
  47270. t['ydieresis'] = 500;
  47271. t['Nacute'] = 722;
  47272. t['icircumflex'] = 278;
  47273. t['Ecircumflex'] = 611;
  47274. t['adieresis'] = 444;
  47275. t['edieresis'] = 444;
  47276. t['cacute'] = 444;
  47277. t['nacute'] = 500;
  47278. t['umacron'] = 500;
  47279. t['Ncaron'] = 722;
  47280. t['Iacute'] = 333;
  47281. t['plusminus'] = 564;
  47282. t['brokenbar'] = 200;
  47283. t['registered'] = 760;
  47284. t['Gbreve'] = 722;
  47285. t['Idotaccent'] = 333;
  47286. t['summation'] = 600;
  47287. t['Egrave'] = 611;
  47288. t['racute'] = 333;
  47289. t['omacron'] = 500;
  47290. t['Zacute'] = 611;
  47291. t['Zcaron'] = 611;
  47292. t['greaterequal'] = 549;
  47293. t['Eth'] = 722;
  47294. t['Ccedilla'] = 667;
  47295. t['lcommaaccent'] = 278;
  47296. t['tcaron'] = 326;
  47297. t['eogonek'] = 444;
  47298. t['Uogonek'] = 722;
  47299. t['Aacute'] = 722;
  47300. t['Adieresis'] = 722;
  47301. t['egrave'] = 444;
  47302. t['zacute'] = 444;
  47303. t['iogonek'] = 278;
  47304. t['Oacute'] = 722;
  47305. t['oacute'] = 500;
  47306. t['amacron'] = 444;
  47307. t['sacute'] = 389;
  47308. t['idieresis'] = 278;
  47309. t['Ocircumflex'] = 722;
  47310. t['Ugrave'] = 722;
  47311. t['Delta'] = 612;
  47312. t['thorn'] = 500;
  47313. t['twosuperior'] = 300;
  47314. t['Odieresis'] = 722;
  47315. t['mu'] = 500;
  47316. t['igrave'] = 278;
  47317. t['ohungarumlaut'] = 500;
  47318. t['Eogonek'] = 611;
  47319. t['dcroat'] = 500;
  47320. t['threequarters'] = 750;
  47321. t['Scedilla'] = 556;
  47322. t['lcaron'] = 344;
  47323. t['Kcommaaccent'] = 722;
  47324. t['Lacute'] = 611;
  47325. t['trademark'] = 980;
  47326. t['edotaccent'] = 444;
  47327. t['Igrave'] = 333;
  47328. t['Imacron'] = 333;
  47329. t['Lcaron'] = 611;
  47330. t['onehalf'] = 750;
  47331. t['lessequal'] = 549;
  47332. t['ocircumflex'] = 500;
  47333. t['ntilde'] = 500;
  47334. t['Uhungarumlaut'] = 722;
  47335. t['Eacute'] = 611;
  47336. t['emacron'] = 444;
  47337. t['gbreve'] = 500;
  47338. t['onequarter'] = 750;
  47339. t['Scaron'] = 556;
  47340. t['Scommaaccent'] = 556;
  47341. t['Ohungarumlaut'] = 722;
  47342. t['degree'] = 400;
  47343. t['ograve'] = 500;
  47344. t['Ccaron'] = 667;
  47345. t['ugrave'] = 500;
  47346. t['radical'] = 453;
  47347. t['Dcaron'] = 722;
  47348. t['rcommaaccent'] = 333;
  47349. t['Ntilde'] = 722;
  47350. t['otilde'] = 500;
  47351. t['Rcommaaccent'] = 667;
  47352. t['Lcommaaccent'] = 611;
  47353. t['Atilde'] = 722;
  47354. t['Aogonek'] = 722;
  47355. t['Aring'] = 722;
  47356. t['Otilde'] = 722;
  47357. t['zdotaccent'] = 444;
  47358. t['Ecaron'] = 611;
  47359. t['Iogonek'] = 333;
  47360. t['kcommaaccent'] = 500;
  47361. t['minus'] = 564;
  47362. t['Icircumflex'] = 333;
  47363. t['ncaron'] = 500;
  47364. t['tcommaaccent'] = 278;
  47365. t['logicalnot'] = 564;
  47366. t['odieresis'] = 500;
  47367. t['udieresis'] = 500;
  47368. t['notequal'] = 549;
  47369. t['gcommaaccent'] = 500;
  47370. t['eth'] = 500;
  47371. t['zcaron'] = 444;
  47372. t['ncommaaccent'] = 500;
  47373. t['onesuperior'] = 300;
  47374. t['imacron'] = 278;
  47375. t['Euro'] = 500;
  47376. });
  47377. t['Times-Bold'] = getLookupTableFactory(function (t) {
  47378. t['space'] = 250;
  47379. t['exclam'] = 333;
  47380. t['quotedbl'] = 555;
  47381. t['numbersign'] = 500;
  47382. t['dollar'] = 500;
  47383. t['percent'] = 1000;
  47384. t['ampersand'] = 833;
  47385. t['quoteright'] = 333;
  47386. t['parenleft'] = 333;
  47387. t['parenright'] = 333;
  47388. t['asterisk'] = 500;
  47389. t['plus'] = 570;
  47390. t['comma'] = 250;
  47391. t['hyphen'] = 333;
  47392. t['period'] = 250;
  47393. t['slash'] = 278;
  47394. t['zero'] = 500;
  47395. t['one'] = 500;
  47396. t['two'] = 500;
  47397. t['three'] = 500;
  47398. t['four'] = 500;
  47399. t['five'] = 500;
  47400. t['six'] = 500;
  47401. t['seven'] = 500;
  47402. t['eight'] = 500;
  47403. t['nine'] = 500;
  47404. t['colon'] = 333;
  47405. t['semicolon'] = 333;
  47406. t['less'] = 570;
  47407. t['equal'] = 570;
  47408. t['greater'] = 570;
  47409. t['question'] = 500;
  47410. t['at'] = 930;
  47411. t['A'] = 722;
  47412. t['B'] = 667;
  47413. t['C'] = 722;
  47414. t['D'] = 722;
  47415. t['E'] = 667;
  47416. t['F'] = 611;
  47417. t['G'] = 778;
  47418. t['H'] = 778;
  47419. t['I'] = 389;
  47420. t['J'] = 500;
  47421. t['K'] = 778;
  47422. t['L'] = 667;
  47423. t['M'] = 944;
  47424. t['N'] = 722;
  47425. t['O'] = 778;
  47426. t['P'] = 611;
  47427. t['Q'] = 778;
  47428. t['R'] = 722;
  47429. t['S'] = 556;
  47430. t['T'] = 667;
  47431. t['U'] = 722;
  47432. t['V'] = 722;
  47433. t['W'] = 1000;
  47434. t['X'] = 722;
  47435. t['Y'] = 722;
  47436. t['Z'] = 667;
  47437. t['bracketleft'] = 333;
  47438. t['backslash'] = 278;
  47439. t['bracketright'] = 333;
  47440. t['asciicircum'] = 581;
  47441. t['underscore'] = 500;
  47442. t['quoteleft'] = 333;
  47443. t['a'] = 500;
  47444. t['b'] = 556;
  47445. t['c'] = 444;
  47446. t['d'] = 556;
  47447. t['e'] = 444;
  47448. t['f'] = 333;
  47449. t['g'] = 500;
  47450. t['h'] = 556;
  47451. t['i'] = 278;
  47452. t['j'] = 333;
  47453. t['k'] = 556;
  47454. t['l'] = 278;
  47455. t['m'] = 833;
  47456. t['n'] = 556;
  47457. t['o'] = 500;
  47458. t['p'] = 556;
  47459. t['q'] = 556;
  47460. t['r'] = 444;
  47461. t['s'] = 389;
  47462. t['t'] = 333;
  47463. t['u'] = 556;
  47464. t['v'] = 500;
  47465. t['w'] = 722;
  47466. t['x'] = 500;
  47467. t['y'] = 500;
  47468. t['z'] = 444;
  47469. t['braceleft'] = 394;
  47470. t['bar'] = 220;
  47471. t['braceright'] = 394;
  47472. t['asciitilde'] = 520;
  47473. t['exclamdown'] = 333;
  47474. t['cent'] = 500;
  47475. t['sterling'] = 500;
  47476. t['fraction'] = 167;
  47477. t['yen'] = 500;
  47478. t['florin'] = 500;
  47479. t['section'] = 500;
  47480. t['currency'] = 500;
  47481. t['quotesingle'] = 278;
  47482. t['quotedblleft'] = 500;
  47483. t['guillemotleft'] = 500;
  47484. t['guilsinglleft'] = 333;
  47485. t['guilsinglright'] = 333;
  47486. t['fi'] = 556;
  47487. t['fl'] = 556;
  47488. t['endash'] = 500;
  47489. t['dagger'] = 500;
  47490. t['daggerdbl'] = 500;
  47491. t['periodcentered'] = 250;
  47492. t['paragraph'] = 540;
  47493. t['bullet'] = 350;
  47494. t['quotesinglbase'] = 333;
  47495. t['quotedblbase'] = 500;
  47496. t['quotedblright'] = 500;
  47497. t['guillemotright'] = 500;
  47498. t['ellipsis'] = 1000;
  47499. t['perthousand'] = 1000;
  47500. t['questiondown'] = 500;
  47501. t['grave'] = 333;
  47502. t['acute'] = 333;
  47503. t['circumflex'] = 333;
  47504. t['tilde'] = 333;
  47505. t['macron'] = 333;
  47506. t['breve'] = 333;
  47507. t['dotaccent'] = 333;
  47508. t['dieresis'] = 333;
  47509. t['ring'] = 333;
  47510. t['cedilla'] = 333;
  47511. t['hungarumlaut'] = 333;
  47512. t['ogonek'] = 333;
  47513. t['caron'] = 333;
  47514. t['emdash'] = 1000;
  47515. t['AE'] = 1000;
  47516. t['ordfeminine'] = 300;
  47517. t['Lslash'] = 667;
  47518. t['Oslash'] = 778;
  47519. t['OE'] = 1000;
  47520. t['ordmasculine'] = 330;
  47521. t['ae'] = 722;
  47522. t['dotlessi'] = 278;
  47523. t['lslash'] = 278;
  47524. t['oslash'] = 500;
  47525. t['oe'] = 722;
  47526. t['germandbls'] = 556;
  47527. t['Idieresis'] = 389;
  47528. t['eacute'] = 444;
  47529. t['abreve'] = 500;
  47530. t['uhungarumlaut'] = 556;
  47531. t['ecaron'] = 444;
  47532. t['Ydieresis'] = 722;
  47533. t['divide'] = 570;
  47534. t['Yacute'] = 722;
  47535. t['Acircumflex'] = 722;
  47536. t['aacute'] = 500;
  47537. t['Ucircumflex'] = 722;
  47538. t['yacute'] = 500;
  47539. t['scommaaccent'] = 389;
  47540. t['ecircumflex'] = 444;
  47541. t['Uring'] = 722;
  47542. t['Udieresis'] = 722;
  47543. t['aogonek'] = 500;
  47544. t['Uacute'] = 722;
  47545. t['uogonek'] = 556;
  47546. t['Edieresis'] = 667;
  47547. t['Dcroat'] = 722;
  47548. t['commaaccent'] = 250;
  47549. t['copyright'] = 747;
  47550. t['Emacron'] = 667;
  47551. t['ccaron'] = 444;
  47552. t['aring'] = 500;
  47553. t['Ncommaaccent'] = 722;
  47554. t['lacute'] = 278;
  47555. t['agrave'] = 500;
  47556. t['Tcommaaccent'] = 667;
  47557. t['Cacute'] = 722;
  47558. t['atilde'] = 500;
  47559. t['Edotaccent'] = 667;
  47560. t['scaron'] = 389;
  47561. t['scedilla'] = 389;
  47562. t['iacute'] = 278;
  47563. t['lozenge'] = 494;
  47564. t['Rcaron'] = 722;
  47565. t['Gcommaaccent'] = 778;
  47566. t['ucircumflex'] = 556;
  47567. t['acircumflex'] = 500;
  47568. t['Amacron'] = 722;
  47569. t['rcaron'] = 444;
  47570. t['ccedilla'] = 444;
  47571. t['Zdotaccent'] = 667;
  47572. t['Thorn'] = 611;
  47573. t['Omacron'] = 778;
  47574. t['Racute'] = 722;
  47575. t['Sacute'] = 556;
  47576. t['dcaron'] = 672;
  47577. t['Umacron'] = 722;
  47578. t['uring'] = 556;
  47579. t['threesuperior'] = 300;
  47580. t['Ograve'] = 778;
  47581. t['Agrave'] = 722;
  47582. t['Abreve'] = 722;
  47583. t['multiply'] = 570;
  47584. t['uacute'] = 556;
  47585. t['Tcaron'] = 667;
  47586. t['partialdiff'] = 494;
  47587. t['ydieresis'] = 500;
  47588. t['Nacute'] = 722;
  47589. t['icircumflex'] = 278;
  47590. t['Ecircumflex'] = 667;
  47591. t['adieresis'] = 500;
  47592. t['edieresis'] = 444;
  47593. t['cacute'] = 444;
  47594. t['nacute'] = 556;
  47595. t['umacron'] = 556;
  47596. t['Ncaron'] = 722;
  47597. t['Iacute'] = 389;
  47598. t['plusminus'] = 570;
  47599. t['brokenbar'] = 220;
  47600. t['registered'] = 747;
  47601. t['Gbreve'] = 778;
  47602. t['Idotaccent'] = 389;
  47603. t['summation'] = 600;
  47604. t['Egrave'] = 667;
  47605. t['racute'] = 444;
  47606. t['omacron'] = 500;
  47607. t['Zacute'] = 667;
  47608. t['Zcaron'] = 667;
  47609. t['greaterequal'] = 549;
  47610. t['Eth'] = 722;
  47611. t['Ccedilla'] = 722;
  47612. t['lcommaaccent'] = 278;
  47613. t['tcaron'] = 416;
  47614. t['eogonek'] = 444;
  47615. t['Uogonek'] = 722;
  47616. t['Aacute'] = 722;
  47617. t['Adieresis'] = 722;
  47618. t['egrave'] = 444;
  47619. t['zacute'] = 444;
  47620. t['iogonek'] = 278;
  47621. t['Oacute'] = 778;
  47622. t['oacute'] = 500;
  47623. t['amacron'] = 500;
  47624. t['sacute'] = 389;
  47625. t['idieresis'] = 278;
  47626. t['Ocircumflex'] = 778;
  47627. t['Ugrave'] = 722;
  47628. t['Delta'] = 612;
  47629. t['thorn'] = 556;
  47630. t['twosuperior'] = 300;
  47631. t['Odieresis'] = 778;
  47632. t['mu'] = 556;
  47633. t['igrave'] = 278;
  47634. t['ohungarumlaut'] = 500;
  47635. t['Eogonek'] = 667;
  47636. t['dcroat'] = 556;
  47637. t['threequarters'] = 750;
  47638. t['Scedilla'] = 556;
  47639. t['lcaron'] = 394;
  47640. t['Kcommaaccent'] = 778;
  47641. t['Lacute'] = 667;
  47642. t['trademark'] = 1000;
  47643. t['edotaccent'] = 444;
  47644. t['Igrave'] = 389;
  47645. t['Imacron'] = 389;
  47646. t['Lcaron'] = 667;
  47647. t['onehalf'] = 750;
  47648. t['lessequal'] = 549;
  47649. t['ocircumflex'] = 500;
  47650. t['ntilde'] = 556;
  47651. t['Uhungarumlaut'] = 722;
  47652. t['Eacute'] = 667;
  47653. t['emacron'] = 444;
  47654. t['gbreve'] = 500;
  47655. t['onequarter'] = 750;
  47656. t['Scaron'] = 556;
  47657. t['Scommaaccent'] = 556;
  47658. t['Ohungarumlaut'] = 778;
  47659. t['degree'] = 400;
  47660. t['ograve'] = 500;
  47661. t['Ccaron'] = 722;
  47662. t['ugrave'] = 556;
  47663. t['radical'] = 549;
  47664. t['Dcaron'] = 722;
  47665. t['rcommaaccent'] = 444;
  47666. t['Ntilde'] = 722;
  47667. t['otilde'] = 500;
  47668. t['Rcommaaccent'] = 722;
  47669. t['Lcommaaccent'] = 667;
  47670. t['Atilde'] = 722;
  47671. t['Aogonek'] = 722;
  47672. t['Aring'] = 722;
  47673. t['Otilde'] = 778;
  47674. t['zdotaccent'] = 444;
  47675. t['Ecaron'] = 667;
  47676. t['Iogonek'] = 389;
  47677. t['kcommaaccent'] = 556;
  47678. t['minus'] = 570;
  47679. t['Icircumflex'] = 389;
  47680. t['ncaron'] = 556;
  47681. t['tcommaaccent'] = 333;
  47682. t['logicalnot'] = 570;
  47683. t['odieresis'] = 500;
  47684. t['udieresis'] = 556;
  47685. t['notequal'] = 549;
  47686. t['gcommaaccent'] = 500;
  47687. t['eth'] = 500;
  47688. t['zcaron'] = 444;
  47689. t['ncommaaccent'] = 556;
  47690. t['onesuperior'] = 300;
  47691. t['imacron'] = 278;
  47692. t['Euro'] = 500;
  47693. });
  47694. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  47695. t['space'] = 250;
  47696. t['exclam'] = 389;
  47697. t['quotedbl'] = 555;
  47698. t['numbersign'] = 500;
  47699. t['dollar'] = 500;
  47700. t['percent'] = 833;
  47701. t['ampersand'] = 778;
  47702. t['quoteright'] = 333;
  47703. t['parenleft'] = 333;
  47704. t['parenright'] = 333;
  47705. t['asterisk'] = 500;
  47706. t['plus'] = 570;
  47707. t['comma'] = 250;
  47708. t['hyphen'] = 333;
  47709. t['period'] = 250;
  47710. t['slash'] = 278;
  47711. t['zero'] = 500;
  47712. t['one'] = 500;
  47713. t['two'] = 500;
  47714. t['three'] = 500;
  47715. t['four'] = 500;
  47716. t['five'] = 500;
  47717. t['six'] = 500;
  47718. t['seven'] = 500;
  47719. t['eight'] = 500;
  47720. t['nine'] = 500;
  47721. t['colon'] = 333;
  47722. t['semicolon'] = 333;
  47723. t['less'] = 570;
  47724. t['equal'] = 570;
  47725. t['greater'] = 570;
  47726. t['question'] = 500;
  47727. t['at'] = 832;
  47728. t['A'] = 667;
  47729. t['B'] = 667;
  47730. t['C'] = 667;
  47731. t['D'] = 722;
  47732. t['E'] = 667;
  47733. t['F'] = 667;
  47734. t['G'] = 722;
  47735. t['H'] = 778;
  47736. t['I'] = 389;
  47737. t['J'] = 500;
  47738. t['K'] = 667;
  47739. t['L'] = 611;
  47740. t['M'] = 889;
  47741. t['N'] = 722;
  47742. t['O'] = 722;
  47743. t['P'] = 611;
  47744. t['Q'] = 722;
  47745. t['R'] = 667;
  47746. t['S'] = 556;
  47747. t['T'] = 611;
  47748. t['U'] = 722;
  47749. t['V'] = 667;
  47750. t['W'] = 889;
  47751. t['X'] = 667;
  47752. t['Y'] = 611;
  47753. t['Z'] = 611;
  47754. t['bracketleft'] = 333;
  47755. t['backslash'] = 278;
  47756. t['bracketright'] = 333;
  47757. t['asciicircum'] = 570;
  47758. t['underscore'] = 500;
  47759. t['quoteleft'] = 333;
  47760. t['a'] = 500;
  47761. t['b'] = 500;
  47762. t['c'] = 444;
  47763. t['d'] = 500;
  47764. t['e'] = 444;
  47765. t['f'] = 333;
  47766. t['g'] = 500;
  47767. t['h'] = 556;
  47768. t['i'] = 278;
  47769. t['j'] = 278;
  47770. t['k'] = 500;
  47771. t['l'] = 278;
  47772. t['m'] = 778;
  47773. t['n'] = 556;
  47774. t['o'] = 500;
  47775. t['p'] = 500;
  47776. t['q'] = 500;
  47777. t['r'] = 389;
  47778. t['s'] = 389;
  47779. t['t'] = 278;
  47780. t['u'] = 556;
  47781. t['v'] = 444;
  47782. t['w'] = 667;
  47783. t['x'] = 500;
  47784. t['y'] = 444;
  47785. t['z'] = 389;
  47786. t['braceleft'] = 348;
  47787. t['bar'] = 220;
  47788. t['braceright'] = 348;
  47789. t['asciitilde'] = 570;
  47790. t['exclamdown'] = 389;
  47791. t['cent'] = 500;
  47792. t['sterling'] = 500;
  47793. t['fraction'] = 167;
  47794. t['yen'] = 500;
  47795. t['florin'] = 500;
  47796. t['section'] = 500;
  47797. t['currency'] = 500;
  47798. t['quotesingle'] = 278;
  47799. t['quotedblleft'] = 500;
  47800. t['guillemotleft'] = 500;
  47801. t['guilsinglleft'] = 333;
  47802. t['guilsinglright'] = 333;
  47803. t['fi'] = 556;
  47804. t['fl'] = 556;
  47805. t['endash'] = 500;
  47806. t['dagger'] = 500;
  47807. t['daggerdbl'] = 500;
  47808. t['periodcentered'] = 250;
  47809. t['paragraph'] = 500;
  47810. t['bullet'] = 350;
  47811. t['quotesinglbase'] = 333;
  47812. t['quotedblbase'] = 500;
  47813. t['quotedblright'] = 500;
  47814. t['guillemotright'] = 500;
  47815. t['ellipsis'] = 1000;
  47816. t['perthousand'] = 1000;
  47817. t['questiondown'] = 500;
  47818. t['grave'] = 333;
  47819. t['acute'] = 333;
  47820. t['circumflex'] = 333;
  47821. t['tilde'] = 333;
  47822. t['macron'] = 333;
  47823. t['breve'] = 333;
  47824. t['dotaccent'] = 333;
  47825. t['dieresis'] = 333;
  47826. t['ring'] = 333;
  47827. t['cedilla'] = 333;
  47828. t['hungarumlaut'] = 333;
  47829. t['ogonek'] = 333;
  47830. t['caron'] = 333;
  47831. t['emdash'] = 1000;
  47832. t['AE'] = 944;
  47833. t['ordfeminine'] = 266;
  47834. t['Lslash'] = 611;
  47835. t['Oslash'] = 722;
  47836. t['OE'] = 944;
  47837. t['ordmasculine'] = 300;
  47838. t['ae'] = 722;
  47839. t['dotlessi'] = 278;
  47840. t['lslash'] = 278;
  47841. t['oslash'] = 500;
  47842. t['oe'] = 722;
  47843. t['germandbls'] = 500;
  47844. t['Idieresis'] = 389;
  47845. t['eacute'] = 444;
  47846. t['abreve'] = 500;
  47847. t['uhungarumlaut'] = 556;
  47848. t['ecaron'] = 444;
  47849. t['Ydieresis'] = 611;
  47850. t['divide'] = 570;
  47851. t['Yacute'] = 611;
  47852. t['Acircumflex'] = 667;
  47853. t['aacute'] = 500;
  47854. t['Ucircumflex'] = 722;
  47855. t['yacute'] = 444;
  47856. t['scommaaccent'] = 389;
  47857. t['ecircumflex'] = 444;
  47858. t['Uring'] = 722;
  47859. t['Udieresis'] = 722;
  47860. t['aogonek'] = 500;
  47861. t['Uacute'] = 722;
  47862. t['uogonek'] = 556;
  47863. t['Edieresis'] = 667;
  47864. t['Dcroat'] = 722;
  47865. t['commaaccent'] = 250;
  47866. t['copyright'] = 747;
  47867. t['Emacron'] = 667;
  47868. t['ccaron'] = 444;
  47869. t['aring'] = 500;
  47870. t['Ncommaaccent'] = 722;
  47871. t['lacute'] = 278;
  47872. t['agrave'] = 500;
  47873. t['Tcommaaccent'] = 611;
  47874. t['Cacute'] = 667;
  47875. t['atilde'] = 500;
  47876. t['Edotaccent'] = 667;
  47877. t['scaron'] = 389;
  47878. t['scedilla'] = 389;
  47879. t['iacute'] = 278;
  47880. t['lozenge'] = 494;
  47881. t['Rcaron'] = 667;
  47882. t['Gcommaaccent'] = 722;
  47883. t['ucircumflex'] = 556;
  47884. t['acircumflex'] = 500;
  47885. t['Amacron'] = 667;
  47886. t['rcaron'] = 389;
  47887. t['ccedilla'] = 444;
  47888. t['Zdotaccent'] = 611;
  47889. t['Thorn'] = 611;
  47890. t['Omacron'] = 722;
  47891. t['Racute'] = 667;
  47892. t['Sacute'] = 556;
  47893. t['dcaron'] = 608;
  47894. t['Umacron'] = 722;
  47895. t['uring'] = 556;
  47896. t['threesuperior'] = 300;
  47897. t['Ograve'] = 722;
  47898. t['Agrave'] = 667;
  47899. t['Abreve'] = 667;
  47900. t['multiply'] = 570;
  47901. t['uacute'] = 556;
  47902. t['Tcaron'] = 611;
  47903. t['partialdiff'] = 494;
  47904. t['ydieresis'] = 444;
  47905. t['Nacute'] = 722;
  47906. t['icircumflex'] = 278;
  47907. t['Ecircumflex'] = 667;
  47908. t['adieresis'] = 500;
  47909. t['edieresis'] = 444;
  47910. t['cacute'] = 444;
  47911. t['nacute'] = 556;
  47912. t['umacron'] = 556;
  47913. t['Ncaron'] = 722;
  47914. t['Iacute'] = 389;
  47915. t['plusminus'] = 570;
  47916. t['brokenbar'] = 220;
  47917. t['registered'] = 747;
  47918. t['Gbreve'] = 722;
  47919. t['Idotaccent'] = 389;
  47920. t['summation'] = 600;
  47921. t['Egrave'] = 667;
  47922. t['racute'] = 389;
  47923. t['omacron'] = 500;
  47924. t['Zacute'] = 611;
  47925. t['Zcaron'] = 611;
  47926. t['greaterequal'] = 549;
  47927. t['Eth'] = 722;
  47928. t['Ccedilla'] = 667;
  47929. t['lcommaaccent'] = 278;
  47930. t['tcaron'] = 366;
  47931. t['eogonek'] = 444;
  47932. t['Uogonek'] = 722;
  47933. t['Aacute'] = 667;
  47934. t['Adieresis'] = 667;
  47935. t['egrave'] = 444;
  47936. t['zacute'] = 389;
  47937. t['iogonek'] = 278;
  47938. t['Oacute'] = 722;
  47939. t['oacute'] = 500;
  47940. t['amacron'] = 500;
  47941. t['sacute'] = 389;
  47942. t['idieresis'] = 278;
  47943. t['Ocircumflex'] = 722;
  47944. t['Ugrave'] = 722;
  47945. t['Delta'] = 612;
  47946. t['thorn'] = 500;
  47947. t['twosuperior'] = 300;
  47948. t['Odieresis'] = 722;
  47949. t['mu'] = 576;
  47950. t['igrave'] = 278;
  47951. t['ohungarumlaut'] = 500;
  47952. t['Eogonek'] = 667;
  47953. t['dcroat'] = 500;
  47954. t['threequarters'] = 750;
  47955. t['Scedilla'] = 556;
  47956. t['lcaron'] = 382;
  47957. t['Kcommaaccent'] = 667;
  47958. t['Lacute'] = 611;
  47959. t['trademark'] = 1000;
  47960. t['edotaccent'] = 444;
  47961. t['Igrave'] = 389;
  47962. t['Imacron'] = 389;
  47963. t['Lcaron'] = 611;
  47964. t['onehalf'] = 750;
  47965. t['lessequal'] = 549;
  47966. t['ocircumflex'] = 500;
  47967. t['ntilde'] = 556;
  47968. t['Uhungarumlaut'] = 722;
  47969. t['Eacute'] = 667;
  47970. t['emacron'] = 444;
  47971. t['gbreve'] = 500;
  47972. t['onequarter'] = 750;
  47973. t['Scaron'] = 556;
  47974. t['Scommaaccent'] = 556;
  47975. t['Ohungarumlaut'] = 722;
  47976. t['degree'] = 400;
  47977. t['ograve'] = 500;
  47978. t['Ccaron'] = 667;
  47979. t['ugrave'] = 556;
  47980. t['radical'] = 549;
  47981. t['Dcaron'] = 722;
  47982. t['rcommaaccent'] = 389;
  47983. t['Ntilde'] = 722;
  47984. t['otilde'] = 500;
  47985. t['Rcommaaccent'] = 667;
  47986. t['Lcommaaccent'] = 611;
  47987. t['Atilde'] = 667;
  47988. t['Aogonek'] = 667;
  47989. t['Aring'] = 667;
  47990. t['Otilde'] = 722;
  47991. t['zdotaccent'] = 389;
  47992. t['Ecaron'] = 667;
  47993. t['Iogonek'] = 389;
  47994. t['kcommaaccent'] = 500;
  47995. t['minus'] = 606;
  47996. t['Icircumflex'] = 389;
  47997. t['ncaron'] = 556;
  47998. t['tcommaaccent'] = 278;
  47999. t['logicalnot'] = 606;
  48000. t['odieresis'] = 500;
  48001. t['udieresis'] = 556;
  48002. t['notequal'] = 549;
  48003. t['gcommaaccent'] = 500;
  48004. t['eth'] = 500;
  48005. t['zcaron'] = 389;
  48006. t['ncommaaccent'] = 556;
  48007. t['onesuperior'] = 300;
  48008. t['imacron'] = 278;
  48009. t['Euro'] = 500;
  48010. });
  48011. t['Times-Italic'] = getLookupTableFactory(function (t) {
  48012. t['space'] = 250;
  48013. t['exclam'] = 333;
  48014. t['quotedbl'] = 420;
  48015. t['numbersign'] = 500;
  48016. t['dollar'] = 500;
  48017. t['percent'] = 833;
  48018. t['ampersand'] = 778;
  48019. t['quoteright'] = 333;
  48020. t['parenleft'] = 333;
  48021. t['parenright'] = 333;
  48022. t['asterisk'] = 500;
  48023. t['plus'] = 675;
  48024. t['comma'] = 250;
  48025. t['hyphen'] = 333;
  48026. t['period'] = 250;
  48027. t['slash'] = 278;
  48028. t['zero'] = 500;
  48029. t['one'] = 500;
  48030. t['two'] = 500;
  48031. t['three'] = 500;
  48032. t['four'] = 500;
  48033. t['five'] = 500;
  48034. t['six'] = 500;
  48035. t['seven'] = 500;
  48036. t['eight'] = 500;
  48037. t['nine'] = 500;
  48038. t['colon'] = 333;
  48039. t['semicolon'] = 333;
  48040. t['less'] = 675;
  48041. t['equal'] = 675;
  48042. t['greater'] = 675;
  48043. t['question'] = 500;
  48044. t['at'] = 920;
  48045. t['A'] = 611;
  48046. t['B'] = 611;
  48047. t['C'] = 667;
  48048. t['D'] = 722;
  48049. t['E'] = 611;
  48050. t['F'] = 611;
  48051. t['G'] = 722;
  48052. t['H'] = 722;
  48053. t['I'] = 333;
  48054. t['J'] = 444;
  48055. t['K'] = 667;
  48056. t['L'] = 556;
  48057. t['M'] = 833;
  48058. t['N'] = 667;
  48059. t['O'] = 722;
  48060. t['P'] = 611;
  48061. t['Q'] = 722;
  48062. t['R'] = 611;
  48063. t['S'] = 500;
  48064. t['T'] = 556;
  48065. t['U'] = 722;
  48066. t['V'] = 611;
  48067. t['W'] = 833;
  48068. t['X'] = 611;
  48069. t['Y'] = 556;
  48070. t['Z'] = 556;
  48071. t['bracketleft'] = 389;
  48072. t['backslash'] = 278;
  48073. t['bracketright'] = 389;
  48074. t['asciicircum'] = 422;
  48075. t['underscore'] = 500;
  48076. t['quoteleft'] = 333;
  48077. t['a'] = 500;
  48078. t['b'] = 500;
  48079. t['c'] = 444;
  48080. t['d'] = 500;
  48081. t['e'] = 444;
  48082. t['f'] = 278;
  48083. t['g'] = 500;
  48084. t['h'] = 500;
  48085. t['i'] = 278;
  48086. t['j'] = 278;
  48087. t['k'] = 444;
  48088. t['l'] = 278;
  48089. t['m'] = 722;
  48090. t['n'] = 500;
  48091. t['o'] = 500;
  48092. t['p'] = 500;
  48093. t['q'] = 500;
  48094. t['r'] = 389;
  48095. t['s'] = 389;
  48096. t['t'] = 278;
  48097. t['u'] = 500;
  48098. t['v'] = 444;
  48099. t['w'] = 667;
  48100. t['x'] = 444;
  48101. t['y'] = 444;
  48102. t['z'] = 389;
  48103. t['braceleft'] = 400;
  48104. t['bar'] = 275;
  48105. t['braceright'] = 400;
  48106. t['asciitilde'] = 541;
  48107. t['exclamdown'] = 389;
  48108. t['cent'] = 500;
  48109. t['sterling'] = 500;
  48110. t['fraction'] = 167;
  48111. t['yen'] = 500;
  48112. t['florin'] = 500;
  48113. t['section'] = 500;
  48114. t['currency'] = 500;
  48115. t['quotesingle'] = 214;
  48116. t['quotedblleft'] = 556;
  48117. t['guillemotleft'] = 500;
  48118. t['guilsinglleft'] = 333;
  48119. t['guilsinglright'] = 333;
  48120. t['fi'] = 500;
  48121. t['fl'] = 500;
  48122. t['endash'] = 500;
  48123. t['dagger'] = 500;
  48124. t['daggerdbl'] = 500;
  48125. t['periodcentered'] = 250;
  48126. t['paragraph'] = 523;
  48127. t['bullet'] = 350;
  48128. t['quotesinglbase'] = 333;
  48129. t['quotedblbase'] = 556;
  48130. t['quotedblright'] = 556;
  48131. t['guillemotright'] = 500;
  48132. t['ellipsis'] = 889;
  48133. t['perthousand'] = 1000;
  48134. t['questiondown'] = 500;
  48135. t['grave'] = 333;
  48136. t['acute'] = 333;
  48137. t['circumflex'] = 333;
  48138. t['tilde'] = 333;
  48139. t['macron'] = 333;
  48140. t['breve'] = 333;
  48141. t['dotaccent'] = 333;
  48142. t['dieresis'] = 333;
  48143. t['ring'] = 333;
  48144. t['cedilla'] = 333;
  48145. t['hungarumlaut'] = 333;
  48146. t['ogonek'] = 333;
  48147. t['caron'] = 333;
  48148. t['emdash'] = 889;
  48149. t['AE'] = 889;
  48150. t['ordfeminine'] = 276;
  48151. t['Lslash'] = 556;
  48152. t['Oslash'] = 722;
  48153. t['OE'] = 944;
  48154. t['ordmasculine'] = 310;
  48155. t['ae'] = 667;
  48156. t['dotlessi'] = 278;
  48157. t['lslash'] = 278;
  48158. t['oslash'] = 500;
  48159. t['oe'] = 667;
  48160. t['germandbls'] = 500;
  48161. t['Idieresis'] = 333;
  48162. t['eacute'] = 444;
  48163. t['abreve'] = 500;
  48164. t['uhungarumlaut'] = 500;
  48165. t['ecaron'] = 444;
  48166. t['Ydieresis'] = 556;
  48167. t['divide'] = 675;
  48168. t['Yacute'] = 556;
  48169. t['Acircumflex'] = 611;
  48170. t['aacute'] = 500;
  48171. t['Ucircumflex'] = 722;
  48172. t['yacute'] = 444;
  48173. t['scommaaccent'] = 389;
  48174. t['ecircumflex'] = 444;
  48175. t['Uring'] = 722;
  48176. t['Udieresis'] = 722;
  48177. t['aogonek'] = 500;
  48178. t['Uacute'] = 722;
  48179. t['uogonek'] = 500;
  48180. t['Edieresis'] = 611;
  48181. t['Dcroat'] = 722;
  48182. t['commaaccent'] = 250;
  48183. t['copyright'] = 760;
  48184. t['Emacron'] = 611;
  48185. t['ccaron'] = 444;
  48186. t['aring'] = 500;
  48187. t['Ncommaaccent'] = 667;
  48188. t['lacute'] = 278;
  48189. t['agrave'] = 500;
  48190. t['Tcommaaccent'] = 556;
  48191. t['Cacute'] = 667;
  48192. t['atilde'] = 500;
  48193. t['Edotaccent'] = 611;
  48194. t['scaron'] = 389;
  48195. t['scedilla'] = 389;
  48196. t['iacute'] = 278;
  48197. t['lozenge'] = 471;
  48198. t['Rcaron'] = 611;
  48199. t['Gcommaaccent'] = 722;
  48200. t['ucircumflex'] = 500;
  48201. t['acircumflex'] = 500;
  48202. t['Amacron'] = 611;
  48203. t['rcaron'] = 389;
  48204. t['ccedilla'] = 444;
  48205. t['Zdotaccent'] = 556;
  48206. t['Thorn'] = 611;
  48207. t['Omacron'] = 722;
  48208. t['Racute'] = 611;
  48209. t['Sacute'] = 500;
  48210. t['dcaron'] = 544;
  48211. t['Umacron'] = 722;
  48212. t['uring'] = 500;
  48213. t['threesuperior'] = 300;
  48214. t['Ograve'] = 722;
  48215. t['Agrave'] = 611;
  48216. t['Abreve'] = 611;
  48217. t['multiply'] = 675;
  48218. t['uacute'] = 500;
  48219. t['Tcaron'] = 556;
  48220. t['partialdiff'] = 476;
  48221. t['ydieresis'] = 444;
  48222. t['Nacute'] = 667;
  48223. t['icircumflex'] = 278;
  48224. t['Ecircumflex'] = 611;
  48225. t['adieresis'] = 500;
  48226. t['edieresis'] = 444;
  48227. t['cacute'] = 444;
  48228. t['nacute'] = 500;
  48229. t['umacron'] = 500;
  48230. t['Ncaron'] = 667;
  48231. t['Iacute'] = 333;
  48232. t['plusminus'] = 675;
  48233. t['brokenbar'] = 275;
  48234. t['registered'] = 760;
  48235. t['Gbreve'] = 722;
  48236. t['Idotaccent'] = 333;
  48237. t['summation'] = 600;
  48238. t['Egrave'] = 611;
  48239. t['racute'] = 389;
  48240. t['omacron'] = 500;
  48241. t['Zacute'] = 556;
  48242. t['Zcaron'] = 556;
  48243. t['greaterequal'] = 549;
  48244. t['Eth'] = 722;
  48245. t['Ccedilla'] = 667;
  48246. t['lcommaaccent'] = 278;
  48247. t['tcaron'] = 300;
  48248. t['eogonek'] = 444;
  48249. t['Uogonek'] = 722;
  48250. t['Aacute'] = 611;
  48251. t['Adieresis'] = 611;
  48252. t['egrave'] = 444;
  48253. t['zacute'] = 389;
  48254. t['iogonek'] = 278;
  48255. t['Oacute'] = 722;
  48256. t['oacute'] = 500;
  48257. t['amacron'] = 500;
  48258. t['sacute'] = 389;
  48259. t['idieresis'] = 278;
  48260. t['Ocircumflex'] = 722;
  48261. t['Ugrave'] = 722;
  48262. t['Delta'] = 612;
  48263. t['thorn'] = 500;
  48264. t['twosuperior'] = 300;
  48265. t['Odieresis'] = 722;
  48266. t['mu'] = 500;
  48267. t['igrave'] = 278;
  48268. t['ohungarumlaut'] = 500;
  48269. t['Eogonek'] = 611;
  48270. t['dcroat'] = 500;
  48271. t['threequarters'] = 750;
  48272. t['Scedilla'] = 500;
  48273. t['lcaron'] = 300;
  48274. t['Kcommaaccent'] = 667;
  48275. t['Lacute'] = 556;
  48276. t['trademark'] = 980;
  48277. t['edotaccent'] = 444;
  48278. t['Igrave'] = 333;
  48279. t['Imacron'] = 333;
  48280. t['Lcaron'] = 611;
  48281. t['onehalf'] = 750;
  48282. t['lessequal'] = 549;
  48283. t['ocircumflex'] = 500;
  48284. t['ntilde'] = 500;
  48285. t['Uhungarumlaut'] = 722;
  48286. t['Eacute'] = 611;
  48287. t['emacron'] = 444;
  48288. t['gbreve'] = 500;
  48289. t['onequarter'] = 750;
  48290. t['Scaron'] = 500;
  48291. t['Scommaaccent'] = 500;
  48292. t['Ohungarumlaut'] = 722;
  48293. t['degree'] = 400;
  48294. t['ograve'] = 500;
  48295. t['Ccaron'] = 667;
  48296. t['ugrave'] = 500;
  48297. t['radical'] = 453;
  48298. t['Dcaron'] = 722;
  48299. t['rcommaaccent'] = 389;
  48300. t['Ntilde'] = 667;
  48301. t['otilde'] = 500;
  48302. t['Rcommaaccent'] = 611;
  48303. t['Lcommaaccent'] = 556;
  48304. t['Atilde'] = 611;
  48305. t['Aogonek'] = 611;
  48306. t['Aring'] = 611;
  48307. t['Otilde'] = 722;
  48308. t['zdotaccent'] = 389;
  48309. t['Ecaron'] = 611;
  48310. t['Iogonek'] = 333;
  48311. t['kcommaaccent'] = 444;
  48312. t['minus'] = 675;
  48313. t['Icircumflex'] = 333;
  48314. t['ncaron'] = 500;
  48315. t['tcommaaccent'] = 278;
  48316. t['logicalnot'] = 675;
  48317. t['odieresis'] = 500;
  48318. t['udieresis'] = 500;
  48319. t['notequal'] = 549;
  48320. t['gcommaaccent'] = 500;
  48321. t['eth'] = 500;
  48322. t['zcaron'] = 389;
  48323. t['ncommaaccent'] = 500;
  48324. t['onesuperior'] = 300;
  48325. t['imacron'] = 278;
  48326. t['Euro'] = 500;
  48327. });
  48328. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  48329. t['space'] = 278;
  48330. t['a1'] = 974;
  48331. t['a2'] = 961;
  48332. t['a202'] = 974;
  48333. t['a3'] = 980;
  48334. t['a4'] = 719;
  48335. t['a5'] = 789;
  48336. t['a119'] = 790;
  48337. t['a118'] = 791;
  48338. t['a117'] = 690;
  48339. t['a11'] = 960;
  48340. t['a12'] = 939;
  48341. t['a13'] = 549;
  48342. t['a14'] = 855;
  48343. t['a15'] = 911;
  48344. t['a16'] = 933;
  48345. t['a105'] = 911;
  48346. t['a17'] = 945;
  48347. t['a18'] = 974;
  48348. t['a19'] = 755;
  48349. t['a20'] = 846;
  48350. t['a21'] = 762;
  48351. t['a22'] = 761;
  48352. t['a23'] = 571;
  48353. t['a24'] = 677;
  48354. t['a25'] = 763;
  48355. t['a26'] = 760;
  48356. t['a27'] = 759;
  48357. t['a28'] = 754;
  48358. t['a6'] = 494;
  48359. t['a7'] = 552;
  48360. t['a8'] = 537;
  48361. t['a9'] = 577;
  48362. t['a10'] = 692;
  48363. t['a29'] = 786;
  48364. t['a30'] = 788;
  48365. t['a31'] = 788;
  48366. t['a32'] = 790;
  48367. t['a33'] = 793;
  48368. t['a34'] = 794;
  48369. t['a35'] = 816;
  48370. t['a36'] = 823;
  48371. t['a37'] = 789;
  48372. t['a38'] = 841;
  48373. t['a39'] = 823;
  48374. t['a40'] = 833;
  48375. t['a41'] = 816;
  48376. t['a42'] = 831;
  48377. t['a43'] = 923;
  48378. t['a44'] = 744;
  48379. t['a45'] = 723;
  48380. t['a46'] = 749;
  48381. t['a47'] = 790;
  48382. t['a48'] = 792;
  48383. t['a49'] = 695;
  48384. t['a50'] = 776;
  48385. t['a51'] = 768;
  48386. t['a52'] = 792;
  48387. t['a53'] = 759;
  48388. t['a54'] = 707;
  48389. t['a55'] = 708;
  48390. t['a56'] = 682;
  48391. t['a57'] = 701;
  48392. t['a58'] = 826;
  48393. t['a59'] = 815;
  48394. t['a60'] = 789;
  48395. t['a61'] = 789;
  48396. t['a62'] = 707;
  48397. t['a63'] = 687;
  48398. t['a64'] = 696;
  48399. t['a65'] = 689;
  48400. t['a66'] = 786;
  48401. t['a67'] = 787;
  48402. t['a68'] = 713;
  48403. t['a69'] = 791;
  48404. t['a70'] = 785;
  48405. t['a71'] = 791;
  48406. t['a72'] = 873;
  48407. t['a73'] = 761;
  48408. t['a74'] = 762;
  48409. t['a203'] = 762;
  48410. t['a75'] = 759;
  48411. t['a204'] = 759;
  48412. t['a76'] = 892;
  48413. t['a77'] = 892;
  48414. t['a78'] = 788;
  48415. t['a79'] = 784;
  48416. t['a81'] = 438;
  48417. t['a82'] = 138;
  48418. t['a83'] = 277;
  48419. t['a84'] = 415;
  48420. t['a97'] = 392;
  48421. t['a98'] = 392;
  48422. t['a99'] = 668;
  48423. t['a100'] = 668;
  48424. t['a89'] = 390;
  48425. t['a90'] = 390;
  48426. t['a93'] = 317;
  48427. t['a94'] = 317;
  48428. t['a91'] = 276;
  48429. t['a92'] = 276;
  48430. t['a205'] = 509;
  48431. t['a85'] = 509;
  48432. t['a206'] = 410;
  48433. t['a86'] = 410;
  48434. t['a87'] = 234;
  48435. t['a88'] = 234;
  48436. t['a95'] = 334;
  48437. t['a96'] = 334;
  48438. t['a101'] = 732;
  48439. t['a102'] = 544;
  48440. t['a103'] = 544;
  48441. t['a104'] = 910;
  48442. t['a106'] = 667;
  48443. t['a107'] = 760;
  48444. t['a108'] = 760;
  48445. t['a112'] = 776;
  48446. t['a111'] = 595;
  48447. t['a110'] = 694;
  48448. t['a109'] = 626;
  48449. t['a120'] = 788;
  48450. t['a121'] = 788;
  48451. t['a122'] = 788;
  48452. t['a123'] = 788;
  48453. t['a124'] = 788;
  48454. t['a125'] = 788;
  48455. t['a126'] = 788;
  48456. t['a127'] = 788;
  48457. t['a128'] = 788;
  48458. t['a129'] = 788;
  48459. t['a130'] = 788;
  48460. t['a131'] = 788;
  48461. t['a132'] = 788;
  48462. t['a133'] = 788;
  48463. t['a134'] = 788;
  48464. t['a135'] = 788;
  48465. t['a136'] = 788;
  48466. t['a137'] = 788;
  48467. t['a138'] = 788;
  48468. t['a139'] = 788;
  48469. t['a140'] = 788;
  48470. t['a141'] = 788;
  48471. t['a142'] = 788;
  48472. t['a143'] = 788;
  48473. t['a144'] = 788;
  48474. t['a145'] = 788;
  48475. t['a146'] = 788;
  48476. t['a147'] = 788;
  48477. t['a148'] = 788;
  48478. t['a149'] = 788;
  48479. t['a150'] = 788;
  48480. t['a151'] = 788;
  48481. t['a152'] = 788;
  48482. t['a153'] = 788;
  48483. t['a154'] = 788;
  48484. t['a155'] = 788;
  48485. t['a156'] = 788;
  48486. t['a157'] = 788;
  48487. t['a158'] = 788;
  48488. t['a159'] = 788;
  48489. t['a160'] = 894;
  48490. t['a161'] = 838;
  48491. t['a163'] = 1016;
  48492. t['a164'] = 458;
  48493. t['a196'] = 748;
  48494. t['a165'] = 924;
  48495. t['a192'] = 748;
  48496. t['a166'] = 918;
  48497. t['a167'] = 927;
  48498. t['a168'] = 928;
  48499. t['a169'] = 928;
  48500. t['a170'] = 834;
  48501. t['a171'] = 873;
  48502. t['a172'] = 828;
  48503. t['a173'] = 924;
  48504. t['a162'] = 924;
  48505. t['a174'] = 917;
  48506. t['a175'] = 930;
  48507. t['a176'] = 931;
  48508. t['a177'] = 463;
  48509. t['a178'] = 883;
  48510. t['a179'] = 836;
  48511. t['a193'] = 836;
  48512. t['a180'] = 867;
  48513. t['a199'] = 867;
  48514. t['a181'] = 696;
  48515. t['a200'] = 696;
  48516. t['a182'] = 874;
  48517. t['a201'] = 874;
  48518. t['a183'] = 760;
  48519. t['a184'] = 946;
  48520. t['a197'] = 771;
  48521. t['a185'] = 865;
  48522. t['a194'] = 771;
  48523. t['a198'] = 888;
  48524. t['a186'] = 967;
  48525. t['a195'] = 888;
  48526. t['a187'] = 831;
  48527. t['a188'] = 873;
  48528. t['a189'] = 927;
  48529. t['a190'] = 970;
  48530. t['a191'] = 918;
  48531. });
  48532. });
  48533. exports.getMetrics = getMetrics;
  48534. /***/ }),
  48535. /* 32 */
  48536. /***/ (function(module, exports, __w_pdfjs_require__) {
  48537. "use strict";
  48538. var sharedUtil = __w_pdfjs_require__(0);
  48539. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  48540. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  48541. var MASK_HIGH = 0xffff0000;
  48542. var MASK_LOW = 0xffff;
  48543. function MurmurHash3_64(seed) {
  48544. var SEED = 0xc3d2e1f0;
  48545. this.h1 = seed ? seed & 0xffffffff : SEED;
  48546. this.h2 = seed ? seed & 0xffffffff : SEED;
  48547. }
  48548. var alwaysUseUint32ArrayView = false;
  48549. try {
  48550. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  48551. } catch (e) {
  48552. alwaysUseUint32ArrayView = true;
  48553. }
  48554. MurmurHash3_64.prototype = {
  48555. update: function MurmurHash3_64_update(input) {
  48556. var useUint32ArrayView = alwaysUseUint32ArrayView;
  48557. var i;
  48558. if (typeof input === 'string') {
  48559. var data = new Uint8Array(input.length * 2);
  48560. var length = 0;
  48561. for (i = 0; i < input.length; i++) {
  48562. var code = input.charCodeAt(i);
  48563. if (code <= 0xff) {
  48564. data[length++] = code;
  48565. } else {
  48566. data[length++] = code >>> 8;
  48567. data[length++] = code & 0xff;
  48568. }
  48569. }
  48570. } else if (input instanceof Uint8Array) {
  48571. data = input;
  48572. length = data.length;
  48573. } else if (typeof input === 'object' && 'length' in input) {
  48574. data = input;
  48575. length = data.length;
  48576. useUint32ArrayView = true;
  48577. } else {
  48578. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  48579. }
  48580. var blockCounts = length >> 2;
  48581. var tailLength = length - blockCounts * 4;
  48582. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  48583. var k1 = 0;
  48584. var k2 = 0;
  48585. var h1 = this.h1;
  48586. var h2 = this.h2;
  48587. var C1 = 0xcc9e2d51;
  48588. var C2 = 0x1b873593;
  48589. var C1_LOW = C1 & MASK_LOW;
  48590. var C2_LOW = C2 & MASK_LOW;
  48591. for (i = 0; i < blockCounts; i++) {
  48592. if (i & 1) {
  48593. k1 = dataUint32[i];
  48594. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48595. k1 = k1 << 15 | k1 >>> 17;
  48596. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48597. h1 ^= k1;
  48598. h1 = h1 << 13 | h1 >>> 19;
  48599. h1 = h1 * 5 + 0xe6546b64;
  48600. } else {
  48601. k2 = dataUint32[i];
  48602. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  48603. k2 = k2 << 15 | k2 >>> 17;
  48604. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  48605. h2 ^= k2;
  48606. h2 = h2 << 13 | h2 >>> 19;
  48607. h2 = h2 * 5 + 0xe6546b64;
  48608. }
  48609. }
  48610. k1 = 0;
  48611. switch (tailLength) {
  48612. case 3:
  48613. k1 ^= data[blockCounts * 4 + 2] << 16;
  48614. case 2:
  48615. k1 ^= data[blockCounts * 4 + 1] << 8;
  48616. case 1:
  48617. k1 ^= data[blockCounts * 4];
  48618. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48619. k1 = k1 << 15 | k1 >>> 17;
  48620. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48621. if (blockCounts & 1) {
  48622. h1 ^= k1;
  48623. } else {
  48624. h2 ^= k1;
  48625. }
  48626. }
  48627. this.h1 = h1;
  48628. this.h2 = h2;
  48629. return this;
  48630. },
  48631. hexdigest: function MurmurHash3_64_hexdigest() {
  48632. var h1 = this.h1;
  48633. var h2 = this.h2;
  48634. h1 ^= h2 >>> 1;
  48635. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  48636. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  48637. h1 ^= h2 >>> 1;
  48638. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  48639. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  48640. h1 ^= h2 >>> 1;
  48641. for (var i = 0, arr = [
  48642. h1,
  48643. h2
  48644. ], str = ''; i < arr.length; i++) {
  48645. var hex = (arr[i] >>> 0).toString(16);
  48646. while (hex.length < 8) {
  48647. hex = '0' + hex;
  48648. }
  48649. str += hex;
  48650. }
  48651. return str;
  48652. }
  48653. };
  48654. return MurmurHash3_64;
  48655. }();
  48656. exports.MurmurHash3_64 = MurmurHash3_64;
  48657. /***/ }),
  48658. /* 33 */
  48659. /***/ (function(module, exports, __w_pdfjs_require__) {
  48660. "use strict";
  48661. var sharedUtil = __w_pdfjs_require__(0);
  48662. var corePrimitives = __w_pdfjs_require__(1);
  48663. var coreFunction = __w_pdfjs_require__(6);
  48664. var coreColorSpace = __w_pdfjs_require__(3);
  48665. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  48666. var MissingDataException = sharedUtil.MissingDataException;
  48667. var Util = sharedUtil.Util;
  48668. var assert = sharedUtil.assert;
  48669. var error = sharedUtil.error;
  48670. var info = sharedUtil.info;
  48671. var warn = sharedUtil.warn;
  48672. var isStream = corePrimitives.isStream;
  48673. var PDFFunction = coreFunction.PDFFunction;
  48674. var ColorSpace = coreColorSpace.ColorSpace;
  48675. var ShadingType = {
  48676. FUNCTION_BASED: 1,
  48677. AXIAL: 2,
  48678. RADIAL: 3,
  48679. FREE_FORM_MESH: 4,
  48680. LATTICE_FORM_MESH: 5,
  48681. COONS_PATCH_MESH: 6,
  48682. TENSOR_PATCH_MESH: 7
  48683. };
  48684. var Pattern = function PatternClosure() {
  48685. function Pattern() {
  48686. error('should not call Pattern constructor');
  48687. }
  48688. Pattern.prototype = {
  48689. getPattern: function Pattern_getPattern(ctx) {
  48690. error('Should not call Pattern.getStyle: ' + ctx);
  48691. }
  48692. };
  48693. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  48694. var dict = isStream(shading) ? shading.dict : shading;
  48695. var type = dict.get('ShadingType');
  48696. try {
  48697. switch (type) {
  48698. case ShadingType.AXIAL:
  48699. case ShadingType.RADIAL:
  48700. return new Shadings.RadialAxial(dict, matrix, xref, res);
  48701. case ShadingType.FREE_FORM_MESH:
  48702. case ShadingType.LATTICE_FORM_MESH:
  48703. case ShadingType.COONS_PATCH_MESH:
  48704. case ShadingType.TENSOR_PATCH_MESH:
  48705. return new Shadings.Mesh(shading, matrix, xref, res);
  48706. default:
  48707. throw new Error('Unsupported ShadingType: ' + type);
  48708. }
  48709. } catch (ex) {
  48710. if (ex instanceof MissingDataException) {
  48711. throw ex;
  48712. }
  48713. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  48714. warn(ex);
  48715. return new Shadings.Dummy();
  48716. }
  48717. };
  48718. return Pattern;
  48719. }();
  48720. var Shadings = {};
  48721. Shadings.SMALL_NUMBER = 1e-6;
  48722. Shadings.RadialAxial = function RadialAxialClosure() {
  48723. function RadialAxial(dict, matrix, xref, res) {
  48724. this.matrix = matrix;
  48725. this.coordsArr = dict.getArray('Coords');
  48726. this.shadingType = dict.get('ShadingType');
  48727. this.type = 'Pattern';
  48728. var cs = dict.get('ColorSpace', 'CS');
  48729. cs = ColorSpace.parse(cs, xref, res);
  48730. this.cs = cs;
  48731. var t0 = 0.0, t1 = 1.0;
  48732. if (dict.has('Domain')) {
  48733. var domainArr = dict.getArray('Domain');
  48734. t0 = domainArr[0];
  48735. t1 = domainArr[1];
  48736. }
  48737. var extendStart = false, extendEnd = false;
  48738. if (dict.has('Extend')) {
  48739. var extendArr = dict.getArray('Extend');
  48740. extendStart = extendArr[0];
  48741. extendEnd = extendArr[1];
  48742. }
  48743. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  48744. var x1 = this.coordsArr[0];
  48745. var y1 = this.coordsArr[1];
  48746. var r1 = this.coordsArr[2];
  48747. var x2 = this.coordsArr[3];
  48748. var y2 = this.coordsArr[4];
  48749. var r2 = this.coordsArr[5];
  48750. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  48751. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  48752. warn('Unsupported radial gradient.');
  48753. }
  48754. }
  48755. this.extendStart = extendStart;
  48756. this.extendEnd = extendEnd;
  48757. var fnObj = dict.get('Function');
  48758. var fn = PDFFunction.parseArray(xref, fnObj);
  48759. var diff = t1 - t0;
  48760. var step = diff / 10;
  48761. var colorStops = this.colorStops = [];
  48762. if (t0 >= t1 || step <= 0) {
  48763. info('Bad shading domain.');
  48764. return;
  48765. }
  48766. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  48767. var rgbColor;
  48768. for (var i = t0; i <= t1; i += step) {
  48769. ratio[0] = i;
  48770. fn(ratio, 0, color, 0);
  48771. rgbColor = cs.getRgb(color, 0);
  48772. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48773. colorStops.push([
  48774. (i - t0) / diff,
  48775. cssColor
  48776. ]);
  48777. }
  48778. var background = 'transparent';
  48779. if (dict.has('Background')) {
  48780. rgbColor = cs.getRgb(dict.get('Background'), 0);
  48781. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48782. }
  48783. if (!extendStart) {
  48784. colorStops.unshift([
  48785. 0,
  48786. background
  48787. ]);
  48788. colorStops[1][0] += Shadings.SMALL_NUMBER;
  48789. }
  48790. if (!extendEnd) {
  48791. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  48792. colorStops.push([
  48793. 1,
  48794. background
  48795. ]);
  48796. }
  48797. this.colorStops = colorStops;
  48798. }
  48799. RadialAxial.prototype = {
  48800. getIR: function RadialAxial_getIR() {
  48801. var coordsArr = this.coordsArr;
  48802. var shadingType = this.shadingType;
  48803. var type, p0, p1, r0, r1;
  48804. if (shadingType === ShadingType.AXIAL) {
  48805. p0 = [
  48806. coordsArr[0],
  48807. coordsArr[1]
  48808. ];
  48809. p1 = [
  48810. coordsArr[2],
  48811. coordsArr[3]
  48812. ];
  48813. r0 = null;
  48814. r1 = null;
  48815. type = 'axial';
  48816. } else if (shadingType === ShadingType.RADIAL) {
  48817. p0 = [
  48818. coordsArr[0],
  48819. coordsArr[1]
  48820. ];
  48821. p1 = [
  48822. coordsArr[3],
  48823. coordsArr[4]
  48824. ];
  48825. r0 = coordsArr[2];
  48826. r1 = coordsArr[5];
  48827. type = 'radial';
  48828. } else {
  48829. error('getPattern type unknown: ' + shadingType);
  48830. }
  48831. var matrix = this.matrix;
  48832. if (matrix) {
  48833. p0 = Util.applyTransform(p0, matrix);
  48834. p1 = Util.applyTransform(p1, matrix);
  48835. if (shadingType === ShadingType.RADIAL) {
  48836. var scale = Util.singularValueDecompose2dScale(matrix);
  48837. r0 *= scale[0];
  48838. r1 *= scale[1];
  48839. }
  48840. }
  48841. return [
  48842. 'RadialAxial',
  48843. type,
  48844. this.colorStops,
  48845. p0,
  48846. p1,
  48847. r0,
  48848. r1
  48849. ];
  48850. }
  48851. };
  48852. return RadialAxial;
  48853. }();
  48854. Shadings.Mesh = function MeshClosure() {
  48855. function MeshStreamReader(stream, context) {
  48856. this.stream = stream;
  48857. this.context = context;
  48858. this.buffer = 0;
  48859. this.bufferLength = 0;
  48860. var numComps = context.numComps;
  48861. this.tmpCompsBuf = new Float32Array(numComps);
  48862. var csNumComps = context.colorSpace.numComps;
  48863. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48864. }
  48865. MeshStreamReader.prototype = {
  48866. get hasData() {
  48867. if (this.stream.end) {
  48868. return this.stream.pos < this.stream.end;
  48869. }
  48870. if (this.bufferLength > 0) {
  48871. return true;
  48872. }
  48873. var nextByte = this.stream.getByte();
  48874. if (nextByte < 0) {
  48875. return false;
  48876. }
  48877. this.buffer = nextByte;
  48878. this.bufferLength = 8;
  48879. return true;
  48880. },
  48881. readBits: function MeshStreamReader_readBits(n) {
  48882. var buffer = this.buffer;
  48883. var bufferLength = this.bufferLength;
  48884. if (n === 32) {
  48885. if (bufferLength === 0) {
  48886. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48887. }
  48888. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48889. var nextByte = this.stream.getByte();
  48890. this.buffer = nextByte & (1 << bufferLength) - 1;
  48891. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48892. }
  48893. if (n === 8 && bufferLength === 0) {
  48894. return this.stream.getByte();
  48895. }
  48896. while (bufferLength < n) {
  48897. buffer = buffer << 8 | this.stream.getByte();
  48898. bufferLength += 8;
  48899. }
  48900. bufferLength -= n;
  48901. this.bufferLength = bufferLength;
  48902. this.buffer = buffer & (1 << bufferLength) - 1;
  48903. return buffer >> bufferLength;
  48904. },
  48905. align: function MeshStreamReader_align() {
  48906. this.buffer = 0;
  48907. this.bufferLength = 0;
  48908. },
  48909. readFlag: function MeshStreamReader_readFlag() {
  48910. return this.readBits(this.context.bitsPerFlag);
  48911. },
  48912. readCoordinate: function MeshStreamReader_readCoordinate() {
  48913. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48914. var xi = this.readBits(bitsPerCoordinate);
  48915. var yi = this.readBits(bitsPerCoordinate);
  48916. var decode = this.context.decode;
  48917. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48918. return [
  48919. xi * scale * (decode[1] - decode[0]) + decode[0],
  48920. yi * scale * (decode[3] - decode[2]) + decode[2]
  48921. ];
  48922. },
  48923. readComponents: function MeshStreamReader_readComponents() {
  48924. var numComps = this.context.numComps;
  48925. var bitsPerComponent = this.context.bitsPerComponent;
  48926. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48927. var decode = this.context.decode;
  48928. var components = this.tmpCompsBuf;
  48929. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48930. var ci = this.readBits(bitsPerComponent);
  48931. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48932. }
  48933. var color = this.tmpCsCompsBuf;
  48934. if (this.context.colorFn) {
  48935. this.context.colorFn(components, 0, color, 0);
  48936. }
  48937. return this.context.colorSpace.getRgb(color, 0);
  48938. }
  48939. };
  48940. function decodeType4Shading(mesh, reader) {
  48941. var coords = mesh.coords;
  48942. var colors = mesh.colors;
  48943. var operators = [];
  48944. var ps = [];
  48945. var verticesLeft = 0;
  48946. while (reader.hasData) {
  48947. var f = reader.readFlag();
  48948. var coord = reader.readCoordinate();
  48949. var color = reader.readComponents();
  48950. if (verticesLeft === 0) {
  48951. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48952. switch (f) {
  48953. case 0:
  48954. verticesLeft = 3;
  48955. break;
  48956. case 1:
  48957. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48958. verticesLeft = 1;
  48959. break;
  48960. case 2:
  48961. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48962. verticesLeft = 1;
  48963. break;
  48964. }
  48965. operators.push(f);
  48966. }
  48967. ps.push(coords.length);
  48968. coords.push(coord);
  48969. colors.push(color);
  48970. verticesLeft--;
  48971. reader.align();
  48972. }
  48973. mesh.figures.push({
  48974. type: 'triangles',
  48975. coords: new Int32Array(ps),
  48976. colors: new Int32Array(ps)
  48977. });
  48978. }
  48979. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48980. var coords = mesh.coords;
  48981. var colors = mesh.colors;
  48982. var ps = [];
  48983. while (reader.hasData) {
  48984. var coord = reader.readCoordinate();
  48985. var color = reader.readComponents();
  48986. ps.push(coords.length);
  48987. coords.push(coord);
  48988. colors.push(color);
  48989. }
  48990. mesh.figures.push({
  48991. type: 'lattice',
  48992. coords: new Int32Array(ps),
  48993. colors: new Int32Array(ps),
  48994. verticesPerRow: verticesPerRow
  48995. });
  48996. }
  48997. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48998. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48999. var TRIANGLE_DENSITY = 20;
  49000. var getB = function getBClosure() {
  49001. function buildB(count) {
  49002. var lut = [];
  49003. for (var i = 0; i <= count; i++) {
  49004. var t = i / count, t_ = 1 - t;
  49005. lut.push(new Float32Array([
  49006. t_ * t_ * t_,
  49007. 3 * t * t_ * t_,
  49008. 3 * t * t * t_,
  49009. t * t * t
  49010. ]));
  49011. }
  49012. return lut;
  49013. }
  49014. var cache = [];
  49015. return function getB(count) {
  49016. if (!cache[count]) {
  49017. cache[count] = buildB(count);
  49018. }
  49019. return cache[count];
  49020. };
  49021. }();
  49022. function buildFigureFromPatch(mesh, index) {
  49023. var figure = mesh.figures[index];
  49024. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  49025. var coords = mesh.coords, colors = mesh.colors;
  49026. var pi = figure.coords;
  49027. var ci = figure.colors;
  49028. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49029. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49030. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49031. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49032. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  49033. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  49034. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  49035. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  49036. var verticesPerRow = splitXBy + 1;
  49037. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  49038. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  49039. var k = 0;
  49040. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  49041. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  49042. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  49043. for (var row = 0; row <= splitYBy; row++) {
  49044. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  49045. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  49046. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  49047. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  49048. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  49049. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  49050. for (var col = 0; col <= splitXBy; col++, k++) {
  49051. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  49052. continue;
  49053. }
  49054. var x = 0, y = 0;
  49055. var q = 0;
  49056. for (var i = 0; i <= 3; i++) {
  49057. for (var j = 0; j <= 3; j++, q++) {
  49058. var m = bRow[row][i] * bCol[col][j];
  49059. x += coords[pi[q]][0] * m;
  49060. y += coords[pi[q]][1] * m;
  49061. }
  49062. }
  49063. figureCoords[k] = coords.length;
  49064. coords.push([
  49065. x,
  49066. y
  49067. ]);
  49068. figureColors[k] = colors.length;
  49069. var newColor = new Uint8Array(3);
  49070. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  49071. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  49072. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  49073. colors.push(newColor);
  49074. }
  49075. }
  49076. figureCoords[0] = pi[0];
  49077. figureColors[0] = ci[0];
  49078. figureCoords[splitXBy] = pi[3];
  49079. figureColors[splitXBy] = ci[1];
  49080. figureCoords[verticesPerRow * splitYBy] = pi[12];
  49081. figureColors[verticesPerRow * splitYBy] = ci[2];
  49082. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  49083. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  49084. mesh.figures[index] = {
  49085. type: 'lattice',
  49086. coords: figureCoords,
  49087. colors: figureColors,
  49088. verticesPerRow: verticesPerRow
  49089. };
  49090. }
  49091. function decodeType6Shading(mesh, reader) {
  49092. var coords = mesh.coords;
  49093. var colors = mesh.colors;
  49094. var ps = new Int32Array(16);
  49095. var cs = new Int32Array(4);
  49096. while (reader.hasData) {
  49097. var f = reader.readFlag();
  49098. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  49099. var i, ii;
  49100. var pi = coords.length;
  49101. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  49102. coords.push(reader.readCoordinate());
  49103. }
  49104. var ci = colors.length;
  49105. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49106. colors.push(reader.readComponents());
  49107. }
  49108. var tmp1, tmp2, tmp3, tmp4;
  49109. switch (f) {
  49110. case 0:
  49111. ps[12] = pi + 3;
  49112. ps[13] = pi + 4;
  49113. ps[14] = pi + 5;
  49114. ps[15] = pi + 6;
  49115. ps[8] = pi + 2;
  49116. ps[11] = pi + 7;
  49117. ps[4] = pi + 1;
  49118. ps[7] = pi + 8;
  49119. ps[0] = pi;
  49120. ps[1] = pi + 11;
  49121. ps[2] = pi + 10;
  49122. ps[3] = pi + 9;
  49123. cs[2] = ci + 1;
  49124. cs[3] = ci + 2;
  49125. cs[0] = ci;
  49126. cs[1] = ci + 3;
  49127. break;
  49128. case 1:
  49129. tmp1 = ps[12];
  49130. tmp2 = ps[13];
  49131. tmp3 = ps[14];
  49132. tmp4 = ps[15];
  49133. ps[12] = tmp4;
  49134. ps[13] = pi + 0;
  49135. ps[14] = pi + 1;
  49136. ps[15] = pi + 2;
  49137. ps[8] = tmp3;
  49138. ps[11] = pi + 3;
  49139. ps[4] = tmp2;
  49140. ps[7] = pi + 4;
  49141. ps[0] = tmp1;
  49142. ps[1] = pi + 7;
  49143. ps[2] = pi + 6;
  49144. ps[3] = pi + 5;
  49145. tmp1 = cs[2];
  49146. tmp2 = cs[3];
  49147. cs[2] = tmp2;
  49148. cs[3] = ci;
  49149. cs[0] = tmp1;
  49150. cs[1] = ci + 1;
  49151. break;
  49152. case 2:
  49153. tmp1 = ps[15];
  49154. tmp2 = ps[11];
  49155. ps[12] = ps[3];
  49156. ps[13] = pi + 0;
  49157. ps[14] = pi + 1;
  49158. ps[15] = pi + 2;
  49159. ps[8] = ps[7];
  49160. ps[11] = pi + 3;
  49161. ps[4] = tmp2;
  49162. ps[7] = pi + 4;
  49163. ps[0] = tmp1;
  49164. ps[1] = pi + 7;
  49165. ps[2] = pi + 6;
  49166. ps[3] = pi + 5;
  49167. tmp1 = cs[3];
  49168. cs[2] = cs[1];
  49169. cs[3] = ci;
  49170. cs[0] = tmp1;
  49171. cs[1] = ci + 1;
  49172. break;
  49173. case 3:
  49174. ps[12] = ps[0];
  49175. ps[13] = pi + 0;
  49176. ps[14] = pi + 1;
  49177. ps[15] = pi + 2;
  49178. ps[8] = ps[1];
  49179. ps[11] = pi + 3;
  49180. ps[4] = ps[2];
  49181. ps[7] = pi + 4;
  49182. ps[0] = ps[3];
  49183. ps[1] = pi + 7;
  49184. ps[2] = pi + 6;
  49185. ps[3] = pi + 5;
  49186. cs[2] = cs[0];
  49187. cs[3] = ci;
  49188. cs[0] = cs[1];
  49189. cs[1] = ci + 1;
  49190. break;
  49191. }
  49192. ps[5] = coords.length;
  49193. coords.push([
  49194. (-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,
  49195. (-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
  49196. ]);
  49197. ps[6] = coords.length;
  49198. coords.push([
  49199. (-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,
  49200. (-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
  49201. ]);
  49202. ps[9] = coords.length;
  49203. coords.push([
  49204. (-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,
  49205. (-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
  49206. ]);
  49207. ps[10] = coords.length;
  49208. coords.push([
  49209. (-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,
  49210. (-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
  49211. ]);
  49212. mesh.figures.push({
  49213. type: 'patch',
  49214. coords: new Int32Array(ps),
  49215. colors: new Int32Array(cs)
  49216. });
  49217. }
  49218. }
  49219. function decodeType7Shading(mesh, reader) {
  49220. var coords = mesh.coords;
  49221. var colors = mesh.colors;
  49222. var ps = new Int32Array(16);
  49223. var cs = new Int32Array(4);
  49224. while (reader.hasData) {
  49225. var f = reader.readFlag();
  49226. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  49227. var i, ii;
  49228. var pi = coords.length;
  49229. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  49230. coords.push(reader.readCoordinate());
  49231. }
  49232. var ci = colors.length;
  49233. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49234. colors.push(reader.readComponents());
  49235. }
  49236. var tmp1, tmp2, tmp3, tmp4;
  49237. switch (f) {
  49238. case 0:
  49239. ps[12] = pi + 3;
  49240. ps[13] = pi + 4;
  49241. ps[14] = pi + 5;
  49242. ps[15] = pi + 6;
  49243. ps[8] = pi + 2;
  49244. ps[9] = pi + 13;
  49245. ps[10] = pi + 14;
  49246. ps[11] = pi + 7;
  49247. ps[4] = pi + 1;
  49248. ps[5] = pi + 12;
  49249. ps[6] = pi + 15;
  49250. ps[7] = pi + 8;
  49251. ps[0] = pi;
  49252. ps[1] = pi + 11;
  49253. ps[2] = pi + 10;
  49254. ps[3] = pi + 9;
  49255. cs[2] = ci + 1;
  49256. cs[3] = ci + 2;
  49257. cs[0] = ci;
  49258. cs[1] = ci + 3;
  49259. break;
  49260. case 1:
  49261. tmp1 = ps[12];
  49262. tmp2 = ps[13];
  49263. tmp3 = ps[14];
  49264. tmp4 = ps[15];
  49265. ps[12] = tmp4;
  49266. ps[13] = pi + 0;
  49267. ps[14] = pi + 1;
  49268. ps[15] = pi + 2;
  49269. ps[8] = tmp3;
  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[2];
  49282. tmp2 = cs[3];
  49283. cs[2] = tmp2;
  49284. cs[3] = ci;
  49285. cs[0] = tmp1;
  49286. cs[1] = ci + 1;
  49287. break;
  49288. case 2:
  49289. tmp1 = ps[15];
  49290. tmp2 = ps[11];
  49291. ps[12] = ps[3];
  49292. ps[13] = pi + 0;
  49293. ps[14] = pi + 1;
  49294. ps[15] = pi + 2;
  49295. ps[8] = ps[7];
  49296. ps[9] = pi + 9;
  49297. ps[10] = pi + 10;
  49298. ps[11] = pi + 3;
  49299. ps[4] = tmp2;
  49300. ps[5] = pi + 8;
  49301. ps[6] = pi + 11;
  49302. ps[7] = pi + 4;
  49303. ps[0] = tmp1;
  49304. ps[1] = pi + 7;
  49305. ps[2] = pi + 6;
  49306. ps[3] = pi + 5;
  49307. tmp1 = cs[3];
  49308. cs[2] = cs[1];
  49309. cs[3] = ci;
  49310. cs[0] = tmp1;
  49311. cs[1] = ci + 1;
  49312. break;
  49313. case 3:
  49314. ps[12] = ps[0];
  49315. ps[13] = pi + 0;
  49316. ps[14] = pi + 1;
  49317. ps[15] = pi + 2;
  49318. ps[8] = ps[1];
  49319. ps[9] = pi + 9;
  49320. ps[10] = pi + 10;
  49321. ps[11] = pi + 3;
  49322. ps[4] = ps[2];
  49323. ps[5] = pi + 8;
  49324. ps[6] = pi + 11;
  49325. ps[7] = pi + 4;
  49326. ps[0] = ps[3];
  49327. ps[1] = pi + 7;
  49328. ps[2] = pi + 6;
  49329. ps[3] = pi + 5;
  49330. cs[2] = cs[0];
  49331. cs[3] = ci;
  49332. cs[0] = cs[1];
  49333. cs[1] = ci + 1;
  49334. break;
  49335. }
  49336. mesh.figures.push({
  49337. type: 'patch',
  49338. coords: new Int32Array(ps),
  49339. colors: new Int32Array(cs)
  49340. });
  49341. }
  49342. }
  49343. function updateBounds(mesh) {
  49344. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  49345. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  49346. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  49347. minX = minX > x ? x : minX;
  49348. minY = minY > y ? y : minY;
  49349. maxX = maxX < x ? x : maxX;
  49350. maxY = maxY < y ? y : maxY;
  49351. }
  49352. mesh.bounds = [
  49353. minX,
  49354. minY,
  49355. maxX,
  49356. maxY
  49357. ];
  49358. }
  49359. function packData(mesh) {
  49360. var i, ii, j, jj;
  49361. var coords = mesh.coords;
  49362. var coordsPacked = new Float32Array(coords.length * 2);
  49363. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  49364. var xy = coords[i];
  49365. coordsPacked[j++] = xy[0];
  49366. coordsPacked[j++] = xy[1];
  49367. }
  49368. mesh.coords = coordsPacked;
  49369. var colors = mesh.colors;
  49370. var colorsPacked = new Uint8Array(colors.length * 3);
  49371. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  49372. var c = colors[i];
  49373. colorsPacked[j++] = c[0];
  49374. colorsPacked[j++] = c[1];
  49375. colorsPacked[j++] = c[2];
  49376. }
  49377. mesh.colors = colorsPacked;
  49378. var figures = mesh.figures;
  49379. for (i = 0, ii = figures.length; i < ii; i++) {
  49380. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  49381. for (j = 0, jj = ps.length; j < jj; j++) {
  49382. ps[j] *= 2;
  49383. cs[j] *= 3;
  49384. }
  49385. }
  49386. }
  49387. function Mesh(stream, matrix, xref, res) {
  49388. assert(isStream(stream), 'Mesh data is not a stream');
  49389. var dict = stream.dict;
  49390. this.matrix = matrix;
  49391. this.shadingType = dict.get('ShadingType');
  49392. this.type = 'Pattern';
  49393. this.bbox = dict.getArray('BBox');
  49394. var cs = dict.get('ColorSpace', 'CS');
  49395. cs = ColorSpace.parse(cs, xref, res);
  49396. this.cs = cs;
  49397. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  49398. var fnObj = dict.get('Function');
  49399. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  49400. this.coords = [];
  49401. this.colors = [];
  49402. this.figures = [];
  49403. var decodeContext = {
  49404. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  49405. bitsPerComponent: dict.get('BitsPerComponent'),
  49406. bitsPerFlag: dict.get('BitsPerFlag'),
  49407. decode: dict.getArray('Decode'),
  49408. colorFn: fn,
  49409. colorSpace: cs,
  49410. numComps: fn ? 1 : cs.numComps
  49411. };
  49412. var reader = new MeshStreamReader(stream, decodeContext);
  49413. var patchMesh = false;
  49414. switch (this.shadingType) {
  49415. case ShadingType.FREE_FORM_MESH:
  49416. decodeType4Shading(this, reader);
  49417. break;
  49418. case ShadingType.LATTICE_FORM_MESH:
  49419. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  49420. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  49421. decodeType5Shading(this, reader, verticesPerRow);
  49422. break;
  49423. case ShadingType.COONS_PATCH_MESH:
  49424. decodeType6Shading(this, reader);
  49425. patchMesh = true;
  49426. break;
  49427. case ShadingType.TENSOR_PATCH_MESH:
  49428. decodeType7Shading(this, reader);
  49429. patchMesh = true;
  49430. break;
  49431. default:
  49432. error('Unsupported mesh type.');
  49433. break;
  49434. }
  49435. if (patchMesh) {
  49436. updateBounds(this);
  49437. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  49438. buildFigureFromPatch(this, i);
  49439. }
  49440. }
  49441. updateBounds(this);
  49442. packData(this);
  49443. }
  49444. Mesh.prototype = {
  49445. getIR: function Mesh_getIR() {
  49446. return [
  49447. 'Mesh',
  49448. this.shadingType,
  49449. this.coords,
  49450. this.colors,
  49451. this.figures,
  49452. this.bounds,
  49453. this.matrix,
  49454. this.bbox,
  49455. this.background
  49456. ];
  49457. }
  49458. };
  49459. return Mesh;
  49460. }();
  49461. Shadings.Dummy = function DummyClosure() {
  49462. function Dummy() {
  49463. this.type = 'Pattern';
  49464. }
  49465. Dummy.prototype = {
  49466. getIR: function Dummy_getIR() {
  49467. return ['Dummy'];
  49468. }
  49469. };
  49470. return Dummy;
  49471. }();
  49472. function getTilingPatternIR(operatorList, dict, args) {
  49473. var matrix = dict.getArray('Matrix');
  49474. var bbox = dict.getArray('BBox');
  49475. var xstep = dict.get('XStep');
  49476. var ystep = dict.get('YStep');
  49477. var paintType = dict.get('PaintType');
  49478. var tilingType = dict.get('TilingType');
  49479. return [
  49480. 'TilingPattern',
  49481. args,
  49482. operatorList,
  49483. matrix,
  49484. bbox,
  49485. xstep,
  49486. ystep,
  49487. paintType,
  49488. tilingType
  49489. ];
  49490. }
  49491. exports.Pattern = Pattern;
  49492. exports.getTilingPatternIR = getTilingPatternIR;
  49493. /***/ }),
  49494. /* 34 */
  49495. /***/ (function(module, exports, __w_pdfjs_require__) {
  49496. "use strict";
  49497. var sharedUtil = __w_pdfjs_require__(0);
  49498. var coreStream = __w_pdfjs_require__(2);
  49499. var coreChunkedStream = __w_pdfjs_require__(11);
  49500. var coreDocument = __w_pdfjs_require__(25);
  49501. var warn = sharedUtil.warn;
  49502. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  49503. var shadow = sharedUtil.shadow;
  49504. var NotImplementedException = sharedUtil.NotImplementedException;
  49505. var MissingDataException = sharedUtil.MissingDataException;
  49506. var createPromiseCapability = sharedUtil.createPromiseCapability;
  49507. var Util = sharedUtil.Util;
  49508. var Stream = coreStream.Stream;
  49509. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  49510. var PDFDocument = coreDocument.PDFDocument;
  49511. var BasePdfManager = function BasePdfManagerClosure() {
  49512. function BasePdfManager() {
  49513. throw new Error('Cannot initialize BaseManagerManager');
  49514. }
  49515. BasePdfManager.prototype = {
  49516. get docId() {
  49517. return this._docId;
  49518. },
  49519. get password() {
  49520. return this._password;
  49521. },
  49522. get docBaseUrl() {
  49523. var docBaseUrl = null;
  49524. if (this._docBaseUrl) {
  49525. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  49526. if (absoluteUrl) {
  49527. docBaseUrl = absoluteUrl.href;
  49528. } else {
  49529. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  49530. }
  49531. }
  49532. return shadow(this, 'docBaseUrl', docBaseUrl);
  49533. },
  49534. onLoadedStream: function BasePdfManager_onLoadedStream() {
  49535. throw new NotImplementedException();
  49536. },
  49537. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  49538. return this.ensure(this.pdfDocument, prop, args);
  49539. },
  49540. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  49541. return this.ensure(this.pdfDocument.xref, prop, args);
  49542. },
  49543. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  49544. return this.ensure(this.pdfDocument.catalog, prop, args);
  49545. },
  49546. getPage: function BasePdfManager_getPage(pageIndex) {
  49547. return this.pdfDocument.getPage(pageIndex);
  49548. },
  49549. cleanup: function BasePdfManager_cleanup() {
  49550. return this.pdfDocument.cleanup();
  49551. },
  49552. ensure: function BasePdfManager_ensure(obj, prop, args) {
  49553. return new NotImplementedException();
  49554. },
  49555. requestRange: function BasePdfManager_requestRange(begin, end) {
  49556. return new NotImplementedException();
  49557. },
  49558. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  49559. return new NotImplementedException();
  49560. },
  49561. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  49562. return new NotImplementedException();
  49563. },
  49564. updatePassword: function BasePdfManager_updatePassword(password) {
  49565. this._password = password;
  49566. },
  49567. terminate: function BasePdfManager_terminate() {
  49568. return new NotImplementedException();
  49569. }
  49570. };
  49571. return BasePdfManager;
  49572. }();
  49573. var LocalPdfManager = function LocalPdfManagerClosure() {
  49574. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  49575. this._docId = docId;
  49576. this._password = password;
  49577. this._docBaseUrl = docBaseUrl;
  49578. this.evaluatorOptions = evaluatorOptions;
  49579. var stream = new Stream(data);
  49580. this.pdfDocument = new PDFDocument(this, stream);
  49581. this._loadedStreamCapability = createPromiseCapability();
  49582. this._loadedStreamCapability.resolve(stream);
  49583. }
  49584. Util.inherit(LocalPdfManager, BasePdfManager, {
  49585. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  49586. return new Promise(function (resolve, reject) {
  49587. try {
  49588. var value = obj[prop];
  49589. var result;
  49590. if (typeof value === 'function') {
  49591. result = value.apply(obj, args);
  49592. } else {
  49593. result = value;
  49594. }
  49595. resolve(result);
  49596. } catch (e) {
  49597. reject(e);
  49598. }
  49599. });
  49600. },
  49601. requestRange: function LocalPdfManager_requestRange(begin, end) {
  49602. return Promise.resolve();
  49603. },
  49604. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  49605. },
  49606. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  49607. return this._loadedStreamCapability.promise;
  49608. },
  49609. terminate: function LocalPdfManager_terminate() {
  49610. }
  49611. });
  49612. return LocalPdfManager;
  49613. }();
  49614. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  49615. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  49616. this._docId = docId;
  49617. this._password = args.password;
  49618. this._docBaseUrl = docBaseUrl;
  49619. this.msgHandler = args.msgHandler;
  49620. this.evaluatorOptions = evaluatorOptions;
  49621. var params = {
  49622. msgHandler: args.msgHandler,
  49623. url: args.url,
  49624. length: args.length,
  49625. disableAutoFetch: args.disableAutoFetch,
  49626. rangeChunkSize: args.rangeChunkSize
  49627. };
  49628. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  49629. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  49630. }
  49631. Util.inherit(NetworkPdfManager, BasePdfManager, {
  49632. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  49633. var pdfManager = this;
  49634. return new Promise(function (resolve, reject) {
  49635. function ensureHelper() {
  49636. try {
  49637. var result;
  49638. var value = obj[prop];
  49639. if (typeof value === 'function') {
  49640. result = value.apply(obj, args);
  49641. } else {
  49642. result = value;
  49643. }
  49644. resolve(result);
  49645. } catch (e) {
  49646. if (!(e instanceof MissingDataException)) {
  49647. reject(e);
  49648. return;
  49649. }
  49650. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  49651. }
  49652. }
  49653. ensureHelper();
  49654. });
  49655. },
  49656. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  49657. return this.streamManager.requestRange(begin, end);
  49658. },
  49659. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  49660. this.streamManager.requestAllChunks();
  49661. },
  49662. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  49663. this.streamManager.onReceiveData({ chunk: chunk });
  49664. },
  49665. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  49666. return this.streamManager.onLoadedStream();
  49667. },
  49668. terminate: function NetworkPdfManager_terminate() {
  49669. this.streamManager.abort();
  49670. }
  49671. });
  49672. return NetworkPdfManager;
  49673. }();
  49674. exports.LocalPdfManager = LocalPdfManager;
  49675. exports.NetworkPdfManager = NetworkPdfManager;
  49676. /***/ }),
  49677. /* 35 */
  49678. /***/ (function(module, exports, __w_pdfjs_require__) {
  49679. "use strict";
  49680. var sharedUtil = __w_pdfjs_require__(0);
  49681. var corePrimitives = __w_pdfjs_require__(1);
  49682. var error = sharedUtil.error;
  49683. var isSpace = sharedUtil.isSpace;
  49684. var EOF = corePrimitives.EOF;
  49685. var PostScriptParser = function PostScriptParserClosure() {
  49686. function PostScriptParser(lexer) {
  49687. this.lexer = lexer;
  49688. this.operators = [];
  49689. this.token = null;
  49690. this.prev = null;
  49691. }
  49692. PostScriptParser.prototype = {
  49693. nextToken: function PostScriptParser_nextToken() {
  49694. this.prev = this.token;
  49695. this.token = this.lexer.getToken();
  49696. },
  49697. accept: function PostScriptParser_accept(type) {
  49698. if (this.token.type === type) {
  49699. this.nextToken();
  49700. return true;
  49701. }
  49702. return false;
  49703. },
  49704. expect: function PostScriptParser_expect(type) {
  49705. if (this.accept(type)) {
  49706. return true;
  49707. }
  49708. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  49709. },
  49710. parse: function PostScriptParser_parse() {
  49711. this.nextToken();
  49712. this.expect(PostScriptTokenTypes.LBRACE);
  49713. this.parseBlock();
  49714. this.expect(PostScriptTokenTypes.RBRACE);
  49715. return this.operators;
  49716. },
  49717. parseBlock: function PostScriptParser_parseBlock() {
  49718. while (true) {
  49719. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  49720. this.operators.push(this.prev.value);
  49721. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  49722. this.operators.push(this.prev.value);
  49723. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49724. this.parseCondition();
  49725. } else {
  49726. return;
  49727. }
  49728. }
  49729. },
  49730. parseCondition: function PostScriptParser_parseCondition() {
  49731. var conditionLocation = this.operators.length;
  49732. this.operators.push(null, null);
  49733. this.parseBlock();
  49734. this.expect(PostScriptTokenTypes.RBRACE);
  49735. if (this.accept(PostScriptTokenTypes.IF)) {
  49736. this.operators[conditionLocation] = this.operators.length;
  49737. this.operators[conditionLocation + 1] = 'jz';
  49738. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49739. var jumpLocation = this.operators.length;
  49740. this.operators.push(null, null);
  49741. var endOfTrue = this.operators.length;
  49742. this.parseBlock();
  49743. this.expect(PostScriptTokenTypes.RBRACE);
  49744. this.expect(PostScriptTokenTypes.IFELSE);
  49745. this.operators[jumpLocation] = this.operators.length;
  49746. this.operators[jumpLocation + 1] = 'j';
  49747. this.operators[conditionLocation] = endOfTrue;
  49748. this.operators[conditionLocation + 1] = 'jz';
  49749. } else {
  49750. error('PS Function: error parsing conditional.');
  49751. }
  49752. }
  49753. };
  49754. return PostScriptParser;
  49755. }();
  49756. var PostScriptTokenTypes = {
  49757. LBRACE: 0,
  49758. RBRACE: 1,
  49759. NUMBER: 2,
  49760. OPERATOR: 3,
  49761. IF: 4,
  49762. IFELSE: 5
  49763. };
  49764. var PostScriptToken = function PostScriptTokenClosure() {
  49765. function PostScriptToken(type, value) {
  49766. this.type = type;
  49767. this.value = value;
  49768. }
  49769. var opCache = Object.create(null);
  49770. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  49771. var opValue = opCache[op];
  49772. if (opValue) {
  49773. return opValue;
  49774. }
  49775. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49776. };
  49777. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  49778. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  49779. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  49780. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  49781. return PostScriptToken;
  49782. }();
  49783. var PostScriptLexer = function PostScriptLexerClosure() {
  49784. function PostScriptLexer(stream) {
  49785. this.stream = stream;
  49786. this.nextChar();
  49787. this.strBuf = [];
  49788. }
  49789. PostScriptLexer.prototype = {
  49790. nextChar: function PostScriptLexer_nextChar() {
  49791. return this.currentChar = this.stream.getByte();
  49792. },
  49793. getToken: function PostScriptLexer_getToken() {
  49794. var comment = false;
  49795. var ch = this.currentChar;
  49796. while (true) {
  49797. if (ch < 0) {
  49798. return EOF;
  49799. }
  49800. if (comment) {
  49801. if (ch === 0x0A || ch === 0x0D) {
  49802. comment = false;
  49803. }
  49804. } else if (ch === 0x25) {
  49805. comment = true;
  49806. } else if (!isSpace(ch)) {
  49807. break;
  49808. }
  49809. ch = this.nextChar();
  49810. }
  49811. switch (ch | 0) {
  49812. case 0x30:
  49813. case 0x31:
  49814. case 0x32:
  49815. case 0x33:
  49816. case 0x34:
  49817. case 0x35:
  49818. case 0x36:
  49819. case 0x37:
  49820. case 0x38:
  49821. case 0x39:
  49822. case 0x2B:
  49823. case 0x2D:
  49824. case 0x2E:
  49825. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49826. case 0x7B:
  49827. this.nextChar();
  49828. return PostScriptToken.LBRACE;
  49829. case 0x7D:
  49830. this.nextChar();
  49831. return PostScriptToken.RBRACE;
  49832. }
  49833. var strBuf = this.strBuf;
  49834. strBuf.length = 0;
  49835. strBuf[0] = String.fromCharCode(ch);
  49836. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  49837. strBuf.push(String.fromCharCode(ch));
  49838. }
  49839. var str = strBuf.join('');
  49840. switch (str.toLowerCase()) {
  49841. case 'if':
  49842. return PostScriptToken.IF;
  49843. case 'ifelse':
  49844. return PostScriptToken.IFELSE;
  49845. default:
  49846. return PostScriptToken.getOperator(str);
  49847. }
  49848. },
  49849. getNumber: function PostScriptLexer_getNumber() {
  49850. var ch = this.currentChar;
  49851. var strBuf = this.strBuf;
  49852. strBuf.length = 0;
  49853. strBuf[0] = String.fromCharCode(ch);
  49854. while ((ch = this.nextChar()) >= 0) {
  49855. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49856. strBuf.push(String.fromCharCode(ch));
  49857. } else {
  49858. break;
  49859. }
  49860. }
  49861. var value = parseFloat(strBuf.join(''));
  49862. if (isNaN(value)) {
  49863. error('Invalid floating point number: ' + value);
  49864. }
  49865. return value;
  49866. }
  49867. };
  49868. return PostScriptLexer;
  49869. }();
  49870. exports.PostScriptLexer = PostScriptLexer;
  49871. exports.PostScriptParser = PostScriptParser;
  49872. /***/ }),
  49873. /* 36 */
  49874. /***/ (function(module, exports, __w_pdfjs_require__) {
  49875. "use strict";
  49876. var sharedUtil = __w_pdfjs_require__(0);
  49877. var coreStream = __w_pdfjs_require__(2);
  49878. var coreEncodings = __w_pdfjs_require__(4);
  49879. var warn = sharedUtil.warn;
  49880. var isSpace = sharedUtil.isSpace;
  49881. var Stream = coreStream.Stream;
  49882. var getEncoding = coreEncodings.getEncoding;
  49883. var HINTING_ENABLED = false;
  49884. var Type1CharString = function Type1CharStringClosure() {
  49885. var COMMAND_MAP = {
  49886. 'hstem': [1],
  49887. 'vstem': [3],
  49888. 'vmoveto': [4],
  49889. 'rlineto': [5],
  49890. 'hlineto': [6],
  49891. 'vlineto': [7],
  49892. 'rrcurveto': [8],
  49893. 'callsubr': [10],
  49894. 'flex': [
  49895. 12,
  49896. 35
  49897. ],
  49898. 'drop': [
  49899. 12,
  49900. 18
  49901. ],
  49902. 'endchar': [14],
  49903. 'rmoveto': [21],
  49904. 'hmoveto': [22],
  49905. 'vhcurveto': [30],
  49906. 'hvcurveto': [31]
  49907. };
  49908. function Type1CharString() {
  49909. this.width = 0;
  49910. this.lsb = 0;
  49911. this.flexing = false;
  49912. this.output = [];
  49913. this.stack = [];
  49914. }
  49915. Type1CharString.prototype = {
  49916. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49917. var count = encoded.length;
  49918. var error = false;
  49919. var wx, sbx, subrNumber;
  49920. for (var i = 0; i < count; i++) {
  49921. var value = encoded[i];
  49922. if (value < 32) {
  49923. if (value === 12) {
  49924. value = (value << 8) + encoded[++i];
  49925. }
  49926. switch (value) {
  49927. case 1:
  49928. if (!HINTING_ENABLED) {
  49929. this.stack = [];
  49930. break;
  49931. }
  49932. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49933. break;
  49934. case 3:
  49935. if (!HINTING_ENABLED) {
  49936. this.stack = [];
  49937. break;
  49938. }
  49939. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49940. break;
  49941. case 4:
  49942. if (this.flexing) {
  49943. if (this.stack.length < 1) {
  49944. error = true;
  49945. break;
  49946. }
  49947. var dy = this.stack.pop();
  49948. this.stack.push(0, dy);
  49949. break;
  49950. }
  49951. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49952. break;
  49953. case 5:
  49954. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49955. break;
  49956. case 6:
  49957. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49958. break;
  49959. case 7:
  49960. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49961. break;
  49962. case 8:
  49963. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49964. break;
  49965. case 9:
  49966. this.stack = [];
  49967. break;
  49968. case 10:
  49969. if (this.stack.length < 1) {
  49970. error = true;
  49971. break;
  49972. }
  49973. subrNumber = this.stack.pop();
  49974. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49975. break;
  49976. case 11:
  49977. return error;
  49978. case 13:
  49979. if (this.stack.length < 2) {
  49980. error = true;
  49981. break;
  49982. }
  49983. wx = this.stack.pop();
  49984. sbx = this.stack.pop();
  49985. this.lsb = sbx;
  49986. this.width = wx;
  49987. this.stack.push(wx, sbx);
  49988. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49989. break;
  49990. case 14:
  49991. this.output.push(COMMAND_MAP.endchar[0]);
  49992. break;
  49993. case 21:
  49994. if (this.flexing) {
  49995. break;
  49996. }
  49997. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49998. break;
  49999. case 22:
  50000. if (this.flexing) {
  50001. this.stack.push(0);
  50002. break;
  50003. }
  50004. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  50005. break;
  50006. case 30:
  50007. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  50008. break;
  50009. case 31:
  50010. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  50011. break;
  50012. case (12 << 8) + 0:
  50013. this.stack = [];
  50014. break;
  50015. case (12 << 8) + 1:
  50016. if (!HINTING_ENABLED) {
  50017. this.stack = [];
  50018. break;
  50019. }
  50020. error = this.executeCommand(2, COMMAND_MAP.vstem);
  50021. break;
  50022. case (12 << 8) + 2:
  50023. if (!HINTING_ENABLED) {
  50024. this.stack = [];
  50025. break;
  50026. }
  50027. error = this.executeCommand(2, COMMAND_MAP.hstem);
  50028. break;
  50029. case (12 << 8) + 6:
  50030. if (seacAnalysisEnabled) {
  50031. this.seac = this.stack.splice(-4, 4);
  50032. error = this.executeCommand(0, COMMAND_MAP.endchar);
  50033. } else {
  50034. error = this.executeCommand(4, COMMAND_MAP.endchar);
  50035. }
  50036. break;
  50037. case (12 << 8) + 7:
  50038. if (this.stack.length < 4) {
  50039. error = true;
  50040. break;
  50041. }
  50042. this.stack.pop();
  50043. wx = this.stack.pop();
  50044. var sby = this.stack.pop();
  50045. sbx = this.stack.pop();
  50046. this.lsb = sbx;
  50047. this.width = wx;
  50048. this.stack.push(wx, sbx, sby);
  50049. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  50050. break;
  50051. case (12 << 8) + 12:
  50052. if (this.stack.length < 2) {
  50053. error = true;
  50054. break;
  50055. }
  50056. var num2 = this.stack.pop();
  50057. var num1 = this.stack.pop();
  50058. this.stack.push(num1 / num2);
  50059. break;
  50060. case (12 << 8) + 16:
  50061. if (this.stack.length < 2) {
  50062. error = true;
  50063. break;
  50064. }
  50065. subrNumber = this.stack.pop();
  50066. var numArgs = this.stack.pop();
  50067. if (subrNumber === 0 && numArgs === 3) {
  50068. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  50069. 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]);
  50070. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  50071. this.flexing = false;
  50072. this.stack.push(flexArgs[15], flexArgs[16]);
  50073. } else if (subrNumber === 1 && numArgs === 0) {
  50074. this.flexing = true;
  50075. }
  50076. break;
  50077. case (12 << 8) + 17:
  50078. break;
  50079. case (12 << 8) + 33:
  50080. this.stack = [];
  50081. break;
  50082. default:
  50083. warn('Unknown type 1 charstring command of "' + value + '"');
  50084. break;
  50085. }
  50086. if (error) {
  50087. break;
  50088. }
  50089. continue;
  50090. } else if (value <= 246) {
  50091. value = value - 139;
  50092. } else if (value <= 250) {
  50093. value = (value - 247) * 256 + encoded[++i] + 108;
  50094. } else if (value <= 254) {
  50095. value = -((value - 251) * 256) - encoded[++i] - 108;
  50096. } else {
  50097. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  50098. }
  50099. this.stack.push(value);
  50100. }
  50101. return error;
  50102. },
  50103. executeCommand: function (howManyArgs, command, keepStack) {
  50104. var stackLength = this.stack.length;
  50105. if (howManyArgs > stackLength) {
  50106. return true;
  50107. }
  50108. var start = stackLength - howManyArgs;
  50109. for (var i = start; i < stackLength; i++) {
  50110. var value = this.stack[i];
  50111. if (value === (value | 0)) {
  50112. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  50113. } else {
  50114. value = 65536 * value | 0;
  50115. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  50116. }
  50117. }
  50118. this.output.push.apply(this.output, command);
  50119. if (keepStack) {
  50120. this.stack.splice(start, howManyArgs);
  50121. } else {
  50122. this.stack.length = 0;
  50123. }
  50124. return false;
  50125. }
  50126. };
  50127. return Type1CharString;
  50128. }();
  50129. var Type1Parser = function Type1ParserClosure() {
  50130. var EEXEC_ENCRYPT_KEY = 55665;
  50131. var CHAR_STRS_ENCRYPT_KEY = 4330;
  50132. function isHexDigit(code) {
  50133. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  50134. }
  50135. function decrypt(data, key, discardNumber) {
  50136. if (discardNumber >= data.length) {
  50137. return new Uint8Array(0);
  50138. }
  50139. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  50140. for (i = 0; i < discardNumber; i++) {
  50141. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  50142. }
  50143. var count = data.length - discardNumber;
  50144. var decrypted = new Uint8Array(count);
  50145. for (i = discardNumber, j = 0; j < count; i++, j++) {
  50146. var value = data[i];
  50147. decrypted[j] = value ^ r >> 8;
  50148. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50149. }
  50150. return decrypted;
  50151. }
  50152. function decryptAscii(data, key, discardNumber) {
  50153. var r = key | 0, c1 = 52845, c2 = 22719;
  50154. var count = data.length, maybeLength = count >>> 1;
  50155. var decrypted = new Uint8Array(maybeLength);
  50156. var i, j;
  50157. for (i = 0, j = 0; i < count; i++) {
  50158. var digit1 = data[i];
  50159. if (!isHexDigit(digit1)) {
  50160. continue;
  50161. }
  50162. i++;
  50163. var digit2;
  50164. while (i < count && !isHexDigit(digit2 = data[i])) {
  50165. i++;
  50166. }
  50167. if (i < count) {
  50168. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  50169. decrypted[j++] = value ^ r >> 8;
  50170. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50171. }
  50172. }
  50173. return Array.prototype.slice.call(decrypted, discardNumber, j);
  50174. }
  50175. function isSpecial(c) {
  50176. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  50177. }
  50178. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  50179. if (encrypted) {
  50180. var data = stream.getBytes();
  50181. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  50182. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  50183. }
  50184. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  50185. this.stream = stream;
  50186. this.nextChar();
  50187. }
  50188. Type1Parser.prototype = {
  50189. readNumberArray: function Type1Parser_readNumberArray() {
  50190. this.getToken();
  50191. var array = [];
  50192. while (true) {
  50193. var token = this.getToken();
  50194. if (token === null || token === ']' || token === '}') {
  50195. break;
  50196. }
  50197. array.push(parseFloat(token || 0));
  50198. }
  50199. return array;
  50200. },
  50201. readNumber: function Type1Parser_readNumber() {
  50202. var token = this.getToken();
  50203. return parseFloat(token || 0);
  50204. },
  50205. readInt: function Type1Parser_readInt() {
  50206. var token = this.getToken();
  50207. return parseInt(token || 0, 10) | 0;
  50208. },
  50209. readBoolean: function Type1Parser_readBoolean() {
  50210. var token = this.getToken();
  50211. return token === 'true' ? 1 : 0;
  50212. },
  50213. nextChar: function Type1_nextChar() {
  50214. return this.currentChar = this.stream.getByte();
  50215. },
  50216. getToken: function Type1Parser_getToken() {
  50217. var comment = false;
  50218. var ch = this.currentChar;
  50219. while (true) {
  50220. if (ch === -1) {
  50221. return null;
  50222. }
  50223. if (comment) {
  50224. if (ch === 0x0A || ch === 0x0D) {
  50225. comment = false;
  50226. }
  50227. } else if (ch === 0x25) {
  50228. comment = true;
  50229. } else if (!isSpace(ch)) {
  50230. break;
  50231. }
  50232. ch = this.nextChar();
  50233. }
  50234. if (isSpecial(ch)) {
  50235. this.nextChar();
  50236. return String.fromCharCode(ch);
  50237. }
  50238. var token = '';
  50239. do {
  50240. token += String.fromCharCode(ch);
  50241. ch = this.nextChar();
  50242. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  50243. return token;
  50244. },
  50245. extractFontProgram: function Type1Parser_extractFontProgram() {
  50246. var stream = this.stream;
  50247. var subrs = [], charstrings = [];
  50248. var privateData = Object.create(null);
  50249. privateData['lenIV'] = 4;
  50250. var program = {
  50251. subrs: [],
  50252. charstrings: [],
  50253. properties: { 'privateData': privateData }
  50254. };
  50255. var token, length, data, lenIV, encoded;
  50256. while ((token = this.getToken()) !== null) {
  50257. if (token !== '/') {
  50258. continue;
  50259. }
  50260. token = this.getToken();
  50261. switch (token) {
  50262. case 'CharStrings':
  50263. this.getToken();
  50264. this.getToken();
  50265. this.getToken();
  50266. this.getToken();
  50267. while (true) {
  50268. token = this.getToken();
  50269. if (token === null || token === 'end') {
  50270. break;
  50271. }
  50272. if (token !== '/') {
  50273. continue;
  50274. }
  50275. var glyph = this.getToken();
  50276. length = this.readInt();
  50277. this.getToken();
  50278. data = stream.makeSubStream(stream.pos, length);
  50279. lenIV = program.properties.privateData['lenIV'];
  50280. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50281. stream.skip(length);
  50282. this.nextChar();
  50283. token = this.getToken();
  50284. if (token === 'noaccess') {
  50285. this.getToken();
  50286. }
  50287. charstrings.push({
  50288. glyph: glyph,
  50289. encoded: encoded
  50290. });
  50291. }
  50292. break;
  50293. case 'Subrs':
  50294. this.readInt();
  50295. this.getToken();
  50296. while ((token = this.getToken()) === 'dup') {
  50297. var index = this.readInt();
  50298. length = this.readInt();
  50299. this.getToken();
  50300. data = stream.makeSubStream(stream.pos, length);
  50301. lenIV = program.properties.privateData['lenIV'];
  50302. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50303. stream.skip(length);
  50304. this.nextChar();
  50305. token = this.getToken();
  50306. if (token === 'noaccess') {
  50307. this.getToken();
  50308. }
  50309. subrs[index] = encoded;
  50310. }
  50311. break;
  50312. case 'BlueValues':
  50313. case 'OtherBlues':
  50314. case 'FamilyBlues':
  50315. case 'FamilyOtherBlues':
  50316. var blueArray = this.readNumberArray();
  50317. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  50318. program.properties.privateData[token] = blueArray;
  50319. }
  50320. break;
  50321. case 'StemSnapH':
  50322. case 'StemSnapV':
  50323. program.properties.privateData[token] = this.readNumberArray();
  50324. break;
  50325. case 'StdHW':
  50326. case 'StdVW':
  50327. program.properties.privateData[token] = this.readNumberArray()[0];
  50328. break;
  50329. case 'BlueShift':
  50330. case 'lenIV':
  50331. case 'BlueFuzz':
  50332. case 'BlueScale':
  50333. case 'LanguageGroup':
  50334. case 'ExpansionFactor':
  50335. program.properties.privateData[token] = this.readNumber();
  50336. break;
  50337. case 'ForceBold':
  50338. program.properties.privateData[token] = this.readBoolean();
  50339. break;
  50340. }
  50341. }
  50342. for (var i = 0; i < charstrings.length; i++) {
  50343. glyph = charstrings[i].glyph;
  50344. encoded = charstrings[i].encoded;
  50345. var charString = new Type1CharString();
  50346. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  50347. var output = charString.output;
  50348. if (error) {
  50349. output = [14];
  50350. }
  50351. program.charstrings.push({
  50352. glyphName: glyph,
  50353. charstring: output,
  50354. width: charString.width,
  50355. lsb: charString.lsb,
  50356. seac: charString.seac
  50357. });
  50358. }
  50359. return program;
  50360. },
  50361. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  50362. var token;
  50363. while ((token = this.getToken()) !== null) {
  50364. if (token !== '/') {
  50365. continue;
  50366. }
  50367. token = this.getToken();
  50368. switch (token) {
  50369. case 'FontMatrix':
  50370. var matrix = this.readNumberArray();
  50371. properties.fontMatrix = matrix;
  50372. break;
  50373. case 'Encoding':
  50374. var encodingArg = this.getToken();
  50375. var encoding;
  50376. if (!/^\d+$/.test(encodingArg)) {
  50377. encoding = getEncoding(encodingArg);
  50378. } else {
  50379. encoding = [];
  50380. var size = parseInt(encodingArg, 10) | 0;
  50381. this.getToken();
  50382. for (var j = 0; j < size; j++) {
  50383. token = this.getToken();
  50384. while (token !== 'dup' && token !== 'def') {
  50385. token = this.getToken();
  50386. if (token === null) {
  50387. return;
  50388. }
  50389. }
  50390. if (token === 'def') {
  50391. break;
  50392. }
  50393. var index = this.readInt();
  50394. this.getToken();
  50395. var glyph = this.getToken();
  50396. encoding[index] = glyph;
  50397. this.getToken();
  50398. }
  50399. }
  50400. properties.builtInEncoding = encoding;
  50401. break;
  50402. case 'FontBBox':
  50403. var fontBBox = this.readNumberArray();
  50404. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  50405. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  50406. properties.ascentScaled = true;
  50407. break;
  50408. }
  50409. }
  50410. }
  50411. };
  50412. return Type1Parser;
  50413. }();
  50414. exports.Type1Parser = Type1Parser;
  50415. /***/ }),
  50416. /* 37 */
  50417. /***/ (function(module, exports, __w_pdfjs_require__) {
  50418. "use strict";
  50419. var pdfjsVersion = '1.7.290';
  50420. var pdfjsBuild = 'b509a3f8';
  50421. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50422. {
  50423. __w_pdfjs_require__(18);
  50424. }
  50425. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50426. /***/ })
  50427. /******/ ]);
  50428. });