pdf.worker.js 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531
  1. /* Copyright 2017 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. (function webpackUniversalModuleDefinition(root, factory) {
  16. if(typeof exports === 'object' && typeof module === 'object')
  17. module.exports = factory();
  18. else if(typeof define === 'function' && define.amd)
  19. define("pdfjs-dist/build/pdf.worker", [], factory);
  20. else if(typeof exports === 'object')
  21. exports["pdfjs-dist/build/pdf.worker"] = factory();
  22. else
  23. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsDistBuildPdfWorker = factory();
  24. })(this, function() {
  25. return /******/ (function(modules) { // webpackBootstrap
  26. /******/ // The module cache
  27. /******/ var installedModules = {};
  28. /******/ // The require function
  29. /******/ function __w_pdfjs_require__(moduleId) {
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33. /******/ // Create a new module (and put it into the cache)
  34. /******/ var module = installedModules[moduleId] = {
  35. /******/ i: moduleId,
  36. /******/ l: false,
  37. /******/ exports: {}
  38. /******/ };
  39. /******/ // Execute the module function
  40. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  41. /******/ // Flag the module as loaded
  42. /******/ module.l = true;
  43. /******/ // Return the exports of the module
  44. /******/ return module.exports;
  45. /******/ }
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __w_pdfjs_require__.m = modules;
  48. /******/ // expose the module cache
  49. /******/ __w_pdfjs_require__.c = installedModules;
  50. /******/ // identity function for calling harmony imports with the correct context
  51. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  52. /******/ // define getter function for harmony exports
  53. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  54. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  55. /******/ Object.defineProperty(exports, name, {
  56. /******/ configurable: false,
  57. /******/ enumerable: true,
  58. /******/ get: getter
  59. /******/ });
  60. /******/ }
  61. /******/ };
  62. /******/ // getDefaultExport function for compatibility with non-harmony modules
  63. /******/ __w_pdfjs_require__.n = function(module) {
  64. /******/ var getter = module && module.__esModule ?
  65. /******/ function getDefault() { return module['default']; } :
  66. /******/ function getModuleExports() { return module; };
  67. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  68. /******/ return getter;
  69. /******/ };
  70. /******/ // Object.prototype.hasOwnProperty.call
  71. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  72. /******/ // __webpack_public_path__
  73. /******/ __w_pdfjs_require__.p = "";
  74. /******/ // Load entry module and return exports
  75. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 36);
  76. /******/ })
  77. /************************************************************************/
  78. /******/ ([
  79. /* 0 */
  80. /***/ (function(module, exports, __w_pdfjs_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(global) {
  83. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  84. var FONT_IDENTITY_MATRIX = [
  85. 0.001,
  86. 0,
  87. 0,
  88. 0.001,
  89. 0,
  90. 0
  91. ];
  92. var TextRenderingMode = {
  93. FILL: 0,
  94. STROKE: 1,
  95. FILL_STROKE: 2,
  96. INVISIBLE: 3,
  97. FILL_ADD_TO_PATH: 4,
  98. STROKE_ADD_TO_PATH: 5,
  99. FILL_STROKE_ADD_TO_PATH: 6,
  100. ADD_TO_PATH: 7,
  101. FILL_STROKE_MASK: 3,
  102. ADD_TO_PATH_FLAG: 4
  103. };
  104. var ImageKind = {
  105. GRAYSCALE_1BPP: 1,
  106. RGB_24BPP: 2,
  107. RGBA_32BPP: 3
  108. };
  109. var AnnotationType = {
  110. TEXT: 1,
  111. LINK: 2,
  112. FREETEXT: 3,
  113. LINE: 4,
  114. SQUARE: 5,
  115. CIRCLE: 6,
  116. POLYGON: 7,
  117. POLYLINE: 8,
  118. HIGHLIGHT: 9,
  119. UNDERLINE: 10,
  120. SQUIGGLY: 11,
  121. STRIKEOUT: 12,
  122. STAMP: 13,
  123. CARET: 14,
  124. INK: 15,
  125. POPUP: 16,
  126. FILEATTACHMENT: 17,
  127. SOUND: 18,
  128. MOVIE: 19,
  129. WIDGET: 20,
  130. SCREEN: 21,
  131. PRINTERMARK: 22,
  132. TRAPNET: 23,
  133. WATERMARK: 24,
  134. THREED: 25,
  135. REDACT: 26
  136. };
  137. var AnnotationFlag = {
  138. INVISIBLE: 0x01,
  139. HIDDEN: 0x02,
  140. PRINT: 0x04,
  141. NOZOOM: 0x08,
  142. NOROTATE: 0x10,
  143. NOVIEW: 0x20,
  144. READONLY: 0x40,
  145. LOCKED: 0x80,
  146. TOGGLENOVIEW: 0x100,
  147. LOCKEDCONTENTS: 0x200
  148. };
  149. var AnnotationFieldFlag = {
  150. READONLY: 0x0000001,
  151. REQUIRED: 0x0000002,
  152. NOEXPORT: 0x0000004,
  153. MULTILINE: 0x0001000,
  154. PASSWORD: 0x0002000,
  155. NOTOGGLETOOFF: 0x0004000,
  156. RADIO: 0x0008000,
  157. PUSHBUTTON: 0x0010000,
  158. COMBO: 0x0020000,
  159. EDIT: 0x0040000,
  160. SORT: 0x0080000,
  161. FILESELECT: 0x0100000,
  162. MULTISELECT: 0x0200000,
  163. DONOTSPELLCHECK: 0x0400000,
  164. DONOTSCROLL: 0x0800000,
  165. COMB: 0x1000000,
  166. RICHTEXT: 0x2000000,
  167. RADIOSINUNISON: 0x2000000,
  168. COMMITONSELCHANGE: 0x4000000
  169. };
  170. var AnnotationBorderStyleType = {
  171. SOLID: 1,
  172. DASHED: 2,
  173. BEVELED: 3,
  174. INSET: 4,
  175. UNDERLINE: 5
  176. };
  177. var StreamType = {
  178. UNKNOWN: 0,
  179. FLATE: 1,
  180. LZW: 2,
  181. DCT: 3,
  182. JPX: 4,
  183. JBIG: 5,
  184. A85: 6,
  185. AHX: 7,
  186. CCF: 8,
  187. RL: 9
  188. };
  189. var FontType = {
  190. UNKNOWN: 0,
  191. TYPE1: 1,
  192. TYPE1C: 2,
  193. CIDFONTTYPE0: 3,
  194. CIDFONTTYPE0C: 4,
  195. TRUETYPE: 5,
  196. CIDFONTTYPE2: 6,
  197. TYPE3: 7,
  198. OPENTYPE: 8,
  199. TYPE0: 9,
  200. MMTYPE1: 10
  201. };
  202. var VERBOSITY_LEVELS = {
  203. errors: 0,
  204. warnings: 1,
  205. infos: 5
  206. };
  207. var 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__(28);
  2531. var coreJpg = __w_pdfjs_require__(29);
  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__(34);
  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. var sharedUtil = __w_pdfjs_require__(0);
  18676. var corePrimitives = __w_pdfjs_require__(1);
  18677. var corePdfManager = __w_pdfjs_require__(33);
  18678. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  18679. var InvalidPDFException = sharedUtil.InvalidPDFException;
  18680. var MessageHandler = sharedUtil.MessageHandler;
  18681. var MissingPDFException = sharedUtil.MissingPDFException;
  18682. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  18683. var PasswordException = sharedUtil.PasswordException;
  18684. var UnknownErrorException = sharedUtil.UnknownErrorException;
  18685. var XRefParseException = sharedUtil.XRefParseException;
  18686. var arrayByteLength = sharedUtil.arrayByteLength;
  18687. var arraysToBytes = sharedUtil.arraysToBytes;
  18688. var assert = sharedUtil.assert;
  18689. var createPromiseCapability = sharedUtil.createPromiseCapability;
  18690. var error = sharedUtil.error;
  18691. var info = sharedUtil.info;
  18692. var warn = sharedUtil.warn;
  18693. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  18694. var Ref = corePrimitives.Ref;
  18695. var LocalPdfManager = corePdfManager.LocalPdfManager;
  18696. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  18697. var globalScope = sharedUtil.globalScope;
  18698. var WorkerTask = function WorkerTaskClosure() {
  18699. function WorkerTask(name) {
  18700. this.name = name;
  18701. this.terminated = false;
  18702. this._capability = createPromiseCapability();
  18703. }
  18704. WorkerTask.prototype = {
  18705. get finished() {
  18706. return this._capability.promise;
  18707. },
  18708. finish: function () {
  18709. this._capability.resolve();
  18710. },
  18711. terminate: function () {
  18712. this.terminated = true;
  18713. },
  18714. ensureNotTerminated: function () {
  18715. if (this.terminated) {
  18716. throw new Error('Worker task was terminated');
  18717. }
  18718. }
  18719. };
  18720. return WorkerTask;
  18721. }();
  18722. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  18723. function PDFWorkerStream(params, msgHandler) {
  18724. this._queuedChunks = [];
  18725. var initialData = params.initialData;
  18726. if (initialData && initialData.length > 0) {
  18727. this._queuedChunks.push(initialData);
  18728. }
  18729. this._msgHandler = msgHandler;
  18730. this._isRangeSupported = !params.disableRange;
  18731. this._isStreamingSupported = !params.disableStream;
  18732. this._contentLength = params.length;
  18733. this._fullRequestReader = null;
  18734. this._rangeReaders = [];
  18735. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  18736. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  18737. }
  18738. PDFWorkerStream.prototype = {
  18739. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  18740. if (args.begin === undefined) {
  18741. if (this._fullRequestReader) {
  18742. this._fullRequestReader._enqueue(args.chunk);
  18743. } else {
  18744. this._queuedChunks.push(args.chunk);
  18745. }
  18746. } else {
  18747. var found = this._rangeReaders.some(function (rangeReader) {
  18748. if (rangeReader._begin !== args.begin) {
  18749. return false;
  18750. }
  18751. rangeReader._enqueue(args.chunk);
  18752. return true;
  18753. });
  18754. assert(found);
  18755. }
  18756. },
  18757. _onProgress: function PDFWorkerStream_onProgress(evt) {
  18758. if (this._rangeReaders.length > 0) {
  18759. var firstReader = this._rangeReaders[0];
  18760. if (firstReader.onProgress) {
  18761. firstReader.onProgress({ loaded: evt.loaded });
  18762. }
  18763. }
  18764. },
  18765. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  18766. var i = this._rangeReaders.indexOf(reader);
  18767. if (i >= 0) {
  18768. this._rangeReaders.splice(i, 1);
  18769. }
  18770. },
  18771. getFullReader: function PDFWorkerStream_getFullReader() {
  18772. assert(!this._fullRequestReader);
  18773. var queuedChunks = this._queuedChunks;
  18774. this._queuedChunks = null;
  18775. return new PDFWorkerStreamReader(this, queuedChunks);
  18776. },
  18777. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  18778. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  18779. this._msgHandler.send('RequestDataRange', {
  18780. begin: begin,
  18781. end: end
  18782. });
  18783. this._rangeReaders.push(reader);
  18784. return reader;
  18785. },
  18786. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  18787. if (this._fullRequestReader) {
  18788. this._fullRequestReader.cancel(reason);
  18789. }
  18790. var readers = this._rangeReaders.slice(0);
  18791. readers.forEach(function (rangeReader) {
  18792. rangeReader.cancel(reason);
  18793. });
  18794. }
  18795. };
  18796. function PDFWorkerStreamReader(stream, queuedChunks) {
  18797. this._stream = stream;
  18798. this._done = false;
  18799. this._queuedChunks = queuedChunks || [];
  18800. this._requests = [];
  18801. this._headersReady = Promise.resolve();
  18802. stream._fullRequestReader = this;
  18803. this.onProgress = null;
  18804. }
  18805. PDFWorkerStreamReader.prototype = {
  18806. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  18807. if (this._done) {
  18808. return;
  18809. }
  18810. if (this._requests.length > 0) {
  18811. var requestCapability = this._requests.shift();
  18812. requestCapability.resolve({
  18813. value: chunk,
  18814. done: false
  18815. });
  18816. return;
  18817. }
  18818. this._queuedChunks.push(chunk);
  18819. },
  18820. get headersReady() {
  18821. return this._headersReady;
  18822. },
  18823. get isRangeSupported() {
  18824. return this._stream._isRangeSupported;
  18825. },
  18826. get isStreamingSupported() {
  18827. return this._stream._isStreamingSupported;
  18828. },
  18829. get contentLength() {
  18830. return this._stream._contentLength;
  18831. },
  18832. read: function PDFWorkerStreamReader_read() {
  18833. if (this._queuedChunks.length > 0) {
  18834. var chunk = this._queuedChunks.shift();
  18835. return Promise.resolve({
  18836. value: chunk,
  18837. done: false
  18838. });
  18839. }
  18840. if (this._done) {
  18841. return Promise.resolve({
  18842. value: undefined,
  18843. done: true
  18844. });
  18845. }
  18846. var requestCapability = createPromiseCapability();
  18847. this._requests.push(requestCapability);
  18848. return requestCapability.promise;
  18849. },
  18850. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18851. this._done = true;
  18852. this._requests.forEach(function (requestCapability) {
  18853. requestCapability.resolve({
  18854. value: undefined,
  18855. done: true
  18856. });
  18857. });
  18858. this._requests = [];
  18859. }
  18860. };
  18861. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18862. this._stream = stream;
  18863. this._begin = begin;
  18864. this._end = end;
  18865. this._queuedChunk = null;
  18866. this._requests = [];
  18867. this._done = false;
  18868. this.onProgress = null;
  18869. }
  18870. PDFWorkerStreamRangeReader.prototype = {
  18871. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18872. if (this._done) {
  18873. return;
  18874. }
  18875. if (this._requests.length === 0) {
  18876. this._queuedChunk = chunk;
  18877. } else {
  18878. var requestsCapability = this._requests.shift();
  18879. requestsCapability.resolve({
  18880. value: chunk,
  18881. done: false
  18882. });
  18883. this._requests.forEach(function (requestCapability) {
  18884. requestCapability.resolve({
  18885. value: undefined,
  18886. done: true
  18887. });
  18888. });
  18889. this._requests = [];
  18890. }
  18891. this._done = true;
  18892. this._stream._removeRangeReader(this);
  18893. },
  18894. get isStreamingSupported() {
  18895. return false;
  18896. },
  18897. read: function PDFWorkerStreamRangeReader_read() {
  18898. if (this._queuedChunk) {
  18899. return Promise.resolve({
  18900. value: this._queuedChunk,
  18901. done: false
  18902. });
  18903. }
  18904. if (this._done) {
  18905. return Promise.resolve({
  18906. value: undefined,
  18907. done: true
  18908. });
  18909. }
  18910. var requestCapability = createPromiseCapability();
  18911. this._requests.push(requestCapability);
  18912. return requestCapability.promise;
  18913. },
  18914. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18915. this._done = true;
  18916. this._requests.forEach(function (requestCapability) {
  18917. requestCapability.resolve({
  18918. value: undefined,
  18919. done: true
  18920. });
  18921. });
  18922. this._requests = [];
  18923. this._stream._removeRangeReader(this);
  18924. }
  18925. };
  18926. return PDFWorkerStream;
  18927. }();
  18928. var PDFNetworkStream;
  18929. function setPDFNetworkStreamClass(cls) {
  18930. PDFNetworkStream = cls;
  18931. }
  18932. var WorkerMessageHandler = {
  18933. setup: function wphSetup(handler, port) {
  18934. var testMessageProcessed = false;
  18935. handler.on('test', function wphSetupTest(data) {
  18936. if (testMessageProcessed) {
  18937. return;
  18938. }
  18939. testMessageProcessed = true;
  18940. if (!(data instanceof Uint8Array)) {
  18941. handler.send('test', 'main', false);
  18942. return;
  18943. }
  18944. var supportTransfers = data[0] === 255;
  18945. handler.postMessageTransfers = supportTransfers;
  18946. var xhr = new XMLHttpRequest();
  18947. var responseExists = 'response' in xhr;
  18948. try {
  18949. xhr.responseType;
  18950. } catch (e) {
  18951. responseExists = false;
  18952. }
  18953. if (!responseExists) {
  18954. handler.send('test', false);
  18955. return;
  18956. }
  18957. handler.send('test', {
  18958. supportTypedArray: true,
  18959. supportTransfers: supportTransfers
  18960. });
  18961. });
  18962. handler.on('configure', function wphConfigure(data) {
  18963. setVerbosityLevel(data.verbosity);
  18964. });
  18965. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18966. return WorkerMessageHandler.createDocumentHandler(data, port);
  18967. });
  18968. },
  18969. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18970. var pdfManager;
  18971. var terminated = false;
  18972. var cancelXHRs = null;
  18973. var WorkerTasks = [];
  18974. var docId = docParams.docId;
  18975. var docBaseUrl = docParams.docBaseUrl;
  18976. var workerHandlerName = docParams.docId + '_worker';
  18977. var handler = new MessageHandler(workerHandlerName, docId, port);
  18978. handler.postMessageTransfers = docParams.postMessageTransfers;
  18979. function ensureNotTerminated() {
  18980. if (terminated) {
  18981. throw new Error('Worker was terminated');
  18982. }
  18983. }
  18984. function startWorkerTask(task) {
  18985. WorkerTasks.push(task);
  18986. }
  18987. function finishWorkerTask(task) {
  18988. task.finish();
  18989. var i = WorkerTasks.indexOf(task);
  18990. WorkerTasks.splice(i, 1);
  18991. }
  18992. function loadDocument(recoveryMode) {
  18993. var loadDocumentCapability = createPromiseCapability();
  18994. var parseSuccess = function parseSuccess() {
  18995. var numPagesPromise = pdfManager.ensureDoc('numPages');
  18996. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  18997. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  18998. Promise.all([
  18999. numPagesPromise,
  19000. fingerprintPromise,
  19001. encryptedPromise
  19002. ]).then(function onDocReady(results) {
  19003. var doc = {
  19004. numPages: results[0],
  19005. fingerprint: results[1],
  19006. encrypted: !!results[2]
  19007. };
  19008. loadDocumentCapability.resolve(doc);
  19009. }, parseFailure);
  19010. };
  19011. var parseFailure = function parseFailure(e) {
  19012. loadDocumentCapability.reject(e);
  19013. };
  19014. pdfManager.ensureDoc('checkHeader', []).then(function () {
  19015. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  19016. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  19017. }, parseFailure);
  19018. }, parseFailure);
  19019. return loadDocumentCapability.promise;
  19020. }
  19021. function getPdfManager(data, evaluatorOptions) {
  19022. var pdfManagerCapability = createPromiseCapability();
  19023. var pdfManager;
  19024. var source = data.source;
  19025. if (source.data) {
  19026. try {
  19027. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  19028. pdfManagerCapability.resolve(pdfManager);
  19029. } catch (ex) {
  19030. pdfManagerCapability.reject(ex);
  19031. }
  19032. return pdfManagerCapability.promise;
  19033. }
  19034. var pdfStream;
  19035. try {
  19036. if (source.chunkedViewerLoading) {
  19037. pdfStream = new PDFWorkerStream(source, handler);
  19038. } else {
  19039. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  19040. pdfStream = new PDFNetworkStream(data);
  19041. }
  19042. } catch (ex) {
  19043. pdfManagerCapability.reject(ex);
  19044. return pdfManagerCapability.promise;
  19045. }
  19046. var fullRequest = pdfStream.getFullReader();
  19047. fullRequest.headersReady.then(function () {
  19048. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  19049. fullRequest.onProgress = function (evt) {
  19050. handler.send('DocProgress', {
  19051. loaded: evt.loaded,
  19052. total: evt.total
  19053. });
  19054. };
  19055. }
  19056. if (!fullRequest.isRangeSupported) {
  19057. return;
  19058. }
  19059. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  19060. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  19061. msgHandler: handler,
  19062. url: source.url,
  19063. password: source.password,
  19064. length: fullRequest.contentLength,
  19065. disableAutoFetch: disableAutoFetch,
  19066. rangeChunkSize: source.rangeChunkSize
  19067. }, evaluatorOptions, docBaseUrl);
  19068. pdfManagerCapability.resolve(pdfManager);
  19069. cancelXHRs = null;
  19070. }).catch(function (reason) {
  19071. pdfManagerCapability.reject(reason);
  19072. cancelXHRs = null;
  19073. });
  19074. var cachedChunks = [], loaded = 0;
  19075. var flushChunks = function () {
  19076. var pdfFile = arraysToBytes(cachedChunks);
  19077. if (source.length && pdfFile.length !== source.length) {
  19078. warn('reported HTTP length is different from actual');
  19079. }
  19080. try {
  19081. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  19082. pdfManagerCapability.resolve(pdfManager);
  19083. } catch (ex) {
  19084. pdfManagerCapability.reject(ex);
  19085. }
  19086. cachedChunks = [];
  19087. };
  19088. var readPromise = new Promise(function (resolve, reject) {
  19089. var readChunk = function (chunk) {
  19090. try {
  19091. ensureNotTerminated();
  19092. if (chunk.done) {
  19093. if (!pdfManager) {
  19094. flushChunks();
  19095. }
  19096. cancelXHRs = null;
  19097. return;
  19098. }
  19099. var data = chunk.value;
  19100. loaded += arrayByteLength(data);
  19101. if (!fullRequest.isStreamingSupported) {
  19102. handler.send('DocProgress', {
  19103. loaded: loaded,
  19104. total: Math.max(loaded, fullRequest.contentLength || 0)
  19105. });
  19106. }
  19107. if (pdfManager) {
  19108. pdfManager.sendProgressiveData(data);
  19109. } else {
  19110. cachedChunks.push(data);
  19111. }
  19112. fullRequest.read().then(readChunk, reject);
  19113. } catch (e) {
  19114. reject(e);
  19115. }
  19116. };
  19117. fullRequest.read().then(readChunk, reject);
  19118. });
  19119. readPromise.catch(function (e) {
  19120. pdfManagerCapability.reject(e);
  19121. cancelXHRs = null;
  19122. });
  19123. cancelXHRs = function () {
  19124. pdfStream.cancelAllRequests('abort');
  19125. };
  19126. return pdfManagerCapability.promise;
  19127. }
  19128. function setupDoc(data) {
  19129. function onSuccess(doc) {
  19130. ensureNotTerminated();
  19131. handler.send('GetDoc', { pdfInfo: doc });
  19132. }
  19133. function onFailure(e) {
  19134. if (e instanceof PasswordException) {
  19135. var task = new WorkerTask('PasswordException: response ' + e.code);
  19136. startWorkerTask(task);
  19137. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  19138. finishWorkerTask(task);
  19139. pdfManager.updatePassword(data.password);
  19140. pdfManagerReady();
  19141. }).catch(function (ex) {
  19142. finishWorkerTask(task);
  19143. handler.send('PasswordException', ex);
  19144. }.bind(null, e));
  19145. } else if (e instanceof InvalidPDFException) {
  19146. handler.send('InvalidPDF', e);
  19147. } else if (e instanceof MissingPDFException) {
  19148. handler.send('MissingPDF', e);
  19149. } else if (e instanceof UnexpectedResponseException) {
  19150. handler.send('UnexpectedResponse', e);
  19151. } else {
  19152. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  19153. }
  19154. }
  19155. function pdfManagerReady() {
  19156. ensureNotTerminated();
  19157. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  19158. ensureNotTerminated();
  19159. if (!(ex instanceof XRefParseException)) {
  19160. onFailure(ex);
  19161. return;
  19162. }
  19163. pdfManager.requestLoadedStream();
  19164. pdfManager.onLoadedStream().then(function () {
  19165. ensureNotTerminated();
  19166. loadDocument(true).then(onSuccess, onFailure);
  19167. });
  19168. }, onFailure);
  19169. }
  19170. ensureNotTerminated();
  19171. var cMapOptions = {
  19172. url: data.cMapUrl === undefined ? null : data.cMapUrl,
  19173. packed: data.cMapPacked === true
  19174. };
  19175. var evaluatorOptions = {
  19176. forceDataSchema: data.disableCreateObjectURL,
  19177. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  19178. disableFontFace: data.disableFontFace,
  19179. cMapOptions: cMapOptions,
  19180. disableNativeImageDecoder: data.disableNativeImageDecoder
  19181. };
  19182. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  19183. if (terminated) {
  19184. newPdfManager.terminate();
  19185. throw new Error('Worker was terminated');
  19186. }
  19187. pdfManager = newPdfManager;
  19188. handler.send('PDFManagerReady', null);
  19189. pdfManager.onLoadedStream().then(function (stream) {
  19190. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  19191. });
  19192. }).then(pdfManagerReady, onFailure);
  19193. }
  19194. handler.on('GetPage', function wphSetupGetPage(data) {
  19195. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19196. var rotatePromise = pdfManager.ensure(page, 'rotate');
  19197. var refPromise = pdfManager.ensure(page, 'ref');
  19198. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  19199. var viewPromise = pdfManager.ensure(page, 'view');
  19200. return Promise.all([
  19201. rotatePromise,
  19202. refPromise,
  19203. userUnitPromise,
  19204. viewPromise
  19205. ]).then(function (results) {
  19206. return {
  19207. rotate: results[0],
  19208. ref: results[1],
  19209. userUnit: results[2],
  19210. view: results[3]
  19211. };
  19212. });
  19213. });
  19214. });
  19215. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  19216. var ref = new Ref(data.ref.num, data.ref.gen);
  19217. var catalog = pdfManager.pdfDocument.catalog;
  19218. return catalog.getPageIndex(ref);
  19219. });
  19220. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  19221. return pdfManager.ensureCatalog('destinations');
  19222. });
  19223. handler.on('GetDestination', function wphSetupGetDestination(data) {
  19224. return pdfManager.ensureCatalog('getDestination', [data.id]);
  19225. });
  19226. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  19227. return pdfManager.ensureCatalog('pageLabels');
  19228. });
  19229. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  19230. return pdfManager.ensureCatalog('attachments');
  19231. });
  19232. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  19233. return pdfManager.ensureCatalog('javaScript');
  19234. });
  19235. handler.on('GetOutline', function wphSetupGetOutline(data) {
  19236. return pdfManager.ensureCatalog('documentOutline');
  19237. });
  19238. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  19239. return Promise.all([
  19240. pdfManager.ensureDoc('documentInfo'),
  19241. pdfManager.ensureCatalog('metadata')
  19242. ]);
  19243. });
  19244. handler.on('GetData', function wphSetupGetData(data) {
  19245. pdfManager.requestLoadedStream();
  19246. return pdfManager.onLoadedStream().then(function (stream) {
  19247. return stream.bytes;
  19248. });
  19249. });
  19250. handler.on('GetStats', function wphSetupGetStats(data) {
  19251. return pdfManager.pdfDocument.xref.stats;
  19252. });
  19253. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  19254. return pdfManager.getPage(data.pageIndex).then(function (page) {
  19255. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  19256. });
  19257. });
  19258. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  19259. var pageIndex = data.pageIndex;
  19260. pdfManager.getPage(pageIndex).then(function (page) {
  19261. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  19262. startWorkerTask(task);
  19263. var pageNum = pageIndex + 1;
  19264. var start = Date.now();
  19265. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  19266. finishWorkerTask(task);
  19267. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  19268. }, function (e) {
  19269. finishWorkerTask(task);
  19270. if (task.terminated) {
  19271. return;
  19272. }
  19273. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  19274. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  19275. var wrappedException;
  19276. if (typeof e === 'string') {
  19277. wrappedException = {
  19278. message: e,
  19279. stack: minimumStackMessage
  19280. };
  19281. } else if (typeof e === 'object') {
  19282. wrappedException = {
  19283. message: e.message || e.toString(),
  19284. stack: e.stack || minimumStackMessage
  19285. };
  19286. } else {
  19287. wrappedException = {
  19288. message: 'Unknown exception type: ' + typeof e,
  19289. stack: minimumStackMessage
  19290. };
  19291. }
  19292. handler.send('PageError', {
  19293. pageNum: pageNum,
  19294. error: wrappedException,
  19295. intent: data.intent
  19296. });
  19297. });
  19298. });
  19299. }, this);
  19300. handler.on('GetTextContent', function wphExtractText(data) {
  19301. var pageIndex = data.pageIndex;
  19302. var normalizeWhitespace = data.normalizeWhitespace;
  19303. var combineTextItems = data.combineTextItems;
  19304. return pdfManager.getPage(pageIndex).then(function (page) {
  19305. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  19306. startWorkerTask(task);
  19307. var pageNum = pageIndex + 1;
  19308. var start = Date.now();
  19309. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  19310. finishWorkerTask(task);
  19311. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  19312. return textContent;
  19313. }, function (reason) {
  19314. finishWorkerTask(task);
  19315. if (task.terminated) {
  19316. return;
  19317. }
  19318. throw reason;
  19319. });
  19320. });
  19321. });
  19322. handler.on('Cleanup', function wphCleanup(data) {
  19323. return pdfManager.cleanup();
  19324. });
  19325. handler.on('Terminate', function wphTerminate(data) {
  19326. terminated = true;
  19327. if (pdfManager) {
  19328. pdfManager.terminate();
  19329. pdfManager = null;
  19330. }
  19331. if (cancelXHRs) {
  19332. cancelXHRs();
  19333. }
  19334. var waitOn = [];
  19335. WorkerTasks.forEach(function (task) {
  19336. waitOn.push(task.finished);
  19337. task.terminate();
  19338. });
  19339. return Promise.all(waitOn).then(function () {
  19340. handler.destroy();
  19341. handler = null;
  19342. });
  19343. });
  19344. handler.on('Ready', function wphReady(data) {
  19345. setupDoc(docParams);
  19346. docParams = null;
  19347. });
  19348. return workerHandlerName;
  19349. }
  19350. };
  19351. function initializeWorker() {
  19352. if (!('console' in globalScope)) {
  19353. var consoleTimer = {};
  19354. var workerConsole = {
  19355. log: function log() {
  19356. var args = Array.prototype.slice.call(arguments);
  19357. globalScope.postMessage({
  19358. targetName: 'main',
  19359. action: 'console_log',
  19360. data: args
  19361. });
  19362. },
  19363. error: function error() {
  19364. var args = Array.prototype.slice.call(arguments);
  19365. globalScope.postMessage({
  19366. targetName: 'main',
  19367. action: 'console_error',
  19368. data: args
  19369. });
  19370. throw 'pdf.js execution error';
  19371. },
  19372. time: function time(name) {
  19373. consoleTimer[name] = Date.now();
  19374. },
  19375. timeEnd: function timeEnd(name) {
  19376. var time = consoleTimer[name];
  19377. if (!time) {
  19378. error('Unknown timer name ' + name);
  19379. }
  19380. this.log('Timer:', name, Date.now() - time);
  19381. }
  19382. };
  19383. globalScope.console = workerConsole;
  19384. }
  19385. var handler = new MessageHandler('worker', 'main', self);
  19386. WorkerMessageHandler.setup(handler, self);
  19387. handler.send('ready', null);
  19388. }
  19389. function isNodeJS() {
  19390. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  19391. return typeof process === 'object' && process + '' === '[object process]';
  19392. }
  19393. return false;
  19394. }
  19395. if (typeof window === 'undefined' && !isNodeJS()) {
  19396. initializeWorker();
  19397. }
  19398. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  19399. exports.WorkerTask = WorkerTask;
  19400. exports.WorkerMessageHandler = WorkerMessageHandler;
  19401. /***/ }),
  19402. /* 9 */
  19403. /***/ (function(module, exports, __w_pdfjs_require__) {
  19404. "use strict";
  19405. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  19406. var QeTable = [
  19407. {
  19408. qe: 0x5601,
  19409. nmps: 1,
  19410. nlps: 1,
  19411. switchFlag: 1
  19412. },
  19413. {
  19414. qe: 0x3401,
  19415. nmps: 2,
  19416. nlps: 6,
  19417. switchFlag: 0
  19418. },
  19419. {
  19420. qe: 0x1801,
  19421. nmps: 3,
  19422. nlps: 9,
  19423. switchFlag: 0
  19424. },
  19425. {
  19426. qe: 0x0AC1,
  19427. nmps: 4,
  19428. nlps: 12,
  19429. switchFlag: 0
  19430. },
  19431. {
  19432. qe: 0x0521,
  19433. nmps: 5,
  19434. nlps: 29,
  19435. switchFlag: 0
  19436. },
  19437. {
  19438. qe: 0x0221,
  19439. nmps: 38,
  19440. nlps: 33,
  19441. switchFlag: 0
  19442. },
  19443. {
  19444. qe: 0x5601,
  19445. nmps: 7,
  19446. nlps: 6,
  19447. switchFlag: 1
  19448. },
  19449. {
  19450. qe: 0x5401,
  19451. nmps: 8,
  19452. nlps: 14,
  19453. switchFlag: 0
  19454. },
  19455. {
  19456. qe: 0x4801,
  19457. nmps: 9,
  19458. nlps: 14,
  19459. switchFlag: 0
  19460. },
  19461. {
  19462. qe: 0x3801,
  19463. nmps: 10,
  19464. nlps: 14,
  19465. switchFlag: 0
  19466. },
  19467. {
  19468. qe: 0x3001,
  19469. nmps: 11,
  19470. nlps: 17,
  19471. switchFlag: 0
  19472. },
  19473. {
  19474. qe: 0x2401,
  19475. nmps: 12,
  19476. nlps: 18,
  19477. switchFlag: 0
  19478. },
  19479. {
  19480. qe: 0x1C01,
  19481. nmps: 13,
  19482. nlps: 20,
  19483. switchFlag: 0
  19484. },
  19485. {
  19486. qe: 0x1601,
  19487. nmps: 29,
  19488. nlps: 21,
  19489. switchFlag: 0
  19490. },
  19491. {
  19492. qe: 0x5601,
  19493. nmps: 15,
  19494. nlps: 14,
  19495. switchFlag: 1
  19496. },
  19497. {
  19498. qe: 0x5401,
  19499. nmps: 16,
  19500. nlps: 14,
  19501. switchFlag: 0
  19502. },
  19503. {
  19504. qe: 0x5101,
  19505. nmps: 17,
  19506. nlps: 15,
  19507. switchFlag: 0
  19508. },
  19509. {
  19510. qe: 0x4801,
  19511. nmps: 18,
  19512. nlps: 16,
  19513. switchFlag: 0
  19514. },
  19515. {
  19516. qe: 0x3801,
  19517. nmps: 19,
  19518. nlps: 17,
  19519. switchFlag: 0
  19520. },
  19521. {
  19522. qe: 0x3401,
  19523. nmps: 20,
  19524. nlps: 18,
  19525. switchFlag: 0
  19526. },
  19527. {
  19528. qe: 0x3001,
  19529. nmps: 21,
  19530. nlps: 19,
  19531. switchFlag: 0
  19532. },
  19533. {
  19534. qe: 0x2801,
  19535. nmps: 22,
  19536. nlps: 19,
  19537. switchFlag: 0
  19538. },
  19539. {
  19540. qe: 0x2401,
  19541. nmps: 23,
  19542. nlps: 20,
  19543. switchFlag: 0
  19544. },
  19545. {
  19546. qe: 0x2201,
  19547. nmps: 24,
  19548. nlps: 21,
  19549. switchFlag: 0
  19550. },
  19551. {
  19552. qe: 0x1C01,
  19553. nmps: 25,
  19554. nlps: 22,
  19555. switchFlag: 0
  19556. },
  19557. {
  19558. qe: 0x1801,
  19559. nmps: 26,
  19560. nlps: 23,
  19561. switchFlag: 0
  19562. },
  19563. {
  19564. qe: 0x1601,
  19565. nmps: 27,
  19566. nlps: 24,
  19567. switchFlag: 0
  19568. },
  19569. {
  19570. qe: 0x1401,
  19571. nmps: 28,
  19572. nlps: 25,
  19573. switchFlag: 0
  19574. },
  19575. {
  19576. qe: 0x1201,
  19577. nmps: 29,
  19578. nlps: 26,
  19579. switchFlag: 0
  19580. },
  19581. {
  19582. qe: 0x1101,
  19583. nmps: 30,
  19584. nlps: 27,
  19585. switchFlag: 0
  19586. },
  19587. {
  19588. qe: 0x0AC1,
  19589. nmps: 31,
  19590. nlps: 28,
  19591. switchFlag: 0
  19592. },
  19593. {
  19594. qe: 0x09C1,
  19595. nmps: 32,
  19596. nlps: 29,
  19597. switchFlag: 0
  19598. },
  19599. {
  19600. qe: 0x08A1,
  19601. nmps: 33,
  19602. nlps: 30,
  19603. switchFlag: 0
  19604. },
  19605. {
  19606. qe: 0x0521,
  19607. nmps: 34,
  19608. nlps: 31,
  19609. switchFlag: 0
  19610. },
  19611. {
  19612. qe: 0x0441,
  19613. nmps: 35,
  19614. nlps: 32,
  19615. switchFlag: 0
  19616. },
  19617. {
  19618. qe: 0x02A1,
  19619. nmps: 36,
  19620. nlps: 33,
  19621. switchFlag: 0
  19622. },
  19623. {
  19624. qe: 0x0221,
  19625. nmps: 37,
  19626. nlps: 34,
  19627. switchFlag: 0
  19628. },
  19629. {
  19630. qe: 0x0141,
  19631. nmps: 38,
  19632. nlps: 35,
  19633. switchFlag: 0
  19634. },
  19635. {
  19636. qe: 0x0111,
  19637. nmps: 39,
  19638. nlps: 36,
  19639. switchFlag: 0
  19640. },
  19641. {
  19642. qe: 0x0085,
  19643. nmps: 40,
  19644. nlps: 37,
  19645. switchFlag: 0
  19646. },
  19647. {
  19648. qe: 0x0049,
  19649. nmps: 41,
  19650. nlps: 38,
  19651. switchFlag: 0
  19652. },
  19653. {
  19654. qe: 0x0025,
  19655. nmps: 42,
  19656. nlps: 39,
  19657. switchFlag: 0
  19658. },
  19659. {
  19660. qe: 0x0015,
  19661. nmps: 43,
  19662. nlps: 40,
  19663. switchFlag: 0
  19664. },
  19665. {
  19666. qe: 0x0009,
  19667. nmps: 44,
  19668. nlps: 41,
  19669. switchFlag: 0
  19670. },
  19671. {
  19672. qe: 0x0005,
  19673. nmps: 45,
  19674. nlps: 42,
  19675. switchFlag: 0
  19676. },
  19677. {
  19678. qe: 0x0001,
  19679. nmps: 45,
  19680. nlps: 43,
  19681. switchFlag: 0
  19682. },
  19683. {
  19684. qe: 0x5601,
  19685. nmps: 46,
  19686. nlps: 46,
  19687. switchFlag: 0
  19688. }
  19689. ];
  19690. function ArithmeticDecoder(data, start, end) {
  19691. this.data = data;
  19692. this.bp = start;
  19693. this.dataEnd = end;
  19694. this.chigh = data[start];
  19695. this.clow = 0;
  19696. this.byteIn();
  19697. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  19698. this.clow = this.clow << 7 & 0xFFFF;
  19699. this.ct -= 7;
  19700. this.a = 0x8000;
  19701. }
  19702. ArithmeticDecoder.prototype = {
  19703. byteIn: function ArithmeticDecoder_byteIn() {
  19704. var data = this.data;
  19705. var bp = this.bp;
  19706. if (data[bp] === 0xFF) {
  19707. var b1 = data[bp + 1];
  19708. if (b1 > 0x8F) {
  19709. this.clow += 0xFF00;
  19710. this.ct = 8;
  19711. } else {
  19712. bp++;
  19713. this.clow += data[bp] << 9;
  19714. this.ct = 7;
  19715. this.bp = bp;
  19716. }
  19717. } else {
  19718. bp++;
  19719. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  19720. this.ct = 8;
  19721. this.bp = bp;
  19722. }
  19723. if (this.clow > 0xFFFF) {
  19724. this.chigh += this.clow >> 16;
  19725. this.clow &= 0xFFFF;
  19726. }
  19727. },
  19728. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  19729. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  19730. var qeTableIcx = QeTable[cx_index];
  19731. var qeIcx = qeTableIcx.qe;
  19732. var d;
  19733. var a = this.a - qeIcx;
  19734. if (this.chigh < qeIcx) {
  19735. if (a < qeIcx) {
  19736. a = qeIcx;
  19737. d = cx_mps;
  19738. cx_index = qeTableIcx.nmps;
  19739. } else {
  19740. a = qeIcx;
  19741. d = 1 ^ cx_mps;
  19742. if (qeTableIcx.switchFlag === 1) {
  19743. cx_mps = d;
  19744. }
  19745. cx_index = qeTableIcx.nlps;
  19746. }
  19747. } else {
  19748. this.chigh -= qeIcx;
  19749. if ((a & 0x8000) !== 0) {
  19750. this.a = a;
  19751. return cx_mps;
  19752. }
  19753. if (a < qeIcx) {
  19754. d = 1 ^ cx_mps;
  19755. if (qeTableIcx.switchFlag === 1) {
  19756. cx_mps = d;
  19757. }
  19758. cx_index = qeTableIcx.nlps;
  19759. } else {
  19760. d = cx_mps;
  19761. cx_index = qeTableIcx.nmps;
  19762. }
  19763. }
  19764. do {
  19765. if (this.ct === 0) {
  19766. this.byteIn();
  19767. }
  19768. a <<= 1;
  19769. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  19770. this.clow = this.clow << 1 & 0xFFFF;
  19771. this.ct--;
  19772. } while ((a & 0x8000) === 0);
  19773. this.a = a;
  19774. contexts[pos] = cx_index << 1 | cx_mps;
  19775. return d;
  19776. }
  19777. };
  19778. return ArithmeticDecoder;
  19779. }();
  19780. exports.ArithmeticDecoder = ArithmeticDecoder;
  19781. /***/ }),
  19782. /* 10 */
  19783. /***/ (function(module, exports, __w_pdfjs_require__) {
  19784. "use strict";
  19785. var sharedUtil = __w_pdfjs_require__(0);
  19786. var coreCharsets = __w_pdfjs_require__(22);
  19787. var coreEncodings = __w_pdfjs_require__(4);
  19788. var error = sharedUtil.error;
  19789. var info = sharedUtil.info;
  19790. var bytesToString = sharedUtil.bytesToString;
  19791. var warn = sharedUtil.warn;
  19792. var isArray = sharedUtil.isArray;
  19793. var Util = sharedUtil.Util;
  19794. var stringToBytes = sharedUtil.stringToBytes;
  19795. var assert = sharedUtil.assert;
  19796. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  19797. var ExpertCharset = coreCharsets.ExpertCharset;
  19798. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  19799. var StandardEncoding = coreEncodings.StandardEncoding;
  19800. var ExpertEncoding = coreEncodings.ExpertEncoding;
  19801. var MAX_SUBR_NESTING = 10;
  19802. var CFFStandardStrings = [
  19803. '.notdef',
  19804. 'space',
  19805. 'exclam',
  19806. 'quotedbl',
  19807. 'numbersign',
  19808. 'dollar',
  19809. 'percent',
  19810. 'ampersand',
  19811. 'quoteright',
  19812. 'parenleft',
  19813. 'parenright',
  19814. 'asterisk',
  19815. 'plus',
  19816. 'comma',
  19817. 'hyphen',
  19818. 'period',
  19819. 'slash',
  19820. 'zero',
  19821. 'one',
  19822. 'two',
  19823. 'three',
  19824. 'four',
  19825. 'five',
  19826. 'six',
  19827. 'seven',
  19828. 'eight',
  19829. 'nine',
  19830. 'colon',
  19831. 'semicolon',
  19832. 'less',
  19833. 'equal',
  19834. 'greater',
  19835. 'question',
  19836. 'at',
  19837. 'A',
  19838. 'B',
  19839. 'C',
  19840. 'D',
  19841. 'E',
  19842. 'F',
  19843. 'G',
  19844. 'H',
  19845. 'I',
  19846. 'J',
  19847. 'K',
  19848. 'L',
  19849. 'M',
  19850. 'N',
  19851. 'O',
  19852. 'P',
  19853. 'Q',
  19854. 'R',
  19855. 'S',
  19856. 'T',
  19857. 'U',
  19858. 'V',
  19859. 'W',
  19860. 'X',
  19861. 'Y',
  19862. 'Z',
  19863. 'bracketleft',
  19864. 'backslash',
  19865. 'bracketright',
  19866. 'asciicircum',
  19867. 'underscore',
  19868. 'quoteleft',
  19869. 'a',
  19870. 'b',
  19871. 'c',
  19872. 'd',
  19873. 'e',
  19874. 'f',
  19875. 'g',
  19876. 'h',
  19877. 'i',
  19878. 'j',
  19879. 'k',
  19880. 'l',
  19881. 'm',
  19882. 'n',
  19883. 'o',
  19884. 'p',
  19885. 'q',
  19886. 'r',
  19887. 's',
  19888. 't',
  19889. 'u',
  19890. 'v',
  19891. 'w',
  19892. 'x',
  19893. 'y',
  19894. 'z',
  19895. 'braceleft',
  19896. 'bar',
  19897. 'braceright',
  19898. 'asciitilde',
  19899. 'exclamdown',
  19900. 'cent',
  19901. 'sterling',
  19902. 'fraction',
  19903. 'yen',
  19904. 'florin',
  19905. 'section',
  19906. 'currency',
  19907. 'quotesingle',
  19908. 'quotedblleft',
  19909. 'guillemotleft',
  19910. 'guilsinglleft',
  19911. 'guilsinglright',
  19912. 'fi',
  19913. 'fl',
  19914. 'endash',
  19915. 'dagger',
  19916. 'daggerdbl',
  19917. 'periodcentered',
  19918. 'paragraph',
  19919. 'bullet',
  19920. 'quotesinglbase',
  19921. 'quotedblbase',
  19922. 'quotedblright',
  19923. 'guillemotright',
  19924. 'ellipsis',
  19925. 'perthousand',
  19926. 'questiondown',
  19927. 'grave',
  19928. 'acute',
  19929. 'circumflex',
  19930. 'tilde',
  19931. 'macron',
  19932. 'breve',
  19933. 'dotaccent',
  19934. 'dieresis',
  19935. 'ring',
  19936. 'cedilla',
  19937. 'hungarumlaut',
  19938. 'ogonek',
  19939. 'caron',
  19940. 'emdash',
  19941. 'AE',
  19942. 'ordfeminine',
  19943. 'Lslash',
  19944. 'Oslash',
  19945. 'OE',
  19946. 'ordmasculine',
  19947. 'ae',
  19948. 'dotlessi',
  19949. 'lslash',
  19950. 'oslash',
  19951. 'oe',
  19952. 'germandbls',
  19953. 'onesuperior',
  19954. 'logicalnot',
  19955. 'mu',
  19956. 'trademark',
  19957. 'Eth',
  19958. 'onehalf',
  19959. 'plusminus',
  19960. 'Thorn',
  19961. 'onequarter',
  19962. 'divide',
  19963. 'brokenbar',
  19964. 'degree',
  19965. 'thorn',
  19966. 'threequarters',
  19967. 'twosuperior',
  19968. 'registered',
  19969. 'minus',
  19970. 'eth',
  19971. 'multiply',
  19972. 'threesuperior',
  19973. 'copyright',
  19974. 'Aacute',
  19975. 'Acircumflex',
  19976. 'Adieresis',
  19977. 'Agrave',
  19978. 'Aring',
  19979. 'Atilde',
  19980. 'Ccedilla',
  19981. 'Eacute',
  19982. 'Ecircumflex',
  19983. 'Edieresis',
  19984. 'Egrave',
  19985. 'Iacute',
  19986. 'Icircumflex',
  19987. 'Idieresis',
  19988. 'Igrave',
  19989. 'Ntilde',
  19990. 'Oacute',
  19991. 'Ocircumflex',
  19992. 'Odieresis',
  19993. 'Ograve',
  19994. 'Otilde',
  19995. 'Scaron',
  19996. 'Uacute',
  19997. 'Ucircumflex',
  19998. 'Udieresis',
  19999. 'Ugrave',
  20000. 'Yacute',
  20001. 'Ydieresis',
  20002. 'Zcaron',
  20003. 'aacute',
  20004. 'acircumflex',
  20005. 'adieresis',
  20006. 'agrave',
  20007. 'aring',
  20008. 'atilde',
  20009. 'ccedilla',
  20010. 'eacute',
  20011. 'ecircumflex',
  20012. 'edieresis',
  20013. 'egrave',
  20014. 'iacute',
  20015. 'icircumflex',
  20016. 'idieresis',
  20017. 'igrave',
  20018. 'ntilde',
  20019. 'oacute',
  20020. 'ocircumflex',
  20021. 'odieresis',
  20022. 'ograve',
  20023. 'otilde',
  20024. 'scaron',
  20025. 'uacute',
  20026. 'ucircumflex',
  20027. 'udieresis',
  20028. 'ugrave',
  20029. 'yacute',
  20030. 'ydieresis',
  20031. 'zcaron',
  20032. 'exclamsmall',
  20033. 'Hungarumlautsmall',
  20034. 'dollaroldstyle',
  20035. 'dollarsuperior',
  20036. 'ampersandsmall',
  20037. 'Acutesmall',
  20038. 'parenleftsuperior',
  20039. 'parenrightsuperior',
  20040. 'twodotenleader',
  20041. 'onedotenleader',
  20042. 'zerooldstyle',
  20043. 'oneoldstyle',
  20044. 'twooldstyle',
  20045. 'threeoldstyle',
  20046. 'fouroldstyle',
  20047. 'fiveoldstyle',
  20048. 'sixoldstyle',
  20049. 'sevenoldstyle',
  20050. 'eightoldstyle',
  20051. 'nineoldstyle',
  20052. 'commasuperior',
  20053. 'threequartersemdash',
  20054. 'periodsuperior',
  20055. 'questionsmall',
  20056. 'asuperior',
  20057. 'bsuperior',
  20058. 'centsuperior',
  20059. 'dsuperior',
  20060. 'esuperior',
  20061. 'isuperior',
  20062. 'lsuperior',
  20063. 'msuperior',
  20064. 'nsuperior',
  20065. 'osuperior',
  20066. 'rsuperior',
  20067. 'ssuperior',
  20068. 'tsuperior',
  20069. 'ff',
  20070. 'ffi',
  20071. 'ffl',
  20072. 'parenleftinferior',
  20073. 'parenrightinferior',
  20074. 'Circumflexsmall',
  20075. 'hyphensuperior',
  20076. 'Gravesmall',
  20077. 'Asmall',
  20078. 'Bsmall',
  20079. 'Csmall',
  20080. 'Dsmall',
  20081. 'Esmall',
  20082. 'Fsmall',
  20083. 'Gsmall',
  20084. 'Hsmall',
  20085. 'Ismall',
  20086. 'Jsmall',
  20087. 'Ksmall',
  20088. 'Lsmall',
  20089. 'Msmall',
  20090. 'Nsmall',
  20091. 'Osmall',
  20092. 'Psmall',
  20093. 'Qsmall',
  20094. 'Rsmall',
  20095. 'Ssmall',
  20096. 'Tsmall',
  20097. 'Usmall',
  20098. 'Vsmall',
  20099. 'Wsmall',
  20100. 'Xsmall',
  20101. 'Ysmall',
  20102. 'Zsmall',
  20103. 'colonmonetary',
  20104. 'onefitted',
  20105. 'rupiah',
  20106. 'Tildesmall',
  20107. 'exclamdownsmall',
  20108. 'centoldstyle',
  20109. 'Lslashsmall',
  20110. 'Scaronsmall',
  20111. 'Zcaronsmall',
  20112. 'Dieresissmall',
  20113. 'Brevesmall',
  20114. 'Caronsmall',
  20115. 'Dotaccentsmall',
  20116. 'Macronsmall',
  20117. 'figuredash',
  20118. 'hypheninferior',
  20119. 'Ogoneksmall',
  20120. 'Ringsmall',
  20121. 'Cedillasmall',
  20122. 'questiondownsmall',
  20123. 'oneeighth',
  20124. 'threeeighths',
  20125. 'fiveeighths',
  20126. 'seveneighths',
  20127. 'onethird',
  20128. 'twothirds',
  20129. 'zerosuperior',
  20130. 'foursuperior',
  20131. 'fivesuperior',
  20132. 'sixsuperior',
  20133. 'sevensuperior',
  20134. 'eightsuperior',
  20135. 'ninesuperior',
  20136. 'zeroinferior',
  20137. 'oneinferior',
  20138. 'twoinferior',
  20139. 'threeinferior',
  20140. 'fourinferior',
  20141. 'fiveinferior',
  20142. 'sixinferior',
  20143. 'seveninferior',
  20144. 'eightinferior',
  20145. 'nineinferior',
  20146. 'centinferior',
  20147. 'dollarinferior',
  20148. 'periodinferior',
  20149. 'commainferior',
  20150. 'Agravesmall',
  20151. 'Aacutesmall',
  20152. 'Acircumflexsmall',
  20153. 'Atildesmall',
  20154. 'Adieresissmall',
  20155. 'Aringsmall',
  20156. 'AEsmall',
  20157. 'Ccedillasmall',
  20158. 'Egravesmall',
  20159. 'Eacutesmall',
  20160. 'Ecircumflexsmall',
  20161. 'Edieresissmall',
  20162. 'Igravesmall',
  20163. 'Iacutesmall',
  20164. 'Icircumflexsmall',
  20165. 'Idieresissmall',
  20166. 'Ethsmall',
  20167. 'Ntildesmall',
  20168. 'Ogravesmall',
  20169. 'Oacutesmall',
  20170. 'Ocircumflexsmall',
  20171. 'Otildesmall',
  20172. 'Odieresissmall',
  20173. 'OEsmall',
  20174. 'Oslashsmall',
  20175. 'Ugravesmall',
  20176. 'Uacutesmall',
  20177. 'Ucircumflexsmall',
  20178. 'Udieresissmall',
  20179. 'Yacutesmall',
  20180. 'Thornsmall',
  20181. 'Ydieresissmall',
  20182. '001.000',
  20183. '001.001',
  20184. '001.002',
  20185. '001.003',
  20186. 'Black',
  20187. 'Bold',
  20188. 'Book',
  20189. 'Light',
  20190. 'Medium',
  20191. 'Regular',
  20192. 'Roman',
  20193. 'Semibold'
  20194. ];
  20195. var CFFParser = function CFFParserClosure() {
  20196. var CharstringValidationData = [
  20197. null,
  20198. {
  20199. id: 'hstem',
  20200. min: 2,
  20201. stackClearing: true,
  20202. stem: true
  20203. },
  20204. null,
  20205. {
  20206. id: 'vstem',
  20207. min: 2,
  20208. stackClearing: true,
  20209. stem: true
  20210. },
  20211. {
  20212. id: 'vmoveto',
  20213. min: 1,
  20214. stackClearing: true
  20215. },
  20216. {
  20217. id: 'rlineto',
  20218. min: 2,
  20219. resetStack: true
  20220. },
  20221. {
  20222. id: 'hlineto',
  20223. min: 1,
  20224. resetStack: true
  20225. },
  20226. {
  20227. id: 'vlineto',
  20228. min: 1,
  20229. resetStack: true
  20230. },
  20231. {
  20232. id: 'rrcurveto',
  20233. min: 6,
  20234. resetStack: true
  20235. },
  20236. null,
  20237. {
  20238. id: 'callsubr',
  20239. min: 1,
  20240. undefStack: true
  20241. },
  20242. {
  20243. id: 'return',
  20244. min: 0,
  20245. undefStack: true
  20246. },
  20247. null,
  20248. null,
  20249. {
  20250. id: 'endchar',
  20251. min: 0,
  20252. stackClearing: true
  20253. },
  20254. null,
  20255. null,
  20256. null,
  20257. {
  20258. id: 'hstemhm',
  20259. min: 2,
  20260. stackClearing: true,
  20261. stem: true
  20262. },
  20263. {
  20264. id: 'hintmask',
  20265. min: 0,
  20266. stackClearing: true
  20267. },
  20268. {
  20269. id: 'cntrmask',
  20270. min: 0,
  20271. stackClearing: true
  20272. },
  20273. {
  20274. id: 'rmoveto',
  20275. min: 2,
  20276. stackClearing: true
  20277. },
  20278. {
  20279. id: 'hmoveto',
  20280. min: 1,
  20281. stackClearing: true
  20282. },
  20283. {
  20284. id: 'vstemhm',
  20285. min: 2,
  20286. stackClearing: true,
  20287. stem: true
  20288. },
  20289. {
  20290. id: 'rcurveline',
  20291. min: 8,
  20292. resetStack: true
  20293. },
  20294. {
  20295. id: 'rlinecurve',
  20296. min: 8,
  20297. resetStack: true
  20298. },
  20299. {
  20300. id: 'vvcurveto',
  20301. min: 4,
  20302. resetStack: true
  20303. },
  20304. {
  20305. id: 'hhcurveto',
  20306. min: 4,
  20307. resetStack: true
  20308. },
  20309. null,
  20310. {
  20311. id: 'callgsubr',
  20312. min: 1,
  20313. undefStack: true
  20314. },
  20315. {
  20316. id: 'vhcurveto',
  20317. min: 4,
  20318. resetStack: true
  20319. },
  20320. {
  20321. id: 'hvcurveto',
  20322. min: 4,
  20323. resetStack: true
  20324. }
  20325. ];
  20326. var CharstringValidationData12 = [
  20327. null,
  20328. null,
  20329. null,
  20330. {
  20331. id: 'and',
  20332. min: 2,
  20333. stackDelta: -1
  20334. },
  20335. {
  20336. id: 'or',
  20337. min: 2,
  20338. stackDelta: -1
  20339. },
  20340. {
  20341. id: 'not',
  20342. min: 1,
  20343. stackDelta: 0
  20344. },
  20345. null,
  20346. null,
  20347. null,
  20348. {
  20349. id: 'abs',
  20350. min: 1,
  20351. stackDelta: 0
  20352. },
  20353. {
  20354. id: 'add',
  20355. min: 2,
  20356. stackDelta: -1,
  20357. stackFn: function stack_div(stack, index) {
  20358. stack[index - 2] = stack[index - 2] + stack[index - 1];
  20359. }
  20360. },
  20361. {
  20362. id: 'sub',
  20363. min: 2,
  20364. stackDelta: -1,
  20365. stackFn: function stack_div(stack, index) {
  20366. stack[index - 2] = stack[index - 2] - stack[index - 1];
  20367. }
  20368. },
  20369. {
  20370. id: 'div',
  20371. min: 2,
  20372. stackDelta: -1,
  20373. stackFn: function stack_div(stack, index) {
  20374. stack[index - 2] = stack[index - 2] / stack[index - 1];
  20375. }
  20376. },
  20377. null,
  20378. {
  20379. id: 'neg',
  20380. min: 1,
  20381. stackDelta: 0,
  20382. stackFn: function stack_div(stack, index) {
  20383. stack[index - 1] = -stack[index - 1];
  20384. }
  20385. },
  20386. {
  20387. id: 'eq',
  20388. min: 2,
  20389. stackDelta: -1
  20390. },
  20391. null,
  20392. null,
  20393. {
  20394. id: 'drop',
  20395. min: 1,
  20396. stackDelta: -1
  20397. },
  20398. null,
  20399. {
  20400. id: 'put',
  20401. min: 2,
  20402. stackDelta: -2
  20403. },
  20404. {
  20405. id: 'get',
  20406. min: 1,
  20407. stackDelta: 0
  20408. },
  20409. {
  20410. id: 'ifelse',
  20411. min: 4,
  20412. stackDelta: -3
  20413. },
  20414. {
  20415. id: 'random',
  20416. min: 0,
  20417. stackDelta: 1
  20418. },
  20419. {
  20420. id: 'mul',
  20421. min: 2,
  20422. stackDelta: -1,
  20423. stackFn: function stack_div(stack, index) {
  20424. stack[index - 2] = stack[index - 2] * stack[index - 1];
  20425. }
  20426. },
  20427. null,
  20428. {
  20429. id: 'sqrt',
  20430. min: 1,
  20431. stackDelta: 0
  20432. },
  20433. {
  20434. id: 'dup',
  20435. min: 1,
  20436. stackDelta: 1
  20437. },
  20438. {
  20439. id: 'exch',
  20440. min: 2,
  20441. stackDelta: 0
  20442. },
  20443. {
  20444. id: 'index',
  20445. min: 2,
  20446. stackDelta: 0
  20447. },
  20448. {
  20449. id: 'roll',
  20450. min: 3,
  20451. stackDelta: -2
  20452. },
  20453. null,
  20454. null,
  20455. null,
  20456. {
  20457. id: 'hflex',
  20458. min: 7,
  20459. resetStack: true
  20460. },
  20461. {
  20462. id: 'flex',
  20463. min: 13,
  20464. resetStack: true
  20465. },
  20466. {
  20467. id: 'hflex1',
  20468. min: 9,
  20469. resetStack: true
  20470. },
  20471. {
  20472. id: 'flex1',
  20473. min: 11,
  20474. resetStack: true
  20475. }
  20476. ];
  20477. function CFFParser(file, properties, seacAnalysisEnabled) {
  20478. this.bytes = file.getBytes();
  20479. this.properties = properties;
  20480. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  20481. }
  20482. CFFParser.prototype = {
  20483. parse: function CFFParser_parse() {
  20484. var properties = this.properties;
  20485. var cff = new CFF();
  20486. this.cff = cff;
  20487. var header = this.parseHeader();
  20488. var nameIndex = this.parseIndex(header.endPos);
  20489. var topDictIndex = this.parseIndex(nameIndex.endPos);
  20490. var stringIndex = this.parseIndex(topDictIndex.endPos);
  20491. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  20492. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  20493. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  20494. cff.header = header.obj;
  20495. cff.names = this.parseNameIndex(nameIndex.obj);
  20496. cff.strings = this.parseStringIndex(stringIndex.obj);
  20497. cff.topDict = topDict;
  20498. cff.globalSubrIndex = globalSubrIndex.obj;
  20499. this.parsePrivateDict(cff.topDict);
  20500. cff.isCIDFont = topDict.hasName('ROS');
  20501. var charStringOffset = topDict.getByName('CharStrings');
  20502. var charStringIndex = this.parseIndex(charStringOffset).obj;
  20503. var fontMatrix = topDict.getByName('FontMatrix');
  20504. if (fontMatrix) {
  20505. properties.fontMatrix = fontMatrix;
  20506. }
  20507. var fontBBox = topDict.getByName('FontBBox');
  20508. if (fontBBox) {
  20509. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  20510. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  20511. properties.ascentScaled = true;
  20512. }
  20513. var charset, encoding;
  20514. if (cff.isCIDFont) {
  20515. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  20516. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  20517. var dictRaw = fdArrayIndex.get(i);
  20518. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  20519. this.parsePrivateDict(fontDict);
  20520. cff.fdArray.push(fontDict);
  20521. }
  20522. encoding = null;
  20523. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  20524. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  20525. } else {
  20526. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  20527. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  20528. }
  20529. cff.charset = charset;
  20530. cff.encoding = encoding;
  20531. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  20532. cff.charStrings = charStringsAndSeacs.charStrings;
  20533. cff.seacs = charStringsAndSeacs.seacs;
  20534. cff.widths = charStringsAndSeacs.widths;
  20535. return cff;
  20536. },
  20537. parseHeader: function CFFParser_parseHeader() {
  20538. var bytes = this.bytes;
  20539. var bytesLength = bytes.length;
  20540. var offset = 0;
  20541. while (offset < bytesLength && bytes[offset] !== 1) {
  20542. ++offset;
  20543. }
  20544. if (offset >= bytesLength) {
  20545. error('Invalid CFF header');
  20546. } else if (offset !== 0) {
  20547. info('cff data is shifted');
  20548. bytes = bytes.subarray(offset);
  20549. this.bytes = bytes;
  20550. }
  20551. var major = bytes[0];
  20552. var minor = bytes[1];
  20553. var hdrSize = bytes[2];
  20554. var offSize = bytes[3];
  20555. var header = new CFFHeader(major, minor, hdrSize, offSize);
  20556. return {
  20557. obj: header,
  20558. endPos: hdrSize
  20559. };
  20560. },
  20561. parseDict: function CFFParser_parseDict(dict) {
  20562. var pos = 0;
  20563. function parseOperand() {
  20564. var value = dict[pos++];
  20565. if (value === 30) {
  20566. return parseFloatOperand();
  20567. } else if (value === 28) {
  20568. value = dict[pos++];
  20569. value = (value << 24 | dict[pos++] << 16) >> 16;
  20570. return value;
  20571. } else if (value === 29) {
  20572. value = dict[pos++];
  20573. value = value << 8 | dict[pos++];
  20574. value = value << 8 | dict[pos++];
  20575. value = value << 8 | dict[pos++];
  20576. return value;
  20577. } else if (value >= 32 && value <= 246) {
  20578. return value - 139;
  20579. } else if (value >= 247 && value <= 250) {
  20580. return (value - 247) * 256 + dict[pos++] + 108;
  20581. } else if (value >= 251 && value <= 254) {
  20582. return -((value - 251) * 256) - dict[pos++] - 108;
  20583. }
  20584. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  20585. return NaN;
  20586. }
  20587. function parseFloatOperand() {
  20588. var str = '';
  20589. var eof = 15;
  20590. var lookup = [
  20591. '0',
  20592. '1',
  20593. '2',
  20594. '3',
  20595. '4',
  20596. '5',
  20597. '6',
  20598. '7',
  20599. '8',
  20600. '9',
  20601. '.',
  20602. 'E',
  20603. 'E-',
  20604. null,
  20605. '-'
  20606. ];
  20607. var length = dict.length;
  20608. while (pos < length) {
  20609. var b = dict[pos++];
  20610. var b1 = b >> 4;
  20611. var b2 = b & 15;
  20612. if (b1 === eof) {
  20613. break;
  20614. }
  20615. str += lookup[b1];
  20616. if (b2 === eof) {
  20617. break;
  20618. }
  20619. str += lookup[b2];
  20620. }
  20621. return parseFloat(str);
  20622. }
  20623. var operands = [];
  20624. var entries = [];
  20625. pos = 0;
  20626. var end = dict.length;
  20627. while (pos < end) {
  20628. var b = dict[pos];
  20629. if (b <= 21) {
  20630. if (b === 12) {
  20631. b = b << 8 | dict[++pos];
  20632. }
  20633. entries.push([
  20634. b,
  20635. operands
  20636. ]);
  20637. operands = [];
  20638. ++pos;
  20639. } else {
  20640. operands.push(parseOperand());
  20641. }
  20642. }
  20643. return entries;
  20644. },
  20645. parseIndex: function CFFParser_parseIndex(pos) {
  20646. var cffIndex = new CFFIndex();
  20647. var bytes = this.bytes;
  20648. var count = bytes[pos++] << 8 | bytes[pos++];
  20649. var offsets = [];
  20650. var end = pos;
  20651. var i, ii;
  20652. if (count !== 0) {
  20653. var offsetSize = bytes[pos++];
  20654. var startPos = pos + (count + 1) * offsetSize - 1;
  20655. for (i = 0, ii = count + 1; i < ii; ++i) {
  20656. var offset = 0;
  20657. for (var j = 0; j < offsetSize; ++j) {
  20658. offset <<= 8;
  20659. offset += bytes[pos++];
  20660. }
  20661. offsets.push(startPos + offset);
  20662. }
  20663. end = offsets[count];
  20664. }
  20665. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  20666. var offsetStart = offsets[i];
  20667. var offsetEnd = offsets[i + 1];
  20668. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  20669. }
  20670. return {
  20671. obj: cffIndex,
  20672. endPos: end
  20673. };
  20674. },
  20675. parseNameIndex: function CFFParser_parseNameIndex(index) {
  20676. var names = [];
  20677. for (var i = 0, ii = index.count; i < ii; ++i) {
  20678. var name = index.get(i);
  20679. var length = Math.min(name.length, 127);
  20680. var data = [];
  20681. for (var j = 0; j < length; ++j) {
  20682. var c = name[j];
  20683. if (j === 0 && c === 0) {
  20684. data[j] = c;
  20685. continue;
  20686. }
  20687. 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) {
  20688. data[j] = 95;
  20689. continue;
  20690. }
  20691. data[j] = c;
  20692. }
  20693. names.push(bytesToString(data));
  20694. }
  20695. return names;
  20696. },
  20697. parseStringIndex: function CFFParser_parseStringIndex(index) {
  20698. var strings = new CFFStrings();
  20699. for (var i = 0, ii = index.count; i < ii; ++i) {
  20700. var data = index.get(i);
  20701. strings.add(bytesToString(data));
  20702. }
  20703. return strings;
  20704. },
  20705. createDict: function CFFParser_createDict(Type, dict, strings) {
  20706. var cffDict = new Type(strings);
  20707. for (var i = 0, ii = dict.length; i < ii; ++i) {
  20708. var pair = dict[i];
  20709. var key = pair[0];
  20710. var value = pair[1];
  20711. cffDict.setByKey(key, value);
  20712. }
  20713. return cffDict;
  20714. },
  20715. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  20716. if (state.callDepth > MAX_SUBR_NESTING) {
  20717. return false;
  20718. }
  20719. var stackSize = state.stackSize;
  20720. var stack = state.stack;
  20721. var length = data.length;
  20722. for (var j = 0; j < length;) {
  20723. var value = data[j++];
  20724. var validationCommand = null;
  20725. if (value === 12) {
  20726. var q = data[j++];
  20727. if (q === 0) {
  20728. data[j - 2] = 139;
  20729. data[j - 1] = 22;
  20730. stackSize = 0;
  20731. } else {
  20732. validationCommand = CharstringValidationData12[q];
  20733. }
  20734. } else if (value === 28) {
  20735. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  20736. j += 2;
  20737. stackSize++;
  20738. } else if (value === 14) {
  20739. if (stackSize >= 4) {
  20740. stackSize -= 4;
  20741. if (this.seacAnalysisEnabled) {
  20742. state.seac = stack.slice(stackSize, stackSize + 4);
  20743. return false;
  20744. }
  20745. }
  20746. validationCommand = CharstringValidationData[value];
  20747. } else if (value >= 32 && value <= 246) {
  20748. stack[stackSize] = value - 139;
  20749. stackSize++;
  20750. } else if (value >= 247 && value <= 254) {
  20751. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  20752. j++;
  20753. stackSize++;
  20754. } else if (value === 255) {
  20755. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  20756. j += 4;
  20757. stackSize++;
  20758. } else if (value === 19 || value === 20) {
  20759. state.hints += stackSize >> 1;
  20760. j += state.hints + 7 >> 3;
  20761. stackSize %= 2;
  20762. validationCommand = CharstringValidationData[value];
  20763. } else if (value === 10 || value === 29) {
  20764. var subrsIndex;
  20765. if (value === 10) {
  20766. subrsIndex = localSubrIndex;
  20767. } else {
  20768. subrsIndex = globalSubrIndex;
  20769. }
  20770. if (!subrsIndex) {
  20771. validationCommand = CharstringValidationData[value];
  20772. warn('Missing subrsIndex for ' + validationCommand.id);
  20773. return false;
  20774. }
  20775. var bias = 32768;
  20776. if (subrsIndex.count < 1240) {
  20777. bias = 107;
  20778. } else if (subrsIndex.count < 33900) {
  20779. bias = 1131;
  20780. }
  20781. var subrNumber = stack[--stackSize] + bias;
  20782. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  20783. validationCommand = CharstringValidationData[value];
  20784. warn('Out of bounds subrIndex for ' + validationCommand.id);
  20785. return false;
  20786. }
  20787. state.stackSize = stackSize;
  20788. state.callDepth++;
  20789. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  20790. if (!valid) {
  20791. return false;
  20792. }
  20793. state.callDepth--;
  20794. stackSize = state.stackSize;
  20795. continue;
  20796. } else if (value === 11) {
  20797. state.stackSize = stackSize;
  20798. return true;
  20799. } else {
  20800. validationCommand = CharstringValidationData[value];
  20801. }
  20802. if (validationCommand) {
  20803. if (validationCommand.stem) {
  20804. state.hints += stackSize >> 1;
  20805. }
  20806. if ('min' in validationCommand) {
  20807. if (!state.undefStack && stackSize < validationCommand.min) {
  20808. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  20809. return false;
  20810. }
  20811. }
  20812. if (state.firstStackClearing && validationCommand.stackClearing) {
  20813. state.firstStackClearing = false;
  20814. stackSize -= validationCommand.min;
  20815. if (stackSize >= 2 && validationCommand.stem) {
  20816. stackSize %= 2;
  20817. } else if (stackSize > 1) {
  20818. warn('Found too many parameters for stack-clearing command');
  20819. }
  20820. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  20821. state.width = stack[stackSize - 1];
  20822. }
  20823. }
  20824. if ('stackDelta' in validationCommand) {
  20825. if ('stackFn' in validationCommand) {
  20826. validationCommand.stackFn(stack, stackSize);
  20827. }
  20828. stackSize += validationCommand.stackDelta;
  20829. } else if (validationCommand.stackClearing) {
  20830. stackSize = 0;
  20831. } else if (validationCommand.resetStack) {
  20832. stackSize = 0;
  20833. state.undefStack = false;
  20834. } else if (validationCommand.undefStack) {
  20835. stackSize = 0;
  20836. state.undefStack = true;
  20837. state.firstStackClearing = false;
  20838. }
  20839. }
  20840. }
  20841. state.stackSize = stackSize;
  20842. return true;
  20843. },
  20844. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20845. var seacs = [];
  20846. var widths = [];
  20847. var count = charStrings.count;
  20848. for (var i = 0; i < count; i++) {
  20849. var charstring = charStrings.get(i);
  20850. var state = {
  20851. callDepth: 0,
  20852. stackSize: 0,
  20853. stack: [],
  20854. undefStack: true,
  20855. hints: 0,
  20856. firstStackClearing: true,
  20857. seac: null,
  20858. width: null
  20859. };
  20860. var valid = true;
  20861. var localSubrToUse = null;
  20862. if (fdSelect && fdArray.length) {
  20863. var fdIndex = fdSelect.getFDIndex(i);
  20864. if (fdIndex === -1) {
  20865. warn('Glyph index is not in fd select.');
  20866. valid = false;
  20867. }
  20868. if (fdIndex >= fdArray.length) {
  20869. warn('Invalid fd index for glyph index.');
  20870. valid = false;
  20871. }
  20872. if (valid) {
  20873. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20874. }
  20875. } else if (localSubrIndex) {
  20876. localSubrToUse = localSubrIndex;
  20877. }
  20878. if (valid) {
  20879. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20880. }
  20881. if (state.width !== null) {
  20882. widths[i] = state.width;
  20883. }
  20884. if (state.seac !== null) {
  20885. seacs[i] = state.seac;
  20886. }
  20887. if (!valid) {
  20888. charStrings.set(i, new Uint8Array([14]));
  20889. }
  20890. }
  20891. return {
  20892. charStrings: charStrings,
  20893. seacs: seacs,
  20894. widths: widths
  20895. };
  20896. },
  20897. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20898. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20899. parentDict.setByKey(18, [
  20900. 0,
  20901. 0
  20902. ]);
  20903. parentDict.privateDict = privateDict;
  20904. },
  20905. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20906. if (!parentDict.hasName('Private')) {
  20907. this.emptyPrivateDictionary(parentDict);
  20908. return;
  20909. }
  20910. var privateOffset = parentDict.getByName('Private');
  20911. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20912. parentDict.removeByName('Private');
  20913. return;
  20914. }
  20915. var size = privateOffset[0];
  20916. var offset = privateOffset[1];
  20917. if (size === 0 || offset >= this.bytes.length) {
  20918. this.emptyPrivateDictionary(parentDict);
  20919. return;
  20920. }
  20921. var privateDictEnd = offset + size;
  20922. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20923. var dict = this.parseDict(dictData);
  20924. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20925. parentDict.privateDict = privateDict;
  20926. if (!privateDict.getByName('Subrs')) {
  20927. return;
  20928. }
  20929. var subrsOffset = privateDict.getByName('Subrs');
  20930. var relativeOffset = offset + subrsOffset;
  20931. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20932. this.emptyPrivateDictionary(parentDict);
  20933. return;
  20934. }
  20935. var subrsIndex = this.parseIndex(relativeOffset);
  20936. privateDict.subrsIndex = subrsIndex.obj;
  20937. },
  20938. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20939. if (pos === 0) {
  20940. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20941. } else if (pos === 1) {
  20942. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20943. } else if (pos === 2) {
  20944. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20945. }
  20946. var bytes = this.bytes;
  20947. var start = pos;
  20948. var format = bytes[pos++];
  20949. var charset = ['.notdef'];
  20950. var id, count, i;
  20951. length -= 1;
  20952. switch (format) {
  20953. case 0:
  20954. for (i = 0; i < length; i++) {
  20955. id = bytes[pos++] << 8 | bytes[pos++];
  20956. charset.push(cid ? id : strings.get(id));
  20957. }
  20958. break;
  20959. case 1:
  20960. while (charset.length <= length) {
  20961. id = bytes[pos++] << 8 | bytes[pos++];
  20962. count = bytes[pos++];
  20963. for (i = 0; i <= count; i++) {
  20964. charset.push(cid ? id++ : strings.get(id++));
  20965. }
  20966. }
  20967. break;
  20968. case 2:
  20969. while (charset.length <= length) {
  20970. id = bytes[pos++] << 8 | bytes[pos++];
  20971. count = bytes[pos++] << 8 | bytes[pos++];
  20972. for (i = 0; i <= count; i++) {
  20973. charset.push(cid ? id++ : strings.get(id++));
  20974. }
  20975. }
  20976. break;
  20977. default:
  20978. error('Unknown charset format');
  20979. }
  20980. var end = pos;
  20981. var raw = bytes.subarray(start, end);
  20982. return new CFFCharset(false, format, charset, raw);
  20983. },
  20984. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20985. var encoding = Object.create(null);
  20986. var bytes = this.bytes;
  20987. var predefined = false;
  20988. var format, i, ii;
  20989. var raw = null;
  20990. function readSupplement() {
  20991. var supplementsCount = bytes[pos++];
  20992. for (i = 0; i < supplementsCount; i++) {
  20993. var code = bytes[pos++];
  20994. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20995. encoding[code] = charset.indexOf(strings.get(sid));
  20996. }
  20997. }
  20998. if (pos === 0 || pos === 1) {
  20999. predefined = true;
  21000. format = pos;
  21001. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  21002. for (i = 0, ii = charset.length; i < ii; i++) {
  21003. var index = baseEncoding.indexOf(charset[i]);
  21004. if (index !== -1) {
  21005. encoding[index] = i;
  21006. }
  21007. }
  21008. } else {
  21009. var dataStart = pos;
  21010. format = bytes[pos++];
  21011. switch (format & 0x7f) {
  21012. case 0:
  21013. var glyphsCount = bytes[pos++];
  21014. for (i = 1; i <= glyphsCount; i++) {
  21015. encoding[bytes[pos++]] = i;
  21016. }
  21017. break;
  21018. case 1:
  21019. var rangesCount = bytes[pos++];
  21020. var gid = 1;
  21021. for (i = 0; i < rangesCount; i++) {
  21022. var start = bytes[pos++];
  21023. var left = bytes[pos++];
  21024. for (var j = start; j <= start + left; j++) {
  21025. encoding[j] = gid++;
  21026. }
  21027. }
  21028. break;
  21029. default:
  21030. error('Unknown encoding format: ' + format + ' in CFF');
  21031. break;
  21032. }
  21033. var dataEnd = pos;
  21034. if (format & 0x80) {
  21035. bytes[dataStart] &= 0x7f;
  21036. readSupplement();
  21037. }
  21038. raw = bytes.subarray(dataStart, dataEnd);
  21039. }
  21040. format = format & 0x7f;
  21041. return new CFFEncoding(predefined, format, encoding, raw);
  21042. },
  21043. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  21044. var start = pos;
  21045. var bytes = this.bytes;
  21046. var format = bytes[pos++];
  21047. var fdSelect = [], rawBytes;
  21048. var i, invalidFirstGID = false;
  21049. switch (format) {
  21050. case 0:
  21051. for (i = 0; i < length; ++i) {
  21052. var id = bytes[pos++];
  21053. fdSelect.push(id);
  21054. }
  21055. rawBytes = bytes.subarray(start, pos);
  21056. break;
  21057. case 3:
  21058. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21059. for (i = 0; i < rangesCount; ++i) {
  21060. var first = bytes[pos++] << 8 | bytes[pos++];
  21061. if (i === 0 && first !== 0) {
  21062. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  21063. invalidFirstGID = true;
  21064. first = 0;
  21065. }
  21066. var fdIndex = bytes[pos++];
  21067. var next = bytes[pos] << 8 | bytes[pos + 1];
  21068. for (var j = first; j < next; ++j) {
  21069. fdSelect.push(fdIndex);
  21070. }
  21071. }
  21072. pos += 2;
  21073. rawBytes = bytes.subarray(start, pos);
  21074. if (invalidFirstGID) {
  21075. rawBytes[3] = rawBytes[4] = 0;
  21076. }
  21077. break;
  21078. default:
  21079. error('parseFDSelect: Unknown format "' + format + '".');
  21080. break;
  21081. }
  21082. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  21083. return new CFFFDSelect(fdSelect, rawBytes);
  21084. }
  21085. };
  21086. return CFFParser;
  21087. }();
  21088. var CFF = function CFFClosure() {
  21089. function CFF() {
  21090. this.header = null;
  21091. this.names = [];
  21092. this.topDict = null;
  21093. this.strings = new CFFStrings();
  21094. this.globalSubrIndex = null;
  21095. this.encoding = null;
  21096. this.charset = null;
  21097. this.charStrings = null;
  21098. this.fdArray = [];
  21099. this.fdSelect = null;
  21100. this.isCIDFont = false;
  21101. }
  21102. return CFF;
  21103. }();
  21104. var CFFHeader = function CFFHeaderClosure() {
  21105. function CFFHeader(major, minor, hdrSize, offSize) {
  21106. this.major = major;
  21107. this.minor = minor;
  21108. this.hdrSize = hdrSize;
  21109. this.offSize = offSize;
  21110. }
  21111. return CFFHeader;
  21112. }();
  21113. var CFFStrings = function CFFStringsClosure() {
  21114. function CFFStrings() {
  21115. this.strings = [];
  21116. }
  21117. CFFStrings.prototype = {
  21118. get: function CFFStrings_get(index) {
  21119. if (index >= 0 && index <= 390) {
  21120. return CFFStandardStrings[index];
  21121. }
  21122. if (index - 391 <= this.strings.length) {
  21123. return this.strings[index - 391];
  21124. }
  21125. return CFFStandardStrings[0];
  21126. },
  21127. add: function CFFStrings_add(value) {
  21128. this.strings.push(value);
  21129. },
  21130. get count() {
  21131. return this.strings.length;
  21132. }
  21133. };
  21134. return CFFStrings;
  21135. }();
  21136. var CFFIndex = function CFFIndexClosure() {
  21137. function CFFIndex() {
  21138. this.objects = [];
  21139. this.length = 0;
  21140. }
  21141. CFFIndex.prototype = {
  21142. add: function CFFIndex_add(data) {
  21143. this.length += data.length;
  21144. this.objects.push(data);
  21145. },
  21146. set: function CFFIndex_set(index, data) {
  21147. this.length += data.length - this.objects[index].length;
  21148. this.objects[index] = data;
  21149. },
  21150. get: function CFFIndex_get(index) {
  21151. return this.objects[index];
  21152. },
  21153. get count() {
  21154. return this.objects.length;
  21155. }
  21156. };
  21157. return CFFIndex;
  21158. }();
  21159. var CFFDict = function CFFDictClosure() {
  21160. function CFFDict(tables, strings) {
  21161. this.keyToNameMap = tables.keyToNameMap;
  21162. this.nameToKeyMap = tables.nameToKeyMap;
  21163. this.defaults = tables.defaults;
  21164. this.types = tables.types;
  21165. this.opcodes = tables.opcodes;
  21166. this.order = tables.order;
  21167. this.strings = strings;
  21168. this.values = Object.create(null);
  21169. }
  21170. CFFDict.prototype = {
  21171. setByKey: function CFFDict_setByKey(key, value) {
  21172. if (!(key in this.keyToNameMap)) {
  21173. return false;
  21174. }
  21175. var valueLength = value.length;
  21176. if (valueLength === 0) {
  21177. return true;
  21178. }
  21179. for (var i = 0; i < valueLength; i++) {
  21180. if (isNaN(value[i])) {
  21181. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21182. return true;
  21183. }
  21184. }
  21185. var type = this.types[key];
  21186. if (type === 'num' || type === 'sid' || type === 'offset') {
  21187. value = value[0];
  21188. }
  21189. this.values[key] = value;
  21190. return true;
  21191. },
  21192. setByName: function CFFDict_setByName(name, value) {
  21193. if (!(name in this.nameToKeyMap)) {
  21194. error('Invalid dictionary name "' + name + '"');
  21195. }
  21196. this.values[this.nameToKeyMap[name]] = value;
  21197. },
  21198. hasName: function CFFDict_hasName(name) {
  21199. return this.nameToKeyMap[name] in this.values;
  21200. },
  21201. getByName: function CFFDict_getByName(name) {
  21202. if (!(name in this.nameToKeyMap)) {
  21203. error('Invalid dictionary name "' + name + '"');
  21204. }
  21205. var key = this.nameToKeyMap[name];
  21206. if (!(key in this.values)) {
  21207. return this.defaults[key];
  21208. }
  21209. return this.values[key];
  21210. },
  21211. removeByName: function CFFDict_removeByName(name) {
  21212. delete this.values[this.nameToKeyMap[name]];
  21213. }
  21214. };
  21215. CFFDict.createTables = function CFFDict_createTables(layout) {
  21216. var tables = {
  21217. keyToNameMap: {},
  21218. nameToKeyMap: {},
  21219. defaults: {},
  21220. types: {},
  21221. opcodes: {},
  21222. order: []
  21223. };
  21224. for (var i = 0, ii = layout.length; i < ii; ++i) {
  21225. var entry = layout[i];
  21226. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21227. tables.keyToNameMap[key] = entry[1];
  21228. tables.nameToKeyMap[entry[1]] = key;
  21229. tables.types[key] = entry[2];
  21230. tables.defaults[key] = entry[3];
  21231. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  21232. tables.order.push(key);
  21233. }
  21234. return tables;
  21235. };
  21236. return CFFDict;
  21237. }();
  21238. var CFFTopDict = function CFFTopDictClosure() {
  21239. var layout = [
  21240. [
  21241. [
  21242. 12,
  21243. 30
  21244. ],
  21245. 'ROS',
  21246. [
  21247. 'sid',
  21248. 'sid',
  21249. 'num'
  21250. ],
  21251. null
  21252. ],
  21253. [
  21254. [
  21255. 12,
  21256. 20
  21257. ],
  21258. 'SyntheticBase',
  21259. 'num',
  21260. null
  21261. ],
  21262. [
  21263. 0,
  21264. 'version',
  21265. 'sid',
  21266. null
  21267. ],
  21268. [
  21269. 1,
  21270. 'Notice',
  21271. 'sid',
  21272. null
  21273. ],
  21274. [
  21275. [
  21276. 12,
  21277. 0
  21278. ],
  21279. 'Copyright',
  21280. 'sid',
  21281. null
  21282. ],
  21283. [
  21284. 2,
  21285. 'FullName',
  21286. 'sid',
  21287. null
  21288. ],
  21289. [
  21290. 3,
  21291. 'FamilyName',
  21292. 'sid',
  21293. null
  21294. ],
  21295. [
  21296. 4,
  21297. 'Weight',
  21298. 'sid',
  21299. null
  21300. ],
  21301. [
  21302. [
  21303. 12,
  21304. 1
  21305. ],
  21306. 'isFixedPitch',
  21307. 'num',
  21308. 0
  21309. ],
  21310. [
  21311. [
  21312. 12,
  21313. 2
  21314. ],
  21315. 'ItalicAngle',
  21316. 'num',
  21317. 0
  21318. ],
  21319. [
  21320. [
  21321. 12,
  21322. 3
  21323. ],
  21324. 'UnderlinePosition',
  21325. 'num',
  21326. -100
  21327. ],
  21328. [
  21329. [
  21330. 12,
  21331. 4
  21332. ],
  21333. 'UnderlineThickness',
  21334. 'num',
  21335. 50
  21336. ],
  21337. [
  21338. [
  21339. 12,
  21340. 5
  21341. ],
  21342. 'PaintType',
  21343. 'num',
  21344. 0
  21345. ],
  21346. [
  21347. [
  21348. 12,
  21349. 6
  21350. ],
  21351. 'CharstringType',
  21352. 'num',
  21353. 2
  21354. ],
  21355. [
  21356. [
  21357. 12,
  21358. 7
  21359. ],
  21360. 'FontMatrix',
  21361. [
  21362. 'num',
  21363. 'num',
  21364. 'num',
  21365. 'num',
  21366. 'num',
  21367. 'num'
  21368. ],
  21369. [
  21370. 0.001,
  21371. 0,
  21372. 0,
  21373. 0.001,
  21374. 0,
  21375. 0
  21376. ]
  21377. ],
  21378. [
  21379. 13,
  21380. 'UniqueID',
  21381. 'num',
  21382. null
  21383. ],
  21384. [
  21385. 5,
  21386. 'FontBBox',
  21387. [
  21388. 'num',
  21389. 'num',
  21390. 'num',
  21391. 'num'
  21392. ],
  21393. [
  21394. 0,
  21395. 0,
  21396. 0,
  21397. 0
  21398. ]
  21399. ],
  21400. [
  21401. [
  21402. 12,
  21403. 8
  21404. ],
  21405. 'StrokeWidth',
  21406. 'num',
  21407. 0
  21408. ],
  21409. [
  21410. 14,
  21411. 'XUID',
  21412. 'array',
  21413. null
  21414. ],
  21415. [
  21416. 15,
  21417. 'charset',
  21418. 'offset',
  21419. 0
  21420. ],
  21421. [
  21422. 16,
  21423. 'Encoding',
  21424. 'offset',
  21425. 0
  21426. ],
  21427. [
  21428. 17,
  21429. 'CharStrings',
  21430. 'offset',
  21431. 0
  21432. ],
  21433. [
  21434. 18,
  21435. 'Private',
  21436. [
  21437. 'offset',
  21438. 'offset'
  21439. ],
  21440. null
  21441. ],
  21442. [
  21443. [
  21444. 12,
  21445. 21
  21446. ],
  21447. 'PostScript',
  21448. 'sid',
  21449. null
  21450. ],
  21451. [
  21452. [
  21453. 12,
  21454. 22
  21455. ],
  21456. 'BaseFontName',
  21457. 'sid',
  21458. null
  21459. ],
  21460. [
  21461. [
  21462. 12,
  21463. 23
  21464. ],
  21465. 'BaseFontBlend',
  21466. 'delta',
  21467. null
  21468. ],
  21469. [
  21470. [
  21471. 12,
  21472. 31
  21473. ],
  21474. 'CIDFontVersion',
  21475. 'num',
  21476. 0
  21477. ],
  21478. [
  21479. [
  21480. 12,
  21481. 32
  21482. ],
  21483. 'CIDFontRevision',
  21484. 'num',
  21485. 0
  21486. ],
  21487. [
  21488. [
  21489. 12,
  21490. 33
  21491. ],
  21492. 'CIDFontType',
  21493. 'num',
  21494. 0
  21495. ],
  21496. [
  21497. [
  21498. 12,
  21499. 34
  21500. ],
  21501. 'CIDCount',
  21502. 'num',
  21503. 8720
  21504. ],
  21505. [
  21506. [
  21507. 12,
  21508. 35
  21509. ],
  21510. 'UIDBase',
  21511. 'num',
  21512. null
  21513. ],
  21514. [
  21515. [
  21516. 12,
  21517. 37
  21518. ],
  21519. 'FDSelect',
  21520. 'offset',
  21521. null
  21522. ],
  21523. [
  21524. [
  21525. 12,
  21526. 36
  21527. ],
  21528. 'FDArray',
  21529. 'offset',
  21530. null
  21531. ],
  21532. [
  21533. [
  21534. 12,
  21535. 38
  21536. ],
  21537. 'FontName',
  21538. 'sid',
  21539. null
  21540. ]
  21541. ];
  21542. var tables = null;
  21543. function CFFTopDict(strings) {
  21544. if (tables === null) {
  21545. tables = CFFDict.createTables(layout);
  21546. }
  21547. CFFDict.call(this, tables, strings);
  21548. this.privateDict = null;
  21549. }
  21550. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  21551. return CFFTopDict;
  21552. }();
  21553. var CFFPrivateDict = function CFFPrivateDictClosure() {
  21554. var layout = [
  21555. [
  21556. 6,
  21557. 'BlueValues',
  21558. 'delta',
  21559. null
  21560. ],
  21561. [
  21562. 7,
  21563. 'OtherBlues',
  21564. 'delta',
  21565. null
  21566. ],
  21567. [
  21568. 8,
  21569. 'FamilyBlues',
  21570. 'delta',
  21571. null
  21572. ],
  21573. [
  21574. 9,
  21575. 'FamilyOtherBlues',
  21576. 'delta',
  21577. null
  21578. ],
  21579. [
  21580. [
  21581. 12,
  21582. 9
  21583. ],
  21584. 'BlueScale',
  21585. 'num',
  21586. 0.039625
  21587. ],
  21588. [
  21589. [
  21590. 12,
  21591. 10
  21592. ],
  21593. 'BlueShift',
  21594. 'num',
  21595. 7
  21596. ],
  21597. [
  21598. [
  21599. 12,
  21600. 11
  21601. ],
  21602. 'BlueFuzz',
  21603. 'num',
  21604. 1
  21605. ],
  21606. [
  21607. 10,
  21608. 'StdHW',
  21609. 'num',
  21610. null
  21611. ],
  21612. [
  21613. 11,
  21614. 'StdVW',
  21615. 'num',
  21616. null
  21617. ],
  21618. [
  21619. [
  21620. 12,
  21621. 12
  21622. ],
  21623. 'StemSnapH',
  21624. 'delta',
  21625. null
  21626. ],
  21627. [
  21628. [
  21629. 12,
  21630. 13
  21631. ],
  21632. 'StemSnapV',
  21633. 'delta',
  21634. null
  21635. ],
  21636. [
  21637. [
  21638. 12,
  21639. 14
  21640. ],
  21641. 'ForceBold',
  21642. 'num',
  21643. 0
  21644. ],
  21645. [
  21646. [
  21647. 12,
  21648. 17
  21649. ],
  21650. 'LanguageGroup',
  21651. 'num',
  21652. 0
  21653. ],
  21654. [
  21655. [
  21656. 12,
  21657. 18
  21658. ],
  21659. 'ExpansionFactor',
  21660. 'num',
  21661. 0.06
  21662. ],
  21663. [
  21664. [
  21665. 12,
  21666. 19
  21667. ],
  21668. 'initialRandomSeed',
  21669. 'num',
  21670. 0
  21671. ],
  21672. [
  21673. 20,
  21674. 'defaultWidthX',
  21675. 'num',
  21676. 0
  21677. ],
  21678. [
  21679. 21,
  21680. 'nominalWidthX',
  21681. 'num',
  21682. 0
  21683. ],
  21684. [
  21685. 19,
  21686. 'Subrs',
  21687. 'offset',
  21688. null
  21689. ]
  21690. ];
  21691. var tables = null;
  21692. function CFFPrivateDict(strings) {
  21693. if (tables === null) {
  21694. tables = CFFDict.createTables(layout);
  21695. }
  21696. CFFDict.call(this, tables, strings);
  21697. this.subrsIndex = null;
  21698. }
  21699. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  21700. return CFFPrivateDict;
  21701. }();
  21702. var CFFCharsetPredefinedTypes = {
  21703. ISO_ADOBE: 0,
  21704. EXPERT: 1,
  21705. EXPERT_SUBSET: 2
  21706. };
  21707. var CFFCharset = function CFFCharsetClosure() {
  21708. function CFFCharset(predefined, format, charset, raw) {
  21709. this.predefined = predefined;
  21710. this.format = format;
  21711. this.charset = charset;
  21712. this.raw = raw;
  21713. }
  21714. return CFFCharset;
  21715. }();
  21716. var CFFEncoding = function CFFEncodingClosure() {
  21717. function CFFEncoding(predefined, format, encoding, raw) {
  21718. this.predefined = predefined;
  21719. this.format = format;
  21720. this.encoding = encoding;
  21721. this.raw = raw;
  21722. }
  21723. return CFFEncoding;
  21724. }();
  21725. var CFFFDSelect = function CFFFDSelectClosure() {
  21726. function CFFFDSelect(fdSelect, raw) {
  21727. this.fdSelect = fdSelect;
  21728. this.raw = raw;
  21729. }
  21730. CFFFDSelect.prototype = {
  21731. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  21732. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21733. return -1;
  21734. }
  21735. return this.fdSelect[glyphIndex];
  21736. }
  21737. };
  21738. return CFFFDSelect;
  21739. }();
  21740. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  21741. function CFFOffsetTracker() {
  21742. this.offsets = Object.create(null);
  21743. }
  21744. CFFOffsetTracker.prototype = {
  21745. isTracking: function CFFOffsetTracker_isTracking(key) {
  21746. return key in this.offsets;
  21747. },
  21748. track: function CFFOffsetTracker_track(key, location) {
  21749. if (key in this.offsets) {
  21750. error('Already tracking location of ' + key);
  21751. }
  21752. this.offsets[key] = location;
  21753. },
  21754. offset: function CFFOffsetTracker_offset(value) {
  21755. for (var key in this.offsets) {
  21756. this.offsets[key] += value;
  21757. }
  21758. },
  21759. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  21760. if (!(key in this.offsets)) {
  21761. error('Not tracking location of ' + key);
  21762. }
  21763. var data = output.data;
  21764. var dataOffset = this.offsets[key];
  21765. var size = 5;
  21766. for (var i = 0, ii = values.length; i < ii; ++i) {
  21767. var offset0 = i * size + dataOffset;
  21768. var offset1 = offset0 + 1;
  21769. var offset2 = offset0 + 2;
  21770. var offset3 = offset0 + 3;
  21771. var offset4 = offset0 + 4;
  21772. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  21773. error('writing to an offset that is not empty');
  21774. }
  21775. var value = values[i];
  21776. data[offset0] = 0x1d;
  21777. data[offset1] = value >> 24 & 0xFF;
  21778. data[offset2] = value >> 16 & 0xFF;
  21779. data[offset3] = value >> 8 & 0xFF;
  21780. data[offset4] = value & 0xFF;
  21781. }
  21782. }
  21783. };
  21784. return CFFOffsetTracker;
  21785. }();
  21786. var CFFCompiler = function CFFCompilerClosure() {
  21787. function CFFCompiler(cff) {
  21788. this.cff = cff;
  21789. }
  21790. CFFCompiler.prototype = {
  21791. compile: function CFFCompiler_compile() {
  21792. var cff = this.cff;
  21793. var output = {
  21794. data: [],
  21795. length: 0,
  21796. add: function CFFCompiler_add(data) {
  21797. this.data = this.data.concat(data);
  21798. this.length = this.data.length;
  21799. }
  21800. };
  21801. var header = this.compileHeader(cff.header);
  21802. output.add(header);
  21803. var nameIndex = this.compileNameIndex(cff.names);
  21804. output.add(nameIndex);
  21805. if (cff.isCIDFont) {
  21806. if (cff.topDict.hasName('FontMatrix')) {
  21807. var base = cff.topDict.getByName('FontMatrix');
  21808. cff.topDict.removeByName('FontMatrix');
  21809. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  21810. var subDict = cff.fdArray[i];
  21811. var matrix = base.slice(0);
  21812. if (subDict.hasName('FontMatrix')) {
  21813. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  21814. }
  21815. subDict.setByName('FontMatrix', matrix);
  21816. }
  21817. }
  21818. }
  21819. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  21820. output.add(compiled.output);
  21821. var topDictTracker = compiled.trackers[0];
  21822. var stringIndex = this.compileStringIndex(cff.strings.strings);
  21823. output.add(stringIndex);
  21824. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  21825. output.add(globalSubrIndex);
  21826. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  21827. if (cff.encoding.predefined) {
  21828. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  21829. } else {
  21830. var encoding = this.compileEncoding(cff.encoding);
  21831. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  21832. output.add(encoding);
  21833. }
  21834. }
  21835. if (cff.charset && cff.topDict.hasName('charset')) {
  21836. if (cff.charset.predefined) {
  21837. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21838. } else {
  21839. var charset = this.compileCharset(cff.charset);
  21840. topDictTracker.setEntryLocation('charset', [output.length], output);
  21841. output.add(charset);
  21842. }
  21843. }
  21844. var charStrings = this.compileCharStrings(cff.charStrings);
  21845. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21846. output.add(charStrings);
  21847. if (cff.isCIDFont) {
  21848. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21849. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21850. output.add(fdSelect);
  21851. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21852. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21853. output.add(compiled.output);
  21854. var fontDictTrackers = compiled.trackers;
  21855. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21856. }
  21857. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21858. output.add([0]);
  21859. return output.data;
  21860. },
  21861. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21862. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21863. return this.encodeInteger(value);
  21864. }
  21865. return this.encodeFloat(value);
  21866. },
  21867. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21868. var value = num.toString();
  21869. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21870. if (m) {
  21871. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21872. value = (Math.round(num * epsilon) / epsilon).toString();
  21873. }
  21874. var nibbles = '';
  21875. var i, ii;
  21876. for (i = 0, ii = value.length; i < ii; ++i) {
  21877. var a = value[i];
  21878. if (a === 'e') {
  21879. nibbles += value[++i] === '-' ? 'c' : 'b';
  21880. } else if (a === '.') {
  21881. nibbles += 'a';
  21882. } else if (a === '-') {
  21883. nibbles += 'e';
  21884. } else {
  21885. nibbles += a;
  21886. }
  21887. }
  21888. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21889. var out = [30];
  21890. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21891. out.push(parseInt(nibbles.substr(i, 2), 16));
  21892. }
  21893. return out;
  21894. },
  21895. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21896. var code;
  21897. if (value >= -107 && value <= 107) {
  21898. code = [value + 139];
  21899. } else if (value >= 108 && value <= 1131) {
  21900. value = value - 108;
  21901. code = [
  21902. (value >> 8) + 247,
  21903. value & 0xFF
  21904. ];
  21905. } else if (value >= -1131 && value <= -108) {
  21906. value = -value - 108;
  21907. code = [
  21908. (value >> 8) + 251,
  21909. value & 0xFF
  21910. ];
  21911. } else if (value >= -32768 && value <= 32767) {
  21912. code = [
  21913. 0x1c,
  21914. value >> 8 & 0xFF,
  21915. value & 0xFF
  21916. ];
  21917. } else {
  21918. code = [
  21919. 0x1d,
  21920. value >> 24 & 0xFF,
  21921. value >> 16 & 0xFF,
  21922. value >> 8 & 0xFF,
  21923. value & 0xFF
  21924. ];
  21925. }
  21926. return code;
  21927. },
  21928. compileHeader: function CFFCompiler_compileHeader(header) {
  21929. return [
  21930. header.major,
  21931. header.minor,
  21932. header.hdrSize,
  21933. header.offSize
  21934. ];
  21935. },
  21936. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21937. var nameIndex = new CFFIndex();
  21938. for (var i = 0, ii = names.length; i < ii; ++i) {
  21939. nameIndex.add(stringToBytes(names[i]));
  21940. }
  21941. return this.compileIndex(nameIndex);
  21942. },
  21943. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21944. var fontDictTrackers = [];
  21945. var fdArrayIndex = new CFFIndex();
  21946. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21947. var fontDict = dicts[i];
  21948. if (removeCidKeys) {
  21949. fontDict.removeByName('CIDFontVersion');
  21950. fontDict.removeByName('CIDFontRevision');
  21951. fontDict.removeByName('CIDFontType');
  21952. fontDict.removeByName('CIDCount');
  21953. fontDict.removeByName('UIDBase');
  21954. }
  21955. var fontDictTracker = new CFFOffsetTracker();
  21956. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21957. fontDictTrackers.push(fontDictTracker);
  21958. fdArrayIndex.add(fontDictData);
  21959. fontDictTracker.offset(length);
  21960. }
  21961. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21962. return {
  21963. trackers: fontDictTrackers,
  21964. output: fdArrayIndex
  21965. };
  21966. },
  21967. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21968. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21969. var fontDict = dicts[i];
  21970. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21971. var privateDict = fontDict.privateDict;
  21972. var privateDictTracker = new CFFOffsetTracker();
  21973. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21974. var outputLength = output.length;
  21975. privateDictTracker.offset(outputLength);
  21976. if (!privateDictData.length) {
  21977. outputLength = 0;
  21978. }
  21979. trackers[i].setEntryLocation('Private', [
  21980. privateDictData.length,
  21981. outputLength
  21982. ], output);
  21983. output.add(privateDictData);
  21984. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21985. var subrs = this.compileIndex(privateDict.subrsIndex);
  21986. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21987. output.add(subrs);
  21988. }
  21989. }
  21990. },
  21991. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21992. var out = [];
  21993. var order = dict.order;
  21994. for (var i = 0; i < order.length; ++i) {
  21995. var key = order[i];
  21996. if (!(key in dict.values)) {
  21997. continue;
  21998. }
  21999. var values = dict.values[key];
  22000. var types = dict.types[key];
  22001. if (!isArray(types)) {
  22002. types = [types];
  22003. }
  22004. if (!isArray(values)) {
  22005. values = [values];
  22006. }
  22007. if (values.length === 0) {
  22008. continue;
  22009. }
  22010. for (var j = 0, jj = types.length; j < jj; ++j) {
  22011. var type = types[j];
  22012. var value = values[j];
  22013. switch (type) {
  22014. case 'num':
  22015. case 'sid':
  22016. out = out.concat(this.encodeNumber(value));
  22017. break;
  22018. case 'offset':
  22019. var name = dict.keyToNameMap[key];
  22020. if (!offsetTracker.isTracking(name)) {
  22021. offsetTracker.track(name, out.length);
  22022. }
  22023. out = out.concat([
  22024. 0x1d,
  22025. 0,
  22026. 0,
  22027. 0,
  22028. 0
  22029. ]);
  22030. break;
  22031. case 'array':
  22032. case 'delta':
  22033. out = out.concat(this.encodeNumber(value));
  22034. for (var k = 1, kk = values.length; k < kk; ++k) {
  22035. out = out.concat(this.encodeNumber(values[k]));
  22036. }
  22037. break;
  22038. default:
  22039. error('Unknown data type of ' + type);
  22040. break;
  22041. }
  22042. }
  22043. out = out.concat(dict.opcodes[key]);
  22044. }
  22045. return out;
  22046. },
  22047. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  22048. var stringIndex = new CFFIndex();
  22049. for (var i = 0, ii = strings.length; i < ii; ++i) {
  22050. stringIndex.add(stringToBytes(strings[i]));
  22051. }
  22052. return this.compileIndex(stringIndex);
  22053. },
  22054. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  22055. var globalSubrIndex = this.cff.globalSubrIndex;
  22056. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  22057. },
  22058. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  22059. return this.compileIndex(charStrings);
  22060. },
  22061. compileCharset: function CFFCompiler_compileCharset(charset) {
  22062. return this.compileTypedArray(charset.raw);
  22063. },
  22064. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  22065. return this.compileTypedArray(encoding.raw);
  22066. },
  22067. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  22068. return this.compileTypedArray(fdSelect);
  22069. },
  22070. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  22071. var out = [];
  22072. for (var i = 0, ii = data.length; i < ii; ++i) {
  22073. out[i] = data[i];
  22074. }
  22075. return out;
  22076. },
  22077. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  22078. trackers = trackers || [];
  22079. var objects = index.objects;
  22080. var count = objects.length;
  22081. if (count === 0) {
  22082. return [
  22083. 0,
  22084. 0,
  22085. 0
  22086. ];
  22087. }
  22088. var data = [
  22089. count >> 8 & 0xFF,
  22090. count & 0xff
  22091. ];
  22092. var lastOffset = 1, i;
  22093. for (i = 0; i < count; ++i) {
  22094. lastOffset += objects[i].length;
  22095. }
  22096. var offsetSize;
  22097. if (lastOffset < 0x100) {
  22098. offsetSize = 1;
  22099. } else if (lastOffset < 0x10000) {
  22100. offsetSize = 2;
  22101. } else if (lastOffset < 0x1000000) {
  22102. offsetSize = 3;
  22103. } else {
  22104. offsetSize = 4;
  22105. }
  22106. data.push(offsetSize);
  22107. var relativeOffset = 1;
  22108. for (i = 0; i < count + 1; i++) {
  22109. if (offsetSize === 1) {
  22110. data.push(relativeOffset & 0xFF);
  22111. } else if (offsetSize === 2) {
  22112. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22113. } else if (offsetSize === 3) {
  22114. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22115. } else {
  22116. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22117. }
  22118. if (objects[i]) {
  22119. relativeOffset += objects[i].length;
  22120. }
  22121. }
  22122. for (i = 0; i < count; i++) {
  22123. if (trackers[i]) {
  22124. trackers[i].offset(data.length);
  22125. }
  22126. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  22127. data.push(objects[i][j]);
  22128. }
  22129. }
  22130. return data;
  22131. }
  22132. };
  22133. return CFFCompiler;
  22134. }();
  22135. exports.CFFStandardStrings = CFFStandardStrings;
  22136. exports.CFFParser = CFFParser;
  22137. exports.CFF = CFF;
  22138. exports.CFFHeader = CFFHeader;
  22139. exports.CFFStrings = CFFStrings;
  22140. exports.CFFIndex = CFFIndex;
  22141. exports.CFFCharset = CFFCharset;
  22142. exports.CFFTopDict = CFFTopDict;
  22143. exports.CFFPrivateDict = CFFPrivateDict;
  22144. exports.CFFCompiler = CFFCompiler;
  22145. /***/ }),
  22146. /* 11 */
  22147. /***/ (function(module, exports, __w_pdfjs_require__) {
  22148. "use strict";
  22149. var sharedUtil = __w_pdfjs_require__(0);
  22150. var MissingDataException = sharedUtil.MissingDataException;
  22151. var arrayByteLength = sharedUtil.arrayByteLength;
  22152. var arraysToBytes = sharedUtil.arraysToBytes;
  22153. var assert = sharedUtil.assert;
  22154. var createPromiseCapability = sharedUtil.createPromiseCapability;
  22155. var isInt = sharedUtil.isInt;
  22156. var isEmptyObj = sharedUtil.isEmptyObj;
  22157. var ChunkedStream = function ChunkedStreamClosure() {
  22158. function ChunkedStream(length, chunkSize, manager) {
  22159. this.bytes = new Uint8Array(length);
  22160. this.start = 0;
  22161. this.pos = 0;
  22162. this.end = length;
  22163. this.chunkSize = chunkSize;
  22164. this.loadedChunks = [];
  22165. this.numChunksLoaded = 0;
  22166. this.numChunks = Math.ceil(length / chunkSize);
  22167. this.manager = manager;
  22168. this.progressiveDataLength = 0;
  22169. this.lastSuccessfulEnsureByteChunk = -1;
  22170. }
  22171. ChunkedStream.prototype = {
  22172. getMissingChunks: function ChunkedStream_getMissingChunks() {
  22173. var chunks = [];
  22174. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  22175. if (!this.loadedChunks[chunk]) {
  22176. chunks.push(chunk);
  22177. }
  22178. }
  22179. return chunks;
  22180. },
  22181. getBaseStreams: function ChunkedStream_getBaseStreams() {
  22182. return [this];
  22183. },
  22184. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  22185. return this.numChunksLoaded === this.numChunks;
  22186. },
  22187. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  22188. var end = begin + chunk.byteLength;
  22189. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  22190. var length = this.bytes.length;
  22191. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  22192. this.bytes.set(new Uint8Array(chunk), begin);
  22193. var chunkSize = this.chunkSize;
  22194. var beginChunk = Math.floor(begin / chunkSize);
  22195. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22196. var curChunk;
  22197. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22198. if (!this.loadedChunks[curChunk]) {
  22199. this.loadedChunks[curChunk] = true;
  22200. ++this.numChunksLoaded;
  22201. }
  22202. }
  22203. },
  22204. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  22205. var position = this.progressiveDataLength;
  22206. var beginChunk = Math.floor(position / this.chunkSize);
  22207. this.bytes.set(new Uint8Array(data), position);
  22208. position += data.byteLength;
  22209. this.progressiveDataLength = position;
  22210. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  22211. var curChunk;
  22212. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22213. if (!this.loadedChunks[curChunk]) {
  22214. this.loadedChunks[curChunk] = true;
  22215. ++this.numChunksLoaded;
  22216. }
  22217. }
  22218. },
  22219. ensureByte: function ChunkedStream_ensureByte(pos) {
  22220. var chunk = Math.floor(pos / this.chunkSize);
  22221. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  22222. return;
  22223. }
  22224. if (!this.loadedChunks[chunk]) {
  22225. throw new MissingDataException(pos, pos + 1);
  22226. }
  22227. this.lastSuccessfulEnsureByteChunk = chunk;
  22228. },
  22229. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  22230. if (begin >= end) {
  22231. return;
  22232. }
  22233. if (end <= this.progressiveDataLength) {
  22234. return;
  22235. }
  22236. var chunkSize = this.chunkSize;
  22237. var beginChunk = Math.floor(begin / chunkSize);
  22238. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22239. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22240. if (!this.loadedChunks[chunk]) {
  22241. throw new MissingDataException(begin, end);
  22242. }
  22243. }
  22244. },
  22245. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  22246. var chunk, numChunks = this.numChunks;
  22247. for (var i = 0; i < numChunks; ++i) {
  22248. chunk = (beginChunk + i) % numChunks;
  22249. if (!this.loadedChunks[chunk]) {
  22250. return chunk;
  22251. }
  22252. }
  22253. return null;
  22254. },
  22255. hasChunk: function ChunkedStream_hasChunk(chunk) {
  22256. return !!this.loadedChunks[chunk];
  22257. },
  22258. get length() {
  22259. return this.end - this.start;
  22260. },
  22261. get isEmpty() {
  22262. return this.length === 0;
  22263. },
  22264. getByte: function ChunkedStream_getByte() {
  22265. var pos = this.pos;
  22266. if (pos >= this.end) {
  22267. return -1;
  22268. }
  22269. this.ensureByte(pos);
  22270. return this.bytes[this.pos++];
  22271. },
  22272. getUint16: function ChunkedStream_getUint16() {
  22273. var b0 = this.getByte();
  22274. var b1 = this.getByte();
  22275. if (b0 === -1 || b1 === -1) {
  22276. return -1;
  22277. }
  22278. return (b0 << 8) + b1;
  22279. },
  22280. getInt32: function ChunkedStream_getInt32() {
  22281. var b0 = this.getByte();
  22282. var b1 = this.getByte();
  22283. var b2 = this.getByte();
  22284. var b3 = this.getByte();
  22285. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22286. },
  22287. getBytes: function ChunkedStream_getBytes(length) {
  22288. var bytes = this.bytes;
  22289. var pos = this.pos;
  22290. var strEnd = this.end;
  22291. if (!length) {
  22292. this.ensureRange(pos, strEnd);
  22293. return bytes.subarray(pos, strEnd);
  22294. }
  22295. var end = pos + length;
  22296. if (end > strEnd) {
  22297. end = strEnd;
  22298. }
  22299. this.ensureRange(pos, end);
  22300. this.pos = end;
  22301. return bytes.subarray(pos, end);
  22302. },
  22303. peekByte: function ChunkedStream_peekByte() {
  22304. var peekedByte = this.getByte();
  22305. this.pos--;
  22306. return peekedByte;
  22307. },
  22308. peekBytes: function ChunkedStream_peekBytes(length) {
  22309. var bytes = this.getBytes(length);
  22310. this.pos -= bytes.length;
  22311. return bytes;
  22312. },
  22313. getByteRange: function ChunkedStream_getBytes(begin, end) {
  22314. this.ensureRange(begin, end);
  22315. return this.bytes.subarray(begin, end);
  22316. },
  22317. skip: function ChunkedStream_skip(n) {
  22318. if (!n) {
  22319. n = 1;
  22320. }
  22321. this.pos += n;
  22322. },
  22323. reset: function ChunkedStream_reset() {
  22324. this.pos = this.start;
  22325. },
  22326. moveStart: function ChunkedStream_moveStart() {
  22327. this.start = this.pos;
  22328. },
  22329. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  22330. this.ensureRange(start, start + length);
  22331. function ChunkedStreamSubstream() {
  22332. }
  22333. ChunkedStreamSubstream.prototype = Object.create(this);
  22334. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  22335. var chunkSize = this.chunkSize;
  22336. var beginChunk = Math.floor(this.start / chunkSize);
  22337. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  22338. var missingChunks = [];
  22339. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22340. if (!this.loadedChunks[chunk]) {
  22341. missingChunks.push(chunk);
  22342. }
  22343. }
  22344. return missingChunks;
  22345. };
  22346. var subStream = new ChunkedStreamSubstream();
  22347. subStream.pos = subStream.start = start;
  22348. subStream.end = start + length || this.end;
  22349. subStream.dict = dict;
  22350. return subStream;
  22351. }
  22352. };
  22353. return ChunkedStream;
  22354. }();
  22355. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  22356. function ChunkedStreamManager(pdfNetworkStream, args) {
  22357. var chunkSize = args.rangeChunkSize;
  22358. var length = args.length;
  22359. this.stream = new ChunkedStream(length, chunkSize, this);
  22360. this.length = length;
  22361. this.chunkSize = chunkSize;
  22362. this.pdfNetworkStream = pdfNetworkStream;
  22363. this.url = args.url;
  22364. this.disableAutoFetch = args.disableAutoFetch;
  22365. this.msgHandler = args.msgHandler;
  22366. this.currRequestId = 0;
  22367. this.chunksNeededByRequest = Object.create(null);
  22368. this.requestsByChunk = Object.create(null);
  22369. this.promisesByRequest = Object.create(null);
  22370. this.progressiveDataLength = 0;
  22371. this.aborted = false;
  22372. this._loadedStreamCapability = createPromiseCapability();
  22373. }
  22374. ChunkedStreamManager.prototype = {
  22375. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  22376. return this._loadedStreamCapability.promise;
  22377. },
  22378. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  22379. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  22380. if (!rangeReader.isStreamingSupported) {
  22381. rangeReader.onProgress = this.onProgress.bind(this);
  22382. }
  22383. var chunks = [], loaded = 0;
  22384. var manager = this;
  22385. var promise = new Promise(function (resolve, reject) {
  22386. var readChunk = function (chunk) {
  22387. try {
  22388. if (!chunk.done) {
  22389. var data = chunk.value;
  22390. chunks.push(data);
  22391. loaded += arrayByteLength(data);
  22392. if (rangeReader.isStreamingSupported) {
  22393. manager.onProgress({ loaded: loaded });
  22394. }
  22395. rangeReader.read().then(readChunk, reject);
  22396. return;
  22397. }
  22398. var chunkData = arraysToBytes(chunks);
  22399. chunks = null;
  22400. resolve(chunkData);
  22401. } catch (e) {
  22402. reject(e);
  22403. }
  22404. };
  22405. rangeReader.read().then(readChunk, reject);
  22406. });
  22407. promise.then(function (data) {
  22408. if (this.aborted) {
  22409. return;
  22410. }
  22411. this.onReceiveData({
  22412. chunk: data,
  22413. begin: begin
  22414. });
  22415. }.bind(this));
  22416. },
  22417. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  22418. var missingChunks = this.stream.getMissingChunks();
  22419. this._requestChunks(missingChunks);
  22420. return this._loadedStreamCapability.promise;
  22421. },
  22422. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  22423. var requestId = this.currRequestId++;
  22424. var i, ii;
  22425. var chunksNeeded = Object.create(null);
  22426. this.chunksNeededByRequest[requestId] = chunksNeeded;
  22427. for (i = 0, ii = chunks.length; i < ii; i++) {
  22428. if (!this.stream.hasChunk(chunks[i])) {
  22429. chunksNeeded[chunks[i]] = true;
  22430. }
  22431. }
  22432. if (isEmptyObj(chunksNeeded)) {
  22433. return Promise.resolve();
  22434. }
  22435. var capability = createPromiseCapability();
  22436. this.promisesByRequest[requestId] = capability;
  22437. var chunksToRequest = [];
  22438. for (var chunk in chunksNeeded) {
  22439. chunk = chunk | 0;
  22440. if (!(chunk in this.requestsByChunk)) {
  22441. this.requestsByChunk[chunk] = [];
  22442. chunksToRequest.push(chunk);
  22443. }
  22444. this.requestsByChunk[chunk].push(requestId);
  22445. }
  22446. if (!chunksToRequest.length) {
  22447. return capability.promise;
  22448. }
  22449. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  22450. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  22451. var groupedChunk = groupedChunksToRequest[i];
  22452. var begin = groupedChunk.beginChunk * this.chunkSize;
  22453. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  22454. this.sendRequest(begin, end);
  22455. }
  22456. return capability.promise;
  22457. },
  22458. getStream: function ChunkedStreamManager_getStream() {
  22459. return this.stream;
  22460. },
  22461. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  22462. end = Math.min(end, this.length);
  22463. var beginChunk = this.getBeginChunk(begin);
  22464. var endChunk = this.getEndChunk(end);
  22465. var chunks = [];
  22466. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22467. chunks.push(chunk);
  22468. }
  22469. return this._requestChunks(chunks);
  22470. },
  22471. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  22472. ranges = ranges || [];
  22473. var chunksToRequest = [];
  22474. for (var i = 0; i < ranges.length; i++) {
  22475. var beginChunk = this.getBeginChunk(ranges[i].begin);
  22476. var endChunk = this.getEndChunk(ranges[i].end);
  22477. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22478. if (chunksToRequest.indexOf(chunk) < 0) {
  22479. chunksToRequest.push(chunk);
  22480. }
  22481. }
  22482. }
  22483. chunksToRequest.sort(function (a, b) {
  22484. return a - b;
  22485. });
  22486. return this._requestChunks(chunksToRequest);
  22487. },
  22488. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  22489. var groupedChunks = [];
  22490. var beginChunk = -1;
  22491. var prevChunk = -1;
  22492. for (var i = 0; i < chunks.length; ++i) {
  22493. var chunk = chunks[i];
  22494. if (beginChunk < 0) {
  22495. beginChunk = chunk;
  22496. }
  22497. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  22498. groupedChunks.push({
  22499. beginChunk: beginChunk,
  22500. endChunk: prevChunk + 1
  22501. });
  22502. beginChunk = chunk;
  22503. }
  22504. if (i + 1 === chunks.length) {
  22505. groupedChunks.push({
  22506. beginChunk: beginChunk,
  22507. endChunk: chunk + 1
  22508. });
  22509. }
  22510. prevChunk = chunk;
  22511. }
  22512. return groupedChunks;
  22513. },
  22514. onProgress: function ChunkedStreamManager_onProgress(args) {
  22515. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  22516. this.msgHandler.send('DocProgress', {
  22517. loaded: bytesLoaded,
  22518. total: this.length
  22519. });
  22520. },
  22521. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  22522. var chunk = args.chunk;
  22523. var isProgressive = args.begin === undefined;
  22524. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  22525. var end = begin + chunk.byteLength;
  22526. var beginChunk = Math.floor(begin / this.chunkSize);
  22527. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  22528. if (isProgressive) {
  22529. this.stream.onReceiveProgressiveData(chunk);
  22530. this.progressiveDataLength = end;
  22531. } else {
  22532. this.stream.onReceiveData(begin, chunk);
  22533. }
  22534. if (this.stream.allChunksLoaded()) {
  22535. this._loadedStreamCapability.resolve(this.stream);
  22536. }
  22537. var loadedRequests = [];
  22538. var i, requestId;
  22539. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  22540. var requestIds = this.requestsByChunk[chunk] || [];
  22541. delete this.requestsByChunk[chunk];
  22542. for (i = 0; i < requestIds.length; ++i) {
  22543. requestId = requestIds[i];
  22544. var chunksNeeded = this.chunksNeededByRequest[requestId];
  22545. if (chunk in chunksNeeded) {
  22546. delete chunksNeeded[chunk];
  22547. }
  22548. if (!isEmptyObj(chunksNeeded)) {
  22549. continue;
  22550. }
  22551. loadedRequests.push(requestId);
  22552. }
  22553. }
  22554. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  22555. var nextEmptyChunk;
  22556. if (this.stream.numChunksLoaded === 1) {
  22557. var lastChunk = this.stream.numChunks - 1;
  22558. if (!this.stream.hasChunk(lastChunk)) {
  22559. nextEmptyChunk = lastChunk;
  22560. }
  22561. } else {
  22562. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  22563. }
  22564. if (isInt(nextEmptyChunk)) {
  22565. this._requestChunks([nextEmptyChunk]);
  22566. }
  22567. }
  22568. for (i = 0; i < loadedRequests.length; ++i) {
  22569. requestId = loadedRequests[i];
  22570. var capability = this.promisesByRequest[requestId];
  22571. delete this.promisesByRequest[requestId];
  22572. capability.resolve();
  22573. }
  22574. this.msgHandler.send('DocProgress', {
  22575. loaded: this.stream.numChunksLoaded * this.chunkSize,
  22576. total: this.length
  22577. });
  22578. },
  22579. onError: function ChunkedStreamManager_onError(err) {
  22580. this._loadedStreamCapability.reject(err);
  22581. },
  22582. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  22583. var chunk = Math.floor(begin / this.chunkSize);
  22584. return chunk;
  22585. },
  22586. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  22587. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  22588. return chunk;
  22589. },
  22590. abort: function ChunkedStreamManager_abort() {
  22591. this.aborted = true;
  22592. if (this.pdfNetworkStream) {
  22593. this.pdfNetworkStream.cancelAllRequests('abort');
  22594. }
  22595. for (var requestId in this.promisesByRequest) {
  22596. var capability = this.promisesByRequest[requestId];
  22597. capability.reject(new Error('Request was aborted'));
  22598. }
  22599. }
  22600. };
  22601. return ChunkedStreamManager;
  22602. }();
  22603. exports.ChunkedStream = ChunkedStream;
  22604. exports.ChunkedStreamManager = ChunkedStreamManager;
  22605. /***/ }),
  22606. /* 12 */
  22607. /***/ (function(module, exports, __w_pdfjs_require__) {
  22608. "use strict";
  22609. var sharedUtil = __w_pdfjs_require__(0);
  22610. var corePrimitives = __w_pdfjs_require__(1);
  22611. var coreStream = __w_pdfjs_require__(2);
  22612. var PasswordException = sharedUtil.PasswordException;
  22613. var PasswordResponses = sharedUtil.PasswordResponses;
  22614. var bytesToString = sharedUtil.bytesToString;
  22615. var warn = sharedUtil.warn;
  22616. var error = sharedUtil.error;
  22617. var assert = sharedUtil.assert;
  22618. var isInt = sharedUtil.isInt;
  22619. var stringToBytes = sharedUtil.stringToBytes;
  22620. var utf8StringToString = sharedUtil.utf8StringToString;
  22621. var Name = corePrimitives.Name;
  22622. var isName = corePrimitives.isName;
  22623. var isDict = corePrimitives.isDict;
  22624. var DecryptStream = coreStream.DecryptStream;
  22625. var ARCFourCipher = function ARCFourCipherClosure() {
  22626. function ARCFourCipher(key) {
  22627. this.a = 0;
  22628. this.b = 0;
  22629. var s = new Uint8Array(256);
  22630. var i, j = 0, tmp, keyLength = key.length;
  22631. for (i = 0; i < 256; ++i) {
  22632. s[i] = i;
  22633. }
  22634. for (i = 0; i < 256; ++i) {
  22635. tmp = s[i];
  22636. j = j + tmp + key[i % keyLength] & 0xFF;
  22637. s[i] = s[j];
  22638. s[j] = tmp;
  22639. }
  22640. this.s = s;
  22641. }
  22642. ARCFourCipher.prototype = {
  22643. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  22644. var i, n = data.length, tmp, tmp2;
  22645. var a = this.a, b = this.b, s = this.s;
  22646. var output = new Uint8Array(n);
  22647. for (i = 0; i < n; ++i) {
  22648. a = a + 1 & 0xFF;
  22649. tmp = s[a];
  22650. b = b + tmp & 0xFF;
  22651. tmp2 = s[b];
  22652. s[a] = tmp2;
  22653. s[b] = tmp;
  22654. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  22655. }
  22656. this.a = a;
  22657. this.b = b;
  22658. return output;
  22659. }
  22660. };
  22661. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  22662. return ARCFourCipher;
  22663. }();
  22664. var calculateMD5 = function calculateMD5Closure() {
  22665. var r = new Uint8Array([
  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. 7,
  22679. 12,
  22680. 17,
  22681. 22,
  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. 5,
  22695. 9,
  22696. 14,
  22697. 20,
  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. 4,
  22711. 11,
  22712. 16,
  22713. 23,
  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. 6,
  22727. 10,
  22728. 15,
  22729. 21
  22730. ]);
  22731. var k = new Int32Array([
  22732. -680876936,
  22733. -389564586,
  22734. 606105819,
  22735. -1044525330,
  22736. -176418897,
  22737. 1200080426,
  22738. -1473231341,
  22739. -45705983,
  22740. 1770035416,
  22741. -1958414417,
  22742. -42063,
  22743. -1990404162,
  22744. 1804603682,
  22745. -40341101,
  22746. -1502002290,
  22747. 1236535329,
  22748. -165796510,
  22749. -1069501632,
  22750. 643717713,
  22751. -373897302,
  22752. -701558691,
  22753. 38016083,
  22754. -660478335,
  22755. -405537848,
  22756. 568446438,
  22757. -1019803690,
  22758. -187363961,
  22759. 1163531501,
  22760. -1444681467,
  22761. -51403784,
  22762. 1735328473,
  22763. -1926607734,
  22764. -378558,
  22765. -2022574463,
  22766. 1839030562,
  22767. -35309556,
  22768. -1530992060,
  22769. 1272893353,
  22770. -155497632,
  22771. -1094730640,
  22772. 681279174,
  22773. -358537222,
  22774. -722521979,
  22775. 76029189,
  22776. -640364487,
  22777. -421815835,
  22778. 530742520,
  22779. -995338651,
  22780. -198630844,
  22781. 1126891415,
  22782. -1416354905,
  22783. -57434055,
  22784. 1700485571,
  22785. -1894986606,
  22786. -1051523,
  22787. -2054922799,
  22788. 1873313359,
  22789. -30611744,
  22790. -1560198380,
  22791. 1309151649,
  22792. -145523070,
  22793. -1120210379,
  22794. 718787259,
  22795. -343485551
  22796. ]);
  22797. function hash(data, offset, length) {
  22798. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  22799. var paddedLength = length + 72 & ~63;
  22800. var padded = new Uint8Array(paddedLength);
  22801. var i, j, n;
  22802. for (i = 0; i < length; ++i) {
  22803. padded[i] = data[offset++];
  22804. }
  22805. padded[i++] = 0x80;
  22806. n = paddedLength - 8;
  22807. while (i < n) {
  22808. padded[i++] = 0;
  22809. }
  22810. padded[i++] = length << 3 & 0xFF;
  22811. padded[i++] = length >> 5 & 0xFF;
  22812. padded[i++] = length >> 13 & 0xFF;
  22813. padded[i++] = length >> 21 & 0xFF;
  22814. padded[i++] = length >>> 29 & 0xFF;
  22815. padded[i++] = 0;
  22816. padded[i++] = 0;
  22817. padded[i++] = 0;
  22818. var w = new Int32Array(16);
  22819. for (i = 0; i < paddedLength;) {
  22820. for (j = 0; j < 16; ++j, i += 4) {
  22821. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  22822. }
  22823. var a = h0, b = h1, c = h2, d = h3, f, g;
  22824. for (j = 0; j < 64; ++j) {
  22825. if (j < 16) {
  22826. f = b & c | ~b & d;
  22827. g = j;
  22828. } else if (j < 32) {
  22829. f = d & b | ~d & c;
  22830. g = 5 * j + 1 & 15;
  22831. } else if (j < 48) {
  22832. f = b ^ c ^ d;
  22833. g = 3 * j + 5 & 15;
  22834. } else {
  22835. f = c ^ (b | ~d);
  22836. g = 7 * j & 15;
  22837. }
  22838. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22839. d = c;
  22840. c = b;
  22841. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22842. a = tmp;
  22843. }
  22844. h0 = h0 + a | 0;
  22845. h1 = h1 + b | 0;
  22846. h2 = h2 + c | 0;
  22847. h3 = h3 + d | 0;
  22848. }
  22849. return new Uint8Array([
  22850. h0 & 0xFF,
  22851. h0 >> 8 & 0xFF,
  22852. h0 >> 16 & 0xFF,
  22853. h0 >>> 24 & 0xFF,
  22854. h1 & 0xFF,
  22855. h1 >> 8 & 0xFF,
  22856. h1 >> 16 & 0xFF,
  22857. h1 >>> 24 & 0xFF,
  22858. h2 & 0xFF,
  22859. h2 >> 8 & 0xFF,
  22860. h2 >> 16 & 0xFF,
  22861. h2 >>> 24 & 0xFF,
  22862. h3 & 0xFF,
  22863. h3 >> 8 & 0xFF,
  22864. h3 >> 16 & 0xFF,
  22865. h3 >>> 24 & 0xFF
  22866. ]);
  22867. }
  22868. return hash;
  22869. }();
  22870. var Word64 = function Word64Closure() {
  22871. function Word64(highInteger, lowInteger) {
  22872. this.high = highInteger | 0;
  22873. this.low = lowInteger | 0;
  22874. }
  22875. Word64.prototype = {
  22876. and: function Word64_and(word) {
  22877. this.high &= word.high;
  22878. this.low &= word.low;
  22879. },
  22880. xor: function Word64_xor(word) {
  22881. this.high ^= word.high;
  22882. this.low ^= word.low;
  22883. },
  22884. or: function Word64_or(word) {
  22885. this.high |= word.high;
  22886. this.low |= word.low;
  22887. },
  22888. shiftRight: function Word64_shiftRight(places) {
  22889. if (places >= 32) {
  22890. this.low = this.high >>> places - 32 | 0;
  22891. this.high = 0;
  22892. } else {
  22893. this.low = this.low >>> places | this.high << 32 - places;
  22894. this.high = this.high >>> places | 0;
  22895. }
  22896. },
  22897. shiftLeft: function Word64_shiftLeft(places) {
  22898. if (places >= 32) {
  22899. this.high = this.low << places - 32;
  22900. this.low = 0;
  22901. } else {
  22902. this.high = this.high << places | this.low >>> 32 - places;
  22903. this.low = this.low << places;
  22904. }
  22905. },
  22906. rotateRight: function Word64_rotateRight(places) {
  22907. var low, high;
  22908. if (places & 32) {
  22909. high = this.low;
  22910. low = this.high;
  22911. } else {
  22912. low = this.low;
  22913. high = this.high;
  22914. }
  22915. places &= 31;
  22916. this.low = low >>> places | high << 32 - places;
  22917. this.high = high >>> places | low << 32 - places;
  22918. },
  22919. not: function Word64_not() {
  22920. this.high = ~this.high;
  22921. this.low = ~this.low;
  22922. },
  22923. add: function Word64_add(word) {
  22924. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22925. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22926. if (lowAdd > 0xFFFFFFFF) {
  22927. highAdd += 1;
  22928. }
  22929. this.low = lowAdd | 0;
  22930. this.high = highAdd | 0;
  22931. },
  22932. copyTo: function Word64_copyTo(bytes, offset) {
  22933. bytes[offset] = this.high >>> 24 & 0xFF;
  22934. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22935. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22936. bytes[offset + 3] = this.high & 0xFF;
  22937. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22938. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22939. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22940. bytes[offset + 7] = this.low & 0xFF;
  22941. },
  22942. assign: function Word64_assign(word) {
  22943. this.high = word.high;
  22944. this.low = word.low;
  22945. }
  22946. };
  22947. return Word64;
  22948. }();
  22949. var calculateSHA256 = function calculateSHA256Closure() {
  22950. function rotr(x, n) {
  22951. return x >>> n | x << 32 - n;
  22952. }
  22953. function ch(x, y, z) {
  22954. return x & y ^ ~x & z;
  22955. }
  22956. function maj(x, y, z) {
  22957. return x & y ^ x & z ^ y & z;
  22958. }
  22959. function sigma(x) {
  22960. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22961. }
  22962. function sigmaPrime(x) {
  22963. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22964. }
  22965. function littleSigma(x) {
  22966. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22967. }
  22968. function littleSigmaPrime(x) {
  22969. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22970. }
  22971. var k = [
  22972. 0x428a2f98,
  22973. 0x71374491,
  22974. 0xb5c0fbcf,
  22975. 0xe9b5dba5,
  22976. 0x3956c25b,
  22977. 0x59f111f1,
  22978. 0x923f82a4,
  22979. 0xab1c5ed5,
  22980. 0xd807aa98,
  22981. 0x12835b01,
  22982. 0x243185be,
  22983. 0x550c7dc3,
  22984. 0x72be5d74,
  22985. 0x80deb1fe,
  22986. 0x9bdc06a7,
  22987. 0xc19bf174,
  22988. 0xe49b69c1,
  22989. 0xefbe4786,
  22990. 0x0fc19dc6,
  22991. 0x240ca1cc,
  22992. 0x2de92c6f,
  22993. 0x4a7484aa,
  22994. 0x5cb0a9dc,
  22995. 0x76f988da,
  22996. 0x983e5152,
  22997. 0xa831c66d,
  22998. 0xb00327c8,
  22999. 0xbf597fc7,
  23000. 0xc6e00bf3,
  23001. 0xd5a79147,
  23002. 0x06ca6351,
  23003. 0x14292967,
  23004. 0x27b70a85,
  23005. 0x2e1b2138,
  23006. 0x4d2c6dfc,
  23007. 0x53380d13,
  23008. 0x650a7354,
  23009. 0x766a0abb,
  23010. 0x81c2c92e,
  23011. 0x92722c85,
  23012. 0xa2bfe8a1,
  23013. 0xa81a664b,
  23014. 0xc24b8b70,
  23015. 0xc76c51a3,
  23016. 0xd192e819,
  23017. 0xd6990624,
  23018. 0xf40e3585,
  23019. 0x106aa070,
  23020. 0x19a4c116,
  23021. 0x1e376c08,
  23022. 0x2748774c,
  23023. 0x34b0bcb5,
  23024. 0x391c0cb3,
  23025. 0x4ed8aa4a,
  23026. 0x5b9cca4f,
  23027. 0x682e6ff3,
  23028. 0x748f82ee,
  23029. 0x78a5636f,
  23030. 0x84c87814,
  23031. 0x8cc70208,
  23032. 0x90befffa,
  23033. 0xa4506ceb,
  23034. 0xbef9a3f7,
  23035. 0xc67178f2
  23036. ];
  23037. function hash(data, offset, length) {
  23038. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  23039. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  23040. var padded = new Uint8Array(paddedLength);
  23041. var i, j, n;
  23042. for (i = 0; i < length; ++i) {
  23043. padded[i] = data[offset++];
  23044. }
  23045. padded[i++] = 0x80;
  23046. n = paddedLength - 8;
  23047. while (i < n) {
  23048. padded[i++] = 0;
  23049. }
  23050. padded[i++] = 0;
  23051. padded[i++] = 0;
  23052. padded[i++] = 0;
  23053. padded[i++] = length >>> 29 & 0xFF;
  23054. padded[i++] = length >> 21 & 0xFF;
  23055. padded[i++] = length >> 13 & 0xFF;
  23056. padded[i++] = length >> 5 & 0xFF;
  23057. padded[i++] = length << 3 & 0xFF;
  23058. var w = new Uint32Array(64);
  23059. for (i = 0; i < paddedLength;) {
  23060. for (j = 0; j < 16; ++j) {
  23061. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23062. i += 4;
  23063. }
  23064. for (j = 16; j < 64; ++j) {
  23065. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  23066. }
  23067. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  23068. for (j = 0; j < 64; ++j) {
  23069. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  23070. t2 = sigma(a) + maj(a, b, c);
  23071. h = g;
  23072. g = f;
  23073. f = e;
  23074. e = d + t1 | 0;
  23075. d = c;
  23076. c = b;
  23077. b = a;
  23078. a = t1 + t2 | 0;
  23079. }
  23080. h0 = h0 + a | 0;
  23081. h1 = h1 + b | 0;
  23082. h2 = h2 + c | 0;
  23083. h3 = h3 + d | 0;
  23084. h4 = h4 + e | 0;
  23085. h5 = h5 + f | 0;
  23086. h6 = h6 + g | 0;
  23087. h7 = h7 + h | 0;
  23088. }
  23089. return new Uint8Array([
  23090. h0 >> 24 & 0xFF,
  23091. h0 >> 16 & 0xFF,
  23092. h0 >> 8 & 0xFF,
  23093. h0 & 0xFF,
  23094. h1 >> 24 & 0xFF,
  23095. h1 >> 16 & 0xFF,
  23096. h1 >> 8 & 0xFF,
  23097. h1 & 0xFF,
  23098. h2 >> 24 & 0xFF,
  23099. h2 >> 16 & 0xFF,
  23100. h2 >> 8 & 0xFF,
  23101. h2 & 0xFF,
  23102. h3 >> 24 & 0xFF,
  23103. h3 >> 16 & 0xFF,
  23104. h3 >> 8 & 0xFF,
  23105. h3 & 0xFF,
  23106. h4 >> 24 & 0xFF,
  23107. h4 >> 16 & 0xFF,
  23108. h4 >> 8 & 0xFF,
  23109. h4 & 0xFF,
  23110. h5 >> 24 & 0xFF,
  23111. h5 >> 16 & 0xFF,
  23112. h5 >> 8 & 0xFF,
  23113. h5 & 0xFF,
  23114. h6 >> 24 & 0xFF,
  23115. h6 >> 16 & 0xFF,
  23116. h6 >> 8 & 0xFF,
  23117. h6 & 0xFF,
  23118. h7 >> 24 & 0xFF,
  23119. h7 >> 16 & 0xFF,
  23120. h7 >> 8 & 0xFF,
  23121. h7 & 0xFF
  23122. ]);
  23123. }
  23124. return hash;
  23125. }();
  23126. var calculateSHA512 = function calculateSHA512Closure() {
  23127. function ch(result, x, y, z, tmp) {
  23128. result.assign(x);
  23129. result.and(y);
  23130. tmp.assign(x);
  23131. tmp.not();
  23132. tmp.and(z);
  23133. result.xor(tmp);
  23134. }
  23135. function maj(result, x, y, z, tmp) {
  23136. result.assign(x);
  23137. result.and(y);
  23138. tmp.assign(x);
  23139. tmp.and(z);
  23140. result.xor(tmp);
  23141. tmp.assign(y);
  23142. tmp.and(z);
  23143. result.xor(tmp);
  23144. }
  23145. function sigma(result, x, tmp) {
  23146. result.assign(x);
  23147. result.rotateRight(28);
  23148. tmp.assign(x);
  23149. tmp.rotateRight(34);
  23150. result.xor(tmp);
  23151. tmp.assign(x);
  23152. tmp.rotateRight(39);
  23153. result.xor(tmp);
  23154. }
  23155. function sigmaPrime(result, x, tmp) {
  23156. result.assign(x);
  23157. result.rotateRight(14);
  23158. tmp.assign(x);
  23159. tmp.rotateRight(18);
  23160. result.xor(tmp);
  23161. tmp.assign(x);
  23162. tmp.rotateRight(41);
  23163. result.xor(tmp);
  23164. }
  23165. function littleSigma(result, x, tmp) {
  23166. result.assign(x);
  23167. result.rotateRight(1);
  23168. tmp.assign(x);
  23169. tmp.rotateRight(8);
  23170. result.xor(tmp);
  23171. tmp.assign(x);
  23172. tmp.shiftRight(7);
  23173. result.xor(tmp);
  23174. }
  23175. function littleSigmaPrime(result, x, tmp) {
  23176. result.assign(x);
  23177. result.rotateRight(19);
  23178. tmp.assign(x);
  23179. tmp.rotateRight(61);
  23180. result.xor(tmp);
  23181. tmp.assign(x);
  23182. tmp.shiftRight(6);
  23183. result.xor(tmp);
  23184. }
  23185. var k = [
  23186. new Word64(0x428a2f98, 0xd728ae22),
  23187. new Word64(0x71374491, 0x23ef65cd),
  23188. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  23189. new Word64(0xe9b5dba5, 0x8189dbbc),
  23190. new Word64(0x3956c25b, 0xf348b538),
  23191. new Word64(0x59f111f1, 0xb605d019),
  23192. new Word64(0x923f82a4, 0xaf194f9b),
  23193. new Word64(0xab1c5ed5, 0xda6d8118),
  23194. new Word64(0xd807aa98, 0xa3030242),
  23195. new Word64(0x12835b01, 0x45706fbe),
  23196. new Word64(0x243185be, 0x4ee4b28c),
  23197. new Word64(0x550c7dc3, 0xd5ffb4e2),
  23198. new Word64(0x72be5d74, 0xf27b896f),
  23199. new Word64(0x80deb1fe, 0x3b1696b1),
  23200. new Word64(0x9bdc06a7, 0x25c71235),
  23201. new Word64(0xc19bf174, 0xcf692694),
  23202. new Word64(0xe49b69c1, 0x9ef14ad2),
  23203. new Word64(0xefbe4786, 0x384f25e3),
  23204. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  23205. new Word64(0x240ca1cc, 0x77ac9c65),
  23206. new Word64(0x2de92c6f, 0x592b0275),
  23207. new Word64(0x4a7484aa, 0x6ea6e483),
  23208. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  23209. new Word64(0x76f988da, 0x831153b5),
  23210. new Word64(0x983e5152, 0xee66dfab),
  23211. new Word64(0xa831c66d, 0x2db43210),
  23212. new Word64(0xb00327c8, 0x98fb213f),
  23213. new Word64(0xbf597fc7, 0xbeef0ee4),
  23214. new Word64(0xc6e00bf3, 0x3da88fc2),
  23215. new Word64(0xd5a79147, 0x930aa725),
  23216. new Word64(0x06ca6351, 0xe003826f),
  23217. new Word64(0x14292967, 0x0a0e6e70),
  23218. new Word64(0x27b70a85, 0x46d22ffc),
  23219. new Word64(0x2e1b2138, 0x5c26c926),
  23220. new Word64(0x4d2c6dfc, 0x5ac42aed),
  23221. new Word64(0x53380d13, 0x9d95b3df),
  23222. new Word64(0x650a7354, 0x8baf63de),
  23223. new Word64(0x766a0abb, 0x3c77b2a8),
  23224. new Word64(0x81c2c92e, 0x47edaee6),
  23225. new Word64(0x92722c85, 0x1482353b),
  23226. new Word64(0xa2bfe8a1, 0x4cf10364),
  23227. new Word64(0xa81a664b, 0xbc423001),
  23228. new Word64(0xc24b8b70, 0xd0f89791),
  23229. new Word64(0xc76c51a3, 0x0654be30),
  23230. new Word64(0xd192e819, 0xd6ef5218),
  23231. new Word64(0xd6990624, 0x5565a910),
  23232. new Word64(0xf40e3585, 0x5771202a),
  23233. new Word64(0x106aa070, 0x32bbd1b8),
  23234. new Word64(0x19a4c116, 0xb8d2d0c8),
  23235. new Word64(0x1e376c08, 0x5141ab53),
  23236. new Word64(0x2748774c, 0xdf8eeb99),
  23237. new Word64(0x34b0bcb5, 0xe19b48a8),
  23238. new Word64(0x391c0cb3, 0xc5c95a63),
  23239. new Word64(0x4ed8aa4a, 0xe3418acb),
  23240. new Word64(0x5b9cca4f, 0x7763e373),
  23241. new Word64(0x682e6ff3, 0xd6b2b8a3),
  23242. new Word64(0x748f82ee, 0x5defb2fc),
  23243. new Word64(0x78a5636f, 0x43172f60),
  23244. new Word64(0x84c87814, 0xa1f0ab72),
  23245. new Word64(0x8cc70208, 0x1a6439ec),
  23246. new Word64(0x90befffa, 0x23631e28),
  23247. new Word64(0xa4506ceb, 0xde82bde9),
  23248. new Word64(0xbef9a3f7, 0xb2c67915),
  23249. new Word64(0xc67178f2, 0xe372532b),
  23250. new Word64(0xca273ece, 0xea26619c),
  23251. new Word64(0xd186b8c7, 0x21c0c207),
  23252. new Word64(0xeada7dd6, 0xcde0eb1e),
  23253. new Word64(0xf57d4f7f, 0xee6ed178),
  23254. new Word64(0x06f067aa, 0x72176fba),
  23255. new Word64(0x0a637dc5, 0xa2c898a6),
  23256. new Word64(0x113f9804, 0xbef90dae),
  23257. new Word64(0x1b710b35, 0x131c471b),
  23258. new Word64(0x28db77f5, 0x23047d84),
  23259. new Word64(0x32caab7b, 0x40c72493),
  23260. new Word64(0x3c9ebe0a, 0x15c9bebc),
  23261. new Word64(0x431d67c4, 0x9c100d4c),
  23262. new Word64(0x4cc5d4be, 0xcb3e42b6),
  23263. new Word64(0x597f299c, 0xfc657e2a),
  23264. new Word64(0x5fcb6fab, 0x3ad6faec),
  23265. new Word64(0x6c44198c, 0x4a475817)
  23266. ];
  23267. function hash(data, offset, length, mode384) {
  23268. mode384 = !!mode384;
  23269. var h0, h1, h2, h3, h4, h5, h6, h7;
  23270. if (!mode384) {
  23271. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  23272. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  23273. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  23274. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  23275. h4 = new Word64(0x510e527f, 0xade682d1);
  23276. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  23277. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  23278. h7 = new Word64(0x5be0cd19, 0x137e2179);
  23279. } else {
  23280. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  23281. h1 = new Word64(0x629a292a, 0x367cd507);
  23282. h2 = new Word64(0x9159015a, 0x3070dd17);
  23283. h3 = new Word64(0x152fecd8, 0xf70e5939);
  23284. h4 = new Word64(0x67332667, 0xffc00b31);
  23285. h5 = new Word64(0x8eb44a87, 0x68581511);
  23286. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  23287. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  23288. }
  23289. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  23290. var padded = new Uint8Array(paddedLength);
  23291. var i, j, n;
  23292. for (i = 0; i < length; ++i) {
  23293. padded[i] = data[offset++];
  23294. }
  23295. padded[i++] = 0x80;
  23296. n = paddedLength - 16;
  23297. while (i < n) {
  23298. padded[i++] = 0;
  23299. }
  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++] = 0;
  23308. padded[i++] = 0;
  23309. padded[i++] = 0;
  23310. padded[i++] = 0;
  23311. padded[i++] = length >>> 29 & 0xFF;
  23312. padded[i++] = length >> 21 & 0xFF;
  23313. padded[i++] = length >> 13 & 0xFF;
  23314. padded[i++] = length >> 5 & 0xFF;
  23315. padded[i++] = length << 3 & 0xFF;
  23316. var w = new Array(80);
  23317. for (i = 0; i < 80; i++) {
  23318. w[i] = new Word64(0, 0);
  23319. }
  23320. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  23321. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  23322. var g = new Word64(0, 0), h = new Word64(0, 0);
  23323. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  23324. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  23325. for (i = 0; i < paddedLength;) {
  23326. for (j = 0; j < 16; ++j) {
  23327. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23328. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  23329. i += 8;
  23330. }
  23331. for (j = 16; j < 80; ++j) {
  23332. tmp3 = w[j];
  23333. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  23334. tmp3.add(w[j - 7]);
  23335. littleSigma(tmp1, w[j - 15], tmp2);
  23336. tmp3.add(tmp1);
  23337. tmp3.add(w[j - 16]);
  23338. }
  23339. a.assign(h0);
  23340. b.assign(h1);
  23341. c.assign(h2);
  23342. d.assign(h3);
  23343. e.assign(h4);
  23344. f.assign(h5);
  23345. g.assign(h6);
  23346. h.assign(h7);
  23347. for (j = 0; j < 80; ++j) {
  23348. t1.assign(h);
  23349. sigmaPrime(tmp1, e, tmp2);
  23350. t1.add(tmp1);
  23351. ch(tmp1, e, f, g, tmp2);
  23352. t1.add(tmp1);
  23353. t1.add(k[j]);
  23354. t1.add(w[j]);
  23355. sigma(t2, a, tmp2);
  23356. maj(tmp1, a, b, c, tmp2);
  23357. t2.add(tmp1);
  23358. tmp3 = h;
  23359. h = g;
  23360. g = f;
  23361. f = e;
  23362. d.add(t1);
  23363. e = d;
  23364. d = c;
  23365. c = b;
  23366. b = a;
  23367. tmp3.assign(t1);
  23368. tmp3.add(t2);
  23369. a = tmp3;
  23370. }
  23371. h0.add(a);
  23372. h1.add(b);
  23373. h2.add(c);
  23374. h3.add(d);
  23375. h4.add(e);
  23376. h5.add(f);
  23377. h6.add(g);
  23378. h7.add(h);
  23379. }
  23380. var result;
  23381. if (!mode384) {
  23382. result = new Uint8Array(64);
  23383. h0.copyTo(result, 0);
  23384. h1.copyTo(result, 8);
  23385. h2.copyTo(result, 16);
  23386. h3.copyTo(result, 24);
  23387. h4.copyTo(result, 32);
  23388. h5.copyTo(result, 40);
  23389. h6.copyTo(result, 48);
  23390. h7.copyTo(result, 56);
  23391. } else {
  23392. result = new Uint8Array(48);
  23393. h0.copyTo(result, 0);
  23394. h1.copyTo(result, 8);
  23395. h2.copyTo(result, 16);
  23396. h3.copyTo(result, 24);
  23397. h4.copyTo(result, 32);
  23398. h5.copyTo(result, 40);
  23399. }
  23400. return result;
  23401. }
  23402. return hash;
  23403. }();
  23404. var calculateSHA384 = function calculateSHA384Closure() {
  23405. function hash(data, offset, length) {
  23406. return calculateSHA512(data, offset, length, true);
  23407. }
  23408. return hash;
  23409. }();
  23410. var NullCipher = function NullCipherClosure() {
  23411. function NullCipher() {
  23412. }
  23413. NullCipher.prototype = {
  23414. decryptBlock: function NullCipher_decryptBlock(data) {
  23415. return data;
  23416. }
  23417. };
  23418. return NullCipher;
  23419. }();
  23420. var AES128Cipher = function AES128CipherClosure() {
  23421. var rcon = new Uint8Array([
  23422. 0x8d,
  23423. 0x01,
  23424. 0x02,
  23425. 0x04,
  23426. 0x08,
  23427. 0x10,
  23428. 0x20,
  23429. 0x40,
  23430. 0x80,
  23431. 0x1b,
  23432. 0x36,
  23433. 0x6c,
  23434. 0xd8,
  23435. 0xab,
  23436. 0x4d,
  23437. 0x9a,
  23438. 0x2f,
  23439. 0x5e,
  23440. 0xbc,
  23441. 0x63,
  23442. 0xc6,
  23443. 0x97,
  23444. 0x35,
  23445. 0x6a,
  23446. 0xd4,
  23447. 0xb3,
  23448. 0x7d,
  23449. 0xfa,
  23450. 0xef,
  23451. 0xc5,
  23452. 0x91,
  23453. 0x39,
  23454. 0x72,
  23455. 0xe4,
  23456. 0xd3,
  23457. 0xbd,
  23458. 0x61,
  23459. 0xc2,
  23460. 0x9f,
  23461. 0x25,
  23462. 0x4a,
  23463. 0x94,
  23464. 0x33,
  23465. 0x66,
  23466. 0xcc,
  23467. 0x83,
  23468. 0x1d,
  23469. 0x3a,
  23470. 0x74,
  23471. 0xe8,
  23472. 0xcb,
  23473. 0x8d,
  23474. 0x01,
  23475. 0x02,
  23476. 0x04,
  23477. 0x08,
  23478. 0x10,
  23479. 0x20,
  23480. 0x40,
  23481. 0x80,
  23482. 0x1b,
  23483. 0x36,
  23484. 0x6c,
  23485. 0xd8,
  23486. 0xab,
  23487. 0x4d,
  23488. 0x9a,
  23489. 0x2f,
  23490. 0x5e,
  23491. 0xbc,
  23492. 0x63,
  23493. 0xc6,
  23494. 0x97,
  23495. 0x35,
  23496. 0x6a,
  23497. 0xd4,
  23498. 0xb3,
  23499. 0x7d,
  23500. 0xfa,
  23501. 0xef,
  23502. 0xc5,
  23503. 0x91,
  23504. 0x39,
  23505. 0x72,
  23506. 0xe4,
  23507. 0xd3,
  23508. 0xbd,
  23509. 0x61,
  23510. 0xc2,
  23511. 0x9f,
  23512. 0x25,
  23513. 0x4a,
  23514. 0x94,
  23515. 0x33,
  23516. 0x66,
  23517. 0xcc,
  23518. 0x83,
  23519. 0x1d,
  23520. 0x3a,
  23521. 0x74,
  23522. 0xe8,
  23523. 0xcb,
  23524. 0x8d,
  23525. 0x01,
  23526. 0x02,
  23527. 0x04,
  23528. 0x08,
  23529. 0x10,
  23530. 0x20,
  23531. 0x40,
  23532. 0x80,
  23533. 0x1b,
  23534. 0x36,
  23535. 0x6c,
  23536. 0xd8,
  23537. 0xab,
  23538. 0x4d,
  23539. 0x9a,
  23540. 0x2f,
  23541. 0x5e,
  23542. 0xbc,
  23543. 0x63,
  23544. 0xc6,
  23545. 0x97,
  23546. 0x35,
  23547. 0x6a,
  23548. 0xd4,
  23549. 0xb3,
  23550. 0x7d,
  23551. 0xfa,
  23552. 0xef,
  23553. 0xc5,
  23554. 0x91,
  23555. 0x39,
  23556. 0x72,
  23557. 0xe4,
  23558. 0xd3,
  23559. 0xbd,
  23560. 0x61,
  23561. 0xc2,
  23562. 0x9f,
  23563. 0x25,
  23564. 0x4a,
  23565. 0x94,
  23566. 0x33,
  23567. 0x66,
  23568. 0xcc,
  23569. 0x83,
  23570. 0x1d,
  23571. 0x3a,
  23572. 0x74,
  23573. 0xe8,
  23574. 0xcb,
  23575. 0x8d,
  23576. 0x01,
  23577. 0x02,
  23578. 0x04,
  23579. 0x08,
  23580. 0x10,
  23581. 0x20,
  23582. 0x40,
  23583. 0x80,
  23584. 0x1b,
  23585. 0x36,
  23586. 0x6c,
  23587. 0xd8,
  23588. 0xab,
  23589. 0x4d,
  23590. 0x9a,
  23591. 0x2f,
  23592. 0x5e,
  23593. 0xbc,
  23594. 0x63,
  23595. 0xc6,
  23596. 0x97,
  23597. 0x35,
  23598. 0x6a,
  23599. 0xd4,
  23600. 0xb3,
  23601. 0x7d,
  23602. 0xfa,
  23603. 0xef,
  23604. 0xc5,
  23605. 0x91,
  23606. 0x39,
  23607. 0x72,
  23608. 0xe4,
  23609. 0xd3,
  23610. 0xbd,
  23611. 0x61,
  23612. 0xc2,
  23613. 0x9f,
  23614. 0x25,
  23615. 0x4a,
  23616. 0x94,
  23617. 0x33,
  23618. 0x66,
  23619. 0xcc,
  23620. 0x83,
  23621. 0x1d,
  23622. 0x3a,
  23623. 0x74,
  23624. 0xe8,
  23625. 0xcb,
  23626. 0x8d,
  23627. 0x01,
  23628. 0x02,
  23629. 0x04,
  23630. 0x08,
  23631. 0x10,
  23632. 0x20,
  23633. 0x40,
  23634. 0x80,
  23635. 0x1b,
  23636. 0x36,
  23637. 0x6c,
  23638. 0xd8,
  23639. 0xab,
  23640. 0x4d,
  23641. 0x9a,
  23642. 0x2f,
  23643. 0x5e,
  23644. 0xbc,
  23645. 0x63,
  23646. 0xc6,
  23647. 0x97,
  23648. 0x35,
  23649. 0x6a,
  23650. 0xd4,
  23651. 0xb3,
  23652. 0x7d,
  23653. 0xfa,
  23654. 0xef,
  23655. 0xc5,
  23656. 0x91,
  23657. 0x39,
  23658. 0x72,
  23659. 0xe4,
  23660. 0xd3,
  23661. 0xbd,
  23662. 0x61,
  23663. 0xc2,
  23664. 0x9f,
  23665. 0x25,
  23666. 0x4a,
  23667. 0x94,
  23668. 0x33,
  23669. 0x66,
  23670. 0xcc,
  23671. 0x83,
  23672. 0x1d,
  23673. 0x3a,
  23674. 0x74,
  23675. 0xe8,
  23676. 0xcb,
  23677. 0x8d
  23678. ]);
  23679. var s = new Uint8Array([
  23680. 0x63,
  23681. 0x7c,
  23682. 0x77,
  23683. 0x7b,
  23684. 0xf2,
  23685. 0x6b,
  23686. 0x6f,
  23687. 0xc5,
  23688. 0x30,
  23689. 0x01,
  23690. 0x67,
  23691. 0x2b,
  23692. 0xfe,
  23693. 0xd7,
  23694. 0xab,
  23695. 0x76,
  23696. 0xca,
  23697. 0x82,
  23698. 0xc9,
  23699. 0x7d,
  23700. 0xfa,
  23701. 0x59,
  23702. 0x47,
  23703. 0xf0,
  23704. 0xad,
  23705. 0xd4,
  23706. 0xa2,
  23707. 0xaf,
  23708. 0x9c,
  23709. 0xa4,
  23710. 0x72,
  23711. 0xc0,
  23712. 0xb7,
  23713. 0xfd,
  23714. 0x93,
  23715. 0x26,
  23716. 0x36,
  23717. 0x3f,
  23718. 0xf7,
  23719. 0xcc,
  23720. 0x34,
  23721. 0xa5,
  23722. 0xe5,
  23723. 0xf1,
  23724. 0x71,
  23725. 0xd8,
  23726. 0x31,
  23727. 0x15,
  23728. 0x04,
  23729. 0xc7,
  23730. 0x23,
  23731. 0xc3,
  23732. 0x18,
  23733. 0x96,
  23734. 0x05,
  23735. 0x9a,
  23736. 0x07,
  23737. 0x12,
  23738. 0x80,
  23739. 0xe2,
  23740. 0xeb,
  23741. 0x27,
  23742. 0xb2,
  23743. 0x75,
  23744. 0x09,
  23745. 0x83,
  23746. 0x2c,
  23747. 0x1a,
  23748. 0x1b,
  23749. 0x6e,
  23750. 0x5a,
  23751. 0xa0,
  23752. 0x52,
  23753. 0x3b,
  23754. 0xd6,
  23755. 0xb3,
  23756. 0x29,
  23757. 0xe3,
  23758. 0x2f,
  23759. 0x84,
  23760. 0x53,
  23761. 0xd1,
  23762. 0x00,
  23763. 0xed,
  23764. 0x20,
  23765. 0xfc,
  23766. 0xb1,
  23767. 0x5b,
  23768. 0x6a,
  23769. 0xcb,
  23770. 0xbe,
  23771. 0x39,
  23772. 0x4a,
  23773. 0x4c,
  23774. 0x58,
  23775. 0xcf,
  23776. 0xd0,
  23777. 0xef,
  23778. 0xaa,
  23779. 0xfb,
  23780. 0x43,
  23781. 0x4d,
  23782. 0x33,
  23783. 0x85,
  23784. 0x45,
  23785. 0xf9,
  23786. 0x02,
  23787. 0x7f,
  23788. 0x50,
  23789. 0x3c,
  23790. 0x9f,
  23791. 0xa8,
  23792. 0x51,
  23793. 0xa3,
  23794. 0x40,
  23795. 0x8f,
  23796. 0x92,
  23797. 0x9d,
  23798. 0x38,
  23799. 0xf5,
  23800. 0xbc,
  23801. 0xb6,
  23802. 0xda,
  23803. 0x21,
  23804. 0x10,
  23805. 0xff,
  23806. 0xf3,
  23807. 0xd2,
  23808. 0xcd,
  23809. 0x0c,
  23810. 0x13,
  23811. 0xec,
  23812. 0x5f,
  23813. 0x97,
  23814. 0x44,
  23815. 0x17,
  23816. 0xc4,
  23817. 0xa7,
  23818. 0x7e,
  23819. 0x3d,
  23820. 0x64,
  23821. 0x5d,
  23822. 0x19,
  23823. 0x73,
  23824. 0x60,
  23825. 0x81,
  23826. 0x4f,
  23827. 0xdc,
  23828. 0x22,
  23829. 0x2a,
  23830. 0x90,
  23831. 0x88,
  23832. 0x46,
  23833. 0xee,
  23834. 0xb8,
  23835. 0x14,
  23836. 0xde,
  23837. 0x5e,
  23838. 0x0b,
  23839. 0xdb,
  23840. 0xe0,
  23841. 0x32,
  23842. 0x3a,
  23843. 0x0a,
  23844. 0x49,
  23845. 0x06,
  23846. 0x24,
  23847. 0x5c,
  23848. 0xc2,
  23849. 0xd3,
  23850. 0xac,
  23851. 0x62,
  23852. 0x91,
  23853. 0x95,
  23854. 0xe4,
  23855. 0x79,
  23856. 0xe7,
  23857. 0xc8,
  23858. 0x37,
  23859. 0x6d,
  23860. 0x8d,
  23861. 0xd5,
  23862. 0x4e,
  23863. 0xa9,
  23864. 0x6c,
  23865. 0x56,
  23866. 0xf4,
  23867. 0xea,
  23868. 0x65,
  23869. 0x7a,
  23870. 0xae,
  23871. 0x08,
  23872. 0xba,
  23873. 0x78,
  23874. 0x25,
  23875. 0x2e,
  23876. 0x1c,
  23877. 0xa6,
  23878. 0xb4,
  23879. 0xc6,
  23880. 0xe8,
  23881. 0xdd,
  23882. 0x74,
  23883. 0x1f,
  23884. 0x4b,
  23885. 0xbd,
  23886. 0x8b,
  23887. 0x8a,
  23888. 0x70,
  23889. 0x3e,
  23890. 0xb5,
  23891. 0x66,
  23892. 0x48,
  23893. 0x03,
  23894. 0xf6,
  23895. 0x0e,
  23896. 0x61,
  23897. 0x35,
  23898. 0x57,
  23899. 0xb9,
  23900. 0x86,
  23901. 0xc1,
  23902. 0x1d,
  23903. 0x9e,
  23904. 0xe1,
  23905. 0xf8,
  23906. 0x98,
  23907. 0x11,
  23908. 0x69,
  23909. 0xd9,
  23910. 0x8e,
  23911. 0x94,
  23912. 0x9b,
  23913. 0x1e,
  23914. 0x87,
  23915. 0xe9,
  23916. 0xce,
  23917. 0x55,
  23918. 0x28,
  23919. 0xdf,
  23920. 0x8c,
  23921. 0xa1,
  23922. 0x89,
  23923. 0x0d,
  23924. 0xbf,
  23925. 0xe6,
  23926. 0x42,
  23927. 0x68,
  23928. 0x41,
  23929. 0x99,
  23930. 0x2d,
  23931. 0x0f,
  23932. 0xb0,
  23933. 0x54,
  23934. 0xbb,
  23935. 0x16
  23936. ]);
  23937. var inv_s = new Uint8Array([
  23938. 0x52,
  23939. 0x09,
  23940. 0x6a,
  23941. 0xd5,
  23942. 0x30,
  23943. 0x36,
  23944. 0xa5,
  23945. 0x38,
  23946. 0xbf,
  23947. 0x40,
  23948. 0xa3,
  23949. 0x9e,
  23950. 0x81,
  23951. 0xf3,
  23952. 0xd7,
  23953. 0xfb,
  23954. 0x7c,
  23955. 0xe3,
  23956. 0x39,
  23957. 0x82,
  23958. 0x9b,
  23959. 0x2f,
  23960. 0xff,
  23961. 0x87,
  23962. 0x34,
  23963. 0x8e,
  23964. 0x43,
  23965. 0x44,
  23966. 0xc4,
  23967. 0xde,
  23968. 0xe9,
  23969. 0xcb,
  23970. 0x54,
  23971. 0x7b,
  23972. 0x94,
  23973. 0x32,
  23974. 0xa6,
  23975. 0xc2,
  23976. 0x23,
  23977. 0x3d,
  23978. 0xee,
  23979. 0x4c,
  23980. 0x95,
  23981. 0x0b,
  23982. 0x42,
  23983. 0xfa,
  23984. 0xc3,
  23985. 0x4e,
  23986. 0x08,
  23987. 0x2e,
  23988. 0xa1,
  23989. 0x66,
  23990. 0x28,
  23991. 0xd9,
  23992. 0x24,
  23993. 0xb2,
  23994. 0x76,
  23995. 0x5b,
  23996. 0xa2,
  23997. 0x49,
  23998. 0x6d,
  23999. 0x8b,
  24000. 0xd1,
  24001. 0x25,
  24002. 0x72,
  24003. 0xf8,
  24004. 0xf6,
  24005. 0x64,
  24006. 0x86,
  24007. 0x68,
  24008. 0x98,
  24009. 0x16,
  24010. 0xd4,
  24011. 0xa4,
  24012. 0x5c,
  24013. 0xcc,
  24014. 0x5d,
  24015. 0x65,
  24016. 0xb6,
  24017. 0x92,
  24018. 0x6c,
  24019. 0x70,
  24020. 0x48,
  24021. 0x50,
  24022. 0xfd,
  24023. 0xed,
  24024. 0xb9,
  24025. 0xda,
  24026. 0x5e,
  24027. 0x15,
  24028. 0x46,
  24029. 0x57,
  24030. 0xa7,
  24031. 0x8d,
  24032. 0x9d,
  24033. 0x84,
  24034. 0x90,
  24035. 0xd8,
  24036. 0xab,
  24037. 0x00,
  24038. 0x8c,
  24039. 0xbc,
  24040. 0xd3,
  24041. 0x0a,
  24042. 0xf7,
  24043. 0xe4,
  24044. 0x58,
  24045. 0x05,
  24046. 0xb8,
  24047. 0xb3,
  24048. 0x45,
  24049. 0x06,
  24050. 0xd0,
  24051. 0x2c,
  24052. 0x1e,
  24053. 0x8f,
  24054. 0xca,
  24055. 0x3f,
  24056. 0x0f,
  24057. 0x02,
  24058. 0xc1,
  24059. 0xaf,
  24060. 0xbd,
  24061. 0x03,
  24062. 0x01,
  24063. 0x13,
  24064. 0x8a,
  24065. 0x6b,
  24066. 0x3a,
  24067. 0x91,
  24068. 0x11,
  24069. 0x41,
  24070. 0x4f,
  24071. 0x67,
  24072. 0xdc,
  24073. 0xea,
  24074. 0x97,
  24075. 0xf2,
  24076. 0xcf,
  24077. 0xce,
  24078. 0xf0,
  24079. 0xb4,
  24080. 0xe6,
  24081. 0x73,
  24082. 0x96,
  24083. 0xac,
  24084. 0x74,
  24085. 0x22,
  24086. 0xe7,
  24087. 0xad,
  24088. 0x35,
  24089. 0x85,
  24090. 0xe2,
  24091. 0xf9,
  24092. 0x37,
  24093. 0xe8,
  24094. 0x1c,
  24095. 0x75,
  24096. 0xdf,
  24097. 0x6e,
  24098. 0x47,
  24099. 0xf1,
  24100. 0x1a,
  24101. 0x71,
  24102. 0x1d,
  24103. 0x29,
  24104. 0xc5,
  24105. 0x89,
  24106. 0x6f,
  24107. 0xb7,
  24108. 0x62,
  24109. 0x0e,
  24110. 0xaa,
  24111. 0x18,
  24112. 0xbe,
  24113. 0x1b,
  24114. 0xfc,
  24115. 0x56,
  24116. 0x3e,
  24117. 0x4b,
  24118. 0xc6,
  24119. 0xd2,
  24120. 0x79,
  24121. 0x20,
  24122. 0x9a,
  24123. 0xdb,
  24124. 0xc0,
  24125. 0xfe,
  24126. 0x78,
  24127. 0xcd,
  24128. 0x5a,
  24129. 0xf4,
  24130. 0x1f,
  24131. 0xdd,
  24132. 0xa8,
  24133. 0x33,
  24134. 0x88,
  24135. 0x07,
  24136. 0xc7,
  24137. 0x31,
  24138. 0xb1,
  24139. 0x12,
  24140. 0x10,
  24141. 0x59,
  24142. 0x27,
  24143. 0x80,
  24144. 0xec,
  24145. 0x5f,
  24146. 0x60,
  24147. 0x51,
  24148. 0x7f,
  24149. 0xa9,
  24150. 0x19,
  24151. 0xb5,
  24152. 0x4a,
  24153. 0x0d,
  24154. 0x2d,
  24155. 0xe5,
  24156. 0x7a,
  24157. 0x9f,
  24158. 0x93,
  24159. 0xc9,
  24160. 0x9c,
  24161. 0xef,
  24162. 0xa0,
  24163. 0xe0,
  24164. 0x3b,
  24165. 0x4d,
  24166. 0xae,
  24167. 0x2a,
  24168. 0xf5,
  24169. 0xb0,
  24170. 0xc8,
  24171. 0xeb,
  24172. 0xbb,
  24173. 0x3c,
  24174. 0x83,
  24175. 0x53,
  24176. 0x99,
  24177. 0x61,
  24178. 0x17,
  24179. 0x2b,
  24180. 0x04,
  24181. 0x7e,
  24182. 0xba,
  24183. 0x77,
  24184. 0xd6,
  24185. 0x26,
  24186. 0xe1,
  24187. 0x69,
  24188. 0x14,
  24189. 0x63,
  24190. 0x55,
  24191. 0x21,
  24192. 0x0c,
  24193. 0x7d
  24194. ]);
  24195. var mixCol = new Uint8Array(256);
  24196. for (var i = 0; i < 256; i++) {
  24197. if (i < 128) {
  24198. mixCol[i] = i << 1;
  24199. } else {
  24200. mixCol[i] = i << 1 ^ 0x1b;
  24201. }
  24202. }
  24203. var mix = new Uint32Array([
  24204. 0x00000000,
  24205. 0x0e090d0b,
  24206. 0x1c121a16,
  24207. 0x121b171d,
  24208. 0x3824342c,
  24209. 0x362d3927,
  24210. 0x24362e3a,
  24211. 0x2a3f2331,
  24212. 0x70486858,
  24213. 0x7e416553,
  24214. 0x6c5a724e,
  24215. 0x62537f45,
  24216. 0x486c5c74,
  24217. 0x4665517f,
  24218. 0x547e4662,
  24219. 0x5a774b69,
  24220. 0xe090d0b0,
  24221. 0xee99ddbb,
  24222. 0xfc82caa6,
  24223. 0xf28bc7ad,
  24224. 0xd8b4e49c,
  24225. 0xd6bde997,
  24226. 0xc4a6fe8a,
  24227. 0xcaaff381,
  24228. 0x90d8b8e8,
  24229. 0x9ed1b5e3,
  24230. 0x8ccaa2fe,
  24231. 0x82c3aff5,
  24232. 0xa8fc8cc4,
  24233. 0xa6f581cf,
  24234. 0xb4ee96d2,
  24235. 0xbae79bd9,
  24236. 0xdb3bbb7b,
  24237. 0xd532b670,
  24238. 0xc729a16d,
  24239. 0xc920ac66,
  24240. 0xe31f8f57,
  24241. 0xed16825c,
  24242. 0xff0d9541,
  24243. 0xf104984a,
  24244. 0xab73d323,
  24245. 0xa57ade28,
  24246. 0xb761c935,
  24247. 0xb968c43e,
  24248. 0x9357e70f,
  24249. 0x9d5eea04,
  24250. 0x8f45fd19,
  24251. 0x814cf012,
  24252. 0x3bab6bcb,
  24253. 0x35a266c0,
  24254. 0x27b971dd,
  24255. 0x29b07cd6,
  24256. 0x038f5fe7,
  24257. 0x0d8652ec,
  24258. 0x1f9d45f1,
  24259. 0x119448fa,
  24260. 0x4be30393,
  24261. 0x45ea0e98,
  24262. 0x57f11985,
  24263. 0x59f8148e,
  24264. 0x73c737bf,
  24265. 0x7dce3ab4,
  24266. 0x6fd52da9,
  24267. 0x61dc20a2,
  24268. 0xad766df6,
  24269. 0xa37f60fd,
  24270. 0xb16477e0,
  24271. 0xbf6d7aeb,
  24272. 0x955259da,
  24273. 0x9b5b54d1,
  24274. 0x894043cc,
  24275. 0x87494ec7,
  24276. 0xdd3e05ae,
  24277. 0xd33708a5,
  24278. 0xc12c1fb8,
  24279. 0xcf2512b3,
  24280. 0xe51a3182,
  24281. 0xeb133c89,
  24282. 0xf9082b94,
  24283. 0xf701269f,
  24284. 0x4de6bd46,
  24285. 0x43efb04d,
  24286. 0x51f4a750,
  24287. 0x5ffdaa5b,
  24288. 0x75c2896a,
  24289. 0x7bcb8461,
  24290. 0x69d0937c,
  24291. 0x67d99e77,
  24292. 0x3daed51e,
  24293. 0x33a7d815,
  24294. 0x21bccf08,
  24295. 0x2fb5c203,
  24296. 0x058ae132,
  24297. 0x0b83ec39,
  24298. 0x1998fb24,
  24299. 0x1791f62f,
  24300. 0x764dd68d,
  24301. 0x7844db86,
  24302. 0x6a5fcc9b,
  24303. 0x6456c190,
  24304. 0x4e69e2a1,
  24305. 0x4060efaa,
  24306. 0x527bf8b7,
  24307. 0x5c72f5bc,
  24308. 0x0605bed5,
  24309. 0x080cb3de,
  24310. 0x1a17a4c3,
  24311. 0x141ea9c8,
  24312. 0x3e218af9,
  24313. 0x302887f2,
  24314. 0x223390ef,
  24315. 0x2c3a9de4,
  24316. 0x96dd063d,
  24317. 0x98d40b36,
  24318. 0x8acf1c2b,
  24319. 0x84c61120,
  24320. 0xaef93211,
  24321. 0xa0f03f1a,
  24322. 0xb2eb2807,
  24323. 0xbce2250c,
  24324. 0xe6956e65,
  24325. 0xe89c636e,
  24326. 0xfa877473,
  24327. 0xf48e7978,
  24328. 0xdeb15a49,
  24329. 0xd0b85742,
  24330. 0xc2a3405f,
  24331. 0xccaa4d54,
  24332. 0x41ecdaf7,
  24333. 0x4fe5d7fc,
  24334. 0x5dfec0e1,
  24335. 0x53f7cdea,
  24336. 0x79c8eedb,
  24337. 0x77c1e3d0,
  24338. 0x65daf4cd,
  24339. 0x6bd3f9c6,
  24340. 0x31a4b2af,
  24341. 0x3fadbfa4,
  24342. 0x2db6a8b9,
  24343. 0x23bfa5b2,
  24344. 0x09808683,
  24345. 0x07898b88,
  24346. 0x15929c95,
  24347. 0x1b9b919e,
  24348. 0xa17c0a47,
  24349. 0xaf75074c,
  24350. 0xbd6e1051,
  24351. 0xb3671d5a,
  24352. 0x99583e6b,
  24353. 0x97513360,
  24354. 0x854a247d,
  24355. 0x8b432976,
  24356. 0xd134621f,
  24357. 0xdf3d6f14,
  24358. 0xcd267809,
  24359. 0xc32f7502,
  24360. 0xe9105633,
  24361. 0xe7195b38,
  24362. 0xf5024c25,
  24363. 0xfb0b412e,
  24364. 0x9ad7618c,
  24365. 0x94de6c87,
  24366. 0x86c57b9a,
  24367. 0x88cc7691,
  24368. 0xa2f355a0,
  24369. 0xacfa58ab,
  24370. 0xbee14fb6,
  24371. 0xb0e842bd,
  24372. 0xea9f09d4,
  24373. 0xe49604df,
  24374. 0xf68d13c2,
  24375. 0xf8841ec9,
  24376. 0xd2bb3df8,
  24377. 0xdcb230f3,
  24378. 0xcea927ee,
  24379. 0xc0a02ae5,
  24380. 0x7a47b13c,
  24381. 0x744ebc37,
  24382. 0x6655ab2a,
  24383. 0x685ca621,
  24384. 0x42638510,
  24385. 0x4c6a881b,
  24386. 0x5e719f06,
  24387. 0x5078920d,
  24388. 0x0a0fd964,
  24389. 0x0406d46f,
  24390. 0x161dc372,
  24391. 0x1814ce79,
  24392. 0x322bed48,
  24393. 0x3c22e043,
  24394. 0x2e39f75e,
  24395. 0x2030fa55,
  24396. 0xec9ab701,
  24397. 0xe293ba0a,
  24398. 0xf088ad17,
  24399. 0xfe81a01c,
  24400. 0xd4be832d,
  24401. 0xdab78e26,
  24402. 0xc8ac993b,
  24403. 0xc6a59430,
  24404. 0x9cd2df59,
  24405. 0x92dbd252,
  24406. 0x80c0c54f,
  24407. 0x8ec9c844,
  24408. 0xa4f6eb75,
  24409. 0xaaffe67e,
  24410. 0xb8e4f163,
  24411. 0xb6edfc68,
  24412. 0x0c0a67b1,
  24413. 0x02036aba,
  24414. 0x10187da7,
  24415. 0x1e1170ac,
  24416. 0x342e539d,
  24417. 0x3a275e96,
  24418. 0x283c498b,
  24419. 0x26354480,
  24420. 0x7c420fe9,
  24421. 0x724b02e2,
  24422. 0x605015ff,
  24423. 0x6e5918f4,
  24424. 0x44663bc5,
  24425. 0x4a6f36ce,
  24426. 0x587421d3,
  24427. 0x567d2cd8,
  24428. 0x37a10c7a,
  24429. 0x39a80171,
  24430. 0x2bb3166c,
  24431. 0x25ba1b67,
  24432. 0x0f853856,
  24433. 0x018c355d,
  24434. 0x13972240,
  24435. 0x1d9e2f4b,
  24436. 0x47e96422,
  24437. 0x49e06929,
  24438. 0x5bfb7e34,
  24439. 0x55f2733f,
  24440. 0x7fcd500e,
  24441. 0x71c45d05,
  24442. 0x63df4a18,
  24443. 0x6dd64713,
  24444. 0xd731dcca,
  24445. 0xd938d1c1,
  24446. 0xcb23c6dc,
  24447. 0xc52acbd7,
  24448. 0xef15e8e6,
  24449. 0xe11ce5ed,
  24450. 0xf307f2f0,
  24451. 0xfd0efffb,
  24452. 0xa779b492,
  24453. 0xa970b999,
  24454. 0xbb6bae84,
  24455. 0xb562a38f,
  24456. 0x9f5d80be,
  24457. 0x91548db5,
  24458. 0x834f9aa8,
  24459. 0x8d4697a3
  24460. ]);
  24461. function expandKey128(cipherKey) {
  24462. var b = 176, result = new Uint8Array(b);
  24463. result.set(cipherKey);
  24464. for (var j = 16, i = 1; j < b; ++i) {
  24465. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24466. t1 = s[t1];
  24467. t2 = s[t2];
  24468. t3 = s[t3];
  24469. t4 = s[t4];
  24470. t1 = t1 ^ rcon[i];
  24471. for (var n = 0; n < 4; ++n) {
  24472. result[j] = t1 ^= result[j - 16];
  24473. j++;
  24474. result[j] = t2 ^= result[j - 16];
  24475. j++;
  24476. result[j] = t3 ^= result[j - 16];
  24477. j++;
  24478. result[j] = t4 ^= result[j - 16];
  24479. j++;
  24480. }
  24481. }
  24482. return result;
  24483. }
  24484. function decrypt128(input, key) {
  24485. var state = new Uint8Array(16);
  24486. state.set(input);
  24487. var i, j, k;
  24488. var t, u, v;
  24489. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24490. state[j] ^= key[k];
  24491. }
  24492. for (i = 9; i >= 1; --i) {
  24493. t = state[13];
  24494. state[13] = state[9];
  24495. state[9] = state[5];
  24496. state[5] = state[1];
  24497. state[1] = t;
  24498. t = state[14];
  24499. u = state[10];
  24500. state[14] = state[6];
  24501. state[10] = state[2];
  24502. state[6] = t;
  24503. state[2] = u;
  24504. t = state[15];
  24505. u = state[11];
  24506. v = state[7];
  24507. state[15] = state[3];
  24508. state[11] = t;
  24509. state[7] = u;
  24510. state[3] = v;
  24511. for (j = 0; j < 16; ++j) {
  24512. state[j] = inv_s[state[j]];
  24513. }
  24514. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24515. state[j] ^= key[k];
  24516. }
  24517. for (j = 0; j < 16; j += 4) {
  24518. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24519. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24520. state[j] = t >>> 24 & 0xFF;
  24521. state[j + 1] = t >> 16 & 0xFF;
  24522. state[j + 2] = t >> 8 & 0xFF;
  24523. state[j + 3] = t & 0xFF;
  24524. }
  24525. }
  24526. t = state[13];
  24527. state[13] = state[9];
  24528. state[9] = state[5];
  24529. state[5] = state[1];
  24530. state[1] = t;
  24531. t = state[14];
  24532. u = state[10];
  24533. state[14] = state[6];
  24534. state[10] = state[2];
  24535. state[6] = t;
  24536. state[2] = u;
  24537. t = state[15];
  24538. u = state[11];
  24539. v = state[7];
  24540. state[15] = state[3];
  24541. state[11] = t;
  24542. state[7] = u;
  24543. state[3] = v;
  24544. for (j = 0; j < 16; ++j) {
  24545. state[j] = inv_s[state[j]];
  24546. state[j] ^= key[j];
  24547. }
  24548. return state;
  24549. }
  24550. function encrypt128(input, key) {
  24551. var t, u, v, k;
  24552. var state = new Uint8Array(16);
  24553. state.set(input);
  24554. for (j = 0; j < 16; ++j) {
  24555. state[j] ^= key[j];
  24556. }
  24557. for (i = 1; i < 10; i++) {
  24558. for (j = 0; j < 16; ++j) {
  24559. state[j] = s[state[j]];
  24560. }
  24561. v = state[1];
  24562. state[1] = state[5];
  24563. state[5] = state[9];
  24564. state[9] = state[13];
  24565. state[13] = v;
  24566. v = state[2];
  24567. u = state[6];
  24568. state[2] = state[10];
  24569. state[6] = state[14];
  24570. state[10] = v;
  24571. state[14] = u;
  24572. v = state[3];
  24573. u = state[7];
  24574. t = state[11];
  24575. state[3] = state[15];
  24576. state[7] = v;
  24577. state[11] = u;
  24578. state[15] = t;
  24579. for (var j = 0; j < 16; j += 4) {
  24580. var s0 = state[j + 0], s1 = state[j + 1];
  24581. var s2 = state[j + 2], s3 = state[j + 3];
  24582. t = s0 ^ s1 ^ s2 ^ s3;
  24583. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24584. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24585. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24586. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24587. }
  24588. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24589. state[j] ^= key[k];
  24590. }
  24591. }
  24592. for (j = 0; j < 16; ++j) {
  24593. state[j] = s[state[j]];
  24594. }
  24595. v = state[1];
  24596. state[1] = state[5];
  24597. state[5] = state[9];
  24598. state[9] = state[13];
  24599. state[13] = v;
  24600. v = state[2];
  24601. u = state[6];
  24602. state[2] = state[10];
  24603. state[6] = state[14];
  24604. state[10] = v;
  24605. state[14] = u;
  24606. v = state[3];
  24607. u = state[7];
  24608. t = state[11];
  24609. state[3] = state[15];
  24610. state[7] = v;
  24611. state[11] = u;
  24612. state[15] = t;
  24613. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24614. state[j] ^= key[k];
  24615. }
  24616. return state;
  24617. }
  24618. function AES128Cipher(key) {
  24619. this.key = expandKey128(key);
  24620. this.buffer = new Uint8Array(16);
  24621. this.bufferPosition = 0;
  24622. }
  24623. function decryptBlock2(data, finalize) {
  24624. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24625. for (i = 0; i < sourceLength; ++i) {
  24626. buffer[bufferLength] = data[i];
  24627. ++bufferLength;
  24628. if (bufferLength < 16) {
  24629. continue;
  24630. }
  24631. var plain = decrypt128(buffer, this.key);
  24632. for (j = 0; j < 16; ++j) {
  24633. plain[j] ^= iv[j];
  24634. }
  24635. iv = buffer;
  24636. result.push(plain);
  24637. buffer = new Uint8Array(16);
  24638. bufferLength = 0;
  24639. }
  24640. this.buffer = buffer;
  24641. this.bufferLength = bufferLength;
  24642. this.iv = iv;
  24643. if (result.length === 0) {
  24644. return new Uint8Array([]);
  24645. }
  24646. var outputLength = 16 * result.length;
  24647. if (finalize) {
  24648. var lastBlock = result[result.length - 1];
  24649. var psLen = lastBlock[15];
  24650. if (psLen <= 16) {
  24651. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24652. if (lastBlock[i] !== psLen) {
  24653. psLen = 0;
  24654. break;
  24655. }
  24656. }
  24657. outputLength -= psLen;
  24658. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24659. }
  24660. }
  24661. var output = new Uint8Array(outputLength);
  24662. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24663. output.set(result[i], j);
  24664. }
  24665. return output;
  24666. }
  24667. AES128Cipher.prototype = {
  24668. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  24669. var i, sourceLength = data.length;
  24670. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24671. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24672. buffer[bufferLength] = data[i];
  24673. }
  24674. if (bufferLength < 16) {
  24675. this.bufferLength = bufferLength;
  24676. return new Uint8Array([]);
  24677. }
  24678. this.iv = buffer;
  24679. this.buffer = new Uint8Array(16);
  24680. this.bufferLength = 0;
  24681. this.decryptBlock = decryptBlock2;
  24682. return this.decryptBlock(data.subarray(16), finalize);
  24683. },
  24684. encrypt: function AES128Cipher_encrypt(data, iv) {
  24685. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24686. if (!iv) {
  24687. iv = new Uint8Array(16);
  24688. }
  24689. for (i = 0; i < sourceLength; ++i) {
  24690. buffer[bufferLength] = data[i];
  24691. ++bufferLength;
  24692. if (bufferLength < 16) {
  24693. continue;
  24694. }
  24695. for (j = 0; j < 16; ++j) {
  24696. buffer[j] ^= iv[j];
  24697. }
  24698. var cipher = encrypt128(buffer, this.key);
  24699. iv = cipher;
  24700. result.push(cipher);
  24701. buffer = new Uint8Array(16);
  24702. bufferLength = 0;
  24703. }
  24704. this.buffer = buffer;
  24705. this.bufferLength = bufferLength;
  24706. this.iv = iv;
  24707. if (result.length === 0) {
  24708. return new Uint8Array([]);
  24709. }
  24710. var outputLength = 16 * result.length;
  24711. var output = new Uint8Array(outputLength);
  24712. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24713. output.set(result[i], j);
  24714. }
  24715. return output;
  24716. }
  24717. };
  24718. return AES128Cipher;
  24719. }();
  24720. var AES256Cipher = function AES256CipherClosure() {
  24721. var s = new Uint8Array([
  24722. 0x63,
  24723. 0x7c,
  24724. 0x77,
  24725. 0x7b,
  24726. 0xf2,
  24727. 0x6b,
  24728. 0x6f,
  24729. 0xc5,
  24730. 0x30,
  24731. 0x01,
  24732. 0x67,
  24733. 0x2b,
  24734. 0xfe,
  24735. 0xd7,
  24736. 0xab,
  24737. 0x76,
  24738. 0xca,
  24739. 0x82,
  24740. 0xc9,
  24741. 0x7d,
  24742. 0xfa,
  24743. 0x59,
  24744. 0x47,
  24745. 0xf0,
  24746. 0xad,
  24747. 0xd4,
  24748. 0xa2,
  24749. 0xaf,
  24750. 0x9c,
  24751. 0xa4,
  24752. 0x72,
  24753. 0xc0,
  24754. 0xb7,
  24755. 0xfd,
  24756. 0x93,
  24757. 0x26,
  24758. 0x36,
  24759. 0x3f,
  24760. 0xf7,
  24761. 0xcc,
  24762. 0x34,
  24763. 0xa5,
  24764. 0xe5,
  24765. 0xf1,
  24766. 0x71,
  24767. 0xd8,
  24768. 0x31,
  24769. 0x15,
  24770. 0x04,
  24771. 0xc7,
  24772. 0x23,
  24773. 0xc3,
  24774. 0x18,
  24775. 0x96,
  24776. 0x05,
  24777. 0x9a,
  24778. 0x07,
  24779. 0x12,
  24780. 0x80,
  24781. 0xe2,
  24782. 0xeb,
  24783. 0x27,
  24784. 0xb2,
  24785. 0x75,
  24786. 0x09,
  24787. 0x83,
  24788. 0x2c,
  24789. 0x1a,
  24790. 0x1b,
  24791. 0x6e,
  24792. 0x5a,
  24793. 0xa0,
  24794. 0x52,
  24795. 0x3b,
  24796. 0xd6,
  24797. 0xb3,
  24798. 0x29,
  24799. 0xe3,
  24800. 0x2f,
  24801. 0x84,
  24802. 0x53,
  24803. 0xd1,
  24804. 0x00,
  24805. 0xed,
  24806. 0x20,
  24807. 0xfc,
  24808. 0xb1,
  24809. 0x5b,
  24810. 0x6a,
  24811. 0xcb,
  24812. 0xbe,
  24813. 0x39,
  24814. 0x4a,
  24815. 0x4c,
  24816. 0x58,
  24817. 0xcf,
  24818. 0xd0,
  24819. 0xef,
  24820. 0xaa,
  24821. 0xfb,
  24822. 0x43,
  24823. 0x4d,
  24824. 0x33,
  24825. 0x85,
  24826. 0x45,
  24827. 0xf9,
  24828. 0x02,
  24829. 0x7f,
  24830. 0x50,
  24831. 0x3c,
  24832. 0x9f,
  24833. 0xa8,
  24834. 0x51,
  24835. 0xa3,
  24836. 0x40,
  24837. 0x8f,
  24838. 0x92,
  24839. 0x9d,
  24840. 0x38,
  24841. 0xf5,
  24842. 0xbc,
  24843. 0xb6,
  24844. 0xda,
  24845. 0x21,
  24846. 0x10,
  24847. 0xff,
  24848. 0xf3,
  24849. 0xd2,
  24850. 0xcd,
  24851. 0x0c,
  24852. 0x13,
  24853. 0xec,
  24854. 0x5f,
  24855. 0x97,
  24856. 0x44,
  24857. 0x17,
  24858. 0xc4,
  24859. 0xa7,
  24860. 0x7e,
  24861. 0x3d,
  24862. 0x64,
  24863. 0x5d,
  24864. 0x19,
  24865. 0x73,
  24866. 0x60,
  24867. 0x81,
  24868. 0x4f,
  24869. 0xdc,
  24870. 0x22,
  24871. 0x2a,
  24872. 0x90,
  24873. 0x88,
  24874. 0x46,
  24875. 0xee,
  24876. 0xb8,
  24877. 0x14,
  24878. 0xde,
  24879. 0x5e,
  24880. 0x0b,
  24881. 0xdb,
  24882. 0xe0,
  24883. 0x32,
  24884. 0x3a,
  24885. 0x0a,
  24886. 0x49,
  24887. 0x06,
  24888. 0x24,
  24889. 0x5c,
  24890. 0xc2,
  24891. 0xd3,
  24892. 0xac,
  24893. 0x62,
  24894. 0x91,
  24895. 0x95,
  24896. 0xe4,
  24897. 0x79,
  24898. 0xe7,
  24899. 0xc8,
  24900. 0x37,
  24901. 0x6d,
  24902. 0x8d,
  24903. 0xd5,
  24904. 0x4e,
  24905. 0xa9,
  24906. 0x6c,
  24907. 0x56,
  24908. 0xf4,
  24909. 0xea,
  24910. 0x65,
  24911. 0x7a,
  24912. 0xae,
  24913. 0x08,
  24914. 0xba,
  24915. 0x78,
  24916. 0x25,
  24917. 0x2e,
  24918. 0x1c,
  24919. 0xa6,
  24920. 0xb4,
  24921. 0xc6,
  24922. 0xe8,
  24923. 0xdd,
  24924. 0x74,
  24925. 0x1f,
  24926. 0x4b,
  24927. 0xbd,
  24928. 0x8b,
  24929. 0x8a,
  24930. 0x70,
  24931. 0x3e,
  24932. 0xb5,
  24933. 0x66,
  24934. 0x48,
  24935. 0x03,
  24936. 0xf6,
  24937. 0x0e,
  24938. 0x61,
  24939. 0x35,
  24940. 0x57,
  24941. 0xb9,
  24942. 0x86,
  24943. 0xc1,
  24944. 0x1d,
  24945. 0x9e,
  24946. 0xe1,
  24947. 0xf8,
  24948. 0x98,
  24949. 0x11,
  24950. 0x69,
  24951. 0xd9,
  24952. 0x8e,
  24953. 0x94,
  24954. 0x9b,
  24955. 0x1e,
  24956. 0x87,
  24957. 0xe9,
  24958. 0xce,
  24959. 0x55,
  24960. 0x28,
  24961. 0xdf,
  24962. 0x8c,
  24963. 0xa1,
  24964. 0x89,
  24965. 0x0d,
  24966. 0xbf,
  24967. 0xe6,
  24968. 0x42,
  24969. 0x68,
  24970. 0x41,
  24971. 0x99,
  24972. 0x2d,
  24973. 0x0f,
  24974. 0xb0,
  24975. 0x54,
  24976. 0xbb,
  24977. 0x16
  24978. ]);
  24979. var inv_s = new Uint8Array([
  24980. 0x52,
  24981. 0x09,
  24982. 0x6a,
  24983. 0xd5,
  24984. 0x30,
  24985. 0x36,
  24986. 0xa5,
  24987. 0x38,
  24988. 0xbf,
  24989. 0x40,
  24990. 0xa3,
  24991. 0x9e,
  24992. 0x81,
  24993. 0xf3,
  24994. 0xd7,
  24995. 0xfb,
  24996. 0x7c,
  24997. 0xe3,
  24998. 0x39,
  24999. 0x82,
  25000. 0x9b,
  25001. 0x2f,
  25002. 0xff,
  25003. 0x87,
  25004. 0x34,
  25005. 0x8e,
  25006. 0x43,
  25007. 0x44,
  25008. 0xc4,
  25009. 0xde,
  25010. 0xe9,
  25011. 0xcb,
  25012. 0x54,
  25013. 0x7b,
  25014. 0x94,
  25015. 0x32,
  25016. 0xa6,
  25017. 0xc2,
  25018. 0x23,
  25019. 0x3d,
  25020. 0xee,
  25021. 0x4c,
  25022. 0x95,
  25023. 0x0b,
  25024. 0x42,
  25025. 0xfa,
  25026. 0xc3,
  25027. 0x4e,
  25028. 0x08,
  25029. 0x2e,
  25030. 0xa1,
  25031. 0x66,
  25032. 0x28,
  25033. 0xd9,
  25034. 0x24,
  25035. 0xb2,
  25036. 0x76,
  25037. 0x5b,
  25038. 0xa2,
  25039. 0x49,
  25040. 0x6d,
  25041. 0x8b,
  25042. 0xd1,
  25043. 0x25,
  25044. 0x72,
  25045. 0xf8,
  25046. 0xf6,
  25047. 0x64,
  25048. 0x86,
  25049. 0x68,
  25050. 0x98,
  25051. 0x16,
  25052. 0xd4,
  25053. 0xa4,
  25054. 0x5c,
  25055. 0xcc,
  25056. 0x5d,
  25057. 0x65,
  25058. 0xb6,
  25059. 0x92,
  25060. 0x6c,
  25061. 0x70,
  25062. 0x48,
  25063. 0x50,
  25064. 0xfd,
  25065. 0xed,
  25066. 0xb9,
  25067. 0xda,
  25068. 0x5e,
  25069. 0x15,
  25070. 0x46,
  25071. 0x57,
  25072. 0xa7,
  25073. 0x8d,
  25074. 0x9d,
  25075. 0x84,
  25076. 0x90,
  25077. 0xd8,
  25078. 0xab,
  25079. 0x00,
  25080. 0x8c,
  25081. 0xbc,
  25082. 0xd3,
  25083. 0x0a,
  25084. 0xf7,
  25085. 0xe4,
  25086. 0x58,
  25087. 0x05,
  25088. 0xb8,
  25089. 0xb3,
  25090. 0x45,
  25091. 0x06,
  25092. 0xd0,
  25093. 0x2c,
  25094. 0x1e,
  25095. 0x8f,
  25096. 0xca,
  25097. 0x3f,
  25098. 0x0f,
  25099. 0x02,
  25100. 0xc1,
  25101. 0xaf,
  25102. 0xbd,
  25103. 0x03,
  25104. 0x01,
  25105. 0x13,
  25106. 0x8a,
  25107. 0x6b,
  25108. 0x3a,
  25109. 0x91,
  25110. 0x11,
  25111. 0x41,
  25112. 0x4f,
  25113. 0x67,
  25114. 0xdc,
  25115. 0xea,
  25116. 0x97,
  25117. 0xf2,
  25118. 0xcf,
  25119. 0xce,
  25120. 0xf0,
  25121. 0xb4,
  25122. 0xe6,
  25123. 0x73,
  25124. 0x96,
  25125. 0xac,
  25126. 0x74,
  25127. 0x22,
  25128. 0xe7,
  25129. 0xad,
  25130. 0x35,
  25131. 0x85,
  25132. 0xe2,
  25133. 0xf9,
  25134. 0x37,
  25135. 0xe8,
  25136. 0x1c,
  25137. 0x75,
  25138. 0xdf,
  25139. 0x6e,
  25140. 0x47,
  25141. 0xf1,
  25142. 0x1a,
  25143. 0x71,
  25144. 0x1d,
  25145. 0x29,
  25146. 0xc5,
  25147. 0x89,
  25148. 0x6f,
  25149. 0xb7,
  25150. 0x62,
  25151. 0x0e,
  25152. 0xaa,
  25153. 0x18,
  25154. 0xbe,
  25155. 0x1b,
  25156. 0xfc,
  25157. 0x56,
  25158. 0x3e,
  25159. 0x4b,
  25160. 0xc6,
  25161. 0xd2,
  25162. 0x79,
  25163. 0x20,
  25164. 0x9a,
  25165. 0xdb,
  25166. 0xc0,
  25167. 0xfe,
  25168. 0x78,
  25169. 0xcd,
  25170. 0x5a,
  25171. 0xf4,
  25172. 0x1f,
  25173. 0xdd,
  25174. 0xa8,
  25175. 0x33,
  25176. 0x88,
  25177. 0x07,
  25178. 0xc7,
  25179. 0x31,
  25180. 0xb1,
  25181. 0x12,
  25182. 0x10,
  25183. 0x59,
  25184. 0x27,
  25185. 0x80,
  25186. 0xec,
  25187. 0x5f,
  25188. 0x60,
  25189. 0x51,
  25190. 0x7f,
  25191. 0xa9,
  25192. 0x19,
  25193. 0xb5,
  25194. 0x4a,
  25195. 0x0d,
  25196. 0x2d,
  25197. 0xe5,
  25198. 0x7a,
  25199. 0x9f,
  25200. 0x93,
  25201. 0xc9,
  25202. 0x9c,
  25203. 0xef,
  25204. 0xa0,
  25205. 0xe0,
  25206. 0x3b,
  25207. 0x4d,
  25208. 0xae,
  25209. 0x2a,
  25210. 0xf5,
  25211. 0xb0,
  25212. 0xc8,
  25213. 0xeb,
  25214. 0xbb,
  25215. 0x3c,
  25216. 0x83,
  25217. 0x53,
  25218. 0x99,
  25219. 0x61,
  25220. 0x17,
  25221. 0x2b,
  25222. 0x04,
  25223. 0x7e,
  25224. 0xba,
  25225. 0x77,
  25226. 0xd6,
  25227. 0x26,
  25228. 0xe1,
  25229. 0x69,
  25230. 0x14,
  25231. 0x63,
  25232. 0x55,
  25233. 0x21,
  25234. 0x0c,
  25235. 0x7d
  25236. ]);
  25237. var mixCol = new Uint8Array(256);
  25238. for (var i = 0; i < 256; i++) {
  25239. if (i < 128) {
  25240. mixCol[i] = i << 1;
  25241. } else {
  25242. mixCol[i] = i << 1 ^ 0x1b;
  25243. }
  25244. }
  25245. var mix = new Uint32Array([
  25246. 0x00000000,
  25247. 0x0e090d0b,
  25248. 0x1c121a16,
  25249. 0x121b171d,
  25250. 0x3824342c,
  25251. 0x362d3927,
  25252. 0x24362e3a,
  25253. 0x2a3f2331,
  25254. 0x70486858,
  25255. 0x7e416553,
  25256. 0x6c5a724e,
  25257. 0x62537f45,
  25258. 0x486c5c74,
  25259. 0x4665517f,
  25260. 0x547e4662,
  25261. 0x5a774b69,
  25262. 0xe090d0b0,
  25263. 0xee99ddbb,
  25264. 0xfc82caa6,
  25265. 0xf28bc7ad,
  25266. 0xd8b4e49c,
  25267. 0xd6bde997,
  25268. 0xc4a6fe8a,
  25269. 0xcaaff381,
  25270. 0x90d8b8e8,
  25271. 0x9ed1b5e3,
  25272. 0x8ccaa2fe,
  25273. 0x82c3aff5,
  25274. 0xa8fc8cc4,
  25275. 0xa6f581cf,
  25276. 0xb4ee96d2,
  25277. 0xbae79bd9,
  25278. 0xdb3bbb7b,
  25279. 0xd532b670,
  25280. 0xc729a16d,
  25281. 0xc920ac66,
  25282. 0xe31f8f57,
  25283. 0xed16825c,
  25284. 0xff0d9541,
  25285. 0xf104984a,
  25286. 0xab73d323,
  25287. 0xa57ade28,
  25288. 0xb761c935,
  25289. 0xb968c43e,
  25290. 0x9357e70f,
  25291. 0x9d5eea04,
  25292. 0x8f45fd19,
  25293. 0x814cf012,
  25294. 0x3bab6bcb,
  25295. 0x35a266c0,
  25296. 0x27b971dd,
  25297. 0x29b07cd6,
  25298. 0x038f5fe7,
  25299. 0x0d8652ec,
  25300. 0x1f9d45f1,
  25301. 0x119448fa,
  25302. 0x4be30393,
  25303. 0x45ea0e98,
  25304. 0x57f11985,
  25305. 0x59f8148e,
  25306. 0x73c737bf,
  25307. 0x7dce3ab4,
  25308. 0x6fd52da9,
  25309. 0x61dc20a2,
  25310. 0xad766df6,
  25311. 0xa37f60fd,
  25312. 0xb16477e0,
  25313. 0xbf6d7aeb,
  25314. 0x955259da,
  25315. 0x9b5b54d1,
  25316. 0x894043cc,
  25317. 0x87494ec7,
  25318. 0xdd3e05ae,
  25319. 0xd33708a5,
  25320. 0xc12c1fb8,
  25321. 0xcf2512b3,
  25322. 0xe51a3182,
  25323. 0xeb133c89,
  25324. 0xf9082b94,
  25325. 0xf701269f,
  25326. 0x4de6bd46,
  25327. 0x43efb04d,
  25328. 0x51f4a750,
  25329. 0x5ffdaa5b,
  25330. 0x75c2896a,
  25331. 0x7bcb8461,
  25332. 0x69d0937c,
  25333. 0x67d99e77,
  25334. 0x3daed51e,
  25335. 0x33a7d815,
  25336. 0x21bccf08,
  25337. 0x2fb5c203,
  25338. 0x058ae132,
  25339. 0x0b83ec39,
  25340. 0x1998fb24,
  25341. 0x1791f62f,
  25342. 0x764dd68d,
  25343. 0x7844db86,
  25344. 0x6a5fcc9b,
  25345. 0x6456c190,
  25346. 0x4e69e2a1,
  25347. 0x4060efaa,
  25348. 0x527bf8b7,
  25349. 0x5c72f5bc,
  25350. 0x0605bed5,
  25351. 0x080cb3de,
  25352. 0x1a17a4c3,
  25353. 0x141ea9c8,
  25354. 0x3e218af9,
  25355. 0x302887f2,
  25356. 0x223390ef,
  25357. 0x2c3a9de4,
  25358. 0x96dd063d,
  25359. 0x98d40b36,
  25360. 0x8acf1c2b,
  25361. 0x84c61120,
  25362. 0xaef93211,
  25363. 0xa0f03f1a,
  25364. 0xb2eb2807,
  25365. 0xbce2250c,
  25366. 0xe6956e65,
  25367. 0xe89c636e,
  25368. 0xfa877473,
  25369. 0xf48e7978,
  25370. 0xdeb15a49,
  25371. 0xd0b85742,
  25372. 0xc2a3405f,
  25373. 0xccaa4d54,
  25374. 0x41ecdaf7,
  25375. 0x4fe5d7fc,
  25376. 0x5dfec0e1,
  25377. 0x53f7cdea,
  25378. 0x79c8eedb,
  25379. 0x77c1e3d0,
  25380. 0x65daf4cd,
  25381. 0x6bd3f9c6,
  25382. 0x31a4b2af,
  25383. 0x3fadbfa4,
  25384. 0x2db6a8b9,
  25385. 0x23bfa5b2,
  25386. 0x09808683,
  25387. 0x07898b88,
  25388. 0x15929c95,
  25389. 0x1b9b919e,
  25390. 0xa17c0a47,
  25391. 0xaf75074c,
  25392. 0xbd6e1051,
  25393. 0xb3671d5a,
  25394. 0x99583e6b,
  25395. 0x97513360,
  25396. 0x854a247d,
  25397. 0x8b432976,
  25398. 0xd134621f,
  25399. 0xdf3d6f14,
  25400. 0xcd267809,
  25401. 0xc32f7502,
  25402. 0xe9105633,
  25403. 0xe7195b38,
  25404. 0xf5024c25,
  25405. 0xfb0b412e,
  25406. 0x9ad7618c,
  25407. 0x94de6c87,
  25408. 0x86c57b9a,
  25409. 0x88cc7691,
  25410. 0xa2f355a0,
  25411. 0xacfa58ab,
  25412. 0xbee14fb6,
  25413. 0xb0e842bd,
  25414. 0xea9f09d4,
  25415. 0xe49604df,
  25416. 0xf68d13c2,
  25417. 0xf8841ec9,
  25418. 0xd2bb3df8,
  25419. 0xdcb230f3,
  25420. 0xcea927ee,
  25421. 0xc0a02ae5,
  25422. 0x7a47b13c,
  25423. 0x744ebc37,
  25424. 0x6655ab2a,
  25425. 0x685ca621,
  25426. 0x42638510,
  25427. 0x4c6a881b,
  25428. 0x5e719f06,
  25429. 0x5078920d,
  25430. 0x0a0fd964,
  25431. 0x0406d46f,
  25432. 0x161dc372,
  25433. 0x1814ce79,
  25434. 0x322bed48,
  25435. 0x3c22e043,
  25436. 0x2e39f75e,
  25437. 0x2030fa55,
  25438. 0xec9ab701,
  25439. 0xe293ba0a,
  25440. 0xf088ad17,
  25441. 0xfe81a01c,
  25442. 0xd4be832d,
  25443. 0xdab78e26,
  25444. 0xc8ac993b,
  25445. 0xc6a59430,
  25446. 0x9cd2df59,
  25447. 0x92dbd252,
  25448. 0x80c0c54f,
  25449. 0x8ec9c844,
  25450. 0xa4f6eb75,
  25451. 0xaaffe67e,
  25452. 0xb8e4f163,
  25453. 0xb6edfc68,
  25454. 0x0c0a67b1,
  25455. 0x02036aba,
  25456. 0x10187da7,
  25457. 0x1e1170ac,
  25458. 0x342e539d,
  25459. 0x3a275e96,
  25460. 0x283c498b,
  25461. 0x26354480,
  25462. 0x7c420fe9,
  25463. 0x724b02e2,
  25464. 0x605015ff,
  25465. 0x6e5918f4,
  25466. 0x44663bc5,
  25467. 0x4a6f36ce,
  25468. 0x587421d3,
  25469. 0x567d2cd8,
  25470. 0x37a10c7a,
  25471. 0x39a80171,
  25472. 0x2bb3166c,
  25473. 0x25ba1b67,
  25474. 0x0f853856,
  25475. 0x018c355d,
  25476. 0x13972240,
  25477. 0x1d9e2f4b,
  25478. 0x47e96422,
  25479. 0x49e06929,
  25480. 0x5bfb7e34,
  25481. 0x55f2733f,
  25482. 0x7fcd500e,
  25483. 0x71c45d05,
  25484. 0x63df4a18,
  25485. 0x6dd64713,
  25486. 0xd731dcca,
  25487. 0xd938d1c1,
  25488. 0xcb23c6dc,
  25489. 0xc52acbd7,
  25490. 0xef15e8e6,
  25491. 0xe11ce5ed,
  25492. 0xf307f2f0,
  25493. 0xfd0efffb,
  25494. 0xa779b492,
  25495. 0xa970b999,
  25496. 0xbb6bae84,
  25497. 0xb562a38f,
  25498. 0x9f5d80be,
  25499. 0x91548db5,
  25500. 0x834f9aa8,
  25501. 0x8d4697a3
  25502. ]);
  25503. function expandKey256(cipherKey) {
  25504. var b = 240, result = new Uint8Array(b);
  25505. var r = 1;
  25506. result.set(cipherKey);
  25507. for (var j = 32, i = 1; j < b; ++i) {
  25508. if (j % 32 === 16) {
  25509. t1 = s[t1];
  25510. t2 = s[t2];
  25511. t3 = s[t3];
  25512. t4 = s[t4];
  25513. } else if (j % 32 === 0) {
  25514. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  25515. t1 = s[t1];
  25516. t2 = s[t2];
  25517. t3 = s[t3];
  25518. t4 = s[t4];
  25519. t1 = t1 ^ r;
  25520. if ((r <<= 1) >= 256) {
  25521. r = (r ^ 0x1b) & 0xFF;
  25522. }
  25523. }
  25524. for (var n = 0; n < 4; ++n) {
  25525. result[j] = t1 ^= result[j - 32];
  25526. j++;
  25527. result[j] = t2 ^= result[j - 32];
  25528. j++;
  25529. result[j] = t3 ^= result[j - 32];
  25530. j++;
  25531. result[j] = t4 ^= result[j - 32];
  25532. j++;
  25533. }
  25534. }
  25535. return result;
  25536. }
  25537. function decrypt256(input, key) {
  25538. var state = new Uint8Array(16);
  25539. state.set(input);
  25540. var i, j, k;
  25541. var t, u, v;
  25542. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25543. state[j] ^= key[k];
  25544. }
  25545. for (i = 13; i >= 1; --i) {
  25546. t = state[13];
  25547. state[13] = state[9];
  25548. state[9] = state[5];
  25549. state[5] = state[1];
  25550. state[1] = t;
  25551. t = state[14];
  25552. u = state[10];
  25553. state[14] = state[6];
  25554. state[10] = state[2];
  25555. state[6] = t;
  25556. state[2] = u;
  25557. t = state[15];
  25558. u = state[11];
  25559. v = state[7];
  25560. state[15] = state[3];
  25561. state[11] = t;
  25562. state[7] = u;
  25563. state[3] = v;
  25564. for (j = 0; j < 16; ++j) {
  25565. state[j] = inv_s[state[j]];
  25566. }
  25567. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25568. state[j] ^= key[k];
  25569. }
  25570. for (j = 0; j < 16; j += 4) {
  25571. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  25572. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  25573. state[j] = t >>> 24 & 0xFF;
  25574. state[j + 1] = t >> 16 & 0xFF;
  25575. state[j + 2] = t >> 8 & 0xFF;
  25576. state[j + 3] = t & 0xFF;
  25577. }
  25578. }
  25579. t = state[13];
  25580. state[13] = state[9];
  25581. state[9] = state[5];
  25582. state[5] = state[1];
  25583. state[1] = t;
  25584. t = state[14];
  25585. u = state[10];
  25586. state[14] = state[6];
  25587. state[10] = state[2];
  25588. state[6] = t;
  25589. state[2] = u;
  25590. t = state[15];
  25591. u = state[11];
  25592. v = state[7];
  25593. state[15] = state[3];
  25594. state[11] = t;
  25595. state[7] = u;
  25596. state[3] = v;
  25597. for (j = 0; j < 16; ++j) {
  25598. state[j] = inv_s[state[j]];
  25599. state[j] ^= key[j];
  25600. }
  25601. return state;
  25602. }
  25603. function encrypt256(input, key) {
  25604. var t, u, v, k;
  25605. var state = new Uint8Array(16);
  25606. state.set(input);
  25607. for (j = 0; j < 16; ++j) {
  25608. state[j] ^= key[j];
  25609. }
  25610. for (i = 1; i < 14; i++) {
  25611. for (j = 0; j < 16; ++j) {
  25612. state[j] = s[state[j]];
  25613. }
  25614. v = state[1];
  25615. state[1] = state[5];
  25616. state[5] = state[9];
  25617. state[9] = state[13];
  25618. state[13] = v;
  25619. v = state[2];
  25620. u = state[6];
  25621. state[2] = state[10];
  25622. state[6] = state[14];
  25623. state[10] = v;
  25624. state[14] = u;
  25625. v = state[3];
  25626. u = state[7];
  25627. t = state[11];
  25628. state[3] = state[15];
  25629. state[7] = v;
  25630. state[11] = u;
  25631. state[15] = t;
  25632. for (var j = 0; j < 16; j += 4) {
  25633. var s0 = state[j + 0], s1 = state[j + 1];
  25634. var s2 = state[j + 2], s3 = state[j + 3];
  25635. t = s0 ^ s1 ^ s2 ^ s3;
  25636. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  25637. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  25638. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  25639. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  25640. }
  25641. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25642. state[j] ^= key[k];
  25643. }
  25644. }
  25645. for (j = 0; j < 16; ++j) {
  25646. state[j] = s[state[j]];
  25647. }
  25648. v = state[1];
  25649. state[1] = state[5];
  25650. state[5] = state[9];
  25651. state[9] = state[13];
  25652. state[13] = v;
  25653. v = state[2];
  25654. u = state[6];
  25655. state[2] = state[10];
  25656. state[6] = state[14];
  25657. state[10] = v;
  25658. state[14] = u;
  25659. v = state[3];
  25660. u = state[7];
  25661. t = state[11];
  25662. state[3] = state[15];
  25663. state[7] = v;
  25664. state[11] = u;
  25665. state[15] = t;
  25666. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25667. state[j] ^= key[k];
  25668. }
  25669. return state;
  25670. }
  25671. function AES256Cipher(key) {
  25672. this.key = expandKey256(key);
  25673. this.buffer = new Uint8Array(16);
  25674. this.bufferPosition = 0;
  25675. }
  25676. function decryptBlock2(data, finalize) {
  25677. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  25678. for (i = 0; i < sourceLength; ++i) {
  25679. buffer[bufferLength] = data[i];
  25680. ++bufferLength;
  25681. if (bufferLength < 16) {
  25682. continue;
  25683. }
  25684. var plain = decrypt256(buffer, this.key);
  25685. for (j = 0; j < 16; ++j) {
  25686. plain[j] ^= iv[j];
  25687. }
  25688. iv = buffer;
  25689. result.push(plain);
  25690. buffer = new Uint8Array(16);
  25691. bufferLength = 0;
  25692. }
  25693. this.buffer = buffer;
  25694. this.bufferLength = bufferLength;
  25695. this.iv = iv;
  25696. if (result.length === 0) {
  25697. return new Uint8Array([]);
  25698. }
  25699. var outputLength = 16 * result.length;
  25700. if (finalize) {
  25701. var lastBlock = result[result.length - 1];
  25702. var psLen = lastBlock[15];
  25703. if (psLen <= 16) {
  25704. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  25705. if (lastBlock[i] !== psLen) {
  25706. psLen = 0;
  25707. break;
  25708. }
  25709. }
  25710. outputLength -= psLen;
  25711. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  25712. }
  25713. }
  25714. var output = new Uint8Array(outputLength);
  25715. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25716. output.set(result[i], j);
  25717. }
  25718. return output;
  25719. }
  25720. AES256Cipher.prototype = {
  25721. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  25722. var i, sourceLength = data.length;
  25723. var buffer = this.buffer, bufferLength = this.bufferPosition;
  25724. if (iv) {
  25725. this.iv = iv;
  25726. } else {
  25727. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  25728. buffer[bufferLength] = data[i];
  25729. }
  25730. if (bufferLength < 16) {
  25731. this.bufferLength = bufferLength;
  25732. return new Uint8Array([]);
  25733. }
  25734. this.iv = buffer;
  25735. data = data.subarray(16);
  25736. }
  25737. this.buffer = new Uint8Array(16);
  25738. this.bufferLength = 0;
  25739. this.decryptBlock = decryptBlock2;
  25740. return this.decryptBlock(data, finalize);
  25741. },
  25742. encrypt: function AES256Cipher_encrypt(data, iv) {
  25743. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  25744. if (!iv) {
  25745. iv = new Uint8Array(16);
  25746. }
  25747. for (i = 0; i < sourceLength; ++i) {
  25748. buffer[bufferLength] = data[i];
  25749. ++bufferLength;
  25750. if (bufferLength < 16) {
  25751. continue;
  25752. }
  25753. for (j = 0; j < 16; ++j) {
  25754. buffer[j] ^= iv[j];
  25755. }
  25756. var cipher = encrypt256(buffer, this.key);
  25757. this.iv = cipher;
  25758. result.push(cipher);
  25759. buffer = new Uint8Array(16);
  25760. bufferLength = 0;
  25761. }
  25762. this.buffer = buffer;
  25763. this.bufferLength = bufferLength;
  25764. this.iv = iv;
  25765. if (result.length === 0) {
  25766. return new Uint8Array([]);
  25767. }
  25768. var outputLength = 16 * result.length;
  25769. var output = new Uint8Array(outputLength);
  25770. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25771. output.set(result[i], j);
  25772. }
  25773. return output;
  25774. }
  25775. };
  25776. return AES256Cipher;
  25777. }();
  25778. var PDF17 = function PDF17Closure() {
  25779. function compareByteArrays(array1, array2) {
  25780. if (array1.length !== array2.length) {
  25781. return false;
  25782. }
  25783. for (var i = 0; i < array1.length; i++) {
  25784. if (array1[i] !== array2[i]) {
  25785. return false;
  25786. }
  25787. }
  25788. return true;
  25789. }
  25790. function PDF17() {
  25791. }
  25792. PDF17.prototype = {
  25793. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25794. var hashData = new Uint8Array(password.length + 56);
  25795. hashData.set(password, 0);
  25796. hashData.set(ownerValidationSalt, password.length);
  25797. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25798. var result = calculateSHA256(hashData, 0, hashData.length);
  25799. return compareByteArrays(result, ownerPassword);
  25800. },
  25801. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  25802. var hashData = new Uint8Array(password.length + 8);
  25803. hashData.set(password, 0);
  25804. hashData.set(userValidationSalt, password.length);
  25805. var result = calculateSHA256(hashData, 0, hashData.length);
  25806. return compareByteArrays(result, userPassword);
  25807. },
  25808. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25809. var hashData = new Uint8Array(password.length + 56);
  25810. hashData.set(password, 0);
  25811. hashData.set(ownerKeySalt, password.length);
  25812. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25813. var key = calculateSHA256(hashData, 0, hashData.length);
  25814. var cipher = new AES256Cipher(key);
  25815. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25816. },
  25817. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  25818. var hashData = new Uint8Array(password.length + 8);
  25819. hashData.set(password, 0);
  25820. hashData.set(userKeySalt, password.length);
  25821. var key = calculateSHA256(hashData, 0, hashData.length);
  25822. var cipher = new AES256Cipher(key);
  25823. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25824. }
  25825. };
  25826. return PDF17;
  25827. }();
  25828. var PDF20 = function PDF20Closure() {
  25829. function concatArrays(array1, array2) {
  25830. var t = new Uint8Array(array1.length + array2.length);
  25831. t.set(array1, 0);
  25832. t.set(array2, array1.length);
  25833. return t;
  25834. }
  25835. function calculatePDF20Hash(password, input, userBytes) {
  25836. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25837. var e = [0];
  25838. var i = 0;
  25839. while (i < 64 || e[e.length - 1] > i - 32) {
  25840. var arrayLength = password.length + k.length + userBytes.length;
  25841. var k1 = new Uint8Array(arrayLength * 64);
  25842. var array = concatArrays(password, k);
  25843. array = concatArrays(array, userBytes);
  25844. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25845. k1.set(array, pos);
  25846. }
  25847. var cipher = new AES128Cipher(k.subarray(0, 16));
  25848. e = cipher.encrypt(k1, k.subarray(16, 32));
  25849. var remainder = 0;
  25850. for (var z = 0; z < 16; z++) {
  25851. remainder *= 256 % 3;
  25852. remainder %= 3;
  25853. remainder += (e[z] >>> 0) % 3;
  25854. remainder %= 3;
  25855. }
  25856. if (remainder === 0) {
  25857. k = calculateSHA256(e, 0, e.length);
  25858. } else if (remainder === 1) {
  25859. k = calculateSHA384(e, 0, e.length);
  25860. } else if (remainder === 2) {
  25861. k = calculateSHA512(e, 0, e.length);
  25862. }
  25863. i++;
  25864. }
  25865. return k.subarray(0, 32);
  25866. }
  25867. function PDF20() {
  25868. }
  25869. function compareByteArrays(array1, array2) {
  25870. if (array1.length !== array2.length) {
  25871. return false;
  25872. }
  25873. for (var i = 0; i < array1.length; i++) {
  25874. if (array1[i] !== array2[i]) {
  25875. return false;
  25876. }
  25877. }
  25878. return true;
  25879. }
  25880. PDF20.prototype = {
  25881. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25882. return calculatePDF20Hash(password, concatBytes, userBytes);
  25883. },
  25884. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25885. var hashData = new Uint8Array(password.length + 56);
  25886. hashData.set(password, 0);
  25887. hashData.set(ownerValidationSalt, password.length);
  25888. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25889. var result = calculatePDF20Hash(password, hashData, userBytes);
  25890. return compareByteArrays(result, ownerPassword);
  25891. },
  25892. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25893. var hashData = new Uint8Array(password.length + 8);
  25894. hashData.set(password, 0);
  25895. hashData.set(userValidationSalt, password.length);
  25896. var result = calculatePDF20Hash(password, hashData, []);
  25897. return compareByteArrays(result, userPassword);
  25898. },
  25899. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25900. var hashData = new Uint8Array(password.length + 56);
  25901. hashData.set(password, 0);
  25902. hashData.set(ownerKeySalt, password.length);
  25903. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25904. var key = calculatePDF20Hash(password, hashData, userBytes);
  25905. var cipher = new AES256Cipher(key);
  25906. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25907. },
  25908. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25909. var hashData = new Uint8Array(password.length + 8);
  25910. hashData.set(password, 0);
  25911. hashData.set(userKeySalt, password.length);
  25912. var key = calculatePDF20Hash(password, hashData, []);
  25913. var cipher = new AES256Cipher(key);
  25914. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25915. }
  25916. };
  25917. return PDF20;
  25918. }();
  25919. var CipherTransform = function CipherTransformClosure() {
  25920. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25921. this.StringCipherConstructor = stringCipherConstructor;
  25922. this.StreamCipherConstructor = streamCipherConstructor;
  25923. }
  25924. CipherTransform.prototype = {
  25925. createStream: function CipherTransform_createStream(stream, length) {
  25926. var cipher = new this.StreamCipherConstructor();
  25927. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25928. return cipher.decryptBlock(data, finalize);
  25929. });
  25930. },
  25931. decryptString: function CipherTransform_decryptString(s) {
  25932. var cipher = new this.StringCipherConstructor();
  25933. var data = stringToBytes(s);
  25934. data = cipher.decryptBlock(data, true);
  25935. return bytesToString(data);
  25936. }
  25937. };
  25938. return CipherTransform;
  25939. }();
  25940. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25941. var defaultPasswordBytes = new Uint8Array([
  25942. 0x28,
  25943. 0xBF,
  25944. 0x4E,
  25945. 0x5E,
  25946. 0x4E,
  25947. 0x75,
  25948. 0x8A,
  25949. 0x41,
  25950. 0x64,
  25951. 0x00,
  25952. 0x4E,
  25953. 0x56,
  25954. 0xFF,
  25955. 0xFA,
  25956. 0x01,
  25957. 0x08,
  25958. 0x2E,
  25959. 0x2E,
  25960. 0x00,
  25961. 0xB6,
  25962. 0xD0,
  25963. 0x68,
  25964. 0x3E,
  25965. 0x80,
  25966. 0x2F,
  25967. 0x0C,
  25968. 0xA9,
  25969. 0xFE,
  25970. 0x64,
  25971. 0x53,
  25972. 0x69,
  25973. 0x7A
  25974. ]);
  25975. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25976. if (password) {
  25977. var passwordLength = Math.min(127, password.length);
  25978. password = password.subarray(0, passwordLength);
  25979. } else {
  25980. password = [];
  25981. }
  25982. var pdfAlgorithm;
  25983. if (revision === 6) {
  25984. pdfAlgorithm = new PDF20();
  25985. } else {
  25986. pdfAlgorithm = new PDF17();
  25987. }
  25988. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25989. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25990. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25991. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25992. }
  25993. return null;
  25994. }
  25995. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25996. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25997. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25998. if (password) {
  25999. n = Math.min(32, password.length);
  26000. for (; i < n; ++i) {
  26001. hashData[i] = password[i];
  26002. }
  26003. }
  26004. j = 0;
  26005. while (i < 32) {
  26006. hashData[i++] = defaultPasswordBytes[j++];
  26007. }
  26008. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  26009. hashData[i++] = ownerPassword[j];
  26010. }
  26011. hashData[i++] = flags & 0xFF;
  26012. hashData[i++] = flags >> 8 & 0xFF;
  26013. hashData[i++] = flags >> 16 & 0xFF;
  26014. hashData[i++] = flags >>> 24 & 0xFF;
  26015. for (j = 0, n = fileId.length; j < n; ++j) {
  26016. hashData[i++] = fileId[j];
  26017. }
  26018. if (revision >= 4 && !encryptMetadata) {
  26019. hashData[i++] = 0xFF;
  26020. hashData[i++] = 0xFF;
  26021. hashData[i++] = 0xFF;
  26022. hashData[i++] = 0xFF;
  26023. }
  26024. var hash = calculateMD5(hashData, 0, i);
  26025. var keyLengthInBytes = keyLength >> 3;
  26026. if (revision >= 3) {
  26027. for (j = 0; j < 50; ++j) {
  26028. hash = calculateMD5(hash, 0, keyLengthInBytes);
  26029. }
  26030. }
  26031. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  26032. var cipher, checkData;
  26033. if (revision >= 3) {
  26034. for (i = 0; i < 32; ++i) {
  26035. hashData[i] = defaultPasswordBytes[i];
  26036. }
  26037. for (j = 0, n = fileId.length; j < n; ++j) {
  26038. hashData[i++] = fileId[j];
  26039. }
  26040. cipher = new ARCFourCipher(encryptionKey);
  26041. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  26042. n = encryptionKey.length;
  26043. var derivedKey = new Uint8Array(n), k;
  26044. for (j = 1; j <= 19; ++j) {
  26045. for (k = 0; k < n; ++k) {
  26046. derivedKey[k] = encryptionKey[k] ^ j;
  26047. }
  26048. cipher = new ARCFourCipher(derivedKey);
  26049. checkData = cipher.encryptBlock(checkData);
  26050. }
  26051. for (j = 0, n = checkData.length; j < n; ++j) {
  26052. if (userPassword[j] !== checkData[j]) {
  26053. return null;
  26054. }
  26055. }
  26056. } else {
  26057. cipher = new ARCFourCipher(encryptionKey);
  26058. checkData = cipher.encryptBlock(defaultPasswordBytes);
  26059. for (j = 0, n = checkData.length; j < n; ++j) {
  26060. if (userPassword[j] !== checkData[j]) {
  26061. return null;
  26062. }
  26063. }
  26064. }
  26065. return encryptionKey;
  26066. }
  26067. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  26068. var hashData = new Uint8Array(32), i = 0, j, n;
  26069. n = Math.min(32, password.length);
  26070. for (; i < n; ++i) {
  26071. hashData[i] = password[i];
  26072. }
  26073. j = 0;
  26074. while (i < 32) {
  26075. hashData[i++] = defaultPasswordBytes[j++];
  26076. }
  26077. var hash = calculateMD5(hashData, 0, i);
  26078. var keyLengthInBytes = keyLength >> 3;
  26079. if (revision >= 3) {
  26080. for (j = 0; j < 50; ++j) {
  26081. hash = calculateMD5(hash, 0, hash.length);
  26082. }
  26083. }
  26084. var cipher, userPassword;
  26085. if (revision >= 3) {
  26086. userPassword = ownerPassword;
  26087. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  26088. for (j = 19; j >= 0; j--) {
  26089. for (k = 0; k < keyLengthInBytes; ++k) {
  26090. derivedKey[k] = hash[k] ^ j;
  26091. }
  26092. cipher = new ARCFourCipher(derivedKey);
  26093. userPassword = cipher.encryptBlock(userPassword);
  26094. }
  26095. } else {
  26096. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  26097. userPassword = cipher.encryptBlock(ownerPassword);
  26098. }
  26099. return userPassword;
  26100. }
  26101. var identityName = Name.get('Identity');
  26102. function CipherTransformFactory(dict, fileId, password) {
  26103. var filter = dict.get('Filter');
  26104. if (!isName(filter, 'Standard')) {
  26105. error('unknown encryption method');
  26106. }
  26107. this.dict = dict;
  26108. var algorithm = dict.get('V');
  26109. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  26110. error('unsupported encryption algorithm');
  26111. }
  26112. this.algorithm = algorithm;
  26113. var keyLength = dict.get('Length');
  26114. if (!keyLength) {
  26115. if (algorithm <= 3) {
  26116. keyLength = 40;
  26117. } else {
  26118. var cfDict = dict.get('CF');
  26119. var streamCryptoName = dict.get('StmF');
  26120. if (isDict(cfDict) && isName(streamCryptoName)) {
  26121. cfDict.suppressEncryption = true;
  26122. var handlerDict = cfDict.get(streamCryptoName.name);
  26123. keyLength = handlerDict && handlerDict.get('Length') || 128;
  26124. if (keyLength < 40) {
  26125. keyLength <<= 3;
  26126. }
  26127. }
  26128. }
  26129. }
  26130. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  26131. error('invalid key length');
  26132. }
  26133. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  26134. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  26135. var flags = dict.get('P');
  26136. var revision = dict.get('R');
  26137. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  26138. this.encryptMetadata = encryptMetadata;
  26139. var fileIdBytes = stringToBytes(fileId);
  26140. var passwordBytes;
  26141. if (password) {
  26142. if (revision === 6) {
  26143. try {
  26144. password = utf8StringToString(password);
  26145. } catch (ex) {
  26146. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  26147. }
  26148. }
  26149. passwordBytes = stringToBytes(password);
  26150. }
  26151. var encryptionKey;
  26152. if (algorithm !== 5) {
  26153. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26154. } else {
  26155. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  26156. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  26157. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  26158. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  26159. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  26160. var ownerEncryption = stringToBytes(dict.get('OE'));
  26161. var userEncryption = stringToBytes(dict.get('UE'));
  26162. var perms = stringToBytes(dict.get('Perms'));
  26163. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  26164. }
  26165. if (!encryptionKey && !password) {
  26166. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  26167. } else if (!encryptionKey && password) {
  26168. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  26169. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26170. }
  26171. if (!encryptionKey) {
  26172. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  26173. }
  26174. this.encryptionKey = encryptionKey;
  26175. if (algorithm >= 4) {
  26176. var cf = dict.get('CF');
  26177. if (isDict(cf)) {
  26178. cf.suppressEncryption = true;
  26179. }
  26180. this.cf = cf;
  26181. this.stmf = dict.get('StmF') || identityName;
  26182. this.strf = dict.get('StrF') || identityName;
  26183. this.eff = dict.get('EFF') || this.stmf;
  26184. }
  26185. }
  26186. function buildObjectKey(num, gen, encryptionKey, isAes) {
  26187. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  26188. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  26189. key[i] = encryptionKey[i];
  26190. }
  26191. key[i++] = num & 0xFF;
  26192. key[i++] = num >> 8 & 0xFF;
  26193. key[i++] = num >> 16 & 0xFF;
  26194. key[i++] = gen & 0xFF;
  26195. key[i++] = gen >> 8 & 0xFF;
  26196. if (isAes) {
  26197. key[i++] = 0x73;
  26198. key[i++] = 0x41;
  26199. key[i++] = 0x6C;
  26200. key[i++] = 0x54;
  26201. }
  26202. var hash = calculateMD5(key, 0, i);
  26203. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  26204. }
  26205. function buildCipherConstructor(cf, name, num, gen, key) {
  26206. assert(isName(name), 'Invalid crypt filter name.');
  26207. var cryptFilter = cf.get(name.name);
  26208. var cfm;
  26209. if (cryptFilter !== null && cryptFilter !== undefined) {
  26210. cfm = cryptFilter.get('CFM');
  26211. }
  26212. if (!cfm || cfm.name === 'None') {
  26213. return function cipherTransformFactoryBuildCipherConstructorNone() {
  26214. return new NullCipher();
  26215. };
  26216. }
  26217. if (cfm.name === 'V2') {
  26218. return function cipherTransformFactoryBuildCipherConstructorV2() {
  26219. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  26220. };
  26221. }
  26222. if (cfm.name === 'AESV2') {
  26223. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  26224. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  26225. };
  26226. }
  26227. if (cfm.name === 'AESV3') {
  26228. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  26229. return new AES256Cipher(key);
  26230. };
  26231. }
  26232. error('Unknown crypto method');
  26233. }
  26234. CipherTransformFactory.prototype = {
  26235. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  26236. if (this.algorithm === 4 || this.algorithm === 5) {
  26237. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  26238. }
  26239. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  26240. var cipherConstructor = function buildCipherCipherConstructor() {
  26241. return new ARCFourCipher(key);
  26242. };
  26243. return new CipherTransform(cipherConstructor, cipherConstructor);
  26244. }
  26245. };
  26246. return CipherTransformFactory;
  26247. }();
  26248. exports.AES128Cipher = AES128Cipher;
  26249. exports.AES256Cipher = AES256Cipher;
  26250. exports.ARCFourCipher = ARCFourCipher;
  26251. exports.CipherTransformFactory = CipherTransformFactory;
  26252. exports.PDF17 = PDF17;
  26253. exports.PDF20 = PDF20;
  26254. exports.calculateMD5 = calculateMD5;
  26255. exports.calculateSHA256 = calculateSHA256;
  26256. exports.calculateSHA384 = calculateSHA384;
  26257. exports.calculateSHA512 = calculateSHA512;
  26258. /***/ }),
  26259. /* 13 */
  26260. /***/ (function(module, exports, __w_pdfjs_require__) {
  26261. "use strict";
  26262. var sharedUtil = __w_pdfjs_require__(0);
  26263. var corePrimitives = __w_pdfjs_require__(1);
  26264. var coreStream = __w_pdfjs_require__(2);
  26265. var coreParser = __w_pdfjs_require__(5);
  26266. var coreImage = __w_pdfjs_require__(27);
  26267. var coreColorSpace = __w_pdfjs_require__(3);
  26268. var coreMurmurHash3 = __w_pdfjs_require__(31);
  26269. var coreFonts = __w_pdfjs_require__(26);
  26270. var coreFunction = __w_pdfjs_require__(6);
  26271. var corePattern = __w_pdfjs_require__(32);
  26272. var coreCMap = __w_pdfjs_require__(23);
  26273. var coreMetrics = __w_pdfjs_require__(30);
  26274. var coreBidi = __w_pdfjs_require__(21);
  26275. var coreEncodings = __w_pdfjs_require__(4);
  26276. var coreStandardFonts = __w_pdfjs_require__(16);
  26277. var coreUnicode = __w_pdfjs_require__(17);
  26278. var coreGlyphList = __w_pdfjs_require__(7);
  26279. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  26280. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  26281. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  26282. var ImageKind = sharedUtil.ImageKind;
  26283. var OPS = sharedUtil.OPS;
  26284. var TextRenderingMode = sharedUtil.TextRenderingMode;
  26285. var Util = sharedUtil.Util;
  26286. var assert = sharedUtil.assert;
  26287. var createPromiseCapability = sharedUtil.createPromiseCapability;
  26288. var error = sharedUtil.error;
  26289. var info = sharedUtil.info;
  26290. var isArray = sharedUtil.isArray;
  26291. var isNum = sharedUtil.isNum;
  26292. var isString = sharedUtil.isString;
  26293. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  26294. var warn = sharedUtil.warn;
  26295. var Dict = corePrimitives.Dict;
  26296. var Name = corePrimitives.Name;
  26297. var isEOF = corePrimitives.isEOF;
  26298. var isCmd = corePrimitives.isCmd;
  26299. var isDict = corePrimitives.isDict;
  26300. var isName = corePrimitives.isName;
  26301. var isRef = corePrimitives.isRef;
  26302. var isStream = corePrimitives.isStream;
  26303. var DecodeStream = coreStream.DecodeStream;
  26304. var JpegStream = coreStream.JpegStream;
  26305. var Stream = coreStream.Stream;
  26306. var Lexer = coreParser.Lexer;
  26307. var Parser = coreParser.Parser;
  26308. var PDFImage = coreImage.PDFImage;
  26309. var ColorSpace = coreColorSpace.ColorSpace;
  26310. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  26311. var ErrorFont = coreFonts.ErrorFont;
  26312. var FontFlags = coreFonts.FontFlags;
  26313. var Font = coreFonts.Font;
  26314. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  26315. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  26316. var getFontType = coreFonts.getFontType;
  26317. var isPDFFunction = coreFunction.isPDFFunction;
  26318. var PDFFunction = coreFunction.PDFFunction;
  26319. var Pattern = corePattern.Pattern;
  26320. var getTilingPatternIR = corePattern.getTilingPatternIR;
  26321. var CMapFactory = coreCMap.CMapFactory;
  26322. var IdentityCMap = coreCMap.IdentityCMap;
  26323. var getMetrics = coreMetrics.getMetrics;
  26324. var bidi = coreBidi.bidi;
  26325. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  26326. var StandardEncoding = coreEncodings.StandardEncoding;
  26327. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  26328. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  26329. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  26330. var getEncoding = coreEncodings.getEncoding;
  26331. var getStdFontMap = coreStandardFonts.getStdFontMap;
  26332. var getSerifFonts = coreStandardFonts.getSerifFonts;
  26333. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  26334. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  26335. var reverseIfRtl = coreUnicode.reverseIfRtl;
  26336. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  26337. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  26338. var PartialEvaluator = function PartialEvaluatorClosure() {
  26339. var DefaultPartialEvaluatorOptions = {
  26340. forceDataSchema: false,
  26341. maxImageSize: -1,
  26342. disableFontFace: false,
  26343. cMapOptions: {
  26344. url: null,
  26345. packed: false
  26346. },
  26347. disableNativeImageDecoder: false
  26348. };
  26349. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  26350. this.xref = xref;
  26351. this.resources = resources;
  26352. this.handler = handler;
  26353. this.forceDataSchema = forceDataSchema;
  26354. }
  26355. NativeImageDecoder.prototype = {
  26356. canDecode: function (image) {
  26357. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  26358. },
  26359. decode: function (image) {
  26360. var dict = image.dict;
  26361. var colorSpace = dict.get('ColorSpace', 'CS');
  26362. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  26363. var numComps = colorSpace.numComps;
  26364. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  26365. image.getIR(this.forceDataSchema),
  26366. numComps
  26367. ]);
  26368. return decodePromise.then(function (message) {
  26369. var data = message.data;
  26370. return new Stream(data, 0, data.length, image.dict);
  26371. });
  26372. }
  26373. };
  26374. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  26375. var dict = image.dict;
  26376. if (dict.has('DecodeParms') || dict.has('DP')) {
  26377. return false;
  26378. }
  26379. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26380. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26381. };
  26382. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  26383. var dict = image.dict;
  26384. if (dict.has('DecodeParms') || dict.has('DP')) {
  26385. return false;
  26386. }
  26387. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26388. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26389. };
  26390. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, options) {
  26391. this.pdfManager = pdfManager;
  26392. this.xref = xref;
  26393. this.handler = handler;
  26394. this.pageIndex = pageIndex;
  26395. this.idFactory = idFactory;
  26396. this.fontCache = fontCache;
  26397. this.options = options || DefaultPartialEvaluatorOptions;
  26398. }
  26399. var TIME_SLOT_DURATION_MS = 20;
  26400. var CHECK_TIME_EVERY = 100;
  26401. function TimeSlotManager() {
  26402. this.reset();
  26403. }
  26404. TimeSlotManager.prototype = {
  26405. check: function TimeSlotManager_check() {
  26406. if (++this.checked < CHECK_TIME_EVERY) {
  26407. return false;
  26408. }
  26409. this.checked = 0;
  26410. return this.endTime <= Date.now();
  26411. },
  26412. reset: function TimeSlotManager_reset() {
  26413. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  26414. this.checked = 0;
  26415. }
  26416. };
  26417. var deferred = Promise.resolve();
  26418. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  26419. PartialEvaluator.prototype = {
  26420. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  26421. if (!isDict(resources)) {
  26422. return false;
  26423. }
  26424. var processed = Object.create(null);
  26425. if (resources.objId) {
  26426. processed[resources.objId] = true;
  26427. }
  26428. var nodes = [resources], xref = this.xref;
  26429. while (nodes.length) {
  26430. var key, i, ii;
  26431. var node = nodes.shift();
  26432. var graphicStates = node.get('ExtGState');
  26433. if (isDict(graphicStates)) {
  26434. var graphicStatesKeys = graphicStates.getKeys();
  26435. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  26436. key = graphicStatesKeys[i];
  26437. var graphicState = graphicStates.get(key);
  26438. var bm = graphicState.get('BM');
  26439. if (isName(bm) && bm.name !== 'Normal') {
  26440. return true;
  26441. }
  26442. }
  26443. }
  26444. var xObjects = node.get('XObject');
  26445. if (!isDict(xObjects)) {
  26446. continue;
  26447. }
  26448. var xObjectsKeys = xObjects.getKeys();
  26449. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  26450. key = xObjectsKeys[i];
  26451. var xObject = xObjects.getRaw(key);
  26452. if (isRef(xObject)) {
  26453. if (processed[xObject.toString()]) {
  26454. continue;
  26455. }
  26456. xObject = xref.fetch(xObject);
  26457. }
  26458. if (!isStream(xObject)) {
  26459. continue;
  26460. }
  26461. if (xObject.dict.objId) {
  26462. if (processed[xObject.dict.objId]) {
  26463. continue;
  26464. }
  26465. processed[xObject.dict.objId] = true;
  26466. }
  26467. var xResources = xObject.dict.get('Resources');
  26468. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  26469. nodes.push(xResources);
  26470. if (xResources.objId) {
  26471. processed[xResources.objId] = true;
  26472. }
  26473. }
  26474. }
  26475. }
  26476. return false;
  26477. },
  26478. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  26479. var matrix = xobj.dict.getArray('Matrix');
  26480. var bbox = xobj.dict.getArray('BBox');
  26481. var group = xobj.dict.get('Group');
  26482. if (group) {
  26483. var groupOptions = {
  26484. matrix: matrix,
  26485. bbox: bbox,
  26486. smask: smask,
  26487. isolated: false,
  26488. knockout: false
  26489. };
  26490. var groupSubtype = group.get('S');
  26491. var colorSpace;
  26492. if (isName(groupSubtype, 'Transparency')) {
  26493. groupOptions.isolated = group.get('I') || false;
  26494. groupOptions.knockout = group.get('K') || false;
  26495. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  26496. }
  26497. if (smask && smask.backdrop) {
  26498. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  26499. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  26500. }
  26501. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  26502. }
  26503. operatorList.addOp(OPS.paintFormXObjectBegin, [
  26504. matrix,
  26505. bbox
  26506. ]);
  26507. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  26508. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  26509. if (group) {
  26510. operatorList.addOp(OPS.endGroup, [groupOptions]);
  26511. }
  26512. });
  26513. },
  26514. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  26515. var self = this;
  26516. var dict = image.dict;
  26517. var w = dict.get('Width', 'W');
  26518. var h = dict.get('Height', 'H');
  26519. if (!(w && isNum(w)) || !(h && isNum(h))) {
  26520. warn('Image dimensions are missing, or not numbers.');
  26521. return;
  26522. }
  26523. var maxImageSize = this.options.maxImageSize;
  26524. if (maxImageSize !== -1 && w * h > maxImageSize) {
  26525. warn('Image exceeded maximum allowed size and was removed.');
  26526. return;
  26527. }
  26528. var imageMask = dict.get('ImageMask', 'IM') || false;
  26529. var imgData, args;
  26530. if (imageMask) {
  26531. var width = dict.get('Width', 'W');
  26532. var height = dict.get('Height', 'H');
  26533. var bitStrideLength = width + 7 >> 3;
  26534. var imgArray = image.getBytes(bitStrideLength * height);
  26535. var decode = dict.getArray('Decode', 'D');
  26536. var inverseDecode = !!decode && decode[0] > 0;
  26537. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  26538. imgData.cached = true;
  26539. args = [imgData];
  26540. operatorList.addOp(OPS.paintImageMaskXObject, args);
  26541. if (cacheKey) {
  26542. imageCache[cacheKey] = {
  26543. fn: OPS.paintImageMaskXObject,
  26544. args: args
  26545. };
  26546. }
  26547. return;
  26548. }
  26549. var softMask = dict.get('SMask', 'SM') || false;
  26550. var mask = dict.get('Mask') || false;
  26551. var SMALL_IMAGE_DIMENSIONS = 200;
  26552. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  26553. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  26554. imgData = imageObj.createImageData(true);
  26555. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  26556. return;
  26557. }
  26558. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  26559. var objId = 'img_' + this.idFactory.createObjId();
  26560. operatorList.addDependency(objId);
  26561. args = [
  26562. objId,
  26563. w,
  26564. h
  26565. ];
  26566. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  26567. operatorList.addOp(OPS.paintJpegXObject, args);
  26568. this.handler.send('obj', [
  26569. objId,
  26570. this.pageIndex,
  26571. 'JpegStream',
  26572. image.getIR(this.options.forceDataSchema)
  26573. ]);
  26574. return;
  26575. }
  26576. var nativeImageDecoder = null;
  26577. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  26578. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  26579. }
  26580. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  26581. var imgData = imageObj.createImageData(false);
  26582. self.handler.send('obj', [
  26583. objId,
  26584. self.pageIndex,
  26585. 'Image',
  26586. imgData
  26587. ], [imgData.data.buffer]);
  26588. }).then(undefined, function (reason) {
  26589. warn('Unable to decode image: ' + reason);
  26590. self.handler.send('obj', [
  26591. objId,
  26592. self.pageIndex,
  26593. 'Image',
  26594. null
  26595. ]);
  26596. });
  26597. operatorList.addOp(OPS.paintImageXObject, args);
  26598. if (cacheKey) {
  26599. imageCache[cacheKey] = {
  26600. fn: OPS.paintImageXObject,
  26601. args: args
  26602. };
  26603. }
  26604. },
  26605. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  26606. var smaskContent = smask.get('G');
  26607. var smaskOptions = {
  26608. subtype: smask.get('S').name,
  26609. backdrop: smask.get('BC')
  26610. };
  26611. var transferObj = smask.get('TR');
  26612. if (isPDFFunction(transferObj)) {
  26613. var transferFn = PDFFunction.parse(this.xref, transferObj);
  26614. var transferMap = new Uint8Array(256);
  26615. var tmp = new Float32Array(1);
  26616. for (var i = 0; i < 256; i++) {
  26617. tmp[0] = i / 255;
  26618. transferFn(tmp, 0, tmp, 0);
  26619. transferMap[i] = tmp[0] * 255 | 0;
  26620. }
  26621. smaskOptions.transferMap = transferMap;
  26622. }
  26623. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  26624. },
  26625. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  26626. var tilingOpList = new OperatorList();
  26627. var resourcesArray = [
  26628. patternDict.get('Resources'),
  26629. resources
  26630. ];
  26631. var patternResources = Dict.merge(this.xref, resourcesArray);
  26632. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  26633. operatorList.addDependencies(tilingOpList.dependencies);
  26634. operatorList.addOp(fn, getTilingPatternIR({
  26635. fnArray: tilingOpList.fnArray,
  26636. argsArray: tilingOpList.argsArray
  26637. }, patternDict, args));
  26638. });
  26639. },
  26640. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  26641. var fontName;
  26642. if (fontArgs) {
  26643. fontArgs = fontArgs.slice();
  26644. fontName = fontArgs[0].name;
  26645. }
  26646. var self = this;
  26647. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  26648. if (!translated.font.isType3Font) {
  26649. return translated;
  26650. }
  26651. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  26652. return translated;
  26653. }, function (reason) {
  26654. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26655. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  26656. });
  26657. }).then(function (translated) {
  26658. state.font = translated.font;
  26659. translated.send(self.handler);
  26660. return translated.loadedName;
  26661. });
  26662. },
  26663. handleText: function PartialEvaluator_handleText(chars, state) {
  26664. var font = state.font;
  26665. var glyphs = font.charsToGlyphs(chars);
  26666. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  26667. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  26668. var buildPath = function (fontChar) {
  26669. if (!font.renderer.hasBuiltPath(fontChar)) {
  26670. var path = font.renderer.getPathJs(fontChar);
  26671. this.handler.send('commonobj', [
  26672. font.loadedName + '_path_' + fontChar,
  26673. 'FontPath',
  26674. path
  26675. ]);
  26676. }
  26677. }.bind(this);
  26678. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  26679. var glyph = glyphs[i];
  26680. buildPath(glyph.fontChar);
  26681. var accent = glyph.accent;
  26682. if (accent && accent.fontChar) {
  26683. buildPath(accent.fontChar);
  26684. }
  26685. }
  26686. }
  26687. return glyphs;
  26688. },
  26689. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  26690. var gStateObj = [];
  26691. var gStateKeys = gState.getKeys();
  26692. var self = this;
  26693. var promise = Promise.resolve();
  26694. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  26695. var key = gStateKeys[i];
  26696. var value = gState.get(key);
  26697. switch (key) {
  26698. case 'Type':
  26699. break;
  26700. case 'LW':
  26701. case 'LC':
  26702. case 'LJ':
  26703. case 'ML':
  26704. case 'D':
  26705. case 'RI':
  26706. case 'FL':
  26707. case 'CA':
  26708. case 'ca':
  26709. gStateObj.push([
  26710. key,
  26711. value
  26712. ]);
  26713. break;
  26714. case 'Font':
  26715. promise = promise.then(function () {
  26716. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  26717. operatorList.addDependency(loadedName);
  26718. gStateObj.push([
  26719. key,
  26720. [
  26721. loadedName,
  26722. value[1]
  26723. ]
  26724. ]);
  26725. });
  26726. });
  26727. break;
  26728. case 'BM':
  26729. gStateObj.push([
  26730. key,
  26731. value
  26732. ]);
  26733. break;
  26734. case 'SMask':
  26735. if (isName(value, 'None')) {
  26736. gStateObj.push([
  26737. key,
  26738. false
  26739. ]);
  26740. break;
  26741. }
  26742. if (isDict(value)) {
  26743. promise = promise.then(function (dict) {
  26744. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  26745. }.bind(this, value));
  26746. gStateObj.push([
  26747. key,
  26748. true
  26749. ]);
  26750. } else {
  26751. warn('Unsupported SMask type');
  26752. }
  26753. break;
  26754. case 'OP':
  26755. case 'op':
  26756. case 'OPM':
  26757. case 'BG':
  26758. case 'BG2':
  26759. case 'UCR':
  26760. case 'UCR2':
  26761. case 'TR':
  26762. case 'TR2':
  26763. case 'HT':
  26764. case 'SM':
  26765. case 'SA':
  26766. case 'AIS':
  26767. case 'TK':
  26768. info('graphic state operator ' + key);
  26769. break;
  26770. default:
  26771. info('Unknown graphic state operator ' + key);
  26772. break;
  26773. }
  26774. }
  26775. return promise.then(function () {
  26776. if (gStateObj.length > 0) {
  26777. operatorList.addOp(OPS.setGState, [gStateObj]);
  26778. }
  26779. });
  26780. },
  26781. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  26782. function errorFont() {
  26783. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  26784. }
  26785. var fontRef;
  26786. if (font) {
  26787. assert(isRef(font));
  26788. fontRef = font;
  26789. } else {
  26790. var fontRes = resources.get('Font');
  26791. if (fontRes) {
  26792. fontRef = fontRes.getRaw(fontName);
  26793. } else {
  26794. warn('fontRes not available');
  26795. return errorFont();
  26796. }
  26797. }
  26798. if (!fontRef) {
  26799. warn('fontRef not available');
  26800. return errorFont();
  26801. }
  26802. if (this.fontCache.has(fontRef)) {
  26803. return this.fontCache.get(fontRef);
  26804. }
  26805. font = xref.fetchIfRef(fontRef);
  26806. if (!isDict(font)) {
  26807. return errorFont();
  26808. }
  26809. if (font.translated) {
  26810. return font.translated;
  26811. }
  26812. var fontCapability = createPromiseCapability();
  26813. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  26814. var descriptor = preEvaluatedFont.descriptor;
  26815. var fontRefIsRef = isRef(fontRef), fontID;
  26816. if (fontRefIsRef) {
  26817. fontID = fontRef.toString();
  26818. }
  26819. if (isDict(descriptor)) {
  26820. if (!descriptor.fontAliases) {
  26821. descriptor.fontAliases = Object.create(null);
  26822. }
  26823. var fontAliases = descriptor.fontAliases;
  26824. var hash = preEvaluatedFont.hash;
  26825. if (fontAliases[hash]) {
  26826. var aliasFontRef = fontAliases[hash].aliasRef;
  26827. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26828. this.fontCache.putAlias(fontRef, aliasFontRef);
  26829. return this.fontCache.get(fontRef);
  26830. }
  26831. } else {
  26832. fontAliases[hash] = { fontID: Font.getFontID() };
  26833. }
  26834. if (fontRefIsRef) {
  26835. fontAliases[hash].aliasRef = fontRef;
  26836. }
  26837. fontID = fontAliases[hash].fontID;
  26838. }
  26839. if (fontRefIsRef) {
  26840. this.fontCache.put(fontRef, fontCapability.promise);
  26841. } else {
  26842. if (!fontID) {
  26843. fontID = this.idFactory.createObjId();
  26844. }
  26845. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26846. }
  26847. assert(fontID, 'The "fontID" must be defined.');
  26848. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26849. font.translated = fontCapability.promise;
  26850. var translatedPromise;
  26851. try {
  26852. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26853. } catch (e) {
  26854. translatedPromise = Promise.reject(e);
  26855. }
  26856. var self = this;
  26857. translatedPromise.then(function (translatedFont) {
  26858. if (translatedFont.fontType !== undefined) {
  26859. var xrefFontStats = xref.stats.fontTypes;
  26860. xrefFontStats[translatedFont.fontType] = true;
  26861. }
  26862. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26863. }, function (reason) {
  26864. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26865. try {
  26866. var descriptor = preEvaluatedFont.descriptor;
  26867. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26868. var subtype = fontFile3 && fontFile3.get('Subtype');
  26869. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26870. var xrefFontStats = xref.stats.fontTypes;
  26871. xrefFontStats[fontType] = true;
  26872. } catch (ex) {
  26873. }
  26874. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26875. });
  26876. return fontCapability.promise;
  26877. },
  26878. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26879. var lastIndex = operatorList.length - 1;
  26880. if (!args) {
  26881. args = [];
  26882. }
  26883. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26884. operatorList.addOp(OPS.constructPath, [
  26885. [fn],
  26886. args
  26887. ]);
  26888. } else {
  26889. var opArgs = operatorList.argsArray[lastIndex];
  26890. opArgs[0].push(fn);
  26891. Array.prototype.push.apply(opArgs[1], args);
  26892. }
  26893. },
  26894. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26895. var patternName = args[args.length - 1];
  26896. var pattern;
  26897. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26898. var dict = isStream(pattern) ? pattern.dict : pattern;
  26899. var typeNum = dict.get('PatternType');
  26900. if (typeNum === TILING_PATTERN) {
  26901. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26902. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26903. } else if (typeNum === SHADING_PATTERN) {
  26904. var shading = dict.get('Shading');
  26905. var matrix = dict.getArray('Matrix');
  26906. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26907. operatorList.addOp(fn, pattern.getIR());
  26908. return Promise.resolve();
  26909. }
  26910. return Promise.reject('Unknown PatternType: ' + typeNum);
  26911. }
  26912. operatorList.addOp(fn, args);
  26913. return Promise.resolve();
  26914. },
  26915. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26916. var self = this;
  26917. var xref = this.xref;
  26918. var imageCache = Object.create(null);
  26919. assert(operatorList);
  26920. resources = resources || Dict.empty;
  26921. var xobjs = resources.get('XObject') || Dict.empty;
  26922. var patterns = resources.get('Pattern') || Dict.empty;
  26923. var stateManager = new StateManager(initialState || new EvalState());
  26924. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26925. var timeSlotManager = new TimeSlotManager();
  26926. return new Promise(function promiseBody(resolve, reject) {
  26927. var next = function (promise) {
  26928. promise.then(function () {
  26929. try {
  26930. promiseBody(resolve, reject);
  26931. } catch (ex) {
  26932. reject(ex);
  26933. }
  26934. }, reject);
  26935. };
  26936. task.ensureNotTerminated();
  26937. timeSlotManager.reset();
  26938. var stop, operation = {}, i, ii, cs;
  26939. while (!(stop = timeSlotManager.check())) {
  26940. operation.args = null;
  26941. if (!preprocessor.read(operation)) {
  26942. break;
  26943. }
  26944. var args = operation.args;
  26945. var fn = operation.fn;
  26946. switch (fn | 0) {
  26947. case OPS.paintXObject:
  26948. if (args[0].code) {
  26949. break;
  26950. }
  26951. var name = args[0].name;
  26952. if (!name) {
  26953. warn('XObject must be referred to by name.');
  26954. continue;
  26955. }
  26956. if (imageCache[name] !== undefined) {
  26957. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26958. args = null;
  26959. continue;
  26960. }
  26961. var xobj = xobjs.get(name);
  26962. if (xobj) {
  26963. assert(isStream(xobj), 'XObject should be a stream');
  26964. var type = xobj.dict.get('Subtype');
  26965. assert(isName(type), 'XObject should have a Name subtype');
  26966. if (type.name === 'Form') {
  26967. stateManager.save();
  26968. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26969. stateManager.restore();
  26970. }));
  26971. return;
  26972. } else if (type.name === 'Image') {
  26973. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26974. args = null;
  26975. continue;
  26976. } else if (type.name === 'PS') {
  26977. info('Ignored XObject subtype PS');
  26978. continue;
  26979. } else {
  26980. error('Unhandled XObject subtype ' + type.name);
  26981. }
  26982. }
  26983. break;
  26984. case OPS.setFont:
  26985. var fontSize = args[1];
  26986. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26987. operatorList.addDependency(loadedName);
  26988. operatorList.addOp(OPS.setFont, [
  26989. loadedName,
  26990. fontSize
  26991. ]);
  26992. }));
  26993. return;
  26994. case OPS.endInlineImage:
  26995. var cacheKey = args[0].cacheKey;
  26996. if (cacheKey) {
  26997. var cacheEntry = imageCache[cacheKey];
  26998. if (cacheEntry !== undefined) {
  26999. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  27000. args = null;
  27001. continue;
  27002. }
  27003. }
  27004. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  27005. args = null;
  27006. continue;
  27007. case OPS.showText:
  27008. args[0] = self.handleText(args[0], stateManager.state);
  27009. break;
  27010. case OPS.showSpacedText:
  27011. var arr = args[0];
  27012. var combinedGlyphs = [];
  27013. var arrLength = arr.length;
  27014. var state = stateManager.state;
  27015. for (i = 0; i < arrLength; ++i) {
  27016. var arrItem = arr[i];
  27017. if (isString(arrItem)) {
  27018. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  27019. } else if (isNum(arrItem)) {
  27020. combinedGlyphs.push(arrItem);
  27021. }
  27022. }
  27023. args[0] = combinedGlyphs;
  27024. fn = OPS.showText;
  27025. break;
  27026. case OPS.nextLineShowText:
  27027. operatorList.addOp(OPS.nextLine);
  27028. args[0] = self.handleText(args[0], stateManager.state);
  27029. fn = OPS.showText;
  27030. break;
  27031. case OPS.nextLineSetSpacingShowText:
  27032. operatorList.addOp(OPS.nextLine);
  27033. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  27034. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  27035. args[0] = self.handleText(args[0], stateManager.state);
  27036. fn = OPS.showText;
  27037. break;
  27038. case OPS.setTextRenderingMode:
  27039. stateManager.state.textRenderingMode = args[0];
  27040. break;
  27041. case OPS.setFillColorSpace:
  27042. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  27043. continue;
  27044. case OPS.setStrokeColorSpace:
  27045. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  27046. continue;
  27047. case OPS.setFillColor:
  27048. cs = stateManager.state.fillColorSpace;
  27049. args = cs.getRgb(args, 0);
  27050. fn = OPS.setFillRGBColor;
  27051. break;
  27052. case OPS.setStrokeColor:
  27053. cs = stateManager.state.strokeColorSpace;
  27054. args = cs.getRgb(args, 0);
  27055. fn = OPS.setStrokeRGBColor;
  27056. break;
  27057. case OPS.setFillGray:
  27058. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  27059. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27060. fn = OPS.setFillRGBColor;
  27061. break;
  27062. case OPS.setStrokeGray:
  27063. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  27064. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27065. fn = OPS.setStrokeRGBColor;
  27066. break;
  27067. case OPS.setFillCMYKColor:
  27068. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  27069. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27070. fn = OPS.setFillRGBColor;
  27071. break;
  27072. case OPS.setStrokeCMYKColor:
  27073. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  27074. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27075. fn = OPS.setStrokeRGBColor;
  27076. break;
  27077. case OPS.setFillRGBColor:
  27078. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  27079. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27080. break;
  27081. case OPS.setStrokeRGBColor:
  27082. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  27083. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27084. break;
  27085. case OPS.setFillColorN:
  27086. cs = stateManager.state.fillColorSpace;
  27087. if (cs.name === 'Pattern') {
  27088. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  27089. return;
  27090. }
  27091. args = cs.getRgb(args, 0);
  27092. fn = OPS.setFillRGBColor;
  27093. break;
  27094. case OPS.setStrokeColorN:
  27095. cs = stateManager.state.strokeColorSpace;
  27096. if (cs.name === 'Pattern') {
  27097. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  27098. return;
  27099. }
  27100. args = cs.getRgb(args, 0);
  27101. fn = OPS.setStrokeRGBColor;
  27102. break;
  27103. case OPS.shadingFill:
  27104. var shadingRes = resources.get('Shading');
  27105. if (!shadingRes) {
  27106. error('No shading resource found');
  27107. }
  27108. var shading = shadingRes.get(args[0].name);
  27109. if (!shading) {
  27110. error('No shading object found');
  27111. }
  27112. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  27113. var patternIR = shadingFill.getIR();
  27114. args = [patternIR];
  27115. fn = OPS.shadingFill;
  27116. break;
  27117. case OPS.setGState:
  27118. var dictName = args[0];
  27119. var extGState = resources.get('ExtGState');
  27120. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  27121. break;
  27122. }
  27123. var gState = extGState.get(dictName.name);
  27124. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  27125. return;
  27126. case OPS.moveTo:
  27127. case OPS.lineTo:
  27128. case OPS.curveTo:
  27129. case OPS.curveTo2:
  27130. case OPS.curveTo3:
  27131. case OPS.closePath:
  27132. self.buildPath(operatorList, fn, args);
  27133. continue;
  27134. case OPS.rectangle:
  27135. self.buildPath(operatorList, fn, args);
  27136. continue;
  27137. case OPS.markPoint:
  27138. case OPS.markPointProps:
  27139. case OPS.beginMarkedContent:
  27140. case OPS.beginMarkedContentProps:
  27141. case OPS.endMarkedContent:
  27142. case OPS.beginCompat:
  27143. case OPS.endCompat:
  27144. continue;
  27145. default:
  27146. if (args !== null) {
  27147. for (i = 0, ii = args.length; i < ii; i++) {
  27148. if (args[i] instanceof Dict) {
  27149. break;
  27150. }
  27151. }
  27152. if (i < ii) {
  27153. warn('getOperatorList - ignoring operator: ' + fn);
  27154. continue;
  27155. }
  27156. }
  27157. }
  27158. operatorList.addOp(fn, args);
  27159. }
  27160. if (stop) {
  27161. next(deferred);
  27162. return;
  27163. }
  27164. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  27165. operatorList.addOp(OPS.restore, []);
  27166. }
  27167. resolve();
  27168. });
  27169. },
  27170. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  27171. stateManager = stateManager || new StateManager(new TextState());
  27172. var WhitespaceRegexp = /\s/g;
  27173. var textContent = {
  27174. items: [],
  27175. styles: Object.create(null)
  27176. };
  27177. var textContentItem = {
  27178. initialized: false,
  27179. str: [],
  27180. width: 0,
  27181. height: 0,
  27182. vertical: false,
  27183. lastAdvanceWidth: 0,
  27184. lastAdvanceHeight: 0,
  27185. textAdvanceScale: 0,
  27186. spaceWidth: 0,
  27187. fakeSpaceMin: Infinity,
  27188. fakeMultiSpaceMin: Infinity,
  27189. fakeMultiSpaceMax: -0,
  27190. textRunBreakAllowed: false,
  27191. transform: null,
  27192. fontName: null
  27193. };
  27194. var SPACE_FACTOR = 0.3;
  27195. var MULTI_SPACE_FACTOR = 1.5;
  27196. var MULTI_SPACE_FACTOR_MAX = 4;
  27197. var self = this;
  27198. var xref = this.xref;
  27199. resources = xref.fetchIfRef(resources) || Dict.empty;
  27200. var xobjs = null;
  27201. var xobjsCache = Object.create(null);
  27202. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  27203. var textState;
  27204. function ensureTextContentItem() {
  27205. if (textContentItem.initialized) {
  27206. return textContentItem;
  27207. }
  27208. var font = textState.font;
  27209. if (!(font.loadedName in textContent.styles)) {
  27210. textContent.styles[font.loadedName] = {
  27211. fontFamily: font.fallbackName,
  27212. ascent: font.ascent,
  27213. descent: font.descent,
  27214. vertical: font.vertical
  27215. };
  27216. }
  27217. textContentItem.fontName = font.loadedName;
  27218. var tsm = [
  27219. textState.fontSize * textState.textHScale,
  27220. 0,
  27221. 0,
  27222. textState.fontSize,
  27223. 0,
  27224. textState.textRise
  27225. ];
  27226. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  27227. var glyphHeight = font.bbox[3] - font.bbox[1];
  27228. if (glyphHeight > 0) {
  27229. glyphHeight = glyphHeight * textState.fontMatrix[3];
  27230. tsm[3] *= glyphHeight;
  27231. }
  27232. }
  27233. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  27234. textContentItem.transform = trm;
  27235. if (!font.vertical) {
  27236. textContentItem.width = 0;
  27237. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  27238. textContentItem.vertical = false;
  27239. } else {
  27240. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  27241. textContentItem.height = 0;
  27242. textContentItem.vertical = true;
  27243. }
  27244. var a = textState.textLineMatrix[0];
  27245. var b = textState.textLineMatrix[1];
  27246. var scaleLineX = Math.sqrt(a * a + b * b);
  27247. a = textState.ctm[0];
  27248. b = textState.ctm[1];
  27249. var scaleCtmX = Math.sqrt(a * a + b * b);
  27250. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  27251. textContentItem.lastAdvanceWidth = 0;
  27252. textContentItem.lastAdvanceHeight = 0;
  27253. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  27254. if (spaceWidth) {
  27255. textContentItem.spaceWidth = spaceWidth;
  27256. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  27257. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  27258. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  27259. textContentItem.textRunBreakAllowed = !font.isMonospace;
  27260. } else {
  27261. textContentItem.spaceWidth = 0;
  27262. textContentItem.fakeSpaceMin = Infinity;
  27263. textContentItem.fakeMultiSpaceMin = Infinity;
  27264. textContentItem.fakeMultiSpaceMax = 0;
  27265. textContentItem.textRunBreakAllowed = false;
  27266. }
  27267. textContentItem.initialized = true;
  27268. return textContentItem;
  27269. }
  27270. function replaceWhitespace(str) {
  27271. var i = 0, ii = str.length, code;
  27272. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  27273. i++;
  27274. }
  27275. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  27276. }
  27277. function runBidiTransform(textChunk) {
  27278. var str = textChunk.str.join('');
  27279. var bidiResult = bidi(str, -1, textChunk.vertical);
  27280. return {
  27281. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  27282. dir: bidiResult.dir,
  27283. width: textChunk.width,
  27284. height: textChunk.height,
  27285. transform: textChunk.transform,
  27286. fontName: textChunk.fontName
  27287. };
  27288. }
  27289. function handleSetFont(fontName, fontRef) {
  27290. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  27291. textState.font = translated.font;
  27292. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  27293. });
  27294. }
  27295. function buildTextContentItem(chars) {
  27296. var font = textState.font;
  27297. var textChunk = ensureTextContentItem();
  27298. var width = 0;
  27299. var height = 0;
  27300. var glyphs = font.charsToGlyphs(chars);
  27301. for (var i = 0; i < glyphs.length; i++) {
  27302. var glyph = glyphs[i];
  27303. var glyphWidth = null;
  27304. if (font.vertical && glyph.vmetric) {
  27305. glyphWidth = glyph.vmetric[0];
  27306. } else {
  27307. glyphWidth = glyph.width;
  27308. }
  27309. var glyphUnicode = glyph.unicode;
  27310. var NormalizedUnicodes = getNormalizedUnicodes();
  27311. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  27312. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  27313. }
  27314. glyphUnicode = reverseIfRtl(glyphUnicode);
  27315. var charSpacing = textState.charSpacing;
  27316. if (glyph.isSpace) {
  27317. var wordSpacing = textState.wordSpacing;
  27318. charSpacing += wordSpacing;
  27319. if (wordSpacing > 0) {
  27320. addFakeSpaces(wordSpacing, textChunk.str);
  27321. }
  27322. }
  27323. var tx = 0;
  27324. var ty = 0;
  27325. if (!font.vertical) {
  27326. var w0 = glyphWidth * textState.fontMatrix[0];
  27327. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  27328. width += tx;
  27329. } else {
  27330. var w1 = glyphWidth * textState.fontMatrix[0];
  27331. ty = w1 * textState.fontSize + charSpacing;
  27332. height += ty;
  27333. }
  27334. textState.translateTextMatrix(tx, ty);
  27335. textChunk.str.push(glyphUnicode);
  27336. }
  27337. if (!font.vertical) {
  27338. textChunk.lastAdvanceWidth = width;
  27339. textChunk.width += width;
  27340. } else {
  27341. textChunk.lastAdvanceHeight = height;
  27342. textChunk.height += Math.abs(height);
  27343. }
  27344. return textChunk;
  27345. }
  27346. function addFakeSpaces(width, strBuf) {
  27347. if (width < textContentItem.fakeSpaceMin) {
  27348. return;
  27349. }
  27350. if (width < textContentItem.fakeMultiSpaceMin) {
  27351. strBuf.push(' ');
  27352. return;
  27353. }
  27354. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  27355. while (fakeSpaces-- > 0) {
  27356. strBuf.push(' ');
  27357. }
  27358. }
  27359. function flushTextContentItem() {
  27360. if (!textContentItem.initialized) {
  27361. return;
  27362. }
  27363. textContentItem.width *= textContentItem.textAdvanceScale;
  27364. textContentItem.height *= textContentItem.textAdvanceScale;
  27365. textContent.items.push(runBidiTransform(textContentItem));
  27366. textContentItem.initialized = false;
  27367. textContentItem.str.length = 0;
  27368. }
  27369. var timeSlotManager = new TimeSlotManager();
  27370. return new Promise(function promiseBody(resolve, reject) {
  27371. var next = function (promise) {
  27372. promise.then(function () {
  27373. try {
  27374. promiseBody(resolve, reject);
  27375. } catch (ex) {
  27376. reject(ex);
  27377. }
  27378. }, reject);
  27379. };
  27380. task.ensureNotTerminated();
  27381. timeSlotManager.reset();
  27382. var stop, operation = {}, args = [];
  27383. while (!(stop = timeSlotManager.check())) {
  27384. args.length = 0;
  27385. operation.args = args;
  27386. if (!preprocessor.read(operation)) {
  27387. break;
  27388. }
  27389. textState = stateManager.state;
  27390. var fn = operation.fn;
  27391. args = operation.args;
  27392. var advance, diff;
  27393. switch (fn | 0) {
  27394. case OPS.setFont:
  27395. var fontNameArg = args[0].name, fontSizeArg = args[1];
  27396. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  27397. break;
  27398. }
  27399. flushTextContentItem();
  27400. textState.fontName = fontNameArg;
  27401. textState.fontSize = fontSizeArg;
  27402. next(handleSetFont(fontNameArg, null));
  27403. return;
  27404. case OPS.setTextRise:
  27405. flushTextContentItem();
  27406. textState.textRise = args[0];
  27407. break;
  27408. case OPS.setHScale:
  27409. flushTextContentItem();
  27410. textState.textHScale = args[0] / 100;
  27411. break;
  27412. case OPS.setLeading:
  27413. flushTextContentItem();
  27414. textState.leading = args[0];
  27415. break;
  27416. case OPS.moveText:
  27417. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  27418. advance = args[0] - args[1];
  27419. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  27420. textState.translateTextLineMatrix(args[0], args[1]);
  27421. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  27422. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  27423. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  27424. addFakeSpaces(diff, textContentItem.str);
  27425. break;
  27426. }
  27427. flushTextContentItem();
  27428. textState.translateTextLineMatrix(args[0], args[1]);
  27429. textState.textMatrix = textState.textLineMatrix.slice();
  27430. break;
  27431. case OPS.setLeadingMoveText:
  27432. flushTextContentItem();
  27433. textState.leading = -args[1];
  27434. textState.translateTextLineMatrix(args[0], args[1]);
  27435. textState.textMatrix = textState.textLineMatrix.slice();
  27436. break;
  27437. case OPS.nextLine:
  27438. flushTextContentItem();
  27439. textState.carriageReturn();
  27440. break;
  27441. case OPS.setTextMatrix:
  27442. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  27443. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  27444. textState.translateTextLineMatrix(advance.width, advance.height);
  27445. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  27446. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  27447. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  27448. addFakeSpaces(diff, textContentItem.str);
  27449. break;
  27450. }
  27451. flushTextContentItem();
  27452. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27453. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27454. break;
  27455. case OPS.setCharSpacing:
  27456. textState.charSpacing = args[0];
  27457. break;
  27458. case OPS.setWordSpacing:
  27459. textState.wordSpacing = args[0];
  27460. break;
  27461. case OPS.beginText:
  27462. flushTextContentItem();
  27463. textState.textMatrix = IDENTITY_MATRIX.slice();
  27464. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  27465. break;
  27466. case OPS.showSpacedText:
  27467. var items = args[0];
  27468. var offset;
  27469. for (var j = 0, jj = items.length; j < jj; j++) {
  27470. if (typeof items[j] === 'string') {
  27471. buildTextContentItem(items[j]);
  27472. } else if (isNum(items[j])) {
  27473. ensureTextContentItem();
  27474. advance = items[j] * textState.fontSize / 1000;
  27475. var breakTextRun = false;
  27476. if (textState.font.vertical) {
  27477. offset = advance;
  27478. textState.translateTextMatrix(0, offset);
  27479. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27480. if (!breakTextRun) {
  27481. textContentItem.height += offset;
  27482. }
  27483. } else {
  27484. advance = -advance;
  27485. offset = advance * textState.textHScale;
  27486. textState.translateTextMatrix(offset, 0);
  27487. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27488. if (!breakTextRun) {
  27489. textContentItem.width += offset;
  27490. }
  27491. }
  27492. if (breakTextRun) {
  27493. flushTextContentItem();
  27494. } else if (advance > 0) {
  27495. addFakeSpaces(advance, textContentItem.str);
  27496. }
  27497. }
  27498. }
  27499. break;
  27500. case OPS.showText:
  27501. buildTextContentItem(args[0]);
  27502. break;
  27503. case OPS.nextLineShowText:
  27504. flushTextContentItem();
  27505. textState.carriageReturn();
  27506. buildTextContentItem(args[0]);
  27507. break;
  27508. case OPS.nextLineSetSpacingShowText:
  27509. flushTextContentItem();
  27510. textState.wordSpacing = args[0];
  27511. textState.charSpacing = args[1];
  27512. textState.carriageReturn();
  27513. buildTextContentItem(args[2]);
  27514. break;
  27515. case OPS.paintXObject:
  27516. flushTextContentItem();
  27517. if (args[0].code) {
  27518. break;
  27519. }
  27520. if (!xobjs) {
  27521. xobjs = resources.get('XObject') || Dict.empty;
  27522. }
  27523. var name = args[0].name;
  27524. if (xobjsCache.key === name) {
  27525. if (xobjsCache.texts) {
  27526. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  27527. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  27528. }
  27529. break;
  27530. }
  27531. var xobj = xobjs.get(name);
  27532. if (!xobj) {
  27533. break;
  27534. }
  27535. assert(isStream(xobj), 'XObject should be a stream');
  27536. var type = xobj.dict.get('Subtype');
  27537. assert(isName(type), 'XObject should have a Name subtype');
  27538. if ('Form' !== type.name) {
  27539. xobjsCache.key = name;
  27540. xobjsCache.texts = null;
  27541. break;
  27542. }
  27543. stateManager.save();
  27544. var matrix = xobj.dict.getArray('Matrix');
  27545. if (isArray(matrix) && matrix.length === 6) {
  27546. stateManager.transform(matrix);
  27547. }
  27548. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  27549. Util.appendToArray(textContent.items, formTextContent.items);
  27550. Util.extendObj(textContent.styles, formTextContent.styles);
  27551. stateManager.restore();
  27552. xobjsCache.key = name;
  27553. xobjsCache.texts = formTextContent;
  27554. }));
  27555. return;
  27556. case OPS.setGState:
  27557. flushTextContentItem();
  27558. var dictName = args[0];
  27559. var extGState = resources.get('ExtGState');
  27560. if (!isDict(extGState) || !isName(dictName)) {
  27561. break;
  27562. }
  27563. var gState = extGState.get(dictName.name);
  27564. if (!isDict(gState)) {
  27565. break;
  27566. }
  27567. var gStateFont = gState.get('Font');
  27568. if (gStateFont) {
  27569. textState.fontName = null;
  27570. textState.fontSize = gStateFont[1];
  27571. next(handleSetFont(null, gStateFont[0]));
  27572. return;
  27573. }
  27574. break;
  27575. }
  27576. }
  27577. if (stop) {
  27578. next(deferred);
  27579. return;
  27580. }
  27581. flushTextContentItem();
  27582. resolve(textContent);
  27583. });
  27584. },
  27585. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  27586. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27587. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  27588. if (properties.composite) {
  27589. var cidSystemInfo = dict.get('CIDSystemInfo');
  27590. if (isDict(cidSystemInfo)) {
  27591. properties.cidSystemInfo = {
  27592. registry: cidSystemInfo.get('Registry'),
  27593. ordering: cidSystemInfo.get('Ordering'),
  27594. supplement: cidSystemInfo.get('Supplement')
  27595. };
  27596. }
  27597. var cidToGidMap = dict.get('CIDToGIDMap');
  27598. if (isStream(cidToGidMap)) {
  27599. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  27600. }
  27601. }
  27602. var differences = [];
  27603. var baseEncodingName = null;
  27604. var encoding;
  27605. if (dict.has('Encoding')) {
  27606. encoding = dict.get('Encoding');
  27607. if (isDict(encoding)) {
  27608. baseEncodingName = encoding.get('BaseEncoding');
  27609. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  27610. if (encoding.has('Differences')) {
  27611. var diffEncoding = encoding.get('Differences');
  27612. var index = 0;
  27613. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  27614. var data = xref.fetchIfRef(diffEncoding[j]);
  27615. if (isNum(data)) {
  27616. index = data;
  27617. } else if (isName(data)) {
  27618. differences[index++] = data.name;
  27619. } else {
  27620. error('Invalid entry in \'Differences\' array: ' + data);
  27621. }
  27622. }
  27623. }
  27624. } else if (isName(encoding)) {
  27625. baseEncodingName = encoding.name;
  27626. } else {
  27627. error('Encoding is not a Name nor a Dict');
  27628. }
  27629. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  27630. baseEncodingName = null;
  27631. }
  27632. }
  27633. if (baseEncodingName) {
  27634. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  27635. } else {
  27636. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27637. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  27638. encoding = StandardEncoding;
  27639. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  27640. encoding = WinAnsiEncoding;
  27641. }
  27642. if (isSymbolicFont) {
  27643. encoding = MacRomanEncoding;
  27644. if (!properties.file) {
  27645. if (/Symbol/i.test(properties.name)) {
  27646. encoding = SymbolSetEncoding;
  27647. } else if (/Dingbats/i.test(properties.name)) {
  27648. encoding = ZapfDingbatsEncoding;
  27649. }
  27650. }
  27651. }
  27652. properties.defaultEncoding = encoding;
  27653. }
  27654. properties.differences = differences;
  27655. properties.baseEncodingName = baseEncodingName;
  27656. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  27657. properties.dict = dict;
  27658. return toUnicodePromise.then(function (toUnicode) {
  27659. properties.toUnicode = toUnicode;
  27660. return this.buildToUnicode(properties);
  27661. }.bind(this)).then(function (toUnicode) {
  27662. properties.toUnicode = toUnicode;
  27663. return properties;
  27664. });
  27665. },
  27666. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  27667. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  27668. if (properties.hasIncludedToUnicodeMap) {
  27669. return Promise.resolve(properties.toUnicode);
  27670. }
  27671. var toUnicode, charcode, glyphName;
  27672. if (!properties.composite) {
  27673. toUnicode = [];
  27674. var encoding = properties.defaultEncoding.slice();
  27675. var baseEncodingName = properties.baseEncodingName;
  27676. var differences = properties.differences;
  27677. for (charcode in differences) {
  27678. glyphName = differences[charcode];
  27679. if (glyphName === '.notdef') {
  27680. continue;
  27681. }
  27682. encoding[charcode] = glyphName;
  27683. }
  27684. var glyphsUnicodeMap = getGlyphsUnicode();
  27685. for (charcode in encoding) {
  27686. glyphName = encoding[charcode];
  27687. if (glyphName === '') {
  27688. continue;
  27689. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  27690. var code = 0;
  27691. switch (glyphName[0]) {
  27692. case 'G':
  27693. if (glyphName.length === 3) {
  27694. code = parseInt(glyphName.substr(1), 16);
  27695. }
  27696. break;
  27697. case 'g':
  27698. if (glyphName.length === 5) {
  27699. code = parseInt(glyphName.substr(1), 16);
  27700. }
  27701. break;
  27702. case 'C':
  27703. case 'c':
  27704. if (glyphName.length >= 3) {
  27705. code = +glyphName.substr(1);
  27706. }
  27707. break;
  27708. default:
  27709. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  27710. if (unicode !== -1) {
  27711. code = unicode;
  27712. }
  27713. }
  27714. if (code) {
  27715. if (baseEncodingName && code === +charcode) {
  27716. var baseEncoding = getEncoding(baseEncodingName);
  27717. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  27718. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27719. continue;
  27720. }
  27721. }
  27722. toUnicode[charcode] = String.fromCharCode(code);
  27723. }
  27724. continue;
  27725. }
  27726. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27727. }
  27728. return Promise.resolve(new ToUnicodeMap(toUnicode));
  27729. }
  27730. 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'))) {
  27731. var registry = properties.cidSystemInfo.registry;
  27732. var ordering = properties.cidSystemInfo.ordering;
  27733. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  27734. return CMapFactory.create(ucs2CMapName, this.options.cMapOptions, null).then(function (ucs2CMap) {
  27735. var cMap = properties.cMap;
  27736. toUnicode = [];
  27737. cMap.forEach(function (charcode, cid) {
  27738. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  27739. var ucs2 = ucs2CMap.lookup(cid);
  27740. if (ucs2) {
  27741. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  27742. }
  27743. });
  27744. return new ToUnicodeMap(toUnicode);
  27745. });
  27746. }
  27747. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  27748. },
  27749. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  27750. var cmapObj = toUnicode;
  27751. if (isName(cmapObj)) {
  27752. return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) {
  27753. if (cmap instanceof IdentityCMap) {
  27754. return new IdentityToUnicodeMap(0, 0xFFFF);
  27755. }
  27756. return new ToUnicodeMap(cmap.getMap());
  27757. });
  27758. } else if (isStream(cmapObj)) {
  27759. return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) {
  27760. if (cmap instanceof IdentityCMap) {
  27761. return new IdentityToUnicodeMap(0, 0xFFFF);
  27762. }
  27763. var map = new Array(cmap.length);
  27764. cmap.forEach(function (charCode, token) {
  27765. var str = [];
  27766. for (var k = 0; k < token.length; k += 2) {
  27767. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27768. if ((w1 & 0xF800) !== 0xD800) {
  27769. str.push(w1);
  27770. continue;
  27771. }
  27772. k += 2;
  27773. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27774. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  27775. }
  27776. map[charCode] = String.fromCharCode.apply(String, str);
  27777. });
  27778. return new ToUnicodeMap(map);
  27779. });
  27780. }
  27781. return Promise.resolve(null);
  27782. },
  27783. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  27784. var glyphsData = cidToGidStream.getBytes();
  27785. var result = [];
  27786. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  27787. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  27788. if (glyphID === 0) {
  27789. continue;
  27790. }
  27791. var code = j >> 1;
  27792. result[code] = glyphID;
  27793. }
  27794. return result;
  27795. },
  27796. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  27797. var glyphsWidths = [];
  27798. var defaultWidth = 0;
  27799. var glyphsVMetrics = [];
  27800. var defaultVMetrics;
  27801. var i, ii, j, jj, start, code, widths;
  27802. if (properties.composite) {
  27803. defaultWidth = dict.get('DW') || 1000;
  27804. widths = dict.get('W');
  27805. if (widths) {
  27806. for (i = 0, ii = widths.length; i < ii; i++) {
  27807. start = xref.fetchIfRef(widths[i++]);
  27808. code = xref.fetchIfRef(widths[i]);
  27809. if (isArray(code)) {
  27810. for (j = 0, jj = code.length; j < jj; j++) {
  27811. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  27812. }
  27813. } else {
  27814. var width = xref.fetchIfRef(widths[++i]);
  27815. for (j = start; j <= code; j++) {
  27816. glyphsWidths[j] = width;
  27817. }
  27818. }
  27819. }
  27820. }
  27821. if (properties.vertical) {
  27822. var vmetrics = dict.getArray('DW2') || [
  27823. 880,
  27824. -1000
  27825. ];
  27826. defaultVMetrics = [
  27827. vmetrics[1],
  27828. defaultWidth * 0.5,
  27829. vmetrics[0]
  27830. ];
  27831. vmetrics = dict.get('W2');
  27832. if (vmetrics) {
  27833. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27834. start = xref.fetchIfRef(vmetrics[i++]);
  27835. code = xref.fetchIfRef(vmetrics[i]);
  27836. if (isArray(code)) {
  27837. for (j = 0, jj = code.length; j < jj; j++) {
  27838. glyphsVMetrics[start++] = [
  27839. xref.fetchIfRef(code[j++]),
  27840. xref.fetchIfRef(code[j++]),
  27841. xref.fetchIfRef(code[j])
  27842. ];
  27843. }
  27844. } else {
  27845. var vmetric = [
  27846. xref.fetchIfRef(vmetrics[++i]),
  27847. xref.fetchIfRef(vmetrics[++i]),
  27848. xref.fetchIfRef(vmetrics[++i])
  27849. ];
  27850. for (j = start; j <= code; j++) {
  27851. glyphsVMetrics[j] = vmetric;
  27852. }
  27853. }
  27854. }
  27855. }
  27856. }
  27857. } else {
  27858. var firstChar = properties.firstChar;
  27859. widths = dict.get('Widths');
  27860. if (widths) {
  27861. j = firstChar;
  27862. for (i = 0, ii = widths.length; i < ii; i++) {
  27863. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27864. }
  27865. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27866. } else {
  27867. var baseFontName = dict.get('BaseFont');
  27868. if (isName(baseFontName)) {
  27869. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27870. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27871. defaultWidth = metrics.defaultWidth;
  27872. }
  27873. }
  27874. }
  27875. var isMonospace = true;
  27876. var firstWidth = defaultWidth;
  27877. for (var glyph in glyphsWidths) {
  27878. var glyphWidth = glyphsWidths[glyph];
  27879. if (!glyphWidth) {
  27880. continue;
  27881. }
  27882. if (!firstWidth) {
  27883. firstWidth = glyphWidth;
  27884. continue;
  27885. }
  27886. if (firstWidth !== glyphWidth) {
  27887. isMonospace = false;
  27888. break;
  27889. }
  27890. }
  27891. if (isMonospace) {
  27892. properties.flags |= FontFlags.FixedPitch;
  27893. }
  27894. properties.defaultWidth = defaultWidth;
  27895. properties.widths = glyphsWidths;
  27896. properties.defaultVMetrics = defaultVMetrics;
  27897. properties.vmetrics = glyphsVMetrics;
  27898. },
  27899. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27900. var fontNameWoStyle = baseFontName.split('-')[0];
  27901. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27902. },
  27903. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27904. var defaultWidth = 0;
  27905. var widths = [];
  27906. var monospace = false;
  27907. var stdFontMap = getStdFontMap();
  27908. var lookupName = stdFontMap[name] || name;
  27909. var Metrics = getMetrics();
  27910. if (!(lookupName in Metrics)) {
  27911. if (this.isSerifFont(name)) {
  27912. lookupName = 'Times-Roman';
  27913. } else {
  27914. lookupName = 'Helvetica';
  27915. }
  27916. }
  27917. var glyphWidths = Metrics[lookupName];
  27918. if (isNum(glyphWidths)) {
  27919. defaultWidth = glyphWidths;
  27920. monospace = true;
  27921. } else {
  27922. widths = glyphWidths();
  27923. }
  27924. return {
  27925. defaultWidth: defaultWidth,
  27926. monospace: monospace,
  27927. widths: widths
  27928. };
  27929. },
  27930. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27931. var widths = Object.create(null);
  27932. var differences = properties.differences;
  27933. var encoding = properties.defaultEncoding;
  27934. for (var charCode = 0; charCode < 256; charCode++) {
  27935. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27936. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27937. continue;
  27938. }
  27939. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27940. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27941. continue;
  27942. }
  27943. }
  27944. return widths;
  27945. },
  27946. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27947. var baseDict = dict;
  27948. var type = dict.get('Subtype');
  27949. assert(isName(type), 'invalid font Subtype');
  27950. var composite = false;
  27951. var uint8array;
  27952. if (type.name === 'Type0') {
  27953. var df = dict.get('DescendantFonts');
  27954. if (!df) {
  27955. error('Descendant fonts are not specified');
  27956. }
  27957. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27958. type = dict.get('Subtype');
  27959. assert(isName(type), 'invalid font Subtype');
  27960. composite = true;
  27961. }
  27962. var descriptor = dict.get('FontDescriptor');
  27963. if (descriptor) {
  27964. var hash = new MurmurHash3_64();
  27965. var encoding = baseDict.getRaw('Encoding');
  27966. if (isName(encoding)) {
  27967. hash.update(encoding.name);
  27968. } else if (isRef(encoding)) {
  27969. hash.update(encoding.toString());
  27970. } else if (isDict(encoding)) {
  27971. var keys = encoding.getKeys();
  27972. for (var i = 0, ii = keys.length; i < ii; i++) {
  27973. var entry = encoding.getRaw(keys[i]);
  27974. if (isName(entry)) {
  27975. hash.update(entry.name);
  27976. } else if (isRef(entry)) {
  27977. hash.update(entry.toString());
  27978. } else if (isArray(entry)) {
  27979. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27980. for (var j = 0; j < diffLength; j++) {
  27981. var diffEntry = entry[j];
  27982. if (isName(diffEntry)) {
  27983. diffBuf[j] = diffEntry.name;
  27984. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27985. diffBuf[j] = diffEntry.toString();
  27986. }
  27987. }
  27988. hash.update(diffBuf.join());
  27989. }
  27990. }
  27991. }
  27992. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27993. if (isStream(toUnicode)) {
  27994. var stream = toUnicode.str || toUnicode;
  27995. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27996. hash.update(uint8array);
  27997. } else if (isName(toUnicode)) {
  27998. hash.update(toUnicode.name);
  27999. }
  28000. var widths = dict.get('Widths') || baseDict.get('Widths');
  28001. if (widths) {
  28002. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  28003. hash.update(uint8array);
  28004. }
  28005. }
  28006. return {
  28007. descriptor: descriptor,
  28008. dict: dict,
  28009. baseDict: baseDict,
  28010. composite: composite,
  28011. type: type.name,
  28012. hash: hash ? hash.hexdigest() : ''
  28013. };
  28014. },
  28015. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  28016. var baseDict = preEvaluatedFont.baseDict;
  28017. var dict = preEvaluatedFont.dict;
  28018. var composite = preEvaluatedFont.composite;
  28019. var descriptor = preEvaluatedFont.descriptor;
  28020. var type = preEvaluatedFont.type;
  28021. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  28022. var cMapOptions = this.options.cMapOptions;
  28023. var properties;
  28024. if (!descriptor) {
  28025. if (type === 'Type3') {
  28026. descriptor = new Dict(null);
  28027. descriptor.set('FontName', Name.get(type));
  28028. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  28029. } else {
  28030. var baseFontName = dict.get('BaseFont');
  28031. if (!isName(baseFontName)) {
  28032. error('Base font is not specified');
  28033. }
  28034. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  28035. var metrics = this.getBaseFontMetrics(baseFontName);
  28036. var fontNameWoStyle = baseFontName.split('-')[0];
  28037. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  28038. properties = {
  28039. type: type,
  28040. name: baseFontName,
  28041. widths: metrics.widths,
  28042. defaultWidth: metrics.defaultWidth,
  28043. flags: flags,
  28044. firstChar: 0,
  28045. lastChar: maxCharIndex
  28046. };
  28047. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  28048. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  28049. return new Font(baseFontName, null, properties);
  28050. }.bind(this));
  28051. }
  28052. }
  28053. var firstChar = dict.get('FirstChar') || 0;
  28054. var lastChar = dict.get('LastChar') || maxCharIndex;
  28055. var fontName = descriptor.get('FontName');
  28056. var baseFont = dict.get('BaseFont');
  28057. if (isString(fontName)) {
  28058. fontName = Name.get(fontName);
  28059. }
  28060. if (isString(baseFont)) {
  28061. baseFont = Name.get(baseFont);
  28062. }
  28063. if (type !== 'Type3') {
  28064. var fontNameStr = fontName && fontName.name;
  28065. var baseFontStr = baseFont && baseFont.name;
  28066. if (fontNameStr !== baseFontStr) {
  28067. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  28068. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  28069. fontName = baseFont;
  28070. }
  28071. }
  28072. }
  28073. fontName = fontName || baseFont;
  28074. assert(isName(fontName), 'invalid font name');
  28075. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  28076. if (fontFile) {
  28077. if (fontFile.dict) {
  28078. var subtype = fontFile.dict.get('Subtype');
  28079. if (subtype) {
  28080. subtype = subtype.name;
  28081. }
  28082. var length1 = fontFile.dict.get('Length1');
  28083. var length2 = fontFile.dict.get('Length2');
  28084. var length3 = fontFile.dict.get('Length3');
  28085. }
  28086. }
  28087. properties = {
  28088. type: type,
  28089. name: fontName.name,
  28090. subtype: subtype,
  28091. file: fontFile,
  28092. length1: length1,
  28093. length2: length2,
  28094. length3: length3,
  28095. loadedName: baseDict.loadedName,
  28096. composite: composite,
  28097. wideChars: composite,
  28098. fixedPitch: false,
  28099. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  28100. firstChar: firstChar || 0,
  28101. lastChar: lastChar || maxCharIndex,
  28102. bbox: descriptor.getArray('FontBBox'),
  28103. ascent: descriptor.get('Ascent'),
  28104. descent: descriptor.get('Descent'),
  28105. xHeight: descriptor.get('XHeight'),
  28106. capHeight: descriptor.get('CapHeight'),
  28107. flags: descriptor.get('Flags'),
  28108. italicAngle: descriptor.get('ItalicAngle'),
  28109. coded: false
  28110. };
  28111. var cMapPromise;
  28112. if (composite) {
  28113. var cidEncoding = baseDict.get('Encoding');
  28114. if (isName(cidEncoding)) {
  28115. properties.cidEncoding = cidEncoding.name;
  28116. }
  28117. cMapPromise = CMapFactory.create(cidEncoding, cMapOptions, null).then(function (cMap) {
  28118. properties.cMap = cMap;
  28119. properties.vertical = properties.cMap.vertical;
  28120. });
  28121. } else {
  28122. cMapPromise = Promise.resolve(undefined);
  28123. }
  28124. return cMapPromise.then(function () {
  28125. return this.extractDataStructures(dict, baseDict, xref, properties);
  28126. }.bind(this)).then(function (properties) {
  28127. this.extractWidths(dict, xref, descriptor, properties);
  28128. if (type === 'Type3') {
  28129. properties.isType3Font = true;
  28130. }
  28131. return new Font(fontName.name, fontFile, properties);
  28132. }.bind(this));
  28133. }
  28134. };
  28135. return PartialEvaluator;
  28136. }();
  28137. var TranslatedFont = function TranslatedFontClosure() {
  28138. function TranslatedFont(loadedName, font, dict) {
  28139. this.loadedName = loadedName;
  28140. this.font = font;
  28141. this.dict = dict;
  28142. this.type3Loaded = null;
  28143. this.sent = false;
  28144. }
  28145. TranslatedFont.prototype = {
  28146. send: function (handler) {
  28147. if (this.sent) {
  28148. return;
  28149. }
  28150. var fontData = this.font.exportData();
  28151. handler.send('commonobj', [
  28152. this.loadedName,
  28153. 'Font',
  28154. fontData
  28155. ]);
  28156. this.sent = true;
  28157. },
  28158. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  28159. assert(this.font.isType3Font);
  28160. if (this.type3Loaded) {
  28161. return this.type3Loaded;
  28162. }
  28163. var translatedFont = this.font;
  28164. var loadCharProcsPromise = Promise.resolve();
  28165. var charProcs = this.dict.get('CharProcs');
  28166. var fontResources = this.dict.get('Resources') || resources;
  28167. var charProcKeys = charProcs.getKeys();
  28168. var charProcOperatorList = Object.create(null);
  28169. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  28170. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  28171. var glyphStream = charProcs.get(key);
  28172. var operatorList = new OperatorList();
  28173. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  28174. charProcOperatorList[key] = operatorList.getIR();
  28175. parentOperatorList.addDependencies(operatorList.dependencies);
  28176. }, function (reason) {
  28177. warn('Type3 font resource \"' + key + '\" is not available');
  28178. var operatorList = new OperatorList();
  28179. charProcOperatorList[key] = operatorList.getIR();
  28180. });
  28181. }.bind(this, charProcKeys[i]));
  28182. }
  28183. this.type3Loaded = loadCharProcsPromise.then(function () {
  28184. translatedFont.charProcOperatorList = charProcOperatorList;
  28185. });
  28186. return this.type3Loaded;
  28187. }
  28188. };
  28189. return TranslatedFont;
  28190. }();
  28191. var OperatorList = function OperatorListClosure() {
  28192. var CHUNK_SIZE = 1000;
  28193. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  28194. function getTransfers(queue) {
  28195. var transfers = [];
  28196. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28197. for (var i = 0, ii = queue.length; i < ii; i++) {
  28198. switch (fnArray[i]) {
  28199. case OPS.paintInlineImageXObject:
  28200. case OPS.paintInlineImageXObjectGroup:
  28201. case OPS.paintImageMaskXObject:
  28202. var arg = argsArray[i][0];
  28203. if (!arg.cached) {
  28204. transfers.push(arg.data.buffer);
  28205. }
  28206. break;
  28207. }
  28208. }
  28209. return transfers;
  28210. }
  28211. function OperatorList(intent, messageHandler, pageIndex) {
  28212. this.messageHandler = messageHandler;
  28213. this.fnArray = [];
  28214. this.argsArray = [];
  28215. this.dependencies = Object.create(null);
  28216. this._totalLength = 0;
  28217. this.pageIndex = pageIndex;
  28218. this.intent = intent;
  28219. }
  28220. OperatorList.prototype = {
  28221. get length() {
  28222. return this.argsArray.length;
  28223. },
  28224. get totalLength() {
  28225. return this._totalLength + this.length;
  28226. },
  28227. addOp: function (fn, args) {
  28228. this.fnArray.push(fn);
  28229. this.argsArray.push(args);
  28230. if (this.messageHandler) {
  28231. if (this.fnArray.length >= CHUNK_SIZE) {
  28232. this.flush();
  28233. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  28234. this.flush();
  28235. }
  28236. }
  28237. },
  28238. addDependency: function (dependency) {
  28239. if (dependency in this.dependencies) {
  28240. return;
  28241. }
  28242. this.dependencies[dependency] = true;
  28243. this.addOp(OPS.dependency, [dependency]);
  28244. },
  28245. addDependencies: function (dependencies) {
  28246. for (var key in dependencies) {
  28247. this.addDependency(key);
  28248. }
  28249. },
  28250. addOpList: function (opList) {
  28251. Util.extendObj(this.dependencies, opList.dependencies);
  28252. for (var i = 0, ii = opList.length; i < ii; i++) {
  28253. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  28254. }
  28255. },
  28256. getIR: function () {
  28257. return {
  28258. fnArray: this.fnArray,
  28259. argsArray: this.argsArray,
  28260. length: this.length
  28261. };
  28262. },
  28263. flush: function (lastChunk) {
  28264. if (this.intent !== 'oplist') {
  28265. new QueueOptimizer().optimize(this);
  28266. }
  28267. var transfers = getTransfers(this);
  28268. var length = this.length;
  28269. this._totalLength += length;
  28270. this.messageHandler.send('RenderPageChunk', {
  28271. operatorList: {
  28272. fnArray: this.fnArray,
  28273. argsArray: this.argsArray,
  28274. lastChunk: lastChunk,
  28275. length: length
  28276. },
  28277. pageIndex: this.pageIndex,
  28278. intent: this.intent
  28279. }, transfers);
  28280. this.dependencies = Object.create(null);
  28281. this.fnArray.length = 0;
  28282. this.argsArray.length = 0;
  28283. }
  28284. };
  28285. return OperatorList;
  28286. }();
  28287. var StateManager = function StateManagerClosure() {
  28288. function StateManager(initialState) {
  28289. this.state = initialState;
  28290. this.stateStack = [];
  28291. }
  28292. StateManager.prototype = {
  28293. save: function () {
  28294. var old = this.state;
  28295. this.stateStack.push(this.state);
  28296. this.state = old.clone();
  28297. },
  28298. restore: function () {
  28299. var prev = this.stateStack.pop();
  28300. if (prev) {
  28301. this.state = prev;
  28302. }
  28303. },
  28304. transform: function (args) {
  28305. this.state.ctm = Util.transform(this.state.ctm, args);
  28306. }
  28307. };
  28308. return StateManager;
  28309. }();
  28310. var TextState = function TextStateClosure() {
  28311. function TextState() {
  28312. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28313. this.fontName = null;
  28314. this.fontSize = 0;
  28315. this.font = null;
  28316. this.fontMatrix = FONT_IDENTITY_MATRIX;
  28317. this.textMatrix = IDENTITY_MATRIX.slice();
  28318. this.textLineMatrix = IDENTITY_MATRIX.slice();
  28319. this.charSpacing = 0;
  28320. this.wordSpacing = 0;
  28321. this.leading = 0;
  28322. this.textHScale = 1;
  28323. this.textRise = 0;
  28324. }
  28325. TextState.prototype = {
  28326. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28327. var m = this.textMatrix;
  28328. m[0] = a;
  28329. m[1] = b;
  28330. m[2] = c;
  28331. m[3] = d;
  28332. m[4] = e;
  28333. m[5] = f;
  28334. },
  28335. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28336. var m = this.textLineMatrix;
  28337. m[0] = a;
  28338. m[1] = b;
  28339. m[2] = c;
  28340. m[3] = d;
  28341. m[4] = e;
  28342. m[5] = f;
  28343. },
  28344. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  28345. var m = this.textMatrix;
  28346. m[4] = m[0] * x + m[2] * y + m[4];
  28347. m[5] = m[1] * x + m[3] * y + m[5];
  28348. },
  28349. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  28350. var m = this.textLineMatrix;
  28351. m[4] = m[0] * x + m[2] * y + m[4];
  28352. m[5] = m[1] * x + m[3] * y + m[5];
  28353. },
  28354. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  28355. var font = this.font;
  28356. if (!font) {
  28357. return null;
  28358. }
  28359. var m = this.textLineMatrix;
  28360. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  28361. return null;
  28362. }
  28363. var txDiff = e - m[4], tyDiff = f - m[5];
  28364. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  28365. return null;
  28366. }
  28367. var tx, ty, denominator = a * d - b * c;
  28368. if (font.vertical) {
  28369. tx = -tyDiff * c / denominator;
  28370. ty = tyDiff * a / denominator;
  28371. } else {
  28372. tx = txDiff * d / denominator;
  28373. ty = -txDiff * b / denominator;
  28374. }
  28375. return {
  28376. width: tx,
  28377. height: ty,
  28378. value: font.vertical ? ty : tx
  28379. };
  28380. },
  28381. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  28382. var tsm = [
  28383. this.fontSize * this.textHScale,
  28384. 0,
  28385. 0,
  28386. this.fontSize,
  28387. 0,
  28388. this.textRise
  28389. ];
  28390. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  28391. },
  28392. carriageReturn: function TextState_carriageReturn() {
  28393. this.translateTextLineMatrix(0, -this.leading);
  28394. this.textMatrix = this.textLineMatrix.slice();
  28395. },
  28396. clone: function TextState_clone() {
  28397. var clone = Object.create(this);
  28398. clone.textMatrix = this.textMatrix.slice();
  28399. clone.textLineMatrix = this.textLineMatrix.slice();
  28400. clone.fontMatrix = this.fontMatrix.slice();
  28401. return clone;
  28402. }
  28403. };
  28404. return TextState;
  28405. }();
  28406. var EvalState = function EvalStateClosure() {
  28407. function EvalState() {
  28408. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28409. this.font = null;
  28410. this.textRenderingMode = TextRenderingMode.FILL;
  28411. this.fillColorSpace = ColorSpace.singletons.gray;
  28412. this.strokeColorSpace = ColorSpace.singletons.gray;
  28413. }
  28414. EvalState.prototype = {
  28415. clone: function CanvasExtraState_clone() {
  28416. return Object.create(this);
  28417. }
  28418. };
  28419. return EvalState;
  28420. }();
  28421. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  28422. var getOPMap = getLookupTableFactory(function (t) {
  28423. t['w'] = {
  28424. id: OPS.setLineWidth,
  28425. numArgs: 1,
  28426. variableArgs: false
  28427. };
  28428. t['J'] = {
  28429. id: OPS.setLineCap,
  28430. numArgs: 1,
  28431. variableArgs: false
  28432. };
  28433. t['j'] = {
  28434. id: OPS.setLineJoin,
  28435. numArgs: 1,
  28436. variableArgs: false
  28437. };
  28438. t['M'] = {
  28439. id: OPS.setMiterLimit,
  28440. numArgs: 1,
  28441. variableArgs: false
  28442. };
  28443. t['d'] = {
  28444. id: OPS.setDash,
  28445. numArgs: 2,
  28446. variableArgs: false
  28447. };
  28448. t['ri'] = {
  28449. id: OPS.setRenderingIntent,
  28450. numArgs: 1,
  28451. variableArgs: false
  28452. };
  28453. t['i'] = {
  28454. id: OPS.setFlatness,
  28455. numArgs: 1,
  28456. variableArgs: false
  28457. };
  28458. t['gs'] = {
  28459. id: OPS.setGState,
  28460. numArgs: 1,
  28461. variableArgs: false
  28462. };
  28463. t['q'] = {
  28464. id: OPS.save,
  28465. numArgs: 0,
  28466. variableArgs: false
  28467. };
  28468. t['Q'] = {
  28469. id: OPS.restore,
  28470. numArgs: 0,
  28471. variableArgs: false
  28472. };
  28473. t['cm'] = {
  28474. id: OPS.transform,
  28475. numArgs: 6,
  28476. variableArgs: false
  28477. };
  28478. t['m'] = {
  28479. id: OPS.moveTo,
  28480. numArgs: 2,
  28481. variableArgs: false
  28482. };
  28483. t['l'] = {
  28484. id: OPS.lineTo,
  28485. numArgs: 2,
  28486. variableArgs: false
  28487. };
  28488. t['c'] = {
  28489. id: OPS.curveTo,
  28490. numArgs: 6,
  28491. variableArgs: false
  28492. };
  28493. t['v'] = {
  28494. id: OPS.curveTo2,
  28495. numArgs: 4,
  28496. variableArgs: false
  28497. };
  28498. t['y'] = {
  28499. id: OPS.curveTo3,
  28500. numArgs: 4,
  28501. variableArgs: false
  28502. };
  28503. t['h'] = {
  28504. id: OPS.closePath,
  28505. numArgs: 0,
  28506. variableArgs: false
  28507. };
  28508. t['re'] = {
  28509. id: OPS.rectangle,
  28510. numArgs: 4,
  28511. variableArgs: false
  28512. };
  28513. t['S'] = {
  28514. id: OPS.stroke,
  28515. numArgs: 0,
  28516. variableArgs: false
  28517. };
  28518. t['s'] = {
  28519. id: OPS.closeStroke,
  28520. numArgs: 0,
  28521. variableArgs: false
  28522. };
  28523. t['f'] = {
  28524. id: OPS.fill,
  28525. numArgs: 0,
  28526. variableArgs: false
  28527. };
  28528. t['F'] = {
  28529. id: OPS.fill,
  28530. numArgs: 0,
  28531. variableArgs: false
  28532. };
  28533. t['f*'] = {
  28534. id: OPS.eoFill,
  28535. numArgs: 0,
  28536. variableArgs: false
  28537. };
  28538. t['B'] = {
  28539. id: OPS.fillStroke,
  28540. numArgs: 0,
  28541. variableArgs: false
  28542. };
  28543. t['B*'] = {
  28544. id: OPS.eoFillStroke,
  28545. numArgs: 0,
  28546. variableArgs: false
  28547. };
  28548. t['b'] = {
  28549. id: OPS.closeFillStroke,
  28550. numArgs: 0,
  28551. variableArgs: false
  28552. };
  28553. t['b*'] = {
  28554. id: OPS.closeEOFillStroke,
  28555. numArgs: 0,
  28556. variableArgs: false
  28557. };
  28558. t['n'] = {
  28559. id: OPS.endPath,
  28560. numArgs: 0,
  28561. variableArgs: false
  28562. };
  28563. t['W'] = {
  28564. id: OPS.clip,
  28565. numArgs: 0,
  28566. variableArgs: false
  28567. };
  28568. t['W*'] = {
  28569. id: OPS.eoClip,
  28570. numArgs: 0,
  28571. variableArgs: false
  28572. };
  28573. t['BT'] = {
  28574. id: OPS.beginText,
  28575. numArgs: 0,
  28576. variableArgs: false
  28577. };
  28578. t['ET'] = {
  28579. id: OPS.endText,
  28580. numArgs: 0,
  28581. variableArgs: false
  28582. };
  28583. t['Tc'] = {
  28584. id: OPS.setCharSpacing,
  28585. numArgs: 1,
  28586. variableArgs: false
  28587. };
  28588. t['Tw'] = {
  28589. id: OPS.setWordSpacing,
  28590. numArgs: 1,
  28591. variableArgs: false
  28592. };
  28593. t['Tz'] = {
  28594. id: OPS.setHScale,
  28595. numArgs: 1,
  28596. variableArgs: false
  28597. };
  28598. t['TL'] = {
  28599. id: OPS.setLeading,
  28600. numArgs: 1,
  28601. variableArgs: false
  28602. };
  28603. t['Tf'] = {
  28604. id: OPS.setFont,
  28605. numArgs: 2,
  28606. variableArgs: false
  28607. };
  28608. t['Tr'] = {
  28609. id: OPS.setTextRenderingMode,
  28610. numArgs: 1,
  28611. variableArgs: false
  28612. };
  28613. t['Ts'] = {
  28614. id: OPS.setTextRise,
  28615. numArgs: 1,
  28616. variableArgs: false
  28617. };
  28618. t['Td'] = {
  28619. id: OPS.moveText,
  28620. numArgs: 2,
  28621. variableArgs: false
  28622. };
  28623. t['TD'] = {
  28624. id: OPS.setLeadingMoveText,
  28625. numArgs: 2,
  28626. variableArgs: false
  28627. };
  28628. t['Tm'] = {
  28629. id: OPS.setTextMatrix,
  28630. numArgs: 6,
  28631. variableArgs: false
  28632. };
  28633. t['T*'] = {
  28634. id: OPS.nextLine,
  28635. numArgs: 0,
  28636. variableArgs: false
  28637. };
  28638. t['Tj'] = {
  28639. id: OPS.showText,
  28640. numArgs: 1,
  28641. variableArgs: false
  28642. };
  28643. t['TJ'] = {
  28644. id: OPS.showSpacedText,
  28645. numArgs: 1,
  28646. variableArgs: false
  28647. };
  28648. t['\''] = {
  28649. id: OPS.nextLineShowText,
  28650. numArgs: 1,
  28651. variableArgs: false
  28652. };
  28653. t['"'] = {
  28654. id: OPS.nextLineSetSpacingShowText,
  28655. numArgs: 3,
  28656. variableArgs: false
  28657. };
  28658. t['d0'] = {
  28659. id: OPS.setCharWidth,
  28660. numArgs: 2,
  28661. variableArgs: false
  28662. };
  28663. t['d1'] = {
  28664. id: OPS.setCharWidthAndBounds,
  28665. numArgs: 6,
  28666. variableArgs: false
  28667. };
  28668. t['CS'] = {
  28669. id: OPS.setStrokeColorSpace,
  28670. numArgs: 1,
  28671. variableArgs: false
  28672. };
  28673. t['cs'] = {
  28674. id: OPS.setFillColorSpace,
  28675. numArgs: 1,
  28676. variableArgs: false
  28677. };
  28678. t['SC'] = {
  28679. id: OPS.setStrokeColor,
  28680. numArgs: 4,
  28681. variableArgs: true
  28682. };
  28683. t['SCN'] = {
  28684. id: OPS.setStrokeColorN,
  28685. numArgs: 33,
  28686. variableArgs: true
  28687. };
  28688. t['sc'] = {
  28689. id: OPS.setFillColor,
  28690. numArgs: 4,
  28691. variableArgs: true
  28692. };
  28693. t['scn'] = {
  28694. id: OPS.setFillColorN,
  28695. numArgs: 33,
  28696. variableArgs: true
  28697. };
  28698. t['G'] = {
  28699. id: OPS.setStrokeGray,
  28700. numArgs: 1,
  28701. variableArgs: false
  28702. };
  28703. t['g'] = {
  28704. id: OPS.setFillGray,
  28705. numArgs: 1,
  28706. variableArgs: false
  28707. };
  28708. t['RG'] = {
  28709. id: OPS.setStrokeRGBColor,
  28710. numArgs: 3,
  28711. variableArgs: false
  28712. };
  28713. t['rg'] = {
  28714. id: OPS.setFillRGBColor,
  28715. numArgs: 3,
  28716. variableArgs: false
  28717. };
  28718. t['K'] = {
  28719. id: OPS.setStrokeCMYKColor,
  28720. numArgs: 4,
  28721. variableArgs: false
  28722. };
  28723. t['k'] = {
  28724. id: OPS.setFillCMYKColor,
  28725. numArgs: 4,
  28726. variableArgs: false
  28727. };
  28728. t['sh'] = {
  28729. id: OPS.shadingFill,
  28730. numArgs: 1,
  28731. variableArgs: false
  28732. };
  28733. t['BI'] = {
  28734. id: OPS.beginInlineImage,
  28735. numArgs: 0,
  28736. variableArgs: false
  28737. };
  28738. t['ID'] = {
  28739. id: OPS.beginImageData,
  28740. numArgs: 0,
  28741. variableArgs: false
  28742. };
  28743. t['EI'] = {
  28744. id: OPS.endInlineImage,
  28745. numArgs: 1,
  28746. variableArgs: false
  28747. };
  28748. t['Do'] = {
  28749. id: OPS.paintXObject,
  28750. numArgs: 1,
  28751. variableArgs: false
  28752. };
  28753. t['MP'] = {
  28754. id: OPS.markPoint,
  28755. numArgs: 1,
  28756. variableArgs: false
  28757. };
  28758. t['DP'] = {
  28759. id: OPS.markPointProps,
  28760. numArgs: 2,
  28761. variableArgs: false
  28762. };
  28763. t['BMC'] = {
  28764. id: OPS.beginMarkedContent,
  28765. numArgs: 1,
  28766. variableArgs: false
  28767. };
  28768. t['BDC'] = {
  28769. id: OPS.beginMarkedContentProps,
  28770. numArgs: 2,
  28771. variableArgs: false
  28772. };
  28773. t['EMC'] = {
  28774. id: OPS.endMarkedContent,
  28775. numArgs: 0,
  28776. variableArgs: false
  28777. };
  28778. t['BX'] = {
  28779. id: OPS.beginCompat,
  28780. numArgs: 0,
  28781. variableArgs: false
  28782. };
  28783. t['EX'] = {
  28784. id: OPS.endCompat,
  28785. numArgs: 0,
  28786. variableArgs: false
  28787. };
  28788. t['BM'] = null;
  28789. t['BD'] = null;
  28790. t['true'] = null;
  28791. t['fa'] = null;
  28792. t['fal'] = null;
  28793. t['fals'] = null;
  28794. t['false'] = null;
  28795. t['nu'] = null;
  28796. t['nul'] = null;
  28797. t['null'] = null;
  28798. });
  28799. function EvaluatorPreprocessor(stream, xref, stateManager) {
  28800. this.opMap = getOPMap();
  28801. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  28802. this.stateManager = stateManager;
  28803. this.nonProcessedArgs = [];
  28804. }
  28805. EvaluatorPreprocessor.prototype = {
  28806. get savedStatesDepth() {
  28807. return this.stateManager.stateStack.length;
  28808. },
  28809. read: function EvaluatorPreprocessor_read(operation) {
  28810. var args = operation.args;
  28811. while (true) {
  28812. var obj = this.parser.getObj();
  28813. if (isCmd(obj)) {
  28814. var cmd = obj.cmd;
  28815. var opSpec = this.opMap[cmd];
  28816. if (!opSpec) {
  28817. warn('Unknown command "' + cmd + '"');
  28818. continue;
  28819. }
  28820. var fn = opSpec.id;
  28821. var numArgs = opSpec.numArgs;
  28822. var argsLength = args !== null ? args.length : 0;
  28823. if (!opSpec.variableArgs) {
  28824. if (argsLength !== numArgs) {
  28825. var nonProcessedArgs = this.nonProcessedArgs;
  28826. while (argsLength > numArgs) {
  28827. nonProcessedArgs.push(args.shift());
  28828. argsLength--;
  28829. }
  28830. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28831. if (args === null) {
  28832. args = [];
  28833. }
  28834. args.unshift(nonProcessedArgs.pop());
  28835. argsLength++;
  28836. }
  28837. }
  28838. if (argsLength < numArgs) {
  28839. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28840. if (args !== null) {
  28841. args.length = 0;
  28842. }
  28843. continue;
  28844. }
  28845. } else if (argsLength > numArgs) {
  28846. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28847. }
  28848. this.preprocessCommand(fn, args);
  28849. operation.fn = fn;
  28850. operation.args = args;
  28851. return true;
  28852. }
  28853. if (isEOF(obj)) {
  28854. return false;
  28855. }
  28856. if (obj !== null) {
  28857. if (args === null) {
  28858. args = [];
  28859. }
  28860. args.push(obj);
  28861. assert(args.length <= 33, 'Too many arguments');
  28862. }
  28863. }
  28864. },
  28865. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28866. switch (fn | 0) {
  28867. case OPS.save:
  28868. this.stateManager.save();
  28869. break;
  28870. case OPS.restore:
  28871. this.stateManager.restore();
  28872. break;
  28873. case OPS.transform:
  28874. this.stateManager.transform(args);
  28875. break;
  28876. }
  28877. }
  28878. };
  28879. return EvaluatorPreprocessor;
  28880. }();
  28881. var QueueOptimizer = function QueueOptimizerClosure() {
  28882. function addState(parentState, pattern, fn) {
  28883. var state = parentState;
  28884. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28885. var item = pattern[i];
  28886. state = state[item] || (state[item] = []);
  28887. }
  28888. state[pattern[pattern.length - 1]] = fn;
  28889. }
  28890. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28891. var iFirstPIMXO = iFirstSave + 2;
  28892. for (var i = 0; i < count; i++) {
  28893. var arg = argsArray[iFirstPIMXO + 4 * i];
  28894. var imageMask = arg.length === 1 && arg[0];
  28895. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28896. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28897. continue;
  28898. }
  28899. break;
  28900. }
  28901. return count - i;
  28902. }
  28903. var InitialState = [];
  28904. addState(InitialState, [
  28905. OPS.save,
  28906. OPS.transform,
  28907. OPS.paintInlineImageXObject,
  28908. OPS.restore
  28909. ], function foundInlineImageGroup(context) {
  28910. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28911. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28912. var MAX_WIDTH = 1000;
  28913. var IMAGE_PADDING = 1;
  28914. var fnArray = context.fnArray, argsArray = context.argsArray;
  28915. var curr = context.iCurr;
  28916. var iFirstSave = curr - 3;
  28917. var iFirstTransform = curr - 2;
  28918. var iFirstPIIXO = curr - 1;
  28919. var i = iFirstSave + 4;
  28920. var ii = fnArray.length;
  28921. while (i + 3 < ii) {
  28922. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28923. break;
  28924. }
  28925. i += 4;
  28926. }
  28927. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28928. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28929. return i;
  28930. }
  28931. var maxX = 0;
  28932. var map = [], maxLineHeight = 0;
  28933. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28934. var q;
  28935. for (q = 0; q < count; q++) {
  28936. var transform = argsArray[iFirstTransform + (q << 2)];
  28937. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28938. if (currentX + img.width > MAX_WIDTH) {
  28939. maxX = Math.max(maxX, currentX);
  28940. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28941. currentX = 0;
  28942. maxLineHeight = 0;
  28943. }
  28944. map.push({
  28945. transform: transform,
  28946. x: currentX,
  28947. y: currentY,
  28948. w: img.width,
  28949. h: img.height
  28950. });
  28951. currentX += img.width + 2 * IMAGE_PADDING;
  28952. maxLineHeight = Math.max(maxLineHeight, img.height);
  28953. }
  28954. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28955. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28956. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28957. var imgRowSize = imgWidth << 2;
  28958. for (q = 0; q < count; q++) {
  28959. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28960. var rowSize = map[q].w << 2;
  28961. var dataOffset = 0;
  28962. var offset = map[q].x + map[q].y * imgWidth << 2;
  28963. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28964. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28965. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28966. dataOffset += rowSize;
  28967. offset += imgRowSize;
  28968. }
  28969. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28970. while (offset >= 0) {
  28971. data[offset - 4] = data[offset];
  28972. data[offset - 3] = data[offset + 1];
  28973. data[offset - 2] = data[offset + 2];
  28974. data[offset - 1] = data[offset + 3];
  28975. data[offset + rowSize] = data[offset + rowSize - 4];
  28976. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28977. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28978. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28979. offset -= imgRowSize;
  28980. }
  28981. }
  28982. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28983. argsArray.splice(iFirstSave, count * 4, [
  28984. {
  28985. width: imgWidth,
  28986. height: imgHeight,
  28987. kind: ImageKind.RGBA_32BPP,
  28988. data: imgData
  28989. },
  28990. map
  28991. ]);
  28992. return iFirstSave + 1;
  28993. });
  28994. addState(InitialState, [
  28995. OPS.save,
  28996. OPS.transform,
  28997. OPS.paintImageMaskXObject,
  28998. OPS.restore
  28999. ], function foundImageMaskGroup(context) {
  29000. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  29001. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  29002. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  29003. var fnArray = context.fnArray, argsArray = context.argsArray;
  29004. var curr = context.iCurr;
  29005. var iFirstSave = curr - 3;
  29006. var iFirstTransform = curr - 2;
  29007. var iFirstPIMXO = curr - 1;
  29008. var i = iFirstSave + 4;
  29009. var ii = fnArray.length;
  29010. while (i + 3 < ii) {
  29011. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  29012. break;
  29013. }
  29014. i += 4;
  29015. }
  29016. var count = (i - iFirstSave) / 4;
  29017. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  29018. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  29019. return i;
  29020. }
  29021. var q;
  29022. var isSameImage = false;
  29023. var iTransform, transformArgs;
  29024. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  29025. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  29026. isSameImage = true;
  29027. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29028. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29029. iTransform = iFirstTransform + 4;
  29030. var iPIMXO = iFirstPIMXO + 4;
  29031. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  29032. transformArgs = argsArray[iTransform];
  29033. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  29034. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  29035. isSameImage = false;
  29036. } else {
  29037. count = q;
  29038. }
  29039. break;
  29040. }
  29041. }
  29042. }
  29043. if (isSameImage) {
  29044. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  29045. var positions = new Float32Array(count * 2);
  29046. iTransform = iFirstTransform;
  29047. for (q = 0; q < count; q++, iTransform += 4) {
  29048. transformArgs = argsArray[iTransform];
  29049. positions[q << 1] = transformArgs[4];
  29050. positions[(q << 1) + 1] = transformArgs[5];
  29051. }
  29052. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  29053. argsArray.splice(iFirstSave, count * 4, [
  29054. firstPIMXOArg0,
  29055. firstTransformArg0,
  29056. firstTransformArg3,
  29057. positions
  29058. ]);
  29059. } else {
  29060. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  29061. var images = [];
  29062. for (q = 0; q < count; q++) {
  29063. transformArgs = argsArray[iFirstTransform + (q << 2)];
  29064. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  29065. images.push({
  29066. data: maskParams.data,
  29067. width: maskParams.width,
  29068. height: maskParams.height,
  29069. transform: transformArgs
  29070. });
  29071. }
  29072. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  29073. argsArray.splice(iFirstSave, count * 4, [images]);
  29074. }
  29075. return iFirstSave + 1;
  29076. });
  29077. addState(InitialState, [
  29078. OPS.save,
  29079. OPS.transform,
  29080. OPS.paintImageXObject,
  29081. OPS.restore
  29082. ], function (context) {
  29083. var MIN_IMAGES_IN_BLOCK = 3;
  29084. var MAX_IMAGES_IN_BLOCK = 1000;
  29085. var fnArray = context.fnArray, argsArray = context.argsArray;
  29086. var curr = context.iCurr;
  29087. var iFirstSave = curr - 3;
  29088. var iFirstTransform = curr - 2;
  29089. var iFirstPIXO = curr - 1;
  29090. var iFirstRestore = curr;
  29091. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  29092. return iFirstRestore + 1;
  29093. }
  29094. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  29095. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29096. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29097. var i = iFirstSave + 4;
  29098. var ii = fnArray.length;
  29099. while (i + 3 < ii) {
  29100. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  29101. break;
  29102. }
  29103. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  29104. break;
  29105. }
  29106. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  29107. break;
  29108. }
  29109. i += 4;
  29110. }
  29111. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  29112. if (count < MIN_IMAGES_IN_BLOCK) {
  29113. return i;
  29114. }
  29115. var positions = new Float32Array(count * 2);
  29116. var iTransform = iFirstTransform;
  29117. for (var q = 0; q < count; q++, iTransform += 4) {
  29118. var transformArgs = argsArray[iTransform];
  29119. positions[q << 1] = transformArgs[4];
  29120. positions[(q << 1) + 1] = transformArgs[5];
  29121. }
  29122. var args = [
  29123. firstPIXOArg0,
  29124. firstTransformArg0,
  29125. firstTransformArg3,
  29126. positions
  29127. ];
  29128. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  29129. argsArray.splice(iFirstSave, count * 4, args);
  29130. return iFirstSave + 1;
  29131. });
  29132. addState(InitialState, [
  29133. OPS.beginText,
  29134. OPS.setFont,
  29135. OPS.setTextMatrix,
  29136. OPS.showText,
  29137. OPS.endText
  29138. ], function (context) {
  29139. var MIN_CHARS_IN_BLOCK = 3;
  29140. var MAX_CHARS_IN_BLOCK = 1000;
  29141. var fnArray = context.fnArray, argsArray = context.argsArray;
  29142. var curr = context.iCurr;
  29143. var iFirstBeginText = curr - 4;
  29144. var iFirstSetFont = curr - 3;
  29145. var iFirstSetTextMatrix = curr - 2;
  29146. var iFirstShowText = curr - 1;
  29147. var iFirstEndText = curr;
  29148. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  29149. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  29150. var i = iFirstBeginText + 5;
  29151. var ii = fnArray.length;
  29152. while (i + 4 < ii) {
  29153. 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) {
  29154. break;
  29155. }
  29156. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  29157. break;
  29158. }
  29159. i += 5;
  29160. }
  29161. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  29162. if (count < MIN_CHARS_IN_BLOCK) {
  29163. return i;
  29164. }
  29165. var iFirst = iFirstBeginText;
  29166. 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) {
  29167. count++;
  29168. iFirst -= 5;
  29169. }
  29170. var iEndText = iFirst + 4;
  29171. for (var q = 1; q < count; q++) {
  29172. fnArray.splice(iEndText, 3);
  29173. argsArray.splice(iEndText, 3);
  29174. iEndText += 2;
  29175. }
  29176. return iEndText + 1;
  29177. });
  29178. function QueueOptimizer() {
  29179. }
  29180. QueueOptimizer.prototype = {
  29181. optimize: function QueueOptimizer_optimize(queue) {
  29182. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  29183. var context = {
  29184. iCurr: 0,
  29185. fnArray: fnArray,
  29186. argsArray: argsArray
  29187. };
  29188. var state;
  29189. var i = 0, ii = fnArray.length;
  29190. while (i < ii) {
  29191. state = (state || InitialState)[fnArray[i]];
  29192. if (typeof state === 'function') {
  29193. context.iCurr = i;
  29194. i = state(context);
  29195. state = undefined;
  29196. ii = context.fnArray.length;
  29197. } else {
  29198. i++;
  29199. }
  29200. }
  29201. }
  29202. };
  29203. return QueueOptimizer;
  29204. }();
  29205. exports.OperatorList = OperatorList;
  29206. exports.PartialEvaluator = PartialEvaluator;
  29207. /***/ }),
  29208. /* 14 */
  29209. /***/ (function(module, exports, __w_pdfjs_require__) {
  29210. "use strict";
  29211. var sharedUtil = __w_pdfjs_require__(0);
  29212. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  29213. var info = sharedUtil.info;
  29214. var warn = sharedUtil.warn;
  29215. var error = sharedUtil.error;
  29216. var log2 = sharedUtil.log2;
  29217. var readUint16 = sharedUtil.readUint16;
  29218. var readUint32 = sharedUtil.readUint32;
  29219. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  29220. var JpxImage = function JpxImageClosure() {
  29221. var SubbandsGainLog2 = {
  29222. 'LL': 0,
  29223. 'LH': 1,
  29224. 'HL': 1,
  29225. 'HH': 2
  29226. };
  29227. function JpxImage() {
  29228. this.failOnCorruptedImage = false;
  29229. }
  29230. JpxImage.prototype = {
  29231. parse: function JpxImage_parse(data) {
  29232. var head = readUint16(data, 0);
  29233. if (head === 0xFF4F) {
  29234. this.parseCodestream(data, 0, data.length);
  29235. return;
  29236. }
  29237. var position = 0, length = data.length;
  29238. while (position < length) {
  29239. var headerSize = 8;
  29240. var lbox = readUint32(data, position);
  29241. var tbox = readUint32(data, position + 4);
  29242. position += headerSize;
  29243. if (lbox === 1) {
  29244. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  29245. position += 8;
  29246. headerSize += 8;
  29247. }
  29248. if (lbox === 0) {
  29249. lbox = length - position + headerSize;
  29250. }
  29251. if (lbox < headerSize) {
  29252. error('JPX Error: Invalid box field size');
  29253. }
  29254. var dataLength = lbox - headerSize;
  29255. var jumpDataLength = true;
  29256. switch (tbox) {
  29257. case 0x6A703268:
  29258. jumpDataLength = false;
  29259. break;
  29260. case 0x636F6C72:
  29261. var method = data[position];
  29262. if (method === 1) {
  29263. var colorspace = readUint32(data, position + 3);
  29264. switch (colorspace) {
  29265. case 16:
  29266. case 17:
  29267. case 18:
  29268. break;
  29269. default:
  29270. warn('Unknown colorspace ' + colorspace);
  29271. break;
  29272. }
  29273. } else if (method === 2) {
  29274. info('ICC profile not supported');
  29275. }
  29276. break;
  29277. case 0x6A703263:
  29278. this.parseCodestream(data, position, position + dataLength);
  29279. break;
  29280. case 0x6A502020:
  29281. if (0x0d0a870a !== readUint32(data, position)) {
  29282. warn('Invalid JP2 signature');
  29283. }
  29284. break;
  29285. case 0x6A501A1A:
  29286. case 0x66747970:
  29287. case 0x72726571:
  29288. case 0x72657320:
  29289. case 0x69686472:
  29290. break;
  29291. default:
  29292. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  29293. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  29294. break;
  29295. }
  29296. if (jumpDataLength) {
  29297. position += dataLength;
  29298. }
  29299. }
  29300. },
  29301. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  29302. var newByte = stream.getByte();
  29303. while (newByte >= 0) {
  29304. var oldByte = newByte;
  29305. newByte = stream.getByte();
  29306. var code = oldByte << 8 | newByte;
  29307. if (code === 0xFF51) {
  29308. stream.skip(4);
  29309. var Xsiz = stream.getInt32() >>> 0;
  29310. var Ysiz = stream.getInt32() >>> 0;
  29311. var XOsiz = stream.getInt32() >>> 0;
  29312. var YOsiz = stream.getInt32() >>> 0;
  29313. stream.skip(16);
  29314. var Csiz = stream.getUint16();
  29315. this.width = Xsiz - XOsiz;
  29316. this.height = Ysiz - YOsiz;
  29317. this.componentsCount = Csiz;
  29318. this.bitsPerComponent = 8;
  29319. return;
  29320. }
  29321. }
  29322. error('JPX Error: No size marker found in JPX stream');
  29323. },
  29324. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  29325. var context = {};
  29326. var doNotRecover = false;
  29327. try {
  29328. var position = start;
  29329. while (position + 1 < end) {
  29330. var code = readUint16(data, position);
  29331. position += 2;
  29332. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  29333. switch (code) {
  29334. case 0xFF4F:
  29335. context.mainHeader = true;
  29336. break;
  29337. case 0xFFD9:
  29338. break;
  29339. case 0xFF51:
  29340. length = readUint16(data, position);
  29341. var siz = {};
  29342. siz.Xsiz = readUint32(data, position + 4);
  29343. siz.Ysiz = readUint32(data, position + 8);
  29344. siz.XOsiz = readUint32(data, position + 12);
  29345. siz.YOsiz = readUint32(data, position + 16);
  29346. siz.XTsiz = readUint32(data, position + 20);
  29347. siz.YTsiz = readUint32(data, position + 24);
  29348. siz.XTOsiz = readUint32(data, position + 28);
  29349. siz.YTOsiz = readUint32(data, position + 32);
  29350. var componentsCount = readUint16(data, position + 36);
  29351. siz.Csiz = componentsCount;
  29352. var components = [];
  29353. j = position + 38;
  29354. for (var i = 0; i < componentsCount; i++) {
  29355. var component = {
  29356. precision: (data[j] & 0x7F) + 1,
  29357. isSigned: !!(data[j] & 0x80),
  29358. XRsiz: data[j + 1],
  29359. YRsiz: data[j + 1]
  29360. };
  29361. calculateComponentDimensions(component, siz);
  29362. components.push(component);
  29363. }
  29364. context.SIZ = siz;
  29365. context.components = components;
  29366. calculateTileGrids(context, components);
  29367. context.QCC = [];
  29368. context.COC = [];
  29369. break;
  29370. case 0xFF5C:
  29371. length = readUint16(data, position);
  29372. var qcd = {};
  29373. j = position + 2;
  29374. sqcd = data[j++];
  29375. switch (sqcd & 0x1F) {
  29376. case 0:
  29377. spqcdSize = 8;
  29378. scalarExpounded = true;
  29379. break;
  29380. case 1:
  29381. spqcdSize = 16;
  29382. scalarExpounded = false;
  29383. break;
  29384. case 2:
  29385. spqcdSize = 16;
  29386. scalarExpounded = true;
  29387. break;
  29388. default:
  29389. throw new Error('Invalid SQcd value ' + sqcd);
  29390. }
  29391. qcd.noQuantization = spqcdSize === 8;
  29392. qcd.scalarExpounded = scalarExpounded;
  29393. qcd.guardBits = sqcd >> 5;
  29394. spqcds = [];
  29395. while (j < length + position) {
  29396. var spqcd = {};
  29397. if (spqcdSize === 8) {
  29398. spqcd.epsilon = data[j++] >> 3;
  29399. spqcd.mu = 0;
  29400. } else {
  29401. spqcd.epsilon = data[j] >> 3;
  29402. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29403. j += 2;
  29404. }
  29405. spqcds.push(spqcd);
  29406. }
  29407. qcd.SPqcds = spqcds;
  29408. if (context.mainHeader) {
  29409. context.QCD = qcd;
  29410. } else {
  29411. context.currentTile.QCD = qcd;
  29412. context.currentTile.QCC = [];
  29413. }
  29414. break;
  29415. case 0xFF5D:
  29416. length = readUint16(data, position);
  29417. var qcc = {};
  29418. j = position + 2;
  29419. var cqcc;
  29420. if (context.SIZ.Csiz < 257) {
  29421. cqcc = data[j++];
  29422. } else {
  29423. cqcc = readUint16(data, j);
  29424. j += 2;
  29425. }
  29426. sqcd = data[j++];
  29427. switch (sqcd & 0x1F) {
  29428. case 0:
  29429. spqcdSize = 8;
  29430. scalarExpounded = true;
  29431. break;
  29432. case 1:
  29433. spqcdSize = 16;
  29434. scalarExpounded = false;
  29435. break;
  29436. case 2:
  29437. spqcdSize = 16;
  29438. scalarExpounded = true;
  29439. break;
  29440. default:
  29441. throw new Error('Invalid SQcd value ' + sqcd);
  29442. }
  29443. qcc.noQuantization = spqcdSize === 8;
  29444. qcc.scalarExpounded = scalarExpounded;
  29445. qcc.guardBits = sqcd >> 5;
  29446. spqcds = [];
  29447. while (j < length + position) {
  29448. spqcd = {};
  29449. if (spqcdSize === 8) {
  29450. spqcd.epsilon = data[j++] >> 3;
  29451. spqcd.mu = 0;
  29452. } else {
  29453. spqcd.epsilon = data[j] >> 3;
  29454. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29455. j += 2;
  29456. }
  29457. spqcds.push(spqcd);
  29458. }
  29459. qcc.SPqcds = spqcds;
  29460. if (context.mainHeader) {
  29461. context.QCC[cqcc] = qcc;
  29462. } else {
  29463. context.currentTile.QCC[cqcc] = qcc;
  29464. }
  29465. break;
  29466. case 0xFF52:
  29467. length = readUint16(data, position);
  29468. var cod = {};
  29469. j = position + 2;
  29470. var scod = data[j++];
  29471. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  29472. cod.sopMarkerUsed = !!(scod & 2);
  29473. cod.ephMarkerUsed = !!(scod & 4);
  29474. cod.progressionOrder = data[j++];
  29475. cod.layersCount = readUint16(data, j);
  29476. j += 2;
  29477. cod.multipleComponentTransform = data[j++];
  29478. cod.decompositionLevelsCount = data[j++];
  29479. cod.xcb = (data[j++] & 0xF) + 2;
  29480. cod.ycb = (data[j++] & 0xF) + 2;
  29481. var blockStyle = data[j++];
  29482. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  29483. cod.resetContextProbabilities = !!(blockStyle & 2);
  29484. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  29485. cod.verticalyStripe = !!(blockStyle & 8);
  29486. cod.predictableTermination = !!(blockStyle & 16);
  29487. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  29488. cod.reversibleTransformation = data[j++];
  29489. if (cod.entropyCoderWithCustomPrecincts) {
  29490. var precinctsSizes = [];
  29491. while (j < length + position) {
  29492. var precinctsSize = data[j++];
  29493. precinctsSizes.push({
  29494. PPx: precinctsSize & 0xF,
  29495. PPy: precinctsSize >> 4
  29496. });
  29497. }
  29498. cod.precinctsSizes = precinctsSizes;
  29499. }
  29500. var unsupported = [];
  29501. if (cod.selectiveArithmeticCodingBypass) {
  29502. unsupported.push('selectiveArithmeticCodingBypass');
  29503. }
  29504. if (cod.resetContextProbabilities) {
  29505. unsupported.push('resetContextProbabilities');
  29506. }
  29507. if (cod.terminationOnEachCodingPass) {
  29508. unsupported.push('terminationOnEachCodingPass');
  29509. }
  29510. if (cod.verticalyStripe) {
  29511. unsupported.push('verticalyStripe');
  29512. }
  29513. if (cod.predictableTermination) {
  29514. unsupported.push('predictableTermination');
  29515. }
  29516. if (unsupported.length > 0) {
  29517. doNotRecover = true;
  29518. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  29519. }
  29520. if (context.mainHeader) {
  29521. context.COD = cod;
  29522. } else {
  29523. context.currentTile.COD = cod;
  29524. context.currentTile.COC = [];
  29525. }
  29526. break;
  29527. case 0xFF90:
  29528. length = readUint16(data, position);
  29529. tile = {};
  29530. tile.index = readUint16(data, position + 2);
  29531. tile.length = readUint32(data, position + 4);
  29532. tile.dataEnd = tile.length + position - 2;
  29533. tile.partIndex = data[position + 8];
  29534. tile.partsCount = data[position + 9];
  29535. context.mainHeader = false;
  29536. if (tile.partIndex === 0) {
  29537. tile.COD = context.COD;
  29538. tile.COC = context.COC.slice(0);
  29539. tile.QCD = context.QCD;
  29540. tile.QCC = context.QCC.slice(0);
  29541. }
  29542. context.currentTile = tile;
  29543. break;
  29544. case 0xFF93:
  29545. tile = context.currentTile;
  29546. if (tile.partIndex === 0) {
  29547. initializeTile(context, tile.index);
  29548. buildPackets(context);
  29549. }
  29550. length = tile.dataEnd - position;
  29551. parseTilePackets(context, data, position, length);
  29552. break;
  29553. case 0xFF55:
  29554. case 0xFF57:
  29555. case 0xFF58:
  29556. case 0xFF64:
  29557. length = readUint16(data, position);
  29558. break;
  29559. case 0xFF53:
  29560. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  29561. default:
  29562. throw new Error('Unknown codestream code: ' + code.toString(16));
  29563. }
  29564. position += length;
  29565. }
  29566. } catch (e) {
  29567. if (doNotRecover || this.failOnCorruptedImage) {
  29568. error('JPX Error: ' + e.message);
  29569. } else {
  29570. warn('JPX: Trying to recover from: ' + e.message);
  29571. }
  29572. }
  29573. this.tiles = transformComponents(context);
  29574. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  29575. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  29576. this.componentsCount = context.SIZ.Csiz;
  29577. }
  29578. };
  29579. function calculateComponentDimensions(component, siz) {
  29580. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  29581. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  29582. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  29583. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  29584. component.width = component.x1 - component.x0;
  29585. component.height = component.y1 - component.y0;
  29586. }
  29587. function calculateTileGrids(context, components) {
  29588. var siz = context.SIZ;
  29589. var tile, tiles = [];
  29590. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  29591. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  29592. for (var q = 0; q < numYtiles; q++) {
  29593. for (var p = 0; p < numXtiles; p++) {
  29594. tile = {};
  29595. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  29596. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  29597. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  29598. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  29599. tile.width = tile.tx1 - tile.tx0;
  29600. tile.height = tile.ty1 - tile.ty0;
  29601. tile.components = [];
  29602. tiles.push(tile);
  29603. }
  29604. }
  29605. context.tiles = tiles;
  29606. var componentsCount = siz.Csiz;
  29607. for (var i = 0, ii = componentsCount; i < ii; i++) {
  29608. var component = components[i];
  29609. for (var j = 0, jj = tiles.length; j < jj; j++) {
  29610. var tileComponent = {};
  29611. tile = tiles[j];
  29612. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  29613. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  29614. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  29615. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  29616. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  29617. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  29618. tile.components[i] = tileComponent;
  29619. }
  29620. }
  29621. }
  29622. function getBlocksDimensions(context, component, r) {
  29623. var codOrCoc = component.codingStyleParameters;
  29624. var result = {};
  29625. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  29626. result.PPx = 15;
  29627. result.PPy = 15;
  29628. } else {
  29629. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  29630. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  29631. }
  29632. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  29633. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  29634. return result;
  29635. }
  29636. function buildPrecincts(context, resolution, dimensions) {
  29637. var precinctWidth = 1 << dimensions.PPx;
  29638. var precinctHeight = 1 << dimensions.PPy;
  29639. var isZeroRes = resolution.resLevel === 0;
  29640. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  29641. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  29642. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  29643. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  29644. var numprecincts = numprecinctswide * numprecinctshigh;
  29645. resolution.precinctParameters = {
  29646. precinctWidth: precinctWidth,
  29647. precinctHeight: precinctHeight,
  29648. numprecinctswide: numprecinctswide,
  29649. numprecinctshigh: numprecinctshigh,
  29650. numprecincts: numprecincts,
  29651. precinctWidthInSubband: precinctWidthInSubband,
  29652. precinctHeightInSubband: precinctHeightInSubband
  29653. };
  29654. }
  29655. function buildCodeblocks(context, subband, dimensions) {
  29656. var xcb_ = dimensions.xcb_;
  29657. var ycb_ = dimensions.ycb_;
  29658. var codeblockWidth = 1 << xcb_;
  29659. var codeblockHeight = 1 << ycb_;
  29660. var cbx0 = subband.tbx0 >> xcb_;
  29661. var cby0 = subband.tby0 >> ycb_;
  29662. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  29663. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  29664. var precinctParameters = subband.resolution.precinctParameters;
  29665. var codeblocks = [];
  29666. var precincts = [];
  29667. var i, j, codeblock, precinctNumber;
  29668. for (j = cby0; j < cby1; j++) {
  29669. for (i = cbx0; i < cbx1; i++) {
  29670. codeblock = {
  29671. cbx: i,
  29672. cby: j,
  29673. tbx0: codeblockWidth * i,
  29674. tby0: codeblockHeight * j,
  29675. tbx1: codeblockWidth * (i + 1),
  29676. tby1: codeblockHeight * (j + 1)
  29677. };
  29678. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  29679. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  29680. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  29681. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  29682. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  29683. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  29684. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  29685. codeblock.precinctNumber = precinctNumber;
  29686. codeblock.subbandType = subband.type;
  29687. codeblock.Lblock = 3;
  29688. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  29689. continue;
  29690. }
  29691. codeblocks.push(codeblock);
  29692. var precinct = precincts[precinctNumber];
  29693. if (precinct !== undefined) {
  29694. if (i < precinct.cbxMin) {
  29695. precinct.cbxMin = i;
  29696. } else if (i > precinct.cbxMax) {
  29697. precinct.cbxMax = i;
  29698. }
  29699. if (j < precinct.cbyMin) {
  29700. precinct.cbxMin = j;
  29701. } else if (j > precinct.cbyMax) {
  29702. precinct.cbyMax = j;
  29703. }
  29704. } else {
  29705. precincts[precinctNumber] = precinct = {
  29706. cbxMin: i,
  29707. cbyMin: j,
  29708. cbxMax: i,
  29709. cbyMax: j
  29710. };
  29711. }
  29712. codeblock.precinct = precinct;
  29713. }
  29714. }
  29715. subband.codeblockParameters = {
  29716. codeblockWidth: xcb_,
  29717. codeblockHeight: ycb_,
  29718. numcodeblockwide: cbx1 - cbx0 + 1,
  29719. numcodeblockhigh: cby1 - cby0 + 1
  29720. };
  29721. subband.codeblocks = codeblocks;
  29722. subband.precincts = precincts;
  29723. }
  29724. function createPacket(resolution, precinctNumber, layerNumber) {
  29725. var precinctCodeblocks = [];
  29726. var subbands = resolution.subbands;
  29727. for (var i = 0, ii = subbands.length; i < ii; i++) {
  29728. var subband = subbands[i];
  29729. var codeblocks = subband.codeblocks;
  29730. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  29731. var codeblock = codeblocks[j];
  29732. if (codeblock.precinctNumber !== precinctNumber) {
  29733. continue;
  29734. }
  29735. precinctCodeblocks.push(codeblock);
  29736. }
  29737. }
  29738. return {
  29739. layerNumber: layerNumber,
  29740. codeblocks: precinctCodeblocks
  29741. };
  29742. }
  29743. function LayerResolutionComponentPositionIterator(context) {
  29744. var siz = context.SIZ;
  29745. var tileIndex = context.currentTile.index;
  29746. var tile = context.tiles[tileIndex];
  29747. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29748. var componentsCount = siz.Csiz;
  29749. var maxDecompositionLevelsCount = 0;
  29750. for (var q = 0; q < componentsCount; q++) {
  29751. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29752. }
  29753. var l = 0, r = 0, i = 0, k = 0;
  29754. this.nextPacket = function JpxImage_nextPacket() {
  29755. for (; l < layersCount; l++) {
  29756. for (; r <= maxDecompositionLevelsCount; r++) {
  29757. for (; i < componentsCount; i++) {
  29758. var component = tile.components[i];
  29759. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29760. continue;
  29761. }
  29762. var resolution = component.resolutions[r];
  29763. var numprecincts = resolution.precinctParameters.numprecincts;
  29764. for (; k < numprecincts;) {
  29765. var packet = createPacket(resolution, k, l);
  29766. k++;
  29767. return packet;
  29768. }
  29769. k = 0;
  29770. }
  29771. i = 0;
  29772. }
  29773. r = 0;
  29774. }
  29775. error('JPX Error: Out of packets');
  29776. };
  29777. }
  29778. function ResolutionLayerComponentPositionIterator(context) {
  29779. var siz = context.SIZ;
  29780. var tileIndex = context.currentTile.index;
  29781. var tile = context.tiles[tileIndex];
  29782. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29783. var componentsCount = siz.Csiz;
  29784. var maxDecompositionLevelsCount = 0;
  29785. for (var q = 0; q < componentsCount; q++) {
  29786. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29787. }
  29788. var r = 0, l = 0, i = 0, k = 0;
  29789. this.nextPacket = function JpxImage_nextPacket() {
  29790. for (; r <= maxDecompositionLevelsCount; r++) {
  29791. for (; l < layersCount; l++) {
  29792. for (; i < componentsCount; i++) {
  29793. var component = tile.components[i];
  29794. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29795. continue;
  29796. }
  29797. var resolution = component.resolutions[r];
  29798. var numprecincts = resolution.precinctParameters.numprecincts;
  29799. for (; k < numprecincts;) {
  29800. var packet = createPacket(resolution, k, l);
  29801. k++;
  29802. return packet;
  29803. }
  29804. k = 0;
  29805. }
  29806. i = 0;
  29807. }
  29808. l = 0;
  29809. }
  29810. error('JPX Error: Out of packets');
  29811. };
  29812. }
  29813. function ResolutionPositionComponentLayerIterator(context) {
  29814. var siz = context.SIZ;
  29815. var tileIndex = context.currentTile.index;
  29816. var tile = context.tiles[tileIndex];
  29817. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29818. var componentsCount = siz.Csiz;
  29819. var l, r, c, p;
  29820. var maxDecompositionLevelsCount = 0;
  29821. for (c = 0; c < componentsCount; c++) {
  29822. var component = tile.components[c];
  29823. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29824. }
  29825. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29826. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29827. var maxNumPrecincts = 0;
  29828. for (c = 0; c < componentsCount; ++c) {
  29829. var resolutions = tile.components[c].resolutions;
  29830. if (r < resolutions.length) {
  29831. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29832. }
  29833. }
  29834. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29835. }
  29836. l = 0;
  29837. r = 0;
  29838. c = 0;
  29839. p = 0;
  29840. this.nextPacket = function JpxImage_nextPacket() {
  29841. for (; r <= maxDecompositionLevelsCount; r++) {
  29842. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29843. for (; c < componentsCount; c++) {
  29844. var component = tile.components[c];
  29845. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29846. continue;
  29847. }
  29848. var resolution = component.resolutions[r];
  29849. var numprecincts = resolution.precinctParameters.numprecincts;
  29850. if (p >= numprecincts) {
  29851. continue;
  29852. }
  29853. for (; l < layersCount;) {
  29854. var packet = createPacket(resolution, p, l);
  29855. l++;
  29856. return packet;
  29857. }
  29858. l = 0;
  29859. }
  29860. c = 0;
  29861. }
  29862. p = 0;
  29863. }
  29864. error('JPX Error: Out of packets');
  29865. };
  29866. }
  29867. function PositionComponentResolutionLayerIterator(context) {
  29868. var siz = context.SIZ;
  29869. var tileIndex = context.currentTile.index;
  29870. var tile = context.tiles[tileIndex];
  29871. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29872. var componentsCount = siz.Csiz;
  29873. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29874. var precinctsIterationSizes = precinctsSizes;
  29875. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29876. this.nextPacket = function JpxImage_nextPacket() {
  29877. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29878. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29879. for (; c < componentsCount; c++) {
  29880. var component = tile.components[c];
  29881. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29882. for (; r <= decompositionLevelsCount; r++) {
  29883. var resolution = component.resolutions[r];
  29884. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29885. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29886. if (k === null) {
  29887. continue;
  29888. }
  29889. for (; l < layersCount;) {
  29890. var packet = createPacket(resolution, k, l);
  29891. l++;
  29892. return packet;
  29893. }
  29894. l = 0;
  29895. }
  29896. r = 0;
  29897. }
  29898. c = 0;
  29899. }
  29900. px = 0;
  29901. }
  29902. error('JPX Error: Out of packets');
  29903. };
  29904. }
  29905. function ComponentPositionResolutionLayerIterator(context) {
  29906. var siz = context.SIZ;
  29907. var tileIndex = context.currentTile.index;
  29908. var tile = context.tiles[tileIndex];
  29909. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29910. var componentsCount = siz.Csiz;
  29911. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29912. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29913. this.nextPacket = function JpxImage_nextPacket() {
  29914. for (; c < componentsCount; ++c) {
  29915. var component = tile.components[c];
  29916. var precinctsIterationSizes = precinctsSizes.components[c];
  29917. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29918. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29919. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29920. for (; r <= decompositionLevelsCount; r++) {
  29921. var resolution = component.resolutions[r];
  29922. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29923. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29924. if (k === null) {
  29925. continue;
  29926. }
  29927. for (; l < layersCount;) {
  29928. var packet = createPacket(resolution, k, l);
  29929. l++;
  29930. return packet;
  29931. }
  29932. l = 0;
  29933. }
  29934. r = 0;
  29935. }
  29936. px = 0;
  29937. }
  29938. py = 0;
  29939. }
  29940. error('JPX Error: Out of packets');
  29941. };
  29942. }
  29943. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29944. var posX = pxIndex * precinctIterationSizes.minWidth;
  29945. var posY = pyIndex * precinctIterationSizes.minHeight;
  29946. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29947. return null;
  29948. }
  29949. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29950. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29951. }
  29952. function getPrecinctSizesInImageScale(tile) {
  29953. var componentsCount = tile.components.length;
  29954. var minWidth = Number.MAX_VALUE;
  29955. var minHeight = Number.MAX_VALUE;
  29956. var maxNumWide = 0;
  29957. var maxNumHigh = 0;
  29958. var sizePerComponent = new Array(componentsCount);
  29959. for (var c = 0; c < componentsCount; c++) {
  29960. var component = tile.components[c];
  29961. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29962. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29963. var minWidthCurrentComponent = Number.MAX_VALUE;
  29964. var minHeightCurrentComponent = Number.MAX_VALUE;
  29965. var maxNumWideCurrentComponent = 0;
  29966. var maxNumHighCurrentComponent = 0;
  29967. var scale = 1;
  29968. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29969. var resolution = component.resolutions[r];
  29970. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29971. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29972. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29973. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29974. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29975. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29976. sizePerResolution[r] = {
  29977. width: widthCurrentResolution,
  29978. height: heightCurrentResolution
  29979. };
  29980. scale <<= 1;
  29981. }
  29982. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29983. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29984. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29985. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29986. sizePerComponent[c] = {
  29987. resolutions: sizePerResolution,
  29988. minWidth: minWidthCurrentComponent,
  29989. minHeight: minHeightCurrentComponent,
  29990. maxNumWide: maxNumWideCurrentComponent,
  29991. maxNumHigh: maxNumHighCurrentComponent
  29992. };
  29993. }
  29994. return {
  29995. components: sizePerComponent,
  29996. minWidth: minWidth,
  29997. minHeight: minHeight,
  29998. maxNumWide: maxNumWide,
  29999. maxNumHigh: maxNumHigh
  30000. };
  30001. }
  30002. function buildPackets(context) {
  30003. var siz = context.SIZ;
  30004. var tileIndex = context.currentTile.index;
  30005. var tile = context.tiles[tileIndex];
  30006. var componentsCount = siz.Csiz;
  30007. for (var c = 0; c < componentsCount; c++) {
  30008. var component = tile.components[c];
  30009. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30010. var resolutions = [];
  30011. var subbands = [];
  30012. for (var r = 0; r <= decompositionLevelsCount; r++) {
  30013. var blocksDimensions = getBlocksDimensions(context, component, r);
  30014. var resolution = {};
  30015. var scale = 1 << decompositionLevelsCount - r;
  30016. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30017. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30018. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30019. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30020. resolution.resLevel = r;
  30021. buildPrecincts(context, resolution, blocksDimensions);
  30022. resolutions.push(resolution);
  30023. var subband;
  30024. if (r === 0) {
  30025. subband = {};
  30026. subband.type = 'LL';
  30027. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30028. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30029. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30030. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30031. subband.resolution = resolution;
  30032. buildCodeblocks(context, subband, blocksDimensions);
  30033. subbands.push(subband);
  30034. resolution.subbands = [subband];
  30035. } else {
  30036. var bscale = 1 << decompositionLevelsCount - r + 1;
  30037. var resolutionSubbands = [];
  30038. subband = {};
  30039. subband.type = 'HL';
  30040. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30041. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30042. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30043. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30044. subband.resolution = resolution;
  30045. buildCodeblocks(context, subband, blocksDimensions);
  30046. subbands.push(subband);
  30047. resolutionSubbands.push(subband);
  30048. subband = {};
  30049. subband.type = 'LH';
  30050. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30051. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30052. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30053. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30054. subband.resolution = resolution;
  30055. buildCodeblocks(context, subband, blocksDimensions);
  30056. subbands.push(subband);
  30057. resolutionSubbands.push(subband);
  30058. subband = {};
  30059. subband.type = 'HH';
  30060. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30061. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30062. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30063. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30064. subband.resolution = resolution;
  30065. buildCodeblocks(context, subband, blocksDimensions);
  30066. subbands.push(subband);
  30067. resolutionSubbands.push(subband);
  30068. resolution.subbands = resolutionSubbands;
  30069. }
  30070. }
  30071. component.resolutions = resolutions;
  30072. component.subbands = subbands;
  30073. }
  30074. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30075. switch (progressionOrder) {
  30076. case 0:
  30077. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30078. break;
  30079. case 1:
  30080. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30081. break;
  30082. case 2:
  30083. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30084. break;
  30085. case 3:
  30086. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30087. break;
  30088. case 4:
  30089. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30090. break;
  30091. default:
  30092. error('JPX Error: Unsupported progression order ' + progressionOrder);
  30093. }
  30094. }
  30095. function parseTilePackets(context, data, offset, dataLength) {
  30096. var position = 0;
  30097. var buffer, bufferSize = 0, skipNextBit = false;
  30098. function readBits(count) {
  30099. while (bufferSize < count) {
  30100. var b = data[offset + position];
  30101. position++;
  30102. if (skipNextBit) {
  30103. buffer = buffer << 7 | b;
  30104. bufferSize += 7;
  30105. skipNextBit = false;
  30106. } else {
  30107. buffer = buffer << 8 | b;
  30108. bufferSize += 8;
  30109. }
  30110. if (b === 0xFF) {
  30111. skipNextBit = true;
  30112. }
  30113. }
  30114. bufferSize -= count;
  30115. return buffer >>> bufferSize & (1 << count) - 1;
  30116. }
  30117. function skipMarkerIfEqual(value) {
  30118. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  30119. skipBytes(1);
  30120. return true;
  30121. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  30122. skipBytes(2);
  30123. return true;
  30124. }
  30125. return false;
  30126. }
  30127. function skipBytes(count) {
  30128. position += count;
  30129. }
  30130. function alignToByte() {
  30131. bufferSize = 0;
  30132. if (skipNextBit) {
  30133. position++;
  30134. skipNextBit = false;
  30135. }
  30136. }
  30137. function readCodingpasses() {
  30138. if (readBits(1) === 0) {
  30139. return 1;
  30140. }
  30141. if (readBits(1) === 0) {
  30142. return 2;
  30143. }
  30144. var value = readBits(2);
  30145. if (value < 3) {
  30146. return value + 3;
  30147. }
  30148. value = readBits(5);
  30149. if (value < 31) {
  30150. return value + 6;
  30151. }
  30152. value = readBits(7);
  30153. return value + 37;
  30154. }
  30155. var tileIndex = context.currentTile.index;
  30156. var tile = context.tiles[tileIndex];
  30157. var sopMarkerUsed = context.COD.sopMarkerUsed;
  30158. var ephMarkerUsed = context.COD.ephMarkerUsed;
  30159. var packetsIterator = tile.packetsIterator;
  30160. while (position < dataLength) {
  30161. alignToByte();
  30162. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30163. skipBytes(4);
  30164. }
  30165. var packet = packetsIterator.nextPacket();
  30166. if (!readBits(1)) {
  30167. continue;
  30168. }
  30169. var layerNumber = packet.layerNumber;
  30170. var queue = [], codeblock;
  30171. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30172. codeblock = packet.codeblocks[i];
  30173. var precinct = codeblock.precinct;
  30174. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30175. var codeblockRow = codeblock.cby - precinct.cbyMin;
  30176. var codeblockIncluded = false;
  30177. var firstTimeInclusion = false;
  30178. var valueReady;
  30179. if (codeblock['included'] !== undefined) {
  30180. codeblockIncluded = !!readBits(1);
  30181. } else {
  30182. precinct = codeblock.precinct;
  30183. var inclusionTree, zeroBitPlanesTree;
  30184. if (precinct['inclusionTree'] !== undefined) {
  30185. inclusionTree = precinct.inclusionTree;
  30186. } else {
  30187. var width = precinct.cbxMax - precinct.cbxMin + 1;
  30188. var height = precinct.cbyMax - precinct.cbyMin + 1;
  30189. inclusionTree = new InclusionTree(width, height, layerNumber);
  30190. zeroBitPlanesTree = new TagTree(width, height);
  30191. precinct.inclusionTree = inclusionTree;
  30192. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30193. }
  30194. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30195. while (true) {
  30196. if (readBits(1)) {
  30197. valueReady = !inclusionTree.nextLevel();
  30198. if (valueReady) {
  30199. codeblock.included = true;
  30200. codeblockIncluded = firstTimeInclusion = true;
  30201. break;
  30202. }
  30203. } else {
  30204. inclusionTree.incrementValue(layerNumber);
  30205. break;
  30206. }
  30207. }
  30208. }
  30209. }
  30210. if (!codeblockIncluded) {
  30211. continue;
  30212. }
  30213. if (firstTimeInclusion) {
  30214. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30215. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30216. while (true) {
  30217. if (readBits(1)) {
  30218. valueReady = !zeroBitPlanesTree.nextLevel();
  30219. if (valueReady) {
  30220. break;
  30221. }
  30222. } else {
  30223. zeroBitPlanesTree.incrementValue();
  30224. }
  30225. }
  30226. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30227. }
  30228. var codingpasses = readCodingpasses();
  30229. while (readBits(1)) {
  30230. codeblock.Lblock++;
  30231. }
  30232. var codingpassesLog2 = log2(codingpasses);
  30233. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30234. var codedDataLength = readBits(bits);
  30235. queue.push({
  30236. codeblock: codeblock,
  30237. codingpasses: codingpasses,
  30238. dataLength: codedDataLength
  30239. });
  30240. }
  30241. alignToByte();
  30242. if (ephMarkerUsed) {
  30243. skipMarkerIfEqual(0x92);
  30244. }
  30245. while (queue.length > 0) {
  30246. var packetItem = queue.shift();
  30247. codeblock = packetItem.codeblock;
  30248. if (codeblock['data'] === undefined) {
  30249. codeblock.data = [];
  30250. }
  30251. codeblock.data.push({
  30252. data: data,
  30253. start: offset + position,
  30254. end: offset + position + packetItem.dataLength,
  30255. codingpasses: packetItem.codingpasses
  30256. });
  30257. position += packetItem.dataLength;
  30258. }
  30259. }
  30260. return position;
  30261. }
  30262. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30263. var x0 = subband.tbx0;
  30264. var y0 = subband.tby0;
  30265. var width = subband.tbx1 - subband.tbx0;
  30266. var codeblocks = subband.codeblocks;
  30267. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  30268. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  30269. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  30270. var codeblock = codeblocks[i];
  30271. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30272. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30273. if (blockWidth === 0 || blockHeight === 0) {
  30274. continue;
  30275. }
  30276. if (codeblock['data'] === undefined) {
  30277. continue;
  30278. }
  30279. var bitModel, currentCodingpassType;
  30280. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30281. currentCodingpassType = 2;
  30282. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  30283. var j, jj, dataItem;
  30284. for (j = 0, jj = data.length; j < jj; j++) {
  30285. dataItem = data[j];
  30286. totalLength += dataItem.end - dataItem.start;
  30287. codingpasses += dataItem.codingpasses;
  30288. }
  30289. var encodedData = new Uint8Array(totalLength);
  30290. var position = 0;
  30291. for (j = 0, jj = data.length; j < jj; j++) {
  30292. dataItem = data[j];
  30293. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30294. encodedData.set(chunk, position);
  30295. position += chunk.length;
  30296. }
  30297. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  30298. bitModel.setDecoder(decoder);
  30299. for (j = 0; j < codingpasses; j++) {
  30300. switch (currentCodingpassType) {
  30301. case 0:
  30302. bitModel.runSignificancePropagationPass();
  30303. break;
  30304. case 1:
  30305. bitModel.runMagnitudeRefinementPass();
  30306. break;
  30307. case 2:
  30308. bitModel.runCleanupPass();
  30309. if (segmentationSymbolUsed) {
  30310. bitModel.checkSegmentationSymbol();
  30311. }
  30312. break;
  30313. }
  30314. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30315. }
  30316. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30317. var sign = bitModel.coefficentsSign;
  30318. var magnitude = bitModel.coefficentsMagnitude;
  30319. var bitsDecoded = bitModel.bitsDecoded;
  30320. var magnitudeCorrection = reversible ? 0 : 0.5;
  30321. var k, n, nb;
  30322. position = 0;
  30323. var interleave = subband.type !== 'LL';
  30324. for (j = 0; j < blockHeight; j++) {
  30325. var row = offset / width | 0;
  30326. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30327. for (k = 0; k < blockWidth; k++) {
  30328. n = magnitude[position];
  30329. if (n !== 0) {
  30330. n = (n + magnitudeCorrection) * delta;
  30331. if (sign[position] !== 0) {
  30332. n = -n;
  30333. }
  30334. nb = bitsDecoded[position];
  30335. var pos = interleave ? levelOffset + (offset << 1) : offset;
  30336. if (reversible && nb >= mb) {
  30337. coefficients[pos] = n;
  30338. } else {
  30339. coefficients[pos] = n * (1 << mb - nb);
  30340. }
  30341. }
  30342. offset++;
  30343. position++;
  30344. }
  30345. offset += width - blockWidth;
  30346. }
  30347. }
  30348. }
  30349. function transformTile(context, tile, c) {
  30350. var component = tile.components[c];
  30351. var codingStyleParameters = component.codingStyleParameters;
  30352. var quantizationParameters = component.quantizationParameters;
  30353. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  30354. var spqcds = quantizationParameters.SPqcds;
  30355. var scalarExpounded = quantizationParameters.scalarExpounded;
  30356. var guardBits = quantizationParameters.guardBits;
  30357. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  30358. var precision = context.components[c].precision;
  30359. var reversible = codingStyleParameters.reversibleTransformation;
  30360. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  30361. var subbandCoefficients = [];
  30362. var b = 0;
  30363. for (var i = 0; i <= decompositionLevelsCount; i++) {
  30364. var resolution = component.resolutions[i];
  30365. var width = resolution.trx1 - resolution.trx0;
  30366. var height = resolution.try1 - resolution.try0;
  30367. var coefficients = new Float32Array(width * height);
  30368. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  30369. var mu, epsilon;
  30370. if (!scalarExpounded) {
  30371. mu = spqcds[0].mu;
  30372. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  30373. } else {
  30374. mu = spqcds[b].mu;
  30375. epsilon = spqcds[b].epsilon;
  30376. b++;
  30377. }
  30378. var subband = resolution.subbands[j];
  30379. var gainLog2 = SubbandsGainLog2[subband.type];
  30380. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  30381. var mb = guardBits + epsilon - 1;
  30382. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  30383. }
  30384. subbandCoefficients.push({
  30385. width: width,
  30386. height: height,
  30387. items: coefficients
  30388. });
  30389. }
  30390. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  30391. return {
  30392. left: component.tcx0,
  30393. top: component.tcy0,
  30394. width: result.width,
  30395. height: result.height,
  30396. items: result.items
  30397. };
  30398. }
  30399. function transformComponents(context) {
  30400. var siz = context.SIZ;
  30401. var components = context.components;
  30402. var componentsCount = siz.Csiz;
  30403. var resultImages = [];
  30404. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  30405. var tile = context.tiles[i];
  30406. var transformedTiles = [];
  30407. var c;
  30408. for (c = 0; c < componentsCount; c++) {
  30409. transformedTiles[c] = transformTile(context, tile, c);
  30410. }
  30411. var tile0 = transformedTiles[0];
  30412. var out = new Uint8Array(tile0.items.length * componentsCount);
  30413. var result = {
  30414. left: tile0.left,
  30415. top: tile0.top,
  30416. width: tile0.width,
  30417. height: tile0.height,
  30418. items: out
  30419. };
  30420. var shift, offset, max, min, maxK;
  30421. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  30422. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  30423. var fourComponents = componentsCount === 4;
  30424. var y0items = transformedTiles[0].items;
  30425. var y1items = transformedTiles[1].items;
  30426. var y2items = transformedTiles[2].items;
  30427. var y3items = fourComponents ? transformedTiles[3].items : null;
  30428. shift = components[0].precision - 8;
  30429. offset = (128 << shift) + 0.5;
  30430. max = 255 * (1 << shift);
  30431. maxK = max * 0.5;
  30432. min = -maxK;
  30433. var component0 = tile.components[0];
  30434. var alpha01 = componentsCount - 3;
  30435. jj = y0items.length;
  30436. if (!component0.codingStyleParameters.reversibleTransformation) {
  30437. for (j = 0; j < jj; j++, pos += alpha01) {
  30438. y0 = y0items[j] + offset;
  30439. y1 = y1items[j];
  30440. y2 = y2items[j];
  30441. r = y0 + 1.402 * y2;
  30442. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  30443. b = y0 + 1.772 * y1;
  30444. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30445. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30446. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30447. }
  30448. } else {
  30449. for (j = 0; j < jj; j++, pos += alpha01) {
  30450. y0 = y0items[j] + offset;
  30451. y1 = y1items[j];
  30452. y2 = y2items[j];
  30453. g = y0 - (y2 + y1 >> 2);
  30454. r = g + y2;
  30455. b = g + y1;
  30456. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30457. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30458. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30459. }
  30460. }
  30461. if (fourComponents) {
  30462. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  30463. k = y3items[j];
  30464. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  30465. }
  30466. }
  30467. } else {
  30468. for (c = 0; c < componentsCount; c++) {
  30469. var items = transformedTiles[c].items;
  30470. shift = components[c].precision - 8;
  30471. offset = (128 << shift) + 0.5;
  30472. max = 127.5 * (1 << shift);
  30473. min = -max;
  30474. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  30475. val = items[j];
  30476. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  30477. pos += componentsCount;
  30478. }
  30479. }
  30480. }
  30481. resultImages.push(result);
  30482. }
  30483. return resultImages;
  30484. }
  30485. function initializeTile(context, tileIndex) {
  30486. var siz = context.SIZ;
  30487. var componentsCount = siz.Csiz;
  30488. var tile = context.tiles[tileIndex];
  30489. for (var c = 0; c < componentsCount; c++) {
  30490. var component = tile.components[c];
  30491. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  30492. component.quantizationParameters = qcdOrQcc;
  30493. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  30494. component.codingStyleParameters = codOrCoc;
  30495. }
  30496. tile.codingStyleDefaultParameters = context.currentTile.COD;
  30497. }
  30498. var TagTree = function TagTreeClosure() {
  30499. function TagTree(width, height) {
  30500. var levelsLength = log2(Math.max(width, height)) + 1;
  30501. this.levels = [];
  30502. for (var i = 0; i < levelsLength; i++) {
  30503. var level = {
  30504. width: width,
  30505. height: height,
  30506. items: []
  30507. };
  30508. this.levels.push(level);
  30509. width = Math.ceil(width / 2);
  30510. height = Math.ceil(height / 2);
  30511. }
  30512. }
  30513. TagTree.prototype = {
  30514. reset: function TagTree_reset(i, j) {
  30515. var currentLevel = 0, value = 0, level;
  30516. while (currentLevel < this.levels.length) {
  30517. level = this.levels[currentLevel];
  30518. var index = i + j * level.width;
  30519. if (level.items[index] !== undefined) {
  30520. value = level.items[index];
  30521. break;
  30522. }
  30523. level.index = index;
  30524. i >>= 1;
  30525. j >>= 1;
  30526. currentLevel++;
  30527. }
  30528. currentLevel--;
  30529. level = this.levels[currentLevel];
  30530. level.items[level.index] = value;
  30531. this.currentLevel = currentLevel;
  30532. delete this.value;
  30533. },
  30534. incrementValue: function TagTree_incrementValue() {
  30535. var level = this.levels[this.currentLevel];
  30536. level.items[level.index]++;
  30537. },
  30538. nextLevel: function TagTree_nextLevel() {
  30539. var currentLevel = this.currentLevel;
  30540. var level = this.levels[currentLevel];
  30541. var value = level.items[level.index];
  30542. currentLevel--;
  30543. if (currentLevel < 0) {
  30544. this.value = value;
  30545. return false;
  30546. }
  30547. this.currentLevel = currentLevel;
  30548. level = this.levels[currentLevel];
  30549. level.items[level.index] = value;
  30550. return true;
  30551. }
  30552. };
  30553. return TagTree;
  30554. }();
  30555. var InclusionTree = function InclusionTreeClosure() {
  30556. function InclusionTree(width, height, defaultValue) {
  30557. var levelsLength = log2(Math.max(width, height)) + 1;
  30558. this.levels = [];
  30559. for (var i = 0; i < levelsLength; i++) {
  30560. var items = new Uint8Array(width * height);
  30561. for (var j = 0, jj = items.length; j < jj; j++) {
  30562. items[j] = defaultValue;
  30563. }
  30564. var level = {
  30565. width: width,
  30566. height: height,
  30567. items: items
  30568. };
  30569. this.levels.push(level);
  30570. width = Math.ceil(width / 2);
  30571. height = Math.ceil(height / 2);
  30572. }
  30573. }
  30574. InclusionTree.prototype = {
  30575. reset: function InclusionTree_reset(i, j, stopValue) {
  30576. var currentLevel = 0;
  30577. while (currentLevel < this.levels.length) {
  30578. var level = this.levels[currentLevel];
  30579. var index = i + j * level.width;
  30580. level.index = index;
  30581. var value = level.items[index];
  30582. if (value === 0xFF) {
  30583. break;
  30584. }
  30585. if (value > stopValue) {
  30586. this.currentLevel = currentLevel;
  30587. this.propagateValues();
  30588. return false;
  30589. }
  30590. i >>= 1;
  30591. j >>= 1;
  30592. currentLevel++;
  30593. }
  30594. this.currentLevel = currentLevel - 1;
  30595. return true;
  30596. },
  30597. incrementValue: function InclusionTree_incrementValue(stopValue) {
  30598. var level = this.levels[this.currentLevel];
  30599. level.items[level.index] = stopValue + 1;
  30600. this.propagateValues();
  30601. },
  30602. propagateValues: function InclusionTree_propagateValues() {
  30603. var levelIndex = this.currentLevel;
  30604. var level = this.levels[levelIndex];
  30605. var currentValue = level.items[level.index];
  30606. while (--levelIndex >= 0) {
  30607. level = this.levels[levelIndex];
  30608. level.items[level.index] = currentValue;
  30609. }
  30610. },
  30611. nextLevel: function InclusionTree_nextLevel() {
  30612. var currentLevel = this.currentLevel;
  30613. var level = this.levels[currentLevel];
  30614. var value = level.items[level.index];
  30615. level.items[level.index] = 0xFF;
  30616. currentLevel--;
  30617. if (currentLevel < 0) {
  30618. return false;
  30619. }
  30620. this.currentLevel = currentLevel;
  30621. level = this.levels[currentLevel];
  30622. level.items[level.index] = value;
  30623. return true;
  30624. }
  30625. };
  30626. return InclusionTree;
  30627. }();
  30628. var BitModel = function BitModelClosure() {
  30629. var UNIFORM_CONTEXT = 17;
  30630. var RUNLENGTH_CONTEXT = 18;
  30631. var LLAndLHContextsLabel = new Uint8Array([
  30632. 0,
  30633. 5,
  30634. 8,
  30635. 0,
  30636. 3,
  30637. 7,
  30638. 8,
  30639. 0,
  30640. 4,
  30641. 7,
  30642. 8,
  30643. 0,
  30644. 0,
  30645. 0,
  30646. 0,
  30647. 0,
  30648. 1,
  30649. 6,
  30650. 8,
  30651. 0,
  30652. 3,
  30653. 7,
  30654. 8,
  30655. 0,
  30656. 4,
  30657. 7,
  30658. 8,
  30659. 0,
  30660. 0,
  30661. 0,
  30662. 0,
  30663. 0,
  30664. 2,
  30665. 6,
  30666. 8,
  30667. 0,
  30668. 3,
  30669. 7,
  30670. 8,
  30671. 0,
  30672. 4,
  30673. 7,
  30674. 8,
  30675. 0,
  30676. 0,
  30677. 0,
  30678. 0,
  30679. 0,
  30680. 2,
  30681. 6,
  30682. 8,
  30683. 0,
  30684. 3,
  30685. 7,
  30686. 8,
  30687. 0,
  30688. 4,
  30689. 7,
  30690. 8,
  30691. 0,
  30692. 0,
  30693. 0,
  30694. 0,
  30695. 0,
  30696. 2,
  30697. 6,
  30698. 8,
  30699. 0,
  30700. 3,
  30701. 7,
  30702. 8,
  30703. 0,
  30704. 4,
  30705. 7,
  30706. 8
  30707. ]);
  30708. var HLContextLabel = new Uint8Array([
  30709. 0,
  30710. 3,
  30711. 4,
  30712. 0,
  30713. 5,
  30714. 7,
  30715. 7,
  30716. 0,
  30717. 8,
  30718. 8,
  30719. 8,
  30720. 0,
  30721. 0,
  30722. 0,
  30723. 0,
  30724. 0,
  30725. 1,
  30726. 3,
  30727. 4,
  30728. 0,
  30729. 6,
  30730. 7,
  30731. 7,
  30732. 0,
  30733. 8,
  30734. 8,
  30735. 8,
  30736. 0,
  30737. 0,
  30738. 0,
  30739. 0,
  30740. 0,
  30741. 2,
  30742. 3,
  30743. 4,
  30744. 0,
  30745. 6,
  30746. 7,
  30747. 7,
  30748. 0,
  30749. 8,
  30750. 8,
  30751. 8,
  30752. 0,
  30753. 0,
  30754. 0,
  30755. 0,
  30756. 0,
  30757. 2,
  30758. 3,
  30759. 4,
  30760. 0,
  30761. 6,
  30762. 7,
  30763. 7,
  30764. 0,
  30765. 8,
  30766. 8,
  30767. 8,
  30768. 0,
  30769. 0,
  30770. 0,
  30771. 0,
  30772. 0,
  30773. 2,
  30774. 3,
  30775. 4,
  30776. 0,
  30777. 6,
  30778. 7,
  30779. 7,
  30780. 0,
  30781. 8,
  30782. 8,
  30783. 8
  30784. ]);
  30785. var HHContextLabel = new Uint8Array([
  30786. 0,
  30787. 1,
  30788. 2,
  30789. 0,
  30790. 1,
  30791. 2,
  30792. 2,
  30793. 0,
  30794. 2,
  30795. 2,
  30796. 2,
  30797. 0,
  30798. 0,
  30799. 0,
  30800. 0,
  30801. 0,
  30802. 3,
  30803. 4,
  30804. 5,
  30805. 0,
  30806. 4,
  30807. 5,
  30808. 5,
  30809. 0,
  30810. 5,
  30811. 5,
  30812. 5,
  30813. 0,
  30814. 0,
  30815. 0,
  30816. 0,
  30817. 0,
  30818. 6,
  30819. 7,
  30820. 7,
  30821. 0,
  30822. 7,
  30823. 7,
  30824. 7,
  30825. 0,
  30826. 7,
  30827. 7,
  30828. 7,
  30829. 0,
  30830. 0,
  30831. 0,
  30832. 0,
  30833. 0,
  30834. 8,
  30835. 8,
  30836. 8,
  30837. 0,
  30838. 8,
  30839. 8,
  30840. 8,
  30841. 0,
  30842. 8,
  30843. 8,
  30844. 8,
  30845. 0,
  30846. 0,
  30847. 0,
  30848. 0,
  30849. 0,
  30850. 8,
  30851. 8,
  30852. 8,
  30853. 0,
  30854. 8,
  30855. 8,
  30856. 8,
  30857. 0,
  30858. 8,
  30859. 8,
  30860. 8
  30861. ]);
  30862. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30863. this.width = width;
  30864. this.height = height;
  30865. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30866. var coefficientCount = width * height;
  30867. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30868. this.coefficentsSign = new Uint8Array(coefficientCount);
  30869. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30870. this.processingFlags = new Uint8Array(coefficientCount);
  30871. var bitsDecoded = new Uint8Array(coefficientCount);
  30872. if (zeroBitPlanes !== 0) {
  30873. for (var i = 0; i < coefficientCount; i++) {
  30874. bitsDecoded[i] = zeroBitPlanes;
  30875. }
  30876. }
  30877. this.bitsDecoded = bitsDecoded;
  30878. this.reset();
  30879. }
  30880. BitModel.prototype = {
  30881. setDecoder: function BitModel_setDecoder(decoder) {
  30882. this.decoder = decoder;
  30883. },
  30884. reset: function BitModel_reset() {
  30885. this.contexts = new Int8Array(19);
  30886. this.contexts[0] = 4 << 1 | 0;
  30887. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30888. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30889. },
  30890. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30891. var neighborsSignificance = this.neighborsSignificance;
  30892. var width = this.width, height = this.height;
  30893. var left = column > 0;
  30894. var right = column + 1 < width;
  30895. var i;
  30896. if (row > 0) {
  30897. i = index - width;
  30898. if (left) {
  30899. neighborsSignificance[i - 1] += 0x10;
  30900. }
  30901. if (right) {
  30902. neighborsSignificance[i + 1] += 0x10;
  30903. }
  30904. neighborsSignificance[i] += 0x04;
  30905. }
  30906. if (row + 1 < height) {
  30907. i = index + width;
  30908. if (left) {
  30909. neighborsSignificance[i - 1] += 0x10;
  30910. }
  30911. if (right) {
  30912. neighborsSignificance[i + 1] += 0x10;
  30913. }
  30914. neighborsSignificance[i] += 0x04;
  30915. }
  30916. if (left) {
  30917. neighborsSignificance[index - 1] += 0x01;
  30918. }
  30919. if (right) {
  30920. neighborsSignificance[index + 1] += 0x01;
  30921. }
  30922. neighborsSignificance[index] |= 0x80;
  30923. },
  30924. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30925. var decoder = this.decoder;
  30926. var width = this.width, height = this.height;
  30927. var coefficentsMagnitude = this.coefficentsMagnitude;
  30928. var coefficentsSign = this.coefficentsSign;
  30929. var neighborsSignificance = this.neighborsSignificance;
  30930. var processingFlags = this.processingFlags;
  30931. var contexts = this.contexts;
  30932. var labels = this.contextLabelTable;
  30933. var bitsDecoded = this.bitsDecoded;
  30934. var processedInverseMask = ~1;
  30935. var processedMask = 1;
  30936. var firstMagnitudeBitMask = 2;
  30937. for (var i0 = 0; i0 < height; i0 += 4) {
  30938. for (var j = 0; j < width; j++) {
  30939. var index = i0 * width + j;
  30940. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30941. var i = i0 + i1;
  30942. if (i >= height) {
  30943. break;
  30944. }
  30945. processingFlags[index] &= processedInverseMask;
  30946. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30947. continue;
  30948. }
  30949. var contextLabel = labels[neighborsSignificance[index]];
  30950. var decision = decoder.readBit(contexts, contextLabel);
  30951. if (decision) {
  30952. var sign = this.decodeSignBit(i, j, index);
  30953. coefficentsSign[index] = sign;
  30954. coefficentsMagnitude[index] = 1;
  30955. this.setNeighborsSignificance(i, j, index);
  30956. processingFlags[index] |= firstMagnitudeBitMask;
  30957. }
  30958. bitsDecoded[index]++;
  30959. processingFlags[index] |= processedMask;
  30960. }
  30961. }
  30962. }
  30963. },
  30964. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30965. var width = this.width, height = this.height;
  30966. var coefficentsMagnitude = this.coefficentsMagnitude;
  30967. var coefficentsSign = this.coefficentsSign;
  30968. var contribution, sign0, sign1, significance1;
  30969. var contextLabel, decoded;
  30970. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30971. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30972. sign1 = coefficentsSign[index + 1];
  30973. if (significance1) {
  30974. sign0 = coefficentsSign[index - 1];
  30975. contribution = 1 - sign1 - sign0;
  30976. } else {
  30977. contribution = 1 - sign1 - sign1;
  30978. }
  30979. } else if (significance1) {
  30980. sign0 = coefficentsSign[index - 1];
  30981. contribution = 1 - sign0 - sign0;
  30982. } else {
  30983. contribution = 0;
  30984. }
  30985. var horizontalContribution = 3 * contribution;
  30986. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30987. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30988. sign1 = coefficentsSign[index + width];
  30989. if (significance1) {
  30990. sign0 = coefficentsSign[index - width];
  30991. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30992. } else {
  30993. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30994. }
  30995. } else if (significance1) {
  30996. sign0 = coefficentsSign[index - width];
  30997. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30998. } else {
  30999. contribution = horizontalContribution;
  31000. }
  31001. if (contribution >= 0) {
  31002. contextLabel = 9 + contribution;
  31003. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31004. } else {
  31005. contextLabel = 9 - contribution;
  31006. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31007. }
  31008. return decoded;
  31009. },
  31010. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  31011. var decoder = this.decoder;
  31012. var width = this.width, height = this.height;
  31013. var coefficentsMagnitude = this.coefficentsMagnitude;
  31014. var neighborsSignificance = this.neighborsSignificance;
  31015. var contexts = this.contexts;
  31016. var bitsDecoded = this.bitsDecoded;
  31017. var processingFlags = this.processingFlags;
  31018. var processedMask = 1;
  31019. var firstMagnitudeBitMask = 2;
  31020. var length = width * height;
  31021. var width4 = width * 4;
  31022. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31023. indexNext = Math.min(length, index0 + width4);
  31024. for (var j = 0; j < width; j++) {
  31025. for (var index = index0 + j; index < indexNext; index += width) {
  31026. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31027. continue;
  31028. }
  31029. var contextLabel = 16;
  31030. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31031. processingFlags[index] ^= firstMagnitudeBitMask;
  31032. var significance = neighborsSignificance[index] & 127;
  31033. contextLabel = significance === 0 ? 15 : 14;
  31034. }
  31035. var bit = decoder.readBit(contexts, contextLabel);
  31036. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31037. bitsDecoded[index]++;
  31038. processingFlags[index] |= processedMask;
  31039. }
  31040. }
  31041. }
  31042. },
  31043. runCleanupPass: function BitModel_runCleanupPass() {
  31044. var decoder = this.decoder;
  31045. var width = this.width, height = this.height;
  31046. var neighborsSignificance = this.neighborsSignificance;
  31047. var coefficentsMagnitude = this.coefficentsMagnitude;
  31048. var coefficentsSign = this.coefficentsSign;
  31049. var contexts = this.contexts;
  31050. var labels = this.contextLabelTable;
  31051. var bitsDecoded = this.bitsDecoded;
  31052. var processingFlags = this.processingFlags;
  31053. var processedMask = 1;
  31054. var firstMagnitudeBitMask = 2;
  31055. var oneRowDown = width;
  31056. var twoRowsDown = width * 2;
  31057. var threeRowsDown = width * 3;
  31058. var iNext;
  31059. for (var i0 = 0; i0 < height; i0 = iNext) {
  31060. iNext = Math.min(i0 + 4, height);
  31061. var indexBase = i0 * width;
  31062. var checkAllEmpty = i0 + 3 < height;
  31063. for (var j = 0; j < width; j++) {
  31064. var index0 = indexBase + j;
  31065. 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;
  31066. var i1 = 0, index = index0;
  31067. var i = i0, sign;
  31068. if (allEmpty) {
  31069. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31070. if (!hasSignificantCoefficent) {
  31071. bitsDecoded[index0]++;
  31072. bitsDecoded[index0 + oneRowDown]++;
  31073. bitsDecoded[index0 + twoRowsDown]++;
  31074. bitsDecoded[index0 + threeRowsDown]++;
  31075. continue;
  31076. }
  31077. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31078. if (i1 !== 0) {
  31079. i = i0 + i1;
  31080. index += i1 * width;
  31081. }
  31082. sign = this.decodeSignBit(i, j, index);
  31083. coefficentsSign[index] = sign;
  31084. coefficentsMagnitude[index] = 1;
  31085. this.setNeighborsSignificance(i, j, index);
  31086. processingFlags[index] |= firstMagnitudeBitMask;
  31087. index = index0;
  31088. for (var i2 = i0; i2 <= i; i2++, index += width) {
  31089. bitsDecoded[index]++;
  31090. }
  31091. i1++;
  31092. }
  31093. for (i = i0 + i1; i < iNext; i++, index += width) {
  31094. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31095. continue;
  31096. }
  31097. var contextLabel = labels[neighborsSignificance[index]];
  31098. var decision = decoder.readBit(contexts, contextLabel);
  31099. if (decision === 1) {
  31100. sign = this.decodeSignBit(i, j, index);
  31101. coefficentsSign[index] = sign;
  31102. coefficentsMagnitude[index] = 1;
  31103. this.setNeighborsSignificance(i, j, index);
  31104. processingFlags[index] |= firstMagnitudeBitMask;
  31105. }
  31106. bitsDecoded[index]++;
  31107. }
  31108. }
  31109. }
  31110. },
  31111. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  31112. var decoder = this.decoder;
  31113. var contexts = this.contexts;
  31114. 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);
  31115. if (symbol !== 0xA) {
  31116. error('JPX Error: Invalid segmentation symbol');
  31117. }
  31118. }
  31119. };
  31120. return BitModel;
  31121. }();
  31122. var Transform = function TransformClosure() {
  31123. function Transform() {
  31124. }
  31125. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  31126. var ll = subbands[0];
  31127. for (var i = 1, ii = subbands.length; i < ii; i++) {
  31128. ll = this.iterate(ll, subbands[i], u0, v0);
  31129. }
  31130. return ll;
  31131. };
  31132. Transform.prototype.extend = function extend(buffer, offset, size) {
  31133. var i1 = offset - 1, j1 = offset + 1;
  31134. var i2 = offset + size - 2, j2 = offset + size;
  31135. buffer[i1--] = buffer[j1++];
  31136. buffer[j2++] = buffer[i2--];
  31137. buffer[i1--] = buffer[j1++];
  31138. buffer[j2++] = buffer[i2--];
  31139. buffer[i1--] = buffer[j1++];
  31140. buffer[j2++] = buffer[i2--];
  31141. buffer[i1] = buffer[j1];
  31142. buffer[j2] = buffer[i2];
  31143. };
  31144. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  31145. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  31146. var width = hl_lh_hh.width;
  31147. var height = hl_lh_hh.height;
  31148. var items = hl_lh_hh.items;
  31149. var i, j, k, l, u, v;
  31150. for (k = 0, i = 0; i < llHeight; i++) {
  31151. l = i * 2 * width;
  31152. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31153. items[l] = llItems[k];
  31154. }
  31155. }
  31156. llItems = ll.items = null;
  31157. var bufferPadding = 4;
  31158. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31159. if (width === 1) {
  31160. if ((u0 & 1) !== 0) {
  31161. for (v = 0, k = 0; v < height; v++, k += width) {
  31162. items[k] *= 0.5;
  31163. }
  31164. }
  31165. } else {
  31166. for (v = 0, k = 0; v < height; v++, k += width) {
  31167. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31168. this.extend(rowBuffer, bufferPadding, width);
  31169. this.filter(rowBuffer, bufferPadding, width);
  31170. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31171. }
  31172. }
  31173. var numBuffers = 16;
  31174. var colBuffers = [];
  31175. for (i = 0; i < numBuffers; i++) {
  31176. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31177. }
  31178. var b, currentBuffer = 0;
  31179. ll = bufferPadding + height;
  31180. if (height === 1) {
  31181. if ((v0 & 1) !== 0) {
  31182. for (u = 0; u < width; u++) {
  31183. items[u] *= 0.5;
  31184. }
  31185. }
  31186. } else {
  31187. for (u = 0; u < width; u++) {
  31188. if (currentBuffer === 0) {
  31189. numBuffers = Math.min(width - u, numBuffers);
  31190. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31191. for (b = 0; b < numBuffers; b++) {
  31192. colBuffers[b][l] = items[k + b];
  31193. }
  31194. }
  31195. currentBuffer = numBuffers;
  31196. }
  31197. currentBuffer--;
  31198. var buffer = colBuffers[currentBuffer];
  31199. this.extend(buffer, bufferPadding, height);
  31200. this.filter(buffer, bufferPadding, height);
  31201. if (currentBuffer === 0) {
  31202. k = u - numBuffers + 1;
  31203. for (l = bufferPadding; l < ll; k += width, l++) {
  31204. for (b = 0; b < numBuffers; b++) {
  31205. items[k + b] = colBuffers[b][l];
  31206. }
  31207. }
  31208. }
  31209. }
  31210. }
  31211. return {
  31212. width: width,
  31213. height: height,
  31214. items: items
  31215. };
  31216. };
  31217. return Transform;
  31218. }();
  31219. var IrreversibleTransform = function IrreversibleTransformClosure() {
  31220. function IrreversibleTransform() {
  31221. Transform.call(this);
  31222. }
  31223. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  31224. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  31225. var len = length >> 1;
  31226. offset = offset | 0;
  31227. var j, n, current, next;
  31228. var alpha = -1.586134342059924;
  31229. var beta = -0.052980118572961;
  31230. var gamma = 0.882911075530934;
  31231. var delta = 0.443506852043971;
  31232. var K = 1.230174104914001;
  31233. var K_ = 1 / K;
  31234. j = offset - 3;
  31235. for (n = len + 4; n--; j += 2) {
  31236. x[j] *= K_;
  31237. }
  31238. j = offset - 2;
  31239. current = delta * x[j - 1];
  31240. for (n = len + 3; n--; j += 2) {
  31241. next = delta * x[j + 1];
  31242. x[j] = K * x[j] - current - next;
  31243. if (n--) {
  31244. j += 2;
  31245. current = delta * x[j + 1];
  31246. x[j] = K * x[j] - current - next;
  31247. } else {
  31248. break;
  31249. }
  31250. }
  31251. j = offset - 1;
  31252. current = gamma * x[j - 1];
  31253. for (n = len + 2; n--; j += 2) {
  31254. next = gamma * x[j + 1];
  31255. x[j] -= current + next;
  31256. if (n--) {
  31257. j += 2;
  31258. current = gamma * x[j + 1];
  31259. x[j] -= current + next;
  31260. } else {
  31261. break;
  31262. }
  31263. }
  31264. j = offset;
  31265. current = beta * x[j - 1];
  31266. for (n = len + 1; n--; j += 2) {
  31267. next = beta * x[j + 1];
  31268. x[j] -= current + next;
  31269. if (n--) {
  31270. j += 2;
  31271. current = beta * x[j + 1];
  31272. x[j] -= current + next;
  31273. } else {
  31274. break;
  31275. }
  31276. }
  31277. if (len !== 0) {
  31278. j = offset + 1;
  31279. current = alpha * x[j - 1];
  31280. for (n = len; n--; j += 2) {
  31281. next = alpha * x[j + 1];
  31282. x[j] -= current + next;
  31283. if (n--) {
  31284. j += 2;
  31285. current = alpha * x[j + 1];
  31286. x[j] -= current + next;
  31287. } else {
  31288. break;
  31289. }
  31290. }
  31291. }
  31292. };
  31293. return IrreversibleTransform;
  31294. }();
  31295. var ReversibleTransform = function ReversibleTransformClosure() {
  31296. function ReversibleTransform() {
  31297. Transform.call(this);
  31298. }
  31299. ReversibleTransform.prototype = Object.create(Transform.prototype);
  31300. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  31301. var len = length >> 1;
  31302. offset = offset | 0;
  31303. var j, n;
  31304. for (j = offset, n = len + 1; n--; j += 2) {
  31305. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31306. }
  31307. for (j = offset + 1, n = len; n--; j += 2) {
  31308. x[j] += x[j - 1] + x[j + 1] >> 1;
  31309. }
  31310. };
  31311. return ReversibleTransform;
  31312. }();
  31313. return JpxImage;
  31314. }();
  31315. exports.JpxImage = JpxImage;
  31316. /***/ }),
  31317. /* 15 */
  31318. /***/ (function(module, exports, __w_pdfjs_require__) {
  31319. "use strict";
  31320. var sharedUtil = __w_pdfjs_require__(0);
  31321. var corePrimitives = __w_pdfjs_require__(1);
  31322. var coreCrypto = __w_pdfjs_require__(12);
  31323. var coreParser = __w_pdfjs_require__(5);
  31324. var coreChunkedStream = __w_pdfjs_require__(11);
  31325. var coreColorSpace = __w_pdfjs_require__(3);
  31326. var InvalidPDFException = sharedUtil.InvalidPDFException;
  31327. var MissingDataException = sharedUtil.MissingDataException;
  31328. var XRefParseException = sharedUtil.XRefParseException;
  31329. var assert = sharedUtil.assert;
  31330. var bytesToString = sharedUtil.bytesToString;
  31331. var createPromiseCapability = sharedUtil.createPromiseCapability;
  31332. var error = sharedUtil.error;
  31333. var info = sharedUtil.info;
  31334. var isArray = sharedUtil.isArray;
  31335. var isBool = sharedUtil.isBool;
  31336. var isInt = sharedUtil.isInt;
  31337. var isString = sharedUtil.isString;
  31338. var shadow = sharedUtil.shadow;
  31339. var stringToPDFString = sharedUtil.stringToPDFString;
  31340. var stringToUTF8String = sharedUtil.stringToUTF8String;
  31341. var warn = sharedUtil.warn;
  31342. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  31343. var Util = sharedUtil.Util;
  31344. var Ref = corePrimitives.Ref;
  31345. var RefSet = corePrimitives.RefSet;
  31346. var RefSetCache = corePrimitives.RefSetCache;
  31347. var isName = corePrimitives.isName;
  31348. var isCmd = corePrimitives.isCmd;
  31349. var isDict = corePrimitives.isDict;
  31350. var isRef = corePrimitives.isRef;
  31351. var isRefsEqual = corePrimitives.isRefsEqual;
  31352. var isStream = corePrimitives.isStream;
  31353. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  31354. var Lexer = coreParser.Lexer;
  31355. var Parser = coreParser.Parser;
  31356. var ChunkedStream = coreChunkedStream.ChunkedStream;
  31357. var ColorSpace = coreColorSpace.ColorSpace;
  31358. var Catalog = function CatalogClosure() {
  31359. function Catalog(pdfManager, xref, pageFactory) {
  31360. this.pdfManager = pdfManager;
  31361. this.xref = xref;
  31362. this.catDict = xref.getCatalogObj();
  31363. this.fontCache = new RefSetCache();
  31364. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  31365. this.pageFactory = pageFactory;
  31366. this.pagePromises = [];
  31367. }
  31368. Catalog.prototype = {
  31369. get metadata() {
  31370. var streamRef = this.catDict.getRaw('Metadata');
  31371. if (!isRef(streamRef)) {
  31372. return shadow(this, 'metadata', null);
  31373. }
  31374. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  31375. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  31376. var metadata;
  31377. if (stream && isDict(stream.dict)) {
  31378. var type = stream.dict.get('Type');
  31379. var subtype = stream.dict.get('Subtype');
  31380. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  31381. try {
  31382. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  31383. } catch (e) {
  31384. info('Skipping invalid metadata.');
  31385. }
  31386. }
  31387. }
  31388. return shadow(this, 'metadata', metadata);
  31389. },
  31390. get toplevelPagesDict() {
  31391. var pagesObj = this.catDict.get('Pages');
  31392. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  31393. return shadow(this, 'toplevelPagesDict', pagesObj);
  31394. },
  31395. get documentOutline() {
  31396. var obj = null;
  31397. try {
  31398. obj = this.readDocumentOutline();
  31399. } catch (ex) {
  31400. if (ex instanceof MissingDataException) {
  31401. throw ex;
  31402. }
  31403. warn('Unable to read document outline');
  31404. }
  31405. return shadow(this, 'documentOutline', obj);
  31406. },
  31407. readDocumentOutline: function Catalog_readDocumentOutline() {
  31408. var obj = this.catDict.get('Outlines');
  31409. if (!isDict(obj)) {
  31410. return null;
  31411. }
  31412. obj = obj.getRaw('First');
  31413. if (!isRef(obj)) {
  31414. return null;
  31415. }
  31416. var root = { items: [] };
  31417. var queue = [{
  31418. obj: obj,
  31419. parent: root
  31420. }];
  31421. var processed = new RefSet();
  31422. processed.put(obj);
  31423. var xref = this.xref, blackColor = new Uint8Array(3);
  31424. while (queue.length > 0) {
  31425. var i = queue.shift();
  31426. var outlineDict = xref.fetchIfRef(i.obj);
  31427. if (outlineDict === null) {
  31428. continue;
  31429. }
  31430. assert(outlineDict.has('Title'), 'Invalid outline item');
  31431. var data = {
  31432. url: null,
  31433. dest: null
  31434. };
  31435. Catalog.parseDestDictionary({
  31436. destDict: outlineDict,
  31437. resultObj: data,
  31438. docBaseUrl: this.pdfManager.docBaseUrl
  31439. });
  31440. var title = outlineDict.get('Title');
  31441. var flags = outlineDict.get('F') || 0;
  31442. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  31443. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  31444. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  31445. }
  31446. var outlineItem = {
  31447. dest: data.dest,
  31448. url: data.url,
  31449. unsafeUrl: data.unsafeUrl,
  31450. newWindow: data.newWindow,
  31451. title: stringToPDFString(title),
  31452. color: rgbColor,
  31453. count: outlineDict.get('Count'),
  31454. bold: !!(flags & 2),
  31455. italic: !!(flags & 1),
  31456. items: []
  31457. };
  31458. i.parent.items.push(outlineItem);
  31459. obj = outlineDict.getRaw('First');
  31460. if (isRef(obj) && !processed.has(obj)) {
  31461. queue.push({
  31462. obj: obj,
  31463. parent: outlineItem
  31464. });
  31465. processed.put(obj);
  31466. }
  31467. obj = outlineDict.getRaw('Next');
  31468. if (isRef(obj) && !processed.has(obj)) {
  31469. queue.push({
  31470. obj: obj,
  31471. parent: i.parent
  31472. });
  31473. processed.put(obj);
  31474. }
  31475. }
  31476. return root.items.length > 0 ? root.items : null;
  31477. },
  31478. get numPages() {
  31479. var obj = this.toplevelPagesDict.get('Count');
  31480. assert(isInt(obj), 'page count in top level pages object is not an integer');
  31481. return shadow(this, 'num', obj);
  31482. },
  31483. get destinations() {
  31484. function fetchDestination(dest) {
  31485. return isDict(dest) ? dest.get('D') : dest;
  31486. }
  31487. var xref = this.xref;
  31488. var dests = {}, nameTreeRef, nameDictionaryRef;
  31489. var obj = this.catDict.get('Names');
  31490. if (obj && obj.has('Dests')) {
  31491. nameTreeRef = obj.getRaw('Dests');
  31492. } else if (this.catDict.has('Dests')) {
  31493. nameDictionaryRef = this.catDict.get('Dests');
  31494. }
  31495. if (nameDictionaryRef) {
  31496. obj = nameDictionaryRef;
  31497. obj.forEach(function catalogForEach(key, value) {
  31498. if (!value) {
  31499. return;
  31500. }
  31501. dests[key] = fetchDestination(value);
  31502. });
  31503. }
  31504. if (nameTreeRef) {
  31505. var nameTree = new NameTree(nameTreeRef, xref);
  31506. var names = nameTree.getAll();
  31507. for (var name in names) {
  31508. dests[name] = fetchDestination(names[name]);
  31509. }
  31510. }
  31511. return shadow(this, 'destinations', dests);
  31512. },
  31513. getDestination: function Catalog_getDestination(destinationId) {
  31514. function fetchDestination(dest) {
  31515. return isDict(dest) ? dest.get('D') : dest;
  31516. }
  31517. var xref = this.xref;
  31518. var dest = null, nameTreeRef, nameDictionaryRef;
  31519. var obj = this.catDict.get('Names');
  31520. if (obj && obj.has('Dests')) {
  31521. nameTreeRef = obj.getRaw('Dests');
  31522. } else if (this.catDict.has('Dests')) {
  31523. nameDictionaryRef = this.catDict.get('Dests');
  31524. }
  31525. if (nameDictionaryRef) {
  31526. var value = nameDictionaryRef.get(destinationId);
  31527. if (value) {
  31528. dest = fetchDestination(value);
  31529. }
  31530. }
  31531. if (nameTreeRef) {
  31532. var nameTree = new NameTree(nameTreeRef, xref);
  31533. dest = fetchDestination(nameTree.get(destinationId));
  31534. }
  31535. return dest;
  31536. },
  31537. get pageLabels() {
  31538. var obj = null;
  31539. try {
  31540. obj = this.readPageLabels();
  31541. } catch (ex) {
  31542. if (ex instanceof MissingDataException) {
  31543. throw ex;
  31544. }
  31545. warn('Unable to read page labels.');
  31546. }
  31547. return shadow(this, 'pageLabels', obj);
  31548. },
  31549. readPageLabels: function Catalog_readPageLabels() {
  31550. var obj = this.catDict.getRaw('PageLabels');
  31551. if (!obj) {
  31552. return null;
  31553. }
  31554. var pageLabels = new Array(this.numPages);
  31555. var style = null;
  31556. var prefix = '';
  31557. var numberTree = new NumberTree(obj, this.xref);
  31558. var nums = numberTree.getAll();
  31559. var currentLabel = '', currentIndex = 1;
  31560. for (var i = 0, ii = this.numPages; i < ii; i++) {
  31561. if (i in nums) {
  31562. var labelDict = nums[i];
  31563. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  31564. var type = labelDict.get('Type');
  31565. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  31566. var s = labelDict.get('S');
  31567. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  31568. style = s ? s.name : null;
  31569. var p = labelDict.get('P');
  31570. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  31571. prefix = p ? stringToPDFString(p) : '';
  31572. var st = labelDict.get('St');
  31573. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  31574. currentIndex = st || 1;
  31575. }
  31576. switch (style) {
  31577. case 'D':
  31578. currentLabel = currentIndex;
  31579. break;
  31580. case 'R':
  31581. case 'r':
  31582. currentLabel = Util.toRoman(currentIndex, style === 'r');
  31583. break;
  31584. case 'A':
  31585. case 'a':
  31586. var LIMIT = 26;
  31587. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  31588. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  31589. var letterIndex = currentIndex - 1;
  31590. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  31591. var charBuf = [];
  31592. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  31593. charBuf.push(character);
  31594. }
  31595. currentLabel = charBuf.join('');
  31596. break;
  31597. default:
  31598. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  31599. }
  31600. pageLabels[i] = prefix + currentLabel;
  31601. currentLabel = '';
  31602. currentIndex++;
  31603. }
  31604. return pageLabels;
  31605. },
  31606. get attachments() {
  31607. var xref = this.xref;
  31608. var attachments = null, nameTreeRef;
  31609. var obj = this.catDict.get('Names');
  31610. if (obj) {
  31611. nameTreeRef = obj.getRaw('EmbeddedFiles');
  31612. }
  31613. if (nameTreeRef) {
  31614. var nameTree = new NameTree(nameTreeRef, xref);
  31615. var names = nameTree.getAll();
  31616. for (var name in names) {
  31617. var fs = new FileSpec(names[name], xref);
  31618. if (!attachments) {
  31619. attachments = Object.create(null);
  31620. }
  31621. attachments[stringToPDFString(name)] = fs.serializable;
  31622. }
  31623. }
  31624. return shadow(this, 'attachments', attachments);
  31625. },
  31626. get javaScript() {
  31627. var xref = this.xref;
  31628. var obj = this.catDict.get('Names');
  31629. var javaScript = [];
  31630. function appendIfJavaScriptDict(jsDict) {
  31631. var type = jsDict.get('S');
  31632. if (!isName(type, 'JavaScript')) {
  31633. return;
  31634. }
  31635. var js = jsDict.get('JS');
  31636. if (isStream(js)) {
  31637. js = bytesToString(js.getBytes());
  31638. } else if (!isString(js)) {
  31639. return;
  31640. }
  31641. javaScript.push(stringToPDFString(js));
  31642. }
  31643. if (obj && obj.has('JavaScript')) {
  31644. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  31645. var names = nameTree.getAll();
  31646. for (var name in names) {
  31647. var jsDict = names[name];
  31648. if (isDict(jsDict)) {
  31649. appendIfJavaScriptDict(jsDict);
  31650. }
  31651. }
  31652. }
  31653. var openactionDict = this.catDict.get('OpenAction');
  31654. if (isDict(openactionDict, 'Action')) {
  31655. var actionType = openactionDict.get('S');
  31656. if (isName(actionType, 'Named')) {
  31657. var action = openactionDict.get('N');
  31658. if (isName(action, 'Print')) {
  31659. javaScript.push('print({});');
  31660. }
  31661. } else {
  31662. appendIfJavaScriptDict(openactionDict);
  31663. }
  31664. }
  31665. return shadow(this, 'javaScript', javaScript);
  31666. },
  31667. cleanup: function Catalog_cleanup() {
  31668. var promises = [];
  31669. this.fontCache.forEach(function (promise) {
  31670. promises.push(promise);
  31671. });
  31672. return Promise.all(promises).then(function (translatedFonts) {
  31673. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  31674. var font = translatedFonts[i].dict;
  31675. delete font.translated;
  31676. }
  31677. this.fontCache.clear();
  31678. }.bind(this));
  31679. },
  31680. getPage: function Catalog_getPage(pageIndex) {
  31681. if (!(pageIndex in this.pagePromises)) {
  31682. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  31683. var dict = a[0];
  31684. var ref = a[1];
  31685. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache);
  31686. }.bind(this));
  31687. }
  31688. return this.pagePromises[pageIndex];
  31689. },
  31690. getPageDict: function Catalog_getPageDict(pageIndex) {
  31691. var capability = createPromiseCapability();
  31692. var nodesToVisit = [this.catDict.getRaw('Pages')];
  31693. var currentPageIndex = 0;
  31694. var xref = this.xref;
  31695. var checkAllKids = false;
  31696. function next() {
  31697. while (nodesToVisit.length) {
  31698. var currentNode = nodesToVisit.pop();
  31699. if (isRef(currentNode)) {
  31700. xref.fetchAsync(currentNode).then(function (obj) {
  31701. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  31702. if (pageIndex === currentPageIndex) {
  31703. capability.resolve([
  31704. obj,
  31705. currentNode
  31706. ]);
  31707. } else {
  31708. currentPageIndex++;
  31709. next();
  31710. }
  31711. return;
  31712. }
  31713. nodesToVisit.push(obj);
  31714. next();
  31715. }, capability.reject);
  31716. return;
  31717. }
  31718. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  31719. var count = currentNode.get('Count');
  31720. if (count === 0) {
  31721. checkAllKids = true;
  31722. }
  31723. if (currentPageIndex + count <= pageIndex) {
  31724. currentPageIndex += count;
  31725. continue;
  31726. }
  31727. var kids = currentNode.get('Kids');
  31728. assert(isArray(kids), 'page dictionary kids object is not an array');
  31729. if (!checkAllKids && count === kids.length) {
  31730. nodesToVisit = [kids[pageIndex - currentPageIndex]];
  31731. currentPageIndex = pageIndex;
  31732. continue;
  31733. } else {
  31734. for (var last = kids.length - 1; last >= 0; last--) {
  31735. nodesToVisit.push(kids[last]);
  31736. }
  31737. }
  31738. }
  31739. capability.reject('Page index ' + pageIndex + ' not found.');
  31740. }
  31741. next();
  31742. return capability.promise;
  31743. },
  31744. getPageIndex: function Catalog_getPageIndex(pageRef) {
  31745. var xref = this.xref;
  31746. function pagesBeforeRef(kidRef) {
  31747. var total = 0;
  31748. var parentRef;
  31749. return xref.fetchAsync(kidRef).then(function (node) {
  31750. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  31751. throw new Error('The reference does not point to a /Page Dict.');
  31752. }
  31753. if (!node) {
  31754. return null;
  31755. }
  31756. assert(isDict(node), 'node must be a Dict.');
  31757. parentRef = node.getRaw('Parent');
  31758. return node.getAsync('Parent');
  31759. }).then(function (parent) {
  31760. if (!parent) {
  31761. return null;
  31762. }
  31763. assert(isDict(parent), 'parent must be a Dict.');
  31764. return parent.getAsync('Kids');
  31765. }).then(function (kids) {
  31766. if (!kids) {
  31767. return null;
  31768. }
  31769. var kidPromises = [];
  31770. var found = false;
  31771. for (var i = 0; i < kids.length; i++) {
  31772. var kid = kids[i];
  31773. assert(isRef(kid), 'kid must be a Ref.');
  31774. if (kid.num === kidRef.num) {
  31775. found = true;
  31776. break;
  31777. }
  31778. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  31779. if (kid.has('Count')) {
  31780. var count = kid.get('Count');
  31781. total += count;
  31782. } else {
  31783. total++;
  31784. }
  31785. }));
  31786. }
  31787. if (!found) {
  31788. error('kid ref not found in parents kids');
  31789. }
  31790. return Promise.all(kidPromises).then(function () {
  31791. return [
  31792. total,
  31793. parentRef
  31794. ];
  31795. });
  31796. });
  31797. }
  31798. var total = 0;
  31799. function next(ref) {
  31800. return pagesBeforeRef(ref).then(function (args) {
  31801. if (!args) {
  31802. return total;
  31803. }
  31804. var count = args[0];
  31805. var parentRef = args[1];
  31806. total += count;
  31807. return next(parentRef);
  31808. });
  31809. }
  31810. return next(pageRef);
  31811. }
  31812. };
  31813. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  31814. function addDefaultProtocolToUrl(url) {
  31815. if (url.indexOf('www.') === 0) {
  31816. return 'http://' + url;
  31817. }
  31818. return url;
  31819. }
  31820. function tryConvertUrlEncoding(url) {
  31821. try {
  31822. return stringToUTF8String(url);
  31823. } catch (e) {
  31824. return url;
  31825. }
  31826. }
  31827. var destDict = params.destDict;
  31828. if (!isDict(destDict)) {
  31829. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31830. return;
  31831. }
  31832. var resultObj = params.resultObj;
  31833. if (typeof resultObj !== 'object') {
  31834. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31835. return;
  31836. }
  31837. var docBaseUrl = params.docBaseUrl || null;
  31838. var action = destDict.get('A'), url, dest;
  31839. if (isDict(action)) {
  31840. var linkType = action.get('S').name;
  31841. switch (linkType) {
  31842. case 'URI':
  31843. url = action.get('URI');
  31844. if (isName(url)) {
  31845. url = '/' + url.name;
  31846. } else if (isString(url)) {
  31847. url = addDefaultProtocolToUrl(url);
  31848. }
  31849. break;
  31850. case 'GoTo':
  31851. dest = action.get('D');
  31852. break;
  31853. case 'Launch':
  31854. case 'GoToR':
  31855. var urlDict = action.get('F');
  31856. if (isDict(urlDict)) {
  31857. url = urlDict.get('F') || null;
  31858. } else if (isString(urlDict)) {
  31859. url = urlDict;
  31860. }
  31861. var remoteDest = action.get('D');
  31862. if (remoteDest) {
  31863. if (isName(remoteDest)) {
  31864. remoteDest = remoteDest.name;
  31865. }
  31866. if (isString(url)) {
  31867. var baseUrl = url.split('#')[0];
  31868. if (isString(remoteDest)) {
  31869. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31870. } else if (isArray(remoteDest)) {
  31871. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31872. }
  31873. }
  31874. }
  31875. var newWindow = action.get('NewWindow');
  31876. if (isBool(newWindow)) {
  31877. resultObj.newWindow = newWindow;
  31878. }
  31879. break;
  31880. case 'Named':
  31881. var namedAction = action.get('N');
  31882. if (isName(namedAction)) {
  31883. resultObj.action = namedAction.name;
  31884. }
  31885. break;
  31886. case 'JavaScript':
  31887. var jsAction = action.get('JS'), js;
  31888. if (isStream(jsAction)) {
  31889. js = bytesToString(jsAction.getBytes());
  31890. } else if (isString(jsAction)) {
  31891. js = jsAction;
  31892. }
  31893. if (js) {
  31894. var URL_OPEN_METHODS = [
  31895. 'app.launchURL',
  31896. 'window.open'
  31897. ];
  31898. var regex = new RegExp('^(?:' + URL_OPEN_METHODS.join('|') + ')' + '\\((?:\'|\")(\\S+)(?:\'|\")(?:,|\\))');
  31899. var jsUrl = regex.exec(stringToPDFString(js), 'i');
  31900. if (jsUrl && jsUrl[1]) {
  31901. url = jsUrl[1];
  31902. break;
  31903. }
  31904. }
  31905. default:
  31906. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31907. break;
  31908. }
  31909. } else if (destDict.has('Dest')) {
  31910. dest = destDict.get('Dest');
  31911. }
  31912. if (isString(url)) {
  31913. url = tryConvertUrlEncoding(url);
  31914. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31915. if (absoluteUrl) {
  31916. resultObj.url = absoluteUrl.href;
  31917. }
  31918. resultObj.unsafeUrl = url;
  31919. }
  31920. if (dest) {
  31921. if (isName(dest)) {
  31922. dest = dest.name;
  31923. }
  31924. if (isString(dest) || isArray(dest)) {
  31925. resultObj.dest = dest;
  31926. }
  31927. }
  31928. };
  31929. return Catalog;
  31930. }();
  31931. var XRef = function XRefClosure() {
  31932. function XRef(stream, pdfManager) {
  31933. this.stream = stream;
  31934. this.pdfManager = pdfManager;
  31935. this.entries = [];
  31936. this.xrefstms = Object.create(null);
  31937. this.cache = [];
  31938. this.stats = {
  31939. streamTypes: [],
  31940. fontTypes: []
  31941. };
  31942. }
  31943. XRef.prototype = {
  31944. setStartXRef: function XRef_setStartXRef(startXRef) {
  31945. this.startXRefQueue = [startXRef];
  31946. },
  31947. parse: function XRef_parse(recoveryMode) {
  31948. var trailerDict;
  31949. if (!recoveryMode) {
  31950. trailerDict = this.readXRef();
  31951. } else {
  31952. warn('Indexing all PDF objects');
  31953. trailerDict = this.indexObjects();
  31954. }
  31955. trailerDict.assignXref(this);
  31956. this.trailer = trailerDict;
  31957. var encrypt = trailerDict.get('Encrypt');
  31958. if (isDict(encrypt)) {
  31959. var ids = trailerDict.get('ID');
  31960. var fileId = ids && ids.length ? ids[0] : '';
  31961. encrypt.suppressEncryption = true;
  31962. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31963. }
  31964. if (!(this.root = trailerDict.get('Root'))) {
  31965. error('Invalid root reference');
  31966. }
  31967. },
  31968. processXRefTable: function XRef_processXRefTable(parser) {
  31969. if (!('tableState' in this)) {
  31970. this.tableState = {
  31971. entryNum: 0,
  31972. streamPos: parser.lexer.stream.pos,
  31973. parserBuf1: parser.buf1,
  31974. parserBuf2: parser.buf2
  31975. };
  31976. }
  31977. var obj = this.readXRefTable(parser);
  31978. if (!isCmd(obj, 'trailer')) {
  31979. error('Invalid XRef table: could not find trailer dictionary');
  31980. }
  31981. var dict = parser.getObj();
  31982. if (!isDict(dict) && dict.dict) {
  31983. dict = dict.dict;
  31984. }
  31985. if (!isDict(dict)) {
  31986. error('Invalid XRef table: could not parse trailer dictionary');
  31987. }
  31988. delete this.tableState;
  31989. return dict;
  31990. },
  31991. readXRefTable: function XRef_readXRefTable(parser) {
  31992. var stream = parser.lexer.stream;
  31993. var tableState = this.tableState;
  31994. stream.pos = tableState.streamPos;
  31995. parser.buf1 = tableState.parserBuf1;
  31996. parser.buf2 = tableState.parserBuf2;
  31997. var obj;
  31998. while (true) {
  31999. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  32000. if (isCmd(obj = parser.getObj(), 'trailer')) {
  32001. break;
  32002. }
  32003. tableState.firstEntryNum = obj;
  32004. tableState.entryCount = parser.getObj();
  32005. }
  32006. var first = tableState.firstEntryNum;
  32007. var count = tableState.entryCount;
  32008. if (!isInt(first) || !isInt(count)) {
  32009. error('Invalid XRef table: wrong types in subsection header');
  32010. }
  32011. for (var i = tableState.entryNum; i < count; i++) {
  32012. tableState.streamPos = stream.pos;
  32013. tableState.entryNum = i;
  32014. tableState.parserBuf1 = parser.buf1;
  32015. tableState.parserBuf2 = parser.buf2;
  32016. var entry = {};
  32017. entry.offset = parser.getObj();
  32018. entry.gen = parser.getObj();
  32019. var type = parser.getObj();
  32020. if (isCmd(type, 'f')) {
  32021. entry.free = true;
  32022. } else if (isCmd(type, 'n')) {
  32023. entry.uncompressed = true;
  32024. }
  32025. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  32026. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  32027. }
  32028. if (i === 0 && entry.free && first === 1) {
  32029. first = 0;
  32030. }
  32031. if (!this.entries[i + first]) {
  32032. this.entries[i + first] = entry;
  32033. }
  32034. }
  32035. tableState.entryNum = 0;
  32036. tableState.streamPos = stream.pos;
  32037. tableState.parserBuf1 = parser.buf1;
  32038. tableState.parserBuf2 = parser.buf2;
  32039. delete tableState.firstEntryNum;
  32040. delete tableState.entryCount;
  32041. }
  32042. if (this.entries[0] && !this.entries[0].free) {
  32043. error('Invalid XRef table: unexpected first object');
  32044. }
  32045. return obj;
  32046. },
  32047. processXRefStream: function XRef_processXRefStream(stream) {
  32048. if (!('streamState' in this)) {
  32049. var streamParameters = stream.dict;
  32050. var byteWidths = streamParameters.get('W');
  32051. var range = streamParameters.get('Index');
  32052. if (!range) {
  32053. range = [
  32054. 0,
  32055. streamParameters.get('Size')
  32056. ];
  32057. }
  32058. this.streamState = {
  32059. entryRanges: range,
  32060. byteWidths: byteWidths,
  32061. entryNum: 0,
  32062. streamPos: stream.pos
  32063. };
  32064. }
  32065. this.readXRefStream(stream);
  32066. delete this.streamState;
  32067. return stream.dict;
  32068. },
  32069. readXRefStream: function XRef_readXRefStream(stream) {
  32070. var i, j;
  32071. var streamState = this.streamState;
  32072. stream.pos = streamState.streamPos;
  32073. var byteWidths = streamState.byteWidths;
  32074. var typeFieldWidth = byteWidths[0];
  32075. var offsetFieldWidth = byteWidths[1];
  32076. var generationFieldWidth = byteWidths[2];
  32077. var entryRanges = streamState.entryRanges;
  32078. while (entryRanges.length > 0) {
  32079. var first = entryRanges[0];
  32080. var n = entryRanges[1];
  32081. if (!isInt(first) || !isInt(n)) {
  32082. error('Invalid XRef range fields: ' + first + ', ' + n);
  32083. }
  32084. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  32085. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  32086. }
  32087. for (i = streamState.entryNum; i < n; ++i) {
  32088. streamState.entryNum = i;
  32089. streamState.streamPos = stream.pos;
  32090. var type = 0, offset = 0, generation = 0;
  32091. for (j = 0; j < typeFieldWidth; ++j) {
  32092. type = type << 8 | stream.getByte();
  32093. }
  32094. if (typeFieldWidth === 0) {
  32095. type = 1;
  32096. }
  32097. for (j = 0; j < offsetFieldWidth; ++j) {
  32098. offset = offset << 8 | stream.getByte();
  32099. }
  32100. for (j = 0; j < generationFieldWidth; ++j) {
  32101. generation = generation << 8 | stream.getByte();
  32102. }
  32103. var entry = {};
  32104. entry.offset = offset;
  32105. entry.gen = generation;
  32106. switch (type) {
  32107. case 0:
  32108. entry.free = true;
  32109. break;
  32110. case 1:
  32111. entry.uncompressed = true;
  32112. break;
  32113. case 2:
  32114. break;
  32115. default:
  32116. error('Invalid XRef entry type: ' + type);
  32117. }
  32118. if (!this.entries[first + i]) {
  32119. this.entries[first + i] = entry;
  32120. }
  32121. }
  32122. streamState.entryNum = 0;
  32123. streamState.streamPos = stream.pos;
  32124. entryRanges.splice(0, 2);
  32125. }
  32126. },
  32127. indexObjects: function XRef_indexObjects() {
  32128. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  32129. var PERCENT = 0x25, LT = 0x3C;
  32130. function readToken(data, offset) {
  32131. var token = '', ch = data[offset];
  32132. while (ch !== LF && ch !== CR && ch !== LT) {
  32133. if (++offset >= data.length) {
  32134. break;
  32135. }
  32136. token += String.fromCharCode(ch);
  32137. ch = data[offset];
  32138. }
  32139. return token;
  32140. }
  32141. function skipUntil(data, offset, what) {
  32142. var length = what.length, dataLength = data.length;
  32143. var skipped = 0;
  32144. while (offset < dataLength) {
  32145. var i = 0;
  32146. while (i < length && data[offset + i] === what[i]) {
  32147. ++i;
  32148. }
  32149. if (i >= length) {
  32150. break;
  32151. }
  32152. offset++;
  32153. skipped++;
  32154. }
  32155. return skipped;
  32156. }
  32157. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  32158. var trailerBytes = new Uint8Array([
  32159. 116,
  32160. 114,
  32161. 97,
  32162. 105,
  32163. 108,
  32164. 101,
  32165. 114
  32166. ]);
  32167. var startxrefBytes = new Uint8Array([
  32168. 115,
  32169. 116,
  32170. 97,
  32171. 114,
  32172. 116,
  32173. 120,
  32174. 114,
  32175. 101,
  32176. 102
  32177. ]);
  32178. var endobjBytes = new Uint8Array([
  32179. 101,
  32180. 110,
  32181. 100,
  32182. 111,
  32183. 98,
  32184. 106
  32185. ]);
  32186. var xrefBytes = new Uint8Array([
  32187. 47,
  32188. 88,
  32189. 82,
  32190. 101,
  32191. 102
  32192. ]);
  32193. this.entries.length = 0;
  32194. var stream = this.stream;
  32195. stream.pos = 0;
  32196. var buffer = stream.getBytes();
  32197. var position = stream.start, length = buffer.length;
  32198. var trailers = [], xrefStms = [];
  32199. while (position < length) {
  32200. var ch = buffer[position];
  32201. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  32202. ++position;
  32203. continue;
  32204. }
  32205. if (ch === PERCENT) {
  32206. do {
  32207. ++position;
  32208. if (position >= length) {
  32209. break;
  32210. }
  32211. ch = buffer[position];
  32212. } while (ch !== LF && ch !== CR);
  32213. continue;
  32214. }
  32215. var token = readToken(buffer, position);
  32216. var m;
  32217. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  32218. position += skipUntil(buffer, position, trailerBytes);
  32219. trailers.push(position);
  32220. position += skipUntil(buffer, position, startxrefBytes);
  32221. } else if (m = objRegExp.exec(token)) {
  32222. if (typeof this.entries[m[1]] === 'undefined') {
  32223. this.entries[m[1]] = {
  32224. offset: position - stream.start,
  32225. gen: m[2] | 0,
  32226. uncompressed: true
  32227. };
  32228. }
  32229. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  32230. var content = buffer.subarray(position, position + contentLength);
  32231. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  32232. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  32233. xrefStms.push(position - stream.start);
  32234. this.xrefstms[position - stream.start] = 1;
  32235. }
  32236. position += contentLength;
  32237. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  32238. trailers.push(position);
  32239. position += skipUntil(buffer, position, startxrefBytes);
  32240. } else {
  32241. position += token.length + 1;
  32242. }
  32243. }
  32244. var i, ii;
  32245. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  32246. this.startXRefQueue.push(xrefStms[i]);
  32247. this.readXRef(true);
  32248. }
  32249. var dict;
  32250. for (i = 0, ii = trailers.length; i < ii; ++i) {
  32251. stream.pos = trailers[i];
  32252. var parser = new Parser(new Lexer(stream), true, this, true);
  32253. var obj = parser.getObj();
  32254. if (!isCmd(obj, 'trailer')) {
  32255. continue;
  32256. }
  32257. dict = parser.getObj();
  32258. if (!isDict(dict)) {
  32259. continue;
  32260. }
  32261. if (dict.has('ID')) {
  32262. return dict;
  32263. }
  32264. }
  32265. if (dict) {
  32266. return dict;
  32267. }
  32268. throw new InvalidPDFException('Invalid PDF structure');
  32269. },
  32270. readXRef: function XRef_readXRef(recoveryMode) {
  32271. var stream = this.stream;
  32272. try {
  32273. while (this.startXRefQueue.length) {
  32274. var startXRef = this.startXRefQueue[0];
  32275. stream.pos = startXRef + stream.start;
  32276. var parser = new Parser(new Lexer(stream), true, this);
  32277. var obj = parser.getObj();
  32278. var dict;
  32279. if (isCmd(obj, 'xref')) {
  32280. dict = this.processXRefTable(parser);
  32281. if (!this.topDict) {
  32282. this.topDict = dict;
  32283. }
  32284. obj = dict.get('XRefStm');
  32285. if (isInt(obj)) {
  32286. var pos = obj;
  32287. if (!(pos in this.xrefstms)) {
  32288. this.xrefstms[pos] = 1;
  32289. this.startXRefQueue.push(pos);
  32290. }
  32291. }
  32292. } else if (isInt(obj)) {
  32293. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  32294. error('Invalid XRef stream');
  32295. }
  32296. dict = this.processXRefStream(obj);
  32297. if (!this.topDict) {
  32298. this.topDict = dict;
  32299. }
  32300. if (!dict) {
  32301. error('Failed to read XRef stream');
  32302. }
  32303. } else {
  32304. error('Invalid XRef stream header');
  32305. }
  32306. obj = dict.get('Prev');
  32307. if (isInt(obj)) {
  32308. this.startXRefQueue.push(obj);
  32309. } else if (isRef(obj)) {
  32310. this.startXRefQueue.push(obj.num);
  32311. }
  32312. this.startXRefQueue.shift();
  32313. }
  32314. return this.topDict;
  32315. } catch (e) {
  32316. if (e instanceof MissingDataException) {
  32317. throw e;
  32318. }
  32319. info('(while reading XRef): ' + e);
  32320. }
  32321. if (recoveryMode) {
  32322. return;
  32323. }
  32324. throw new XRefParseException();
  32325. },
  32326. getEntry: function XRef_getEntry(i) {
  32327. var xrefEntry = this.entries[i];
  32328. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  32329. return xrefEntry;
  32330. }
  32331. return null;
  32332. },
  32333. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  32334. if (!isRef(obj)) {
  32335. return obj;
  32336. }
  32337. return this.fetch(obj, suppressEncryption);
  32338. },
  32339. fetch: function XRef_fetch(ref, suppressEncryption) {
  32340. assert(isRef(ref), 'ref object is not a reference');
  32341. var num = ref.num;
  32342. if (num in this.cache) {
  32343. var cacheEntry = this.cache[num];
  32344. return cacheEntry;
  32345. }
  32346. var xrefEntry = this.getEntry(num);
  32347. if (xrefEntry === null) {
  32348. return this.cache[num] = null;
  32349. }
  32350. if (xrefEntry.uncompressed) {
  32351. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  32352. } else {
  32353. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  32354. }
  32355. if (isDict(xrefEntry)) {
  32356. xrefEntry.objId = ref.toString();
  32357. } else if (isStream(xrefEntry)) {
  32358. xrefEntry.dict.objId = ref.toString();
  32359. }
  32360. return xrefEntry;
  32361. },
  32362. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  32363. var gen = ref.gen;
  32364. var num = ref.num;
  32365. if (xrefEntry.gen !== gen) {
  32366. error('inconsistent generation in XRef');
  32367. }
  32368. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  32369. var parser = new Parser(new Lexer(stream), true, this);
  32370. var obj1 = parser.getObj();
  32371. var obj2 = parser.getObj();
  32372. var obj3 = parser.getObj();
  32373. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  32374. error('bad XRef entry');
  32375. }
  32376. if (!isCmd(obj3, 'obj')) {
  32377. if (obj3.cmd.indexOf('obj') === 0) {
  32378. num = parseInt(obj3.cmd.substring(3), 10);
  32379. if (!isNaN(num)) {
  32380. return num;
  32381. }
  32382. }
  32383. error('bad XRef entry');
  32384. }
  32385. if (this.encrypt && !suppressEncryption) {
  32386. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  32387. } else {
  32388. xrefEntry = parser.getObj();
  32389. }
  32390. if (!isStream(xrefEntry)) {
  32391. this.cache[num] = xrefEntry;
  32392. }
  32393. return xrefEntry;
  32394. },
  32395. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  32396. var tableOffset = xrefEntry.offset;
  32397. var stream = this.fetch(new Ref(tableOffset, 0));
  32398. if (!isStream(stream)) {
  32399. error('bad ObjStm stream');
  32400. }
  32401. var first = stream.dict.get('First');
  32402. var n = stream.dict.get('N');
  32403. if (!isInt(first) || !isInt(n)) {
  32404. error('invalid first and n parameters for ObjStm stream');
  32405. }
  32406. var parser = new Parser(new Lexer(stream), false, this);
  32407. parser.allowStreams = true;
  32408. var i, entries = [], num, nums = [];
  32409. for (i = 0; i < n; ++i) {
  32410. num = parser.getObj();
  32411. if (!isInt(num)) {
  32412. error('invalid object number in the ObjStm stream: ' + num);
  32413. }
  32414. nums.push(num);
  32415. var offset = parser.getObj();
  32416. if (!isInt(offset)) {
  32417. error('invalid object offset in the ObjStm stream: ' + offset);
  32418. }
  32419. }
  32420. for (i = 0; i < n; ++i) {
  32421. entries.push(parser.getObj());
  32422. if (isCmd(parser.buf1, 'endobj')) {
  32423. parser.shift();
  32424. }
  32425. num = nums[i];
  32426. var entry = this.entries[num];
  32427. if (entry && entry.offset === tableOffset && entry.gen === i) {
  32428. this.cache[num] = entries[i];
  32429. }
  32430. }
  32431. xrefEntry = entries[xrefEntry.gen];
  32432. if (xrefEntry === undefined) {
  32433. error('bad XRef entry for compressed object');
  32434. }
  32435. return xrefEntry;
  32436. },
  32437. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  32438. if (!isRef(obj)) {
  32439. return Promise.resolve(obj);
  32440. }
  32441. return this.fetchAsync(obj, suppressEncryption);
  32442. },
  32443. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  32444. var streamManager = this.stream.manager;
  32445. var xref = this;
  32446. return new Promise(function tryFetch(resolve, reject) {
  32447. try {
  32448. resolve(xref.fetch(ref, suppressEncryption));
  32449. } catch (e) {
  32450. if (e instanceof MissingDataException) {
  32451. streamManager.requestRange(e.begin, e.end).then(function () {
  32452. tryFetch(resolve, reject);
  32453. }, reject);
  32454. return;
  32455. }
  32456. reject(e);
  32457. }
  32458. });
  32459. },
  32460. getCatalogObj: function XRef_getCatalogObj() {
  32461. return this.root;
  32462. }
  32463. };
  32464. return XRef;
  32465. }();
  32466. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  32467. function NameOrNumberTree(root, xref) {
  32468. throw new Error('Cannot initialize NameOrNumberTree.');
  32469. }
  32470. NameOrNumberTree.prototype = {
  32471. getAll: function NameOrNumberTree_getAll() {
  32472. var dict = Object.create(null);
  32473. if (!this.root) {
  32474. return dict;
  32475. }
  32476. var xref = this.xref;
  32477. var processed = new RefSet();
  32478. processed.put(this.root);
  32479. var queue = [this.root];
  32480. while (queue.length > 0) {
  32481. var i, n;
  32482. var obj = xref.fetchIfRef(queue.shift());
  32483. if (!isDict(obj)) {
  32484. continue;
  32485. }
  32486. if (obj.has('Kids')) {
  32487. var kids = obj.get('Kids');
  32488. for (i = 0, n = kids.length; i < n; i++) {
  32489. var kid = kids[i];
  32490. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  32491. queue.push(kid);
  32492. processed.put(kid);
  32493. }
  32494. continue;
  32495. }
  32496. var entries = obj.get(this._type);
  32497. if (isArray(entries)) {
  32498. for (i = 0, n = entries.length; i < n; i += 2) {
  32499. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  32500. }
  32501. }
  32502. }
  32503. return dict;
  32504. },
  32505. get: function NameOrNumberTree_get(key) {
  32506. if (!this.root) {
  32507. return null;
  32508. }
  32509. var xref = this.xref;
  32510. var kidsOrEntries = xref.fetchIfRef(this.root);
  32511. var loopCount = 0;
  32512. var MAX_LEVELS = 10;
  32513. var l, r, m;
  32514. while (kidsOrEntries.has('Kids')) {
  32515. if (++loopCount > MAX_LEVELS) {
  32516. warn('Search depth limit reached for "' + this._type + '" tree.');
  32517. return null;
  32518. }
  32519. var kids = kidsOrEntries.get('Kids');
  32520. if (!isArray(kids)) {
  32521. return null;
  32522. }
  32523. l = 0;
  32524. r = kids.length - 1;
  32525. while (l <= r) {
  32526. m = l + r >> 1;
  32527. var kid = xref.fetchIfRef(kids[m]);
  32528. var limits = kid.get('Limits');
  32529. if (key < xref.fetchIfRef(limits[0])) {
  32530. r = m - 1;
  32531. } else if (key > xref.fetchIfRef(limits[1])) {
  32532. l = m + 1;
  32533. } else {
  32534. kidsOrEntries = xref.fetchIfRef(kids[m]);
  32535. break;
  32536. }
  32537. }
  32538. if (l > r) {
  32539. return null;
  32540. }
  32541. }
  32542. var entries = kidsOrEntries.get(this._type);
  32543. if (isArray(entries)) {
  32544. l = 0;
  32545. r = entries.length - 2;
  32546. while (l <= r) {
  32547. m = l + r & ~1;
  32548. var currentKey = xref.fetchIfRef(entries[m]);
  32549. if (key < currentKey) {
  32550. r = m - 2;
  32551. } else if (key > currentKey) {
  32552. l = m + 2;
  32553. } else {
  32554. return xref.fetchIfRef(entries[m + 1]);
  32555. }
  32556. }
  32557. }
  32558. return null;
  32559. }
  32560. };
  32561. return NameOrNumberTree;
  32562. }();
  32563. var NameTree = function NameTreeClosure() {
  32564. function NameTree(root, xref) {
  32565. this.root = root;
  32566. this.xref = xref;
  32567. this._type = 'Names';
  32568. }
  32569. Util.inherit(NameTree, NameOrNumberTree, {});
  32570. return NameTree;
  32571. }();
  32572. var NumberTree = function NumberTreeClosure() {
  32573. function NumberTree(root, xref) {
  32574. this.root = root;
  32575. this.xref = xref;
  32576. this._type = 'Nums';
  32577. }
  32578. Util.inherit(NumberTree, NameOrNumberTree, {});
  32579. return NumberTree;
  32580. }();
  32581. var FileSpec = function FileSpecClosure() {
  32582. function FileSpec(root, xref) {
  32583. if (!root || !isDict(root)) {
  32584. return;
  32585. }
  32586. this.xref = xref;
  32587. this.root = root;
  32588. if (root.has('FS')) {
  32589. this.fs = root.get('FS');
  32590. }
  32591. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  32592. if (root.has('RF')) {
  32593. warn('Related file specifications are not supported');
  32594. }
  32595. this.contentAvailable = true;
  32596. if (!root.has('EF')) {
  32597. this.contentAvailable = false;
  32598. warn('Non-embedded file specifications are not supported');
  32599. }
  32600. }
  32601. function pickPlatformItem(dict) {
  32602. if (dict.has('UF')) {
  32603. return dict.get('UF');
  32604. } else if (dict.has('F')) {
  32605. return dict.get('F');
  32606. } else if (dict.has('Unix')) {
  32607. return dict.get('Unix');
  32608. } else if (dict.has('Mac')) {
  32609. return dict.get('Mac');
  32610. } else if (dict.has('DOS')) {
  32611. return dict.get('DOS');
  32612. }
  32613. return null;
  32614. }
  32615. FileSpec.prototype = {
  32616. get filename() {
  32617. if (!this._filename && this.root) {
  32618. var filename = pickPlatformItem(this.root) || 'unnamed';
  32619. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  32620. }
  32621. return this._filename;
  32622. },
  32623. get content() {
  32624. if (!this.contentAvailable) {
  32625. return null;
  32626. }
  32627. if (!this.contentRef && this.root) {
  32628. this.contentRef = pickPlatformItem(this.root.get('EF'));
  32629. }
  32630. var content = null;
  32631. if (this.contentRef) {
  32632. var xref = this.xref;
  32633. var fileObj = xref.fetchIfRef(this.contentRef);
  32634. if (fileObj && isStream(fileObj)) {
  32635. content = fileObj.getBytes();
  32636. } else {
  32637. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  32638. }
  32639. } else {
  32640. warn('Embedded file specification does not have a content');
  32641. }
  32642. return content;
  32643. },
  32644. get serializable() {
  32645. return {
  32646. filename: this.filename,
  32647. content: this.content
  32648. };
  32649. }
  32650. };
  32651. return FileSpec;
  32652. }();
  32653. var ObjectLoader = function () {
  32654. function mayHaveChildren(value) {
  32655. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  32656. }
  32657. function addChildren(node, nodesToVisit) {
  32658. var value;
  32659. if (isDict(node) || isStream(node)) {
  32660. var map;
  32661. if (isDict(node)) {
  32662. map = node.map;
  32663. } else {
  32664. map = node.dict.map;
  32665. }
  32666. for (var key in map) {
  32667. value = map[key];
  32668. if (mayHaveChildren(value)) {
  32669. nodesToVisit.push(value);
  32670. }
  32671. }
  32672. } else if (isArray(node)) {
  32673. for (var i = 0, ii = node.length; i < ii; i++) {
  32674. value = node[i];
  32675. if (mayHaveChildren(value)) {
  32676. nodesToVisit.push(value);
  32677. }
  32678. }
  32679. }
  32680. }
  32681. function ObjectLoader(obj, keys, xref) {
  32682. this.obj = obj;
  32683. this.keys = keys;
  32684. this.xref = xref;
  32685. this.refSet = null;
  32686. this.capability = null;
  32687. }
  32688. ObjectLoader.prototype = {
  32689. load: function ObjectLoader_load() {
  32690. var keys = this.keys;
  32691. this.capability = createPromiseCapability();
  32692. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  32693. this.capability.resolve();
  32694. return this.capability.promise;
  32695. }
  32696. this.refSet = new RefSet();
  32697. var nodesToVisit = [];
  32698. for (var i = 0; i < keys.length; i++) {
  32699. nodesToVisit.push(this.obj[keys[i]]);
  32700. }
  32701. this._walk(nodesToVisit);
  32702. return this.capability.promise;
  32703. },
  32704. _walk: function ObjectLoader_walk(nodesToVisit) {
  32705. var nodesToRevisit = [];
  32706. var pendingRequests = [];
  32707. while (nodesToVisit.length) {
  32708. var currentNode = nodesToVisit.pop();
  32709. if (isRef(currentNode)) {
  32710. if (this.refSet.has(currentNode)) {
  32711. continue;
  32712. }
  32713. try {
  32714. var ref = currentNode;
  32715. this.refSet.put(ref);
  32716. currentNode = this.xref.fetch(currentNode);
  32717. } catch (e) {
  32718. if (!(e instanceof MissingDataException)) {
  32719. throw e;
  32720. }
  32721. nodesToRevisit.push(currentNode);
  32722. pendingRequests.push({
  32723. begin: e.begin,
  32724. end: e.end
  32725. });
  32726. }
  32727. }
  32728. if (currentNode && currentNode.getBaseStreams) {
  32729. var baseStreams = currentNode.getBaseStreams();
  32730. var foundMissingData = false;
  32731. for (var i = 0; i < baseStreams.length; i++) {
  32732. var stream = baseStreams[i];
  32733. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  32734. foundMissingData = true;
  32735. pendingRequests.push({
  32736. begin: stream.start,
  32737. end: stream.end
  32738. });
  32739. }
  32740. }
  32741. if (foundMissingData) {
  32742. nodesToRevisit.push(currentNode);
  32743. }
  32744. }
  32745. addChildren(currentNode, nodesToVisit);
  32746. }
  32747. if (pendingRequests.length) {
  32748. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  32749. nodesToVisit = nodesToRevisit;
  32750. for (var i = 0; i < nodesToRevisit.length; i++) {
  32751. var node = nodesToRevisit[i];
  32752. if (isRef(node)) {
  32753. this.refSet.remove(node);
  32754. }
  32755. }
  32756. this._walk(nodesToVisit);
  32757. }.bind(this), this.capability.reject);
  32758. return;
  32759. }
  32760. this.refSet = null;
  32761. this.capability.resolve();
  32762. }
  32763. };
  32764. return ObjectLoader;
  32765. }();
  32766. exports.Catalog = Catalog;
  32767. exports.ObjectLoader = ObjectLoader;
  32768. exports.XRef = XRef;
  32769. exports.FileSpec = FileSpec;
  32770. /***/ }),
  32771. /* 16 */
  32772. /***/ (function(module, exports, __w_pdfjs_require__) {
  32773. "use strict";
  32774. var sharedUtil = __w_pdfjs_require__(0);
  32775. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32776. var getStdFontMap = getLookupTableFactory(function (t) {
  32777. t['ArialNarrow'] = 'Helvetica';
  32778. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  32779. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  32780. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  32781. t['ArialBlack'] = 'Helvetica';
  32782. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  32783. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  32784. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  32785. t['Arial-Black'] = 'Helvetica';
  32786. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  32787. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  32788. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  32789. t['Arial'] = 'Helvetica';
  32790. t['Arial-Bold'] = 'Helvetica-Bold';
  32791. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  32792. t['Arial-Italic'] = 'Helvetica-Oblique';
  32793. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  32794. t['Arial-BoldMT'] = 'Helvetica-Bold';
  32795. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  32796. t['ArialMT'] = 'Helvetica';
  32797. t['Courier-Bold'] = 'Courier-Bold';
  32798. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  32799. t['Courier-Italic'] = 'Courier-Oblique';
  32800. t['CourierNew'] = 'Courier';
  32801. t['CourierNew-Bold'] = 'Courier-Bold';
  32802. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  32803. t['CourierNew-Italic'] = 'Courier-Oblique';
  32804. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  32805. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  32806. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  32807. t['CourierNewPSMT'] = 'Courier';
  32808. t['Helvetica'] = 'Helvetica';
  32809. t['Helvetica-Bold'] = 'Helvetica-Bold';
  32810. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  32811. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32812. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32813. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32814. t['Symbol-Bold'] = 'Symbol';
  32815. t['Symbol-BoldItalic'] = 'Symbol';
  32816. t['Symbol-Italic'] = 'Symbol';
  32817. t['TimesNewRoman'] = 'Times-Roman';
  32818. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32819. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32820. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32821. t['TimesNewRomanPS'] = 'Times-Roman';
  32822. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32823. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32824. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32825. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32826. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32827. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32828. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32829. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32830. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32831. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32832. });
  32833. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32834. t['CenturyGothic'] = 'Helvetica';
  32835. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32836. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32837. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32838. t['ComicSansMS'] = 'Comic Sans MS';
  32839. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32840. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32841. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32842. t['LucidaConsole'] = 'Courier';
  32843. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32844. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32845. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32846. t['MS-Gothic'] = 'MS Gothic';
  32847. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32848. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32849. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32850. t['MS-Mincho'] = 'MS Mincho';
  32851. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32852. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32853. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32854. t['MS-PGothic'] = 'MS PGothic';
  32855. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32856. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32857. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32858. t['MS-PMincho'] = 'MS PMincho';
  32859. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32860. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32861. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32862. t['NuptialScript'] = 'Times-Italic';
  32863. t['Wingdings'] = 'ZapfDingbats';
  32864. });
  32865. var getSerifFonts = getLookupTableFactory(function (t) {
  32866. t['Adobe Jenson'] = true;
  32867. t['Adobe Text'] = true;
  32868. t['Albertus'] = true;
  32869. t['Aldus'] = true;
  32870. t['Alexandria'] = true;
  32871. t['Algerian'] = true;
  32872. t['American Typewriter'] = true;
  32873. t['Antiqua'] = true;
  32874. t['Apex'] = true;
  32875. t['Arno'] = true;
  32876. t['Aster'] = true;
  32877. t['Aurora'] = true;
  32878. t['Baskerville'] = true;
  32879. t['Bell'] = true;
  32880. t['Bembo'] = true;
  32881. t['Bembo Schoolbook'] = true;
  32882. t['Benguiat'] = true;
  32883. t['Berkeley Old Style'] = true;
  32884. t['Bernhard Modern'] = true;
  32885. t['Berthold City'] = true;
  32886. t['Bodoni'] = true;
  32887. t['Bauer Bodoni'] = true;
  32888. t['Book Antiqua'] = true;
  32889. t['Bookman'] = true;
  32890. t['Bordeaux Roman'] = true;
  32891. t['Californian FB'] = true;
  32892. t['Calisto'] = true;
  32893. t['Calvert'] = true;
  32894. t['Capitals'] = true;
  32895. t['Cambria'] = true;
  32896. t['Cartier'] = true;
  32897. t['Caslon'] = true;
  32898. t['Catull'] = true;
  32899. t['Centaur'] = true;
  32900. t['Century Old Style'] = true;
  32901. t['Century Schoolbook'] = true;
  32902. t['Chaparral'] = true;
  32903. t['Charis SIL'] = true;
  32904. t['Cheltenham'] = true;
  32905. t['Cholla Slab'] = true;
  32906. t['Clarendon'] = true;
  32907. t['Clearface'] = true;
  32908. t['Cochin'] = true;
  32909. t['Colonna'] = true;
  32910. t['Computer Modern'] = true;
  32911. t['Concrete Roman'] = true;
  32912. t['Constantia'] = true;
  32913. t['Cooper Black'] = true;
  32914. t['Corona'] = true;
  32915. t['Ecotype'] = true;
  32916. t['Egyptienne'] = true;
  32917. t['Elephant'] = true;
  32918. t['Excelsior'] = true;
  32919. t['Fairfield'] = true;
  32920. t['FF Scala'] = true;
  32921. t['Folkard'] = true;
  32922. t['Footlight'] = true;
  32923. t['FreeSerif'] = true;
  32924. t['Friz Quadrata'] = true;
  32925. t['Garamond'] = true;
  32926. t['Gentium'] = true;
  32927. t['Georgia'] = true;
  32928. t['Gloucester'] = true;
  32929. t['Goudy Old Style'] = true;
  32930. t['Goudy Schoolbook'] = true;
  32931. t['Goudy Pro Font'] = true;
  32932. t['Granjon'] = true;
  32933. t['Guardian Egyptian'] = true;
  32934. t['Heather'] = true;
  32935. t['Hercules'] = true;
  32936. t['High Tower Text'] = true;
  32937. t['Hiroshige'] = true;
  32938. t['Hoefler Text'] = true;
  32939. t['Humana Serif'] = true;
  32940. t['Imprint'] = true;
  32941. t['Ionic No. 5'] = true;
  32942. t['Janson'] = true;
  32943. t['Joanna'] = true;
  32944. t['Korinna'] = true;
  32945. t['Lexicon'] = true;
  32946. t['Liberation Serif'] = true;
  32947. t['Linux Libertine'] = true;
  32948. t['Literaturnaya'] = true;
  32949. t['Lucida'] = true;
  32950. t['Lucida Bright'] = true;
  32951. t['Melior'] = true;
  32952. t['Memphis'] = true;
  32953. t['Miller'] = true;
  32954. t['Minion'] = true;
  32955. t['Modern'] = true;
  32956. t['Mona Lisa'] = true;
  32957. t['Mrs Eaves'] = true;
  32958. t['MS Serif'] = true;
  32959. t['Museo Slab'] = true;
  32960. t['New York'] = true;
  32961. t['Nimbus Roman'] = true;
  32962. t['NPS Rawlinson Roadway'] = true;
  32963. t['NuptialScript'] = true;
  32964. t['Palatino'] = true;
  32965. t['Perpetua'] = true;
  32966. t['Plantin'] = true;
  32967. t['Plantin Schoolbook'] = true;
  32968. t['Playbill'] = true;
  32969. t['Poor Richard'] = true;
  32970. t['Rawlinson Roadway'] = true;
  32971. t['Renault'] = true;
  32972. t['Requiem'] = true;
  32973. t['Rockwell'] = true;
  32974. t['Roman'] = true;
  32975. t['Rotis Serif'] = true;
  32976. t['Sabon'] = true;
  32977. t['Scala'] = true;
  32978. t['Seagull'] = true;
  32979. t['Sistina'] = true;
  32980. t['Souvenir'] = true;
  32981. t['STIX'] = true;
  32982. t['Stone Informal'] = true;
  32983. t['Stone Serif'] = true;
  32984. t['Sylfaen'] = true;
  32985. t['Times'] = true;
  32986. t['Trajan'] = true;
  32987. t['Trinité'] = true;
  32988. t['Trump Mediaeval'] = true;
  32989. t['Utopia'] = true;
  32990. t['Vale Type'] = true;
  32991. t['Bitstream Vera'] = true;
  32992. t['Vera Serif'] = true;
  32993. t['Versailles'] = true;
  32994. t['Wanted'] = true;
  32995. t['Weiss'] = true;
  32996. t['Wide Latin'] = true;
  32997. t['Windsor'] = true;
  32998. t['XITS'] = true;
  32999. });
  33000. var getSymbolsFonts = getLookupTableFactory(function (t) {
  33001. t['Dingbats'] = true;
  33002. t['Symbol'] = true;
  33003. t['ZapfDingbats'] = true;
  33004. });
  33005. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  33006. t[2] = 10;
  33007. t[3] = 32;
  33008. t[4] = 33;
  33009. t[5] = 34;
  33010. t[6] = 35;
  33011. t[7] = 36;
  33012. t[8] = 37;
  33013. t[9] = 38;
  33014. t[10] = 39;
  33015. t[11] = 40;
  33016. t[12] = 41;
  33017. t[13] = 42;
  33018. t[14] = 43;
  33019. t[15] = 44;
  33020. t[16] = 45;
  33021. t[17] = 46;
  33022. t[18] = 47;
  33023. t[19] = 48;
  33024. t[20] = 49;
  33025. t[21] = 50;
  33026. t[22] = 51;
  33027. t[23] = 52;
  33028. t[24] = 53;
  33029. t[25] = 54;
  33030. t[26] = 55;
  33031. t[27] = 56;
  33032. t[28] = 57;
  33033. t[29] = 58;
  33034. t[30] = 894;
  33035. t[31] = 60;
  33036. t[32] = 61;
  33037. t[33] = 62;
  33038. t[34] = 63;
  33039. t[35] = 64;
  33040. t[36] = 65;
  33041. t[37] = 66;
  33042. t[38] = 67;
  33043. t[39] = 68;
  33044. t[40] = 69;
  33045. t[41] = 70;
  33046. t[42] = 71;
  33047. t[43] = 72;
  33048. t[44] = 73;
  33049. t[45] = 74;
  33050. t[46] = 75;
  33051. t[47] = 76;
  33052. t[48] = 77;
  33053. t[49] = 78;
  33054. t[50] = 79;
  33055. t[51] = 80;
  33056. t[52] = 81;
  33057. t[53] = 82;
  33058. t[54] = 83;
  33059. t[55] = 84;
  33060. t[56] = 85;
  33061. t[57] = 86;
  33062. t[58] = 87;
  33063. t[59] = 88;
  33064. t[60] = 89;
  33065. t[61] = 90;
  33066. t[62] = 91;
  33067. t[63] = 92;
  33068. t[64] = 93;
  33069. t[65] = 94;
  33070. t[66] = 95;
  33071. t[67] = 96;
  33072. t[68] = 97;
  33073. t[69] = 98;
  33074. t[70] = 99;
  33075. t[71] = 100;
  33076. t[72] = 101;
  33077. t[73] = 102;
  33078. t[74] = 103;
  33079. t[75] = 104;
  33080. t[76] = 105;
  33081. t[77] = 106;
  33082. t[78] = 107;
  33083. t[79] = 108;
  33084. t[80] = 109;
  33085. t[81] = 110;
  33086. t[82] = 111;
  33087. t[83] = 112;
  33088. t[84] = 113;
  33089. t[85] = 114;
  33090. t[86] = 115;
  33091. t[87] = 116;
  33092. t[88] = 117;
  33093. t[89] = 118;
  33094. t[90] = 119;
  33095. t[91] = 120;
  33096. t[92] = 121;
  33097. t[93] = 122;
  33098. t[94] = 123;
  33099. t[95] = 124;
  33100. t[96] = 125;
  33101. t[97] = 126;
  33102. t[98] = 196;
  33103. t[99] = 197;
  33104. t[100] = 199;
  33105. t[101] = 201;
  33106. t[102] = 209;
  33107. t[103] = 214;
  33108. t[104] = 220;
  33109. t[105] = 225;
  33110. t[106] = 224;
  33111. t[107] = 226;
  33112. t[108] = 228;
  33113. t[109] = 227;
  33114. t[110] = 229;
  33115. t[111] = 231;
  33116. t[112] = 233;
  33117. t[113] = 232;
  33118. t[114] = 234;
  33119. t[115] = 235;
  33120. t[116] = 237;
  33121. t[117] = 236;
  33122. t[118] = 238;
  33123. t[119] = 239;
  33124. t[120] = 241;
  33125. t[121] = 243;
  33126. t[122] = 242;
  33127. t[123] = 244;
  33128. t[124] = 246;
  33129. t[125] = 245;
  33130. t[126] = 250;
  33131. t[127] = 249;
  33132. t[128] = 251;
  33133. t[129] = 252;
  33134. t[130] = 8224;
  33135. t[131] = 176;
  33136. t[132] = 162;
  33137. t[133] = 163;
  33138. t[134] = 167;
  33139. t[135] = 8226;
  33140. t[136] = 182;
  33141. t[137] = 223;
  33142. t[138] = 174;
  33143. t[139] = 169;
  33144. t[140] = 8482;
  33145. t[141] = 180;
  33146. t[142] = 168;
  33147. t[143] = 8800;
  33148. t[144] = 198;
  33149. t[145] = 216;
  33150. t[146] = 8734;
  33151. t[147] = 177;
  33152. t[148] = 8804;
  33153. t[149] = 8805;
  33154. t[150] = 165;
  33155. t[151] = 181;
  33156. t[152] = 8706;
  33157. t[153] = 8721;
  33158. t[154] = 8719;
  33159. t[156] = 8747;
  33160. t[157] = 170;
  33161. t[158] = 186;
  33162. t[159] = 8486;
  33163. t[160] = 230;
  33164. t[161] = 248;
  33165. t[162] = 191;
  33166. t[163] = 161;
  33167. t[164] = 172;
  33168. t[165] = 8730;
  33169. t[166] = 402;
  33170. t[167] = 8776;
  33171. t[168] = 8710;
  33172. t[169] = 171;
  33173. t[170] = 187;
  33174. t[171] = 8230;
  33175. t[210] = 218;
  33176. t[223] = 711;
  33177. t[224] = 321;
  33178. t[225] = 322;
  33179. t[227] = 353;
  33180. t[229] = 382;
  33181. t[234] = 253;
  33182. t[252] = 263;
  33183. t[253] = 268;
  33184. t[254] = 269;
  33185. t[258] = 258;
  33186. t[260] = 260;
  33187. t[261] = 261;
  33188. t[265] = 280;
  33189. t[266] = 281;
  33190. t[268] = 283;
  33191. t[269] = 313;
  33192. t[275] = 323;
  33193. t[276] = 324;
  33194. t[278] = 328;
  33195. t[284] = 345;
  33196. t[285] = 346;
  33197. t[286] = 347;
  33198. t[292] = 367;
  33199. t[295] = 377;
  33200. t[296] = 378;
  33201. t[298] = 380;
  33202. t[305] = 963;
  33203. t[306] = 964;
  33204. t[307] = 966;
  33205. t[308] = 8215;
  33206. t[309] = 8252;
  33207. t[310] = 8319;
  33208. t[311] = 8359;
  33209. t[312] = 8592;
  33210. t[313] = 8593;
  33211. t[337] = 9552;
  33212. t[493] = 1039;
  33213. t[494] = 1040;
  33214. t[705] = 1524;
  33215. t[706] = 8362;
  33216. t[710] = 64288;
  33217. t[711] = 64298;
  33218. t[759] = 1617;
  33219. t[761] = 1776;
  33220. t[763] = 1778;
  33221. t[775] = 1652;
  33222. t[777] = 1764;
  33223. t[778] = 1780;
  33224. t[779] = 1781;
  33225. t[780] = 1782;
  33226. t[782] = 771;
  33227. t[783] = 64726;
  33228. t[786] = 8363;
  33229. t[788] = 8532;
  33230. t[790] = 768;
  33231. t[791] = 769;
  33232. t[792] = 768;
  33233. t[795] = 803;
  33234. t[797] = 64336;
  33235. t[798] = 64337;
  33236. t[799] = 64342;
  33237. t[800] = 64343;
  33238. t[801] = 64344;
  33239. t[802] = 64345;
  33240. t[803] = 64362;
  33241. t[804] = 64363;
  33242. t[805] = 64364;
  33243. t[2424] = 7821;
  33244. t[2425] = 7822;
  33245. t[2426] = 7823;
  33246. t[2427] = 7824;
  33247. t[2428] = 7825;
  33248. t[2429] = 7826;
  33249. t[2430] = 7827;
  33250. t[2433] = 7682;
  33251. t[2678] = 8045;
  33252. t[2679] = 8046;
  33253. t[2830] = 1552;
  33254. t[2838] = 686;
  33255. t[2840] = 751;
  33256. t[2842] = 753;
  33257. t[2843] = 754;
  33258. t[2844] = 755;
  33259. t[2846] = 757;
  33260. t[2856] = 767;
  33261. t[2857] = 848;
  33262. t[2858] = 849;
  33263. t[2862] = 853;
  33264. t[2863] = 854;
  33265. t[2864] = 855;
  33266. t[2865] = 861;
  33267. t[2866] = 862;
  33268. t[2906] = 7460;
  33269. t[2908] = 7462;
  33270. t[2909] = 7463;
  33271. t[2910] = 7464;
  33272. t[2912] = 7466;
  33273. t[2913] = 7467;
  33274. t[2914] = 7468;
  33275. t[2916] = 7470;
  33276. t[2917] = 7471;
  33277. t[2918] = 7472;
  33278. t[2920] = 7474;
  33279. t[2921] = 7475;
  33280. t[2922] = 7476;
  33281. t[2924] = 7478;
  33282. t[2925] = 7479;
  33283. t[2926] = 7480;
  33284. t[2928] = 7482;
  33285. t[2929] = 7483;
  33286. t[2930] = 7484;
  33287. t[2932] = 7486;
  33288. t[2933] = 7487;
  33289. t[2934] = 7488;
  33290. t[2936] = 7490;
  33291. t[2937] = 7491;
  33292. t[2938] = 7492;
  33293. t[2940] = 7494;
  33294. t[2941] = 7495;
  33295. t[2942] = 7496;
  33296. t[2944] = 7498;
  33297. t[2946] = 7500;
  33298. t[2948] = 7502;
  33299. t[2950] = 7504;
  33300. t[2951] = 7505;
  33301. t[2952] = 7506;
  33302. t[2954] = 7508;
  33303. t[2955] = 7509;
  33304. t[2956] = 7510;
  33305. t[2958] = 7512;
  33306. t[2959] = 7513;
  33307. t[2960] = 7514;
  33308. t[2962] = 7516;
  33309. t[2963] = 7517;
  33310. t[2964] = 7518;
  33311. t[2966] = 7520;
  33312. t[2967] = 7521;
  33313. t[2968] = 7522;
  33314. t[2970] = 7524;
  33315. t[2971] = 7525;
  33316. t[2972] = 7526;
  33317. t[2974] = 7528;
  33318. t[2975] = 7529;
  33319. t[2976] = 7530;
  33320. t[2978] = 1537;
  33321. t[2979] = 1538;
  33322. t[2980] = 1539;
  33323. t[2982] = 1549;
  33324. t[2983] = 1551;
  33325. t[2984] = 1552;
  33326. t[2986] = 1554;
  33327. t[2987] = 1555;
  33328. t[2988] = 1556;
  33329. t[2990] = 1623;
  33330. t[2991] = 1624;
  33331. t[2995] = 1775;
  33332. t[2999] = 1791;
  33333. t[3002] = 64290;
  33334. t[3003] = 64291;
  33335. t[3004] = 64292;
  33336. t[3006] = 64294;
  33337. t[3007] = 64295;
  33338. t[3008] = 64296;
  33339. t[3011] = 1900;
  33340. t[3014] = 8223;
  33341. t[3015] = 8244;
  33342. t[3017] = 7532;
  33343. t[3018] = 7533;
  33344. t[3019] = 7534;
  33345. t[3075] = 7590;
  33346. t[3076] = 7591;
  33347. t[3079] = 7594;
  33348. t[3080] = 7595;
  33349. t[3083] = 7598;
  33350. t[3084] = 7599;
  33351. t[3087] = 7602;
  33352. t[3088] = 7603;
  33353. t[3091] = 7606;
  33354. t[3092] = 7607;
  33355. t[3095] = 7610;
  33356. t[3096] = 7611;
  33357. t[3099] = 7614;
  33358. t[3100] = 7615;
  33359. t[3103] = 7618;
  33360. t[3104] = 7619;
  33361. t[3107] = 8337;
  33362. t[3108] = 8338;
  33363. t[3116] = 1884;
  33364. t[3119] = 1885;
  33365. t[3120] = 1885;
  33366. t[3123] = 1886;
  33367. t[3124] = 1886;
  33368. t[3127] = 1887;
  33369. t[3128] = 1887;
  33370. t[3131] = 1888;
  33371. t[3132] = 1888;
  33372. t[3135] = 1889;
  33373. t[3136] = 1889;
  33374. t[3139] = 1890;
  33375. t[3140] = 1890;
  33376. t[3143] = 1891;
  33377. t[3144] = 1891;
  33378. t[3147] = 1892;
  33379. t[3148] = 1892;
  33380. t[3153] = 580;
  33381. t[3154] = 581;
  33382. t[3157] = 584;
  33383. t[3158] = 585;
  33384. t[3161] = 588;
  33385. t[3162] = 589;
  33386. t[3165] = 891;
  33387. t[3166] = 892;
  33388. t[3169] = 1274;
  33389. t[3170] = 1275;
  33390. t[3173] = 1278;
  33391. t[3174] = 1279;
  33392. t[3181] = 7622;
  33393. t[3182] = 7623;
  33394. t[3282] = 11799;
  33395. t[3316] = 578;
  33396. t[3379] = 42785;
  33397. t[3393] = 1159;
  33398. t[3416] = 8377;
  33399. });
  33400. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  33401. t[227] = 322;
  33402. t[264] = 261;
  33403. t[291] = 346;
  33404. });
  33405. exports.getStdFontMap = getStdFontMap;
  33406. exports.getNonStdFontMap = getNonStdFontMap;
  33407. exports.getSerifFonts = getSerifFonts;
  33408. exports.getSymbolsFonts = getSymbolsFonts;
  33409. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  33410. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  33411. /***/ }),
  33412. /* 17 */
  33413. /***/ (function(module, exports, __w_pdfjs_require__) {
  33414. "use strict";
  33415. var sharedUtil = __w_pdfjs_require__(0);
  33416. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  33417. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  33418. t[63721] = 0x00A9;
  33419. t[63193] = 0x00A9;
  33420. t[63720] = 0x00AE;
  33421. t[63194] = 0x00AE;
  33422. t[63722] = 0x2122;
  33423. t[63195] = 0x2122;
  33424. t[63729] = 0x23A7;
  33425. t[63730] = 0x23A8;
  33426. t[63731] = 0x23A9;
  33427. t[63740] = 0x23AB;
  33428. t[63741] = 0x23AC;
  33429. t[63742] = 0x23AD;
  33430. t[63726] = 0x23A1;
  33431. t[63727] = 0x23A2;
  33432. t[63728] = 0x23A3;
  33433. t[63737] = 0x23A4;
  33434. t[63738] = 0x23A5;
  33435. t[63739] = 0x23A6;
  33436. t[63723] = 0x239B;
  33437. t[63724] = 0x239C;
  33438. t[63725] = 0x239D;
  33439. t[63734] = 0x239E;
  33440. t[63735] = 0x239F;
  33441. t[63736] = 0x23A0;
  33442. });
  33443. function mapSpecialUnicodeValues(code) {
  33444. if (code >= 0xFFF0 && code <= 0xFFFF) {
  33445. return 0;
  33446. } else if (code >= 0xF600 && code <= 0xF8FF) {
  33447. return getSpecialPUASymbols()[code] || code;
  33448. }
  33449. return code;
  33450. }
  33451. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33452. var unicode = glyphsUnicodeMap[name];
  33453. if (unicode !== undefined) {
  33454. return unicode;
  33455. }
  33456. if (!name) {
  33457. return -1;
  33458. }
  33459. if (name[0] === 'u') {
  33460. var nameLen = name.length, hexStr;
  33461. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  33462. hexStr = name.substr(3);
  33463. } else if (nameLen >= 5 && nameLen <= 7) {
  33464. hexStr = name.substr(1);
  33465. } else {
  33466. return -1;
  33467. }
  33468. if (hexStr === hexStr.toUpperCase()) {
  33469. unicode = parseInt(hexStr, 16);
  33470. if (unicode >= 0) {
  33471. return unicode;
  33472. }
  33473. }
  33474. }
  33475. return -1;
  33476. }
  33477. var UnicodeRanges = [
  33478. {
  33479. 'begin': 0x0000,
  33480. 'end': 0x007F
  33481. },
  33482. {
  33483. 'begin': 0x0080,
  33484. 'end': 0x00FF
  33485. },
  33486. {
  33487. 'begin': 0x0100,
  33488. 'end': 0x017F
  33489. },
  33490. {
  33491. 'begin': 0x0180,
  33492. 'end': 0x024F
  33493. },
  33494. {
  33495. 'begin': 0x0250,
  33496. 'end': 0x02AF
  33497. },
  33498. {
  33499. 'begin': 0x02B0,
  33500. 'end': 0x02FF
  33501. },
  33502. {
  33503. 'begin': 0x0300,
  33504. 'end': 0x036F
  33505. },
  33506. {
  33507. 'begin': 0x0370,
  33508. 'end': 0x03FF
  33509. },
  33510. {
  33511. 'begin': 0x2C80,
  33512. 'end': 0x2CFF
  33513. },
  33514. {
  33515. 'begin': 0x0400,
  33516. 'end': 0x04FF
  33517. },
  33518. {
  33519. 'begin': 0x0530,
  33520. 'end': 0x058F
  33521. },
  33522. {
  33523. 'begin': 0x0590,
  33524. 'end': 0x05FF
  33525. },
  33526. {
  33527. 'begin': 0xA500,
  33528. 'end': 0xA63F
  33529. },
  33530. {
  33531. 'begin': 0x0600,
  33532. 'end': 0x06FF
  33533. },
  33534. {
  33535. 'begin': 0x07C0,
  33536. 'end': 0x07FF
  33537. },
  33538. {
  33539. 'begin': 0x0900,
  33540. 'end': 0x097F
  33541. },
  33542. {
  33543. 'begin': 0x0980,
  33544. 'end': 0x09FF
  33545. },
  33546. {
  33547. 'begin': 0x0A00,
  33548. 'end': 0x0A7F
  33549. },
  33550. {
  33551. 'begin': 0x0A80,
  33552. 'end': 0x0AFF
  33553. },
  33554. {
  33555. 'begin': 0x0B00,
  33556. 'end': 0x0B7F
  33557. },
  33558. {
  33559. 'begin': 0x0B80,
  33560. 'end': 0x0BFF
  33561. },
  33562. {
  33563. 'begin': 0x0C00,
  33564. 'end': 0x0C7F
  33565. },
  33566. {
  33567. 'begin': 0x0C80,
  33568. 'end': 0x0CFF
  33569. },
  33570. {
  33571. 'begin': 0x0D00,
  33572. 'end': 0x0D7F
  33573. },
  33574. {
  33575. 'begin': 0x0E00,
  33576. 'end': 0x0E7F
  33577. },
  33578. {
  33579. 'begin': 0x0E80,
  33580. 'end': 0x0EFF
  33581. },
  33582. {
  33583. 'begin': 0x10A0,
  33584. 'end': 0x10FF
  33585. },
  33586. {
  33587. 'begin': 0x1B00,
  33588. 'end': 0x1B7F
  33589. },
  33590. {
  33591. 'begin': 0x1100,
  33592. 'end': 0x11FF
  33593. },
  33594. {
  33595. 'begin': 0x1E00,
  33596. 'end': 0x1EFF
  33597. },
  33598. {
  33599. 'begin': 0x1F00,
  33600. 'end': 0x1FFF
  33601. },
  33602. {
  33603. 'begin': 0x2000,
  33604. 'end': 0x206F
  33605. },
  33606. {
  33607. 'begin': 0x2070,
  33608. 'end': 0x209F
  33609. },
  33610. {
  33611. 'begin': 0x20A0,
  33612. 'end': 0x20CF
  33613. },
  33614. {
  33615. 'begin': 0x20D0,
  33616. 'end': 0x20FF
  33617. },
  33618. {
  33619. 'begin': 0x2100,
  33620. 'end': 0x214F
  33621. },
  33622. {
  33623. 'begin': 0x2150,
  33624. 'end': 0x218F
  33625. },
  33626. {
  33627. 'begin': 0x2190,
  33628. 'end': 0x21FF
  33629. },
  33630. {
  33631. 'begin': 0x2200,
  33632. 'end': 0x22FF
  33633. },
  33634. {
  33635. 'begin': 0x2300,
  33636. 'end': 0x23FF
  33637. },
  33638. {
  33639. 'begin': 0x2400,
  33640. 'end': 0x243F
  33641. },
  33642. {
  33643. 'begin': 0x2440,
  33644. 'end': 0x245F
  33645. },
  33646. {
  33647. 'begin': 0x2460,
  33648. 'end': 0x24FF
  33649. },
  33650. {
  33651. 'begin': 0x2500,
  33652. 'end': 0x257F
  33653. },
  33654. {
  33655. 'begin': 0x2580,
  33656. 'end': 0x259F
  33657. },
  33658. {
  33659. 'begin': 0x25A0,
  33660. 'end': 0x25FF
  33661. },
  33662. {
  33663. 'begin': 0x2600,
  33664. 'end': 0x26FF
  33665. },
  33666. {
  33667. 'begin': 0x2700,
  33668. 'end': 0x27BF
  33669. },
  33670. {
  33671. 'begin': 0x3000,
  33672. 'end': 0x303F
  33673. },
  33674. {
  33675. 'begin': 0x3040,
  33676. 'end': 0x309F
  33677. },
  33678. {
  33679. 'begin': 0x30A0,
  33680. 'end': 0x30FF
  33681. },
  33682. {
  33683. 'begin': 0x3100,
  33684. 'end': 0x312F
  33685. },
  33686. {
  33687. 'begin': 0x3130,
  33688. 'end': 0x318F
  33689. },
  33690. {
  33691. 'begin': 0xA840,
  33692. 'end': 0xA87F
  33693. },
  33694. {
  33695. 'begin': 0x3200,
  33696. 'end': 0x32FF
  33697. },
  33698. {
  33699. 'begin': 0x3300,
  33700. 'end': 0x33FF
  33701. },
  33702. {
  33703. 'begin': 0xAC00,
  33704. 'end': 0xD7AF
  33705. },
  33706. {
  33707. 'begin': 0xD800,
  33708. 'end': 0xDFFF
  33709. },
  33710. {
  33711. 'begin': 0x10900,
  33712. 'end': 0x1091F
  33713. },
  33714. {
  33715. 'begin': 0x4E00,
  33716. 'end': 0x9FFF
  33717. },
  33718. {
  33719. 'begin': 0xE000,
  33720. 'end': 0xF8FF
  33721. },
  33722. {
  33723. 'begin': 0x31C0,
  33724. 'end': 0x31EF
  33725. },
  33726. {
  33727. 'begin': 0xFB00,
  33728. 'end': 0xFB4F
  33729. },
  33730. {
  33731. 'begin': 0xFB50,
  33732. 'end': 0xFDFF
  33733. },
  33734. {
  33735. 'begin': 0xFE20,
  33736. 'end': 0xFE2F
  33737. },
  33738. {
  33739. 'begin': 0xFE10,
  33740. 'end': 0xFE1F
  33741. },
  33742. {
  33743. 'begin': 0xFE50,
  33744. 'end': 0xFE6F
  33745. },
  33746. {
  33747. 'begin': 0xFE70,
  33748. 'end': 0xFEFF
  33749. },
  33750. {
  33751. 'begin': 0xFF00,
  33752. 'end': 0xFFEF
  33753. },
  33754. {
  33755. 'begin': 0xFFF0,
  33756. 'end': 0xFFFF
  33757. },
  33758. {
  33759. 'begin': 0x0F00,
  33760. 'end': 0x0FFF
  33761. },
  33762. {
  33763. 'begin': 0x0700,
  33764. 'end': 0x074F
  33765. },
  33766. {
  33767. 'begin': 0x0780,
  33768. 'end': 0x07BF
  33769. },
  33770. {
  33771. 'begin': 0x0D80,
  33772. 'end': 0x0DFF
  33773. },
  33774. {
  33775. 'begin': 0x1000,
  33776. 'end': 0x109F
  33777. },
  33778. {
  33779. 'begin': 0x1200,
  33780. 'end': 0x137F
  33781. },
  33782. {
  33783. 'begin': 0x13A0,
  33784. 'end': 0x13FF
  33785. },
  33786. {
  33787. 'begin': 0x1400,
  33788. 'end': 0x167F
  33789. },
  33790. {
  33791. 'begin': 0x1680,
  33792. 'end': 0x169F
  33793. },
  33794. {
  33795. 'begin': 0x16A0,
  33796. 'end': 0x16FF
  33797. },
  33798. {
  33799. 'begin': 0x1780,
  33800. 'end': 0x17FF
  33801. },
  33802. {
  33803. 'begin': 0x1800,
  33804. 'end': 0x18AF
  33805. },
  33806. {
  33807. 'begin': 0x2800,
  33808. 'end': 0x28FF
  33809. },
  33810. {
  33811. 'begin': 0xA000,
  33812. 'end': 0xA48F
  33813. },
  33814. {
  33815. 'begin': 0x1700,
  33816. 'end': 0x171F
  33817. },
  33818. {
  33819. 'begin': 0x10300,
  33820. 'end': 0x1032F
  33821. },
  33822. {
  33823. 'begin': 0x10330,
  33824. 'end': 0x1034F
  33825. },
  33826. {
  33827. 'begin': 0x10400,
  33828. 'end': 0x1044F
  33829. },
  33830. {
  33831. 'begin': 0x1D000,
  33832. 'end': 0x1D0FF
  33833. },
  33834. {
  33835. 'begin': 0x1D400,
  33836. 'end': 0x1D7FF
  33837. },
  33838. {
  33839. 'begin': 0xFF000,
  33840. 'end': 0xFFFFD
  33841. },
  33842. {
  33843. 'begin': 0xFE00,
  33844. 'end': 0xFE0F
  33845. },
  33846. {
  33847. 'begin': 0xE0000,
  33848. 'end': 0xE007F
  33849. },
  33850. {
  33851. 'begin': 0x1900,
  33852. 'end': 0x194F
  33853. },
  33854. {
  33855. 'begin': 0x1950,
  33856. 'end': 0x197F
  33857. },
  33858. {
  33859. 'begin': 0x1980,
  33860. 'end': 0x19DF
  33861. },
  33862. {
  33863. 'begin': 0x1A00,
  33864. 'end': 0x1A1F
  33865. },
  33866. {
  33867. 'begin': 0x2C00,
  33868. 'end': 0x2C5F
  33869. },
  33870. {
  33871. 'begin': 0x2D30,
  33872. 'end': 0x2D7F
  33873. },
  33874. {
  33875. 'begin': 0x4DC0,
  33876. 'end': 0x4DFF
  33877. },
  33878. {
  33879. 'begin': 0xA800,
  33880. 'end': 0xA82F
  33881. },
  33882. {
  33883. 'begin': 0x10000,
  33884. 'end': 0x1007F
  33885. },
  33886. {
  33887. 'begin': 0x10140,
  33888. 'end': 0x1018F
  33889. },
  33890. {
  33891. 'begin': 0x10380,
  33892. 'end': 0x1039F
  33893. },
  33894. {
  33895. 'begin': 0x103A0,
  33896. 'end': 0x103DF
  33897. },
  33898. {
  33899. 'begin': 0x10450,
  33900. 'end': 0x1047F
  33901. },
  33902. {
  33903. 'begin': 0x10480,
  33904. 'end': 0x104AF
  33905. },
  33906. {
  33907. 'begin': 0x10800,
  33908. 'end': 0x1083F
  33909. },
  33910. {
  33911. 'begin': 0x10A00,
  33912. 'end': 0x10A5F
  33913. },
  33914. {
  33915. 'begin': 0x1D300,
  33916. 'end': 0x1D35F
  33917. },
  33918. {
  33919. 'begin': 0x12000,
  33920. 'end': 0x123FF
  33921. },
  33922. {
  33923. 'begin': 0x1D360,
  33924. 'end': 0x1D37F
  33925. },
  33926. {
  33927. 'begin': 0x1B80,
  33928. 'end': 0x1BBF
  33929. },
  33930. {
  33931. 'begin': 0x1C00,
  33932. 'end': 0x1C4F
  33933. },
  33934. {
  33935. 'begin': 0x1C50,
  33936. 'end': 0x1C7F
  33937. },
  33938. {
  33939. 'begin': 0xA880,
  33940. 'end': 0xA8DF
  33941. },
  33942. {
  33943. 'begin': 0xA900,
  33944. 'end': 0xA92F
  33945. },
  33946. {
  33947. 'begin': 0xA930,
  33948. 'end': 0xA95F
  33949. },
  33950. {
  33951. 'begin': 0xAA00,
  33952. 'end': 0xAA5F
  33953. },
  33954. {
  33955. 'begin': 0x10190,
  33956. 'end': 0x101CF
  33957. },
  33958. {
  33959. 'begin': 0x101D0,
  33960. 'end': 0x101FF
  33961. },
  33962. {
  33963. 'begin': 0x102A0,
  33964. 'end': 0x102DF
  33965. },
  33966. {
  33967. 'begin': 0x1F030,
  33968. 'end': 0x1F09F
  33969. }
  33970. ];
  33971. function getUnicodeRangeFor(value) {
  33972. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33973. var range = UnicodeRanges[i];
  33974. if (value >= range.begin && value < range.end) {
  33975. return i;
  33976. }
  33977. }
  33978. return -1;
  33979. }
  33980. function isRTLRangeFor(value) {
  33981. var range = UnicodeRanges[13];
  33982. if (value >= range.begin && value < range.end) {
  33983. return true;
  33984. }
  33985. range = UnicodeRanges[11];
  33986. if (value >= range.begin && value < range.end) {
  33987. return true;
  33988. }
  33989. return false;
  33990. }
  33991. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33992. t['\u00A8'] = '\u0020\u0308';
  33993. t['\u00AF'] = '\u0020\u0304';
  33994. t['\u00B4'] = '\u0020\u0301';
  33995. t['\u00B5'] = '\u03BC';
  33996. t['\u00B8'] = '\u0020\u0327';
  33997. t['\u0132'] = '\u0049\u004A';
  33998. t['\u0133'] = '\u0069\u006A';
  33999. t['\u013F'] = '\u004C\u00B7';
  34000. t['\u0140'] = '\u006C\u00B7';
  34001. t['\u0149'] = '\u02BC\u006E';
  34002. t['\u017F'] = '\u0073';
  34003. t['\u01C4'] = '\u0044\u017D';
  34004. t['\u01C5'] = '\u0044\u017E';
  34005. t['\u01C6'] = '\u0064\u017E';
  34006. t['\u01C7'] = '\u004C\u004A';
  34007. t['\u01C8'] = '\u004C\u006A';
  34008. t['\u01C9'] = '\u006C\u006A';
  34009. t['\u01CA'] = '\u004E\u004A';
  34010. t['\u01CB'] = '\u004E\u006A';
  34011. t['\u01CC'] = '\u006E\u006A';
  34012. t['\u01F1'] = '\u0044\u005A';
  34013. t['\u01F2'] = '\u0044\u007A';
  34014. t['\u01F3'] = '\u0064\u007A';
  34015. t['\u02D8'] = '\u0020\u0306';
  34016. t['\u02D9'] = '\u0020\u0307';
  34017. t['\u02DA'] = '\u0020\u030A';
  34018. t['\u02DB'] = '\u0020\u0328';
  34019. t['\u02DC'] = '\u0020\u0303';
  34020. t['\u02DD'] = '\u0020\u030B';
  34021. t['\u037A'] = '\u0020\u0345';
  34022. t['\u0384'] = '\u0020\u0301';
  34023. t['\u03D0'] = '\u03B2';
  34024. t['\u03D1'] = '\u03B8';
  34025. t['\u03D2'] = '\u03A5';
  34026. t['\u03D5'] = '\u03C6';
  34027. t['\u03D6'] = '\u03C0';
  34028. t['\u03F0'] = '\u03BA';
  34029. t['\u03F1'] = '\u03C1';
  34030. t['\u03F2'] = '\u03C2';
  34031. t['\u03F4'] = '\u0398';
  34032. t['\u03F5'] = '\u03B5';
  34033. t['\u03F9'] = '\u03A3';
  34034. t['\u0587'] = '\u0565\u0582';
  34035. t['\u0675'] = '\u0627\u0674';
  34036. t['\u0676'] = '\u0648\u0674';
  34037. t['\u0677'] = '\u06C7\u0674';
  34038. t['\u0678'] = '\u064A\u0674';
  34039. t['\u0E33'] = '\u0E4D\u0E32';
  34040. t['\u0EB3'] = '\u0ECD\u0EB2';
  34041. t['\u0EDC'] = '\u0EAB\u0E99';
  34042. t['\u0EDD'] = '\u0EAB\u0EA1';
  34043. t['\u0F77'] = '\u0FB2\u0F81';
  34044. t['\u0F79'] = '\u0FB3\u0F81';
  34045. t['\u1E9A'] = '\u0061\u02BE';
  34046. t['\u1FBD'] = '\u0020\u0313';
  34047. t['\u1FBF'] = '\u0020\u0313';
  34048. t['\u1FC0'] = '\u0020\u0342';
  34049. t['\u1FFE'] = '\u0020\u0314';
  34050. t['\u2002'] = '\u0020';
  34051. t['\u2003'] = '\u0020';
  34052. t['\u2004'] = '\u0020';
  34053. t['\u2005'] = '\u0020';
  34054. t['\u2006'] = '\u0020';
  34055. t['\u2008'] = '\u0020';
  34056. t['\u2009'] = '\u0020';
  34057. t['\u200A'] = '\u0020';
  34058. t['\u2017'] = '\u0020\u0333';
  34059. t['\u2024'] = '\u002E';
  34060. t['\u2025'] = '\u002E\u002E';
  34061. t['\u2026'] = '\u002E\u002E\u002E';
  34062. t['\u2033'] = '\u2032\u2032';
  34063. t['\u2034'] = '\u2032\u2032\u2032';
  34064. t['\u2036'] = '\u2035\u2035';
  34065. t['\u2037'] = '\u2035\u2035\u2035';
  34066. t['\u203C'] = '\u0021\u0021';
  34067. t['\u203E'] = '\u0020\u0305';
  34068. t['\u2047'] = '\u003F\u003F';
  34069. t['\u2048'] = '\u003F\u0021';
  34070. t['\u2049'] = '\u0021\u003F';
  34071. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  34072. t['\u205F'] = '\u0020';
  34073. t['\u20A8'] = '\u0052\u0073';
  34074. t['\u2100'] = '\u0061\u002F\u0063';
  34075. t['\u2101'] = '\u0061\u002F\u0073';
  34076. t['\u2103'] = '\u00B0\u0043';
  34077. t['\u2105'] = '\u0063\u002F\u006F';
  34078. t['\u2106'] = '\u0063\u002F\u0075';
  34079. t['\u2107'] = '\u0190';
  34080. t['\u2109'] = '\u00B0\u0046';
  34081. t['\u2116'] = '\u004E\u006F';
  34082. t['\u2121'] = '\u0054\u0045\u004C';
  34083. t['\u2135'] = '\u05D0';
  34084. t['\u2136'] = '\u05D1';
  34085. t['\u2137'] = '\u05D2';
  34086. t['\u2138'] = '\u05D3';
  34087. t['\u213B'] = '\u0046\u0041\u0058';
  34088. t['\u2160'] = '\u0049';
  34089. t['\u2161'] = '\u0049\u0049';
  34090. t['\u2162'] = '\u0049\u0049\u0049';
  34091. t['\u2163'] = '\u0049\u0056';
  34092. t['\u2164'] = '\u0056';
  34093. t['\u2165'] = '\u0056\u0049';
  34094. t['\u2166'] = '\u0056\u0049\u0049';
  34095. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  34096. t['\u2168'] = '\u0049\u0058';
  34097. t['\u2169'] = '\u0058';
  34098. t['\u216A'] = '\u0058\u0049';
  34099. t['\u216B'] = '\u0058\u0049\u0049';
  34100. t['\u216C'] = '\u004C';
  34101. t['\u216D'] = '\u0043';
  34102. t['\u216E'] = '\u0044';
  34103. t['\u216F'] = '\u004D';
  34104. t['\u2170'] = '\u0069';
  34105. t['\u2171'] = '\u0069\u0069';
  34106. t['\u2172'] = '\u0069\u0069\u0069';
  34107. t['\u2173'] = '\u0069\u0076';
  34108. t['\u2174'] = '\u0076';
  34109. t['\u2175'] = '\u0076\u0069';
  34110. t['\u2176'] = '\u0076\u0069\u0069';
  34111. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  34112. t['\u2178'] = '\u0069\u0078';
  34113. t['\u2179'] = '\u0078';
  34114. t['\u217A'] = '\u0078\u0069';
  34115. t['\u217B'] = '\u0078\u0069\u0069';
  34116. t['\u217C'] = '\u006C';
  34117. t['\u217D'] = '\u0063';
  34118. t['\u217E'] = '\u0064';
  34119. t['\u217F'] = '\u006D';
  34120. t['\u222C'] = '\u222B\u222B';
  34121. t['\u222D'] = '\u222B\u222B\u222B';
  34122. t['\u222F'] = '\u222E\u222E';
  34123. t['\u2230'] = '\u222E\u222E\u222E';
  34124. t['\u2474'] = '\u0028\u0031\u0029';
  34125. t['\u2475'] = '\u0028\u0032\u0029';
  34126. t['\u2476'] = '\u0028\u0033\u0029';
  34127. t['\u2477'] = '\u0028\u0034\u0029';
  34128. t['\u2478'] = '\u0028\u0035\u0029';
  34129. t['\u2479'] = '\u0028\u0036\u0029';
  34130. t['\u247A'] = '\u0028\u0037\u0029';
  34131. t['\u247B'] = '\u0028\u0038\u0029';
  34132. t['\u247C'] = '\u0028\u0039\u0029';
  34133. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  34134. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  34135. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  34136. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  34137. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  34138. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  34139. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  34140. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  34141. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  34142. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  34143. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  34144. t['\u2488'] = '\u0031\u002E';
  34145. t['\u2489'] = '\u0032\u002E';
  34146. t['\u248A'] = '\u0033\u002E';
  34147. t['\u248B'] = '\u0034\u002E';
  34148. t['\u248C'] = '\u0035\u002E';
  34149. t['\u248D'] = '\u0036\u002E';
  34150. t['\u248E'] = '\u0037\u002E';
  34151. t['\u248F'] = '\u0038\u002E';
  34152. t['\u2490'] = '\u0039\u002E';
  34153. t['\u2491'] = '\u0031\u0030\u002E';
  34154. t['\u2492'] = '\u0031\u0031\u002E';
  34155. t['\u2493'] = '\u0031\u0032\u002E';
  34156. t['\u2494'] = '\u0031\u0033\u002E';
  34157. t['\u2495'] = '\u0031\u0034\u002E';
  34158. t['\u2496'] = '\u0031\u0035\u002E';
  34159. t['\u2497'] = '\u0031\u0036\u002E';
  34160. t['\u2498'] = '\u0031\u0037\u002E';
  34161. t['\u2499'] = '\u0031\u0038\u002E';
  34162. t['\u249A'] = '\u0031\u0039\u002E';
  34163. t['\u249B'] = '\u0032\u0030\u002E';
  34164. t['\u249C'] = '\u0028\u0061\u0029';
  34165. t['\u249D'] = '\u0028\u0062\u0029';
  34166. t['\u249E'] = '\u0028\u0063\u0029';
  34167. t['\u249F'] = '\u0028\u0064\u0029';
  34168. t['\u24A0'] = '\u0028\u0065\u0029';
  34169. t['\u24A1'] = '\u0028\u0066\u0029';
  34170. t['\u24A2'] = '\u0028\u0067\u0029';
  34171. t['\u24A3'] = '\u0028\u0068\u0029';
  34172. t['\u24A4'] = '\u0028\u0069\u0029';
  34173. t['\u24A5'] = '\u0028\u006A\u0029';
  34174. t['\u24A6'] = '\u0028\u006B\u0029';
  34175. t['\u24A7'] = '\u0028\u006C\u0029';
  34176. t['\u24A8'] = '\u0028\u006D\u0029';
  34177. t['\u24A9'] = '\u0028\u006E\u0029';
  34178. t['\u24AA'] = '\u0028\u006F\u0029';
  34179. t['\u24AB'] = '\u0028\u0070\u0029';
  34180. t['\u24AC'] = '\u0028\u0071\u0029';
  34181. t['\u24AD'] = '\u0028\u0072\u0029';
  34182. t['\u24AE'] = '\u0028\u0073\u0029';
  34183. t['\u24AF'] = '\u0028\u0074\u0029';
  34184. t['\u24B0'] = '\u0028\u0075\u0029';
  34185. t['\u24B1'] = '\u0028\u0076\u0029';
  34186. t['\u24B2'] = '\u0028\u0077\u0029';
  34187. t['\u24B3'] = '\u0028\u0078\u0029';
  34188. t['\u24B4'] = '\u0028\u0079\u0029';
  34189. t['\u24B5'] = '\u0028\u007A\u0029';
  34190. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  34191. t['\u2A74'] = '\u003A\u003A\u003D';
  34192. t['\u2A75'] = '\u003D\u003D';
  34193. t['\u2A76'] = '\u003D\u003D\u003D';
  34194. t['\u2E9F'] = '\u6BCD';
  34195. t['\u2EF3'] = '\u9F9F';
  34196. t['\u2F00'] = '\u4E00';
  34197. t['\u2F01'] = '\u4E28';
  34198. t['\u2F02'] = '\u4E36';
  34199. t['\u2F03'] = '\u4E3F';
  34200. t['\u2F04'] = '\u4E59';
  34201. t['\u2F05'] = '\u4E85';
  34202. t['\u2F06'] = '\u4E8C';
  34203. t['\u2F07'] = '\u4EA0';
  34204. t['\u2F08'] = '\u4EBA';
  34205. t['\u2F09'] = '\u513F';
  34206. t['\u2F0A'] = '\u5165';
  34207. t['\u2F0B'] = '\u516B';
  34208. t['\u2F0C'] = '\u5182';
  34209. t['\u2F0D'] = '\u5196';
  34210. t['\u2F0E'] = '\u51AB';
  34211. t['\u2F0F'] = '\u51E0';
  34212. t['\u2F10'] = '\u51F5';
  34213. t['\u2F11'] = '\u5200';
  34214. t['\u2F12'] = '\u529B';
  34215. t['\u2F13'] = '\u52F9';
  34216. t['\u2F14'] = '\u5315';
  34217. t['\u2F15'] = '\u531A';
  34218. t['\u2F16'] = '\u5338';
  34219. t['\u2F17'] = '\u5341';
  34220. t['\u2F18'] = '\u535C';
  34221. t['\u2F19'] = '\u5369';
  34222. t['\u2F1A'] = '\u5382';
  34223. t['\u2F1B'] = '\u53B6';
  34224. t['\u2F1C'] = '\u53C8';
  34225. t['\u2F1D'] = '\u53E3';
  34226. t['\u2F1E'] = '\u56D7';
  34227. t['\u2F1F'] = '\u571F';
  34228. t['\u2F20'] = '\u58EB';
  34229. t['\u2F21'] = '\u5902';
  34230. t['\u2F22'] = '\u590A';
  34231. t['\u2F23'] = '\u5915';
  34232. t['\u2F24'] = '\u5927';
  34233. t['\u2F25'] = '\u5973';
  34234. t['\u2F26'] = '\u5B50';
  34235. t['\u2F27'] = '\u5B80';
  34236. t['\u2F28'] = '\u5BF8';
  34237. t['\u2F29'] = '\u5C0F';
  34238. t['\u2F2A'] = '\u5C22';
  34239. t['\u2F2B'] = '\u5C38';
  34240. t['\u2F2C'] = '\u5C6E';
  34241. t['\u2F2D'] = '\u5C71';
  34242. t['\u2F2E'] = '\u5DDB';
  34243. t['\u2F2F'] = '\u5DE5';
  34244. t['\u2F30'] = '\u5DF1';
  34245. t['\u2F31'] = '\u5DFE';
  34246. t['\u2F32'] = '\u5E72';
  34247. t['\u2F33'] = '\u5E7A';
  34248. t['\u2F34'] = '\u5E7F';
  34249. t['\u2F35'] = '\u5EF4';
  34250. t['\u2F36'] = '\u5EFE';
  34251. t['\u2F37'] = '\u5F0B';
  34252. t['\u2F38'] = '\u5F13';
  34253. t['\u2F39'] = '\u5F50';
  34254. t['\u2F3A'] = '\u5F61';
  34255. t['\u2F3B'] = '\u5F73';
  34256. t['\u2F3C'] = '\u5FC3';
  34257. t['\u2F3D'] = '\u6208';
  34258. t['\u2F3E'] = '\u6236';
  34259. t['\u2F3F'] = '\u624B';
  34260. t['\u2F40'] = '\u652F';
  34261. t['\u2F41'] = '\u6534';
  34262. t['\u2F42'] = '\u6587';
  34263. t['\u2F43'] = '\u6597';
  34264. t['\u2F44'] = '\u65A4';
  34265. t['\u2F45'] = '\u65B9';
  34266. t['\u2F46'] = '\u65E0';
  34267. t['\u2F47'] = '\u65E5';
  34268. t['\u2F48'] = '\u66F0';
  34269. t['\u2F49'] = '\u6708';
  34270. t['\u2F4A'] = '\u6728';
  34271. t['\u2F4B'] = '\u6B20';
  34272. t['\u2F4C'] = '\u6B62';
  34273. t['\u2F4D'] = '\u6B79';
  34274. t['\u2F4E'] = '\u6BB3';
  34275. t['\u2F4F'] = '\u6BCB';
  34276. t['\u2F50'] = '\u6BD4';
  34277. t['\u2F51'] = '\u6BDB';
  34278. t['\u2F52'] = '\u6C0F';
  34279. t['\u2F53'] = '\u6C14';
  34280. t['\u2F54'] = '\u6C34';
  34281. t['\u2F55'] = '\u706B';
  34282. t['\u2F56'] = '\u722A';
  34283. t['\u2F57'] = '\u7236';
  34284. t['\u2F58'] = '\u723B';
  34285. t['\u2F59'] = '\u723F';
  34286. t['\u2F5A'] = '\u7247';
  34287. t['\u2F5B'] = '\u7259';
  34288. t['\u2F5C'] = '\u725B';
  34289. t['\u2F5D'] = '\u72AC';
  34290. t['\u2F5E'] = '\u7384';
  34291. t['\u2F5F'] = '\u7389';
  34292. t['\u2F60'] = '\u74DC';
  34293. t['\u2F61'] = '\u74E6';
  34294. t['\u2F62'] = '\u7518';
  34295. t['\u2F63'] = '\u751F';
  34296. t['\u2F64'] = '\u7528';
  34297. t['\u2F65'] = '\u7530';
  34298. t['\u2F66'] = '\u758B';
  34299. t['\u2F67'] = '\u7592';
  34300. t['\u2F68'] = '\u7676';
  34301. t['\u2F69'] = '\u767D';
  34302. t['\u2F6A'] = '\u76AE';
  34303. t['\u2F6B'] = '\u76BF';
  34304. t['\u2F6C'] = '\u76EE';
  34305. t['\u2F6D'] = '\u77DB';
  34306. t['\u2F6E'] = '\u77E2';
  34307. t['\u2F6F'] = '\u77F3';
  34308. t['\u2F70'] = '\u793A';
  34309. t['\u2F71'] = '\u79B8';
  34310. t['\u2F72'] = '\u79BE';
  34311. t['\u2F73'] = '\u7A74';
  34312. t['\u2F74'] = '\u7ACB';
  34313. t['\u2F75'] = '\u7AF9';
  34314. t['\u2F76'] = '\u7C73';
  34315. t['\u2F77'] = '\u7CF8';
  34316. t['\u2F78'] = '\u7F36';
  34317. t['\u2F79'] = '\u7F51';
  34318. t['\u2F7A'] = '\u7F8A';
  34319. t['\u2F7B'] = '\u7FBD';
  34320. t['\u2F7C'] = '\u8001';
  34321. t['\u2F7D'] = '\u800C';
  34322. t['\u2F7E'] = '\u8012';
  34323. t['\u2F7F'] = '\u8033';
  34324. t['\u2F80'] = '\u807F';
  34325. t['\u2F81'] = '\u8089';
  34326. t['\u2F82'] = '\u81E3';
  34327. t['\u2F83'] = '\u81EA';
  34328. t['\u2F84'] = '\u81F3';
  34329. t['\u2F85'] = '\u81FC';
  34330. t['\u2F86'] = '\u820C';
  34331. t['\u2F87'] = '\u821B';
  34332. t['\u2F88'] = '\u821F';
  34333. t['\u2F89'] = '\u826E';
  34334. t['\u2F8A'] = '\u8272';
  34335. t['\u2F8B'] = '\u8278';
  34336. t['\u2F8C'] = '\u864D';
  34337. t['\u2F8D'] = '\u866B';
  34338. t['\u2F8E'] = '\u8840';
  34339. t['\u2F8F'] = '\u884C';
  34340. t['\u2F90'] = '\u8863';
  34341. t['\u2F91'] = '\u897E';
  34342. t['\u2F92'] = '\u898B';
  34343. t['\u2F93'] = '\u89D2';
  34344. t['\u2F94'] = '\u8A00';
  34345. t['\u2F95'] = '\u8C37';
  34346. t['\u2F96'] = '\u8C46';
  34347. t['\u2F97'] = '\u8C55';
  34348. t['\u2F98'] = '\u8C78';
  34349. t['\u2F99'] = '\u8C9D';
  34350. t['\u2F9A'] = '\u8D64';
  34351. t['\u2F9B'] = '\u8D70';
  34352. t['\u2F9C'] = '\u8DB3';
  34353. t['\u2F9D'] = '\u8EAB';
  34354. t['\u2F9E'] = '\u8ECA';
  34355. t['\u2F9F'] = '\u8F9B';
  34356. t['\u2FA0'] = '\u8FB0';
  34357. t['\u2FA1'] = '\u8FB5';
  34358. t['\u2FA2'] = '\u9091';
  34359. t['\u2FA3'] = '\u9149';
  34360. t['\u2FA4'] = '\u91C6';
  34361. t['\u2FA5'] = '\u91CC';
  34362. t['\u2FA6'] = '\u91D1';
  34363. t['\u2FA7'] = '\u9577';
  34364. t['\u2FA8'] = '\u9580';
  34365. t['\u2FA9'] = '\u961C';
  34366. t['\u2FAA'] = '\u96B6';
  34367. t['\u2FAB'] = '\u96B9';
  34368. t['\u2FAC'] = '\u96E8';
  34369. t['\u2FAD'] = '\u9751';
  34370. t['\u2FAE'] = '\u975E';
  34371. t['\u2FAF'] = '\u9762';
  34372. t['\u2FB0'] = '\u9769';
  34373. t['\u2FB1'] = '\u97CB';
  34374. t['\u2FB2'] = '\u97ED';
  34375. t['\u2FB3'] = '\u97F3';
  34376. t['\u2FB4'] = '\u9801';
  34377. t['\u2FB5'] = '\u98A8';
  34378. t['\u2FB6'] = '\u98DB';
  34379. t['\u2FB7'] = '\u98DF';
  34380. t['\u2FB8'] = '\u9996';
  34381. t['\u2FB9'] = '\u9999';
  34382. t['\u2FBA'] = '\u99AC';
  34383. t['\u2FBB'] = '\u9AA8';
  34384. t['\u2FBC'] = '\u9AD8';
  34385. t['\u2FBD'] = '\u9ADF';
  34386. t['\u2FBE'] = '\u9B25';
  34387. t['\u2FBF'] = '\u9B2F';
  34388. t['\u2FC0'] = '\u9B32';
  34389. t['\u2FC1'] = '\u9B3C';
  34390. t['\u2FC2'] = '\u9B5A';
  34391. t['\u2FC3'] = '\u9CE5';
  34392. t['\u2FC4'] = '\u9E75';
  34393. t['\u2FC5'] = '\u9E7F';
  34394. t['\u2FC6'] = '\u9EA5';
  34395. t['\u2FC7'] = '\u9EBB';
  34396. t['\u2FC8'] = '\u9EC3';
  34397. t['\u2FC9'] = '\u9ECD';
  34398. t['\u2FCA'] = '\u9ED1';
  34399. t['\u2FCB'] = '\u9EF9';
  34400. t['\u2FCC'] = '\u9EFD';
  34401. t['\u2FCD'] = '\u9F0E';
  34402. t['\u2FCE'] = '\u9F13';
  34403. t['\u2FCF'] = '\u9F20';
  34404. t['\u2FD0'] = '\u9F3B';
  34405. t['\u2FD1'] = '\u9F4A';
  34406. t['\u2FD2'] = '\u9F52';
  34407. t['\u2FD3'] = '\u9F8D';
  34408. t['\u2FD4'] = '\u9F9C';
  34409. t['\u2FD5'] = '\u9FA0';
  34410. t['\u3036'] = '\u3012';
  34411. t['\u3038'] = '\u5341';
  34412. t['\u3039'] = '\u5344';
  34413. t['\u303A'] = '\u5345';
  34414. t['\u309B'] = '\u0020\u3099';
  34415. t['\u309C'] = '\u0020\u309A';
  34416. t['\u3131'] = '\u1100';
  34417. t['\u3132'] = '\u1101';
  34418. t['\u3133'] = '\u11AA';
  34419. t['\u3134'] = '\u1102';
  34420. t['\u3135'] = '\u11AC';
  34421. t['\u3136'] = '\u11AD';
  34422. t['\u3137'] = '\u1103';
  34423. t['\u3138'] = '\u1104';
  34424. t['\u3139'] = '\u1105';
  34425. t['\u313A'] = '\u11B0';
  34426. t['\u313B'] = '\u11B1';
  34427. t['\u313C'] = '\u11B2';
  34428. t['\u313D'] = '\u11B3';
  34429. t['\u313E'] = '\u11B4';
  34430. t['\u313F'] = '\u11B5';
  34431. t['\u3140'] = '\u111A';
  34432. t['\u3141'] = '\u1106';
  34433. t['\u3142'] = '\u1107';
  34434. t['\u3143'] = '\u1108';
  34435. t['\u3144'] = '\u1121';
  34436. t['\u3145'] = '\u1109';
  34437. t['\u3146'] = '\u110A';
  34438. t['\u3147'] = '\u110B';
  34439. t['\u3148'] = '\u110C';
  34440. t['\u3149'] = '\u110D';
  34441. t['\u314A'] = '\u110E';
  34442. t['\u314B'] = '\u110F';
  34443. t['\u314C'] = '\u1110';
  34444. t['\u314D'] = '\u1111';
  34445. t['\u314E'] = '\u1112';
  34446. t['\u314F'] = '\u1161';
  34447. t['\u3150'] = '\u1162';
  34448. t['\u3151'] = '\u1163';
  34449. t['\u3152'] = '\u1164';
  34450. t['\u3153'] = '\u1165';
  34451. t['\u3154'] = '\u1166';
  34452. t['\u3155'] = '\u1167';
  34453. t['\u3156'] = '\u1168';
  34454. t['\u3157'] = '\u1169';
  34455. t['\u3158'] = '\u116A';
  34456. t['\u3159'] = '\u116B';
  34457. t['\u315A'] = '\u116C';
  34458. t['\u315B'] = '\u116D';
  34459. t['\u315C'] = '\u116E';
  34460. t['\u315D'] = '\u116F';
  34461. t['\u315E'] = '\u1170';
  34462. t['\u315F'] = '\u1171';
  34463. t['\u3160'] = '\u1172';
  34464. t['\u3161'] = '\u1173';
  34465. t['\u3162'] = '\u1174';
  34466. t['\u3163'] = '\u1175';
  34467. t['\u3164'] = '\u1160';
  34468. t['\u3165'] = '\u1114';
  34469. t['\u3166'] = '\u1115';
  34470. t['\u3167'] = '\u11C7';
  34471. t['\u3168'] = '\u11C8';
  34472. t['\u3169'] = '\u11CC';
  34473. t['\u316A'] = '\u11CE';
  34474. t['\u316B'] = '\u11D3';
  34475. t['\u316C'] = '\u11D7';
  34476. t['\u316D'] = '\u11D9';
  34477. t['\u316E'] = '\u111C';
  34478. t['\u316F'] = '\u11DD';
  34479. t['\u3170'] = '\u11DF';
  34480. t['\u3171'] = '\u111D';
  34481. t['\u3172'] = '\u111E';
  34482. t['\u3173'] = '\u1120';
  34483. t['\u3174'] = '\u1122';
  34484. t['\u3175'] = '\u1123';
  34485. t['\u3176'] = '\u1127';
  34486. t['\u3177'] = '\u1129';
  34487. t['\u3178'] = '\u112B';
  34488. t['\u3179'] = '\u112C';
  34489. t['\u317A'] = '\u112D';
  34490. t['\u317B'] = '\u112E';
  34491. t['\u317C'] = '\u112F';
  34492. t['\u317D'] = '\u1132';
  34493. t['\u317E'] = '\u1136';
  34494. t['\u317F'] = '\u1140';
  34495. t['\u3180'] = '\u1147';
  34496. t['\u3181'] = '\u114C';
  34497. t['\u3182'] = '\u11F1';
  34498. t['\u3183'] = '\u11F2';
  34499. t['\u3184'] = '\u1157';
  34500. t['\u3185'] = '\u1158';
  34501. t['\u3186'] = '\u1159';
  34502. t['\u3187'] = '\u1184';
  34503. t['\u3188'] = '\u1185';
  34504. t['\u3189'] = '\u1188';
  34505. t['\u318A'] = '\u1191';
  34506. t['\u318B'] = '\u1192';
  34507. t['\u318C'] = '\u1194';
  34508. t['\u318D'] = '\u119E';
  34509. t['\u318E'] = '\u11A1';
  34510. t['\u3200'] = '\u0028\u1100\u0029';
  34511. t['\u3201'] = '\u0028\u1102\u0029';
  34512. t['\u3202'] = '\u0028\u1103\u0029';
  34513. t['\u3203'] = '\u0028\u1105\u0029';
  34514. t['\u3204'] = '\u0028\u1106\u0029';
  34515. t['\u3205'] = '\u0028\u1107\u0029';
  34516. t['\u3206'] = '\u0028\u1109\u0029';
  34517. t['\u3207'] = '\u0028\u110B\u0029';
  34518. t['\u3208'] = '\u0028\u110C\u0029';
  34519. t['\u3209'] = '\u0028\u110E\u0029';
  34520. t['\u320A'] = '\u0028\u110F\u0029';
  34521. t['\u320B'] = '\u0028\u1110\u0029';
  34522. t['\u320C'] = '\u0028\u1111\u0029';
  34523. t['\u320D'] = '\u0028\u1112\u0029';
  34524. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  34525. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  34526. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  34527. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  34528. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  34529. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  34530. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  34531. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  34532. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  34533. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  34534. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  34535. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  34536. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  34537. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  34538. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  34539. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  34540. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  34541. t['\u3220'] = '\u0028\u4E00\u0029';
  34542. t['\u3221'] = '\u0028\u4E8C\u0029';
  34543. t['\u3222'] = '\u0028\u4E09\u0029';
  34544. t['\u3223'] = '\u0028\u56DB\u0029';
  34545. t['\u3224'] = '\u0028\u4E94\u0029';
  34546. t['\u3225'] = '\u0028\u516D\u0029';
  34547. t['\u3226'] = '\u0028\u4E03\u0029';
  34548. t['\u3227'] = '\u0028\u516B\u0029';
  34549. t['\u3228'] = '\u0028\u4E5D\u0029';
  34550. t['\u3229'] = '\u0028\u5341\u0029';
  34551. t['\u322A'] = '\u0028\u6708\u0029';
  34552. t['\u322B'] = '\u0028\u706B\u0029';
  34553. t['\u322C'] = '\u0028\u6C34\u0029';
  34554. t['\u322D'] = '\u0028\u6728\u0029';
  34555. t['\u322E'] = '\u0028\u91D1\u0029';
  34556. t['\u322F'] = '\u0028\u571F\u0029';
  34557. t['\u3230'] = '\u0028\u65E5\u0029';
  34558. t['\u3231'] = '\u0028\u682A\u0029';
  34559. t['\u3232'] = '\u0028\u6709\u0029';
  34560. t['\u3233'] = '\u0028\u793E\u0029';
  34561. t['\u3234'] = '\u0028\u540D\u0029';
  34562. t['\u3235'] = '\u0028\u7279\u0029';
  34563. t['\u3236'] = '\u0028\u8CA1\u0029';
  34564. t['\u3237'] = '\u0028\u795D\u0029';
  34565. t['\u3238'] = '\u0028\u52B4\u0029';
  34566. t['\u3239'] = '\u0028\u4EE3\u0029';
  34567. t['\u323A'] = '\u0028\u547C\u0029';
  34568. t['\u323B'] = '\u0028\u5B66\u0029';
  34569. t['\u323C'] = '\u0028\u76E3\u0029';
  34570. t['\u323D'] = '\u0028\u4F01\u0029';
  34571. t['\u323E'] = '\u0028\u8CC7\u0029';
  34572. t['\u323F'] = '\u0028\u5354\u0029';
  34573. t['\u3240'] = '\u0028\u796D\u0029';
  34574. t['\u3241'] = '\u0028\u4F11\u0029';
  34575. t['\u3242'] = '\u0028\u81EA\u0029';
  34576. t['\u3243'] = '\u0028\u81F3\u0029';
  34577. t['\u32C0'] = '\u0031\u6708';
  34578. t['\u32C1'] = '\u0032\u6708';
  34579. t['\u32C2'] = '\u0033\u6708';
  34580. t['\u32C3'] = '\u0034\u6708';
  34581. t['\u32C4'] = '\u0035\u6708';
  34582. t['\u32C5'] = '\u0036\u6708';
  34583. t['\u32C6'] = '\u0037\u6708';
  34584. t['\u32C7'] = '\u0038\u6708';
  34585. t['\u32C8'] = '\u0039\u6708';
  34586. t['\u32C9'] = '\u0031\u0030\u6708';
  34587. t['\u32CA'] = '\u0031\u0031\u6708';
  34588. t['\u32CB'] = '\u0031\u0032\u6708';
  34589. t['\u3358'] = '\u0030\u70B9';
  34590. t['\u3359'] = '\u0031\u70B9';
  34591. t['\u335A'] = '\u0032\u70B9';
  34592. t['\u335B'] = '\u0033\u70B9';
  34593. t['\u335C'] = '\u0034\u70B9';
  34594. t['\u335D'] = '\u0035\u70B9';
  34595. t['\u335E'] = '\u0036\u70B9';
  34596. t['\u335F'] = '\u0037\u70B9';
  34597. t['\u3360'] = '\u0038\u70B9';
  34598. t['\u3361'] = '\u0039\u70B9';
  34599. t['\u3362'] = '\u0031\u0030\u70B9';
  34600. t['\u3363'] = '\u0031\u0031\u70B9';
  34601. t['\u3364'] = '\u0031\u0032\u70B9';
  34602. t['\u3365'] = '\u0031\u0033\u70B9';
  34603. t['\u3366'] = '\u0031\u0034\u70B9';
  34604. t['\u3367'] = '\u0031\u0035\u70B9';
  34605. t['\u3368'] = '\u0031\u0036\u70B9';
  34606. t['\u3369'] = '\u0031\u0037\u70B9';
  34607. t['\u336A'] = '\u0031\u0038\u70B9';
  34608. t['\u336B'] = '\u0031\u0039\u70B9';
  34609. t['\u336C'] = '\u0032\u0030\u70B9';
  34610. t['\u336D'] = '\u0032\u0031\u70B9';
  34611. t['\u336E'] = '\u0032\u0032\u70B9';
  34612. t['\u336F'] = '\u0032\u0033\u70B9';
  34613. t['\u3370'] = '\u0032\u0034\u70B9';
  34614. t['\u33E0'] = '\u0031\u65E5';
  34615. t['\u33E1'] = '\u0032\u65E5';
  34616. t['\u33E2'] = '\u0033\u65E5';
  34617. t['\u33E3'] = '\u0034\u65E5';
  34618. t['\u33E4'] = '\u0035\u65E5';
  34619. t['\u33E5'] = '\u0036\u65E5';
  34620. t['\u33E6'] = '\u0037\u65E5';
  34621. t['\u33E7'] = '\u0038\u65E5';
  34622. t['\u33E8'] = '\u0039\u65E5';
  34623. t['\u33E9'] = '\u0031\u0030\u65E5';
  34624. t['\u33EA'] = '\u0031\u0031\u65E5';
  34625. t['\u33EB'] = '\u0031\u0032\u65E5';
  34626. t['\u33EC'] = '\u0031\u0033\u65E5';
  34627. t['\u33ED'] = '\u0031\u0034\u65E5';
  34628. t['\u33EE'] = '\u0031\u0035\u65E5';
  34629. t['\u33EF'] = '\u0031\u0036\u65E5';
  34630. t['\u33F0'] = '\u0031\u0037\u65E5';
  34631. t['\u33F1'] = '\u0031\u0038\u65E5';
  34632. t['\u33F2'] = '\u0031\u0039\u65E5';
  34633. t['\u33F3'] = '\u0032\u0030\u65E5';
  34634. t['\u33F4'] = '\u0032\u0031\u65E5';
  34635. t['\u33F5'] = '\u0032\u0032\u65E5';
  34636. t['\u33F6'] = '\u0032\u0033\u65E5';
  34637. t['\u33F7'] = '\u0032\u0034\u65E5';
  34638. t['\u33F8'] = '\u0032\u0035\u65E5';
  34639. t['\u33F9'] = '\u0032\u0036\u65E5';
  34640. t['\u33FA'] = '\u0032\u0037\u65E5';
  34641. t['\u33FB'] = '\u0032\u0038\u65E5';
  34642. t['\u33FC'] = '\u0032\u0039\u65E5';
  34643. t['\u33FD'] = '\u0033\u0030\u65E5';
  34644. t['\u33FE'] = '\u0033\u0031\u65E5';
  34645. t['\uFB00'] = '\u0066\u0066';
  34646. t['\uFB01'] = '\u0066\u0069';
  34647. t['\uFB02'] = '\u0066\u006C';
  34648. t['\uFB03'] = '\u0066\u0066\u0069';
  34649. t['\uFB04'] = '\u0066\u0066\u006C';
  34650. t['\uFB05'] = '\u017F\u0074';
  34651. t['\uFB06'] = '\u0073\u0074';
  34652. t['\uFB13'] = '\u0574\u0576';
  34653. t['\uFB14'] = '\u0574\u0565';
  34654. t['\uFB15'] = '\u0574\u056B';
  34655. t['\uFB16'] = '\u057E\u0576';
  34656. t['\uFB17'] = '\u0574\u056D';
  34657. t['\uFB4F'] = '\u05D0\u05DC';
  34658. t['\uFB50'] = '\u0671';
  34659. t['\uFB51'] = '\u0671';
  34660. t['\uFB52'] = '\u067B';
  34661. t['\uFB53'] = '\u067B';
  34662. t['\uFB54'] = '\u067B';
  34663. t['\uFB55'] = '\u067B';
  34664. t['\uFB56'] = '\u067E';
  34665. t['\uFB57'] = '\u067E';
  34666. t['\uFB58'] = '\u067E';
  34667. t['\uFB59'] = '\u067E';
  34668. t['\uFB5A'] = '\u0680';
  34669. t['\uFB5B'] = '\u0680';
  34670. t['\uFB5C'] = '\u0680';
  34671. t['\uFB5D'] = '\u0680';
  34672. t['\uFB5E'] = '\u067A';
  34673. t['\uFB5F'] = '\u067A';
  34674. t['\uFB60'] = '\u067A';
  34675. t['\uFB61'] = '\u067A';
  34676. t['\uFB62'] = '\u067F';
  34677. t['\uFB63'] = '\u067F';
  34678. t['\uFB64'] = '\u067F';
  34679. t['\uFB65'] = '\u067F';
  34680. t['\uFB66'] = '\u0679';
  34681. t['\uFB67'] = '\u0679';
  34682. t['\uFB68'] = '\u0679';
  34683. t['\uFB69'] = '\u0679';
  34684. t['\uFB6A'] = '\u06A4';
  34685. t['\uFB6B'] = '\u06A4';
  34686. t['\uFB6C'] = '\u06A4';
  34687. t['\uFB6D'] = '\u06A4';
  34688. t['\uFB6E'] = '\u06A6';
  34689. t['\uFB6F'] = '\u06A6';
  34690. t['\uFB70'] = '\u06A6';
  34691. t['\uFB71'] = '\u06A6';
  34692. t['\uFB72'] = '\u0684';
  34693. t['\uFB73'] = '\u0684';
  34694. t['\uFB74'] = '\u0684';
  34695. t['\uFB75'] = '\u0684';
  34696. t['\uFB76'] = '\u0683';
  34697. t['\uFB77'] = '\u0683';
  34698. t['\uFB78'] = '\u0683';
  34699. t['\uFB79'] = '\u0683';
  34700. t['\uFB7A'] = '\u0686';
  34701. t['\uFB7B'] = '\u0686';
  34702. t['\uFB7C'] = '\u0686';
  34703. t['\uFB7D'] = '\u0686';
  34704. t['\uFB7E'] = '\u0687';
  34705. t['\uFB7F'] = '\u0687';
  34706. t['\uFB80'] = '\u0687';
  34707. t['\uFB81'] = '\u0687';
  34708. t['\uFB82'] = '\u068D';
  34709. t['\uFB83'] = '\u068D';
  34710. t['\uFB84'] = '\u068C';
  34711. t['\uFB85'] = '\u068C';
  34712. t['\uFB86'] = '\u068E';
  34713. t['\uFB87'] = '\u068E';
  34714. t['\uFB88'] = '\u0688';
  34715. t['\uFB89'] = '\u0688';
  34716. t['\uFB8A'] = '\u0698';
  34717. t['\uFB8B'] = '\u0698';
  34718. t['\uFB8C'] = '\u0691';
  34719. t['\uFB8D'] = '\u0691';
  34720. t['\uFB8E'] = '\u06A9';
  34721. t['\uFB8F'] = '\u06A9';
  34722. t['\uFB90'] = '\u06A9';
  34723. t['\uFB91'] = '\u06A9';
  34724. t['\uFB92'] = '\u06AF';
  34725. t['\uFB93'] = '\u06AF';
  34726. t['\uFB94'] = '\u06AF';
  34727. t['\uFB95'] = '\u06AF';
  34728. t['\uFB96'] = '\u06B3';
  34729. t['\uFB97'] = '\u06B3';
  34730. t['\uFB98'] = '\u06B3';
  34731. t['\uFB99'] = '\u06B3';
  34732. t['\uFB9A'] = '\u06B1';
  34733. t['\uFB9B'] = '\u06B1';
  34734. t['\uFB9C'] = '\u06B1';
  34735. t['\uFB9D'] = '\u06B1';
  34736. t['\uFB9E'] = '\u06BA';
  34737. t['\uFB9F'] = '\u06BA';
  34738. t['\uFBA0'] = '\u06BB';
  34739. t['\uFBA1'] = '\u06BB';
  34740. t['\uFBA2'] = '\u06BB';
  34741. t['\uFBA3'] = '\u06BB';
  34742. t['\uFBA4'] = '\u06C0';
  34743. t['\uFBA5'] = '\u06C0';
  34744. t['\uFBA6'] = '\u06C1';
  34745. t['\uFBA7'] = '\u06C1';
  34746. t['\uFBA8'] = '\u06C1';
  34747. t['\uFBA9'] = '\u06C1';
  34748. t['\uFBAA'] = '\u06BE';
  34749. t['\uFBAB'] = '\u06BE';
  34750. t['\uFBAC'] = '\u06BE';
  34751. t['\uFBAD'] = '\u06BE';
  34752. t['\uFBAE'] = '\u06D2';
  34753. t['\uFBAF'] = '\u06D2';
  34754. t['\uFBB0'] = '\u06D3';
  34755. t['\uFBB1'] = '\u06D3';
  34756. t['\uFBD3'] = '\u06AD';
  34757. t['\uFBD4'] = '\u06AD';
  34758. t['\uFBD5'] = '\u06AD';
  34759. t['\uFBD6'] = '\u06AD';
  34760. t['\uFBD7'] = '\u06C7';
  34761. t['\uFBD8'] = '\u06C7';
  34762. t['\uFBD9'] = '\u06C6';
  34763. t['\uFBDA'] = '\u06C6';
  34764. t['\uFBDB'] = '\u06C8';
  34765. t['\uFBDC'] = '\u06C8';
  34766. t['\uFBDD'] = '\u0677';
  34767. t['\uFBDE'] = '\u06CB';
  34768. t['\uFBDF'] = '\u06CB';
  34769. t['\uFBE0'] = '\u06C5';
  34770. t['\uFBE1'] = '\u06C5';
  34771. t['\uFBE2'] = '\u06C9';
  34772. t['\uFBE3'] = '\u06C9';
  34773. t['\uFBE4'] = '\u06D0';
  34774. t['\uFBE5'] = '\u06D0';
  34775. t['\uFBE6'] = '\u06D0';
  34776. t['\uFBE7'] = '\u06D0';
  34777. t['\uFBE8'] = '\u0649';
  34778. t['\uFBE9'] = '\u0649';
  34779. t['\uFBEA'] = '\u0626\u0627';
  34780. t['\uFBEB'] = '\u0626\u0627';
  34781. t['\uFBEC'] = '\u0626\u06D5';
  34782. t['\uFBED'] = '\u0626\u06D5';
  34783. t['\uFBEE'] = '\u0626\u0648';
  34784. t['\uFBEF'] = '\u0626\u0648';
  34785. t['\uFBF0'] = '\u0626\u06C7';
  34786. t['\uFBF1'] = '\u0626\u06C7';
  34787. t['\uFBF2'] = '\u0626\u06C6';
  34788. t['\uFBF3'] = '\u0626\u06C6';
  34789. t['\uFBF4'] = '\u0626\u06C8';
  34790. t['\uFBF5'] = '\u0626\u06C8';
  34791. t['\uFBF6'] = '\u0626\u06D0';
  34792. t['\uFBF7'] = '\u0626\u06D0';
  34793. t['\uFBF8'] = '\u0626\u06D0';
  34794. t['\uFBF9'] = '\u0626\u0649';
  34795. t['\uFBFA'] = '\u0626\u0649';
  34796. t['\uFBFB'] = '\u0626\u0649';
  34797. t['\uFBFC'] = '\u06CC';
  34798. t['\uFBFD'] = '\u06CC';
  34799. t['\uFBFE'] = '\u06CC';
  34800. t['\uFBFF'] = '\u06CC';
  34801. t['\uFC00'] = '\u0626\u062C';
  34802. t['\uFC01'] = '\u0626\u062D';
  34803. t['\uFC02'] = '\u0626\u0645';
  34804. t['\uFC03'] = '\u0626\u0649';
  34805. t['\uFC04'] = '\u0626\u064A';
  34806. t['\uFC05'] = '\u0628\u062C';
  34807. t['\uFC06'] = '\u0628\u062D';
  34808. t['\uFC07'] = '\u0628\u062E';
  34809. t['\uFC08'] = '\u0628\u0645';
  34810. t['\uFC09'] = '\u0628\u0649';
  34811. t['\uFC0A'] = '\u0628\u064A';
  34812. t['\uFC0B'] = '\u062A\u062C';
  34813. t['\uFC0C'] = '\u062A\u062D';
  34814. t['\uFC0D'] = '\u062A\u062E';
  34815. t['\uFC0E'] = '\u062A\u0645';
  34816. t['\uFC0F'] = '\u062A\u0649';
  34817. t['\uFC10'] = '\u062A\u064A';
  34818. t['\uFC11'] = '\u062B\u062C';
  34819. t['\uFC12'] = '\u062B\u0645';
  34820. t['\uFC13'] = '\u062B\u0649';
  34821. t['\uFC14'] = '\u062B\u064A';
  34822. t['\uFC15'] = '\u062C\u062D';
  34823. t['\uFC16'] = '\u062C\u0645';
  34824. t['\uFC17'] = '\u062D\u062C';
  34825. t['\uFC18'] = '\u062D\u0645';
  34826. t['\uFC19'] = '\u062E\u062C';
  34827. t['\uFC1A'] = '\u062E\u062D';
  34828. t['\uFC1B'] = '\u062E\u0645';
  34829. t['\uFC1C'] = '\u0633\u062C';
  34830. t['\uFC1D'] = '\u0633\u062D';
  34831. t['\uFC1E'] = '\u0633\u062E';
  34832. t['\uFC1F'] = '\u0633\u0645';
  34833. t['\uFC20'] = '\u0635\u062D';
  34834. t['\uFC21'] = '\u0635\u0645';
  34835. t['\uFC22'] = '\u0636\u062C';
  34836. t['\uFC23'] = '\u0636\u062D';
  34837. t['\uFC24'] = '\u0636\u062E';
  34838. t['\uFC25'] = '\u0636\u0645';
  34839. t['\uFC26'] = '\u0637\u062D';
  34840. t['\uFC27'] = '\u0637\u0645';
  34841. t['\uFC28'] = '\u0638\u0645';
  34842. t['\uFC29'] = '\u0639\u062C';
  34843. t['\uFC2A'] = '\u0639\u0645';
  34844. t['\uFC2B'] = '\u063A\u062C';
  34845. t['\uFC2C'] = '\u063A\u0645';
  34846. t['\uFC2D'] = '\u0641\u062C';
  34847. t['\uFC2E'] = '\u0641\u062D';
  34848. t['\uFC2F'] = '\u0641\u062E';
  34849. t['\uFC30'] = '\u0641\u0645';
  34850. t['\uFC31'] = '\u0641\u0649';
  34851. t['\uFC32'] = '\u0641\u064A';
  34852. t['\uFC33'] = '\u0642\u062D';
  34853. t['\uFC34'] = '\u0642\u0645';
  34854. t['\uFC35'] = '\u0642\u0649';
  34855. t['\uFC36'] = '\u0642\u064A';
  34856. t['\uFC37'] = '\u0643\u0627';
  34857. t['\uFC38'] = '\u0643\u062C';
  34858. t['\uFC39'] = '\u0643\u062D';
  34859. t['\uFC3A'] = '\u0643\u062E';
  34860. t['\uFC3B'] = '\u0643\u0644';
  34861. t['\uFC3C'] = '\u0643\u0645';
  34862. t['\uFC3D'] = '\u0643\u0649';
  34863. t['\uFC3E'] = '\u0643\u064A';
  34864. t['\uFC3F'] = '\u0644\u062C';
  34865. t['\uFC40'] = '\u0644\u062D';
  34866. t['\uFC41'] = '\u0644\u062E';
  34867. t['\uFC42'] = '\u0644\u0645';
  34868. t['\uFC43'] = '\u0644\u0649';
  34869. t['\uFC44'] = '\u0644\u064A';
  34870. t['\uFC45'] = '\u0645\u062C';
  34871. t['\uFC46'] = '\u0645\u062D';
  34872. t['\uFC47'] = '\u0645\u062E';
  34873. t['\uFC48'] = '\u0645\u0645';
  34874. t['\uFC49'] = '\u0645\u0649';
  34875. t['\uFC4A'] = '\u0645\u064A';
  34876. t['\uFC4B'] = '\u0646\u062C';
  34877. t['\uFC4C'] = '\u0646\u062D';
  34878. t['\uFC4D'] = '\u0646\u062E';
  34879. t['\uFC4E'] = '\u0646\u0645';
  34880. t['\uFC4F'] = '\u0646\u0649';
  34881. t['\uFC50'] = '\u0646\u064A';
  34882. t['\uFC51'] = '\u0647\u062C';
  34883. t['\uFC52'] = '\u0647\u0645';
  34884. t['\uFC53'] = '\u0647\u0649';
  34885. t['\uFC54'] = '\u0647\u064A';
  34886. t['\uFC55'] = '\u064A\u062C';
  34887. t['\uFC56'] = '\u064A\u062D';
  34888. t['\uFC57'] = '\u064A\u062E';
  34889. t['\uFC58'] = '\u064A\u0645';
  34890. t['\uFC59'] = '\u064A\u0649';
  34891. t['\uFC5A'] = '\u064A\u064A';
  34892. t['\uFC5B'] = '\u0630\u0670';
  34893. t['\uFC5C'] = '\u0631\u0670';
  34894. t['\uFC5D'] = '\u0649\u0670';
  34895. t['\uFC5E'] = '\u0020\u064C\u0651';
  34896. t['\uFC5F'] = '\u0020\u064D\u0651';
  34897. t['\uFC60'] = '\u0020\u064E\u0651';
  34898. t['\uFC61'] = '\u0020\u064F\u0651';
  34899. t['\uFC62'] = '\u0020\u0650\u0651';
  34900. t['\uFC63'] = '\u0020\u0651\u0670';
  34901. t['\uFC64'] = '\u0626\u0631';
  34902. t['\uFC65'] = '\u0626\u0632';
  34903. t['\uFC66'] = '\u0626\u0645';
  34904. t['\uFC67'] = '\u0626\u0646';
  34905. t['\uFC68'] = '\u0626\u0649';
  34906. t['\uFC69'] = '\u0626\u064A';
  34907. t['\uFC6A'] = '\u0628\u0631';
  34908. t['\uFC6B'] = '\u0628\u0632';
  34909. t['\uFC6C'] = '\u0628\u0645';
  34910. t['\uFC6D'] = '\u0628\u0646';
  34911. t['\uFC6E'] = '\u0628\u0649';
  34912. t['\uFC6F'] = '\u0628\u064A';
  34913. t['\uFC70'] = '\u062A\u0631';
  34914. t['\uFC71'] = '\u062A\u0632';
  34915. t['\uFC72'] = '\u062A\u0645';
  34916. t['\uFC73'] = '\u062A\u0646';
  34917. t['\uFC74'] = '\u062A\u0649';
  34918. t['\uFC75'] = '\u062A\u064A';
  34919. t['\uFC76'] = '\u062B\u0631';
  34920. t['\uFC77'] = '\u062B\u0632';
  34921. t['\uFC78'] = '\u062B\u0645';
  34922. t['\uFC79'] = '\u062B\u0646';
  34923. t['\uFC7A'] = '\u062B\u0649';
  34924. t['\uFC7B'] = '\u062B\u064A';
  34925. t['\uFC7C'] = '\u0641\u0649';
  34926. t['\uFC7D'] = '\u0641\u064A';
  34927. t['\uFC7E'] = '\u0642\u0649';
  34928. t['\uFC7F'] = '\u0642\u064A';
  34929. t['\uFC80'] = '\u0643\u0627';
  34930. t['\uFC81'] = '\u0643\u0644';
  34931. t['\uFC82'] = '\u0643\u0645';
  34932. t['\uFC83'] = '\u0643\u0649';
  34933. t['\uFC84'] = '\u0643\u064A';
  34934. t['\uFC85'] = '\u0644\u0645';
  34935. t['\uFC86'] = '\u0644\u0649';
  34936. t['\uFC87'] = '\u0644\u064A';
  34937. t['\uFC88'] = '\u0645\u0627';
  34938. t['\uFC89'] = '\u0645\u0645';
  34939. t['\uFC8A'] = '\u0646\u0631';
  34940. t['\uFC8B'] = '\u0646\u0632';
  34941. t['\uFC8C'] = '\u0646\u0645';
  34942. t['\uFC8D'] = '\u0646\u0646';
  34943. t['\uFC8E'] = '\u0646\u0649';
  34944. t['\uFC8F'] = '\u0646\u064A';
  34945. t['\uFC90'] = '\u0649\u0670';
  34946. t['\uFC91'] = '\u064A\u0631';
  34947. t['\uFC92'] = '\u064A\u0632';
  34948. t['\uFC93'] = '\u064A\u0645';
  34949. t['\uFC94'] = '\u064A\u0646';
  34950. t['\uFC95'] = '\u064A\u0649';
  34951. t['\uFC96'] = '\u064A\u064A';
  34952. t['\uFC97'] = '\u0626\u062C';
  34953. t['\uFC98'] = '\u0626\u062D';
  34954. t['\uFC99'] = '\u0626\u062E';
  34955. t['\uFC9A'] = '\u0626\u0645';
  34956. t['\uFC9B'] = '\u0626\u0647';
  34957. t['\uFC9C'] = '\u0628\u062C';
  34958. t['\uFC9D'] = '\u0628\u062D';
  34959. t['\uFC9E'] = '\u0628\u062E';
  34960. t['\uFC9F'] = '\u0628\u0645';
  34961. t['\uFCA0'] = '\u0628\u0647';
  34962. t['\uFCA1'] = '\u062A\u062C';
  34963. t['\uFCA2'] = '\u062A\u062D';
  34964. t['\uFCA3'] = '\u062A\u062E';
  34965. t['\uFCA4'] = '\u062A\u0645';
  34966. t['\uFCA5'] = '\u062A\u0647';
  34967. t['\uFCA6'] = '\u062B\u0645';
  34968. t['\uFCA7'] = '\u062C\u062D';
  34969. t['\uFCA8'] = '\u062C\u0645';
  34970. t['\uFCA9'] = '\u062D\u062C';
  34971. t['\uFCAA'] = '\u062D\u0645';
  34972. t['\uFCAB'] = '\u062E\u062C';
  34973. t['\uFCAC'] = '\u062E\u0645';
  34974. t['\uFCAD'] = '\u0633\u062C';
  34975. t['\uFCAE'] = '\u0633\u062D';
  34976. t['\uFCAF'] = '\u0633\u062E';
  34977. t['\uFCB0'] = '\u0633\u0645';
  34978. t['\uFCB1'] = '\u0635\u062D';
  34979. t['\uFCB2'] = '\u0635\u062E';
  34980. t['\uFCB3'] = '\u0635\u0645';
  34981. t['\uFCB4'] = '\u0636\u062C';
  34982. t['\uFCB5'] = '\u0636\u062D';
  34983. t['\uFCB6'] = '\u0636\u062E';
  34984. t['\uFCB7'] = '\u0636\u0645';
  34985. t['\uFCB8'] = '\u0637\u062D';
  34986. t['\uFCB9'] = '\u0638\u0645';
  34987. t['\uFCBA'] = '\u0639\u062C';
  34988. t['\uFCBB'] = '\u0639\u0645';
  34989. t['\uFCBC'] = '\u063A\u062C';
  34990. t['\uFCBD'] = '\u063A\u0645';
  34991. t['\uFCBE'] = '\u0641\u062C';
  34992. t['\uFCBF'] = '\u0641\u062D';
  34993. t['\uFCC0'] = '\u0641\u062E';
  34994. t['\uFCC1'] = '\u0641\u0645';
  34995. t['\uFCC2'] = '\u0642\u062D';
  34996. t['\uFCC3'] = '\u0642\u0645';
  34997. t['\uFCC4'] = '\u0643\u062C';
  34998. t['\uFCC5'] = '\u0643\u062D';
  34999. t['\uFCC6'] = '\u0643\u062E';
  35000. t['\uFCC7'] = '\u0643\u0644';
  35001. t['\uFCC8'] = '\u0643\u0645';
  35002. t['\uFCC9'] = '\u0644\u062C';
  35003. t['\uFCCA'] = '\u0644\u062D';
  35004. t['\uFCCB'] = '\u0644\u062E';
  35005. t['\uFCCC'] = '\u0644\u0645';
  35006. t['\uFCCD'] = '\u0644\u0647';
  35007. t['\uFCCE'] = '\u0645\u062C';
  35008. t['\uFCCF'] = '\u0645\u062D';
  35009. t['\uFCD0'] = '\u0645\u062E';
  35010. t['\uFCD1'] = '\u0645\u0645';
  35011. t['\uFCD2'] = '\u0646\u062C';
  35012. t['\uFCD3'] = '\u0646\u062D';
  35013. t['\uFCD4'] = '\u0646\u062E';
  35014. t['\uFCD5'] = '\u0646\u0645';
  35015. t['\uFCD6'] = '\u0646\u0647';
  35016. t['\uFCD7'] = '\u0647\u062C';
  35017. t['\uFCD8'] = '\u0647\u0645';
  35018. t['\uFCD9'] = '\u0647\u0670';
  35019. t['\uFCDA'] = '\u064A\u062C';
  35020. t['\uFCDB'] = '\u064A\u062D';
  35021. t['\uFCDC'] = '\u064A\u062E';
  35022. t['\uFCDD'] = '\u064A\u0645';
  35023. t['\uFCDE'] = '\u064A\u0647';
  35024. t['\uFCDF'] = '\u0626\u0645';
  35025. t['\uFCE0'] = '\u0626\u0647';
  35026. t['\uFCE1'] = '\u0628\u0645';
  35027. t['\uFCE2'] = '\u0628\u0647';
  35028. t['\uFCE3'] = '\u062A\u0645';
  35029. t['\uFCE4'] = '\u062A\u0647';
  35030. t['\uFCE5'] = '\u062B\u0645';
  35031. t['\uFCE6'] = '\u062B\u0647';
  35032. t['\uFCE7'] = '\u0633\u0645';
  35033. t['\uFCE8'] = '\u0633\u0647';
  35034. t['\uFCE9'] = '\u0634\u0645';
  35035. t['\uFCEA'] = '\u0634\u0647';
  35036. t['\uFCEB'] = '\u0643\u0644';
  35037. t['\uFCEC'] = '\u0643\u0645';
  35038. t['\uFCED'] = '\u0644\u0645';
  35039. t['\uFCEE'] = '\u0646\u0645';
  35040. t['\uFCEF'] = '\u0646\u0647';
  35041. t['\uFCF0'] = '\u064A\u0645';
  35042. t['\uFCF1'] = '\u064A\u0647';
  35043. t['\uFCF2'] = '\u0640\u064E\u0651';
  35044. t['\uFCF3'] = '\u0640\u064F\u0651';
  35045. t['\uFCF4'] = '\u0640\u0650\u0651';
  35046. t['\uFCF5'] = '\u0637\u0649';
  35047. t['\uFCF6'] = '\u0637\u064A';
  35048. t['\uFCF7'] = '\u0639\u0649';
  35049. t['\uFCF8'] = '\u0639\u064A';
  35050. t['\uFCF9'] = '\u063A\u0649';
  35051. t['\uFCFA'] = '\u063A\u064A';
  35052. t['\uFCFB'] = '\u0633\u0649';
  35053. t['\uFCFC'] = '\u0633\u064A';
  35054. t['\uFCFD'] = '\u0634\u0649';
  35055. t['\uFCFE'] = '\u0634\u064A';
  35056. t['\uFCFF'] = '\u062D\u0649';
  35057. t['\uFD00'] = '\u062D\u064A';
  35058. t['\uFD01'] = '\u062C\u0649';
  35059. t['\uFD02'] = '\u062C\u064A';
  35060. t['\uFD03'] = '\u062E\u0649';
  35061. t['\uFD04'] = '\u062E\u064A';
  35062. t['\uFD05'] = '\u0635\u0649';
  35063. t['\uFD06'] = '\u0635\u064A';
  35064. t['\uFD07'] = '\u0636\u0649';
  35065. t['\uFD08'] = '\u0636\u064A';
  35066. t['\uFD09'] = '\u0634\u062C';
  35067. t['\uFD0A'] = '\u0634\u062D';
  35068. t['\uFD0B'] = '\u0634\u062E';
  35069. t['\uFD0C'] = '\u0634\u0645';
  35070. t['\uFD0D'] = '\u0634\u0631';
  35071. t['\uFD0E'] = '\u0633\u0631';
  35072. t['\uFD0F'] = '\u0635\u0631';
  35073. t['\uFD10'] = '\u0636\u0631';
  35074. t['\uFD11'] = '\u0637\u0649';
  35075. t['\uFD12'] = '\u0637\u064A';
  35076. t['\uFD13'] = '\u0639\u0649';
  35077. t['\uFD14'] = '\u0639\u064A';
  35078. t['\uFD15'] = '\u063A\u0649';
  35079. t['\uFD16'] = '\u063A\u064A';
  35080. t['\uFD17'] = '\u0633\u0649';
  35081. t['\uFD18'] = '\u0633\u064A';
  35082. t['\uFD19'] = '\u0634\u0649';
  35083. t['\uFD1A'] = '\u0634\u064A';
  35084. t['\uFD1B'] = '\u062D\u0649';
  35085. t['\uFD1C'] = '\u062D\u064A';
  35086. t['\uFD1D'] = '\u062C\u0649';
  35087. t['\uFD1E'] = '\u062C\u064A';
  35088. t['\uFD1F'] = '\u062E\u0649';
  35089. t['\uFD20'] = '\u062E\u064A';
  35090. t['\uFD21'] = '\u0635\u0649';
  35091. t['\uFD22'] = '\u0635\u064A';
  35092. t['\uFD23'] = '\u0636\u0649';
  35093. t['\uFD24'] = '\u0636\u064A';
  35094. t['\uFD25'] = '\u0634\u062C';
  35095. t['\uFD26'] = '\u0634\u062D';
  35096. t['\uFD27'] = '\u0634\u062E';
  35097. t['\uFD28'] = '\u0634\u0645';
  35098. t['\uFD29'] = '\u0634\u0631';
  35099. t['\uFD2A'] = '\u0633\u0631';
  35100. t['\uFD2B'] = '\u0635\u0631';
  35101. t['\uFD2C'] = '\u0636\u0631';
  35102. t['\uFD2D'] = '\u0634\u062C';
  35103. t['\uFD2E'] = '\u0634\u062D';
  35104. t['\uFD2F'] = '\u0634\u062E';
  35105. t['\uFD30'] = '\u0634\u0645';
  35106. t['\uFD31'] = '\u0633\u0647';
  35107. t['\uFD32'] = '\u0634\u0647';
  35108. t['\uFD33'] = '\u0637\u0645';
  35109. t['\uFD34'] = '\u0633\u062C';
  35110. t['\uFD35'] = '\u0633\u062D';
  35111. t['\uFD36'] = '\u0633\u062E';
  35112. t['\uFD37'] = '\u0634\u062C';
  35113. t['\uFD38'] = '\u0634\u062D';
  35114. t['\uFD39'] = '\u0634\u062E';
  35115. t['\uFD3A'] = '\u0637\u0645';
  35116. t['\uFD3B'] = '\u0638\u0645';
  35117. t['\uFD3C'] = '\u0627\u064B';
  35118. t['\uFD3D'] = '\u0627\u064B';
  35119. t['\uFD50'] = '\u062A\u062C\u0645';
  35120. t['\uFD51'] = '\u062A\u062D\u062C';
  35121. t['\uFD52'] = '\u062A\u062D\u062C';
  35122. t['\uFD53'] = '\u062A\u062D\u0645';
  35123. t['\uFD54'] = '\u062A\u062E\u0645';
  35124. t['\uFD55'] = '\u062A\u0645\u062C';
  35125. t['\uFD56'] = '\u062A\u0645\u062D';
  35126. t['\uFD57'] = '\u062A\u0645\u062E';
  35127. t['\uFD58'] = '\u062C\u0645\u062D';
  35128. t['\uFD59'] = '\u062C\u0645\u062D';
  35129. t['\uFD5A'] = '\u062D\u0645\u064A';
  35130. t['\uFD5B'] = '\u062D\u0645\u0649';
  35131. t['\uFD5C'] = '\u0633\u062D\u062C';
  35132. t['\uFD5D'] = '\u0633\u062C\u062D';
  35133. t['\uFD5E'] = '\u0633\u062C\u0649';
  35134. t['\uFD5F'] = '\u0633\u0645\u062D';
  35135. t['\uFD60'] = '\u0633\u0645\u062D';
  35136. t['\uFD61'] = '\u0633\u0645\u062C';
  35137. t['\uFD62'] = '\u0633\u0645\u0645';
  35138. t['\uFD63'] = '\u0633\u0645\u0645';
  35139. t['\uFD64'] = '\u0635\u062D\u062D';
  35140. t['\uFD65'] = '\u0635\u062D\u062D';
  35141. t['\uFD66'] = '\u0635\u0645\u0645';
  35142. t['\uFD67'] = '\u0634\u062D\u0645';
  35143. t['\uFD68'] = '\u0634\u062D\u0645';
  35144. t['\uFD69'] = '\u0634\u062C\u064A';
  35145. t['\uFD6A'] = '\u0634\u0645\u062E';
  35146. t['\uFD6B'] = '\u0634\u0645\u062E';
  35147. t['\uFD6C'] = '\u0634\u0645\u0645';
  35148. t['\uFD6D'] = '\u0634\u0645\u0645';
  35149. t['\uFD6E'] = '\u0636\u062D\u0649';
  35150. t['\uFD6F'] = '\u0636\u062E\u0645';
  35151. t['\uFD70'] = '\u0636\u062E\u0645';
  35152. t['\uFD71'] = '\u0637\u0645\u062D';
  35153. t['\uFD72'] = '\u0637\u0645\u062D';
  35154. t['\uFD73'] = '\u0637\u0645\u0645';
  35155. t['\uFD74'] = '\u0637\u0645\u064A';
  35156. t['\uFD75'] = '\u0639\u062C\u0645';
  35157. t['\uFD76'] = '\u0639\u0645\u0645';
  35158. t['\uFD77'] = '\u0639\u0645\u0645';
  35159. t['\uFD78'] = '\u0639\u0645\u0649';
  35160. t['\uFD79'] = '\u063A\u0645\u0645';
  35161. t['\uFD7A'] = '\u063A\u0645\u064A';
  35162. t['\uFD7B'] = '\u063A\u0645\u0649';
  35163. t['\uFD7C'] = '\u0641\u062E\u0645';
  35164. t['\uFD7D'] = '\u0641\u062E\u0645';
  35165. t['\uFD7E'] = '\u0642\u0645\u062D';
  35166. t['\uFD7F'] = '\u0642\u0645\u0645';
  35167. t['\uFD80'] = '\u0644\u062D\u0645';
  35168. t['\uFD81'] = '\u0644\u062D\u064A';
  35169. t['\uFD82'] = '\u0644\u062D\u0649';
  35170. t['\uFD83'] = '\u0644\u062C\u062C';
  35171. t['\uFD84'] = '\u0644\u062C\u062C';
  35172. t['\uFD85'] = '\u0644\u062E\u0645';
  35173. t['\uFD86'] = '\u0644\u062E\u0645';
  35174. t['\uFD87'] = '\u0644\u0645\u062D';
  35175. t['\uFD88'] = '\u0644\u0645\u062D';
  35176. t['\uFD89'] = '\u0645\u062D\u062C';
  35177. t['\uFD8A'] = '\u0645\u062D\u0645';
  35178. t['\uFD8B'] = '\u0645\u062D\u064A';
  35179. t['\uFD8C'] = '\u0645\u062C\u062D';
  35180. t['\uFD8D'] = '\u0645\u062C\u0645';
  35181. t['\uFD8E'] = '\u0645\u062E\u062C';
  35182. t['\uFD8F'] = '\u0645\u062E\u0645';
  35183. t['\uFD92'] = '\u0645\u062C\u062E';
  35184. t['\uFD93'] = '\u0647\u0645\u062C';
  35185. t['\uFD94'] = '\u0647\u0645\u0645';
  35186. t['\uFD95'] = '\u0646\u062D\u0645';
  35187. t['\uFD96'] = '\u0646\u062D\u0649';
  35188. t['\uFD97'] = '\u0646\u062C\u0645';
  35189. t['\uFD98'] = '\u0646\u062C\u0645';
  35190. t['\uFD99'] = '\u0646\u062C\u0649';
  35191. t['\uFD9A'] = '\u0646\u0645\u064A';
  35192. t['\uFD9B'] = '\u0646\u0645\u0649';
  35193. t['\uFD9C'] = '\u064A\u0645\u0645';
  35194. t['\uFD9D'] = '\u064A\u0645\u0645';
  35195. t['\uFD9E'] = '\u0628\u062E\u064A';
  35196. t['\uFD9F'] = '\u062A\u062C\u064A';
  35197. t['\uFDA0'] = '\u062A\u062C\u0649';
  35198. t['\uFDA1'] = '\u062A\u062E\u064A';
  35199. t['\uFDA2'] = '\u062A\u062E\u0649';
  35200. t['\uFDA3'] = '\u062A\u0645\u064A';
  35201. t['\uFDA4'] = '\u062A\u0645\u0649';
  35202. t['\uFDA5'] = '\u062C\u0645\u064A';
  35203. t['\uFDA6'] = '\u062C\u062D\u0649';
  35204. t['\uFDA7'] = '\u062C\u0645\u0649';
  35205. t['\uFDA8'] = '\u0633\u062E\u0649';
  35206. t['\uFDA9'] = '\u0635\u062D\u064A';
  35207. t['\uFDAA'] = '\u0634\u062D\u064A';
  35208. t['\uFDAB'] = '\u0636\u062D\u064A';
  35209. t['\uFDAC'] = '\u0644\u062C\u064A';
  35210. t['\uFDAD'] = '\u0644\u0645\u064A';
  35211. t['\uFDAE'] = '\u064A\u062D\u064A';
  35212. t['\uFDAF'] = '\u064A\u062C\u064A';
  35213. t['\uFDB0'] = '\u064A\u0645\u064A';
  35214. t['\uFDB1'] = '\u0645\u0645\u064A';
  35215. t['\uFDB2'] = '\u0642\u0645\u064A';
  35216. t['\uFDB3'] = '\u0646\u062D\u064A';
  35217. t['\uFDB4'] = '\u0642\u0645\u062D';
  35218. t['\uFDB5'] = '\u0644\u062D\u0645';
  35219. t['\uFDB6'] = '\u0639\u0645\u064A';
  35220. t['\uFDB7'] = '\u0643\u0645\u064A';
  35221. t['\uFDB8'] = '\u0646\u062C\u062D';
  35222. t['\uFDB9'] = '\u0645\u062E\u064A';
  35223. t['\uFDBA'] = '\u0644\u062C\u0645';
  35224. t['\uFDBB'] = '\u0643\u0645\u0645';
  35225. t['\uFDBC'] = '\u0644\u062C\u0645';
  35226. t['\uFDBD'] = '\u0646\u062C\u062D';
  35227. t['\uFDBE'] = '\u062C\u062D\u064A';
  35228. t['\uFDBF'] = '\u062D\u062C\u064A';
  35229. t['\uFDC0'] = '\u0645\u062C\u064A';
  35230. t['\uFDC1'] = '\u0641\u0645\u064A';
  35231. t['\uFDC2'] = '\u0628\u062D\u064A';
  35232. t['\uFDC3'] = '\u0643\u0645\u0645';
  35233. t['\uFDC4'] = '\u0639\u062C\u0645';
  35234. t['\uFDC5'] = '\u0635\u0645\u0645';
  35235. t['\uFDC6'] = '\u0633\u062E\u064A';
  35236. t['\uFDC7'] = '\u0646\u062C\u064A';
  35237. t['\uFE49'] = '\u203E';
  35238. t['\uFE4A'] = '\u203E';
  35239. t['\uFE4B'] = '\u203E';
  35240. t['\uFE4C'] = '\u203E';
  35241. t['\uFE4D'] = '\u005F';
  35242. t['\uFE4E'] = '\u005F';
  35243. t['\uFE4F'] = '\u005F';
  35244. t['\uFE80'] = '\u0621';
  35245. t['\uFE81'] = '\u0622';
  35246. t['\uFE82'] = '\u0622';
  35247. t['\uFE83'] = '\u0623';
  35248. t['\uFE84'] = '\u0623';
  35249. t['\uFE85'] = '\u0624';
  35250. t['\uFE86'] = '\u0624';
  35251. t['\uFE87'] = '\u0625';
  35252. t['\uFE88'] = '\u0625';
  35253. t['\uFE89'] = '\u0626';
  35254. t['\uFE8A'] = '\u0626';
  35255. t['\uFE8B'] = '\u0626';
  35256. t['\uFE8C'] = '\u0626';
  35257. t['\uFE8D'] = '\u0627';
  35258. t['\uFE8E'] = '\u0627';
  35259. t['\uFE8F'] = '\u0628';
  35260. t['\uFE90'] = '\u0628';
  35261. t['\uFE91'] = '\u0628';
  35262. t['\uFE92'] = '\u0628';
  35263. t['\uFE93'] = '\u0629';
  35264. t['\uFE94'] = '\u0629';
  35265. t['\uFE95'] = '\u062A';
  35266. t['\uFE96'] = '\u062A';
  35267. t['\uFE97'] = '\u062A';
  35268. t['\uFE98'] = '\u062A';
  35269. t['\uFE99'] = '\u062B';
  35270. t['\uFE9A'] = '\u062B';
  35271. t['\uFE9B'] = '\u062B';
  35272. t['\uFE9C'] = '\u062B';
  35273. t['\uFE9D'] = '\u062C';
  35274. t['\uFE9E'] = '\u062C';
  35275. t['\uFE9F'] = '\u062C';
  35276. t['\uFEA0'] = '\u062C';
  35277. t['\uFEA1'] = '\u062D';
  35278. t['\uFEA2'] = '\u062D';
  35279. t['\uFEA3'] = '\u062D';
  35280. t['\uFEA4'] = '\u062D';
  35281. t['\uFEA5'] = '\u062E';
  35282. t['\uFEA6'] = '\u062E';
  35283. t['\uFEA7'] = '\u062E';
  35284. t['\uFEA8'] = '\u062E';
  35285. t['\uFEA9'] = '\u062F';
  35286. t['\uFEAA'] = '\u062F';
  35287. t['\uFEAB'] = '\u0630';
  35288. t['\uFEAC'] = '\u0630';
  35289. t['\uFEAD'] = '\u0631';
  35290. t['\uFEAE'] = '\u0631';
  35291. t['\uFEAF'] = '\u0632';
  35292. t['\uFEB0'] = '\u0632';
  35293. t['\uFEB1'] = '\u0633';
  35294. t['\uFEB2'] = '\u0633';
  35295. t['\uFEB3'] = '\u0633';
  35296. t['\uFEB4'] = '\u0633';
  35297. t['\uFEB5'] = '\u0634';
  35298. t['\uFEB6'] = '\u0634';
  35299. t['\uFEB7'] = '\u0634';
  35300. t['\uFEB8'] = '\u0634';
  35301. t['\uFEB9'] = '\u0635';
  35302. t['\uFEBA'] = '\u0635';
  35303. t['\uFEBB'] = '\u0635';
  35304. t['\uFEBC'] = '\u0635';
  35305. t['\uFEBD'] = '\u0636';
  35306. t['\uFEBE'] = '\u0636';
  35307. t['\uFEBF'] = '\u0636';
  35308. t['\uFEC0'] = '\u0636';
  35309. t['\uFEC1'] = '\u0637';
  35310. t['\uFEC2'] = '\u0637';
  35311. t['\uFEC3'] = '\u0637';
  35312. t['\uFEC4'] = '\u0637';
  35313. t['\uFEC5'] = '\u0638';
  35314. t['\uFEC6'] = '\u0638';
  35315. t['\uFEC7'] = '\u0638';
  35316. t['\uFEC8'] = '\u0638';
  35317. t['\uFEC9'] = '\u0639';
  35318. t['\uFECA'] = '\u0639';
  35319. t['\uFECB'] = '\u0639';
  35320. t['\uFECC'] = '\u0639';
  35321. t['\uFECD'] = '\u063A';
  35322. t['\uFECE'] = '\u063A';
  35323. t['\uFECF'] = '\u063A';
  35324. t['\uFED0'] = '\u063A';
  35325. t['\uFED1'] = '\u0641';
  35326. t['\uFED2'] = '\u0641';
  35327. t['\uFED3'] = '\u0641';
  35328. t['\uFED4'] = '\u0641';
  35329. t['\uFED5'] = '\u0642';
  35330. t['\uFED6'] = '\u0642';
  35331. t['\uFED7'] = '\u0642';
  35332. t['\uFED8'] = '\u0642';
  35333. t['\uFED9'] = '\u0643';
  35334. t['\uFEDA'] = '\u0643';
  35335. t['\uFEDB'] = '\u0643';
  35336. t['\uFEDC'] = '\u0643';
  35337. t['\uFEDD'] = '\u0644';
  35338. t['\uFEDE'] = '\u0644';
  35339. t['\uFEDF'] = '\u0644';
  35340. t['\uFEE0'] = '\u0644';
  35341. t['\uFEE1'] = '\u0645';
  35342. t['\uFEE2'] = '\u0645';
  35343. t['\uFEE3'] = '\u0645';
  35344. t['\uFEE4'] = '\u0645';
  35345. t['\uFEE5'] = '\u0646';
  35346. t['\uFEE6'] = '\u0646';
  35347. t['\uFEE7'] = '\u0646';
  35348. t['\uFEE8'] = '\u0646';
  35349. t['\uFEE9'] = '\u0647';
  35350. t['\uFEEA'] = '\u0647';
  35351. t['\uFEEB'] = '\u0647';
  35352. t['\uFEEC'] = '\u0647';
  35353. t['\uFEED'] = '\u0648';
  35354. t['\uFEEE'] = '\u0648';
  35355. t['\uFEEF'] = '\u0649';
  35356. t['\uFEF0'] = '\u0649';
  35357. t['\uFEF1'] = '\u064A';
  35358. t['\uFEF2'] = '\u064A';
  35359. t['\uFEF3'] = '\u064A';
  35360. t['\uFEF4'] = '\u064A';
  35361. t['\uFEF5'] = '\u0644\u0622';
  35362. t['\uFEF6'] = '\u0644\u0622';
  35363. t['\uFEF7'] = '\u0644\u0623';
  35364. t['\uFEF8'] = '\u0644\u0623';
  35365. t['\uFEF9'] = '\u0644\u0625';
  35366. t['\uFEFA'] = '\u0644\u0625';
  35367. t['\uFEFB'] = '\u0644\u0627';
  35368. t['\uFEFC'] = '\u0644\u0627';
  35369. });
  35370. function reverseIfRtl(chars) {
  35371. var charsLength = chars.length;
  35372. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  35373. return chars;
  35374. }
  35375. var s = '';
  35376. for (var ii = charsLength - 1; ii >= 0; ii--) {
  35377. s += chars[ii];
  35378. }
  35379. return s;
  35380. }
  35381. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  35382. exports.reverseIfRtl = reverseIfRtl;
  35383. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  35384. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  35385. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  35386. /***/ }),
  35387. /* 18 */
  35388. /***/ (function(module, exports, __w_pdfjs_require__) {
  35389. "use strict";
  35390. var sharedUtil = __w_pdfjs_require__(0);
  35391. var coreWorker = __w_pdfjs_require__(8);
  35392. var OK_RESPONSE = 200;
  35393. var PARTIAL_CONTENT_RESPONSE = 206;
  35394. function NetworkManager(url, args) {
  35395. this.url = url;
  35396. args = args || {};
  35397. this.isHttp = /^https?:/i.test(url);
  35398. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  35399. this.withCredentials = args.withCredentials || false;
  35400. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  35401. return new XMLHttpRequest();
  35402. };
  35403. this.currXhrId = 0;
  35404. this.pendingRequests = Object.create(null);
  35405. this.loadedRequests = Object.create(null);
  35406. }
  35407. function getArrayBuffer(xhr) {
  35408. var data = xhr.response;
  35409. if (typeof data !== 'string') {
  35410. return data;
  35411. }
  35412. var length = data.length;
  35413. var array = new Uint8Array(length);
  35414. for (var i = 0; i < length; i++) {
  35415. array[i] = data.charCodeAt(i) & 0xFF;
  35416. }
  35417. return array.buffer;
  35418. }
  35419. var supportsMozChunked = function supportsMozChunkedClosure() {
  35420. try {
  35421. var x = new XMLHttpRequest();
  35422. x.open('GET', 'https://example.com');
  35423. x.responseType = 'moz-chunked-arraybuffer';
  35424. return x.responseType === 'moz-chunked-arraybuffer';
  35425. } catch (e) {
  35426. return false;
  35427. }
  35428. }();
  35429. NetworkManager.prototype = {
  35430. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  35431. var args = {
  35432. begin: begin,
  35433. end: end
  35434. };
  35435. for (var prop in listeners) {
  35436. args[prop] = listeners[prop];
  35437. }
  35438. return this.request(args);
  35439. },
  35440. requestFull: function NetworkManager_requestFull(listeners) {
  35441. return this.request(listeners);
  35442. },
  35443. request: function NetworkManager_request(args) {
  35444. var xhr = this.getXhr();
  35445. var xhrId = this.currXhrId++;
  35446. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  35447. xhr.open('GET', this.url);
  35448. xhr.withCredentials = this.withCredentials;
  35449. for (var property in this.httpHeaders) {
  35450. var value = this.httpHeaders[property];
  35451. if (typeof value === 'undefined') {
  35452. continue;
  35453. }
  35454. xhr.setRequestHeader(property, value);
  35455. }
  35456. if (this.isHttp && 'begin' in args && 'end' in args) {
  35457. var rangeStr = args.begin + '-' + (args.end - 1);
  35458. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  35459. pendingRequest.expectedStatus = 206;
  35460. } else {
  35461. pendingRequest.expectedStatus = 200;
  35462. }
  35463. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  35464. if (useMozChunkedLoading) {
  35465. xhr.responseType = 'moz-chunked-arraybuffer';
  35466. pendingRequest.onProgressiveData = args.onProgressiveData;
  35467. pendingRequest.mozChunked = true;
  35468. } else {
  35469. xhr.responseType = 'arraybuffer';
  35470. }
  35471. if (args.onError) {
  35472. xhr.onerror = function (evt) {
  35473. args.onError(xhr.status);
  35474. };
  35475. }
  35476. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  35477. xhr.onprogress = this.onProgress.bind(this, xhrId);
  35478. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  35479. pendingRequest.onDone = args.onDone;
  35480. pendingRequest.onError = args.onError;
  35481. pendingRequest.onProgress = args.onProgress;
  35482. xhr.send(null);
  35483. return xhrId;
  35484. },
  35485. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  35486. var pendingRequest = this.pendingRequests[xhrId];
  35487. if (!pendingRequest) {
  35488. return;
  35489. }
  35490. if (pendingRequest.mozChunked) {
  35491. var chunk = getArrayBuffer(pendingRequest.xhr);
  35492. pendingRequest.onProgressiveData(chunk);
  35493. }
  35494. var onProgress = pendingRequest.onProgress;
  35495. if (onProgress) {
  35496. onProgress(evt);
  35497. }
  35498. },
  35499. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  35500. var pendingRequest = this.pendingRequests[xhrId];
  35501. if (!pendingRequest) {
  35502. return;
  35503. }
  35504. var xhr = pendingRequest.xhr;
  35505. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  35506. pendingRequest.onHeadersReceived();
  35507. delete pendingRequest.onHeadersReceived;
  35508. }
  35509. if (xhr.readyState !== 4) {
  35510. return;
  35511. }
  35512. if (!(xhrId in this.pendingRequests)) {
  35513. return;
  35514. }
  35515. delete this.pendingRequests[xhrId];
  35516. if (xhr.status === 0 && this.isHttp) {
  35517. if (pendingRequest.onError) {
  35518. pendingRequest.onError(xhr.status);
  35519. }
  35520. return;
  35521. }
  35522. var xhrStatus = xhr.status || OK_RESPONSE;
  35523. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  35524. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  35525. if (pendingRequest.onError) {
  35526. pendingRequest.onError(xhr.status);
  35527. }
  35528. return;
  35529. }
  35530. this.loadedRequests[xhrId] = true;
  35531. var chunk = getArrayBuffer(xhr);
  35532. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  35533. var rangeHeader = xhr.getResponseHeader('Content-Range');
  35534. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  35535. var begin = parseInt(matches[1], 10);
  35536. pendingRequest.onDone({
  35537. begin: begin,
  35538. chunk: chunk
  35539. });
  35540. } else if (pendingRequest.onProgressiveData) {
  35541. pendingRequest.onDone(null);
  35542. } else if (chunk) {
  35543. pendingRequest.onDone({
  35544. begin: 0,
  35545. chunk: chunk
  35546. });
  35547. } else if (pendingRequest.onError) {
  35548. pendingRequest.onError(xhr.status);
  35549. }
  35550. },
  35551. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  35552. for (var xhrId in this.pendingRequests) {
  35553. return true;
  35554. }
  35555. return false;
  35556. },
  35557. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  35558. return this.pendingRequests[xhrId].xhr;
  35559. },
  35560. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  35561. return !!this.pendingRequests[xhrId].onProgressiveData;
  35562. },
  35563. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  35564. return xhrId in this.pendingRequests;
  35565. },
  35566. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  35567. return xhrId in this.loadedRequests;
  35568. },
  35569. abortAllRequests: function NetworkManager_abortAllRequests() {
  35570. for (var xhrId in this.pendingRequests) {
  35571. this.abortRequest(xhrId | 0);
  35572. }
  35573. },
  35574. abortRequest: function NetworkManager_abortRequest(xhrId) {
  35575. var xhr = this.pendingRequests[xhrId].xhr;
  35576. delete this.pendingRequests[xhrId];
  35577. xhr.abort();
  35578. }
  35579. };
  35580. var assert = sharedUtil.assert;
  35581. var createPromiseCapability = sharedUtil.createPromiseCapability;
  35582. var isInt = sharedUtil.isInt;
  35583. var MissingPDFException = sharedUtil.MissingPDFException;
  35584. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  35585. function PDFNetworkStream(options) {
  35586. this._options = options;
  35587. var source = options.source;
  35588. this._manager = new NetworkManager(source.url, {
  35589. httpHeaders: source.httpHeaders,
  35590. withCredentials: source.withCredentials
  35591. });
  35592. this._rangeChunkSize = source.rangeChunkSize;
  35593. this._fullRequestReader = null;
  35594. this._rangeRequestReaders = [];
  35595. }
  35596. PDFNetworkStream.prototype = {
  35597. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  35598. var i = this._rangeRequestReaders.indexOf(reader);
  35599. if (i >= 0) {
  35600. this._rangeRequestReaders.splice(i, 1);
  35601. }
  35602. },
  35603. getFullReader: function PDFNetworkStream_getFullReader() {
  35604. assert(!this._fullRequestReader);
  35605. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  35606. return this._fullRequestReader;
  35607. },
  35608. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  35609. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  35610. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  35611. this._rangeRequestReaders.push(reader);
  35612. return reader;
  35613. },
  35614. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  35615. if (this._fullRequestReader) {
  35616. this._fullRequestReader.cancel(reason);
  35617. }
  35618. var readers = this._rangeRequestReaders.slice(0);
  35619. readers.forEach(function (reader) {
  35620. reader.cancel(reason);
  35621. });
  35622. }
  35623. };
  35624. function PDFNetworkStreamFullRequestReader(manager, options) {
  35625. this._manager = manager;
  35626. var source = options.source;
  35627. var args = {
  35628. onHeadersReceived: this._onHeadersReceived.bind(this),
  35629. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  35630. onDone: this._onDone.bind(this),
  35631. onError: this._onError.bind(this),
  35632. onProgress: this._onProgress.bind(this)
  35633. };
  35634. this._url = source.url;
  35635. this._fullRequestId = manager.requestFull(args);
  35636. this._headersReceivedCapability = createPromiseCapability();
  35637. this._disableRange = options.disableRange || false;
  35638. this._contentLength = source.length;
  35639. this._rangeChunkSize = source.rangeChunkSize;
  35640. if (!this._rangeChunkSize && !this._disableRange) {
  35641. this._disableRange = true;
  35642. }
  35643. this._isStreamingSupported = false;
  35644. this._isRangeSupported = false;
  35645. this._cachedChunks = [];
  35646. this._requests = [];
  35647. this._done = false;
  35648. this._storedError = undefined;
  35649. this.onProgress = null;
  35650. }
  35651. PDFNetworkStreamFullRequestReader.prototype = {
  35652. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  35653. if (this._disableRange) {
  35654. return false;
  35655. }
  35656. var networkManager = this._manager;
  35657. if (!networkManager.isHttp) {
  35658. return false;
  35659. }
  35660. var fullRequestXhrId = this._fullRequestId;
  35661. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  35662. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  35663. return false;
  35664. }
  35665. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  35666. if (contentEncoding !== 'identity') {
  35667. return false;
  35668. }
  35669. var length = fullRequestXhr.getResponseHeader('Content-Length');
  35670. length = parseInt(length, 10);
  35671. if (!isInt(length)) {
  35672. return false;
  35673. }
  35674. this._contentLength = length;
  35675. if (length <= 2 * this._rangeChunkSize) {
  35676. return false;
  35677. }
  35678. return true;
  35679. },
  35680. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  35681. if (this._validateRangeRequestCapabilities()) {
  35682. this._isRangeSupported = true;
  35683. }
  35684. var networkManager = this._manager;
  35685. var fullRequestXhrId = this._fullRequestId;
  35686. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  35687. this._isStreamingSupported = true;
  35688. } else if (this._isRangeSupported) {
  35689. networkManager.abortRequest(fullRequestXhrId);
  35690. }
  35691. this._headersReceivedCapability.resolve();
  35692. },
  35693. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  35694. if (this._requests.length > 0) {
  35695. var requestCapability = this._requests.shift();
  35696. requestCapability.resolve({
  35697. value: chunk,
  35698. done: false
  35699. });
  35700. } else {
  35701. this._cachedChunks.push(chunk);
  35702. }
  35703. },
  35704. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  35705. if (args) {
  35706. this._onProgressiveData(args.chunk);
  35707. }
  35708. this._done = true;
  35709. if (this._cachedChunks.length > 0) {
  35710. return;
  35711. }
  35712. this._requests.forEach(function (requestCapability) {
  35713. requestCapability.resolve({
  35714. value: undefined,
  35715. done: true
  35716. });
  35717. });
  35718. this._requests = [];
  35719. },
  35720. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  35721. var url = this._url;
  35722. var exception;
  35723. if (status === 404 || status === 0 && /^file:/.test(url)) {
  35724. exception = new MissingPDFException('Missing PDF "' + url + '".');
  35725. } else {
  35726. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  35727. }
  35728. this._storedError = exception;
  35729. this._headersReceivedCapability.reject(exception);
  35730. this._requests.forEach(function (requestCapability) {
  35731. requestCapability.reject(exception);
  35732. });
  35733. this._requests = [];
  35734. this._cachedChunks = [];
  35735. },
  35736. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  35737. if (this.onProgress) {
  35738. this.onProgress({
  35739. loaded: data.loaded,
  35740. total: data.lengthComputable ? data.total : this._contentLength
  35741. });
  35742. }
  35743. },
  35744. get isRangeSupported() {
  35745. return this._isRangeSupported;
  35746. },
  35747. get isStreamingSupported() {
  35748. return this._isStreamingSupported;
  35749. },
  35750. get contentLength() {
  35751. return this._contentLength;
  35752. },
  35753. get headersReady() {
  35754. return this._headersReceivedCapability.promise;
  35755. },
  35756. read: function PDFNetworkStreamFullRequestReader_read() {
  35757. if (this._storedError) {
  35758. return Promise.reject(this._storedError);
  35759. }
  35760. if (this._cachedChunks.length > 0) {
  35761. var chunk = this._cachedChunks.shift();
  35762. return Promise.resolve(chunk);
  35763. }
  35764. if (this._done) {
  35765. return Promise.resolve({
  35766. value: undefined,
  35767. done: true
  35768. });
  35769. }
  35770. var requestCapability = createPromiseCapability();
  35771. this._requests.push(requestCapability);
  35772. return requestCapability.promise;
  35773. },
  35774. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  35775. this._done = true;
  35776. this._headersReceivedCapability.reject(reason);
  35777. this._requests.forEach(function (requestCapability) {
  35778. requestCapability.resolve({
  35779. value: undefined,
  35780. done: true
  35781. });
  35782. });
  35783. this._requests = [];
  35784. if (this._manager.isPendingRequest(this._fullRequestId)) {
  35785. this._manager.abortRequest(this._fullRequestId);
  35786. }
  35787. this._fullRequestReader = null;
  35788. }
  35789. };
  35790. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  35791. this._manager = manager;
  35792. var args = {
  35793. onDone: this._onDone.bind(this),
  35794. onProgress: this._onProgress.bind(this)
  35795. };
  35796. this._requestId = manager.requestRange(begin, end, args);
  35797. this._requests = [];
  35798. this._queuedChunk = null;
  35799. this._done = false;
  35800. this.onProgress = null;
  35801. this.onClosed = null;
  35802. }
  35803. PDFNetworkStreamRangeRequestReader.prototype = {
  35804. _close: function PDFNetworkStreamRangeRequestReader_close() {
  35805. if (this.onClosed) {
  35806. this.onClosed(this);
  35807. }
  35808. },
  35809. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  35810. var chunk = data.chunk;
  35811. if (this._requests.length > 0) {
  35812. var requestCapability = this._requests.shift();
  35813. requestCapability.resolve({
  35814. value: chunk,
  35815. done: false
  35816. });
  35817. } else {
  35818. this._queuedChunk = chunk;
  35819. }
  35820. this._done = true;
  35821. this._requests.forEach(function (requestCapability) {
  35822. requestCapability.resolve({
  35823. value: undefined,
  35824. done: true
  35825. });
  35826. });
  35827. this._requests = [];
  35828. this._close();
  35829. },
  35830. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35831. if (!this.isStreamingSupported && this.onProgress) {
  35832. this.onProgress({ loaded: evt.loaded });
  35833. }
  35834. },
  35835. get isStreamingSupported() {
  35836. return false;
  35837. },
  35838. read: function PDFNetworkStreamRangeRequestReader_read() {
  35839. if (this._queuedChunk !== null) {
  35840. var chunk = this._queuedChunk;
  35841. this._queuedChunk = null;
  35842. return Promise.resolve({
  35843. value: chunk,
  35844. done: false
  35845. });
  35846. }
  35847. if (this._done) {
  35848. return Promise.resolve({
  35849. value: undefined,
  35850. done: true
  35851. });
  35852. }
  35853. var requestCapability = createPromiseCapability();
  35854. this._requests.push(requestCapability);
  35855. return requestCapability.promise;
  35856. },
  35857. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35858. this._done = true;
  35859. this._requests.forEach(function (requestCapability) {
  35860. requestCapability.resolve({
  35861. value: undefined,
  35862. done: true
  35863. });
  35864. });
  35865. this._requests = [];
  35866. if (this._manager.isPendingRequest(this._requestId)) {
  35867. this._manager.abortRequest(this._requestId);
  35868. }
  35869. this._close();
  35870. }
  35871. };
  35872. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35873. exports.PDFNetworkStream = PDFNetworkStream;
  35874. exports.NetworkManager = NetworkManager;
  35875. /***/ }),
  35876. /* 19 */
  35877. /***/ (function(module, exports) {
  35878. var g;
  35879. g = function () {
  35880. return this;
  35881. }();
  35882. try {
  35883. g = g || Function("return this")() || (1, eval)("this");
  35884. } catch (e) {
  35885. if (typeof window === "object")
  35886. g = window;
  35887. }
  35888. module.exports = g;
  35889. /***/ }),
  35890. /* 20 */
  35891. /***/ (function(module, exports, __w_pdfjs_require__) {
  35892. "use strict";
  35893. var sharedUtil = __w_pdfjs_require__(0);
  35894. var corePrimitives = __w_pdfjs_require__(1);
  35895. var coreStream = __w_pdfjs_require__(2);
  35896. var coreColorSpace = __w_pdfjs_require__(3);
  35897. var coreObj = __w_pdfjs_require__(15);
  35898. var coreEvaluator = __w_pdfjs_require__(13);
  35899. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35900. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35901. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35902. var AnnotationType = sharedUtil.AnnotationType;
  35903. var OPS = sharedUtil.OPS;
  35904. var Util = sharedUtil.Util;
  35905. var isArray = sharedUtil.isArray;
  35906. var isInt = sharedUtil.isInt;
  35907. var stringToBytes = sharedUtil.stringToBytes;
  35908. var stringToPDFString = sharedUtil.stringToPDFString;
  35909. var warn = sharedUtil.warn;
  35910. var Dict = corePrimitives.Dict;
  35911. var isDict = corePrimitives.isDict;
  35912. var isName = corePrimitives.isName;
  35913. var isRef = corePrimitives.isRef;
  35914. var Stream = coreStream.Stream;
  35915. var ColorSpace = coreColorSpace.ColorSpace;
  35916. var Catalog = coreObj.Catalog;
  35917. var ObjectLoader = coreObj.ObjectLoader;
  35918. var FileSpec = coreObj.FileSpec;
  35919. var OperatorList = coreEvaluator.OperatorList;
  35920. function AnnotationFactory() {
  35921. }
  35922. AnnotationFactory.prototype = {
  35923. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35924. var dict = xref.fetchIfRef(ref);
  35925. if (!isDict(dict)) {
  35926. return;
  35927. }
  35928. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35929. var subtype = dict.get('Subtype');
  35930. subtype = isName(subtype) ? subtype.name : null;
  35931. var parameters = {
  35932. xref: xref,
  35933. dict: dict,
  35934. ref: isRef(ref) ? ref : null,
  35935. subtype: subtype,
  35936. id: id,
  35937. pdfManager: pdfManager
  35938. };
  35939. switch (subtype) {
  35940. case 'Link':
  35941. return new LinkAnnotation(parameters);
  35942. case 'Text':
  35943. return new TextAnnotation(parameters);
  35944. case 'Widget':
  35945. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35946. fieldType = isName(fieldType) ? fieldType.name : null;
  35947. switch (fieldType) {
  35948. case 'Tx':
  35949. return new TextWidgetAnnotation(parameters);
  35950. case 'Btn':
  35951. return new ButtonWidgetAnnotation(parameters);
  35952. case 'Ch':
  35953. return new ChoiceWidgetAnnotation(parameters);
  35954. }
  35955. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35956. return new WidgetAnnotation(parameters);
  35957. case 'Popup':
  35958. return new PopupAnnotation(parameters);
  35959. case 'Highlight':
  35960. return new HighlightAnnotation(parameters);
  35961. case 'Underline':
  35962. return new UnderlineAnnotation(parameters);
  35963. case 'Squiggly':
  35964. return new SquigglyAnnotation(parameters);
  35965. case 'StrikeOut':
  35966. return new StrikeOutAnnotation(parameters);
  35967. case 'FileAttachment':
  35968. return new FileAttachmentAnnotation(parameters);
  35969. default:
  35970. if (!subtype) {
  35971. warn('Annotation is missing the required /Subtype.');
  35972. } else {
  35973. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35974. }
  35975. return new Annotation(parameters);
  35976. }
  35977. }
  35978. };
  35979. var Annotation = function AnnotationClosure() {
  35980. function getTransformMatrix(rect, bbox, matrix) {
  35981. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  35982. var minX = bounds[0];
  35983. var minY = bounds[1];
  35984. var maxX = bounds[2];
  35985. var maxY = bounds[3];
  35986. if (minX === maxX || minY === maxY) {
  35987. return [
  35988. 1,
  35989. 0,
  35990. 0,
  35991. 1,
  35992. rect[0],
  35993. rect[1]
  35994. ];
  35995. }
  35996. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  35997. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  35998. return [
  35999. xRatio,
  36000. 0,
  36001. 0,
  36002. yRatio,
  36003. rect[0] - minX * xRatio,
  36004. rect[1] - minY * yRatio
  36005. ];
  36006. }
  36007. function getDefaultAppearance(dict) {
  36008. var appearanceState = dict.get('AP');
  36009. if (!isDict(appearanceState)) {
  36010. return;
  36011. }
  36012. var appearance;
  36013. var appearances = appearanceState.get('N');
  36014. if (isDict(appearances)) {
  36015. var as = dict.get('AS');
  36016. if (as && appearances.has(as.name)) {
  36017. appearance = appearances.get(as.name);
  36018. }
  36019. } else {
  36020. appearance = appearances;
  36021. }
  36022. return appearance;
  36023. }
  36024. function Annotation(params) {
  36025. var dict = params.dict;
  36026. this.setFlags(dict.get('F'));
  36027. this.setRectangle(dict.getArray('Rect'));
  36028. this.setColor(dict.getArray('C'));
  36029. this.setBorderStyle(dict);
  36030. this.appearance = getDefaultAppearance(dict);
  36031. this.data = {};
  36032. this.data.id = params.id;
  36033. this.data.subtype = params.subtype;
  36034. this.data.annotationFlags = this.flags;
  36035. this.data.rect = this.rectangle;
  36036. this.data.color = this.color;
  36037. this.data.borderStyle = this.borderStyle;
  36038. this.data.hasAppearance = !!this.appearance;
  36039. }
  36040. Annotation.prototype = {
  36041. _hasFlag: function Annotation_hasFlag(flags, flag) {
  36042. return !!(flags & flag);
  36043. },
  36044. _isViewable: function Annotation_isViewable(flags) {
  36045. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  36046. },
  36047. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  36048. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  36049. },
  36050. get viewable() {
  36051. if (this.flags === 0) {
  36052. return true;
  36053. }
  36054. return this._isViewable(this.flags);
  36055. },
  36056. get printable() {
  36057. if (this.flags === 0) {
  36058. return false;
  36059. }
  36060. return this._isPrintable(this.flags);
  36061. },
  36062. setFlags: function Annotation_setFlags(flags) {
  36063. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  36064. },
  36065. hasFlag: function Annotation_hasFlag(flag) {
  36066. return this._hasFlag(this.flags, flag);
  36067. },
  36068. setRectangle: function Annotation_setRectangle(rectangle) {
  36069. if (isArray(rectangle) && rectangle.length === 4) {
  36070. this.rectangle = Util.normalizeRect(rectangle);
  36071. } else {
  36072. this.rectangle = [
  36073. 0,
  36074. 0,
  36075. 0,
  36076. 0
  36077. ];
  36078. }
  36079. },
  36080. setColor: function Annotation_setColor(color) {
  36081. var rgbColor = new Uint8Array(3);
  36082. if (!isArray(color)) {
  36083. this.color = rgbColor;
  36084. return;
  36085. }
  36086. switch (color.length) {
  36087. case 0:
  36088. this.color = null;
  36089. break;
  36090. case 1:
  36091. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  36092. this.color = rgbColor;
  36093. break;
  36094. case 3:
  36095. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  36096. this.color = rgbColor;
  36097. break;
  36098. case 4:
  36099. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  36100. this.color = rgbColor;
  36101. break;
  36102. default:
  36103. this.color = rgbColor;
  36104. break;
  36105. }
  36106. },
  36107. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  36108. this.borderStyle = new AnnotationBorderStyle();
  36109. if (!isDict(borderStyle)) {
  36110. return;
  36111. }
  36112. if (borderStyle.has('BS')) {
  36113. var dict = borderStyle.get('BS');
  36114. var dictType = dict.get('Type');
  36115. if (!dictType || isName(dictType, 'Border')) {
  36116. this.borderStyle.setWidth(dict.get('W'));
  36117. this.borderStyle.setStyle(dict.get('S'));
  36118. this.borderStyle.setDashArray(dict.getArray('D'));
  36119. }
  36120. } else if (borderStyle.has('Border')) {
  36121. var array = borderStyle.getArray('Border');
  36122. if (isArray(array) && array.length >= 3) {
  36123. this.borderStyle.setHorizontalCornerRadius(array[0]);
  36124. this.borderStyle.setVerticalCornerRadius(array[1]);
  36125. this.borderStyle.setWidth(array[2]);
  36126. if (array.length === 4) {
  36127. this.borderStyle.setDashArray(array[3]);
  36128. }
  36129. }
  36130. } else {
  36131. this.borderStyle.setWidth(0);
  36132. }
  36133. },
  36134. _preparePopup: function Annotation_preparePopup(dict) {
  36135. if (!dict.has('C')) {
  36136. this.data.color = null;
  36137. }
  36138. this.data.hasPopup = dict.has('Popup');
  36139. this.data.title = stringToPDFString(dict.get('T') || '');
  36140. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  36141. },
  36142. loadResources: function Annotation_loadResources(keys) {
  36143. return new Promise(function (resolve, reject) {
  36144. this.appearance.dict.getAsync('Resources').then(function (resources) {
  36145. if (!resources) {
  36146. resolve();
  36147. return;
  36148. }
  36149. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  36150. objectLoader.load().then(function () {
  36151. resolve(resources);
  36152. }, reject);
  36153. }, reject);
  36154. }.bind(this));
  36155. },
  36156. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  36157. if (!this.appearance) {
  36158. return Promise.resolve(new OperatorList());
  36159. }
  36160. var data = this.data;
  36161. var appearanceDict = this.appearance.dict;
  36162. var resourcesPromise = this.loadResources([
  36163. 'ExtGState',
  36164. 'ColorSpace',
  36165. 'Pattern',
  36166. 'Shading',
  36167. 'XObject',
  36168. 'Font'
  36169. ]);
  36170. var bbox = appearanceDict.getArray('BBox') || [
  36171. 0,
  36172. 0,
  36173. 1,
  36174. 1
  36175. ];
  36176. var matrix = appearanceDict.getArray('Matrix') || [
  36177. 1,
  36178. 0,
  36179. 0,
  36180. 1,
  36181. 0,
  36182. 0
  36183. ];
  36184. var transform = getTransformMatrix(data.rect, bbox, matrix);
  36185. var self = this;
  36186. return resourcesPromise.then(function (resources) {
  36187. var opList = new OperatorList();
  36188. opList.addOp(OPS.beginAnnotation, [
  36189. data.rect,
  36190. transform,
  36191. matrix
  36192. ]);
  36193. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  36194. opList.addOp(OPS.endAnnotation, []);
  36195. self.appearance.reset();
  36196. return opList;
  36197. });
  36198. });
  36199. }
  36200. };
  36201. Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) {
  36202. var annotationPromises = [];
  36203. for (var i = 0, n = annotations.length; i < n; ++i) {
  36204. if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) {
  36205. annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms));
  36206. }
  36207. }
  36208. return Promise.all(annotationPromises).then(function (operatorLists) {
  36209. opList.addOp(OPS.beginAnnotations, []);
  36210. for (var i = 0, n = operatorLists.length; i < n; ++i) {
  36211. opList.addOpList(operatorLists[i]);
  36212. }
  36213. opList.addOp(OPS.endAnnotations, []);
  36214. });
  36215. };
  36216. return Annotation;
  36217. }();
  36218. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  36219. function AnnotationBorderStyle() {
  36220. this.width = 1;
  36221. this.style = AnnotationBorderStyleType.SOLID;
  36222. this.dashArray = [3];
  36223. this.horizontalCornerRadius = 0;
  36224. this.verticalCornerRadius = 0;
  36225. }
  36226. AnnotationBorderStyle.prototype = {
  36227. setWidth: function AnnotationBorderStyle_setWidth(width) {
  36228. if (width === (width | 0)) {
  36229. this.width = width;
  36230. }
  36231. },
  36232. setStyle: function AnnotationBorderStyle_setStyle(style) {
  36233. if (!style) {
  36234. return;
  36235. }
  36236. switch (style.name) {
  36237. case 'S':
  36238. this.style = AnnotationBorderStyleType.SOLID;
  36239. break;
  36240. case 'D':
  36241. this.style = AnnotationBorderStyleType.DASHED;
  36242. break;
  36243. case 'B':
  36244. this.style = AnnotationBorderStyleType.BEVELED;
  36245. break;
  36246. case 'I':
  36247. this.style = AnnotationBorderStyleType.INSET;
  36248. break;
  36249. case 'U':
  36250. this.style = AnnotationBorderStyleType.UNDERLINE;
  36251. break;
  36252. default:
  36253. break;
  36254. }
  36255. },
  36256. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  36257. if (isArray(dashArray) && dashArray.length > 0) {
  36258. var isValid = true;
  36259. var allZeros = true;
  36260. for (var i = 0, len = dashArray.length; i < len; i++) {
  36261. var element = dashArray[i];
  36262. var validNumber = +element >= 0;
  36263. if (!validNumber) {
  36264. isValid = false;
  36265. break;
  36266. } else if (element > 0) {
  36267. allZeros = false;
  36268. }
  36269. }
  36270. if (isValid && !allZeros) {
  36271. this.dashArray = dashArray;
  36272. } else {
  36273. this.width = 0;
  36274. }
  36275. } else if (dashArray) {
  36276. this.width = 0;
  36277. }
  36278. },
  36279. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  36280. if (radius === (radius | 0)) {
  36281. this.horizontalCornerRadius = radius;
  36282. }
  36283. },
  36284. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  36285. if (radius === (radius | 0)) {
  36286. this.verticalCornerRadius = radius;
  36287. }
  36288. }
  36289. };
  36290. return AnnotationBorderStyle;
  36291. }();
  36292. var WidgetAnnotation = function WidgetAnnotationClosure() {
  36293. function WidgetAnnotation(params) {
  36294. Annotation.call(this, params);
  36295. var dict = params.dict;
  36296. var data = this.data;
  36297. data.annotationType = AnnotationType.WIDGET;
  36298. data.fieldName = this._constructFieldName(dict);
  36299. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  36300. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  36301. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  36302. var fieldType = Util.getInheritableProperty(dict, 'FT');
  36303. data.fieldType = isName(fieldType) ? fieldType.name : null;
  36304. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  36305. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  36306. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  36307. data.fieldFlags = 0;
  36308. }
  36309. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  36310. if (data.fieldType === 'Sig') {
  36311. this.setFlags(AnnotationFlag.HIDDEN);
  36312. }
  36313. }
  36314. Util.inherit(WidgetAnnotation, Annotation, {
  36315. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  36316. if (!dict.has('T') && !dict.has('Parent')) {
  36317. warn('Unknown field name, falling back to empty field name.');
  36318. return '';
  36319. }
  36320. if (!dict.has('Parent')) {
  36321. return stringToPDFString(dict.get('T'));
  36322. }
  36323. var fieldName = [];
  36324. if (dict.has('T')) {
  36325. fieldName.unshift(stringToPDFString(dict.get('T')));
  36326. }
  36327. var loopDict = dict;
  36328. while (loopDict.has('Parent')) {
  36329. loopDict = loopDict.get('Parent');
  36330. if (loopDict.has('T')) {
  36331. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  36332. }
  36333. }
  36334. return fieldName.join('.');
  36335. },
  36336. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  36337. return !!(this.data.fieldFlags & flag);
  36338. }
  36339. });
  36340. return WidgetAnnotation;
  36341. }();
  36342. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  36343. function TextWidgetAnnotation(params) {
  36344. WidgetAnnotation.call(this, params);
  36345. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  36346. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  36347. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  36348. alignment = null;
  36349. }
  36350. this.data.textAlignment = alignment;
  36351. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  36352. if (!isInt(maximumLength) || maximumLength < 0) {
  36353. maximumLength = null;
  36354. }
  36355. this.data.maxLen = maximumLength;
  36356. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  36357. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  36358. }
  36359. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  36360. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36361. var operatorList = new OperatorList();
  36362. if (renderForms) {
  36363. return Promise.resolve(operatorList);
  36364. }
  36365. if (this.appearance) {
  36366. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36367. }
  36368. if (!this.data.defaultAppearance) {
  36369. return Promise.resolve(operatorList);
  36370. }
  36371. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  36372. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  36373. return operatorList;
  36374. });
  36375. }
  36376. });
  36377. return TextWidgetAnnotation;
  36378. }();
  36379. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  36380. function ButtonWidgetAnnotation(params) {
  36381. WidgetAnnotation.call(this, params);
  36382. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36383. if (this.data.checkBox) {
  36384. if (!isName(this.data.fieldValue)) {
  36385. return;
  36386. }
  36387. this.data.fieldValue = this.data.fieldValue.name;
  36388. }
  36389. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36390. if (this.data.radioButton) {
  36391. this.data.fieldValue = this.data.buttonValue = null;
  36392. var fieldParent = params.dict.get('Parent');
  36393. if (isDict(fieldParent) && fieldParent.has('V')) {
  36394. var fieldParentValue = fieldParent.get('V');
  36395. if (isName(fieldParentValue)) {
  36396. this.data.fieldValue = fieldParentValue.name;
  36397. }
  36398. }
  36399. var appearanceStates = params.dict.get('AP');
  36400. if (!isDict(appearanceStates)) {
  36401. return;
  36402. }
  36403. var normalAppearanceState = appearanceStates.get('N');
  36404. if (!isDict(normalAppearanceState)) {
  36405. return;
  36406. }
  36407. var keys = normalAppearanceState.getKeys();
  36408. for (var i = 0, ii = keys.length; i < ii; i++) {
  36409. if (keys[i] !== 'Off') {
  36410. this.data.buttonValue = keys[i];
  36411. break;
  36412. }
  36413. }
  36414. }
  36415. }
  36416. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  36417. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36418. var operatorList = new OperatorList();
  36419. if (renderForms) {
  36420. return Promise.resolve(operatorList);
  36421. }
  36422. if (this.appearance) {
  36423. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36424. }
  36425. return Promise.resolve(operatorList);
  36426. }
  36427. });
  36428. return ButtonWidgetAnnotation;
  36429. }();
  36430. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  36431. function ChoiceWidgetAnnotation(params) {
  36432. WidgetAnnotation.call(this, params);
  36433. this.data.options = [];
  36434. var options = params.dict.get('Opt');
  36435. if (isArray(options)) {
  36436. var xref = params.xref;
  36437. for (var i = 0, ii = options.length; i < ii; i++) {
  36438. var option = xref.fetchIfRef(options[i]);
  36439. var isOptionArray = isArray(option);
  36440. this.data.options[i] = {
  36441. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  36442. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  36443. };
  36444. }
  36445. }
  36446. if (!isArray(this.data.fieldValue)) {
  36447. this.data.fieldValue = [this.data.fieldValue];
  36448. }
  36449. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  36450. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  36451. }
  36452. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  36453. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36454. var operatorList = new OperatorList();
  36455. if (renderForms) {
  36456. return Promise.resolve(operatorList);
  36457. }
  36458. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36459. }
  36460. });
  36461. return ChoiceWidgetAnnotation;
  36462. }();
  36463. var TextAnnotation = function TextAnnotationClosure() {
  36464. var DEFAULT_ICON_SIZE = 22;
  36465. function TextAnnotation(parameters) {
  36466. Annotation.call(this, parameters);
  36467. this.data.annotationType = AnnotationType.TEXT;
  36468. if (this.data.hasAppearance) {
  36469. this.data.name = 'NoIcon';
  36470. } else {
  36471. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  36472. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  36473. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  36474. }
  36475. this._preparePopup(parameters.dict);
  36476. }
  36477. Util.inherit(TextAnnotation, Annotation, {});
  36478. return TextAnnotation;
  36479. }();
  36480. var LinkAnnotation = function LinkAnnotationClosure() {
  36481. function LinkAnnotation(params) {
  36482. Annotation.call(this, params);
  36483. var data = this.data;
  36484. data.annotationType = AnnotationType.LINK;
  36485. Catalog.parseDestDictionary({
  36486. destDict: params.dict,
  36487. resultObj: data,
  36488. docBaseUrl: params.pdfManager.docBaseUrl
  36489. });
  36490. }
  36491. Util.inherit(LinkAnnotation, Annotation, {});
  36492. return LinkAnnotation;
  36493. }();
  36494. var PopupAnnotation = function PopupAnnotationClosure() {
  36495. function PopupAnnotation(parameters) {
  36496. Annotation.call(this, parameters);
  36497. this.data.annotationType = AnnotationType.POPUP;
  36498. var dict = parameters.dict;
  36499. var parentItem = dict.get('Parent');
  36500. if (!parentItem) {
  36501. warn('Popup annotation has a missing or invalid parent annotation.');
  36502. return;
  36503. }
  36504. this.data.parentId = dict.getRaw('Parent').toString();
  36505. this.data.title = stringToPDFString(parentItem.get('T') || '');
  36506. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  36507. if (!parentItem.has('C')) {
  36508. this.data.color = null;
  36509. } else {
  36510. this.setColor(parentItem.getArray('C'));
  36511. this.data.color = this.color;
  36512. }
  36513. if (!this.viewable) {
  36514. var parentFlags = parentItem.get('F');
  36515. if (this._isViewable(parentFlags)) {
  36516. this.setFlags(parentFlags);
  36517. }
  36518. }
  36519. }
  36520. Util.inherit(PopupAnnotation, Annotation, {});
  36521. return PopupAnnotation;
  36522. }();
  36523. var HighlightAnnotation = function HighlightAnnotationClosure() {
  36524. function HighlightAnnotation(parameters) {
  36525. Annotation.call(this, parameters);
  36526. this.data.annotationType = AnnotationType.HIGHLIGHT;
  36527. this._preparePopup(parameters.dict);
  36528. this.data.borderStyle.setWidth(0);
  36529. }
  36530. Util.inherit(HighlightAnnotation, Annotation, {});
  36531. return HighlightAnnotation;
  36532. }();
  36533. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  36534. function UnderlineAnnotation(parameters) {
  36535. Annotation.call(this, parameters);
  36536. this.data.annotationType = AnnotationType.UNDERLINE;
  36537. this._preparePopup(parameters.dict);
  36538. this.data.borderStyle.setWidth(0);
  36539. }
  36540. Util.inherit(UnderlineAnnotation, Annotation, {});
  36541. return UnderlineAnnotation;
  36542. }();
  36543. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  36544. function SquigglyAnnotation(parameters) {
  36545. Annotation.call(this, parameters);
  36546. this.data.annotationType = AnnotationType.SQUIGGLY;
  36547. this._preparePopup(parameters.dict);
  36548. this.data.borderStyle.setWidth(0);
  36549. }
  36550. Util.inherit(SquigglyAnnotation, Annotation, {});
  36551. return SquigglyAnnotation;
  36552. }();
  36553. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  36554. function StrikeOutAnnotation(parameters) {
  36555. Annotation.call(this, parameters);
  36556. this.data.annotationType = AnnotationType.STRIKEOUT;
  36557. this._preparePopup(parameters.dict);
  36558. this.data.borderStyle.setWidth(0);
  36559. }
  36560. Util.inherit(StrikeOutAnnotation, Annotation, {});
  36561. return StrikeOutAnnotation;
  36562. }();
  36563. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  36564. function FileAttachmentAnnotation(parameters) {
  36565. Annotation.call(this, parameters);
  36566. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  36567. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  36568. this.data.file = file.serializable;
  36569. this._preparePopup(parameters.dict);
  36570. }
  36571. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  36572. return FileAttachmentAnnotation;
  36573. }();
  36574. exports.Annotation = Annotation;
  36575. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  36576. exports.AnnotationFactory = AnnotationFactory;
  36577. /***/ }),
  36578. /* 21 */
  36579. /***/ (function(module, exports, __w_pdfjs_require__) {
  36580. "use strict";
  36581. var sharedUtil = __w_pdfjs_require__(0);
  36582. var warn = sharedUtil.warn;
  36583. var baseTypes = [
  36584. 'BN',
  36585. 'BN',
  36586. 'BN',
  36587. 'BN',
  36588. 'BN',
  36589. 'BN',
  36590. 'BN',
  36591. 'BN',
  36592. 'BN',
  36593. 'S',
  36594. 'B',
  36595. 'S',
  36596. 'WS',
  36597. 'B',
  36598. 'BN',
  36599. 'BN',
  36600. 'BN',
  36601. 'BN',
  36602. 'BN',
  36603. 'BN',
  36604. 'BN',
  36605. 'BN',
  36606. 'BN',
  36607. 'BN',
  36608. 'BN',
  36609. 'BN',
  36610. 'BN',
  36611. 'BN',
  36612. 'B',
  36613. 'B',
  36614. 'B',
  36615. 'S',
  36616. 'WS',
  36617. 'ON',
  36618. 'ON',
  36619. 'ET',
  36620. 'ET',
  36621. 'ET',
  36622. 'ON',
  36623. 'ON',
  36624. 'ON',
  36625. 'ON',
  36626. 'ON',
  36627. 'ES',
  36628. 'CS',
  36629. 'ES',
  36630. 'CS',
  36631. 'CS',
  36632. 'EN',
  36633. 'EN',
  36634. 'EN',
  36635. 'EN',
  36636. 'EN',
  36637. 'EN',
  36638. 'EN',
  36639. 'EN',
  36640. 'EN',
  36641. 'EN',
  36642. 'CS',
  36643. 'ON',
  36644. 'ON',
  36645. 'ON',
  36646. 'ON',
  36647. 'ON',
  36648. 'ON',
  36649. 'L',
  36650. 'L',
  36651. 'L',
  36652. 'L',
  36653. 'L',
  36654. 'L',
  36655. 'L',
  36656. 'L',
  36657. 'L',
  36658. 'L',
  36659. 'L',
  36660. 'L',
  36661. 'L',
  36662. 'L',
  36663. 'L',
  36664. 'L',
  36665. 'L',
  36666. 'L',
  36667. 'L',
  36668. 'L',
  36669. 'L',
  36670. 'L',
  36671. 'L',
  36672. 'L',
  36673. 'L',
  36674. 'L',
  36675. 'ON',
  36676. 'ON',
  36677. 'ON',
  36678. 'ON',
  36679. 'ON',
  36680. 'ON',
  36681. 'L',
  36682. 'L',
  36683. 'L',
  36684. 'L',
  36685. 'L',
  36686. 'L',
  36687. 'L',
  36688. 'L',
  36689. 'L',
  36690. 'L',
  36691. 'L',
  36692. 'L',
  36693. 'L',
  36694. 'L',
  36695. 'L',
  36696. 'L',
  36697. 'L',
  36698. 'L',
  36699. 'L',
  36700. 'L',
  36701. 'L',
  36702. 'L',
  36703. 'L',
  36704. 'L',
  36705. 'L',
  36706. 'L',
  36707. 'ON',
  36708. 'ON',
  36709. 'ON',
  36710. 'ON',
  36711. 'BN',
  36712. 'BN',
  36713. 'BN',
  36714. 'BN',
  36715. 'BN',
  36716. 'BN',
  36717. 'B',
  36718. 'BN',
  36719. 'BN',
  36720. 'BN',
  36721. 'BN',
  36722. 'BN',
  36723. 'BN',
  36724. 'BN',
  36725. 'BN',
  36726. 'BN',
  36727. 'BN',
  36728. 'BN',
  36729. 'BN',
  36730. 'BN',
  36731. 'BN',
  36732. 'BN',
  36733. 'BN',
  36734. 'BN',
  36735. 'BN',
  36736. 'BN',
  36737. 'BN',
  36738. 'BN',
  36739. 'BN',
  36740. 'BN',
  36741. 'BN',
  36742. 'BN',
  36743. 'BN',
  36744. 'CS',
  36745. 'ON',
  36746. 'ET',
  36747. 'ET',
  36748. 'ET',
  36749. 'ET',
  36750. 'ON',
  36751. 'ON',
  36752. 'ON',
  36753. 'ON',
  36754. 'L',
  36755. 'ON',
  36756. 'ON',
  36757. 'BN',
  36758. 'ON',
  36759. 'ON',
  36760. 'ET',
  36761. 'ET',
  36762. 'EN',
  36763. 'EN',
  36764. 'ON',
  36765. 'L',
  36766. 'ON',
  36767. 'ON',
  36768. 'ON',
  36769. 'EN',
  36770. 'L',
  36771. 'ON',
  36772. 'ON',
  36773. 'ON',
  36774. 'ON',
  36775. 'ON',
  36776. 'L',
  36777. 'L',
  36778. 'L',
  36779. 'L',
  36780. 'L',
  36781. 'L',
  36782. 'L',
  36783. 'L',
  36784. 'L',
  36785. 'L',
  36786. 'L',
  36787. 'L',
  36788. 'L',
  36789. 'L',
  36790. 'L',
  36791. 'L',
  36792. 'L',
  36793. 'L',
  36794. 'L',
  36795. 'L',
  36796. 'L',
  36797. 'L',
  36798. 'L',
  36799. 'ON',
  36800. 'L',
  36801. 'L',
  36802. 'L',
  36803. 'L',
  36804. 'L',
  36805. 'L',
  36806. 'L',
  36807. 'L',
  36808. 'L',
  36809. 'L',
  36810. 'L',
  36811. 'L',
  36812. 'L',
  36813. 'L',
  36814. 'L',
  36815. 'L',
  36816. 'L',
  36817. 'L',
  36818. 'L',
  36819. 'L',
  36820. 'L',
  36821. 'L',
  36822. 'L',
  36823. 'L',
  36824. 'L',
  36825. 'L',
  36826. 'L',
  36827. 'L',
  36828. 'L',
  36829. 'L',
  36830. 'L',
  36831. 'ON',
  36832. 'L',
  36833. 'L',
  36834. 'L',
  36835. 'L',
  36836. 'L',
  36837. 'L',
  36838. 'L',
  36839. 'L'
  36840. ];
  36841. var arabicTypes = [
  36842. 'AN',
  36843. 'AN',
  36844. 'AN',
  36845. 'AN',
  36846. 'AN',
  36847. 'AN',
  36848. 'ON',
  36849. 'ON',
  36850. 'AL',
  36851. 'ET',
  36852. 'ET',
  36853. 'AL',
  36854. 'CS',
  36855. 'AL',
  36856. 'ON',
  36857. 'ON',
  36858. 'NSM',
  36859. 'NSM',
  36860. 'NSM',
  36861. 'NSM',
  36862. 'NSM',
  36863. 'NSM',
  36864. 'NSM',
  36865. 'NSM',
  36866. 'NSM',
  36867. 'NSM',
  36868. 'NSM',
  36869. 'AL',
  36870. 'AL',
  36871. '',
  36872. 'AL',
  36873. 'AL',
  36874. 'AL',
  36875. 'AL',
  36876. 'AL',
  36877. 'AL',
  36878. 'AL',
  36879. 'AL',
  36880. 'AL',
  36881. 'AL',
  36882. 'AL',
  36883. 'AL',
  36884. 'AL',
  36885. 'AL',
  36886. 'AL',
  36887. 'AL',
  36888. 'AL',
  36889. 'AL',
  36890. 'AL',
  36891. 'AL',
  36892. 'AL',
  36893. 'AL',
  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. 'NSM',
  36918. 'NSM',
  36919. 'NSM',
  36920. 'NSM',
  36921. 'NSM',
  36922. 'NSM',
  36923. 'NSM',
  36924. 'NSM',
  36925. 'NSM',
  36926. 'NSM',
  36927. 'NSM',
  36928. 'NSM',
  36929. 'NSM',
  36930. 'NSM',
  36931. 'NSM',
  36932. 'NSM',
  36933. 'NSM',
  36934. 'NSM',
  36935. 'NSM',
  36936. 'NSM',
  36937. 'NSM',
  36938. 'AN',
  36939. 'AN',
  36940. 'AN',
  36941. 'AN',
  36942. 'AN',
  36943. 'AN',
  36944. 'AN',
  36945. 'AN',
  36946. 'AN',
  36947. 'AN',
  36948. 'ET',
  36949. 'AN',
  36950. 'AN',
  36951. 'AL',
  36952. 'AL',
  36953. 'AL',
  36954. 'NSM',
  36955. 'AL',
  36956. 'AL',
  36957. 'AL',
  36958. 'AL',
  36959. 'AL',
  36960. 'AL',
  36961. 'AL',
  36962. 'AL',
  36963. 'AL',
  36964. 'AL',
  36965. 'AL',
  36966. 'AL',
  36967. 'AL',
  36968. 'AL',
  36969. 'AL',
  36970. 'AL',
  36971. 'AL',
  36972. 'AL',
  36973. 'AL',
  36974. 'AL',
  36975. 'AL',
  36976. 'AL',
  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. 'NSM',
  37057. 'NSM',
  37058. 'NSM',
  37059. 'NSM',
  37060. 'NSM',
  37061. 'NSM',
  37062. 'NSM',
  37063. 'AN',
  37064. 'ON',
  37065. 'NSM',
  37066. 'NSM',
  37067. 'NSM',
  37068. 'NSM',
  37069. 'NSM',
  37070. 'NSM',
  37071. 'AL',
  37072. 'AL',
  37073. 'NSM',
  37074. 'NSM',
  37075. 'ON',
  37076. 'NSM',
  37077. 'NSM',
  37078. 'NSM',
  37079. 'NSM',
  37080. 'AL',
  37081. 'AL',
  37082. 'EN',
  37083. 'EN',
  37084. 'EN',
  37085. 'EN',
  37086. 'EN',
  37087. 'EN',
  37088. 'EN',
  37089. 'EN',
  37090. 'EN',
  37091. 'EN',
  37092. 'AL',
  37093. 'AL',
  37094. 'AL',
  37095. 'AL',
  37096. 'AL',
  37097. 'AL'
  37098. ];
  37099. function isOdd(i) {
  37100. return (i & 1) !== 0;
  37101. }
  37102. function isEven(i) {
  37103. return (i & 1) === 0;
  37104. }
  37105. function findUnequal(arr, start, value) {
  37106. for (var j = start, jj = arr.length; j < jj; ++j) {
  37107. if (arr[j] !== value) {
  37108. return j;
  37109. }
  37110. }
  37111. return j;
  37112. }
  37113. function setValues(arr, start, end, value) {
  37114. for (var j = start; j < end; ++j) {
  37115. arr[j] = value;
  37116. }
  37117. }
  37118. function reverseValues(arr, start, end) {
  37119. for (var i = start, j = end - 1; i < j; ++i, --j) {
  37120. var temp = arr[i];
  37121. arr[i] = arr[j];
  37122. arr[j] = temp;
  37123. }
  37124. }
  37125. function createBidiText(str, isLTR, vertical) {
  37126. return {
  37127. str: str,
  37128. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  37129. };
  37130. }
  37131. var chars = [];
  37132. var types = [];
  37133. function bidi(str, startLevel, vertical) {
  37134. var isLTR = true;
  37135. var strLength = str.length;
  37136. if (strLength === 0 || vertical) {
  37137. return createBidiText(str, isLTR, vertical);
  37138. }
  37139. chars.length = strLength;
  37140. types.length = strLength;
  37141. var numBidi = 0;
  37142. var i, ii;
  37143. for (i = 0; i < strLength; ++i) {
  37144. chars[i] = str.charAt(i);
  37145. var charCode = str.charCodeAt(i);
  37146. var charType = 'L';
  37147. if (charCode <= 0x00ff) {
  37148. charType = baseTypes[charCode];
  37149. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  37150. charType = 'R';
  37151. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  37152. charType = arabicTypes[charCode & 0xff];
  37153. if (!charType) {
  37154. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  37155. }
  37156. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  37157. charType = 'AL';
  37158. }
  37159. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  37160. numBidi++;
  37161. }
  37162. types[i] = charType;
  37163. }
  37164. if (numBidi === 0) {
  37165. isLTR = true;
  37166. return createBidiText(str, isLTR);
  37167. }
  37168. if (startLevel === -1) {
  37169. if (numBidi / strLength < 0.3) {
  37170. isLTR = true;
  37171. startLevel = 0;
  37172. } else {
  37173. isLTR = false;
  37174. startLevel = 1;
  37175. }
  37176. }
  37177. var levels = [];
  37178. for (i = 0; i < strLength; ++i) {
  37179. levels[i] = startLevel;
  37180. }
  37181. var e = isOdd(startLevel) ? 'R' : 'L';
  37182. var sor = e;
  37183. var eor = sor;
  37184. var lastType = sor;
  37185. for (i = 0; i < strLength; ++i) {
  37186. if (types[i] === 'NSM') {
  37187. types[i] = lastType;
  37188. } else {
  37189. lastType = types[i];
  37190. }
  37191. }
  37192. lastType = sor;
  37193. var t;
  37194. for (i = 0; i < strLength; ++i) {
  37195. t = types[i];
  37196. if (t === 'EN') {
  37197. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  37198. } else if (t === 'R' || t === 'L' || t === 'AL') {
  37199. lastType = t;
  37200. }
  37201. }
  37202. for (i = 0; i < strLength; ++i) {
  37203. t = types[i];
  37204. if (t === 'AL') {
  37205. types[i] = 'R';
  37206. }
  37207. }
  37208. for (i = 1; i < strLength - 1; ++i) {
  37209. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  37210. types[i] = 'EN';
  37211. }
  37212. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  37213. types[i] = types[i - 1];
  37214. }
  37215. }
  37216. for (i = 0; i < strLength; ++i) {
  37217. if (types[i] === 'EN') {
  37218. var j;
  37219. for (j = i - 1; j >= 0; --j) {
  37220. if (types[j] !== 'ET') {
  37221. break;
  37222. }
  37223. types[j] = 'EN';
  37224. }
  37225. for (j = i + 1; j < strLength; ++j) {
  37226. if (types[j] !== 'ET') {
  37227. break;
  37228. }
  37229. types[j] = 'EN';
  37230. }
  37231. }
  37232. }
  37233. for (i = 0; i < strLength; ++i) {
  37234. t = types[i];
  37235. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  37236. types[i] = 'ON';
  37237. }
  37238. }
  37239. lastType = sor;
  37240. for (i = 0; i < strLength; ++i) {
  37241. t = types[i];
  37242. if (t === 'EN') {
  37243. types[i] = lastType === 'L' ? 'L' : 'EN';
  37244. } else if (t === 'R' || t === 'L') {
  37245. lastType = t;
  37246. }
  37247. }
  37248. for (i = 0; i < strLength; ++i) {
  37249. if (types[i] === 'ON') {
  37250. var end = findUnequal(types, i + 1, 'ON');
  37251. var before = sor;
  37252. if (i > 0) {
  37253. before = types[i - 1];
  37254. }
  37255. var after = eor;
  37256. if (end + 1 < strLength) {
  37257. after = types[end + 1];
  37258. }
  37259. if (before !== 'L') {
  37260. before = 'R';
  37261. }
  37262. if (after !== 'L') {
  37263. after = 'R';
  37264. }
  37265. if (before === after) {
  37266. setValues(types, i, end, before);
  37267. }
  37268. i = end - 1;
  37269. }
  37270. }
  37271. for (i = 0; i < strLength; ++i) {
  37272. if (types[i] === 'ON') {
  37273. types[i] = e;
  37274. }
  37275. }
  37276. for (i = 0; i < strLength; ++i) {
  37277. t = types[i];
  37278. if (isEven(levels[i])) {
  37279. if (t === 'R') {
  37280. levels[i] += 1;
  37281. } else if (t === 'AN' || t === 'EN') {
  37282. levels[i] += 2;
  37283. }
  37284. } else {
  37285. if (t === 'L' || t === 'AN' || t === 'EN') {
  37286. levels[i] += 1;
  37287. }
  37288. }
  37289. }
  37290. var highestLevel = -1;
  37291. var lowestOddLevel = 99;
  37292. var level;
  37293. for (i = 0, ii = levels.length; i < ii; ++i) {
  37294. level = levels[i];
  37295. if (highestLevel < level) {
  37296. highestLevel = level;
  37297. }
  37298. if (lowestOddLevel > level && isOdd(level)) {
  37299. lowestOddLevel = level;
  37300. }
  37301. }
  37302. for (level = highestLevel; level >= lowestOddLevel; --level) {
  37303. var start = -1;
  37304. for (i = 0, ii = levels.length; i < ii; ++i) {
  37305. if (levels[i] < level) {
  37306. if (start >= 0) {
  37307. reverseValues(chars, start, i);
  37308. start = -1;
  37309. }
  37310. } else if (start < 0) {
  37311. start = i;
  37312. }
  37313. }
  37314. if (start >= 0) {
  37315. reverseValues(chars, start, levels.length);
  37316. }
  37317. }
  37318. for (i = 0, ii = chars.length; i < ii; ++i) {
  37319. var ch = chars[i];
  37320. if (ch === '<' || ch === '>') {
  37321. chars[i] = '';
  37322. }
  37323. }
  37324. return createBidiText(chars.join(''), isLTR);
  37325. }
  37326. exports.bidi = bidi;
  37327. /***/ }),
  37328. /* 22 */
  37329. /***/ (function(module, exports, __w_pdfjs_require__) {
  37330. "use strict";
  37331. var ISOAdobeCharset = [
  37332. '.notdef',
  37333. 'space',
  37334. 'exclam',
  37335. 'quotedbl',
  37336. 'numbersign',
  37337. 'dollar',
  37338. 'percent',
  37339. 'ampersand',
  37340. 'quoteright',
  37341. 'parenleft',
  37342. 'parenright',
  37343. 'asterisk',
  37344. 'plus',
  37345. 'comma',
  37346. 'hyphen',
  37347. 'period',
  37348. 'slash',
  37349. 'zero',
  37350. 'one',
  37351. 'two',
  37352. 'three',
  37353. 'four',
  37354. 'five',
  37355. 'six',
  37356. 'seven',
  37357. 'eight',
  37358. 'nine',
  37359. 'colon',
  37360. 'semicolon',
  37361. 'less',
  37362. 'equal',
  37363. 'greater',
  37364. 'question',
  37365. 'at',
  37366. 'A',
  37367. 'B',
  37368. 'C',
  37369. 'D',
  37370. 'E',
  37371. 'F',
  37372. 'G',
  37373. 'H',
  37374. 'I',
  37375. 'J',
  37376. 'K',
  37377. 'L',
  37378. 'M',
  37379. 'N',
  37380. 'O',
  37381. 'P',
  37382. 'Q',
  37383. 'R',
  37384. 'S',
  37385. 'T',
  37386. 'U',
  37387. 'V',
  37388. 'W',
  37389. 'X',
  37390. 'Y',
  37391. 'Z',
  37392. 'bracketleft',
  37393. 'backslash',
  37394. 'bracketright',
  37395. 'asciicircum',
  37396. 'underscore',
  37397. 'quoteleft',
  37398. 'a',
  37399. 'b',
  37400. 'c',
  37401. 'd',
  37402. 'e',
  37403. 'f',
  37404. 'g',
  37405. 'h',
  37406. 'i',
  37407. 'j',
  37408. 'k',
  37409. 'l',
  37410. 'm',
  37411. 'n',
  37412. 'o',
  37413. 'p',
  37414. 'q',
  37415. 'r',
  37416. 's',
  37417. 't',
  37418. 'u',
  37419. 'v',
  37420. 'w',
  37421. 'x',
  37422. 'y',
  37423. 'z',
  37424. 'braceleft',
  37425. 'bar',
  37426. 'braceright',
  37427. 'asciitilde',
  37428. 'exclamdown',
  37429. 'cent',
  37430. 'sterling',
  37431. 'fraction',
  37432. 'yen',
  37433. 'florin',
  37434. 'section',
  37435. 'currency',
  37436. 'quotesingle',
  37437. 'quotedblleft',
  37438. 'guillemotleft',
  37439. 'guilsinglleft',
  37440. 'guilsinglright',
  37441. 'fi',
  37442. 'fl',
  37443. 'endash',
  37444. 'dagger',
  37445. 'daggerdbl',
  37446. 'periodcentered',
  37447. 'paragraph',
  37448. 'bullet',
  37449. 'quotesinglbase',
  37450. 'quotedblbase',
  37451. 'quotedblright',
  37452. 'guillemotright',
  37453. 'ellipsis',
  37454. 'perthousand',
  37455. 'questiondown',
  37456. 'grave',
  37457. 'acute',
  37458. 'circumflex',
  37459. 'tilde',
  37460. 'macron',
  37461. 'breve',
  37462. 'dotaccent',
  37463. 'dieresis',
  37464. 'ring',
  37465. 'cedilla',
  37466. 'hungarumlaut',
  37467. 'ogonek',
  37468. 'caron',
  37469. 'emdash',
  37470. 'AE',
  37471. 'ordfeminine',
  37472. 'Lslash',
  37473. 'Oslash',
  37474. 'OE',
  37475. 'ordmasculine',
  37476. 'ae',
  37477. 'dotlessi',
  37478. 'lslash',
  37479. 'oslash',
  37480. 'oe',
  37481. 'germandbls',
  37482. 'onesuperior',
  37483. 'logicalnot',
  37484. 'mu',
  37485. 'trademark',
  37486. 'Eth',
  37487. 'onehalf',
  37488. 'plusminus',
  37489. 'Thorn',
  37490. 'onequarter',
  37491. 'divide',
  37492. 'brokenbar',
  37493. 'degree',
  37494. 'thorn',
  37495. 'threequarters',
  37496. 'twosuperior',
  37497. 'registered',
  37498. 'minus',
  37499. 'eth',
  37500. 'multiply',
  37501. 'threesuperior',
  37502. 'copyright',
  37503. 'Aacute',
  37504. 'Acircumflex',
  37505. 'Adieresis',
  37506. 'Agrave',
  37507. 'Aring',
  37508. 'Atilde',
  37509. 'Ccedilla',
  37510. 'Eacute',
  37511. 'Ecircumflex',
  37512. 'Edieresis',
  37513. 'Egrave',
  37514. 'Iacute',
  37515. 'Icircumflex',
  37516. 'Idieresis',
  37517. 'Igrave',
  37518. 'Ntilde',
  37519. 'Oacute',
  37520. 'Ocircumflex',
  37521. 'Odieresis',
  37522. 'Ograve',
  37523. 'Otilde',
  37524. 'Scaron',
  37525. 'Uacute',
  37526. 'Ucircumflex',
  37527. 'Udieresis',
  37528. 'Ugrave',
  37529. 'Yacute',
  37530. 'Ydieresis',
  37531. 'Zcaron',
  37532. 'aacute',
  37533. 'acircumflex',
  37534. 'adieresis',
  37535. 'agrave',
  37536. 'aring',
  37537. 'atilde',
  37538. 'ccedilla',
  37539. 'eacute',
  37540. 'ecircumflex',
  37541. 'edieresis',
  37542. 'egrave',
  37543. 'iacute',
  37544. 'icircumflex',
  37545. 'idieresis',
  37546. 'igrave',
  37547. 'ntilde',
  37548. 'oacute',
  37549. 'ocircumflex',
  37550. 'odieresis',
  37551. 'ograve',
  37552. 'otilde',
  37553. 'scaron',
  37554. 'uacute',
  37555. 'ucircumflex',
  37556. 'udieresis',
  37557. 'ugrave',
  37558. 'yacute',
  37559. 'ydieresis',
  37560. 'zcaron'
  37561. ];
  37562. var ExpertCharset = [
  37563. '.notdef',
  37564. 'space',
  37565. 'exclamsmall',
  37566. 'Hungarumlautsmall',
  37567. 'dollaroldstyle',
  37568. 'dollarsuperior',
  37569. 'ampersandsmall',
  37570. 'Acutesmall',
  37571. 'parenleftsuperior',
  37572. 'parenrightsuperior',
  37573. 'twodotenleader',
  37574. 'onedotenleader',
  37575. 'comma',
  37576. 'hyphen',
  37577. 'period',
  37578. 'fraction',
  37579. 'zerooldstyle',
  37580. 'oneoldstyle',
  37581. 'twooldstyle',
  37582. 'threeoldstyle',
  37583. 'fouroldstyle',
  37584. 'fiveoldstyle',
  37585. 'sixoldstyle',
  37586. 'sevenoldstyle',
  37587. 'eightoldstyle',
  37588. 'nineoldstyle',
  37589. 'colon',
  37590. 'semicolon',
  37591. 'commasuperior',
  37592. 'threequartersemdash',
  37593. 'periodsuperior',
  37594. 'questionsmall',
  37595. 'asuperior',
  37596. 'bsuperior',
  37597. 'centsuperior',
  37598. 'dsuperior',
  37599. 'esuperior',
  37600. 'isuperior',
  37601. 'lsuperior',
  37602. 'msuperior',
  37603. 'nsuperior',
  37604. 'osuperior',
  37605. 'rsuperior',
  37606. 'ssuperior',
  37607. 'tsuperior',
  37608. 'ff',
  37609. 'fi',
  37610. 'fl',
  37611. 'ffi',
  37612. 'ffl',
  37613. 'parenleftinferior',
  37614. 'parenrightinferior',
  37615. 'Circumflexsmall',
  37616. 'hyphensuperior',
  37617. 'Gravesmall',
  37618. 'Asmall',
  37619. 'Bsmall',
  37620. 'Csmall',
  37621. 'Dsmall',
  37622. 'Esmall',
  37623. 'Fsmall',
  37624. 'Gsmall',
  37625. 'Hsmall',
  37626. 'Ismall',
  37627. 'Jsmall',
  37628. 'Ksmall',
  37629. 'Lsmall',
  37630. 'Msmall',
  37631. 'Nsmall',
  37632. 'Osmall',
  37633. 'Psmall',
  37634. 'Qsmall',
  37635. 'Rsmall',
  37636. 'Ssmall',
  37637. 'Tsmall',
  37638. 'Usmall',
  37639. 'Vsmall',
  37640. 'Wsmall',
  37641. 'Xsmall',
  37642. 'Ysmall',
  37643. 'Zsmall',
  37644. 'colonmonetary',
  37645. 'onefitted',
  37646. 'rupiah',
  37647. 'Tildesmall',
  37648. 'exclamdownsmall',
  37649. 'centoldstyle',
  37650. 'Lslashsmall',
  37651. 'Scaronsmall',
  37652. 'Zcaronsmall',
  37653. 'Dieresissmall',
  37654. 'Brevesmall',
  37655. 'Caronsmall',
  37656. 'Dotaccentsmall',
  37657. 'Macronsmall',
  37658. 'figuredash',
  37659. 'hypheninferior',
  37660. 'Ogoneksmall',
  37661. 'Ringsmall',
  37662. 'Cedillasmall',
  37663. 'onequarter',
  37664. 'onehalf',
  37665. 'threequarters',
  37666. 'questiondownsmall',
  37667. 'oneeighth',
  37668. 'threeeighths',
  37669. 'fiveeighths',
  37670. 'seveneighths',
  37671. 'onethird',
  37672. 'twothirds',
  37673. 'zerosuperior',
  37674. 'onesuperior',
  37675. 'twosuperior',
  37676. 'threesuperior',
  37677. 'foursuperior',
  37678. 'fivesuperior',
  37679. 'sixsuperior',
  37680. 'sevensuperior',
  37681. 'eightsuperior',
  37682. 'ninesuperior',
  37683. 'zeroinferior',
  37684. 'oneinferior',
  37685. 'twoinferior',
  37686. 'threeinferior',
  37687. 'fourinferior',
  37688. 'fiveinferior',
  37689. 'sixinferior',
  37690. 'seveninferior',
  37691. 'eightinferior',
  37692. 'nineinferior',
  37693. 'centinferior',
  37694. 'dollarinferior',
  37695. 'periodinferior',
  37696. 'commainferior',
  37697. 'Agravesmall',
  37698. 'Aacutesmall',
  37699. 'Acircumflexsmall',
  37700. 'Atildesmall',
  37701. 'Adieresissmall',
  37702. 'Aringsmall',
  37703. 'AEsmall',
  37704. 'Ccedillasmall',
  37705. 'Egravesmall',
  37706. 'Eacutesmall',
  37707. 'Ecircumflexsmall',
  37708. 'Edieresissmall',
  37709. 'Igravesmall',
  37710. 'Iacutesmall',
  37711. 'Icircumflexsmall',
  37712. 'Idieresissmall',
  37713. 'Ethsmall',
  37714. 'Ntildesmall',
  37715. 'Ogravesmall',
  37716. 'Oacutesmall',
  37717. 'Ocircumflexsmall',
  37718. 'Otildesmall',
  37719. 'Odieresissmall',
  37720. 'OEsmall',
  37721. 'Oslashsmall',
  37722. 'Ugravesmall',
  37723. 'Uacutesmall',
  37724. 'Ucircumflexsmall',
  37725. 'Udieresissmall',
  37726. 'Yacutesmall',
  37727. 'Thornsmall',
  37728. 'Ydieresissmall'
  37729. ];
  37730. var ExpertSubsetCharset = [
  37731. '.notdef',
  37732. 'space',
  37733. 'dollaroldstyle',
  37734. 'dollarsuperior',
  37735. 'parenleftsuperior',
  37736. 'parenrightsuperior',
  37737. 'twodotenleader',
  37738. 'onedotenleader',
  37739. 'comma',
  37740. 'hyphen',
  37741. 'period',
  37742. 'fraction',
  37743. 'zerooldstyle',
  37744. 'oneoldstyle',
  37745. 'twooldstyle',
  37746. 'threeoldstyle',
  37747. 'fouroldstyle',
  37748. 'fiveoldstyle',
  37749. 'sixoldstyle',
  37750. 'sevenoldstyle',
  37751. 'eightoldstyle',
  37752. 'nineoldstyle',
  37753. 'colon',
  37754. 'semicolon',
  37755. 'commasuperior',
  37756. 'threequartersemdash',
  37757. 'periodsuperior',
  37758. 'asuperior',
  37759. 'bsuperior',
  37760. 'centsuperior',
  37761. 'dsuperior',
  37762. 'esuperior',
  37763. 'isuperior',
  37764. 'lsuperior',
  37765. 'msuperior',
  37766. 'nsuperior',
  37767. 'osuperior',
  37768. 'rsuperior',
  37769. 'ssuperior',
  37770. 'tsuperior',
  37771. 'ff',
  37772. 'fi',
  37773. 'fl',
  37774. 'ffi',
  37775. 'ffl',
  37776. 'parenleftinferior',
  37777. 'parenrightinferior',
  37778. 'hyphensuperior',
  37779. 'colonmonetary',
  37780. 'onefitted',
  37781. 'rupiah',
  37782. 'centoldstyle',
  37783. 'figuredash',
  37784. 'hypheninferior',
  37785. 'onequarter',
  37786. 'onehalf',
  37787. 'threequarters',
  37788. 'oneeighth',
  37789. 'threeeighths',
  37790. 'fiveeighths',
  37791. 'seveneighths',
  37792. 'onethird',
  37793. 'twothirds',
  37794. 'zerosuperior',
  37795. 'onesuperior',
  37796. 'twosuperior',
  37797. 'threesuperior',
  37798. 'foursuperior',
  37799. 'fivesuperior',
  37800. 'sixsuperior',
  37801. 'sevensuperior',
  37802. 'eightsuperior',
  37803. 'ninesuperior',
  37804. 'zeroinferior',
  37805. 'oneinferior',
  37806. 'twoinferior',
  37807. 'threeinferior',
  37808. 'fourinferior',
  37809. 'fiveinferior',
  37810. 'sixinferior',
  37811. 'seveninferior',
  37812. 'eightinferior',
  37813. 'nineinferior',
  37814. 'centinferior',
  37815. 'dollarinferior',
  37816. 'periodinferior',
  37817. 'commainferior'
  37818. ];
  37819. exports.ISOAdobeCharset = ISOAdobeCharset;
  37820. exports.ExpertCharset = ExpertCharset;
  37821. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  37822. /***/ }),
  37823. /* 23 */
  37824. /***/ (function(module, exports, __w_pdfjs_require__) {
  37825. "use strict";
  37826. var sharedUtil = __w_pdfjs_require__(0);
  37827. var corePrimitives = __w_pdfjs_require__(1);
  37828. var coreStream = __w_pdfjs_require__(2);
  37829. var coreParser = __w_pdfjs_require__(5);
  37830. var Util = sharedUtil.Util;
  37831. var assert = sharedUtil.assert;
  37832. var warn = sharedUtil.warn;
  37833. var error = sharedUtil.error;
  37834. var isInt = sharedUtil.isInt;
  37835. var isString = sharedUtil.isString;
  37836. var MissingDataException = sharedUtil.MissingDataException;
  37837. var isEOF = corePrimitives.isEOF;
  37838. var isName = corePrimitives.isName;
  37839. var isCmd = corePrimitives.isCmd;
  37840. var isStream = corePrimitives.isStream;
  37841. var StringStream = coreStream.StringStream;
  37842. var Lexer = coreParser.Lexer;
  37843. var BUILT_IN_CMAPS = [
  37844. 'Adobe-GB1-UCS2',
  37845. 'Adobe-CNS1-UCS2',
  37846. 'Adobe-Japan1-UCS2',
  37847. 'Adobe-Korea1-UCS2',
  37848. '78-EUC-H',
  37849. '78-EUC-V',
  37850. '78-H',
  37851. '78-RKSJ-H',
  37852. '78-RKSJ-V',
  37853. '78-V',
  37854. '78ms-RKSJ-H',
  37855. '78ms-RKSJ-V',
  37856. '83pv-RKSJ-H',
  37857. '90ms-RKSJ-H',
  37858. '90ms-RKSJ-V',
  37859. '90msp-RKSJ-H',
  37860. '90msp-RKSJ-V',
  37861. '90pv-RKSJ-H',
  37862. '90pv-RKSJ-V',
  37863. 'Add-H',
  37864. 'Add-RKSJ-H',
  37865. 'Add-RKSJ-V',
  37866. 'Add-V',
  37867. 'Adobe-CNS1-0',
  37868. 'Adobe-CNS1-1',
  37869. 'Adobe-CNS1-2',
  37870. 'Adobe-CNS1-3',
  37871. 'Adobe-CNS1-4',
  37872. 'Adobe-CNS1-5',
  37873. 'Adobe-CNS1-6',
  37874. 'Adobe-GB1-0',
  37875. 'Adobe-GB1-1',
  37876. 'Adobe-GB1-2',
  37877. 'Adobe-GB1-3',
  37878. 'Adobe-GB1-4',
  37879. 'Adobe-GB1-5',
  37880. 'Adobe-Japan1-0',
  37881. 'Adobe-Japan1-1',
  37882. 'Adobe-Japan1-2',
  37883. 'Adobe-Japan1-3',
  37884. 'Adobe-Japan1-4',
  37885. 'Adobe-Japan1-5',
  37886. 'Adobe-Japan1-6',
  37887. 'Adobe-Korea1-0',
  37888. 'Adobe-Korea1-1',
  37889. 'Adobe-Korea1-2',
  37890. 'B5-H',
  37891. 'B5-V',
  37892. 'B5pc-H',
  37893. 'B5pc-V',
  37894. 'CNS-EUC-H',
  37895. 'CNS-EUC-V',
  37896. 'CNS1-H',
  37897. 'CNS1-V',
  37898. 'CNS2-H',
  37899. 'CNS2-V',
  37900. 'ETHK-B5-H',
  37901. 'ETHK-B5-V',
  37902. 'ETen-B5-H',
  37903. 'ETen-B5-V',
  37904. 'ETenms-B5-H',
  37905. 'ETenms-B5-V',
  37906. 'EUC-H',
  37907. 'EUC-V',
  37908. 'Ext-H',
  37909. 'Ext-RKSJ-H',
  37910. 'Ext-RKSJ-V',
  37911. 'Ext-V',
  37912. 'GB-EUC-H',
  37913. 'GB-EUC-V',
  37914. 'GB-H',
  37915. 'GB-V',
  37916. 'GBK-EUC-H',
  37917. 'GBK-EUC-V',
  37918. 'GBK2K-H',
  37919. 'GBK2K-V',
  37920. 'GBKp-EUC-H',
  37921. 'GBKp-EUC-V',
  37922. 'GBT-EUC-H',
  37923. 'GBT-EUC-V',
  37924. 'GBT-H',
  37925. 'GBT-V',
  37926. 'GBTpc-EUC-H',
  37927. 'GBTpc-EUC-V',
  37928. 'GBpc-EUC-H',
  37929. 'GBpc-EUC-V',
  37930. 'H',
  37931. 'HKdla-B5-H',
  37932. 'HKdla-B5-V',
  37933. 'HKdlb-B5-H',
  37934. 'HKdlb-B5-V',
  37935. 'HKgccs-B5-H',
  37936. 'HKgccs-B5-V',
  37937. 'HKm314-B5-H',
  37938. 'HKm314-B5-V',
  37939. 'HKm471-B5-H',
  37940. 'HKm471-B5-V',
  37941. 'HKscs-B5-H',
  37942. 'HKscs-B5-V',
  37943. 'Hankaku',
  37944. 'Hiragana',
  37945. 'KSC-EUC-H',
  37946. 'KSC-EUC-V',
  37947. 'KSC-H',
  37948. 'KSC-Johab-H',
  37949. 'KSC-Johab-V',
  37950. 'KSC-V',
  37951. 'KSCms-UHC-H',
  37952. 'KSCms-UHC-HW-H',
  37953. 'KSCms-UHC-HW-V',
  37954. 'KSCms-UHC-V',
  37955. 'KSCpc-EUC-H',
  37956. 'KSCpc-EUC-V',
  37957. 'Katakana',
  37958. 'NWP-H',
  37959. 'NWP-V',
  37960. 'RKSJ-H',
  37961. 'RKSJ-V',
  37962. 'Roman',
  37963. 'UniCNS-UCS2-H',
  37964. 'UniCNS-UCS2-V',
  37965. 'UniCNS-UTF16-H',
  37966. 'UniCNS-UTF16-V',
  37967. 'UniCNS-UTF32-H',
  37968. 'UniCNS-UTF32-V',
  37969. 'UniCNS-UTF8-H',
  37970. 'UniCNS-UTF8-V',
  37971. 'UniGB-UCS2-H',
  37972. 'UniGB-UCS2-V',
  37973. 'UniGB-UTF16-H',
  37974. 'UniGB-UTF16-V',
  37975. 'UniGB-UTF32-H',
  37976. 'UniGB-UTF32-V',
  37977. 'UniGB-UTF8-H',
  37978. 'UniGB-UTF8-V',
  37979. 'UniJIS-UCS2-H',
  37980. 'UniJIS-UCS2-HW-H',
  37981. 'UniJIS-UCS2-HW-V',
  37982. 'UniJIS-UCS2-V',
  37983. 'UniJIS-UTF16-H',
  37984. 'UniJIS-UTF16-V',
  37985. 'UniJIS-UTF32-H',
  37986. 'UniJIS-UTF32-V',
  37987. 'UniJIS-UTF8-H',
  37988. 'UniJIS-UTF8-V',
  37989. 'UniJIS2004-UTF16-H',
  37990. 'UniJIS2004-UTF16-V',
  37991. 'UniJIS2004-UTF32-H',
  37992. 'UniJIS2004-UTF32-V',
  37993. 'UniJIS2004-UTF8-H',
  37994. 'UniJIS2004-UTF8-V',
  37995. 'UniJISPro-UCS2-HW-V',
  37996. 'UniJISPro-UCS2-V',
  37997. 'UniJISPro-UTF8-V',
  37998. 'UniJISX0213-UTF32-H',
  37999. 'UniJISX0213-UTF32-V',
  38000. 'UniJISX02132004-UTF32-H',
  38001. 'UniJISX02132004-UTF32-V',
  38002. 'UniKS-UCS2-H',
  38003. 'UniKS-UCS2-V',
  38004. 'UniKS-UTF16-H',
  38005. 'UniKS-UTF16-V',
  38006. 'UniKS-UTF32-H',
  38007. 'UniKS-UTF32-V',
  38008. 'UniKS-UTF8-H',
  38009. 'UniKS-UTF8-V',
  38010. 'V',
  38011. 'WP-Symbol'
  38012. ];
  38013. var CMap = function CMapClosure() {
  38014. function CMap(builtInCMap) {
  38015. this.codespaceRanges = [
  38016. [],
  38017. [],
  38018. [],
  38019. []
  38020. ];
  38021. this.numCodespaceRanges = 0;
  38022. this._map = [];
  38023. this.name = '';
  38024. this.vertical = false;
  38025. this.useCMap = null;
  38026. this.builtInCMap = builtInCMap;
  38027. }
  38028. CMap.prototype = {
  38029. addCodespaceRange: function (n, low, high) {
  38030. this.codespaceRanges[n - 1].push(low, high);
  38031. this.numCodespaceRanges++;
  38032. },
  38033. mapCidRange: function (low, high, dstLow) {
  38034. while (low <= high) {
  38035. this._map[low++] = dstLow++;
  38036. }
  38037. },
  38038. mapBfRange: function (low, high, dstLow) {
  38039. var lastByte = dstLow.length - 1;
  38040. while (low <= high) {
  38041. this._map[low++] = dstLow;
  38042. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  38043. }
  38044. },
  38045. mapBfRangeToArray: function (low, high, array) {
  38046. var i = 0, ii = array.length;
  38047. while (low <= high && i < ii) {
  38048. this._map[low] = array[i++];
  38049. ++low;
  38050. }
  38051. },
  38052. mapOne: function (src, dst) {
  38053. this._map[src] = dst;
  38054. },
  38055. lookup: function (code) {
  38056. return this._map[code];
  38057. },
  38058. contains: function (code) {
  38059. return this._map[code] !== undefined;
  38060. },
  38061. forEach: function (callback) {
  38062. var map = this._map;
  38063. var length = map.length;
  38064. var i;
  38065. if (length <= 0x10000) {
  38066. for (i = 0; i < length; i++) {
  38067. if (map[i] !== undefined) {
  38068. callback(i, map[i]);
  38069. }
  38070. }
  38071. } else {
  38072. for (i in this._map) {
  38073. callback(i, map[i]);
  38074. }
  38075. }
  38076. },
  38077. charCodeOf: function (value) {
  38078. return this._map.indexOf(value);
  38079. },
  38080. getMap: function () {
  38081. return this._map;
  38082. },
  38083. readCharCode: function (str, offset, out) {
  38084. var c = 0;
  38085. var codespaceRanges = this.codespaceRanges;
  38086. var codespaceRangesLen = this.codespaceRanges.length;
  38087. for (var n = 0; n < codespaceRangesLen; n++) {
  38088. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  38089. var codespaceRange = codespaceRanges[n];
  38090. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  38091. var low = codespaceRange[k++];
  38092. var high = codespaceRange[k++];
  38093. if (c >= low && c <= high) {
  38094. out.charcode = c;
  38095. out.length = n + 1;
  38096. return;
  38097. }
  38098. }
  38099. }
  38100. out.charcode = 0;
  38101. out.length = 1;
  38102. },
  38103. get length() {
  38104. return this._map.length;
  38105. },
  38106. get isIdentityCMap() {
  38107. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  38108. return false;
  38109. }
  38110. if (this._map.length !== 0x10000) {
  38111. return false;
  38112. }
  38113. for (var i = 0; i < 0x10000; i++) {
  38114. if (this._map[i] !== i) {
  38115. return false;
  38116. }
  38117. }
  38118. return true;
  38119. }
  38120. };
  38121. return CMap;
  38122. }();
  38123. var IdentityCMap = function IdentityCMapClosure() {
  38124. function IdentityCMap(vertical, n) {
  38125. CMap.call(this);
  38126. this.vertical = vertical;
  38127. this.addCodespaceRange(n, 0, 0xffff);
  38128. }
  38129. Util.inherit(IdentityCMap, CMap, {});
  38130. IdentityCMap.prototype = {
  38131. addCodespaceRange: CMap.prototype.addCodespaceRange,
  38132. mapCidRange: function (low, high, dstLow) {
  38133. error('should not call mapCidRange');
  38134. },
  38135. mapBfRange: function (low, high, dstLow) {
  38136. error('should not call mapBfRange');
  38137. },
  38138. mapBfRangeToArray: function (low, high, array) {
  38139. error('should not call mapBfRangeToArray');
  38140. },
  38141. mapOne: function (src, dst) {
  38142. error('should not call mapCidOne');
  38143. },
  38144. lookup: function (code) {
  38145. return isInt(code) && code <= 0xffff ? code : undefined;
  38146. },
  38147. contains: function (code) {
  38148. return isInt(code) && code <= 0xffff;
  38149. },
  38150. forEach: function (callback) {
  38151. for (var i = 0; i <= 0xffff; i++) {
  38152. callback(i, i);
  38153. }
  38154. },
  38155. charCodeOf: function (value) {
  38156. return isInt(value) && value <= 0xffff ? value : -1;
  38157. },
  38158. getMap: function () {
  38159. var map = new Array(0x10000);
  38160. for (var i = 0; i <= 0xffff; i++) {
  38161. map[i] = i;
  38162. }
  38163. return map;
  38164. },
  38165. readCharCode: CMap.prototype.readCharCode,
  38166. get length() {
  38167. return 0x10000;
  38168. },
  38169. get isIdentityCMap() {
  38170. error('should not access .isIdentityCMap');
  38171. }
  38172. };
  38173. return IdentityCMap;
  38174. }();
  38175. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  38176. function fetchBinaryData(url) {
  38177. return new Promise(function (resolve, reject) {
  38178. var request = new XMLHttpRequest();
  38179. request.open('GET', url, true);
  38180. request.responseType = 'arraybuffer';
  38181. request.onreadystatechange = function () {
  38182. if (request.readyState === XMLHttpRequest.DONE) {
  38183. if (!request.response || request.status !== 200 && request.status !== 0) {
  38184. reject(new Error('Unable to get binary cMap at: ' + url));
  38185. } else {
  38186. resolve(new Uint8Array(request.response));
  38187. }
  38188. }
  38189. };
  38190. request.send(null);
  38191. });
  38192. }
  38193. function hexToInt(a, size) {
  38194. var n = 0;
  38195. for (var i = 0; i <= size; i++) {
  38196. n = n << 8 | a[i];
  38197. }
  38198. return n >>> 0;
  38199. }
  38200. function hexToStr(a, size) {
  38201. if (size === 1) {
  38202. return String.fromCharCode(a[0], a[1]);
  38203. }
  38204. if (size === 3) {
  38205. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  38206. }
  38207. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  38208. }
  38209. function addHex(a, b, size) {
  38210. var c = 0;
  38211. for (var i = size; i >= 0; i--) {
  38212. c += a[i] + b[i];
  38213. a[i] = c & 255;
  38214. c >>= 8;
  38215. }
  38216. }
  38217. function incHex(a, size) {
  38218. var c = 1;
  38219. for (var i = size; i >= 0 && c > 0; i--) {
  38220. c += a[i];
  38221. a[i] = c & 255;
  38222. c >>= 8;
  38223. }
  38224. }
  38225. var MAX_NUM_SIZE = 16;
  38226. var MAX_ENCODED_NUM_SIZE = 19;
  38227. function BinaryCMapStream(data) {
  38228. this.buffer = data;
  38229. this.pos = 0;
  38230. this.end = data.length;
  38231. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  38232. }
  38233. BinaryCMapStream.prototype = {
  38234. readByte: function () {
  38235. if (this.pos >= this.end) {
  38236. return -1;
  38237. }
  38238. return this.buffer[this.pos++];
  38239. },
  38240. readNumber: function () {
  38241. var n = 0;
  38242. var last;
  38243. do {
  38244. var b = this.readByte();
  38245. if (b < 0) {
  38246. error('unexpected EOF in bcmap');
  38247. }
  38248. last = !(b & 0x80);
  38249. n = n << 7 | b & 0x7F;
  38250. } while (!last);
  38251. return n;
  38252. },
  38253. readSigned: function () {
  38254. var n = this.readNumber();
  38255. return n & 1 ? ~(n >>> 1) : n >>> 1;
  38256. },
  38257. readHex: function (num, size) {
  38258. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  38259. this.pos += size + 1;
  38260. },
  38261. readHexNumber: function (num, size) {
  38262. var last;
  38263. var stack = this.tmpBuf, sp = 0;
  38264. do {
  38265. var b = this.readByte();
  38266. if (b < 0) {
  38267. error('unexpected EOF in bcmap');
  38268. }
  38269. last = !(b & 0x80);
  38270. stack[sp++] = b & 0x7F;
  38271. } while (!last);
  38272. var i = size, buffer = 0, bufferSize = 0;
  38273. while (i >= 0) {
  38274. while (bufferSize < 8 && stack.length > 0) {
  38275. buffer = stack[--sp] << bufferSize | buffer;
  38276. bufferSize += 7;
  38277. }
  38278. num[i] = buffer & 255;
  38279. i--;
  38280. buffer >>= 8;
  38281. bufferSize -= 8;
  38282. }
  38283. },
  38284. readHexSigned: function (num, size) {
  38285. this.readHexNumber(num, size);
  38286. var sign = num[size] & 1 ? 255 : 0;
  38287. var c = 0;
  38288. for (var i = 0; i <= size; i++) {
  38289. c = (c & 1) << 8 | num[i];
  38290. num[i] = c >> 1 ^ sign;
  38291. }
  38292. },
  38293. readString: function () {
  38294. var len = this.readNumber();
  38295. var s = '';
  38296. for (var i = 0; i < len; i++) {
  38297. s += String.fromCharCode(this.readNumber());
  38298. }
  38299. return s;
  38300. }
  38301. };
  38302. function processBinaryCMap(url, cMap, extend) {
  38303. return fetchBinaryData(url).then(function (data) {
  38304. var stream = new BinaryCMapStream(data);
  38305. var header = stream.readByte();
  38306. cMap.vertical = !!(header & 1);
  38307. var useCMap = null;
  38308. var start = new Uint8Array(MAX_NUM_SIZE);
  38309. var end = new Uint8Array(MAX_NUM_SIZE);
  38310. var char = new Uint8Array(MAX_NUM_SIZE);
  38311. var charCode = new Uint8Array(MAX_NUM_SIZE);
  38312. var tmp = new Uint8Array(MAX_NUM_SIZE);
  38313. var code;
  38314. var b;
  38315. while ((b = stream.readByte()) >= 0) {
  38316. var type = b >> 5;
  38317. if (type === 7) {
  38318. switch (b & 0x1F) {
  38319. case 0:
  38320. stream.readString();
  38321. break;
  38322. case 1:
  38323. useCMap = stream.readString();
  38324. break;
  38325. }
  38326. continue;
  38327. }
  38328. var sequence = !!(b & 0x10);
  38329. var dataSize = b & 15;
  38330. assert(dataSize + 1 <= MAX_NUM_SIZE);
  38331. var ucs2DataSize = 1;
  38332. var subitemsCount = stream.readNumber();
  38333. var i;
  38334. switch (type) {
  38335. case 0:
  38336. stream.readHex(start, dataSize);
  38337. stream.readHexNumber(end, dataSize);
  38338. addHex(end, start, dataSize);
  38339. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38340. for (i = 1; i < subitemsCount; i++) {
  38341. incHex(end, dataSize);
  38342. stream.readHexNumber(start, dataSize);
  38343. addHex(start, end, dataSize);
  38344. stream.readHexNumber(end, dataSize);
  38345. addHex(end, start, dataSize);
  38346. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38347. }
  38348. break;
  38349. case 1:
  38350. stream.readHex(start, dataSize);
  38351. stream.readHexNumber(end, dataSize);
  38352. addHex(end, start, dataSize);
  38353. code = stream.readNumber();
  38354. for (i = 1; i < subitemsCount; i++) {
  38355. incHex(end, dataSize);
  38356. stream.readHexNumber(start, dataSize);
  38357. addHex(start, end, dataSize);
  38358. stream.readHexNumber(end, dataSize);
  38359. addHex(end, start, dataSize);
  38360. code = stream.readNumber();
  38361. }
  38362. break;
  38363. case 2:
  38364. stream.readHex(char, dataSize);
  38365. code = stream.readNumber();
  38366. cMap.mapOne(hexToInt(char, dataSize), code);
  38367. for (i = 1; i < subitemsCount; i++) {
  38368. incHex(char, dataSize);
  38369. if (!sequence) {
  38370. stream.readHexNumber(tmp, dataSize);
  38371. addHex(char, tmp, dataSize);
  38372. }
  38373. code = stream.readSigned() + (code + 1);
  38374. cMap.mapOne(hexToInt(char, dataSize), code);
  38375. }
  38376. break;
  38377. case 3:
  38378. stream.readHex(start, dataSize);
  38379. stream.readHexNumber(end, dataSize);
  38380. addHex(end, start, dataSize);
  38381. code = stream.readNumber();
  38382. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38383. for (i = 1; i < subitemsCount; i++) {
  38384. incHex(end, dataSize);
  38385. if (!sequence) {
  38386. stream.readHexNumber(start, dataSize);
  38387. addHex(start, end, dataSize);
  38388. } else {
  38389. start.set(end);
  38390. }
  38391. stream.readHexNumber(end, dataSize);
  38392. addHex(end, start, dataSize);
  38393. code = stream.readNumber();
  38394. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38395. }
  38396. break;
  38397. case 4:
  38398. stream.readHex(char, ucs2DataSize);
  38399. stream.readHex(charCode, dataSize);
  38400. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38401. for (i = 1; i < subitemsCount; i++) {
  38402. incHex(char, ucs2DataSize);
  38403. if (!sequence) {
  38404. stream.readHexNumber(tmp, ucs2DataSize);
  38405. addHex(char, tmp, ucs2DataSize);
  38406. }
  38407. incHex(charCode, dataSize);
  38408. stream.readHexSigned(tmp, dataSize);
  38409. addHex(charCode, tmp, dataSize);
  38410. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38411. }
  38412. break;
  38413. case 5:
  38414. stream.readHex(start, ucs2DataSize);
  38415. stream.readHexNumber(end, ucs2DataSize);
  38416. addHex(end, start, ucs2DataSize);
  38417. stream.readHex(charCode, dataSize);
  38418. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38419. for (i = 1; i < subitemsCount; i++) {
  38420. incHex(end, ucs2DataSize);
  38421. if (!sequence) {
  38422. stream.readHexNumber(start, ucs2DataSize);
  38423. addHex(start, end, ucs2DataSize);
  38424. } else {
  38425. start.set(end);
  38426. }
  38427. stream.readHexNumber(end, ucs2DataSize);
  38428. addHex(end, start, ucs2DataSize);
  38429. stream.readHex(charCode, dataSize);
  38430. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38431. }
  38432. break;
  38433. default:
  38434. error('Unknown type: ' + type);
  38435. break;
  38436. }
  38437. }
  38438. if (useCMap) {
  38439. return extend(useCMap);
  38440. }
  38441. return cMap;
  38442. });
  38443. }
  38444. function BinaryCMapReader() {
  38445. }
  38446. BinaryCMapReader.prototype = { read: processBinaryCMap };
  38447. return BinaryCMapReader;
  38448. }();
  38449. var CMapFactory = function CMapFactoryClosure() {
  38450. function strToInt(str) {
  38451. var a = 0;
  38452. for (var i = 0; i < str.length; i++) {
  38453. a = a << 8 | str.charCodeAt(i);
  38454. }
  38455. return a >>> 0;
  38456. }
  38457. function expectString(obj) {
  38458. if (!isString(obj)) {
  38459. error('Malformed CMap: expected string.');
  38460. }
  38461. }
  38462. function expectInt(obj) {
  38463. if (!isInt(obj)) {
  38464. error('Malformed CMap: expected int.');
  38465. }
  38466. }
  38467. function parseBfChar(cMap, lexer) {
  38468. while (true) {
  38469. var obj = lexer.getObj();
  38470. if (isEOF(obj)) {
  38471. break;
  38472. }
  38473. if (isCmd(obj, 'endbfchar')) {
  38474. return;
  38475. }
  38476. expectString(obj);
  38477. var src = strToInt(obj);
  38478. obj = lexer.getObj();
  38479. expectString(obj);
  38480. var dst = obj;
  38481. cMap.mapOne(src, dst);
  38482. }
  38483. }
  38484. function parseBfRange(cMap, lexer) {
  38485. while (true) {
  38486. var obj = lexer.getObj();
  38487. if (isEOF(obj)) {
  38488. break;
  38489. }
  38490. if (isCmd(obj, 'endbfrange')) {
  38491. return;
  38492. }
  38493. expectString(obj);
  38494. var low = strToInt(obj);
  38495. obj = lexer.getObj();
  38496. expectString(obj);
  38497. var high = strToInt(obj);
  38498. obj = lexer.getObj();
  38499. if (isInt(obj) || isString(obj)) {
  38500. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  38501. cMap.mapBfRange(low, high, dstLow);
  38502. } else if (isCmd(obj, '[')) {
  38503. obj = lexer.getObj();
  38504. var array = [];
  38505. while (!isCmd(obj, ']') && !isEOF(obj)) {
  38506. array.push(obj);
  38507. obj = lexer.getObj();
  38508. }
  38509. cMap.mapBfRangeToArray(low, high, array);
  38510. } else {
  38511. break;
  38512. }
  38513. }
  38514. error('Invalid bf range.');
  38515. }
  38516. function parseCidChar(cMap, lexer) {
  38517. while (true) {
  38518. var obj = lexer.getObj();
  38519. if (isEOF(obj)) {
  38520. break;
  38521. }
  38522. if (isCmd(obj, 'endcidchar')) {
  38523. return;
  38524. }
  38525. expectString(obj);
  38526. var src = strToInt(obj);
  38527. obj = lexer.getObj();
  38528. expectInt(obj);
  38529. var dst = obj;
  38530. cMap.mapOne(src, dst);
  38531. }
  38532. }
  38533. function parseCidRange(cMap, lexer) {
  38534. while (true) {
  38535. var obj = lexer.getObj();
  38536. if (isEOF(obj)) {
  38537. break;
  38538. }
  38539. if (isCmd(obj, 'endcidrange')) {
  38540. return;
  38541. }
  38542. expectString(obj);
  38543. var low = strToInt(obj);
  38544. obj = lexer.getObj();
  38545. expectString(obj);
  38546. var high = strToInt(obj);
  38547. obj = lexer.getObj();
  38548. expectInt(obj);
  38549. var dstLow = obj;
  38550. cMap.mapCidRange(low, high, dstLow);
  38551. }
  38552. }
  38553. function parseCodespaceRange(cMap, lexer) {
  38554. while (true) {
  38555. var obj = lexer.getObj();
  38556. if (isEOF(obj)) {
  38557. break;
  38558. }
  38559. if (isCmd(obj, 'endcodespacerange')) {
  38560. return;
  38561. }
  38562. if (!isString(obj)) {
  38563. break;
  38564. }
  38565. var low = strToInt(obj);
  38566. obj = lexer.getObj();
  38567. if (!isString(obj)) {
  38568. break;
  38569. }
  38570. var high = strToInt(obj);
  38571. cMap.addCodespaceRange(obj.length, low, high);
  38572. }
  38573. error('Invalid codespace range.');
  38574. }
  38575. function parseWMode(cMap, lexer) {
  38576. var obj = lexer.getObj();
  38577. if (isInt(obj)) {
  38578. cMap.vertical = !!obj;
  38579. }
  38580. }
  38581. function parseCMapName(cMap, lexer) {
  38582. var obj = lexer.getObj();
  38583. if (isName(obj) && isString(obj.name)) {
  38584. cMap.name = obj.name;
  38585. }
  38586. }
  38587. function parseCMap(cMap, lexer, builtInCMapParams, useCMap) {
  38588. var previous;
  38589. var embededUseCMap;
  38590. objLoop:
  38591. while (true) {
  38592. try {
  38593. var obj = lexer.getObj();
  38594. if (isEOF(obj)) {
  38595. break;
  38596. } else if (isName(obj)) {
  38597. if (obj.name === 'WMode') {
  38598. parseWMode(cMap, lexer);
  38599. } else if (obj.name === 'CMapName') {
  38600. parseCMapName(cMap, lexer);
  38601. }
  38602. previous = obj;
  38603. } else if (isCmd(obj)) {
  38604. switch (obj.cmd) {
  38605. case 'endcmap':
  38606. break objLoop;
  38607. case 'usecmap':
  38608. if (isName(previous)) {
  38609. embededUseCMap = previous.name;
  38610. }
  38611. break;
  38612. case 'begincodespacerange':
  38613. parseCodespaceRange(cMap, lexer);
  38614. break;
  38615. case 'beginbfchar':
  38616. parseBfChar(cMap, lexer);
  38617. break;
  38618. case 'begincidchar':
  38619. parseCidChar(cMap, lexer);
  38620. break;
  38621. case 'beginbfrange':
  38622. parseBfRange(cMap, lexer);
  38623. break;
  38624. case 'begincidrange':
  38625. parseCidRange(cMap, lexer);
  38626. break;
  38627. }
  38628. }
  38629. } catch (ex) {
  38630. if (ex instanceof MissingDataException) {
  38631. throw ex;
  38632. }
  38633. warn('Invalid cMap data: ' + ex);
  38634. continue;
  38635. }
  38636. }
  38637. if (!useCMap && embededUseCMap) {
  38638. useCMap = embededUseCMap;
  38639. }
  38640. if (useCMap) {
  38641. return extendCMap(cMap, builtInCMapParams, useCMap);
  38642. }
  38643. return Promise.resolve(cMap);
  38644. }
  38645. function extendCMap(cMap, builtInCMapParams, useCMap) {
  38646. return createBuiltInCMap(useCMap, builtInCMapParams).then(function (newCMap) {
  38647. cMap.useCMap = newCMap;
  38648. if (cMap.numCodespaceRanges === 0) {
  38649. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  38650. for (var i = 0; i < useCodespaceRanges.length; i++) {
  38651. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  38652. }
  38653. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  38654. }
  38655. cMap.useCMap.forEach(function (key, value) {
  38656. if (!cMap.contains(key)) {
  38657. cMap.mapOne(key, cMap.useCMap.lookup(key));
  38658. }
  38659. });
  38660. return cMap;
  38661. });
  38662. }
  38663. function parseBinaryCMap(name, builtInCMapParams) {
  38664. var url = builtInCMapParams.url + name + '.bcmap';
  38665. var cMap = new CMap(true);
  38666. return new BinaryCMapReader().read(url, cMap, function (useCMap) {
  38667. return extendCMap(cMap, builtInCMapParams, useCMap);
  38668. });
  38669. }
  38670. function createBuiltInCMap(name, builtInCMapParams) {
  38671. if (name === 'Identity-H') {
  38672. return Promise.resolve(new IdentityCMap(false, 2));
  38673. } else if (name === 'Identity-V') {
  38674. return Promise.resolve(new IdentityCMap(true, 2));
  38675. }
  38676. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  38677. return Promise.reject(new Error('Unknown cMap name: ' + name));
  38678. }
  38679. assert(builtInCMapParams, 'built-in cMap parameters are not provided');
  38680. if (builtInCMapParams.packed) {
  38681. return parseBinaryCMap(name, builtInCMapParams);
  38682. }
  38683. return new Promise(function (resolve, reject) {
  38684. var url = builtInCMapParams.url + name;
  38685. var request = new XMLHttpRequest();
  38686. request.onreadystatechange = function () {
  38687. if (request.readyState === XMLHttpRequest.DONE) {
  38688. if (request.status === 200 || request.status === 0) {
  38689. var cMap = new CMap(true);
  38690. var lexer = new Lexer(new StringStream(request.responseText));
  38691. parseCMap(cMap, lexer, builtInCMapParams, null).then(function (parsedCMap) {
  38692. resolve(parsedCMap);
  38693. });
  38694. } else {
  38695. reject(new Error('Unable to get cMap at: ' + url));
  38696. }
  38697. }
  38698. };
  38699. request.open('GET', url, true);
  38700. request.send(null);
  38701. });
  38702. }
  38703. return {
  38704. create: function (encoding, builtInCMapParams, useCMap) {
  38705. if (isName(encoding)) {
  38706. return createBuiltInCMap(encoding.name, builtInCMapParams);
  38707. } else if (isStream(encoding)) {
  38708. var cMap = new CMap();
  38709. var lexer = new Lexer(encoding);
  38710. return parseCMap(cMap, lexer, builtInCMapParams, useCMap).then(function (parsedCMap) {
  38711. if (parsedCMap.isIdentityCMap) {
  38712. return createBuiltInCMap(parsedCMap.name, builtInCMapParams);
  38713. }
  38714. return parsedCMap;
  38715. });
  38716. }
  38717. return Promise.reject(new Error('Encoding required.'));
  38718. }
  38719. };
  38720. }();
  38721. exports.CMap = CMap;
  38722. exports.CMapFactory = CMapFactory;
  38723. exports.IdentityCMap = IdentityCMap;
  38724. /***/ }),
  38725. /* 24 */
  38726. /***/ (function(module, exports, __w_pdfjs_require__) {
  38727. "use strict";
  38728. var sharedUtil = __w_pdfjs_require__(0);
  38729. var corePrimitives = __w_pdfjs_require__(1);
  38730. var coreStream = __w_pdfjs_require__(2);
  38731. var coreObj = __w_pdfjs_require__(15);
  38732. var coreParser = __w_pdfjs_require__(5);
  38733. var coreCrypto = __w_pdfjs_require__(12);
  38734. var coreEvaluator = __w_pdfjs_require__(13);
  38735. var coreAnnotation = __w_pdfjs_require__(20);
  38736. var MissingDataException = sharedUtil.MissingDataException;
  38737. var Util = sharedUtil.Util;
  38738. var assert = sharedUtil.assert;
  38739. var error = sharedUtil.error;
  38740. var info = sharedUtil.info;
  38741. var isArray = sharedUtil.isArray;
  38742. var isArrayBuffer = sharedUtil.isArrayBuffer;
  38743. var isNum = sharedUtil.isNum;
  38744. var isString = sharedUtil.isString;
  38745. var shadow = sharedUtil.shadow;
  38746. var stringToBytes = sharedUtil.stringToBytes;
  38747. var stringToPDFString = sharedUtil.stringToPDFString;
  38748. var warn = sharedUtil.warn;
  38749. var isSpace = sharedUtil.isSpace;
  38750. var Dict = corePrimitives.Dict;
  38751. var isDict = corePrimitives.isDict;
  38752. var isName = corePrimitives.isName;
  38753. var isStream = corePrimitives.isStream;
  38754. var NullStream = coreStream.NullStream;
  38755. var Stream = coreStream.Stream;
  38756. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  38757. var Catalog = coreObj.Catalog;
  38758. var ObjectLoader = coreObj.ObjectLoader;
  38759. var XRef = coreObj.XRef;
  38760. var Linearization = coreParser.Linearization;
  38761. var calculateMD5 = coreCrypto.calculateMD5;
  38762. var OperatorList = coreEvaluator.OperatorList;
  38763. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  38764. var Annotation = coreAnnotation.Annotation;
  38765. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  38766. var Page = function PageClosure() {
  38767. var DEFAULT_USER_UNIT = 1.0;
  38768. var LETTER_SIZE_MEDIABOX = [
  38769. 0,
  38770. 0,
  38771. 612,
  38772. 792
  38773. ];
  38774. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) {
  38775. this.pdfManager = pdfManager;
  38776. this.pageIndex = pageIndex;
  38777. this.pageDict = pageDict;
  38778. this.xref = xref;
  38779. this.ref = ref;
  38780. this.fontCache = fontCache;
  38781. this.evaluatorOptions = pdfManager.evaluatorOptions;
  38782. this.resourcesPromise = null;
  38783. var uniquePrefix = 'p' + this.pageIndex + '_';
  38784. var idCounters = { obj: 0 };
  38785. this.idFactory = {
  38786. createObjId: function () {
  38787. return uniquePrefix + ++idCounters.obj;
  38788. }
  38789. };
  38790. }
  38791. Page.prototype = {
  38792. getPageProp: function Page_getPageProp(key) {
  38793. return this.pageDict.get(key);
  38794. },
  38795. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  38796. var dict = this.pageDict, valueArray = null, loopCount = 0;
  38797. var MAX_LOOP_COUNT = 100;
  38798. getArray = getArray || false;
  38799. while (dict) {
  38800. var value = getArray ? dict.getArray(key) : dict.get(key);
  38801. if (value) {
  38802. if (!valueArray) {
  38803. valueArray = [];
  38804. }
  38805. valueArray.push(value);
  38806. }
  38807. if (++loopCount > MAX_LOOP_COUNT) {
  38808. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  38809. break;
  38810. }
  38811. dict = dict.get('Parent');
  38812. }
  38813. if (!valueArray) {
  38814. return Dict.empty;
  38815. }
  38816. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  38817. return valueArray[0];
  38818. }
  38819. return Dict.merge(this.xref, valueArray);
  38820. },
  38821. get content() {
  38822. return this.getPageProp('Contents');
  38823. },
  38824. get resources() {
  38825. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  38826. },
  38827. get mediaBox() {
  38828. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  38829. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  38830. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  38831. }
  38832. return shadow(this, 'mediaBox', mediaBox);
  38833. },
  38834. get cropBox() {
  38835. var cropBox = this.getInheritedPageProp('CropBox', true);
  38836. if (!isArray(cropBox) || cropBox.length !== 4) {
  38837. return shadow(this, 'cropBox', this.mediaBox);
  38838. }
  38839. return shadow(this, 'cropBox', cropBox);
  38840. },
  38841. get userUnit() {
  38842. var obj = this.getPageProp('UserUnit');
  38843. if (!isNum(obj) || obj <= 0) {
  38844. obj = DEFAULT_USER_UNIT;
  38845. }
  38846. return shadow(this, 'userUnit', obj);
  38847. },
  38848. get view() {
  38849. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  38850. if (mediaBox === cropBox) {
  38851. return shadow(this, 'view', mediaBox);
  38852. }
  38853. var intersection = Util.intersect(cropBox, mediaBox);
  38854. return shadow(this, 'view', intersection || mediaBox);
  38855. },
  38856. get rotate() {
  38857. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38858. if (rotate % 90 !== 0) {
  38859. rotate = 0;
  38860. } else if (rotate >= 360) {
  38861. rotate = rotate % 360;
  38862. } else if (rotate < 0) {
  38863. rotate = (rotate % 360 + 360) % 360;
  38864. }
  38865. return shadow(this, 'rotate', rotate);
  38866. },
  38867. getContentStream: function Page_getContentStream() {
  38868. var content = this.content;
  38869. var stream;
  38870. if (isArray(content)) {
  38871. var xref = this.xref;
  38872. var i, n = content.length;
  38873. var streams = [];
  38874. for (i = 0; i < n; ++i) {
  38875. streams.push(xref.fetchIfRef(content[i]));
  38876. }
  38877. stream = new StreamsSequenceStream(streams);
  38878. } else if (isStream(content)) {
  38879. stream = content;
  38880. } else {
  38881. stream = new NullStream();
  38882. }
  38883. return stream;
  38884. },
  38885. loadResources: function Page_loadResources(keys) {
  38886. if (!this.resourcesPromise) {
  38887. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38888. }
  38889. return this.resourcesPromise.then(function resourceSuccess() {
  38890. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38891. return objectLoader.load();
  38892. }.bind(this));
  38893. },
  38894. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38895. var self = this;
  38896. var pdfManager = this.pdfManager;
  38897. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38898. var resourcesPromise = this.loadResources([
  38899. 'ExtGState',
  38900. 'ColorSpace',
  38901. 'Pattern',
  38902. 'Shading',
  38903. 'XObject',
  38904. 'Font'
  38905. ]);
  38906. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.evaluatorOptions);
  38907. var dataPromises = Promise.all([
  38908. contentStreamPromise,
  38909. resourcesPromise
  38910. ]);
  38911. var pageListPromise = dataPromises.then(function (data) {
  38912. var contentStream = data[0];
  38913. var opList = new OperatorList(intent, handler, self.pageIndex);
  38914. handler.send('StartRenderPage', {
  38915. transparency: partialEvaluator.hasBlendModes(self.resources),
  38916. pageIndex: self.pageIndex,
  38917. intent: intent
  38918. });
  38919. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38920. return opList;
  38921. });
  38922. });
  38923. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38924. return Promise.all([
  38925. pageListPromise,
  38926. annotationsPromise
  38927. ]).then(function (datas) {
  38928. var pageOpList = datas[0];
  38929. var annotations = datas[1];
  38930. if (annotations.length === 0) {
  38931. pageOpList.flush(true);
  38932. return pageOpList;
  38933. }
  38934. var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms);
  38935. return annotationsReadyPromise.then(function () {
  38936. pageOpList.flush(true);
  38937. return pageOpList;
  38938. });
  38939. });
  38940. },
  38941. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38942. var handler = {
  38943. on: function nullHandlerOn() {
  38944. },
  38945. send: function nullHandlerSend() {
  38946. }
  38947. };
  38948. var self = this;
  38949. var pdfManager = this.pdfManager;
  38950. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38951. var resourcesPromise = this.loadResources([
  38952. 'ExtGState',
  38953. 'XObject',
  38954. 'Font'
  38955. ]);
  38956. var dataPromises = Promise.all([
  38957. contentStreamPromise,
  38958. resourcesPromise
  38959. ]);
  38960. return dataPromises.then(function (data) {
  38961. var contentStream = data[0];
  38962. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.evaluatorOptions);
  38963. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38964. });
  38965. },
  38966. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38967. var annotations = this.annotations;
  38968. var annotationsData = [];
  38969. for (var i = 0, n = annotations.length; i < n; ++i) {
  38970. if (intent) {
  38971. if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) {
  38972. continue;
  38973. }
  38974. }
  38975. annotationsData.push(annotations[i].data);
  38976. }
  38977. return annotationsData;
  38978. },
  38979. get annotations() {
  38980. var annotations = [];
  38981. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38982. var annotationFactory = new AnnotationFactory();
  38983. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38984. var annotationRef = annotationRefs[i];
  38985. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38986. if (annotation) {
  38987. annotations.push(annotation);
  38988. }
  38989. }
  38990. return shadow(this, 'annotations', annotations);
  38991. }
  38992. };
  38993. return Page;
  38994. }();
  38995. var PDFDocument = function PDFDocumentClosure() {
  38996. var FINGERPRINT_FIRST_BYTES = 1024;
  38997. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  38998. function PDFDocument(pdfManager, arg) {
  38999. var stream;
  39000. if (isStream(arg)) {
  39001. stream = arg;
  39002. } else if (isArrayBuffer(arg)) {
  39003. stream = new Stream(arg);
  39004. } else {
  39005. error('PDFDocument: Unknown argument type');
  39006. }
  39007. assert(stream.length > 0, 'stream must have data');
  39008. this.pdfManager = pdfManager;
  39009. this.stream = stream;
  39010. this.xref = new XRef(stream, pdfManager);
  39011. }
  39012. function find(stream, needle, limit, backwards) {
  39013. var pos = stream.pos;
  39014. var end = stream.end;
  39015. var strBuf = [];
  39016. if (pos + limit > end) {
  39017. limit = end - pos;
  39018. }
  39019. for (var n = 0; n < limit; ++n) {
  39020. strBuf.push(String.fromCharCode(stream.getByte()));
  39021. }
  39022. var str = strBuf.join('');
  39023. stream.pos = pos;
  39024. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  39025. if (index === -1) {
  39026. return false;
  39027. }
  39028. stream.pos += index;
  39029. return true;
  39030. }
  39031. var DocumentInfoValidators = {
  39032. get entries() {
  39033. return shadow(this, 'entries', {
  39034. Title: isString,
  39035. Author: isString,
  39036. Subject: isString,
  39037. Keywords: isString,
  39038. Creator: isString,
  39039. Producer: isString,
  39040. CreationDate: isString,
  39041. ModDate: isString,
  39042. Trapped: isName
  39043. });
  39044. }
  39045. };
  39046. PDFDocument.prototype = {
  39047. parse: function PDFDocument_parse(recoveryMode) {
  39048. this.setup(recoveryMode);
  39049. var version = this.catalog.catDict.get('Version');
  39050. if (isName(version)) {
  39051. this.pdfFormatVersion = version.name;
  39052. }
  39053. try {
  39054. this.acroForm = this.catalog.catDict.get('AcroForm');
  39055. if (this.acroForm) {
  39056. this.xfa = this.acroForm.get('XFA');
  39057. var fields = this.acroForm.get('Fields');
  39058. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  39059. this.acroForm = null;
  39060. }
  39061. }
  39062. } catch (ex) {
  39063. info('Something wrong with AcroForm entry');
  39064. this.acroForm = null;
  39065. }
  39066. },
  39067. get linearization() {
  39068. var linearization = null;
  39069. if (this.stream.length) {
  39070. try {
  39071. linearization = Linearization.create(this.stream);
  39072. } catch (err) {
  39073. if (err instanceof MissingDataException) {
  39074. throw err;
  39075. }
  39076. info(err);
  39077. }
  39078. }
  39079. return shadow(this, 'linearization', linearization);
  39080. },
  39081. get startXRef() {
  39082. var stream = this.stream;
  39083. var startXRef = 0;
  39084. var linearization = this.linearization;
  39085. if (linearization) {
  39086. stream.reset();
  39087. if (find(stream, 'endobj', 1024)) {
  39088. startXRef = stream.pos + 6;
  39089. }
  39090. } else {
  39091. var step = 1024;
  39092. var found = false, pos = stream.end;
  39093. while (!found && pos > 0) {
  39094. pos -= step - 'startxref'.length;
  39095. if (pos < 0) {
  39096. pos = 0;
  39097. }
  39098. stream.pos = pos;
  39099. found = find(stream, 'startxref', step, true);
  39100. }
  39101. if (found) {
  39102. stream.skip(9);
  39103. var ch;
  39104. do {
  39105. ch = stream.getByte();
  39106. } while (isSpace(ch));
  39107. var str = '';
  39108. while (ch >= 0x20 && ch <= 0x39) {
  39109. str += String.fromCharCode(ch);
  39110. ch = stream.getByte();
  39111. }
  39112. startXRef = parseInt(str, 10);
  39113. if (isNaN(startXRef)) {
  39114. startXRef = 0;
  39115. }
  39116. }
  39117. }
  39118. return shadow(this, 'startXRef', startXRef);
  39119. },
  39120. get mainXRefEntriesOffset() {
  39121. var mainXRefEntriesOffset = 0;
  39122. var linearization = this.linearization;
  39123. if (linearization) {
  39124. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  39125. }
  39126. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  39127. },
  39128. checkHeader: function PDFDocument_checkHeader() {
  39129. var stream = this.stream;
  39130. stream.reset();
  39131. if (find(stream, '%PDF-', 1024)) {
  39132. stream.moveStart();
  39133. var MAX_VERSION_LENGTH = 12;
  39134. var version = '', ch;
  39135. while ((ch = stream.getByte()) > 0x20) {
  39136. if (version.length >= MAX_VERSION_LENGTH) {
  39137. break;
  39138. }
  39139. version += String.fromCharCode(ch);
  39140. }
  39141. if (!this.pdfFormatVersion) {
  39142. this.pdfFormatVersion = version.substring(5);
  39143. }
  39144. return;
  39145. }
  39146. },
  39147. parseStartXRef: function PDFDocument_parseStartXRef() {
  39148. var startXRef = this.startXRef;
  39149. this.xref.setStartXRef(startXRef);
  39150. },
  39151. setup: function PDFDocument_setup(recoveryMode) {
  39152. this.xref.parse(recoveryMode);
  39153. var self = this;
  39154. var pageFactory = {
  39155. createPage: function (pageIndex, dict, ref, fontCache) {
  39156. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache);
  39157. }
  39158. };
  39159. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  39160. },
  39161. get numPages() {
  39162. var linearization = this.linearization;
  39163. var num = linearization ? linearization.numPages : this.catalog.numPages;
  39164. return shadow(this, 'numPages', num);
  39165. },
  39166. get documentInfo() {
  39167. var docInfo = {
  39168. PDFFormatVersion: this.pdfFormatVersion,
  39169. IsAcroFormPresent: !!this.acroForm,
  39170. IsXFAPresent: !!this.xfa
  39171. };
  39172. var infoDict;
  39173. try {
  39174. infoDict = this.xref.trailer.get('Info');
  39175. } catch (err) {
  39176. info('The document information dictionary is invalid.');
  39177. }
  39178. if (infoDict) {
  39179. var validEntries = DocumentInfoValidators.entries;
  39180. for (var key in validEntries) {
  39181. if (infoDict.has(key)) {
  39182. var value = infoDict.get(key);
  39183. if (validEntries[key](value)) {
  39184. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  39185. } else {
  39186. info('Bad value in document info for "' + key + '"');
  39187. }
  39188. }
  39189. }
  39190. }
  39191. return shadow(this, 'documentInfo', docInfo);
  39192. },
  39193. get fingerprint() {
  39194. var xref = this.xref, hash, fileID = '';
  39195. var idArray = xref.trailer.get('ID');
  39196. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  39197. hash = stringToBytes(idArray[0]);
  39198. } else {
  39199. if (this.stream.ensureRange) {
  39200. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  39201. }
  39202. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  39203. }
  39204. for (var i = 0, n = hash.length; i < n; i++) {
  39205. var hex = hash[i].toString(16);
  39206. fileID += hex.length === 1 ? '0' + hex : hex;
  39207. }
  39208. return shadow(this, 'fingerprint', fileID);
  39209. },
  39210. getPage: function PDFDocument_getPage(pageIndex) {
  39211. return this.catalog.getPage(pageIndex);
  39212. },
  39213. cleanup: function PDFDocument_cleanup() {
  39214. return this.catalog.cleanup();
  39215. }
  39216. };
  39217. return PDFDocument;
  39218. }();
  39219. exports.Page = Page;
  39220. exports.PDFDocument = PDFDocument;
  39221. /***/ }),
  39222. /* 25 */
  39223. /***/ (function(module, exports, __w_pdfjs_require__) {
  39224. "use strict";
  39225. var sharedUtil = __w_pdfjs_require__(0);
  39226. var coreStream = __w_pdfjs_require__(2);
  39227. var coreGlyphList = __w_pdfjs_require__(7);
  39228. var coreEncodings = __w_pdfjs_require__(4);
  39229. var coreCFFParser = __w_pdfjs_require__(10);
  39230. var Util = sharedUtil.Util;
  39231. var bytesToString = sharedUtil.bytesToString;
  39232. var error = sharedUtil.error;
  39233. var Stream = coreStream.Stream;
  39234. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39235. var StandardEncoding = coreEncodings.StandardEncoding;
  39236. var CFFParser = coreCFFParser.CFFParser;
  39237. var FontRendererFactory = function FontRendererFactoryClosure() {
  39238. function getLong(data, offset) {
  39239. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39240. }
  39241. function getUshort(data, offset) {
  39242. return data[offset] << 8 | data[offset + 1];
  39243. }
  39244. function parseCmap(data, start, end) {
  39245. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39246. var format = getUshort(data, start + offset);
  39247. var ranges, p, i;
  39248. if (format === 4) {
  39249. getUshort(data, start + offset + 2);
  39250. var segCount = getUshort(data, start + offset + 6) >> 1;
  39251. p = start + offset + 14;
  39252. ranges = [];
  39253. for (i = 0; i < segCount; i++, p += 2) {
  39254. ranges[i] = { end: getUshort(data, p) };
  39255. }
  39256. p += 2;
  39257. for (i = 0; i < segCount; i++, p += 2) {
  39258. ranges[i].start = getUshort(data, p);
  39259. }
  39260. for (i = 0; i < segCount; i++, p += 2) {
  39261. ranges[i].idDelta = getUshort(data, p);
  39262. }
  39263. for (i = 0; i < segCount; i++, p += 2) {
  39264. var idOffset = getUshort(data, p);
  39265. if (idOffset === 0) {
  39266. continue;
  39267. }
  39268. ranges[i].ids = [];
  39269. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39270. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39271. idOffset += 2;
  39272. }
  39273. }
  39274. return ranges;
  39275. } else if (format === 12) {
  39276. getLong(data, start + offset + 4);
  39277. var groups = getLong(data, start + offset + 12);
  39278. p = start + offset + 16;
  39279. ranges = [];
  39280. for (i = 0; i < groups; i++) {
  39281. ranges.push({
  39282. start: getLong(data, p),
  39283. end: getLong(data, p + 4),
  39284. idDelta: getLong(data, p + 8) - getLong(data, p)
  39285. });
  39286. p += 12;
  39287. }
  39288. return ranges;
  39289. }
  39290. error('not supported cmap: ' + format);
  39291. }
  39292. function parseCff(data, start, end, seacAnalysisEnabled) {
  39293. var properties = {};
  39294. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39295. var cff = parser.parse();
  39296. return {
  39297. glyphs: cff.charStrings.objects,
  39298. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39299. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  39300. };
  39301. }
  39302. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39303. var itemSize, itemDecode;
  39304. if (isGlyphLocationsLong) {
  39305. itemSize = 4;
  39306. itemDecode = function fontItemDecodeLong(data, offset) {
  39307. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39308. };
  39309. } else {
  39310. itemSize = 2;
  39311. itemDecode = function fontItemDecode(data, offset) {
  39312. return data[offset] << 9 | data[offset + 1] << 1;
  39313. };
  39314. }
  39315. var glyphs = [];
  39316. var startOffset = itemDecode(loca, 0);
  39317. for (var j = itemSize; j < loca.length; j += itemSize) {
  39318. var endOffset = itemDecode(loca, j);
  39319. glyphs.push(glyf.subarray(startOffset, endOffset));
  39320. startOffset = endOffset;
  39321. }
  39322. return glyphs;
  39323. }
  39324. function lookupCmap(ranges, unicode) {
  39325. var code = unicode.charCodeAt(0), gid = 0;
  39326. var l = 0, r = ranges.length - 1;
  39327. while (l < r) {
  39328. var c = l + r + 1 >> 1;
  39329. if (code < ranges[c].start) {
  39330. r = c - 1;
  39331. } else {
  39332. l = c;
  39333. }
  39334. }
  39335. if (ranges[l].start <= code && code <= ranges[l].end) {
  39336. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  39337. }
  39338. return {
  39339. charCode: code,
  39340. glyphId: gid
  39341. };
  39342. }
  39343. function compileGlyf(code, cmds, font) {
  39344. function moveTo(x, y) {
  39345. cmds.push({
  39346. cmd: 'moveTo',
  39347. args: [
  39348. x,
  39349. y
  39350. ]
  39351. });
  39352. }
  39353. function lineTo(x, y) {
  39354. cmds.push({
  39355. cmd: 'lineTo',
  39356. args: [
  39357. x,
  39358. y
  39359. ]
  39360. });
  39361. }
  39362. function quadraticCurveTo(xa, ya, x, y) {
  39363. cmds.push({
  39364. cmd: 'quadraticCurveTo',
  39365. args: [
  39366. xa,
  39367. ya,
  39368. x,
  39369. y
  39370. ]
  39371. });
  39372. }
  39373. var i = 0;
  39374. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39375. var flags;
  39376. var x = 0, y = 0;
  39377. i += 10;
  39378. if (numberOfContours < 0) {
  39379. do {
  39380. flags = code[i] << 8 | code[i + 1];
  39381. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  39382. i += 4;
  39383. var arg1, arg2;
  39384. if (flags & 0x01) {
  39385. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39386. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39387. i += 4;
  39388. } else {
  39389. arg1 = code[i++];
  39390. arg2 = code[i++];
  39391. }
  39392. if (flags & 0x02) {
  39393. x = arg1;
  39394. y = arg2;
  39395. } else {
  39396. x = 0;
  39397. y = 0;
  39398. }
  39399. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  39400. if (flags & 0x08) {
  39401. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39402. i += 2;
  39403. } else if (flags & 0x40) {
  39404. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39405. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39406. i += 4;
  39407. } else if (flags & 0x80) {
  39408. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39409. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39410. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39411. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39412. i += 8;
  39413. }
  39414. var subglyph = font.glyphs[glyphIndex];
  39415. if (subglyph) {
  39416. cmds.push({ cmd: 'save' });
  39417. cmds.push({
  39418. cmd: 'transform',
  39419. args: [
  39420. scaleX,
  39421. scale01,
  39422. scale10,
  39423. scaleY,
  39424. x,
  39425. y
  39426. ]
  39427. });
  39428. compileGlyf(subglyph, cmds, font);
  39429. cmds.push({ cmd: 'restore' });
  39430. }
  39431. } while (flags & 0x20);
  39432. } else {
  39433. var endPtsOfContours = [];
  39434. var j, jj;
  39435. for (j = 0; j < numberOfContours; j++) {
  39436. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39437. i += 2;
  39438. }
  39439. var instructionLength = code[i] << 8 | code[i + 1];
  39440. i += 2 + instructionLength;
  39441. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39442. var points = [];
  39443. while (points.length < numberOfPoints) {
  39444. flags = code[i++];
  39445. var repeat = 1;
  39446. if (flags & 0x08) {
  39447. repeat += code[i++];
  39448. }
  39449. while (repeat-- > 0) {
  39450. points.push({ flags: flags });
  39451. }
  39452. }
  39453. for (j = 0; j < numberOfPoints; j++) {
  39454. switch (points[j].flags & 0x12) {
  39455. case 0x00:
  39456. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39457. i += 2;
  39458. break;
  39459. case 0x02:
  39460. x -= code[i++];
  39461. break;
  39462. case 0x12:
  39463. x += code[i++];
  39464. break;
  39465. }
  39466. points[j].x = x;
  39467. }
  39468. for (j = 0; j < numberOfPoints; j++) {
  39469. switch (points[j].flags & 0x24) {
  39470. case 0x00:
  39471. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39472. i += 2;
  39473. break;
  39474. case 0x04:
  39475. y -= code[i++];
  39476. break;
  39477. case 0x24:
  39478. y += code[i++];
  39479. break;
  39480. }
  39481. points[j].y = y;
  39482. }
  39483. var startPoint = 0;
  39484. for (i = 0; i < numberOfContours; i++) {
  39485. var endPoint = endPtsOfContours[i];
  39486. var contour = points.slice(startPoint, endPoint + 1);
  39487. if (contour[0].flags & 1) {
  39488. contour.push(contour[0]);
  39489. } else if (contour[contour.length - 1].flags & 1) {
  39490. contour.unshift(contour[contour.length - 1]);
  39491. } else {
  39492. var p = {
  39493. flags: 1,
  39494. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39495. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39496. };
  39497. contour.unshift(p);
  39498. contour.push(p);
  39499. }
  39500. moveTo(contour[0].x, contour[0].y);
  39501. for (j = 1, jj = contour.length; j < jj; j++) {
  39502. if (contour[j].flags & 1) {
  39503. lineTo(contour[j].x, contour[j].y);
  39504. } else if (contour[j + 1].flags & 1) {
  39505. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39506. j++;
  39507. } else {
  39508. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39509. }
  39510. }
  39511. startPoint = endPoint + 1;
  39512. }
  39513. }
  39514. }
  39515. function compileCharString(code, cmds, font) {
  39516. var stack = [];
  39517. var x = 0, y = 0;
  39518. var stems = 0;
  39519. function moveTo(x, y) {
  39520. cmds.push({
  39521. cmd: 'moveTo',
  39522. args: [
  39523. x,
  39524. y
  39525. ]
  39526. });
  39527. }
  39528. function lineTo(x, y) {
  39529. cmds.push({
  39530. cmd: 'lineTo',
  39531. args: [
  39532. x,
  39533. y
  39534. ]
  39535. });
  39536. }
  39537. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39538. cmds.push({
  39539. cmd: 'bezierCurveTo',
  39540. args: [
  39541. x1,
  39542. y1,
  39543. x2,
  39544. y2,
  39545. x,
  39546. y
  39547. ]
  39548. });
  39549. }
  39550. function parse(code) {
  39551. var i = 0;
  39552. while (i < code.length) {
  39553. var stackClean = false;
  39554. var v = code[i++];
  39555. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39556. switch (v) {
  39557. case 1:
  39558. stems += stack.length >> 1;
  39559. stackClean = true;
  39560. break;
  39561. case 3:
  39562. stems += stack.length >> 1;
  39563. stackClean = true;
  39564. break;
  39565. case 4:
  39566. y += stack.pop();
  39567. moveTo(x, y);
  39568. stackClean = true;
  39569. break;
  39570. case 5:
  39571. while (stack.length > 0) {
  39572. x += stack.shift();
  39573. y += stack.shift();
  39574. lineTo(x, y);
  39575. }
  39576. break;
  39577. case 6:
  39578. while (stack.length > 0) {
  39579. x += stack.shift();
  39580. lineTo(x, y);
  39581. if (stack.length === 0) {
  39582. break;
  39583. }
  39584. y += stack.shift();
  39585. lineTo(x, y);
  39586. }
  39587. break;
  39588. case 7:
  39589. while (stack.length > 0) {
  39590. y += stack.shift();
  39591. lineTo(x, y);
  39592. if (stack.length === 0) {
  39593. break;
  39594. }
  39595. x += stack.shift();
  39596. lineTo(x, y);
  39597. }
  39598. break;
  39599. case 8:
  39600. while (stack.length > 0) {
  39601. xa = x + stack.shift();
  39602. ya = y + stack.shift();
  39603. xb = xa + stack.shift();
  39604. yb = ya + stack.shift();
  39605. x = xb + stack.shift();
  39606. y = yb + stack.shift();
  39607. bezierCurveTo(xa, ya, xb, yb, x, y);
  39608. }
  39609. break;
  39610. case 10:
  39611. n = stack.pop() + font.subrsBias;
  39612. subrCode = font.subrs[n];
  39613. if (subrCode) {
  39614. parse(subrCode);
  39615. }
  39616. break;
  39617. case 11:
  39618. return;
  39619. case 12:
  39620. v = code[i++];
  39621. switch (v) {
  39622. case 34:
  39623. xa = x + stack.shift();
  39624. xb = xa + stack.shift();
  39625. y1 = y + stack.shift();
  39626. x = xb + stack.shift();
  39627. bezierCurveTo(xa, y, xb, y1, x, y1);
  39628. xa = x + stack.shift();
  39629. xb = xa + stack.shift();
  39630. x = xb + stack.shift();
  39631. bezierCurveTo(xa, y1, xb, y, x, y);
  39632. break;
  39633. case 35:
  39634. xa = x + stack.shift();
  39635. ya = y + stack.shift();
  39636. xb = xa + stack.shift();
  39637. yb = ya + stack.shift();
  39638. x = xb + stack.shift();
  39639. y = yb + stack.shift();
  39640. bezierCurveTo(xa, ya, xb, yb, x, y);
  39641. xa = x + stack.shift();
  39642. ya = y + stack.shift();
  39643. xb = xa + stack.shift();
  39644. yb = ya + stack.shift();
  39645. x = xb + stack.shift();
  39646. y = yb + stack.shift();
  39647. bezierCurveTo(xa, ya, xb, yb, x, y);
  39648. stack.pop();
  39649. break;
  39650. case 36:
  39651. xa = x + stack.shift();
  39652. y1 = y + stack.shift();
  39653. xb = xa + stack.shift();
  39654. y2 = y1 + stack.shift();
  39655. x = xb + stack.shift();
  39656. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39657. xa = x + stack.shift();
  39658. xb = xa + stack.shift();
  39659. y3 = y2 + stack.shift();
  39660. x = xb + stack.shift();
  39661. bezierCurveTo(xa, y2, xb, y3, x, y);
  39662. break;
  39663. case 37:
  39664. var x0 = x, y0 = y;
  39665. xa = x + stack.shift();
  39666. ya = y + stack.shift();
  39667. xb = xa + stack.shift();
  39668. yb = ya + stack.shift();
  39669. x = xb + stack.shift();
  39670. y = yb + stack.shift();
  39671. bezierCurveTo(xa, ya, xb, yb, x, y);
  39672. xa = x + stack.shift();
  39673. ya = y + stack.shift();
  39674. xb = xa + stack.shift();
  39675. yb = ya + stack.shift();
  39676. x = xb;
  39677. y = yb;
  39678. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39679. x += stack.shift();
  39680. } else {
  39681. y += stack.shift();
  39682. }
  39683. bezierCurveTo(xa, ya, xb, yb, x, y);
  39684. break;
  39685. default:
  39686. error('unknown operator: 12 ' + v);
  39687. }
  39688. break;
  39689. case 14:
  39690. if (stack.length >= 4) {
  39691. var achar = stack.pop();
  39692. var bchar = stack.pop();
  39693. y = stack.pop();
  39694. x = stack.pop();
  39695. cmds.push({ cmd: 'save' });
  39696. cmds.push({
  39697. cmd: 'translate',
  39698. args: [
  39699. x,
  39700. y
  39701. ]
  39702. });
  39703. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  39704. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39705. cmds.push({ cmd: 'restore' });
  39706. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  39707. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39708. }
  39709. return;
  39710. case 18:
  39711. stems += stack.length >> 1;
  39712. stackClean = true;
  39713. break;
  39714. case 19:
  39715. stems += stack.length >> 1;
  39716. i += stems + 7 >> 3;
  39717. stackClean = true;
  39718. break;
  39719. case 20:
  39720. stems += stack.length >> 1;
  39721. i += stems + 7 >> 3;
  39722. stackClean = true;
  39723. break;
  39724. case 21:
  39725. y += stack.pop();
  39726. x += stack.pop();
  39727. moveTo(x, y);
  39728. stackClean = true;
  39729. break;
  39730. case 22:
  39731. x += stack.pop();
  39732. moveTo(x, y);
  39733. stackClean = true;
  39734. break;
  39735. case 23:
  39736. stems += stack.length >> 1;
  39737. stackClean = true;
  39738. break;
  39739. case 24:
  39740. while (stack.length > 2) {
  39741. xa = x + stack.shift();
  39742. ya = y + stack.shift();
  39743. xb = xa + stack.shift();
  39744. yb = ya + stack.shift();
  39745. x = xb + stack.shift();
  39746. y = yb + stack.shift();
  39747. bezierCurveTo(xa, ya, xb, yb, x, y);
  39748. }
  39749. x += stack.shift();
  39750. y += stack.shift();
  39751. lineTo(x, y);
  39752. break;
  39753. case 25:
  39754. while (stack.length > 6) {
  39755. x += stack.shift();
  39756. y += stack.shift();
  39757. lineTo(x, y);
  39758. }
  39759. xa = x + stack.shift();
  39760. ya = y + stack.shift();
  39761. xb = xa + stack.shift();
  39762. yb = ya + stack.shift();
  39763. x = xb + stack.shift();
  39764. y = yb + stack.shift();
  39765. bezierCurveTo(xa, ya, xb, yb, x, y);
  39766. break;
  39767. case 26:
  39768. if (stack.length % 2) {
  39769. x += stack.shift();
  39770. }
  39771. while (stack.length > 0) {
  39772. xa = x;
  39773. ya = y + stack.shift();
  39774. xb = xa + stack.shift();
  39775. yb = ya + stack.shift();
  39776. x = xb;
  39777. y = yb + stack.shift();
  39778. bezierCurveTo(xa, ya, xb, yb, x, y);
  39779. }
  39780. break;
  39781. case 27:
  39782. if (stack.length % 2) {
  39783. y += stack.shift();
  39784. }
  39785. while (stack.length > 0) {
  39786. xa = x + stack.shift();
  39787. ya = y;
  39788. xb = xa + stack.shift();
  39789. yb = ya + stack.shift();
  39790. x = xb + stack.shift();
  39791. y = yb;
  39792. bezierCurveTo(xa, ya, xb, yb, x, y);
  39793. }
  39794. break;
  39795. case 28:
  39796. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39797. i += 2;
  39798. break;
  39799. case 29:
  39800. n = stack.pop() + font.gsubrsBias;
  39801. subrCode = font.gsubrs[n];
  39802. if (subrCode) {
  39803. parse(subrCode);
  39804. }
  39805. break;
  39806. case 30:
  39807. while (stack.length > 0) {
  39808. xa = x;
  39809. ya = y + stack.shift();
  39810. xb = xa + stack.shift();
  39811. yb = ya + stack.shift();
  39812. x = xb + stack.shift();
  39813. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39814. bezierCurveTo(xa, ya, xb, yb, x, y);
  39815. if (stack.length === 0) {
  39816. break;
  39817. }
  39818. xa = x + stack.shift();
  39819. ya = y;
  39820. xb = xa + stack.shift();
  39821. yb = ya + stack.shift();
  39822. y = yb + stack.shift();
  39823. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39824. bezierCurveTo(xa, ya, xb, yb, x, y);
  39825. }
  39826. break;
  39827. case 31:
  39828. while (stack.length > 0) {
  39829. xa = x + stack.shift();
  39830. ya = y;
  39831. xb = xa + stack.shift();
  39832. yb = ya + stack.shift();
  39833. y = yb + stack.shift();
  39834. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39835. bezierCurveTo(xa, ya, xb, yb, x, y);
  39836. if (stack.length === 0) {
  39837. break;
  39838. }
  39839. xa = x;
  39840. ya = y + stack.shift();
  39841. xb = xa + stack.shift();
  39842. yb = ya + stack.shift();
  39843. x = xb + stack.shift();
  39844. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39845. bezierCurveTo(xa, ya, xb, yb, x, y);
  39846. }
  39847. break;
  39848. default:
  39849. if (v < 32) {
  39850. error('unknown operator: ' + v);
  39851. }
  39852. if (v < 247) {
  39853. stack.push(v - 139);
  39854. } else if (v < 251) {
  39855. stack.push((v - 247) * 256 + code[i++] + 108);
  39856. } else if (v < 255) {
  39857. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39858. } else {
  39859. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39860. i += 4;
  39861. }
  39862. break;
  39863. }
  39864. if (stackClean) {
  39865. stack.length = 0;
  39866. }
  39867. }
  39868. }
  39869. parse(code);
  39870. }
  39871. var noop = '';
  39872. function CompiledFont(fontMatrix) {
  39873. this.compiledGlyphs = Object.create(null);
  39874. this.compiledCharCodeToGlyphId = Object.create(null);
  39875. this.fontMatrix = fontMatrix;
  39876. }
  39877. CompiledFont.prototype = {
  39878. getPathJs: function (unicode) {
  39879. var cmap = lookupCmap(this.cmap, unicode);
  39880. var fn = this.compiledGlyphs[cmap.glyphId];
  39881. if (!fn) {
  39882. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39883. this.compiledGlyphs[cmap.glyphId] = fn;
  39884. }
  39885. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39886. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39887. }
  39888. return fn;
  39889. },
  39890. compileGlyph: function (code) {
  39891. if (!code || code.length === 0 || code[0] === 14) {
  39892. return noop;
  39893. }
  39894. var cmds = [];
  39895. cmds.push({ cmd: 'save' });
  39896. cmds.push({
  39897. cmd: 'transform',
  39898. args: this.fontMatrix.slice()
  39899. });
  39900. cmds.push({
  39901. cmd: 'scale',
  39902. args: [
  39903. 'size',
  39904. '-size'
  39905. ]
  39906. });
  39907. this.compileGlyphImpl(code, cmds);
  39908. cmds.push({ cmd: 'restore' });
  39909. return cmds;
  39910. },
  39911. compileGlyphImpl: function () {
  39912. error('Children classes should implement this.');
  39913. },
  39914. hasBuiltPath: function (unicode) {
  39915. var cmap = lookupCmap(this.cmap, unicode);
  39916. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39917. }
  39918. };
  39919. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39920. fontMatrix = fontMatrix || [
  39921. 0.000488,
  39922. 0,
  39923. 0,
  39924. 0.000488,
  39925. 0,
  39926. 0
  39927. ];
  39928. CompiledFont.call(this, fontMatrix);
  39929. this.glyphs = glyphs;
  39930. this.cmap = cmap;
  39931. }
  39932. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39933. compileGlyphImpl: function (code, cmds) {
  39934. compileGlyf(code, cmds, this);
  39935. }
  39936. });
  39937. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39938. fontMatrix = fontMatrix || [
  39939. 0.001,
  39940. 0,
  39941. 0,
  39942. 0.001,
  39943. 0,
  39944. 0
  39945. ];
  39946. CompiledFont.call(this, fontMatrix);
  39947. this.glyphs = cffInfo.glyphs;
  39948. this.gsubrs = cffInfo.gsubrs || [];
  39949. this.subrs = cffInfo.subrs || [];
  39950. this.cmap = cmap;
  39951. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39952. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39953. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39954. }
  39955. Util.inherit(Type2Compiled, CompiledFont, {
  39956. compileGlyphImpl: function (code, cmds) {
  39957. compileCharString(code, cmds, this);
  39958. }
  39959. });
  39960. return {
  39961. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39962. var data = new Uint8Array(font.data);
  39963. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39964. var numTables = getUshort(data, 4);
  39965. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39966. var tag = bytesToString(data.subarray(p, p + 4));
  39967. var offset = getLong(data, p + 8);
  39968. var length = getLong(data, p + 12);
  39969. switch (tag) {
  39970. case 'cmap':
  39971. cmap = parseCmap(data, offset, offset + length);
  39972. break;
  39973. case 'glyf':
  39974. glyf = data.subarray(offset, offset + length);
  39975. break;
  39976. case 'loca':
  39977. loca = data.subarray(offset, offset + length);
  39978. break;
  39979. case 'head':
  39980. unitsPerEm = getUshort(data, offset + 18);
  39981. indexToLocFormat = getUshort(data, offset + 50);
  39982. break;
  39983. case 'CFF ':
  39984. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39985. break;
  39986. }
  39987. }
  39988. if (glyf) {
  39989. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39990. 1 / unitsPerEm,
  39991. 0,
  39992. 0,
  39993. 1 / unitsPerEm,
  39994. 0,
  39995. 0
  39996. ];
  39997. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39998. }
  39999. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  40000. }
  40001. };
  40002. }();
  40003. exports.FontRendererFactory = FontRendererFactory;
  40004. /***/ }),
  40005. /* 26 */
  40006. /***/ (function(module, exports, __w_pdfjs_require__) {
  40007. "use strict";
  40008. var sharedUtil = __w_pdfjs_require__(0);
  40009. var corePrimitives = __w_pdfjs_require__(1);
  40010. var coreStream = __w_pdfjs_require__(2);
  40011. var coreGlyphList = __w_pdfjs_require__(7);
  40012. var coreFontRenderer = __w_pdfjs_require__(25);
  40013. var coreEncodings = __w_pdfjs_require__(4);
  40014. var coreStandardFonts = __w_pdfjs_require__(16);
  40015. var coreUnicode = __w_pdfjs_require__(17);
  40016. var coreType1Parser = __w_pdfjs_require__(35);
  40017. var coreCFFParser = __w_pdfjs_require__(10);
  40018. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  40019. var FontType = sharedUtil.FontType;
  40020. var assert = sharedUtil.assert;
  40021. var bytesToString = sharedUtil.bytesToString;
  40022. var error = sharedUtil.error;
  40023. var info = sharedUtil.info;
  40024. var isArray = sharedUtil.isArray;
  40025. var isInt = sharedUtil.isInt;
  40026. var isNum = sharedUtil.isNum;
  40027. var readUint32 = sharedUtil.readUint32;
  40028. var shadow = sharedUtil.shadow;
  40029. var string32 = sharedUtil.string32;
  40030. var warn = sharedUtil.warn;
  40031. var MissingDataException = sharedUtil.MissingDataException;
  40032. var isSpace = sharedUtil.isSpace;
  40033. var Stream = coreStream.Stream;
  40034. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  40035. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  40036. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  40037. var StandardEncoding = coreEncodings.StandardEncoding;
  40038. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  40039. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  40040. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  40041. var getEncoding = coreEncodings.getEncoding;
  40042. var getStdFontMap = coreStandardFonts.getStdFontMap;
  40043. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  40044. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  40045. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  40046. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  40047. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  40048. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  40049. var Type1Parser = coreType1Parser.Type1Parser;
  40050. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  40051. var CFFParser = coreCFFParser.CFFParser;
  40052. var CFFCompiler = coreCFFParser.CFFCompiler;
  40053. var CFF = coreCFFParser.CFF;
  40054. var CFFHeader = coreCFFParser.CFFHeader;
  40055. var CFFTopDict = coreCFFParser.CFFTopDict;
  40056. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  40057. var CFFStrings = coreCFFParser.CFFStrings;
  40058. var CFFIndex = coreCFFParser.CFFIndex;
  40059. var CFFCharset = coreCFFParser.CFFCharset;
  40060. var PRIVATE_USE_OFFSET_START = 0xE000;
  40061. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  40062. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  40063. var PDF_GLYPH_SPACE_UNITS = 1000;
  40064. var SEAC_ANALYSIS_ENABLED = false;
  40065. var FontFlags = {
  40066. FixedPitch: 1,
  40067. Serif: 2,
  40068. Symbolic: 4,
  40069. Script: 8,
  40070. Nonsymbolic: 32,
  40071. Italic: 64,
  40072. AllCap: 65536,
  40073. SmallCap: 131072,
  40074. ForceBold: 262144
  40075. };
  40076. var MacStandardGlyphOrdering = [
  40077. '.notdef',
  40078. '.null',
  40079. 'nonmarkingreturn',
  40080. 'space',
  40081. 'exclam',
  40082. 'quotedbl',
  40083. 'numbersign',
  40084. 'dollar',
  40085. 'percent',
  40086. 'ampersand',
  40087. 'quotesingle',
  40088. 'parenleft',
  40089. 'parenright',
  40090. 'asterisk',
  40091. 'plus',
  40092. 'comma',
  40093. 'hyphen',
  40094. 'period',
  40095. 'slash',
  40096. 'zero',
  40097. 'one',
  40098. 'two',
  40099. 'three',
  40100. 'four',
  40101. 'five',
  40102. 'six',
  40103. 'seven',
  40104. 'eight',
  40105. 'nine',
  40106. 'colon',
  40107. 'semicolon',
  40108. 'less',
  40109. 'equal',
  40110. 'greater',
  40111. 'question',
  40112. 'at',
  40113. 'A',
  40114. 'B',
  40115. 'C',
  40116. 'D',
  40117. 'E',
  40118. 'F',
  40119. 'G',
  40120. 'H',
  40121. 'I',
  40122. 'J',
  40123. 'K',
  40124. 'L',
  40125. 'M',
  40126. 'N',
  40127. 'O',
  40128. 'P',
  40129. 'Q',
  40130. 'R',
  40131. 'S',
  40132. 'T',
  40133. 'U',
  40134. 'V',
  40135. 'W',
  40136. 'X',
  40137. 'Y',
  40138. 'Z',
  40139. 'bracketleft',
  40140. 'backslash',
  40141. 'bracketright',
  40142. 'asciicircum',
  40143. 'underscore',
  40144. 'grave',
  40145. 'a',
  40146. 'b',
  40147. 'c',
  40148. 'd',
  40149. 'e',
  40150. 'f',
  40151. 'g',
  40152. 'h',
  40153. 'i',
  40154. 'j',
  40155. 'k',
  40156. 'l',
  40157. 'm',
  40158. 'n',
  40159. 'o',
  40160. 'p',
  40161. 'q',
  40162. 'r',
  40163. 's',
  40164. 't',
  40165. 'u',
  40166. 'v',
  40167. 'w',
  40168. 'x',
  40169. 'y',
  40170. 'z',
  40171. 'braceleft',
  40172. 'bar',
  40173. 'braceright',
  40174. 'asciitilde',
  40175. 'Adieresis',
  40176. 'Aring',
  40177. 'Ccedilla',
  40178. 'Eacute',
  40179. 'Ntilde',
  40180. 'Odieresis',
  40181. 'Udieresis',
  40182. 'aacute',
  40183. 'agrave',
  40184. 'acircumflex',
  40185. 'adieresis',
  40186. 'atilde',
  40187. 'aring',
  40188. 'ccedilla',
  40189. 'eacute',
  40190. 'egrave',
  40191. 'ecircumflex',
  40192. 'edieresis',
  40193. 'iacute',
  40194. 'igrave',
  40195. 'icircumflex',
  40196. 'idieresis',
  40197. 'ntilde',
  40198. 'oacute',
  40199. 'ograve',
  40200. 'ocircumflex',
  40201. 'odieresis',
  40202. 'otilde',
  40203. 'uacute',
  40204. 'ugrave',
  40205. 'ucircumflex',
  40206. 'udieresis',
  40207. 'dagger',
  40208. 'degree',
  40209. 'cent',
  40210. 'sterling',
  40211. 'section',
  40212. 'bullet',
  40213. 'paragraph',
  40214. 'germandbls',
  40215. 'registered',
  40216. 'copyright',
  40217. 'trademark',
  40218. 'acute',
  40219. 'dieresis',
  40220. 'notequal',
  40221. 'AE',
  40222. 'Oslash',
  40223. 'infinity',
  40224. 'plusminus',
  40225. 'lessequal',
  40226. 'greaterequal',
  40227. 'yen',
  40228. 'mu',
  40229. 'partialdiff',
  40230. 'summation',
  40231. 'product',
  40232. 'pi',
  40233. 'integral',
  40234. 'ordfeminine',
  40235. 'ordmasculine',
  40236. 'Omega',
  40237. 'ae',
  40238. 'oslash',
  40239. 'questiondown',
  40240. 'exclamdown',
  40241. 'logicalnot',
  40242. 'radical',
  40243. 'florin',
  40244. 'approxequal',
  40245. 'Delta',
  40246. 'guillemotleft',
  40247. 'guillemotright',
  40248. 'ellipsis',
  40249. 'nonbreakingspace',
  40250. 'Agrave',
  40251. 'Atilde',
  40252. 'Otilde',
  40253. 'OE',
  40254. 'oe',
  40255. 'endash',
  40256. 'emdash',
  40257. 'quotedblleft',
  40258. 'quotedblright',
  40259. 'quoteleft',
  40260. 'quoteright',
  40261. 'divide',
  40262. 'lozenge',
  40263. 'ydieresis',
  40264. 'Ydieresis',
  40265. 'fraction',
  40266. 'currency',
  40267. 'guilsinglleft',
  40268. 'guilsinglright',
  40269. 'fi',
  40270. 'fl',
  40271. 'daggerdbl',
  40272. 'periodcentered',
  40273. 'quotesinglbase',
  40274. 'quotedblbase',
  40275. 'perthousand',
  40276. 'Acircumflex',
  40277. 'Ecircumflex',
  40278. 'Aacute',
  40279. 'Edieresis',
  40280. 'Egrave',
  40281. 'Iacute',
  40282. 'Icircumflex',
  40283. 'Idieresis',
  40284. 'Igrave',
  40285. 'Oacute',
  40286. 'Ocircumflex',
  40287. 'apple',
  40288. 'Ograve',
  40289. 'Uacute',
  40290. 'Ucircumflex',
  40291. 'Ugrave',
  40292. 'dotlessi',
  40293. 'circumflex',
  40294. 'tilde',
  40295. 'macron',
  40296. 'breve',
  40297. 'dotaccent',
  40298. 'ring',
  40299. 'cedilla',
  40300. 'hungarumlaut',
  40301. 'ogonek',
  40302. 'caron',
  40303. 'Lslash',
  40304. 'lslash',
  40305. 'Scaron',
  40306. 'scaron',
  40307. 'Zcaron',
  40308. 'zcaron',
  40309. 'brokenbar',
  40310. 'Eth',
  40311. 'eth',
  40312. 'Yacute',
  40313. 'yacute',
  40314. 'Thorn',
  40315. 'thorn',
  40316. 'minus',
  40317. 'multiply',
  40318. 'onesuperior',
  40319. 'twosuperior',
  40320. 'threesuperior',
  40321. 'onehalf',
  40322. 'onequarter',
  40323. 'threequarters',
  40324. 'franc',
  40325. 'Gbreve',
  40326. 'gbreve',
  40327. 'Idotaccent',
  40328. 'Scedilla',
  40329. 'scedilla',
  40330. 'Cacute',
  40331. 'cacute',
  40332. 'Ccaron',
  40333. 'ccaron',
  40334. 'dcroat'
  40335. ];
  40336. function adjustWidths(properties) {
  40337. if (!properties.fontMatrix) {
  40338. return;
  40339. }
  40340. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  40341. return;
  40342. }
  40343. var scale = 0.001 / properties.fontMatrix[0];
  40344. var glyphsWidths = properties.widths;
  40345. for (var glyph in glyphsWidths) {
  40346. glyphsWidths[glyph] *= scale;
  40347. }
  40348. properties.defaultWidth *= scale;
  40349. }
  40350. function adjustToUnicode(properties, builtInEncoding) {
  40351. if (properties.hasIncludedToUnicodeMap) {
  40352. return;
  40353. }
  40354. if (properties.hasEncoding) {
  40355. return;
  40356. }
  40357. if (builtInEncoding === properties.defaultEncoding) {
  40358. return;
  40359. }
  40360. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  40361. return;
  40362. }
  40363. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  40364. for (var charCode in builtInEncoding) {
  40365. var glyphName = builtInEncoding[charCode];
  40366. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40367. if (unicode !== -1) {
  40368. toUnicode[charCode] = String.fromCharCode(unicode);
  40369. }
  40370. }
  40371. properties.toUnicode.amend(toUnicode);
  40372. }
  40373. function getFontType(type, subtype) {
  40374. switch (type) {
  40375. case 'Type1':
  40376. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  40377. case 'CIDFontType0':
  40378. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  40379. case 'OpenType':
  40380. return FontType.OPENTYPE;
  40381. case 'TrueType':
  40382. return FontType.TRUETYPE;
  40383. case 'CIDFontType2':
  40384. return FontType.CIDFONTTYPE2;
  40385. case 'MMType1':
  40386. return FontType.MMTYPE1;
  40387. case 'Type0':
  40388. return FontType.TYPE0;
  40389. default:
  40390. return FontType.UNKNOWN;
  40391. }
  40392. }
  40393. function recoverGlyphName(name, glyphsUnicodeMap) {
  40394. if (glyphsUnicodeMap[name] !== undefined) {
  40395. return name;
  40396. }
  40397. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  40398. if (unicode !== -1) {
  40399. for (var key in glyphsUnicodeMap) {
  40400. if (glyphsUnicodeMap[key] === unicode) {
  40401. return key;
  40402. }
  40403. }
  40404. }
  40405. info('Unable to recover a standard glyph name for: ' + name);
  40406. return name;
  40407. }
  40408. var Glyph = function GlyphClosure() {
  40409. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40410. this.fontChar = fontChar;
  40411. this.unicode = unicode;
  40412. this.accent = accent;
  40413. this.width = width;
  40414. this.vmetric = vmetric;
  40415. this.operatorListId = operatorListId;
  40416. this.isSpace = isSpace;
  40417. this.isInFont = isInFont;
  40418. }
  40419. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40420. 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;
  40421. };
  40422. return Glyph;
  40423. }();
  40424. var ToUnicodeMap = function ToUnicodeMapClosure() {
  40425. function ToUnicodeMap(cmap) {
  40426. this._map = cmap;
  40427. }
  40428. ToUnicodeMap.prototype = {
  40429. get length() {
  40430. return this._map.length;
  40431. },
  40432. forEach: function (callback) {
  40433. for (var charCode in this._map) {
  40434. callback(charCode, this._map[charCode].charCodeAt(0));
  40435. }
  40436. },
  40437. has: function (i) {
  40438. return this._map[i] !== undefined;
  40439. },
  40440. get: function (i) {
  40441. return this._map[i];
  40442. },
  40443. charCodeOf: function (v) {
  40444. return this._map.indexOf(v);
  40445. },
  40446. amend: function (map) {
  40447. for (var charCode in map) {
  40448. this._map[charCode] = map[charCode];
  40449. }
  40450. }
  40451. };
  40452. return ToUnicodeMap;
  40453. }();
  40454. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  40455. function IdentityToUnicodeMap(firstChar, lastChar) {
  40456. this.firstChar = firstChar;
  40457. this.lastChar = lastChar;
  40458. }
  40459. IdentityToUnicodeMap.prototype = {
  40460. get length() {
  40461. return this.lastChar + 1 - this.firstChar;
  40462. },
  40463. forEach: function (callback) {
  40464. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40465. callback(i, i);
  40466. }
  40467. },
  40468. has: function (i) {
  40469. return this.firstChar <= i && i <= this.lastChar;
  40470. },
  40471. get: function (i) {
  40472. if (this.firstChar <= i && i <= this.lastChar) {
  40473. return String.fromCharCode(i);
  40474. }
  40475. return undefined;
  40476. },
  40477. charCodeOf: function (v) {
  40478. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40479. },
  40480. amend: function (map) {
  40481. error('Should not call amend()');
  40482. }
  40483. };
  40484. return IdentityToUnicodeMap;
  40485. }();
  40486. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  40487. function writeInt16(dest, offset, num) {
  40488. dest[offset] = num >> 8 & 0xFF;
  40489. dest[offset + 1] = num & 0xFF;
  40490. }
  40491. function writeInt32(dest, offset, num) {
  40492. dest[offset] = num >> 24 & 0xFF;
  40493. dest[offset + 1] = num >> 16 & 0xFF;
  40494. dest[offset + 2] = num >> 8 & 0xFF;
  40495. dest[offset + 3] = num & 0xFF;
  40496. }
  40497. function writeData(dest, offset, data) {
  40498. var i, ii;
  40499. if (data instanceof Uint8Array) {
  40500. dest.set(data, offset);
  40501. } else if (typeof data === 'string') {
  40502. for (i = 0, ii = data.length; i < ii; i++) {
  40503. dest[offset++] = data.charCodeAt(i) & 0xFF;
  40504. }
  40505. } else {
  40506. for (i = 0, ii = data.length; i < ii; i++) {
  40507. dest[offset++] = data[i] & 0xFF;
  40508. }
  40509. }
  40510. }
  40511. function OpenTypeFileBuilder(sfnt) {
  40512. this.sfnt = sfnt;
  40513. this.tables = Object.create(null);
  40514. }
  40515. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  40516. var maxPower2 = 1, log2 = 0;
  40517. while ((maxPower2 ^ entriesCount) > maxPower2) {
  40518. maxPower2 <<= 1;
  40519. log2++;
  40520. }
  40521. var searchRange = maxPower2 * entrySize;
  40522. return {
  40523. range: searchRange,
  40524. entry: log2,
  40525. rangeShift: entrySize * entriesCount - searchRange
  40526. };
  40527. };
  40528. var OTF_HEADER_SIZE = 12;
  40529. var OTF_TABLE_ENTRY_SIZE = 16;
  40530. OpenTypeFileBuilder.prototype = {
  40531. toArray: function OpenTypeFileBuilder_toArray() {
  40532. var sfnt = this.sfnt;
  40533. var tables = this.tables;
  40534. var tablesNames = Object.keys(tables);
  40535. tablesNames.sort();
  40536. var numTables = tablesNames.length;
  40537. var i, j, jj, table, tableName;
  40538. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  40539. var tableOffsets = [offset];
  40540. for (i = 0; i < numTables; i++) {
  40541. table = tables[tablesNames[i]];
  40542. var paddedLength = (table.length + 3 & ~3) >>> 0;
  40543. offset += paddedLength;
  40544. tableOffsets.push(offset);
  40545. }
  40546. var file = new Uint8Array(offset);
  40547. for (i = 0; i < numTables; i++) {
  40548. table = tables[tablesNames[i]];
  40549. writeData(file, tableOffsets[i], table);
  40550. }
  40551. if (sfnt === 'true') {
  40552. sfnt = string32(0x00010000);
  40553. }
  40554. file[0] = sfnt.charCodeAt(0) & 0xFF;
  40555. file[1] = sfnt.charCodeAt(1) & 0xFF;
  40556. file[2] = sfnt.charCodeAt(2) & 0xFF;
  40557. file[3] = sfnt.charCodeAt(3) & 0xFF;
  40558. writeInt16(file, 4, numTables);
  40559. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  40560. writeInt16(file, 6, searchParams.range);
  40561. writeInt16(file, 8, searchParams.entry);
  40562. writeInt16(file, 10, searchParams.rangeShift);
  40563. offset = OTF_HEADER_SIZE;
  40564. for (i = 0; i < numTables; i++) {
  40565. tableName = tablesNames[i];
  40566. file[offset] = tableName.charCodeAt(0) & 0xFF;
  40567. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  40568. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  40569. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  40570. var checksum = 0;
  40571. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  40572. var quad = readUint32(file, j);
  40573. checksum = checksum + quad >>> 0;
  40574. }
  40575. writeInt32(file, offset + 4, checksum);
  40576. writeInt32(file, offset + 8, tableOffsets[i]);
  40577. writeInt32(file, offset + 12, tables[tableName].length);
  40578. offset += OTF_TABLE_ENTRY_SIZE;
  40579. }
  40580. return file;
  40581. },
  40582. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  40583. if (tag in this.tables) {
  40584. throw new Error('Table ' + tag + ' already exists');
  40585. }
  40586. this.tables[tag] = data;
  40587. }
  40588. };
  40589. return OpenTypeFileBuilder;
  40590. }();
  40591. var ProblematicCharRanges = new Int32Array([
  40592. 0x0000,
  40593. 0x0020,
  40594. 0x007F,
  40595. 0x00A1,
  40596. 0x00AD,
  40597. 0x00AE,
  40598. 0x0600,
  40599. 0x0780,
  40600. 0x08A0,
  40601. 0x10A0,
  40602. 0x1780,
  40603. 0x1800,
  40604. 0x1C00,
  40605. 0x1C50,
  40606. 0x2000,
  40607. 0x2010,
  40608. 0x2011,
  40609. 0x2012,
  40610. 0x2028,
  40611. 0x2030,
  40612. 0x205F,
  40613. 0x2070,
  40614. 0x25CC,
  40615. 0x25CD,
  40616. 0x3000,
  40617. 0x3001,
  40618. 0xAA60,
  40619. 0xAA80,
  40620. 0xFFF0,
  40621. 0x10000
  40622. ]);
  40623. var Font = function FontClosure() {
  40624. function Font(name, file, properties) {
  40625. var charCode, glyphName, unicode;
  40626. this.name = name;
  40627. this.loadedName = properties.loadedName;
  40628. this.isType3Font = properties.isType3Font;
  40629. this.sizes = [];
  40630. this.missingFile = false;
  40631. this.glyphCache = Object.create(null);
  40632. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  40633. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  40634. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  40635. var type = properties.type;
  40636. var subtype = properties.subtype;
  40637. this.type = type;
  40638. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  40639. this.differences = properties.differences;
  40640. this.widths = properties.widths;
  40641. this.defaultWidth = properties.defaultWidth;
  40642. this.composite = properties.composite;
  40643. this.wideChars = properties.wideChars;
  40644. this.cMap = properties.cMap;
  40645. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  40646. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  40647. this.fontMatrix = properties.fontMatrix;
  40648. this.bbox = properties.bbox;
  40649. this.toUnicode = properties.toUnicode;
  40650. this.toFontChar = [];
  40651. if (properties.type === 'Type3') {
  40652. for (charCode = 0; charCode < 256; charCode++) {
  40653. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  40654. }
  40655. this.fontType = FontType.TYPE3;
  40656. return;
  40657. }
  40658. this.cidEncoding = properties.cidEncoding;
  40659. this.vertical = properties.vertical;
  40660. if (this.vertical) {
  40661. this.vmetrics = properties.vmetrics;
  40662. this.defaultVMetrics = properties.defaultVMetrics;
  40663. }
  40664. var glyphsUnicodeMap;
  40665. if (!file || file.isEmpty) {
  40666. if (file) {
  40667. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  40668. }
  40669. this.missingFile = true;
  40670. var fontName = name.replace(/[,_]/g, '-');
  40671. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  40672. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  40673. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  40674. this.bold = fontName.search(/bold/gi) !== -1;
  40675. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  40676. this.black = name.search(/Black/g) !== -1;
  40677. this.remeasure = Object.keys(this.widths).length > 0;
  40678. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  40679. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  40680. var map = [];
  40681. for (charCode in GlyphMapForStandardFonts) {
  40682. map[+charCode] = GlyphMapForStandardFonts[charCode];
  40683. }
  40684. if (/Arial-?Black/i.test(name)) {
  40685. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  40686. for (charCode in SupplementalGlyphMapForArialBlack) {
  40687. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  40688. }
  40689. }
  40690. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  40691. if (!isIdentityUnicode) {
  40692. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40693. map[+charCode] = unicodeCharCode;
  40694. });
  40695. }
  40696. this.toFontChar = map;
  40697. this.toUnicode = new ToUnicodeMap(map);
  40698. } else if (/Symbol/i.test(fontName)) {
  40699. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  40700. } else if (/Dingbats/i.test(fontName)) {
  40701. if (/Wingdings/i.test(name)) {
  40702. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  40703. }
  40704. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  40705. } else if (isStandardFont) {
  40706. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  40707. } else {
  40708. glyphsUnicodeMap = getGlyphsUnicode();
  40709. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40710. if (!this.composite) {
  40711. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  40712. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40713. if (unicode !== -1) {
  40714. unicodeCharCode = unicode;
  40715. }
  40716. }
  40717. this.toFontChar[charCode] = unicodeCharCode;
  40718. }.bind(this));
  40719. }
  40720. this.loadedName = fontName.split('-')[0];
  40721. this.loading = false;
  40722. this.fontType = getFontType(type, subtype);
  40723. return;
  40724. }
  40725. if (subtype === 'Type1C') {
  40726. if (type !== 'Type1' && type !== 'MMType1') {
  40727. if (isTrueTypeFile(file)) {
  40728. subtype = 'TrueType';
  40729. } else {
  40730. type = 'Type1';
  40731. }
  40732. } else if (isOpenTypeFile(file)) {
  40733. type = subtype = 'OpenType';
  40734. }
  40735. }
  40736. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  40737. type = 'CIDFontType0';
  40738. }
  40739. if (subtype === 'OpenType') {
  40740. type = 'OpenType';
  40741. }
  40742. if (type === 'CIDFontType0') {
  40743. if (isType1File(file)) {
  40744. subtype = 'CIDFontType0';
  40745. } else if (isOpenTypeFile(file)) {
  40746. type = subtype = 'OpenType';
  40747. } else {
  40748. subtype = 'CIDFontType0C';
  40749. }
  40750. }
  40751. var data;
  40752. switch (type) {
  40753. case 'MMType1':
  40754. info('MMType1 font (' + name + '), falling back to Type1.');
  40755. case 'Type1':
  40756. case 'CIDFontType0':
  40757. this.mimetype = 'font/opentype';
  40758. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  40759. adjustWidths(properties);
  40760. data = this.convert(name, cff, properties);
  40761. break;
  40762. case 'OpenType':
  40763. case 'TrueType':
  40764. case 'CIDFontType2':
  40765. this.mimetype = 'font/opentype';
  40766. data = this.checkAndRepair(name, file, properties);
  40767. if (this.isOpenType) {
  40768. adjustWidths(properties);
  40769. type = 'OpenType';
  40770. }
  40771. break;
  40772. default:
  40773. error('Font ' + type + ' is not supported');
  40774. break;
  40775. }
  40776. this.data = data;
  40777. this.fontType = getFontType(type, subtype);
  40778. this.fontMatrix = properties.fontMatrix;
  40779. this.widths = properties.widths;
  40780. this.defaultWidth = properties.defaultWidth;
  40781. this.toUnicode = properties.toUnicode;
  40782. this.encoding = properties.baseEncoding;
  40783. this.seacMap = properties.seacMap;
  40784. this.loading = true;
  40785. }
  40786. Font.getFontID = function () {
  40787. var ID = 1;
  40788. return function Font_getFontID() {
  40789. return String(ID++);
  40790. };
  40791. }();
  40792. function int16(b0, b1) {
  40793. return (b0 << 8) + b1;
  40794. }
  40795. function signedInt16(b0, b1) {
  40796. var value = (b0 << 8) + b1;
  40797. return value & 1 << 15 ? value - 0x10000 : value;
  40798. }
  40799. function int32(b0, b1, b2, b3) {
  40800. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  40801. }
  40802. function string16(value) {
  40803. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40804. }
  40805. function safeString16(value) {
  40806. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  40807. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40808. }
  40809. function isTrueTypeFile(file) {
  40810. var header = file.peekBytes(4);
  40811. return readUint32(header, 0) === 0x00010000;
  40812. }
  40813. function isOpenTypeFile(file) {
  40814. var header = file.peekBytes(4);
  40815. return bytesToString(header) === 'OTTO';
  40816. }
  40817. function isType1File(file) {
  40818. var header = file.peekBytes(2);
  40819. if (header[0] === 0x25 && header[1] === 0x21) {
  40820. return true;
  40821. }
  40822. if (header[0] === 0x80 && header[1] === 0x01) {
  40823. return true;
  40824. }
  40825. return false;
  40826. }
  40827. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  40828. var toFontChar = [], unicode;
  40829. for (var i = 0, ii = encoding.length; i < ii; i++) {
  40830. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  40831. if (unicode !== -1) {
  40832. toFontChar[i] = unicode;
  40833. }
  40834. }
  40835. for (var charCode in differences) {
  40836. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  40837. if (unicode !== -1) {
  40838. toFontChar[+charCode] = unicode;
  40839. }
  40840. }
  40841. return toFontChar;
  40842. }
  40843. function isProblematicUnicodeLocation(code) {
  40844. var i = 0, j = ProblematicCharRanges.length - 1;
  40845. while (i < j) {
  40846. var c = i + j + 1 >> 1;
  40847. if (code < ProblematicCharRanges[c]) {
  40848. j = c - 1;
  40849. } else {
  40850. i = c;
  40851. }
  40852. }
  40853. return !(i & 1);
  40854. }
  40855. function adjustMapping(charCodeToGlyphId, properties) {
  40856. var toUnicode = properties.toUnicode;
  40857. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40858. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40859. var newMap = Object.create(null);
  40860. var toFontChar = [];
  40861. var usedFontCharCodes = [];
  40862. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40863. for (var originalCharCode in charCodeToGlyphId) {
  40864. originalCharCode |= 0;
  40865. var glyphId = charCodeToGlyphId[originalCharCode];
  40866. var fontCharCode = originalCharCode;
  40867. var hasUnicodeValue = false;
  40868. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40869. hasUnicodeValue = true;
  40870. var unicode = toUnicode.get(fontCharCode);
  40871. if (unicode.length === 1) {
  40872. fontCharCode = unicode.charCodeAt(0);
  40873. }
  40874. }
  40875. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40876. do {
  40877. fontCharCode = nextAvailableFontCharCode++;
  40878. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40879. fontCharCode = 0xF020;
  40880. nextAvailableFontCharCode = fontCharCode + 1;
  40881. }
  40882. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40883. }
  40884. newMap[fontCharCode] = glyphId;
  40885. toFontChar[originalCharCode] = fontCharCode;
  40886. usedFontCharCodes[fontCharCode] = true;
  40887. }
  40888. return {
  40889. toFontChar: toFontChar,
  40890. charCodeToGlyphId: newMap,
  40891. nextAvailableFontCharCode: nextAvailableFontCharCode
  40892. };
  40893. }
  40894. function getRanges(glyphs, numGlyphs) {
  40895. var codes = [];
  40896. for (var charCode in glyphs) {
  40897. if (glyphs[charCode] >= numGlyphs) {
  40898. continue;
  40899. }
  40900. codes.push({
  40901. fontCharCode: charCode | 0,
  40902. glyphId: glyphs[charCode]
  40903. });
  40904. }
  40905. codes.sort(function fontGetRangesSort(a, b) {
  40906. return a.fontCharCode - b.fontCharCode;
  40907. });
  40908. var ranges = [];
  40909. var length = codes.length;
  40910. for (var n = 0; n < length;) {
  40911. var start = codes[n].fontCharCode;
  40912. var codeIndices = [codes[n].glyphId];
  40913. ++n;
  40914. var end = start;
  40915. while (n < length && end + 1 === codes[n].fontCharCode) {
  40916. codeIndices.push(codes[n].glyphId);
  40917. ++end;
  40918. ++n;
  40919. if (end === 0xFFFF) {
  40920. break;
  40921. }
  40922. }
  40923. ranges.push([
  40924. start,
  40925. end,
  40926. codeIndices
  40927. ]);
  40928. }
  40929. return ranges;
  40930. }
  40931. function createCmapTable(glyphs, numGlyphs) {
  40932. var ranges = getRanges(glyphs, numGlyphs);
  40933. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40934. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40935. var i, ii, j, jj;
  40936. for (i = ranges.length - 1; i >= 0; --i) {
  40937. if (ranges[i][0] <= 0xFFFF) {
  40938. break;
  40939. }
  40940. }
  40941. var bmpLength = i + 1;
  40942. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40943. ranges[i][1] = 0xFFFE;
  40944. }
  40945. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40946. var segCount = bmpLength + trailingRangesCount;
  40947. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40948. var startCount = '';
  40949. var endCount = '';
  40950. var idDeltas = '';
  40951. var idRangeOffsets = '';
  40952. var glyphsIds = '';
  40953. var bias = 0;
  40954. var range, start, end, codes;
  40955. for (i = 0, ii = bmpLength; i < ii; i++) {
  40956. range = ranges[i];
  40957. start = range[0];
  40958. end = range[1];
  40959. startCount += string16(start);
  40960. endCount += string16(end);
  40961. codes = range[2];
  40962. var contiguous = true;
  40963. for (j = 1, jj = codes.length; j < jj; ++j) {
  40964. if (codes[j] !== codes[j - 1] + 1) {
  40965. contiguous = false;
  40966. break;
  40967. }
  40968. }
  40969. if (!contiguous) {
  40970. var offset = (segCount - i) * 2 + bias * 2;
  40971. bias += end - start + 1;
  40972. idDeltas += string16(0);
  40973. idRangeOffsets += string16(offset);
  40974. for (j = 0, jj = codes.length; j < jj; ++j) {
  40975. glyphsIds += string16(codes[j]);
  40976. }
  40977. } else {
  40978. var startCode = codes[0];
  40979. idDeltas += string16(startCode - start & 0xFFFF);
  40980. idRangeOffsets += string16(0);
  40981. }
  40982. }
  40983. if (trailingRangesCount > 0) {
  40984. endCount += '\xFF\xFF';
  40985. startCount += '\xFF\xFF';
  40986. idDeltas += '\x00\x01';
  40987. idRangeOffsets += '\x00\x00';
  40988. }
  40989. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40990. var format31012 = '';
  40991. var header31012 = '';
  40992. if (numTables > 1) {
  40993. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40994. format31012 = '';
  40995. for (i = 0, ii = ranges.length; i < ii; i++) {
  40996. range = ranges[i];
  40997. start = range[0];
  40998. codes = range[2];
  40999. var code = codes[0];
  41000. for (j = 1, jj = codes.length; j < jj; ++j) {
  41001. if (codes[j] !== codes[j - 1] + 1) {
  41002. end = range[0] + j - 1;
  41003. format31012 += string32(start) + string32(end) + string32(code);
  41004. start = end + 1;
  41005. code = codes[j];
  41006. }
  41007. }
  41008. format31012 += string32(start) + string32(range[1]) + string32(code);
  41009. }
  41010. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  41011. }
  41012. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  41013. }
  41014. function validateOS2Table(os2) {
  41015. var stream = new Stream(os2.data);
  41016. var version = stream.getUint16();
  41017. stream.getBytes(60);
  41018. var selection = stream.getUint16();
  41019. if (version < 4 && selection & 0x0300) {
  41020. return false;
  41021. }
  41022. var firstChar = stream.getUint16();
  41023. var lastChar = stream.getUint16();
  41024. if (firstChar > lastChar) {
  41025. return false;
  41026. }
  41027. stream.getBytes(6);
  41028. var usWinAscent = stream.getUint16();
  41029. if (usWinAscent === 0) {
  41030. return false;
  41031. }
  41032. os2.data[8] = os2.data[9] = 0;
  41033. return true;
  41034. }
  41035. function createOS2Table(properties, charstrings, override) {
  41036. override = override || {
  41037. unitsPerEm: 0,
  41038. yMax: 0,
  41039. yMin: 0,
  41040. ascent: 0,
  41041. descent: 0
  41042. };
  41043. var ulUnicodeRange1 = 0;
  41044. var ulUnicodeRange2 = 0;
  41045. var ulUnicodeRange3 = 0;
  41046. var ulUnicodeRange4 = 0;
  41047. var firstCharIndex = null;
  41048. var lastCharIndex = 0;
  41049. if (charstrings) {
  41050. for (var code in charstrings) {
  41051. code |= 0;
  41052. if (firstCharIndex > code || !firstCharIndex) {
  41053. firstCharIndex = code;
  41054. }
  41055. if (lastCharIndex < code) {
  41056. lastCharIndex = code;
  41057. }
  41058. var position = getUnicodeRangeFor(code);
  41059. if (position < 32) {
  41060. ulUnicodeRange1 |= 1 << position;
  41061. } else if (position < 64) {
  41062. ulUnicodeRange2 |= 1 << position - 32;
  41063. } else if (position < 96) {
  41064. ulUnicodeRange3 |= 1 << position - 64;
  41065. } else if (position < 123) {
  41066. ulUnicodeRange4 |= 1 << position - 96;
  41067. } else {
  41068. error('Unicode ranges Bits > 123 are reserved for internal usage');
  41069. }
  41070. }
  41071. } else {
  41072. firstCharIndex = 0;
  41073. lastCharIndex = 255;
  41074. }
  41075. var bbox = properties.bbox || [
  41076. 0,
  41077. 0,
  41078. 0,
  41079. 0
  41080. ];
  41081. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41082. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  41083. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  41084. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  41085. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  41086. typoDescent = -typoDescent;
  41087. }
  41088. var winAscent = override.yMax || typoAscent;
  41089. var winDescent = -override.yMin || -typoDescent;
  41090. 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';
  41091. }
  41092. function createPostTable(properties) {
  41093. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  41094. 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';
  41095. }
  41096. function createNameTable(name, proto) {
  41097. if (!proto) {
  41098. proto = [
  41099. [],
  41100. []
  41101. ];
  41102. }
  41103. var strings = [
  41104. proto[0][0] || 'Original licence',
  41105. proto[0][1] || name,
  41106. proto[0][2] || 'Unknown',
  41107. proto[0][3] || 'uniqueID',
  41108. proto[0][4] || name,
  41109. proto[0][5] || 'Version 0.11',
  41110. proto[0][6] || '',
  41111. proto[0][7] || 'Unknown',
  41112. proto[0][8] || 'Unknown',
  41113. proto[0][9] || 'Unknown'
  41114. ];
  41115. var stringsUnicode = [];
  41116. var i, ii, j, jj, str;
  41117. for (i = 0, ii = strings.length; i < ii; i++) {
  41118. str = proto[1][i] || strings[i];
  41119. var strBufUnicode = [];
  41120. for (j = 0, jj = str.length; j < jj; j++) {
  41121. strBufUnicode.push(string16(str.charCodeAt(j)));
  41122. }
  41123. stringsUnicode.push(strBufUnicode.join(''));
  41124. }
  41125. var names = [
  41126. strings,
  41127. stringsUnicode
  41128. ];
  41129. var platforms = [
  41130. '\x00\x01',
  41131. '\x00\x03'
  41132. ];
  41133. var encodings = [
  41134. '\x00\x00',
  41135. '\x00\x01'
  41136. ];
  41137. var languages = [
  41138. '\x00\x00',
  41139. '\x04\x09'
  41140. ];
  41141. var namesRecordCount = strings.length * platforms.length;
  41142. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  41143. var strOffset = 0;
  41144. for (i = 0, ii = platforms.length; i < ii; i++) {
  41145. var strs = names[i];
  41146. for (j = 0, jj = strs.length; j < jj; j++) {
  41147. str = strs[j];
  41148. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  41149. nameTable += nameRecord;
  41150. strOffset += str.length;
  41151. }
  41152. }
  41153. nameTable += strings.join('') + stringsUnicode.join('');
  41154. return nameTable;
  41155. }
  41156. Font.prototype = {
  41157. name: null,
  41158. font: null,
  41159. mimetype: null,
  41160. encoding: null,
  41161. get renderer() {
  41162. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  41163. return shadow(this, 'renderer', renderer);
  41164. },
  41165. exportData: function Font_exportData() {
  41166. var data = {};
  41167. for (var i in this) {
  41168. if (this.hasOwnProperty(i)) {
  41169. data[i] = this[i];
  41170. }
  41171. }
  41172. return data;
  41173. },
  41174. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  41175. function readTableEntry(file) {
  41176. var tag = bytesToString(file.getBytes(4));
  41177. var checksum = file.getInt32() >>> 0;
  41178. var offset = file.getInt32() >>> 0;
  41179. var length = file.getInt32() >>> 0;
  41180. var previousPosition = file.pos;
  41181. file.pos = file.start ? file.start : 0;
  41182. file.skip(offset);
  41183. var data = file.getBytes(length);
  41184. file.pos = previousPosition;
  41185. if (tag === 'head') {
  41186. data[8] = data[9] = data[10] = data[11] = 0;
  41187. data[17] |= 0x20;
  41188. }
  41189. return {
  41190. tag: tag,
  41191. checksum: checksum,
  41192. length: length,
  41193. offset: offset,
  41194. data: data
  41195. };
  41196. }
  41197. function readOpenTypeHeader(ttf) {
  41198. return {
  41199. version: bytesToString(ttf.getBytes(4)),
  41200. numTables: ttf.getUint16(),
  41201. searchRange: ttf.getUint16(),
  41202. entrySelector: ttf.getUint16(),
  41203. rangeShift: ttf.getUint16()
  41204. };
  41205. }
  41206. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  41207. if (!cmap) {
  41208. warn('No cmap table available.');
  41209. return {
  41210. platformId: -1,
  41211. encodingId: -1,
  41212. mappings: [],
  41213. hasShortCmap: false
  41214. };
  41215. }
  41216. var segment;
  41217. var start = (font.start ? font.start : 0) + cmap.offset;
  41218. font.pos = start;
  41219. font.getUint16();
  41220. var numTables = font.getUint16();
  41221. var potentialTable;
  41222. var canBreak = false;
  41223. for (var i = 0; i < numTables; i++) {
  41224. var platformId = font.getUint16();
  41225. var encodingId = font.getUint16();
  41226. var offset = font.getInt32() >>> 0;
  41227. var useTable = false;
  41228. if (platformId === 0 && encodingId === 0) {
  41229. useTable = true;
  41230. } else if (platformId === 1 && encodingId === 0) {
  41231. useTable = true;
  41232. } else if (platformId === 3 && encodingId === 1 && (!isSymbolicFont && hasEncoding || !potentialTable)) {
  41233. useTable = true;
  41234. if (!isSymbolicFont) {
  41235. canBreak = true;
  41236. }
  41237. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  41238. useTable = true;
  41239. canBreak = true;
  41240. }
  41241. if (useTable) {
  41242. potentialTable = {
  41243. platformId: platformId,
  41244. encodingId: encodingId,
  41245. offset: offset
  41246. };
  41247. }
  41248. if (canBreak) {
  41249. break;
  41250. }
  41251. }
  41252. if (potentialTable) {
  41253. font.pos = start + potentialTable.offset;
  41254. }
  41255. if (!potentialTable || font.peekByte() === -1) {
  41256. warn('Could not find a preferred cmap table.');
  41257. return {
  41258. platformId: -1,
  41259. encodingId: -1,
  41260. mappings: [],
  41261. hasShortCmap: false
  41262. };
  41263. }
  41264. var format = font.getUint16();
  41265. font.getUint16();
  41266. font.getUint16();
  41267. var hasShortCmap = false;
  41268. var mappings = [];
  41269. var j, glyphId;
  41270. if (format === 0) {
  41271. for (j = 0; j < 256; j++) {
  41272. var index = font.getByte();
  41273. if (!index) {
  41274. continue;
  41275. }
  41276. mappings.push({
  41277. charCode: j,
  41278. glyphId: index
  41279. });
  41280. }
  41281. hasShortCmap = true;
  41282. } else if (format === 4) {
  41283. var segCount = font.getUint16() >> 1;
  41284. font.getBytes(6);
  41285. var segIndex, segments = [];
  41286. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41287. segments.push({ end: font.getUint16() });
  41288. }
  41289. font.getUint16();
  41290. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41291. segments[segIndex].start = font.getUint16();
  41292. }
  41293. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41294. segments[segIndex].delta = font.getUint16();
  41295. }
  41296. var offsetsCount = 0;
  41297. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41298. segment = segments[segIndex];
  41299. var rangeOffset = font.getUint16();
  41300. if (!rangeOffset) {
  41301. segment.offsetIndex = -1;
  41302. continue;
  41303. }
  41304. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  41305. segment.offsetIndex = offsetIndex;
  41306. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  41307. }
  41308. var offsets = [];
  41309. for (j = 0; j < offsetsCount; j++) {
  41310. offsets.push(font.getUint16());
  41311. }
  41312. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41313. segment = segments[segIndex];
  41314. start = segment.start;
  41315. var end = segment.end;
  41316. var delta = segment.delta;
  41317. offsetIndex = segment.offsetIndex;
  41318. for (j = start; j <= end; j++) {
  41319. if (j === 0xFFFF) {
  41320. continue;
  41321. }
  41322. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  41323. glyphId = glyphId + delta & 0xFFFF;
  41324. if (glyphId === 0) {
  41325. continue;
  41326. }
  41327. mappings.push({
  41328. charCode: j,
  41329. glyphId: glyphId
  41330. });
  41331. }
  41332. }
  41333. } else if (format === 6) {
  41334. var firstCode = font.getUint16();
  41335. var entryCount = font.getUint16();
  41336. for (j = 0; j < entryCount; j++) {
  41337. glyphId = font.getUint16();
  41338. var charCode = firstCode + j;
  41339. mappings.push({
  41340. charCode: charCode,
  41341. glyphId: glyphId
  41342. });
  41343. }
  41344. } else {
  41345. warn('cmap table has unsupported format: ' + format);
  41346. return {
  41347. platformId: -1,
  41348. encodingId: -1,
  41349. mappings: [],
  41350. hasShortCmap: false
  41351. };
  41352. }
  41353. mappings.sort(function (a, b) {
  41354. return a.charCode - b.charCode;
  41355. });
  41356. for (i = 1; i < mappings.length; i++) {
  41357. if (mappings[i - 1].charCode === mappings[i].charCode) {
  41358. mappings.splice(i, 1);
  41359. i--;
  41360. }
  41361. }
  41362. return {
  41363. platformId: potentialTable.platformId,
  41364. encodingId: potentialTable.encodingId,
  41365. mappings: mappings,
  41366. hasShortCmap: hasShortCmap
  41367. };
  41368. }
  41369. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  41370. if (!header) {
  41371. if (metrics) {
  41372. metrics.data = null;
  41373. }
  41374. return;
  41375. }
  41376. font.pos = (font.start ? font.start : 0) + header.offset;
  41377. font.pos += header.length - 2;
  41378. var numOfMetrics = font.getUint16();
  41379. if (numOfMetrics > numGlyphs) {
  41380. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  41381. numOfMetrics = numGlyphs;
  41382. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  41383. header.data[35] = numOfMetrics & 0x00ff;
  41384. }
  41385. var numOfSidebearings = numGlyphs - numOfMetrics;
  41386. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  41387. if (numMissing > 0) {
  41388. var entries = new Uint8Array(metrics.length + numMissing * 2);
  41389. entries.set(metrics.data);
  41390. metrics.data = entries;
  41391. }
  41392. }
  41393. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  41394. if (sourceEnd - sourceStart <= 12) {
  41395. return 0;
  41396. }
  41397. var glyf = source.subarray(sourceStart, sourceEnd);
  41398. var contoursCount = glyf[0] << 8 | glyf[1];
  41399. if (contoursCount & 0x8000) {
  41400. dest.set(glyf, destStart);
  41401. return glyf.length;
  41402. }
  41403. var i, j = 10, flagsCount = 0;
  41404. for (i = 0; i < contoursCount; i++) {
  41405. var endPoint = glyf[j] << 8 | glyf[j + 1];
  41406. flagsCount = endPoint + 1;
  41407. j += 2;
  41408. }
  41409. var instructionsStart = j;
  41410. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  41411. j += 2 + instructionsLength;
  41412. var instructionsEnd = j;
  41413. var coordinatesLength = 0;
  41414. for (i = 0; i < flagsCount; i++) {
  41415. var flag = glyf[j++];
  41416. if (flag & 0xC0) {
  41417. glyf[j - 1] = flag & 0x3F;
  41418. }
  41419. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  41420. coordinatesLength += xyLength;
  41421. if (flag & 8) {
  41422. var repeat = glyf[j++];
  41423. i += repeat;
  41424. coordinatesLength += repeat * xyLength;
  41425. }
  41426. }
  41427. if (coordinatesLength === 0) {
  41428. return 0;
  41429. }
  41430. var glyphDataLength = j + coordinatesLength;
  41431. if (glyphDataLength > glyf.length) {
  41432. return 0;
  41433. }
  41434. if (!hintsValid && instructionsLength > 0) {
  41435. dest.set(glyf.subarray(0, instructionsStart), destStart);
  41436. dest.set([
  41437. 0,
  41438. 0
  41439. ], destStart + instructionsStart);
  41440. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  41441. glyphDataLength -= instructionsLength;
  41442. if (glyf.length - glyphDataLength > 3) {
  41443. glyphDataLength = glyphDataLength + 3 & ~3;
  41444. }
  41445. return glyphDataLength;
  41446. }
  41447. if (glyf.length - glyphDataLength > 3) {
  41448. glyphDataLength = glyphDataLength + 3 & ~3;
  41449. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  41450. return glyphDataLength;
  41451. }
  41452. dest.set(glyf, destStart);
  41453. return glyf.length;
  41454. }
  41455. function sanitizeHead(head, numGlyphs, locaLength) {
  41456. var data = head.data;
  41457. var version = int32(data[0], data[1], data[2], data[3]);
  41458. if (version >> 16 !== 1) {
  41459. info('Attempting to fix invalid version in head table: ' + version);
  41460. data[0] = 0;
  41461. data[1] = 1;
  41462. data[2] = 0;
  41463. data[3] = 0;
  41464. }
  41465. var indexToLocFormat = int16(data[50], data[51]);
  41466. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  41467. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  41468. var numGlyphsPlusOne = numGlyphs + 1;
  41469. if (locaLength === numGlyphsPlusOne << 1) {
  41470. data[50] = 0;
  41471. data[51] = 0;
  41472. } else if (locaLength === numGlyphsPlusOne << 2) {
  41473. data[50] = 0;
  41474. data[51] = 1;
  41475. } else {
  41476. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  41477. }
  41478. }
  41479. }
  41480. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  41481. var itemSize, itemDecode, itemEncode;
  41482. if (isGlyphLocationsLong) {
  41483. itemSize = 4;
  41484. itemDecode = function fontItemDecodeLong(data, offset) {
  41485. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  41486. };
  41487. itemEncode = function fontItemEncodeLong(data, offset, value) {
  41488. data[offset] = value >>> 24 & 0xFF;
  41489. data[offset + 1] = value >> 16 & 0xFF;
  41490. data[offset + 2] = value >> 8 & 0xFF;
  41491. data[offset + 3] = value & 0xFF;
  41492. };
  41493. } else {
  41494. itemSize = 2;
  41495. itemDecode = function fontItemDecode(data, offset) {
  41496. return data[offset] << 9 | data[offset + 1] << 1;
  41497. };
  41498. itemEncode = function fontItemEncode(data, offset, value) {
  41499. data[offset] = value >> 9 & 0xFF;
  41500. data[offset + 1] = value >> 1 & 0xFF;
  41501. };
  41502. }
  41503. var locaData = loca.data;
  41504. var locaDataSize = itemSize * (1 + numGlyphs);
  41505. if (locaData.length !== locaDataSize) {
  41506. locaData = new Uint8Array(locaDataSize);
  41507. locaData.set(loca.data.subarray(0, locaDataSize));
  41508. loca.data = locaData;
  41509. }
  41510. var oldGlyfData = glyf.data;
  41511. var oldGlyfDataLength = oldGlyfData.length;
  41512. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  41513. var startOffset = itemDecode(locaData, 0);
  41514. var writeOffset = 0;
  41515. var missingGlyphData = Object.create(null);
  41516. itemEncode(locaData, 0, writeOffset);
  41517. var i, j;
  41518. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41519. var endOffset = itemDecode(locaData, j);
  41520. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  41521. endOffset = oldGlyfDataLength;
  41522. }
  41523. if (endOffset > oldGlyfDataLength) {
  41524. itemEncode(locaData, j, writeOffset);
  41525. startOffset = endOffset;
  41526. continue;
  41527. }
  41528. if (startOffset === endOffset) {
  41529. missingGlyphData[i] = true;
  41530. }
  41531. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  41532. writeOffset += newLength;
  41533. itemEncode(locaData, j, writeOffset);
  41534. startOffset = endOffset;
  41535. }
  41536. if (writeOffset === 0) {
  41537. var simpleGlyph = new Uint8Array([
  41538. 0,
  41539. 1,
  41540. 0,
  41541. 0,
  41542. 0,
  41543. 0,
  41544. 0,
  41545. 0,
  41546. 0,
  41547. 0,
  41548. 0,
  41549. 0,
  41550. 0,
  41551. 0,
  41552. 49,
  41553. 0
  41554. ]);
  41555. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41556. itemEncode(locaData, j, simpleGlyph.length);
  41557. }
  41558. glyf.data = simpleGlyph;
  41559. return missingGlyphData;
  41560. }
  41561. if (dupFirstEntry) {
  41562. var firstEntryLength = itemDecode(locaData, itemSize);
  41563. if (newGlyfData.length > firstEntryLength + writeOffset) {
  41564. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  41565. } else {
  41566. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  41567. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  41568. }
  41569. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  41570. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  41571. } else {
  41572. glyf.data = newGlyfData.subarray(0, writeOffset);
  41573. }
  41574. return missingGlyphData;
  41575. }
  41576. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  41577. var start = (font.start ? font.start : 0) + post.offset;
  41578. font.pos = start;
  41579. var length = post.length, end = start + length;
  41580. var version = font.getInt32();
  41581. font.getBytes(28);
  41582. var glyphNames;
  41583. var valid = true;
  41584. var i;
  41585. switch (version) {
  41586. case 0x00010000:
  41587. glyphNames = MacStandardGlyphOrdering;
  41588. break;
  41589. case 0x00020000:
  41590. var numGlyphs = font.getUint16();
  41591. if (numGlyphs !== maxpNumGlyphs) {
  41592. valid = false;
  41593. break;
  41594. }
  41595. var glyphNameIndexes = [];
  41596. for (i = 0; i < numGlyphs; ++i) {
  41597. var index = font.getUint16();
  41598. if (index >= 32768) {
  41599. valid = false;
  41600. break;
  41601. }
  41602. glyphNameIndexes.push(index);
  41603. }
  41604. if (!valid) {
  41605. break;
  41606. }
  41607. var customNames = [];
  41608. var strBuf = [];
  41609. while (font.pos < end) {
  41610. var stringLength = font.getByte();
  41611. strBuf.length = stringLength;
  41612. for (i = 0; i < stringLength; ++i) {
  41613. strBuf[i] = String.fromCharCode(font.getByte());
  41614. }
  41615. customNames.push(strBuf.join(''));
  41616. }
  41617. glyphNames = [];
  41618. for (i = 0; i < numGlyphs; ++i) {
  41619. var j = glyphNameIndexes[i];
  41620. if (j < 258) {
  41621. glyphNames.push(MacStandardGlyphOrdering[j]);
  41622. continue;
  41623. }
  41624. glyphNames.push(customNames[j - 258]);
  41625. }
  41626. break;
  41627. case 0x00030000:
  41628. break;
  41629. default:
  41630. warn('Unknown/unsupported post table version ' + version);
  41631. valid = false;
  41632. if (properties.defaultEncoding) {
  41633. glyphNames = properties.defaultEncoding;
  41634. }
  41635. break;
  41636. }
  41637. properties.glyphNames = glyphNames;
  41638. return valid;
  41639. }
  41640. function readNameTable(nameTable) {
  41641. var start = (font.start ? font.start : 0) + nameTable.offset;
  41642. font.pos = start;
  41643. var names = [
  41644. [],
  41645. []
  41646. ];
  41647. var length = nameTable.length, end = start + length;
  41648. var format = font.getUint16();
  41649. var FORMAT_0_HEADER_LENGTH = 6;
  41650. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  41651. return names;
  41652. }
  41653. var numRecords = font.getUint16();
  41654. var stringsStart = font.getUint16();
  41655. var records = [];
  41656. var NAME_RECORD_LENGTH = 12;
  41657. var i, ii;
  41658. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  41659. var r = {
  41660. platform: font.getUint16(),
  41661. encoding: font.getUint16(),
  41662. language: font.getUint16(),
  41663. name: font.getUint16(),
  41664. length: font.getUint16(),
  41665. offset: font.getUint16()
  41666. };
  41667. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  41668. records.push(r);
  41669. }
  41670. }
  41671. for (i = 0, ii = records.length; i < ii; i++) {
  41672. var record = records[i];
  41673. if (record.length <= 0) {
  41674. continue;
  41675. }
  41676. var pos = start + stringsStart + record.offset;
  41677. if (pos + record.length > end) {
  41678. continue;
  41679. }
  41680. font.pos = pos;
  41681. var nameIndex = record.name;
  41682. if (record.encoding) {
  41683. var str = '';
  41684. for (var j = 0, jj = record.length; j < jj; j += 2) {
  41685. str += String.fromCharCode(font.getUint16());
  41686. }
  41687. names[1][nameIndex] = str;
  41688. } else {
  41689. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  41690. }
  41691. }
  41692. return names;
  41693. }
  41694. var TTOpsStackDeltas = [
  41695. 0,
  41696. 0,
  41697. 0,
  41698. 0,
  41699. 0,
  41700. 0,
  41701. 0,
  41702. 0,
  41703. -2,
  41704. -2,
  41705. -2,
  41706. -2,
  41707. 0,
  41708. 0,
  41709. -2,
  41710. -5,
  41711. -1,
  41712. -1,
  41713. -1,
  41714. -1,
  41715. -1,
  41716. -1,
  41717. -1,
  41718. -1,
  41719. 0,
  41720. 0,
  41721. -1,
  41722. 0,
  41723. -1,
  41724. -1,
  41725. -1,
  41726. -1,
  41727. 1,
  41728. -1,
  41729. -999,
  41730. 0,
  41731. 1,
  41732. 0,
  41733. -1,
  41734. -2,
  41735. 0,
  41736. -1,
  41737. -2,
  41738. -1,
  41739. -1,
  41740. 0,
  41741. -1,
  41742. -1,
  41743. 0,
  41744. 0,
  41745. -999,
  41746. -999,
  41747. -1,
  41748. -1,
  41749. -1,
  41750. -1,
  41751. -2,
  41752. -999,
  41753. -2,
  41754. -2,
  41755. -999,
  41756. 0,
  41757. -2,
  41758. -2,
  41759. 0,
  41760. 0,
  41761. -2,
  41762. 0,
  41763. -2,
  41764. 0,
  41765. 0,
  41766. 0,
  41767. -2,
  41768. -1,
  41769. -1,
  41770. 1,
  41771. 1,
  41772. 0,
  41773. 0,
  41774. -1,
  41775. -1,
  41776. -1,
  41777. -1,
  41778. -1,
  41779. -1,
  41780. -1,
  41781. 0,
  41782. 0,
  41783. -1,
  41784. 0,
  41785. -1,
  41786. -1,
  41787. 0,
  41788. -999,
  41789. -1,
  41790. -1,
  41791. -1,
  41792. -1,
  41793. -1,
  41794. -1,
  41795. 0,
  41796. 0,
  41797. 0,
  41798. 0,
  41799. 0,
  41800. 0,
  41801. 0,
  41802. 0,
  41803. 0,
  41804. 0,
  41805. 0,
  41806. 0,
  41807. -2,
  41808. -999,
  41809. -999,
  41810. -999,
  41811. -999,
  41812. -999,
  41813. -1,
  41814. -1,
  41815. -2,
  41816. -2,
  41817. 0,
  41818. 0,
  41819. 0,
  41820. 0,
  41821. -1,
  41822. -1,
  41823. -999,
  41824. -2,
  41825. -2,
  41826. 0,
  41827. 0,
  41828. -1,
  41829. -2,
  41830. -2,
  41831. 0,
  41832. 0,
  41833. 0,
  41834. -1,
  41835. -1,
  41836. -1,
  41837. -2
  41838. ];
  41839. function sanitizeTTProgram(table, ttContext) {
  41840. var data = table.data;
  41841. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41842. var stack = [];
  41843. var callstack = [];
  41844. var functionsCalled = [];
  41845. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41846. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41847. for (var ii = data.length; i < ii;) {
  41848. var op = data[i++];
  41849. if (op === 0x40) {
  41850. n = data[i++];
  41851. if (inFDEF || inELSE) {
  41852. i += n;
  41853. } else {
  41854. for (j = 0; j < n; j++) {
  41855. stack.push(data[i++]);
  41856. }
  41857. }
  41858. } else if (op === 0x41) {
  41859. n = data[i++];
  41860. if (inFDEF || inELSE) {
  41861. i += n * 2;
  41862. } else {
  41863. for (j = 0; j < n; j++) {
  41864. b = data[i++];
  41865. stack.push(b << 8 | data[i++]);
  41866. }
  41867. }
  41868. } else if ((op & 0xF8) === 0xB0) {
  41869. n = op - 0xB0 + 1;
  41870. if (inFDEF || inELSE) {
  41871. i += n;
  41872. } else {
  41873. for (j = 0; j < n; j++) {
  41874. stack.push(data[i++]);
  41875. }
  41876. }
  41877. } else if ((op & 0xF8) === 0xB8) {
  41878. n = op - 0xB8 + 1;
  41879. if (inFDEF || inELSE) {
  41880. i += n * 2;
  41881. } else {
  41882. for (j = 0; j < n; j++) {
  41883. b = data[i++];
  41884. stack.push(b << 8 | data[i++]);
  41885. }
  41886. }
  41887. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41888. if (!inFDEF && !inELSE) {
  41889. funcId = stack[stack.length - 1];
  41890. ttContext.functionsUsed[funcId] = true;
  41891. if (funcId in ttContext.functionsStackDeltas) {
  41892. stack.length += ttContext.functionsStackDeltas[funcId];
  41893. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41894. callstack.push({
  41895. data: data,
  41896. i: i,
  41897. stackTop: stack.length - 1
  41898. });
  41899. functionsCalled.push(funcId);
  41900. pc = ttContext.functionsDefined[funcId];
  41901. if (!pc) {
  41902. warn('TT: CALL non-existent function');
  41903. ttContext.hintsValid = false;
  41904. return;
  41905. }
  41906. data = pc.data;
  41907. i = pc.i;
  41908. }
  41909. }
  41910. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41911. if (inFDEF || inELSE) {
  41912. warn('TT: nested FDEFs not allowed');
  41913. tooComplexToFollowFunctions = true;
  41914. }
  41915. inFDEF = true;
  41916. lastDeff = i;
  41917. funcId = stack.pop();
  41918. ttContext.functionsDefined[funcId] = {
  41919. data: data,
  41920. i: i
  41921. };
  41922. } else if (op === 0x2D) {
  41923. if (inFDEF) {
  41924. inFDEF = false;
  41925. lastEndf = i;
  41926. } else {
  41927. pc = callstack.pop();
  41928. if (!pc) {
  41929. warn('TT: ENDF bad stack');
  41930. ttContext.hintsValid = false;
  41931. return;
  41932. }
  41933. funcId = functionsCalled.pop();
  41934. data = pc.data;
  41935. i = pc.i;
  41936. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41937. }
  41938. } else if (op === 0x89) {
  41939. if (inFDEF || inELSE) {
  41940. warn('TT: nested IDEFs not allowed');
  41941. tooComplexToFollowFunctions = true;
  41942. }
  41943. inFDEF = true;
  41944. lastDeff = i;
  41945. } else if (op === 0x58) {
  41946. ++ifLevel;
  41947. } else if (op === 0x1B) {
  41948. inELSE = ifLevel;
  41949. } else if (op === 0x59) {
  41950. if (inELSE === ifLevel) {
  41951. inELSE = 0;
  41952. }
  41953. --ifLevel;
  41954. } else if (op === 0x1C) {
  41955. if (!inFDEF && !inELSE) {
  41956. var offset = stack[stack.length - 1];
  41957. if (offset > 0) {
  41958. i += offset - 1;
  41959. }
  41960. }
  41961. }
  41962. if (!inFDEF && !inELSE) {
  41963. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41964. if (op >= 0x71 && op <= 0x75) {
  41965. n = stack.pop();
  41966. if (!isNaN(n)) {
  41967. stackDelta = -n * 2;
  41968. }
  41969. }
  41970. while (stackDelta < 0 && stack.length > 0) {
  41971. stack.pop();
  41972. stackDelta++;
  41973. }
  41974. while (stackDelta > 0) {
  41975. stack.push(NaN);
  41976. stackDelta--;
  41977. }
  41978. }
  41979. }
  41980. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41981. var content = [data];
  41982. if (i > data.length) {
  41983. content.push(new Uint8Array(i - data.length));
  41984. }
  41985. if (lastDeff > lastEndf) {
  41986. warn('TT: complementing a missing function tail');
  41987. content.push(new Uint8Array([
  41988. 0x22,
  41989. 0x2D
  41990. ]));
  41991. }
  41992. foldTTTable(table, content);
  41993. }
  41994. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41995. if (ttContext.tooComplexToFollowFunctions) {
  41996. return;
  41997. }
  41998. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  41999. warn('TT: more functions defined than expected');
  42000. ttContext.hintsValid = false;
  42001. return;
  42002. }
  42003. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  42004. if (j > maxFunctionDefs) {
  42005. warn('TT: invalid function id: ' + j);
  42006. ttContext.hintsValid = false;
  42007. return;
  42008. }
  42009. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  42010. warn('TT: undefined function: ' + j);
  42011. ttContext.hintsValid = false;
  42012. return;
  42013. }
  42014. }
  42015. }
  42016. function foldTTTable(table, content) {
  42017. if (content.length > 1) {
  42018. var newLength = 0;
  42019. var j, jj;
  42020. for (j = 0, jj = content.length; j < jj; j++) {
  42021. newLength += content[j].length;
  42022. }
  42023. newLength = newLength + 3 & ~3;
  42024. var result = new Uint8Array(newLength);
  42025. var pos = 0;
  42026. for (j = 0, jj = content.length; j < jj; j++) {
  42027. result.set(content[j], pos);
  42028. pos += content[j].length;
  42029. }
  42030. table.data = result;
  42031. table.length = newLength;
  42032. }
  42033. }
  42034. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  42035. var ttContext = {
  42036. functionsDefined: [],
  42037. functionsUsed: [],
  42038. functionsStackDeltas: [],
  42039. tooComplexToFollowFunctions: false,
  42040. hintsValid: true
  42041. };
  42042. if (fpgm) {
  42043. sanitizeTTProgram(fpgm, ttContext);
  42044. }
  42045. if (prep) {
  42046. sanitizeTTProgram(prep, ttContext);
  42047. }
  42048. if (fpgm) {
  42049. checkInvalidFunctions(ttContext, maxFunctionDefs);
  42050. }
  42051. if (cvt && cvt.length & 1) {
  42052. var cvtData = new Uint8Array(cvt.length + 1);
  42053. cvtData.set(cvt.data);
  42054. cvt.data = cvtData;
  42055. }
  42056. return ttContext.hintsValid;
  42057. }
  42058. font = new Stream(new Uint8Array(font.getBytes()));
  42059. var VALID_TABLES = [
  42060. 'OS/2',
  42061. 'cmap',
  42062. 'head',
  42063. 'hhea',
  42064. 'hmtx',
  42065. 'maxp',
  42066. 'name',
  42067. 'post',
  42068. 'loca',
  42069. 'glyf',
  42070. 'fpgm',
  42071. 'prep',
  42072. 'cvt ',
  42073. 'CFF '
  42074. ];
  42075. var header = readOpenTypeHeader(font);
  42076. var numTables = header.numTables;
  42077. var cff, cffFile;
  42078. var tables = Object.create(null);
  42079. tables['OS/2'] = null;
  42080. tables['cmap'] = null;
  42081. tables['head'] = null;
  42082. tables['hhea'] = null;
  42083. tables['hmtx'] = null;
  42084. tables['maxp'] = null;
  42085. tables['name'] = null;
  42086. tables['post'] = null;
  42087. var table;
  42088. for (var i = 0; i < numTables; i++) {
  42089. table = readTableEntry(font);
  42090. if (VALID_TABLES.indexOf(table.tag) < 0) {
  42091. continue;
  42092. }
  42093. if (table.length === 0) {
  42094. continue;
  42095. }
  42096. tables[table.tag] = table;
  42097. }
  42098. var isTrueType = !tables['CFF '];
  42099. if (!isTrueType) {
  42100. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  42101. cffFile = new Stream(tables['CFF '].data);
  42102. cff = new CFFFont(cffFile, properties);
  42103. adjustWidths(properties);
  42104. return this.convert(name, cff, properties);
  42105. }
  42106. delete tables['glyf'];
  42107. delete tables['loca'];
  42108. delete tables['fpgm'];
  42109. delete tables['prep'];
  42110. delete tables['cvt '];
  42111. this.isOpenType = true;
  42112. } else {
  42113. if (!tables['loca']) {
  42114. error('Required "loca" table is not found');
  42115. }
  42116. if (!tables['glyf']) {
  42117. warn('Required "glyf" table is not found -- trying to recover.');
  42118. tables['glyf'] = {
  42119. tag: 'glyf',
  42120. data: new Uint8Array(0)
  42121. };
  42122. }
  42123. this.isOpenType = false;
  42124. }
  42125. if (!tables['maxp']) {
  42126. error('Required "maxp" table is not found');
  42127. }
  42128. font.pos = (font.start || 0) + tables['maxp'].offset;
  42129. var version = font.getInt32();
  42130. var numGlyphs = font.getUint16();
  42131. var maxFunctionDefs = 0;
  42132. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  42133. font.pos += 8;
  42134. var maxZones = font.getUint16();
  42135. if (maxZones > 2) {
  42136. tables['maxp'].data[14] = 0;
  42137. tables['maxp'].data[15] = 2;
  42138. }
  42139. font.pos += 4;
  42140. maxFunctionDefs = font.getUint16();
  42141. }
  42142. var dupFirstEntry = false;
  42143. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  42144. dupFirstEntry = true;
  42145. numGlyphs++;
  42146. tables['maxp'].data[4] = numGlyphs >> 8;
  42147. tables['maxp'].data[5] = numGlyphs & 255;
  42148. }
  42149. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  42150. if (!hintsValid) {
  42151. delete tables['fpgm'];
  42152. delete tables['prep'];
  42153. delete tables['cvt '];
  42154. }
  42155. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  42156. if (!tables['head']) {
  42157. error('Required "head" table is not found');
  42158. }
  42159. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  42160. var missingGlyphs = Object.create(null);
  42161. if (isTrueType) {
  42162. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  42163. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  42164. }
  42165. if (!tables['hhea']) {
  42166. error('Required "hhea" table is not found');
  42167. }
  42168. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  42169. tables['hhea'].data[10] = 0xFF;
  42170. tables['hhea'].data[11] = 0xFF;
  42171. }
  42172. var metricsOverride = {
  42173. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  42174. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  42175. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  42176. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  42177. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  42178. };
  42179. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  42180. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  42181. if (tables['post']) {
  42182. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  42183. if (!valid) {
  42184. tables['post'] = null;
  42185. }
  42186. }
  42187. var charCodeToGlyphId = [], charCode;
  42188. var toUnicode = properties.toUnicode, widths = properties.widths;
  42189. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  42190. function hasGlyph(glyphId, charCode, widthCode) {
  42191. if (!missingGlyphs[glyphId]) {
  42192. return true;
  42193. }
  42194. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  42195. return true;
  42196. }
  42197. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  42198. return true;
  42199. }
  42200. return false;
  42201. }
  42202. if (properties.composite) {
  42203. var cidToGidMap = properties.cidToGidMap || [];
  42204. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  42205. properties.cMap.forEach(function (charCode, cid) {
  42206. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  42207. var glyphId = -1;
  42208. if (isCidToGidMapEmpty) {
  42209. glyphId = cid;
  42210. } else if (cidToGidMap[cid] !== undefined) {
  42211. glyphId = cidToGidMap[cid];
  42212. }
  42213. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  42214. charCodeToGlyphId[charCode] = glyphId;
  42215. }
  42216. });
  42217. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  42218. charCodeToGlyphId[0] = numGlyphs - 1;
  42219. }
  42220. } else {
  42221. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  42222. var cmapPlatformId = cmapTable.platformId;
  42223. var cmapEncodingId = cmapTable.encodingId;
  42224. var cmapMappings = cmapTable.mappings;
  42225. var cmapMappingsLength = cmapMappings.length;
  42226. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  42227. var baseEncoding = [];
  42228. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  42229. baseEncoding = getEncoding(properties.baseEncodingName);
  42230. }
  42231. var glyphsUnicodeMap = getGlyphsUnicode();
  42232. for (charCode = 0; charCode < 256; charCode++) {
  42233. var glyphName, standardGlyphName;
  42234. if (this.differences && charCode in this.differences) {
  42235. glyphName = this.differences[charCode];
  42236. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  42237. glyphName = baseEncoding[charCode];
  42238. } else {
  42239. glyphName = StandardEncoding[charCode];
  42240. }
  42241. if (!glyphName) {
  42242. continue;
  42243. }
  42244. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42245. var unicodeOrCharCode, isUnicode = false;
  42246. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  42247. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  42248. isUnicode = true;
  42249. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  42250. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  42251. }
  42252. var found = false;
  42253. for (i = 0; i < cmapMappingsLength; ++i) {
  42254. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  42255. continue;
  42256. }
  42257. var code = isUnicode ? charCode : unicodeOrCharCode;
  42258. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  42259. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42260. found = true;
  42261. break;
  42262. }
  42263. }
  42264. if (!found && properties.glyphNames) {
  42265. var glyphId = properties.glyphNames.indexOf(glyphName);
  42266. if (glyphId === -1 && standardGlyphName !== glyphName) {
  42267. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  42268. }
  42269. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  42270. charCodeToGlyphId[charCode] = glyphId;
  42271. found = true;
  42272. }
  42273. }
  42274. if (!found) {
  42275. charCodeToGlyphId[charCode] = 0;
  42276. }
  42277. }
  42278. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  42279. for (i = 0; i < cmapMappingsLength; ++i) {
  42280. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  42281. }
  42282. } else {
  42283. for (i = 0; i < cmapMappingsLength; ++i) {
  42284. charCode = cmapMappings[i].charCode & 0xFF;
  42285. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42286. }
  42287. }
  42288. }
  42289. if (charCodeToGlyphId.length === 0) {
  42290. charCodeToGlyphId[0] = 0;
  42291. }
  42292. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  42293. this.toFontChar = newMapping.toFontChar;
  42294. tables['cmap'] = {
  42295. tag: 'cmap',
  42296. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  42297. };
  42298. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  42299. tables['OS/2'] = {
  42300. tag: 'OS/2',
  42301. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  42302. };
  42303. }
  42304. if (!tables['post']) {
  42305. tables['post'] = {
  42306. tag: 'post',
  42307. data: createPostTable(properties)
  42308. };
  42309. }
  42310. if (!isTrueType) {
  42311. try {
  42312. cffFile = new Stream(tables['CFF '].data);
  42313. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  42314. cff = parser.parse();
  42315. var compiler = new CFFCompiler(cff);
  42316. tables['CFF '].data = compiler.compile();
  42317. } catch (e) {
  42318. warn('Failed to compile font ' + properties.loadedName);
  42319. }
  42320. }
  42321. if (!tables['name']) {
  42322. tables['name'] = {
  42323. tag: 'name',
  42324. data: createNameTable(this.name)
  42325. };
  42326. } else {
  42327. var namePrototype = readNameTable(tables['name']);
  42328. tables['name'].data = createNameTable(name, namePrototype);
  42329. }
  42330. var builder = new OpenTypeFileBuilder(header.version);
  42331. for (var tableTag in tables) {
  42332. builder.addTable(tableTag, tables[tableTag].data);
  42333. }
  42334. return builder.toArray();
  42335. },
  42336. convert: function Font_convert(fontName, font, properties) {
  42337. properties.fixedPitch = false;
  42338. if (properties.builtInEncoding) {
  42339. adjustToUnicode(properties, properties.builtInEncoding);
  42340. }
  42341. var mapping = font.getGlyphMapping(properties);
  42342. var newMapping = adjustMapping(mapping, properties);
  42343. this.toFontChar = newMapping.toFontChar;
  42344. var numGlyphs = font.numGlyphs;
  42345. function getCharCodes(charCodeToGlyphId, glyphId) {
  42346. var charCodes = null;
  42347. for (var charCode in charCodeToGlyphId) {
  42348. if (glyphId === charCodeToGlyphId[charCode]) {
  42349. if (!charCodes) {
  42350. charCodes = [];
  42351. }
  42352. charCodes.push(charCode | 0);
  42353. }
  42354. }
  42355. return charCodes;
  42356. }
  42357. function createCharCode(charCodeToGlyphId, glyphId) {
  42358. for (var charCode in charCodeToGlyphId) {
  42359. if (glyphId === charCodeToGlyphId[charCode]) {
  42360. return charCode | 0;
  42361. }
  42362. }
  42363. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  42364. return newMapping.nextAvailableFontCharCode++;
  42365. }
  42366. var seacs = font.seacs;
  42367. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  42368. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  42369. var charset = font.getCharset();
  42370. var seacMap = Object.create(null);
  42371. for (var glyphId in seacs) {
  42372. glyphId |= 0;
  42373. var seac = seacs[glyphId];
  42374. var baseGlyphName = StandardEncoding[seac[2]];
  42375. var accentGlyphName = StandardEncoding[seac[3]];
  42376. var baseGlyphId = charset.indexOf(baseGlyphName);
  42377. var accentGlyphId = charset.indexOf(accentGlyphName);
  42378. if (baseGlyphId < 0 || accentGlyphId < 0) {
  42379. continue;
  42380. }
  42381. var accentOffset = {
  42382. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  42383. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  42384. };
  42385. var charCodes = getCharCodes(mapping, glyphId);
  42386. if (!charCodes) {
  42387. continue;
  42388. }
  42389. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  42390. var charCode = charCodes[i];
  42391. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  42392. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  42393. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  42394. seacMap[charCode] = {
  42395. baseFontCharCode: baseFontCharCode,
  42396. accentFontCharCode: accentFontCharCode,
  42397. accentOffset: accentOffset
  42398. };
  42399. }
  42400. }
  42401. properties.seacMap = seacMap;
  42402. }
  42403. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  42404. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  42405. builder.addTable('CFF ', font.data);
  42406. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  42407. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  42408. 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');
  42409. 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));
  42410. builder.addTable('hmtx', function fontFieldsHmtx() {
  42411. var charstrings = font.charstrings;
  42412. var cffWidths = font.cff ? font.cff.widths : null;
  42413. var hmtx = '\x00\x00\x00\x00';
  42414. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  42415. var width = 0;
  42416. if (charstrings) {
  42417. var charstring = charstrings[i - 1];
  42418. width = 'width' in charstring ? charstring.width : 0;
  42419. } else if (cffWidths) {
  42420. width = Math.ceil(cffWidths[i] || 0);
  42421. }
  42422. hmtx += string16(width) + string16(0);
  42423. }
  42424. return hmtx;
  42425. }());
  42426. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  42427. builder.addTable('name', createNameTable(fontName));
  42428. builder.addTable('post', createPostTable(properties));
  42429. return builder.toArray();
  42430. },
  42431. get spaceWidth() {
  42432. if ('_shadowWidth' in this) {
  42433. return this._shadowWidth;
  42434. }
  42435. var possibleSpaceReplacements = [
  42436. 'space',
  42437. 'minus',
  42438. 'one',
  42439. 'i',
  42440. 'I'
  42441. ];
  42442. var width;
  42443. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  42444. var glyphName = possibleSpaceReplacements[i];
  42445. if (glyphName in this.widths) {
  42446. width = this.widths[glyphName];
  42447. break;
  42448. }
  42449. var glyphsUnicodeMap = getGlyphsUnicode();
  42450. var glyphUnicode = glyphsUnicodeMap[glyphName];
  42451. var charcode = 0;
  42452. if (this.composite) {
  42453. if (this.cMap.contains(glyphUnicode)) {
  42454. charcode = this.cMap.lookup(glyphUnicode);
  42455. }
  42456. }
  42457. if (!charcode && this.toUnicode) {
  42458. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  42459. }
  42460. if (charcode <= 0) {
  42461. charcode = glyphUnicode;
  42462. }
  42463. width = this.widths[charcode];
  42464. if (width) {
  42465. break;
  42466. }
  42467. }
  42468. width = width || this.defaultWidth;
  42469. this._shadowWidth = width;
  42470. return width;
  42471. },
  42472. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  42473. var fontCharCode, width, operatorListId;
  42474. var widthCode = charcode;
  42475. if (this.cMap && this.cMap.contains(charcode)) {
  42476. widthCode = this.cMap.lookup(charcode);
  42477. }
  42478. width = this.widths[widthCode];
  42479. width = isNum(width) ? width : this.defaultWidth;
  42480. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  42481. var unicode = this.toUnicode.get(charcode) || charcode;
  42482. if (typeof unicode === 'number') {
  42483. unicode = String.fromCharCode(unicode);
  42484. }
  42485. var isInFont = charcode in this.toFontChar;
  42486. fontCharCode = this.toFontChar[charcode] || charcode;
  42487. if (this.missingFile) {
  42488. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  42489. }
  42490. if (this.isType3Font) {
  42491. operatorListId = fontCharCode;
  42492. }
  42493. var accent = null;
  42494. if (this.seacMap && this.seacMap[charcode]) {
  42495. isInFont = true;
  42496. var seac = this.seacMap[charcode];
  42497. fontCharCode = seac.baseFontCharCode;
  42498. accent = {
  42499. fontChar: String.fromCharCode(seac.accentFontCharCode),
  42500. offset: seac.accentOffset
  42501. };
  42502. }
  42503. var fontChar = String.fromCharCode(fontCharCode);
  42504. var glyph = this.glyphCache[charcode];
  42505. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  42506. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  42507. this.glyphCache[charcode] = glyph;
  42508. }
  42509. return glyph;
  42510. },
  42511. charsToGlyphs: function Font_charsToGlyphs(chars) {
  42512. var charsCache = this.charsCache;
  42513. var glyphs, glyph, charcode;
  42514. if (charsCache) {
  42515. glyphs = charsCache[chars];
  42516. if (glyphs) {
  42517. return glyphs;
  42518. }
  42519. }
  42520. if (!charsCache) {
  42521. charsCache = this.charsCache = Object.create(null);
  42522. }
  42523. glyphs = [];
  42524. var charsCacheKey = chars;
  42525. var i = 0, ii;
  42526. if (this.cMap) {
  42527. var c = Object.create(null);
  42528. while (i < chars.length) {
  42529. this.cMap.readCharCode(chars, i, c);
  42530. charcode = c.charcode;
  42531. var length = c.length;
  42532. i += length;
  42533. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  42534. glyph = this.charToGlyph(charcode, isSpace);
  42535. glyphs.push(glyph);
  42536. }
  42537. } else {
  42538. for (i = 0, ii = chars.length; i < ii; ++i) {
  42539. charcode = chars.charCodeAt(i);
  42540. glyph = this.charToGlyph(charcode, charcode === 0x20);
  42541. glyphs.push(glyph);
  42542. }
  42543. }
  42544. return charsCache[charsCacheKey] = glyphs;
  42545. }
  42546. };
  42547. return Font;
  42548. }();
  42549. var ErrorFont = function ErrorFontClosure() {
  42550. function ErrorFont(error) {
  42551. this.error = error;
  42552. this.loadedName = 'g_font_error';
  42553. this.loading = false;
  42554. }
  42555. ErrorFont.prototype = {
  42556. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  42557. return [];
  42558. },
  42559. exportData: function ErrorFont_exportData() {
  42560. return { error: this.error };
  42561. }
  42562. };
  42563. return ErrorFont;
  42564. }();
  42565. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  42566. var charCodeToGlyphId = Object.create(null);
  42567. var glyphId, charCode, baseEncoding;
  42568. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  42569. if (properties.baseEncodingName) {
  42570. baseEncoding = getEncoding(properties.baseEncodingName);
  42571. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42572. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42573. if (glyphId >= 0) {
  42574. charCodeToGlyphId[charCode] = glyphId;
  42575. } else {
  42576. charCodeToGlyphId[charCode] = 0;
  42577. }
  42578. }
  42579. } else if (isSymbolicFont) {
  42580. for (charCode in builtInEncoding) {
  42581. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  42582. }
  42583. } else {
  42584. baseEncoding = StandardEncoding;
  42585. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42586. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42587. if (glyphId >= 0) {
  42588. charCodeToGlyphId[charCode] = glyphId;
  42589. } else {
  42590. charCodeToGlyphId[charCode] = 0;
  42591. }
  42592. }
  42593. }
  42594. var differences = properties.differences, glyphsUnicodeMap;
  42595. if (differences) {
  42596. for (charCode in differences) {
  42597. var glyphName = differences[charCode];
  42598. glyphId = glyphNames.indexOf(glyphName);
  42599. if (glyphId === -1) {
  42600. if (!glyphsUnicodeMap) {
  42601. glyphsUnicodeMap = getGlyphsUnicode();
  42602. }
  42603. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42604. if (standardGlyphName !== glyphName) {
  42605. glyphId = glyphNames.indexOf(standardGlyphName);
  42606. }
  42607. }
  42608. if (glyphId >= 0) {
  42609. charCodeToGlyphId[charCode] = glyphId;
  42610. } else {
  42611. charCodeToGlyphId[charCode] = 0;
  42612. }
  42613. }
  42614. }
  42615. return charCodeToGlyphId;
  42616. }
  42617. var Type1Font = function Type1FontClosure() {
  42618. function findBlock(streamBytes, signature, startIndex) {
  42619. var streamBytesLength = streamBytes.length;
  42620. var signatureLength = signature.length;
  42621. var scanLength = streamBytesLength - signatureLength;
  42622. var i = startIndex, j, found = false;
  42623. while (i < scanLength) {
  42624. j = 0;
  42625. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42626. j++;
  42627. }
  42628. if (j >= signatureLength) {
  42629. i += j;
  42630. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  42631. i++;
  42632. }
  42633. found = true;
  42634. break;
  42635. }
  42636. i++;
  42637. }
  42638. return {
  42639. found: found,
  42640. length: i
  42641. };
  42642. }
  42643. function getHeaderBlock(stream, suggestedLength) {
  42644. var EEXEC_SIGNATURE = [
  42645. 0x65,
  42646. 0x65,
  42647. 0x78,
  42648. 0x65,
  42649. 0x63
  42650. ];
  42651. var streamStartPos = stream.pos;
  42652. var headerBytes, headerBytesLength, block;
  42653. try {
  42654. headerBytes = stream.getBytes(suggestedLength);
  42655. headerBytesLength = headerBytes.length;
  42656. } catch (ex) {
  42657. if (ex instanceof MissingDataException) {
  42658. throw ex;
  42659. }
  42660. }
  42661. if (headerBytesLength === suggestedLength) {
  42662. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42663. if (block.found && block.length === suggestedLength) {
  42664. return {
  42665. stream: new Stream(headerBytes),
  42666. length: suggestedLength
  42667. };
  42668. }
  42669. }
  42670. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  42671. stream.pos = streamStartPos;
  42672. var SCAN_BLOCK_LENGTH = 2048;
  42673. var actualLength;
  42674. while (true) {
  42675. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42676. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42677. if (block.length === 0) {
  42678. break;
  42679. }
  42680. stream.pos += block.length;
  42681. if (block.found) {
  42682. actualLength = stream.pos - streamStartPos;
  42683. break;
  42684. }
  42685. }
  42686. stream.pos = streamStartPos;
  42687. if (actualLength) {
  42688. return {
  42689. stream: new Stream(stream.getBytes(actualLength)),
  42690. length: actualLength
  42691. };
  42692. }
  42693. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  42694. return {
  42695. stream: new Stream(stream.getBytes(suggestedLength)),
  42696. length: suggestedLength
  42697. };
  42698. }
  42699. function getEexecBlock(stream, suggestedLength) {
  42700. var eexecBytes = stream.getBytes();
  42701. return {
  42702. stream: new Stream(eexecBytes),
  42703. length: eexecBytes.length
  42704. };
  42705. }
  42706. function Type1Font(name, file, properties) {
  42707. var PFB_HEADER_SIZE = 6;
  42708. var headerBlockLength = properties.length1;
  42709. var eexecBlockLength = properties.length2;
  42710. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42711. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42712. if (pfbHeaderPresent) {
  42713. file.skip(PFB_HEADER_SIZE);
  42714. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42715. }
  42716. var headerBlock = getHeaderBlock(file, headerBlockLength);
  42717. headerBlockLength = headerBlock.length;
  42718. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  42719. headerBlockParser.extractFontHeader(properties);
  42720. if (pfbHeaderPresent) {
  42721. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42722. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42723. }
  42724. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  42725. eexecBlockLength = eexecBlock.length;
  42726. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  42727. var data = eexecBlockParser.extractFontProgram();
  42728. for (var info in data.properties) {
  42729. properties[info] = data.properties[info];
  42730. }
  42731. var charstrings = data.charstrings;
  42732. var type2Charstrings = this.getType2Charstrings(charstrings);
  42733. var subrs = this.getType2Subrs(data.subrs);
  42734. this.charstrings = charstrings;
  42735. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42736. this.seacs = this.getSeacs(data.charstrings);
  42737. }
  42738. Type1Font.prototype = {
  42739. get numGlyphs() {
  42740. return this.charstrings.length + 1;
  42741. },
  42742. getCharset: function Type1Font_getCharset() {
  42743. var charset = ['.notdef'];
  42744. var charstrings = this.charstrings;
  42745. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42746. charset.push(charstrings[glyphId].glyphName);
  42747. }
  42748. return charset;
  42749. },
  42750. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  42751. var charstrings = this.charstrings;
  42752. var glyphNames = ['.notdef'], glyphId;
  42753. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42754. glyphNames.push(charstrings[glyphId].glyphName);
  42755. }
  42756. var encoding = properties.builtInEncoding;
  42757. if (encoding) {
  42758. var builtInEncoding = Object.create(null);
  42759. for (var charCode in encoding) {
  42760. glyphId = glyphNames.indexOf(encoding[charCode]);
  42761. if (glyphId >= 0) {
  42762. builtInEncoding[charCode] = glyphId;
  42763. }
  42764. }
  42765. }
  42766. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  42767. },
  42768. getSeacs: function Type1Font_getSeacs(charstrings) {
  42769. var i, ii;
  42770. var seacMap = [];
  42771. for (i = 0, ii = charstrings.length; i < ii; i++) {
  42772. var charstring = charstrings[i];
  42773. if (charstring.seac) {
  42774. seacMap[i + 1] = charstring.seac;
  42775. }
  42776. }
  42777. return seacMap;
  42778. },
  42779. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  42780. var type2Charstrings = [];
  42781. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42782. type2Charstrings.push(type1Charstrings[i].charstring);
  42783. }
  42784. return type2Charstrings;
  42785. },
  42786. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  42787. var bias = 0;
  42788. var count = type1Subrs.length;
  42789. if (count < 1133) {
  42790. bias = 107;
  42791. } else if (count < 33769) {
  42792. bias = 1131;
  42793. } else {
  42794. bias = 32768;
  42795. }
  42796. var type2Subrs = [];
  42797. var i;
  42798. for (i = 0; i < bias; i++) {
  42799. type2Subrs.push([0x0B]);
  42800. }
  42801. for (i = 0; i < count; i++) {
  42802. type2Subrs.push(type1Subrs[i]);
  42803. }
  42804. return type2Subrs;
  42805. },
  42806. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  42807. var cff = new CFF();
  42808. cff.header = new CFFHeader(1, 0, 4, 4);
  42809. cff.names = [name];
  42810. var topDict = new CFFTopDict();
  42811. topDict.setByName('version', 391);
  42812. topDict.setByName('Notice', 392);
  42813. topDict.setByName('FullName', 393);
  42814. topDict.setByName('FamilyName', 394);
  42815. topDict.setByName('Weight', 395);
  42816. topDict.setByName('Encoding', null);
  42817. topDict.setByName('FontMatrix', properties.fontMatrix);
  42818. topDict.setByName('FontBBox', properties.bbox);
  42819. topDict.setByName('charset', null);
  42820. topDict.setByName('CharStrings', null);
  42821. topDict.setByName('Private', null);
  42822. cff.topDict = topDict;
  42823. var strings = new CFFStrings();
  42824. strings.add('Version 0.11');
  42825. strings.add('See original notice');
  42826. strings.add(name);
  42827. strings.add(name);
  42828. strings.add('Medium');
  42829. cff.strings = strings;
  42830. cff.globalSubrIndex = new CFFIndex();
  42831. var count = glyphs.length;
  42832. var charsetArray = [0];
  42833. var i, ii;
  42834. for (i = 0; i < count; i++) {
  42835. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  42836. if (index === -1) {
  42837. index = 0;
  42838. }
  42839. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  42840. }
  42841. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42842. var charStringsIndex = new CFFIndex();
  42843. charStringsIndex.add([
  42844. 0x8B,
  42845. 0x0E
  42846. ]);
  42847. for (i = 0; i < count; i++) {
  42848. var glyph = glyphs[i];
  42849. if (glyph.length === 0) {
  42850. charStringsIndex.add([
  42851. 0x8B,
  42852. 0x0E
  42853. ]);
  42854. continue;
  42855. }
  42856. charStringsIndex.add(glyph);
  42857. }
  42858. cff.charStrings = charStringsIndex;
  42859. var privateDict = new CFFPrivateDict();
  42860. privateDict.setByName('Subrs', null);
  42861. var fields = [
  42862. 'BlueValues',
  42863. 'OtherBlues',
  42864. 'FamilyBlues',
  42865. 'FamilyOtherBlues',
  42866. 'StemSnapH',
  42867. 'StemSnapV',
  42868. 'BlueShift',
  42869. 'BlueFuzz',
  42870. 'BlueScale',
  42871. 'LanguageGroup',
  42872. 'ExpansionFactor',
  42873. 'ForceBold',
  42874. 'StdHW',
  42875. 'StdVW'
  42876. ];
  42877. for (i = 0, ii = fields.length; i < ii; i++) {
  42878. var field = fields[i];
  42879. if (!(field in properties.privateData)) {
  42880. continue;
  42881. }
  42882. var value = properties.privateData[field];
  42883. if (isArray(value)) {
  42884. for (var j = value.length - 1; j > 0; j--) {
  42885. value[j] -= value[j - 1];
  42886. }
  42887. }
  42888. privateDict.setByName(field, value);
  42889. }
  42890. cff.topDict.privateDict = privateDict;
  42891. var subrIndex = new CFFIndex();
  42892. for (i = 0, ii = subrs.length; i < ii; i++) {
  42893. subrIndex.add(subrs[i]);
  42894. }
  42895. privateDict.subrsIndex = subrIndex;
  42896. var compiler = new CFFCompiler(cff);
  42897. return compiler.compile();
  42898. }
  42899. };
  42900. return Type1Font;
  42901. }();
  42902. var CFFFont = function CFFFontClosure() {
  42903. function CFFFont(file, properties) {
  42904. this.properties = properties;
  42905. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42906. this.cff = parser.parse();
  42907. var compiler = new CFFCompiler(this.cff);
  42908. this.seacs = this.cff.seacs;
  42909. try {
  42910. this.data = compiler.compile();
  42911. } catch (e) {
  42912. warn('Failed to compile font ' + properties.loadedName);
  42913. this.data = file;
  42914. }
  42915. }
  42916. CFFFont.prototype = {
  42917. get numGlyphs() {
  42918. return this.cff.charStrings.count;
  42919. },
  42920. getCharset: function CFFFont_getCharset() {
  42921. return this.cff.charset.charset;
  42922. },
  42923. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42924. var cff = this.cff;
  42925. var properties = this.properties;
  42926. var charsets = cff.charset.charset;
  42927. var charCodeToGlyphId;
  42928. var glyphId;
  42929. if (properties.composite) {
  42930. charCodeToGlyphId = Object.create(null);
  42931. if (cff.isCIDFont) {
  42932. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42933. var cid = charsets[glyphId];
  42934. var charCode = properties.cMap.charCodeOf(cid);
  42935. charCodeToGlyphId[charCode] = glyphId;
  42936. }
  42937. } else {
  42938. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42939. charCodeToGlyphId[glyphId] = glyphId;
  42940. }
  42941. }
  42942. return charCodeToGlyphId;
  42943. }
  42944. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42945. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42946. return charCodeToGlyphId;
  42947. }
  42948. };
  42949. return CFFFont;
  42950. }();
  42951. (function checkSeacSupport() {
  42952. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42953. SEAC_ANALYSIS_ENABLED = true;
  42954. }
  42955. }());
  42956. (function checkChromeWindows() {
  42957. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42958. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42959. }
  42960. }());
  42961. exports.ErrorFont = ErrorFont;
  42962. exports.Font = Font;
  42963. exports.FontFlags = FontFlags;
  42964. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42965. exports.ToUnicodeMap = ToUnicodeMap;
  42966. exports.getFontType = getFontType;
  42967. /***/ }),
  42968. /* 27 */
  42969. /***/ (function(module, exports, __w_pdfjs_require__) {
  42970. "use strict";
  42971. var sharedUtil = __w_pdfjs_require__(0);
  42972. var corePrimitives = __w_pdfjs_require__(1);
  42973. var coreColorSpace = __w_pdfjs_require__(3);
  42974. var coreStream = __w_pdfjs_require__(2);
  42975. var coreJpx = __w_pdfjs_require__(14);
  42976. var ImageKind = sharedUtil.ImageKind;
  42977. var assert = sharedUtil.assert;
  42978. var error = sharedUtil.error;
  42979. var info = sharedUtil.info;
  42980. var isArray = sharedUtil.isArray;
  42981. var warn = sharedUtil.warn;
  42982. var Name = corePrimitives.Name;
  42983. var isStream = corePrimitives.isStream;
  42984. var ColorSpace = coreColorSpace.ColorSpace;
  42985. var DecodeStream = coreStream.DecodeStream;
  42986. var JpegStream = coreStream.JpegStream;
  42987. var JpxImage = coreJpx.JpxImage;
  42988. var PDFImage = function PDFImageClosure() {
  42989. function handleImageData(image, nativeDecoder) {
  42990. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42991. return nativeDecoder.decode(image);
  42992. }
  42993. return Promise.resolve(image);
  42994. }
  42995. function decodeAndClamp(value, addend, coefficient, max) {
  42996. value = addend + value * coefficient;
  42997. return value < 0 ? 0 : value > max ? max : value;
  42998. }
  42999. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  43000. var length = w2 * h2;
  43001. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43002. var xRatio = w1 / w2;
  43003. var yRatio = h1 / h2;
  43004. var i, j, py, newIndex = 0, oldIndex;
  43005. var xScaled = new Uint16Array(w2);
  43006. var w1Scanline = w1;
  43007. for (i = 0; i < w2; i++) {
  43008. xScaled[i] = Math.floor(i * xRatio);
  43009. }
  43010. for (i = 0; i < h2; i++) {
  43011. py = Math.floor(i * yRatio) * w1Scanline;
  43012. for (j = 0; j < w2; j++) {
  43013. oldIndex = py + xScaled[j];
  43014. dest[newIndex++] = src[oldIndex];
  43015. }
  43016. }
  43017. return dest;
  43018. }
  43019. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  43020. this.image = image;
  43021. var dict = image.dict;
  43022. if (dict.has('Filter')) {
  43023. var filter = dict.get('Filter').name;
  43024. if (filter === 'JPXDecode') {
  43025. var jpxImage = new JpxImage();
  43026. jpxImage.parseImageProperties(image.stream);
  43027. image.stream.reset();
  43028. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43029. image.numComps = jpxImage.componentsCount;
  43030. } else if (filter === 'JBIG2Decode') {
  43031. image.bitsPerComponent = 1;
  43032. image.numComps = 1;
  43033. }
  43034. }
  43035. this.width = dict.get('Width', 'W');
  43036. this.height = dict.get('Height', 'H');
  43037. if (this.width < 1 || this.height < 1) {
  43038. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  43039. }
  43040. this.interpolate = dict.get('Interpolate', 'I') || false;
  43041. this.imageMask = dict.get('ImageMask', 'IM') || false;
  43042. this.matte = dict.get('Matte') || false;
  43043. var bitsPerComponent = image.bitsPerComponent;
  43044. if (!bitsPerComponent) {
  43045. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  43046. if (!bitsPerComponent) {
  43047. if (this.imageMask) {
  43048. bitsPerComponent = 1;
  43049. } else {
  43050. error('Bits per component missing in image: ' + this.imageMask);
  43051. }
  43052. }
  43053. }
  43054. this.bpc = bitsPerComponent;
  43055. if (!this.imageMask) {
  43056. var colorSpace = dict.get('ColorSpace', 'CS');
  43057. if (!colorSpace) {
  43058. info('JPX images (which do not require color spaces)');
  43059. switch (image.numComps) {
  43060. case 1:
  43061. colorSpace = Name.get('DeviceGray');
  43062. break;
  43063. case 3:
  43064. colorSpace = Name.get('DeviceRGB');
  43065. break;
  43066. case 4:
  43067. colorSpace = Name.get('DeviceCMYK');
  43068. break;
  43069. default:
  43070. error('JPX images with ' + this.numComps + ' color components not supported.');
  43071. }
  43072. }
  43073. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  43074. this.numComps = this.colorSpace.numComps;
  43075. }
  43076. this.decode = dict.getArray('Decode', 'D');
  43077. this.needsDecode = false;
  43078. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  43079. this.needsDecode = true;
  43080. var max = (1 << bitsPerComponent) - 1;
  43081. this.decodeCoefficients = [];
  43082. this.decodeAddends = [];
  43083. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43084. var dmin = this.decode[i];
  43085. var dmax = this.decode[i + 1];
  43086. this.decodeCoefficients[j] = dmax - dmin;
  43087. this.decodeAddends[j] = max * dmin;
  43088. }
  43089. }
  43090. if (smask) {
  43091. this.smask = new PDFImage(xref, res, smask, false);
  43092. } else if (mask) {
  43093. if (isStream(mask)) {
  43094. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  43095. if (!imageMask) {
  43096. warn('Ignoring /Mask in image without /ImageMask.');
  43097. } else {
  43098. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  43099. }
  43100. } else {
  43101. this.mask = mask;
  43102. }
  43103. }
  43104. }
  43105. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  43106. var imagePromise = handleImageData(image, nativeDecoder);
  43107. var smaskPromise;
  43108. var maskPromise;
  43109. var smask = image.dict.get('SMask');
  43110. var mask = image.dict.get('Mask');
  43111. if (smask) {
  43112. smaskPromise = handleImageData(smask, nativeDecoder);
  43113. maskPromise = Promise.resolve(null);
  43114. } else {
  43115. smaskPromise = Promise.resolve(null);
  43116. if (mask) {
  43117. if (isStream(mask)) {
  43118. maskPromise = handleImageData(mask, nativeDecoder);
  43119. } else if (isArray(mask)) {
  43120. maskPromise = Promise.resolve(mask);
  43121. } else {
  43122. warn('Unsupported mask format.');
  43123. maskPromise = Promise.resolve(null);
  43124. }
  43125. } else {
  43126. maskPromise = Promise.resolve(null);
  43127. }
  43128. }
  43129. return Promise.all([
  43130. imagePromise,
  43131. smaskPromise,
  43132. maskPromise
  43133. ]).then(function (results) {
  43134. var imageData = results[0];
  43135. var smaskData = results[1];
  43136. var maskData = results[2];
  43137. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  43138. });
  43139. };
  43140. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  43141. var computedLength = (width + 7 >> 3) * height;
  43142. var actualLength = imgArray.byteLength;
  43143. var haveFullData = computedLength === actualLength;
  43144. var data, i;
  43145. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43146. data = imgArray;
  43147. } else if (!inverseDecode) {
  43148. data = new Uint8Array(actualLength);
  43149. data.set(imgArray);
  43150. } else {
  43151. data = new Uint8Array(computedLength);
  43152. data.set(imgArray);
  43153. for (i = actualLength; i < computedLength; i++) {
  43154. data[i] = 0xff;
  43155. }
  43156. }
  43157. if (inverseDecode) {
  43158. for (i = 0; i < actualLength; i++) {
  43159. data[i] = ~data[i];
  43160. }
  43161. }
  43162. return {
  43163. data: data,
  43164. width: width,
  43165. height: height
  43166. };
  43167. };
  43168. PDFImage.prototype = {
  43169. get drawWidth() {
  43170. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43171. },
  43172. get drawHeight() {
  43173. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43174. },
  43175. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  43176. var bpc = this.bpc;
  43177. var numComps = this.numComps;
  43178. var decodeAddends = this.decodeAddends;
  43179. var decodeCoefficients = this.decodeCoefficients;
  43180. var max = (1 << bpc) - 1;
  43181. var i, ii;
  43182. if (bpc === 1) {
  43183. for (i = 0, ii = buffer.length; i < ii; i++) {
  43184. buffer[i] = +!buffer[i];
  43185. }
  43186. return;
  43187. }
  43188. var index = 0;
  43189. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43190. for (var j = 0; j < numComps; j++) {
  43191. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43192. index++;
  43193. }
  43194. }
  43195. },
  43196. getComponents: function PDFImage_getComponents(buffer) {
  43197. var bpc = this.bpc;
  43198. if (bpc === 8) {
  43199. return buffer;
  43200. }
  43201. var width = this.width;
  43202. var height = this.height;
  43203. var numComps = this.numComps;
  43204. var length = width * height * numComps;
  43205. var bufferPos = 0;
  43206. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43207. var rowComps = width * numComps;
  43208. var max = (1 << bpc) - 1;
  43209. var i = 0, ii, buf;
  43210. if (bpc === 1) {
  43211. var mask, loop1End, loop2End;
  43212. for (var j = 0; j < height; j++) {
  43213. loop1End = i + (rowComps & ~7);
  43214. loop2End = i + rowComps;
  43215. while (i < loop1End) {
  43216. buf = buffer[bufferPos++];
  43217. output[i] = buf >> 7 & 1;
  43218. output[i + 1] = buf >> 6 & 1;
  43219. output[i + 2] = buf >> 5 & 1;
  43220. output[i + 3] = buf >> 4 & 1;
  43221. output[i + 4] = buf >> 3 & 1;
  43222. output[i + 5] = buf >> 2 & 1;
  43223. output[i + 6] = buf >> 1 & 1;
  43224. output[i + 7] = buf & 1;
  43225. i += 8;
  43226. }
  43227. if (i < loop2End) {
  43228. buf = buffer[bufferPos++];
  43229. mask = 128;
  43230. while (i < loop2End) {
  43231. output[i++] = +!!(buf & mask);
  43232. mask >>= 1;
  43233. }
  43234. }
  43235. }
  43236. } else {
  43237. var bits = 0;
  43238. buf = 0;
  43239. for (i = 0, ii = length; i < ii; ++i) {
  43240. if (i % rowComps === 0) {
  43241. buf = 0;
  43242. bits = 0;
  43243. }
  43244. while (bits < bpc) {
  43245. buf = buf << 8 | buffer[bufferPos++];
  43246. bits += 8;
  43247. }
  43248. var remainingBits = bits - bpc;
  43249. var value = buf >> remainingBits;
  43250. output[i] = value < 0 ? 0 : value > max ? max : value;
  43251. buf = buf & (1 << remainingBits) - 1;
  43252. bits = remainingBits;
  43253. }
  43254. }
  43255. return output;
  43256. },
  43257. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43258. var smask = this.smask;
  43259. var mask = this.mask;
  43260. var alphaBuf, sw, sh, i, ii, j;
  43261. if (smask) {
  43262. sw = smask.width;
  43263. sh = smask.height;
  43264. alphaBuf = new Uint8Array(sw * sh);
  43265. smask.fillGrayBuffer(alphaBuf);
  43266. if (sw !== width || sh !== height) {
  43267. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43268. }
  43269. } else if (mask) {
  43270. if (mask instanceof PDFImage) {
  43271. sw = mask.width;
  43272. sh = mask.height;
  43273. alphaBuf = new Uint8Array(sw * sh);
  43274. mask.numComps = 1;
  43275. mask.fillGrayBuffer(alphaBuf);
  43276. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43277. alphaBuf[i] = 255 - alphaBuf[i];
  43278. }
  43279. if (sw !== width || sh !== height) {
  43280. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43281. }
  43282. } else if (isArray(mask)) {
  43283. alphaBuf = new Uint8Array(width * height);
  43284. var numComps = this.numComps;
  43285. for (i = 0, ii = width * height; i < ii; ++i) {
  43286. var opacity = 0;
  43287. var imageOffset = i * numComps;
  43288. for (j = 0; j < numComps; ++j) {
  43289. var color = image[imageOffset + j];
  43290. var maskOffset = j * 2;
  43291. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43292. opacity = 255;
  43293. break;
  43294. }
  43295. }
  43296. alphaBuf[i] = opacity;
  43297. }
  43298. } else {
  43299. error('Unknown mask format.');
  43300. }
  43301. }
  43302. if (alphaBuf) {
  43303. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43304. rgbaBuf[j] = alphaBuf[i];
  43305. }
  43306. } else {
  43307. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43308. rgbaBuf[j] = 255;
  43309. }
  43310. }
  43311. },
  43312. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  43313. var matte = this.smask && this.smask.matte;
  43314. if (!matte) {
  43315. return;
  43316. }
  43317. var matteRgb = this.colorSpace.getRgb(matte, 0);
  43318. var matteR = matteRgb[0];
  43319. var matteG = matteRgb[1];
  43320. var matteB = matteRgb[2];
  43321. var length = width * height * 4;
  43322. var r, g, b;
  43323. for (var i = 0; i < length; i += 4) {
  43324. var alpha = buffer[i + 3];
  43325. if (alpha === 0) {
  43326. buffer[i] = 255;
  43327. buffer[i + 1] = 255;
  43328. buffer[i + 2] = 255;
  43329. continue;
  43330. }
  43331. var k = 255 / alpha;
  43332. r = (buffer[i] - matteR) * k + matteR;
  43333. g = (buffer[i + 1] - matteG) * k + matteG;
  43334. b = (buffer[i + 2] - matteB) * k + matteB;
  43335. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  43336. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  43337. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  43338. }
  43339. },
  43340. createImageData: function PDFImage_createImageData(forceRGBA) {
  43341. var drawWidth = this.drawWidth;
  43342. var drawHeight = this.drawHeight;
  43343. var imgData = {
  43344. width: drawWidth,
  43345. height: drawHeight
  43346. };
  43347. var numComps = this.numComps;
  43348. var originalWidth = this.width;
  43349. var originalHeight = this.height;
  43350. var bpc = this.bpc;
  43351. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43352. var imgArray;
  43353. if (!forceRGBA) {
  43354. var kind;
  43355. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  43356. kind = ImageKind.GRAYSCALE_1BPP;
  43357. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  43358. kind = ImageKind.RGB_24BPP;
  43359. }
  43360. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43361. imgData.kind = kind;
  43362. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43363. if (this.image instanceof DecodeStream) {
  43364. imgData.data = imgArray;
  43365. } else {
  43366. var newArray = new Uint8Array(imgArray.length);
  43367. newArray.set(imgArray);
  43368. imgData.data = newArray;
  43369. }
  43370. if (this.needsDecode) {
  43371. assert(kind === ImageKind.GRAYSCALE_1BPP);
  43372. var buffer = imgData.data;
  43373. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43374. buffer[i] ^= 0xff;
  43375. }
  43376. }
  43377. return imgData;
  43378. }
  43379. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  43380. imgData.kind = ImageKind.RGB_24BPP;
  43381. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  43382. return imgData;
  43383. }
  43384. }
  43385. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43386. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43387. var comps = this.getComponents(imgArray);
  43388. var alpha01, maybeUndoPreblend;
  43389. if (!forceRGBA && !this.smask && !this.mask) {
  43390. imgData.kind = ImageKind.RGB_24BPP;
  43391. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  43392. alpha01 = 0;
  43393. maybeUndoPreblend = false;
  43394. } else {
  43395. imgData.kind = ImageKind.RGBA_32BPP;
  43396. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  43397. alpha01 = 1;
  43398. maybeUndoPreblend = true;
  43399. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43400. }
  43401. if (this.needsDecode) {
  43402. this.decodeBuffer(comps);
  43403. }
  43404. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43405. if (maybeUndoPreblend) {
  43406. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43407. }
  43408. return imgData;
  43409. },
  43410. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  43411. var numComps = this.numComps;
  43412. if (numComps !== 1) {
  43413. error('Reading gray scale from a color image: ' + numComps);
  43414. }
  43415. var width = this.width;
  43416. var height = this.height;
  43417. var bpc = this.bpc;
  43418. var rowBytes = width * numComps * bpc + 7 >> 3;
  43419. var imgArray = this.getImageBytes(height * rowBytes);
  43420. var comps = this.getComponents(imgArray);
  43421. var i, length;
  43422. if (bpc === 1) {
  43423. length = width * height;
  43424. if (this.needsDecode) {
  43425. for (i = 0; i < length; ++i) {
  43426. buffer[i] = comps[i] - 1 & 255;
  43427. }
  43428. } else {
  43429. for (i = 0; i < length; ++i) {
  43430. buffer[i] = -comps[i] & 255;
  43431. }
  43432. }
  43433. return;
  43434. }
  43435. if (this.needsDecode) {
  43436. this.decodeBuffer(comps);
  43437. }
  43438. length = width * height;
  43439. var scale = 255 / ((1 << bpc) - 1);
  43440. for (i = 0; i < length; ++i) {
  43441. buffer[i] = scale * comps[i] | 0;
  43442. }
  43443. },
  43444. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  43445. this.image.reset();
  43446. this.image.drawWidth = drawWidth || this.width;
  43447. this.image.drawHeight = drawHeight || this.height;
  43448. this.image.forceRGB = !!forceRGB;
  43449. return this.image.getBytes(length);
  43450. }
  43451. };
  43452. return PDFImage;
  43453. }();
  43454. exports.PDFImage = PDFImage;
  43455. /***/ }),
  43456. /* 28 */
  43457. /***/ (function(module, exports, __w_pdfjs_require__) {
  43458. "use strict";
  43459. var sharedUtil = __w_pdfjs_require__(0);
  43460. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  43461. var error = sharedUtil.error;
  43462. var log2 = sharedUtil.log2;
  43463. var readInt8 = sharedUtil.readInt8;
  43464. var readUint16 = sharedUtil.readUint16;
  43465. var readUint32 = sharedUtil.readUint32;
  43466. var shadow = sharedUtil.shadow;
  43467. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  43468. var Jbig2Image = function Jbig2ImageClosure() {
  43469. function ContextCache() {
  43470. }
  43471. ContextCache.prototype = {
  43472. getContexts: function (id) {
  43473. if (id in this) {
  43474. return this[id];
  43475. }
  43476. return this[id] = new Int8Array(1 << 16);
  43477. }
  43478. };
  43479. function DecodingContext(data, start, end) {
  43480. this.data = data;
  43481. this.start = start;
  43482. this.end = end;
  43483. }
  43484. DecodingContext.prototype = {
  43485. get decoder() {
  43486. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  43487. return shadow(this, 'decoder', decoder);
  43488. },
  43489. get contextCache() {
  43490. var cache = new ContextCache();
  43491. return shadow(this, 'contextCache', cache);
  43492. }
  43493. };
  43494. function decodeInteger(contextCache, procedure, decoder) {
  43495. var contexts = contextCache.getContexts(procedure);
  43496. var prev = 1;
  43497. function readBits(length) {
  43498. var v = 0;
  43499. for (var i = 0; i < length; i++) {
  43500. var bit = decoder.readBit(contexts, prev);
  43501. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  43502. v = v << 1 | bit;
  43503. }
  43504. return v >>> 0;
  43505. }
  43506. var sign = readBits(1);
  43507. 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);
  43508. return sign === 0 ? value : value > 0 ? -value : null;
  43509. }
  43510. function decodeIAID(contextCache, decoder, codeLength) {
  43511. var contexts = contextCache.getContexts('IAID');
  43512. var prev = 1;
  43513. for (var i = 0; i < codeLength; i++) {
  43514. var bit = decoder.readBit(contexts, prev);
  43515. prev = prev << 1 | bit;
  43516. }
  43517. if (codeLength < 31) {
  43518. return prev & (1 << codeLength) - 1;
  43519. }
  43520. return prev & 0x7FFFFFFF;
  43521. }
  43522. var SegmentTypes = [
  43523. 'SymbolDictionary',
  43524. null,
  43525. null,
  43526. null,
  43527. 'IntermediateTextRegion',
  43528. null,
  43529. 'ImmediateTextRegion',
  43530. 'ImmediateLosslessTextRegion',
  43531. null,
  43532. null,
  43533. null,
  43534. null,
  43535. null,
  43536. null,
  43537. null,
  43538. null,
  43539. 'patternDictionary',
  43540. null,
  43541. null,
  43542. null,
  43543. 'IntermediateHalftoneRegion',
  43544. null,
  43545. 'ImmediateHalftoneRegion',
  43546. 'ImmediateLosslessHalftoneRegion',
  43547. null,
  43548. null,
  43549. null,
  43550. null,
  43551. null,
  43552. null,
  43553. null,
  43554. null,
  43555. null,
  43556. null,
  43557. null,
  43558. null,
  43559. 'IntermediateGenericRegion',
  43560. null,
  43561. 'ImmediateGenericRegion',
  43562. 'ImmediateLosslessGenericRegion',
  43563. 'IntermediateGenericRefinementRegion',
  43564. null,
  43565. 'ImmediateGenericRefinementRegion',
  43566. 'ImmediateLosslessGenericRefinementRegion',
  43567. null,
  43568. null,
  43569. null,
  43570. null,
  43571. 'PageInformation',
  43572. 'EndOfPage',
  43573. 'EndOfStripe',
  43574. 'EndOfFile',
  43575. 'Profiles',
  43576. 'Tables',
  43577. null,
  43578. null,
  43579. null,
  43580. null,
  43581. null,
  43582. null,
  43583. null,
  43584. null,
  43585. 'Extension'
  43586. ];
  43587. var CodingTemplates = [
  43588. [
  43589. {
  43590. x: -1,
  43591. y: -2
  43592. },
  43593. {
  43594. x: 0,
  43595. y: -2
  43596. },
  43597. {
  43598. x: 1,
  43599. y: -2
  43600. },
  43601. {
  43602. x: -2,
  43603. y: -1
  43604. },
  43605. {
  43606. x: -1,
  43607. y: -1
  43608. },
  43609. {
  43610. x: 0,
  43611. y: -1
  43612. },
  43613. {
  43614. x: 1,
  43615. y: -1
  43616. },
  43617. {
  43618. x: 2,
  43619. y: -1
  43620. },
  43621. {
  43622. x: -4,
  43623. y: 0
  43624. },
  43625. {
  43626. x: -3,
  43627. y: 0
  43628. },
  43629. {
  43630. x: -2,
  43631. y: 0
  43632. },
  43633. {
  43634. x: -1,
  43635. y: 0
  43636. }
  43637. ],
  43638. [
  43639. {
  43640. x: -1,
  43641. y: -2
  43642. },
  43643. {
  43644. x: 0,
  43645. y: -2
  43646. },
  43647. {
  43648. x: 1,
  43649. y: -2
  43650. },
  43651. {
  43652. x: 2,
  43653. y: -2
  43654. },
  43655. {
  43656. x: -2,
  43657. y: -1
  43658. },
  43659. {
  43660. x: -1,
  43661. y: -1
  43662. },
  43663. {
  43664. x: 0,
  43665. y: -1
  43666. },
  43667. {
  43668. x: 1,
  43669. y: -1
  43670. },
  43671. {
  43672. x: 2,
  43673. y: -1
  43674. },
  43675. {
  43676. x: -3,
  43677. y: 0
  43678. },
  43679. {
  43680. x: -2,
  43681. y: 0
  43682. },
  43683. {
  43684. x: -1,
  43685. y: 0
  43686. }
  43687. ],
  43688. [
  43689. {
  43690. x: -1,
  43691. y: -2
  43692. },
  43693. {
  43694. x: 0,
  43695. y: -2
  43696. },
  43697. {
  43698. x: 1,
  43699. y: -2
  43700. },
  43701. {
  43702. x: -2,
  43703. y: -1
  43704. },
  43705. {
  43706. x: -1,
  43707. y: -1
  43708. },
  43709. {
  43710. x: 0,
  43711. y: -1
  43712. },
  43713. {
  43714. x: 1,
  43715. y: -1
  43716. },
  43717. {
  43718. x: -2,
  43719. y: 0
  43720. },
  43721. {
  43722. x: -1,
  43723. y: 0
  43724. }
  43725. ],
  43726. [
  43727. {
  43728. x: -3,
  43729. y: -1
  43730. },
  43731. {
  43732. x: -2,
  43733. y: -1
  43734. },
  43735. {
  43736. x: -1,
  43737. y: -1
  43738. },
  43739. {
  43740. x: 0,
  43741. y: -1
  43742. },
  43743. {
  43744. x: 1,
  43745. y: -1
  43746. },
  43747. {
  43748. x: -4,
  43749. y: 0
  43750. },
  43751. {
  43752. x: -3,
  43753. y: 0
  43754. },
  43755. {
  43756. x: -2,
  43757. y: 0
  43758. },
  43759. {
  43760. x: -1,
  43761. y: 0
  43762. }
  43763. ]
  43764. ];
  43765. var RefinementTemplates = [
  43766. {
  43767. coding: [
  43768. {
  43769. x: 0,
  43770. y: -1
  43771. },
  43772. {
  43773. x: 1,
  43774. y: -1
  43775. },
  43776. {
  43777. x: -1,
  43778. y: 0
  43779. }
  43780. ],
  43781. reference: [
  43782. {
  43783. x: 0,
  43784. y: -1
  43785. },
  43786. {
  43787. x: 1,
  43788. y: -1
  43789. },
  43790. {
  43791. x: -1,
  43792. y: 0
  43793. },
  43794. {
  43795. x: 0,
  43796. y: 0
  43797. },
  43798. {
  43799. x: 1,
  43800. y: 0
  43801. },
  43802. {
  43803. x: -1,
  43804. y: 1
  43805. },
  43806. {
  43807. x: 0,
  43808. y: 1
  43809. },
  43810. {
  43811. x: 1,
  43812. y: 1
  43813. }
  43814. ]
  43815. },
  43816. {
  43817. coding: [
  43818. {
  43819. x: -1,
  43820. y: -1
  43821. },
  43822. {
  43823. x: 0,
  43824. y: -1
  43825. },
  43826. {
  43827. x: 1,
  43828. y: -1
  43829. },
  43830. {
  43831. x: -1,
  43832. y: 0
  43833. }
  43834. ],
  43835. reference: [
  43836. {
  43837. x: 0,
  43838. y: -1
  43839. },
  43840. {
  43841. x: -1,
  43842. y: 0
  43843. },
  43844. {
  43845. x: 0,
  43846. y: 0
  43847. },
  43848. {
  43849. x: 1,
  43850. y: 0
  43851. },
  43852. {
  43853. x: 0,
  43854. y: 1
  43855. },
  43856. {
  43857. x: 1,
  43858. y: 1
  43859. }
  43860. ]
  43861. }
  43862. ];
  43863. var ReusedContexts = [
  43864. 0x9B25,
  43865. 0x0795,
  43866. 0x00E5,
  43867. 0x0195
  43868. ];
  43869. var RefinementReusedContexts = [
  43870. 0x0020,
  43871. 0x0008
  43872. ];
  43873. function decodeBitmapTemplate0(width, height, decodingContext) {
  43874. var decoder = decodingContext.decoder;
  43875. var contexts = decodingContext.contextCache.getContexts('GB');
  43876. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43877. var OLD_PIXEL_MASK = 0x7BF7;
  43878. for (i = 0; i < height; i++) {
  43879. row = bitmap[i] = new Uint8Array(width);
  43880. row1 = i < 1 ? row : bitmap[i - 1];
  43881. row2 = i < 2 ? row : bitmap[i - 2];
  43882. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43883. for (j = 0; j < width; j++) {
  43884. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43885. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43886. }
  43887. }
  43888. return bitmap;
  43889. }
  43890. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43891. if (mmr) {
  43892. error('JBIG2 error: MMR encoding is not supported');
  43893. }
  43894. 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) {
  43895. return decodeBitmapTemplate0(width, height, decodingContext);
  43896. }
  43897. var useskip = !!skip;
  43898. var template = CodingTemplates[templateIndex].concat(at);
  43899. template.sort(function (a, b) {
  43900. return a.y - b.y || a.x - b.x;
  43901. });
  43902. var templateLength = template.length;
  43903. var templateX = new Int8Array(templateLength);
  43904. var templateY = new Int8Array(templateLength);
  43905. var changingTemplateEntries = [];
  43906. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43907. var c, k;
  43908. for (k = 0; k < templateLength; k++) {
  43909. templateX[k] = template[k].x;
  43910. templateY[k] = template[k].y;
  43911. minX = Math.min(minX, template[k].x);
  43912. maxX = Math.max(maxX, template[k].x);
  43913. minY = Math.min(minY, template[k].y);
  43914. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43915. reuseMask |= 1 << templateLength - 1 - k;
  43916. } else {
  43917. changingTemplateEntries.push(k);
  43918. }
  43919. }
  43920. var changingEntriesLength = changingTemplateEntries.length;
  43921. var changingTemplateX = new Int8Array(changingEntriesLength);
  43922. var changingTemplateY = new Int8Array(changingEntriesLength);
  43923. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43924. for (c = 0; c < changingEntriesLength; c++) {
  43925. k = changingTemplateEntries[c];
  43926. changingTemplateX[c] = template[k].x;
  43927. changingTemplateY[c] = template[k].y;
  43928. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43929. }
  43930. var sbb_left = -minX;
  43931. var sbb_top = -minY;
  43932. var sbb_right = width - maxX;
  43933. var pseudoPixelContext = ReusedContexts[templateIndex];
  43934. var row = new Uint8Array(width);
  43935. var bitmap = [];
  43936. var decoder = decodingContext.decoder;
  43937. var contexts = decodingContext.contextCache.getContexts('GB');
  43938. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43939. for (var i = 0; i < height; i++) {
  43940. if (prediction) {
  43941. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43942. ltp ^= sltp;
  43943. if (ltp) {
  43944. bitmap.push(row);
  43945. continue;
  43946. }
  43947. }
  43948. row = new Uint8Array(row);
  43949. bitmap.push(row);
  43950. for (j = 0; j < width; j++) {
  43951. if (useskip && skip[i][j]) {
  43952. row[j] = 0;
  43953. continue;
  43954. }
  43955. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43956. contextLabel = contextLabel << 1 & reuseMask;
  43957. for (k = 0; k < changingEntriesLength; k++) {
  43958. i0 = i + changingTemplateY[k];
  43959. j0 = j + changingTemplateX[k];
  43960. bit = bitmap[i0][j0];
  43961. if (bit) {
  43962. bit = changingTemplateBit[k];
  43963. contextLabel |= bit;
  43964. }
  43965. }
  43966. } else {
  43967. contextLabel = 0;
  43968. shift = templateLength - 1;
  43969. for (k = 0; k < templateLength; k++, shift--) {
  43970. j0 = j + templateX[k];
  43971. if (j0 >= 0 && j0 < width) {
  43972. i0 = i + templateY[k];
  43973. if (i0 >= 0) {
  43974. bit = bitmap[i0][j0];
  43975. if (bit) {
  43976. contextLabel |= bit << shift;
  43977. }
  43978. }
  43979. }
  43980. }
  43981. }
  43982. var pixel = decoder.readBit(contexts, contextLabel);
  43983. row[j] = pixel;
  43984. }
  43985. }
  43986. return bitmap;
  43987. }
  43988. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43989. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43990. if (templateIndex === 0) {
  43991. codingTemplate = codingTemplate.concat([at[0]]);
  43992. }
  43993. var codingTemplateLength = codingTemplate.length;
  43994. var codingTemplateX = new Int32Array(codingTemplateLength);
  43995. var codingTemplateY = new Int32Array(codingTemplateLength);
  43996. var k;
  43997. for (k = 0; k < codingTemplateLength; k++) {
  43998. codingTemplateX[k] = codingTemplate[k].x;
  43999. codingTemplateY[k] = codingTemplate[k].y;
  44000. }
  44001. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  44002. if (templateIndex === 0) {
  44003. referenceTemplate = referenceTemplate.concat([at[1]]);
  44004. }
  44005. var referenceTemplateLength = referenceTemplate.length;
  44006. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  44007. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  44008. for (k = 0; k < referenceTemplateLength; k++) {
  44009. referenceTemplateX[k] = referenceTemplate[k].x;
  44010. referenceTemplateY[k] = referenceTemplate[k].y;
  44011. }
  44012. var referenceWidth = referenceBitmap[0].length;
  44013. var referenceHeight = referenceBitmap.length;
  44014. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  44015. var bitmap = [];
  44016. var decoder = decodingContext.decoder;
  44017. var contexts = decodingContext.contextCache.getContexts('GR');
  44018. var ltp = 0;
  44019. for (var i = 0; i < height; i++) {
  44020. if (prediction) {
  44021. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  44022. ltp ^= sltp;
  44023. if (ltp) {
  44024. error('JBIG2 error: prediction is not supported');
  44025. }
  44026. }
  44027. var row = new Uint8Array(width);
  44028. bitmap.push(row);
  44029. for (var j = 0; j < width; j++) {
  44030. var i0, j0;
  44031. var contextLabel = 0;
  44032. for (k = 0; k < codingTemplateLength; k++) {
  44033. i0 = i + codingTemplateY[k];
  44034. j0 = j + codingTemplateX[k];
  44035. if (i0 < 0 || j0 < 0 || j0 >= width) {
  44036. contextLabel <<= 1;
  44037. } else {
  44038. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  44039. }
  44040. }
  44041. for (k = 0; k < referenceTemplateLength; k++) {
  44042. i0 = i + referenceTemplateY[k] + offsetY;
  44043. j0 = j + referenceTemplateX[k] + offsetX;
  44044. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  44045. contextLabel <<= 1;
  44046. } else {
  44047. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  44048. }
  44049. }
  44050. var pixel = decoder.readBit(contexts, contextLabel);
  44051. row[j] = pixel;
  44052. }
  44053. }
  44054. return bitmap;
  44055. }
  44056. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  44057. if (huffman) {
  44058. error('JBIG2 error: huffman is not supported');
  44059. }
  44060. var newSymbols = [];
  44061. var currentHeight = 0;
  44062. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  44063. var decoder = decodingContext.decoder;
  44064. var contextCache = decodingContext.contextCache;
  44065. while (newSymbols.length < numberOfNewSymbols) {
  44066. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  44067. currentHeight += deltaHeight;
  44068. var currentWidth = 0;
  44069. while (true) {
  44070. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  44071. if (deltaWidth === null) {
  44072. break;
  44073. }
  44074. currentWidth += deltaWidth;
  44075. var bitmap;
  44076. if (refinement) {
  44077. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  44078. if (numberOfInstances > 1) {
  44079. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  44080. } else {
  44081. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44082. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44083. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44084. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  44085. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  44086. }
  44087. } else {
  44088. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  44089. }
  44090. newSymbols.push(bitmap);
  44091. }
  44092. }
  44093. var exportedSymbols = [];
  44094. var flags = [], currentFlag = false;
  44095. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  44096. while (flags.length < totalSymbolsLength) {
  44097. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  44098. while (runLength--) {
  44099. flags.push(currentFlag);
  44100. }
  44101. currentFlag = !currentFlag;
  44102. }
  44103. for (var i = 0, ii = symbols.length; i < ii; i++) {
  44104. if (flags[i]) {
  44105. exportedSymbols.push(symbols[i]);
  44106. }
  44107. }
  44108. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  44109. if (flags[i]) {
  44110. exportedSymbols.push(newSymbols[j]);
  44111. }
  44112. }
  44113. return exportedSymbols;
  44114. }
  44115. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  44116. if (huffman) {
  44117. error('JBIG2 error: huffman is not supported');
  44118. }
  44119. var bitmap = [];
  44120. var i, row;
  44121. for (i = 0; i < height; i++) {
  44122. row = new Uint8Array(width);
  44123. if (defaultPixelValue) {
  44124. for (var j = 0; j < width; j++) {
  44125. row[j] = defaultPixelValue;
  44126. }
  44127. }
  44128. bitmap.push(row);
  44129. }
  44130. var decoder = decodingContext.decoder;
  44131. var contextCache = decodingContext.contextCache;
  44132. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  44133. var firstS = 0;
  44134. i = 0;
  44135. while (i < numberOfSymbolInstances) {
  44136. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  44137. stripT += deltaT;
  44138. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  44139. firstS += deltaFirstS;
  44140. var currentS = firstS;
  44141. do {
  44142. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  44143. var t = stripSize * stripT + currentT;
  44144. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44145. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  44146. var symbolBitmap = inputSymbols[symbolId];
  44147. var symbolWidth = symbolBitmap[0].length;
  44148. var symbolHeight = symbolBitmap.length;
  44149. if (applyRefinement) {
  44150. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  44151. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  44152. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44153. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44154. symbolWidth += rdw;
  44155. symbolHeight += rdh;
  44156. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  44157. }
  44158. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  44159. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  44160. var s2, t2, symbolRow;
  44161. if (transposed) {
  44162. for (s2 = 0; s2 < symbolHeight; s2++) {
  44163. row = bitmap[offsetS + s2];
  44164. if (!row) {
  44165. continue;
  44166. }
  44167. symbolRow = symbolBitmap[s2];
  44168. var maxWidth = Math.min(width - offsetT, symbolWidth);
  44169. switch (combinationOperator) {
  44170. case 0:
  44171. for (t2 = 0; t2 < maxWidth; t2++) {
  44172. row[offsetT + t2] |= symbolRow[t2];
  44173. }
  44174. break;
  44175. case 2:
  44176. for (t2 = 0; t2 < maxWidth; t2++) {
  44177. row[offsetT + t2] ^= symbolRow[t2];
  44178. }
  44179. break;
  44180. default:
  44181. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44182. }
  44183. }
  44184. currentS += symbolHeight - 1;
  44185. } else {
  44186. for (t2 = 0; t2 < symbolHeight; t2++) {
  44187. row = bitmap[offsetT + t2];
  44188. if (!row) {
  44189. continue;
  44190. }
  44191. symbolRow = symbolBitmap[t2];
  44192. switch (combinationOperator) {
  44193. case 0:
  44194. for (s2 = 0; s2 < symbolWidth; s2++) {
  44195. row[offsetS + s2] |= symbolRow[s2];
  44196. }
  44197. break;
  44198. case 2:
  44199. for (s2 = 0; s2 < symbolWidth; s2++) {
  44200. row[offsetS + s2] ^= symbolRow[s2];
  44201. }
  44202. break;
  44203. default:
  44204. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44205. }
  44206. }
  44207. currentS += symbolWidth - 1;
  44208. }
  44209. i++;
  44210. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  44211. if (deltaS === null) {
  44212. break;
  44213. }
  44214. currentS += deltaS + dsOffset;
  44215. } while (true);
  44216. }
  44217. return bitmap;
  44218. }
  44219. function readSegmentHeader(data, start) {
  44220. var segmentHeader = {};
  44221. segmentHeader.number = readUint32(data, start);
  44222. var flags = data[start + 4];
  44223. var segmentType = flags & 0x3F;
  44224. if (!SegmentTypes[segmentType]) {
  44225. error('JBIG2 error: invalid segment type: ' + segmentType);
  44226. }
  44227. segmentHeader.type = segmentType;
  44228. segmentHeader.typeName = SegmentTypes[segmentType];
  44229. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  44230. var pageAssociationFieldSize = !!(flags & 0x40);
  44231. var referredFlags = data[start + 5];
  44232. var referredToCount = referredFlags >> 5 & 7;
  44233. var retainBits = [referredFlags & 31];
  44234. var position = start + 6;
  44235. if (referredFlags === 7) {
  44236. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  44237. position += 3;
  44238. var bytes = referredToCount + 7 >> 3;
  44239. retainBits[0] = data[position++];
  44240. while (--bytes > 0) {
  44241. retainBits.push(data[position++]);
  44242. }
  44243. } else if (referredFlags === 5 || referredFlags === 6) {
  44244. error('JBIG2 error: invalid referred-to flags');
  44245. }
  44246. segmentHeader.retainBits = retainBits;
  44247. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  44248. var referredTo = [];
  44249. var i, ii;
  44250. for (i = 0; i < referredToCount; i++) {
  44251. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  44252. referredTo.push(number);
  44253. position += referredToSegmentNumberSize;
  44254. }
  44255. segmentHeader.referredTo = referredTo;
  44256. if (!pageAssociationFieldSize) {
  44257. segmentHeader.pageAssociation = data[position++];
  44258. } else {
  44259. segmentHeader.pageAssociation = readUint32(data, position);
  44260. position += 4;
  44261. }
  44262. segmentHeader.length = readUint32(data, position);
  44263. position += 4;
  44264. if (segmentHeader.length === 0xFFFFFFFF) {
  44265. if (segmentType === 38) {
  44266. var genericRegionInfo = readRegionSegmentInformation(data, position);
  44267. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  44268. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  44269. var searchPatternLength = 6;
  44270. var searchPattern = new Uint8Array(searchPatternLength);
  44271. if (!genericRegionMmr) {
  44272. searchPattern[0] = 0xFF;
  44273. searchPattern[1] = 0xAC;
  44274. }
  44275. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  44276. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  44277. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  44278. searchPattern[5] = genericRegionInfo.height & 0xFF;
  44279. for (i = position, ii = data.length; i < ii; i++) {
  44280. var j = 0;
  44281. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  44282. j++;
  44283. }
  44284. if (j === searchPatternLength) {
  44285. segmentHeader.length = i + searchPatternLength;
  44286. break;
  44287. }
  44288. }
  44289. if (segmentHeader.length === 0xFFFFFFFF) {
  44290. error('JBIG2 error: segment end was not found');
  44291. }
  44292. } else {
  44293. error('JBIG2 error: invalid unknown segment length');
  44294. }
  44295. }
  44296. segmentHeader.headerEnd = position;
  44297. return segmentHeader;
  44298. }
  44299. function readSegments(header, data, start, end) {
  44300. var segments = [];
  44301. var position = start;
  44302. while (position < end) {
  44303. var segmentHeader = readSegmentHeader(data, position);
  44304. position = segmentHeader.headerEnd;
  44305. var segment = {
  44306. header: segmentHeader,
  44307. data: data
  44308. };
  44309. if (!header.randomAccess) {
  44310. segment.start = position;
  44311. position += segmentHeader.length;
  44312. segment.end = position;
  44313. }
  44314. segments.push(segment);
  44315. if (segmentHeader.type === 51) {
  44316. break;
  44317. }
  44318. }
  44319. if (header.randomAccess) {
  44320. for (var i = 0, ii = segments.length; i < ii; i++) {
  44321. segments[i].start = position;
  44322. position += segments[i].header.length;
  44323. segments[i].end = position;
  44324. }
  44325. }
  44326. return segments;
  44327. }
  44328. function readRegionSegmentInformation(data, start) {
  44329. return {
  44330. width: readUint32(data, start),
  44331. height: readUint32(data, start + 4),
  44332. x: readUint32(data, start + 8),
  44333. y: readUint32(data, start + 12),
  44334. combinationOperator: data[start + 16] & 7
  44335. };
  44336. }
  44337. var RegionSegmentInformationFieldLength = 17;
  44338. function processSegment(segment, visitor) {
  44339. var header = segment.header;
  44340. var data = segment.data, position = segment.start, end = segment.end;
  44341. var args, at, i, atLength;
  44342. switch (header.type) {
  44343. case 0:
  44344. var dictionary = {};
  44345. var dictionaryFlags = readUint16(data, position);
  44346. dictionary.huffman = !!(dictionaryFlags & 1);
  44347. dictionary.refinement = !!(dictionaryFlags & 2);
  44348. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  44349. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  44350. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  44351. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  44352. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  44353. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  44354. dictionary.template = dictionaryFlags >> 10 & 3;
  44355. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  44356. position += 2;
  44357. if (!dictionary.huffman) {
  44358. atLength = dictionary.template === 0 ? 4 : 1;
  44359. at = [];
  44360. for (i = 0; i < atLength; i++) {
  44361. at.push({
  44362. x: readInt8(data, position),
  44363. y: readInt8(data, position + 1)
  44364. });
  44365. position += 2;
  44366. }
  44367. dictionary.at = at;
  44368. }
  44369. if (dictionary.refinement && !dictionary.refinementTemplate) {
  44370. at = [];
  44371. for (i = 0; i < 2; i++) {
  44372. at.push({
  44373. x: readInt8(data, position),
  44374. y: readInt8(data, position + 1)
  44375. });
  44376. position += 2;
  44377. }
  44378. dictionary.refinementAt = at;
  44379. }
  44380. dictionary.numberOfExportedSymbols = readUint32(data, position);
  44381. position += 4;
  44382. dictionary.numberOfNewSymbols = readUint32(data, position);
  44383. position += 4;
  44384. args = [
  44385. dictionary,
  44386. header.number,
  44387. header.referredTo,
  44388. data,
  44389. position,
  44390. end
  44391. ];
  44392. break;
  44393. case 6:
  44394. case 7:
  44395. var textRegion = {};
  44396. textRegion.info = readRegionSegmentInformation(data, position);
  44397. position += RegionSegmentInformationFieldLength;
  44398. var textRegionSegmentFlags = readUint16(data, position);
  44399. position += 2;
  44400. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  44401. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  44402. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  44403. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  44404. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  44405. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  44406. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  44407. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  44408. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  44409. if (textRegion.huffman) {
  44410. var textRegionHuffmanFlags = readUint16(data, position);
  44411. position += 2;
  44412. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  44413. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  44414. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  44415. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  44416. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  44417. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  44418. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  44419. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  44420. }
  44421. if (textRegion.refinement && !textRegion.refinementTemplate) {
  44422. at = [];
  44423. for (i = 0; i < 2; i++) {
  44424. at.push({
  44425. x: readInt8(data, position),
  44426. y: readInt8(data, position + 1)
  44427. });
  44428. position += 2;
  44429. }
  44430. textRegion.refinementAt = at;
  44431. }
  44432. textRegion.numberOfSymbolInstances = readUint32(data, position);
  44433. position += 4;
  44434. if (textRegion.huffman) {
  44435. error('JBIG2 error: huffman is not supported');
  44436. }
  44437. args = [
  44438. textRegion,
  44439. header.referredTo,
  44440. data,
  44441. position,
  44442. end
  44443. ];
  44444. break;
  44445. case 38:
  44446. case 39:
  44447. var genericRegion = {};
  44448. genericRegion.info = readRegionSegmentInformation(data, position);
  44449. position += RegionSegmentInformationFieldLength;
  44450. var genericRegionSegmentFlags = data[position++];
  44451. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  44452. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  44453. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  44454. if (!genericRegion.mmr) {
  44455. atLength = genericRegion.template === 0 ? 4 : 1;
  44456. at = [];
  44457. for (i = 0; i < atLength; i++) {
  44458. at.push({
  44459. x: readInt8(data, position),
  44460. y: readInt8(data, position + 1)
  44461. });
  44462. position += 2;
  44463. }
  44464. genericRegion.at = at;
  44465. }
  44466. args = [
  44467. genericRegion,
  44468. data,
  44469. position,
  44470. end
  44471. ];
  44472. break;
  44473. case 48:
  44474. var pageInfo = {
  44475. width: readUint32(data, position),
  44476. height: readUint32(data, position + 4),
  44477. resolutionX: readUint32(data, position + 8),
  44478. resolutionY: readUint32(data, position + 12)
  44479. };
  44480. if (pageInfo.height === 0xFFFFFFFF) {
  44481. delete pageInfo.height;
  44482. }
  44483. var pageSegmentFlags = data[position + 16];
  44484. readUint16(data, position + 17);
  44485. pageInfo.lossless = !!(pageSegmentFlags & 1);
  44486. pageInfo.refinement = !!(pageSegmentFlags & 2);
  44487. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  44488. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  44489. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  44490. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  44491. args = [pageInfo];
  44492. break;
  44493. case 49:
  44494. break;
  44495. case 50:
  44496. break;
  44497. case 51:
  44498. break;
  44499. case 62:
  44500. break;
  44501. default:
  44502. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  44503. }
  44504. var callbackName = 'on' + header.typeName;
  44505. if (callbackName in visitor) {
  44506. visitor[callbackName].apply(visitor, args);
  44507. }
  44508. }
  44509. function processSegments(segments, visitor) {
  44510. for (var i = 0, ii = segments.length; i < ii; i++) {
  44511. processSegment(segments[i], visitor);
  44512. }
  44513. }
  44514. function parseJbig2(data, start, end) {
  44515. var position = start;
  44516. 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) {
  44517. error('JBIG2 error: invalid header');
  44518. }
  44519. var header = {};
  44520. position += 8;
  44521. var flags = data[position++];
  44522. header.randomAccess = !(flags & 1);
  44523. if (!(flags & 2)) {
  44524. header.numberOfPages = readUint32(data, position);
  44525. position += 4;
  44526. }
  44527. readSegments(header, data, position, end);
  44528. error('Not implemented');
  44529. }
  44530. function parseJbig2Chunks(chunks) {
  44531. var visitor = new SimpleSegmentVisitor();
  44532. for (var i = 0, ii = chunks.length; i < ii; i++) {
  44533. var chunk = chunks[i];
  44534. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  44535. processSegments(segments, visitor);
  44536. }
  44537. return visitor.buffer;
  44538. }
  44539. function SimpleSegmentVisitor() {
  44540. }
  44541. SimpleSegmentVisitor.prototype = {
  44542. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  44543. this.currentPageInfo = info;
  44544. var rowSize = info.width + 7 >> 3;
  44545. var buffer = new Uint8Array(rowSize * info.height);
  44546. if (info.defaultPixelValue) {
  44547. for (var i = 0, ii = buffer.length; i < ii; i++) {
  44548. buffer[i] = 0xFF;
  44549. }
  44550. }
  44551. this.buffer = buffer;
  44552. },
  44553. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  44554. var pageInfo = this.currentPageInfo;
  44555. var width = regionInfo.width, height = regionInfo.height;
  44556. var rowSize = pageInfo.width + 7 >> 3;
  44557. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  44558. var buffer = this.buffer;
  44559. var mask0 = 128 >> (regionInfo.x & 7);
  44560. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  44561. var i, j, mask, offset;
  44562. switch (combinationOperator) {
  44563. case 0:
  44564. for (i = 0; i < height; i++) {
  44565. mask = mask0;
  44566. offset = offset0;
  44567. for (j = 0; j < width; j++) {
  44568. if (bitmap[i][j]) {
  44569. buffer[offset] |= mask;
  44570. }
  44571. mask >>= 1;
  44572. if (!mask) {
  44573. mask = 128;
  44574. offset++;
  44575. }
  44576. }
  44577. offset0 += rowSize;
  44578. }
  44579. break;
  44580. case 2:
  44581. for (i = 0; i < height; i++) {
  44582. mask = mask0;
  44583. offset = offset0;
  44584. for (j = 0; j < width; j++) {
  44585. if (bitmap[i][j]) {
  44586. buffer[offset] ^= mask;
  44587. }
  44588. mask >>= 1;
  44589. if (!mask) {
  44590. mask = 128;
  44591. offset++;
  44592. }
  44593. }
  44594. offset0 += rowSize;
  44595. }
  44596. break;
  44597. default:
  44598. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44599. }
  44600. },
  44601. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  44602. var regionInfo = region.info;
  44603. var decodingContext = new DecodingContext(data, start, end);
  44604. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  44605. this.drawBitmap(regionInfo, bitmap);
  44606. },
  44607. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  44608. this.onImmediateGenericRegion.apply(this, arguments);
  44609. },
  44610. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  44611. var huffmanTables;
  44612. if (dictionary.huffman) {
  44613. error('JBIG2 error: huffman is not supported');
  44614. }
  44615. var symbols = this.symbols;
  44616. if (!symbols) {
  44617. this.symbols = symbols = {};
  44618. }
  44619. var inputSymbols = [];
  44620. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44621. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44622. }
  44623. var decodingContext = new DecodingContext(data, start, end);
  44624. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  44625. },
  44626. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  44627. var regionInfo = region.info;
  44628. var huffmanTables;
  44629. var symbols = this.symbols;
  44630. var inputSymbols = [];
  44631. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44632. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44633. }
  44634. var symbolCodeLength = log2(inputSymbols.length);
  44635. var decodingContext = new DecodingContext(data, start, end);
  44636. 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);
  44637. this.drawBitmap(regionInfo, bitmap);
  44638. },
  44639. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  44640. this.onImmediateTextRegion.apply(this, arguments);
  44641. }
  44642. };
  44643. function Jbig2Image() {
  44644. }
  44645. Jbig2Image.prototype = {
  44646. parseChunks: function Jbig2Image_parseChunks(chunks) {
  44647. return parseJbig2Chunks(chunks);
  44648. }
  44649. };
  44650. return Jbig2Image;
  44651. }();
  44652. exports.Jbig2Image = Jbig2Image;
  44653. /***/ }),
  44654. /* 29 */
  44655. /***/ (function(module, exports, __w_pdfjs_require__) {
  44656. "use strict";
  44657. var sharedUtil = __w_pdfjs_require__(0);
  44658. var error = sharedUtil.error;
  44659. var JpegImage = function JpegImageClosure() {
  44660. var dctZigZag = new Uint8Array([
  44661. 0,
  44662. 1,
  44663. 8,
  44664. 16,
  44665. 9,
  44666. 2,
  44667. 3,
  44668. 10,
  44669. 17,
  44670. 24,
  44671. 32,
  44672. 25,
  44673. 18,
  44674. 11,
  44675. 4,
  44676. 5,
  44677. 12,
  44678. 19,
  44679. 26,
  44680. 33,
  44681. 40,
  44682. 48,
  44683. 41,
  44684. 34,
  44685. 27,
  44686. 20,
  44687. 13,
  44688. 6,
  44689. 7,
  44690. 14,
  44691. 21,
  44692. 28,
  44693. 35,
  44694. 42,
  44695. 49,
  44696. 56,
  44697. 57,
  44698. 50,
  44699. 43,
  44700. 36,
  44701. 29,
  44702. 22,
  44703. 15,
  44704. 23,
  44705. 30,
  44706. 37,
  44707. 44,
  44708. 51,
  44709. 58,
  44710. 59,
  44711. 52,
  44712. 45,
  44713. 38,
  44714. 31,
  44715. 39,
  44716. 46,
  44717. 53,
  44718. 60,
  44719. 61,
  44720. 54,
  44721. 47,
  44722. 55,
  44723. 62,
  44724. 63
  44725. ]);
  44726. var dctCos1 = 4017;
  44727. var dctSin1 = 799;
  44728. var dctCos3 = 3406;
  44729. var dctSin3 = 2276;
  44730. var dctCos6 = 1567;
  44731. var dctSin6 = 3784;
  44732. var dctSqrt2 = 5793;
  44733. var dctSqrt1d2 = 2896;
  44734. function JpegImage() {
  44735. this.decodeTransform = null;
  44736. this.colorTransform = -1;
  44737. }
  44738. function buildHuffmanTable(codeLengths, values) {
  44739. var k = 0, code = [], i, j, length = 16;
  44740. while (length > 0 && !codeLengths[length - 1]) {
  44741. length--;
  44742. }
  44743. code.push({
  44744. children: [],
  44745. index: 0
  44746. });
  44747. var p = code[0], q;
  44748. for (i = 0; i < length; i++) {
  44749. for (j = 0; j < codeLengths[i]; j++) {
  44750. p = code.pop();
  44751. p.children[p.index] = values[k];
  44752. while (p.index > 0) {
  44753. p = code.pop();
  44754. }
  44755. p.index++;
  44756. code.push(p);
  44757. while (code.length <= i) {
  44758. code.push(q = {
  44759. children: [],
  44760. index: 0
  44761. });
  44762. p.children[p.index] = q.children;
  44763. p = q;
  44764. }
  44765. k++;
  44766. }
  44767. if (i + 1 < length) {
  44768. code.push(q = {
  44769. children: [],
  44770. index: 0
  44771. });
  44772. p.children[p.index] = q.children;
  44773. p = q;
  44774. }
  44775. }
  44776. return code[0].children;
  44777. }
  44778. function getBlockBufferOffset(component, row, col) {
  44779. return 64 * ((component.blocksPerLine + 1) * row + col);
  44780. }
  44781. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  44782. var mcusPerLine = frame.mcusPerLine;
  44783. var progressive = frame.progressive;
  44784. var startOffset = offset, bitsData = 0, bitsCount = 0;
  44785. function readBit() {
  44786. if (bitsCount > 0) {
  44787. bitsCount--;
  44788. return bitsData >> bitsCount & 1;
  44789. }
  44790. bitsData = data[offset++];
  44791. if (bitsData === 0xFF) {
  44792. var nextByte = data[offset++];
  44793. if (nextByte) {
  44794. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  44795. }
  44796. }
  44797. bitsCount = 7;
  44798. return bitsData >>> 7;
  44799. }
  44800. function decodeHuffman(tree) {
  44801. var node = tree;
  44802. while (true) {
  44803. node = node[readBit()];
  44804. if (typeof node === 'number') {
  44805. return node;
  44806. }
  44807. if (typeof node !== 'object') {
  44808. error('JPEG error: invalid huffman sequence');
  44809. }
  44810. }
  44811. }
  44812. function receive(length) {
  44813. var n = 0;
  44814. while (length > 0) {
  44815. n = n << 1 | readBit();
  44816. length--;
  44817. }
  44818. return n;
  44819. }
  44820. function receiveAndExtend(length) {
  44821. if (length === 1) {
  44822. return readBit() === 1 ? 1 : -1;
  44823. }
  44824. var n = receive(length);
  44825. if (n >= 1 << length - 1) {
  44826. return n;
  44827. }
  44828. return n + (-1 << length) + 1;
  44829. }
  44830. function decodeBaseline(component, offset) {
  44831. var t = decodeHuffman(component.huffmanTableDC);
  44832. var diff = t === 0 ? 0 : receiveAndExtend(t);
  44833. component.blockData[offset] = component.pred += diff;
  44834. var k = 1;
  44835. while (k < 64) {
  44836. var rs = decodeHuffman(component.huffmanTableAC);
  44837. var s = rs & 15, r = rs >> 4;
  44838. if (s === 0) {
  44839. if (r < 15) {
  44840. break;
  44841. }
  44842. k += 16;
  44843. continue;
  44844. }
  44845. k += r;
  44846. var z = dctZigZag[k];
  44847. component.blockData[offset + z] = receiveAndExtend(s);
  44848. k++;
  44849. }
  44850. }
  44851. function decodeDCFirst(component, offset) {
  44852. var t = decodeHuffman(component.huffmanTableDC);
  44853. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44854. component.blockData[offset] = component.pred += diff;
  44855. }
  44856. function decodeDCSuccessive(component, offset) {
  44857. component.blockData[offset] |= readBit() << successive;
  44858. }
  44859. var eobrun = 0;
  44860. function decodeACFirst(component, offset) {
  44861. if (eobrun > 0) {
  44862. eobrun--;
  44863. return;
  44864. }
  44865. var k = spectralStart, e = spectralEnd;
  44866. while (k <= e) {
  44867. var rs = decodeHuffman(component.huffmanTableAC);
  44868. var s = rs & 15, r = rs >> 4;
  44869. if (s === 0) {
  44870. if (r < 15) {
  44871. eobrun = receive(r) + (1 << r) - 1;
  44872. break;
  44873. }
  44874. k += 16;
  44875. continue;
  44876. }
  44877. k += r;
  44878. var z = dctZigZag[k];
  44879. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44880. k++;
  44881. }
  44882. }
  44883. var successiveACState = 0, successiveACNextValue;
  44884. function decodeACSuccessive(component, offset) {
  44885. var k = spectralStart;
  44886. var e = spectralEnd;
  44887. var r = 0;
  44888. var s;
  44889. var rs;
  44890. while (k <= e) {
  44891. var z = dctZigZag[k];
  44892. switch (successiveACState) {
  44893. case 0:
  44894. rs = decodeHuffman(component.huffmanTableAC);
  44895. s = rs & 15;
  44896. r = rs >> 4;
  44897. if (s === 0) {
  44898. if (r < 15) {
  44899. eobrun = receive(r) + (1 << r);
  44900. successiveACState = 4;
  44901. } else {
  44902. r = 16;
  44903. successiveACState = 1;
  44904. }
  44905. } else {
  44906. if (s !== 1) {
  44907. error('JPEG error: invalid ACn encoding');
  44908. }
  44909. successiveACNextValue = receiveAndExtend(s);
  44910. successiveACState = r ? 2 : 3;
  44911. }
  44912. continue;
  44913. case 1:
  44914. case 2:
  44915. if (component.blockData[offset + z]) {
  44916. component.blockData[offset + z] += readBit() << successive;
  44917. } else {
  44918. r--;
  44919. if (r === 0) {
  44920. successiveACState = successiveACState === 2 ? 3 : 0;
  44921. }
  44922. }
  44923. break;
  44924. case 3:
  44925. if (component.blockData[offset + z]) {
  44926. component.blockData[offset + z] += readBit() << successive;
  44927. } else {
  44928. component.blockData[offset + z] = successiveACNextValue << successive;
  44929. successiveACState = 0;
  44930. }
  44931. break;
  44932. case 4:
  44933. if (component.blockData[offset + z]) {
  44934. component.blockData[offset + z] += readBit() << successive;
  44935. }
  44936. break;
  44937. }
  44938. k++;
  44939. }
  44940. if (successiveACState === 4) {
  44941. eobrun--;
  44942. if (eobrun === 0) {
  44943. successiveACState = 0;
  44944. }
  44945. }
  44946. }
  44947. function decodeMcu(component, decode, mcu, row, col) {
  44948. var mcuRow = mcu / mcusPerLine | 0;
  44949. var mcuCol = mcu % mcusPerLine;
  44950. var blockRow = mcuRow * component.v + row;
  44951. var blockCol = mcuCol * component.h + col;
  44952. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44953. decode(component, offset);
  44954. }
  44955. function decodeBlock(component, decode, mcu) {
  44956. var blockRow = mcu / component.blocksPerLine | 0;
  44957. var blockCol = mcu % component.blocksPerLine;
  44958. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44959. decode(component, offset);
  44960. }
  44961. var componentsLength = components.length;
  44962. var component, i, j, k, n;
  44963. var decodeFn;
  44964. if (progressive) {
  44965. if (spectralStart === 0) {
  44966. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44967. } else {
  44968. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44969. }
  44970. } else {
  44971. decodeFn = decodeBaseline;
  44972. }
  44973. var mcu = 0, marker;
  44974. var mcuExpected;
  44975. if (componentsLength === 1) {
  44976. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44977. } else {
  44978. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44979. }
  44980. if (!resetInterval) {
  44981. resetInterval = mcuExpected;
  44982. }
  44983. var h, v;
  44984. while (mcu < mcuExpected) {
  44985. for (i = 0; i < componentsLength; i++) {
  44986. components[i].pred = 0;
  44987. }
  44988. eobrun = 0;
  44989. if (componentsLength === 1) {
  44990. component = components[0];
  44991. for (n = 0; n < resetInterval; n++) {
  44992. decodeBlock(component, decodeFn, mcu);
  44993. mcu++;
  44994. }
  44995. } else {
  44996. for (n = 0; n < resetInterval; n++) {
  44997. for (i = 0; i < componentsLength; i++) {
  44998. component = components[i];
  44999. h = component.h;
  45000. v = component.v;
  45001. for (j = 0; j < v; j++) {
  45002. for (k = 0; k < h; k++) {
  45003. decodeMcu(component, decodeFn, mcu, j, k);
  45004. }
  45005. }
  45006. }
  45007. mcu++;
  45008. }
  45009. }
  45010. bitsCount = 0;
  45011. marker = data[offset] << 8 | data[offset + 1];
  45012. while (data[offset] === 0x00 && offset < data.length - 1) {
  45013. offset++;
  45014. marker = data[offset] << 8 | data[offset + 1];
  45015. }
  45016. if (marker <= 0xFF00) {
  45017. error('JPEG error: marker was not found');
  45018. }
  45019. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  45020. offset += 2;
  45021. } else {
  45022. break;
  45023. }
  45024. }
  45025. return offset - startOffset;
  45026. }
  45027. function quantizeAndInverse(component, blockBufferOffset, p) {
  45028. var qt = component.quantizationTable, blockData = component.blockData;
  45029. var v0, v1, v2, v3, v4, v5, v6, v7;
  45030. var p0, p1, p2, p3, p4, p5, p6, p7;
  45031. var t;
  45032. if (!qt) {
  45033. error('JPEG error: missing required Quantization Table.');
  45034. }
  45035. for (var row = 0; row < 64; row += 8) {
  45036. p0 = blockData[blockBufferOffset + row];
  45037. p1 = blockData[blockBufferOffset + row + 1];
  45038. p2 = blockData[blockBufferOffset + row + 2];
  45039. p3 = blockData[blockBufferOffset + row + 3];
  45040. p4 = blockData[blockBufferOffset + row + 4];
  45041. p5 = blockData[blockBufferOffset + row + 5];
  45042. p6 = blockData[blockBufferOffset + row + 6];
  45043. p7 = blockData[blockBufferOffset + row + 7];
  45044. p0 *= qt[row];
  45045. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45046. t = dctSqrt2 * p0 + 512 >> 10;
  45047. p[row] = t;
  45048. p[row + 1] = t;
  45049. p[row + 2] = t;
  45050. p[row + 3] = t;
  45051. p[row + 4] = t;
  45052. p[row + 5] = t;
  45053. p[row + 6] = t;
  45054. p[row + 7] = t;
  45055. continue;
  45056. }
  45057. p1 *= qt[row + 1];
  45058. p2 *= qt[row + 2];
  45059. p3 *= qt[row + 3];
  45060. p4 *= qt[row + 4];
  45061. p5 *= qt[row + 5];
  45062. p6 *= qt[row + 6];
  45063. p7 *= qt[row + 7];
  45064. v0 = dctSqrt2 * p0 + 128 >> 8;
  45065. v1 = dctSqrt2 * p4 + 128 >> 8;
  45066. v2 = p2;
  45067. v3 = p6;
  45068. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  45069. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  45070. v5 = p3 << 4;
  45071. v6 = p5 << 4;
  45072. v0 = v0 + v1 + 1 >> 1;
  45073. v1 = v0 - v1;
  45074. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  45075. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  45076. v3 = t;
  45077. v4 = v4 + v6 + 1 >> 1;
  45078. v6 = v4 - v6;
  45079. v7 = v7 + v5 + 1 >> 1;
  45080. v5 = v7 - v5;
  45081. v0 = v0 + v3 + 1 >> 1;
  45082. v3 = v0 - v3;
  45083. v1 = v1 + v2 + 1 >> 1;
  45084. v2 = v1 - v2;
  45085. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45086. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45087. v7 = t;
  45088. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45089. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45090. v6 = t;
  45091. p[row] = v0 + v7;
  45092. p[row + 7] = v0 - v7;
  45093. p[row + 1] = v1 + v6;
  45094. p[row + 6] = v1 - v6;
  45095. p[row + 2] = v2 + v5;
  45096. p[row + 5] = v2 - v5;
  45097. p[row + 3] = v3 + v4;
  45098. p[row + 4] = v3 - v4;
  45099. }
  45100. for (var col = 0; col < 8; ++col) {
  45101. p0 = p[col];
  45102. p1 = p[col + 8];
  45103. p2 = p[col + 16];
  45104. p3 = p[col + 24];
  45105. p4 = p[col + 32];
  45106. p5 = p[col + 40];
  45107. p6 = p[col + 48];
  45108. p7 = p[col + 56];
  45109. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45110. t = dctSqrt2 * p0 + 8192 >> 14;
  45111. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  45112. blockData[blockBufferOffset + col] = t;
  45113. blockData[blockBufferOffset + col + 8] = t;
  45114. blockData[blockBufferOffset + col + 16] = t;
  45115. blockData[blockBufferOffset + col + 24] = t;
  45116. blockData[blockBufferOffset + col + 32] = t;
  45117. blockData[blockBufferOffset + col + 40] = t;
  45118. blockData[blockBufferOffset + col + 48] = t;
  45119. blockData[blockBufferOffset + col + 56] = t;
  45120. continue;
  45121. }
  45122. v0 = dctSqrt2 * p0 + 2048 >> 12;
  45123. v1 = dctSqrt2 * p4 + 2048 >> 12;
  45124. v2 = p2;
  45125. v3 = p6;
  45126. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  45127. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  45128. v5 = p3;
  45129. v6 = p5;
  45130. v0 = (v0 + v1 + 1 >> 1) + 4112;
  45131. v1 = v0 - v1;
  45132. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  45133. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  45134. v3 = t;
  45135. v4 = v4 + v6 + 1 >> 1;
  45136. v6 = v4 - v6;
  45137. v7 = v7 + v5 + 1 >> 1;
  45138. v5 = v7 - v5;
  45139. v0 = v0 + v3 + 1 >> 1;
  45140. v3 = v0 - v3;
  45141. v1 = v1 + v2 + 1 >> 1;
  45142. v2 = v1 - v2;
  45143. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45144. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45145. v7 = t;
  45146. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45147. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45148. v6 = t;
  45149. p0 = v0 + v7;
  45150. p7 = v0 - v7;
  45151. p1 = v1 + v6;
  45152. p6 = v1 - v6;
  45153. p2 = v2 + v5;
  45154. p5 = v2 - v5;
  45155. p3 = v3 + v4;
  45156. p4 = v3 - v4;
  45157. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  45158. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  45159. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  45160. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  45161. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  45162. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  45163. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  45164. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  45165. blockData[blockBufferOffset + col] = p0;
  45166. blockData[blockBufferOffset + col + 8] = p1;
  45167. blockData[blockBufferOffset + col + 16] = p2;
  45168. blockData[blockBufferOffset + col + 24] = p3;
  45169. blockData[blockBufferOffset + col + 32] = p4;
  45170. blockData[blockBufferOffset + col + 40] = p5;
  45171. blockData[blockBufferOffset + col + 48] = p6;
  45172. blockData[blockBufferOffset + col + 56] = p7;
  45173. }
  45174. }
  45175. function buildComponentData(frame, component) {
  45176. var blocksPerLine = component.blocksPerLine;
  45177. var blocksPerColumn = component.blocksPerColumn;
  45178. var computationBuffer = new Int16Array(64);
  45179. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  45180. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  45181. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  45182. quantizeAndInverse(component, offset, computationBuffer);
  45183. }
  45184. }
  45185. return component.blockData;
  45186. }
  45187. function clamp0to255(a) {
  45188. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  45189. }
  45190. JpegImage.prototype = {
  45191. parse: function parse(data) {
  45192. function readUint16() {
  45193. var value = data[offset] << 8 | data[offset + 1];
  45194. offset += 2;
  45195. return value;
  45196. }
  45197. function readDataBlock() {
  45198. var length = readUint16();
  45199. var array = data.subarray(offset, offset + length - 2);
  45200. offset += array.length;
  45201. return array;
  45202. }
  45203. function prepareComponents(frame) {
  45204. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  45205. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  45206. for (var i = 0; i < frame.components.length; i++) {
  45207. component = frame.components[i];
  45208. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  45209. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  45210. var blocksPerLineForMcu = mcusPerLine * component.h;
  45211. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  45212. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  45213. component.blockData = new Int16Array(blocksBufferSize);
  45214. component.blocksPerLine = blocksPerLine;
  45215. component.blocksPerColumn = blocksPerColumn;
  45216. }
  45217. frame.mcusPerLine = mcusPerLine;
  45218. frame.mcusPerColumn = mcusPerColumn;
  45219. }
  45220. var offset = 0;
  45221. var jfif = null;
  45222. var adobe = null;
  45223. var frame, resetInterval;
  45224. var quantizationTables = [];
  45225. var huffmanTablesAC = [], huffmanTablesDC = [];
  45226. var fileMarker = readUint16();
  45227. if (fileMarker !== 0xFFD8) {
  45228. error('JPEG error: SOI not found');
  45229. }
  45230. fileMarker = readUint16();
  45231. while (fileMarker !== 0xFFD9) {
  45232. var i, j, l;
  45233. switch (fileMarker) {
  45234. case 0xFFE0:
  45235. case 0xFFE1:
  45236. case 0xFFE2:
  45237. case 0xFFE3:
  45238. case 0xFFE4:
  45239. case 0xFFE5:
  45240. case 0xFFE6:
  45241. case 0xFFE7:
  45242. case 0xFFE8:
  45243. case 0xFFE9:
  45244. case 0xFFEA:
  45245. case 0xFFEB:
  45246. case 0xFFEC:
  45247. case 0xFFED:
  45248. case 0xFFEE:
  45249. case 0xFFEF:
  45250. case 0xFFFE:
  45251. var appData = readDataBlock();
  45252. if (fileMarker === 0xFFE0) {
  45253. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  45254. jfif = {
  45255. version: {
  45256. major: appData[5],
  45257. minor: appData[6]
  45258. },
  45259. densityUnits: appData[7],
  45260. xDensity: appData[8] << 8 | appData[9],
  45261. yDensity: appData[10] << 8 | appData[11],
  45262. thumbWidth: appData[12],
  45263. thumbHeight: appData[13],
  45264. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  45265. };
  45266. }
  45267. }
  45268. if (fileMarker === 0xFFEE) {
  45269. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  45270. adobe = {
  45271. version: appData[5] << 8 | appData[6],
  45272. flags0: appData[7] << 8 | appData[8],
  45273. flags1: appData[9] << 8 | appData[10],
  45274. transformCode: appData[11]
  45275. };
  45276. }
  45277. }
  45278. break;
  45279. case 0xFFDB:
  45280. var quantizationTablesLength = readUint16();
  45281. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  45282. var z;
  45283. while (offset < quantizationTablesEnd) {
  45284. var quantizationTableSpec = data[offset++];
  45285. var tableData = new Uint16Array(64);
  45286. if (quantizationTableSpec >> 4 === 0) {
  45287. for (j = 0; j < 64; j++) {
  45288. z = dctZigZag[j];
  45289. tableData[z] = data[offset++];
  45290. }
  45291. } else if (quantizationTableSpec >> 4 === 1) {
  45292. for (j = 0; j < 64; j++) {
  45293. z = dctZigZag[j];
  45294. tableData[z] = readUint16();
  45295. }
  45296. } else {
  45297. error('JPEG error: DQT - invalid table spec');
  45298. }
  45299. quantizationTables[quantizationTableSpec & 15] = tableData;
  45300. }
  45301. break;
  45302. case 0xFFC0:
  45303. case 0xFFC1:
  45304. case 0xFFC2:
  45305. if (frame) {
  45306. error('JPEG error: Only single frame JPEGs supported');
  45307. }
  45308. readUint16();
  45309. frame = {};
  45310. frame.extended = fileMarker === 0xFFC1;
  45311. frame.progressive = fileMarker === 0xFFC2;
  45312. frame.precision = data[offset++];
  45313. frame.scanLines = readUint16();
  45314. frame.samplesPerLine = readUint16();
  45315. frame.components = [];
  45316. frame.componentIds = {};
  45317. var componentsCount = data[offset++], componentId;
  45318. var maxH = 0, maxV = 0;
  45319. for (i = 0; i < componentsCount; i++) {
  45320. componentId = data[offset];
  45321. var h = data[offset + 1] >> 4;
  45322. var v = data[offset + 1] & 15;
  45323. if (maxH < h) {
  45324. maxH = h;
  45325. }
  45326. if (maxV < v) {
  45327. maxV = v;
  45328. }
  45329. var qId = data[offset + 2];
  45330. l = frame.components.push({
  45331. h: h,
  45332. v: v,
  45333. quantizationId: qId,
  45334. quantizationTable: null
  45335. });
  45336. frame.componentIds[componentId] = l - 1;
  45337. offset += 3;
  45338. }
  45339. frame.maxH = maxH;
  45340. frame.maxV = maxV;
  45341. prepareComponents(frame);
  45342. break;
  45343. case 0xFFC4:
  45344. var huffmanLength = readUint16();
  45345. for (i = 2; i < huffmanLength;) {
  45346. var huffmanTableSpec = data[offset++];
  45347. var codeLengths = new Uint8Array(16);
  45348. var codeLengthSum = 0;
  45349. for (j = 0; j < 16; j++, offset++) {
  45350. codeLengthSum += codeLengths[j] = data[offset];
  45351. }
  45352. var huffmanValues = new Uint8Array(codeLengthSum);
  45353. for (j = 0; j < codeLengthSum; j++, offset++) {
  45354. huffmanValues[j] = data[offset];
  45355. }
  45356. i += 17 + codeLengthSum;
  45357. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  45358. }
  45359. break;
  45360. case 0xFFDD:
  45361. readUint16();
  45362. resetInterval = readUint16();
  45363. break;
  45364. case 0xFFDA:
  45365. readUint16();
  45366. var selectorsCount = data[offset++];
  45367. var components = [], component;
  45368. for (i = 0; i < selectorsCount; i++) {
  45369. var componentIndex = frame.componentIds[data[offset++]];
  45370. component = frame.components[componentIndex];
  45371. var tableSpec = data[offset++];
  45372. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  45373. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  45374. components.push(component);
  45375. }
  45376. var spectralStart = data[offset++];
  45377. var spectralEnd = data[offset++];
  45378. var successiveApproximation = data[offset++];
  45379. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  45380. offset += processed;
  45381. break;
  45382. case 0xFFFF:
  45383. if (data[offset] !== 0xFF) {
  45384. offset--;
  45385. }
  45386. break;
  45387. default:
  45388. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  45389. offset -= 3;
  45390. break;
  45391. }
  45392. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  45393. }
  45394. fileMarker = readUint16();
  45395. }
  45396. this.width = frame.samplesPerLine;
  45397. this.height = frame.scanLines;
  45398. this.jfif = jfif;
  45399. this.adobe = adobe;
  45400. this.components = [];
  45401. for (i = 0; i < frame.components.length; i++) {
  45402. component = frame.components[i];
  45403. var quantizationTable = quantizationTables[component.quantizationId];
  45404. if (quantizationTable) {
  45405. component.quantizationTable = quantizationTable;
  45406. }
  45407. this.components.push({
  45408. output: buildComponentData(frame, component),
  45409. scaleX: component.h / frame.maxH,
  45410. scaleY: component.v / frame.maxV,
  45411. blocksPerLine: component.blocksPerLine,
  45412. blocksPerColumn: component.blocksPerColumn
  45413. });
  45414. }
  45415. this.numComponents = this.components.length;
  45416. },
  45417. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  45418. var scaleX = this.width / width, scaleY = this.height / height;
  45419. var component, componentScaleX, componentScaleY, blocksPerScanline;
  45420. var x, y, i, j, k;
  45421. var index;
  45422. var offset = 0;
  45423. var output;
  45424. var numComponents = this.components.length;
  45425. var dataLength = width * height * numComponents;
  45426. var data = new Uint8Array(dataLength);
  45427. var xScaleBlockOffset = new Uint32Array(width);
  45428. var mask3LSB = 0xfffffff8;
  45429. for (i = 0; i < numComponents; i++) {
  45430. component = this.components[i];
  45431. componentScaleX = component.scaleX * scaleX;
  45432. componentScaleY = component.scaleY * scaleY;
  45433. offset = i;
  45434. output = component.output;
  45435. blocksPerScanline = component.blocksPerLine + 1 << 3;
  45436. for (x = 0; x < width; x++) {
  45437. j = 0 | x * componentScaleX;
  45438. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  45439. }
  45440. for (y = 0; y < height; y++) {
  45441. j = 0 | y * componentScaleY;
  45442. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  45443. for (x = 0; x < width; x++) {
  45444. data[offset] = output[index + xScaleBlockOffset[x]];
  45445. offset += numComponents;
  45446. }
  45447. }
  45448. }
  45449. var transform = this.decodeTransform;
  45450. if (transform) {
  45451. for (i = 0; i < dataLength;) {
  45452. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  45453. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  45454. }
  45455. }
  45456. }
  45457. return data;
  45458. },
  45459. _isColorConversionNeeded: function isColorConversionNeeded() {
  45460. if (this.adobe && this.adobe.transformCode) {
  45461. return true;
  45462. } else if (this.numComponents === 3) {
  45463. if (!this.adobe && this.colorTransform === 0) {
  45464. return false;
  45465. }
  45466. return true;
  45467. }
  45468. if (!this.adobe && this.colorTransform === 1) {
  45469. return true;
  45470. }
  45471. return false;
  45472. },
  45473. _convertYccToRgb: function convertYccToRgb(data) {
  45474. var Y, Cb, Cr;
  45475. for (var i = 0, length = data.length; i < length; i += 3) {
  45476. Y = data[i];
  45477. Cb = data[i + 1];
  45478. Cr = data[i + 2];
  45479. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  45480. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  45481. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  45482. }
  45483. return data;
  45484. },
  45485. _convertYcckToRgb: function convertYcckToRgb(data) {
  45486. var Y, Cb, Cr, k;
  45487. var offset = 0;
  45488. for (var i = 0, length = data.length; i < length; i += 4) {
  45489. Y = data[i];
  45490. Cb = data[i + 1];
  45491. Cr = data[i + 2];
  45492. k = data[i + 3];
  45493. 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);
  45494. 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);
  45495. 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);
  45496. data[offset++] = clamp0to255(r);
  45497. data[offset++] = clamp0to255(g);
  45498. data[offset++] = clamp0to255(b);
  45499. }
  45500. return data;
  45501. },
  45502. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  45503. var Y, Cb, Cr;
  45504. for (var i = 0, length = data.length; i < length; i += 4) {
  45505. Y = data[i];
  45506. Cb = data[i + 1];
  45507. Cr = data[i + 2];
  45508. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  45509. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  45510. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  45511. }
  45512. return data;
  45513. },
  45514. _convertCmykToRgb: function convertCmykToRgb(data) {
  45515. var c, m, y, k;
  45516. var offset = 0;
  45517. var min = -255 * 255 * 255;
  45518. var scale = 1 / 255 / 255;
  45519. for (var i = 0, length = data.length; i < length; i += 4) {
  45520. c = data[i];
  45521. m = data[i + 1];
  45522. y = data[i + 2];
  45523. k = data[i + 3];
  45524. 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);
  45525. 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);
  45526. 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);
  45527. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  45528. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  45529. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  45530. }
  45531. return data;
  45532. },
  45533. getData: function getData(width, height, forceRGBoutput) {
  45534. if (this.numComponents > 4) {
  45535. error('JPEG error: Unsupported color mode');
  45536. }
  45537. var data = this._getLinearizedBlockData(width, height);
  45538. if (this.numComponents === 1 && forceRGBoutput) {
  45539. var dataLength = data.length;
  45540. var rgbData = new Uint8Array(dataLength * 3);
  45541. var offset = 0;
  45542. for (var i = 0; i < dataLength; i++) {
  45543. var grayColor = data[i];
  45544. rgbData[offset++] = grayColor;
  45545. rgbData[offset++] = grayColor;
  45546. rgbData[offset++] = grayColor;
  45547. }
  45548. return rgbData;
  45549. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  45550. return this._convertYccToRgb(data);
  45551. } else if (this.numComponents === 4) {
  45552. if (this._isColorConversionNeeded()) {
  45553. if (forceRGBoutput) {
  45554. return this._convertYcckToRgb(data);
  45555. }
  45556. return this._convertYcckToCmyk(data);
  45557. } else if (forceRGBoutput) {
  45558. return this._convertCmykToRgb(data);
  45559. }
  45560. }
  45561. return data;
  45562. }
  45563. };
  45564. return JpegImage;
  45565. }();
  45566. exports.JpegImage = JpegImage;
  45567. /***/ }),
  45568. /* 30 */
  45569. /***/ (function(module, exports, __w_pdfjs_require__) {
  45570. "use strict";
  45571. var sharedUtil = __w_pdfjs_require__(0);
  45572. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  45573. var getMetrics = getLookupTableFactory(function (t) {
  45574. t['Courier'] = 600;
  45575. t['Courier-Bold'] = 600;
  45576. t['Courier-BoldOblique'] = 600;
  45577. t['Courier-Oblique'] = 600;
  45578. t['Helvetica'] = getLookupTableFactory(function (t) {
  45579. t['space'] = 278;
  45580. t['exclam'] = 278;
  45581. t['quotedbl'] = 355;
  45582. t['numbersign'] = 556;
  45583. t['dollar'] = 556;
  45584. t['percent'] = 889;
  45585. t['ampersand'] = 667;
  45586. t['quoteright'] = 222;
  45587. t['parenleft'] = 333;
  45588. t['parenright'] = 333;
  45589. t['asterisk'] = 389;
  45590. t['plus'] = 584;
  45591. t['comma'] = 278;
  45592. t['hyphen'] = 333;
  45593. t['period'] = 278;
  45594. t['slash'] = 278;
  45595. t['zero'] = 556;
  45596. t['one'] = 556;
  45597. t['two'] = 556;
  45598. t['three'] = 556;
  45599. t['four'] = 556;
  45600. t['five'] = 556;
  45601. t['six'] = 556;
  45602. t['seven'] = 556;
  45603. t['eight'] = 556;
  45604. t['nine'] = 556;
  45605. t['colon'] = 278;
  45606. t['semicolon'] = 278;
  45607. t['less'] = 584;
  45608. t['equal'] = 584;
  45609. t['greater'] = 584;
  45610. t['question'] = 556;
  45611. t['at'] = 1015;
  45612. t['A'] = 667;
  45613. t['B'] = 667;
  45614. t['C'] = 722;
  45615. t['D'] = 722;
  45616. t['E'] = 667;
  45617. t['F'] = 611;
  45618. t['G'] = 778;
  45619. t['H'] = 722;
  45620. t['I'] = 278;
  45621. t['J'] = 500;
  45622. t['K'] = 667;
  45623. t['L'] = 556;
  45624. t['M'] = 833;
  45625. t['N'] = 722;
  45626. t['O'] = 778;
  45627. t['P'] = 667;
  45628. t['Q'] = 778;
  45629. t['R'] = 722;
  45630. t['S'] = 667;
  45631. t['T'] = 611;
  45632. t['U'] = 722;
  45633. t['V'] = 667;
  45634. t['W'] = 944;
  45635. t['X'] = 667;
  45636. t['Y'] = 667;
  45637. t['Z'] = 611;
  45638. t['bracketleft'] = 278;
  45639. t['backslash'] = 278;
  45640. t['bracketright'] = 278;
  45641. t['asciicircum'] = 469;
  45642. t['underscore'] = 556;
  45643. t['quoteleft'] = 222;
  45644. t['a'] = 556;
  45645. t['b'] = 556;
  45646. t['c'] = 500;
  45647. t['d'] = 556;
  45648. t['e'] = 556;
  45649. t['f'] = 278;
  45650. t['g'] = 556;
  45651. t['h'] = 556;
  45652. t['i'] = 222;
  45653. t['j'] = 222;
  45654. t['k'] = 500;
  45655. t['l'] = 222;
  45656. t['m'] = 833;
  45657. t['n'] = 556;
  45658. t['o'] = 556;
  45659. t['p'] = 556;
  45660. t['q'] = 556;
  45661. t['r'] = 333;
  45662. t['s'] = 500;
  45663. t['t'] = 278;
  45664. t['u'] = 556;
  45665. t['v'] = 500;
  45666. t['w'] = 722;
  45667. t['x'] = 500;
  45668. t['y'] = 500;
  45669. t['z'] = 500;
  45670. t['braceleft'] = 334;
  45671. t['bar'] = 260;
  45672. t['braceright'] = 334;
  45673. t['asciitilde'] = 584;
  45674. t['exclamdown'] = 333;
  45675. t['cent'] = 556;
  45676. t['sterling'] = 556;
  45677. t['fraction'] = 167;
  45678. t['yen'] = 556;
  45679. t['florin'] = 556;
  45680. t['section'] = 556;
  45681. t['currency'] = 556;
  45682. t['quotesingle'] = 191;
  45683. t['quotedblleft'] = 333;
  45684. t['guillemotleft'] = 556;
  45685. t['guilsinglleft'] = 333;
  45686. t['guilsinglright'] = 333;
  45687. t['fi'] = 500;
  45688. t['fl'] = 500;
  45689. t['endash'] = 556;
  45690. t['dagger'] = 556;
  45691. t['daggerdbl'] = 556;
  45692. t['periodcentered'] = 278;
  45693. t['paragraph'] = 537;
  45694. t['bullet'] = 350;
  45695. t['quotesinglbase'] = 222;
  45696. t['quotedblbase'] = 333;
  45697. t['quotedblright'] = 333;
  45698. t['guillemotright'] = 556;
  45699. t['ellipsis'] = 1000;
  45700. t['perthousand'] = 1000;
  45701. t['questiondown'] = 611;
  45702. t['grave'] = 333;
  45703. t['acute'] = 333;
  45704. t['circumflex'] = 333;
  45705. t['tilde'] = 333;
  45706. t['macron'] = 333;
  45707. t['breve'] = 333;
  45708. t['dotaccent'] = 333;
  45709. t['dieresis'] = 333;
  45710. t['ring'] = 333;
  45711. t['cedilla'] = 333;
  45712. t['hungarumlaut'] = 333;
  45713. t['ogonek'] = 333;
  45714. t['caron'] = 333;
  45715. t['emdash'] = 1000;
  45716. t['AE'] = 1000;
  45717. t['ordfeminine'] = 370;
  45718. t['Lslash'] = 556;
  45719. t['Oslash'] = 778;
  45720. t['OE'] = 1000;
  45721. t['ordmasculine'] = 365;
  45722. t['ae'] = 889;
  45723. t['dotlessi'] = 278;
  45724. t['lslash'] = 222;
  45725. t['oslash'] = 611;
  45726. t['oe'] = 944;
  45727. t['germandbls'] = 611;
  45728. t['Idieresis'] = 278;
  45729. t['eacute'] = 556;
  45730. t['abreve'] = 556;
  45731. t['uhungarumlaut'] = 556;
  45732. t['ecaron'] = 556;
  45733. t['Ydieresis'] = 667;
  45734. t['divide'] = 584;
  45735. t['Yacute'] = 667;
  45736. t['Acircumflex'] = 667;
  45737. t['aacute'] = 556;
  45738. t['Ucircumflex'] = 722;
  45739. t['yacute'] = 500;
  45740. t['scommaaccent'] = 500;
  45741. t['ecircumflex'] = 556;
  45742. t['Uring'] = 722;
  45743. t['Udieresis'] = 722;
  45744. t['aogonek'] = 556;
  45745. t['Uacute'] = 722;
  45746. t['uogonek'] = 556;
  45747. t['Edieresis'] = 667;
  45748. t['Dcroat'] = 722;
  45749. t['commaaccent'] = 250;
  45750. t['copyright'] = 737;
  45751. t['Emacron'] = 667;
  45752. t['ccaron'] = 500;
  45753. t['aring'] = 556;
  45754. t['Ncommaaccent'] = 722;
  45755. t['lacute'] = 222;
  45756. t['agrave'] = 556;
  45757. t['Tcommaaccent'] = 611;
  45758. t['Cacute'] = 722;
  45759. t['atilde'] = 556;
  45760. t['Edotaccent'] = 667;
  45761. t['scaron'] = 500;
  45762. t['scedilla'] = 500;
  45763. t['iacute'] = 278;
  45764. t['lozenge'] = 471;
  45765. t['Rcaron'] = 722;
  45766. t['Gcommaaccent'] = 778;
  45767. t['ucircumflex'] = 556;
  45768. t['acircumflex'] = 556;
  45769. t['Amacron'] = 667;
  45770. t['rcaron'] = 333;
  45771. t['ccedilla'] = 500;
  45772. t['Zdotaccent'] = 611;
  45773. t['Thorn'] = 667;
  45774. t['Omacron'] = 778;
  45775. t['Racute'] = 722;
  45776. t['Sacute'] = 667;
  45777. t['dcaron'] = 643;
  45778. t['Umacron'] = 722;
  45779. t['uring'] = 556;
  45780. t['threesuperior'] = 333;
  45781. t['Ograve'] = 778;
  45782. t['Agrave'] = 667;
  45783. t['Abreve'] = 667;
  45784. t['multiply'] = 584;
  45785. t['uacute'] = 556;
  45786. t['Tcaron'] = 611;
  45787. t['partialdiff'] = 476;
  45788. t['ydieresis'] = 500;
  45789. t['Nacute'] = 722;
  45790. t['icircumflex'] = 278;
  45791. t['Ecircumflex'] = 667;
  45792. t['adieresis'] = 556;
  45793. t['edieresis'] = 556;
  45794. t['cacute'] = 500;
  45795. t['nacute'] = 556;
  45796. t['umacron'] = 556;
  45797. t['Ncaron'] = 722;
  45798. t['Iacute'] = 278;
  45799. t['plusminus'] = 584;
  45800. t['brokenbar'] = 260;
  45801. t['registered'] = 737;
  45802. t['Gbreve'] = 778;
  45803. t['Idotaccent'] = 278;
  45804. t['summation'] = 600;
  45805. t['Egrave'] = 667;
  45806. t['racute'] = 333;
  45807. t['omacron'] = 556;
  45808. t['Zacute'] = 611;
  45809. t['Zcaron'] = 611;
  45810. t['greaterequal'] = 549;
  45811. t['Eth'] = 722;
  45812. t['Ccedilla'] = 722;
  45813. t['lcommaaccent'] = 222;
  45814. t['tcaron'] = 317;
  45815. t['eogonek'] = 556;
  45816. t['Uogonek'] = 722;
  45817. t['Aacute'] = 667;
  45818. t['Adieresis'] = 667;
  45819. t['egrave'] = 556;
  45820. t['zacute'] = 500;
  45821. t['iogonek'] = 222;
  45822. t['Oacute'] = 778;
  45823. t['oacute'] = 556;
  45824. t['amacron'] = 556;
  45825. t['sacute'] = 500;
  45826. t['idieresis'] = 278;
  45827. t['Ocircumflex'] = 778;
  45828. t['Ugrave'] = 722;
  45829. t['Delta'] = 612;
  45830. t['thorn'] = 556;
  45831. t['twosuperior'] = 333;
  45832. t['Odieresis'] = 778;
  45833. t['mu'] = 556;
  45834. t['igrave'] = 278;
  45835. t['ohungarumlaut'] = 556;
  45836. t['Eogonek'] = 667;
  45837. t['dcroat'] = 556;
  45838. t['threequarters'] = 834;
  45839. t['Scedilla'] = 667;
  45840. t['lcaron'] = 299;
  45841. t['Kcommaaccent'] = 667;
  45842. t['Lacute'] = 556;
  45843. t['trademark'] = 1000;
  45844. t['edotaccent'] = 556;
  45845. t['Igrave'] = 278;
  45846. t['Imacron'] = 278;
  45847. t['Lcaron'] = 556;
  45848. t['onehalf'] = 834;
  45849. t['lessequal'] = 549;
  45850. t['ocircumflex'] = 556;
  45851. t['ntilde'] = 556;
  45852. t['Uhungarumlaut'] = 722;
  45853. t['Eacute'] = 667;
  45854. t['emacron'] = 556;
  45855. t['gbreve'] = 556;
  45856. t['onequarter'] = 834;
  45857. t['Scaron'] = 667;
  45858. t['Scommaaccent'] = 667;
  45859. t['Ohungarumlaut'] = 778;
  45860. t['degree'] = 400;
  45861. t['ograve'] = 556;
  45862. t['Ccaron'] = 722;
  45863. t['ugrave'] = 556;
  45864. t['radical'] = 453;
  45865. t['Dcaron'] = 722;
  45866. t['rcommaaccent'] = 333;
  45867. t['Ntilde'] = 722;
  45868. t['otilde'] = 556;
  45869. t['Rcommaaccent'] = 722;
  45870. t['Lcommaaccent'] = 556;
  45871. t['Atilde'] = 667;
  45872. t['Aogonek'] = 667;
  45873. t['Aring'] = 667;
  45874. t['Otilde'] = 778;
  45875. t['zdotaccent'] = 500;
  45876. t['Ecaron'] = 667;
  45877. t['Iogonek'] = 278;
  45878. t['kcommaaccent'] = 500;
  45879. t['minus'] = 584;
  45880. t['Icircumflex'] = 278;
  45881. t['ncaron'] = 556;
  45882. t['tcommaaccent'] = 278;
  45883. t['logicalnot'] = 584;
  45884. t['odieresis'] = 556;
  45885. t['udieresis'] = 556;
  45886. t['notequal'] = 549;
  45887. t['gcommaaccent'] = 556;
  45888. t['eth'] = 556;
  45889. t['zcaron'] = 500;
  45890. t['ncommaaccent'] = 556;
  45891. t['onesuperior'] = 333;
  45892. t['imacron'] = 278;
  45893. t['Euro'] = 556;
  45894. });
  45895. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45896. t['space'] = 278;
  45897. t['exclam'] = 333;
  45898. t['quotedbl'] = 474;
  45899. t['numbersign'] = 556;
  45900. t['dollar'] = 556;
  45901. t['percent'] = 889;
  45902. t['ampersand'] = 722;
  45903. t['quoteright'] = 278;
  45904. t['parenleft'] = 333;
  45905. t['parenright'] = 333;
  45906. t['asterisk'] = 389;
  45907. t['plus'] = 584;
  45908. t['comma'] = 278;
  45909. t['hyphen'] = 333;
  45910. t['period'] = 278;
  45911. t['slash'] = 278;
  45912. t['zero'] = 556;
  45913. t['one'] = 556;
  45914. t['two'] = 556;
  45915. t['three'] = 556;
  45916. t['four'] = 556;
  45917. t['five'] = 556;
  45918. t['six'] = 556;
  45919. t['seven'] = 556;
  45920. t['eight'] = 556;
  45921. t['nine'] = 556;
  45922. t['colon'] = 333;
  45923. t['semicolon'] = 333;
  45924. t['less'] = 584;
  45925. t['equal'] = 584;
  45926. t['greater'] = 584;
  45927. t['question'] = 611;
  45928. t['at'] = 975;
  45929. t['A'] = 722;
  45930. t['B'] = 722;
  45931. t['C'] = 722;
  45932. t['D'] = 722;
  45933. t['E'] = 667;
  45934. t['F'] = 611;
  45935. t['G'] = 778;
  45936. t['H'] = 722;
  45937. t['I'] = 278;
  45938. t['J'] = 556;
  45939. t['K'] = 722;
  45940. t['L'] = 611;
  45941. t['M'] = 833;
  45942. t['N'] = 722;
  45943. t['O'] = 778;
  45944. t['P'] = 667;
  45945. t['Q'] = 778;
  45946. t['R'] = 722;
  45947. t['S'] = 667;
  45948. t['T'] = 611;
  45949. t['U'] = 722;
  45950. t['V'] = 667;
  45951. t['W'] = 944;
  45952. t['X'] = 667;
  45953. t['Y'] = 667;
  45954. t['Z'] = 611;
  45955. t['bracketleft'] = 333;
  45956. t['backslash'] = 278;
  45957. t['bracketright'] = 333;
  45958. t['asciicircum'] = 584;
  45959. t['underscore'] = 556;
  45960. t['quoteleft'] = 278;
  45961. t['a'] = 556;
  45962. t['b'] = 611;
  45963. t['c'] = 556;
  45964. t['d'] = 611;
  45965. t['e'] = 556;
  45966. t['f'] = 333;
  45967. t['g'] = 611;
  45968. t['h'] = 611;
  45969. t['i'] = 278;
  45970. t['j'] = 278;
  45971. t['k'] = 556;
  45972. t['l'] = 278;
  45973. t['m'] = 889;
  45974. t['n'] = 611;
  45975. t['o'] = 611;
  45976. t['p'] = 611;
  45977. t['q'] = 611;
  45978. t['r'] = 389;
  45979. t['s'] = 556;
  45980. t['t'] = 333;
  45981. t['u'] = 611;
  45982. t['v'] = 556;
  45983. t['w'] = 778;
  45984. t['x'] = 556;
  45985. t['y'] = 556;
  45986. t['z'] = 500;
  45987. t['braceleft'] = 389;
  45988. t['bar'] = 280;
  45989. t['braceright'] = 389;
  45990. t['asciitilde'] = 584;
  45991. t['exclamdown'] = 333;
  45992. t['cent'] = 556;
  45993. t['sterling'] = 556;
  45994. t['fraction'] = 167;
  45995. t['yen'] = 556;
  45996. t['florin'] = 556;
  45997. t['section'] = 556;
  45998. t['currency'] = 556;
  45999. t['quotesingle'] = 238;
  46000. t['quotedblleft'] = 500;
  46001. t['guillemotleft'] = 556;
  46002. t['guilsinglleft'] = 333;
  46003. t['guilsinglright'] = 333;
  46004. t['fi'] = 611;
  46005. t['fl'] = 611;
  46006. t['endash'] = 556;
  46007. t['dagger'] = 556;
  46008. t['daggerdbl'] = 556;
  46009. t['periodcentered'] = 278;
  46010. t['paragraph'] = 556;
  46011. t['bullet'] = 350;
  46012. t['quotesinglbase'] = 278;
  46013. t['quotedblbase'] = 500;
  46014. t['quotedblright'] = 500;
  46015. t['guillemotright'] = 556;
  46016. t['ellipsis'] = 1000;
  46017. t['perthousand'] = 1000;
  46018. t['questiondown'] = 611;
  46019. t['grave'] = 333;
  46020. t['acute'] = 333;
  46021. t['circumflex'] = 333;
  46022. t['tilde'] = 333;
  46023. t['macron'] = 333;
  46024. t['breve'] = 333;
  46025. t['dotaccent'] = 333;
  46026. t['dieresis'] = 333;
  46027. t['ring'] = 333;
  46028. t['cedilla'] = 333;
  46029. t['hungarumlaut'] = 333;
  46030. t['ogonek'] = 333;
  46031. t['caron'] = 333;
  46032. t['emdash'] = 1000;
  46033. t['AE'] = 1000;
  46034. t['ordfeminine'] = 370;
  46035. t['Lslash'] = 611;
  46036. t['Oslash'] = 778;
  46037. t['OE'] = 1000;
  46038. t['ordmasculine'] = 365;
  46039. t['ae'] = 889;
  46040. t['dotlessi'] = 278;
  46041. t['lslash'] = 278;
  46042. t['oslash'] = 611;
  46043. t['oe'] = 944;
  46044. t['germandbls'] = 611;
  46045. t['Idieresis'] = 278;
  46046. t['eacute'] = 556;
  46047. t['abreve'] = 556;
  46048. t['uhungarumlaut'] = 611;
  46049. t['ecaron'] = 556;
  46050. t['Ydieresis'] = 667;
  46051. t['divide'] = 584;
  46052. t['Yacute'] = 667;
  46053. t['Acircumflex'] = 722;
  46054. t['aacute'] = 556;
  46055. t['Ucircumflex'] = 722;
  46056. t['yacute'] = 556;
  46057. t['scommaaccent'] = 556;
  46058. t['ecircumflex'] = 556;
  46059. t['Uring'] = 722;
  46060. t['Udieresis'] = 722;
  46061. t['aogonek'] = 556;
  46062. t['Uacute'] = 722;
  46063. t['uogonek'] = 611;
  46064. t['Edieresis'] = 667;
  46065. t['Dcroat'] = 722;
  46066. t['commaaccent'] = 250;
  46067. t['copyright'] = 737;
  46068. t['Emacron'] = 667;
  46069. t['ccaron'] = 556;
  46070. t['aring'] = 556;
  46071. t['Ncommaaccent'] = 722;
  46072. t['lacute'] = 278;
  46073. t['agrave'] = 556;
  46074. t['Tcommaaccent'] = 611;
  46075. t['Cacute'] = 722;
  46076. t['atilde'] = 556;
  46077. t['Edotaccent'] = 667;
  46078. t['scaron'] = 556;
  46079. t['scedilla'] = 556;
  46080. t['iacute'] = 278;
  46081. t['lozenge'] = 494;
  46082. t['Rcaron'] = 722;
  46083. t['Gcommaaccent'] = 778;
  46084. t['ucircumflex'] = 611;
  46085. t['acircumflex'] = 556;
  46086. t['Amacron'] = 722;
  46087. t['rcaron'] = 389;
  46088. t['ccedilla'] = 556;
  46089. t['Zdotaccent'] = 611;
  46090. t['Thorn'] = 667;
  46091. t['Omacron'] = 778;
  46092. t['Racute'] = 722;
  46093. t['Sacute'] = 667;
  46094. t['dcaron'] = 743;
  46095. t['Umacron'] = 722;
  46096. t['uring'] = 611;
  46097. t['threesuperior'] = 333;
  46098. t['Ograve'] = 778;
  46099. t['Agrave'] = 722;
  46100. t['Abreve'] = 722;
  46101. t['multiply'] = 584;
  46102. t['uacute'] = 611;
  46103. t['Tcaron'] = 611;
  46104. t['partialdiff'] = 494;
  46105. t['ydieresis'] = 556;
  46106. t['Nacute'] = 722;
  46107. t['icircumflex'] = 278;
  46108. t['Ecircumflex'] = 667;
  46109. t['adieresis'] = 556;
  46110. t['edieresis'] = 556;
  46111. t['cacute'] = 556;
  46112. t['nacute'] = 611;
  46113. t['umacron'] = 611;
  46114. t['Ncaron'] = 722;
  46115. t['Iacute'] = 278;
  46116. t['plusminus'] = 584;
  46117. t['brokenbar'] = 280;
  46118. t['registered'] = 737;
  46119. t['Gbreve'] = 778;
  46120. t['Idotaccent'] = 278;
  46121. t['summation'] = 600;
  46122. t['Egrave'] = 667;
  46123. t['racute'] = 389;
  46124. t['omacron'] = 611;
  46125. t['Zacute'] = 611;
  46126. t['Zcaron'] = 611;
  46127. t['greaterequal'] = 549;
  46128. t['Eth'] = 722;
  46129. t['Ccedilla'] = 722;
  46130. t['lcommaaccent'] = 278;
  46131. t['tcaron'] = 389;
  46132. t['eogonek'] = 556;
  46133. t['Uogonek'] = 722;
  46134. t['Aacute'] = 722;
  46135. t['Adieresis'] = 722;
  46136. t['egrave'] = 556;
  46137. t['zacute'] = 500;
  46138. t['iogonek'] = 278;
  46139. t['Oacute'] = 778;
  46140. t['oacute'] = 611;
  46141. t['amacron'] = 556;
  46142. t['sacute'] = 556;
  46143. t['idieresis'] = 278;
  46144. t['Ocircumflex'] = 778;
  46145. t['Ugrave'] = 722;
  46146. t['Delta'] = 612;
  46147. t['thorn'] = 611;
  46148. t['twosuperior'] = 333;
  46149. t['Odieresis'] = 778;
  46150. t['mu'] = 611;
  46151. t['igrave'] = 278;
  46152. t['ohungarumlaut'] = 611;
  46153. t['Eogonek'] = 667;
  46154. t['dcroat'] = 611;
  46155. t['threequarters'] = 834;
  46156. t['Scedilla'] = 667;
  46157. t['lcaron'] = 400;
  46158. t['Kcommaaccent'] = 722;
  46159. t['Lacute'] = 611;
  46160. t['trademark'] = 1000;
  46161. t['edotaccent'] = 556;
  46162. t['Igrave'] = 278;
  46163. t['Imacron'] = 278;
  46164. t['Lcaron'] = 611;
  46165. t['onehalf'] = 834;
  46166. t['lessequal'] = 549;
  46167. t['ocircumflex'] = 611;
  46168. t['ntilde'] = 611;
  46169. t['Uhungarumlaut'] = 722;
  46170. t['Eacute'] = 667;
  46171. t['emacron'] = 556;
  46172. t['gbreve'] = 611;
  46173. t['onequarter'] = 834;
  46174. t['Scaron'] = 667;
  46175. t['Scommaaccent'] = 667;
  46176. t['Ohungarumlaut'] = 778;
  46177. t['degree'] = 400;
  46178. t['ograve'] = 611;
  46179. t['Ccaron'] = 722;
  46180. t['ugrave'] = 611;
  46181. t['radical'] = 549;
  46182. t['Dcaron'] = 722;
  46183. t['rcommaaccent'] = 389;
  46184. t['Ntilde'] = 722;
  46185. t['otilde'] = 611;
  46186. t['Rcommaaccent'] = 722;
  46187. t['Lcommaaccent'] = 611;
  46188. t['Atilde'] = 722;
  46189. t['Aogonek'] = 722;
  46190. t['Aring'] = 722;
  46191. t['Otilde'] = 778;
  46192. t['zdotaccent'] = 500;
  46193. t['Ecaron'] = 667;
  46194. t['Iogonek'] = 278;
  46195. t['kcommaaccent'] = 556;
  46196. t['minus'] = 584;
  46197. t['Icircumflex'] = 278;
  46198. t['ncaron'] = 611;
  46199. t['tcommaaccent'] = 333;
  46200. t['logicalnot'] = 584;
  46201. t['odieresis'] = 611;
  46202. t['udieresis'] = 611;
  46203. t['notequal'] = 549;
  46204. t['gcommaaccent'] = 611;
  46205. t['eth'] = 611;
  46206. t['zcaron'] = 500;
  46207. t['ncommaaccent'] = 611;
  46208. t['onesuperior'] = 333;
  46209. t['imacron'] = 278;
  46210. t['Euro'] = 556;
  46211. });
  46212. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  46213. t['space'] = 278;
  46214. t['exclam'] = 333;
  46215. t['quotedbl'] = 474;
  46216. t['numbersign'] = 556;
  46217. t['dollar'] = 556;
  46218. t['percent'] = 889;
  46219. t['ampersand'] = 722;
  46220. t['quoteright'] = 278;
  46221. t['parenleft'] = 333;
  46222. t['parenright'] = 333;
  46223. t['asterisk'] = 389;
  46224. t['plus'] = 584;
  46225. t['comma'] = 278;
  46226. t['hyphen'] = 333;
  46227. t['period'] = 278;
  46228. t['slash'] = 278;
  46229. t['zero'] = 556;
  46230. t['one'] = 556;
  46231. t['two'] = 556;
  46232. t['three'] = 556;
  46233. t['four'] = 556;
  46234. t['five'] = 556;
  46235. t['six'] = 556;
  46236. t['seven'] = 556;
  46237. t['eight'] = 556;
  46238. t['nine'] = 556;
  46239. t['colon'] = 333;
  46240. t['semicolon'] = 333;
  46241. t['less'] = 584;
  46242. t['equal'] = 584;
  46243. t['greater'] = 584;
  46244. t['question'] = 611;
  46245. t['at'] = 975;
  46246. t['A'] = 722;
  46247. t['B'] = 722;
  46248. t['C'] = 722;
  46249. t['D'] = 722;
  46250. t['E'] = 667;
  46251. t['F'] = 611;
  46252. t['G'] = 778;
  46253. t['H'] = 722;
  46254. t['I'] = 278;
  46255. t['J'] = 556;
  46256. t['K'] = 722;
  46257. t['L'] = 611;
  46258. t['M'] = 833;
  46259. t['N'] = 722;
  46260. t['O'] = 778;
  46261. t['P'] = 667;
  46262. t['Q'] = 778;
  46263. t['R'] = 722;
  46264. t['S'] = 667;
  46265. t['T'] = 611;
  46266. t['U'] = 722;
  46267. t['V'] = 667;
  46268. t['W'] = 944;
  46269. t['X'] = 667;
  46270. t['Y'] = 667;
  46271. t['Z'] = 611;
  46272. t['bracketleft'] = 333;
  46273. t['backslash'] = 278;
  46274. t['bracketright'] = 333;
  46275. t['asciicircum'] = 584;
  46276. t['underscore'] = 556;
  46277. t['quoteleft'] = 278;
  46278. t['a'] = 556;
  46279. t['b'] = 611;
  46280. t['c'] = 556;
  46281. t['d'] = 611;
  46282. t['e'] = 556;
  46283. t['f'] = 333;
  46284. t['g'] = 611;
  46285. t['h'] = 611;
  46286. t['i'] = 278;
  46287. t['j'] = 278;
  46288. t['k'] = 556;
  46289. t['l'] = 278;
  46290. t['m'] = 889;
  46291. t['n'] = 611;
  46292. t['o'] = 611;
  46293. t['p'] = 611;
  46294. t['q'] = 611;
  46295. t['r'] = 389;
  46296. t['s'] = 556;
  46297. t['t'] = 333;
  46298. t['u'] = 611;
  46299. t['v'] = 556;
  46300. t['w'] = 778;
  46301. t['x'] = 556;
  46302. t['y'] = 556;
  46303. t['z'] = 500;
  46304. t['braceleft'] = 389;
  46305. t['bar'] = 280;
  46306. t['braceright'] = 389;
  46307. t['asciitilde'] = 584;
  46308. t['exclamdown'] = 333;
  46309. t['cent'] = 556;
  46310. t['sterling'] = 556;
  46311. t['fraction'] = 167;
  46312. t['yen'] = 556;
  46313. t['florin'] = 556;
  46314. t['section'] = 556;
  46315. t['currency'] = 556;
  46316. t['quotesingle'] = 238;
  46317. t['quotedblleft'] = 500;
  46318. t['guillemotleft'] = 556;
  46319. t['guilsinglleft'] = 333;
  46320. t['guilsinglright'] = 333;
  46321. t['fi'] = 611;
  46322. t['fl'] = 611;
  46323. t['endash'] = 556;
  46324. t['dagger'] = 556;
  46325. t['daggerdbl'] = 556;
  46326. t['periodcentered'] = 278;
  46327. t['paragraph'] = 556;
  46328. t['bullet'] = 350;
  46329. t['quotesinglbase'] = 278;
  46330. t['quotedblbase'] = 500;
  46331. t['quotedblright'] = 500;
  46332. t['guillemotright'] = 556;
  46333. t['ellipsis'] = 1000;
  46334. t['perthousand'] = 1000;
  46335. t['questiondown'] = 611;
  46336. t['grave'] = 333;
  46337. t['acute'] = 333;
  46338. t['circumflex'] = 333;
  46339. t['tilde'] = 333;
  46340. t['macron'] = 333;
  46341. t['breve'] = 333;
  46342. t['dotaccent'] = 333;
  46343. t['dieresis'] = 333;
  46344. t['ring'] = 333;
  46345. t['cedilla'] = 333;
  46346. t['hungarumlaut'] = 333;
  46347. t['ogonek'] = 333;
  46348. t['caron'] = 333;
  46349. t['emdash'] = 1000;
  46350. t['AE'] = 1000;
  46351. t['ordfeminine'] = 370;
  46352. t['Lslash'] = 611;
  46353. t['Oslash'] = 778;
  46354. t['OE'] = 1000;
  46355. t['ordmasculine'] = 365;
  46356. t['ae'] = 889;
  46357. t['dotlessi'] = 278;
  46358. t['lslash'] = 278;
  46359. t['oslash'] = 611;
  46360. t['oe'] = 944;
  46361. t['germandbls'] = 611;
  46362. t['Idieresis'] = 278;
  46363. t['eacute'] = 556;
  46364. t['abreve'] = 556;
  46365. t['uhungarumlaut'] = 611;
  46366. t['ecaron'] = 556;
  46367. t['Ydieresis'] = 667;
  46368. t['divide'] = 584;
  46369. t['Yacute'] = 667;
  46370. t['Acircumflex'] = 722;
  46371. t['aacute'] = 556;
  46372. t['Ucircumflex'] = 722;
  46373. t['yacute'] = 556;
  46374. t['scommaaccent'] = 556;
  46375. t['ecircumflex'] = 556;
  46376. t['Uring'] = 722;
  46377. t['Udieresis'] = 722;
  46378. t['aogonek'] = 556;
  46379. t['Uacute'] = 722;
  46380. t['uogonek'] = 611;
  46381. t['Edieresis'] = 667;
  46382. t['Dcroat'] = 722;
  46383. t['commaaccent'] = 250;
  46384. t['copyright'] = 737;
  46385. t['Emacron'] = 667;
  46386. t['ccaron'] = 556;
  46387. t['aring'] = 556;
  46388. t['Ncommaaccent'] = 722;
  46389. t['lacute'] = 278;
  46390. t['agrave'] = 556;
  46391. t['Tcommaaccent'] = 611;
  46392. t['Cacute'] = 722;
  46393. t['atilde'] = 556;
  46394. t['Edotaccent'] = 667;
  46395. t['scaron'] = 556;
  46396. t['scedilla'] = 556;
  46397. t['iacute'] = 278;
  46398. t['lozenge'] = 494;
  46399. t['Rcaron'] = 722;
  46400. t['Gcommaaccent'] = 778;
  46401. t['ucircumflex'] = 611;
  46402. t['acircumflex'] = 556;
  46403. t['Amacron'] = 722;
  46404. t['rcaron'] = 389;
  46405. t['ccedilla'] = 556;
  46406. t['Zdotaccent'] = 611;
  46407. t['Thorn'] = 667;
  46408. t['Omacron'] = 778;
  46409. t['Racute'] = 722;
  46410. t['Sacute'] = 667;
  46411. t['dcaron'] = 743;
  46412. t['Umacron'] = 722;
  46413. t['uring'] = 611;
  46414. t['threesuperior'] = 333;
  46415. t['Ograve'] = 778;
  46416. t['Agrave'] = 722;
  46417. t['Abreve'] = 722;
  46418. t['multiply'] = 584;
  46419. t['uacute'] = 611;
  46420. t['Tcaron'] = 611;
  46421. t['partialdiff'] = 494;
  46422. t['ydieresis'] = 556;
  46423. t['Nacute'] = 722;
  46424. t['icircumflex'] = 278;
  46425. t['Ecircumflex'] = 667;
  46426. t['adieresis'] = 556;
  46427. t['edieresis'] = 556;
  46428. t['cacute'] = 556;
  46429. t['nacute'] = 611;
  46430. t['umacron'] = 611;
  46431. t['Ncaron'] = 722;
  46432. t['Iacute'] = 278;
  46433. t['plusminus'] = 584;
  46434. t['brokenbar'] = 280;
  46435. t['registered'] = 737;
  46436. t['Gbreve'] = 778;
  46437. t['Idotaccent'] = 278;
  46438. t['summation'] = 600;
  46439. t['Egrave'] = 667;
  46440. t['racute'] = 389;
  46441. t['omacron'] = 611;
  46442. t['Zacute'] = 611;
  46443. t['Zcaron'] = 611;
  46444. t['greaterequal'] = 549;
  46445. t['Eth'] = 722;
  46446. t['Ccedilla'] = 722;
  46447. t['lcommaaccent'] = 278;
  46448. t['tcaron'] = 389;
  46449. t['eogonek'] = 556;
  46450. t['Uogonek'] = 722;
  46451. t['Aacute'] = 722;
  46452. t['Adieresis'] = 722;
  46453. t['egrave'] = 556;
  46454. t['zacute'] = 500;
  46455. t['iogonek'] = 278;
  46456. t['Oacute'] = 778;
  46457. t['oacute'] = 611;
  46458. t['amacron'] = 556;
  46459. t['sacute'] = 556;
  46460. t['idieresis'] = 278;
  46461. t['Ocircumflex'] = 778;
  46462. t['Ugrave'] = 722;
  46463. t['Delta'] = 612;
  46464. t['thorn'] = 611;
  46465. t['twosuperior'] = 333;
  46466. t['Odieresis'] = 778;
  46467. t['mu'] = 611;
  46468. t['igrave'] = 278;
  46469. t['ohungarumlaut'] = 611;
  46470. t['Eogonek'] = 667;
  46471. t['dcroat'] = 611;
  46472. t['threequarters'] = 834;
  46473. t['Scedilla'] = 667;
  46474. t['lcaron'] = 400;
  46475. t['Kcommaaccent'] = 722;
  46476. t['Lacute'] = 611;
  46477. t['trademark'] = 1000;
  46478. t['edotaccent'] = 556;
  46479. t['Igrave'] = 278;
  46480. t['Imacron'] = 278;
  46481. t['Lcaron'] = 611;
  46482. t['onehalf'] = 834;
  46483. t['lessequal'] = 549;
  46484. t['ocircumflex'] = 611;
  46485. t['ntilde'] = 611;
  46486. t['Uhungarumlaut'] = 722;
  46487. t['Eacute'] = 667;
  46488. t['emacron'] = 556;
  46489. t['gbreve'] = 611;
  46490. t['onequarter'] = 834;
  46491. t['Scaron'] = 667;
  46492. t['Scommaaccent'] = 667;
  46493. t['Ohungarumlaut'] = 778;
  46494. t['degree'] = 400;
  46495. t['ograve'] = 611;
  46496. t['Ccaron'] = 722;
  46497. t['ugrave'] = 611;
  46498. t['radical'] = 549;
  46499. t['Dcaron'] = 722;
  46500. t['rcommaaccent'] = 389;
  46501. t['Ntilde'] = 722;
  46502. t['otilde'] = 611;
  46503. t['Rcommaaccent'] = 722;
  46504. t['Lcommaaccent'] = 611;
  46505. t['Atilde'] = 722;
  46506. t['Aogonek'] = 722;
  46507. t['Aring'] = 722;
  46508. t['Otilde'] = 778;
  46509. t['zdotaccent'] = 500;
  46510. t['Ecaron'] = 667;
  46511. t['Iogonek'] = 278;
  46512. t['kcommaaccent'] = 556;
  46513. t['minus'] = 584;
  46514. t['Icircumflex'] = 278;
  46515. t['ncaron'] = 611;
  46516. t['tcommaaccent'] = 333;
  46517. t['logicalnot'] = 584;
  46518. t['odieresis'] = 611;
  46519. t['udieresis'] = 611;
  46520. t['notequal'] = 549;
  46521. t['gcommaaccent'] = 611;
  46522. t['eth'] = 611;
  46523. t['zcaron'] = 500;
  46524. t['ncommaaccent'] = 611;
  46525. t['onesuperior'] = 333;
  46526. t['imacron'] = 278;
  46527. t['Euro'] = 556;
  46528. });
  46529. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  46530. t['space'] = 278;
  46531. t['exclam'] = 278;
  46532. t['quotedbl'] = 355;
  46533. t['numbersign'] = 556;
  46534. t['dollar'] = 556;
  46535. t['percent'] = 889;
  46536. t['ampersand'] = 667;
  46537. t['quoteright'] = 222;
  46538. t['parenleft'] = 333;
  46539. t['parenright'] = 333;
  46540. t['asterisk'] = 389;
  46541. t['plus'] = 584;
  46542. t['comma'] = 278;
  46543. t['hyphen'] = 333;
  46544. t['period'] = 278;
  46545. t['slash'] = 278;
  46546. t['zero'] = 556;
  46547. t['one'] = 556;
  46548. t['two'] = 556;
  46549. t['three'] = 556;
  46550. t['four'] = 556;
  46551. t['five'] = 556;
  46552. t['six'] = 556;
  46553. t['seven'] = 556;
  46554. t['eight'] = 556;
  46555. t['nine'] = 556;
  46556. t['colon'] = 278;
  46557. t['semicolon'] = 278;
  46558. t['less'] = 584;
  46559. t['equal'] = 584;
  46560. t['greater'] = 584;
  46561. t['question'] = 556;
  46562. t['at'] = 1015;
  46563. t['A'] = 667;
  46564. t['B'] = 667;
  46565. t['C'] = 722;
  46566. t['D'] = 722;
  46567. t['E'] = 667;
  46568. t['F'] = 611;
  46569. t['G'] = 778;
  46570. t['H'] = 722;
  46571. t['I'] = 278;
  46572. t['J'] = 500;
  46573. t['K'] = 667;
  46574. t['L'] = 556;
  46575. t['M'] = 833;
  46576. t['N'] = 722;
  46577. t['O'] = 778;
  46578. t['P'] = 667;
  46579. t['Q'] = 778;
  46580. t['R'] = 722;
  46581. t['S'] = 667;
  46582. t['T'] = 611;
  46583. t['U'] = 722;
  46584. t['V'] = 667;
  46585. t['W'] = 944;
  46586. t['X'] = 667;
  46587. t['Y'] = 667;
  46588. t['Z'] = 611;
  46589. t['bracketleft'] = 278;
  46590. t['backslash'] = 278;
  46591. t['bracketright'] = 278;
  46592. t['asciicircum'] = 469;
  46593. t['underscore'] = 556;
  46594. t['quoteleft'] = 222;
  46595. t['a'] = 556;
  46596. t['b'] = 556;
  46597. t['c'] = 500;
  46598. t['d'] = 556;
  46599. t['e'] = 556;
  46600. t['f'] = 278;
  46601. t['g'] = 556;
  46602. t['h'] = 556;
  46603. t['i'] = 222;
  46604. t['j'] = 222;
  46605. t['k'] = 500;
  46606. t['l'] = 222;
  46607. t['m'] = 833;
  46608. t['n'] = 556;
  46609. t['o'] = 556;
  46610. t['p'] = 556;
  46611. t['q'] = 556;
  46612. t['r'] = 333;
  46613. t['s'] = 500;
  46614. t['t'] = 278;
  46615. t['u'] = 556;
  46616. t['v'] = 500;
  46617. t['w'] = 722;
  46618. t['x'] = 500;
  46619. t['y'] = 500;
  46620. t['z'] = 500;
  46621. t['braceleft'] = 334;
  46622. t['bar'] = 260;
  46623. t['braceright'] = 334;
  46624. t['asciitilde'] = 584;
  46625. t['exclamdown'] = 333;
  46626. t['cent'] = 556;
  46627. t['sterling'] = 556;
  46628. t['fraction'] = 167;
  46629. t['yen'] = 556;
  46630. t['florin'] = 556;
  46631. t['section'] = 556;
  46632. t['currency'] = 556;
  46633. t['quotesingle'] = 191;
  46634. t['quotedblleft'] = 333;
  46635. t['guillemotleft'] = 556;
  46636. t['guilsinglleft'] = 333;
  46637. t['guilsinglright'] = 333;
  46638. t['fi'] = 500;
  46639. t['fl'] = 500;
  46640. t['endash'] = 556;
  46641. t['dagger'] = 556;
  46642. t['daggerdbl'] = 556;
  46643. t['periodcentered'] = 278;
  46644. t['paragraph'] = 537;
  46645. t['bullet'] = 350;
  46646. t['quotesinglbase'] = 222;
  46647. t['quotedblbase'] = 333;
  46648. t['quotedblright'] = 333;
  46649. t['guillemotright'] = 556;
  46650. t['ellipsis'] = 1000;
  46651. t['perthousand'] = 1000;
  46652. t['questiondown'] = 611;
  46653. t['grave'] = 333;
  46654. t['acute'] = 333;
  46655. t['circumflex'] = 333;
  46656. t['tilde'] = 333;
  46657. t['macron'] = 333;
  46658. t['breve'] = 333;
  46659. t['dotaccent'] = 333;
  46660. t['dieresis'] = 333;
  46661. t['ring'] = 333;
  46662. t['cedilla'] = 333;
  46663. t['hungarumlaut'] = 333;
  46664. t['ogonek'] = 333;
  46665. t['caron'] = 333;
  46666. t['emdash'] = 1000;
  46667. t['AE'] = 1000;
  46668. t['ordfeminine'] = 370;
  46669. t['Lslash'] = 556;
  46670. t['Oslash'] = 778;
  46671. t['OE'] = 1000;
  46672. t['ordmasculine'] = 365;
  46673. t['ae'] = 889;
  46674. t['dotlessi'] = 278;
  46675. t['lslash'] = 222;
  46676. t['oslash'] = 611;
  46677. t['oe'] = 944;
  46678. t['germandbls'] = 611;
  46679. t['Idieresis'] = 278;
  46680. t['eacute'] = 556;
  46681. t['abreve'] = 556;
  46682. t['uhungarumlaut'] = 556;
  46683. t['ecaron'] = 556;
  46684. t['Ydieresis'] = 667;
  46685. t['divide'] = 584;
  46686. t['Yacute'] = 667;
  46687. t['Acircumflex'] = 667;
  46688. t['aacute'] = 556;
  46689. t['Ucircumflex'] = 722;
  46690. t['yacute'] = 500;
  46691. t['scommaaccent'] = 500;
  46692. t['ecircumflex'] = 556;
  46693. t['Uring'] = 722;
  46694. t['Udieresis'] = 722;
  46695. t['aogonek'] = 556;
  46696. t['Uacute'] = 722;
  46697. t['uogonek'] = 556;
  46698. t['Edieresis'] = 667;
  46699. t['Dcroat'] = 722;
  46700. t['commaaccent'] = 250;
  46701. t['copyright'] = 737;
  46702. t['Emacron'] = 667;
  46703. t['ccaron'] = 500;
  46704. t['aring'] = 556;
  46705. t['Ncommaaccent'] = 722;
  46706. t['lacute'] = 222;
  46707. t['agrave'] = 556;
  46708. t['Tcommaaccent'] = 611;
  46709. t['Cacute'] = 722;
  46710. t['atilde'] = 556;
  46711. t['Edotaccent'] = 667;
  46712. t['scaron'] = 500;
  46713. t['scedilla'] = 500;
  46714. t['iacute'] = 278;
  46715. t['lozenge'] = 471;
  46716. t['Rcaron'] = 722;
  46717. t['Gcommaaccent'] = 778;
  46718. t['ucircumflex'] = 556;
  46719. t['acircumflex'] = 556;
  46720. t['Amacron'] = 667;
  46721. t['rcaron'] = 333;
  46722. t['ccedilla'] = 500;
  46723. t['Zdotaccent'] = 611;
  46724. t['Thorn'] = 667;
  46725. t['Omacron'] = 778;
  46726. t['Racute'] = 722;
  46727. t['Sacute'] = 667;
  46728. t['dcaron'] = 643;
  46729. t['Umacron'] = 722;
  46730. t['uring'] = 556;
  46731. t['threesuperior'] = 333;
  46732. t['Ograve'] = 778;
  46733. t['Agrave'] = 667;
  46734. t['Abreve'] = 667;
  46735. t['multiply'] = 584;
  46736. t['uacute'] = 556;
  46737. t['Tcaron'] = 611;
  46738. t['partialdiff'] = 476;
  46739. t['ydieresis'] = 500;
  46740. t['Nacute'] = 722;
  46741. t['icircumflex'] = 278;
  46742. t['Ecircumflex'] = 667;
  46743. t['adieresis'] = 556;
  46744. t['edieresis'] = 556;
  46745. t['cacute'] = 500;
  46746. t['nacute'] = 556;
  46747. t['umacron'] = 556;
  46748. t['Ncaron'] = 722;
  46749. t['Iacute'] = 278;
  46750. t['plusminus'] = 584;
  46751. t['brokenbar'] = 260;
  46752. t['registered'] = 737;
  46753. t['Gbreve'] = 778;
  46754. t['Idotaccent'] = 278;
  46755. t['summation'] = 600;
  46756. t['Egrave'] = 667;
  46757. t['racute'] = 333;
  46758. t['omacron'] = 556;
  46759. t['Zacute'] = 611;
  46760. t['Zcaron'] = 611;
  46761. t['greaterequal'] = 549;
  46762. t['Eth'] = 722;
  46763. t['Ccedilla'] = 722;
  46764. t['lcommaaccent'] = 222;
  46765. t['tcaron'] = 317;
  46766. t['eogonek'] = 556;
  46767. t['Uogonek'] = 722;
  46768. t['Aacute'] = 667;
  46769. t['Adieresis'] = 667;
  46770. t['egrave'] = 556;
  46771. t['zacute'] = 500;
  46772. t['iogonek'] = 222;
  46773. t['Oacute'] = 778;
  46774. t['oacute'] = 556;
  46775. t['amacron'] = 556;
  46776. t['sacute'] = 500;
  46777. t['idieresis'] = 278;
  46778. t['Ocircumflex'] = 778;
  46779. t['Ugrave'] = 722;
  46780. t['Delta'] = 612;
  46781. t['thorn'] = 556;
  46782. t['twosuperior'] = 333;
  46783. t['Odieresis'] = 778;
  46784. t['mu'] = 556;
  46785. t['igrave'] = 278;
  46786. t['ohungarumlaut'] = 556;
  46787. t['Eogonek'] = 667;
  46788. t['dcroat'] = 556;
  46789. t['threequarters'] = 834;
  46790. t['Scedilla'] = 667;
  46791. t['lcaron'] = 299;
  46792. t['Kcommaaccent'] = 667;
  46793. t['Lacute'] = 556;
  46794. t['trademark'] = 1000;
  46795. t['edotaccent'] = 556;
  46796. t['Igrave'] = 278;
  46797. t['Imacron'] = 278;
  46798. t['Lcaron'] = 556;
  46799. t['onehalf'] = 834;
  46800. t['lessequal'] = 549;
  46801. t['ocircumflex'] = 556;
  46802. t['ntilde'] = 556;
  46803. t['Uhungarumlaut'] = 722;
  46804. t['Eacute'] = 667;
  46805. t['emacron'] = 556;
  46806. t['gbreve'] = 556;
  46807. t['onequarter'] = 834;
  46808. t['Scaron'] = 667;
  46809. t['Scommaaccent'] = 667;
  46810. t['Ohungarumlaut'] = 778;
  46811. t['degree'] = 400;
  46812. t['ograve'] = 556;
  46813. t['Ccaron'] = 722;
  46814. t['ugrave'] = 556;
  46815. t['radical'] = 453;
  46816. t['Dcaron'] = 722;
  46817. t['rcommaaccent'] = 333;
  46818. t['Ntilde'] = 722;
  46819. t['otilde'] = 556;
  46820. t['Rcommaaccent'] = 722;
  46821. t['Lcommaaccent'] = 556;
  46822. t['Atilde'] = 667;
  46823. t['Aogonek'] = 667;
  46824. t['Aring'] = 667;
  46825. t['Otilde'] = 778;
  46826. t['zdotaccent'] = 500;
  46827. t['Ecaron'] = 667;
  46828. t['Iogonek'] = 278;
  46829. t['kcommaaccent'] = 500;
  46830. t['minus'] = 584;
  46831. t['Icircumflex'] = 278;
  46832. t['ncaron'] = 556;
  46833. t['tcommaaccent'] = 278;
  46834. t['logicalnot'] = 584;
  46835. t['odieresis'] = 556;
  46836. t['udieresis'] = 556;
  46837. t['notequal'] = 549;
  46838. t['gcommaaccent'] = 556;
  46839. t['eth'] = 556;
  46840. t['zcaron'] = 500;
  46841. t['ncommaaccent'] = 556;
  46842. t['onesuperior'] = 333;
  46843. t['imacron'] = 278;
  46844. t['Euro'] = 556;
  46845. });
  46846. t['Symbol'] = getLookupTableFactory(function (t) {
  46847. t['space'] = 250;
  46848. t['exclam'] = 333;
  46849. t['universal'] = 713;
  46850. t['numbersign'] = 500;
  46851. t['existential'] = 549;
  46852. t['percent'] = 833;
  46853. t['ampersand'] = 778;
  46854. t['suchthat'] = 439;
  46855. t['parenleft'] = 333;
  46856. t['parenright'] = 333;
  46857. t['asteriskmath'] = 500;
  46858. t['plus'] = 549;
  46859. t['comma'] = 250;
  46860. t['minus'] = 549;
  46861. t['period'] = 250;
  46862. t['slash'] = 278;
  46863. t['zero'] = 500;
  46864. t['one'] = 500;
  46865. t['two'] = 500;
  46866. t['three'] = 500;
  46867. t['four'] = 500;
  46868. t['five'] = 500;
  46869. t['six'] = 500;
  46870. t['seven'] = 500;
  46871. t['eight'] = 500;
  46872. t['nine'] = 500;
  46873. t['colon'] = 278;
  46874. t['semicolon'] = 278;
  46875. t['less'] = 549;
  46876. t['equal'] = 549;
  46877. t['greater'] = 549;
  46878. t['question'] = 444;
  46879. t['congruent'] = 549;
  46880. t['Alpha'] = 722;
  46881. t['Beta'] = 667;
  46882. t['Chi'] = 722;
  46883. t['Delta'] = 612;
  46884. t['Epsilon'] = 611;
  46885. t['Phi'] = 763;
  46886. t['Gamma'] = 603;
  46887. t['Eta'] = 722;
  46888. t['Iota'] = 333;
  46889. t['theta1'] = 631;
  46890. t['Kappa'] = 722;
  46891. t['Lambda'] = 686;
  46892. t['Mu'] = 889;
  46893. t['Nu'] = 722;
  46894. t['Omicron'] = 722;
  46895. t['Pi'] = 768;
  46896. t['Theta'] = 741;
  46897. t['Rho'] = 556;
  46898. t['Sigma'] = 592;
  46899. t['Tau'] = 611;
  46900. t['Upsilon'] = 690;
  46901. t['sigma1'] = 439;
  46902. t['Omega'] = 768;
  46903. t['Xi'] = 645;
  46904. t['Psi'] = 795;
  46905. t['Zeta'] = 611;
  46906. t['bracketleft'] = 333;
  46907. t['therefore'] = 863;
  46908. t['bracketright'] = 333;
  46909. t['perpendicular'] = 658;
  46910. t['underscore'] = 500;
  46911. t['radicalex'] = 500;
  46912. t['alpha'] = 631;
  46913. t['beta'] = 549;
  46914. t['chi'] = 549;
  46915. t['delta'] = 494;
  46916. t['epsilon'] = 439;
  46917. t['phi'] = 521;
  46918. t['gamma'] = 411;
  46919. t['eta'] = 603;
  46920. t['iota'] = 329;
  46921. t['phi1'] = 603;
  46922. t['kappa'] = 549;
  46923. t['lambda'] = 549;
  46924. t['mu'] = 576;
  46925. t['nu'] = 521;
  46926. t['omicron'] = 549;
  46927. t['pi'] = 549;
  46928. t['theta'] = 521;
  46929. t['rho'] = 549;
  46930. t['sigma'] = 603;
  46931. t['tau'] = 439;
  46932. t['upsilon'] = 576;
  46933. t['omega1'] = 713;
  46934. t['omega'] = 686;
  46935. t['xi'] = 493;
  46936. t['psi'] = 686;
  46937. t['zeta'] = 494;
  46938. t['braceleft'] = 480;
  46939. t['bar'] = 200;
  46940. t['braceright'] = 480;
  46941. t['similar'] = 549;
  46942. t['Euro'] = 750;
  46943. t['Upsilon1'] = 620;
  46944. t['minute'] = 247;
  46945. t['lessequal'] = 549;
  46946. t['fraction'] = 167;
  46947. t['infinity'] = 713;
  46948. t['florin'] = 500;
  46949. t['club'] = 753;
  46950. t['diamond'] = 753;
  46951. t['heart'] = 753;
  46952. t['spade'] = 753;
  46953. t['arrowboth'] = 1042;
  46954. t['arrowleft'] = 987;
  46955. t['arrowup'] = 603;
  46956. t['arrowright'] = 987;
  46957. t['arrowdown'] = 603;
  46958. t['degree'] = 400;
  46959. t['plusminus'] = 549;
  46960. t['second'] = 411;
  46961. t['greaterequal'] = 549;
  46962. t['multiply'] = 549;
  46963. t['proportional'] = 713;
  46964. t['partialdiff'] = 494;
  46965. t['bullet'] = 460;
  46966. t['divide'] = 549;
  46967. t['notequal'] = 549;
  46968. t['equivalence'] = 549;
  46969. t['approxequal'] = 549;
  46970. t['ellipsis'] = 1000;
  46971. t['arrowvertex'] = 603;
  46972. t['arrowhorizex'] = 1000;
  46973. t['carriagereturn'] = 658;
  46974. t['aleph'] = 823;
  46975. t['Ifraktur'] = 686;
  46976. t['Rfraktur'] = 795;
  46977. t['weierstrass'] = 987;
  46978. t['circlemultiply'] = 768;
  46979. t['circleplus'] = 768;
  46980. t['emptyset'] = 823;
  46981. t['intersection'] = 768;
  46982. t['union'] = 768;
  46983. t['propersuperset'] = 713;
  46984. t['reflexsuperset'] = 713;
  46985. t['notsubset'] = 713;
  46986. t['propersubset'] = 713;
  46987. t['reflexsubset'] = 713;
  46988. t['element'] = 713;
  46989. t['notelement'] = 713;
  46990. t['angle'] = 768;
  46991. t['gradient'] = 713;
  46992. t['registerserif'] = 790;
  46993. t['copyrightserif'] = 790;
  46994. t['trademarkserif'] = 890;
  46995. t['product'] = 823;
  46996. t['radical'] = 549;
  46997. t['dotmath'] = 250;
  46998. t['logicalnot'] = 713;
  46999. t['logicaland'] = 603;
  47000. t['logicalor'] = 603;
  47001. t['arrowdblboth'] = 1042;
  47002. t['arrowdblleft'] = 987;
  47003. t['arrowdblup'] = 603;
  47004. t['arrowdblright'] = 987;
  47005. t['arrowdbldown'] = 603;
  47006. t['lozenge'] = 494;
  47007. t['angleleft'] = 329;
  47008. t['registersans'] = 790;
  47009. t['copyrightsans'] = 790;
  47010. t['trademarksans'] = 786;
  47011. t['summation'] = 713;
  47012. t['parenlefttp'] = 384;
  47013. t['parenleftex'] = 384;
  47014. t['parenleftbt'] = 384;
  47015. t['bracketlefttp'] = 384;
  47016. t['bracketleftex'] = 384;
  47017. t['bracketleftbt'] = 384;
  47018. t['bracelefttp'] = 494;
  47019. t['braceleftmid'] = 494;
  47020. t['braceleftbt'] = 494;
  47021. t['braceex'] = 494;
  47022. t['angleright'] = 329;
  47023. t['integral'] = 274;
  47024. t['integraltp'] = 686;
  47025. t['integralex'] = 686;
  47026. t['integralbt'] = 686;
  47027. t['parenrighttp'] = 384;
  47028. t['parenrightex'] = 384;
  47029. t['parenrightbt'] = 384;
  47030. t['bracketrighttp'] = 384;
  47031. t['bracketrightex'] = 384;
  47032. t['bracketrightbt'] = 384;
  47033. t['bracerighttp'] = 494;
  47034. t['bracerightmid'] = 494;
  47035. t['bracerightbt'] = 494;
  47036. t['apple'] = 790;
  47037. });
  47038. t['Times-Roman'] = getLookupTableFactory(function (t) {
  47039. t['space'] = 250;
  47040. t['exclam'] = 333;
  47041. t['quotedbl'] = 408;
  47042. t['numbersign'] = 500;
  47043. t['dollar'] = 500;
  47044. t['percent'] = 833;
  47045. t['ampersand'] = 778;
  47046. t['quoteright'] = 333;
  47047. t['parenleft'] = 333;
  47048. t['parenright'] = 333;
  47049. t['asterisk'] = 500;
  47050. t['plus'] = 564;
  47051. t['comma'] = 250;
  47052. t['hyphen'] = 333;
  47053. t['period'] = 250;
  47054. t['slash'] = 278;
  47055. t['zero'] = 500;
  47056. t['one'] = 500;
  47057. t['two'] = 500;
  47058. t['three'] = 500;
  47059. t['four'] = 500;
  47060. t['five'] = 500;
  47061. t['six'] = 500;
  47062. t['seven'] = 500;
  47063. t['eight'] = 500;
  47064. t['nine'] = 500;
  47065. t['colon'] = 278;
  47066. t['semicolon'] = 278;
  47067. t['less'] = 564;
  47068. t['equal'] = 564;
  47069. t['greater'] = 564;
  47070. t['question'] = 444;
  47071. t['at'] = 921;
  47072. t['A'] = 722;
  47073. t['B'] = 667;
  47074. t['C'] = 667;
  47075. t['D'] = 722;
  47076. t['E'] = 611;
  47077. t['F'] = 556;
  47078. t['G'] = 722;
  47079. t['H'] = 722;
  47080. t['I'] = 333;
  47081. t['J'] = 389;
  47082. t['K'] = 722;
  47083. t['L'] = 611;
  47084. t['M'] = 889;
  47085. t['N'] = 722;
  47086. t['O'] = 722;
  47087. t['P'] = 556;
  47088. t['Q'] = 722;
  47089. t['R'] = 667;
  47090. t['S'] = 556;
  47091. t['T'] = 611;
  47092. t['U'] = 722;
  47093. t['V'] = 722;
  47094. t['W'] = 944;
  47095. t['X'] = 722;
  47096. t['Y'] = 722;
  47097. t['Z'] = 611;
  47098. t['bracketleft'] = 333;
  47099. t['backslash'] = 278;
  47100. t['bracketright'] = 333;
  47101. t['asciicircum'] = 469;
  47102. t['underscore'] = 500;
  47103. t['quoteleft'] = 333;
  47104. t['a'] = 444;
  47105. t['b'] = 500;
  47106. t['c'] = 444;
  47107. t['d'] = 500;
  47108. t['e'] = 444;
  47109. t['f'] = 333;
  47110. t['g'] = 500;
  47111. t['h'] = 500;
  47112. t['i'] = 278;
  47113. t['j'] = 278;
  47114. t['k'] = 500;
  47115. t['l'] = 278;
  47116. t['m'] = 778;
  47117. t['n'] = 500;
  47118. t['o'] = 500;
  47119. t['p'] = 500;
  47120. t['q'] = 500;
  47121. t['r'] = 333;
  47122. t['s'] = 389;
  47123. t['t'] = 278;
  47124. t['u'] = 500;
  47125. t['v'] = 500;
  47126. t['w'] = 722;
  47127. t['x'] = 500;
  47128. t['y'] = 500;
  47129. t['z'] = 444;
  47130. t['braceleft'] = 480;
  47131. t['bar'] = 200;
  47132. t['braceright'] = 480;
  47133. t['asciitilde'] = 541;
  47134. t['exclamdown'] = 333;
  47135. t['cent'] = 500;
  47136. t['sterling'] = 500;
  47137. t['fraction'] = 167;
  47138. t['yen'] = 500;
  47139. t['florin'] = 500;
  47140. t['section'] = 500;
  47141. t['currency'] = 500;
  47142. t['quotesingle'] = 180;
  47143. t['quotedblleft'] = 444;
  47144. t['guillemotleft'] = 500;
  47145. t['guilsinglleft'] = 333;
  47146. t['guilsinglright'] = 333;
  47147. t['fi'] = 556;
  47148. t['fl'] = 556;
  47149. t['endash'] = 500;
  47150. t['dagger'] = 500;
  47151. t['daggerdbl'] = 500;
  47152. t['periodcentered'] = 250;
  47153. t['paragraph'] = 453;
  47154. t['bullet'] = 350;
  47155. t['quotesinglbase'] = 333;
  47156. t['quotedblbase'] = 444;
  47157. t['quotedblright'] = 444;
  47158. t['guillemotright'] = 500;
  47159. t['ellipsis'] = 1000;
  47160. t['perthousand'] = 1000;
  47161. t['questiondown'] = 444;
  47162. t['grave'] = 333;
  47163. t['acute'] = 333;
  47164. t['circumflex'] = 333;
  47165. t['tilde'] = 333;
  47166. t['macron'] = 333;
  47167. t['breve'] = 333;
  47168. t['dotaccent'] = 333;
  47169. t['dieresis'] = 333;
  47170. t['ring'] = 333;
  47171. t['cedilla'] = 333;
  47172. t['hungarumlaut'] = 333;
  47173. t['ogonek'] = 333;
  47174. t['caron'] = 333;
  47175. t['emdash'] = 1000;
  47176. t['AE'] = 889;
  47177. t['ordfeminine'] = 276;
  47178. t['Lslash'] = 611;
  47179. t['Oslash'] = 722;
  47180. t['OE'] = 889;
  47181. t['ordmasculine'] = 310;
  47182. t['ae'] = 667;
  47183. t['dotlessi'] = 278;
  47184. t['lslash'] = 278;
  47185. t['oslash'] = 500;
  47186. t['oe'] = 722;
  47187. t['germandbls'] = 500;
  47188. t['Idieresis'] = 333;
  47189. t['eacute'] = 444;
  47190. t['abreve'] = 444;
  47191. t['uhungarumlaut'] = 500;
  47192. t['ecaron'] = 444;
  47193. t['Ydieresis'] = 722;
  47194. t['divide'] = 564;
  47195. t['Yacute'] = 722;
  47196. t['Acircumflex'] = 722;
  47197. t['aacute'] = 444;
  47198. t['Ucircumflex'] = 722;
  47199. t['yacute'] = 500;
  47200. t['scommaaccent'] = 389;
  47201. t['ecircumflex'] = 444;
  47202. t['Uring'] = 722;
  47203. t['Udieresis'] = 722;
  47204. t['aogonek'] = 444;
  47205. t['Uacute'] = 722;
  47206. t['uogonek'] = 500;
  47207. t['Edieresis'] = 611;
  47208. t['Dcroat'] = 722;
  47209. t['commaaccent'] = 250;
  47210. t['copyright'] = 760;
  47211. t['Emacron'] = 611;
  47212. t['ccaron'] = 444;
  47213. t['aring'] = 444;
  47214. t['Ncommaaccent'] = 722;
  47215. t['lacute'] = 278;
  47216. t['agrave'] = 444;
  47217. t['Tcommaaccent'] = 611;
  47218. t['Cacute'] = 667;
  47219. t['atilde'] = 444;
  47220. t['Edotaccent'] = 611;
  47221. t['scaron'] = 389;
  47222. t['scedilla'] = 389;
  47223. t['iacute'] = 278;
  47224. t['lozenge'] = 471;
  47225. t['Rcaron'] = 667;
  47226. t['Gcommaaccent'] = 722;
  47227. t['ucircumflex'] = 500;
  47228. t['acircumflex'] = 444;
  47229. t['Amacron'] = 722;
  47230. t['rcaron'] = 333;
  47231. t['ccedilla'] = 444;
  47232. t['Zdotaccent'] = 611;
  47233. t['Thorn'] = 556;
  47234. t['Omacron'] = 722;
  47235. t['Racute'] = 667;
  47236. t['Sacute'] = 556;
  47237. t['dcaron'] = 588;
  47238. t['Umacron'] = 722;
  47239. t['uring'] = 500;
  47240. t['threesuperior'] = 300;
  47241. t['Ograve'] = 722;
  47242. t['Agrave'] = 722;
  47243. t['Abreve'] = 722;
  47244. t['multiply'] = 564;
  47245. t['uacute'] = 500;
  47246. t['Tcaron'] = 611;
  47247. t['partialdiff'] = 476;
  47248. t['ydieresis'] = 500;
  47249. t['Nacute'] = 722;
  47250. t['icircumflex'] = 278;
  47251. t['Ecircumflex'] = 611;
  47252. t['adieresis'] = 444;
  47253. t['edieresis'] = 444;
  47254. t['cacute'] = 444;
  47255. t['nacute'] = 500;
  47256. t['umacron'] = 500;
  47257. t['Ncaron'] = 722;
  47258. t['Iacute'] = 333;
  47259. t['plusminus'] = 564;
  47260. t['brokenbar'] = 200;
  47261. t['registered'] = 760;
  47262. t['Gbreve'] = 722;
  47263. t['Idotaccent'] = 333;
  47264. t['summation'] = 600;
  47265. t['Egrave'] = 611;
  47266. t['racute'] = 333;
  47267. t['omacron'] = 500;
  47268. t['Zacute'] = 611;
  47269. t['Zcaron'] = 611;
  47270. t['greaterequal'] = 549;
  47271. t['Eth'] = 722;
  47272. t['Ccedilla'] = 667;
  47273. t['lcommaaccent'] = 278;
  47274. t['tcaron'] = 326;
  47275. t['eogonek'] = 444;
  47276. t['Uogonek'] = 722;
  47277. t['Aacute'] = 722;
  47278. t['Adieresis'] = 722;
  47279. t['egrave'] = 444;
  47280. t['zacute'] = 444;
  47281. t['iogonek'] = 278;
  47282. t['Oacute'] = 722;
  47283. t['oacute'] = 500;
  47284. t['amacron'] = 444;
  47285. t['sacute'] = 389;
  47286. t['idieresis'] = 278;
  47287. t['Ocircumflex'] = 722;
  47288. t['Ugrave'] = 722;
  47289. t['Delta'] = 612;
  47290. t['thorn'] = 500;
  47291. t['twosuperior'] = 300;
  47292. t['Odieresis'] = 722;
  47293. t['mu'] = 500;
  47294. t['igrave'] = 278;
  47295. t['ohungarumlaut'] = 500;
  47296. t['Eogonek'] = 611;
  47297. t['dcroat'] = 500;
  47298. t['threequarters'] = 750;
  47299. t['Scedilla'] = 556;
  47300. t['lcaron'] = 344;
  47301. t['Kcommaaccent'] = 722;
  47302. t['Lacute'] = 611;
  47303. t['trademark'] = 980;
  47304. t['edotaccent'] = 444;
  47305. t['Igrave'] = 333;
  47306. t['Imacron'] = 333;
  47307. t['Lcaron'] = 611;
  47308. t['onehalf'] = 750;
  47309. t['lessequal'] = 549;
  47310. t['ocircumflex'] = 500;
  47311. t['ntilde'] = 500;
  47312. t['Uhungarumlaut'] = 722;
  47313. t['Eacute'] = 611;
  47314. t['emacron'] = 444;
  47315. t['gbreve'] = 500;
  47316. t['onequarter'] = 750;
  47317. t['Scaron'] = 556;
  47318. t['Scommaaccent'] = 556;
  47319. t['Ohungarumlaut'] = 722;
  47320. t['degree'] = 400;
  47321. t['ograve'] = 500;
  47322. t['Ccaron'] = 667;
  47323. t['ugrave'] = 500;
  47324. t['radical'] = 453;
  47325. t['Dcaron'] = 722;
  47326. t['rcommaaccent'] = 333;
  47327. t['Ntilde'] = 722;
  47328. t['otilde'] = 500;
  47329. t['Rcommaaccent'] = 667;
  47330. t['Lcommaaccent'] = 611;
  47331. t['Atilde'] = 722;
  47332. t['Aogonek'] = 722;
  47333. t['Aring'] = 722;
  47334. t['Otilde'] = 722;
  47335. t['zdotaccent'] = 444;
  47336. t['Ecaron'] = 611;
  47337. t['Iogonek'] = 333;
  47338. t['kcommaaccent'] = 500;
  47339. t['minus'] = 564;
  47340. t['Icircumflex'] = 333;
  47341. t['ncaron'] = 500;
  47342. t['tcommaaccent'] = 278;
  47343. t['logicalnot'] = 564;
  47344. t['odieresis'] = 500;
  47345. t['udieresis'] = 500;
  47346. t['notequal'] = 549;
  47347. t['gcommaaccent'] = 500;
  47348. t['eth'] = 500;
  47349. t['zcaron'] = 444;
  47350. t['ncommaaccent'] = 500;
  47351. t['onesuperior'] = 300;
  47352. t['imacron'] = 278;
  47353. t['Euro'] = 500;
  47354. });
  47355. t['Times-Bold'] = getLookupTableFactory(function (t) {
  47356. t['space'] = 250;
  47357. t['exclam'] = 333;
  47358. t['quotedbl'] = 555;
  47359. t['numbersign'] = 500;
  47360. t['dollar'] = 500;
  47361. t['percent'] = 1000;
  47362. t['ampersand'] = 833;
  47363. t['quoteright'] = 333;
  47364. t['parenleft'] = 333;
  47365. t['parenright'] = 333;
  47366. t['asterisk'] = 500;
  47367. t['plus'] = 570;
  47368. t['comma'] = 250;
  47369. t['hyphen'] = 333;
  47370. t['period'] = 250;
  47371. t['slash'] = 278;
  47372. t['zero'] = 500;
  47373. t['one'] = 500;
  47374. t['two'] = 500;
  47375. t['three'] = 500;
  47376. t['four'] = 500;
  47377. t['five'] = 500;
  47378. t['six'] = 500;
  47379. t['seven'] = 500;
  47380. t['eight'] = 500;
  47381. t['nine'] = 500;
  47382. t['colon'] = 333;
  47383. t['semicolon'] = 333;
  47384. t['less'] = 570;
  47385. t['equal'] = 570;
  47386. t['greater'] = 570;
  47387. t['question'] = 500;
  47388. t['at'] = 930;
  47389. t['A'] = 722;
  47390. t['B'] = 667;
  47391. t['C'] = 722;
  47392. t['D'] = 722;
  47393. t['E'] = 667;
  47394. t['F'] = 611;
  47395. t['G'] = 778;
  47396. t['H'] = 778;
  47397. t['I'] = 389;
  47398. t['J'] = 500;
  47399. t['K'] = 778;
  47400. t['L'] = 667;
  47401. t['M'] = 944;
  47402. t['N'] = 722;
  47403. t['O'] = 778;
  47404. t['P'] = 611;
  47405. t['Q'] = 778;
  47406. t['R'] = 722;
  47407. t['S'] = 556;
  47408. t['T'] = 667;
  47409. t['U'] = 722;
  47410. t['V'] = 722;
  47411. t['W'] = 1000;
  47412. t['X'] = 722;
  47413. t['Y'] = 722;
  47414. t['Z'] = 667;
  47415. t['bracketleft'] = 333;
  47416. t['backslash'] = 278;
  47417. t['bracketright'] = 333;
  47418. t['asciicircum'] = 581;
  47419. t['underscore'] = 500;
  47420. t['quoteleft'] = 333;
  47421. t['a'] = 500;
  47422. t['b'] = 556;
  47423. t['c'] = 444;
  47424. t['d'] = 556;
  47425. t['e'] = 444;
  47426. t['f'] = 333;
  47427. t['g'] = 500;
  47428. t['h'] = 556;
  47429. t['i'] = 278;
  47430. t['j'] = 333;
  47431. t['k'] = 556;
  47432. t['l'] = 278;
  47433. t['m'] = 833;
  47434. t['n'] = 556;
  47435. t['o'] = 500;
  47436. t['p'] = 556;
  47437. t['q'] = 556;
  47438. t['r'] = 444;
  47439. t['s'] = 389;
  47440. t['t'] = 333;
  47441. t['u'] = 556;
  47442. t['v'] = 500;
  47443. t['w'] = 722;
  47444. t['x'] = 500;
  47445. t['y'] = 500;
  47446. t['z'] = 444;
  47447. t['braceleft'] = 394;
  47448. t['bar'] = 220;
  47449. t['braceright'] = 394;
  47450. t['asciitilde'] = 520;
  47451. t['exclamdown'] = 333;
  47452. t['cent'] = 500;
  47453. t['sterling'] = 500;
  47454. t['fraction'] = 167;
  47455. t['yen'] = 500;
  47456. t['florin'] = 500;
  47457. t['section'] = 500;
  47458. t['currency'] = 500;
  47459. t['quotesingle'] = 278;
  47460. t['quotedblleft'] = 500;
  47461. t['guillemotleft'] = 500;
  47462. t['guilsinglleft'] = 333;
  47463. t['guilsinglright'] = 333;
  47464. t['fi'] = 556;
  47465. t['fl'] = 556;
  47466. t['endash'] = 500;
  47467. t['dagger'] = 500;
  47468. t['daggerdbl'] = 500;
  47469. t['periodcentered'] = 250;
  47470. t['paragraph'] = 540;
  47471. t['bullet'] = 350;
  47472. t['quotesinglbase'] = 333;
  47473. t['quotedblbase'] = 500;
  47474. t['quotedblright'] = 500;
  47475. t['guillemotright'] = 500;
  47476. t['ellipsis'] = 1000;
  47477. t['perthousand'] = 1000;
  47478. t['questiondown'] = 500;
  47479. t['grave'] = 333;
  47480. t['acute'] = 333;
  47481. t['circumflex'] = 333;
  47482. t['tilde'] = 333;
  47483. t['macron'] = 333;
  47484. t['breve'] = 333;
  47485. t['dotaccent'] = 333;
  47486. t['dieresis'] = 333;
  47487. t['ring'] = 333;
  47488. t['cedilla'] = 333;
  47489. t['hungarumlaut'] = 333;
  47490. t['ogonek'] = 333;
  47491. t['caron'] = 333;
  47492. t['emdash'] = 1000;
  47493. t['AE'] = 1000;
  47494. t['ordfeminine'] = 300;
  47495. t['Lslash'] = 667;
  47496. t['Oslash'] = 778;
  47497. t['OE'] = 1000;
  47498. t['ordmasculine'] = 330;
  47499. t['ae'] = 722;
  47500. t['dotlessi'] = 278;
  47501. t['lslash'] = 278;
  47502. t['oslash'] = 500;
  47503. t['oe'] = 722;
  47504. t['germandbls'] = 556;
  47505. t['Idieresis'] = 389;
  47506. t['eacute'] = 444;
  47507. t['abreve'] = 500;
  47508. t['uhungarumlaut'] = 556;
  47509. t['ecaron'] = 444;
  47510. t['Ydieresis'] = 722;
  47511. t['divide'] = 570;
  47512. t['Yacute'] = 722;
  47513. t['Acircumflex'] = 722;
  47514. t['aacute'] = 500;
  47515. t['Ucircumflex'] = 722;
  47516. t['yacute'] = 500;
  47517. t['scommaaccent'] = 389;
  47518. t['ecircumflex'] = 444;
  47519. t['Uring'] = 722;
  47520. t['Udieresis'] = 722;
  47521. t['aogonek'] = 500;
  47522. t['Uacute'] = 722;
  47523. t['uogonek'] = 556;
  47524. t['Edieresis'] = 667;
  47525. t['Dcroat'] = 722;
  47526. t['commaaccent'] = 250;
  47527. t['copyright'] = 747;
  47528. t['Emacron'] = 667;
  47529. t['ccaron'] = 444;
  47530. t['aring'] = 500;
  47531. t['Ncommaaccent'] = 722;
  47532. t['lacute'] = 278;
  47533. t['agrave'] = 500;
  47534. t['Tcommaaccent'] = 667;
  47535. t['Cacute'] = 722;
  47536. t['atilde'] = 500;
  47537. t['Edotaccent'] = 667;
  47538. t['scaron'] = 389;
  47539. t['scedilla'] = 389;
  47540. t['iacute'] = 278;
  47541. t['lozenge'] = 494;
  47542. t['Rcaron'] = 722;
  47543. t['Gcommaaccent'] = 778;
  47544. t['ucircumflex'] = 556;
  47545. t['acircumflex'] = 500;
  47546. t['Amacron'] = 722;
  47547. t['rcaron'] = 444;
  47548. t['ccedilla'] = 444;
  47549. t['Zdotaccent'] = 667;
  47550. t['Thorn'] = 611;
  47551. t['Omacron'] = 778;
  47552. t['Racute'] = 722;
  47553. t['Sacute'] = 556;
  47554. t['dcaron'] = 672;
  47555. t['Umacron'] = 722;
  47556. t['uring'] = 556;
  47557. t['threesuperior'] = 300;
  47558. t['Ograve'] = 778;
  47559. t['Agrave'] = 722;
  47560. t['Abreve'] = 722;
  47561. t['multiply'] = 570;
  47562. t['uacute'] = 556;
  47563. t['Tcaron'] = 667;
  47564. t['partialdiff'] = 494;
  47565. t['ydieresis'] = 500;
  47566. t['Nacute'] = 722;
  47567. t['icircumflex'] = 278;
  47568. t['Ecircumflex'] = 667;
  47569. t['adieresis'] = 500;
  47570. t['edieresis'] = 444;
  47571. t['cacute'] = 444;
  47572. t['nacute'] = 556;
  47573. t['umacron'] = 556;
  47574. t['Ncaron'] = 722;
  47575. t['Iacute'] = 389;
  47576. t['plusminus'] = 570;
  47577. t['brokenbar'] = 220;
  47578. t['registered'] = 747;
  47579. t['Gbreve'] = 778;
  47580. t['Idotaccent'] = 389;
  47581. t['summation'] = 600;
  47582. t['Egrave'] = 667;
  47583. t['racute'] = 444;
  47584. t['omacron'] = 500;
  47585. t['Zacute'] = 667;
  47586. t['Zcaron'] = 667;
  47587. t['greaterequal'] = 549;
  47588. t['Eth'] = 722;
  47589. t['Ccedilla'] = 722;
  47590. t['lcommaaccent'] = 278;
  47591. t['tcaron'] = 416;
  47592. t['eogonek'] = 444;
  47593. t['Uogonek'] = 722;
  47594. t['Aacute'] = 722;
  47595. t['Adieresis'] = 722;
  47596. t['egrave'] = 444;
  47597. t['zacute'] = 444;
  47598. t['iogonek'] = 278;
  47599. t['Oacute'] = 778;
  47600. t['oacute'] = 500;
  47601. t['amacron'] = 500;
  47602. t['sacute'] = 389;
  47603. t['idieresis'] = 278;
  47604. t['Ocircumflex'] = 778;
  47605. t['Ugrave'] = 722;
  47606. t['Delta'] = 612;
  47607. t['thorn'] = 556;
  47608. t['twosuperior'] = 300;
  47609. t['Odieresis'] = 778;
  47610. t['mu'] = 556;
  47611. t['igrave'] = 278;
  47612. t['ohungarumlaut'] = 500;
  47613. t['Eogonek'] = 667;
  47614. t['dcroat'] = 556;
  47615. t['threequarters'] = 750;
  47616. t['Scedilla'] = 556;
  47617. t['lcaron'] = 394;
  47618. t['Kcommaaccent'] = 778;
  47619. t['Lacute'] = 667;
  47620. t['trademark'] = 1000;
  47621. t['edotaccent'] = 444;
  47622. t['Igrave'] = 389;
  47623. t['Imacron'] = 389;
  47624. t['Lcaron'] = 667;
  47625. t['onehalf'] = 750;
  47626. t['lessequal'] = 549;
  47627. t['ocircumflex'] = 500;
  47628. t['ntilde'] = 556;
  47629. t['Uhungarumlaut'] = 722;
  47630. t['Eacute'] = 667;
  47631. t['emacron'] = 444;
  47632. t['gbreve'] = 500;
  47633. t['onequarter'] = 750;
  47634. t['Scaron'] = 556;
  47635. t['Scommaaccent'] = 556;
  47636. t['Ohungarumlaut'] = 778;
  47637. t['degree'] = 400;
  47638. t['ograve'] = 500;
  47639. t['Ccaron'] = 722;
  47640. t['ugrave'] = 556;
  47641. t['radical'] = 549;
  47642. t['Dcaron'] = 722;
  47643. t['rcommaaccent'] = 444;
  47644. t['Ntilde'] = 722;
  47645. t['otilde'] = 500;
  47646. t['Rcommaaccent'] = 722;
  47647. t['Lcommaaccent'] = 667;
  47648. t['Atilde'] = 722;
  47649. t['Aogonek'] = 722;
  47650. t['Aring'] = 722;
  47651. t['Otilde'] = 778;
  47652. t['zdotaccent'] = 444;
  47653. t['Ecaron'] = 667;
  47654. t['Iogonek'] = 389;
  47655. t['kcommaaccent'] = 556;
  47656. t['minus'] = 570;
  47657. t['Icircumflex'] = 389;
  47658. t['ncaron'] = 556;
  47659. t['tcommaaccent'] = 333;
  47660. t['logicalnot'] = 570;
  47661. t['odieresis'] = 500;
  47662. t['udieresis'] = 556;
  47663. t['notequal'] = 549;
  47664. t['gcommaaccent'] = 500;
  47665. t['eth'] = 500;
  47666. t['zcaron'] = 444;
  47667. t['ncommaaccent'] = 556;
  47668. t['onesuperior'] = 300;
  47669. t['imacron'] = 278;
  47670. t['Euro'] = 500;
  47671. });
  47672. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  47673. t['space'] = 250;
  47674. t['exclam'] = 389;
  47675. t['quotedbl'] = 555;
  47676. t['numbersign'] = 500;
  47677. t['dollar'] = 500;
  47678. t['percent'] = 833;
  47679. t['ampersand'] = 778;
  47680. t['quoteright'] = 333;
  47681. t['parenleft'] = 333;
  47682. t['parenright'] = 333;
  47683. t['asterisk'] = 500;
  47684. t['plus'] = 570;
  47685. t['comma'] = 250;
  47686. t['hyphen'] = 333;
  47687. t['period'] = 250;
  47688. t['slash'] = 278;
  47689. t['zero'] = 500;
  47690. t['one'] = 500;
  47691. t['two'] = 500;
  47692. t['three'] = 500;
  47693. t['four'] = 500;
  47694. t['five'] = 500;
  47695. t['six'] = 500;
  47696. t['seven'] = 500;
  47697. t['eight'] = 500;
  47698. t['nine'] = 500;
  47699. t['colon'] = 333;
  47700. t['semicolon'] = 333;
  47701. t['less'] = 570;
  47702. t['equal'] = 570;
  47703. t['greater'] = 570;
  47704. t['question'] = 500;
  47705. t['at'] = 832;
  47706. t['A'] = 667;
  47707. t['B'] = 667;
  47708. t['C'] = 667;
  47709. t['D'] = 722;
  47710. t['E'] = 667;
  47711. t['F'] = 667;
  47712. t['G'] = 722;
  47713. t['H'] = 778;
  47714. t['I'] = 389;
  47715. t['J'] = 500;
  47716. t['K'] = 667;
  47717. t['L'] = 611;
  47718. t['M'] = 889;
  47719. t['N'] = 722;
  47720. t['O'] = 722;
  47721. t['P'] = 611;
  47722. t['Q'] = 722;
  47723. t['R'] = 667;
  47724. t['S'] = 556;
  47725. t['T'] = 611;
  47726. t['U'] = 722;
  47727. t['V'] = 667;
  47728. t['W'] = 889;
  47729. t['X'] = 667;
  47730. t['Y'] = 611;
  47731. t['Z'] = 611;
  47732. t['bracketleft'] = 333;
  47733. t['backslash'] = 278;
  47734. t['bracketright'] = 333;
  47735. t['asciicircum'] = 570;
  47736. t['underscore'] = 500;
  47737. t['quoteleft'] = 333;
  47738. t['a'] = 500;
  47739. t['b'] = 500;
  47740. t['c'] = 444;
  47741. t['d'] = 500;
  47742. t['e'] = 444;
  47743. t['f'] = 333;
  47744. t['g'] = 500;
  47745. t['h'] = 556;
  47746. t['i'] = 278;
  47747. t['j'] = 278;
  47748. t['k'] = 500;
  47749. t['l'] = 278;
  47750. t['m'] = 778;
  47751. t['n'] = 556;
  47752. t['o'] = 500;
  47753. t['p'] = 500;
  47754. t['q'] = 500;
  47755. t['r'] = 389;
  47756. t['s'] = 389;
  47757. t['t'] = 278;
  47758. t['u'] = 556;
  47759. t['v'] = 444;
  47760. t['w'] = 667;
  47761. t['x'] = 500;
  47762. t['y'] = 444;
  47763. t['z'] = 389;
  47764. t['braceleft'] = 348;
  47765. t['bar'] = 220;
  47766. t['braceright'] = 348;
  47767. t['asciitilde'] = 570;
  47768. t['exclamdown'] = 389;
  47769. t['cent'] = 500;
  47770. t['sterling'] = 500;
  47771. t['fraction'] = 167;
  47772. t['yen'] = 500;
  47773. t['florin'] = 500;
  47774. t['section'] = 500;
  47775. t['currency'] = 500;
  47776. t['quotesingle'] = 278;
  47777. t['quotedblleft'] = 500;
  47778. t['guillemotleft'] = 500;
  47779. t['guilsinglleft'] = 333;
  47780. t['guilsinglright'] = 333;
  47781. t['fi'] = 556;
  47782. t['fl'] = 556;
  47783. t['endash'] = 500;
  47784. t['dagger'] = 500;
  47785. t['daggerdbl'] = 500;
  47786. t['periodcentered'] = 250;
  47787. t['paragraph'] = 500;
  47788. t['bullet'] = 350;
  47789. t['quotesinglbase'] = 333;
  47790. t['quotedblbase'] = 500;
  47791. t['quotedblright'] = 500;
  47792. t['guillemotright'] = 500;
  47793. t['ellipsis'] = 1000;
  47794. t['perthousand'] = 1000;
  47795. t['questiondown'] = 500;
  47796. t['grave'] = 333;
  47797. t['acute'] = 333;
  47798. t['circumflex'] = 333;
  47799. t['tilde'] = 333;
  47800. t['macron'] = 333;
  47801. t['breve'] = 333;
  47802. t['dotaccent'] = 333;
  47803. t['dieresis'] = 333;
  47804. t['ring'] = 333;
  47805. t['cedilla'] = 333;
  47806. t['hungarumlaut'] = 333;
  47807. t['ogonek'] = 333;
  47808. t['caron'] = 333;
  47809. t['emdash'] = 1000;
  47810. t['AE'] = 944;
  47811. t['ordfeminine'] = 266;
  47812. t['Lslash'] = 611;
  47813. t['Oslash'] = 722;
  47814. t['OE'] = 944;
  47815. t['ordmasculine'] = 300;
  47816. t['ae'] = 722;
  47817. t['dotlessi'] = 278;
  47818. t['lslash'] = 278;
  47819. t['oslash'] = 500;
  47820. t['oe'] = 722;
  47821. t['germandbls'] = 500;
  47822. t['Idieresis'] = 389;
  47823. t['eacute'] = 444;
  47824. t['abreve'] = 500;
  47825. t['uhungarumlaut'] = 556;
  47826. t['ecaron'] = 444;
  47827. t['Ydieresis'] = 611;
  47828. t['divide'] = 570;
  47829. t['Yacute'] = 611;
  47830. t['Acircumflex'] = 667;
  47831. t['aacute'] = 500;
  47832. t['Ucircumflex'] = 722;
  47833. t['yacute'] = 444;
  47834. t['scommaaccent'] = 389;
  47835. t['ecircumflex'] = 444;
  47836. t['Uring'] = 722;
  47837. t['Udieresis'] = 722;
  47838. t['aogonek'] = 500;
  47839. t['Uacute'] = 722;
  47840. t['uogonek'] = 556;
  47841. t['Edieresis'] = 667;
  47842. t['Dcroat'] = 722;
  47843. t['commaaccent'] = 250;
  47844. t['copyright'] = 747;
  47845. t['Emacron'] = 667;
  47846. t['ccaron'] = 444;
  47847. t['aring'] = 500;
  47848. t['Ncommaaccent'] = 722;
  47849. t['lacute'] = 278;
  47850. t['agrave'] = 500;
  47851. t['Tcommaaccent'] = 611;
  47852. t['Cacute'] = 667;
  47853. t['atilde'] = 500;
  47854. t['Edotaccent'] = 667;
  47855. t['scaron'] = 389;
  47856. t['scedilla'] = 389;
  47857. t['iacute'] = 278;
  47858. t['lozenge'] = 494;
  47859. t['Rcaron'] = 667;
  47860. t['Gcommaaccent'] = 722;
  47861. t['ucircumflex'] = 556;
  47862. t['acircumflex'] = 500;
  47863. t['Amacron'] = 667;
  47864. t['rcaron'] = 389;
  47865. t['ccedilla'] = 444;
  47866. t['Zdotaccent'] = 611;
  47867. t['Thorn'] = 611;
  47868. t['Omacron'] = 722;
  47869. t['Racute'] = 667;
  47870. t['Sacute'] = 556;
  47871. t['dcaron'] = 608;
  47872. t['Umacron'] = 722;
  47873. t['uring'] = 556;
  47874. t['threesuperior'] = 300;
  47875. t['Ograve'] = 722;
  47876. t['Agrave'] = 667;
  47877. t['Abreve'] = 667;
  47878. t['multiply'] = 570;
  47879. t['uacute'] = 556;
  47880. t['Tcaron'] = 611;
  47881. t['partialdiff'] = 494;
  47882. t['ydieresis'] = 444;
  47883. t['Nacute'] = 722;
  47884. t['icircumflex'] = 278;
  47885. t['Ecircumflex'] = 667;
  47886. t['adieresis'] = 500;
  47887. t['edieresis'] = 444;
  47888. t['cacute'] = 444;
  47889. t['nacute'] = 556;
  47890. t['umacron'] = 556;
  47891. t['Ncaron'] = 722;
  47892. t['Iacute'] = 389;
  47893. t['plusminus'] = 570;
  47894. t['brokenbar'] = 220;
  47895. t['registered'] = 747;
  47896. t['Gbreve'] = 722;
  47897. t['Idotaccent'] = 389;
  47898. t['summation'] = 600;
  47899. t['Egrave'] = 667;
  47900. t['racute'] = 389;
  47901. t['omacron'] = 500;
  47902. t['Zacute'] = 611;
  47903. t['Zcaron'] = 611;
  47904. t['greaterequal'] = 549;
  47905. t['Eth'] = 722;
  47906. t['Ccedilla'] = 667;
  47907. t['lcommaaccent'] = 278;
  47908. t['tcaron'] = 366;
  47909. t['eogonek'] = 444;
  47910. t['Uogonek'] = 722;
  47911. t['Aacute'] = 667;
  47912. t['Adieresis'] = 667;
  47913. t['egrave'] = 444;
  47914. t['zacute'] = 389;
  47915. t['iogonek'] = 278;
  47916. t['Oacute'] = 722;
  47917. t['oacute'] = 500;
  47918. t['amacron'] = 500;
  47919. t['sacute'] = 389;
  47920. t['idieresis'] = 278;
  47921. t['Ocircumflex'] = 722;
  47922. t['Ugrave'] = 722;
  47923. t['Delta'] = 612;
  47924. t['thorn'] = 500;
  47925. t['twosuperior'] = 300;
  47926. t['Odieresis'] = 722;
  47927. t['mu'] = 576;
  47928. t['igrave'] = 278;
  47929. t['ohungarumlaut'] = 500;
  47930. t['Eogonek'] = 667;
  47931. t['dcroat'] = 500;
  47932. t['threequarters'] = 750;
  47933. t['Scedilla'] = 556;
  47934. t['lcaron'] = 382;
  47935. t['Kcommaaccent'] = 667;
  47936. t['Lacute'] = 611;
  47937. t['trademark'] = 1000;
  47938. t['edotaccent'] = 444;
  47939. t['Igrave'] = 389;
  47940. t['Imacron'] = 389;
  47941. t['Lcaron'] = 611;
  47942. t['onehalf'] = 750;
  47943. t['lessequal'] = 549;
  47944. t['ocircumflex'] = 500;
  47945. t['ntilde'] = 556;
  47946. t['Uhungarumlaut'] = 722;
  47947. t['Eacute'] = 667;
  47948. t['emacron'] = 444;
  47949. t['gbreve'] = 500;
  47950. t['onequarter'] = 750;
  47951. t['Scaron'] = 556;
  47952. t['Scommaaccent'] = 556;
  47953. t['Ohungarumlaut'] = 722;
  47954. t['degree'] = 400;
  47955. t['ograve'] = 500;
  47956. t['Ccaron'] = 667;
  47957. t['ugrave'] = 556;
  47958. t['radical'] = 549;
  47959. t['Dcaron'] = 722;
  47960. t['rcommaaccent'] = 389;
  47961. t['Ntilde'] = 722;
  47962. t['otilde'] = 500;
  47963. t['Rcommaaccent'] = 667;
  47964. t['Lcommaaccent'] = 611;
  47965. t['Atilde'] = 667;
  47966. t['Aogonek'] = 667;
  47967. t['Aring'] = 667;
  47968. t['Otilde'] = 722;
  47969. t['zdotaccent'] = 389;
  47970. t['Ecaron'] = 667;
  47971. t['Iogonek'] = 389;
  47972. t['kcommaaccent'] = 500;
  47973. t['minus'] = 606;
  47974. t['Icircumflex'] = 389;
  47975. t['ncaron'] = 556;
  47976. t['tcommaaccent'] = 278;
  47977. t['logicalnot'] = 606;
  47978. t['odieresis'] = 500;
  47979. t['udieresis'] = 556;
  47980. t['notequal'] = 549;
  47981. t['gcommaaccent'] = 500;
  47982. t['eth'] = 500;
  47983. t['zcaron'] = 389;
  47984. t['ncommaaccent'] = 556;
  47985. t['onesuperior'] = 300;
  47986. t['imacron'] = 278;
  47987. t['Euro'] = 500;
  47988. });
  47989. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47990. t['space'] = 250;
  47991. t['exclam'] = 333;
  47992. t['quotedbl'] = 420;
  47993. t['numbersign'] = 500;
  47994. t['dollar'] = 500;
  47995. t['percent'] = 833;
  47996. t['ampersand'] = 778;
  47997. t['quoteright'] = 333;
  47998. t['parenleft'] = 333;
  47999. t['parenright'] = 333;
  48000. t['asterisk'] = 500;
  48001. t['plus'] = 675;
  48002. t['comma'] = 250;
  48003. t['hyphen'] = 333;
  48004. t['period'] = 250;
  48005. t['slash'] = 278;
  48006. t['zero'] = 500;
  48007. t['one'] = 500;
  48008. t['two'] = 500;
  48009. t['three'] = 500;
  48010. t['four'] = 500;
  48011. t['five'] = 500;
  48012. t['six'] = 500;
  48013. t['seven'] = 500;
  48014. t['eight'] = 500;
  48015. t['nine'] = 500;
  48016. t['colon'] = 333;
  48017. t['semicolon'] = 333;
  48018. t['less'] = 675;
  48019. t['equal'] = 675;
  48020. t['greater'] = 675;
  48021. t['question'] = 500;
  48022. t['at'] = 920;
  48023. t['A'] = 611;
  48024. t['B'] = 611;
  48025. t['C'] = 667;
  48026. t['D'] = 722;
  48027. t['E'] = 611;
  48028. t['F'] = 611;
  48029. t['G'] = 722;
  48030. t['H'] = 722;
  48031. t['I'] = 333;
  48032. t['J'] = 444;
  48033. t['K'] = 667;
  48034. t['L'] = 556;
  48035. t['M'] = 833;
  48036. t['N'] = 667;
  48037. t['O'] = 722;
  48038. t['P'] = 611;
  48039. t['Q'] = 722;
  48040. t['R'] = 611;
  48041. t['S'] = 500;
  48042. t['T'] = 556;
  48043. t['U'] = 722;
  48044. t['V'] = 611;
  48045. t['W'] = 833;
  48046. t['X'] = 611;
  48047. t['Y'] = 556;
  48048. t['Z'] = 556;
  48049. t['bracketleft'] = 389;
  48050. t['backslash'] = 278;
  48051. t['bracketright'] = 389;
  48052. t['asciicircum'] = 422;
  48053. t['underscore'] = 500;
  48054. t['quoteleft'] = 333;
  48055. t['a'] = 500;
  48056. t['b'] = 500;
  48057. t['c'] = 444;
  48058. t['d'] = 500;
  48059. t['e'] = 444;
  48060. t['f'] = 278;
  48061. t['g'] = 500;
  48062. t['h'] = 500;
  48063. t['i'] = 278;
  48064. t['j'] = 278;
  48065. t['k'] = 444;
  48066. t['l'] = 278;
  48067. t['m'] = 722;
  48068. t['n'] = 500;
  48069. t['o'] = 500;
  48070. t['p'] = 500;
  48071. t['q'] = 500;
  48072. t['r'] = 389;
  48073. t['s'] = 389;
  48074. t['t'] = 278;
  48075. t['u'] = 500;
  48076. t['v'] = 444;
  48077. t['w'] = 667;
  48078. t['x'] = 444;
  48079. t['y'] = 444;
  48080. t['z'] = 389;
  48081. t['braceleft'] = 400;
  48082. t['bar'] = 275;
  48083. t['braceright'] = 400;
  48084. t['asciitilde'] = 541;
  48085. t['exclamdown'] = 389;
  48086. t['cent'] = 500;
  48087. t['sterling'] = 500;
  48088. t['fraction'] = 167;
  48089. t['yen'] = 500;
  48090. t['florin'] = 500;
  48091. t['section'] = 500;
  48092. t['currency'] = 500;
  48093. t['quotesingle'] = 214;
  48094. t['quotedblleft'] = 556;
  48095. t['guillemotleft'] = 500;
  48096. t['guilsinglleft'] = 333;
  48097. t['guilsinglright'] = 333;
  48098. t['fi'] = 500;
  48099. t['fl'] = 500;
  48100. t['endash'] = 500;
  48101. t['dagger'] = 500;
  48102. t['daggerdbl'] = 500;
  48103. t['periodcentered'] = 250;
  48104. t['paragraph'] = 523;
  48105. t['bullet'] = 350;
  48106. t['quotesinglbase'] = 333;
  48107. t['quotedblbase'] = 556;
  48108. t['quotedblright'] = 556;
  48109. t['guillemotright'] = 500;
  48110. t['ellipsis'] = 889;
  48111. t['perthousand'] = 1000;
  48112. t['questiondown'] = 500;
  48113. t['grave'] = 333;
  48114. t['acute'] = 333;
  48115. t['circumflex'] = 333;
  48116. t['tilde'] = 333;
  48117. t['macron'] = 333;
  48118. t['breve'] = 333;
  48119. t['dotaccent'] = 333;
  48120. t['dieresis'] = 333;
  48121. t['ring'] = 333;
  48122. t['cedilla'] = 333;
  48123. t['hungarumlaut'] = 333;
  48124. t['ogonek'] = 333;
  48125. t['caron'] = 333;
  48126. t['emdash'] = 889;
  48127. t['AE'] = 889;
  48128. t['ordfeminine'] = 276;
  48129. t['Lslash'] = 556;
  48130. t['Oslash'] = 722;
  48131. t['OE'] = 944;
  48132. t['ordmasculine'] = 310;
  48133. t['ae'] = 667;
  48134. t['dotlessi'] = 278;
  48135. t['lslash'] = 278;
  48136. t['oslash'] = 500;
  48137. t['oe'] = 667;
  48138. t['germandbls'] = 500;
  48139. t['Idieresis'] = 333;
  48140. t['eacute'] = 444;
  48141. t['abreve'] = 500;
  48142. t['uhungarumlaut'] = 500;
  48143. t['ecaron'] = 444;
  48144. t['Ydieresis'] = 556;
  48145. t['divide'] = 675;
  48146. t['Yacute'] = 556;
  48147. t['Acircumflex'] = 611;
  48148. t['aacute'] = 500;
  48149. t['Ucircumflex'] = 722;
  48150. t['yacute'] = 444;
  48151. t['scommaaccent'] = 389;
  48152. t['ecircumflex'] = 444;
  48153. t['Uring'] = 722;
  48154. t['Udieresis'] = 722;
  48155. t['aogonek'] = 500;
  48156. t['Uacute'] = 722;
  48157. t['uogonek'] = 500;
  48158. t['Edieresis'] = 611;
  48159. t['Dcroat'] = 722;
  48160. t['commaaccent'] = 250;
  48161. t['copyright'] = 760;
  48162. t['Emacron'] = 611;
  48163. t['ccaron'] = 444;
  48164. t['aring'] = 500;
  48165. t['Ncommaaccent'] = 667;
  48166. t['lacute'] = 278;
  48167. t['agrave'] = 500;
  48168. t['Tcommaaccent'] = 556;
  48169. t['Cacute'] = 667;
  48170. t['atilde'] = 500;
  48171. t['Edotaccent'] = 611;
  48172. t['scaron'] = 389;
  48173. t['scedilla'] = 389;
  48174. t['iacute'] = 278;
  48175. t['lozenge'] = 471;
  48176. t['Rcaron'] = 611;
  48177. t['Gcommaaccent'] = 722;
  48178. t['ucircumflex'] = 500;
  48179. t['acircumflex'] = 500;
  48180. t['Amacron'] = 611;
  48181. t['rcaron'] = 389;
  48182. t['ccedilla'] = 444;
  48183. t['Zdotaccent'] = 556;
  48184. t['Thorn'] = 611;
  48185. t['Omacron'] = 722;
  48186. t['Racute'] = 611;
  48187. t['Sacute'] = 500;
  48188. t['dcaron'] = 544;
  48189. t['Umacron'] = 722;
  48190. t['uring'] = 500;
  48191. t['threesuperior'] = 300;
  48192. t['Ograve'] = 722;
  48193. t['Agrave'] = 611;
  48194. t['Abreve'] = 611;
  48195. t['multiply'] = 675;
  48196. t['uacute'] = 500;
  48197. t['Tcaron'] = 556;
  48198. t['partialdiff'] = 476;
  48199. t['ydieresis'] = 444;
  48200. t['Nacute'] = 667;
  48201. t['icircumflex'] = 278;
  48202. t['Ecircumflex'] = 611;
  48203. t['adieresis'] = 500;
  48204. t['edieresis'] = 444;
  48205. t['cacute'] = 444;
  48206. t['nacute'] = 500;
  48207. t['umacron'] = 500;
  48208. t['Ncaron'] = 667;
  48209. t['Iacute'] = 333;
  48210. t['plusminus'] = 675;
  48211. t['brokenbar'] = 275;
  48212. t['registered'] = 760;
  48213. t['Gbreve'] = 722;
  48214. t['Idotaccent'] = 333;
  48215. t['summation'] = 600;
  48216. t['Egrave'] = 611;
  48217. t['racute'] = 389;
  48218. t['omacron'] = 500;
  48219. t['Zacute'] = 556;
  48220. t['Zcaron'] = 556;
  48221. t['greaterequal'] = 549;
  48222. t['Eth'] = 722;
  48223. t['Ccedilla'] = 667;
  48224. t['lcommaaccent'] = 278;
  48225. t['tcaron'] = 300;
  48226. t['eogonek'] = 444;
  48227. t['Uogonek'] = 722;
  48228. t['Aacute'] = 611;
  48229. t['Adieresis'] = 611;
  48230. t['egrave'] = 444;
  48231. t['zacute'] = 389;
  48232. t['iogonek'] = 278;
  48233. t['Oacute'] = 722;
  48234. t['oacute'] = 500;
  48235. t['amacron'] = 500;
  48236. t['sacute'] = 389;
  48237. t['idieresis'] = 278;
  48238. t['Ocircumflex'] = 722;
  48239. t['Ugrave'] = 722;
  48240. t['Delta'] = 612;
  48241. t['thorn'] = 500;
  48242. t['twosuperior'] = 300;
  48243. t['Odieresis'] = 722;
  48244. t['mu'] = 500;
  48245. t['igrave'] = 278;
  48246. t['ohungarumlaut'] = 500;
  48247. t['Eogonek'] = 611;
  48248. t['dcroat'] = 500;
  48249. t['threequarters'] = 750;
  48250. t['Scedilla'] = 500;
  48251. t['lcaron'] = 300;
  48252. t['Kcommaaccent'] = 667;
  48253. t['Lacute'] = 556;
  48254. t['trademark'] = 980;
  48255. t['edotaccent'] = 444;
  48256. t['Igrave'] = 333;
  48257. t['Imacron'] = 333;
  48258. t['Lcaron'] = 611;
  48259. t['onehalf'] = 750;
  48260. t['lessequal'] = 549;
  48261. t['ocircumflex'] = 500;
  48262. t['ntilde'] = 500;
  48263. t['Uhungarumlaut'] = 722;
  48264. t['Eacute'] = 611;
  48265. t['emacron'] = 444;
  48266. t['gbreve'] = 500;
  48267. t['onequarter'] = 750;
  48268. t['Scaron'] = 500;
  48269. t['Scommaaccent'] = 500;
  48270. t['Ohungarumlaut'] = 722;
  48271. t['degree'] = 400;
  48272. t['ograve'] = 500;
  48273. t['Ccaron'] = 667;
  48274. t['ugrave'] = 500;
  48275. t['radical'] = 453;
  48276. t['Dcaron'] = 722;
  48277. t['rcommaaccent'] = 389;
  48278. t['Ntilde'] = 667;
  48279. t['otilde'] = 500;
  48280. t['Rcommaaccent'] = 611;
  48281. t['Lcommaaccent'] = 556;
  48282. t['Atilde'] = 611;
  48283. t['Aogonek'] = 611;
  48284. t['Aring'] = 611;
  48285. t['Otilde'] = 722;
  48286. t['zdotaccent'] = 389;
  48287. t['Ecaron'] = 611;
  48288. t['Iogonek'] = 333;
  48289. t['kcommaaccent'] = 444;
  48290. t['minus'] = 675;
  48291. t['Icircumflex'] = 333;
  48292. t['ncaron'] = 500;
  48293. t['tcommaaccent'] = 278;
  48294. t['logicalnot'] = 675;
  48295. t['odieresis'] = 500;
  48296. t['udieresis'] = 500;
  48297. t['notequal'] = 549;
  48298. t['gcommaaccent'] = 500;
  48299. t['eth'] = 500;
  48300. t['zcaron'] = 389;
  48301. t['ncommaaccent'] = 500;
  48302. t['onesuperior'] = 300;
  48303. t['imacron'] = 278;
  48304. t['Euro'] = 500;
  48305. });
  48306. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  48307. t['space'] = 278;
  48308. t['a1'] = 974;
  48309. t['a2'] = 961;
  48310. t['a202'] = 974;
  48311. t['a3'] = 980;
  48312. t['a4'] = 719;
  48313. t['a5'] = 789;
  48314. t['a119'] = 790;
  48315. t['a118'] = 791;
  48316. t['a117'] = 690;
  48317. t['a11'] = 960;
  48318. t['a12'] = 939;
  48319. t['a13'] = 549;
  48320. t['a14'] = 855;
  48321. t['a15'] = 911;
  48322. t['a16'] = 933;
  48323. t['a105'] = 911;
  48324. t['a17'] = 945;
  48325. t['a18'] = 974;
  48326. t['a19'] = 755;
  48327. t['a20'] = 846;
  48328. t['a21'] = 762;
  48329. t['a22'] = 761;
  48330. t['a23'] = 571;
  48331. t['a24'] = 677;
  48332. t['a25'] = 763;
  48333. t['a26'] = 760;
  48334. t['a27'] = 759;
  48335. t['a28'] = 754;
  48336. t['a6'] = 494;
  48337. t['a7'] = 552;
  48338. t['a8'] = 537;
  48339. t['a9'] = 577;
  48340. t['a10'] = 692;
  48341. t['a29'] = 786;
  48342. t['a30'] = 788;
  48343. t['a31'] = 788;
  48344. t['a32'] = 790;
  48345. t['a33'] = 793;
  48346. t['a34'] = 794;
  48347. t['a35'] = 816;
  48348. t['a36'] = 823;
  48349. t['a37'] = 789;
  48350. t['a38'] = 841;
  48351. t['a39'] = 823;
  48352. t['a40'] = 833;
  48353. t['a41'] = 816;
  48354. t['a42'] = 831;
  48355. t['a43'] = 923;
  48356. t['a44'] = 744;
  48357. t['a45'] = 723;
  48358. t['a46'] = 749;
  48359. t['a47'] = 790;
  48360. t['a48'] = 792;
  48361. t['a49'] = 695;
  48362. t['a50'] = 776;
  48363. t['a51'] = 768;
  48364. t['a52'] = 792;
  48365. t['a53'] = 759;
  48366. t['a54'] = 707;
  48367. t['a55'] = 708;
  48368. t['a56'] = 682;
  48369. t['a57'] = 701;
  48370. t['a58'] = 826;
  48371. t['a59'] = 815;
  48372. t['a60'] = 789;
  48373. t['a61'] = 789;
  48374. t['a62'] = 707;
  48375. t['a63'] = 687;
  48376. t['a64'] = 696;
  48377. t['a65'] = 689;
  48378. t['a66'] = 786;
  48379. t['a67'] = 787;
  48380. t['a68'] = 713;
  48381. t['a69'] = 791;
  48382. t['a70'] = 785;
  48383. t['a71'] = 791;
  48384. t['a72'] = 873;
  48385. t['a73'] = 761;
  48386. t['a74'] = 762;
  48387. t['a203'] = 762;
  48388. t['a75'] = 759;
  48389. t['a204'] = 759;
  48390. t['a76'] = 892;
  48391. t['a77'] = 892;
  48392. t['a78'] = 788;
  48393. t['a79'] = 784;
  48394. t['a81'] = 438;
  48395. t['a82'] = 138;
  48396. t['a83'] = 277;
  48397. t['a84'] = 415;
  48398. t['a97'] = 392;
  48399. t['a98'] = 392;
  48400. t['a99'] = 668;
  48401. t['a100'] = 668;
  48402. t['a89'] = 390;
  48403. t['a90'] = 390;
  48404. t['a93'] = 317;
  48405. t['a94'] = 317;
  48406. t['a91'] = 276;
  48407. t['a92'] = 276;
  48408. t['a205'] = 509;
  48409. t['a85'] = 509;
  48410. t['a206'] = 410;
  48411. t['a86'] = 410;
  48412. t['a87'] = 234;
  48413. t['a88'] = 234;
  48414. t['a95'] = 334;
  48415. t['a96'] = 334;
  48416. t['a101'] = 732;
  48417. t['a102'] = 544;
  48418. t['a103'] = 544;
  48419. t['a104'] = 910;
  48420. t['a106'] = 667;
  48421. t['a107'] = 760;
  48422. t['a108'] = 760;
  48423. t['a112'] = 776;
  48424. t['a111'] = 595;
  48425. t['a110'] = 694;
  48426. t['a109'] = 626;
  48427. t['a120'] = 788;
  48428. t['a121'] = 788;
  48429. t['a122'] = 788;
  48430. t['a123'] = 788;
  48431. t['a124'] = 788;
  48432. t['a125'] = 788;
  48433. t['a126'] = 788;
  48434. t['a127'] = 788;
  48435. t['a128'] = 788;
  48436. t['a129'] = 788;
  48437. t['a130'] = 788;
  48438. t['a131'] = 788;
  48439. t['a132'] = 788;
  48440. t['a133'] = 788;
  48441. t['a134'] = 788;
  48442. t['a135'] = 788;
  48443. t['a136'] = 788;
  48444. t['a137'] = 788;
  48445. t['a138'] = 788;
  48446. t['a139'] = 788;
  48447. t['a140'] = 788;
  48448. t['a141'] = 788;
  48449. t['a142'] = 788;
  48450. t['a143'] = 788;
  48451. t['a144'] = 788;
  48452. t['a145'] = 788;
  48453. t['a146'] = 788;
  48454. t['a147'] = 788;
  48455. t['a148'] = 788;
  48456. t['a149'] = 788;
  48457. t['a150'] = 788;
  48458. t['a151'] = 788;
  48459. t['a152'] = 788;
  48460. t['a153'] = 788;
  48461. t['a154'] = 788;
  48462. t['a155'] = 788;
  48463. t['a156'] = 788;
  48464. t['a157'] = 788;
  48465. t['a158'] = 788;
  48466. t['a159'] = 788;
  48467. t['a160'] = 894;
  48468. t['a161'] = 838;
  48469. t['a163'] = 1016;
  48470. t['a164'] = 458;
  48471. t['a196'] = 748;
  48472. t['a165'] = 924;
  48473. t['a192'] = 748;
  48474. t['a166'] = 918;
  48475. t['a167'] = 927;
  48476. t['a168'] = 928;
  48477. t['a169'] = 928;
  48478. t['a170'] = 834;
  48479. t['a171'] = 873;
  48480. t['a172'] = 828;
  48481. t['a173'] = 924;
  48482. t['a162'] = 924;
  48483. t['a174'] = 917;
  48484. t['a175'] = 930;
  48485. t['a176'] = 931;
  48486. t['a177'] = 463;
  48487. t['a178'] = 883;
  48488. t['a179'] = 836;
  48489. t['a193'] = 836;
  48490. t['a180'] = 867;
  48491. t['a199'] = 867;
  48492. t['a181'] = 696;
  48493. t['a200'] = 696;
  48494. t['a182'] = 874;
  48495. t['a201'] = 874;
  48496. t['a183'] = 760;
  48497. t['a184'] = 946;
  48498. t['a197'] = 771;
  48499. t['a185'] = 865;
  48500. t['a194'] = 771;
  48501. t['a198'] = 888;
  48502. t['a186'] = 967;
  48503. t['a195'] = 888;
  48504. t['a187'] = 831;
  48505. t['a188'] = 873;
  48506. t['a189'] = 927;
  48507. t['a190'] = 970;
  48508. t['a191'] = 918;
  48509. });
  48510. });
  48511. exports.getMetrics = getMetrics;
  48512. /***/ }),
  48513. /* 31 */
  48514. /***/ (function(module, exports, __w_pdfjs_require__) {
  48515. "use strict";
  48516. var sharedUtil = __w_pdfjs_require__(0);
  48517. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  48518. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  48519. var MASK_HIGH = 0xffff0000;
  48520. var MASK_LOW = 0xffff;
  48521. function MurmurHash3_64(seed) {
  48522. var SEED = 0xc3d2e1f0;
  48523. this.h1 = seed ? seed & 0xffffffff : SEED;
  48524. this.h2 = seed ? seed & 0xffffffff : SEED;
  48525. }
  48526. var alwaysUseUint32ArrayView = false;
  48527. try {
  48528. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  48529. } catch (e) {
  48530. alwaysUseUint32ArrayView = true;
  48531. }
  48532. MurmurHash3_64.prototype = {
  48533. update: function MurmurHash3_64_update(input) {
  48534. var useUint32ArrayView = alwaysUseUint32ArrayView;
  48535. var i;
  48536. if (typeof input === 'string') {
  48537. var data = new Uint8Array(input.length * 2);
  48538. var length = 0;
  48539. for (i = 0; i < input.length; i++) {
  48540. var code = input.charCodeAt(i);
  48541. if (code <= 0xff) {
  48542. data[length++] = code;
  48543. } else {
  48544. data[length++] = code >>> 8;
  48545. data[length++] = code & 0xff;
  48546. }
  48547. }
  48548. } else if (input instanceof Uint8Array) {
  48549. data = input;
  48550. length = data.length;
  48551. } else if (typeof input === 'object' && 'length' in input) {
  48552. data = input;
  48553. length = data.length;
  48554. useUint32ArrayView = true;
  48555. } else {
  48556. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  48557. }
  48558. var blockCounts = length >> 2;
  48559. var tailLength = length - blockCounts * 4;
  48560. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  48561. var k1 = 0;
  48562. var k2 = 0;
  48563. var h1 = this.h1;
  48564. var h2 = this.h2;
  48565. var C1 = 0xcc9e2d51;
  48566. var C2 = 0x1b873593;
  48567. var C1_LOW = C1 & MASK_LOW;
  48568. var C2_LOW = C2 & MASK_LOW;
  48569. for (i = 0; i < blockCounts; i++) {
  48570. if (i & 1) {
  48571. k1 = dataUint32[i];
  48572. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48573. k1 = k1 << 15 | k1 >>> 17;
  48574. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48575. h1 ^= k1;
  48576. h1 = h1 << 13 | h1 >>> 19;
  48577. h1 = h1 * 5 + 0xe6546b64;
  48578. } else {
  48579. k2 = dataUint32[i];
  48580. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  48581. k2 = k2 << 15 | k2 >>> 17;
  48582. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  48583. h2 ^= k2;
  48584. h2 = h2 << 13 | h2 >>> 19;
  48585. h2 = h2 * 5 + 0xe6546b64;
  48586. }
  48587. }
  48588. k1 = 0;
  48589. switch (tailLength) {
  48590. case 3:
  48591. k1 ^= data[blockCounts * 4 + 2] << 16;
  48592. case 2:
  48593. k1 ^= data[blockCounts * 4 + 1] << 8;
  48594. case 1:
  48595. k1 ^= data[blockCounts * 4];
  48596. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48597. k1 = k1 << 15 | k1 >>> 17;
  48598. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48599. if (blockCounts & 1) {
  48600. h1 ^= k1;
  48601. } else {
  48602. h2 ^= k1;
  48603. }
  48604. }
  48605. this.h1 = h1;
  48606. this.h2 = h2;
  48607. return this;
  48608. },
  48609. hexdigest: function MurmurHash3_64_hexdigest() {
  48610. var h1 = this.h1;
  48611. var h2 = this.h2;
  48612. h1 ^= h2 >>> 1;
  48613. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  48614. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  48615. h1 ^= h2 >>> 1;
  48616. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  48617. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  48618. h1 ^= h2 >>> 1;
  48619. for (var i = 0, arr = [
  48620. h1,
  48621. h2
  48622. ], str = ''; i < arr.length; i++) {
  48623. var hex = (arr[i] >>> 0).toString(16);
  48624. while (hex.length < 8) {
  48625. hex = '0' + hex;
  48626. }
  48627. str += hex;
  48628. }
  48629. return str;
  48630. }
  48631. };
  48632. return MurmurHash3_64;
  48633. }();
  48634. exports.MurmurHash3_64 = MurmurHash3_64;
  48635. /***/ }),
  48636. /* 32 */
  48637. /***/ (function(module, exports, __w_pdfjs_require__) {
  48638. "use strict";
  48639. var sharedUtil = __w_pdfjs_require__(0);
  48640. var corePrimitives = __w_pdfjs_require__(1);
  48641. var coreFunction = __w_pdfjs_require__(6);
  48642. var coreColorSpace = __w_pdfjs_require__(3);
  48643. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  48644. var MissingDataException = sharedUtil.MissingDataException;
  48645. var Util = sharedUtil.Util;
  48646. var assert = sharedUtil.assert;
  48647. var error = sharedUtil.error;
  48648. var info = sharedUtil.info;
  48649. var warn = sharedUtil.warn;
  48650. var isStream = corePrimitives.isStream;
  48651. var PDFFunction = coreFunction.PDFFunction;
  48652. var ColorSpace = coreColorSpace.ColorSpace;
  48653. var ShadingType = {
  48654. FUNCTION_BASED: 1,
  48655. AXIAL: 2,
  48656. RADIAL: 3,
  48657. FREE_FORM_MESH: 4,
  48658. LATTICE_FORM_MESH: 5,
  48659. COONS_PATCH_MESH: 6,
  48660. TENSOR_PATCH_MESH: 7
  48661. };
  48662. var Pattern = function PatternClosure() {
  48663. function Pattern() {
  48664. error('should not call Pattern constructor');
  48665. }
  48666. Pattern.prototype = {
  48667. getPattern: function Pattern_getPattern(ctx) {
  48668. error('Should not call Pattern.getStyle: ' + ctx);
  48669. }
  48670. };
  48671. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  48672. var dict = isStream(shading) ? shading.dict : shading;
  48673. var type = dict.get('ShadingType');
  48674. try {
  48675. switch (type) {
  48676. case ShadingType.AXIAL:
  48677. case ShadingType.RADIAL:
  48678. return new Shadings.RadialAxial(dict, matrix, xref, res);
  48679. case ShadingType.FREE_FORM_MESH:
  48680. case ShadingType.LATTICE_FORM_MESH:
  48681. case ShadingType.COONS_PATCH_MESH:
  48682. case ShadingType.TENSOR_PATCH_MESH:
  48683. return new Shadings.Mesh(shading, matrix, xref, res);
  48684. default:
  48685. throw new Error('Unsupported ShadingType: ' + type);
  48686. }
  48687. } catch (ex) {
  48688. if (ex instanceof MissingDataException) {
  48689. throw ex;
  48690. }
  48691. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  48692. warn(ex);
  48693. return new Shadings.Dummy();
  48694. }
  48695. };
  48696. return Pattern;
  48697. }();
  48698. var Shadings = {};
  48699. Shadings.SMALL_NUMBER = 1e-6;
  48700. Shadings.RadialAxial = function RadialAxialClosure() {
  48701. function RadialAxial(dict, matrix, xref, res) {
  48702. this.matrix = matrix;
  48703. this.coordsArr = dict.getArray('Coords');
  48704. this.shadingType = dict.get('ShadingType');
  48705. this.type = 'Pattern';
  48706. var cs = dict.get('ColorSpace', 'CS');
  48707. cs = ColorSpace.parse(cs, xref, res);
  48708. this.cs = cs;
  48709. var t0 = 0.0, t1 = 1.0;
  48710. if (dict.has('Domain')) {
  48711. var domainArr = dict.getArray('Domain');
  48712. t0 = domainArr[0];
  48713. t1 = domainArr[1];
  48714. }
  48715. var extendStart = false, extendEnd = false;
  48716. if (dict.has('Extend')) {
  48717. var extendArr = dict.getArray('Extend');
  48718. extendStart = extendArr[0];
  48719. extendEnd = extendArr[1];
  48720. }
  48721. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  48722. var x1 = this.coordsArr[0];
  48723. var y1 = this.coordsArr[1];
  48724. var r1 = this.coordsArr[2];
  48725. var x2 = this.coordsArr[3];
  48726. var y2 = this.coordsArr[4];
  48727. var r2 = this.coordsArr[5];
  48728. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  48729. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  48730. warn('Unsupported radial gradient.');
  48731. }
  48732. }
  48733. this.extendStart = extendStart;
  48734. this.extendEnd = extendEnd;
  48735. var fnObj = dict.get('Function');
  48736. var fn = PDFFunction.parseArray(xref, fnObj);
  48737. var diff = t1 - t0;
  48738. var step = diff / 10;
  48739. var colorStops = this.colorStops = [];
  48740. if (t0 >= t1 || step <= 0) {
  48741. info('Bad shading domain.');
  48742. return;
  48743. }
  48744. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  48745. var rgbColor;
  48746. for (var i = t0; i <= t1; i += step) {
  48747. ratio[0] = i;
  48748. fn(ratio, 0, color, 0);
  48749. rgbColor = cs.getRgb(color, 0);
  48750. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48751. colorStops.push([
  48752. (i - t0) / diff,
  48753. cssColor
  48754. ]);
  48755. }
  48756. var background = 'transparent';
  48757. if (dict.has('Background')) {
  48758. rgbColor = cs.getRgb(dict.get('Background'), 0);
  48759. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48760. }
  48761. if (!extendStart) {
  48762. colorStops.unshift([
  48763. 0,
  48764. background
  48765. ]);
  48766. colorStops[1][0] += Shadings.SMALL_NUMBER;
  48767. }
  48768. if (!extendEnd) {
  48769. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  48770. colorStops.push([
  48771. 1,
  48772. background
  48773. ]);
  48774. }
  48775. this.colorStops = colorStops;
  48776. }
  48777. RadialAxial.prototype = {
  48778. getIR: function RadialAxial_getIR() {
  48779. var coordsArr = this.coordsArr;
  48780. var shadingType = this.shadingType;
  48781. var type, p0, p1, r0, r1;
  48782. if (shadingType === ShadingType.AXIAL) {
  48783. p0 = [
  48784. coordsArr[0],
  48785. coordsArr[1]
  48786. ];
  48787. p1 = [
  48788. coordsArr[2],
  48789. coordsArr[3]
  48790. ];
  48791. r0 = null;
  48792. r1 = null;
  48793. type = 'axial';
  48794. } else if (shadingType === ShadingType.RADIAL) {
  48795. p0 = [
  48796. coordsArr[0],
  48797. coordsArr[1]
  48798. ];
  48799. p1 = [
  48800. coordsArr[3],
  48801. coordsArr[4]
  48802. ];
  48803. r0 = coordsArr[2];
  48804. r1 = coordsArr[5];
  48805. type = 'radial';
  48806. } else {
  48807. error('getPattern type unknown: ' + shadingType);
  48808. }
  48809. var matrix = this.matrix;
  48810. if (matrix) {
  48811. p0 = Util.applyTransform(p0, matrix);
  48812. p1 = Util.applyTransform(p1, matrix);
  48813. if (shadingType === ShadingType.RADIAL) {
  48814. var scale = Util.singularValueDecompose2dScale(matrix);
  48815. r0 *= scale[0];
  48816. r1 *= scale[1];
  48817. }
  48818. }
  48819. return [
  48820. 'RadialAxial',
  48821. type,
  48822. this.colorStops,
  48823. p0,
  48824. p1,
  48825. r0,
  48826. r1
  48827. ];
  48828. }
  48829. };
  48830. return RadialAxial;
  48831. }();
  48832. Shadings.Mesh = function MeshClosure() {
  48833. function MeshStreamReader(stream, context) {
  48834. this.stream = stream;
  48835. this.context = context;
  48836. this.buffer = 0;
  48837. this.bufferLength = 0;
  48838. var numComps = context.numComps;
  48839. this.tmpCompsBuf = new Float32Array(numComps);
  48840. var csNumComps = context.colorSpace.numComps;
  48841. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48842. }
  48843. MeshStreamReader.prototype = {
  48844. get hasData() {
  48845. if (this.stream.end) {
  48846. return this.stream.pos < this.stream.end;
  48847. }
  48848. if (this.bufferLength > 0) {
  48849. return true;
  48850. }
  48851. var nextByte = this.stream.getByte();
  48852. if (nextByte < 0) {
  48853. return false;
  48854. }
  48855. this.buffer = nextByte;
  48856. this.bufferLength = 8;
  48857. return true;
  48858. },
  48859. readBits: function MeshStreamReader_readBits(n) {
  48860. var buffer = this.buffer;
  48861. var bufferLength = this.bufferLength;
  48862. if (n === 32) {
  48863. if (bufferLength === 0) {
  48864. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48865. }
  48866. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48867. var nextByte = this.stream.getByte();
  48868. this.buffer = nextByte & (1 << bufferLength) - 1;
  48869. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48870. }
  48871. if (n === 8 && bufferLength === 0) {
  48872. return this.stream.getByte();
  48873. }
  48874. while (bufferLength < n) {
  48875. buffer = buffer << 8 | this.stream.getByte();
  48876. bufferLength += 8;
  48877. }
  48878. bufferLength -= n;
  48879. this.bufferLength = bufferLength;
  48880. this.buffer = buffer & (1 << bufferLength) - 1;
  48881. return buffer >> bufferLength;
  48882. },
  48883. align: function MeshStreamReader_align() {
  48884. this.buffer = 0;
  48885. this.bufferLength = 0;
  48886. },
  48887. readFlag: function MeshStreamReader_readFlag() {
  48888. return this.readBits(this.context.bitsPerFlag);
  48889. },
  48890. readCoordinate: function MeshStreamReader_readCoordinate() {
  48891. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48892. var xi = this.readBits(bitsPerCoordinate);
  48893. var yi = this.readBits(bitsPerCoordinate);
  48894. var decode = this.context.decode;
  48895. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48896. return [
  48897. xi * scale * (decode[1] - decode[0]) + decode[0],
  48898. yi * scale * (decode[3] - decode[2]) + decode[2]
  48899. ];
  48900. },
  48901. readComponents: function MeshStreamReader_readComponents() {
  48902. var numComps = this.context.numComps;
  48903. var bitsPerComponent = this.context.bitsPerComponent;
  48904. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48905. var decode = this.context.decode;
  48906. var components = this.tmpCompsBuf;
  48907. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48908. var ci = this.readBits(bitsPerComponent);
  48909. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48910. }
  48911. var color = this.tmpCsCompsBuf;
  48912. if (this.context.colorFn) {
  48913. this.context.colorFn(components, 0, color, 0);
  48914. }
  48915. return this.context.colorSpace.getRgb(color, 0);
  48916. }
  48917. };
  48918. function decodeType4Shading(mesh, reader) {
  48919. var coords = mesh.coords;
  48920. var colors = mesh.colors;
  48921. var operators = [];
  48922. var ps = [];
  48923. var verticesLeft = 0;
  48924. while (reader.hasData) {
  48925. var f = reader.readFlag();
  48926. var coord = reader.readCoordinate();
  48927. var color = reader.readComponents();
  48928. if (verticesLeft === 0) {
  48929. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48930. switch (f) {
  48931. case 0:
  48932. verticesLeft = 3;
  48933. break;
  48934. case 1:
  48935. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48936. verticesLeft = 1;
  48937. break;
  48938. case 2:
  48939. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48940. verticesLeft = 1;
  48941. break;
  48942. }
  48943. operators.push(f);
  48944. }
  48945. ps.push(coords.length);
  48946. coords.push(coord);
  48947. colors.push(color);
  48948. verticesLeft--;
  48949. reader.align();
  48950. }
  48951. mesh.figures.push({
  48952. type: 'triangles',
  48953. coords: new Int32Array(ps),
  48954. colors: new Int32Array(ps)
  48955. });
  48956. }
  48957. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48958. var coords = mesh.coords;
  48959. var colors = mesh.colors;
  48960. var ps = [];
  48961. while (reader.hasData) {
  48962. var coord = reader.readCoordinate();
  48963. var color = reader.readComponents();
  48964. ps.push(coords.length);
  48965. coords.push(coord);
  48966. colors.push(color);
  48967. }
  48968. mesh.figures.push({
  48969. type: 'lattice',
  48970. coords: new Int32Array(ps),
  48971. colors: new Int32Array(ps),
  48972. verticesPerRow: verticesPerRow
  48973. });
  48974. }
  48975. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48976. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48977. var TRIANGLE_DENSITY = 20;
  48978. var getB = function getBClosure() {
  48979. function buildB(count) {
  48980. var lut = [];
  48981. for (var i = 0; i <= count; i++) {
  48982. var t = i / count, t_ = 1 - t;
  48983. lut.push(new Float32Array([
  48984. t_ * t_ * t_,
  48985. 3 * t * t_ * t_,
  48986. 3 * t * t * t_,
  48987. t * t * t
  48988. ]));
  48989. }
  48990. return lut;
  48991. }
  48992. var cache = [];
  48993. return function getB(count) {
  48994. if (!cache[count]) {
  48995. cache[count] = buildB(count);
  48996. }
  48997. return cache[count];
  48998. };
  48999. }();
  49000. function buildFigureFromPatch(mesh, index) {
  49001. var figure = mesh.figures[index];
  49002. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  49003. var coords = mesh.coords, colors = mesh.colors;
  49004. var pi = figure.coords;
  49005. var ci = figure.colors;
  49006. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49007. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49008. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49009. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49010. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  49011. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  49012. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  49013. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  49014. var verticesPerRow = splitXBy + 1;
  49015. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  49016. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  49017. var k = 0;
  49018. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  49019. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  49020. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  49021. for (var row = 0; row <= splitYBy; row++) {
  49022. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  49023. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  49024. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  49025. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  49026. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  49027. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  49028. for (var col = 0; col <= splitXBy; col++, k++) {
  49029. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  49030. continue;
  49031. }
  49032. var x = 0, y = 0;
  49033. var q = 0;
  49034. for (var i = 0; i <= 3; i++) {
  49035. for (var j = 0; j <= 3; j++, q++) {
  49036. var m = bRow[row][i] * bCol[col][j];
  49037. x += coords[pi[q]][0] * m;
  49038. y += coords[pi[q]][1] * m;
  49039. }
  49040. }
  49041. figureCoords[k] = coords.length;
  49042. coords.push([
  49043. x,
  49044. y
  49045. ]);
  49046. figureColors[k] = colors.length;
  49047. var newColor = new Uint8Array(3);
  49048. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  49049. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  49050. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  49051. colors.push(newColor);
  49052. }
  49053. }
  49054. figureCoords[0] = pi[0];
  49055. figureColors[0] = ci[0];
  49056. figureCoords[splitXBy] = pi[3];
  49057. figureColors[splitXBy] = ci[1];
  49058. figureCoords[verticesPerRow * splitYBy] = pi[12];
  49059. figureColors[verticesPerRow * splitYBy] = ci[2];
  49060. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  49061. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  49062. mesh.figures[index] = {
  49063. type: 'lattice',
  49064. coords: figureCoords,
  49065. colors: figureColors,
  49066. verticesPerRow: verticesPerRow
  49067. };
  49068. }
  49069. function decodeType6Shading(mesh, reader) {
  49070. var coords = mesh.coords;
  49071. var colors = mesh.colors;
  49072. var ps = new Int32Array(16);
  49073. var cs = new Int32Array(4);
  49074. while (reader.hasData) {
  49075. var f = reader.readFlag();
  49076. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  49077. var i, ii;
  49078. var pi = coords.length;
  49079. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  49080. coords.push(reader.readCoordinate());
  49081. }
  49082. var ci = colors.length;
  49083. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49084. colors.push(reader.readComponents());
  49085. }
  49086. var tmp1, tmp2, tmp3, tmp4;
  49087. switch (f) {
  49088. case 0:
  49089. ps[12] = pi + 3;
  49090. ps[13] = pi + 4;
  49091. ps[14] = pi + 5;
  49092. ps[15] = pi + 6;
  49093. ps[8] = pi + 2;
  49094. ps[11] = pi + 7;
  49095. ps[4] = pi + 1;
  49096. ps[7] = pi + 8;
  49097. ps[0] = pi;
  49098. ps[1] = pi + 11;
  49099. ps[2] = pi + 10;
  49100. ps[3] = pi + 9;
  49101. cs[2] = ci + 1;
  49102. cs[3] = ci + 2;
  49103. cs[0] = ci;
  49104. cs[1] = ci + 3;
  49105. break;
  49106. case 1:
  49107. tmp1 = ps[12];
  49108. tmp2 = ps[13];
  49109. tmp3 = ps[14];
  49110. tmp4 = ps[15];
  49111. ps[12] = tmp4;
  49112. ps[13] = pi + 0;
  49113. ps[14] = pi + 1;
  49114. ps[15] = pi + 2;
  49115. ps[8] = tmp3;
  49116. ps[11] = pi + 3;
  49117. ps[4] = tmp2;
  49118. ps[7] = pi + 4;
  49119. ps[0] = tmp1;
  49120. ps[1] = pi + 7;
  49121. ps[2] = pi + 6;
  49122. ps[3] = pi + 5;
  49123. tmp1 = cs[2];
  49124. tmp2 = cs[3];
  49125. cs[2] = tmp2;
  49126. cs[3] = ci;
  49127. cs[0] = tmp1;
  49128. cs[1] = ci + 1;
  49129. break;
  49130. case 2:
  49131. tmp1 = ps[15];
  49132. tmp2 = ps[11];
  49133. ps[12] = ps[3];
  49134. ps[13] = pi + 0;
  49135. ps[14] = pi + 1;
  49136. ps[15] = pi + 2;
  49137. ps[8] = ps[7];
  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[3];
  49146. cs[2] = cs[1];
  49147. cs[3] = ci;
  49148. cs[0] = tmp1;
  49149. cs[1] = ci + 1;
  49150. break;
  49151. case 3:
  49152. ps[12] = ps[0];
  49153. ps[13] = pi + 0;
  49154. ps[14] = pi + 1;
  49155. ps[15] = pi + 2;
  49156. ps[8] = ps[1];
  49157. ps[11] = pi + 3;
  49158. ps[4] = ps[2];
  49159. ps[7] = pi + 4;
  49160. ps[0] = ps[3];
  49161. ps[1] = pi + 7;
  49162. ps[2] = pi + 6;
  49163. ps[3] = pi + 5;
  49164. cs[2] = cs[0];
  49165. cs[3] = ci;
  49166. cs[0] = cs[1];
  49167. cs[1] = ci + 1;
  49168. break;
  49169. }
  49170. ps[5] = coords.length;
  49171. coords.push([
  49172. (-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,
  49173. (-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
  49174. ]);
  49175. ps[6] = coords.length;
  49176. coords.push([
  49177. (-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,
  49178. (-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
  49179. ]);
  49180. ps[9] = coords.length;
  49181. coords.push([
  49182. (-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,
  49183. (-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
  49184. ]);
  49185. ps[10] = coords.length;
  49186. coords.push([
  49187. (-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,
  49188. (-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
  49189. ]);
  49190. mesh.figures.push({
  49191. type: 'patch',
  49192. coords: new Int32Array(ps),
  49193. colors: new Int32Array(cs)
  49194. });
  49195. }
  49196. }
  49197. function decodeType7Shading(mesh, reader) {
  49198. var coords = mesh.coords;
  49199. var colors = mesh.colors;
  49200. var ps = new Int32Array(16);
  49201. var cs = new Int32Array(4);
  49202. while (reader.hasData) {
  49203. var f = reader.readFlag();
  49204. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  49205. var i, ii;
  49206. var pi = coords.length;
  49207. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  49208. coords.push(reader.readCoordinate());
  49209. }
  49210. var ci = colors.length;
  49211. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49212. colors.push(reader.readComponents());
  49213. }
  49214. var tmp1, tmp2, tmp3, tmp4;
  49215. switch (f) {
  49216. case 0:
  49217. ps[12] = pi + 3;
  49218. ps[13] = pi + 4;
  49219. ps[14] = pi + 5;
  49220. ps[15] = pi + 6;
  49221. ps[8] = pi + 2;
  49222. ps[9] = pi + 13;
  49223. ps[10] = pi + 14;
  49224. ps[11] = pi + 7;
  49225. ps[4] = pi + 1;
  49226. ps[5] = pi + 12;
  49227. ps[6] = pi + 15;
  49228. ps[7] = pi + 8;
  49229. ps[0] = pi;
  49230. ps[1] = pi + 11;
  49231. ps[2] = pi + 10;
  49232. ps[3] = pi + 9;
  49233. cs[2] = ci + 1;
  49234. cs[3] = ci + 2;
  49235. cs[0] = ci;
  49236. cs[1] = ci + 3;
  49237. break;
  49238. case 1:
  49239. tmp1 = ps[12];
  49240. tmp2 = ps[13];
  49241. tmp3 = ps[14];
  49242. tmp4 = ps[15];
  49243. ps[12] = tmp4;
  49244. ps[13] = pi + 0;
  49245. ps[14] = pi + 1;
  49246. ps[15] = pi + 2;
  49247. ps[8] = tmp3;
  49248. ps[9] = pi + 9;
  49249. ps[10] = pi + 10;
  49250. ps[11] = pi + 3;
  49251. ps[4] = tmp2;
  49252. ps[5] = pi + 8;
  49253. ps[6] = pi + 11;
  49254. ps[7] = pi + 4;
  49255. ps[0] = tmp1;
  49256. ps[1] = pi + 7;
  49257. ps[2] = pi + 6;
  49258. ps[3] = pi + 5;
  49259. tmp1 = cs[2];
  49260. tmp2 = cs[3];
  49261. cs[2] = tmp2;
  49262. cs[3] = ci;
  49263. cs[0] = tmp1;
  49264. cs[1] = ci + 1;
  49265. break;
  49266. case 2:
  49267. tmp1 = ps[15];
  49268. tmp2 = ps[11];
  49269. ps[12] = ps[3];
  49270. ps[13] = pi + 0;
  49271. ps[14] = pi + 1;
  49272. ps[15] = pi + 2;
  49273. ps[8] = ps[7];
  49274. ps[9] = pi + 9;
  49275. ps[10] = pi + 10;
  49276. ps[11] = pi + 3;
  49277. ps[4] = tmp2;
  49278. ps[5] = pi + 8;
  49279. ps[6] = pi + 11;
  49280. ps[7] = pi + 4;
  49281. ps[0] = tmp1;
  49282. ps[1] = pi + 7;
  49283. ps[2] = pi + 6;
  49284. ps[3] = pi + 5;
  49285. tmp1 = cs[3];
  49286. cs[2] = cs[1];
  49287. cs[3] = ci;
  49288. cs[0] = tmp1;
  49289. cs[1] = ci + 1;
  49290. break;
  49291. case 3:
  49292. ps[12] = ps[0];
  49293. ps[13] = pi + 0;
  49294. ps[14] = pi + 1;
  49295. ps[15] = pi + 2;
  49296. ps[8] = ps[1];
  49297. ps[9] = pi + 9;
  49298. ps[10] = pi + 10;
  49299. ps[11] = pi + 3;
  49300. ps[4] = ps[2];
  49301. ps[5] = pi + 8;
  49302. ps[6] = pi + 11;
  49303. ps[7] = pi + 4;
  49304. ps[0] = ps[3];
  49305. ps[1] = pi + 7;
  49306. ps[2] = pi + 6;
  49307. ps[3] = pi + 5;
  49308. cs[2] = cs[0];
  49309. cs[3] = ci;
  49310. cs[0] = cs[1];
  49311. cs[1] = ci + 1;
  49312. break;
  49313. }
  49314. mesh.figures.push({
  49315. type: 'patch',
  49316. coords: new Int32Array(ps),
  49317. colors: new Int32Array(cs)
  49318. });
  49319. }
  49320. }
  49321. function updateBounds(mesh) {
  49322. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  49323. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  49324. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  49325. minX = minX > x ? x : minX;
  49326. minY = minY > y ? y : minY;
  49327. maxX = maxX < x ? x : maxX;
  49328. maxY = maxY < y ? y : maxY;
  49329. }
  49330. mesh.bounds = [
  49331. minX,
  49332. minY,
  49333. maxX,
  49334. maxY
  49335. ];
  49336. }
  49337. function packData(mesh) {
  49338. var i, ii, j, jj;
  49339. var coords = mesh.coords;
  49340. var coordsPacked = new Float32Array(coords.length * 2);
  49341. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  49342. var xy = coords[i];
  49343. coordsPacked[j++] = xy[0];
  49344. coordsPacked[j++] = xy[1];
  49345. }
  49346. mesh.coords = coordsPacked;
  49347. var colors = mesh.colors;
  49348. var colorsPacked = new Uint8Array(colors.length * 3);
  49349. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  49350. var c = colors[i];
  49351. colorsPacked[j++] = c[0];
  49352. colorsPacked[j++] = c[1];
  49353. colorsPacked[j++] = c[2];
  49354. }
  49355. mesh.colors = colorsPacked;
  49356. var figures = mesh.figures;
  49357. for (i = 0, ii = figures.length; i < ii; i++) {
  49358. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  49359. for (j = 0, jj = ps.length; j < jj; j++) {
  49360. ps[j] *= 2;
  49361. cs[j] *= 3;
  49362. }
  49363. }
  49364. }
  49365. function Mesh(stream, matrix, xref, res) {
  49366. assert(isStream(stream), 'Mesh data is not a stream');
  49367. var dict = stream.dict;
  49368. this.matrix = matrix;
  49369. this.shadingType = dict.get('ShadingType');
  49370. this.type = 'Pattern';
  49371. this.bbox = dict.getArray('BBox');
  49372. var cs = dict.get('ColorSpace', 'CS');
  49373. cs = ColorSpace.parse(cs, xref, res);
  49374. this.cs = cs;
  49375. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  49376. var fnObj = dict.get('Function');
  49377. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  49378. this.coords = [];
  49379. this.colors = [];
  49380. this.figures = [];
  49381. var decodeContext = {
  49382. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  49383. bitsPerComponent: dict.get('BitsPerComponent'),
  49384. bitsPerFlag: dict.get('BitsPerFlag'),
  49385. decode: dict.getArray('Decode'),
  49386. colorFn: fn,
  49387. colorSpace: cs,
  49388. numComps: fn ? 1 : cs.numComps
  49389. };
  49390. var reader = new MeshStreamReader(stream, decodeContext);
  49391. var patchMesh = false;
  49392. switch (this.shadingType) {
  49393. case ShadingType.FREE_FORM_MESH:
  49394. decodeType4Shading(this, reader);
  49395. break;
  49396. case ShadingType.LATTICE_FORM_MESH:
  49397. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  49398. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  49399. decodeType5Shading(this, reader, verticesPerRow);
  49400. break;
  49401. case ShadingType.COONS_PATCH_MESH:
  49402. decodeType6Shading(this, reader);
  49403. patchMesh = true;
  49404. break;
  49405. case ShadingType.TENSOR_PATCH_MESH:
  49406. decodeType7Shading(this, reader);
  49407. patchMesh = true;
  49408. break;
  49409. default:
  49410. error('Unsupported mesh type.');
  49411. break;
  49412. }
  49413. if (patchMesh) {
  49414. updateBounds(this);
  49415. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  49416. buildFigureFromPatch(this, i);
  49417. }
  49418. }
  49419. updateBounds(this);
  49420. packData(this);
  49421. }
  49422. Mesh.prototype = {
  49423. getIR: function Mesh_getIR() {
  49424. return [
  49425. 'Mesh',
  49426. this.shadingType,
  49427. this.coords,
  49428. this.colors,
  49429. this.figures,
  49430. this.bounds,
  49431. this.matrix,
  49432. this.bbox,
  49433. this.background
  49434. ];
  49435. }
  49436. };
  49437. return Mesh;
  49438. }();
  49439. Shadings.Dummy = function DummyClosure() {
  49440. function Dummy() {
  49441. this.type = 'Pattern';
  49442. }
  49443. Dummy.prototype = {
  49444. getIR: function Dummy_getIR() {
  49445. return ['Dummy'];
  49446. }
  49447. };
  49448. return Dummy;
  49449. }();
  49450. function getTilingPatternIR(operatorList, dict, args) {
  49451. var matrix = dict.getArray('Matrix');
  49452. var bbox = dict.getArray('BBox');
  49453. var xstep = dict.get('XStep');
  49454. var ystep = dict.get('YStep');
  49455. var paintType = dict.get('PaintType');
  49456. var tilingType = dict.get('TilingType');
  49457. return [
  49458. 'TilingPattern',
  49459. args,
  49460. operatorList,
  49461. matrix,
  49462. bbox,
  49463. xstep,
  49464. ystep,
  49465. paintType,
  49466. tilingType
  49467. ];
  49468. }
  49469. exports.Pattern = Pattern;
  49470. exports.getTilingPatternIR = getTilingPatternIR;
  49471. /***/ }),
  49472. /* 33 */
  49473. /***/ (function(module, exports, __w_pdfjs_require__) {
  49474. "use strict";
  49475. var sharedUtil = __w_pdfjs_require__(0);
  49476. var coreStream = __w_pdfjs_require__(2);
  49477. var coreChunkedStream = __w_pdfjs_require__(11);
  49478. var coreDocument = __w_pdfjs_require__(24);
  49479. var warn = sharedUtil.warn;
  49480. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  49481. var shadow = sharedUtil.shadow;
  49482. var NotImplementedException = sharedUtil.NotImplementedException;
  49483. var MissingDataException = sharedUtil.MissingDataException;
  49484. var createPromiseCapability = sharedUtil.createPromiseCapability;
  49485. var Util = sharedUtil.Util;
  49486. var Stream = coreStream.Stream;
  49487. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  49488. var PDFDocument = coreDocument.PDFDocument;
  49489. var BasePdfManager = function BasePdfManagerClosure() {
  49490. function BasePdfManager() {
  49491. throw new Error('Cannot initialize BaseManagerManager');
  49492. }
  49493. BasePdfManager.prototype = {
  49494. get docId() {
  49495. return this._docId;
  49496. },
  49497. get password() {
  49498. return this._password;
  49499. },
  49500. get docBaseUrl() {
  49501. var docBaseUrl = null;
  49502. if (this._docBaseUrl) {
  49503. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  49504. if (absoluteUrl) {
  49505. docBaseUrl = absoluteUrl.href;
  49506. } else {
  49507. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  49508. }
  49509. }
  49510. return shadow(this, 'docBaseUrl', docBaseUrl);
  49511. },
  49512. onLoadedStream: function BasePdfManager_onLoadedStream() {
  49513. throw new NotImplementedException();
  49514. },
  49515. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  49516. return this.ensure(this.pdfDocument, prop, args);
  49517. },
  49518. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  49519. return this.ensure(this.pdfDocument.xref, prop, args);
  49520. },
  49521. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  49522. return this.ensure(this.pdfDocument.catalog, prop, args);
  49523. },
  49524. getPage: function BasePdfManager_getPage(pageIndex) {
  49525. return this.pdfDocument.getPage(pageIndex);
  49526. },
  49527. cleanup: function BasePdfManager_cleanup() {
  49528. return this.pdfDocument.cleanup();
  49529. },
  49530. ensure: function BasePdfManager_ensure(obj, prop, args) {
  49531. return new NotImplementedException();
  49532. },
  49533. requestRange: function BasePdfManager_requestRange(begin, end) {
  49534. return new NotImplementedException();
  49535. },
  49536. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  49537. return new NotImplementedException();
  49538. },
  49539. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  49540. return new NotImplementedException();
  49541. },
  49542. updatePassword: function BasePdfManager_updatePassword(password) {
  49543. this._password = password;
  49544. },
  49545. terminate: function BasePdfManager_terminate() {
  49546. return new NotImplementedException();
  49547. }
  49548. };
  49549. return BasePdfManager;
  49550. }();
  49551. var LocalPdfManager = function LocalPdfManagerClosure() {
  49552. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  49553. this._docId = docId;
  49554. this._password = password;
  49555. this._docBaseUrl = docBaseUrl;
  49556. this.evaluatorOptions = evaluatorOptions;
  49557. var stream = new Stream(data);
  49558. this.pdfDocument = new PDFDocument(this, stream);
  49559. this._loadedStreamCapability = createPromiseCapability();
  49560. this._loadedStreamCapability.resolve(stream);
  49561. }
  49562. Util.inherit(LocalPdfManager, BasePdfManager, {
  49563. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  49564. return new Promise(function (resolve, reject) {
  49565. try {
  49566. var value = obj[prop];
  49567. var result;
  49568. if (typeof value === 'function') {
  49569. result = value.apply(obj, args);
  49570. } else {
  49571. result = value;
  49572. }
  49573. resolve(result);
  49574. } catch (e) {
  49575. reject(e);
  49576. }
  49577. });
  49578. },
  49579. requestRange: function LocalPdfManager_requestRange(begin, end) {
  49580. return Promise.resolve();
  49581. },
  49582. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  49583. },
  49584. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  49585. return this._loadedStreamCapability.promise;
  49586. },
  49587. terminate: function LocalPdfManager_terminate() {
  49588. }
  49589. });
  49590. return LocalPdfManager;
  49591. }();
  49592. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  49593. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  49594. this._docId = docId;
  49595. this._password = args.password;
  49596. this._docBaseUrl = docBaseUrl;
  49597. this.msgHandler = args.msgHandler;
  49598. this.evaluatorOptions = evaluatorOptions;
  49599. var params = {
  49600. msgHandler: args.msgHandler,
  49601. url: args.url,
  49602. length: args.length,
  49603. disableAutoFetch: args.disableAutoFetch,
  49604. rangeChunkSize: args.rangeChunkSize
  49605. };
  49606. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  49607. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  49608. }
  49609. Util.inherit(NetworkPdfManager, BasePdfManager, {
  49610. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  49611. var pdfManager = this;
  49612. return new Promise(function (resolve, reject) {
  49613. function ensureHelper() {
  49614. try {
  49615. var result;
  49616. var value = obj[prop];
  49617. if (typeof value === 'function') {
  49618. result = value.apply(obj, args);
  49619. } else {
  49620. result = value;
  49621. }
  49622. resolve(result);
  49623. } catch (e) {
  49624. if (!(e instanceof MissingDataException)) {
  49625. reject(e);
  49626. return;
  49627. }
  49628. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  49629. }
  49630. }
  49631. ensureHelper();
  49632. });
  49633. },
  49634. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  49635. return this.streamManager.requestRange(begin, end);
  49636. },
  49637. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  49638. this.streamManager.requestAllChunks();
  49639. },
  49640. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  49641. this.streamManager.onReceiveData({ chunk: chunk });
  49642. },
  49643. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  49644. return this.streamManager.onLoadedStream();
  49645. },
  49646. terminate: function NetworkPdfManager_terminate() {
  49647. this.streamManager.abort();
  49648. }
  49649. });
  49650. return NetworkPdfManager;
  49651. }();
  49652. exports.LocalPdfManager = LocalPdfManager;
  49653. exports.NetworkPdfManager = NetworkPdfManager;
  49654. /***/ }),
  49655. /* 34 */
  49656. /***/ (function(module, exports, __w_pdfjs_require__) {
  49657. "use strict";
  49658. var sharedUtil = __w_pdfjs_require__(0);
  49659. var corePrimitives = __w_pdfjs_require__(1);
  49660. var error = sharedUtil.error;
  49661. var isSpace = sharedUtil.isSpace;
  49662. var EOF = corePrimitives.EOF;
  49663. var PostScriptParser = function PostScriptParserClosure() {
  49664. function PostScriptParser(lexer) {
  49665. this.lexer = lexer;
  49666. this.operators = [];
  49667. this.token = null;
  49668. this.prev = null;
  49669. }
  49670. PostScriptParser.prototype = {
  49671. nextToken: function PostScriptParser_nextToken() {
  49672. this.prev = this.token;
  49673. this.token = this.lexer.getToken();
  49674. },
  49675. accept: function PostScriptParser_accept(type) {
  49676. if (this.token.type === type) {
  49677. this.nextToken();
  49678. return true;
  49679. }
  49680. return false;
  49681. },
  49682. expect: function PostScriptParser_expect(type) {
  49683. if (this.accept(type)) {
  49684. return true;
  49685. }
  49686. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  49687. },
  49688. parse: function PostScriptParser_parse() {
  49689. this.nextToken();
  49690. this.expect(PostScriptTokenTypes.LBRACE);
  49691. this.parseBlock();
  49692. this.expect(PostScriptTokenTypes.RBRACE);
  49693. return this.operators;
  49694. },
  49695. parseBlock: function PostScriptParser_parseBlock() {
  49696. while (true) {
  49697. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  49698. this.operators.push(this.prev.value);
  49699. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  49700. this.operators.push(this.prev.value);
  49701. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49702. this.parseCondition();
  49703. } else {
  49704. return;
  49705. }
  49706. }
  49707. },
  49708. parseCondition: function PostScriptParser_parseCondition() {
  49709. var conditionLocation = this.operators.length;
  49710. this.operators.push(null, null);
  49711. this.parseBlock();
  49712. this.expect(PostScriptTokenTypes.RBRACE);
  49713. if (this.accept(PostScriptTokenTypes.IF)) {
  49714. this.operators[conditionLocation] = this.operators.length;
  49715. this.operators[conditionLocation + 1] = 'jz';
  49716. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49717. var jumpLocation = this.operators.length;
  49718. this.operators.push(null, null);
  49719. var endOfTrue = this.operators.length;
  49720. this.parseBlock();
  49721. this.expect(PostScriptTokenTypes.RBRACE);
  49722. this.expect(PostScriptTokenTypes.IFELSE);
  49723. this.operators[jumpLocation] = this.operators.length;
  49724. this.operators[jumpLocation + 1] = 'j';
  49725. this.operators[conditionLocation] = endOfTrue;
  49726. this.operators[conditionLocation + 1] = 'jz';
  49727. } else {
  49728. error('PS Function: error parsing conditional.');
  49729. }
  49730. }
  49731. };
  49732. return PostScriptParser;
  49733. }();
  49734. var PostScriptTokenTypes = {
  49735. LBRACE: 0,
  49736. RBRACE: 1,
  49737. NUMBER: 2,
  49738. OPERATOR: 3,
  49739. IF: 4,
  49740. IFELSE: 5
  49741. };
  49742. var PostScriptToken = function PostScriptTokenClosure() {
  49743. function PostScriptToken(type, value) {
  49744. this.type = type;
  49745. this.value = value;
  49746. }
  49747. var opCache = Object.create(null);
  49748. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  49749. var opValue = opCache[op];
  49750. if (opValue) {
  49751. return opValue;
  49752. }
  49753. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49754. };
  49755. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  49756. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  49757. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  49758. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  49759. return PostScriptToken;
  49760. }();
  49761. var PostScriptLexer = function PostScriptLexerClosure() {
  49762. function PostScriptLexer(stream) {
  49763. this.stream = stream;
  49764. this.nextChar();
  49765. this.strBuf = [];
  49766. }
  49767. PostScriptLexer.prototype = {
  49768. nextChar: function PostScriptLexer_nextChar() {
  49769. return this.currentChar = this.stream.getByte();
  49770. },
  49771. getToken: function PostScriptLexer_getToken() {
  49772. var comment = false;
  49773. var ch = this.currentChar;
  49774. while (true) {
  49775. if (ch < 0) {
  49776. return EOF;
  49777. }
  49778. if (comment) {
  49779. if (ch === 0x0A || ch === 0x0D) {
  49780. comment = false;
  49781. }
  49782. } else if (ch === 0x25) {
  49783. comment = true;
  49784. } else if (!isSpace(ch)) {
  49785. break;
  49786. }
  49787. ch = this.nextChar();
  49788. }
  49789. switch (ch | 0) {
  49790. case 0x30:
  49791. case 0x31:
  49792. case 0x32:
  49793. case 0x33:
  49794. case 0x34:
  49795. case 0x35:
  49796. case 0x36:
  49797. case 0x37:
  49798. case 0x38:
  49799. case 0x39:
  49800. case 0x2B:
  49801. case 0x2D:
  49802. case 0x2E:
  49803. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49804. case 0x7B:
  49805. this.nextChar();
  49806. return PostScriptToken.LBRACE;
  49807. case 0x7D:
  49808. this.nextChar();
  49809. return PostScriptToken.RBRACE;
  49810. }
  49811. var strBuf = this.strBuf;
  49812. strBuf.length = 0;
  49813. strBuf[0] = String.fromCharCode(ch);
  49814. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  49815. strBuf.push(String.fromCharCode(ch));
  49816. }
  49817. var str = strBuf.join('');
  49818. switch (str.toLowerCase()) {
  49819. case 'if':
  49820. return PostScriptToken.IF;
  49821. case 'ifelse':
  49822. return PostScriptToken.IFELSE;
  49823. default:
  49824. return PostScriptToken.getOperator(str);
  49825. }
  49826. },
  49827. getNumber: function PostScriptLexer_getNumber() {
  49828. var ch = this.currentChar;
  49829. var strBuf = this.strBuf;
  49830. strBuf.length = 0;
  49831. strBuf[0] = String.fromCharCode(ch);
  49832. while ((ch = this.nextChar()) >= 0) {
  49833. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49834. strBuf.push(String.fromCharCode(ch));
  49835. } else {
  49836. break;
  49837. }
  49838. }
  49839. var value = parseFloat(strBuf.join(''));
  49840. if (isNaN(value)) {
  49841. error('Invalid floating point number: ' + value);
  49842. }
  49843. return value;
  49844. }
  49845. };
  49846. return PostScriptLexer;
  49847. }();
  49848. exports.PostScriptLexer = PostScriptLexer;
  49849. exports.PostScriptParser = PostScriptParser;
  49850. /***/ }),
  49851. /* 35 */
  49852. /***/ (function(module, exports, __w_pdfjs_require__) {
  49853. "use strict";
  49854. var sharedUtil = __w_pdfjs_require__(0);
  49855. var coreStream = __w_pdfjs_require__(2);
  49856. var coreEncodings = __w_pdfjs_require__(4);
  49857. var warn = sharedUtil.warn;
  49858. var isSpace = sharedUtil.isSpace;
  49859. var Stream = coreStream.Stream;
  49860. var getEncoding = coreEncodings.getEncoding;
  49861. var HINTING_ENABLED = false;
  49862. var Type1CharString = function Type1CharStringClosure() {
  49863. var COMMAND_MAP = {
  49864. 'hstem': [1],
  49865. 'vstem': [3],
  49866. 'vmoveto': [4],
  49867. 'rlineto': [5],
  49868. 'hlineto': [6],
  49869. 'vlineto': [7],
  49870. 'rrcurveto': [8],
  49871. 'callsubr': [10],
  49872. 'flex': [
  49873. 12,
  49874. 35
  49875. ],
  49876. 'drop': [
  49877. 12,
  49878. 18
  49879. ],
  49880. 'endchar': [14],
  49881. 'rmoveto': [21],
  49882. 'hmoveto': [22],
  49883. 'vhcurveto': [30],
  49884. 'hvcurveto': [31]
  49885. };
  49886. function Type1CharString() {
  49887. this.width = 0;
  49888. this.lsb = 0;
  49889. this.flexing = false;
  49890. this.output = [];
  49891. this.stack = [];
  49892. }
  49893. Type1CharString.prototype = {
  49894. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49895. var count = encoded.length;
  49896. var error = false;
  49897. var wx, sbx, subrNumber;
  49898. for (var i = 0; i < count; i++) {
  49899. var value = encoded[i];
  49900. if (value < 32) {
  49901. if (value === 12) {
  49902. value = (value << 8) + encoded[++i];
  49903. }
  49904. switch (value) {
  49905. case 1:
  49906. if (!HINTING_ENABLED) {
  49907. this.stack = [];
  49908. break;
  49909. }
  49910. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49911. break;
  49912. case 3:
  49913. if (!HINTING_ENABLED) {
  49914. this.stack = [];
  49915. break;
  49916. }
  49917. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49918. break;
  49919. case 4:
  49920. if (this.flexing) {
  49921. if (this.stack.length < 1) {
  49922. error = true;
  49923. break;
  49924. }
  49925. var dy = this.stack.pop();
  49926. this.stack.push(0, dy);
  49927. break;
  49928. }
  49929. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49930. break;
  49931. case 5:
  49932. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49933. break;
  49934. case 6:
  49935. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49936. break;
  49937. case 7:
  49938. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49939. break;
  49940. case 8:
  49941. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49942. break;
  49943. case 9:
  49944. this.stack = [];
  49945. break;
  49946. case 10:
  49947. if (this.stack.length < 1) {
  49948. error = true;
  49949. break;
  49950. }
  49951. subrNumber = this.stack.pop();
  49952. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49953. break;
  49954. case 11:
  49955. return error;
  49956. case 13:
  49957. if (this.stack.length < 2) {
  49958. error = true;
  49959. break;
  49960. }
  49961. wx = this.stack.pop();
  49962. sbx = this.stack.pop();
  49963. this.lsb = sbx;
  49964. this.width = wx;
  49965. this.stack.push(wx, sbx);
  49966. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49967. break;
  49968. case 14:
  49969. this.output.push(COMMAND_MAP.endchar[0]);
  49970. break;
  49971. case 21:
  49972. if (this.flexing) {
  49973. break;
  49974. }
  49975. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49976. break;
  49977. case 22:
  49978. if (this.flexing) {
  49979. this.stack.push(0);
  49980. break;
  49981. }
  49982. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49983. break;
  49984. case 30:
  49985. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49986. break;
  49987. case 31:
  49988. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49989. break;
  49990. case (12 << 8) + 0:
  49991. this.stack = [];
  49992. break;
  49993. case (12 << 8) + 1:
  49994. if (!HINTING_ENABLED) {
  49995. this.stack = [];
  49996. break;
  49997. }
  49998. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49999. break;
  50000. case (12 << 8) + 2:
  50001. if (!HINTING_ENABLED) {
  50002. this.stack = [];
  50003. break;
  50004. }
  50005. error = this.executeCommand(2, COMMAND_MAP.hstem);
  50006. break;
  50007. case (12 << 8) + 6:
  50008. if (seacAnalysisEnabled) {
  50009. this.seac = this.stack.splice(-4, 4);
  50010. error = this.executeCommand(0, COMMAND_MAP.endchar);
  50011. } else {
  50012. error = this.executeCommand(4, COMMAND_MAP.endchar);
  50013. }
  50014. break;
  50015. case (12 << 8) + 7:
  50016. if (this.stack.length < 4) {
  50017. error = true;
  50018. break;
  50019. }
  50020. this.stack.pop();
  50021. wx = this.stack.pop();
  50022. var sby = this.stack.pop();
  50023. sbx = this.stack.pop();
  50024. this.lsb = sbx;
  50025. this.width = wx;
  50026. this.stack.push(wx, sbx, sby);
  50027. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  50028. break;
  50029. case (12 << 8) + 12:
  50030. if (this.stack.length < 2) {
  50031. error = true;
  50032. break;
  50033. }
  50034. var num2 = this.stack.pop();
  50035. var num1 = this.stack.pop();
  50036. this.stack.push(num1 / num2);
  50037. break;
  50038. case (12 << 8) + 16:
  50039. if (this.stack.length < 2) {
  50040. error = true;
  50041. break;
  50042. }
  50043. subrNumber = this.stack.pop();
  50044. var numArgs = this.stack.pop();
  50045. if (subrNumber === 0 && numArgs === 3) {
  50046. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  50047. 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]);
  50048. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  50049. this.flexing = false;
  50050. this.stack.push(flexArgs[15], flexArgs[16]);
  50051. } else if (subrNumber === 1 && numArgs === 0) {
  50052. this.flexing = true;
  50053. }
  50054. break;
  50055. case (12 << 8) + 17:
  50056. break;
  50057. case (12 << 8) + 33:
  50058. this.stack = [];
  50059. break;
  50060. default:
  50061. warn('Unknown type 1 charstring command of "' + value + '"');
  50062. break;
  50063. }
  50064. if (error) {
  50065. break;
  50066. }
  50067. continue;
  50068. } else if (value <= 246) {
  50069. value = value - 139;
  50070. } else if (value <= 250) {
  50071. value = (value - 247) * 256 + encoded[++i] + 108;
  50072. } else if (value <= 254) {
  50073. value = -((value - 251) * 256) - encoded[++i] - 108;
  50074. } else {
  50075. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  50076. }
  50077. this.stack.push(value);
  50078. }
  50079. return error;
  50080. },
  50081. executeCommand: function (howManyArgs, command, keepStack) {
  50082. var stackLength = this.stack.length;
  50083. if (howManyArgs > stackLength) {
  50084. return true;
  50085. }
  50086. var start = stackLength - howManyArgs;
  50087. for (var i = start; i < stackLength; i++) {
  50088. var value = this.stack[i];
  50089. if (value === (value | 0)) {
  50090. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  50091. } else {
  50092. value = 65536 * value | 0;
  50093. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  50094. }
  50095. }
  50096. this.output.push.apply(this.output, command);
  50097. if (keepStack) {
  50098. this.stack.splice(start, howManyArgs);
  50099. } else {
  50100. this.stack.length = 0;
  50101. }
  50102. return false;
  50103. }
  50104. };
  50105. return Type1CharString;
  50106. }();
  50107. var Type1Parser = function Type1ParserClosure() {
  50108. var EEXEC_ENCRYPT_KEY = 55665;
  50109. var CHAR_STRS_ENCRYPT_KEY = 4330;
  50110. function isHexDigit(code) {
  50111. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  50112. }
  50113. function decrypt(data, key, discardNumber) {
  50114. if (discardNumber >= data.length) {
  50115. return new Uint8Array(0);
  50116. }
  50117. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  50118. for (i = 0; i < discardNumber; i++) {
  50119. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  50120. }
  50121. var count = data.length - discardNumber;
  50122. var decrypted = new Uint8Array(count);
  50123. for (i = discardNumber, j = 0; j < count; i++, j++) {
  50124. var value = data[i];
  50125. decrypted[j] = value ^ r >> 8;
  50126. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50127. }
  50128. return decrypted;
  50129. }
  50130. function decryptAscii(data, key, discardNumber) {
  50131. var r = key | 0, c1 = 52845, c2 = 22719;
  50132. var count = data.length, maybeLength = count >>> 1;
  50133. var decrypted = new Uint8Array(maybeLength);
  50134. var i, j;
  50135. for (i = 0, j = 0; i < count; i++) {
  50136. var digit1 = data[i];
  50137. if (!isHexDigit(digit1)) {
  50138. continue;
  50139. }
  50140. i++;
  50141. var digit2;
  50142. while (i < count && !isHexDigit(digit2 = data[i])) {
  50143. i++;
  50144. }
  50145. if (i < count) {
  50146. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  50147. decrypted[j++] = value ^ r >> 8;
  50148. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50149. }
  50150. }
  50151. return Array.prototype.slice.call(decrypted, discardNumber, j);
  50152. }
  50153. function isSpecial(c) {
  50154. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  50155. }
  50156. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  50157. if (encrypted) {
  50158. var data = stream.getBytes();
  50159. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  50160. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  50161. }
  50162. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  50163. this.stream = stream;
  50164. this.nextChar();
  50165. }
  50166. Type1Parser.prototype = {
  50167. readNumberArray: function Type1Parser_readNumberArray() {
  50168. this.getToken();
  50169. var array = [];
  50170. while (true) {
  50171. var token = this.getToken();
  50172. if (token === null || token === ']' || token === '}') {
  50173. break;
  50174. }
  50175. array.push(parseFloat(token || 0));
  50176. }
  50177. return array;
  50178. },
  50179. readNumber: function Type1Parser_readNumber() {
  50180. var token = this.getToken();
  50181. return parseFloat(token || 0);
  50182. },
  50183. readInt: function Type1Parser_readInt() {
  50184. var token = this.getToken();
  50185. return parseInt(token || 0, 10) | 0;
  50186. },
  50187. readBoolean: function Type1Parser_readBoolean() {
  50188. var token = this.getToken();
  50189. return token === 'true' ? 1 : 0;
  50190. },
  50191. nextChar: function Type1_nextChar() {
  50192. return this.currentChar = this.stream.getByte();
  50193. },
  50194. getToken: function Type1Parser_getToken() {
  50195. var comment = false;
  50196. var ch = this.currentChar;
  50197. while (true) {
  50198. if (ch === -1) {
  50199. return null;
  50200. }
  50201. if (comment) {
  50202. if (ch === 0x0A || ch === 0x0D) {
  50203. comment = false;
  50204. }
  50205. } else if (ch === 0x25) {
  50206. comment = true;
  50207. } else if (!isSpace(ch)) {
  50208. break;
  50209. }
  50210. ch = this.nextChar();
  50211. }
  50212. if (isSpecial(ch)) {
  50213. this.nextChar();
  50214. return String.fromCharCode(ch);
  50215. }
  50216. var token = '';
  50217. do {
  50218. token += String.fromCharCode(ch);
  50219. ch = this.nextChar();
  50220. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  50221. return token;
  50222. },
  50223. extractFontProgram: function Type1Parser_extractFontProgram() {
  50224. var stream = this.stream;
  50225. var subrs = [], charstrings = [];
  50226. var privateData = Object.create(null);
  50227. privateData['lenIV'] = 4;
  50228. var program = {
  50229. subrs: [],
  50230. charstrings: [],
  50231. properties: { 'privateData': privateData }
  50232. };
  50233. var token, length, data, lenIV, encoded;
  50234. while ((token = this.getToken()) !== null) {
  50235. if (token !== '/') {
  50236. continue;
  50237. }
  50238. token = this.getToken();
  50239. switch (token) {
  50240. case 'CharStrings':
  50241. this.getToken();
  50242. this.getToken();
  50243. this.getToken();
  50244. this.getToken();
  50245. while (true) {
  50246. token = this.getToken();
  50247. if (token === null || token === 'end') {
  50248. break;
  50249. }
  50250. if (token !== '/') {
  50251. continue;
  50252. }
  50253. var glyph = this.getToken();
  50254. length = this.readInt();
  50255. this.getToken();
  50256. data = stream.makeSubStream(stream.pos, length);
  50257. lenIV = program.properties.privateData['lenIV'];
  50258. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50259. stream.skip(length);
  50260. this.nextChar();
  50261. token = this.getToken();
  50262. if (token === 'noaccess') {
  50263. this.getToken();
  50264. }
  50265. charstrings.push({
  50266. glyph: glyph,
  50267. encoded: encoded
  50268. });
  50269. }
  50270. break;
  50271. case 'Subrs':
  50272. this.readInt();
  50273. this.getToken();
  50274. while ((token = this.getToken()) === 'dup') {
  50275. var index = this.readInt();
  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. subrs[index] = encoded;
  50288. }
  50289. break;
  50290. case 'BlueValues':
  50291. case 'OtherBlues':
  50292. case 'FamilyBlues':
  50293. case 'FamilyOtherBlues':
  50294. var blueArray = this.readNumberArray();
  50295. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  50296. program.properties.privateData[token] = blueArray;
  50297. }
  50298. break;
  50299. case 'StemSnapH':
  50300. case 'StemSnapV':
  50301. program.properties.privateData[token] = this.readNumberArray();
  50302. break;
  50303. case 'StdHW':
  50304. case 'StdVW':
  50305. program.properties.privateData[token] = this.readNumberArray()[0];
  50306. break;
  50307. case 'BlueShift':
  50308. case 'lenIV':
  50309. case 'BlueFuzz':
  50310. case 'BlueScale':
  50311. case 'LanguageGroup':
  50312. case 'ExpansionFactor':
  50313. program.properties.privateData[token] = this.readNumber();
  50314. break;
  50315. case 'ForceBold':
  50316. program.properties.privateData[token] = this.readBoolean();
  50317. break;
  50318. }
  50319. }
  50320. for (var i = 0; i < charstrings.length; i++) {
  50321. glyph = charstrings[i].glyph;
  50322. encoded = charstrings[i].encoded;
  50323. var charString = new Type1CharString();
  50324. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  50325. var output = charString.output;
  50326. if (error) {
  50327. output = [14];
  50328. }
  50329. program.charstrings.push({
  50330. glyphName: glyph,
  50331. charstring: output,
  50332. width: charString.width,
  50333. lsb: charString.lsb,
  50334. seac: charString.seac
  50335. });
  50336. }
  50337. return program;
  50338. },
  50339. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  50340. var token;
  50341. while ((token = this.getToken()) !== null) {
  50342. if (token !== '/') {
  50343. continue;
  50344. }
  50345. token = this.getToken();
  50346. switch (token) {
  50347. case 'FontMatrix':
  50348. var matrix = this.readNumberArray();
  50349. properties.fontMatrix = matrix;
  50350. break;
  50351. case 'Encoding':
  50352. var encodingArg = this.getToken();
  50353. var encoding;
  50354. if (!/^\d+$/.test(encodingArg)) {
  50355. encoding = getEncoding(encodingArg);
  50356. } else {
  50357. encoding = [];
  50358. var size = parseInt(encodingArg, 10) | 0;
  50359. this.getToken();
  50360. for (var j = 0; j < size; j++) {
  50361. token = this.getToken();
  50362. while (token !== 'dup' && token !== 'def') {
  50363. token = this.getToken();
  50364. if (token === null) {
  50365. return;
  50366. }
  50367. }
  50368. if (token === 'def') {
  50369. break;
  50370. }
  50371. var index = this.readInt();
  50372. this.getToken();
  50373. var glyph = this.getToken();
  50374. encoding[index] = glyph;
  50375. this.getToken();
  50376. }
  50377. }
  50378. properties.builtInEncoding = encoding;
  50379. break;
  50380. case 'FontBBox':
  50381. var fontBBox = this.readNumberArray();
  50382. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  50383. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  50384. properties.ascentScaled = true;
  50385. break;
  50386. }
  50387. }
  50388. }
  50389. };
  50390. return Type1Parser;
  50391. }();
  50392. exports.Type1Parser = Type1Parser;
  50393. /***/ }),
  50394. /* 36 */
  50395. /***/ (function(module, exports, __w_pdfjs_require__) {
  50396. "use strict";
  50397. var pdfjsVersion = '1.7.292';
  50398. var pdfjsBuild = 'fde609e8';
  50399. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50400. {
  50401. __w_pdfjs_require__(18);
  50402. }
  50403. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50404. /***/ })
  50405. /******/ ]);
  50406. });