pdf.worker.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535
  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 isStream = corePrimitives.isStream;
  35915. var Stream = coreStream.Stream;
  35916. var ColorSpace = coreColorSpace.ColorSpace;
  35917. var Catalog = coreObj.Catalog;
  35918. var ObjectLoader = coreObj.ObjectLoader;
  35919. var FileSpec = coreObj.FileSpec;
  35920. var OperatorList = coreEvaluator.OperatorList;
  35921. function AnnotationFactory() {
  35922. }
  35923. AnnotationFactory.prototype = {
  35924. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35925. var dict = xref.fetchIfRef(ref);
  35926. if (!isDict(dict)) {
  35927. return;
  35928. }
  35929. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35930. var subtype = dict.get('Subtype');
  35931. subtype = isName(subtype) ? subtype.name : null;
  35932. var parameters = {
  35933. xref: xref,
  35934. dict: dict,
  35935. ref: isRef(ref) ? ref : null,
  35936. subtype: subtype,
  35937. id: id,
  35938. pdfManager: pdfManager
  35939. };
  35940. switch (subtype) {
  35941. case 'Link':
  35942. return new LinkAnnotation(parameters);
  35943. case 'Text':
  35944. return new TextAnnotation(parameters);
  35945. case 'Widget':
  35946. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35947. fieldType = isName(fieldType) ? fieldType.name : null;
  35948. switch (fieldType) {
  35949. case 'Tx':
  35950. return new TextWidgetAnnotation(parameters);
  35951. case 'Btn':
  35952. return new ButtonWidgetAnnotation(parameters);
  35953. case 'Ch':
  35954. return new ChoiceWidgetAnnotation(parameters);
  35955. }
  35956. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35957. return new WidgetAnnotation(parameters);
  35958. case 'Popup':
  35959. return new PopupAnnotation(parameters);
  35960. case 'Highlight':
  35961. return new HighlightAnnotation(parameters);
  35962. case 'Underline':
  35963. return new UnderlineAnnotation(parameters);
  35964. case 'Squiggly':
  35965. return new SquigglyAnnotation(parameters);
  35966. case 'StrikeOut':
  35967. return new StrikeOutAnnotation(parameters);
  35968. case 'FileAttachment':
  35969. return new FileAttachmentAnnotation(parameters);
  35970. default:
  35971. if (!subtype) {
  35972. warn('Annotation is missing the required /Subtype.');
  35973. } else {
  35974. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35975. }
  35976. return new Annotation(parameters);
  35977. }
  35978. }
  35979. };
  35980. var Annotation = function AnnotationClosure() {
  35981. function getTransformMatrix(rect, bbox, matrix) {
  35982. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  35983. var minX = bounds[0];
  35984. var minY = bounds[1];
  35985. var maxX = bounds[2];
  35986. var maxY = bounds[3];
  35987. if (minX === maxX || minY === maxY) {
  35988. return [
  35989. 1,
  35990. 0,
  35991. 0,
  35992. 1,
  35993. rect[0],
  35994. rect[1]
  35995. ];
  35996. }
  35997. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  35998. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  35999. return [
  36000. xRatio,
  36001. 0,
  36002. 0,
  36003. yRatio,
  36004. rect[0] - minX * xRatio,
  36005. rect[1] - minY * yRatio
  36006. ];
  36007. }
  36008. function Annotation(params) {
  36009. var dict = params.dict;
  36010. this.setFlags(dict.get('F'));
  36011. this.setRectangle(dict.getArray('Rect'));
  36012. this.setColor(dict.getArray('C'));
  36013. this.setBorderStyle(dict);
  36014. this.setAppearance(dict);
  36015. this.data = {};
  36016. this.data.id = params.id;
  36017. this.data.subtype = params.subtype;
  36018. this.data.annotationFlags = this.flags;
  36019. this.data.rect = this.rectangle;
  36020. this.data.color = this.color;
  36021. this.data.borderStyle = this.borderStyle;
  36022. this.data.hasAppearance = !!this.appearance;
  36023. }
  36024. Annotation.prototype = {
  36025. _hasFlag: function Annotation_hasFlag(flags, flag) {
  36026. return !!(flags & flag);
  36027. },
  36028. _isViewable: function Annotation_isViewable(flags) {
  36029. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  36030. },
  36031. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  36032. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  36033. },
  36034. get viewable() {
  36035. if (this.flags === 0) {
  36036. return true;
  36037. }
  36038. return this._isViewable(this.flags);
  36039. },
  36040. get printable() {
  36041. if (this.flags === 0) {
  36042. return false;
  36043. }
  36044. return this._isPrintable(this.flags);
  36045. },
  36046. setFlags: function Annotation_setFlags(flags) {
  36047. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  36048. },
  36049. hasFlag: function Annotation_hasFlag(flag) {
  36050. return this._hasFlag(this.flags, flag);
  36051. },
  36052. setRectangle: function Annotation_setRectangle(rectangle) {
  36053. if (isArray(rectangle) && rectangle.length === 4) {
  36054. this.rectangle = Util.normalizeRect(rectangle);
  36055. } else {
  36056. this.rectangle = [
  36057. 0,
  36058. 0,
  36059. 0,
  36060. 0
  36061. ];
  36062. }
  36063. },
  36064. setColor: function Annotation_setColor(color) {
  36065. var rgbColor = new Uint8Array(3);
  36066. if (!isArray(color)) {
  36067. this.color = rgbColor;
  36068. return;
  36069. }
  36070. switch (color.length) {
  36071. case 0:
  36072. this.color = null;
  36073. break;
  36074. case 1:
  36075. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  36076. this.color = rgbColor;
  36077. break;
  36078. case 3:
  36079. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  36080. this.color = rgbColor;
  36081. break;
  36082. case 4:
  36083. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  36084. this.color = rgbColor;
  36085. break;
  36086. default:
  36087. this.color = rgbColor;
  36088. break;
  36089. }
  36090. },
  36091. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  36092. this.borderStyle = new AnnotationBorderStyle();
  36093. if (!isDict(borderStyle)) {
  36094. return;
  36095. }
  36096. if (borderStyle.has('BS')) {
  36097. var dict = borderStyle.get('BS');
  36098. var dictType = dict.get('Type');
  36099. if (!dictType || isName(dictType, 'Border')) {
  36100. this.borderStyle.setWidth(dict.get('W'));
  36101. this.borderStyle.setStyle(dict.get('S'));
  36102. this.borderStyle.setDashArray(dict.getArray('D'));
  36103. }
  36104. } else if (borderStyle.has('Border')) {
  36105. var array = borderStyle.getArray('Border');
  36106. if (isArray(array) && array.length >= 3) {
  36107. this.borderStyle.setHorizontalCornerRadius(array[0]);
  36108. this.borderStyle.setVerticalCornerRadius(array[1]);
  36109. this.borderStyle.setWidth(array[2]);
  36110. if (array.length === 4) {
  36111. this.borderStyle.setDashArray(array[3]);
  36112. }
  36113. }
  36114. } else {
  36115. this.borderStyle.setWidth(0);
  36116. }
  36117. },
  36118. setAppearance: function Annotation_setAppearance(dict) {
  36119. this.appearance = null;
  36120. var appearanceStates = dict.get('AP');
  36121. if (!isDict(appearanceStates)) {
  36122. return;
  36123. }
  36124. var normalAppearanceState = appearanceStates.get('N');
  36125. if (isStream(normalAppearanceState)) {
  36126. this.appearance = normalAppearanceState;
  36127. return;
  36128. }
  36129. if (!isDict(normalAppearanceState)) {
  36130. return;
  36131. }
  36132. var as = dict.get('AS');
  36133. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  36134. return;
  36135. }
  36136. this.appearance = normalAppearanceState.get(as.name);
  36137. },
  36138. _preparePopup: function Annotation_preparePopup(dict) {
  36139. if (!dict.has('C')) {
  36140. this.data.color = null;
  36141. }
  36142. this.data.hasPopup = dict.has('Popup');
  36143. this.data.title = stringToPDFString(dict.get('T') || '');
  36144. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  36145. },
  36146. loadResources: function Annotation_loadResources(keys) {
  36147. return new Promise(function (resolve, reject) {
  36148. this.appearance.dict.getAsync('Resources').then(function (resources) {
  36149. if (!resources) {
  36150. resolve();
  36151. return;
  36152. }
  36153. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  36154. objectLoader.load().then(function () {
  36155. resolve(resources);
  36156. }, reject);
  36157. }, reject);
  36158. }.bind(this));
  36159. },
  36160. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  36161. if (!this.appearance) {
  36162. return Promise.resolve(new OperatorList());
  36163. }
  36164. var data = this.data;
  36165. var appearanceDict = this.appearance.dict;
  36166. var resourcesPromise = this.loadResources([
  36167. 'ExtGState',
  36168. 'ColorSpace',
  36169. 'Pattern',
  36170. 'Shading',
  36171. 'XObject',
  36172. 'Font'
  36173. ]);
  36174. var bbox = appearanceDict.getArray('BBox') || [
  36175. 0,
  36176. 0,
  36177. 1,
  36178. 1
  36179. ];
  36180. var matrix = appearanceDict.getArray('Matrix') || [
  36181. 1,
  36182. 0,
  36183. 0,
  36184. 1,
  36185. 0,
  36186. 0
  36187. ];
  36188. var transform = getTransformMatrix(data.rect, bbox, matrix);
  36189. var self = this;
  36190. return resourcesPromise.then(function (resources) {
  36191. var opList = new OperatorList();
  36192. opList.addOp(OPS.beginAnnotation, [
  36193. data.rect,
  36194. transform,
  36195. matrix
  36196. ]);
  36197. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  36198. opList.addOp(OPS.endAnnotation, []);
  36199. self.appearance.reset();
  36200. return opList;
  36201. });
  36202. });
  36203. }
  36204. };
  36205. Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) {
  36206. var annotationPromises = [];
  36207. for (var i = 0, n = annotations.length; i < n; ++i) {
  36208. if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) {
  36209. annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms));
  36210. }
  36211. }
  36212. return Promise.all(annotationPromises).then(function (operatorLists) {
  36213. opList.addOp(OPS.beginAnnotations, []);
  36214. for (var i = 0, n = operatorLists.length; i < n; ++i) {
  36215. opList.addOpList(operatorLists[i]);
  36216. }
  36217. opList.addOp(OPS.endAnnotations, []);
  36218. });
  36219. };
  36220. return Annotation;
  36221. }();
  36222. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  36223. function AnnotationBorderStyle() {
  36224. this.width = 1;
  36225. this.style = AnnotationBorderStyleType.SOLID;
  36226. this.dashArray = [3];
  36227. this.horizontalCornerRadius = 0;
  36228. this.verticalCornerRadius = 0;
  36229. }
  36230. AnnotationBorderStyle.prototype = {
  36231. setWidth: function AnnotationBorderStyle_setWidth(width) {
  36232. if (width === (width | 0)) {
  36233. this.width = width;
  36234. }
  36235. },
  36236. setStyle: function AnnotationBorderStyle_setStyle(style) {
  36237. if (!style) {
  36238. return;
  36239. }
  36240. switch (style.name) {
  36241. case 'S':
  36242. this.style = AnnotationBorderStyleType.SOLID;
  36243. break;
  36244. case 'D':
  36245. this.style = AnnotationBorderStyleType.DASHED;
  36246. break;
  36247. case 'B':
  36248. this.style = AnnotationBorderStyleType.BEVELED;
  36249. break;
  36250. case 'I':
  36251. this.style = AnnotationBorderStyleType.INSET;
  36252. break;
  36253. case 'U':
  36254. this.style = AnnotationBorderStyleType.UNDERLINE;
  36255. break;
  36256. default:
  36257. break;
  36258. }
  36259. },
  36260. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  36261. if (isArray(dashArray) && dashArray.length > 0) {
  36262. var isValid = true;
  36263. var allZeros = true;
  36264. for (var i = 0, len = dashArray.length; i < len; i++) {
  36265. var element = dashArray[i];
  36266. var validNumber = +element >= 0;
  36267. if (!validNumber) {
  36268. isValid = false;
  36269. break;
  36270. } else if (element > 0) {
  36271. allZeros = false;
  36272. }
  36273. }
  36274. if (isValid && !allZeros) {
  36275. this.dashArray = dashArray;
  36276. } else {
  36277. this.width = 0;
  36278. }
  36279. } else if (dashArray) {
  36280. this.width = 0;
  36281. }
  36282. },
  36283. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  36284. if (radius === (radius | 0)) {
  36285. this.horizontalCornerRadius = radius;
  36286. }
  36287. },
  36288. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  36289. if (radius === (radius | 0)) {
  36290. this.verticalCornerRadius = radius;
  36291. }
  36292. }
  36293. };
  36294. return AnnotationBorderStyle;
  36295. }();
  36296. var WidgetAnnotation = function WidgetAnnotationClosure() {
  36297. function WidgetAnnotation(params) {
  36298. Annotation.call(this, params);
  36299. var dict = params.dict;
  36300. var data = this.data;
  36301. data.annotationType = AnnotationType.WIDGET;
  36302. data.fieldName = this._constructFieldName(dict);
  36303. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  36304. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  36305. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  36306. var fieldType = Util.getInheritableProperty(dict, 'FT');
  36307. data.fieldType = isName(fieldType) ? fieldType.name : null;
  36308. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  36309. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  36310. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  36311. data.fieldFlags = 0;
  36312. }
  36313. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  36314. if (data.fieldType === 'Sig') {
  36315. this.setFlags(AnnotationFlag.HIDDEN);
  36316. }
  36317. }
  36318. Util.inherit(WidgetAnnotation, Annotation, {
  36319. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  36320. if (!dict.has('T') && !dict.has('Parent')) {
  36321. warn('Unknown field name, falling back to empty field name.');
  36322. return '';
  36323. }
  36324. if (!dict.has('Parent')) {
  36325. return stringToPDFString(dict.get('T'));
  36326. }
  36327. var fieldName = [];
  36328. if (dict.has('T')) {
  36329. fieldName.unshift(stringToPDFString(dict.get('T')));
  36330. }
  36331. var loopDict = dict;
  36332. while (loopDict.has('Parent')) {
  36333. loopDict = loopDict.get('Parent');
  36334. if (loopDict.has('T')) {
  36335. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  36336. }
  36337. }
  36338. return fieldName.join('.');
  36339. },
  36340. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  36341. return !!(this.data.fieldFlags & flag);
  36342. }
  36343. });
  36344. return WidgetAnnotation;
  36345. }();
  36346. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  36347. function TextWidgetAnnotation(params) {
  36348. WidgetAnnotation.call(this, params);
  36349. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  36350. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  36351. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  36352. alignment = null;
  36353. }
  36354. this.data.textAlignment = alignment;
  36355. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  36356. if (!isInt(maximumLength) || maximumLength < 0) {
  36357. maximumLength = null;
  36358. }
  36359. this.data.maxLen = maximumLength;
  36360. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  36361. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  36362. }
  36363. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  36364. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36365. var operatorList = new OperatorList();
  36366. if (renderForms) {
  36367. return Promise.resolve(operatorList);
  36368. }
  36369. if (this.appearance) {
  36370. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36371. }
  36372. if (!this.data.defaultAppearance) {
  36373. return Promise.resolve(operatorList);
  36374. }
  36375. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  36376. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  36377. return operatorList;
  36378. });
  36379. }
  36380. });
  36381. return TextWidgetAnnotation;
  36382. }();
  36383. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  36384. function ButtonWidgetAnnotation(params) {
  36385. WidgetAnnotation.call(this, params);
  36386. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36387. if (this.data.checkBox) {
  36388. if (!isName(this.data.fieldValue)) {
  36389. return;
  36390. }
  36391. this.data.fieldValue = this.data.fieldValue.name;
  36392. }
  36393. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36394. if (this.data.radioButton) {
  36395. this.data.fieldValue = this.data.buttonValue = null;
  36396. var fieldParent = params.dict.get('Parent');
  36397. if (isDict(fieldParent) && fieldParent.has('V')) {
  36398. var fieldParentValue = fieldParent.get('V');
  36399. if (isName(fieldParentValue)) {
  36400. this.data.fieldValue = fieldParentValue.name;
  36401. }
  36402. }
  36403. var appearanceStates = params.dict.get('AP');
  36404. if (!isDict(appearanceStates)) {
  36405. return;
  36406. }
  36407. var normalAppearanceState = appearanceStates.get('N');
  36408. if (!isDict(normalAppearanceState)) {
  36409. return;
  36410. }
  36411. var keys = normalAppearanceState.getKeys();
  36412. for (var i = 0, ii = keys.length; i < ii; i++) {
  36413. if (keys[i] !== 'Off') {
  36414. this.data.buttonValue = keys[i];
  36415. break;
  36416. }
  36417. }
  36418. }
  36419. }
  36420. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  36421. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36422. var operatorList = new OperatorList();
  36423. if (renderForms) {
  36424. return Promise.resolve(operatorList);
  36425. }
  36426. if (this.appearance) {
  36427. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36428. }
  36429. return Promise.resolve(operatorList);
  36430. }
  36431. });
  36432. return ButtonWidgetAnnotation;
  36433. }();
  36434. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  36435. function ChoiceWidgetAnnotation(params) {
  36436. WidgetAnnotation.call(this, params);
  36437. this.data.options = [];
  36438. var options = params.dict.get('Opt');
  36439. if (isArray(options)) {
  36440. var xref = params.xref;
  36441. for (var i = 0, ii = options.length; i < ii; i++) {
  36442. var option = xref.fetchIfRef(options[i]);
  36443. var isOptionArray = isArray(option);
  36444. this.data.options[i] = {
  36445. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  36446. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  36447. };
  36448. }
  36449. }
  36450. if (!isArray(this.data.fieldValue)) {
  36451. this.data.fieldValue = [this.data.fieldValue];
  36452. }
  36453. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  36454. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  36455. }
  36456. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  36457. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36458. var operatorList = new OperatorList();
  36459. if (renderForms) {
  36460. return Promise.resolve(operatorList);
  36461. }
  36462. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36463. }
  36464. });
  36465. return ChoiceWidgetAnnotation;
  36466. }();
  36467. var TextAnnotation = function TextAnnotationClosure() {
  36468. var DEFAULT_ICON_SIZE = 22;
  36469. function TextAnnotation(parameters) {
  36470. Annotation.call(this, parameters);
  36471. this.data.annotationType = AnnotationType.TEXT;
  36472. if (this.data.hasAppearance) {
  36473. this.data.name = 'NoIcon';
  36474. } else {
  36475. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  36476. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  36477. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  36478. }
  36479. this._preparePopup(parameters.dict);
  36480. }
  36481. Util.inherit(TextAnnotation, Annotation, {});
  36482. return TextAnnotation;
  36483. }();
  36484. var LinkAnnotation = function LinkAnnotationClosure() {
  36485. function LinkAnnotation(params) {
  36486. Annotation.call(this, params);
  36487. var data = this.data;
  36488. data.annotationType = AnnotationType.LINK;
  36489. Catalog.parseDestDictionary({
  36490. destDict: params.dict,
  36491. resultObj: data,
  36492. docBaseUrl: params.pdfManager.docBaseUrl
  36493. });
  36494. }
  36495. Util.inherit(LinkAnnotation, Annotation, {});
  36496. return LinkAnnotation;
  36497. }();
  36498. var PopupAnnotation = function PopupAnnotationClosure() {
  36499. function PopupAnnotation(parameters) {
  36500. Annotation.call(this, parameters);
  36501. this.data.annotationType = AnnotationType.POPUP;
  36502. var dict = parameters.dict;
  36503. var parentItem = dict.get('Parent');
  36504. if (!parentItem) {
  36505. warn('Popup annotation has a missing or invalid parent annotation.');
  36506. return;
  36507. }
  36508. this.data.parentId = dict.getRaw('Parent').toString();
  36509. this.data.title = stringToPDFString(parentItem.get('T') || '');
  36510. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  36511. if (!parentItem.has('C')) {
  36512. this.data.color = null;
  36513. } else {
  36514. this.setColor(parentItem.getArray('C'));
  36515. this.data.color = this.color;
  36516. }
  36517. if (!this.viewable) {
  36518. var parentFlags = parentItem.get('F');
  36519. if (this._isViewable(parentFlags)) {
  36520. this.setFlags(parentFlags);
  36521. }
  36522. }
  36523. }
  36524. Util.inherit(PopupAnnotation, Annotation, {});
  36525. return PopupAnnotation;
  36526. }();
  36527. var HighlightAnnotation = function HighlightAnnotationClosure() {
  36528. function HighlightAnnotation(parameters) {
  36529. Annotation.call(this, parameters);
  36530. this.data.annotationType = AnnotationType.HIGHLIGHT;
  36531. this._preparePopup(parameters.dict);
  36532. this.data.borderStyle.setWidth(0);
  36533. }
  36534. Util.inherit(HighlightAnnotation, Annotation, {});
  36535. return HighlightAnnotation;
  36536. }();
  36537. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  36538. function UnderlineAnnotation(parameters) {
  36539. Annotation.call(this, parameters);
  36540. this.data.annotationType = AnnotationType.UNDERLINE;
  36541. this._preparePopup(parameters.dict);
  36542. this.data.borderStyle.setWidth(0);
  36543. }
  36544. Util.inherit(UnderlineAnnotation, Annotation, {});
  36545. return UnderlineAnnotation;
  36546. }();
  36547. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  36548. function SquigglyAnnotation(parameters) {
  36549. Annotation.call(this, parameters);
  36550. this.data.annotationType = AnnotationType.SQUIGGLY;
  36551. this._preparePopup(parameters.dict);
  36552. this.data.borderStyle.setWidth(0);
  36553. }
  36554. Util.inherit(SquigglyAnnotation, Annotation, {});
  36555. return SquigglyAnnotation;
  36556. }();
  36557. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  36558. function StrikeOutAnnotation(parameters) {
  36559. Annotation.call(this, parameters);
  36560. this.data.annotationType = AnnotationType.STRIKEOUT;
  36561. this._preparePopup(parameters.dict);
  36562. this.data.borderStyle.setWidth(0);
  36563. }
  36564. Util.inherit(StrikeOutAnnotation, Annotation, {});
  36565. return StrikeOutAnnotation;
  36566. }();
  36567. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  36568. function FileAttachmentAnnotation(parameters) {
  36569. Annotation.call(this, parameters);
  36570. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  36571. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  36572. this.data.file = file.serializable;
  36573. this._preparePopup(parameters.dict);
  36574. }
  36575. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  36576. return FileAttachmentAnnotation;
  36577. }();
  36578. exports.Annotation = Annotation;
  36579. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  36580. exports.AnnotationFactory = AnnotationFactory;
  36581. /***/ }),
  36582. /* 21 */
  36583. /***/ (function(module, exports, __w_pdfjs_require__) {
  36584. "use strict";
  36585. var sharedUtil = __w_pdfjs_require__(0);
  36586. var warn = sharedUtil.warn;
  36587. var baseTypes = [
  36588. 'BN',
  36589. 'BN',
  36590. 'BN',
  36591. 'BN',
  36592. 'BN',
  36593. 'BN',
  36594. 'BN',
  36595. 'BN',
  36596. 'BN',
  36597. 'S',
  36598. 'B',
  36599. 'S',
  36600. 'WS',
  36601. 'B',
  36602. 'BN',
  36603. 'BN',
  36604. 'BN',
  36605. 'BN',
  36606. 'BN',
  36607. 'BN',
  36608. 'BN',
  36609. 'BN',
  36610. 'BN',
  36611. 'BN',
  36612. 'BN',
  36613. 'BN',
  36614. 'BN',
  36615. 'BN',
  36616. 'B',
  36617. 'B',
  36618. 'B',
  36619. 'S',
  36620. 'WS',
  36621. 'ON',
  36622. 'ON',
  36623. 'ET',
  36624. 'ET',
  36625. 'ET',
  36626. 'ON',
  36627. 'ON',
  36628. 'ON',
  36629. 'ON',
  36630. 'ON',
  36631. 'ES',
  36632. 'CS',
  36633. 'ES',
  36634. 'CS',
  36635. 'CS',
  36636. 'EN',
  36637. 'EN',
  36638. 'EN',
  36639. 'EN',
  36640. 'EN',
  36641. 'EN',
  36642. 'EN',
  36643. 'EN',
  36644. 'EN',
  36645. 'EN',
  36646. 'CS',
  36647. 'ON',
  36648. 'ON',
  36649. 'ON',
  36650. 'ON',
  36651. 'ON',
  36652. 'ON',
  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. 'L',
  36676. 'L',
  36677. 'L',
  36678. 'L',
  36679. 'ON',
  36680. 'ON',
  36681. 'ON',
  36682. 'ON',
  36683. 'ON',
  36684. 'ON',
  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. 'L',
  36708. 'L',
  36709. 'L',
  36710. 'L',
  36711. 'ON',
  36712. 'ON',
  36713. 'ON',
  36714. 'ON',
  36715. 'BN',
  36716. 'BN',
  36717. 'BN',
  36718. 'BN',
  36719. 'BN',
  36720. 'BN',
  36721. 'B',
  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. 'BN',
  36745. 'BN',
  36746. 'BN',
  36747. 'BN',
  36748. 'CS',
  36749. 'ON',
  36750. 'ET',
  36751. 'ET',
  36752. 'ET',
  36753. 'ET',
  36754. 'ON',
  36755. 'ON',
  36756. 'ON',
  36757. 'ON',
  36758. 'L',
  36759. 'ON',
  36760. 'ON',
  36761. 'BN',
  36762. 'ON',
  36763. 'ON',
  36764. 'ET',
  36765. 'ET',
  36766. 'EN',
  36767. 'EN',
  36768. 'ON',
  36769. 'L',
  36770. 'ON',
  36771. 'ON',
  36772. 'ON',
  36773. 'EN',
  36774. 'L',
  36775. 'ON',
  36776. 'ON',
  36777. 'ON',
  36778. 'ON',
  36779. 'ON',
  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. 'L',
  36800. 'L',
  36801. 'L',
  36802. 'L',
  36803. 'ON',
  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. 'L',
  36832. 'L',
  36833. 'L',
  36834. 'L',
  36835. 'ON',
  36836. 'L',
  36837. 'L',
  36838. 'L',
  36839. 'L',
  36840. 'L',
  36841. 'L',
  36842. 'L',
  36843. 'L'
  36844. ];
  36845. var arabicTypes = [
  36846. 'AN',
  36847. 'AN',
  36848. 'AN',
  36849. 'AN',
  36850. 'AN',
  36851. 'AN',
  36852. 'ON',
  36853. 'ON',
  36854. 'AL',
  36855. 'ET',
  36856. 'ET',
  36857. 'AL',
  36858. 'CS',
  36859. 'AL',
  36860. 'ON',
  36861. 'ON',
  36862. 'NSM',
  36863. 'NSM',
  36864. 'NSM',
  36865. 'NSM',
  36866. 'NSM',
  36867. 'NSM',
  36868. 'NSM',
  36869. 'NSM',
  36870. 'NSM',
  36871. 'NSM',
  36872. 'NSM',
  36873. 'AL',
  36874. 'AL',
  36875. '',
  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. 'AL',
  36918. 'AL',
  36919. 'AL',
  36920. 'AL',
  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. 'NSM',
  36939. 'NSM',
  36940. 'NSM',
  36941. 'NSM',
  36942. 'AN',
  36943. 'AN',
  36944. 'AN',
  36945. 'AN',
  36946. 'AN',
  36947. 'AN',
  36948. 'AN',
  36949. 'AN',
  36950. 'AN',
  36951. 'AN',
  36952. 'ET',
  36953. 'AN',
  36954. 'AN',
  36955. 'AL',
  36956. 'AL',
  36957. 'AL',
  36958. 'NSM',
  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. 'AL',
  37057. 'AL',
  37058. 'AL',
  37059. 'AL',
  37060. 'NSM',
  37061. 'NSM',
  37062. 'NSM',
  37063. 'NSM',
  37064. 'NSM',
  37065. 'NSM',
  37066. 'NSM',
  37067. 'AN',
  37068. 'ON',
  37069. 'NSM',
  37070. 'NSM',
  37071. 'NSM',
  37072. 'NSM',
  37073. 'NSM',
  37074. 'NSM',
  37075. 'AL',
  37076. 'AL',
  37077. 'NSM',
  37078. 'NSM',
  37079. 'ON',
  37080. 'NSM',
  37081. 'NSM',
  37082. 'NSM',
  37083. 'NSM',
  37084. 'AL',
  37085. 'AL',
  37086. 'EN',
  37087. 'EN',
  37088. 'EN',
  37089. 'EN',
  37090. 'EN',
  37091. 'EN',
  37092. 'EN',
  37093. 'EN',
  37094. 'EN',
  37095. 'EN',
  37096. 'AL',
  37097. 'AL',
  37098. 'AL',
  37099. 'AL',
  37100. 'AL',
  37101. 'AL'
  37102. ];
  37103. function isOdd(i) {
  37104. return (i & 1) !== 0;
  37105. }
  37106. function isEven(i) {
  37107. return (i & 1) === 0;
  37108. }
  37109. function findUnequal(arr, start, value) {
  37110. for (var j = start, jj = arr.length; j < jj; ++j) {
  37111. if (arr[j] !== value) {
  37112. return j;
  37113. }
  37114. }
  37115. return j;
  37116. }
  37117. function setValues(arr, start, end, value) {
  37118. for (var j = start; j < end; ++j) {
  37119. arr[j] = value;
  37120. }
  37121. }
  37122. function reverseValues(arr, start, end) {
  37123. for (var i = start, j = end - 1; i < j; ++i, --j) {
  37124. var temp = arr[i];
  37125. arr[i] = arr[j];
  37126. arr[j] = temp;
  37127. }
  37128. }
  37129. function createBidiText(str, isLTR, vertical) {
  37130. return {
  37131. str: str,
  37132. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  37133. };
  37134. }
  37135. var chars = [];
  37136. var types = [];
  37137. function bidi(str, startLevel, vertical) {
  37138. var isLTR = true;
  37139. var strLength = str.length;
  37140. if (strLength === 0 || vertical) {
  37141. return createBidiText(str, isLTR, vertical);
  37142. }
  37143. chars.length = strLength;
  37144. types.length = strLength;
  37145. var numBidi = 0;
  37146. var i, ii;
  37147. for (i = 0; i < strLength; ++i) {
  37148. chars[i] = str.charAt(i);
  37149. var charCode = str.charCodeAt(i);
  37150. var charType = 'L';
  37151. if (charCode <= 0x00ff) {
  37152. charType = baseTypes[charCode];
  37153. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  37154. charType = 'R';
  37155. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  37156. charType = arabicTypes[charCode & 0xff];
  37157. if (!charType) {
  37158. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  37159. }
  37160. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  37161. charType = 'AL';
  37162. }
  37163. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  37164. numBidi++;
  37165. }
  37166. types[i] = charType;
  37167. }
  37168. if (numBidi === 0) {
  37169. isLTR = true;
  37170. return createBidiText(str, isLTR);
  37171. }
  37172. if (startLevel === -1) {
  37173. if (numBidi / strLength < 0.3) {
  37174. isLTR = true;
  37175. startLevel = 0;
  37176. } else {
  37177. isLTR = false;
  37178. startLevel = 1;
  37179. }
  37180. }
  37181. var levels = [];
  37182. for (i = 0; i < strLength; ++i) {
  37183. levels[i] = startLevel;
  37184. }
  37185. var e = isOdd(startLevel) ? 'R' : 'L';
  37186. var sor = e;
  37187. var eor = sor;
  37188. var lastType = sor;
  37189. for (i = 0; i < strLength; ++i) {
  37190. if (types[i] === 'NSM') {
  37191. types[i] = lastType;
  37192. } else {
  37193. lastType = types[i];
  37194. }
  37195. }
  37196. lastType = sor;
  37197. var t;
  37198. for (i = 0; i < strLength; ++i) {
  37199. t = types[i];
  37200. if (t === 'EN') {
  37201. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  37202. } else if (t === 'R' || t === 'L' || t === 'AL') {
  37203. lastType = t;
  37204. }
  37205. }
  37206. for (i = 0; i < strLength; ++i) {
  37207. t = types[i];
  37208. if (t === 'AL') {
  37209. types[i] = 'R';
  37210. }
  37211. }
  37212. for (i = 1; i < strLength - 1; ++i) {
  37213. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  37214. types[i] = 'EN';
  37215. }
  37216. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  37217. types[i] = types[i - 1];
  37218. }
  37219. }
  37220. for (i = 0; i < strLength; ++i) {
  37221. if (types[i] === 'EN') {
  37222. var j;
  37223. for (j = i - 1; j >= 0; --j) {
  37224. if (types[j] !== 'ET') {
  37225. break;
  37226. }
  37227. types[j] = 'EN';
  37228. }
  37229. for (j = i + 1; j < strLength; ++j) {
  37230. if (types[j] !== 'ET') {
  37231. break;
  37232. }
  37233. types[j] = 'EN';
  37234. }
  37235. }
  37236. }
  37237. for (i = 0; i < strLength; ++i) {
  37238. t = types[i];
  37239. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  37240. types[i] = 'ON';
  37241. }
  37242. }
  37243. lastType = sor;
  37244. for (i = 0; i < strLength; ++i) {
  37245. t = types[i];
  37246. if (t === 'EN') {
  37247. types[i] = lastType === 'L' ? 'L' : 'EN';
  37248. } else if (t === 'R' || t === 'L') {
  37249. lastType = t;
  37250. }
  37251. }
  37252. for (i = 0; i < strLength; ++i) {
  37253. if (types[i] === 'ON') {
  37254. var end = findUnequal(types, i + 1, 'ON');
  37255. var before = sor;
  37256. if (i > 0) {
  37257. before = types[i - 1];
  37258. }
  37259. var after = eor;
  37260. if (end + 1 < strLength) {
  37261. after = types[end + 1];
  37262. }
  37263. if (before !== 'L') {
  37264. before = 'R';
  37265. }
  37266. if (after !== 'L') {
  37267. after = 'R';
  37268. }
  37269. if (before === after) {
  37270. setValues(types, i, end, before);
  37271. }
  37272. i = end - 1;
  37273. }
  37274. }
  37275. for (i = 0; i < strLength; ++i) {
  37276. if (types[i] === 'ON') {
  37277. types[i] = e;
  37278. }
  37279. }
  37280. for (i = 0; i < strLength; ++i) {
  37281. t = types[i];
  37282. if (isEven(levels[i])) {
  37283. if (t === 'R') {
  37284. levels[i] += 1;
  37285. } else if (t === 'AN' || t === 'EN') {
  37286. levels[i] += 2;
  37287. }
  37288. } else {
  37289. if (t === 'L' || t === 'AN' || t === 'EN') {
  37290. levels[i] += 1;
  37291. }
  37292. }
  37293. }
  37294. var highestLevel = -1;
  37295. var lowestOddLevel = 99;
  37296. var level;
  37297. for (i = 0, ii = levels.length; i < ii; ++i) {
  37298. level = levels[i];
  37299. if (highestLevel < level) {
  37300. highestLevel = level;
  37301. }
  37302. if (lowestOddLevel > level && isOdd(level)) {
  37303. lowestOddLevel = level;
  37304. }
  37305. }
  37306. for (level = highestLevel; level >= lowestOddLevel; --level) {
  37307. var start = -1;
  37308. for (i = 0, ii = levels.length; i < ii; ++i) {
  37309. if (levels[i] < level) {
  37310. if (start >= 0) {
  37311. reverseValues(chars, start, i);
  37312. start = -1;
  37313. }
  37314. } else if (start < 0) {
  37315. start = i;
  37316. }
  37317. }
  37318. if (start >= 0) {
  37319. reverseValues(chars, start, levels.length);
  37320. }
  37321. }
  37322. for (i = 0, ii = chars.length; i < ii; ++i) {
  37323. var ch = chars[i];
  37324. if (ch === '<' || ch === '>') {
  37325. chars[i] = '';
  37326. }
  37327. }
  37328. return createBidiText(chars.join(''), isLTR);
  37329. }
  37330. exports.bidi = bidi;
  37331. /***/ }),
  37332. /* 22 */
  37333. /***/ (function(module, exports, __w_pdfjs_require__) {
  37334. "use strict";
  37335. var ISOAdobeCharset = [
  37336. '.notdef',
  37337. 'space',
  37338. 'exclam',
  37339. 'quotedbl',
  37340. 'numbersign',
  37341. 'dollar',
  37342. 'percent',
  37343. 'ampersand',
  37344. 'quoteright',
  37345. 'parenleft',
  37346. 'parenright',
  37347. 'asterisk',
  37348. 'plus',
  37349. 'comma',
  37350. 'hyphen',
  37351. 'period',
  37352. 'slash',
  37353. 'zero',
  37354. 'one',
  37355. 'two',
  37356. 'three',
  37357. 'four',
  37358. 'five',
  37359. 'six',
  37360. 'seven',
  37361. 'eight',
  37362. 'nine',
  37363. 'colon',
  37364. 'semicolon',
  37365. 'less',
  37366. 'equal',
  37367. 'greater',
  37368. 'question',
  37369. 'at',
  37370. 'A',
  37371. 'B',
  37372. 'C',
  37373. 'D',
  37374. 'E',
  37375. 'F',
  37376. 'G',
  37377. 'H',
  37378. 'I',
  37379. 'J',
  37380. 'K',
  37381. 'L',
  37382. 'M',
  37383. 'N',
  37384. 'O',
  37385. 'P',
  37386. 'Q',
  37387. 'R',
  37388. 'S',
  37389. 'T',
  37390. 'U',
  37391. 'V',
  37392. 'W',
  37393. 'X',
  37394. 'Y',
  37395. 'Z',
  37396. 'bracketleft',
  37397. 'backslash',
  37398. 'bracketright',
  37399. 'asciicircum',
  37400. 'underscore',
  37401. 'quoteleft',
  37402. 'a',
  37403. 'b',
  37404. 'c',
  37405. 'd',
  37406. 'e',
  37407. 'f',
  37408. 'g',
  37409. 'h',
  37410. 'i',
  37411. 'j',
  37412. 'k',
  37413. 'l',
  37414. 'm',
  37415. 'n',
  37416. 'o',
  37417. 'p',
  37418. 'q',
  37419. 'r',
  37420. 's',
  37421. 't',
  37422. 'u',
  37423. 'v',
  37424. 'w',
  37425. 'x',
  37426. 'y',
  37427. 'z',
  37428. 'braceleft',
  37429. 'bar',
  37430. 'braceright',
  37431. 'asciitilde',
  37432. 'exclamdown',
  37433. 'cent',
  37434. 'sterling',
  37435. 'fraction',
  37436. 'yen',
  37437. 'florin',
  37438. 'section',
  37439. 'currency',
  37440. 'quotesingle',
  37441. 'quotedblleft',
  37442. 'guillemotleft',
  37443. 'guilsinglleft',
  37444. 'guilsinglright',
  37445. 'fi',
  37446. 'fl',
  37447. 'endash',
  37448. 'dagger',
  37449. 'daggerdbl',
  37450. 'periodcentered',
  37451. 'paragraph',
  37452. 'bullet',
  37453. 'quotesinglbase',
  37454. 'quotedblbase',
  37455. 'quotedblright',
  37456. 'guillemotright',
  37457. 'ellipsis',
  37458. 'perthousand',
  37459. 'questiondown',
  37460. 'grave',
  37461. 'acute',
  37462. 'circumflex',
  37463. 'tilde',
  37464. 'macron',
  37465. 'breve',
  37466. 'dotaccent',
  37467. 'dieresis',
  37468. 'ring',
  37469. 'cedilla',
  37470. 'hungarumlaut',
  37471. 'ogonek',
  37472. 'caron',
  37473. 'emdash',
  37474. 'AE',
  37475. 'ordfeminine',
  37476. 'Lslash',
  37477. 'Oslash',
  37478. 'OE',
  37479. 'ordmasculine',
  37480. 'ae',
  37481. 'dotlessi',
  37482. 'lslash',
  37483. 'oslash',
  37484. 'oe',
  37485. 'germandbls',
  37486. 'onesuperior',
  37487. 'logicalnot',
  37488. 'mu',
  37489. 'trademark',
  37490. 'Eth',
  37491. 'onehalf',
  37492. 'plusminus',
  37493. 'Thorn',
  37494. 'onequarter',
  37495. 'divide',
  37496. 'brokenbar',
  37497. 'degree',
  37498. 'thorn',
  37499. 'threequarters',
  37500. 'twosuperior',
  37501. 'registered',
  37502. 'minus',
  37503. 'eth',
  37504. 'multiply',
  37505. 'threesuperior',
  37506. 'copyright',
  37507. 'Aacute',
  37508. 'Acircumflex',
  37509. 'Adieresis',
  37510. 'Agrave',
  37511. 'Aring',
  37512. 'Atilde',
  37513. 'Ccedilla',
  37514. 'Eacute',
  37515. 'Ecircumflex',
  37516. 'Edieresis',
  37517. 'Egrave',
  37518. 'Iacute',
  37519. 'Icircumflex',
  37520. 'Idieresis',
  37521. 'Igrave',
  37522. 'Ntilde',
  37523. 'Oacute',
  37524. 'Ocircumflex',
  37525. 'Odieresis',
  37526. 'Ograve',
  37527. 'Otilde',
  37528. 'Scaron',
  37529. 'Uacute',
  37530. 'Ucircumflex',
  37531. 'Udieresis',
  37532. 'Ugrave',
  37533. 'Yacute',
  37534. 'Ydieresis',
  37535. 'Zcaron',
  37536. 'aacute',
  37537. 'acircumflex',
  37538. 'adieresis',
  37539. 'agrave',
  37540. 'aring',
  37541. 'atilde',
  37542. 'ccedilla',
  37543. 'eacute',
  37544. 'ecircumflex',
  37545. 'edieresis',
  37546. 'egrave',
  37547. 'iacute',
  37548. 'icircumflex',
  37549. 'idieresis',
  37550. 'igrave',
  37551. 'ntilde',
  37552. 'oacute',
  37553. 'ocircumflex',
  37554. 'odieresis',
  37555. 'ograve',
  37556. 'otilde',
  37557. 'scaron',
  37558. 'uacute',
  37559. 'ucircumflex',
  37560. 'udieresis',
  37561. 'ugrave',
  37562. 'yacute',
  37563. 'ydieresis',
  37564. 'zcaron'
  37565. ];
  37566. var ExpertCharset = [
  37567. '.notdef',
  37568. 'space',
  37569. 'exclamsmall',
  37570. 'Hungarumlautsmall',
  37571. 'dollaroldstyle',
  37572. 'dollarsuperior',
  37573. 'ampersandsmall',
  37574. 'Acutesmall',
  37575. 'parenleftsuperior',
  37576. 'parenrightsuperior',
  37577. 'twodotenleader',
  37578. 'onedotenleader',
  37579. 'comma',
  37580. 'hyphen',
  37581. 'period',
  37582. 'fraction',
  37583. 'zerooldstyle',
  37584. 'oneoldstyle',
  37585. 'twooldstyle',
  37586. 'threeoldstyle',
  37587. 'fouroldstyle',
  37588. 'fiveoldstyle',
  37589. 'sixoldstyle',
  37590. 'sevenoldstyle',
  37591. 'eightoldstyle',
  37592. 'nineoldstyle',
  37593. 'colon',
  37594. 'semicolon',
  37595. 'commasuperior',
  37596. 'threequartersemdash',
  37597. 'periodsuperior',
  37598. 'questionsmall',
  37599. 'asuperior',
  37600. 'bsuperior',
  37601. 'centsuperior',
  37602. 'dsuperior',
  37603. 'esuperior',
  37604. 'isuperior',
  37605. 'lsuperior',
  37606. 'msuperior',
  37607. 'nsuperior',
  37608. 'osuperior',
  37609. 'rsuperior',
  37610. 'ssuperior',
  37611. 'tsuperior',
  37612. 'ff',
  37613. 'fi',
  37614. 'fl',
  37615. 'ffi',
  37616. 'ffl',
  37617. 'parenleftinferior',
  37618. 'parenrightinferior',
  37619. 'Circumflexsmall',
  37620. 'hyphensuperior',
  37621. 'Gravesmall',
  37622. 'Asmall',
  37623. 'Bsmall',
  37624. 'Csmall',
  37625. 'Dsmall',
  37626. 'Esmall',
  37627. 'Fsmall',
  37628. 'Gsmall',
  37629. 'Hsmall',
  37630. 'Ismall',
  37631. 'Jsmall',
  37632. 'Ksmall',
  37633. 'Lsmall',
  37634. 'Msmall',
  37635. 'Nsmall',
  37636. 'Osmall',
  37637. 'Psmall',
  37638. 'Qsmall',
  37639. 'Rsmall',
  37640. 'Ssmall',
  37641. 'Tsmall',
  37642. 'Usmall',
  37643. 'Vsmall',
  37644. 'Wsmall',
  37645. 'Xsmall',
  37646. 'Ysmall',
  37647. 'Zsmall',
  37648. 'colonmonetary',
  37649. 'onefitted',
  37650. 'rupiah',
  37651. 'Tildesmall',
  37652. 'exclamdownsmall',
  37653. 'centoldstyle',
  37654. 'Lslashsmall',
  37655. 'Scaronsmall',
  37656. 'Zcaronsmall',
  37657. 'Dieresissmall',
  37658. 'Brevesmall',
  37659. 'Caronsmall',
  37660. 'Dotaccentsmall',
  37661. 'Macronsmall',
  37662. 'figuredash',
  37663. 'hypheninferior',
  37664. 'Ogoneksmall',
  37665. 'Ringsmall',
  37666. 'Cedillasmall',
  37667. 'onequarter',
  37668. 'onehalf',
  37669. 'threequarters',
  37670. 'questiondownsmall',
  37671. 'oneeighth',
  37672. 'threeeighths',
  37673. 'fiveeighths',
  37674. 'seveneighths',
  37675. 'onethird',
  37676. 'twothirds',
  37677. 'zerosuperior',
  37678. 'onesuperior',
  37679. 'twosuperior',
  37680. 'threesuperior',
  37681. 'foursuperior',
  37682. 'fivesuperior',
  37683. 'sixsuperior',
  37684. 'sevensuperior',
  37685. 'eightsuperior',
  37686. 'ninesuperior',
  37687. 'zeroinferior',
  37688. 'oneinferior',
  37689. 'twoinferior',
  37690. 'threeinferior',
  37691. 'fourinferior',
  37692. 'fiveinferior',
  37693. 'sixinferior',
  37694. 'seveninferior',
  37695. 'eightinferior',
  37696. 'nineinferior',
  37697. 'centinferior',
  37698. 'dollarinferior',
  37699. 'periodinferior',
  37700. 'commainferior',
  37701. 'Agravesmall',
  37702. 'Aacutesmall',
  37703. 'Acircumflexsmall',
  37704. 'Atildesmall',
  37705. 'Adieresissmall',
  37706. 'Aringsmall',
  37707. 'AEsmall',
  37708. 'Ccedillasmall',
  37709. 'Egravesmall',
  37710. 'Eacutesmall',
  37711. 'Ecircumflexsmall',
  37712. 'Edieresissmall',
  37713. 'Igravesmall',
  37714. 'Iacutesmall',
  37715. 'Icircumflexsmall',
  37716. 'Idieresissmall',
  37717. 'Ethsmall',
  37718. 'Ntildesmall',
  37719. 'Ogravesmall',
  37720. 'Oacutesmall',
  37721. 'Ocircumflexsmall',
  37722. 'Otildesmall',
  37723. 'Odieresissmall',
  37724. 'OEsmall',
  37725. 'Oslashsmall',
  37726. 'Ugravesmall',
  37727. 'Uacutesmall',
  37728. 'Ucircumflexsmall',
  37729. 'Udieresissmall',
  37730. 'Yacutesmall',
  37731. 'Thornsmall',
  37732. 'Ydieresissmall'
  37733. ];
  37734. var ExpertSubsetCharset = [
  37735. '.notdef',
  37736. 'space',
  37737. 'dollaroldstyle',
  37738. 'dollarsuperior',
  37739. 'parenleftsuperior',
  37740. 'parenrightsuperior',
  37741. 'twodotenleader',
  37742. 'onedotenleader',
  37743. 'comma',
  37744. 'hyphen',
  37745. 'period',
  37746. 'fraction',
  37747. 'zerooldstyle',
  37748. 'oneoldstyle',
  37749. 'twooldstyle',
  37750. 'threeoldstyle',
  37751. 'fouroldstyle',
  37752. 'fiveoldstyle',
  37753. 'sixoldstyle',
  37754. 'sevenoldstyle',
  37755. 'eightoldstyle',
  37756. 'nineoldstyle',
  37757. 'colon',
  37758. 'semicolon',
  37759. 'commasuperior',
  37760. 'threequartersemdash',
  37761. 'periodsuperior',
  37762. 'asuperior',
  37763. 'bsuperior',
  37764. 'centsuperior',
  37765. 'dsuperior',
  37766. 'esuperior',
  37767. 'isuperior',
  37768. 'lsuperior',
  37769. 'msuperior',
  37770. 'nsuperior',
  37771. 'osuperior',
  37772. 'rsuperior',
  37773. 'ssuperior',
  37774. 'tsuperior',
  37775. 'ff',
  37776. 'fi',
  37777. 'fl',
  37778. 'ffi',
  37779. 'ffl',
  37780. 'parenleftinferior',
  37781. 'parenrightinferior',
  37782. 'hyphensuperior',
  37783. 'colonmonetary',
  37784. 'onefitted',
  37785. 'rupiah',
  37786. 'centoldstyle',
  37787. 'figuredash',
  37788. 'hypheninferior',
  37789. 'onequarter',
  37790. 'onehalf',
  37791. 'threequarters',
  37792. 'oneeighth',
  37793. 'threeeighths',
  37794. 'fiveeighths',
  37795. 'seveneighths',
  37796. 'onethird',
  37797. 'twothirds',
  37798. 'zerosuperior',
  37799. 'onesuperior',
  37800. 'twosuperior',
  37801. 'threesuperior',
  37802. 'foursuperior',
  37803. 'fivesuperior',
  37804. 'sixsuperior',
  37805. 'sevensuperior',
  37806. 'eightsuperior',
  37807. 'ninesuperior',
  37808. 'zeroinferior',
  37809. 'oneinferior',
  37810. 'twoinferior',
  37811. 'threeinferior',
  37812. 'fourinferior',
  37813. 'fiveinferior',
  37814. 'sixinferior',
  37815. 'seveninferior',
  37816. 'eightinferior',
  37817. 'nineinferior',
  37818. 'centinferior',
  37819. 'dollarinferior',
  37820. 'periodinferior',
  37821. 'commainferior'
  37822. ];
  37823. exports.ISOAdobeCharset = ISOAdobeCharset;
  37824. exports.ExpertCharset = ExpertCharset;
  37825. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  37826. /***/ }),
  37827. /* 23 */
  37828. /***/ (function(module, exports, __w_pdfjs_require__) {
  37829. "use strict";
  37830. var sharedUtil = __w_pdfjs_require__(0);
  37831. var corePrimitives = __w_pdfjs_require__(1);
  37832. var coreStream = __w_pdfjs_require__(2);
  37833. var coreParser = __w_pdfjs_require__(5);
  37834. var Util = sharedUtil.Util;
  37835. var assert = sharedUtil.assert;
  37836. var warn = sharedUtil.warn;
  37837. var error = sharedUtil.error;
  37838. var isInt = sharedUtil.isInt;
  37839. var isString = sharedUtil.isString;
  37840. var MissingDataException = sharedUtil.MissingDataException;
  37841. var isEOF = corePrimitives.isEOF;
  37842. var isName = corePrimitives.isName;
  37843. var isCmd = corePrimitives.isCmd;
  37844. var isStream = corePrimitives.isStream;
  37845. var StringStream = coreStream.StringStream;
  37846. var Lexer = coreParser.Lexer;
  37847. var BUILT_IN_CMAPS = [
  37848. 'Adobe-GB1-UCS2',
  37849. 'Adobe-CNS1-UCS2',
  37850. 'Adobe-Japan1-UCS2',
  37851. 'Adobe-Korea1-UCS2',
  37852. '78-EUC-H',
  37853. '78-EUC-V',
  37854. '78-H',
  37855. '78-RKSJ-H',
  37856. '78-RKSJ-V',
  37857. '78-V',
  37858. '78ms-RKSJ-H',
  37859. '78ms-RKSJ-V',
  37860. '83pv-RKSJ-H',
  37861. '90ms-RKSJ-H',
  37862. '90ms-RKSJ-V',
  37863. '90msp-RKSJ-H',
  37864. '90msp-RKSJ-V',
  37865. '90pv-RKSJ-H',
  37866. '90pv-RKSJ-V',
  37867. 'Add-H',
  37868. 'Add-RKSJ-H',
  37869. 'Add-RKSJ-V',
  37870. 'Add-V',
  37871. 'Adobe-CNS1-0',
  37872. 'Adobe-CNS1-1',
  37873. 'Adobe-CNS1-2',
  37874. 'Adobe-CNS1-3',
  37875. 'Adobe-CNS1-4',
  37876. 'Adobe-CNS1-5',
  37877. 'Adobe-CNS1-6',
  37878. 'Adobe-GB1-0',
  37879. 'Adobe-GB1-1',
  37880. 'Adobe-GB1-2',
  37881. 'Adobe-GB1-3',
  37882. 'Adobe-GB1-4',
  37883. 'Adobe-GB1-5',
  37884. 'Adobe-Japan1-0',
  37885. 'Adobe-Japan1-1',
  37886. 'Adobe-Japan1-2',
  37887. 'Adobe-Japan1-3',
  37888. 'Adobe-Japan1-4',
  37889. 'Adobe-Japan1-5',
  37890. 'Adobe-Japan1-6',
  37891. 'Adobe-Korea1-0',
  37892. 'Adobe-Korea1-1',
  37893. 'Adobe-Korea1-2',
  37894. 'B5-H',
  37895. 'B5-V',
  37896. 'B5pc-H',
  37897. 'B5pc-V',
  37898. 'CNS-EUC-H',
  37899. 'CNS-EUC-V',
  37900. 'CNS1-H',
  37901. 'CNS1-V',
  37902. 'CNS2-H',
  37903. 'CNS2-V',
  37904. 'ETHK-B5-H',
  37905. 'ETHK-B5-V',
  37906. 'ETen-B5-H',
  37907. 'ETen-B5-V',
  37908. 'ETenms-B5-H',
  37909. 'ETenms-B5-V',
  37910. 'EUC-H',
  37911. 'EUC-V',
  37912. 'Ext-H',
  37913. 'Ext-RKSJ-H',
  37914. 'Ext-RKSJ-V',
  37915. 'Ext-V',
  37916. 'GB-EUC-H',
  37917. 'GB-EUC-V',
  37918. 'GB-H',
  37919. 'GB-V',
  37920. 'GBK-EUC-H',
  37921. 'GBK-EUC-V',
  37922. 'GBK2K-H',
  37923. 'GBK2K-V',
  37924. 'GBKp-EUC-H',
  37925. 'GBKp-EUC-V',
  37926. 'GBT-EUC-H',
  37927. 'GBT-EUC-V',
  37928. 'GBT-H',
  37929. 'GBT-V',
  37930. 'GBTpc-EUC-H',
  37931. 'GBTpc-EUC-V',
  37932. 'GBpc-EUC-H',
  37933. 'GBpc-EUC-V',
  37934. 'H',
  37935. 'HKdla-B5-H',
  37936. 'HKdla-B5-V',
  37937. 'HKdlb-B5-H',
  37938. 'HKdlb-B5-V',
  37939. 'HKgccs-B5-H',
  37940. 'HKgccs-B5-V',
  37941. 'HKm314-B5-H',
  37942. 'HKm314-B5-V',
  37943. 'HKm471-B5-H',
  37944. 'HKm471-B5-V',
  37945. 'HKscs-B5-H',
  37946. 'HKscs-B5-V',
  37947. 'Hankaku',
  37948. 'Hiragana',
  37949. 'KSC-EUC-H',
  37950. 'KSC-EUC-V',
  37951. 'KSC-H',
  37952. 'KSC-Johab-H',
  37953. 'KSC-Johab-V',
  37954. 'KSC-V',
  37955. 'KSCms-UHC-H',
  37956. 'KSCms-UHC-HW-H',
  37957. 'KSCms-UHC-HW-V',
  37958. 'KSCms-UHC-V',
  37959. 'KSCpc-EUC-H',
  37960. 'KSCpc-EUC-V',
  37961. 'Katakana',
  37962. 'NWP-H',
  37963. 'NWP-V',
  37964. 'RKSJ-H',
  37965. 'RKSJ-V',
  37966. 'Roman',
  37967. 'UniCNS-UCS2-H',
  37968. 'UniCNS-UCS2-V',
  37969. 'UniCNS-UTF16-H',
  37970. 'UniCNS-UTF16-V',
  37971. 'UniCNS-UTF32-H',
  37972. 'UniCNS-UTF32-V',
  37973. 'UniCNS-UTF8-H',
  37974. 'UniCNS-UTF8-V',
  37975. 'UniGB-UCS2-H',
  37976. 'UniGB-UCS2-V',
  37977. 'UniGB-UTF16-H',
  37978. 'UniGB-UTF16-V',
  37979. 'UniGB-UTF32-H',
  37980. 'UniGB-UTF32-V',
  37981. 'UniGB-UTF8-H',
  37982. 'UniGB-UTF8-V',
  37983. 'UniJIS-UCS2-H',
  37984. 'UniJIS-UCS2-HW-H',
  37985. 'UniJIS-UCS2-HW-V',
  37986. 'UniJIS-UCS2-V',
  37987. 'UniJIS-UTF16-H',
  37988. 'UniJIS-UTF16-V',
  37989. 'UniJIS-UTF32-H',
  37990. 'UniJIS-UTF32-V',
  37991. 'UniJIS-UTF8-H',
  37992. 'UniJIS-UTF8-V',
  37993. 'UniJIS2004-UTF16-H',
  37994. 'UniJIS2004-UTF16-V',
  37995. 'UniJIS2004-UTF32-H',
  37996. 'UniJIS2004-UTF32-V',
  37997. 'UniJIS2004-UTF8-H',
  37998. 'UniJIS2004-UTF8-V',
  37999. 'UniJISPro-UCS2-HW-V',
  38000. 'UniJISPro-UCS2-V',
  38001. 'UniJISPro-UTF8-V',
  38002. 'UniJISX0213-UTF32-H',
  38003. 'UniJISX0213-UTF32-V',
  38004. 'UniJISX02132004-UTF32-H',
  38005. 'UniJISX02132004-UTF32-V',
  38006. 'UniKS-UCS2-H',
  38007. 'UniKS-UCS2-V',
  38008. 'UniKS-UTF16-H',
  38009. 'UniKS-UTF16-V',
  38010. 'UniKS-UTF32-H',
  38011. 'UniKS-UTF32-V',
  38012. 'UniKS-UTF8-H',
  38013. 'UniKS-UTF8-V',
  38014. 'V',
  38015. 'WP-Symbol'
  38016. ];
  38017. var CMap = function CMapClosure() {
  38018. function CMap(builtInCMap) {
  38019. this.codespaceRanges = [
  38020. [],
  38021. [],
  38022. [],
  38023. []
  38024. ];
  38025. this.numCodespaceRanges = 0;
  38026. this._map = [];
  38027. this.name = '';
  38028. this.vertical = false;
  38029. this.useCMap = null;
  38030. this.builtInCMap = builtInCMap;
  38031. }
  38032. CMap.prototype = {
  38033. addCodespaceRange: function (n, low, high) {
  38034. this.codespaceRanges[n - 1].push(low, high);
  38035. this.numCodespaceRanges++;
  38036. },
  38037. mapCidRange: function (low, high, dstLow) {
  38038. while (low <= high) {
  38039. this._map[low++] = dstLow++;
  38040. }
  38041. },
  38042. mapBfRange: function (low, high, dstLow) {
  38043. var lastByte = dstLow.length - 1;
  38044. while (low <= high) {
  38045. this._map[low++] = dstLow;
  38046. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  38047. }
  38048. },
  38049. mapBfRangeToArray: function (low, high, array) {
  38050. var i = 0, ii = array.length;
  38051. while (low <= high && i < ii) {
  38052. this._map[low] = array[i++];
  38053. ++low;
  38054. }
  38055. },
  38056. mapOne: function (src, dst) {
  38057. this._map[src] = dst;
  38058. },
  38059. lookup: function (code) {
  38060. return this._map[code];
  38061. },
  38062. contains: function (code) {
  38063. return this._map[code] !== undefined;
  38064. },
  38065. forEach: function (callback) {
  38066. var map = this._map;
  38067. var length = map.length;
  38068. var i;
  38069. if (length <= 0x10000) {
  38070. for (i = 0; i < length; i++) {
  38071. if (map[i] !== undefined) {
  38072. callback(i, map[i]);
  38073. }
  38074. }
  38075. } else {
  38076. for (i in this._map) {
  38077. callback(i, map[i]);
  38078. }
  38079. }
  38080. },
  38081. charCodeOf: function (value) {
  38082. return this._map.indexOf(value);
  38083. },
  38084. getMap: function () {
  38085. return this._map;
  38086. },
  38087. readCharCode: function (str, offset, out) {
  38088. var c = 0;
  38089. var codespaceRanges = this.codespaceRanges;
  38090. var codespaceRangesLen = this.codespaceRanges.length;
  38091. for (var n = 0; n < codespaceRangesLen; n++) {
  38092. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  38093. var codespaceRange = codespaceRanges[n];
  38094. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  38095. var low = codespaceRange[k++];
  38096. var high = codespaceRange[k++];
  38097. if (c >= low && c <= high) {
  38098. out.charcode = c;
  38099. out.length = n + 1;
  38100. return;
  38101. }
  38102. }
  38103. }
  38104. out.charcode = 0;
  38105. out.length = 1;
  38106. },
  38107. get length() {
  38108. return this._map.length;
  38109. },
  38110. get isIdentityCMap() {
  38111. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  38112. return false;
  38113. }
  38114. if (this._map.length !== 0x10000) {
  38115. return false;
  38116. }
  38117. for (var i = 0; i < 0x10000; i++) {
  38118. if (this._map[i] !== i) {
  38119. return false;
  38120. }
  38121. }
  38122. return true;
  38123. }
  38124. };
  38125. return CMap;
  38126. }();
  38127. var IdentityCMap = function IdentityCMapClosure() {
  38128. function IdentityCMap(vertical, n) {
  38129. CMap.call(this);
  38130. this.vertical = vertical;
  38131. this.addCodespaceRange(n, 0, 0xffff);
  38132. }
  38133. Util.inherit(IdentityCMap, CMap, {});
  38134. IdentityCMap.prototype = {
  38135. addCodespaceRange: CMap.prototype.addCodespaceRange,
  38136. mapCidRange: function (low, high, dstLow) {
  38137. error('should not call mapCidRange');
  38138. },
  38139. mapBfRange: function (low, high, dstLow) {
  38140. error('should not call mapBfRange');
  38141. },
  38142. mapBfRangeToArray: function (low, high, array) {
  38143. error('should not call mapBfRangeToArray');
  38144. },
  38145. mapOne: function (src, dst) {
  38146. error('should not call mapCidOne');
  38147. },
  38148. lookup: function (code) {
  38149. return isInt(code) && code <= 0xffff ? code : undefined;
  38150. },
  38151. contains: function (code) {
  38152. return isInt(code) && code <= 0xffff;
  38153. },
  38154. forEach: function (callback) {
  38155. for (var i = 0; i <= 0xffff; i++) {
  38156. callback(i, i);
  38157. }
  38158. },
  38159. charCodeOf: function (value) {
  38160. return isInt(value) && value <= 0xffff ? value : -1;
  38161. },
  38162. getMap: function () {
  38163. var map = new Array(0x10000);
  38164. for (var i = 0; i <= 0xffff; i++) {
  38165. map[i] = i;
  38166. }
  38167. return map;
  38168. },
  38169. readCharCode: CMap.prototype.readCharCode,
  38170. get length() {
  38171. return 0x10000;
  38172. },
  38173. get isIdentityCMap() {
  38174. error('should not access .isIdentityCMap');
  38175. }
  38176. };
  38177. return IdentityCMap;
  38178. }();
  38179. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  38180. function fetchBinaryData(url) {
  38181. return new Promise(function (resolve, reject) {
  38182. var request = new XMLHttpRequest();
  38183. request.open('GET', url, true);
  38184. request.responseType = 'arraybuffer';
  38185. request.onreadystatechange = function () {
  38186. if (request.readyState === XMLHttpRequest.DONE) {
  38187. if (!request.response || request.status !== 200 && request.status !== 0) {
  38188. reject(new Error('Unable to get binary cMap at: ' + url));
  38189. } else {
  38190. resolve(new Uint8Array(request.response));
  38191. }
  38192. }
  38193. };
  38194. request.send(null);
  38195. });
  38196. }
  38197. function hexToInt(a, size) {
  38198. var n = 0;
  38199. for (var i = 0; i <= size; i++) {
  38200. n = n << 8 | a[i];
  38201. }
  38202. return n >>> 0;
  38203. }
  38204. function hexToStr(a, size) {
  38205. if (size === 1) {
  38206. return String.fromCharCode(a[0], a[1]);
  38207. }
  38208. if (size === 3) {
  38209. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  38210. }
  38211. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  38212. }
  38213. function addHex(a, b, size) {
  38214. var c = 0;
  38215. for (var i = size; i >= 0; i--) {
  38216. c += a[i] + b[i];
  38217. a[i] = c & 255;
  38218. c >>= 8;
  38219. }
  38220. }
  38221. function incHex(a, size) {
  38222. var c = 1;
  38223. for (var i = size; i >= 0 && c > 0; i--) {
  38224. c += a[i];
  38225. a[i] = c & 255;
  38226. c >>= 8;
  38227. }
  38228. }
  38229. var MAX_NUM_SIZE = 16;
  38230. var MAX_ENCODED_NUM_SIZE = 19;
  38231. function BinaryCMapStream(data) {
  38232. this.buffer = data;
  38233. this.pos = 0;
  38234. this.end = data.length;
  38235. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  38236. }
  38237. BinaryCMapStream.prototype = {
  38238. readByte: function () {
  38239. if (this.pos >= this.end) {
  38240. return -1;
  38241. }
  38242. return this.buffer[this.pos++];
  38243. },
  38244. readNumber: function () {
  38245. var n = 0;
  38246. var last;
  38247. do {
  38248. var b = this.readByte();
  38249. if (b < 0) {
  38250. error('unexpected EOF in bcmap');
  38251. }
  38252. last = !(b & 0x80);
  38253. n = n << 7 | b & 0x7F;
  38254. } while (!last);
  38255. return n;
  38256. },
  38257. readSigned: function () {
  38258. var n = this.readNumber();
  38259. return n & 1 ? ~(n >>> 1) : n >>> 1;
  38260. },
  38261. readHex: function (num, size) {
  38262. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  38263. this.pos += size + 1;
  38264. },
  38265. readHexNumber: function (num, size) {
  38266. var last;
  38267. var stack = this.tmpBuf, sp = 0;
  38268. do {
  38269. var b = this.readByte();
  38270. if (b < 0) {
  38271. error('unexpected EOF in bcmap');
  38272. }
  38273. last = !(b & 0x80);
  38274. stack[sp++] = b & 0x7F;
  38275. } while (!last);
  38276. var i = size, buffer = 0, bufferSize = 0;
  38277. while (i >= 0) {
  38278. while (bufferSize < 8 && stack.length > 0) {
  38279. buffer = stack[--sp] << bufferSize | buffer;
  38280. bufferSize += 7;
  38281. }
  38282. num[i] = buffer & 255;
  38283. i--;
  38284. buffer >>= 8;
  38285. bufferSize -= 8;
  38286. }
  38287. },
  38288. readHexSigned: function (num, size) {
  38289. this.readHexNumber(num, size);
  38290. var sign = num[size] & 1 ? 255 : 0;
  38291. var c = 0;
  38292. for (var i = 0; i <= size; i++) {
  38293. c = (c & 1) << 8 | num[i];
  38294. num[i] = c >> 1 ^ sign;
  38295. }
  38296. },
  38297. readString: function () {
  38298. var len = this.readNumber();
  38299. var s = '';
  38300. for (var i = 0; i < len; i++) {
  38301. s += String.fromCharCode(this.readNumber());
  38302. }
  38303. return s;
  38304. }
  38305. };
  38306. function processBinaryCMap(url, cMap, extend) {
  38307. return fetchBinaryData(url).then(function (data) {
  38308. var stream = new BinaryCMapStream(data);
  38309. var header = stream.readByte();
  38310. cMap.vertical = !!(header & 1);
  38311. var useCMap = null;
  38312. var start = new Uint8Array(MAX_NUM_SIZE);
  38313. var end = new Uint8Array(MAX_NUM_SIZE);
  38314. var char = new Uint8Array(MAX_NUM_SIZE);
  38315. var charCode = new Uint8Array(MAX_NUM_SIZE);
  38316. var tmp = new Uint8Array(MAX_NUM_SIZE);
  38317. var code;
  38318. var b;
  38319. while ((b = stream.readByte()) >= 0) {
  38320. var type = b >> 5;
  38321. if (type === 7) {
  38322. switch (b & 0x1F) {
  38323. case 0:
  38324. stream.readString();
  38325. break;
  38326. case 1:
  38327. useCMap = stream.readString();
  38328. break;
  38329. }
  38330. continue;
  38331. }
  38332. var sequence = !!(b & 0x10);
  38333. var dataSize = b & 15;
  38334. assert(dataSize + 1 <= MAX_NUM_SIZE);
  38335. var ucs2DataSize = 1;
  38336. var subitemsCount = stream.readNumber();
  38337. var i;
  38338. switch (type) {
  38339. case 0:
  38340. stream.readHex(start, dataSize);
  38341. stream.readHexNumber(end, dataSize);
  38342. addHex(end, start, dataSize);
  38343. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38344. for (i = 1; i < subitemsCount; i++) {
  38345. incHex(end, dataSize);
  38346. stream.readHexNumber(start, dataSize);
  38347. addHex(start, end, dataSize);
  38348. stream.readHexNumber(end, dataSize);
  38349. addHex(end, start, dataSize);
  38350. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38351. }
  38352. break;
  38353. case 1:
  38354. stream.readHex(start, dataSize);
  38355. stream.readHexNumber(end, dataSize);
  38356. addHex(end, start, dataSize);
  38357. code = stream.readNumber();
  38358. for (i = 1; i < subitemsCount; i++) {
  38359. incHex(end, dataSize);
  38360. stream.readHexNumber(start, dataSize);
  38361. addHex(start, end, dataSize);
  38362. stream.readHexNumber(end, dataSize);
  38363. addHex(end, start, dataSize);
  38364. code = stream.readNumber();
  38365. }
  38366. break;
  38367. case 2:
  38368. stream.readHex(char, dataSize);
  38369. code = stream.readNumber();
  38370. cMap.mapOne(hexToInt(char, dataSize), code);
  38371. for (i = 1; i < subitemsCount; i++) {
  38372. incHex(char, dataSize);
  38373. if (!sequence) {
  38374. stream.readHexNumber(tmp, dataSize);
  38375. addHex(char, tmp, dataSize);
  38376. }
  38377. code = stream.readSigned() + (code + 1);
  38378. cMap.mapOne(hexToInt(char, dataSize), code);
  38379. }
  38380. break;
  38381. case 3:
  38382. stream.readHex(start, dataSize);
  38383. stream.readHexNumber(end, dataSize);
  38384. addHex(end, start, dataSize);
  38385. code = stream.readNumber();
  38386. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38387. for (i = 1; i < subitemsCount; i++) {
  38388. incHex(end, dataSize);
  38389. if (!sequence) {
  38390. stream.readHexNumber(start, dataSize);
  38391. addHex(start, end, dataSize);
  38392. } else {
  38393. start.set(end);
  38394. }
  38395. stream.readHexNumber(end, dataSize);
  38396. addHex(end, start, dataSize);
  38397. code = stream.readNumber();
  38398. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38399. }
  38400. break;
  38401. case 4:
  38402. stream.readHex(char, ucs2DataSize);
  38403. stream.readHex(charCode, dataSize);
  38404. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38405. for (i = 1; i < subitemsCount; i++) {
  38406. incHex(char, ucs2DataSize);
  38407. if (!sequence) {
  38408. stream.readHexNumber(tmp, ucs2DataSize);
  38409. addHex(char, tmp, ucs2DataSize);
  38410. }
  38411. incHex(charCode, dataSize);
  38412. stream.readHexSigned(tmp, dataSize);
  38413. addHex(charCode, tmp, dataSize);
  38414. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38415. }
  38416. break;
  38417. case 5:
  38418. stream.readHex(start, ucs2DataSize);
  38419. stream.readHexNumber(end, ucs2DataSize);
  38420. addHex(end, start, ucs2DataSize);
  38421. stream.readHex(charCode, dataSize);
  38422. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38423. for (i = 1; i < subitemsCount; i++) {
  38424. incHex(end, ucs2DataSize);
  38425. if (!sequence) {
  38426. stream.readHexNumber(start, ucs2DataSize);
  38427. addHex(start, end, ucs2DataSize);
  38428. } else {
  38429. start.set(end);
  38430. }
  38431. stream.readHexNumber(end, ucs2DataSize);
  38432. addHex(end, start, ucs2DataSize);
  38433. stream.readHex(charCode, dataSize);
  38434. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38435. }
  38436. break;
  38437. default:
  38438. error('Unknown type: ' + type);
  38439. break;
  38440. }
  38441. }
  38442. if (useCMap) {
  38443. return extend(useCMap);
  38444. }
  38445. return cMap;
  38446. });
  38447. }
  38448. function BinaryCMapReader() {
  38449. }
  38450. BinaryCMapReader.prototype = { read: processBinaryCMap };
  38451. return BinaryCMapReader;
  38452. }();
  38453. var CMapFactory = function CMapFactoryClosure() {
  38454. function strToInt(str) {
  38455. var a = 0;
  38456. for (var i = 0; i < str.length; i++) {
  38457. a = a << 8 | str.charCodeAt(i);
  38458. }
  38459. return a >>> 0;
  38460. }
  38461. function expectString(obj) {
  38462. if (!isString(obj)) {
  38463. error('Malformed CMap: expected string.');
  38464. }
  38465. }
  38466. function expectInt(obj) {
  38467. if (!isInt(obj)) {
  38468. error('Malformed CMap: expected int.');
  38469. }
  38470. }
  38471. function parseBfChar(cMap, lexer) {
  38472. while (true) {
  38473. var obj = lexer.getObj();
  38474. if (isEOF(obj)) {
  38475. break;
  38476. }
  38477. if (isCmd(obj, 'endbfchar')) {
  38478. return;
  38479. }
  38480. expectString(obj);
  38481. var src = strToInt(obj);
  38482. obj = lexer.getObj();
  38483. expectString(obj);
  38484. var dst = obj;
  38485. cMap.mapOne(src, dst);
  38486. }
  38487. }
  38488. function parseBfRange(cMap, lexer) {
  38489. while (true) {
  38490. var obj = lexer.getObj();
  38491. if (isEOF(obj)) {
  38492. break;
  38493. }
  38494. if (isCmd(obj, 'endbfrange')) {
  38495. return;
  38496. }
  38497. expectString(obj);
  38498. var low = strToInt(obj);
  38499. obj = lexer.getObj();
  38500. expectString(obj);
  38501. var high = strToInt(obj);
  38502. obj = lexer.getObj();
  38503. if (isInt(obj) || isString(obj)) {
  38504. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  38505. cMap.mapBfRange(low, high, dstLow);
  38506. } else if (isCmd(obj, '[')) {
  38507. obj = lexer.getObj();
  38508. var array = [];
  38509. while (!isCmd(obj, ']') && !isEOF(obj)) {
  38510. array.push(obj);
  38511. obj = lexer.getObj();
  38512. }
  38513. cMap.mapBfRangeToArray(low, high, array);
  38514. } else {
  38515. break;
  38516. }
  38517. }
  38518. error('Invalid bf range.');
  38519. }
  38520. function parseCidChar(cMap, lexer) {
  38521. while (true) {
  38522. var obj = lexer.getObj();
  38523. if (isEOF(obj)) {
  38524. break;
  38525. }
  38526. if (isCmd(obj, 'endcidchar')) {
  38527. return;
  38528. }
  38529. expectString(obj);
  38530. var src = strToInt(obj);
  38531. obj = lexer.getObj();
  38532. expectInt(obj);
  38533. var dst = obj;
  38534. cMap.mapOne(src, dst);
  38535. }
  38536. }
  38537. function parseCidRange(cMap, lexer) {
  38538. while (true) {
  38539. var obj = lexer.getObj();
  38540. if (isEOF(obj)) {
  38541. break;
  38542. }
  38543. if (isCmd(obj, 'endcidrange')) {
  38544. return;
  38545. }
  38546. expectString(obj);
  38547. var low = strToInt(obj);
  38548. obj = lexer.getObj();
  38549. expectString(obj);
  38550. var high = strToInt(obj);
  38551. obj = lexer.getObj();
  38552. expectInt(obj);
  38553. var dstLow = obj;
  38554. cMap.mapCidRange(low, high, dstLow);
  38555. }
  38556. }
  38557. function parseCodespaceRange(cMap, lexer) {
  38558. while (true) {
  38559. var obj = lexer.getObj();
  38560. if (isEOF(obj)) {
  38561. break;
  38562. }
  38563. if (isCmd(obj, 'endcodespacerange')) {
  38564. return;
  38565. }
  38566. if (!isString(obj)) {
  38567. break;
  38568. }
  38569. var low = strToInt(obj);
  38570. obj = lexer.getObj();
  38571. if (!isString(obj)) {
  38572. break;
  38573. }
  38574. var high = strToInt(obj);
  38575. cMap.addCodespaceRange(obj.length, low, high);
  38576. }
  38577. error('Invalid codespace range.');
  38578. }
  38579. function parseWMode(cMap, lexer) {
  38580. var obj = lexer.getObj();
  38581. if (isInt(obj)) {
  38582. cMap.vertical = !!obj;
  38583. }
  38584. }
  38585. function parseCMapName(cMap, lexer) {
  38586. var obj = lexer.getObj();
  38587. if (isName(obj) && isString(obj.name)) {
  38588. cMap.name = obj.name;
  38589. }
  38590. }
  38591. function parseCMap(cMap, lexer, builtInCMapParams, useCMap) {
  38592. var previous;
  38593. var embededUseCMap;
  38594. objLoop:
  38595. while (true) {
  38596. try {
  38597. var obj = lexer.getObj();
  38598. if (isEOF(obj)) {
  38599. break;
  38600. } else if (isName(obj)) {
  38601. if (obj.name === 'WMode') {
  38602. parseWMode(cMap, lexer);
  38603. } else if (obj.name === 'CMapName') {
  38604. parseCMapName(cMap, lexer);
  38605. }
  38606. previous = obj;
  38607. } else if (isCmd(obj)) {
  38608. switch (obj.cmd) {
  38609. case 'endcmap':
  38610. break objLoop;
  38611. case 'usecmap':
  38612. if (isName(previous)) {
  38613. embededUseCMap = previous.name;
  38614. }
  38615. break;
  38616. case 'begincodespacerange':
  38617. parseCodespaceRange(cMap, lexer);
  38618. break;
  38619. case 'beginbfchar':
  38620. parseBfChar(cMap, lexer);
  38621. break;
  38622. case 'begincidchar':
  38623. parseCidChar(cMap, lexer);
  38624. break;
  38625. case 'beginbfrange':
  38626. parseBfRange(cMap, lexer);
  38627. break;
  38628. case 'begincidrange':
  38629. parseCidRange(cMap, lexer);
  38630. break;
  38631. }
  38632. }
  38633. } catch (ex) {
  38634. if (ex instanceof MissingDataException) {
  38635. throw ex;
  38636. }
  38637. warn('Invalid cMap data: ' + ex);
  38638. continue;
  38639. }
  38640. }
  38641. if (!useCMap && embededUseCMap) {
  38642. useCMap = embededUseCMap;
  38643. }
  38644. if (useCMap) {
  38645. return extendCMap(cMap, builtInCMapParams, useCMap);
  38646. }
  38647. return Promise.resolve(cMap);
  38648. }
  38649. function extendCMap(cMap, builtInCMapParams, useCMap) {
  38650. return createBuiltInCMap(useCMap, builtInCMapParams).then(function (newCMap) {
  38651. cMap.useCMap = newCMap;
  38652. if (cMap.numCodespaceRanges === 0) {
  38653. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  38654. for (var i = 0; i < useCodespaceRanges.length; i++) {
  38655. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  38656. }
  38657. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  38658. }
  38659. cMap.useCMap.forEach(function (key, value) {
  38660. if (!cMap.contains(key)) {
  38661. cMap.mapOne(key, cMap.useCMap.lookup(key));
  38662. }
  38663. });
  38664. return cMap;
  38665. });
  38666. }
  38667. function parseBinaryCMap(name, builtInCMapParams) {
  38668. var url = builtInCMapParams.url + name + '.bcmap';
  38669. var cMap = new CMap(true);
  38670. return new BinaryCMapReader().read(url, cMap, function (useCMap) {
  38671. return extendCMap(cMap, builtInCMapParams, useCMap);
  38672. });
  38673. }
  38674. function createBuiltInCMap(name, builtInCMapParams) {
  38675. if (name === 'Identity-H') {
  38676. return Promise.resolve(new IdentityCMap(false, 2));
  38677. } else if (name === 'Identity-V') {
  38678. return Promise.resolve(new IdentityCMap(true, 2));
  38679. }
  38680. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  38681. return Promise.reject(new Error('Unknown cMap name: ' + name));
  38682. }
  38683. assert(builtInCMapParams, 'built-in cMap parameters are not provided');
  38684. if (builtInCMapParams.packed) {
  38685. return parseBinaryCMap(name, builtInCMapParams);
  38686. }
  38687. return new Promise(function (resolve, reject) {
  38688. var url = builtInCMapParams.url + name;
  38689. var request = new XMLHttpRequest();
  38690. request.onreadystatechange = function () {
  38691. if (request.readyState === XMLHttpRequest.DONE) {
  38692. if (request.status === 200 || request.status === 0) {
  38693. var cMap = new CMap(true);
  38694. var lexer = new Lexer(new StringStream(request.responseText));
  38695. parseCMap(cMap, lexer, builtInCMapParams, null).then(function (parsedCMap) {
  38696. resolve(parsedCMap);
  38697. });
  38698. } else {
  38699. reject(new Error('Unable to get cMap at: ' + url));
  38700. }
  38701. }
  38702. };
  38703. request.open('GET', url, true);
  38704. request.send(null);
  38705. });
  38706. }
  38707. return {
  38708. create: function (encoding, builtInCMapParams, useCMap) {
  38709. if (isName(encoding)) {
  38710. return createBuiltInCMap(encoding.name, builtInCMapParams);
  38711. } else if (isStream(encoding)) {
  38712. var cMap = new CMap();
  38713. var lexer = new Lexer(encoding);
  38714. return parseCMap(cMap, lexer, builtInCMapParams, useCMap).then(function (parsedCMap) {
  38715. if (parsedCMap.isIdentityCMap) {
  38716. return createBuiltInCMap(parsedCMap.name, builtInCMapParams);
  38717. }
  38718. return parsedCMap;
  38719. });
  38720. }
  38721. return Promise.reject(new Error('Encoding required.'));
  38722. }
  38723. };
  38724. }();
  38725. exports.CMap = CMap;
  38726. exports.CMapFactory = CMapFactory;
  38727. exports.IdentityCMap = IdentityCMap;
  38728. /***/ }),
  38729. /* 24 */
  38730. /***/ (function(module, exports, __w_pdfjs_require__) {
  38731. "use strict";
  38732. var sharedUtil = __w_pdfjs_require__(0);
  38733. var corePrimitives = __w_pdfjs_require__(1);
  38734. var coreStream = __w_pdfjs_require__(2);
  38735. var coreObj = __w_pdfjs_require__(15);
  38736. var coreParser = __w_pdfjs_require__(5);
  38737. var coreCrypto = __w_pdfjs_require__(12);
  38738. var coreEvaluator = __w_pdfjs_require__(13);
  38739. var coreAnnotation = __w_pdfjs_require__(20);
  38740. var MissingDataException = sharedUtil.MissingDataException;
  38741. var Util = sharedUtil.Util;
  38742. var assert = sharedUtil.assert;
  38743. var error = sharedUtil.error;
  38744. var info = sharedUtil.info;
  38745. var isArray = sharedUtil.isArray;
  38746. var isArrayBuffer = sharedUtil.isArrayBuffer;
  38747. var isNum = sharedUtil.isNum;
  38748. var isString = sharedUtil.isString;
  38749. var shadow = sharedUtil.shadow;
  38750. var stringToBytes = sharedUtil.stringToBytes;
  38751. var stringToPDFString = sharedUtil.stringToPDFString;
  38752. var warn = sharedUtil.warn;
  38753. var isSpace = sharedUtil.isSpace;
  38754. var Dict = corePrimitives.Dict;
  38755. var isDict = corePrimitives.isDict;
  38756. var isName = corePrimitives.isName;
  38757. var isStream = corePrimitives.isStream;
  38758. var NullStream = coreStream.NullStream;
  38759. var Stream = coreStream.Stream;
  38760. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  38761. var Catalog = coreObj.Catalog;
  38762. var ObjectLoader = coreObj.ObjectLoader;
  38763. var XRef = coreObj.XRef;
  38764. var Linearization = coreParser.Linearization;
  38765. var calculateMD5 = coreCrypto.calculateMD5;
  38766. var OperatorList = coreEvaluator.OperatorList;
  38767. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  38768. var Annotation = coreAnnotation.Annotation;
  38769. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  38770. var Page = function PageClosure() {
  38771. var DEFAULT_USER_UNIT = 1.0;
  38772. var LETTER_SIZE_MEDIABOX = [
  38773. 0,
  38774. 0,
  38775. 612,
  38776. 792
  38777. ];
  38778. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) {
  38779. this.pdfManager = pdfManager;
  38780. this.pageIndex = pageIndex;
  38781. this.pageDict = pageDict;
  38782. this.xref = xref;
  38783. this.ref = ref;
  38784. this.fontCache = fontCache;
  38785. this.evaluatorOptions = pdfManager.evaluatorOptions;
  38786. this.resourcesPromise = null;
  38787. var uniquePrefix = 'p' + this.pageIndex + '_';
  38788. var idCounters = { obj: 0 };
  38789. this.idFactory = {
  38790. createObjId: function () {
  38791. return uniquePrefix + ++idCounters.obj;
  38792. }
  38793. };
  38794. }
  38795. Page.prototype = {
  38796. getPageProp: function Page_getPageProp(key) {
  38797. return this.pageDict.get(key);
  38798. },
  38799. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  38800. var dict = this.pageDict, valueArray = null, loopCount = 0;
  38801. var MAX_LOOP_COUNT = 100;
  38802. getArray = getArray || false;
  38803. while (dict) {
  38804. var value = getArray ? dict.getArray(key) : dict.get(key);
  38805. if (value) {
  38806. if (!valueArray) {
  38807. valueArray = [];
  38808. }
  38809. valueArray.push(value);
  38810. }
  38811. if (++loopCount > MAX_LOOP_COUNT) {
  38812. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  38813. break;
  38814. }
  38815. dict = dict.get('Parent');
  38816. }
  38817. if (!valueArray) {
  38818. return Dict.empty;
  38819. }
  38820. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  38821. return valueArray[0];
  38822. }
  38823. return Dict.merge(this.xref, valueArray);
  38824. },
  38825. get content() {
  38826. return this.getPageProp('Contents');
  38827. },
  38828. get resources() {
  38829. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  38830. },
  38831. get mediaBox() {
  38832. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  38833. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  38834. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  38835. }
  38836. return shadow(this, 'mediaBox', mediaBox);
  38837. },
  38838. get cropBox() {
  38839. var cropBox = this.getInheritedPageProp('CropBox', true);
  38840. if (!isArray(cropBox) || cropBox.length !== 4) {
  38841. return shadow(this, 'cropBox', this.mediaBox);
  38842. }
  38843. return shadow(this, 'cropBox', cropBox);
  38844. },
  38845. get userUnit() {
  38846. var obj = this.getPageProp('UserUnit');
  38847. if (!isNum(obj) || obj <= 0) {
  38848. obj = DEFAULT_USER_UNIT;
  38849. }
  38850. return shadow(this, 'userUnit', obj);
  38851. },
  38852. get view() {
  38853. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  38854. if (mediaBox === cropBox) {
  38855. return shadow(this, 'view', mediaBox);
  38856. }
  38857. var intersection = Util.intersect(cropBox, mediaBox);
  38858. return shadow(this, 'view', intersection || mediaBox);
  38859. },
  38860. get rotate() {
  38861. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38862. if (rotate % 90 !== 0) {
  38863. rotate = 0;
  38864. } else if (rotate >= 360) {
  38865. rotate = rotate % 360;
  38866. } else if (rotate < 0) {
  38867. rotate = (rotate % 360 + 360) % 360;
  38868. }
  38869. return shadow(this, 'rotate', rotate);
  38870. },
  38871. getContentStream: function Page_getContentStream() {
  38872. var content = this.content;
  38873. var stream;
  38874. if (isArray(content)) {
  38875. var xref = this.xref;
  38876. var i, n = content.length;
  38877. var streams = [];
  38878. for (i = 0; i < n; ++i) {
  38879. streams.push(xref.fetchIfRef(content[i]));
  38880. }
  38881. stream = new StreamsSequenceStream(streams);
  38882. } else if (isStream(content)) {
  38883. stream = content;
  38884. } else {
  38885. stream = new NullStream();
  38886. }
  38887. return stream;
  38888. },
  38889. loadResources: function Page_loadResources(keys) {
  38890. if (!this.resourcesPromise) {
  38891. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38892. }
  38893. return this.resourcesPromise.then(function resourceSuccess() {
  38894. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38895. return objectLoader.load();
  38896. }.bind(this));
  38897. },
  38898. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38899. var self = this;
  38900. var pdfManager = this.pdfManager;
  38901. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38902. var resourcesPromise = this.loadResources([
  38903. 'ExtGState',
  38904. 'ColorSpace',
  38905. 'Pattern',
  38906. 'Shading',
  38907. 'XObject',
  38908. 'Font'
  38909. ]);
  38910. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.evaluatorOptions);
  38911. var dataPromises = Promise.all([
  38912. contentStreamPromise,
  38913. resourcesPromise
  38914. ]);
  38915. var pageListPromise = dataPromises.then(function (data) {
  38916. var contentStream = data[0];
  38917. var opList = new OperatorList(intent, handler, self.pageIndex);
  38918. handler.send('StartRenderPage', {
  38919. transparency: partialEvaluator.hasBlendModes(self.resources),
  38920. pageIndex: self.pageIndex,
  38921. intent: intent
  38922. });
  38923. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38924. return opList;
  38925. });
  38926. });
  38927. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38928. return Promise.all([
  38929. pageListPromise,
  38930. annotationsPromise
  38931. ]).then(function (datas) {
  38932. var pageOpList = datas[0];
  38933. var annotations = datas[1];
  38934. if (annotations.length === 0) {
  38935. pageOpList.flush(true);
  38936. return pageOpList;
  38937. }
  38938. var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms);
  38939. return annotationsReadyPromise.then(function () {
  38940. pageOpList.flush(true);
  38941. return pageOpList;
  38942. });
  38943. });
  38944. },
  38945. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38946. var handler = {
  38947. on: function nullHandlerOn() {
  38948. },
  38949. send: function nullHandlerSend() {
  38950. }
  38951. };
  38952. var self = this;
  38953. var pdfManager = this.pdfManager;
  38954. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38955. var resourcesPromise = this.loadResources([
  38956. 'ExtGState',
  38957. 'XObject',
  38958. 'Font'
  38959. ]);
  38960. var dataPromises = Promise.all([
  38961. contentStreamPromise,
  38962. resourcesPromise
  38963. ]);
  38964. return dataPromises.then(function (data) {
  38965. var contentStream = data[0];
  38966. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.evaluatorOptions);
  38967. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38968. });
  38969. },
  38970. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38971. var annotations = this.annotations;
  38972. var annotationsData = [];
  38973. for (var i = 0, n = annotations.length; i < n; ++i) {
  38974. if (intent) {
  38975. if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) {
  38976. continue;
  38977. }
  38978. }
  38979. annotationsData.push(annotations[i].data);
  38980. }
  38981. return annotationsData;
  38982. },
  38983. get annotations() {
  38984. var annotations = [];
  38985. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38986. var annotationFactory = new AnnotationFactory();
  38987. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38988. var annotationRef = annotationRefs[i];
  38989. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38990. if (annotation) {
  38991. annotations.push(annotation);
  38992. }
  38993. }
  38994. return shadow(this, 'annotations', annotations);
  38995. }
  38996. };
  38997. return Page;
  38998. }();
  38999. var PDFDocument = function PDFDocumentClosure() {
  39000. var FINGERPRINT_FIRST_BYTES = 1024;
  39001. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  39002. function PDFDocument(pdfManager, arg) {
  39003. var stream;
  39004. if (isStream(arg)) {
  39005. stream = arg;
  39006. } else if (isArrayBuffer(arg)) {
  39007. stream = new Stream(arg);
  39008. } else {
  39009. error('PDFDocument: Unknown argument type');
  39010. }
  39011. assert(stream.length > 0, 'stream must have data');
  39012. this.pdfManager = pdfManager;
  39013. this.stream = stream;
  39014. this.xref = new XRef(stream, pdfManager);
  39015. }
  39016. function find(stream, needle, limit, backwards) {
  39017. var pos = stream.pos;
  39018. var end = stream.end;
  39019. var strBuf = [];
  39020. if (pos + limit > end) {
  39021. limit = end - pos;
  39022. }
  39023. for (var n = 0; n < limit; ++n) {
  39024. strBuf.push(String.fromCharCode(stream.getByte()));
  39025. }
  39026. var str = strBuf.join('');
  39027. stream.pos = pos;
  39028. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  39029. if (index === -1) {
  39030. return false;
  39031. }
  39032. stream.pos += index;
  39033. return true;
  39034. }
  39035. var DocumentInfoValidators = {
  39036. get entries() {
  39037. return shadow(this, 'entries', {
  39038. Title: isString,
  39039. Author: isString,
  39040. Subject: isString,
  39041. Keywords: isString,
  39042. Creator: isString,
  39043. Producer: isString,
  39044. CreationDate: isString,
  39045. ModDate: isString,
  39046. Trapped: isName
  39047. });
  39048. }
  39049. };
  39050. PDFDocument.prototype = {
  39051. parse: function PDFDocument_parse(recoveryMode) {
  39052. this.setup(recoveryMode);
  39053. var version = this.catalog.catDict.get('Version');
  39054. if (isName(version)) {
  39055. this.pdfFormatVersion = version.name;
  39056. }
  39057. try {
  39058. this.acroForm = this.catalog.catDict.get('AcroForm');
  39059. if (this.acroForm) {
  39060. this.xfa = this.acroForm.get('XFA');
  39061. var fields = this.acroForm.get('Fields');
  39062. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  39063. this.acroForm = null;
  39064. }
  39065. }
  39066. } catch (ex) {
  39067. info('Something wrong with AcroForm entry');
  39068. this.acroForm = null;
  39069. }
  39070. },
  39071. get linearization() {
  39072. var linearization = null;
  39073. if (this.stream.length) {
  39074. try {
  39075. linearization = Linearization.create(this.stream);
  39076. } catch (err) {
  39077. if (err instanceof MissingDataException) {
  39078. throw err;
  39079. }
  39080. info(err);
  39081. }
  39082. }
  39083. return shadow(this, 'linearization', linearization);
  39084. },
  39085. get startXRef() {
  39086. var stream = this.stream;
  39087. var startXRef = 0;
  39088. var linearization = this.linearization;
  39089. if (linearization) {
  39090. stream.reset();
  39091. if (find(stream, 'endobj', 1024)) {
  39092. startXRef = stream.pos + 6;
  39093. }
  39094. } else {
  39095. var step = 1024;
  39096. var found = false, pos = stream.end;
  39097. while (!found && pos > 0) {
  39098. pos -= step - 'startxref'.length;
  39099. if (pos < 0) {
  39100. pos = 0;
  39101. }
  39102. stream.pos = pos;
  39103. found = find(stream, 'startxref', step, true);
  39104. }
  39105. if (found) {
  39106. stream.skip(9);
  39107. var ch;
  39108. do {
  39109. ch = stream.getByte();
  39110. } while (isSpace(ch));
  39111. var str = '';
  39112. while (ch >= 0x20 && ch <= 0x39) {
  39113. str += String.fromCharCode(ch);
  39114. ch = stream.getByte();
  39115. }
  39116. startXRef = parseInt(str, 10);
  39117. if (isNaN(startXRef)) {
  39118. startXRef = 0;
  39119. }
  39120. }
  39121. }
  39122. return shadow(this, 'startXRef', startXRef);
  39123. },
  39124. get mainXRefEntriesOffset() {
  39125. var mainXRefEntriesOffset = 0;
  39126. var linearization = this.linearization;
  39127. if (linearization) {
  39128. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  39129. }
  39130. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  39131. },
  39132. checkHeader: function PDFDocument_checkHeader() {
  39133. var stream = this.stream;
  39134. stream.reset();
  39135. if (find(stream, '%PDF-', 1024)) {
  39136. stream.moveStart();
  39137. var MAX_VERSION_LENGTH = 12;
  39138. var version = '', ch;
  39139. while ((ch = stream.getByte()) > 0x20) {
  39140. if (version.length >= MAX_VERSION_LENGTH) {
  39141. break;
  39142. }
  39143. version += String.fromCharCode(ch);
  39144. }
  39145. if (!this.pdfFormatVersion) {
  39146. this.pdfFormatVersion = version.substring(5);
  39147. }
  39148. return;
  39149. }
  39150. },
  39151. parseStartXRef: function PDFDocument_parseStartXRef() {
  39152. var startXRef = this.startXRef;
  39153. this.xref.setStartXRef(startXRef);
  39154. },
  39155. setup: function PDFDocument_setup(recoveryMode) {
  39156. this.xref.parse(recoveryMode);
  39157. var self = this;
  39158. var pageFactory = {
  39159. createPage: function (pageIndex, dict, ref, fontCache) {
  39160. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache);
  39161. }
  39162. };
  39163. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  39164. },
  39165. get numPages() {
  39166. var linearization = this.linearization;
  39167. var num = linearization ? linearization.numPages : this.catalog.numPages;
  39168. return shadow(this, 'numPages', num);
  39169. },
  39170. get documentInfo() {
  39171. var docInfo = {
  39172. PDFFormatVersion: this.pdfFormatVersion,
  39173. IsAcroFormPresent: !!this.acroForm,
  39174. IsXFAPresent: !!this.xfa
  39175. };
  39176. var infoDict;
  39177. try {
  39178. infoDict = this.xref.trailer.get('Info');
  39179. } catch (err) {
  39180. info('The document information dictionary is invalid.');
  39181. }
  39182. if (infoDict) {
  39183. var validEntries = DocumentInfoValidators.entries;
  39184. for (var key in validEntries) {
  39185. if (infoDict.has(key)) {
  39186. var value = infoDict.get(key);
  39187. if (validEntries[key](value)) {
  39188. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  39189. } else {
  39190. info('Bad value in document info for "' + key + '"');
  39191. }
  39192. }
  39193. }
  39194. }
  39195. return shadow(this, 'documentInfo', docInfo);
  39196. },
  39197. get fingerprint() {
  39198. var xref = this.xref, hash, fileID = '';
  39199. var idArray = xref.trailer.get('ID');
  39200. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  39201. hash = stringToBytes(idArray[0]);
  39202. } else {
  39203. if (this.stream.ensureRange) {
  39204. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  39205. }
  39206. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  39207. }
  39208. for (var i = 0, n = hash.length; i < n; i++) {
  39209. var hex = hash[i].toString(16);
  39210. fileID += hex.length === 1 ? '0' + hex : hex;
  39211. }
  39212. return shadow(this, 'fingerprint', fileID);
  39213. },
  39214. getPage: function PDFDocument_getPage(pageIndex) {
  39215. return this.catalog.getPage(pageIndex);
  39216. },
  39217. cleanup: function PDFDocument_cleanup() {
  39218. return this.catalog.cleanup();
  39219. }
  39220. };
  39221. return PDFDocument;
  39222. }();
  39223. exports.Page = Page;
  39224. exports.PDFDocument = PDFDocument;
  39225. /***/ }),
  39226. /* 25 */
  39227. /***/ (function(module, exports, __w_pdfjs_require__) {
  39228. "use strict";
  39229. var sharedUtil = __w_pdfjs_require__(0);
  39230. var coreStream = __w_pdfjs_require__(2);
  39231. var coreGlyphList = __w_pdfjs_require__(7);
  39232. var coreEncodings = __w_pdfjs_require__(4);
  39233. var coreCFFParser = __w_pdfjs_require__(10);
  39234. var Util = sharedUtil.Util;
  39235. var bytesToString = sharedUtil.bytesToString;
  39236. var error = sharedUtil.error;
  39237. var Stream = coreStream.Stream;
  39238. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39239. var StandardEncoding = coreEncodings.StandardEncoding;
  39240. var CFFParser = coreCFFParser.CFFParser;
  39241. var FontRendererFactory = function FontRendererFactoryClosure() {
  39242. function getLong(data, offset) {
  39243. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39244. }
  39245. function getUshort(data, offset) {
  39246. return data[offset] << 8 | data[offset + 1];
  39247. }
  39248. function parseCmap(data, start, end) {
  39249. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39250. var format = getUshort(data, start + offset);
  39251. var ranges, p, i;
  39252. if (format === 4) {
  39253. getUshort(data, start + offset + 2);
  39254. var segCount = getUshort(data, start + offset + 6) >> 1;
  39255. p = start + offset + 14;
  39256. ranges = [];
  39257. for (i = 0; i < segCount; i++, p += 2) {
  39258. ranges[i] = { end: getUshort(data, p) };
  39259. }
  39260. p += 2;
  39261. for (i = 0; i < segCount; i++, p += 2) {
  39262. ranges[i].start = getUshort(data, p);
  39263. }
  39264. for (i = 0; i < segCount; i++, p += 2) {
  39265. ranges[i].idDelta = getUshort(data, p);
  39266. }
  39267. for (i = 0; i < segCount; i++, p += 2) {
  39268. var idOffset = getUshort(data, p);
  39269. if (idOffset === 0) {
  39270. continue;
  39271. }
  39272. ranges[i].ids = [];
  39273. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39274. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39275. idOffset += 2;
  39276. }
  39277. }
  39278. return ranges;
  39279. } else if (format === 12) {
  39280. getLong(data, start + offset + 4);
  39281. var groups = getLong(data, start + offset + 12);
  39282. p = start + offset + 16;
  39283. ranges = [];
  39284. for (i = 0; i < groups; i++) {
  39285. ranges.push({
  39286. start: getLong(data, p),
  39287. end: getLong(data, p + 4),
  39288. idDelta: getLong(data, p + 8) - getLong(data, p)
  39289. });
  39290. p += 12;
  39291. }
  39292. return ranges;
  39293. }
  39294. error('not supported cmap: ' + format);
  39295. }
  39296. function parseCff(data, start, end, seacAnalysisEnabled) {
  39297. var properties = {};
  39298. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39299. var cff = parser.parse();
  39300. return {
  39301. glyphs: cff.charStrings.objects,
  39302. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39303. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  39304. };
  39305. }
  39306. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39307. var itemSize, itemDecode;
  39308. if (isGlyphLocationsLong) {
  39309. itemSize = 4;
  39310. itemDecode = function fontItemDecodeLong(data, offset) {
  39311. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39312. };
  39313. } else {
  39314. itemSize = 2;
  39315. itemDecode = function fontItemDecode(data, offset) {
  39316. return data[offset] << 9 | data[offset + 1] << 1;
  39317. };
  39318. }
  39319. var glyphs = [];
  39320. var startOffset = itemDecode(loca, 0);
  39321. for (var j = itemSize; j < loca.length; j += itemSize) {
  39322. var endOffset = itemDecode(loca, j);
  39323. glyphs.push(glyf.subarray(startOffset, endOffset));
  39324. startOffset = endOffset;
  39325. }
  39326. return glyphs;
  39327. }
  39328. function lookupCmap(ranges, unicode) {
  39329. var code = unicode.charCodeAt(0), gid = 0;
  39330. var l = 0, r = ranges.length - 1;
  39331. while (l < r) {
  39332. var c = l + r + 1 >> 1;
  39333. if (code < ranges[c].start) {
  39334. r = c - 1;
  39335. } else {
  39336. l = c;
  39337. }
  39338. }
  39339. if (ranges[l].start <= code && code <= ranges[l].end) {
  39340. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  39341. }
  39342. return {
  39343. charCode: code,
  39344. glyphId: gid
  39345. };
  39346. }
  39347. function compileGlyf(code, cmds, font) {
  39348. function moveTo(x, y) {
  39349. cmds.push({
  39350. cmd: 'moveTo',
  39351. args: [
  39352. x,
  39353. y
  39354. ]
  39355. });
  39356. }
  39357. function lineTo(x, y) {
  39358. cmds.push({
  39359. cmd: 'lineTo',
  39360. args: [
  39361. x,
  39362. y
  39363. ]
  39364. });
  39365. }
  39366. function quadraticCurveTo(xa, ya, x, y) {
  39367. cmds.push({
  39368. cmd: 'quadraticCurveTo',
  39369. args: [
  39370. xa,
  39371. ya,
  39372. x,
  39373. y
  39374. ]
  39375. });
  39376. }
  39377. var i = 0;
  39378. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39379. var flags;
  39380. var x = 0, y = 0;
  39381. i += 10;
  39382. if (numberOfContours < 0) {
  39383. do {
  39384. flags = code[i] << 8 | code[i + 1];
  39385. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  39386. i += 4;
  39387. var arg1, arg2;
  39388. if (flags & 0x01) {
  39389. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39390. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39391. i += 4;
  39392. } else {
  39393. arg1 = code[i++];
  39394. arg2 = code[i++];
  39395. }
  39396. if (flags & 0x02) {
  39397. x = arg1;
  39398. y = arg2;
  39399. } else {
  39400. x = 0;
  39401. y = 0;
  39402. }
  39403. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  39404. if (flags & 0x08) {
  39405. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39406. i += 2;
  39407. } else if (flags & 0x40) {
  39408. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39409. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39410. i += 4;
  39411. } else if (flags & 0x80) {
  39412. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39413. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39414. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39415. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39416. i += 8;
  39417. }
  39418. var subglyph = font.glyphs[glyphIndex];
  39419. if (subglyph) {
  39420. cmds.push({ cmd: 'save' });
  39421. cmds.push({
  39422. cmd: 'transform',
  39423. args: [
  39424. scaleX,
  39425. scale01,
  39426. scale10,
  39427. scaleY,
  39428. x,
  39429. y
  39430. ]
  39431. });
  39432. compileGlyf(subglyph, cmds, font);
  39433. cmds.push({ cmd: 'restore' });
  39434. }
  39435. } while (flags & 0x20);
  39436. } else {
  39437. var endPtsOfContours = [];
  39438. var j, jj;
  39439. for (j = 0; j < numberOfContours; j++) {
  39440. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39441. i += 2;
  39442. }
  39443. var instructionLength = code[i] << 8 | code[i + 1];
  39444. i += 2 + instructionLength;
  39445. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39446. var points = [];
  39447. while (points.length < numberOfPoints) {
  39448. flags = code[i++];
  39449. var repeat = 1;
  39450. if (flags & 0x08) {
  39451. repeat += code[i++];
  39452. }
  39453. while (repeat-- > 0) {
  39454. points.push({ flags: flags });
  39455. }
  39456. }
  39457. for (j = 0; j < numberOfPoints; j++) {
  39458. switch (points[j].flags & 0x12) {
  39459. case 0x00:
  39460. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39461. i += 2;
  39462. break;
  39463. case 0x02:
  39464. x -= code[i++];
  39465. break;
  39466. case 0x12:
  39467. x += code[i++];
  39468. break;
  39469. }
  39470. points[j].x = x;
  39471. }
  39472. for (j = 0; j < numberOfPoints; j++) {
  39473. switch (points[j].flags & 0x24) {
  39474. case 0x00:
  39475. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39476. i += 2;
  39477. break;
  39478. case 0x04:
  39479. y -= code[i++];
  39480. break;
  39481. case 0x24:
  39482. y += code[i++];
  39483. break;
  39484. }
  39485. points[j].y = y;
  39486. }
  39487. var startPoint = 0;
  39488. for (i = 0; i < numberOfContours; i++) {
  39489. var endPoint = endPtsOfContours[i];
  39490. var contour = points.slice(startPoint, endPoint + 1);
  39491. if (contour[0].flags & 1) {
  39492. contour.push(contour[0]);
  39493. } else if (contour[contour.length - 1].flags & 1) {
  39494. contour.unshift(contour[contour.length - 1]);
  39495. } else {
  39496. var p = {
  39497. flags: 1,
  39498. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39499. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39500. };
  39501. contour.unshift(p);
  39502. contour.push(p);
  39503. }
  39504. moveTo(contour[0].x, contour[0].y);
  39505. for (j = 1, jj = contour.length; j < jj; j++) {
  39506. if (contour[j].flags & 1) {
  39507. lineTo(contour[j].x, contour[j].y);
  39508. } else if (contour[j + 1].flags & 1) {
  39509. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39510. j++;
  39511. } else {
  39512. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39513. }
  39514. }
  39515. startPoint = endPoint + 1;
  39516. }
  39517. }
  39518. }
  39519. function compileCharString(code, cmds, font) {
  39520. var stack = [];
  39521. var x = 0, y = 0;
  39522. var stems = 0;
  39523. function moveTo(x, y) {
  39524. cmds.push({
  39525. cmd: 'moveTo',
  39526. args: [
  39527. x,
  39528. y
  39529. ]
  39530. });
  39531. }
  39532. function lineTo(x, y) {
  39533. cmds.push({
  39534. cmd: 'lineTo',
  39535. args: [
  39536. x,
  39537. y
  39538. ]
  39539. });
  39540. }
  39541. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39542. cmds.push({
  39543. cmd: 'bezierCurveTo',
  39544. args: [
  39545. x1,
  39546. y1,
  39547. x2,
  39548. y2,
  39549. x,
  39550. y
  39551. ]
  39552. });
  39553. }
  39554. function parse(code) {
  39555. var i = 0;
  39556. while (i < code.length) {
  39557. var stackClean = false;
  39558. var v = code[i++];
  39559. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39560. switch (v) {
  39561. case 1:
  39562. stems += stack.length >> 1;
  39563. stackClean = true;
  39564. break;
  39565. case 3:
  39566. stems += stack.length >> 1;
  39567. stackClean = true;
  39568. break;
  39569. case 4:
  39570. y += stack.pop();
  39571. moveTo(x, y);
  39572. stackClean = true;
  39573. break;
  39574. case 5:
  39575. while (stack.length > 0) {
  39576. x += stack.shift();
  39577. y += stack.shift();
  39578. lineTo(x, y);
  39579. }
  39580. break;
  39581. case 6:
  39582. while (stack.length > 0) {
  39583. x += stack.shift();
  39584. lineTo(x, y);
  39585. if (stack.length === 0) {
  39586. break;
  39587. }
  39588. y += stack.shift();
  39589. lineTo(x, y);
  39590. }
  39591. break;
  39592. case 7:
  39593. while (stack.length > 0) {
  39594. y += stack.shift();
  39595. lineTo(x, y);
  39596. if (stack.length === 0) {
  39597. break;
  39598. }
  39599. x += stack.shift();
  39600. lineTo(x, y);
  39601. }
  39602. break;
  39603. case 8:
  39604. while (stack.length > 0) {
  39605. xa = x + stack.shift();
  39606. ya = y + stack.shift();
  39607. xb = xa + stack.shift();
  39608. yb = ya + stack.shift();
  39609. x = xb + stack.shift();
  39610. y = yb + stack.shift();
  39611. bezierCurveTo(xa, ya, xb, yb, x, y);
  39612. }
  39613. break;
  39614. case 10:
  39615. n = stack.pop() + font.subrsBias;
  39616. subrCode = font.subrs[n];
  39617. if (subrCode) {
  39618. parse(subrCode);
  39619. }
  39620. break;
  39621. case 11:
  39622. return;
  39623. case 12:
  39624. v = code[i++];
  39625. switch (v) {
  39626. case 34:
  39627. xa = x + stack.shift();
  39628. xb = xa + stack.shift();
  39629. y1 = y + stack.shift();
  39630. x = xb + stack.shift();
  39631. bezierCurveTo(xa, y, xb, y1, x, y1);
  39632. xa = x + stack.shift();
  39633. xb = xa + stack.shift();
  39634. x = xb + stack.shift();
  39635. bezierCurveTo(xa, y1, xb, y, x, y);
  39636. break;
  39637. case 35:
  39638. xa = x + stack.shift();
  39639. ya = y + stack.shift();
  39640. xb = xa + stack.shift();
  39641. yb = ya + stack.shift();
  39642. x = xb + stack.shift();
  39643. y = yb + stack.shift();
  39644. bezierCurveTo(xa, ya, xb, yb, x, y);
  39645. xa = x + stack.shift();
  39646. ya = y + stack.shift();
  39647. xb = xa + stack.shift();
  39648. yb = ya + stack.shift();
  39649. x = xb + stack.shift();
  39650. y = yb + stack.shift();
  39651. bezierCurveTo(xa, ya, xb, yb, x, y);
  39652. stack.pop();
  39653. break;
  39654. case 36:
  39655. xa = x + stack.shift();
  39656. y1 = y + stack.shift();
  39657. xb = xa + stack.shift();
  39658. y2 = y1 + stack.shift();
  39659. x = xb + stack.shift();
  39660. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39661. xa = x + stack.shift();
  39662. xb = xa + stack.shift();
  39663. y3 = y2 + stack.shift();
  39664. x = xb + stack.shift();
  39665. bezierCurveTo(xa, y2, xb, y3, x, y);
  39666. break;
  39667. case 37:
  39668. var x0 = x, y0 = y;
  39669. xa = x + stack.shift();
  39670. ya = y + stack.shift();
  39671. xb = xa + stack.shift();
  39672. yb = ya + stack.shift();
  39673. x = xb + stack.shift();
  39674. y = yb + stack.shift();
  39675. bezierCurveTo(xa, ya, xb, yb, x, y);
  39676. xa = x + stack.shift();
  39677. ya = y + stack.shift();
  39678. xb = xa + stack.shift();
  39679. yb = ya + stack.shift();
  39680. x = xb;
  39681. y = yb;
  39682. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39683. x += stack.shift();
  39684. } else {
  39685. y += stack.shift();
  39686. }
  39687. bezierCurveTo(xa, ya, xb, yb, x, y);
  39688. break;
  39689. default:
  39690. error('unknown operator: 12 ' + v);
  39691. }
  39692. break;
  39693. case 14:
  39694. if (stack.length >= 4) {
  39695. var achar = stack.pop();
  39696. var bchar = stack.pop();
  39697. y = stack.pop();
  39698. x = stack.pop();
  39699. cmds.push({ cmd: 'save' });
  39700. cmds.push({
  39701. cmd: 'translate',
  39702. args: [
  39703. x,
  39704. y
  39705. ]
  39706. });
  39707. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  39708. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39709. cmds.push({ cmd: 'restore' });
  39710. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  39711. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39712. }
  39713. return;
  39714. case 18:
  39715. stems += stack.length >> 1;
  39716. stackClean = true;
  39717. break;
  39718. case 19:
  39719. stems += stack.length >> 1;
  39720. i += stems + 7 >> 3;
  39721. stackClean = true;
  39722. break;
  39723. case 20:
  39724. stems += stack.length >> 1;
  39725. i += stems + 7 >> 3;
  39726. stackClean = true;
  39727. break;
  39728. case 21:
  39729. y += stack.pop();
  39730. x += stack.pop();
  39731. moveTo(x, y);
  39732. stackClean = true;
  39733. break;
  39734. case 22:
  39735. x += stack.pop();
  39736. moveTo(x, y);
  39737. stackClean = true;
  39738. break;
  39739. case 23:
  39740. stems += stack.length >> 1;
  39741. stackClean = true;
  39742. break;
  39743. case 24:
  39744. while (stack.length > 2) {
  39745. xa = x + stack.shift();
  39746. ya = y + stack.shift();
  39747. xb = xa + stack.shift();
  39748. yb = ya + stack.shift();
  39749. x = xb + stack.shift();
  39750. y = yb + stack.shift();
  39751. bezierCurveTo(xa, ya, xb, yb, x, y);
  39752. }
  39753. x += stack.shift();
  39754. y += stack.shift();
  39755. lineTo(x, y);
  39756. break;
  39757. case 25:
  39758. while (stack.length > 6) {
  39759. x += stack.shift();
  39760. y += stack.shift();
  39761. lineTo(x, y);
  39762. }
  39763. xa = x + stack.shift();
  39764. ya = y + stack.shift();
  39765. xb = xa + stack.shift();
  39766. yb = ya + stack.shift();
  39767. x = xb + stack.shift();
  39768. y = yb + stack.shift();
  39769. bezierCurveTo(xa, ya, xb, yb, x, y);
  39770. break;
  39771. case 26:
  39772. if (stack.length % 2) {
  39773. x += stack.shift();
  39774. }
  39775. while (stack.length > 0) {
  39776. xa = x;
  39777. ya = y + stack.shift();
  39778. xb = xa + stack.shift();
  39779. yb = ya + stack.shift();
  39780. x = xb;
  39781. y = yb + stack.shift();
  39782. bezierCurveTo(xa, ya, xb, yb, x, y);
  39783. }
  39784. break;
  39785. case 27:
  39786. if (stack.length % 2) {
  39787. y += stack.shift();
  39788. }
  39789. while (stack.length > 0) {
  39790. xa = x + stack.shift();
  39791. ya = y;
  39792. xb = xa + stack.shift();
  39793. yb = ya + stack.shift();
  39794. x = xb + stack.shift();
  39795. y = yb;
  39796. bezierCurveTo(xa, ya, xb, yb, x, y);
  39797. }
  39798. break;
  39799. case 28:
  39800. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39801. i += 2;
  39802. break;
  39803. case 29:
  39804. n = stack.pop() + font.gsubrsBias;
  39805. subrCode = font.gsubrs[n];
  39806. if (subrCode) {
  39807. parse(subrCode);
  39808. }
  39809. break;
  39810. case 30:
  39811. while (stack.length > 0) {
  39812. xa = x;
  39813. ya = y + stack.shift();
  39814. xb = xa + stack.shift();
  39815. yb = ya + stack.shift();
  39816. x = xb + stack.shift();
  39817. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39818. bezierCurveTo(xa, ya, xb, yb, x, y);
  39819. if (stack.length === 0) {
  39820. break;
  39821. }
  39822. xa = x + stack.shift();
  39823. ya = y;
  39824. xb = xa + stack.shift();
  39825. yb = ya + stack.shift();
  39826. y = yb + stack.shift();
  39827. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39828. bezierCurveTo(xa, ya, xb, yb, x, y);
  39829. }
  39830. break;
  39831. case 31:
  39832. while (stack.length > 0) {
  39833. xa = x + stack.shift();
  39834. ya = y;
  39835. xb = xa + stack.shift();
  39836. yb = ya + stack.shift();
  39837. y = yb + stack.shift();
  39838. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39839. bezierCurveTo(xa, ya, xb, yb, x, y);
  39840. if (stack.length === 0) {
  39841. break;
  39842. }
  39843. xa = x;
  39844. ya = y + stack.shift();
  39845. xb = xa + stack.shift();
  39846. yb = ya + stack.shift();
  39847. x = xb + stack.shift();
  39848. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39849. bezierCurveTo(xa, ya, xb, yb, x, y);
  39850. }
  39851. break;
  39852. default:
  39853. if (v < 32) {
  39854. error('unknown operator: ' + v);
  39855. }
  39856. if (v < 247) {
  39857. stack.push(v - 139);
  39858. } else if (v < 251) {
  39859. stack.push((v - 247) * 256 + code[i++] + 108);
  39860. } else if (v < 255) {
  39861. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39862. } else {
  39863. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39864. i += 4;
  39865. }
  39866. break;
  39867. }
  39868. if (stackClean) {
  39869. stack.length = 0;
  39870. }
  39871. }
  39872. }
  39873. parse(code);
  39874. }
  39875. var noop = '';
  39876. function CompiledFont(fontMatrix) {
  39877. this.compiledGlyphs = Object.create(null);
  39878. this.compiledCharCodeToGlyphId = Object.create(null);
  39879. this.fontMatrix = fontMatrix;
  39880. }
  39881. CompiledFont.prototype = {
  39882. getPathJs: function (unicode) {
  39883. var cmap = lookupCmap(this.cmap, unicode);
  39884. var fn = this.compiledGlyphs[cmap.glyphId];
  39885. if (!fn) {
  39886. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39887. this.compiledGlyphs[cmap.glyphId] = fn;
  39888. }
  39889. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39890. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39891. }
  39892. return fn;
  39893. },
  39894. compileGlyph: function (code) {
  39895. if (!code || code.length === 0 || code[0] === 14) {
  39896. return noop;
  39897. }
  39898. var cmds = [];
  39899. cmds.push({ cmd: 'save' });
  39900. cmds.push({
  39901. cmd: 'transform',
  39902. args: this.fontMatrix.slice()
  39903. });
  39904. cmds.push({
  39905. cmd: 'scale',
  39906. args: [
  39907. 'size',
  39908. '-size'
  39909. ]
  39910. });
  39911. this.compileGlyphImpl(code, cmds);
  39912. cmds.push({ cmd: 'restore' });
  39913. return cmds;
  39914. },
  39915. compileGlyphImpl: function () {
  39916. error('Children classes should implement this.');
  39917. },
  39918. hasBuiltPath: function (unicode) {
  39919. var cmap = lookupCmap(this.cmap, unicode);
  39920. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39921. }
  39922. };
  39923. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39924. fontMatrix = fontMatrix || [
  39925. 0.000488,
  39926. 0,
  39927. 0,
  39928. 0.000488,
  39929. 0,
  39930. 0
  39931. ];
  39932. CompiledFont.call(this, fontMatrix);
  39933. this.glyphs = glyphs;
  39934. this.cmap = cmap;
  39935. }
  39936. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39937. compileGlyphImpl: function (code, cmds) {
  39938. compileGlyf(code, cmds, this);
  39939. }
  39940. });
  39941. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39942. fontMatrix = fontMatrix || [
  39943. 0.001,
  39944. 0,
  39945. 0,
  39946. 0.001,
  39947. 0,
  39948. 0
  39949. ];
  39950. CompiledFont.call(this, fontMatrix);
  39951. this.glyphs = cffInfo.glyphs;
  39952. this.gsubrs = cffInfo.gsubrs || [];
  39953. this.subrs = cffInfo.subrs || [];
  39954. this.cmap = cmap;
  39955. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39956. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39957. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39958. }
  39959. Util.inherit(Type2Compiled, CompiledFont, {
  39960. compileGlyphImpl: function (code, cmds) {
  39961. compileCharString(code, cmds, this);
  39962. }
  39963. });
  39964. return {
  39965. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39966. var data = new Uint8Array(font.data);
  39967. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39968. var numTables = getUshort(data, 4);
  39969. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39970. var tag = bytesToString(data.subarray(p, p + 4));
  39971. var offset = getLong(data, p + 8);
  39972. var length = getLong(data, p + 12);
  39973. switch (tag) {
  39974. case 'cmap':
  39975. cmap = parseCmap(data, offset, offset + length);
  39976. break;
  39977. case 'glyf':
  39978. glyf = data.subarray(offset, offset + length);
  39979. break;
  39980. case 'loca':
  39981. loca = data.subarray(offset, offset + length);
  39982. break;
  39983. case 'head':
  39984. unitsPerEm = getUshort(data, offset + 18);
  39985. indexToLocFormat = getUshort(data, offset + 50);
  39986. break;
  39987. case 'CFF ':
  39988. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39989. break;
  39990. }
  39991. }
  39992. if (glyf) {
  39993. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39994. 1 / unitsPerEm,
  39995. 0,
  39996. 0,
  39997. 1 / unitsPerEm,
  39998. 0,
  39999. 0
  40000. ];
  40001. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  40002. }
  40003. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  40004. }
  40005. };
  40006. }();
  40007. exports.FontRendererFactory = FontRendererFactory;
  40008. /***/ }),
  40009. /* 26 */
  40010. /***/ (function(module, exports, __w_pdfjs_require__) {
  40011. "use strict";
  40012. var sharedUtil = __w_pdfjs_require__(0);
  40013. var corePrimitives = __w_pdfjs_require__(1);
  40014. var coreStream = __w_pdfjs_require__(2);
  40015. var coreGlyphList = __w_pdfjs_require__(7);
  40016. var coreFontRenderer = __w_pdfjs_require__(25);
  40017. var coreEncodings = __w_pdfjs_require__(4);
  40018. var coreStandardFonts = __w_pdfjs_require__(16);
  40019. var coreUnicode = __w_pdfjs_require__(17);
  40020. var coreType1Parser = __w_pdfjs_require__(35);
  40021. var coreCFFParser = __w_pdfjs_require__(10);
  40022. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  40023. var FontType = sharedUtil.FontType;
  40024. var assert = sharedUtil.assert;
  40025. var bytesToString = sharedUtil.bytesToString;
  40026. var error = sharedUtil.error;
  40027. var info = sharedUtil.info;
  40028. var isArray = sharedUtil.isArray;
  40029. var isInt = sharedUtil.isInt;
  40030. var isNum = sharedUtil.isNum;
  40031. var readUint32 = sharedUtil.readUint32;
  40032. var shadow = sharedUtil.shadow;
  40033. var string32 = sharedUtil.string32;
  40034. var warn = sharedUtil.warn;
  40035. var MissingDataException = sharedUtil.MissingDataException;
  40036. var isSpace = sharedUtil.isSpace;
  40037. var Stream = coreStream.Stream;
  40038. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  40039. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  40040. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  40041. var StandardEncoding = coreEncodings.StandardEncoding;
  40042. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  40043. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  40044. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  40045. var getEncoding = coreEncodings.getEncoding;
  40046. var getStdFontMap = coreStandardFonts.getStdFontMap;
  40047. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  40048. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  40049. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  40050. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  40051. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  40052. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  40053. var Type1Parser = coreType1Parser.Type1Parser;
  40054. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  40055. var CFFParser = coreCFFParser.CFFParser;
  40056. var CFFCompiler = coreCFFParser.CFFCompiler;
  40057. var CFF = coreCFFParser.CFF;
  40058. var CFFHeader = coreCFFParser.CFFHeader;
  40059. var CFFTopDict = coreCFFParser.CFFTopDict;
  40060. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  40061. var CFFStrings = coreCFFParser.CFFStrings;
  40062. var CFFIndex = coreCFFParser.CFFIndex;
  40063. var CFFCharset = coreCFFParser.CFFCharset;
  40064. var PRIVATE_USE_OFFSET_START = 0xE000;
  40065. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  40066. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  40067. var PDF_GLYPH_SPACE_UNITS = 1000;
  40068. var SEAC_ANALYSIS_ENABLED = false;
  40069. var FontFlags = {
  40070. FixedPitch: 1,
  40071. Serif: 2,
  40072. Symbolic: 4,
  40073. Script: 8,
  40074. Nonsymbolic: 32,
  40075. Italic: 64,
  40076. AllCap: 65536,
  40077. SmallCap: 131072,
  40078. ForceBold: 262144
  40079. };
  40080. var MacStandardGlyphOrdering = [
  40081. '.notdef',
  40082. '.null',
  40083. 'nonmarkingreturn',
  40084. 'space',
  40085. 'exclam',
  40086. 'quotedbl',
  40087. 'numbersign',
  40088. 'dollar',
  40089. 'percent',
  40090. 'ampersand',
  40091. 'quotesingle',
  40092. 'parenleft',
  40093. 'parenright',
  40094. 'asterisk',
  40095. 'plus',
  40096. 'comma',
  40097. 'hyphen',
  40098. 'period',
  40099. 'slash',
  40100. 'zero',
  40101. 'one',
  40102. 'two',
  40103. 'three',
  40104. 'four',
  40105. 'five',
  40106. 'six',
  40107. 'seven',
  40108. 'eight',
  40109. 'nine',
  40110. 'colon',
  40111. 'semicolon',
  40112. 'less',
  40113. 'equal',
  40114. 'greater',
  40115. 'question',
  40116. 'at',
  40117. 'A',
  40118. 'B',
  40119. 'C',
  40120. 'D',
  40121. 'E',
  40122. 'F',
  40123. 'G',
  40124. 'H',
  40125. 'I',
  40126. 'J',
  40127. 'K',
  40128. 'L',
  40129. 'M',
  40130. 'N',
  40131. 'O',
  40132. 'P',
  40133. 'Q',
  40134. 'R',
  40135. 'S',
  40136. 'T',
  40137. 'U',
  40138. 'V',
  40139. 'W',
  40140. 'X',
  40141. 'Y',
  40142. 'Z',
  40143. 'bracketleft',
  40144. 'backslash',
  40145. 'bracketright',
  40146. 'asciicircum',
  40147. 'underscore',
  40148. 'grave',
  40149. 'a',
  40150. 'b',
  40151. 'c',
  40152. 'd',
  40153. 'e',
  40154. 'f',
  40155. 'g',
  40156. 'h',
  40157. 'i',
  40158. 'j',
  40159. 'k',
  40160. 'l',
  40161. 'm',
  40162. 'n',
  40163. 'o',
  40164. 'p',
  40165. 'q',
  40166. 'r',
  40167. 's',
  40168. 't',
  40169. 'u',
  40170. 'v',
  40171. 'w',
  40172. 'x',
  40173. 'y',
  40174. 'z',
  40175. 'braceleft',
  40176. 'bar',
  40177. 'braceright',
  40178. 'asciitilde',
  40179. 'Adieresis',
  40180. 'Aring',
  40181. 'Ccedilla',
  40182. 'Eacute',
  40183. 'Ntilde',
  40184. 'Odieresis',
  40185. 'Udieresis',
  40186. 'aacute',
  40187. 'agrave',
  40188. 'acircumflex',
  40189. 'adieresis',
  40190. 'atilde',
  40191. 'aring',
  40192. 'ccedilla',
  40193. 'eacute',
  40194. 'egrave',
  40195. 'ecircumflex',
  40196. 'edieresis',
  40197. 'iacute',
  40198. 'igrave',
  40199. 'icircumflex',
  40200. 'idieresis',
  40201. 'ntilde',
  40202. 'oacute',
  40203. 'ograve',
  40204. 'ocircumflex',
  40205. 'odieresis',
  40206. 'otilde',
  40207. 'uacute',
  40208. 'ugrave',
  40209. 'ucircumflex',
  40210. 'udieresis',
  40211. 'dagger',
  40212. 'degree',
  40213. 'cent',
  40214. 'sterling',
  40215. 'section',
  40216. 'bullet',
  40217. 'paragraph',
  40218. 'germandbls',
  40219. 'registered',
  40220. 'copyright',
  40221. 'trademark',
  40222. 'acute',
  40223. 'dieresis',
  40224. 'notequal',
  40225. 'AE',
  40226. 'Oslash',
  40227. 'infinity',
  40228. 'plusminus',
  40229. 'lessequal',
  40230. 'greaterequal',
  40231. 'yen',
  40232. 'mu',
  40233. 'partialdiff',
  40234. 'summation',
  40235. 'product',
  40236. 'pi',
  40237. 'integral',
  40238. 'ordfeminine',
  40239. 'ordmasculine',
  40240. 'Omega',
  40241. 'ae',
  40242. 'oslash',
  40243. 'questiondown',
  40244. 'exclamdown',
  40245. 'logicalnot',
  40246. 'radical',
  40247. 'florin',
  40248. 'approxequal',
  40249. 'Delta',
  40250. 'guillemotleft',
  40251. 'guillemotright',
  40252. 'ellipsis',
  40253. 'nonbreakingspace',
  40254. 'Agrave',
  40255. 'Atilde',
  40256. 'Otilde',
  40257. 'OE',
  40258. 'oe',
  40259. 'endash',
  40260. 'emdash',
  40261. 'quotedblleft',
  40262. 'quotedblright',
  40263. 'quoteleft',
  40264. 'quoteright',
  40265. 'divide',
  40266. 'lozenge',
  40267. 'ydieresis',
  40268. 'Ydieresis',
  40269. 'fraction',
  40270. 'currency',
  40271. 'guilsinglleft',
  40272. 'guilsinglright',
  40273. 'fi',
  40274. 'fl',
  40275. 'daggerdbl',
  40276. 'periodcentered',
  40277. 'quotesinglbase',
  40278. 'quotedblbase',
  40279. 'perthousand',
  40280. 'Acircumflex',
  40281. 'Ecircumflex',
  40282. 'Aacute',
  40283. 'Edieresis',
  40284. 'Egrave',
  40285. 'Iacute',
  40286. 'Icircumflex',
  40287. 'Idieresis',
  40288. 'Igrave',
  40289. 'Oacute',
  40290. 'Ocircumflex',
  40291. 'apple',
  40292. 'Ograve',
  40293. 'Uacute',
  40294. 'Ucircumflex',
  40295. 'Ugrave',
  40296. 'dotlessi',
  40297. 'circumflex',
  40298. 'tilde',
  40299. 'macron',
  40300. 'breve',
  40301. 'dotaccent',
  40302. 'ring',
  40303. 'cedilla',
  40304. 'hungarumlaut',
  40305. 'ogonek',
  40306. 'caron',
  40307. 'Lslash',
  40308. 'lslash',
  40309. 'Scaron',
  40310. 'scaron',
  40311. 'Zcaron',
  40312. 'zcaron',
  40313. 'brokenbar',
  40314. 'Eth',
  40315. 'eth',
  40316. 'Yacute',
  40317. 'yacute',
  40318. 'Thorn',
  40319. 'thorn',
  40320. 'minus',
  40321. 'multiply',
  40322. 'onesuperior',
  40323. 'twosuperior',
  40324. 'threesuperior',
  40325. 'onehalf',
  40326. 'onequarter',
  40327. 'threequarters',
  40328. 'franc',
  40329. 'Gbreve',
  40330. 'gbreve',
  40331. 'Idotaccent',
  40332. 'Scedilla',
  40333. 'scedilla',
  40334. 'Cacute',
  40335. 'cacute',
  40336. 'Ccaron',
  40337. 'ccaron',
  40338. 'dcroat'
  40339. ];
  40340. function adjustWidths(properties) {
  40341. if (!properties.fontMatrix) {
  40342. return;
  40343. }
  40344. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  40345. return;
  40346. }
  40347. var scale = 0.001 / properties.fontMatrix[0];
  40348. var glyphsWidths = properties.widths;
  40349. for (var glyph in glyphsWidths) {
  40350. glyphsWidths[glyph] *= scale;
  40351. }
  40352. properties.defaultWidth *= scale;
  40353. }
  40354. function adjustToUnicode(properties, builtInEncoding) {
  40355. if (properties.hasIncludedToUnicodeMap) {
  40356. return;
  40357. }
  40358. if (properties.hasEncoding) {
  40359. return;
  40360. }
  40361. if (builtInEncoding === properties.defaultEncoding) {
  40362. return;
  40363. }
  40364. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  40365. return;
  40366. }
  40367. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  40368. for (var charCode in builtInEncoding) {
  40369. var glyphName = builtInEncoding[charCode];
  40370. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40371. if (unicode !== -1) {
  40372. toUnicode[charCode] = String.fromCharCode(unicode);
  40373. }
  40374. }
  40375. properties.toUnicode.amend(toUnicode);
  40376. }
  40377. function getFontType(type, subtype) {
  40378. switch (type) {
  40379. case 'Type1':
  40380. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  40381. case 'CIDFontType0':
  40382. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  40383. case 'OpenType':
  40384. return FontType.OPENTYPE;
  40385. case 'TrueType':
  40386. return FontType.TRUETYPE;
  40387. case 'CIDFontType2':
  40388. return FontType.CIDFONTTYPE2;
  40389. case 'MMType1':
  40390. return FontType.MMTYPE1;
  40391. case 'Type0':
  40392. return FontType.TYPE0;
  40393. default:
  40394. return FontType.UNKNOWN;
  40395. }
  40396. }
  40397. function recoverGlyphName(name, glyphsUnicodeMap) {
  40398. if (glyphsUnicodeMap[name] !== undefined) {
  40399. return name;
  40400. }
  40401. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  40402. if (unicode !== -1) {
  40403. for (var key in glyphsUnicodeMap) {
  40404. if (glyphsUnicodeMap[key] === unicode) {
  40405. return key;
  40406. }
  40407. }
  40408. }
  40409. info('Unable to recover a standard glyph name for: ' + name);
  40410. return name;
  40411. }
  40412. var Glyph = function GlyphClosure() {
  40413. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40414. this.fontChar = fontChar;
  40415. this.unicode = unicode;
  40416. this.accent = accent;
  40417. this.width = width;
  40418. this.vmetric = vmetric;
  40419. this.operatorListId = operatorListId;
  40420. this.isSpace = isSpace;
  40421. this.isInFont = isInFont;
  40422. }
  40423. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40424. 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;
  40425. };
  40426. return Glyph;
  40427. }();
  40428. var ToUnicodeMap = function ToUnicodeMapClosure() {
  40429. function ToUnicodeMap(cmap) {
  40430. this._map = cmap;
  40431. }
  40432. ToUnicodeMap.prototype = {
  40433. get length() {
  40434. return this._map.length;
  40435. },
  40436. forEach: function (callback) {
  40437. for (var charCode in this._map) {
  40438. callback(charCode, this._map[charCode].charCodeAt(0));
  40439. }
  40440. },
  40441. has: function (i) {
  40442. return this._map[i] !== undefined;
  40443. },
  40444. get: function (i) {
  40445. return this._map[i];
  40446. },
  40447. charCodeOf: function (v) {
  40448. return this._map.indexOf(v);
  40449. },
  40450. amend: function (map) {
  40451. for (var charCode in map) {
  40452. this._map[charCode] = map[charCode];
  40453. }
  40454. }
  40455. };
  40456. return ToUnicodeMap;
  40457. }();
  40458. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  40459. function IdentityToUnicodeMap(firstChar, lastChar) {
  40460. this.firstChar = firstChar;
  40461. this.lastChar = lastChar;
  40462. }
  40463. IdentityToUnicodeMap.prototype = {
  40464. get length() {
  40465. return this.lastChar + 1 - this.firstChar;
  40466. },
  40467. forEach: function (callback) {
  40468. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40469. callback(i, i);
  40470. }
  40471. },
  40472. has: function (i) {
  40473. return this.firstChar <= i && i <= this.lastChar;
  40474. },
  40475. get: function (i) {
  40476. if (this.firstChar <= i && i <= this.lastChar) {
  40477. return String.fromCharCode(i);
  40478. }
  40479. return undefined;
  40480. },
  40481. charCodeOf: function (v) {
  40482. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40483. },
  40484. amend: function (map) {
  40485. error('Should not call amend()');
  40486. }
  40487. };
  40488. return IdentityToUnicodeMap;
  40489. }();
  40490. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  40491. function writeInt16(dest, offset, num) {
  40492. dest[offset] = num >> 8 & 0xFF;
  40493. dest[offset + 1] = num & 0xFF;
  40494. }
  40495. function writeInt32(dest, offset, num) {
  40496. dest[offset] = num >> 24 & 0xFF;
  40497. dest[offset + 1] = num >> 16 & 0xFF;
  40498. dest[offset + 2] = num >> 8 & 0xFF;
  40499. dest[offset + 3] = num & 0xFF;
  40500. }
  40501. function writeData(dest, offset, data) {
  40502. var i, ii;
  40503. if (data instanceof Uint8Array) {
  40504. dest.set(data, offset);
  40505. } else if (typeof data === 'string') {
  40506. for (i = 0, ii = data.length; i < ii; i++) {
  40507. dest[offset++] = data.charCodeAt(i) & 0xFF;
  40508. }
  40509. } else {
  40510. for (i = 0, ii = data.length; i < ii; i++) {
  40511. dest[offset++] = data[i] & 0xFF;
  40512. }
  40513. }
  40514. }
  40515. function OpenTypeFileBuilder(sfnt) {
  40516. this.sfnt = sfnt;
  40517. this.tables = Object.create(null);
  40518. }
  40519. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  40520. var maxPower2 = 1, log2 = 0;
  40521. while ((maxPower2 ^ entriesCount) > maxPower2) {
  40522. maxPower2 <<= 1;
  40523. log2++;
  40524. }
  40525. var searchRange = maxPower2 * entrySize;
  40526. return {
  40527. range: searchRange,
  40528. entry: log2,
  40529. rangeShift: entrySize * entriesCount - searchRange
  40530. };
  40531. };
  40532. var OTF_HEADER_SIZE = 12;
  40533. var OTF_TABLE_ENTRY_SIZE = 16;
  40534. OpenTypeFileBuilder.prototype = {
  40535. toArray: function OpenTypeFileBuilder_toArray() {
  40536. var sfnt = this.sfnt;
  40537. var tables = this.tables;
  40538. var tablesNames = Object.keys(tables);
  40539. tablesNames.sort();
  40540. var numTables = tablesNames.length;
  40541. var i, j, jj, table, tableName;
  40542. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  40543. var tableOffsets = [offset];
  40544. for (i = 0; i < numTables; i++) {
  40545. table = tables[tablesNames[i]];
  40546. var paddedLength = (table.length + 3 & ~3) >>> 0;
  40547. offset += paddedLength;
  40548. tableOffsets.push(offset);
  40549. }
  40550. var file = new Uint8Array(offset);
  40551. for (i = 0; i < numTables; i++) {
  40552. table = tables[tablesNames[i]];
  40553. writeData(file, tableOffsets[i], table);
  40554. }
  40555. if (sfnt === 'true') {
  40556. sfnt = string32(0x00010000);
  40557. }
  40558. file[0] = sfnt.charCodeAt(0) & 0xFF;
  40559. file[1] = sfnt.charCodeAt(1) & 0xFF;
  40560. file[2] = sfnt.charCodeAt(2) & 0xFF;
  40561. file[3] = sfnt.charCodeAt(3) & 0xFF;
  40562. writeInt16(file, 4, numTables);
  40563. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  40564. writeInt16(file, 6, searchParams.range);
  40565. writeInt16(file, 8, searchParams.entry);
  40566. writeInt16(file, 10, searchParams.rangeShift);
  40567. offset = OTF_HEADER_SIZE;
  40568. for (i = 0; i < numTables; i++) {
  40569. tableName = tablesNames[i];
  40570. file[offset] = tableName.charCodeAt(0) & 0xFF;
  40571. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  40572. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  40573. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  40574. var checksum = 0;
  40575. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  40576. var quad = readUint32(file, j);
  40577. checksum = checksum + quad >>> 0;
  40578. }
  40579. writeInt32(file, offset + 4, checksum);
  40580. writeInt32(file, offset + 8, tableOffsets[i]);
  40581. writeInt32(file, offset + 12, tables[tableName].length);
  40582. offset += OTF_TABLE_ENTRY_SIZE;
  40583. }
  40584. return file;
  40585. },
  40586. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  40587. if (tag in this.tables) {
  40588. throw new Error('Table ' + tag + ' already exists');
  40589. }
  40590. this.tables[tag] = data;
  40591. }
  40592. };
  40593. return OpenTypeFileBuilder;
  40594. }();
  40595. var ProblematicCharRanges = new Int32Array([
  40596. 0x0000,
  40597. 0x0020,
  40598. 0x007F,
  40599. 0x00A1,
  40600. 0x00AD,
  40601. 0x00AE,
  40602. 0x0600,
  40603. 0x0780,
  40604. 0x08A0,
  40605. 0x10A0,
  40606. 0x1780,
  40607. 0x1800,
  40608. 0x1C00,
  40609. 0x1C50,
  40610. 0x2000,
  40611. 0x2010,
  40612. 0x2011,
  40613. 0x2012,
  40614. 0x2028,
  40615. 0x2030,
  40616. 0x205F,
  40617. 0x2070,
  40618. 0x25CC,
  40619. 0x25CD,
  40620. 0x3000,
  40621. 0x3001,
  40622. 0xAA60,
  40623. 0xAA80,
  40624. 0xFFF0,
  40625. 0x10000
  40626. ]);
  40627. var Font = function FontClosure() {
  40628. function Font(name, file, properties) {
  40629. var charCode, glyphName, unicode;
  40630. this.name = name;
  40631. this.loadedName = properties.loadedName;
  40632. this.isType3Font = properties.isType3Font;
  40633. this.sizes = [];
  40634. this.missingFile = false;
  40635. this.glyphCache = Object.create(null);
  40636. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  40637. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  40638. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  40639. var type = properties.type;
  40640. var subtype = properties.subtype;
  40641. this.type = type;
  40642. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  40643. this.differences = properties.differences;
  40644. this.widths = properties.widths;
  40645. this.defaultWidth = properties.defaultWidth;
  40646. this.composite = properties.composite;
  40647. this.wideChars = properties.wideChars;
  40648. this.cMap = properties.cMap;
  40649. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  40650. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  40651. this.fontMatrix = properties.fontMatrix;
  40652. this.bbox = properties.bbox;
  40653. this.toUnicode = properties.toUnicode;
  40654. this.toFontChar = [];
  40655. if (properties.type === 'Type3') {
  40656. for (charCode = 0; charCode < 256; charCode++) {
  40657. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  40658. }
  40659. this.fontType = FontType.TYPE3;
  40660. return;
  40661. }
  40662. this.cidEncoding = properties.cidEncoding;
  40663. this.vertical = properties.vertical;
  40664. if (this.vertical) {
  40665. this.vmetrics = properties.vmetrics;
  40666. this.defaultVMetrics = properties.defaultVMetrics;
  40667. }
  40668. var glyphsUnicodeMap;
  40669. if (!file || file.isEmpty) {
  40670. if (file) {
  40671. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  40672. }
  40673. this.missingFile = true;
  40674. var fontName = name.replace(/[,_]/g, '-');
  40675. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  40676. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  40677. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  40678. this.bold = fontName.search(/bold/gi) !== -1;
  40679. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  40680. this.black = name.search(/Black/g) !== -1;
  40681. this.remeasure = Object.keys(this.widths).length > 0;
  40682. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  40683. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  40684. var map = [];
  40685. for (charCode in GlyphMapForStandardFonts) {
  40686. map[+charCode] = GlyphMapForStandardFonts[charCode];
  40687. }
  40688. if (/Arial-?Black/i.test(name)) {
  40689. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  40690. for (charCode in SupplementalGlyphMapForArialBlack) {
  40691. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  40692. }
  40693. }
  40694. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  40695. if (!isIdentityUnicode) {
  40696. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40697. map[+charCode] = unicodeCharCode;
  40698. });
  40699. }
  40700. this.toFontChar = map;
  40701. this.toUnicode = new ToUnicodeMap(map);
  40702. } else if (/Symbol/i.test(fontName)) {
  40703. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  40704. } else if (/Dingbats/i.test(fontName)) {
  40705. if (/Wingdings/i.test(name)) {
  40706. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  40707. }
  40708. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  40709. } else if (isStandardFont) {
  40710. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  40711. } else {
  40712. glyphsUnicodeMap = getGlyphsUnicode();
  40713. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40714. if (!this.composite) {
  40715. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  40716. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40717. if (unicode !== -1) {
  40718. unicodeCharCode = unicode;
  40719. }
  40720. }
  40721. this.toFontChar[charCode] = unicodeCharCode;
  40722. }.bind(this));
  40723. }
  40724. this.loadedName = fontName.split('-')[0];
  40725. this.loading = false;
  40726. this.fontType = getFontType(type, subtype);
  40727. return;
  40728. }
  40729. if (subtype === 'Type1C') {
  40730. if (type !== 'Type1' && type !== 'MMType1') {
  40731. if (isTrueTypeFile(file)) {
  40732. subtype = 'TrueType';
  40733. } else {
  40734. type = 'Type1';
  40735. }
  40736. } else if (isOpenTypeFile(file)) {
  40737. type = subtype = 'OpenType';
  40738. }
  40739. }
  40740. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  40741. type = 'CIDFontType0';
  40742. }
  40743. if (subtype === 'OpenType') {
  40744. type = 'OpenType';
  40745. }
  40746. if (type === 'CIDFontType0') {
  40747. if (isType1File(file)) {
  40748. subtype = 'CIDFontType0';
  40749. } else if (isOpenTypeFile(file)) {
  40750. type = subtype = 'OpenType';
  40751. } else {
  40752. subtype = 'CIDFontType0C';
  40753. }
  40754. }
  40755. var data;
  40756. switch (type) {
  40757. case 'MMType1':
  40758. info('MMType1 font (' + name + '), falling back to Type1.');
  40759. case 'Type1':
  40760. case 'CIDFontType0':
  40761. this.mimetype = 'font/opentype';
  40762. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  40763. adjustWidths(properties);
  40764. data = this.convert(name, cff, properties);
  40765. break;
  40766. case 'OpenType':
  40767. case 'TrueType':
  40768. case 'CIDFontType2':
  40769. this.mimetype = 'font/opentype';
  40770. data = this.checkAndRepair(name, file, properties);
  40771. if (this.isOpenType) {
  40772. adjustWidths(properties);
  40773. type = 'OpenType';
  40774. }
  40775. break;
  40776. default:
  40777. error('Font ' + type + ' is not supported');
  40778. break;
  40779. }
  40780. this.data = data;
  40781. this.fontType = getFontType(type, subtype);
  40782. this.fontMatrix = properties.fontMatrix;
  40783. this.widths = properties.widths;
  40784. this.defaultWidth = properties.defaultWidth;
  40785. this.toUnicode = properties.toUnicode;
  40786. this.encoding = properties.baseEncoding;
  40787. this.seacMap = properties.seacMap;
  40788. this.loading = true;
  40789. }
  40790. Font.getFontID = function () {
  40791. var ID = 1;
  40792. return function Font_getFontID() {
  40793. return String(ID++);
  40794. };
  40795. }();
  40796. function int16(b0, b1) {
  40797. return (b0 << 8) + b1;
  40798. }
  40799. function signedInt16(b0, b1) {
  40800. var value = (b0 << 8) + b1;
  40801. return value & 1 << 15 ? value - 0x10000 : value;
  40802. }
  40803. function int32(b0, b1, b2, b3) {
  40804. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  40805. }
  40806. function string16(value) {
  40807. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40808. }
  40809. function safeString16(value) {
  40810. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  40811. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40812. }
  40813. function isTrueTypeFile(file) {
  40814. var header = file.peekBytes(4);
  40815. return readUint32(header, 0) === 0x00010000;
  40816. }
  40817. function isOpenTypeFile(file) {
  40818. var header = file.peekBytes(4);
  40819. return bytesToString(header) === 'OTTO';
  40820. }
  40821. function isType1File(file) {
  40822. var header = file.peekBytes(2);
  40823. if (header[0] === 0x25 && header[1] === 0x21) {
  40824. return true;
  40825. }
  40826. if (header[0] === 0x80 && header[1] === 0x01) {
  40827. return true;
  40828. }
  40829. return false;
  40830. }
  40831. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  40832. var toFontChar = [], unicode;
  40833. for (var i = 0, ii = encoding.length; i < ii; i++) {
  40834. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  40835. if (unicode !== -1) {
  40836. toFontChar[i] = unicode;
  40837. }
  40838. }
  40839. for (var charCode in differences) {
  40840. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  40841. if (unicode !== -1) {
  40842. toFontChar[+charCode] = unicode;
  40843. }
  40844. }
  40845. return toFontChar;
  40846. }
  40847. function isProblematicUnicodeLocation(code) {
  40848. var i = 0, j = ProblematicCharRanges.length - 1;
  40849. while (i < j) {
  40850. var c = i + j + 1 >> 1;
  40851. if (code < ProblematicCharRanges[c]) {
  40852. j = c - 1;
  40853. } else {
  40854. i = c;
  40855. }
  40856. }
  40857. return !(i & 1);
  40858. }
  40859. function adjustMapping(charCodeToGlyphId, properties) {
  40860. var toUnicode = properties.toUnicode;
  40861. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40862. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40863. var newMap = Object.create(null);
  40864. var toFontChar = [];
  40865. var usedFontCharCodes = [];
  40866. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40867. for (var originalCharCode in charCodeToGlyphId) {
  40868. originalCharCode |= 0;
  40869. var glyphId = charCodeToGlyphId[originalCharCode];
  40870. var fontCharCode = originalCharCode;
  40871. var hasUnicodeValue = false;
  40872. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40873. hasUnicodeValue = true;
  40874. var unicode = toUnicode.get(fontCharCode);
  40875. if (unicode.length === 1) {
  40876. fontCharCode = unicode.charCodeAt(0);
  40877. }
  40878. }
  40879. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40880. do {
  40881. fontCharCode = nextAvailableFontCharCode++;
  40882. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40883. fontCharCode = 0xF020;
  40884. nextAvailableFontCharCode = fontCharCode + 1;
  40885. }
  40886. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40887. }
  40888. newMap[fontCharCode] = glyphId;
  40889. toFontChar[originalCharCode] = fontCharCode;
  40890. usedFontCharCodes[fontCharCode] = true;
  40891. }
  40892. return {
  40893. toFontChar: toFontChar,
  40894. charCodeToGlyphId: newMap,
  40895. nextAvailableFontCharCode: nextAvailableFontCharCode
  40896. };
  40897. }
  40898. function getRanges(glyphs, numGlyphs) {
  40899. var codes = [];
  40900. for (var charCode in glyphs) {
  40901. if (glyphs[charCode] >= numGlyphs) {
  40902. continue;
  40903. }
  40904. codes.push({
  40905. fontCharCode: charCode | 0,
  40906. glyphId: glyphs[charCode]
  40907. });
  40908. }
  40909. codes.sort(function fontGetRangesSort(a, b) {
  40910. return a.fontCharCode - b.fontCharCode;
  40911. });
  40912. var ranges = [];
  40913. var length = codes.length;
  40914. for (var n = 0; n < length;) {
  40915. var start = codes[n].fontCharCode;
  40916. var codeIndices = [codes[n].glyphId];
  40917. ++n;
  40918. var end = start;
  40919. while (n < length && end + 1 === codes[n].fontCharCode) {
  40920. codeIndices.push(codes[n].glyphId);
  40921. ++end;
  40922. ++n;
  40923. if (end === 0xFFFF) {
  40924. break;
  40925. }
  40926. }
  40927. ranges.push([
  40928. start,
  40929. end,
  40930. codeIndices
  40931. ]);
  40932. }
  40933. return ranges;
  40934. }
  40935. function createCmapTable(glyphs, numGlyphs) {
  40936. var ranges = getRanges(glyphs, numGlyphs);
  40937. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40938. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40939. var i, ii, j, jj;
  40940. for (i = ranges.length - 1; i >= 0; --i) {
  40941. if (ranges[i][0] <= 0xFFFF) {
  40942. break;
  40943. }
  40944. }
  40945. var bmpLength = i + 1;
  40946. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40947. ranges[i][1] = 0xFFFE;
  40948. }
  40949. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40950. var segCount = bmpLength + trailingRangesCount;
  40951. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40952. var startCount = '';
  40953. var endCount = '';
  40954. var idDeltas = '';
  40955. var idRangeOffsets = '';
  40956. var glyphsIds = '';
  40957. var bias = 0;
  40958. var range, start, end, codes;
  40959. for (i = 0, ii = bmpLength; i < ii; i++) {
  40960. range = ranges[i];
  40961. start = range[0];
  40962. end = range[1];
  40963. startCount += string16(start);
  40964. endCount += string16(end);
  40965. codes = range[2];
  40966. var contiguous = true;
  40967. for (j = 1, jj = codes.length; j < jj; ++j) {
  40968. if (codes[j] !== codes[j - 1] + 1) {
  40969. contiguous = false;
  40970. break;
  40971. }
  40972. }
  40973. if (!contiguous) {
  40974. var offset = (segCount - i) * 2 + bias * 2;
  40975. bias += end - start + 1;
  40976. idDeltas += string16(0);
  40977. idRangeOffsets += string16(offset);
  40978. for (j = 0, jj = codes.length; j < jj; ++j) {
  40979. glyphsIds += string16(codes[j]);
  40980. }
  40981. } else {
  40982. var startCode = codes[0];
  40983. idDeltas += string16(startCode - start & 0xFFFF);
  40984. idRangeOffsets += string16(0);
  40985. }
  40986. }
  40987. if (trailingRangesCount > 0) {
  40988. endCount += '\xFF\xFF';
  40989. startCount += '\xFF\xFF';
  40990. idDeltas += '\x00\x01';
  40991. idRangeOffsets += '\x00\x00';
  40992. }
  40993. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40994. var format31012 = '';
  40995. var header31012 = '';
  40996. if (numTables > 1) {
  40997. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40998. format31012 = '';
  40999. for (i = 0, ii = ranges.length; i < ii; i++) {
  41000. range = ranges[i];
  41001. start = range[0];
  41002. codes = range[2];
  41003. var code = codes[0];
  41004. for (j = 1, jj = codes.length; j < jj; ++j) {
  41005. if (codes[j] !== codes[j - 1] + 1) {
  41006. end = range[0] + j - 1;
  41007. format31012 += string32(start) + string32(end) + string32(code);
  41008. start = end + 1;
  41009. code = codes[j];
  41010. }
  41011. }
  41012. format31012 += string32(start) + string32(range[1]) + string32(code);
  41013. }
  41014. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  41015. }
  41016. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  41017. }
  41018. function validateOS2Table(os2) {
  41019. var stream = new Stream(os2.data);
  41020. var version = stream.getUint16();
  41021. stream.getBytes(60);
  41022. var selection = stream.getUint16();
  41023. if (version < 4 && selection & 0x0300) {
  41024. return false;
  41025. }
  41026. var firstChar = stream.getUint16();
  41027. var lastChar = stream.getUint16();
  41028. if (firstChar > lastChar) {
  41029. return false;
  41030. }
  41031. stream.getBytes(6);
  41032. var usWinAscent = stream.getUint16();
  41033. if (usWinAscent === 0) {
  41034. return false;
  41035. }
  41036. os2.data[8] = os2.data[9] = 0;
  41037. return true;
  41038. }
  41039. function createOS2Table(properties, charstrings, override) {
  41040. override = override || {
  41041. unitsPerEm: 0,
  41042. yMax: 0,
  41043. yMin: 0,
  41044. ascent: 0,
  41045. descent: 0
  41046. };
  41047. var ulUnicodeRange1 = 0;
  41048. var ulUnicodeRange2 = 0;
  41049. var ulUnicodeRange3 = 0;
  41050. var ulUnicodeRange4 = 0;
  41051. var firstCharIndex = null;
  41052. var lastCharIndex = 0;
  41053. if (charstrings) {
  41054. for (var code in charstrings) {
  41055. code |= 0;
  41056. if (firstCharIndex > code || !firstCharIndex) {
  41057. firstCharIndex = code;
  41058. }
  41059. if (lastCharIndex < code) {
  41060. lastCharIndex = code;
  41061. }
  41062. var position = getUnicodeRangeFor(code);
  41063. if (position < 32) {
  41064. ulUnicodeRange1 |= 1 << position;
  41065. } else if (position < 64) {
  41066. ulUnicodeRange2 |= 1 << position - 32;
  41067. } else if (position < 96) {
  41068. ulUnicodeRange3 |= 1 << position - 64;
  41069. } else if (position < 123) {
  41070. ulUnicodeRange4 |= 1 << position - 96;
  41071. } else {
  41072. error('Unicode ranges Bits > 123 are reserved for internal usage');
  41073. }
  41074. }
  41075. } else {
  41076. firstCharIndex = 0;
  41077. lastCharIndex = 255;
  41078. }
  41079. var bbox = properties.bbox || [
  41080. 0,
  41081. 0,
  41082. 0,
  41083. 0
  41084. ];
  41085. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41086. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  41087. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  41088. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  41089. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  41090. typoDescent = -typoDescent;
  41091. }
  41092. var winAscent = override.yMax || typoAscent;
  41093. var winDescent = -override.yMin || -typoDescent;
  41094. 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';
  41095. }
  41096. function createPostTable(properties) {
  41097. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  41098. 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';
  41099. }
  41100. function createNameTable(name, proto) {
  41101. if (!proto) {
  41102. proto = [
  41103. [],
  41104. []
  41105. ];
  41106. }
  41107. var strings = [
  41108. proto[0][0] || 'Original licence',
  41109. proto[0][1] || name,
  41110. proto[0][2] || 'Unknown',
  41111. proto[0][3] || 'uniqueID',
  41112. proto[0][4] || name,
  41113. proto[0][5] || 'Version 0.11',
  41114. proto[0][6] || '',
  41115. proto[0][7] || 'Unknown',
  41116. proto[0][8] || 'Unknown',
  41117. proto[0][9] || 'Unknown'
  41118. ];
  41119. var stringsUnicode = [];
  41120. var i, ii, j, jj, str;
  41121. for (i = 0, ii = strings.length; i < ii; i++) {
  41122. str = proto[1][i] || strings[i];
  41123. var strBufUnicode = [];
  41124. for (j = 0, jj = str.length; j < jj; j++) {
  41125. strBufUnicode.push(string16(str.charCodeAt(j)));
  41126. }
  41127. stringsUnicode.push(strBufUnicode.join(''));
  41128. }
  41129. var names = [
  41130. strings,
  41131. stringsUnicode
  41132. ];
  41133. var platforms = [
  41134. '\x00\x01',
  41135. '\x00\x03'
  41136. ];
  41137. var encodings = [
  41138. '\x00\x00',
  41139. '\x00\x01'
  41140. ];
  41141. var languages = [
  41142. '\x00\x00',
  41143. '\x04\x09'
  41144. ];
  41145. var namesRecordCount = strings.length * platforms.length;
  41146. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  41147. var strOffset = 0;
  41148. for (i = 0, ii = platforms.length; i < ii; i++) {
  41149. var strs = names[i];
  41150. for (j = 0, jj = strs.length; j < jj; j++) {
  41151. str = strs[j];
  41152. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  41153. nameTable += nameRecord;
  41154. strOffset += str.length;
  41155. }
  41156. }
  41157. nameTable += strings.join('') + stringsUnicode.join('');
  41158. return nameTable;
  41159. }
  41160. Font.prototype = {
  41161. name: null,
  41162. font: null,
  41163. mimetype: null,
  41164. encoding: null,
  41165. get renderer() {
  41166. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  41167. return shadow(this, 'renderer', renderer);
  41168. },
  41169. exportData: function Font_exportData() {
  41170. var data = {};
  41171. for (var i in this) {
  41172. if (this.hasOwnProperty(i)) {
  41173. data[i] = this[i];
  41174. }
  41175. }
  41176. return data;
  41177. },
  41178. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  41179. function readTableEntry(file) {
  41180. var tag = bytesToString(file.getBytes(4));
  41181. var checksum = file.getInt32() >>> 0;
  41182. var offset = file.getInt32() >>> 0;
  41183. var length = file.getInt32() >>> 0;
  41184. var previousPosition = file.pos;
  41185. file.pos = file.start ? file.start : 0;
  41186. file.skip(offset);
  41187. var data = file.getBytes(length);
  41188. file.pos = previousPosition;
  41189. if (tag === 'head') {
  41190. data[8] = data[9] = data[10] = data[11] = 0;
  41191. data[17] |= 0x20;
  41192. }
  41193. return {
  41194. tag: tag,
  41195. checksum: checksum,
  41196. length: length,
  41197. offset: offset,
  41198. data: data
  41199. };
  41200. }
  41201. function readOpenTypeHeader(ttf) {
  41202. return {
  41203. version: bytesToString(ttf.getBytes(4)),
  41204. numTables: ttf.getUint16(),
  41205. searchRange: ttf.getUint16(),
  41206. entrySelector: ttf.getUint16(),
  41207. rangeShift: ttf.getUint16()
  41208. };
  41209. }
  41210. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  41211. if (!cmap) {
  41212. warn('No cmap table available.');
  41213. return {
  41214. platformId: -1,
  41215. encodingId: -1,
  41216. mappings: [],
  41217. hasShortCmap: false
  41218. };
  41219. }
  41220. var segment;
  41221. var start = (font.start ? font.start : 0) + cmap.offset;
  41222. font.pos = start;
  41223. font.getUint16();
  41224. var numTables = font.getUint16();
  41225. var potentialTable;
  41226. var canBreak = false;
  41227. for (var i = 0; i < numTables; i++) {
  41228. var platformId = font.getUint16();
  41229. var encodingId = font.getUint16();
  41230. var offset = font.getInt32() >>> 0;
  41231. var useTable = false;
  41232. if (platformId === 0 && encodingId === 0) {
  41233. useTable = true;
  41234. } else if (platformId === 1 && encodingId === 0) {
  41235. useTable = true;
  41236. } else if (platformId === 3 && encodingId === 1 && (!isSymbolicFont && hasEncoding || !potentialTable)) {
  41237. useTable = true;
  41238. if (!isSymbolicFont) {
  41239. canBreak = true;
  41240. }
  41241. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  41242. useTable = true;
  41243. canBreak = true;
  41244. }
  41245. if (useTable) {
  41246. potentialTable = {
  41247. platformId: platformId,
  41248. encodingId: encodingId,
  41249. offset: offset
  41250. };
  41251. }
  41252. if (canBreak) {
  41253. break;
  41254. }
  41255. }
  41256. if (potentialTable) {
  41257. font.pos = start + potentialTable.offset;
  41258. }
  41259. if (!potentialTable || font.peekByte() === -1) {
  41260. warn('Could not find a preferred cmap table.');
  41261. return {
  41262. platformId: -1,
  41263. encodingId: -1,
  41264. mappings: [],
  41265. hasShortCmap: false
  41266. };
  41267. }
  41268. var format = font.getUint16();
  41269. font.getUint16();
  41270. font.getUint16();
  41271. var hasShortCmap = false;
  41272. var mappings = [];
  41273. var j, glyphId;
  41274. if (format === 0) {
  41275. for (j = 0; j < 256; j++) {
  41276. var index = font.getByte();
  41277. if (!index) {
  41278. continue;
  41279. }
  41280. mappings.push({
  41281. charCode: j,
  41282. glyphId: index
  41283. });
  41284. }
  41285. hasShortCmap = true;
  41286. } else if (format === 4) {
  41287. var segCount = font.getUint16() >> 1;
  41288. font.getBytes(6);
  41289. var segIndex, segments = [];
  41290. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41291. segments.push({ end: font.getUint16() });
  41292. }
  41293. font.getUint16();
  41294. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41295. segments[segIndex].start = font.getUint16();
  41296. }
  41297. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41298. segments[segIndex].delta = font.getUint16();
  41299. }
  41300. var offsetsCount = 0;
  41301. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41302. segment = segments[segIndex];
  41303. var rangeOffset = font.getUint16();
  41304. if (!rangeOffset) {
  41305. segment.offsetIndex = -1;
  41306. continue;
  41307. }
  41308. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  41309. segment.offsetIndex = offsetIndex;
  41310. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  41311. }
  41312. var offsets = [];
  41313. for (j = 0; j < offsetsCount; j++) {
  41314. offsets.push(font.getUint16());
  41315. }
  41316. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41317. segment = segments[segIndex];
  41318. start = segment.start;
  41319. var end = segment.end;
  41320. var delta = segment.delta;
  41321. offsetIndex = segment.offsetIndex;
  41322. for (j = start; j <= end; j++) {
  41323. if (j === 0xFFFF) {
  41324. continue;
  41325. }
  41326. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  41327. glyphId = glyphId + delta & 0xFFFF;
  41328. if (glyphId === 0) {
  41329. continue;
  41330. }
  41331. mappings.push({
  41332. charCode: j,
  41333. glyphId: glyphId
  41334. });
  41335. }
  41336. }
  41337. } else if (format === 6) {
  41338. var firstCode = font.getUint16();
  41339. var entryCount = font.getUint16();
  41340. for (j = 0; j < entryCount; j++) {
  41341. glyphId = font.getUint16();
  41342. var charCode = firstCode + j;
  41343. mappings.push({
  41344. charCode: charCode,
  41345. glyphId: glyphId
  41346. });
  41347. }
  41348. } else {
  41349. warn('cmap table has unsupported format: ' + format);
  41350. return {
  41351. platformId: -1,
  41352. encodingId: -1,
  41353. mappings: [],
  41354. hasShortCmap: false
  41355. };
  41356. }
  41357. mappings.sort(function (a, b) {
  41358. return a.charCode - b.charCode;
  41359. });
  41360. for (i = 1; i < mappings.length; i++) {
  41361. if (mappings[i - 1].charCode === mappings[i].charCode) {
  41362. mappings.splice(i, 1);
  41363. i--;
  41364. }
  41365. }
  41366. return {
  41367. platformId: potentialTable.platformId,
  41368. encodingId: potentialTable.encodingId,
  41369. mappings: mappings,
  41370. hasShortCmap: hasShortCmap
  41371. };
  41372. }
  41373. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  41374. if (!header) {
  41375. if (metrics) {
  41376. metrics.data = null;
  41377. }
  41378. return;
  41379. }
  41380. font.pos = (font.start ? font.start : 0) + header.offset;
  41381. font.pos += header.length - 2;
  41382. var numOfMetrics = font.getUint16();
  41383. if (numOfMetrics > numGlyphs) {
  41384. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  41385. numOfMetrics = numGlyphs;
  41386. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  41387. header.data[35] = numOfMetrics & 0x00ff;
  41388. }
  41389. var numOfSidebearings = numGlyphs - numOfMetrics;
  41390. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  41391. if (numMissing > 0) {
  41392. var entries = new Uint8Array(metrics.length + numMissing * 2);
  41393. entries.set(metrics.data);
  41394. metrics.data = entries;
  41395. }
  41396. }
  41397. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  41398. if (sourceEnd - sourceStart <= 12) {
  41399. return 0;
  41400. }
  41401. var glyf = source.subarray(sourceStart, sourceEnd);
  41402. var contoursCount = glyf[0] << 8 | glyf[1];
  41403. if (contoursCount & 0x8000) {
  41404. dest.set(glyf, destStart);
  41405. return glyf.length;
  41406. }
  41407. var i, j = 10, flagsCount = 0;
  41408. for (i = 0; i < contoursCount; i++) {
  41409. var endPoint = glyf[j] << 8 | glyf[j + 1];
  41410. flagsCount = endPoint + 1;
  41411. j += 2;
  41412. }
  41413. var instructionsStart = j;
  41414. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  41415. j += 2 + instructionsLength;
  41416. var instructionsEnd = j;
  41417. var coordinatesLength = 0;
  41418. for (i = 0; i < flagsCount; i++) {
  41419. var flag = glyf[j++];
  41420. if (flag & 0xC0) {
  41421. glyf[j - 1] = flag & 0x3F;
  41422. }
  41423. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  41424. coordinatesLength += xyLength;
  41425. if (flag & 8) {
  41426. var repeat = glyf[j++];
  41427. i += repeat;
  41428. coordinatesLength += repeat * xyLength;
  41429. }
  41430. }
  41431. if (coordinatesLength === 0) {
  41432. return 0;
  41433. }
  41434. var glyphDataLength = j + coordinatesLength;
  41435. if (glyphDataLength > glyf.length) {
  41436. return 0;
  41437. }
  41438. if (!hintsValid && instructionsLength > 0) {
  41439. dest.set(glyf.subarray(0, instructionsStart), destStart);
  41440. dest.set([
  41441. 0,
  41442. 0
  41443. ], destStart + instructionsStart);
  41444. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  41445. glyphDataLength -= instructionsLength;
  41446. if (glyf.length - glyphDataLength > 3) {
  41447. glyphDataLength = glyphDataLength + 3 & ~3;
  41448. }
  41449. return glyphDataLength;
  41450. }
  41451. if (glyf.length - glyphDataLength > 3) {
  41452. glyphDataLength = glyphDataLength + 3 & ~3;
  41453. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  41454. return glyphDataLength;
  41455. }
  41456. dest.set(glyf, destStart);
  41457. return glyf.length;
  41458. }
  41459. function sanitizeHead(head, numGlyphs, locaLength) {
  41460. var data = head.data;
  41461. var version = int32(data[0], data[1], data[2], data[3]);
  41462. if (version >> 16 !== 1) {
  41463. info('Attempting to fix invalid version in head table: ' + version);
  41464. data[0] = 0;
  41465. data[1] = 1;
  41466. data[2] = 0;
  41467. data[3] = 0;
  41468. }
  41469. var indexToLocFormat = int16(data[50], data[51]);
  41470. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  41471. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  41472. var numGlyphsPlusOne = numGlyphs + 1;
  41473. if (locaLength === numGlyphsPlusOne << 1) {
  41474. data[50] = 0;
  41475. data[51] = 0;
  41476. } else if (locaLength === numGlyphsPlusOne << 2) {
  41477. data[50] = 0;
  41478. data[51] = 1;
  41479. } else {
  41480. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  41481. }
  41482. }
  41483. }
  41484. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  41485. var itemSize, itemDecode, itemEncode;
  41486. if (isGlyphLocationsLong) {
  41487. itemSize = 4;
  41488. itemDecode = function fontItemDecodeLong(data, offset) {
  41489. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  41490. };
  41491. itemEncode = function fontItemEncodeLong(data, offset, value) {
  41492. data[offset] = value >>> 24 & 0xFF;
  41493. data[offset + 1] = value >> 16 & 0xFF;
  41494. data[offset + 2] = value >> 8 & 0xFF;
  41495. data[offset + 3] = value & 0xFF;
  41496. };
  41497. } else {
  41498. itemSize = 2;
  41499. itemDecode = function fontItemDecode(data, offset) {
  41500. return data[offset] << 9 | data[offset + 1] << 1;
  41501. };
  41502. itemEncode = function fontItemEncode(data, offset, value) {
  41503. data[offset] = value >> 9 & 0xFF;
  41504. data[offset + 1] = value >> 1 & 0xFF;
  41505. };
  41506. }
  41507. var locaData = loca.data;
  41508. var locaDataSize = itemSize * (1 + numGlyphs);
  41509. if (locaData.length !== locaDataSize) {
  41510. locaData = new Uint8Array(locaDataSize);
  41511. locaData.set(loca.data.subarray(0, locaDataSize));
  41512. loca.data = locaData;
  41513. }
  41514. var oldGlyfData = glyf.data;
  41515. var oldGlyfDataLength = oldGlyfData.length;
  41516. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  41517. var startOffset = itemDecode(locaData, 0);
  41518. var writeOffset = 0;
  41519. var missingGlyphData = Object.create(null);
  41520. itemEncode(locaData, 0, writeOffset);
  41521. var i, j;
  41522. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41523. var endOffset = itemDecode(locaData, j);
  41524. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  41525. endOffset = oldGlyfDataLength;
  41526. }
  41527. if (endOffset > oldGlyfDataLength) {
  41528. itemEncode(locaData, j, writeOffset);
  41529. startOffset = endOffset;
  41530. continue;
  41531. }
  41532. if (startOffset === endOffset) {
  41533. missingGlyphData[i] = true;
  41534. }
  41535. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  41536. writeOffset += newLength;
  41537. itemEncode(locaData, j, writeOffset);
  41538. startOffset = endOffset;
  41539. }
  41540. if (writeOffset === 0) {
  41541. var simpleGlyph = new Uint8Array([
  41542. 0,
  41543. 1,
  41544. 0,
  41545. 0,
  41546. 0,
  41547. 0,
  41548. 0,
  41549. 0,
  41550. 0,
  41551. 0,
  41552. 0,
  41553. 0,
  41554. 0,
  41555. 0,
  41556. 49,
  41557. 0
  41558. ]);
  41559. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41560. itemEncode(locaData, j, simpleGlyph.length);
  41561. }
  41562. glyf.data = simpleGlyph;
  41563. return missingGlyphData;
  41564. }
  41565. if (dupFirstEntry) {
  41566. var firstEntryLength = itemDecode(locaData, itemSize);
  41567. if (newGlyfData.length > firstEntryLength + writeOffset) {
  41568. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  41569. } else {
  41570. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  41571. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  41572. }
  41573. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  41574. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  41575. } else {
  41576. glyf.data = newGlyfData.subarray(0, writeOffset);
  41577. }
  41578. return missingGlyphData;
  41579. }
  41580. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  41581. var start = (font.start ? font.start : 0) + post.offset;
  41582. font.pos = start;
  41583. var length = post.length, end = start + length;
  41584. var version = font.getInt32();
  41585. font.getBytes(28);
  41586. var glyphNames;
  41587. var valid = true;
  41588. var i;
  41589. switch (version) {
  41590. case 0x00010000:
  41591. glyphNames = MacStandardGlyphOrdering;
  41592. break;
  41593. case 0x00020000:
  41594. var numGlyphs = font.getUint16();
  41595. if (numGlyphs !== maxpNumGlyphs) {
  41596. valid = false;
  41597. break;
  41598. }
  41599. var glyphNameIndexes = [];
  41600. for (i = 0; i < numGlyphs; ++i) {
  41601. var index = font.getUint16();
  41602. if (index >= 32768) {
  41603. valid = false;
  41604. break;
  41605. }
  41606. glyphNameIndexes.push(index);
  41607. }
  41608. if (!valid) {
  41609. break;
  41610. }
  41611. var customNames = [];
  41612. var strBuf = [];
  41613. while (font.pos < end) {
  41614. var stringLength = font.getByte();
  41615. strBuf.length = stringLength;
  41616. for (i = 0; i < stringLength; ++i) {
  41617. strBuf[i] = String.fromCharCode(font.getByte());
  41618. }
  41619. customNames.push(strBuf.join(''));
  41620. }
  41621. glyphNames = [];
  41622. for (i = 0; i < numGlyphs; ++i) {
  41623. var j = glyphNameIndexes[i];
  41624. if (j < 258) {
  41625. glyphNames.push(MacStandardGlyphOrdering[j]);
  41626. continue;
  41627. }
  41628. glyphNames.push(customNames[j - 258]);
  41629. }
  41630. break;
  41631. case 0x00030000:
  41632. break;
  41633. default:
  41634. warn('Unknown/unsupported post table version ' + version);
  41635. valid = false;
  41636. if (properties.defaultEncoding) {
  41637. glyphNames = properties.defaultEncoding;
  41638. }
  41639. break;
  41640. }
  41641. properties.glyphNames = glyphNames;
  41642. return valid;
  41643. }
  41644. function readNameTable(nameTable) {
  41645. var start = (font.start ? font.start : 0) + nameTable.offset;
  41646. font.pos = start;
  41647. var names = [
  41648. [],
  41649. []
  41650. ];
  41651. var length = nameTable.length, end = start + length;
  41652. var format = font.getUint16();
  41653. var FORMAT_0_HEADER_LENGTH = 6;
  41654. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  41655. return names;
  41656. }
  41657. var numRecords = font.getUint16();
  41658. var stringsStart = font.getUint16();
  41659. var records = [];
  41660. var NAME_RECORD_LENGTH = 12;
  41661. var i, ii;
  41662. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  41663. var r = {
  41664. platform: font.getUint16(),
  41665. encoding: font.getUint16(),
  41666. language: font.getUint16(),
  41667. name: font.getUint16(),
  41668. length: font.getUint16(),
  41669. offset: font.getUint16()
  41670. };
  41671. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  41672. records.push(r);
  41673. }
  41674. }
  41675. for (i = 0, ii = records.length; i < ii; i++) {
  41676. var record = records[i];
  41677. if (record.length <= 0) {
  41678. continue;
  41679. }
  41680. var pos = start + stringsStart + record.offset;
  41681. if (pos + record.length > end) {
  41682. continue;
  41683. }
  41684. font.pos = pos;
  41685. var nameIndex = record.name;
  41686. if (record.encoding) {
  41687. var str = '';
  41688. for (var j = 0, jj = record.length; j < jj; j += 2) {
  41689. str += String.fromCharCode(font.getUint16());
  41690. }
  41691. names[1][nameIndex] = str;
  41692. } else {
  41693. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  41694. }
  41695. }
  41696. return names;
  41697. }
  41698. var TTOpsStackDeltas = [
  41699. 0,
  41700. 0,
  41701. 0,
  41702. 0,
  41703. 0,
  41704. 0,
  41705. 0,
  41706. 0,
  41707. -2,
  41708. -2,
  41709. -2,
  41710. -2,
  41711. 0,
  41712. 0,
  41713. -2,
  41714. -5,
  41715. -1,
  41716. -1,
  41717. -1,
  41718. -1,
  41719. -1,
  41720. -1,
  41721. -1,
  41722. -1,
  41723. 0,
  41724. 0,
  41725. -1,
  41726. 0,
  41727. -1,
  41728. -1,
  41729. -1,
  41730. -1,
  41731. 1,
  41732. -1,
  41733. -999,
  41734. 0,
  41735. 1,
  41736. 0,
  41737. -1,
  41738. -2,
  41739. 0,
  41740. -1,
  41741. -2,
  41742. -1,
  41743. -1,
  41744. 0,
  41745. -1,
  41746. -1,
  41747. 0,
  41748. 0,
  41749. -999,
  41750. -999,
  41751. -1,
  41752. -1,
  41753. -1,
  41754. -1,
  41755. -2,
  41756. -999,
  41757. -2,
  41758. -2,
  41759. -999,
  41760. 0,
  41761. -2,
  41762. -2,
  41763. 0,
  41764. 0,
  41765. -2,
  41766. 0,
  41767. -2,
  41768. 0,
  41769. 0,
  41770. 0,
  41771. -2,
  41772. -1,
  41773. -1,
  41774. 1,
  41775. 1,
  41776. 0,
  41777. 0,
  41778. -1,
  41779. -1,
  41780. -1,
  41781. -1,
  41782. -1,
  41783. -1,
  41784. -1,
  41785. 0,
  41786. 0,
  41787. -1,
  41788. 0,
  41789. -1,
  41790. -1,
  41791. 0,
  41792. -999,
  41793. -1,
  41794. -1,
  41795. -1,
  41796. -1,
  41797. -1,
  41798. -1,
  41799. 0,
  41800. 0,
  41801. 0,
  41802. 0,
  41803. 0,
  41804. 0,
  41805. 0,
  41806. 0,
  41807. 0,
  41808. 0,
  41809. 0,
  41810. 0,
  41811. -2,
  41812. -999,
  41813. -999,
  41814. -999,
  41815. -999,
  41816. -999,
  41817. -1,
  41818. -1,
  41819. -2,
  41820. -2,
  41821. 0,
  41822. 0,
  41823. 0,
  41824. 0,
  41825. -1,
  41826. -1,
  41827. -999,
  41828. -2,
  41829. -2,
  41830. 0,
  41831. 0,
  41832. -1,
  41833. -2,
  41834. -2,
  41835. 0,
  41836. 0,
  41837. 0,
  41838. -1,
  41839. -1,
  41840. -1,
  41841. -2
  41842. ];
  41843. function sanitizeTTProgram(table, ttContext) {
  41844. var data = table.data;
  41845. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41846. var stack = [];
  41847. var callstack = [];
  41848. var functionsCalled = [];
  41849. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41850. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41851. for (var ii = data.length; i < ii;) {
  41852. var op = data[i++];
  41853. if (op === 0x40) {
  41854. n = data[i++];
  41855. if (inFDEF || inELSE) {
  41856. i += n;
  41857. } else {
  41858. for (j = 0; j < n; j++) {
  41859. stack.push(data[i++]);
  41860. }
  41861. }
  41862. } else if (op === 0x41) {
  41863. n = data[i++];
  41864. if (inFDEF || inELSE) {
  41865. i += n * 2;
  41866. } else {
  41867. for (j = 0; j < n; j++) {
  41868. b = data[i++];
  41869. stack.push(b << 8 | data[i++]);
  41870. }
  41871. }
  41872. } else if ((op & 0xF8) === 0xB0) {
  41873. n = op - 0xB0 + 1;
  41874. if (inFDEF || inELSE) {
  41875. i += n;
  41876. } else {
  41877. for (j = 0; j < n; j++) {
  41878. stack.push(data[i++]);
  41879. }
  41880. }
  41881. } else if ((op & 0xF8) === 0xB8) {
  41882. n = op - 0xB8 + 1;
  41883. if (inFDEF || inELSE) {
  41884. i += n * 2;
  41885. } else {
  41886. for (j = 0; j < n; j++) {
  41887. b = data[i++];
  41888. stack.push(b << 8 | data[i++]);
  41889. }
  41890. }
  41891. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41892. if (!inFDEF && !inELSE) {
  41893. funcId = stack[stack.length - 1];
  41894. ttContext.functionsUsed[funcId] = true;
  41895. if (funcId in ttContext.functionsStackDeltas) {
  41896. stack.length += ttContext.functionsStackDeltas[funcId];
  41897. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41898. callstack.push({
  41899. data: data,
  41900. i: i,
  41901. stackTop: stack.length - 1
  41902. });
  41903. functionsCalled.push(funcId);
  41904. pc = ttContext.functionsDefined[funcId];
  41905. if (!pc) {
  41906. warn('TT: CALL non-existent function');
  41907. ttContext.hintsValid = false;
  41908. return;
  41909. }
  41910. data = pc.data;
  41911. i = pc.i;
  41912. }
  41913. }
  41914. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41915. if (inFDEF || inELSE) {
  41916. warn('TT: nested FDEFs not allowed');
  41917. tooComplexToFollowFunctions = true;
  41918. }
  41919. inFDEF = true;
  41920. lastDeff = i;
  41921. funcId = stack.pop();
  41922. ttContext.functionsDefined[funcId] = {
  41923. data: data,
  41924. i: i
  41925. };
  41926. } else if (op === 0x2D) {
  41927. if (inFDEF) {
  41928. inFDEF = false;
  41929. lastEndf = i;
  41930. } else {
  41931. pc = callstack.pop();
  41932. if (!pc) {
  41933. warn('TT: ENDF bad stack');
  41934. ttContext.hintsValid = false;
  41935. return;
  41936. }
  41937. funcId = functionsCalled.pop();
  41938. data = pc.data;
  41939. i = pc.i;
  41940. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41941. }
  41942. } else if (op === 0x89) {
  41943. if (inFDEF || inELSE) {
  41944. warn('TT: nested IDEFs not allowed');
  41945. tooComplexToFollowFunctions = true;
  41946. }
  41947. inFDEF = true;
  41948. lastDeff = i;
  41949. } else if (op === 0x58) {
  41950. ++ifLevel;
  41951. } else if (op === 0x1B) {
  41952. inELSE = ifLevel;
  41953. } else if (op === 0x59) {
  41954. if (inELSE === ifLevel) {
  41955. inELSE = 0;
  41956. }
  41957. --ifLevel;
  41958. } else if (op === 0x1C) {
  41959. if (!inFDEF && !inELSE) {
  41960. var offset = stack[stack.length - 1];
  41961. if (offset > 0) {
  41962. i += offset - 1;
  41963. }
  41964. }
  41965. }
  41966. if (!inFDEF && !inELSE) {
  41967. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41968. if (op >= 0x71 && op <= 0x75) {
  41969. n = stack.pop();
  41970. if (!isNaN(n)) {
  41971. stackDelta = -n * 2;
  41972. }
  41973. }
  41974. while (stackDelta < 0 && stack.length > 0) {
  41975. stack.pop();
  41976. stackDelta++;
  41977. }
  41978. while (stackDelta > 0) {
  41979. stack.push(NaN);
  41980. stackDelta--;
  41981. }
  41982. }
  41983. }
  41984. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41985. var content = [data];
  41986. if (i > data.length) {
  41987. content.push(new Uint8Array(i - data.length));
  41988. }
  41989. if (lastDeff > lastEndf) {
  41990. warn('TT: complementing a missing function tail');
  41991. content.push(new Uint8Array([
  41992. 0x22,
  41993. 0x2D
  41994. ]));
  41995. }
  41996. foldTTTable(table, content);
  41997. }
  41998. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41999. if (ttContext.tooComplexToFollowFunctions) {
  42000. return;
  42001. }
  42002. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  42003. warn('TT: more functions defined than expected');
  42004. ttContext.hintsValid = false;
  42005. return;
  42006. }
  42007. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  42008. if (j > maxFunctionDefs) {
  42009. warn('TT: invalid function id: ' + j);
  42010. ttContext.hintsValid = false;
  42011. return;
  42012. }
  42013. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  42014. warn('TT: undefined function: ' + j);
  42015. ttContext.hintsValid = false;
  42016. return;
  42017. }
  42018. }
  42019. }
  42020. function foldTTTable(table, content) {
  42021. if (content.length > 1) {
  42022. var newLength = 0;
  42023. var j, jj;
  42024. for (j = 0, jj = content.length; j < jj; j++) {
  42025. newLength += content[j].length;
  42026. }
  42027. newLength = newLength + 3 & ~3;
  42028. var result = new Uint8Array(newLength);
  42029. var pos = 0;
  42030. for (j = 0, jj = content.length; j < jj; j++) {
  42031. result.set(content[j], pos);
  42032. pos += content[j].length;
  42033. }
  42034. table.data = result;
  42035. table.length = newLength;
  42036. }
  42037. }
  42038. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  42039. var ttContext = {
  42040. functionsDefined: [],
  42041. functionsUsed: [],
  42042. functionsStackDeltas: [],
  42043. tooComplexToFollowFunctions: false,
  42044. hintsValid: true
  42045. };
  42046. if (fpgm) {
  42047. sanitizeTTProgram(fpgm, ttContext);
  42048. }
  42049. if (prep) {
  42050. sanitizeTTProgram(prep, ttContext);
  42051. }
  42052. if (fpgm) {
  42053. checkInvalidFunctions(ttContext, maxFunctionDefs);
  42054. }
  42055. if (cvt && cvt.length & 1) {
  42056. var cvtData = new Uint8Array(cvt.length + 1);
  42057. cvtData.set(cvt.data);
  42058. cvt.data = cvtData;
  42059. }
  42060. return ttContext.hintsValid;
  42061. }
  42062. font = new Stream(new Uint8Array(font.getBytes()));
  42063. var VALID_TABLES = [
  42064. 'OS/2',
  42065. 'cmap',
  42066. 'head',
  42067. 'hhea',
  42068. 'hmtx',
  42069. 'maxp',
  42070. 'name',
  42071. 'post',
  42072. 'loca',
  42073. 'glyf',
  42074. 'fpgm',
  42075. 'prep',
  42076. 'cvt ',
  42077. 'CFF '
  42078. ];
  42079. var header = readOpenTypeHeader(font);
  42080. var numTables = header.numTables;
  42081. var cff, cffFile;
  42082. var tables = Object.create(null);
  42083. tables['OS/2'] = null;
  42084. tables['cmap'] = null;
  42085. tables['head'] = null;
  42086. tables['hhea'] = null;
  42087. tables['hmtx'] = null;
  42088. tables['maxp'] = null;
  42089. tables['name'] = null;
  42090. tables['post'] = null;
  42091. var table;
  42092. for (var i = 0; i < numTables; i++) {
  42093. table = readTableEntry(font);
  42094. if (VALID_TABLES.indexOf(table.tag) < 0) {
  42095. continue;
  42096. }
  42097. if (table.length === 0) {
  42098. continue;
  42099. }
  42100. tables[table.tag] = table;
  42101. }
  42102. var isTrueType = !tables['CFF '];
  42103. if (!isTrueType) {
  42104. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  42105. cffFile = new Stream(tables['CFF '].data);
  42106. cff = new CFFFont(cffFile, properties);
  42107. adjustWidths(properties);
  42108. return this.convert(name, cff, properties);
  42109. }
  42110. delete tables['glyf'];
  42111. delete tables['loca'];
  42112. delete tables['fpgm'];
  42113. delete tables['prep'];
  42114. delete tables['cvt '];
  42115. this.isOpenType = true;
  42116. } else {
  42117. if (!tables['loca']) {
  42118. error('Required "loca" table is not found');
  42119. }
  42120. if (!tables['glyf']) {
  42121. warn('Required "glyf" table is not found -- trying to recover.');
  42122. tables['glyf'] = {
  42123. tag: 'glyf',
  42124. data: new Uint8Array(0)
  42125. };
  42126. }
  42127. this.isOpenType = false;
  42128. }
  42129. if (!tables['maxp']) {
  42130. error('Required "maxp" table is not found');
  42131. }
  42132. font.pos = (font.start || 0) + tables['maxp'].offset;
  42133. var version = font.getInt32();
  42134. var numGlyphs = font.getUint16();
  42135. var maxFunctionDefs = 0;
  42136. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  42137. font.pos += 8;
  42138. var maxZones = font.getUint16();
  42139. if (maxZones > 2) {
  42140. tables['maxp'].data[14] = 0;
  42141. tables['maxp'].data[15] = 2;
  42142. }
  42143. font.pos += 4;
  42144. maxFunctionDefs = font.getUint16();
  42145. }
  42146. var dupFirstEntry = false;
  42147. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  42148. dupFirstEntry = true;
  42149. numGlyphs++;
  42150. tables['maxp'].data[4] = numGlyphs >> 8;
  42151. tables['maxp'].data[5] = numGlyphs & 255;
  42152. }
  42153. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  42154. if (!hintsValid) {
  42155. delete tables['fpgm'];
  42156. delete tables['prep'];
  42157. delete tables['cvt '];
  42158. }
  42159. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  42160. if (!tables['head']) {
  42161. error('Required "head" table is not found');
  42162. }
  42163. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  42164. var missingGlyphs = Object.create(null);
  42165. if (isTrueType) {
  42166. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  42167. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  42168. }
  42169. if (!tables['hhea']) {
  42170. error('Required "hhea" table is not found');
  42171. }
  42172. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  42173. tables['hhea'].data[10] = 0xFF;
  42174. tables['hhea'].data[11] = 0xFF;
  42175. }
  42176. var metricsOverride = {
  42177. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  42178. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  42179. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  42180. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  42181. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  42182. };
  42183. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  42184. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  42185. if (tables['post']) {
  42186. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  42187. if (!valid) {
  42188. tables['post'] = null;
  42189. }
  42190. }
  42191. var charCodeToGlyphId = [], charCode;
  42192. var toUnicode = properties.toUnicode, widths = properties.widths;
  42193. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  42194. function hasGlyph(glyphId, charCode, widthCode) {
  42195. if (!missingGlyphs[glyphId]) {
  42196. return true;
  42197. }
  42198. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  42199. return true;
  42200. }
  42201. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  42202. return true;
  42203. }
  42204. return false;
  42205. }
  42206. if (properties.composite) {
  42207. var cidToGidMap = properties.cidToGidMap || [];
  42208. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  42209. properties.cMap.forEach(function (charCode, cid) {
  42210. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  42211. var glyphId = -1;
  42212. if (isCidToGidMapEmpty) {
  42213. glyphId = cid;
  42214. } else if (cidToGidMap[cid] !== undefined) {
  42215. glyphId = cidToGidMap[cid];
  42216. }
  42217. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  42218. charCodeToGlyphId[charCode] = glyphId;
  42219. }
  42220. });
  42221. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  42222. charCodeToGlyphId[0] = numGlyphs - 1;
  42223. }
  42224. } else {
  42225. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  42226. var cmapPlatformId = cmapTable.platformId;
  42227. var cmapEncodingId = cmapTable.encodingId;
  42228. var cmapMappings = cmapTable.mappings;
  42229. var cmapMappingsLength = cmapMappings.length;
  42230. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  42231. var baseEncoding = [];
  42232. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  42233. baseEncoding = getEncoding(properties.baseEncodingName);
  42234. }
  42235. var glyphsUnicodeMap = getGlyphsUnicode();
  42236. for (charCode = 0; charCode < 256; charCode++) {
  42237. var glyphName, standardGlyphName;
  42238. if (this.differences && charCode in this.differences) {
  42239. glyphName = this.differences[charCode];
  42240. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  42241. glyphName = baseEncoding[charCode];
  42242. } else {
  42243. glyphName = StandardEncoding[charCode];
  42244. }
  42245. if (!glyphName) {
  42246. continue;
  42247. }
  42248. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42249. var unicodeOrCharCode, isUnicode = false;
  42250. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  42251. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  42252. isUnicode = true;
  42253. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  42254. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  42255. }
  42256. var found = false;
  42257. for (i = 0; i < cmapMappingsLength; ++i) {
  42258. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  42259. continue;
  42260. }
  42261. var code = isUnicode ? charCode : unicodeOrCharCode;
  42262. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  42263. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42264. found = true;
  42265. break;
  42266. }
  42267. }
  42268. if (!found && properties.glyphNames) {
  42269. var glyphId = properties.glyphNames.indexOf(glyphName);
  42270. if (glyphId === -1 && standardGlyphName !== glyphName) {
  42271. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  42272. }
  42273. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  42274. charCodeToGlyphId[charCode] = glyphId;
  42275. found = true;
  42276. }
  42277. }
  42278. if (!found) {
  42279. charCodeToGlyphId[charCode] = 0;
  42280. }
  42281. }
  42282. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  42283. for (i = 0; i < cmapMappingsLength; ++i) {
  42284. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  42285. }
  42286. } else {
  42287. for (i = 0; i < cmapMappingsLength; ++i) {
  42288. charCode = cmapMappings[i].charCode & 0xFF;
  42289. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42290. }
  42291. }
  42292. }
  42293. if (charCodeToGlyphId.length === 0) {
  42294. charCodeToGlyphId[0] = 0;
  42295. }
  42296. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  42297. this.toFontChar = newMapping.toFontChar;
  42298. tables['cmap'] = {
  42299. tag: 'cmap',
  42300. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  42301. };
  42302. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  42303. tables['OS/2'] = {
  42304. tag: 'OS/2',
  42305. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  42306. };
  42307. }
  42308. if (!tables['post']) {
  42309. tables['post'] = {
  42310. tag: 'post',
  42311. data: createPostTable(properties)
  42312. };
  42313. }
  42314. if (!isTrueType) {
  42315. try {
  42316. cffFile = new Stream(tables['CFF '].data);
  42317. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  42318. cff = parser.parse();
  42319. var compiler = new CFFCompiler(cff);
  42320. tables['CFF '].data = compiler.compile();
  42321. } catch (e) {
  42322. warn('Failed to compile font ' + properties.loadedName);
  42323. }
  42324. }
  42325. if (!tables['name']) {
  42326. tables['name'] = {
  42327. tag: 'name',
  42328. data: createNameTable(this.name)
  42329. };
  42330. } else {
  42331. var namePrototype = readNameTable(tables['name']);
  42332. tables['name'].data = createNameTable(name, namePrototype);
  42333. }
  42334. var builder = new OpenTypeFileBuilder(header.version);
  42335. for (var tableTag in tables) {
  42336. builder.addTable(tableTag, tables[tableTag].data);
  42337. }
  42338. return builder.toArray();
  42339. },
  42340. convert: function Font_convert(fontName, font, properties) {
  42341. properties.fixedPitch = false;
  42342. if (properties.builtInEncoding) {
  42343. adjustToUnicode(properties, properties.builtInEncoding);
  42344. }
  42345. var mapping = font.getGlyphMapping(properties);
  42346. var newMapping = adjustMapping(mapping, properties);
  42347. this.toFontChar = newMapping.toFontChar;
  42348. var numGlyphs = font.numGlyphs;
  42349. function getCharCodes(charCodeToGlyphId, glyphId) {
  42350. var charCodes = null;
  42351. for (var charCode in charCodeToGlyphId) {
  42352. if (glyphId === charCodeToGlyphId[charCode]) {
  42353. if (!charCodes) {
  42354. charCodes = [];
  42355. }
  42356. charCodes.push(charCode | 0);
  42357. }
  42358. }
  42359. return charCodes;
  42360. }
  42361. function createCharCode(charCodeToGlyphId, glyphId) {
  42362. for (var charCode in charCodeToGlyphId) {
  42363. if (glyphId === charCodeToGlyphId[charCode]) {
  42364. return charCode | 0;
  42365. }
  42366. }
  42367. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  42368. return newMapping.nextAvailableFontCharCode++;
  42369. }
  42370. var seacs = font.seacs;
  42371. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  42372. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  42373. var charset = font.getCharset();
  42374. var seacMap = Object.create(null);
  42375. for (var glyphId in seacs) {
  42376. glyphId |= 0;
  42377. var seac = seacs[glyphId];
  42378. var baseGlyphName = StandardEncoding[seac[2]];
  42379. var accentGlyphName = StandardEncoding[seac[3]];
  42380. var baseGlyphId = charset.indexOf(baseGlyphName);
  42381. var accentGlyphId = charset.indexOf(accentGlyphName);
  42382. if (baseGlyphId < 0 || accentGlyphId < 0) {
  42383. continue;
  42384. }
  42385. var accentOffset = {
  42386. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  42387. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  42388. };
  42389. var charCodes = getCharCodes(mapping, glyphId);
  42390. if (!charCodes) {
  42391. continue;
  42392. }
  42393. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  42394. var charCode = charCodes[i];
  42395. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  42396. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  42397. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  42398. seacMap[charCode] = {
  42399. baseFontCharCode: baseFontCharCode,
  42400. accentFontCharCode: accentFontCharCode,
  42401. accentOffset: accentOffset
  42402. };
  42403. }
  42404. }
  42405. properties.seacMap = seacMap;
  42406. }
  42407. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  42408. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  42409. builder.addTable('CFF ', font.data);
  42410. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  42411. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  42412. 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');
  42413. 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));
  42414. builder.addTable('hmtx', function fontFieldsHmtx() {
  42415. var charstrings = font.charstrings;
  42416. var cffWidths = font.cff ? font.cff.widths : null;
  42417. var hmtx = '\x00\x00\x00\x00';
  42418. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  42419. var width = 0;
  42420. if (charstrings) {
  42421. var charstring = charstrings[i - 1];
  42422. width = 'width' in charstring ? charstring.width : 0;
  42423. } else if (cffWidths) {
  42424. width = Math.ceil(cffWidths[i] || 0);
  42425. }
  42426. hmtx += string16(width) + string16(0);
  42427. }
  42428. return hmtx;
  42429. }());
  42430. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  42431. builder.addTable('name', createNameTable(fontName));
  42432. builder.addTable('post', createPostTable(properties));
  42433. return builder.toArray();
  42434. },
  42435. get spaceWidth() {
  42436. if ('_shadowWidth' in this) {
  42437. return this._shadowWidth;
  42438. }
  42439. var possibleSpaceReplacements = [
  42440. 'space',
  42441. 'minus',
  42442. 'one',
  42443. 'i',
  42444. 'I'
  42445. ];
  42446. var width;
  42447. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  42448. var glyphName = possibleSpaceReplacements[i];
  42449. if (glyphName in this.widths) {
  42450. width = this.widths[glyphName];
  42451. break;
  42452. }
  42453. var glyphsUnicodeMap = getGlyphsUnicode();
  42454. var glyphUnicode = glyphsUnicodeMap[glyphName];
  42455. var charcode = 0;
  42456. if (this.composite) {
  42457. if (this.cMap.contains(glyphUnicode)) {
  42458. charcode = this.cMap.lookup(glyphUnicode);
  42459. }
  42460. }
  42461. if (!charcode && this.toUnicode) {
  42462. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  42463. }
  42464. if (charcode <= 0) {
  42465. charcode = glyphUnicode;
  42466. }
  42467. width = this.widths[charcode];
  42468. if (width) {
  42469. break;
  42470. }
  42471. }
  42472. width = width || this.defaultWidth;
  42473. this._shadowWidth = width;
  42474. return width;
  42475. },
  42476. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  42477. var fontCharCode, width, operatorListId;
  42478. var widthCode = charcode;
  42479. if (this.cMap && this.cMap.contains(charcode)) {
  42480. widthCode = this.cMap.lookup(charcode);
  42481. }
  42482. width = this.widths[widthCode];
  42483. width = isNum(width) ? width : this.defaultWidth;
  42484. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  42485. var unicode = this.toUnicode.get(charcode) || charcode;
  42486. if (typeof unicode === 'number') {
  42487. unicode = String.fromCharCode(unicode);
  42488. }
  42489. var isInFont = charcode in this.toFontChar;
  42490. fontCharCode = this.toFontChar[charcode] || charcode;
  42491. if (this.missingFile) {
  42492. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  42493. }
  42494. if (this.isType3Font) {
  42495. operatorListId = fontCharCode;
  42496. }
  42497. var accent = null;
  42498. if (this.seacMap && this.seacMap[charcode]) {
  42499. isInFont = true;
  42500. var seac = this.seacMap[charcode];
  42501. fontCharCode = seac.baseFontCharCode;
  42502. accent = {
  42503. fontChar: String.fromCharCode(seac.accentFontCharCode),
  42504. offset: seac.accentOffset
  42505. };
  42506. }
  42507. var fontChar = String.fromCharCode(fontCharCode);
  42508. var glyph = this.glyphCache[charcode];
  42509. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  42510. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  42511. this.glyphCache[charcode] = glyph;
  42512. }
  42513. return glyph;
  42514. },
  42515. charsToGlyphs: function Font_charsToGlyphs(chars) {
  42516. var charsCache = this.charsCache;
  42517. var glyphs, glyph, charcode;
  42518. if (charsCache) {
  42519. glyphs = charsCache[chars];
  42520. if (glyphs) {
  42521. return glyphs;
  42522. }
  42523. }
  42524. if (!charsCache) {
  42525. charsCache = this.charsCache = Object.create(null);
  42526. }
  42527. glyphs = [];
  42528. var charsCacheKey = chars;
  42529. var i = 0, ii;
  42530. if (this.cMap) {
  42531. var c = Object.create(null);
  42532. while (i < chars.length) {
  42533. this.cMap.readCharCode(chars, i, c);
  42534. charcode = c.charcode;
  42535. var length = c.length;
  42536. i += length;
  42537. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  42538. glyph = this.charToGlyph(charcode, isSpace);
  42539. glyphs.push(glyph);
  42540. }
  42541. } else {
  42542. for (i = 0, ii = chars.length; i < ii; ++i) {
  42543. charcode = chars.charCodeAt(i);
  42544. glyph = this.charToGlyph(charcode, charcode === 0x20);
  42545. glyphs.push(glyph);
  42546. }
  42547. }
  42548. return charsCache[charsCacheKey] = glyphs;
  42549. }
  42550. };
  42551. return Font;
  42552. }();
  42553. var ErrorFont = function ErrorFontClosure() {
  42554. function ErrorFont(error) {
  42555. this.error = error;
  42556. this.loadedName = 'g_font_error';
  42557. this.loading = false;
  42558. }
  42559. ErrorFont.prototype = {
  42560. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  42561. return [];
  42562. },
  42563. exportData: function ErrorFont_exportData() {
  42564. return { error: this.error };
  42565. }
  42566. };
  42567. return ErrorFont;
  42568. }();
  42569. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  42570. var charCodeToGlyphId = Object.create(null);
  42571. var glyphId, charCode, baseEncoding;
  42572. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  42573. if (properties.baseEncodingName) {
  42574. baseEncoding = getEncoding(properties.baseEncodingName);
  42575. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42576. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42577. if (glyphId >= 0) {
  42578. charCodeToGlyphId[charCode] = glyphId;
  42579. } else {
  42580. charCodeToGlyphId[charCode] = 0;
  42581. }
  42582. }
  42583. } else if (isSymbolicFont) {
  42584. for (charCode in builtInEncoding) {
  42585. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  42586. }
  42587. } else {
  42588. baseEncoding = StandardEncoding;
  42589. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42590. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42591. if (glyphId >= 0) {
  42592. charCodeToGlyphId[charCode] = glyphId;
  42593. } else {
  42594. charCodeToGlyphId[charCode] = 0;
  42595. }
  42596. }
  42597. }
  42598. var differences = properties.differences, glyphsUnicodeMap;
  42599. if (differences) {
  42600. for (charCode in differences) {
  42601. var glyphName = differences[charCode];
  42602. glyphId = glyphNames.indexOf(glyphName);
  42603. if (glyphId === -1) {
  42604. if (!glyphsUnicodeMap) {
  42605. glyphsUnicodeMap = getGlyphsUnicode();
  42606. }
  42607. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42608. if (standardGlyphName !== glyphName) {
  42609. glyphId = glyphNames.indexOf(standardGlyphName);
  42610. }
  42611. }
  42612. if (glyphId >= 0) {
  42613. charCodeToGlyphId[charCode] = glyphId;
  42614. } else {
  42615. charCodeToGlyphId[charCode] = 0;
  42616. }
  42617. }
  42618. }
  42619. return charCodeToGlyphId;
  42620. }
  42621. var Type1Font = function Type1FontClosure() {
  42622. function findBlock(streamBytes, signature, startIndex) {
  42623. var streamBytesLength = streamBytes.length;
  42624. var signatureLength = signature.length;
  42625. var scanLength = streamBytesLength - signatureLength;
  42626. var i = startIndex, j, found = false;
  42627. while (i < scanLength) {
  42628. j = 0;
  42629. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42630. j++;
  42631. }
  42632. if (j >= signatureLength) {
  42633. i += j;
  42634. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  42635. i++;
  42636. }
  42637. found = true;
  42638. break;
  42639. }
  42640. i++;
  42641. }
  42642. return {
  42643. found: found,
  42644. length: i
  42645. };
  42646. }
  42647. function getHeaderBlock(stream, suggestedLength) {
  42648. var EEXEC_SIGNATURE = [
  42649. 0x65,
  42650. 0x65,
  42651. 0x78,
  42652. 0x65,
  42653. 0x63
  42654. ];
  42655. var streamStartPos = stream.pos;
  42656. var headerBytes, headerBytesLength, block;
  42657. try {
  42658. headerBytes = stream.getBytes(suggestedLength);
  42659. headerBytesLength = headerBytes.length;
  42660. } catch (ex) {
  42661. if (ex instanceof MissingDataException) {
  42662. throw ex;
  42663. }
  42664. }
  42665. if (headerBytesLength === suggestedLength) {
  42666. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42667. if (block.found && block.length === suggestedLength) {
  42668. return {
  42669. stream: new Stream(headerBytes),
  42670. length: suggestedLength
  42671. };
  42672. }
  42673. }
  42674. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  42675. stream.pos = streamStartPos;
  42676. var SCAN_BLOCK_LENGTH = 2048;
  42677. var actualLength;
  42678. while (true) {
  42679. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42680. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42681. if (block.length === 0) {
  42682. break;
  42683. }
  42684. stream.pos += block.length;
  42685. if (block.found) {
  42686. actualLength = stream.pos - streamStartPos;
  42687. break;
  42688. }
  42689. }
  42690. stream.pos = streamStartPos;
  42691. if (actualLength) {
  42692. return {
  42693. stream: new Stream(stream.getBytes(actualLength)),
  42694. length: actualLength
  42695. };
  42696. }
  42697. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  42698. return {
  42699. stream: new Stream(stream.getBytes(suggestedLength)),
  42700. length: suggestedLength
  42701. };
  42702. }
  42703. function getEexecBlock(stream, suggestedLength) {
  42704. var eexecBytes = stream.getBytes();
  42705. return {
  42706. stream: new Stream(eexecBytes),
  42707. length: eexecBytes.length
  42708. };
  42709. }
  42710. function Type1Font(name, file, properties) {
  42711. var PFB_HEADER_SIZE = 6;
  42712. var headerBlockLength = properties.length1;
  42713. var eexecBlockLength = properties.length2;
  42714. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42715. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42716. if (pfbHeaderPresent) {
  42717. file.skip(PFB_HEADER_SIZE);
  42718. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42719. }
  42720. var headerBlock = getHeaderBlock(file, headerBlockLength);
  42721. headerBlockLength = headerBlock.length;
  42722. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  42723. headerBlockParser.extractFontHeader(properties);
  42724. if (pfbHeaderPresent) {
  42725. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42726. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42727. }
  42728. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  42729. eexecBlockLength = eexecBlock.length;
  42730. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  42731. var data = eexecBlockParser.extractFontProgram();
  42732. for (var info in data.properties) {
  42733. properties[info] = data.properties[info];
  42734. }
  42735. var charstrings = data.charstrings;
  42736. var type2Charstrings = this.getType2Charstrings(charstrings);
  42737. var subrs = this.getType2Subrs(data.subrs);
  42738. this.charstrings = charstrings;
  42739. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42740. this.seacs = this.getSeacs(data.charstrings);
  42741. }
  42742. Type1Font.prototype = {
  42743. get numGlyphs() {
  42744. return this.charstrings.length + 1;
  42745. },
  42746. getCharset: function Type1Font_getCharset() {
  42747. var charset = ['.notdef'];
  42748. var charstrings = this.charstrings;
  42749. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42750. charset.push(charstrings[glyphId].glyphName);
  42751. }
  42752. return charset;
  42753. },
  42754. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  42755. var charstrings = this.charstrings;
  42756. var glyphNames = ['.notdef'], glyphId;
  42757. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42758. glyphNames.push(charstrings[glyphId].glyphName);
  42759. }
  42760. var encoding = properties.builtInEncoding;
  42761. if (encoding) {
  42762. var builtInEncoding = Object.create(null);
  42763. for (var charCode in encoding) {
  42764. glyphId = glyphNames.indexOf(encoding[charCode]);
  42765. if (glyphId >= 0) {
  42766. builtInEncoding[charCode] = glyphId;
  42767. }
  42768. }
  42769. }
  42770. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  42771. },
  42772. getSeacs: function Type1Font_getSeacs(charstrings) {
  42773. var i, ii;
  42774. var seacMap = [];
  42775. for (i = 0, ii = charstrings.length; i < ii; i++) {
  42776. var charstring = charstrings[i];
  42777. if (charstring.seac) {
  42778. seacMap[i + 1] = charstring.seac;
  42779. }
  42780. }
  42781. return seacMap;
  42782. },
  42783. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  42784. var type2Charstrings = [];
  42785. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42786. type2Charstrings.push(type1Charstrings[i].charstring);
  42787. }
  42788. return type2Charstrings;
  42789. },
  42790. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  42791. var bias = 0;
  42792. var count = type1Subrs.length;
  42793. if (count < 1133) {
  42794. bias = 107;
  42795. } else if (count < 33769) {
  42796. bias = 1131;
  42797. } else {
  42798. bias = 32768;
  42799. }
  42800. var type2Subrs = [];
  42801. var i;
  42802. for (i = 0; i < bias; i++) {
  42803. type2Subrs.push([0x0B]);
  42804. }
  42805. for (i = 0; i < count; i++) {
  42806. type2Subrs.push(type1Subrs[i]);
  42807. }
  42808. return type2Subrs;
  42809. },
  42810. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  42811. var cff = new CFF();
  42812. cff.header = new CFFHeader(1, 0, 4, 4);
  42813. cff.names = [name];
  42814. var topDict = new CFFTopDict();
  42815. topDict.setByName('version', 391);
  42816. topDict.setByName('Notice', 392);
  42817. topDict.setByName('FullName', 393);
  42818. topDict.setByName('FamilyName', 394);
  42819. topDict.setByName('Weight', 395);
  42820. topDict.setByName('Encoding', null);
  42821. topDict.setByName('FontMatrix', properties.fontMatrix);
  42822. topDict.setByName('FontBBox', properties.bbox);
  42823. topDict.setByName('charset', null);
  42824. topDict.setByName('CharStrings', null);
  42825. topDict.setByName('Private', null);
  42826. cff.topDict = topDict;
  42827. var strings = new CFFStrings();
  42828. strings.add('Version 0.11');
  42829. strings.add('See original notice');
  42830. strings.add(name);
  42831. strings.add(name);
  42832. strings.add('Medium');
  42833. cff.strings = strings;
  42834. cff.globalSubrIndex = new CFFIndex();
  42835. var count = glyphs.length;
  42836. var charsetArray = [0];
  42837. var i, ii;
  42838. for (i = 0; i < count; i++) {
  42839. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  42840. if (index === -1) {
  42841. index = 0;
  42842. }
  42843. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  42844. }
  42845. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42846. var charStringsIndex = new CFFIndex();
  42847. charStringsIndex.add([
  42848. 0x8B,
  42849. 0x0E
  42850. ]);
  42851. for (i = 0; i < count; i++) {
  42852. var glyph = glyphs[i];
  42853. if (glyph.length === 0) {
  42854. charStringsIndex.add([
  42855. 0x8B,
  42856. 0x0E
  42857. ]);
  42858. continue;
  42859. }
  42860. charStringsIndex.add(glyph);
  42861. }
  42862. cff.charStrings = charStringsIndex;
  42863. var privateDict = new CFFPrivateDict();
  42864. privateDict.setByName('Subrs', null);
  42865. var fields = [
  42866. 'BlueValues',
  42867. 'OtherBlues',
  42868. 'FamilyBlues',
  42869. 'FamilyOtherBlues',
  42870. 'StemSnapH',
  42871. 'StemSnapV',
  42872. 'BlueShift',
  42873. 'BlueFuzz',
  42874. 'BlueScale',
  42875. 'LanguageGroup',
  42876. 'ExpansionFactor',
  42877. 'ForceBold',
  42878. 'StdHW',
  42879. 'StdVW'
  42880. ];
  42881. for (i = 0, ii = fields.length; i < ii; i++) {
  42882. var field = fields[i];
  42883. if (!(field in properties.privateData)) {
  42884. continue;
  42885. }
  42886. var value = properties.privateData[field];
  42887. if (isArray(value)) {
  42888. for (var j = value.length - 1; j > 0; j--) {
  42889. value[j] -= value[j - 1];
  42890. }
  42891. }
  42892. privateDict.setByName(field, value);
  42893. }
  42894. cff.topDict.privateDict = privateDict;
  42895. var subrIndex = new CFFIndex();
  42896. for (i = 0, ii = subrs.length; i < ii; i++) {
  42897. subrIndex.add(subrs[i]);
  42898. }
  42899. privateDict.subrsIndex = subrIndex;
  42900. var compiler = new CFFCompiler(cff);
  42901. return compiler.compile();
  42902. }
  42903. };
  42904. return Type1Font;
  42905. }();
  42906. var CFFFont = function CFFFontClosure() {
  42907. function CFFFont(file, properties) {
  42908. this.properties = properties;
  42909. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42910. this.cff = parser.parse();
  42911. var compiler = new CFFCompiler(this.cff);
  42912. this.seacs = this.cff.seacs;
  42913. try {
  42914. this.data = compiler.compile();
  42915. } catch (e) {
  42916. warn('Failed to compile font ' + properties.loadedName);
  42917. this.data = file;
  42918. }
  42919. }
  42920. CFFFont.prototype = {
  42921. get numGlyphs() {
  42922. return this.cff.charStrings.count;
  42923. },
  42924. getCharset: function CFFFont_getCharset() {
  42925. return this.cff.charset.charset;
  42926. },
  42927. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42928. var cff = this.cff;
  42929. var properties = this.properties;
  42930. var charsets = cff.charset.charset;
  42931. var charCodeToGlyphId;
  42932. var glyphId;
  42933. if (properties.composite) {
  42934. charCodeToGlyphId = Object.create(null);
  42935. if (cff.isCIDFont) {
  42936. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42937. var cid = charsets[glyphId];
  42938. var charCode = properties.cMap.charCodeOf(cid);
  42939. charCodeToGlyphId[charCode] = glyphId;
  42940. }
  42941. } else {
  42942. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42943. charCodeToGlyphId[glyphId] = glyphId;
  42944. }
  42945. }
  42946. return charCodeToGlyphId;
  42947. }
  42948. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42949. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42950. return charCodeToGlyphId;
  42951. }
  42952. };
  42953. return CFFFont;
  42954. }();
  42955. (function checkSeacSupport() {
  42956. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42957. SEAC_ANALYSIS_ENABLED = true;
  42958. }
  42959. }());
  42960. (function checkChromeWindows() {
  42961. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42962. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42963. }
  42964. }());
  42965. exports.ErrorFont = ErrorFont;
  42966. exports.Font = Font;
  42967. exports.FontFlags = FontFlags;
  42968. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42969. exports.ToUnicodeMap = ToUnicodeMap;
  42970. exports.getFontType = getFontType;
  42971. /***/ }),
  42972. /* 27 */
  42973. /***/ (function(module, exports, __w_pdfjs_require__) {
  42974. "use strict";
  42975. var sharedUtil = __w_pdfjs_require__(0);
  42976. var corePrimitives = __w_pdfjs_require__(1);
  42977. var coreColorSpace = __w_pdfjs_require__(3);
  42978. var coreStream = __w_pdfjs_require__(2);
  42979. var coreJpx = __w_pdfjs_require__(14);
  42980. var ImageKind = sharedUtil.ImageKind;
  42981. var assert = sharedUtil.assert;
  42982. var error = sharedUtil.error;
  42983. var info = sharedUtil.info;
  42984. var isArray = sharedUtil.isArray;
  42985. var warn = sharedUtil.warn;
  42986. var Name = corePrimitives.Name;
  42987. var isStream = corePrimitives.isStream;
  42988. var ColorSpace = coreColorSpace.ColorSpace;
  42989. var DecodeStream = coreStream.DecodeStream;
  42990. var JpegStream = coreStream.JpegStream;
  42991. var JpxImage = coreJpx.JpxImage;
  42992. var PDFImage = function PDFImageClosure() {
  42993. function handleImageData(image, nativeDecoder) {
  42994. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42995. return nativeDecoder.decode(image);
  42996. }
  42997. return Promise.resolve(image);
  42998. }
  42999. function decodeAndClamp(value, addend, coefficient, max) {
  43000. value = addend + value * coefficient;
  43001. return value < 0 ? 0 : value > max ? max : value;
  43002. }
  43003. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  43004. var length = w2 * h2;
  43005. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43006. var xRatio = w1 / w2;
  43007. var yRatio = h1 / h2;
  43008. var i, j, py, newIndex = 0, oldIndex;
  43009. var xScaled = new Uint16Array(w2);
  43010. var w1Scanline = w1;
  43011. for (i = 0; i < w2; i++) {
  43012. xScaled[i] = Math.floor(i * xRatio);
  43013. }
  43014. for (i = 0; i < h2; i++) {
  43015. py = Math.floor(i * yRatio) * w1Scanline;
  43016. for (j = 0; j < w2; j++) {
  43017. oldIndex = py + xScaled[j];
  43018. dest[newIndex++] = src[oldIndex];
  43019. }
  43020. }
  43021. return dest;
  43022. }
  43023. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  43024. this.image = image;
  43025. var dict = image.dict;
  43026. if (dict.has('Filter')) {
  43027. var filter = dict.get('Filter').name;
  43028. if (filter === 'JPXDecode') {
  43029. var jpxImage = new JpxImage();
  43030. jpxImage.parseImageProperties(image.stream);
  43031. image.stream.reset();
  43032. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43033. image.numComps = jpxImage.componentsCount;
  43034. } else if (filter === 'JBIG2Decode') {
  43035. image.bitsPerComponent = 1;
  43036. image.numComps = 1;
  43037. }
  43038. }
  43039. this.width = dict.get('Width', 'W');
  43040. this.height = dict.get('Height', 'H');
  43041. if (this.width < 1 || this.height < 1) {
  43042. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  43043. }
  43044. this.interpolate = dict.get('Interpolate', 'I') || false;
  43045. this.imageMask = dict.get('ImageMask', 'IM') || false;
  43046. this.matte = dict.get('Matte') || false;
  43047. var bitsPerComponent = image.bitsPerComponent;
  43048. if (!bitsPerComponent) {
  43049. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  43050. if (!bitsPerComponent) {
  43051. if (this.imageMask) {
  43052. bitsPerComponent = 1;
  43053. } else {
  43054. error('Bits per component missing in image: ' + this.imageMask);
  43055. }
  43056. }
  43057. }
  43058. this.bpc = bitsPerComponent;
  43059. if (!this.imageMask) {
  43060. var colorSpace = dict.get('ColorSpace', 'CS');
  43061. if (!colorSpace) {
  43062. info('JPX images (which do not require color spaces)');
  43063. switch (image.numComps) {
  43064. case 1:
  43065. colorSpace = Name.get('DeviceGray');
  43066. break;
  43067. case 3:
  43068. colorSpace = Name.get('DeviceRGB');
  43069. break;
  43070. case 4:
  43071. colorSpace = Name.get('DeviceCMYK');
  43072. break;
  43073. default:
  43074. error('JPX images with ' + this.numComps + ' color components not supported.');
  43075. }
  43076. }
  43077. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  43078. this.numComps = this.colorSpace.numComps;
  43079. }
  43080. this.decode = dict.getArray('Decode', 'D');
  43081. this.needsDecode = false;
  43082. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  43083. this.needsDecode = true;
  43084. var max = (1 << bitsPerComponent) - 1;
  43085. this.decodeCoefficients = [];
  43086. this.decodeAddends = [];
  43087. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43088. var dmin = this.decode[i];
  43089. var dmax = this.decode[i + 1];
  43090. this.decodeCoefficients[j] = dmax - dmin;
  43091. this.decodeAddends[j] = max * dmin;
  43092. }
  43093. }
  43094. if (smask) {
  43095. this.smask = new PDFImage(xref, res, smask, false);
  43096. } else if (mask) {
  43097. if (isStream(mask)) {
  43098. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  43099. if (!imageMask) {
  43100. warn('Ignoring /Mask in image without /ImageMask.');
  43101. } else {
  43102. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  43103. }
  43104. } else {
  43105. this.mask = mask;
  43106. }
  43107. }
  43108. }
  43109. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  43110. var imagePromise = handleImageData(image, nativeDecoder);
  43111. var smaskPromise;
  43112. var maskPromise;
  43113. var smask = image.dict.get('SMask');
  43114. var mask = image.dict.get('Mask');
  43115. if (smask) {
  43116. smaskPromise = handleImageData(smask, nativeDecoder);
  43117. maskPromise = Promise.resolve(null);
  43118. } else {
  43119. smaskPromise = Promise.resolve(null);
  43120. if (mask) {
  43121. if (isStream(mask)) {
  43122. maskPromise = handleImageData(mask, nativeDecoder);
  43123. } else if (isArray(mask)) {
  43124. maskPromise = Promise.resolve(mask);
  43125. } else {
  43126. warn('Unsupported mask format.');
  43127. maskPromise = Promise.resolve(null);
  43128. }
  43129. } else {
  43130. maskPromise = Promise.resolve(null);
  43131. }
  43132. }
  43133. return Promise.all([
  43134. imagePromise,
  43135. smaskPromise,
  43136. maskPromise
  43137. ]).then(function (results) {
  43138. var imageData = results[0];
  43139. var smaskData = results[1];
  43140. var maskData = results[2];
  43141. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  43142. });
  43143. };
  43144. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  43145. var computedLength = (width + 7 >> 3) * height;
  43146. var actualLength = imgArray.byteLength;
  43147. var haveFullData = computedLength === actualLength;
  43148. var data, i;
  43149. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43150. data = imgArray;
  43151. } else if (!inverseDecode) {
  43152. data = new Uint8Array(actualLength);
  43153. data.set(imgArray);
  43154. } else {
  43155. data = new Uint8Array(computedLength);
  43156. data.set(imgArray);
  43157. for (i = actualLength; i < computedLength; i++) {
  43158. data[i] = 0xff;
  43159. }
  43160. }
  43161. if (inverseDecode) {
  43162. for (i = 0; i < actualLength; i++) {
  43163. data[i] = ~data[i];
  43164. }
  43165. }
  43166. return {
  43167. data: data,
  43168. width: width,
  43169. height: height
  43170. };
  43171. };
  43172. PDFImage.prototype = {
  43173. get drawWidth() {
  43174. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43175. },
  43176. get drawHeight() {
  43177. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43178. },
  43179. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  43180. var bpc = this.bpc;
  43181. var numComps = this.numComps;
  43182. var decodeAddends = this.decodeAddends;
  43183. var decodeCoefficients = this.decodeCoefficients;
  43184. var max = (1 << bpc) - 1;
  43185. var i, ii;
  43186. if (bpc === 1) {
  43187. for (i = 0, ii = buffer.length; i < ii; i++) {
  43188. buffer[i] = +!buffer[i];
  43189. }
  43190. return;
  43191. }
  43192. var index = 0;
  43193. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43194. for (var j = 0; j < numComps; j++) {
  43195. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43196. index++;
  43197. }
  43198. }
  43199. },
  43200. getComponents: function PDFImage_getComponents(buffer) {
  43201. var bpc = this.bpc;
  43202. if (bpc === 8) {
  43203. return buffer;
  43204. }
  43205. var width = this.width;
  43206. var height = this.height;
  43207. var numComps = this.numComps;
  43208. var length = width * height * numComps;
  43209. var bufferPos = 0;
  43210. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43211. var rowComps = width * numComps;
  43212. var max = (1 << bpc) - 1;
  43213. var i = 0, ii, buf;
  43214. if (bpc === 1) {
  43215. var mask, loop1End, loop2End;
  43216. for (var j = 0; j < height; j++) {
  43217. loop1End = i + (rowComps & ~7);
  43218. loop2End = i + rowComps;
  43219. while (i < loop1End) {
  43220. buf = buffer[bufferPos++];
  43221. output[i] = buf >> 7 & 1;
  43222. output[i + 1] = buf >> 6 & 1;
  43223. output[i + 2] = buf >> 5 & 1;
  43224. output[i + 3] = buf >> 4 & 1;
  43225. output[i + 4] = buf >> 3 & 1;
  43226. output[i + 5] = buf >> 2 & 1;
  43227. output[i + 6] = buf >> 1 & 1;
  43228. output[i + 7] = buf & 1;
  43229. i += 8;
  43230. }
  43231. if (i < loop2End) {
  43232. buf = buffer[bufferPos++];
  43233. mask = 128;
  43234. while (i < loop2End) {
  43235. output[i++] = +!!(buf & mask);
  43236. mask >>= 1;
  43237. }
  43238. }
  43239. }
  43240. } else {
  43241. var bits = 0;
  43242. buf = 0;
  43243. for (i = 0, ii = length; i < ii; ++i) {
  43244. if (i % rowComps === 0) {
  43245. buf = 0;
  43246. bits = 0;
  43247. }
  43248. while (bits < bpc) {
  43249. buf = buf << 8 | buffer[bufferPos++];
  43250. bits += 8;
  43251. }
  43252. var remainingBits = bits - bpc;
  43253. var value = buf >> remainingBits;
  43254. output[i] = value < 0 ? 0 : value > max ? max : value;
  43255. buf = buf & (1 << remainingBits) - 1;
  43256. bits = remainingBits;
  43257. }
  43258. }
  43259. return output;
  43260. },
  43261. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43262. var smask = this.smask;
  43263. var mask = this.mask;
  43264. var alphaBuf, sw, sh, i, ii, j;
  43265. if (smask) {
  43266. sw = smask.width;
  43267. sh = smask.height;
  43268. alphaBuf = new Uint8Array(sw * sh);
  43269. smask.fillGrayBuffer(alphaBuf);
  43270. if (sw !== width || sh !== height) {
  43271. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43272. }
  43273. } else if (mask) {
  43274. if (mask instanceof PDFImage) {
  43275. sw = mask.width;
  43276. sh = mask.height;
  43277. alphaBuf = new Uint8Array(sw * sh);
  43278. mask.numComps = 1;
  43279. mask.fillGrayBuffer(alphaBuf);
  43280. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43281. alphaBuf[i] = 255 - alphaBuf[i];
  43282. }
  43283. if (sw !== width || sh !== height) {
  43284. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43285. }
  43286. } else if (isArray(mask)) {
  43287. alphaBuf = new Uint8Array(width * height);
  43288. var numComps = this.numComps;
  43289. for (i = 0, ii = width * height; i < ii; ++i) {
  43290. var opacity = 0;
  43291. var imageOffset = i * numComps;
  43292. for (j = 0; j < numComps; ++j) {
  43293. var color = image[imageOffset + j];
  43294. var maskOffset = j * 2;
  43295. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43296. opacity = 255;
  43297. break;
  43298. }
  43299. }
  43300. alphaBuf[i] = opacity;
  43301. }
  43302. } else {
  43303. error('Unknown mask format.');
  43304. }
  43305. }
  43306. if (alphaBuf) {
  43307. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43308. rgbaBuf[j] = alphaBuf[i];
  43309. }
  43310. } else {
  43311. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43312. rgbaBuf[j] = 255;
  43313. }
  43314. }
  43315. },
  43316. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  43317. var matte = this.smask && this.smask.matte;
  43318. if (!matte) {
  43319. return;
  43320. }
  43321. var matteRgb = this.colorSpace.getRgb(matte, 0);
  43322. var matteR = matteRgb[0];
  43323. var matteG = matteRgb[1];
  43324. var matteB = matteRgb[2];
  43325. var length = width * height * 4;
  43326. var r, g, b;
  43327. for (var i = 0; i < length; i += 4) {
  43328. var alpha = buffer[i + 3];
  43329. if (alpha === 0) {
  43330. buffer[i] = 255;
  43331. buffer[i + 1] = 255;
  43332. buffer[i + 2] = 255;
  43333. continue;
  43334. }
  43335. var k = 255 / alpha;
  43336. r = (buffer[i] - matteR) * k + matteR;
  43337. g = (buffer[i + 1] - matteG) * k + matteG;
  43338. b = (buffer[i + 2] - matteB) * k + matteB;
  43339. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  43340. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  43341. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  43342. }
  43343. },
  43344. createImageData: function PDFImage_createImageData(forceRGBA) {
  43345. var drawWidth = this.drawWidth;
  43346. var drawHeight = this.drawHeight;
  43347. var imgData = {
  43348. width: drawWidth,
  43349. height: drawHeight
  43350. };
  43351. var numComps = this.numComps;
  43352. var originalWidth = this.width;
  43353. var originalHeight = this.height;
  43354. var bpc = this.bpc;
  43355. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43356. var imgArray;
  43357. if (!forceRGBA) {
  43358. var kind;
  43359. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  43360. kind = ImageKind.GRAYSCALE_1BPP;
  43361. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  43362. kind = ImageKind.RGB_24BPP;
  43363. }
  43364. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43365. imgData.kind = kind;
  43366. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43367. if (this.image instanceof DecodeStream) {
  43368. imgData.data = imgArray;
  43369. } else {
  43370. var newArray = new Uint8Array(imgArray.length);
  43371. newArray.set(imgArray);
  43372. imgData.data = newArray;
  43373. }
  43374. if (this.needsDecode) {
  43375. assert(kind === ImageKind.GRAYSCALE_1BPP);
  43376. var buffer = imgData.data;
  43377. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43378. buffer[i] ^= 0xff;
  43379. }
  43380. }
  43381. return imgData;
  43382. }
  43383. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  43384. imgData.kind = ImageKind.RGB_24BPP;
  43385. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  43386. return imgData;
  43387. }
  43388. }
  43389. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43390. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43391. var comps = this.getComponents(imgArray);
  43392. var alpha01, maybeUndoPreblend;
  43393. if (!forceRGBA && !this.smask && !this.mask) {
  43394. imgData.kind = ImageKind.RGB_24BPP;
  43395. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  43396. alpha01 = 0;
  43397. maybeUndoPreblend = false;
  43398. } else {
  43399. imgData.kind = ImageKind.RGBA_32BPP;
  43400. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  43401. alpha01 = 1;
  43402. maybeUndoPreblend = true;
  43403. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43404. }
  43405. if (this.needsDecode) {
  43406. this.decodeBuffer(comps);
  43407. }
  43408. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43409. if (maybeUndoPreblend) {
  43410. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43411. }
  43412. return imgData;
  43413. },
  43414. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  43415. var numComps = this.numComps;
  43416. if (numComps !== 1) {
  43417. error('Reading gray scale from a color image: ' + numComps);
  43418. }
  43419. var width = this.width;
  43420. var height = this.height;
  43421. var bpc = this.bpc;
  43422. var rowBytes = width * numComps * bpc + 7 >> 3;
  43423. var imgArray = this.getImageBytes(height * rowBytes);
  43424. var comps = this.getComponents(imgArray);
  43425. var i, length;
  43426. if (bpc === 1) {
  43427. length = width * height;
  43428. if (this.needsDecode) {
  43429. for (i = 0; i < length; ++i) {
  43430. buffer[i] = comps[i] - 1 & 255;
  43431. }
  43432. } else {
  43433. for (i = 0; i < length; ++i) {
  43434. buffer[i] = -comps[i] & 255;
  43435. }
  43436. }
  43437. return;
  43438. }
  43439. if (this.needsDecode) {
  43440. this.decodeBuffer(comps);
  43441. }
  43442. length = width * height;
  43443. var scale = 255 / ((1 << bpc) - 1);
  43444. for (i = 0; i < length; ++i) {
  43445. buffer[i] = scale * comps[i] | 0;
  43446. }
  43447. },
  43448. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  43449. this.image.reset();
  43450. this.image.drawWidth = drawWidth || this.width;
  43451. this.image.drawHeight = drawHeight || this.height;
  43452. this.image.forceRGB = !!forceRGB;
  43453. return this.image.getBytes(length);
  43454. }
  43455. };
  43456. return PDFImage;
  43457. }();
  43458. exports.PDFImage = PDFImage;
  43459. /***/ }),
  43460. /* 28 */
  43461. /***/ (function(module, exports, __w_pdfjs_require__) {
  43462. "use strict";
  43463. var sharedUtil = __w_pdfjs_require__(0);
  43464. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  43465. var error = sharedUtil.error;
  43466. var log2 = sharedUtil.log2;
  43467. var readInt8 = sharedUtil.readInt8;
  43468. var readUint16 = sharedUtil.readUint16;
  43469. var readUint32 = sharedUtil.readUint32;
  43470. var shadow = sharedUtil.shadow;
  43471. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  43472. var Jbig2Image = function Jbig2ImageClosure() {
  43473. function ContextCache() {
  43474. }
  43475. ContextCache.prototype = {
  43476. getContexts: function (id) {
  43477. if (id in this) {
  43478. return this[id];
  43479. }
  43480. return this[id] = new Int8Array(1 << 16);
  43481. }
  43482. };
  43483. function DecodingContext(data, start, end) {
  43484. this.data = data;
  43485. this.start = start;
  43486. this.end = end;
  43487. }
  43488. DecodingContext.prototype = {
  43489. get decoder() {
  43490. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  43491. return shadow(this, 'decoder', decoder);
  43492. },
  43493. get contextCache() {
  43494. var cache = new ContextCache();
  43495. return shadow(this, 'contextCache', cache);
  43496. }
  43497. };
  43498. function decodeInteger(contextCache, procedure, decoder) {
  43499. var contexts = contextCache.getContexts(procedure);
  43500. var prev = 1;
  43501. function readBits(length) {
  43502. var v = 0;
  43503. for (var i = 0; i < length; i++) {
  43504. var bit = decoder.readBit(contexts, prev);
  43505. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  43506. v = v << 1 | bit;
  43507. }
  43508. return v >>> 0;
  43509. }
  43510. var sign = readBits(1);
  43511. 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);
  43512. return sign === 0 ? value : value > 0 ? -value : null;
  43513. }
  43514. function decodeIAID(contextCache, decoder, codeLength) {
  43515. var contexts = contextCache.getContexts('IAID');
  43516. var prev = 1;
  43517. for (var i = 0; i < codeLength; i++) {
  43518. var bit = decoder.readBit(contexts, prev);
  43519. prev = prev << 1 | bit;
  43520. }
  43521. if (codeLength < 31) {
  43522. return prev & (1 << codeLength) - 1;
  43523. }
  43524. return prev & 0x7FFFFFFF;
  43525. }
  43526. var SegmentTypes = [
  43527. 'SymbolDictionary',
  43528. null,
  43529. null,
  43530. null,
  43531. 'IntermediateTextRegion',
  43532. null,
  43533. 'ImmediateTextRegion',
  43534. 'ImmediateLosslessTextRegion',
  43535. null,
  43536. null,
  43537. null,
  43538. null,
  43539. null,
  43540. null,
  43541. null,
  43542. null,
  43543. 'patternDictionary',
  43544. null,
  43545. null,
  43546. null,
  43547. 'IntermediateHalftoneRegion',
  43548. null,
  43549. 'ImmediateHalftoneRegion',
  43550. 'ImmediateLosslessHalftoneRegion',
  43551. null,
  43552. null,
  43553. null,
  43554. null,
  43555. null,
  43556. null,
  43557. null,
  43558. null,
  43559. null,
  43560. null,
  43561. null,
  43562. null,
  43563. 'IntermediateGenericRegion',
  43564. null,
  43565. 'ImmediateGenericRegion',
  43566. 'ImmediateLosslessGenericRegion',
  43567. 'IntermediateGenericRefinementRegion',
  43568. null,
  43569. 'ImmediateGenericRefinementRegion',
  43570. 'ImmediateLosslessGenericRefinementRegion',
  43571. null,
  43572. null,
  43573. null,
  43574. null,
  43575. 'PageInformation',
  43576. 'EndOfPage',
  43577. 'EndOfStripe',
  43578. 'EndOfFile',
  43579. 'Profiles',
  43580. 'Tables',
  43581. null,
  43582. null,
  43583. null,
  43584. null,
  43585. null,
  43586. null,
  43587. null,
  43588. null,
  43589. 'Extension'
  43590. ];
  43591. var CodingTemplates = [
  43592. [
  43593. {
  43594. x: -1,
  43595. y: -2
  43596. },
  43597. {
  43598. x: 0,
  43599. y: -2
  43600. },
  43601. {
  43602. x: 1,
  43603. y: -2
  43604. },
  43605. {
  43606. x: -2,
  43607. y: -1
  43608. },
  43609. {
  43610. x: -1,
  43611. y: -1
  43612. },
  43613. {
  43614. x: 0,
  43615. y: -1
  43616. },
  43617. {
  43618. x: 1,
  43619. y: -1
  43620. },
  43621. {
  43622. x: 2,
  43623. y: -1
  43624. },
  43625. {
  43626. x: -4,
  43627. y: 0
  43628. },
  43629. {
  43630. x: -3,
  43631. y: 0
  43632. },
  43633. {
  43634. x: -2,
  43635. y: 0
  43636. },
  43637. {
  43638. x: -1,
  43639. y: 0
  43640. }
  43641. ],
  43642. [
  43643. {
  43644. x: -1,
  43645. y: -2
  43646. },
  43647. {
  43648. x: 0,
  43649. y: -2
  43650. },
  43651. {
  43652. x: 1,
  43653. y: -2
  43654. },
  43655. {
  43656. x: 2,
  43657. y: -2
  43658. },
  43659. {
  43660. x: -2,
  43661. y: -1
  43662. },
  43663. {
  43664. x: -1,
  43665. y: -1
  43666. },
  43667. {
  43668. x: 0,
  43669. y: -1
  43670. },
  43671. {
  43672. x: 1,
  43673. y: -1
  43674. },
  43675. {
  43676. x: 2,
  43677. y: -1
  43678. },
  43679. {
  43680. x: -3,
  43681. y: 0
  43682. },
  43683. {
  43684. x: -2,
  43685. y: 0
  43686. },
  43687. {
  43688. x: -1,
  43689. y: 0
  43690. }
  43691. ],
  43692. [
  43693. {
  43694. x: -1,
  43695. y: -2
  43696. },
  43697. {
  43698. x: 0,
  43699. y: -2
  43700. },
  43701. {
  43702. x: 1,
  43703. y: -2
  43704. },
  43705. {
  43706. x: -2,
  43707. y: -1
  43708. },
  43709. {
  43710. x: -1,
  43711. y: -1
  43712. },
  43713. {
  43714. x: 0,
  43715. y: -1
  43716. },
  43717. {
  43718. x: 1,
  43719. y: -1
  43720. },
  43721. {
  43722. x: -2,
  43723. y: 0
  43724. },
  43725. {
  43726. x: -1,
  43727. y: 0
  43728. }
  43729. ],
  43730. [
  43731. {
  43732. x: -3,
  43733. y: -1
  43734. },
  43735. {
  43736. x: -2,
  43737. y: -1
  43738. },
  43739. {
  43740. x: -1,
  43741. y: -1
  43742. },
  43743. {
  43744. x: 0,
  43745. y: -1
  43746. },
  43747. {
  43748. x: 1,
  43749. y: -1
  43750. },
  43751. {
  43752. x: -4,
  43753. y: 0
  43754. },
  43755. {
  43756. x: -3,
  43757. y: 0
  43758. },
  43759. {
  43760. x: -2,
  43761. y: 0
  43762. },
  43763. {
  43764. x: -1,
  43765. y: 0
  43766. }
  43767. ]
  43768. ];
  43769. var RefinementTemplates = [
  43770. {
  43771. coding: [
  43772. {
  43773. x: 0,
  43774. y: -1
  43775. },
  43776. {
  43777. x: 1,
  43778. y: -1
  43779. },
  43780. {
  43781. x: -1,
  43782. y: 0
  43783. }
  43784. ],
  43785. reference: [
  43786. {
  43787. x: 0,
  43788. y: -1
  43789. },
  43790. {
  43791. x: 1,
  43792. y: -1
  43793. },
  43794. {
  43795. x: -1,
  43796. y: 0
  43797. },
  43798. {
  43799. x: 0,
  43800. y: 0
  43801. },
  43802. {
  43803. x: 1,
  43804. y: 0
  43805. },
  43806. {
  43807. x: -1,
  43808. y: 1
  43809. },
  43810. {
  43811. x: 0,
  43812. y: 1
  43813. },
  43814. {
  43815. x: 1,
  43816. y: 1
  43817. }
  43818. ]
  43819. },
  43820. {
  43821. coding: [
  43822. {
  43823. x: -1,
  43824. y: -1
  43825. },
  43826. {
  43827. x: 0,
  43828. y: -1
  43829. },
  43830. {
  43831. x: 1,
  43832. y: -1
  43833. },
  43834. {
  43835. x: -1,
  43836. y: 0
  43837. }
  43838. ],
  43839. reference: [
  43840. {
  43841. x: 0,
  43842. y: -1
  43843. },
  43844. {
  43845. x: -1,
  43846. y: 0
  43847. },
  43848. {
  43849. x: 0,
  43850. y: 0
  43851. },
  43852. {
  43853. x: 1,
  43854. y: 0
  43855. },
  43856. {
  43857. x: 0,
  43858. y: 1
  43859. },
  43860. {
  43861. x: 1,
  43862. y: 1
  43863. }
  43864. ]
  43865. }
  43866. ];
  43867. var ReusedContexts = [
  43868. 0x9B25,
  43869. 0x0795,
  43870. 0x00E5,
  43871. 0x0195
  43872. ];
  43873. var RefinementReusedContexts = [
  43874. 0x0020,
  43875. 0x0008
  43876. ];
  43877. function decodeBitmapTemplate0(width, height, decodingContext) {
  43878. var decoder = decodingContext.decoder;
  43879. var contexts = decodingContext.contextCache.getContexts('GB');
  43880. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43881. var OLD_PIXEL_MASK = 0x7BF7;
  43882. for (i = 0; i < height; i++) {
  43883. row = bitmap[i] = new Uint8Array(width);
  43884. row1 = i < 1 ? row : bitmap[i - 1];
  43885. row2 = i < 2 ? row : bitmap[i - 2];
  43886. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43887. for (j = 0; j < width; j++) {
  43888. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43889. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43890. }
  43891. }
  43892. return bitmap;
  43893. }
  43894. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43895. if (mmr) {
  43896. error('JBIG2 error: MMR encoding is not supported');
  43897. }
  43898. 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) {
  43899. return decodeBitmapTemplate0(width, height, decodingContext);
  43900. }
  43901. var useskip = !!skip;
  43902. var template = CodingTemplates[templateIndex].concat(at);
  43903. template.sort(function (a, b) {
  43904. return a.y - b.y || a.x - b.x;
  43905. });
  43906. var templateLength = template.length;
  43907. var templateX = new Int8Array(templateLength);
  43908. var templateY = new Int8Array(templateLength);
  43909. var changingTemplateEntries = [];
  43910. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43911. var c, k;
  43912. for (k = 0; k < templateLength; k++) {
  43913. templateX[k] = template[k].x;
  43914. templateY[k] = template[k].y;
  43915. minX = Math.min(minX, template[k].x);
  43916. maxX = Math.max(maxX, template[k].x);
  43917. minY = Math.min(minY, template[k].y);
  43918. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43919. reuseMask |= 1 << templateLength - 1 - k;
  43920. } else {
  43921. changingTemplateEntries.push(k);
  43922. }
  43923. }
  43924. var changingEntriesLength = changingTemplateEntries.length;
  43925. var changingTemplateX = new Int8Array(changingEntriesLength);
  43926. var changingTemplateY = new Int8Array(changingEntriesLength);
  43927. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43928. for (c = 0; c < changingEntriesLength; c++) {
  43929. k = changingTemplateEntries[c];
  43930. changingTemplateX[c] = template[k].x;
  43931. changingTemplateY[c] = template[k].y;
  43932. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43933. }
  43934. var sbb_left = -minX;
  43935. var sbb_top = -minY;
  43936. var sbb_right = width - maxX;
  43937. var pseudoPixelContext = ReusedContexts[templateIndex];
  43938. var row = new Uint8Array(width);
  43939. var bitmap = [];
  43940. var decoder = decodingContext.decoder;
  43941. var contexts = decodingContext.contextCache.getContexts('GB');
  43942. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43943. for (var i = 0; i < height; i++) {
  43944. if (prediction) {
  43945. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43946. ltp ^= sltp;
  43947. if (ltp) {
  43948. bitmap.push(row);
  43949. continue;
  43950. }
  43951. }
  43952. row = new Uint8Array(row);
  43953. bitmap.push(row);
  43954. for (j = 0; j < width; j++) {
  43955. if (useskip && skip[i][j]) {
  43956. row[j] = 0;
  43957. continue;
  43958. }
  43959. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43960. contextLabel = contextLabel << 1 & reuseMask;
  43961. for (k = 0; k < changingEntriesLength; k++) {
  43962. i0 = i + changingTemplateY[k];
  43963. j0 = j + changingTemplateX[k];
  43964. bit = bitmap[i0][j0];
  43965. if (bit) {
  43966. bit = changingTemplateBit[k];
  43967. contextLabel |= bit;
  43968. }
  43969. }
  43970. } else {
  43971. contextLabel = 0;
  43972. shift = templateLength - 1;
  43973. for (k = 0; k < templateLength; k++, shift--) {
  43974. j0 = j + templateX[k];
  43975. if (j0 >= 0 && j0 < width) {
  43976. i0 = i + templateY[k];
  43977. if (i0 >= 0) {
  43978. bit = bitmap[i0][j0];
  43979. if (bit) {
  43980. contextLabel |= bit << shift;
  43981. }
  43982. }
  43983. }
  43984. }
  43985. }
  43986. var pixel = decoder.readBit(contexts, contextLabel);
  43987. row[j] = pixel;
  43988. }
  43989. }
  43990. return bitmap;
  43991. }
  43992. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43993. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43994. if (templateIndex === 0) {
  43995. codingTemplate = codingTemplate.concat([at[0]]);
  43996. }
  43997. var codingTemplateLength = codingTemplate.length;
  43998. var codingTemplateX = new Int32Array(codingTemplateLength);
  43999. var codingTemplateY = new Int32Array(codingTemplateLength);
  44000. var k;
  44001. for (k = 0; k < codingTemplateLength; k++) {
  44002. codingTemplateX[k] = codingTemplate[k].x;
  44003. codingTemplateY[k] = codingTemplate[k].y;
  44004. }
  44005. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  44006. if (templateIndex === 0) {
  44007. referenceTemplate = referenceTemplate.concat([at[1]]);
  44008. }
  44009. var referenceTemplateLength = referenceTemplate.length;
  44010. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  44011. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  44012. for (k = 0; k < referenceTemplateLength; k++) {
  44013. referenceTemplateX[k] = referenceTemplate[k].x;
  44014. referenceTemplateY[k] = referenceTemplate[k].y;
  44015. }
  44016. var referenceWidth = referenceBitmap[0].length;
  44017. var referenceHeight = referenceBitmap.length;
  44018. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  44019. var bitmap = [];
  44020. var decoder = decodingContext.decoder;
  44021. var contexts = decodingContext.contextCache.getContexts('GR');
  44022. var ltp = 0;
  44023. for (var i = 0; i < height; i++) {
  44024. if (prediction) {
  44025. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  44026. ltp ^= sltp;
  44027. if (ltp) {
  44028. error('JBIG2 error: prediction is not supported');
  44029. }
  44030. }
  44031. var row = new Uint8Array(width);
  44032. bitmap.push(row);
  44033. for (var j = 0; j < width; j++) {
  44034. var i0, j0;
  44035. var contextLabel = 0;
  44036. for (k = 0; k < codingTemplateLength; k++) {
  44037. i0 = i + codingTemplateY[k];
  44038. j0 = j + codingTemplateX[k];
  44039. if (i0 < 0 || j0 < 0 || j0 >= width) {
  44040. contextLabel <<= 1;
  44041. } else {
  44042. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  44043. }
  44044. }
  44045. for (k = 0; k < referenceTemplateLength; k++) {
  44046. i0 = i + referenceTemplateY[k] + offsetY;
  44047. j0 = j + referenceTemplateX[k] + offsetX;
  44048. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  44049. contextLabel <<= 1;
  44050. } else {
  44051. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  44052. }
  44053. }
  44054. var pixel = decoder.readBit(contexts, contextLabel);
  44055. row[j] = pixel;
  44056. }
  44057. }
  44058. return bitmap;
  44059. }
  44060. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  44061. if (huffman) {
  44062. error('JBIG2 error: huffman is not supported');
  44063. }
  44064. var newSymbols = [];
  44065. var currentHeight = 0;
  44066. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  44067. var decoder = decodingContext.decoder;
  44068. var contextCache = decodingContext.contextCache;
  44069. while (newSymbols.length < numberOfNewSymbols) {
  44070. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  44071. currentHeight += deltaHeight;
  44072. var currentWidth = 0;
  44073. while (true) {
  44074. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  44075. if (deltaWidth === null) {
  44076. break;
  44077. }
  44078. currentWidth += deltaWidth;
  44079. var bitmap;
  44080. if (refinement) {
  44081. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  44082. if (numberOfInstances > 1) {
  44083. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  44084. } else {
  44085. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44086. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44087. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44088. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  44089. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  44090. }
  44091. } else {
  44092. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  44093. }
  44094. newSymbols.push(bitmap);
  44095. }
  44096. }
  44097. var exportedSymbols = [];
  44098. var flags = [], currentFlag = false;
  44099. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  44100. while (flags.length < totalSymbolsLength) {
  44101. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  44102. while (runLength--) {
  44103. flags.push(currentFlag);
  44104. }
  44105. currentFlag = !currentFlag;
  44106. }
  44107. for (var i = 0, ii = symbols.length; i < ii; i++) {
  44108. if (flags[i]) {
  44109. exportedSymbols.push(symbols[i]);
  44110. }
  44111. }
  44112. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  44113. if (flags[i]) {
  44114. exportedSymbols.push(newSymbols[j]);
  44115. }
  44116. }
  44117. return exportedSymbols;
  44118. }
  44119. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  44120. if (huffman) {
  44121. error('JBIG2 error: huffman is not supported');
  44122. }
  44123. var bitmap = [];
  44124. var i, row;
  44125. for (i = 0; i < height; i++) {
  44126. row = new Uint8Array(width);
  44127. if (defaultPixelValue) {
  44128. for (var j = 0; j < width; j++) {
  44129. row[j] = defaultPixelValue;
  44130. }
  44131. }
  44132. bitmap.push(row);
  44133. }
  44134. var decoder = decodingContext.decoder;
  44135. var contextCache = decodingContext.contextCache;
  44136. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  44137. var firstS = 0;
  44138. i = 0;
  44139. while (i < numberOfSymbolInstances) {
  44140. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  44141. stripT += deltaT;
  44142. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  44143. firstS += deltaFirstS;
  44144. var currentS = firstS;
  44145. do {
  44146. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  44147. var t = stripSize * stripT + currentT;
  44148. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44149. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  44150. var symbolBitmap = inputSymbols[symbolId];
  44151. var symbolWidth = symbolBitmap[0].length;
  44152. var symbolHeight = symbolBitmap.length;
  44153. if (applyRefinement) {
  44154. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  44155. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  44156. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44157. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44158. symbolWidth += rdw;
  44159. symbolHeight += rdh;
  44160. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  44161. }
  44162. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  44163. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  44164. var s2, t2, symbolRow;
  44165. if (transposed) {
  44166. for (s2 = 0; s2 < symbolHeight; s2++) {
  44167. row = bitmap[offsetS + s2];
  44168. if (!row) {
  44169. continue;
  44170. }
  44171. symbolRow = symbolBitmap[s2];
  44172. var maxWidth = Math.min(width - offsetT, symbolWidth);
  44173. switch (combinationOperator) {
  44174. case 0:
  44175. for (t2 = 0; t2 < maxWidth; t2++) {
  44176. row[offsetT + t2] |= symbolRow[t2];
  44177. }
  44178. break;
  44179. case 2:
  44180. for (t2 = 0; t2 < maxWidth; t2++) {
  44181. row[offsetT + t2] ^= symbolRow[t2];
  44182. }
  44183. break;
  44184. default:
  44185. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44186. }
  44187. }
  44188. currentS += symbolHeight - 1;
  44189. } else {
  44190. for (t2 = 0; t2 < symbolHeight; t2++) {
  44191. row = bitmap[offsetT + t2];
  44192. if (!row) {
  44193. continue;
  44194. }
  44195. symbolRow = symbolBitmap[t2];
  44196. switch (combinationOperator) {
  44197. case 0:
  44198. for (s2 = 0; s2 < symbolWidth; s2++) {
  44199. row[offsetS + s2] |= symbolRow[s2];
  44200. }
  44201. break;
  44202. case 2:
  44203. for (s2 = 0; s2 < symbolWidth; s2++) {
  44204. row[offsetS + s2] ^= symbolRow[s2];
  44205. }
  44206. break;
  44207. default:
  44208. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44209. }
  44210. }
  44211. currentS += symbolWidth - 1;
  44212. }
  44213. i++;
  44214. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  44215. if (deltaS === null) {
  44216. break;
  44217. }
  44218. currentS += deltaS + dsOffset;
  44219. } while (true);
  44220. }
  44221. return bitmap;
  44222. }
  44223. function readSegmentHeader(data, start) {
  44224. var segmentHeader = {};
  44225. segmentHeader.number = readUint32(data, start);
  44226. var flags = data[start + 4];
  44227. var segmentType = flags & 0x3F;
  44228. if (!SegmentTypes[segmentType]) {
  44229. error('JBIG2 error: invalid segment type: ' + segmentType);
  44230. }
  44231. segmentHeader.type = segmentType;
  44232. segmentHeader.typeName = SegmentTypes[segmentType];
  44233. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  44234. var pageAssociationFieldSize = !!(flags & 0x40);
  44235. var referredFlags = data[start + 5];
  44236. var referredToCount = referredFlags >> 5 & 7;
  44237. var retainBits = [referredFlags & 31];
  44238. var position = start + 6;
  44239. if (referredFlags === 7) {
  44240. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  44241. position += 3;
  44242. var bytes = referredToCount + 7 >> 3;
  44243. retainBits[0] = data[position++];
  44244. while (--bytes > 0) {
  44245. retainBits.push(data[position++]);
  44246. }
  44247. } else if (referredFlags === 5 || referredFlags === 6) {
  44248. error('JBIG2 error: invalid referred-to flags');
  44249. }
  44250. segmentHeader.retainBits = retainBits;
  44251. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  44252. var referredTo = [];
  44253. var i, ii;
  44254. for (i = 0; i < referredToCount; i++) {
  44255. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  44256. referredTo.push(number);
  44257. position += referredToSegmentNumberSize;
  44258. }
  44259. segmentHeader.referredTo = referredTo;
  44260. if (!pageAssociationFieldSize) {
  44261. segmentHeader.pageAssociation = data[position++];
  44262. } else {
  44263. segmentHeader.pageAssociation = readUint32(data, position);
  44264. position += 4;
  44265. }
  44266. segmentHeader.length = readUint32(data, position);
  44267. position += 4;
  44268. if (segmentHeader.length === 0xFFFFFFFF) {
  44269. if (segmentType === 38) {
  44270. var genericRegionInfo = readRegionSegmentInformation(data, position);
  44271. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  44272. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  44273. var searchPatternLength = 6;
  44274. var searchPattern = new Uint8Array(searchPatternLength);
  44275. if (!genericRegionMmr) {
  44276. searchPattern[0] = 0xFF;
  44277. searchPattern[1] = 0xAC;
  44278. }
  44279. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  44280. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  44281. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  44282. searchPattern[5] = genericRegionInfo.height & 0xFF;
  44283. for (i = position, ii = data.length; i < ii; i++) {
  44284. var j = 0;
  44285. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  44286. j++;
  44287. }
  44288. if (j === searchPatternLength) {
  44289. segmentHeader.length = i + searchPatternLength;
  44290. break;
  44291. }
  44292. }
  44293. if (segmentHeader.length === 0xFFFFFFFF) {
  44294. error('JBIG2 error: segment end was not found');
  44295. }
  44296. } else {
  44297. error('JBIG2 error: invalid unknown segment length');
  44298. }
  44299. }
  44300. segmentHeader.headerEnd = position;
  44301. return segmentHeader;
  44302. }
  44303. function readSegments(header, data, start, end) {
  44304. var segments = [];
  44305. var position = start;
  44306. while (position < end) {
  44307. var segmentHeader = readSegmentHeader(data, position);
  44308. position = segmentHeader.headerEnd;
  44309. var segment = {
  44310. header: segmentHeader,
  44311. data: data
  44312. };
  44313. if (!header.randomAccess) {
  44314. segment.start = position;
  44315. position += segmentHeader.length;
  44316. segment.end = position;
  44317. }
  44318. segments.push(segment);
  44319. if (segmentHeader.type === 51) {
  44320. break;
  44321. }
  44322. }
  44323. if (header.randomAccess) {
  44324. for (var i = 0, ii = segments.length; i < ii; i++) {
  44325. segments[i].start = position;
  44326. position += segments[i].header.length;
  44327. segments[i].end = position;
  44328. }
  44329. }
  44330. return segments;
  44331. }
  44332. function readRegionSegmentInformation(data, start) {
  44333. return {
  44334. width: readUint32(data, start),
  44335. height: readUint32(data, start + 4),
  44336. x: readUint32(data, start + 8),
  44337. y: readUint32(data, start + 12),
  44338. combinationOperator: data[start + 16] & 7
  44339. };
  44340. }
  44341. var RegionSegmentInformationFieldLength = 17;
  44342. function processSegment(segment, visitor) {
  44343. var header = segment.header;
  44344. var data = segment.data, position = segment.start, end = segment.end;
  44345. var args, at, i, atLength;
  44346. switch (header.type) {
  44347. case 0:
  44348. var dictionary = {};
  44349. var dictionaryFlags = readUint16(data, position);
  44350. dictionary.huffman = !!(dictionaryFlags & 1);
  44351. dictionary.refinement = !!(dictionaryFlags & 2);
  44352. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  44353. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  44354. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  44355. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  44356. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  44357. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  44358. dictionary.template = dictionaryFlags >> 10 & 3;
  44359. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  44360. position += 2;
  44361. if (!dictionary.huffman) {
  44362. atLength = dictionary.template === 0 ? 4 : 1;
  44363. at = [];
  44364. for (i = 0; i < atLength; i++) {
  44365. at.push({
  44366. x: readInt8(data, position),
  44367. y: readInt8(data, position + 1)
  44368. });
  44369. position += 2;
  44370. }
  44371. dictionary.at = at;
  44372. }
  44373. if (dictionary.refinement && !dictionary.refinementTemplate) {
  44374. at = [];
  44375. for (i = 0; i < 2; i++) {
  44376. at.push({
  44377. x: readInt8(data, position),
  44378. y: readInt8(data, position + 1)
  44379. });
  44380. position += 2;
  44381. }
  44382. dictionary.refinementAt = at;
  44383. }
  44384. dictionary.numberOfExportedSymbols = readUint32(data, position);
  44385. position += 4;
  44386. dictionary.numberOfNewSymbols = readUint32(data, position);
  44387. position += 4;
  44388. args = [
  44389. dictionary,
  44390. header.number,
  44391. header.referredTo,
  44392. data,
  44393. position,
  44394. end
  44395. ];
  44396. break;
  44397. case 6:
  44398. case 7:
  44399. var textRegion = {};
  44400. textRegion.info = readRegionSegmentInformation(data, position);
  44401. position += RegionSegmentInformationFieldLength;
  44402. var textRegionSegmentFlags = readUint16(data, position);
  44403. position += 2;
  44404. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  44405. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  44406. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  44407. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  44408. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  44409. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  44410. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  44411. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  44412. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  44413. if (textRegion.huffman) {
  44414. var textRegionHuffmanFlags = readUint16(data, position);
  44415. position += 2;
  44416. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  44417. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  44418. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  44419. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  44420. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  44421. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  44422. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  44423. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  44424. }
  44425. if (textRegion.refinement && !textRegion.refinementTemplate) {
  44426. at = [];
  44427. for (i = 0; i < 2; i++) {
  44428. at.push({
  44429. x: readInt8(data, position),
  44430. y: readInt8(data, position + 1)
  44431. });
  44432. position += 2;
  44433. }
  44434. textRegion.refinementAt = at;
  44435. }
  44436. textRegion.numberOfSymbolInstances = readUint32(data, position);
  44437. position += 4;
  44438. if (textRegion.huffman) {
  44439. error('JBIG2 error: huffman is not supported');
  44440. }
  44441. args = [
  44442. textRegion,
  44443. header.referredTo,
  44444. data,
  44445. position,
  44446. end
  44447. ];
  44448. break;
  44449. case 38:
  44450. case 39:
  44451. var genericRegion = {};
  44452. genericRegion.info = readRegionSegmentInformation(data, position);
  44453. position += RegionSegmentInformationFieldLength;
  44454. var genericRegionSegmentFlags = data[position++];
  44455. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  44456. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  44457. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  44458. if (!genericRegion.mmr) {
  44459. atLength = genericRegion.template === 0 ? 4 : 1;
  44460. at = [];
  44461. for (i = 0; i < atLength; i++) {
  44462. at.push({
  44463. x: readInt8(data, position),
  44464. y: readInt8(data, position + 1)
  44465. });
  44466. position += 2;
  44467. }
  44468. genericRegion.at = at;
  44469. }
  44470. args = [
  44471. genericRegion,
  44472. data,
  44473. position,
  44474. end
  44475. ];
  44476. break;
  44477. case 48:
  44478. var pageInfo = {
  44479. width: readUint32(data, position),
  44480. height: readUint32(data, position + 4),
  44481. resolutionX: readUint32(data, position + 8),
  44482. resolutionY: readUint32(data, position + 12)
  44483. };
  44484. if (pageInfo.height === 0xFFFFFFFF) {
  44485. delete pageInfo.height;
  44486. }
  44487. var pageSegmentFlags = data[position + 16];
  44488. readUint16(data, position + 17);
  44489. pageInfo.lossless = !!(pageSegmentFlags & 1);
  44490. pageInfo.refinement = !!(pageSegmentFlags & 2);
  44491. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  44492. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  44493. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  44494. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  44495. args = [pageInfo];
  44496. break;
  44497. case 49:
  44498. break;
  44499. case 50:
  44500. break;
  44501. case 51:
  44502. break;
  44503. case 62:
  44504. break;
  44505. default:
  44506. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  44507. }
  44508. var callbackName = 'on' + header.typeName;
  44509. if (callbackName in visitor) {
  44510. visitor[callbackName].apply(visitor, args);
  44511. }
  44512. }
  44513. function processSegments(segments, visitor) {
  44514. for (var i = 0, ii = segments.length; i < ii; i++) {
  44515. processSegment(segments[i], visitor);
  44516. }
  44517. }
  44518. function parseJbig2(data, start, end) {
  44519. var position = start;
  44520. 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) {
  44521. error('JBIG2 error: invalid header');
  44522. }
  44523. var header = {};
  44524. position += 8;
  44525. var flags = data[position++];
  44526. header.randomAccess = !(flags & 1);
  44527. if (!(flags & 2)) {
  44528. header.numberOfPages = readUint32(data, position);
  44529. position += 4;
  44530. }
  44531. readSegments(header, data, position, end);
  44532. error('Not implemented');
  44533. }
  44534. function parseJbig2Chunks(chunks) {
  44535. var visitor = new SimpleSegmentVisitor();
  44536. for (var i = 0, ii = chunks.length; i < ii; i++) {
  44537. var chunk = chunks[i];
  44538. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  44539. processSegments(segments, visitor);
  44540. }
  44541. return visitor.buffer;
  44542. }
  44543. function SimpleSegmentVisitor() {
  44544. }
  44545. SimpleSegmentVisitor.prototype = {
  44546. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  44547. this.currentPageInfo = info;
  44548. var rowSize = info.width + 7 >> 3;
  44549. var buffer = new Uint8Array(rowSize * info.height);
  44550. if (info.defaultPixelValue) {
  44551. for (var i = 0, ii = buffer.length; i < ii; i++) {
  44552. buffer[i] = 0xFF;
  44553. }
  44554. }
  44555. this.buffer = buffer;
  44556. },
  44557. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  44558. var pageInfo = this.currentPageInfo;
  44559. var width = regionInfo.width, height = regionInfo.height;
  44560. var rowSize = pageInfo.width + 7 >> 3;
  44561. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  44562. var buffer = this.buffer;
  44563. var mask0 = 128 >> (regionInfo.x & 7);
  44564. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  44565. var i, j, mask, offset;
  44566. switch (combinationOperator) {
  44567. case 0:
  44568. for (i = 0; i < height; i++) {
  44569. mask = mask0;
  44570. offset = offset0;
  44571. for (j = 0; j < width; j++) {
  44572. if (bitmap[i][j]) {
  44573. buffer[offset] |= mask;
  44574. }
  44575. mask >>= 1;
  44576. if (!mask) {
  44577. mask = 128;
  44578. offset++;
  44579. }
  44580. }
  44581. offset0 += rowSize;
  44582. }
  44583. break;
  44584. case 2:
  44585. for (i = 0; i < height; i++) {
  44586. mask = mask0;
  44587. offset = offset0;
  44588. for (j = 0; j < width; j++) {
  44589. if (bitmap[i][j]) {
  44590. buffer[offset] ^= mask;
  44591. }
  44592. mask >>= 1;
  44593. if (!mask) {
  44594. mask = 128;
  44595. offset++;
  44596. }
  44597. }
  44598. offset0 += rowSize;
  44599. }
  44600. break;
  44601. default:
  44602. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44603. }
  44604. },
  44605. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  44606. var regionInfo = region.info;
  44607. var decodingContext = new DecodingContext(data, start, end);
  44608. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  44609. this.drawBitmap(regionInfo, bitmap);
  44610. },
  44611. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  44612. this.onImmediateGenericRegion.apply(this, arguments);
  44613. },
  44614. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  44615. var huffmanTables;
  44616. if (dictionary.huffman) {
  44617. error('JBIG2 error: huffman is not supported');
  44618. }
  44619. var symbols = this.symbols;
  44620. if (!symbols) {
  44621. this.symbols = symbols = {};
  44622. }
  44623. var inputSymbols = [];
  44624. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44625. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44626. }
  44627. var decodingContext = new DecodingContext(data, start, end);
  44628. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  44629. },
  44630. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  44631. var regionInfo = region.info;
  44632. var huffmanTables;
  44633. var symbols = this.symbols;
  44634. var inputSymbols = [];
  44635. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44636. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44637. }
  44638. var symbolCodeLength = log2(inputSymbols.length);
  44639. var decodingContext = new DecodingContext(data, start, end);
  44640. 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);
  44641. this.drawBitmap(regionInfo, bitmap);
  44642. },
  44643. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  44644. this.onImmediateTextRegion.apply(this, arguments);
  44645. }
  44646. };
  44647. function Jbig2Image() {
  44648. }
  44649. Jbig2Image.prototype = {
  44650. parseChunks: function Jbig2Image_parseChunks(chunks) {
  44651. return parseJbig2Chunks(chunks);
  44652. }
  44653. };
  44654. return Jbig2Image;
  44655. }();
  44656. exports.Jbig2Image = Jbig2Image;
  44657. /***/ }),
  44658. /* 29 */
  44659. /***/ (function(module, exports, __w_pdfjs_require__) {
  44660. "use strict";
  44661. var sharedUtil = __w_pdfjs_require__(0);
  44662. var error = sharedUtil.error;
  44663. var JpegImage = function JpegImageClosure() {
  44664. var dctZigZag = new Uint8Array([
  44665. 0,
  44666. 1,
  44667. 8,
  44668. 16,
  44669. 9,
  44670. 2,
  44671. 3,
  44672. 10,
  44673. 17,
  44674. 24,
  44675. 32,
  44676. 25,
  44677. 18,
  44678. 11,
  44679. 4,
  44680. 5,
  44681. 12,
  44682. 19,
  44683. 26,
  44684. 33,
  44685. 40,
  44686. 48,
  44687. 41,
  44688. 34,
  44689. 27,
  44690. 20,
  44691. 13,
  44692. 6,
  44693. 7,
  44694. 14,
  44695. 21,
  44696. 28,
  44697. 35,
  44698. 42,
  44699. 49,
  44700. 56,
  44701. 57,
  44702. 50,
  44703. 43,
  44704. 36,
  44705. 29,
  44706. 22,
  44707. 15,
  44708. 23,
  44709. 30,
  44710. 37,
  44711. 44,
  44712. 51,
  44713. 58,
  44714. 59,
  44715. 52,
  44716. 45,
  44717. 38,
  44718. 31,
  44719. 39,
  44720. 46,
  44721. 53,
  44722. 60,
  44723. 61,
  44724. 54,
  44725. 47,
  44726. 55,
  44727. 62,
  44728. 63
  44729. ]);
  44730. var dctCos1 = 4017;
  44731. var dctSin1 = 799;
  44732. var dctCos3 = 3406;
  44733. var dctSin3 = 2276;
  44734. var dctCos6 = 1567;
  44735. var dctSin6 = 3784;
  44736. var dctSqrt2 = 5793;
  44737. var dctSqrt1d2 = 2896;
  44738. function JpegImage() {
  44739. this.decodeTransform = null;
  44740. this.colorTransform = -1;
  44741. }
  44742. function buildHuffmanTable(codeLengths, values) {
  44743. var k = 0, code = [], i, j, length = 16;
  44744. while (length > 0 && !codeLengths[length - 1]) {
  44745. length--;
  44746. }
  44747. code.push({
  44748. children: [],
  44749. index: 0
  44750. });
  44751. var p = code[0], q;
  44752. for (i = 0; i < length; i++) {
  44753. for (j = 0; j < codeLengths[i]; j++) {
  44754. p = code.pop();
  44755. p.children[p.index] = values[k];
  44756. while (p.index > 0) {
  44757. p = code.pop();
  44758. }
  44759. p.index++;
  44760. code.push(p);
  44761. while (code.length <= i) {
  44762. code.push(q = {
  44763. children: [],
  44764. index: 0
  44765. });
  44766. p.children[p.index] = q.children;
  44767. p = q;
  44768. }
  44769. k++;
  44770. }
  44771. if (i + 1 < length) {
  44772. code.push(q = {
  44773. children: [],
  44774. index: 0
  44775. });
  44776. p.children[p.index] = q.children;
  44777. p = q;
  44778. }
  44779. }
  44780. return code[0].children;
  44781. }
  44782. function getBlockBufferOffset(component, row, col) {
  44783. return 64 * ((component.blocksPerLine + 1) * row + col);
  44784. }
  44785. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  44786. var mcusPerLine = frame.mcusPerLine;
  44787. var progressive = frame.progressive;
  44788. var startOffset = offset, bitsData = 0, bitsCount = 0;
  44789. function readBit() {
  44790. if (bitsCount > 0) {
  44791. bitsCount--;
  44792. return bitsData >> bitsCount & 1;
  44793. }
  44794. bitsData = data[offset++];
  44795. if (bitsData === 0xFF) {
  44796. var nextByte = data[offset++];
  44797. if (nextByte) {
  44798. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  44799. }
  44800. }
  44801. bitsCount = 7;
  44802. return bitsData >>> 7;
  44803. }
  44804. function decodeHuffman(tree) {
  44805. var node = tree;
  44806. while (true) {
  44807. node = node[readBit()];
  44808. if (typeof node === 'number') {
  44809. return node;
  44810. }
  44811. if (typeof node !== 'object') {
  44812. error('JPEG error: invalid huffman sequence');
  44813. }
  44814. }
  44815. }
  44816. function receive(length) {
  44817. var n = 0;
  44818. while (length > 0) {
  44819. n = n << 1 | readBit();
  44820. length--;
  44821. }
  44822. return n;
  44823. }
  44824. function receiveAndExtend(length) {
  44825. if (length === 1) {
  44826. return readBit() === 1 ? 1 : -1;
  44827. }
  44828. var n = receive(length);
  44829. if (n >= 1 << length - 1) {
  44830. return n;
  44831. }
  44832. return n + (-1 << length) + 1;
  44833. }
  44834. function decodeBaseline(component, offset) {
  44835. var t = decodeHuffman(component.huffmanTableDC);
  44836. var diff = t === 0 ? 0 : receiveAndExtend(t);
  44837. component.blockData[offset] = component.pred += diff;
  44838. var k = 1;
  44839. while (k < 64) {
  44840. var rs = decodeHuffman(component.huffmanTableAC);
  44841. var s = rs & 15, r = rs >> 4;
  44842. if (s === 0) {
  44843. if (r < 15) {
  44844. break;
  44845. }
  44846. k += 16;
  44847. continue;
  44848. }
  44849. k += r;
  44850. var z = dctZigZag[k];
  44851. component.blockData[offset + z] = receiveAndExtend(s);
  44852. k++;
  44853. }
  44854. }
  44855. function decodeDCFirst(component, offset) {
  44856. var t = decodeHuffman(component.huffmanTableDC);
  44857. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44858. component.blockData[offset] = component.pred += diff;
  44859. }
  44860. function decodeDCSuccessive(component, offset) {
  44861. component.blockData[offset] |= readBit() << successive;
  44862. }
  44863. var eobrun = 0;
  44864. function decodeACFirst(component, offset) {
  44865. if (eobrun > 0) {
  44866. eobrun--;
  44867. return;
  44868. }
  44869. var k = spectralStart, e = spectralEnd;
  44870. while (k <= e) {
  44871. var rs = decodeHuffman(component.huffmanTableAC);
  44872. var s = rs & 15, r = rs >> 4;
  44873. if (s === 0) {
  44874. if (r < 15) {
  44875. eobrun = receive(r) + (1 << r) - 1;
  44876. break;
  44877. }
  44878. k += 16;
  44879. continue;
  44880. }
  44881. k += r;
  44882. var z = dctZigZag[k];
  44883. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44884. k++;
  44885. }
  44886. }
  44887. var successiveACState = 0, successiveACNextValue;
  44888. function decodeACSuccessive(component, offset) {
  44889. var k = spectralStart;
  44890. var e = spectralEnd;
  44891. var r = 0;
  44892. var s;
  44893. var rs;
  44894. while (k <= e) {
  44895. var z = dctZigZag[k];
  44896. switch (successiveACState) {
  44897. case 0:
  44898. rs = decodeHuffman(component.huffmanTableAC);
  44899. s = rs & 15;
  44900. r = rs >> 4;
  44901. if (s === 0) {
  44902. if (r < 15) {
  44903. eobrun = receive(r) + (1 << r);
  44904. successiveACState = 4;
  44905. } else {
  44906. r = 16;
  44907. successiveACState = 1;
  44908. }
  44909. } else {
  44910. if (s !== 1) {
  44911. error('JPEG error: invalid ACn encoding');
  44912. }
  44913. successiveACNextValue = receiveAndExtend(s);
  44914. successiveACState = r ? 2 : 3;
  44915. }
  44916. continue;
  44917. case 1:
  44918. case 2:
  44919. if (component.blockData[offset + z]) {
  44920. component.blockData[offset + z] += readBit() << successive;
  44921. } else {
  44922. r--;
  44923. if (r === 0) {
  44924. successiveACState = successiveACState === 2 ? 3 : 0;
  44925. }
  44926. }
  44927. break;
  44928. case 3:
  44929. if (component.blockData[offset + z]) {
  44930. component.blockData[offset + z] += readBit() << successive;
  44931. } else {
  44932. component.blockData[offset + z] = successiveACNextValue << successive;
  44933. successiveACState = 0;
  44934. }
  44935. break;
  44936. case 4:
  44937. if (component.blockData[offset + z]) {
  44938. component.blockData[offset + z] += readBit() << successive;
  44939. }
  44940. break;
  44941. }
  44942. k++;
  44943. }
  44944. if (successiveACState === 4) {
  44945. eobrun--;
  44946. if (eobrun === 0) {
  44947. successiveACState = 0;
  44948. }
  44949. }
  44950. }
  44951. function decodeMcu(component, decode, mcu, row, col) {
  44952. var mcuRow = mcu / mcusPerLine | 0;
  44953. var mcuCol = mcu % mcusPerLine;
  44954. var blockRow = mcuRow * component.v + row;
  44955. var blockCol = mcuCol * component.h + col;
  44956. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44957. decode(component, offset);
  44958. }
  44959. function decodeBlock(component, decode, mcu) {
  44960. var blockRow = mcu / component.blocksPerLine | 0;
  44961. var blockCol = mcu % component.blocksPerLine;
  44962. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44963. decode(component, offset);
  44964. }
  44965. var componentsLength = components.length;
  44966. var component, i, j, k, n;
  44967. var decodeFn;
  44968. if (progressive) {
  44969. if (spectralStart === 0) {
  44970. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44971. } else {
  44972. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44973. }
  44974. } else {
  44975. decodeFn = decodeBaseline;
  44976. }
  44977. var mcu = 0, marker;
  44978. var mcuExpected;
  44979. if (componentsLength === 1) {
  44980. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44981. } else {
  44982. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44983. }
  44984. if (!resetInterval) {
  44985. resetInterval = mcuExpected;
  44986. }
  44987. var h, v;
  44988. while (mcu < mcuExpected) {
  44989. for (i = 0; i < componentsLength; i++) {
  44990. components[i].pred = 0;
  44991. }
  44992. eobrun = 0;
  44993. if (componentsLength === 1) {
  44994. component = components[0];
  44995. for (n = 0; n < resetInterval; n++) {
  44996. decodeBlock(component, decodeFn, mcu);
  44997. mcu++;
  44998. }
  44999. } else {
  45000. for (n = 0; n < resetInterval; n++) {
  45001. for (i = 0; i < componentsLength; i++) {
  45002. component = components[i];
  45003. h = component.h;
  45004. v = component.v;
  45005. for (j = 0; j < v; j++) {
  45006. for (k = 0; k < h; k++) {
  45007. decodeMcu(component, decodeFn, mcu, j, k);
  45008. }
  45009. }
  45010. }
  45011. mcu++;
  45012. }
  45013. }
  45014. bitsCount = 0;
  45015. marker = data[offset] << 8 | data[offset + 1];
  45016. while (data[offset] === 0x00 && offset < data.length - 1) {
  45017. offset++;
  45018. marker = data[offset] << 8 | data[offset + 1];
  45019. }
  45020. if (marker <= 0xFF00) {
  45021. error('JPEG error: marker was not found');
  45022. }
  45023. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  45024. offset += 2;
  45025. } else {
  45026. break;
  45027. }
  45028. }
  45029. return offset - startOffset;
  45030. }
  45031. function quantizeAndInverse(component, blockBufferOffset, p) {
  45032. var qt = component.quantizationTable, blockData = component.blockData;
  45033. var v0, v1, v2, v3, v4, v5, v6, v7;
  45034. var p0, p1, p2, p3, p4, p5, p6, p7;
  45035. var t;
  45036. if (!qt) {
  45037. error('JPEG error: missing required Quantization Table.');
  45038. }
  45039. for (var row = 0; row < 64; row += 8) {
  45040. p0 = blockData[blockBufferOffset + row];
  45041. p1 = blockData[blockBufferOffset + row + 1];
  45042. p2 = blockData[blockBufferOffset + row + 2];
  45043. p3 = blockData[blockBufferOffset + row + 3];
  45044. p4 = blockData[blockBufferOffset + row + 4];
  45045. p5 = blockData[blockBufferOffset + row + 5];
  45046. p6 = blockData[blockBufferOffset + row + 6];
  45047. p7 = blockData[blockBufferOffset + row + 7];
  45048. p0 *= qt[row];
  45049. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45050. t = dctSqrt2 * p0 + 512 >> 10;
  45051. p[row] = t;
  45052. p[row + 1] = t;
  45053. p[row + 2] = t;
  45054. p[row + 3] = t;
  45055. p[row + 4] = t;
  45056. p[row + 5] = t;
  45057. p[row + 6] = t;
  45058. p[row + 7] = t;
  45059. continue;
  45060. }
  45061. p1 *= qt[row + 1];
  45062. p2 *= qt[row + 2];
  45063. p3 *= qt[row + 3];
  45064. p4 *= qt[row + 4];
  45065. p5 *= qt[row + 5];
  45066. p6 *= qt[row + 6];
  45067. p7 *= qt[row + 7];
  45068. v0 = dctSqrt2 * p0 + 128 >> 8;
  45069. v1 = dctSqrt2 * p4 + 128 >> 8;
  45070. v2 = p2;
  45071. v3 = p6;
  45072. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  45073. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  45074. v5 = p3 << 4;
  45075. v6 = p5 << 4;
  45076. v0 = v0 + v1 + 1 >> 1;
  45077. v1 = v0 - v1;
  45078. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  45079. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  45080. v3 = t;
  45081. v4 = v4 + v6 + 1 >> 1;
  45082. v6 = v4 - v6;
  45083. v7 = v7 + v5 + 1 >> 1;
  45084. v5 = v7 - v5;
  45085. v0 = v0 + v3 + 1 >> 1;
  45086. v3 = v0 - v3;
  45087. v1 = v1 + v2 + 1 >> 1;
  45088. v2 = v1 - v2;
  45089. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45090. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45091. v7 = t;
  45092. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45093. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45094. v6 = t;
  45095. p[row] = v0 + v7;
  45096. p[row + 7] = v0 - v7;
  45097. p[row + 1] = v1 + v6;
  45098. p[row + 6] = v1 - v6;
  45099. p[row + 2] = v2 + v5;
  45100. p[row + 5] = v2 - v5;
  45101. p[row + 3] = v3 + v4;
  45102. p[row + 4] = v3 - v4;
  45103. }
  45104. for (var col = 0; col < 8; ++col) {
  45105. p0 = p[col];
  45106. p1 = p[col + 8];
  45107. p2 = p[col + 16];
  45108. p3 = p[col + 24];
  45109. p4 = p[col + 32];
  45110. p5 = p[col + 40];
  45111. p6 = p[col + 48];
  45112. p7 = p[col + 56];
  45113. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45114. t = dctSqrt2 * p0 + 8192 >> 14;
  45115. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  45116. blockData[blockBufferOffset + col] = t;
  45117. blockData[blockBufferOffset + col + 8] = t;
  45118. blockData[blockBufferOffset + col + 16] = t;
  45119. blockData[blockBufferOffset + col + 24] = t;
  45120. blockData[blockBufferOffset + col + 32] = t;
  45121. blockData[blockBufferOffset + col + 40] = t;
  45122. blockData[blockBufferOffset + col + 48] = t;
  45123. blockData[blockBufferOffset + col + 56] = t;
  45124. continue;
  45125. }
  45126. v0 = dctSqrt2 * p0 + 2048 >> 12;
  45127. v1 = dctSqrt2 * p4 + 2048 >> 12;
  45128. v2 = p2;
  45129. v3 = p6;
  45130. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  45131. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  45132. v5 = p3;
  45133. v6 = p5;
  45134. v0 = (v0 + v1 + 1 >> 1) + 4112;
  45135. v1 = v0 - v1;
  45136. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  45137. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  45138. v3 = t;
  45139. v4 = v4 + v6 + 1 >> 1;
  45140. v6 = v4 - v6;
  45141. v7 = v7 + v5 + 1 >> 1;
  45142. v5 = v7 - v5;
  45143. v0 = v0 + v3 + 1 >> 1;
  45144. v3 = v0 - v3;
  45145. v1 = v1 + v2 + 1 >> 1;
  45146. v2 = v1 - v2;
  45147. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45148. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45149. v7 = t;
  45150. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45151. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45152. v6 = t;
  45153. p0 = v0 + v7;
  45154. p7 = v0 - v7;
  45155. p1 = v1 + v6;
  45156. p6 = v1 - v6;
  45157. p2 = v2 + v5;
  45158. p5 = v2 - v5;
  45159. p3 = v3 + v4;
  45160. p4 = v3 - v4;
  45161. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  45162. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  45163. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  45164. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  45165. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  45166. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  45167. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  45168. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  45169. blockData[blockBufferOffset + col] = p0;
  45170. blockData[blockBufferOffset + col + 8] = p1;
  45171. blockData[blockBufferOffset + col + 16] = p2;
  45172. blockData[blockBufferOffset + col + 24] = p3;
  45173. blockData[blockBufferOffset + col + 32] = p4;
  45174. blockData[blockBufferOffset + col + 40] = p5;
  45175. blockData[blockBufferOffset + col + 48] = p6;
  45176. blockData[blockBufferOffset + col + 56] = p7;
  45177. }
  45178. }
  45179. function buildComponentData(frame, component) {
  45180. var blocksPerLine = component.blocksPerLine;
  45181. var blocksPerColumn = component.blocksPerColumn;
  45182. var computationBuffer = new Int16Array(64);
  45183. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  45184. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  45185. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  45186. quantizeAndInverse(component, offset, computationBuffer);
  45187. }
  45188. }
  45189. return component.blockData;
  45190. }
  45191. function clamp0to255(a) {
  45192. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  45193. }
  45194. JpegImage.prototype = {
  45195. parse: function parse(data) {
  45196. function readUint16() {
  45197. var value = data[offset] << 8 | data[offset + 1];
  45198. offset += 2;
  45199. return value;
  45200. }
  45201. function readDataBlock() {
  45202. var length = readUint16();
  45203. var array = data.subarray(offset, offset + length - 2);
  45204. offset += array.length;
  45205. return array;
  45206. }
  45207. function prepareComponents(frame) {
  45208. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  45209. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  45210. for (var i = 0; i < frame.components.length; i++) {
  45211. component = frame.components[i];
  45212. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  45213. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  45214. var blocksPerLineForMcu = mcusPerLine * component.h;
  45215. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  45216. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  45217. component.blockData = new Int16Array(blocksBufferSize);
  45218. component.blocksPerLine = blocksPerLine;
  45219. component.blocksPerColumn = blocksPerColumn;
  45220. }
  45221. frame.mcusPerLine = mcusPerLine;
  45222. frame.mcusPerColumn = mcusPerColumn;
  45223. }
  45224. var offset = 0;
  45225. var jfif = null;
  45226. var adobe = null;
  45227. var frame, resetInterval;
  45228. var quantizationTables = [];
  45229. var huffmanTablesAC = [], huffmanTablesDC = [];
  45230. var fileMarker = readUint16();
  45231. if (fileMarker !== 0xFFD8) {
  45232. error('JPEG error: SOI not found');
  45233. }
  45234. fileMarker = readUint16();
  45235. while (fileMarker !== 0xFFD9) {
  45236. var i, j, l;
  45237. switch (fileMarker) {
  45238. case 0xFFE0:
  45239. case 0xFFE1:
  45240. case 0xFFE2:
  45241. case 0xFFE3:
  45242. case 0xFFE4:
  45243. case 0xFFE5:
  45244. case 0xFFE6:
  45245. case 0xFFE7:
  45246. case 0xFFE8:
  45247. case 0xFFE9:
  45248. case 0xFFEA:
  45249. case 0xFFEB:
  45250. case 0xFFEC:
  45251. case 0xFFED:
  45252. case 0xFFEE:
  45253. case 0xFFEF:
  45254. case 0xFFFE:
  45255. var appData = readDataBlock();
  45256. if (fileMarker === 0xFFE0) {
  45257. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  45258. jfif = {
  45259. version: {
  45260. major: appData[5],
  45261. minor: appData[6]
  45262. },
  45263. densityUnits: appData[7],
  45264. xDensity: appData[8] << 8 | appData[9],
  45265. yDensity: appData[10] << 8 | appData[11],
  45266. thumbWidth: appData[12],
  45267. thumbHeight: appData[13],
  45268. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  45269. };
  45270. }
  45271. }
  45272. if (fileMarker === 0xFFEE) {
  45273. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  45274. adobe = {
  45275. version: appData[5] << 8 | appData[6],
  45276. flags0: appData[7] << 8 | appData[8],
  45277. flags1: appData[9] << 8 | appData[10],
  45278. transformCode: appData[11]
  45279. };
  45280. }
  45281. }
  45282. break;
  45283. case 0xFFDB:
  45284. var quantizationTablesLength = readUint16();
  45285. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  45286. var z;
  45287. while (offset < quantizationTablesEnd) {
  45288. var quantizationTableSpec = data[offset++];
  45289. var tableData = new Uint16Array(64);
  45290. if (quantizationTableSpec >> 4 === 0) {
  45291. for (j = 0; j < 64; j++) {
  45292. z = dctZigZag[j];
  45293. tableData[z] = data[offset++];
  45294. }
  45295. } else if (quantizationTableSpec >> 4 === 1) {
  45296. for (j = 0; j < 64; j++) {
  45297. z = dctZigZag[j];
  45298. tableData[z] = readUint16();
  45299. }
  45300. } else {
  45301. error('JPEG error: DQT - invalid table spec');
  45302. }
  45303. quantizationTables[quantizationTableSpec & 15] = tableData;
  45304. }
  45305. break;
  45306. case 0xFFC0:
  45307. case 0xFFC1:
  45308. case 0xFFC2:
  45309. if (frame) {
  45310. error('JPEG error: Only single frame JPEGs supported');
  45311. }
  45312. readUint16();
  45313. frame = {};
  45314. frame.extended = fileMarker === 0xFFC1;
  45315. frame.progressive = fileMarker === 0xFFC2;
  45316. frame.precision = data[offset++];
  45317. frame.scanLines = readUint16();
  45318. frame.samplesPerLine = readUint16();
  45319. frame.components = [];
  45320. frame.componentIds = {};
  45321. var componentsCount = data[offset++], componentId;
  45322. var maxH = 0, maxV = 0;
  45323. for (i = 0; i < componentsCount; i++) {
  45324. componentId = data[offset];
  45325. var h = data[offset + 1] >> 4;
  45326. var v = data[offset + 1] & 15;
  45327. if (maxH < h) {
  45328. maxH = h;
  45329. }
  45330. if (maxV < v) {
  45331. maxV = v;
  45332. }
  45333. var qId = data[offset + 2];
  45334. l = frame.components.push({
  45335. h: h,
  45336. v: v,
  45337. quantizationId: qId,
  45338. quantizationTable: null
  45339. });
  45340. frame.componentIds[componentId] = l - 1;
  45341. offset += 3;
  45342. }
  45343. frame.maxH = maxH;
  45344. frame.maxV = maxV;
  45345. prepareComponents(frame);
  45346. break;
  45347. case 0xFFC4:
  45348. var huffmanLength = readUint16();
  45349. for (i = 2; i < huffmanLength;) {
  45350. var huffmanTableSpec = data[offset++];
  45351. var codeLengths = new Uint8Array(16);
  45352. var codeLengthSum = 0;
  45353. for (j = 0; j < 16; j++, offset++) {
  45354. codeLengthSum += codeLengths[j] = data[offset];
  45355. }
  45356. var huffmanValues = new Uint8Array(codeLengthSum);
  45357. for (j = 0; j < codeLengthSum; j++, offset++) {
  45358. huffmanValues[j] = data[offset];
  45359. }
  45360. i += 17 + codeLengthSum;
  45361. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  45362. }
  45363. break;
  45364. case 0xFFDD:
  45365. readUint16();
  45366. resetInterval = readUint16();
  45367. break;
  45368. case 0xFFDA:
  45369. readUint16();
  45370. var selectorsCount = data[offset++];
  45371. var components = [], component;
  45372. for (i = 0; i < selectorsCount; i++) {
  45373. var componentIndex = frame.componentIds[data[offset++]];
  45374. component = frame.components[componentIndex];
  45375. var tableSpec = data[offset++];
  45376. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  45377. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  45378. components.push(component);
  45379. }
  45380. var spectralStart = data[offset++];
  45381. var spectralEnd = data[offset++];
  45382. var successiveApproximation = data[offset++];
  45383. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  45384. offset += processed;
  45385. break;
  45386. case 0xFFFF:
  45387. if (data[offset] !== 0xFF) {
  45388. offset--;
  45389. }
  45390. break;
  45391. default:
  45392. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  45393. offset -= 3;
  45394. break;
  45395. }
  45396. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  45397. }
  45398. fileMarker = readUint16();
  45399. }
  45400. this.width = frame.samplesPerLine;
  45401. this.height = frame.scanLines;
  45402. this.jfif = jfif;
  45403. this.adobe = adobe;
  45404. this.components = [];
  45405. for (i = 0; i < frame.components.length; i++) {
  45406. component = frame.components[i];
  45407. var quantizationTable = quantizationTables[component.quantizationId];
  45408. if (quantizationTable) {
  45409. component.quantizationTable = quantizationTable;
  45410. }
  45411. this.components.push({
  45412. output: buildComponentData(frame, component),
  45413. scaleX: component.h / frame.maxH,
  45414. scaleY: component.v / frame.maxV,
  45415. blocksPerLine: component.blocksPerLine,
  45416. blocksPerColumn: component.blocksPerColumn
  45417. });
  45418. }
  45419. this.numComponents = this.components.length;
  45420. },
  45421. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  45422. var scaleX = this.width / width, scaleY = this.height / height;
  45423. var component, componentScaleX, componentScaleY, blocksPerScanline;
  45424. var x, y, i, j, k;
  45425. var index;
  45426. var offset = 0;
  45427. var output;
  45428. var numComponents = this.components.length;
  45429. var dataLength = width * height * numComponents;
  45430. var data = new Uint8Array(dataLength);
  45431. var xScaleBlockOffset = new Uint32Array(width);
  45432. var mask3LSB = 0xfffffff8;
  45433. for (i = 0; i < numComponents; i++) {
  45434. component = this.components[i];
  45435. componentScaleX = component.scaleX * scaleX;
  45436. componentScaleY = component.scaleY * scaleY;
  45437. offset = i;
  45438. output = component.output;
  45439. blocksPerScanline = component.blocksPerLine + 1 << 3;
  45440. for (x = 0; x < width; x++) {
  45441. j = 0 | x * componentScaleX;
  45442. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  45443. }
  45444. for (y = 0; y < height; y++) {
  45445. j = 0 | y * componentScaleY;
  45446. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  45447. for (x = 0; x < width; x++) {
  45448. data[offset] = output[index + xScaleBlockOffset[x]];
  45449. offset += numComponents;
  45450. }
  45451. }
  45452. }
  45453. var transform = this.decodeTransform;
  45454. if (transform) {
  45455. for (i = 0; i < dataLength;) {
  45456. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  45457. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  45458. }
  45459. }
  45460. }
  45461. return data;
  45462. },
  45463. _isColorConversionNeeded: function isColorConversionNeeded() {
  45464. if (this.adobe && this.adobe.transformCode) {
  45465. return true;
  45466. } else if (this.numComponents === 3) {
  45467. if (!this.adobe && this.colorTransform === 0) {
  45468. return false;
  45469. }
  45470. return true;
  45471. }
  45472. if (!this.adobe && this.colorTransform === 1) {
  45473. return true;
  45474. }
  45475. return false;
  45476. },
  45477. _convertYccToRgb: function convertYccToRgb(data) {
  45478. var Y, Cb, Cr;
  45479. for (var i = 0, length = data.length; i < length; i += 3) {
  45480. Y = data[i];
  45481. Cb = data[i + 1];
  45482. Cr = data[i + 2];
  45483. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  45484. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  45485. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  45486. }
  45487. return data;
  45488. },
  45489. _convertYcckToRgb: function convertYcckToRgb(data) {
  45490. var Y, Cb, Cr, k;
  45491. var offset = 0;
  45492. for (var i = 0, length = data.length; i < length; i += 4) {
  45493. Y = data[i];
  45494. Cb = data[i + 1];
  45495. Cr = data[i + 2];
  45496. k = data[i + 3];
  45497. 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);
  45498. 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);
  45499. 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);
  45500. data[offset++] = clamp0to255(r);
  45501. data[offset++] = clamp0to255(g);
  45502. data[offset++] = clamp0to255(b);
  45503. }
  45504. return data;
  45505. },
  45506. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  45507. var Y, Cb, Cr;
  45508. for (var i = 0, length = data.length; i < length; i += 4) {
  45509. Y = data[i];
  45510. Cb = data[i + 1];
  45511. Cr = data[i + 2];
  45512. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  45513. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  45514. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  45515. }
  45516. return data;
  45517. },
  45518. _convertCmykToRgb: function convertCmykToRgb(data) {
  45519. var c, m, y, k;
  45520. var offset = 0;
  45521. var min = -255 * 255 * 255;
  45522. var scale = 1 / 255 / 255;
  45523. for (var i = 0, length = data.length; i < length; i += 4) {
  45524. c = data[i];
  45525. m = data[i + 1];
  45526. y = data[i + 2];
  45527. k = data[i + 3];
  45528. 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);
  45529. 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);
  45530. 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);
  45531. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  45532. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  45533. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  45534. }
  45535. return data;
  45536. },
  45537. getData: function getData(width, height, forceRGBoutput) {
  45538. if (this.numComponents > 4) {
  45539. error('JPEG error: Unsupported color mode');
  45540. }
  45541. var data = this._getLinearizedBlockData(width, height);
  45542. if (this.numComponents === 1 && forceRGBoutput) {
  45543. var dataLength = data.length;
  45544. var rgbData = new Uint8Array(dataLength * 3);
  45545. var offset = 0;
  45546. for (var i = 0; i < dataLength; i++) {
  45547. var grayColor = data[i];
  45548. rgbData[offset++] = grayColor;
  45549. rgbData[offset++] = grayColor;
  45550. rgbData[offset++] = grayColor;
  45551. }
  45552. return rgbData;
  45553. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  45554. return this._convertYccToRgb(data);
  45555. } else if (this.numComponents === 4) {
  45556. if (this._isColorConversionNeeded()) {
  45557. if (forceRGBoutput) {
  45558. return this._convertYcckToRgb(data);
  45559. }
  45560. return this._convertYcckToCmyk(data);
  45561. } else if (forceRGBoutput) {
  45562. return this._convertCmykToRgb(data);
  45563. }
  45564. }
  45565. return data;
  45566. }
  45567. };
  45568. return JpegImage;
  45569. }();
  45570. exports.JpegImage = JpegImage;
  45571. /***/ }),
  45572. /* 30 */
  45573. /***/ (function(module, exports, __w_pdfjs_require__) {
  45574. "use strict";
  45575. var sharedUtil = __w_pdfjs_require__(0);
  45576. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  45577. var getMetrics = getLookupTableFactory(function (t) {
  45578. t['Courier'] = 600;
  45579. t['Courier-Bold'] = 600;
  45580. t['Courier-BoldOblique'] = 600;
  45581. t['Courier-Oblique'] = 600;
  45582. t['Helvetica'] = getLookupTableFactory(function (t) {
  45583. t['space'] = 278;
  45584. t['exclam'] = 278;
  45585. t['quotedbl'] = 355;
  45586. t['numbersign'] = 556;
  45587. t['dollar'] = 556;
  45588. t['percent'] = 889;
  45589. t['ampersand'] = 667;
  45590. t['quoteright'] = 222;
  45591. t['parenleft'] = 333;
  45592. t['parenright'] = 333;
  45593. t['asterisk'] = 389;
  45594. t['plus'] = 584;
  45595. t['comma'] = 278;
  45596. t['hyphen'] = 333;
  45597. t['period'] = 278;
  45598. t['slash'] = 278;
  45599. t['zero'] = 556;
  45600. t['one'] = 556;
  45601. t['two'] = 556;
  45602. t['three'] = 556;
  45603. t['four'] = 556;
  45604. t['five'] = 556;
  45605. t['six'] = 556;
  45606. t['seven'] = 556;
  45607. t['eight'] = 556;
  45608. t['nine'] = 556;
  45609. t['colon'] = 278;
  45610. t['semicolon'] = 278;
  45611. t['less'] = 584;
  45612. t['equal'] = 584;
  45613. t['greater'] = 584;
  45614. t['question'] = 556;
  45615. t['at'] = 1015;
  45616. t['A'] = 667;
  45617. t['B'] = 667;
  45618. t['C'] = 722;
  45619. t['D'] = 722;
  45620. t['E'] = 667;
  45621. t['F'] = 611;
  45622. t['G'] = 778;
  45623. t['H'] = 722;
  45624. t['I'] = 278;
  45625. t['J'] = 500;
  45626. t['K'] = 667;
  45627. t['L'] = 556;
  45628. t['M'] = 833;
  45629. t['N'] = 722;
  45630. t['O'] = 778;
  45631. t['P'] = 667;
  45632. t['Q'] = 778;
  45633. t['R'] = 722;
  45634. t['S'] = 667;
  45635. t['T'] = 611;
  45636. t['U'] = 722;
  45637. t['V'] = 667;
  45638. t['W'] = 944;
  45639. t['X'] = 667;
  45640. t['Y'] = 667;
  45641. t['Z'] = 611;
  45642. t['bracketleft'] = 278;
  45643. t['backslash'] = 278;
  45644. t['bracketright'] = 278;
  45645. t['asciicircum'] = 469;
  45646. t['underscore'] = 556;
  45647. t['quoteleft'] = 222;
  45648. t['a'] = 556;
  45649. t['b'] = 556;
  45650. t['c'] = 500;
  45651. t['d'] = 556;
  45652. t['e'] = 556;
  45653. t['f'] = 278;
  45654. t['g'] = 556;
  45655. t['h'] = 556;
  45656. t['i'] = 222;
  45657. t['j'] = 222;
  45658. t['k'] = 500;
  45659. t['l'] = 222;
  45660. t['m'] = 833;
  45661. t['n'] = 556;
  45662. t['o'] = 556;
  45663. t['p'] = 556;
  45664. t['q'] = 556;
  45665. t['r'] = 333;
  45666. t['s'] = 500;
  45667. t['t'] = 278;
  45668. t['u'] = 556;
  45669. t['v'] = 500;
  45670. t['w'] = 722;
  45671. t['x'] = 500;
  45672. t['y'] = 500;
  45673. t['z'] = 500;
  45674. t['braceleft'] = 334;
  45675. t['bar'] = 260;
  45676. t['braceright'] = 334;
  45677. t['asciitilde'] = 584;
  45678. t['exclamdown'] = 333;
  45679. t['cent'] = 556;
  45680. t['sterling'] = 556;
  45681. t['fraction'] = 167;
  45682. t['yen'] = 556;
  45683. t['florin'] = 556;
  45684. t['section'] = 556;
  45685. t['currency'] = 556;
  45686. t['quotesingle'] = 191;
  45687. t['quotedblleft'] = 333;
  45688. t['guillemotleft'] = 556;
  45689. t['guilsinglleft'] = 333;
  45690. t['guilsinglright'] = 333;
  45691. t['fi'] = 500;
  45692. t['fl'] = 500;
  45693. t['endash'] = 556;
  45694. t['dagger'] = 556;
  45695. t['daggerdbl'] = 556;
  45696. t['periodcentered'] = 278;
  45697. t['paragraph'] = 537;
  45698. t['bullet'] = 350;
  45699. t['quotesinglbase'] = 222;
  45700. t['quotedblbase'] = 333;
  45701. t['quotedblright'] = 333;
  45702. t['guillemotright'] = 556;
  45703. t['ellipsis'] = 1000;
  45704. t['perthousand'] = 1000;
  45705. t['questiondown'] = 611;
  45706. t['grave'] = 333;
  45707. t['acute'] = 333;
  45708. t['circumflex'] = 333;
  45709. t['tilde'] = 333;
  45710. t['macron'] = 333;
  45711. t['breve'] = 333;
  45712. t['dotaccent'] = 333;
  45713. t['dieresis'] = 333;
  45714. t['ring'] = 333;
  45715. t['cedilla'] = 333;
  45716. t['hungarumlaut'] = 333;
  45717. t['ogonek'] = 333;
  45718. t['caron'] = 333;
  45719. t['emdash'] = 1000;
  45720. t['AE'] = 1000;
  45721. t['ordfeminine'] = 370;
  45722. t['Lslash'] = 556;
  45723. t['Oslash'] = 778;
  45724. t['OE'] = 1000;
  45725. t['ordmasculine'] = 365;
  45726. t['ae'] = 889;
  45727. t['dotlessi'] = 278;
  45728. t['lslash'] = 222;
  45729. t['oslash'] = 611;
  45730. t['oe'] = 944;
  45731. t['germandbls'] = 611;
  45732. t['Idieresis'] = 278;
  45733. t['eacute'] = 556;
  45734. t['abreve'] = 556;
  45735. t['uhungarumlaut'] = 556;
  45736. t['ecaron'] = 556;
  45737. t['Ydieresis'] = 667;
  45738. t['divide'] = 584;
  45739. t['Yacute'] = 667;
  45740. t['Acircumflex'] = 667;
  45741. t['aacute'] = 556;
  45742. t['Ucircumflex'] = 722;
  45743. t['yacute'] = 500;
  45744. t['scommaaccent'] = 500;
  45745. t['ecircumflex'] = 556;
  45746. t['Uring'] = 722;
  45747. t['Udieresis'] = 722;
  45748. t['aogonek'] = 556;
  45749. t['Uacute'] = 722;
  45750. t['uogonek'] = 556;
  45751. t['Edieresis'] = 667;
  45752. t['Dcroat'] = 722;
  45753. t['commaaccent'] = 250;
  45754. t['copyright'] = 737;
  45755. t['Emacron'] = 667;
  45756. t['ccaron'] = 500;
  45757. t['aring'] = 556;
  45758. t['Ncommaaccent'] = 722;
  45759. t['lacute'] = 222;
  45760. t['agrave'] = 556;
  45761. t['Tcommaaccent'] = 611;
  45762. t['Cacute'] = 722;
  45763. t['atilde'] = 556;
  45764. t['Edotaccent'] = 667;
  45765. t['scaron'] = 500;
  45766. t['scedilla'] = 500;
  45767. t['iacute'] = 278;
  45768. t['lozenge'] = 471;
  45769. t['Rcaron'] = 722;
  45770. t['Gcommaaccent'] = 778;
  45771. t['ucircumflex'] = 556;
  45772. t['acircumflex'] = 556;
  45773. t['Amacron'] = 667;
  45774. t['rcaron'] = 333;
  45775. t['ccedilla'] = 500;
  45776. t['Zdotaccent'] = 611;
  45777. t['Thorn'] = 667;
  45778. t['Omacron'] = 778;
  45779. t['Racute'] = 722;
  45780. t['Sacute'] = 667;
  45781. t['dcaron'] = 643;
  45782. t['Umacron'] = 722;
  45783. t['uring'] = 556;
  45784. t['threesuperior'] = 333;
  45785. t['Ograve'] = 778;
  45786. t['Agrave'] = 667;
  45787. t['Abreve'] = 667;
  45788. t['multiply'] = 584;
  45789. t['uacute'] = 556;
  45790. t['Tcaron'] = 611;
  45791. t['partialdiff'] = 476;
  45792. t['ydieresis'] = 500;
  45793. t['Nacute'] = 722;
  45794. t['icircumflex'] = 278;
  45795. t['Ecircumflex'] = 667;
  45796. t['adieresis'] = 556;
  45797. t['edieresis'] = 556;
  45798. t['cacute'] = 500;
  45799. t['nacute'] = 556;
  45800. t['umacron'] = 556;
  45801. t['Ncaron'] = 722;
  45802. t['Iacute'] = 278;
  45803. t['plusminus'] = 584;
  45804. t['brokenbar'] = 260;
  45805. t['registered'] = 737;
  45806. t['Gbreve'] = 778;
  45807. t['Idotaccent'] = 278;
  45808. t['summation'] = 600;
  45809. t['Egrave'] = 667;
  45810. t['racute'] = 333;
  45811. t['omacron'] = 556;
  45812. t['Zacute'] = 611;
  45813. t['Zcaron'] = 611;
  45814. t['greaterequal'] = 549;
  45815. t['Eth'] = 722;
  45816. t['Ccedilla'] = 722;
  45817. t['lcommaaccent'] = 222;
  45818. t['tcaron'] = 317;
  45819. t['eogonek'] = 556;
  45820. t['Uogonek'] = 722;
  45821. t['Aacute'] = 667;
  45822. t['Adieresis'] = 667;
  45823. t['egrave'] = 556;
  45824. t['zacute'] = 500;
  45825. t['iogonek'] = 222;
  45826. t['Oacute'] = 778;
  45827. t['oacute'] = 556;
  45828. t['amacron'] = 556;
  45829. t['sacute'] = 500;
  45830. t['idieresis'] = 278;
  45831. t['Ocircumflex'] = 778;
  45832. t['Ugrave'] = 722;
  45833. t['Delta'] = 612;
  45834. t['thorn'] = 556;
  45835. t['twosuperior'] = 333;
  45836. t['Odieresis'] = 778;
  45837. t['mu'] = 556;
  45838. t['igrave'] = 278;
  45839. t['ohungarumlaut'] = 556;
  45840. t['Eogonek'] = 667;
  45841. t['dcroat'] = 556;
  45842. t['threequarters'] = 834;
  45843. t['Scedilla'] = 667;
  45844. t['lcaron'] = 299;
  45845. t['Kcommaaccent'] = 667;
  45846. t['Lacute'] = 556;
  45847. t['trademark'] = 1000;
  45848. t['edotaccent'] = 556;
  45849. t['Igrave'] = 278;
  45850. t['Imacron'] = 278;
  45851. t['Lcaron'] = 556;
  45852. t['onehalf'] = 834;
  45853. t['lessequal'] = 549;
  45854. t['ocircumflex'] = 556;
  45855. t['ntilde'] = 556;
  45856. t['Uhungarumlaut'] = 722;
  45857. t['Eacute'] = 667;
  45858. t['emacron'] = 556;
  45859. t['gbreve'] = 556;
  45860. t['onequarter'] = 834;
  45861. t['Scaron'] = 667;
  45862. t['Scommaaccent'] = 667;
  45863. t['Ohungarumlaut'] = 778;
  45864. t['degree'] = 400;
  45865. t['ograve'] = 556;
  45866. t['Ccaron'] = 722;
  45867. t['ugrave'] = 556;
  45868. t['radical'] = 453;
  45869. t['Dcaron'] = 722;
  45870. t['rcommaaccent'] = 333;
  45871. t['Ntilde'] = 722;
  45872. t['otilde'] = 556;
  45873. t['Rcommaaccent'] = 722;
  45874. t['Lcommaaccent'] = 556;
  45875. t['Atilde'] = 667;
  45876. t['Aogonek'] = 667;
  45877. t['Aring'] = 667;
  45878. t['Otilde'] = 778;
  45879. t['zdotaccent'] = 500;
  45880. t['Ecaron'] = 667;
  45881. t['Iogonek'] = 278;
  45882. t['kcommaaccent'] = 500;
  45883. t['minus'] = 584;
  45884. t['Icircumflex'] = 278;
  45885. t['ncaron'] = 556;
  45886. t['tcommaaccent'] = 278;
  45887. t['logicalnot'] = 584;
  45888. t['odieresis'] = 556;
  45889. t['udieresis'] = 556;
  45890. t['notequal'] = 549;
  45891. t['gcommaaccent'] = 556;
  45892. t['eth'] = 556;
  45893. t['zcaron'] = 500;
  45894. t['ncommaaccent'] = 556;
  45895. t['onesuperior'] = 333;
  45896. t['imacron'] = 278;
  45897. t['Euro'] = 556;
  45898. });
  45899. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45900. t['space'] = 278;
  45901. t['exclam'] = 333;
  45902. t['quotedbl'] = 474;
  45903. t['numbersign'] = 556;
  45904. t['dollar'] = 556;
  45905. t['percent'] = 889;
  45906. t['ampersand'] = 722;
  45907. t['quoteright'] = 278;
  45908. t['parenleft'] = 333;
  45909. t['parenright'] = 333;
  45910. t['asterisk'] = 389;
  45911. t['plus'] = 584;
  45912. t['comma'] = 278;
  45913. t['hyphen'] = 333;
  45914. t['period'] = 278;
  45915. t['slash'] = 278;
  45916. t['zero'] = 556;
  45917. t['one'] = 556;
  45918. t['two'] = 556;
  45919. t['three'] = 556;
  45920. t['four'] = 556;
  45921. t['five'] = 556;
  45922. t['six'] = 556;
  45923. t['seven'] = 556;
  45924. t['eight'] = 556;
  45925. t['nine'] = 556;
  45926. t['colon'] = 333;
  45927. t['semicolon'] = 333;
  45928. t['less'] = 584;
  45929. t['equal'] = 584;
  45930. t['greater'] = 584;
  45931. t['question'] = 611;
  45932. t['at'] = 975;
  45933. t['A'] = 722;
  45934. t['B'] = 722;
  45935. t['C'] = 722;
  45936. t['D'] = 722;
  45937. t['E'] = 667;
  45938. t['F'] = 611;
  45939. t['G'] = 778;
  45940. t['H'] = 722;
  45941. t['I'] = 278;
  45942. t['J'] = 556;
  45943. t['K'] = 722;
  45944. t['L'] = 611;
  45945. t['M'] = 833;
  45946. t['N'] = 722;
  45947. t['O'] = 778;
  45948. t['P'] = 667;
  45949. t['Q'] = 778;
  45950. t['R'] = 722;
  45951. t['S'] = 667;
  45952. t['T'] = 611;
  45953. t['U'] = 722;
  45954. t['V'] = 667;
  45955. t['W'] = 944;
  45956. t['X'] = 667;
  45957. t['Y'] = 667;
  45958. t['Z'] = 611;
  45959. t['bracketleft'] = 333;
  45960. t['backslash'] = 278;
  45961. t['bracketright'] = 333;
  45962. t['asciicircum'] = 584;
  45963. t['underscore'] = 556;
  45964. t['quoteleft'] = 278;
  45965. t['a'] = 556;
  45966. t['b'] = 611;
  45967. t['c'] = 556;
  45968. t['d'] = 611;
  45969. t['e'] = 556;
  45970. t['f'] = 333;
  45971. t['g'] = 611;
  45972. t['h'] = 611;
  45973. t['i'] = 278;
  45974. t['j'] = 278;
  45975. t['k'] = 556;
  45976. t['l'] = 278;
  45977. t['m'] = 889;
  45978. t['n'] = 611;
  45979. t['o'] = 611;
  45980. t['p'] = 611;
  45981. t['q'] = 611;
  45982. t['r'] = 389;
  45983. t['s'] = 556;
  45984. t['t'] = 333;
  45985. t['u'] = 611;
  45986. t['v'] = 556;
  45987. t['w'] = 778;
  45988. t['x'] = 556;
  45989. t['y'] = 556;
  45990. t['z'] = 500;
  45991. t['braceleft'] = 389;
  45992. t['bar'] = 280;
  45993. t['braceright'] = 389;
  45994. t['asciitilde'] = 584;
  45995. t['exclamdown'] = 333;
  45996. t['cent'] = 556;
  45997. t['sterling'] = 556;
  45998. t['fraction'] = 167;
  45999. t['yen'] = 556;
  46000. t['florin'] = 556;
  46001. t['section'] = 556;
  46002. t['currency'] = 556;
  46003. t['quotesingle'] = 238;
  46004. t['quotedblleft'] = 500;
  46005. t['guillemotleft'] = 556;
  46006. t['guilsinglleft'] = 333;
  46007. t['guilsinglright'] = 333;
  46008. t['fi'] = 611;
  46009. t['fl'] = 611;
  46010. t['endash'] = 556;
  46011. t['dagger'] = 556;
  46012. t['daggerdbl'] = 556;
  46013. t['periodcentered'] = 278;
  46014. t['paragraph'] = 556;
  46015. t['bullet'] = 350;
  46016. t['quotesinglbase'] = 278;
  46017. t['quotedblbase'] = 500;
  46018. t['quotedblright'] = 500;
  46019. t['guillemotright'] = 556;
  46020. t['ellipsis'] = 1000;
  46021. t['perthousand'] = 1000;
  46022. t['questiondown'] = 611;
  46023. t['grave'] = 333;
  46024. t['acute'] = 333;
  46025. t['circumflex'] = 333;
  46026. t['tilde'] = 333;
  46027. t['macron'] = 333;
  46028. t['breve'] = 333;
  46029. t['dotaccent'] = 333;
  46030. t['dieresis'] = 333;
  46031. t['ring'] = 333;
  46032. t['cedilla'] = 333;
  46033. t['hungarumlaut'] = 333;
  46034. t['ogonek'] = 333;
  46035. t['caron'] = 333;
  46036. t['emdash'] = 1000;
  46037. t['AE'] = 1000;
  46038. t['ordfeminine'] = 370;
  46039. t['Lslash'] = 611;
  46040. t['Oslash'] = 778;
  46041. t['OE'] = 1000;
  46042. t['ordmasculine'] = 365;
  46043. t['ae'] = 889;
  46044. t['dotlessi'] = 278;
  46045. t['lslash'] = 278;
  46046. t['oslash'] = 611;
  46047. t['oe'] = 944;
  46048. t['germandbls'] = 611;
  46049. t['Idieresis'] = 278;
  46050. t['eacute'] = 556;
  46051. t['abreve'] = 556;
  46052. t['uhungarumlaut'] = 611;
  46053. t['ecaron'] = 556;
  46054. t['Ydieresis'] = 667;
  46055. t['divide'] = 584;
  46056. t['Yacute'] = 667;
  46057. t['Acircumflex'] = 722;
  46058. t['aacute'] = 556;
  46059. t['Ucircumflex'] = 722;
  46060. t['yacute'] = 556;
  46061. t['scommaaccent'] = 556;
  46062. t['ecircumflex'] = 556;
  46063. t['Uring'] = 722;
  46064. t['Udieresis'] = 722;
  46065. t['aogonek'] = 556;
  46066. t['Uacute'] = 722;
  46067. t['uogonek'] = 611;
  46068. t['Edieresis'] = 667;
  46069. t['Dcroat'] = 722;
  46070. t['commaaccent'] = 250;
  46071. t['copyright'] = 737;
  46072. t['Emacron'] = 667;
  46073. t['ccaron'] = 556;
  46074. t['aring'] = 556;
  46075. t['Ncommaaccent'] = 722;
  46076. t['lacute'] = 278;
  46077. t['agrave'] = 556;
  46078. t['Tcommaaccent'] = 611;
  46079. t['Cacute'] = 722;
  46080. t['atilde'] = 556;
  46081. t['Edotaccent'] = 667;
  46082. t['scaron'] = 556;
  46083. t['scedilla'] = 556;
  46084. t['iacute'] = 278;
  46085. t['lozenge'] = 494;
  46086. t['Rcaron'] = 722;
  46087. t['Gcommaaccent'] = 778;
  46088. t['ucircumflex'] = 611;
  46089. t['acircumflex'] = 556;
  46090. t['Amacron'] = 722;
  46091. t['rcaron'] = 389;
  46092. t['ccedilla'] = 556;
  46093. t['Zdotaccent'] = 611;
  46094. t['Thorn'] = 667;
  46095. t['Omacron'] = 778;
  46096. t['Racute'] = 722;
  46097. t['Sacute'] = 667;
  46098. t['dcaron'] = 743;
  46099. t['Umacron'] = 722;
  46100. t['uring'] = 611;
  46101. t['threesuperior'] = 333;
  46102. t['Ograve'] = 778;
  46103. t['Agrave'] = 722;
  46104. t['Abreve'] = 722;
  46105. t['multiply'] = 584;
  46106. t['uacute'] = 611;
  46107. t['Tcaron'] = 611;
  46108. t['partialdiff'] = 494;
  46109. t['ydieresis'] = 556;
  46110. t['Nacute'] = 722;
  46111. t['icircumflex'] = 278;
  46112. t['Ecircumflex'] = 667;
  46113. t['adieresis'] = 556;
  46114. t['edieresis'] = 556;
  46115. t['cacute'] = 556;
  46116. t['nacute'] = 611;
  46117. t['umacron'] = 611;
  46118. t['Ncaron'] = 722;
  46119. t['Iacute'] = 278;
  46120. t['plusminus'] = 584;
  46121. t['brokenbar'] = 280;
  46122. t['registered'] = 737;
  46123. t['Gbreve'] = 778;
  46124. t['Idotaccent'] = 278;
  46125. t['summation'] = 600;
  46126. t['Egrave'] = 667;
  46127. t['racute'] = 389;
  46128. t['omacron'] = 611;
  46129. t['Zacute'] = 611;
  46130. t['Zcaron'] = 611;
  46131. t['greaterequal'] = 549;
  46132. t['Eth'] = 722;
  46133. t['Ccedilla'] = 722;
  46134. t['lcommaaccent'] = 278;
  46135. t['tcaron'] = 389;
  46136. t['eogonek'] = 556;
  46137. t['Uogonek'] = 722;
  46138. t['Aacute'] = 722;
  46139. t['Adieresis'] = 722;
  46140. t['egrave'] = 556;
  46141. t['zacute'] = 500;
  46142. t['iogonek'] = 278;
  46143. t['Oacute'] = 778;
  46144. t['oacute'] = 611;
  46145. t['amacron'] = 556;
  46146. t['sacute'] = 556;
  46147. t['idieresis'] = 278;
  46148. t['Ocircumflex'] = 778;
  46149. t['Ugrave'] = 722;
  46150. t['Delta'] = 612;
  46151. t['thorn'] = 611;
  46152. t['twosuperior'] = 333;
  46153. t['Odieresis'] = 778;
  46154. t['mu'] = 611;
  46155. t['igrave'] = 278;
  46156. t['ohungarumlaut'] = 611;
  46157. t['Eogonek'] = 667;
  46158. t['dcroat'] = 611;
  46159. t['threequarters'] = 834;
  46160. t['Scedilla'] = 667;
  46161. t['lcaron'] = 400;
  46162. t['Kcommaaccent'] = 722;
  46163. t['Lacute'] = 611;
  46164. t['trademark'] = 1000;
  46165. t['edotaccent'] = 556;
  46166. t['Igrave'] = 278;
  46167. t['Imacron'] = 278;
  46168. t['Lcaron'] = 611;
  46169. t['onehalf'] = 834;
  46170. t['lessequal'] = 549;
  46171. t['ocircumflex'] = 611;
  46172. t['ntilde'] = 611;
  46173. t['Uhungarumlaut'] = 722;
  46174. t['Eacute'] = 667;
  46175. t['emacron'] = 556;
  46176. t['gbreve'] = 611;
  46177. t['onequarter'] = 834;
  46178. t['Scaron'] = 667;
  46179. t['Scommaaccent'] = 667;
  46180. t['Ohungarumlaut'] = 778;
  46181. t['degree'] = 400;
  46182. t['ograve'] = 611;
  46183. t['Ccaron'] = 722;
  46184. t['ugrave'] = 611;
  46185. t['radical'] = 549;
  46186. t['Dcaron'] = 722;
  46187. t['rcommaaccent'] = 389;
  46188. t['Ntilde'] = 722;
  46189. t['otilde'] = 611;
  46190. t['Rcommaaccent'] = 722;
  46191. t['Lcommaaccent'] = 611;
  46192. t['Atilde'] = 722;
  46193. t['Aogonek'] = 722;
  46194. t['Aring'] = 722;
  46195. t['Otilde'] = 778;
  46196. t['zdotaccent'] = 500;
  46197. t['Ecaron'] = 667;
  46198. t['Iogonek'] = 278;
  46199. t['kcommaaccent'] = 556;
  46200. t['minus'] = 584;
  46201. t['Icircumflex'] = 278;
  46202. t['ncaron'] = 611;
  46203. t['tcommaaccent'] = 333;
  46204. t['logicalnot'] = 584;
  46205. t['odieresis'] = 611;
  46206. t['udieresis'] = 611;
  46207. t['notequal'] = 549;
  46208. t['gcommaaccent'] = 611;
  46209. t['eth'] = 611;
  46210. t['zcaron'] = 500;
  46211. t['ncommaaccent'] = 611;
  46212. t['onesuperior'] = 333;
  46213. t['imacron'] = 278;
  46214. t['Euro'] = 556;
  46215. });
  46216. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  46217. t['space'] = 278;
  46218. t['exclam'] = 333;
  46219. t['quotedbl'] = 474;
  46220. t['numbersign'] = 556;
  46221. t['dollar'] = 556;
  46222. t['percent'] = 889;
  46223. t['ampersand'] = 722;
  46224. t['quoteright'] = 278;
  46225. t['parenleft'] = 333;
  46226. t['parenright'] = 333;
  46227. t['asterisk'] = 389;
  46228. t['plus'] = 584;
  46229. t['comma'] = 278;
  46230. t['hyphen'] = 333;
  46231. t['period'] = 278;
  46232. t['slash'] = 278;
  46233. t['zero'] = 556;
  46234. t['one'] = 556;
  46235. t['two'] = 556;
  46236. t['three'] = 556;
  46237. t['four'] = 556;
  46238. t['five'] = 556;
  46239. t['six'] = 556;
  46240. t['seven'] = 556;
  46241. t['eight'] = 556;
  46242. t['nine'] = 556;
  46243. t['colon'] = 333;
  46244. t['semicolon'] = 333;
  46245. t['less'] = 584;
  46246. t['equal'] = 584;
  46247. t['greater'] = 584;
  46248. t['question'] = 611;
  46249. t['at'] = 975;
  46250. t['A'] = 722;
  46251. t['B'] = 722;
  46252. t['C'] = 722;
  46253. t['D'] = 722;
  46254. t['E'] = 667;
  46255. t['F'] = 611;
  46256. t['G'] = 778;
  46257. t['H'] = 722;
  46258. t['I'] = 278;
  46259. t['J'] = 556;
  46260. t['K'] = 722;
  46261. t['L'] = 611;
  46262. t['M'] = 833;
  46263. t['N'] = 722;
  46264. t['O'] = 778;
  46265. t['P'] = 667;
  46266. t['Q'] = 778;
  46267. t['R'] = 722;
  46268. t['S'] = 667;
  46269. t['T'] = 611;
  46270. t['U'] = 722;
  46271. t['V'] = 667;
  46272. t['W'] = 944;
  46273. t['X'] = 667;
  46274. t['Y'] = 667;
  46275. t['Z'] = 611;
  46276. t['bracketleft'] = 333;
  46277. t['backslash'] = 278;
  46278. t['bracketright'] = 333;
  46279. t['asciicircum'] = 584;
  46280. t['underscore'] = 556;
  46281. t['quoteleft'] = 278;
  46282. t['a'] = 556;
  46283. t['b'] = 611;
  46284. t['c'] = 556;
  46285. t['d'] = 611;
  46286. t['e'] = 556;
  46287. t['f'] = 333;
  46288. t['g'] = 611;
  46289. t['h'] = 611;
  46290. t['i'] = 278;
  46291. t['j'] = 278;
  46292. t['k'] = 556;
  46293. t['l'] = 278;
  46294. t['m'] = 889;
  46295. t['n'] = 611;
  46296. t['o'] = 611;
  46297. t['p'] = 611;
  46298. t['q'] = 611;
  46299. t['r'] = 389;
  46300. t['s'] = 556;
  46301. t['t'] = 333;
  46302. t['u'] = 611;
  46303. t['v'] = 556;
  46304. t['w'] = 778;
  46305. t['x'] = 556;
  46306. t['y'] = 556;
  46307. t['z'] = 500;
  46308. t['braceleft'] = 389;
  46309. t['bar'] = 280;
  46310. t['braceright'] = 389;
  46311. t['asciitilde'] = 584;
  46312. t['exclamdown'] = 333;
  46313. t['cent'] = 556;
  46314. t['sterling'] = 556;
  46315. t['fraction'] = 167;
  46316. t['yen'] = 556;
  46317. t['florin'] = 556;
  46318. t['section'] = 556;
  46319. t['currency'] = 556;
  46320. t['quotesingle'] = 238;
  46321. t['quotedblleft'] = 500;
  46322. t['guillemotleft'] = 556;
  46323. t['guilsinglleft'] = 333;
  46324. t['guilsinglright'] = 333;
  46325. t['fi'] = 611;
  46326. t['fl'] = 611;
  46327. t['endash'] = 556;
  46328. t['dagger'] = 556;
  46329. t['daggerdbl'] = 556;
  46330. t['periodcentered'] = 278;
  46331. t['paragraph'] = 556;
  46332. t['bullet'] = 350;
  46333. t['quotesinglbase'] = 278;
  46334. t['quotedblbase'] = 500;
  46335. t['quotedblright'] = 500;
  46336. t['guillemotright'] = 556;
  46337. t['ellipsis'] = 1000;
  46338. t['perthousand'] = 1000;
  46339. t['questiondown'] = 611;
  46340. t['grave'] = 333;
  46341. t['acute'] = 333;
  46342. t['circumflex'] = 333;
  46343. t['tilde'] = 333;
  46344. t['macron'] = 333;
  46345. t['breve'] = 333;
  46346. t['dotaccent'] = 333;
  46347. t['dieresis'] = 333;
  46348. t['ring'] = 333;
  46349. t['cedilla'] = 333;
  46350. t['hungarumlaut'] = 333;
  46351. t['ogonek'] = 333;
  46352. t['caron'] = 333;
  46353. t['emdash'] = 1000;
  46354. t['AE'] = 1000;
  46355. t['ordfeminine'] = 370;
  46356. t['Lslash'] = 611;
  46357. t['Oslash'] = 778;
  46358. t['OE'] = 1000;
  46359. t['ordmasculine'] = 365;
  46360. t['ae'] = 889;
  46361. t['dotlessi'] = 278;
  46362. t['lslash'] = 278;
  46363. t['oslash'] = 611;
  46364. t['oe'] = 944;
  46365. t['germandbls'] = 611;
  46366. t['Idieresis'] = 278;
  46367. t['eacute'] = 556;
  46368. t['abreve'] = 556;
  46369. t['uhungarumlaut'] = 611;
  46370. t['ecaron'] = 556;
  46371. t['Ydieresis'] = 667;
  46372. t['divide'] = 584;
  46373. t['Yacute'] = 667;
  46374. t['Acircumflex'] = 722;
  46375. t['aacute'] = 556;
  46376. t['Ucircumflex'] = 722;
  46377. t['yacute'] = 556;
  46378. t['scommaaccent'] = 556;
  46379. t['ecircumflex'] = 556;
  46380. t['Uring'] = 722;
  46381. t['Udieresis'] = 722;
  46382. t['aogonek'] = 556;
  46383. t['Uacute'] = 722;
  46384. t['uogonek'] = 611;
  46385. t['Edieresis'] = 667;
  46386. t['Dcroat'] = 722;
  46387. t['commaaccent'] = 250;
  46388. t['copyright'] = 737;
  46389. t['Emacron'] = 667;
  46390. t['ccaron'] = 556;
  46391. t['aring'] = 556;
  46392. t['Ncommaaccent'] = 722;
  46393. t['lacute'] = 278;
  46394. t['agrave'] = 556;
  46395. t['Tcommaaccent'] = 611;
  46396. t['Cacute'] = 722;
  46397. t['atilde'] = 556;
  46398. t['Edotaccent'] = 667;
  46399. t['scaron'] = 556;
  46400. t['scedilla'] = 556;
  46401. t['iacute'] = 278;
  46402. t['lozenge'] = 494;
  46403. t['Rcaron'] = 722;
  46404. t['Gcommaaccent'] = 778;
  46405. t['ucircumflex'] = 611;
  46406. t['acircumflex'] = 556;
  46407. t['Amacron'] = 722;
  46408. t['rcaron'] = 389;
  46409. t['ccedilla'] = 556;
  46410. t['Zdotaccent'] = 611;
  46411. t['Thorn'] = 667;
  46412. t['Omacron'] = 778;
  46413. t['Racute'] = 722;
  46414. t['Sacute'] = 667;
  46415. t['dcaron'] = 743;
  46416. t['Umacron'] = 722;
  46417. t['uring'] = 611;
  46418. t['threesuperior'] = 333;
  46419. t['Ograve'] = 778;
  46420. t['Agrave'] = 722;
  46421. t['Abreve'] = 722;
  46422. t['multiply'] = 584;
  46423. t['uacute'] = 611;
  46424. t['Tcaron'] = 611;
  46425. t['partialdiff'] = 494;
  46426. t['ydieresis'] = 556;
  46427. t['Nacute'] = 722;
  46428. t['icircumflex'] = 278;
  46429. t['Ecircumflex'] = 667;
  46430. t['adieresis'] = 556;
  46431. t['edieresis'] = 556;
  46432. t['cacute'] = 556;
  46433. t['nacute'] = 611;
  46434. t['umacron'] = 611;
  46435. t['Ncaron'] = 722;
  46436. t['Iacute'] = 278;
  46437. t['plusminus'] = 584;
  46438. t['brokenbar'] = 280;
  46439. t['registered'] = 737;
  46440. t['Gbreve'] = 778;
  46441. t['Idotaccent'] = 278;
  46442. t['summation'] = 600;
  46443. t['Egrave'] = 667;
  46444. t['racute'] = 389;
  46445. t['omacron'] = 611;
  46446. t['Zacute'] = 611;
  46447. t['Zcaron'] = 611;
  46448. t['greaterequal'] = 549;
  46449. t['Eth'] = 722;
  46450. t['Ccedilla'] = 722;
  46451. t['lcommaaccent'] = 278;
  46452. t['tcaron'] = 389;
  46453. t['eogonek'] = 556;
  46454. t['Uogonek'] = 722;
  46455. t['Aacute'] = 722;
  46456. t['Adieresis'] = 722;
  46457. t['egrave'] = 556;
  46458. t['zacute'] = 500;
  46459. t['iogonek'] = 278;
  46460. t['Oacute'] = 778;
  46461. t['oacute'] = 611;
  46462. t['amacron'] = 556;
  46463. t['sacute'] = 556;
  46464. t['idieresis'] = 278;
  46465. t['Ocircumflex'] = 778;
  46466. t['Ugrave'] = 722;
  46467. t['Delta'] = 612;
  46468. t['thorn'] = 611;
  46469. t['twosuperior'] = 333;
  46470. t['Odieresis'] = 778;
  46471. t['mu'] = 611;
  46472. t['igrave'] = 278;
  46473. t['ohungarumlaut'] = 611;
  46474. t['Eogonek'] = 667;
  46475. t['dcroat'] = 611;
  46476. t['threequarters'] = 834;
  46477. t['Scedilla'] = 667;
  46478. t['lcaron'] = 400;
  46479. t['Kcommaaccent'] = 722;
  46480. t['Lacute'] = 611;
  46481. t['trademark'] = 1000;
  46482. t['edotaccent'] = 556;
  46483. t['Igrave'] = 278;
  46484. t['Imacron'] = 278;
  46485. t['Lcaron'] = 611;
  46486. t['onehalf'] = 834;
  46487. t['lessequal'] = 549;
  46488. t['ocircumflex'] = 611;
  46489. t['ntilde'] = 611;
  46490. t['Uhungarumlaut'] = 722;
  46491. t['Eacute'] = 667;
  46492. t['emacron'] = 556;
  46493. t['gbreve'] = 611;
  46494. t['onequarter'] = 834;
  46495. t['Scaron'] = 667;
  46496. t['Scommaaccent'] = 667;
  46497. t['Ohungarumlaut'] = 778;
  46498. t['degree'] = 400;
  46499. t['ograve'] = 611;
  46500. t['Ccaron'] = 722;
  46501. t['ugrave'] = 611;
  46502. t['radical'] = 549;
  46503. t['Dcaron'] = 722;
  46504. t['rcommaaccent'] = 389;
  46505. t['Ntilde'] = 722;
  46506. t['otilde'] = 611;
  46507. t['Rcommaaccent'] = 722;
  46508. t['Lcommaaccent'] = 611;
  46509. t['Atilde'] = 722;
  46510. t['Aogonek'] = 722;
  46511. t['Aring'] = 722;
  46512. t['Otilde'] = 778;
  46513. t['zdotaccent'] = 500;
  46514. t['Ecaron'] = 667;
  46515. t['Iogonek'] = 278;
  46516. t['kcommaaccent'] = 556;
  46517. t['minus'] = 584;
  46518. t['Icircumflex'] = 278;
  46519. t['ncaron'] = 611;
  46520. t['tcommaaccent'] = 333;
  46521. t['logicalnot'] = 584;
  46522. t['odieresis'] = 611;
  46523. t['udieresis'] = 611;
  46524. t['notequal'] = 549;
  46525. t['gcommaaccent'] = 611;
  46526. t['eth'] = 611;
  46527. t['zcaron'] = 500;
  46528. t['ncommaaccent'] = 611;
  46529. t['onesuperior'] = 333;
  46530. t['imacron'] = 278;
  46531. t['Euro'] = 556;
  46532. });
  46533. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  46534. t['space'] = 278;
  46535. t['exclam'] = 278;
  46536. t['quotedbl'] = 355;
  46537. t['numbersign'] = 556;
  46538. t['dollar'] = 556;
  46539. t['percent'] = 889;
  46540. t['ampersand'] = 667;
  46541. t['quoteright'] = 222;
  46542. t['parenleft'] = 333;
  46543. t['parenright'] = 333;
  46544. t['asterisk'] = 389;
  46545. t['plus'] = 584;
  46546. t['comma'] = 278;
  46547. t['hyphen'] = 333;
  46548. t['period'] = 278;
  46549. t['slash'] = 278;
  46550. t['zero'] = 556;
  46551. t['one'] = 556;
  46552. t['two'] = 556;
  46553. t['three'] = 556;
  46554. t['four'] = 556;
  46555. t['five'] = 556;
  46556. t['six'] = 556;
  46557. t['seven'] = 556;
  46558. t['eight'] = 556;
  46559. t['nine'] = 556;
  46560. t['colon'] = 278;
  46561. t['semicolon'] = 278;
  46562. t['less'] = 584;
  46563. t['equal'] = 584;
  46564. t['greater'] = 584;
  46565. t['question'] = 556;
  46566. t['at'] = 1015;
  46567. t['A'] = 667;
  46568. t['B'] = 667;
  46569. t['C'] = 722;
  46570. t['D'] = 722;
  46571. t['E'] = 667;
  46572. t['F'] = 611;
  46573. t['G'] = 778;
  46574. t['H'] = 722;
  46575. t['I'] = 278;
  46576. t['J'] = 500;
  46577. t['K'] = 667;
  46578. t['L'] = 556;
  46579. t['M'] = 833;
  46580. t['N'] = 722;
  46581. t['O'] = 778;
  46582. t['P'] = 667;
  46583. t['Q'] = 778;
  46584. t['R'] = 722;
  46585. t['S'] = 667;
  46586. t['T'] = 611;
  46587. t['U'] = 722;
  46588. t['V'] = 667;
  46589. t['W'] = 944;
  46590. t['X'] = 667;
  46591. t['Y'] = 667;
  46592. t['Z'] = 611;
  46593. t['bracketleft'] = 278;
  46594. t['backslash'] = 278;
  46595. t['bracketright'] = 278;
  46596. t['asciicircum'] = 469;
  46597. t['underscore'] = 556;
  46598. t['quoteleft'] = 222;
  46599. t['a'] = 556;
  46600. t['b'] = 556;
  46601. t['c'] = 500;
  46602. t['d'] = 556;
  46603. t['e'] = 556;
  46604. t['f'] = 278;
  46605. t['g'] = 556;
  46606. t['h'] = 556;
  46607. t['i'] = 222;
  46608. t['j'] = 222;
  46609. t['k'] = 500;
  46610. t['l'] = 222;
  46611. t['m'] = 833;
  46612. t['n'] = 556;
  46613. t['o'] = 556;
  46614. t['p'] = 556;
  46615. t['q'] = 556;
  46616. t['r'] = 333;
  46617. t['s'] = 500;
  46618. t['t'] = 278;
  46619. t['u'] = 556;
  46620. t['v'] = 500;
  46621. t['w'] = 722;
  46622. t['x'] = 500;
  46623. t['y'] = 500;
  46624. t['z'] = 500;
  46625. t['braceleft'] = 334;
  46626. t['bar'] = 260;
  46627. t['braceright'] = 334;
  46628. t['asciitilde'] = 584;
  46629. t['exclamdown'] = 333;
  46630. t['cent'] = 556;
  46631. t['sterling'] = 556;
  46632. t['fraction'] = 167;
  46633. t['yen'] = 556;
  46634. t['florin'] = 556;
  46635. t['section'] = 556;
  46636. t['currency'] = 556;
  46637. t['quotesingle'] = 191;
  46638. t['quotedblleft'] = 333;
  46639. t['guillemotleft'] = 556;
  46640. t['guilsinglleft'] = 333;
  46641. t['guilsinglright'] = 333;
  46642. t['fi'] = 500;
  46643. t['fl'] = 500;
  46644. t['endash'] = 556;
  46645. t['dagger'] = 556;
  46646. t['daggerdbl'] = 556;
  46647. t['periodcentered'] = 278;
  46648. t['paragraph'] = 537;
  46649. t['bullet'] = 350;
  46650. t['quotesinglbase'] = 222;
  46651. t['quotedblbase'] = 333;
  46652. t['quotedblright'] = 333;
  46653. t['guillemotright'] = 556;
  46654. t['ellipsis'] = 1000;
  46655. t['perthousand'] = 1000;
  46656. t['questiondown'] = 611;
  46657. t['grave'] = 333;
  46658. t['acute'] = 333;
  46659. t['circumflex'] = 333;
  46660. t['tilde'] = 333;
  46661. t['macron'] = 333;
  46662. t['breve'] = 333;
  46663. t['dotaccent'] = 333;
  46664. t['dieresis'] = 333;
  46665. t['ring'] = 333;
  46666. t['cedilla'] = 333;
  46667. t['hungarumlaut'] = 333;
  46668. t['ogonek'] = 333;
  46669. t['caron'] = 333;
  46670. t['emdash'] = 1000;
  46671. t['AE'] = 1000;
  46672. t['ordfeminine'] = 370;
  46673. t['Lslash'] = 556;
  46674. t['Oslash'] = 778;
  46675. t['OE'] = 1000;
  46676. t['ordmasculine'] = 365;
  46677. t['ae'] = 889;
  46678. t['dotlessi'] = 278;
  46679. t['lslash'] = 222;
  46680. t['oslash'] = 611;
  46681. t['oe'] = 944;
  46682. t['germandbls'] = 611;
  46683. t['Idieresis'] = 278;
  46684. t['eacute'] = 556;
  46685. t['abreve'] = 556;
  46686. t['uhungarumlaut'] = 556;
  46687. t['ecaron'] = 556;
  46688. t['Ydieresis'] = 667;
  46689. t['divide'] = 584;
  46690. t['Yacute'] = 667;
  46691. t['Acircumflex'] = 667;
  46692. t['aacute'] = 556;
  46693. t['Ucircumflex'] = 722;
  46694. t['yacute'] = 500;
  46695. t['scommaaccent'] = 500;
  46696. t['ecircumflex'] = 556;
  46697. t['Uring'] = 722;
  46698. t['Udieresis'] = 722;
  46699. t['aogonek'] = 556;
  46700. t['Uacute'] = 722;
  46701. t['uogonek'] = 556;
  46702. t['Edieresis'] = 667;
  46703. t['Dcroat'] = 722;
  46704. t['commaaccent'] = 250;
  46705. t['copyright'] = 737;
  46706. t['Emacron'] = 667;
  46707. t['ccaron'] = 500;
  46708. t['aring'] = 556;
  46709. t['Ncommaaccent'] = 722;
  46710. t['lacute'] = 222;
  46711. t['agrave'] = 556;
  46712. t['Tcommaaccent'] = 611;
  46713. t['Cacute'] = 722;
  46714. t['atilde'] = 556;
  46715. t['Edotaccent'] = 667;
  46716. t['scaron'] = 500;
  46717. t['scedilla'] = 500;
  46718. t['iacute'] = 278;
  46719. t['lozenge'] = 471;
  46720. t['Rcaron'] = 722;
  46721. t['Gcommaaccent'] = 778;
  46722. t['ucircumflex'] = 556;
  46723. t['acircumflex'] = 556;
  46724. t['Amacron'] = 667;
  46725. t['rcaron'] = 333;
  46726. t['ccedilla'] = 500;
  46727. t['Zdotaccent'] = 611;
  46728. t['Thorn'] = 667;
  46729. t['Omacron'] = 778;
  46730. t['Racute'] = 722;
  46731. t['Sacute'] = 667;
  46732. t['dcaron'] = 643;
  46733. t['Umacron'] = 722;
  46734. t['uring'] = 556;
  46735. t['threesuperior'] = 333;
  46736. t['Ograve'] = 778;
  46737. t['Agrave'] = 667;
  46738. t['Abreve'] = 667;
  46739. t['multiply'] = 584;
  46740. t['uacute'] = 556;
  46741. t['Tcaron'] = 611;
  46742. t['partialdiff'] = 476;
  46743. t['ydieresis'] = 500;
  46744. t['Nacute'] = 722;
  46745. t['icircumflex'] = 278;
  46746. t['Ecircumflex'] = 667;
  46747. t['adieresis'] = 556;
  46748. t['edieresis'] = 556;
  46749. t['cacute'] = 500;
  46750. t['nacute'] = 556;
  46751. t['umacron'] = 556;
  46752. t['Ncaron'] = 722;
  46753. t['Iacute'] = 278;
  46754. t['plusminus'] = 584;
  46755. t['brokenbar'] = 260;
  46756. t['registered'] = 737;
  46757. t['Gbreve'] = 778;
  46758. t['Idotaccent'] = 278;
  46759. t['summation'] = 600;
  46760. t['Egrave'] = 667;
  46761. t['racute'] = 333;
  46762. t['omacron'] = 556;
  46763. t['Zacute'] = 611;
  46764. t['Zcaron'] = 611;
  46765. t['greaterequal'] = 549;
  46766. t['Eth'] = 722;
  46767. t['Ccedilla'] = 722;
  46768. t['lcommaaccent'] = 222;
  46769. t['tcaron'] = 317;
  46770. t['eogonek'] = 556;
  46771. t['Uogonek'] = 722;
  46772. t['Aacute'] = 667;
  46773. t['Adieresis'] = 667;
  46774. t['egrave'] = 556;
  46775. t['zacute'] = 500;
  46776. t['iogonek'] = 222;
  46777. t['Oacute'] = 778;
  46778. t['oacute'] = 556;
  46779. t['amacron'] = 556;
  46780. t['sacute'] = 500;
  46781. t['idieresis'] = 278;
  46782. t['Ocircumflex'] = 778;
  46783. t['Ugrave'] = 722;
  46784. t['Delta'] = 612;
  46785. t['thorn'] = 556;
  46786. t['twosuperior'] = 333;
  46787. t['Odieresis'] = 778;
  46788. t['mu'] = 556;
  46789. t['igrave'] = 278;
  46790. t['ohungarumlaut'] = 556;
  46791. t['Eogonek'] = 667;
  46792. t['dcroat'] = 556;
  46793. t['threequarters'] = 834;
  46794. t['Scedilla'] = 667;
  46795. t['lcaron'] = 299;
  46796. t['Kcommaaccent'] = 667;
  46797. t['Lacute'] = 556;
  46798. t['trademark'] = 1000;
  46799. t['edotaccent'] = 556;
  46800. t['Igrave'] = 278;
  46801. t['Imacron'] = 278;
  46802. t['Lcaron'] = 556;
  46803. t['onehalf'] = 834;
  46804. t['lessequal'] = 549;
  46805. t['ocircumflex'] = 556;
  46806. t['ntilde'] = 556;
  46807. t['Uhungarumlaut'] = 722;
  46808. t['Eacute'] = 667;
  46809. t['emacron'] = 556;
  46810. t['gbreve'] = 556;
  46811. t['onequarter'] = 834;
  46812. t['Scaron'] = 667;
  46813. t['Scommaaccent'] = 667;
  46814. t['Ohungarumlaut'] = 778;
  46815. t['degree'] = 400;
  46816. t['ograve'] = 556;
  46817. t['Ccaron'] = 722;
  46818. t['ugrave'] = 556;
  46819. t['radical'] = 453;
  46820. t['Dcaron'] = 722;
  46821. t['rcommaaccent'] = 333;
  46822. t['Ntilde'] = 722;
  46823. t['otilde'] = 556;
  46824. t['Rcommaaccent'] = 722;
  46825. t['Lcommaaccent'] = 556;
  46826. t['Atilde'] = 667;
  46827. t['Aogonek'] = 667;
  46828. t['Aring'] = 667;
  46829. t['Otilde'] = 778;
  46830. t['zdotaccent'] = 500;
  46831. t['Ecaron'] = 667;
  46832. t['Iogonek'] = 278;
  46833. t['kcommaaccent'] = 500;
  46834. t['minus'] = 584;
  46835. t['Icircumflex'] = 278;
  46836. t['ncaron'] = 556;
  46837. t['tcommaaccent'] = 278;
  46838. t['logicalnot'] = 584;
  46839. t['odieresis'] = 556;
  46840. t['udieresis'] = 556;
  46841. t['notequal'] = 549;
  46842. t['gcommaaccent'] = 556;
  46843. t['eth'] = 556;
  46844. t['zcaron'] = 500;
  46845. t['ncommaaccent'] = 556;
  46846. t['onesuperior'] = 333;
  46847. t['imacron'] = 278;
  46848. t['Euro'] = 556;
  46849. });
  46850. t['Symbol'] = getLookupTableFactory(function (t) {
  46851. t['space'] = 250;
  46852. t['exclam'] = 333;
  46853. t['universal'] = 713;
  46854. t['numbersign'] = 500;
  46855. t['existential'] = 549;
  46856. t['percent'] = 833;
  46857. t['ampersand'] = 778;
  46858. t['suchthat'] = 439;
  46859. t['parenleft'] = 333;
  46860. t['parenright'] = 333;
  46861. t['asteriskmath'] = 500;
  46862. t['plus'] = 549;
  46863. t['comma'] = 250;
  46864. t['minus'] = 549;
  46865. t['period'] = 250;
  46866. t['slash'] = 278;
  46867. t['zero'] = 500;
  46868. t['one'] = 500;
  46869. t['two'] = 500;
  46870. t['three'] = 500;
  46871. t['four'] = 500;
  46872. t['five'] = 500;
  46873. t['six'] = 500;
  46874. t['seven'] = 500;
  46875. t['eight'] = 500;
  46876. t['nine'] = 500;
  46877. t['colon'] = 278;
  46878. t['semicolon'] = 278;
  46879. t['less'] = 549;
  46880. t['equal'] = 549;
  46881. t['greater'] = 549;
  46882. t['question'] = 444;
  46883. t['congruent'] = 549;
  46884. t['Alpha'] = 722;
  46885. t['Beta'] = 667;
  46886. t['Chi'] = 722;
  46887. t['Delta'] = 612;
  46888. t['Epsilon'] = 611;
  46889. t['Phi'] = 763;
  46890. t['Gamma'] = 603;
  46891. t['Eta'] = 722;
  46892. t['Iota'] = 333;
  46893. t['theta1'] = 631;
  46894. t['Kappa'] = 722;
  46895. t['Lambda'] = 686;
  46896. t['Mu'] = 889;
  46897. t['Nu'] = 722;
  46898. t['Omicron'] = 722;
  46899. t['Pi'] = 768;
  46900. t['Theta'] = 741;
  46901. t['Rho'] = 556;
  46902. t['Sigma'] = 592;
  46903. t['Tau'] = 611;
  46904. t['Upsilon'] = 690;
  46905. t['sigma1'] = 439;
  46906. t['Omega'] = 768;
  46907. t['Xi'] = 645;
  46908. t['Psi'] = 795;
  46909. t['Zeta'] = 611;
  46910. t['bracketleft'] = 333;
  46911. t['therefore'] = 863;
  46912. t['bracketright'] = 333;
  46913. t['perpendicular'] = 658;
  46914. t['underscore'] = 500;
  46915. t['radicalex'] = 500;
  46916. t['alpha'] = 631;
  46917. t['beta'] = 549;
  46918. t['chi'] = 549;
  46919. t['delta'] = 494;
  46920. t['epsilon'] = 439;
  46921. t['phi'] = 521;
  46922. t['gamma'] = 411;
  46923. t['eta'] = 603;
  46924. t['iota'] = 329;
  46925. t['phi1'] = 603;
  46926. t['kappa'] = 549;
  46927. t['lambda'] = 549;
  46928. t['mu'] = 576;
  46929. t['nu'] = 521;
  46930. t['omicron'] = 549;
  46931. t['pi'] = 549;
  46932. t['theta'] = 521;
  46933. t['rho'] = 549;
  46934. t['sigma'] = 603;
  46935. t['tau'] = 439;
  46936. t['upsilon'] = 576;
  46937. t['omega1'] = 713;
  46938. t['omega'] = 686;
  46939. t['xi'] = 493;
  46940. t['psi'] = 686;
  46941. t['zeta'] = 494;
  46942. t['braceleft'] = 480;
  46943. t['bar'] = 200;
  46944. t['braceright'] = 480;
  46945. t['similar'] = 549;
  46946. t['Euro'] = 750;
  46947. t['Upsilon1'] = 620;
  46948. t['minute'] = 247;
  46949. t['lessequal'] = 549;
  46950. t['fraction'] = 167;
  46951. t['infinity'] = 713;
  46952. t['florin'] = 500;
  46953. t['club'] = 753;
  46954. t['diamond'] = 753;
  46955. t['heart'] = 753;
  46956. t['spade'] = 753;
  46957. t['arrowboth'] = 1042;
  46958. t['arrowleft'] = 987;
  46959. t['arrowup'] = 603;
  46960. t['arrowright'] = 987;
  46961. t['arrowdown'] = 603;
  46962. t['degree'] = 400;
  46963. t['plusminus'] = 549;
  46964. t['second'] = 411;
  46965. t['greaterequal'] = 549;
  46966. t['multiply'] = 549;
  46967. t['proportional'] = 713;
  46968. t['partialdiff'] = 494;
  46969. t['bullet'] = 460;
  46970. t['divide'] = 549;
  46971. t['notequal'] = 549;
  46972. t['equivalence'] = 549;
  46973. t['approxequal'] = 549;
  46974. t['ellipsis'] = 1000;
  46975. t['arrowvertex'] = 603;
  46976. t['arrowhorizex'] = 1000;
  46977. t['carriagereturn'] = 658;
  46978. t['aleph'] = 823;
  46979. t['Ifraktur'] = 686;
  46980. t['Rfraktur'] = 795;
  46981. t['weierstrass'] = 987;
  46982. t['circlemultiply'] = 768;
  46983. t['circleplus'] = 768;
  46984. t['emptyset'] = 823;
  46985. t['intersection'] = 768;
  46986. t['union'] = 768;
  46987. t['propersuperset'] = 713;
  46988. t['reflexsuperset'] = 713;
  46989. t['notsubset'] = 713;
  46990. t['propersubset'] = 713;
  46991. t['reflexsubset'] = 713;
  46992. t['element'] = 713;
  46993. t['notelement'] = 713;
  46994. t['angle'] = 768;
  46995. t['gradient'] = 713;
  46996. t['registerserif'] = 790;
  46997. t['copyrightserif'] = 790;
  46998. t['trademarkserif'] = 890;
  46999. t['product'] = 823;
  47000. t['radical'] = 549;
  47001. t['dotmath'] = 250;
  47002. t['logicalnot'] = 713;
  47003. t['logicaland'] = 603;
  47004. t['logicalor'] = 603;
  47005. t['arrowdblboth'] = 1042;
  47006. t['arrowdblleft'] = 987;
  47007. t['arrowdblup'] = 603;
  47008. t['arrowdblright'] = 987;
  47009. t['arrowdbldown'] = 603;
  47010. t['lozenge'] = 494;
  47011. t['angleleft'] = 329;
  47012. t['registersans'] = 790;
  47013. t['copyrightsans'] = 790;
  47014. t['trademarksans'] = 786;
  47015. t['summation'] = 713;
  47016. t['parenlefttp'] = 384;
  47017. t['parenleftex'] = 384;
  47018. t['parenleftbt'] = 384;
  47019. t['bracketlefttp'] = 384;
  47020. t['bracketleftex'] = 384;
  47021. t['bracketleftbt'] = 384;
  47022. t['bracelefttp'] = 494;
  47023. t['braceleftmid'] = 494;
  47024. t['braceleftbt'] = 494;
  47025. t['braceex'] = 494;
  47026. t['angleright'] = 329;
  47027. t['integral'] = 274;
  47028. t['integraltp'] = 686;
  47029. t['integralex'] = 686;
  47030. t['integralbt'] = 686;
  47031. t['parenrighttp'] = 384;
  47032. t['parenrightex'] = 384;
  47033. t['parenrightbt'] = 384;
  47034. t['bracketrighttp'] = 384;
  47035. t['bracketrightex'] = 384;
  47036. t['bracketrightbt'] = 384;
  47037. t['bracerighttp'] = 494;
  47038. t['bracerightmid'] = 494;
  47039. t['bracerightbt'] = 494;
  47040. t['apple'] = 790;
  47041. });
  47042. t['Times-Roman'] = getLookupTableFactory(function (t) {
  47043. t['space'] = 250;
  47044. t['exclam'] = 333;
  47045. t['quotedbl'] = 408;
  47046. t['numbersign'] = 500;
  47047. t['dollar'] = 500;
  47048. t['percent'] = 833;
  47049. t['ampersand'] = 778;
  47050. t['quoteright'] = 333;
  47051. t['parenleft'] = 333;
  47052. t['parenright'] = 333;
  47053. t['asterisk'] = 500;
  47054. t['plus'] = 564;
  47055. t['comma'] = 250;
  47056. t['hyphen'] = 333;
  47057. t['period'] = 250;
  47058. t['slash'] = 278;
  47059. t['zero'] = 500;
  47060. t['one'] = 500;
  47061. t['two'] = 500;
  47062. t['three'] = 500;
  47063. t['four'] = 500;
  47064. t['five'] = 500;
  47065. t['six'] = 500;
  47066. t['seven'] = 500;
  47067. t['eight'] = 500;
  47068. t['nine'] = 500;
  47069. t['colon'] = 278;
  47070. t['semicolon'] = 278;
  47071. t['less'] = 564;
  47072. t['equal'] = 564;
  47073. t['greater'] = 564;
  47074. t['question'] = 444;
  47075. t['at'] = 921;
  47076. t['A'] = 722;
  47077. t['B'] = 667;
  47078. t['C'] = 667;
  47079. t['D'] = 722;
  47080. t['E'] = 611;
  47081. t['F'] = 556;
  47082. t['G'] = 722;
  47083. t['H'] = 722;
  47084. t['I'] = 333;
  47085. t['J'] = 389;
  47086. t['K'] = 722;
  47087. t['L'] = 611;
  47088. t['M'] = 889;
  47089. t['N'] = 722;
  47090. t['O'] = 722;
  47091. t['P'] = 556;
  47092. t['Q'] = 722;
  47093. t['R'] = 667;
  47094. t['S'] = 556;
  47095. t['T'] = 611;
  47096. t['U'] = 722;
  47097. t['V'] = 722;
  47098. t['W'] = 944;
  47099. t['X'] = 722;
  47100. t['Y'] = 722;
  47101. t['Z'] = 611;
  47102. t['bracketleft'] = 333;
  47103. t['backslash'] = 278;
  47104. t['bracketright'] = 333;
  47105. t['asciicircum'] = 469;
  47106. t['underscore'] = 500;
  47107. t['quoteleft'] = 333;
  47108. t['a'] = 444;
  47109. t['b'] = 500;
  47110. t['c'] = 444;
  47111. t['d'] = 500;
  47112. t['e'] = 444;
  47113. t['f'] = 333;
  47114. t['g'] = 500;
  47115. t['h'] = 500;
  47116. t['i'] = 278;
  47117. t['j'] = 278;
  47118. t['k'] = 500;
  47119. t['l'] = 278;
  47120. t['m'] = 778;
  47121. t['n'] = 500;
  47122. t['o'] = 500;
  47123. t['p'] = 500;
  47124. t['q'] = 500;
  47125. t['r'] = 333;
  47126. t['s'] = 389;
  47127. t['t'] = 278;
  47128. t['u'] = 500;
  47129. t['v'] = 500;
  47130. t['w'] = 722;
  47131. t['x'] = 500;
  47132. t['y'] = 500;
  47133. t['z'] = 444;
  47134. t['braceleft'] = 480;
  47135. t['bar'] = 200;
  47136. t['braceright'] = 480;
  47137. t['asciitilde'] = 541;
  47138. t['exclamdown'] = 333;
  47139. t['cent'] = 500;
  47140. t['sterling'] = 500;
  47141. t['fraction'] = 167;
  47142. t['yen'] = 500;
  47143. t['florin'] = 500;
  47144. t['section'] = 500;
  47145. t['currency'] = 500;
  47146. t['quotesingle'] = 180;
  47147. t['quotedblleft'] = 444;
  47148. t['guillemotleft'] = 500;
  47149. t['guilsinglleft'] = 333;
  47150. t['guilsinglright'] = 333;
  47151. t['fi'] = 556;
  47152. t['fl'] = 556;
  47153. t['endash'] = 500;
  47154. t['dagger'] = 500;
  47155. t['daggerdbl'] = 500;
  47156. t['periodcentered'] = 250;
  47157. t['paragraph'] = 453;
  47158. t['bullet'] = 350;
  47159. t['quotesinglbase'] = 333;
  47160. t['quotedblbase'] = 444;
  47161. t['quotedblright'] = 444;
  47162. t['guillemotright'] = 500;
  47163. t['ellipsis'] = 1000;
  47164. t['perthousand'] = 1000;
  47165. t['questiondown'] = 444;
  47166. t['grave'] = 333;
  47167. t['acute'] = 333;
  47168. t['circumflex'] = 333;
  47169. t['tilde'] = 333;
  47170. t['macron'] = 333;
  47171. t['breve'] = 333;
  47172. t['dotaccent'] = 333;
  47173. t['dieresis'] = 333;
  47174. t['ring'] = 333;
  47175. t['cedilla'] = 333;
  47176. t['hungarumlaut'] = 333;
  47177. t['ogonek'] = 333;
  47178. t['caron'] = 333;
  47179. t['emdash'] = 1000;
  47180. t['AE'] = 889;
  47181. t['ordfeminine'] = 276;
  47182. t['Lslash'] = 611;
  47183. t['Oslash'] = 722;
  47184. t['OE'] = 889;
  47185. t['ordmasculine'] = 310;
  47186. t['ae'] = 667;
  47187. t['dotlessi'] = 278;
  47188. t['lslash'] = 278;
  47189. t['oslash'] = 500;
  47190. t['oe'] = 722;
  47191. t['germandbls'] = 500;
  47192. t['Idieresis'] = 333;
  47193. t['eacute'] = 444;
  47194. t['abreve'] = 444;
  47195. t['uhungarumlaut'] = 500;
  47196. t['ecaron'] = 444;
  47197. t['Ydieresis'] = 722;
  47198. t['divide'] = 564;
  47199. t['Yacute'] = 722;
  47200. t['Acircumflex'] = 722;
  47201. t['aacute'] = 444;
  47202. t['Ucircumflex'] = 722;
  47203. t['yacute'] = 500;
  47204. t['scommaaccent'] = 389;
  47205. t['ecircumflex'] = 444;
  47206. t['Uring'] = 722;
  47207. t['Udieresis'] = 722;
  47208. t['aogonek'] = 444;
  47209. t['Uacute'] = 722;
  47210. t['uogonek'] = 500;
  47211. t['Edieresis'] = 611;
  47212. t['Dcroat'] = 722;
  47213. t['commaaccent'] = 250;
  47214. t['copyright'] = 760;
  47215. t['Emacron'] = 611;
  47216. t['ccaron'] = 444;
  47217. t['aring'] = 444;
  47218. t['Ncommaaccent'] = 722;
  47219. t['lacute'] = 278;
  47220. t['agrave'] = 444;
  47221. t['Tcommaaccent'] = 611;
  47222. t['Cacute'] = 667;
  47223. t['atilde'] = 444;
  47224. t['Edotaccent'] = 611;
  47225. t['scaron'] = 389;
  47226. t['scedilla'] = 389;
  47227. t['iacute'] = 278;
  47228. t['lozenge'] = 471;
  47229. t['Rcaron'] = 667;
  47230. t['Gcommaaccent'] = 722;
  47231. t['ucircumflex'] = 500;
  47232. t['acircumflex'] = 444;
  47233. t['Amacron'] = 722;
  47234. t['rcaron'] = 333;
  47235. t['ccedilla'] = 444;
  47236. t['Zdotaccent'] = 611;
  47237. t['Thorn'] = 556;
  47238. t['Omacron'] = 722;
  47239. t['Racute'] = 667;
  47240. t['Sacute'] = 556;
  47241. t['dcaron'] = 588;
  47242. t['Umacron'] = 722;
  47243. t['uring'] = 500;
  47244. t['threesuperior'] = 300;
  47245. t['Ograve'] = 722;
  47246. t['Agrave'] = 722;
  47247. t['Abreve'] = 722;
  47248. t['multiply'] = 564;
  47249. t['uacute'] = 500;
  47250. t['Tcaron'] = 611;
  47251. t['partialdiff'] = 476;
  47252. t['ydieresis'] = 500;
  47253. t['Nacute'] = 722;
  47254. t['icircumflex'] = 278;
  47255. t['Ecircumflex'] = 611;
  47256. t['adieresis'] = 444;
  47257. t['edieresis'] = 444;
  47258. t['cacute'] = 444;
  47259. t['nacute'] = 500;
  47260. t['umacron'] = 500;
  47261. t['Ncaron'] = 722;
  47262. t['Iacute'] = 333;
  47263. t['plusminus'] = 564;
  47264. t['brokenbar'] = 200;
  47265. t['registered'] = 760;
  47266. t['Gbreve'] = 722;
  47267. t['Idotaccent'] = 333;
  47268. t['summation'] = 600;
  47269. t['Egrave'] = 611;
  47270. t['racute'] = 333;
  47271. t['omacron'] = 500;
  47272. t['Zacute'] = 611;
  47273. t['Zcaron'] = 611;
  47274. t['greaterequal'] = 549;
  47275. t['Eth'] = 722;
  47276. t['Ccedilla'] = 667;
  47277. t['lcommaaccent'] = 278;
  47278. t['tcaron'] = 326;
  47279. t['eogonek'] = 444;
  47280. t['Uogonek'] = 722;
  47281. t['Aacute'] = 722;
  47282. t['Adieresis'] = 722;
  47283. t['egrave'] = 444;
  47284. t['zacute'] = 444;
  47285. t['iogonek'] = 278;
  47286. t['Oacute'] = 722;
  47287. t['oacute'] = 500;
  47288. t['amacron'] = 444;
  47289. t['sacute'] = 389;
  47290. t['idieresis'] = 278;
  47291. t['Ocircumflex'] = 722;
  47292. t['Ugrave'] = 722;
  47293. t['Delta'] = 612;
  47294. t['thorn'] = 500;
  47295. t['twosuperior'] = 300;
  47296. t['Odieresis'] = 722;
  47297. t['mu'] = 500;
  47298. t['igrave'] = 278;
  47299. t['ohungarumlaut'] = 500;
  47300. t['Eogonek'] = 611;
  47301. t['dcroat'] = 500;
  47302. t['threequarters'] = 750;
  47303. t['Scedilla'] = 556;
  47304. t['lcaron'] = 344;
  47305. t['Kcommaaccent'] = 722;
  47306. t['Lacute'] = 611;
  47307. t['trademark'] = 980;
  47308. t['edotaccent'] = 444;
  47309. t['Igrave'] = 333;
  47310. t['Imacron'] = 333;
  47311. t['Lcaron'] = 611;
  47312. t['onehalf'] = 750;
  47313. t['lessequal'] = 549;
  47314. t['ocircumflex'] = 500;
  47315. t['ntilde'] = 500;
  47316. t['Uhungarumlaut'] = 722;
  47317. t['Eacute'] = 611;
  47318. t['emacron'] = 444;
  47319. t['gbreve'] = 500;
  47320. t['onequarter'] = 750;
  47321. t['Scaron'] = 556;
  47322. t['Scommaaccent'] = 556;
  47323. t['Ohungarumlaut'] = 722;
  47324. t['degree'] = 400;
  47325. t['ograve'] = 500;
  47326. t['Ccaron'] = 667;
  47327. t['ugrave'] = 500;
  47328. t['radical'] = 453;
  47329. t['Dcaron'] = 722;
  47330. t['rcommaaccent'] = 333;
  47331. t['Ntilde'] = 722;
  47332. t['otilde'] = 500;
  47333. t['Rcommaaccent'] = 667;
  47334. t['Lcommaaccent'] = 611;
  47335. t['Atilde'] = 722;
  47336. t['Aogonek'] = 722;
  47337. t['Aring'] = 722;
  47338. t['Otilde'] = 722;
  47339. t['zdotaccent'] = 444;
  47340. t['Ecaron'] = 611;
  47341. t['Iogonek'] = 333;
  47342. t['kcommaaccent'] = 500;
  47343. t['minus'] = 564;
  47344. t['Icircumflex'] = 333;
  47345. t['ncaron'] = 500;
  47346. t['tcommaaccent'] = 278;
  47347. t['logicalnot'] = 564;
  47348. t['odieresis'] = 500;
  47349. t['udieresis'] = 500;
  47350. t['notequal'] = 549;
  47351. t['gcommaaccent'] = 500;
  47352. t['eth'] = 500;
  47353. t['zcaron'] = 444;
  47354. t['ncommaaccent'] = 500;
  47355. t['onesuperior'] = 300;
  47356. t['imacron'] = 278;
  47357. t['Euro'] = 500;
  47358. });
  47359. t['Times-Bold'] = getLookupTableFactory(function (t) {
  47360. t['space'] = 250;
  47361. t['exclam'] = 333;
  47362. t['quotedbl'] = 555;
  47363. t['numbersign'] = 500;
  47364. t['dollar'] = 500;
  47365. t['percent'] = 1000;
  47366. t['ampersand'] = 833;
  47367. t['quoteright'] = 333;
  47368. t['parenleft'] = 333;
  47369. t['parenright'] = 333;
  47370. t['asterisk'] = 500;
  47371. t['plus'] = 570;
  47372. t['comma'] = 250;
  47373. t['hyphen'] = 333;
  47374. t['period'] = 250;
  47375. t['slash'] = 278;
  47376. t['zero'] = 500;
  47377. t['one'] = 500;
  47378. t['two'] = 500;
  47379. t['three'] = 500;
  47380. t['four'] = 500;
  47381. t['five'] = 500;
  47382. t['six'] = 500;
  47383. t['seven'] = 500;
  47384. t['eight'] = 500;
  47385. t['nine'] = 500;
  47386. t['colon'] = 333;
  47387. t['semicolon'] = 333;
  47388. t['less'] = 570;
  47389. t['equal'] = 570;
  47390. t['greater'] = 570;
  47391. t['question'] = 500;
  47392. t['at'] = 930;
  47393. t['A'] = 722;
  47394. t['B'] = 667;
  47395. t['C'] = 722;
  47396. t['D'] = 722;
  47397. t['E'] = 667;
  47398. t['F'] = 611;
  47399. t['G'] = 778;
  47400. t['H'] = 778;
  47401. t['I'] = 389;
  47402. t['J'] = 500;
  47403. t['K'] = 778;
  47404. t['L'] = 667;
  47405. t['M'] = 944;
  47406. t['N'] = 722;
  47407. t['O'] = 778;
  47408. t['P'] = 611;
  47409. t['Q'] = 778;
  47410. t['R'] = 722;
  47411. t['S'] = 556;
  47412. t['T'] = 667;
  47413. t['U'] = 722;
  47414. t['V'] = 722;
  47415. t['W'] = 1000;
  47416. t['X'] = 722;
  47417. t['Y'] = 722;
  47418. t['Z'] = 667;
  47419. t['bracketleft'] = 333;
  47420. t['backslash'] = 278;
  47421. t['bracketright'] = 333;
  47422. t['asciicircum'] = 581;
  47423. t['underscore'] = 500;
  47424. t['quoteleft'] = 333;
  47425. t['a'] = 500;
  47426. t['b'] = 556;
  47427. t['c'] = 444;
  47428. t['d'] = 556;
  47429. t['e'] = 444;
  47430. t['f'] = 333;
  47431. t['g'] = 500;
  47432. t['h'] = 556;
  47433. t['i'] = 278;
  47434. t['j'] = 333;
  47435. t['k'] = 556;
  47436. t['l'] = 278;
  47437. t['m'] = 833;
  47438. t['n'] = 556;
  47439. t['o'] = 500;
  47440. t['p'] = 556;
  47441. t['q'] = 556;
  47442. t['r'] = 444;
  47443. t['s'] = 389;
  47444. t['t'] = 333;
  47445. t['u'] = 556;
  47446. t['v'] = 500;
  47447. t['w'] = 722;
  47448. t['x'] = 500;
  47449. t['y'] = 500;
  47450. t['z'] = 444;
  47451. t['braceleft'] = 394;
  47452. t['bar'] = 220;
  47453. t['braceright'] = 394;
  47454. t['asciitilde'] = 520;
  47455. t['exclamdown'] = 333;
  47456. t['cent'] = 500;
  47457. t['sterling'] = 500;
  47458. t['fraction'] = 167;
  47459. t['yen'] = 500;
  47460. t['florin'] = 500;
  47461. t['section'] = 500;
  47462. t['currency'] = 500;
  47463. t['quotesingle'] = 278;
  47464. t['quotedblleft'] = 500;
  47465. t['guillemotleft'] = 500;
  47466. t['guilsinglleft'] = 333;
  47467. t['guilsinglright'] = 333;
  47468. t['fi'] = 556;
  47469. t['fl'] = 556;
  47470. t['endash'] = 500;
  47471. t['dagger'] = 500;
  47472. t['daggerdbl'] = 500;
  47473. t['periodcentered'] = 250;
  47474. t['paragraph'] = 540;
  47475. t['bullet'] = 350;
  47476. t['quotesinglbase'] = 333;
  47477. t['quotedblbase'] = 500;
  47478. t['quotedblright'] = 500;
  47479. t['guillemotright'] = 500;
  47480. t['ellipsis'] = 1000;
  47481. t['perthousand'] = 1000;
  47482. t['questiondown'] = 500;
  47483. t['grave'] = 333;
  47484. t['acute'] = 333;
  47485. t['circumflex'] = 333;
  47486. t['tilde'] = 333;
  47487. t['macron'] = 333;
  47488. t['breve'] = 333;
  47489. t['dotaccent'] = 333;
  47490. t['dieresis'] = 333;
  47491. t['ring'] = 333;
  47492. t['cedilla'] = 333;
  47493. t['hungarumlaut'] = 333;
  47494. t['ogonek'] = 333;
  47495. t['caron'] = 333;
  47496. t['emdash'] = 1000;
  47497. t['AE'] = 1000;
  47498. t['ordfeminine'] = 300;
  47499. t['Lslash'] = 667;
  47500. t['Oslash'] = 778;
  47501. t['OE'] = 1000;
  47502. t['ordmasculine'] = 330;
  47503. t['ae'] = 722;
  47504. t['dotlessi'] = 278;
  47505. t['lslash'] = 278;
  47506. t['oslash'] = 500;
  47507. t['oe'] = 722;
  47508. t['germandbls'] = 556;
  47509. t['Idieresis'] = 389;
  47510. t['eacute'] = 444;
  47511. t['abreve'] = 500;
  47512. t['uhungarumlaut'] = 556;
  47513. t['ecaron'] = 444;
  47514. t['Ydieresis'] = 722;
  47515. t['divide'] = 570;
  47516. t['Yacute'] = 722;
  47517. t['Acircumflex'] = 722;
  47518. t['aacute'] = 500;
  47519. t['Ucircumflex'] = 722;
  47520. t['yacute'] = 500;
  47521. t['scommaaccent'] = 389;
  47522. t['ecircumflex'] = 444;
  47523. t['Uring'] = 722;
  47524. t['Udieresis'] = 722;
  47525. t['aogonek'] = 500;
  47526. t['Uacute'] = 722;
  47527. t['uogonek'] = 556;
  47528. t['Edieresis'] = 667;
  47529. t['Dcroat'] = 722;
  47530. t['commaaccent'] = 250;
  47531. t['copyright'] = 747;
  47532. t['Emacron'] = 667;
  47533. t['ccaron'] = 444;
  47534. t['aring'] = 500;
  47535. t['Ncommaaccent'] = 722;
  47536. t['lacute'] = 278;
  47537. t['agrave'] = 500;
  47538. t['Tcommaaccent'] = 667;
  47539. t['Cacute'] = 722;
  47540. t['atilde'] = 500;
  47541. t['Edotaccent'] = 667;
  47542. t['scaron'] = 389;
  47543. t['scedilla'] = 389;
  47544. t['iacute'] = 278;
  47545. t['lozenge'] = 494;
  47546. t['Rcaron'] = 722;
  47547. t['Gcommaaccent'] = 778;
  47548. t['ucircumflex'] = 556;
  47549. t['acircumflex'] = 500;
  47550. t['Amacron'] = 722;
  47551. t['rcaron'] = 444;
  47552. t['ccedilla'] = 444;
  47553. t['Zdotaccent'] = 667;
  47554. t['Thorn'] = 611;
  47555. t['Omacron'] = 778;
  47556. t['Racute'] = 722;
  47557. t['Sacute'] = 556;
  47558. t['dcaron'] = 672;
  47559. t['Umacron'] = 722;
  47560. t['uring'] = 556;
  47561. t['threesuperior'] = 300;
  47562. t['Ograve'] = 778;
  47563. t['Agrave'] = 722;
  47564. t['Abreve'] = 722;
  47565. t['multiply'] = 570;
  47566. t['uacute'] = 556;
  47567. t['Tcaron'] = 667;
  47568. t['partialdiff'] = 494;
  47569. t['ydieresis'] = 500;
  47570. t['Nacute'] = 722;
  47571. t['icircumflex'] = 278;
  47572. t['Ecircumflex'] = 667;
  47573. t['adieresis'] = 500;
  47574. t['edieresis'] = 444;
  47575. t['cacute'] = 444;
  47576. t['nacute'] = 556;
  47577. t['umacron'] = 556;
  47578. t['Ncaron'] = 722;
  47579. t['Iacute'] = 389;
  47580. t['plusminus'] = 570;
  47581. t['brokenbar'] = 220;
  47582. t['registered'] = 747;
  47583. t['Gbreve'] = 778;
  47584. t['Idotaccent'] = 389;
  47585. t['summation'] = 600;
  47586. t['Egrave'] = 667;
  47587. t['racute'] = 444;
  47588. t['omacron'] = 500;
  47589. t['Zacute'] = 667;
  47590. t['Zcaron'] = 667;
  47591. t['greaterequal'] = 549;
  47592. t['Eth'] = 722;
  47593. t['Ccedilla'] = 722;
  47594. t['lcommaaccent'] = 278;
  47595. t['tcaron'] = 416;
  47596. t['eogonek'] = 444;
  47597. t['Uogonek'] = 722;
  47598. t['Aacute'] = 722;
  47599. t['Adieresis'] = 722;
  47600. t['egrave'] = 444;
  47601. t['zacute'] = 444;
  47602. t['iogonek'] = 278;
  47603. t['Oacute'] = 778;
  47604. t['oacute'] = 500;
  47605. t['amacron'] = 500;
  47606. t['sacute'] = 389;
  47607. t['idieresis'] = 278;
  47608. t['Ocircumflex'] = 778;
  47609. t['Ugrave'] = 722;
  47610. t['Delta'] = 612;
  47611. t['thorn'] = 556;
  47612. t['twosuperior'] = 300;
  47613. t['Odieresis'] = 778;
  47614. t['mu'] = 556;
  47615. t['igrave'] = 278;
  47616. t['ohungarumlaut'] = 500;
  47617. t['Eogonek'] = 667;
  47618. t['dcroat'] = 556;
  47619. t['threequarters'] = 750;
  47620. t['Scedilla'] = 556;
  47621. t['lcaron'] = 394;
  47622. t['Kcommaaccent'] = 778;
  47623. t['Lacute'] = 667;
  47624. t['trademark'] = 1000;
  47625. t['edotaccent'] = 444;
  47626. t['Igrave'] = 389;
  47627. t['Imacron'] = 389;
  47628. t['Lcaron'] = 667;
  47629. t['onehalf'] = 750;
  47630. t['lessequal'] = 549;
  47631. t['ocircumflex'] = 500;
  47632. t['ntilde'] = 556;
  47633. t['Uhungarumlaut'] = 722;
  47634. t['Eacute'] = 667;
  47635. t['emacron'] = 444;
  47636. t['gbreve'] = 500;
  47637. t['onequarter'] = 750;
  47638. t['Scaron'] = 556;
  47639. t['Scommaaccent'] = 556;
  47640. t['Ohungarumlaut'] = 778;
  47641. t['degree'] = 400;
  47642. t['ograve'] = 500;
  47643. t['Ccaron'] = 722;
  47644. t['ugrave'] = 556;
  47645. t['radical'] = 549;
  47646. t['Dcaron'] = 722;
  47647. t['rcommaaccent'] = 444;
  47648. t['Ntilde'] = 722;
  47649. t['otilde'] = 500;
  47650. t['Rcommaaccent'] = 722;
  47651. t['Lcommaaccent'] = 667;
  47652. t['Atilde'] = 722;
  47653. t['Aogonek'] = 722;
  47654. t['Aring'] = 722;
  47655. t['Otilde'] = 778;
  47656. t['zdotaccent'] = 444;
  47657. t['Ecaron'] = 667;
  47658. t['Iogonek'] = 389;
  47659. t['kcommaaccent'] = 556;
  47660. t['minus'] = 570;
  47661. t['Icircumflex'] = 389;
  47662. t['ncaron'] = 556;
  47663. t['tcommaaccent'] = 333;
  47664. t['logicalnot'] = 570;
  47665. t['odieresis'] = 500;
  47666. t['udieresis'] = 556;
  47667. t['notequal'] = 549;
  47668. t['gcommaaccent'] = 500;
  47669. t['eth'] = 500;
  47670. t['zcaron'] = 444;
  47671. t['ncommaaccent'] = 556;
  47672. t['onesuperior'] = 300;
  47673. t['imacron'] = 278;
  47674. t['Euro'] = 500;
  47675. });
  47676. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  47677. t['space'] = 250;
  47678. t['exclam'] = 389;
  47679. t['quotedbl'] = 555;
  47680. t['numbersign'] = 500;
  47681. t['dollar'] = 500;
  47682. t['percent'] = 833;
  47683. t['ampersand'] = 778;
  47684. t['quoteright'] = 333;
  47685. t['parenleft'] = 333;
  47686. t['parenright'] = 333;
  47687. t['asterisk'] = 500;
  47688. t['plus'] = 570;
  47689. t['comma'] = 250;
  47690. t['hyphen'] = 333;
  47691. t['period'] = 250;
  47692. t['slash'] = 278;
  47693. t['zero'] = 500;
  47694. t['one'] = 500;
  47695. t['two'] = 500;
  47696. t['three'] = 500;
  47697. t['four'] = 500;
  47698. t['five'] = 500;
  47699. t['six'] = 500;
  47700. t['seven'] = 500;
  47701. t['eight'] = 500;
  47702. t['nine'] = 500;
  47703. t['colon'] = 333;
  47704. t['semicolon'] = 333;
  47705. t['less'] = 570;
  47706. t['equal'] = 570;
  47707. t['greater'] = 570;
  47708. t['question'] = 500;
  47709. t['at'] = 832;
  47710. t['A'] = 667;
  47711. t['B'] = 667;
  47712. t['C'] = 667;
  47713. t['D'] = 722;
  47714. t['E'] = 667;
  47715. t['F'] = 667;
  47716. t['G'] = 722;
  47717. t['H'] = 778;
  47718. t['I'] = 389;
  47719. t['J'] = 500;
  47720. t['K'] = 667;
  47721. t['L'] = 611;
  47722. t['M'] = 889;
  47723. t['N'] = 722;
  47724. t['O'] = 722;
  47725. t['P'] = 611;
  47726. t['Q'] = 722;
  47727. t['R'] = 667;
  47728. t['S'] = 556;
  47729. t['T'] = 611;
  47730. t['U'] = 722;
  47731. t['V'] = 667;
  47732. t['W'] = 889;
  47733. t['X'] = 667;
  47734. t['Y'] = 611;
  47735. t['Z'] = 611;
  47736. t['bracketleft'] = 333;
  47737. t['backslash'] = 278;
  47738. t['bracketright'] = 333;
  47739. t['asciicircum'] = 570;
  47740. t['underscore'] = 500;
  47741. t['quoteleft'] = 333;
  47742. t['a'] = 500;
  47743. t['b'] = 500;
  47744. t['c'] = 444;
  47745. t['d'] = 500;
  47746. t['e'] = 444;
  47747. t['f'] = 333;
  47748. t['g'] = 500;
  47749. t['h'] = 556;
  47750. t['i'] = 278;
  47751. t['j'] = 278;
  47752. t['k'] = 500;
  47753. t['l'] = 278;
  47754. t['m'] = 778;
  47755. t['n'] = 556;
  47756. t['o'] = 500;
  47757. t['p'] = 500;
  47758. t['q'] = 500;
  47759. t['r'] = 389;
  47760. t['s'] = 389;
  47761. t['t'] = 278;
  47762. t['u'] = 556;
  47763. t['v'] = 444;
  47764. t['w'] = 667;
  47765. t['x'] = 500;
  47766. t['y'] = 444;
  47767. t['z'] = 389;
  47768. t['braceleft'] = 348;
  47769. t['bar'] = 220;
  47770. t['braceright'] = 348;
  47771. t['asciitilde'] = 570;
  47772. t['exclamdown'] = 389;
  47773. t['cent'] = 500;
  47774. t['sterling'] = 500;
  47775. t['fraction'] = 167;
  47776. t['yen'] = 500;
  47777. t['florin'] = 500;
  47778. t['section'] = 500;
  47779. t['currency'] = 500;
  47780. t['quotesingle'] = 278;
  47781. t['quotedblleft'] = 500;
  47782. t['guillemotleft'] = 500;
  47783. t['guilsinglleft'] = 333;
  47784. t['guilsinglright'] = 333;
  47785. t['fi'] = 556;
  47786. t['fl'] = 556;
  47787. t['endash'] = 500;
  47788. t['dagger'] = 500;
  47789. t['daggerdbl'] = 500;
  47790. t['periodcentered'] = 250;
  47791. t['paragraph'] = 500;
  47792. t['bullet'] = 350;
  47793. t['quotesinglbase'] = 333;
  47794. t['quotedblbase'] = 500;
  47795. t['quotedblright'] = 500;
  47796. t['guillemotright'] = 500;
  47797. t['ellipsis'] = 1000;
  47798. t['perthousand'] = 1000;
  47799. t['questiondown'] = 500;
  47800. t['grave'] = 333;
  47801. t['acute'] = 333;
  47802. t['circumflex'] = 333;
  47803. t['tilde'] = 333;
  47804. t['macron'] = 333;
  47805. t['breve'] = 333;
  47806. t['dotaccent'] = 333;
  47807. t['dieresis'] = 333;
  47808. t['ring'] = 333;
  47809. t['cedilla'] = 333;
  47810. t['hungarumlaut'] = 333;
  47811. t['ogonek'] = 333;
  47812. t['caron'] = 333;
  47813. t['emdash'] = 1000;
  47814. t['AE'] = 944;
  47815. t['ordfeminine'] = 266;
  47816. t['Lslash'] = 611;
  47817. t['Oslash'] = 722;
  47818. t['OE'] = 944;
  47819. t['ordmasculine'] = 300;
  47820. t['ae'] = 722;
  47821. t['dotlessi'] = 278;
  47822. t['lslash'] = 278;
  47823. t['oslash'] = 500;
  47824. t['oe'] = 722;
  47825. t['germandbls'] = 500;
  47826. t['Idieresis'] = 389;
  47827. t['eacute'] = 444;
  47828. t['abreve'] = 500;
  47829. t['uhungarumlaut'] = 556;
  47830. t['ecaron'] = 444;
  47831. t['Ydieresis'] = 611;
  47832. t['divide'] = 570;
  47833. t['Yacute'] = 611;
  47834. t['Acircumflex'] = 667;
  47835. t['aacute'] = 500;
  47836. t['Ucircumflex'] = 722;
  47837. t['yacute'] = 444;
  47838. t['scommaaccent'] = 389;
  47839. t['ecircumflex'] = 444;
  47840. t['Uring'] = 722;
  47841. t['Udieresis'] = 722;
  47842. t['aogonek'] = 500;
  47843. t['Uacute'] = 722;
  47844. t['uogonek'] = 556;
  47845. t['Edieresis'] = 667;
  47846. t['Dcroat'] = 722;
  47847. t['commaaccent'] = 250;
  47848. t['copyright'] = 747;
  47849. t['Emacron'] = 667;
  47850. t['ccaron'] = 444;
  47851. t['aring'] = 500;
  47852. t['Ncommaaccent'] = 722;
  47853. t['lacute'] = 278;
  47854. t['agrave'] = 500;
  47855. t['Tcommaaccent'] = 611;
  47856. t['Cacute'] = 667;
  47857. t['atilde'] = 500;
  47858. t['Edotaccent'] = 667;
  47859. t['scaron'] = 389;
  47860. t['scedilla'] = 389;
  47861. t['iacute'] = 278;
  47862. t['lozenge'] = 494;
  47863. t['Rcaron'] = 667;
  47864. t['Gcommaaccent'] = 722;
  47865. t['ucircumflex'] = 556;
  47866. t['acircumflex'] = 500;
  47867. t['Amacron'] = 667;
  47868. t['rcaron'] = 389;
  47869. t['ccedilla'] = 444;
  47870. t['Zdotaccent'] = 611;
  47871. t['Thorn'] = 611;
  47872. t['Omacron'] = 722;
  47873. t['Racute'] = 667;
  47874. t['Sacute'] = 556;
  47875. t['dcaron'] = 608;
  47876. t['Umacron'] = 722;
  47877. t['uring'] = 556;
  47878. t['threesuperior'] = 300;
  47879. t['Ograve'] = 722;
  47880. t['Agrave'] = 667;
  47881. t['Abreve'] = 667;
  47882. t['multiply'] = 570;
  47883. t['uacute'] = 556;
  47884. t['Tcaron'] = 611;
  47885. t['partialdiff'] = 494;
  47886. t['ydieresis'] = 444;
  47887. t['Nacute'] = 722;
  47888. t['icircumflex'] = 278;
  47889. t['Ecircumflex'] = 667;
  47890. t['adieresis'] = 500;
  47891. t['edieresis'] = 444;
  47892. t['cacute'] = 444;
  47893. t['nacute'] = 556;
  47894. t['umacron'] = 556;
  47895. t['Ncaron'] = 722;
  47896. t['Iacute'] = 389;
  47897. t['plusminus'] = 570;
  47898. t['brokenbar'] = 220;
  47899. t['registered'] = 747;
  47900. t['Gbreve'] = 722;
  47901. t['Idotaccent'] = 389;
  47902. t['summation'] = 600;
  47903. t['Egrave'] = 667;
  47904. t['racute'] = 389;
  47905. t['omacron'] = 500;
  47906. t['Zacute'] = 611;
  47907. t['Zcaron'] = 611;
  47908. t['greaterequal'] = 549;
  47909. t['Eth'] = 722;
  47910. t['Ccedilla'] = 667;
  47911. t['lcommaaccent'] = 278;
  47912. t['tcaron'] = 366;
  47913. t['eogonek'] = 444;
  47914. t['Uogonek'] = 722;
  47915. t['Aacute'] = 667;
  47916. t['Adieresis'] = 667;
  47917. t['egrave'] = 444;
  47918. t['zacute'] = 389;
  47919. t['iogonek'] = 278;
  47920. t['Oacute'] = 722;
  47921. t['oacute'] = 500;
  47922. t['amacron'] = 500;
  47923. t['sacute'] = 389;
  47924. t['idieresis'] = 278;
  47925. t['Ocircumflex'] = 722;
  47926. t['Ugrave'] = 722;
  47927. t['Delta'] = 612;
  47928. t['thorn'] = 500;
  47929. t['twosuperior'] = 300;
  47930. t['Odieresis'] = 722;
  47931. t['mu'] = 576;
  47932. t['igrave'] = 278;
  47933. t['ohungarumlaut'] = 500;
  47934. t['Eogonek'] = 667;
  47935. t['dcroat'] = 500;
  47936. t['threequarters'] = 750;
  47937. t['Scedilla'] = 556;
  47938. t['lcaron'] = 382;
  47939. t['Kcommaaccent'] = 667;
  47940. t['Lacute'] = 611;
  47941. t['trademark'] = 1000;
  47942. t['edotaccent'] = 444;
  47943. t['Igrave'] = 389;
  47944. t['Imacron'] = 389;
  47945. t['Lcaron'] = 611;
  47946. t['onehalf'] = 750;
  47947. t['lessequal'] = 549;
  47948. t['ocircumflex'] = 500;
  47949. t['ntilde'] = 556;
  47950. t['Uhungarumlaut'] = 722;
  47951. t['Eacute'] = 667;
  47952. t['emacron'] = 444;
  47953. t['gbreve'] = 500;
  47954. t['onequarter'] = 750;
  47955. t['Scaron'] = 556;
  47956. t['Scommaaccent'] = 556;
  47957. t['Ohungarumlaut'] = 722;
  47958. t['degree'] = 400;
  47959. t['ograve'] = 500;
  47960. t['Ccaron'] = 667;
  47961. t['ugrave'] = 556;
  47962. t['radical'] = 549;
  47963. t['Dcaron'] = 722;
  47964. t['rcommaaccent'] = 389;
  47965. t['Ntilde'] = 722;
  47966. t['otilde'] = 500;
  47967. t['Rcommaaccent'] = 667;
  47968. t['Lcommaaccent'] = 611;
  47969. t['Atilde'] = 667;
  47970. t['Aogonek'] = 667;
  47971. t['Aring'] = 667;
  47972. t['Otilde'] = 722;
  47973. t['zdotaccent'] = 389;
  47974. t['Ecaron'] = 667;
  47975. t['Iogonek'] = 389;
  47976. t['kcommaaccent'] = 500;
  47977. t['minus'] = 606;
  47978. t['Icircumflex'] = 389;
  47979. t['ncaron'] = 556;
  47980. t['tcommaaccent'] = 278;
  47981. t['logicalnot'] = 606;
  47982. t['odieresis'] = 500;
  47983. t['udieresis'] = 556;
  47984. t['notequal'] = 549;
  47985. t['gcommaaccent'] = 500;
  47986. t['eth'] = 500;
  47987. t['zcaron'] = 389;
  47988. t['ncommaaccent'] = 556;
  47989. t['onesuperior'] = 300;
  47990. t['imacron'] = 278;
  47991. t['Euro'] = 500;
  47992. });
  47993. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47994. t['space'] = 250;
  47995. t['exclam'] = 333;
  47996. t['quotedbl'] = 420;
  47997. t['numbersign'] = 500;
  47998. t['dollar'] = 500;
  47999. t['percent'] = 833;
  48000. t['ampersand'] = 778;
  48001. t['quoteright'] = 333;
  48002. t['parenleft'] = 333;
  48003. t['parenright'] = 333;
  48004. t['asterisk'] = 500;
  48005. t['plus'] = 675;
  48006. t['comma'] = 250;
  48007. t['hyphen'] = 333;
  48008. t['period'] = 250;
  48009. t['slash'] = 278;
  48010. t['zero'] = 500;
  48011. t['one'] = 500;
  48012. t['two'] = 500;
  48013. t['three'] = 500;
  48014. t['four'] = 500;
  48015. t['five'] = 500;
  48016. t['six'] = 500;
  48017. t['seven'] = 500;
  48018. t['eight'] = 500;
  48019. t['nine'] = 500;
  48020. t['colon'] = 333;
  48021. t['semicolon'] = 333;
  48022. t['less'] = 675;
  48023. t['equal'] = 675;
  48024. t['greater'] = 675;
  48025. t['question'] = 500;
  48026. t['at'] = 920;
  48027. t['A'] = 611;
  48028. t['B'] = 611;
  48029. t['C'] = 667;
  48030. t['D'] = 722;
  48031. t['E'] = 611;
  48032. t['F'] = 611;
  48033. t['G'] = 722;
  48034. t['H'] = 722;
  48035. t['I'] = 333;
  48036. t['J'] = 444;
  48037. t['K'] = 667;
  48038. t['L'] = 556;
  48039. t['M'] = 833;
  48040. t['N'] = 667;
  48041. t['O'] = 722;
  48042. t['P'] = 611;
  48043. t['Q'] = 722;
  48044. t['R'] = 611;
  48045. t['S'] = 500;
  48046. t['T'] = 556;
  48047. t['U'] = 722;
  48048. t['V'] = 611;
  48049. t['W'] = 833;
  48050. t['X'] = 611;
  48051. t['Y'] = 556;
  48052. t['Z'] = 556;
  48053. t['bracketleft'] = 389;
  48054. t['backslash'] = 278;
  48055. t['bracketright'] = 389;
  48056. t['asciicircum'] = 422;
  48057. t['underscore'] = 500;
  48058. t['quoteleft'] = 333;
  48059. t['a'] = 500;
  48060. t['b'] = 500;
  48061. t['c'] = 444;
  48062. t['d'] = 500;
  48063. t['e'] = 444;
  48064. t['f'] = 278;
  48065. t['g'] = 500;
  48066. t['h'] = 500;
  48067. t['i'] = 278;
  48068. t['j'] = 278;
  48069. t['k'] = 444;
  48070. t['l'] = 278;
  48071. t['m'] = 722;
  48072. t['n'] = 500;
  48073. t['o'] = 500;
  48074. t['p'] = 500;
  48075. t['q'] = 500;
  48076. t['r'] = 389;
  48077. t['s'] = 389;
  48078. t['t'] = 278;
  48079. t['u'] = 500;
  48080. t['v'] = 444;
  48081. t['w'] = 667;
  48082. t['x'] = 444;
  48083. t['y'] = 444;
  48084. t['z'] = 389;
  48085. t['braceleft'] = 400;
  48086. t['bar'] = 275;
  48087. t['braceright'] = 400;
  48088. t['asciitilde'] = 541;
  48089. t['exclamdown'] = 389;
  48090. t['cent'] = 500;
  48091. t['sterling'] = 500;
  48092. t['fraction'] = 167;
  48093. t['yen'] = 500;
  48094. t['florin'] = 500;
  48095. t['section'] = 500;
  48096. t['currency'] = 500;
  48097. t['quotesingle'] = 214;
  48098. t['quotedblleft'] = 556;
  48099. t['guillemotleft'] = 500;
  48100. t['guilsinglleft'] = 333;
  48101. t['guilsinglright'] = 333;
  48102. t['fi'] = 500;
  48103. t['fl'] = 500;
  48104. t['endash'] = 500;
  48105. t['dagger'] = 500;
  48106. t['daggerdbl'] = 500;
  48107. t['periodcentered'] = 250;
  48108. t['paragraph'] = 523;
  48109. t['bullet'] = 350;
  48110. t['quotesinglbase'] = 333;
  48111. t['quotedblbase'] = 556;
  48112. t['quotedblright'] = 556;
  48113. t['guillemotright'] = 500;
  48114. t['ellipsis'] = 889;
  48115. t['perthousand'] = 1000;
  48116. t['questiondown'] = 500;
  48117. t['grave'] = 333;
  48118. t['acute'] = 333;
  48119. t['circumflex'] = 333;
  48120. t['tilde'] = 333;
  48121. t['macron'] = 333;
  48122. t['breve'] = 333;
  48123. t['dotaccent'] = 333;
  48124. t['dieresis'] = 333;
  48125. t['ring'] = 333;
  48126. t['cedilla'] = 333;
  48127. t['hungarumlaut'] = 333;
  48128. t['ogonek'] = 333;
  48129. t['caron'] = 333;
  48130. t['emdash'] = 889;
  48131. t['AE'] = 889;
  48132. t['ordfeminine'] = 276;
  48133. t['Lslash'] = 556;
  48134. t['Oslash'] = 722;
  48135. t['OE'] = 944;
  48136. t['ordmasculine'] = 310;
  48137. t['ae'] = 667;
  48138. t['dotlessi'] = 278;
  48139. t['lslash'] = 278;
  48140. t['oslash'] = 500;
  48141. t['oe'] = 667;
  48142. t['germandbls'] = 500;
  48143. t['Idieresis'] = 333;
  48144. t['eacute'] = 444;
  48145. t['abreve'] = 500;
  48146. t['uhungarumlaut'] = 500;
  48147. t['ecaron'] = 444;
  48148. t['Ydieresis'] = 556;
  48149. t['divide'] = 675;
  48150. t['Yacute'] = 556;
  48151. t['Acircumflex'] = 611;
  48152. t['aacute'] = 500;
  48153. t['Ucircumflex'] = 722;
  48154. t['yacute'] = 444;
  48155. t['scommaaccent'] = 389;
  48156. t['ecircumflex'] = 444;
  48157. t['Uring'] = 722;
  48158. t['Udieresis'] = 722;
  48159. t['aogonek'] = 500;
  48160. t['Uacute'] = 722;
  48161. t['uogonek'] = 500;
  48162. t['Edieresis'] = 611;
  48163. t['Dcroat'] = 722;
  48164. t['commaaccent'] = 250;
  48165. t['copyright'] = 760;
  48166. t['Emacron'] = 611;
  48167. t['ccaron'] = 444;
  48168. t['aring'] = 500;
  48169. t['Ncommaaccent'] = 667;
  48170. t['lacute'] = 278;
  48171. t['agrave'] = 500;
  48172. t['Tcommaaccent'] = 556;
  48173. t['Cacute'] = 667;
  48174. t['atilde'] = 500;
  48175. t['Edotaccent'] = 611;
  48176. t['scaron'] = 389;
  48177. t['scedilla'] = 389;
  48178. t['iacute'] = 278;
  48179. t['lozenge'] = 471;
  48180. t['Rcaron'] = 611;
  48181. t['Gcommaaccent'] = 722;
  48182. t['ucircumflex'] = 500;
  48183. t['acircumflex'] = 500;
  48184. t['Amacron'] = 611;
  48185. t['rcaron'] = 389;
  48186. t['ccedilla'] = 444;
  48187. t['Zdotaccent'] = 556;
  48188. t['Thorn'] = 611;
  48189. t['Omacron'] = 722;
  48190. t['Racute'] = 611;
  48191. t['Sacute'] = 500;
  48192. t['dcaron'] = 544;
  48193. t['Umacron'] = 722;
  48194. t['uring'] = 500;
  48195. t['threesuperior'] = 300;
  48196. t['Ograve'] = 722;
  48197. t['Agrave'] = 611;
  48198. t['Abreve'] = 611;
  48199. t['multiply'] = 675;
  48200. t['uacute'] = 500;
  48201. t['Tcaron'] = 556;
  48202. t['partialdiff'] = 476;
  48203. t['ydieresis'] = 444;
  48204. t['Nacute'] = 667;
  48205. t['icircumflex'] = 278;
  48206. t['Ecircumflex'] = 611;
  48207. t['adieresis'] = 500;
  48208. t['edieresis'] = 444;
  48209. t['cacute'] = 444;
  48210. t['nacute'] = 500;
  48211. t['umacron'] = 500;
  48212. t['Ncaron'] = 667;
  48213. t['Iacute'] = 333;
  48214. t['plusminus'] = 675;
  48215. t['brokenbar'] = 275;
  48216. t['registered'] = 760;
  48217. t['Gbreve'] = 722;
  48218. t['Idotaccent'] = 333;
  48219. t['summation'] = 600;
  48220. t['Egrave'] = 611;
  48221. t['racute'] = 389;
  48222. t['omacron'] = 500;
  48223. t['Zacute'] = 556;
  48224. t['Zcaron'] = 556;
  48225. t['greaterequal'] = 549;
  48226. t['Eth'] = 722;
  48227. t['Ccedilla'] = 667;
  48228. t['lcommaaccent'] = 278;
  48229. t['tcaron'] = 300;
  48230. t['eogonek'] = 444;
  48231. t['Uogonek'] = 722;
  48232. t['Aacute'] = 611;
  48233. t['Adieresis'] = 611;
  48234. t['egrave'] = 444;
  48235. t['zacute'] = 389;
  48236. t['iogonek'] = 278;
  48237. t['Oacute'] = 722;
  48238. t['oacute'] = 500;
  48239. t['amacron'] = 500;
  48240. t['sacute'] = 389;
  48241. t['idieresis'] = 278;
  48242. t['Ocircumflex'] = 722;
  48243. t['Ugrave'] = 722;
  48244. t['Delta'] = 612;
  48245. t['thorn'] = 500;
  48246. t['twosuperior'] = 300;
  48247. t['Odieresis'] = 722;
  48248. t['mu'] = 500;
  48249. t['igrave'] = 278;
  48250. t['ohungarumlaut'] = 500;
  48251. t['Eogonek'] = 611;
  48252. t['dcroat'] = 500;
  48253. t['threequarters'] = 750;
  48254. t['Scedilla'] = 500;
  48255. t['lcaron'] = 300;
  48256. t['Kcommaaccent'] = 667;
  48257. t['Lacute'] = 556;
  48258. t['trademark'] = 980;
  48259. t['edotaccent'] = 444;
  48260. t['Igrave'] = 333;
  48261. t['Imacron'] = 333;
  48262. t['Lcaron'] = 611;
  48263. t['onehalf'] = 750;
  48264. t['lessequal'] = 549;
  48265. t['ocircumflex'] = 500;
  48266. t['ntilde'] = 500;
  48267. t['Uhungarumlaut'] = 722;
  48268. t['Eacute'] = 611;
  48269. t['emacron'] = 444;
  48270. t['gbreve'] = 500;
  48271. t['onequarter'] = 750;
  48272. t['Scaron'] = 500;
  48273. t['Scommaaccent'] = 500;
  48274. t['Ohungarumlaut'] = 722;
  48275. t['degree'] = 400;
  48276. t['ograve'] = 500;
  48277. t['Ccaron'] = 667;
  48278. t['ugrave'] = 500;
  48279. t['radical'] = 453;
  48280. t['Dcaron'] = 722;
  48281. t['rcommaaccent'] = 389;
  48282. t['Ntilde'] = 667;
  48283. t['otilde'] = 500;
  48284. t['Rcommaaccent'] = 611;
  48285. t['Lcommaaccent'] = 556;
  48286. t['Atilde'] = 611;
  48287. t['Aogonek'] = 611;
  48288. t['Aring'] = 611;
  48289. t['Otilde'] = 722;
  48290. t['zdotaccent'] = 389;
  48291. t['Ecaron'] = 611;
  48292. t['Iogonek'] = 333;
  48293. t['kcommaaccent'] = 444;
  48294. t['minus'] = 675;
  48295. t['Icircumflex'] = 333;
  48296. t['ncaron'] = 500;
  48297. t['tcommaaccent'] = 278;
  48298. t['logicalnot'] = 675;
  48299. t['odieresis'] = 500;
  48300. t['udieresis'] = 500;
  48301. t['notequal'] = 549;
  48302. t['gcommaaccent'] = 500;
  48303. t['eth'] = 500;
  48304. t['zcaron'] = 389;
  48305. t['ncommaaccent'] = 500;
  48306. t['onesuperior'] = 300;
  48307. t['imacron'] = 278;
  48308. t['Euro'] = 500;
  48309. });
  48310. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  48311. t['space'] = 278;
  48312. t['a1'] = 974;
  48313. t['a2'] = 961;
  48314. t['a202'] = 974;
  48315. t['a3'] = 980;
  48316. t['a4'] = 719;
  48317. t['a5'] = 789;
  48318. t['a119'] = 790;
  48319. t['a118'] = 791;
  48320. t['a117'] = 690;
  48321. t['a11'] = 960;
  48322. t['a12'] = 939;
  48323. t['a13'] = 549;
  48324. t['a14'] = 855;
  48325. t['a15'] = 911;
  48326. t['a16'] = 933;
  48327. t['a105'] = 911;
  48328. t['a17'] = 945;
  48329. t['a18'] = 974;
  48330. t['a19'] = 755;
  48331. t['a20'] = 846;
  48332. t['a21'] = 762;
  48333. t['a22'] = 761;
  48334. t['a23'] = 571;
  48335. t['a24'] = 677;
  48336. t['a25'] = 763;
  48337. t['a26'] = 760;
  48338. t['a27'] = 759;
  48339. t['a28'] = 754;
  48340. t['a6'] = 494;
  48341. t['a7'] = 552;
  48342. t['a8'] = 537;
  48343. t['a9'] = 577;
  48344. t['a10'] = 692;
  48345. t['a29'] = 786;
  48346. t['a30'] = 788;
  48347. t['a31'] = 788;
  48348. t['a32'] = 790;
  48349. t['a33'] = 793;
  48350. t['a34'] = 794;
  48351. t['a35'] = 816;
  48352. t['a36'] = 823;
  48353. t['a37'] = 789;
  48354. t['a38'] = 841;
  48355. t['a39'] = 823;
  48356. t['a40'] = 833;
  48357. t['a41'] = 816;
  48358. t['a42'] = 831;
  48359. t['a43'] = 923;
  48360. t['a44'] = 744;
  48361. t['a45'] = 723;
  48362. t['a46'] = 749;
  48363. t['a47'] = 790;
  48364. t['a48'] = 792;
  48365. t['a49'] = 695;
  48366. t['a50'] = 776;
  48367. t['a51'] = 768;
  48368. t['a52'] = 792;
  48369. t['a53'] = 759;
  48370. t['a54'] = 707;
  48371. t['a55'] = 708;
  48372. t['a56'] = 682;
  48373. t['a57'] = 701;
  48374. t['a58'] = 826;
  48375. t['a59'] = 815;
  48376. t['a60'] = 789;
  48377. t['a61'] = 789;
  48378. t['a62'] = 707;
  48379. t['a63'] = 687;
  48380. t['a64'] = 696;
  48381. t['a65'] = 689;
  48382. t['a66'] = 786;
  48383. t['a67'] = 787;
  48384. t['a68'] = 713;
  48385. t['a69'] = 791;
  48386. t['a70'] = 785;
  48387. t['a71'] = 791;
  48388. t['a72'] = 873;
  48389. t['a73'] = 761;
  48390. t['a74'] = 762;
  48391. t['a203'] = 762;
  48392. t['a75'] = 759;
  48393. t['a204'] = 759;
  48394. t['a76'] = 892;
  48395. t['a77'] = 892;
  48396. t['a78'] = 788;
  48397. t['a79'] = 784;
  48398. t['a81'] = 438;
  48399. t['a82'] = 138;
  48400. t['a83'] = 277;
  48401. t['a84'] = 415;
  48402. t['a97'] = 392;
  48403. t['a98'] = 392;
  48404. t['a99'] = 668;
  48405. t['a100'] = 668;
  48406. t['a89'] = 390;
  48407. t['a90'] = 390;
  48408. t['a93'] = 317;
  48409. t['a94'] = 317;
  48410. t['a91'] = 276;
  48411. t['a92'] = 276;
  48412. t['a205'] = 509;
  48413. t['a85'] = 509;
  48414. t['a206'] = 410;
  48415. t['a86'] = 410;
  48416. t['a87'] = 234;
  48417. t['a88'] = 234;
  48418. t['a95'] = 334;
  48419. t['a96'] = 334;
  48420. t['a101'] = 732;
  48421. t['a102'] = 544;
  48422. t['a103'] = 544;
  48423. t['a104'] = 910;
  48424. t['a106'] = 667;
  48425. t['a107'] = 760;
  48426. t['a108'] = 760;
  48427. t['a112'] = 776;
  48428. t['a111'] = 595;
  48429. t['a110'] = 694;
  48430. t['a109'] = 626;
  48431. t['a120'] = 788;
  48432. t['a121'] = 788;
  48433. t['a122'] = 788;
  48434. t['a123'] = 788;
  48435. t['a124'] = 788;
  48436. t['a125'] = 788;
  48437. t['a126'] = 788;
  48438. t['a127'] = 788;
  48439. t['a128'] = 788;
  48440. t['a129'] = 788;
  48441. t['a130'] = 788;
  48442. t['a131'] = 788;
  48443. t['a132'] = 788;
  48444. t['a133'] = 788;
  48445. t['a134'] = 788;
  48446. t['a135'] = 788;
  48447. t['a136'] = 788;
  48448. t['a137'] = 788;
  48449. t['a138'] = 788;
  48450. t['a139'] = 788;
  48451. t['a140'] = 788;
  48452. t['a141'] = 788;
  48453. t['a142'] = 788;
  48454. t['a143'] = 788;
  48455. t['a144'] = 788;
  48456. t['a145'] = 788;
  48457. t['a146'] = 788;
  48458. t['a147'] = 788;
  48459. t['a148'] = 788;
  48460. t['a149'] = 788;
  48461. t['a150'] = 788;
  48462. t['a151'] = 788;
  48463. t['a152'] = 788;
  48464. t['a153'] = 788;
  48465. t['a154'] = 788;
  48466. t['a155'] = 788;
  48467. t['a156'] = 788;
  48468. t['a157'] = 788;
  48469. t['a158'] = 788;
  48470. t['a159'] = 788;
  48471. t['a160'] = 894;
  48472. t['a161'] = 838;
  48473. t['a163'] = 1016;
  48474. t['a164'] = 458;
  48475. t['a196'] = 748;
  48476. t['a165'] = 924;
  48477. t['a192'] = 748;
  48478. t['a166'] = 918;
  48479. t['a167'] = 927;
  48480. t['a168'] = 928;
  48481. t['a169'] = 928;
  48482. t['a170'] = 834;
  48483. t['a171'] = 873;
  48484. t['a172'] = 828;
  48485. t['a173'] = 924;
  48486. t['a162'] = 924;
  48487. t['a174'] = 917;
  48488. t['a175'] = 930;
  48489. t['a176'] = 931;
  48490. t['a177'] = 463;
  48491. t['a178'] = 883;
  48492. t['a179'] = 836;
  48493. t['a193'] = 836;
  48494. t['a180'] = 867;
  48495. t['a199'] = 867;
  48496. t['a181'] = 696;
  48497. t['a200'] = 696;
  48498. t['a182'] = 874;
  48499. t['a201'] = 874;
  48500. t['a183'] = 760;
  48501. t['a184'] = 946;
  48502. t['a197'] = 771;
  48503. t['a185'] = 865;
  48504. t['a194'] = 771;
  48505. t['a198'] = 888;
  48506. t['a186'] = 967;
  48507. t['a195'] = 888;
  48508. t['a187'] = 831;
  48509. t['a188'] = 873;
  48510. t['a189'] = 927;
  48511. t['a190'] = 970;
  48512. t['a191'] = 918;
  48513. });
  48514. });
  48515. exports.getMetrics = getMetrics;
  48516. /***/ }),
  48517. /* 31 */
  48518. /***/ (function(module, exports, __w_pdfjs_require__) {
  48519. "use strict";
  48520. var sharedUtil = __w_pdfjs_require__(0);
  48521. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  48522. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  48523. var MASK_HIGH = 0xffff0000;
  48524. var MASK_LOW = 0xffff;
  48525. function MurmurHash3_64(seed) {
  48526. var SEED = 0xc3d2e1f0;
  48527. this.h1 = seed ? seed & 0xffffffff : SEED;
  48528. this.h2 = seed ? seed & 0xffffffff : SEED;
  48529. }
  48530. var alwaysUseUint32ArrayView = false;
  48531. try {
  48532. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  48533. } catch (e) {
  48534. alwaysUseUint32ArrayView = true;
  48535. }
  48536. MurmurHash3_64.prototype = {
  48537. update: function MurmurHash3_64_update(input) {
  48538. var useUint32ArrayView = alwaysUseUint32ArrayView;
  48539. var i;
  48540. if (typeof input === 'string') {
  48541. var data = new Uint8Array(input.length * 2);
  48542. var length = 0;
  48543. for (i = 0; i < input.length; i++) {
  48544. var code = input.charCodeAt(i);
  48545. if (code <= 0xff) {
  48546. data[length++] = code;
  48547. } else {
  48548. data[length++] = code >>> 8;
  48549. data[length++] = code & 0xff;
  48550. }
  48551. }
  48552. } else if (input instanceof Uint8Array) {
  48553. data = input;
  48554. length = data.length;
  48555. } else if (typeof input === 'object' && 'length' in input) {
  48556. data = input;
  48557. length = data.length;
  48558. useUint32ArrayView = true;
  48559. } else {
  48560. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  48561. }
  48562. var blockCounts = length >> 2;
  48563. var tailLength = length - blockCounts * 4;
  48564. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  48565. var k1 = 0;
  48566. var k2 = 0;
  48567. var h1 = this.h1;
  48568. var h2 = this.h2;
  48569. var C1 = 0xcc9e2d51;
  48570. var C2 = 0x1b873593;
  48571. var C1_LOW = C1 & MASK_LOW;
  48572. var C2_LOW = C2 & MASK_LOW;
  48573. for (i = 0; i < blockCounts; i++) {
  48574. if (i & 1) {
  48575. k1 = dataUint32[i];
  48576. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48577. k1 = k1 << 15 | k1 >>> 17;
  48578. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48579. h1 ^= k1;
  48580. h1 = h1 << 13 | h1 >>> 19;
  48581. h1 = h1 * 5 + 0xe6546b64;
  48582. } else {
  48583. k2 = dataUint32[i];
  48584. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  48585. k2 = k2 << 15 | k2 >>> 17;
  48586. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  48587. h2 ^= k2;
  48588. h2 = h2 << 13 | h2 >>> 19;
  48589. h2 = h2 * 5 + 0xe6546b64;
  48590. }
  48591. }
  48592. k1 = 0;
  48593. switch (tailLength) {
  48594. case 3:
  48595. k1 ^= data[blockCounts * 4 + 2] << 16;
  48596. case 2:
  48597. k1 ^= data[blockCounts * 4 + 1] << 8;
  48598. case 1:
  48599. k1 ^= data[blockCounts * 4];
  48600. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48601. k1 = k1 << 15 | k1 >>> 17;
  48602. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48603. if (blockCounts & 1) {
  48604. h1 ^= k1;
  48605. } else {
  48606. h2 ^= k1;
  48607. }
  48608. }
  48609. this.h1 = h1;
  48610. this.h2 = h2;
  48611. return this;
  48612. },
  48613. hexdigest: function MurmurHash3_64_hexdigest() {
  48614. var h1 = this.h1;
  48615. var h2 = this.h2;
  48616. h1 ^= h2 >>> 1;
  48617. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  48618. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  48619. h1 ^= h2 >>> 1;
  48620. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  48621. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  48622. h1 ^= h2 >>> 1;
  48623. for (var i = 0, arr = [
  48624. h1,
  48625. h2
  48626. ], str = ''; i < arr.length; i++) {
  48627. var hex = (arr[i] >>> 0).toString(16);
  48628. while (hex.length < 8) {
  48629. hex = '0' + hex;
  48630. }
  48631. str += hex;
  48632. }
  48633. return str;
  48634. }
  48635. };
  48636. return MurmurHash3_64;
  48637. }();
  48638. exports.MurmurHash3_64 = MurmurHash3_64;
  48639. /***/ }),
  48640. /* 32 */
  48641. /***/ (function(module, exports, __w_pdfjs_require__) {
  48642. "use strict";
  48643. var sharedUtil = __w_pdfjs_require__(0);
  48644. var corePrimitives = __w_pdfjs_require__(1);
  48645. var coreFunction = __w_pdfjs_require__(6);
  48646. var coreColorSpace = __w_pdfjs_require__(3);
  48647. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  48648. var MissingDataException = sharedUtil.MissingDataException;
  48649. var Util = sharedUtil.Util;
  48650. var assert = sharedUtil.assert;
  48651. var error = sharedUtil.error;
  48652. var info = sharedUtil.info;
  48653. var warn = sharedUtil.warn;
  48654. var isStream = corePrimitives.isStream;
  48655. var PDFFunction = coreFunction.PDFFunction;
  48656. var ColorSpace = coreColorSpace.ColorSpace;
  48657. var ShadingType = {
  48658. FUNCTION_BASED: 1,
  48659. AXIAL: 2,
  48660. RADIAL: 3,
  48661. FREE_FORM_MESH: 4,
  48662. LATTICE_FORM_MESH: 5,
  48663. COONS_PATCH_MESH: 6,
  48664. TENSOR_PATCH_MESH: 7
  48665. };
  48666. var Pattern = function PatternClosure() {
  48667. function Pattern() {
  48668. error('should not call Pattern constructor');
  48669. }
  48670. Pattern.prototype = {
  48671. getPattern: function Pattern_getPattern(ctx) {
  48672. error('Should not call Pattern.getStyle: ' + ctx);
  48673. }
  48674. };
  48675. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  48676. var dict = isStream(shading) ? shading.dict : shading;
  48677. var type = dict.get('ShadingType');
  48678. try {
  48679. switch (type) {
  48680. case ShadingType.AXIAL:
  48681. case ShadingType.RADIAL:
  48682. return new Shadings.RadialAxial(dict, matrix, xref, res);
  48683. case ShadingType.FREE_FORM_MESH:
  48684. case ShadingType.LATTICE_FORM_MESH:
  48685. case ShadingType.COONS_PATCH_MESH:
  48686. case ShadingType.TENSOR_PATCH_MESH:
  48687. return new Shadings.Mesh(shading, matrix, xref, res);
  48688. default:
  48689. throw new Error('Unsupported ShadingType: ' + type);
  48690. }
  48691. } catch (ex) {
  48692. if (ex instanceof MissingDataException) {
  48693. throw ex;
  48694. }
  48695. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  48696. warn(ex);
  48697. return new Shadings.Dummy();
  48698. }
  48699. };
  48700. return Pattern;
  48701. }();
  48702. var Shadings = {};
  48703. Shadings.SMALL_NUMBER = 1e-6;
  48704. Shadings.RadialAxial = function RadialAxialClosure() {
  48705. function RadialAxial(dict, matrix, xref, res) {
  48706. this.matrix = matrix;
  48707. this.coordsArr = dict.getArray('Coords');
  48708. this.shadingType = dict.get('ShadingType');
  48709. this.type = 'Pattern';
  48710. var cs = dict.get('ColorSpace', 'CS');
  48711. cs = ColorSpace.parse(cs, xref, res);
  48712. this.cs = cs;
  48713. var t0 = 0.0, t1 = 1.0;
  48714. if (dict.has('Domain')) {
  48715. var domainArr = dict.getArray('Domain');
  48716. t0 = domainArr[0];
  48717. t1 = domainArr[1];
  48718. }
  48719. var extendStart = false, extendEnd = false;
  48720. if (dict.has('Extend')) {
  48721. var extendArr = dict.getArray('Extend');
  48722. extendStart = extendArr[0];
  48723. extendEnd = extendArr[1];
  48724. }
  48725. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  48726. var x1 = this.coordsArr[0];
  48727. var y1 = this.coordsArr[1];
  48728. var r1 = this.coordsArr[2];
  48729. var x2 = this.coordsArr[3];
  48730. var y2 = this.coordsArr[4];
  48731. var r2 = this.coordsArr[5];
  48732. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  48733. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  48734. warn('Unsupported radial gradient.');
  48735. }
  48736. }
  48737. this.extendStart = extendStart;
  48738. this.extendEnd = extendEnd;
  48739. var fnObj = dict.get('Function');
  48740. var fn = PDFFunction.parseArray(xref, fnObj);
  48741. var diff = t1 - t0;
  48742. var step = diff / 10;
  48743. var colorStops = this.colorStops = [];
  48744. if (t0 >= t1 || step <= 0) {
  48745. info('Bad shading domain.');
  48746. return;
  48747. }
  48748. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  48749. var rgbColor;
  48750. for (var i = t0; i <= t1; i += step) {
  48751. ratio[0] = i;
  48752. fn(ratio, 0, color, 0);
  48753. rgbColor = cs.getRgb(color, 0);
  48754. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48755. colorStops.push([
  48756. (i - t0) / diff,
  48757. cssColor
  48758. ]);
  48759. }
  48760. var background = 'transparent';
  48761. if (dict.has('Background')) {
  48762. rgbColor = cs.getRgb(dict.get('Background'), 0);
  48763. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48764. }
  48765. if (!extendStart) {
  48766. colorStops.unshift([
  48767. 0,
  48768. background
  48769. ]);
  48770. colorStops[1][0] += Shadings.SMALL_NUMBER;
  48771. }
  48772. if (!extendEnd) {
  48773. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  48774. colorStops.push([
  48775. 1,
  48776. background
  48777. ]);
  48778. }
  48779. this.colorStops = colorStops;
  48780. }
  48781. RadialAxial.prototype = {
  48782. getIR: function RadialAxial_getIR() {
  48783. var coordsArr = this.coordsArr;
  48784. var shadingType = this.shadingType;
  48785. var type, p0, p1, r0, r1;
  48786. if (shadingType === ShadingType.AXIAL) {
  48787. p0 = [
  48788. coordsArr[0],
  48789. coordsArr[1]
  48790. ];
  48791. p1 = [
  48792. coordsArr[2],
  48793. coordsArr[3]
  48794. ];
  48795. r0 = null;
  48796. r1 = null;
  48797. type = 'axial';
  48798. } else if (shadingType === ShadingType.RADIAL) {
  48799. p0 = [
  48800. coordsArr[0],
  48801. coordsArr[1]
  48802. ];
  48803. p1 = [
  48804. coordsArr[3],
  48805. coordsArr[4]
  48806. ];
  48807. r0 = coordsArr[2];
  48808. r1 = coordsArr[5];
  48809. type = 'radial';
  48810. } else {
  48811. error('getPattern type unknown: ' + shadingType);
  48812. }
  48813. var matrix = this.matrix;
  48814. if (matrix) {
  48815. p0 = Util.applyTransform(p0, matrix);
  48816. p1 = Util.applyTransform(p1, matrix);
  48817. if (shadingType === ShadingType.RADIAL) {
  48818. var scale = Util.singularValueDecompose2dScale(matrix);
  48819. r0 *= scale[0];
  48820. r1 *= scale[1];
  48821. }
  48822. }
  48823. return [
  48824. 'RadialAxial',
  48825. type,
  48826. this.colorStops,
  48827. p0,
  48828. p1,
  48829. r0,
  48830. r1
  48831. ];
  48832. }
  48833. };
  48834. return RadialAxial;
  48835. }();
  48836. Shadings.Mesh = function MeshClosure() {
  48837. function MeshStreamReader(stream, context) {
  48838. this.stream = stream;
  48839. this.context = context;
  48840. this.buffer = 0;
  48841. this.bufferLength = 0;
  48842. var numComps = context.numComps;
  48843. this.tmpCompsBuf = new Float32Array(numComps);
  48844. var csNumComps = context.colorSpace.numComps;
  48845. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48846. }
  48847. MeshStreamReader.prototype = {
  48848. get hasData() {
  48849. if (this.stream.end) {
  48850. return this.stream.pos < this.stream.end;
  48851. }
  48852. if (this.bufferLength > 0) {
  48853. return true;
  48854. }
  48855. var nextByte = this.stream.getByte();
  48856. if (nextByte < 0) {
  48857. return false;
  48858. }
  48859. this.buffer = nextByte;
  48860. this.bufferLength = 8;
  48861. return true;
  48862. },
  48863. readBits: function MeshStreamReader_readBits(n) {
  48864. var buffer = this.buffer;
  48865. var bufferLength = this.bufferLength;
  48866. if (n === 32) {
  48867. if (bufferLength === 0) {
  48868. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48869. }
  48870. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48871. var nextByte = this.stream.getByte();
  48872. this.buffer = nextByte & (1 << bufferLength) - 1;
  48873. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48874. }
  48875. if (n === 8 && bufferLength === 0) {
  48876. return this.stream.getByte();
  48877. }
  48878. while (bufferLength < n) {
  48879. buffer = buffer << 8 | this.stream.getByte();
  48880. bufferLength += 8;
  48881. }
  48882. bufferLength -= n;
  48883. this.bufferLength = bufferLength;
  48884. this.buffer = buffer & (1 << bufferLength) - 1;
  48885. return buffer >> bufferLength;
  48886. },
  48887. align: function MeshStreamReader_align() {
  48888. this.buffer = 0;
  48889. this.bufferLength = 0;
  48890. },
  48891. readFlag: function MeshStreamReader_readFlag() {
  48892. return this.readBits(this.context.bitsPerFlag);
  48893. },
  48894. readCoordinate: function MeshStreamReader_readCoordinate() {
  48895. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48896. var xi = this.readBits(bitsPerCoordinate);
  48897. var yi = this.readBits(bitsPerCoordinate);
  48898. var decode = this.context.decode;
  48899. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48900. return [
  48901. xi * scale * (decode[1] - decode[0]) + decode[0],
  48902. yi * scale * (decode[3] - decode[2]) + decode[2]
  48903. ];
  48904. },
  48905. readComponents: function MeshStreamReader_readComponents() {
  48906. var numComps = this.context.numComps;
  48907. var bitsPerComponent = this.context.bitsPerComponent;
  48908. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48909. var decode = this.context.decode;
  48910. var components = this.tmpCompsBuf;
  48911. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48912. var ci = this.readBits(bitsPerComponent);
  48913. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48914. }
  48915. var color = this.tmpCsCompsBuf;
  48916. if (this.context.colorFn) {
  48917. this.context.colorFn(components, 0, color, 0);
  48918. }
  48919. return this.context.colorSpace.getRgb(color, 0);
  48920. }
  48921. };
  48922. function decodeType4Shading(mesh, reader) {
  48923. var coords = mesh.coords;
  48924. var colors = mesh.colors;
  48925. var operators = [];
  48926. var ps = [];
  48927. var verticesLeft = 0;
  48928. while (reader.hasData) {
  48929. var f = reader.readFlag();
  48930. var coord = reader.readCoordinate();
  48931. var color = reader.readComponents();
  48932. if (verticesLeft === 0) {
  48933. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48934. switch (f) {
  48935. case 0:
  48936. verticesLeft = 3;
  48937. break;
  48938. case 1:
  48939. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48940. verticesLeft = 1;
  48941. break;
  48942. case 2:
  48943. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48944. verticesLeft = 1;
  48945. break;
  48946. }
  48947. operators.push(f);
  48948. }
  48949. ps.push(coords.length);
  48950. coords.push(coord);
  48951. colors.push(color);
  48952. verticesLeft--;
  48953. reader.align();
  48954. }
  48955. mesh.figures.push({
  48956. type: 'triangles',
  48957. coords: new Int32Array(ps),
  48958. colors: new Int32Array(ps)
  48959. });
  48960. }
  48961. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48962. var coords = mesh.coords;
  48963. var colors = mesh.colors;
  48964. var ps = [];
  48965. while (reader.hasData) {
  48966. var coord = reader.readCoordinate();
  48967. var color = reader.readComponents();
  48968. ps.push(coords.length);
  48969. coords.push(coord);
  48970. colors.push(color);
  48971. }
  48972. mesh.figures.push({
  48973. type: 'lattice',
  48974. coords: new Int32Array(ps),
  48975. colors: new Int32Array(ps),
  48976. verticesPerRow: verticesPerRow
  48977. });
  48978. }
  48979. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48980. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48981. var TRIANGLE_DENSITY = 20;
  48982. var getB = function getBClosure() {
  48983. function buildB(count) {
  48984. var lut = [];
  48985. for (var i = 0; i <= count; i++) {
  48986. var t = i / count, t_ = 1 - t;
  48987. lut.push(new Float32Array([
  48988. t_ * t_ * t_,
  48989. 3 * t * t_ * t_,
  48990. 3 * t * t * t_,
  48991. t * t * t
  48992. ]));
  48993. }
  48994. return lut;
  48995. }
  48996. var cache = [];
  48997. return function getB(count) {
  48998. if (!cache[count]) {
  48999. cache[count] = buildB(count);
  49000. }
  49001. return cache[count];
  49002. };
  49003. }();
  49004. function buildFigureFromPatch(mesh, index) {
  49005. var figure = mesh.figures[index];
  49006. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  49007. var coords = mesh.coords, colors = mesh.colors;
  49008. var pi = figure.coords;
  49009. var ci = figure.colors;
  49010. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49011. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49012. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49013. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49014. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  49015. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  49016. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  49017. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  49018. var verticesPerRow = splitXBy + 1;
  49019. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  49020. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  49021. var k = 0;
  49022. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  49023. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  49024. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  49025. for (var row = 0; row <= splitYBy; row++) {
  49026. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  49027. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  49028. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  49029. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  49030. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  49031. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  49032. for (var col = 0; col <= splitXBy; col++, k++) {
  49033. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  49034. continue;
  49035. }
  49036. var x = 0, y = 0;
  49037. var q = 0;
  49038. for (var i = 0; i <= 3; i++) {
  49039. for (var j = 0; j <= 3; j++, q++) {
  49040. var m = bRow[row][i] * bCol[col][j];
  49041. x += coords[pi[q]][0] * m;
  49042. y += coords[pi[q]][1] * m;
  49043. }
  49044. }
  49045. figureCoords[k] = coords.length;
  49046. coords.push([
  49047. x,
  49048. y
  49049. ]);
  49050. figureColors[k] = colors.length;
  49051. var newColor = new Uint8Array(3);
  49052. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  49053. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  49054. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  49055. colors.push(newColor);
  49056. }
  49057. }
  49058. figureCoords[0] = pi[0];
  49059. figureColors[0] = ci[0];
  49060. figureCoords[splitXBy] = pi[3];
  49061. figureColors[splitXBy] = ci[1];
  49062. figureCoords[verticesPerRow * splitYBy] = pi[12];
  49063. figureColors[verticesPerRow * splitYBy] = ci[2];
  49064. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  49065. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  49066. mesh.figures[index] = {
  49067. type: 'lattice',
  49068. coords: figureCoords,
  49069. colors: figureColors,
  49070. verticesPerRow: verticesPerRow
  49071. };
  49072. }
  49073. function decodeType6Shading(mesh, reader) {
  49074. var coords = mesh.coords;
  49075. var colors = mesh.colors;
  49076. var ps = new Int32Array(16);
  49077. var cs = new Int32Array(4);
  49078. while (reader.hasData) {
  49079. var f = reader.readFlag();
  49080. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  49081. var i, ii;
  49082. var pi = coords.length;
  49083. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  49084. coords.push(reader.readCoordinate());
  49085. }
  49086. var ci = colors.length;
  49087. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49088. colors.push(reader.readComponents());
  49089. }
  49090. var tmp1, tmp2, tmp3, tmp4;
  49091. switch (f) {
  49092. case 0:
  49093. ps[12] = pi + 3;
  49094. ps[13] = pi + 4;
  49095. ps[14] = pi + 5;
  49096. ps[15] = pi + 6;
  49097. ps[8] = pi + 2;
  49098. ps[11] = pi + 7;
  49099. ps[4] = pi + 1;
  49100. ps[7] = pi + 8;
  49101. ps[0] = pi;
  49102. ps[1] = pi + 11;
  49103. ps[2] = pi + 10;
  49104. ps[3] = pi + 9;
  49105. cs[2] = ci + 1;
  49106. cs[3] = ci + 2;
  49107. cs[0] = ci;
  49108. cs[1] = ci + 3;
  49109. break;
  49110. case 1:
  49111. tmp1 = ps[12];
  49112. tmp2 = ps[13];
  49113. tmp3 = ps[14];
  49114. tmp4 = ps[15];
  49115. ps[12] = tmp4;
  49116. ps[13] = pi + 0;
  49117. ps[14] = pi + 1;
  49118. ps[15] = pi + 2;
  49119. ps[8] = tmp3;
  49120. ps[11] = pi + 3;
  49121. ps[4] = tmp2;
  49122. ps[7] = pi + 4;
  49123. ps[0] = tmp1;
  49124. ps[1] = pi + 7;
  49125. ps[2] = pi + 6;
  49126. ps[3] = pi + 5;
  49127. tmp1 = cs[2];
  49128. tmp2 = cs[3];
  49129. cs[2] = tmp2;
  49130. cs[3] = ci;
  49131. cs[0] = tmp1;
  49132. cs[1] = ci + 1;
  49133. break;
  49134. case 2:
  49135. tmp1 = ps[15];
  49136. tmp2 = ps[11];
  49137. ps[12] = ps[3];
  49138. ps[13] = pi + 0;
  49139. ps[14] = pi + 1;
  49140. ps[15] = pi + 2;
  49141. ps[8] = ps[7];
  49142. ps[11] = pi + 3;
  49143. ps[4] = tmp2;
  49144. ps[7] = pi + 4;
  49145. ps[0] = tmp1;
  49146. ps[1] = pi + 7;
  49147. ps[2] = pi + 6;
  49148. ps[3] = pi + 5;
  49149. tmp1 = cs[3];
  49150. cs[2] = cs[1];
  49151. cs[3] = ci;
  49152. cs[0] = tmp1;
  49153. cs[1] = ci + 1;
  49154. break;
  49155. case 3:
  49156. ps[12] = ps[0];
  49157. ps[13] = pi + 0;
  49158. ps[14] = pi + 1;
  49159. ps[15] = pi + 2;
  49160. ps[8] = ps[1];
  49161. ps[11] = pi + 3;
  49162. ps[4] = ps[2];
  49163. ps[7] = pi + 4;
  49164. ps[0] = ps[3];
  49165. ps[1] = pi + 7;
  49166. ps[2] = pi + 6;
  49167. ps[3] = pi + 5;
  49168. cs[2] = cs[0];
  49169. cs[3] = ci;
  49170. cs[0] = cs[1];
  49171. cs[1] = ci + 1;
  49172. break;
  49173. }
  49174. ps[5] = coords.length;
  49175. coords.push([
  49176. (-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,
  49177. (-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
  49178. ]);
  49179. ps[6] = coords.length;
  49180. coords.push([
  49181. (-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,
  49182. (-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
  49183. ]);
  49184. ps[9] = coords.length;
  49185. coords.push([
  49186. (-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,
  49187. (-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
  49188. ]);
  49189. ps[10] = coords.length;
  49190. coords.push([
  49191. (-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,
  49192. (-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
  49193. ]);
  49194. mesh.figures.push({
  49195. type: 'patch',
  49196. coords: new Int32Array(ps),
  49197. colors: new Int32Array(cs)
  49198. });
  49199. }
  49200. }
  49201. function decodeType7Shading(mesh, reader) {
  49202. var coords = mesh.coords;
  49203. var colors = mesh.colors;
  49204. var ps = new Int32Array(16);
  49205. var cs = new Int32Array(4);
  49206. while (reader.hasData) {
  49207. var f = reader.readFlag();
  49208. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  49209. var i, ii;
  49210. var pi = coords.length;
  49211. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  49212. coords.push(reader.readCoordinate());
  49213. }
  49214. var ci = colors.length;
  49215. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49216. colors.push(reader.readComponents());
  49217. }
  49218. var tmp1, tmp2, tmp3, tmp4;
  49219. switch (f) {
  49220. case 0:
  49221. ps[12] = pi + 3;
  49222. ps[13] = pi + 4;
  49223. ps[14] = pi + 5;
  49224. ps[15] = pi + 6;
  49225. ps[8] = pi + 2;
  49226. ps[9] = pi + 13;
  49227. ps[10] = pi + 14;
  49228. ps[11] = pi + 7;
  49229. ps[4] = pi + 1;
  49230. ps[5] = pi + 12;
  49231. ps[6] = pi + 15;
  49232. ps[7] = pi + 8;
  49233. ps[0] = pi;
  49234. ps[1] = pi + 11;
  49235. ps[2] = pi + 10;
  49236. ps[3] = pi + 9;
  49237. cs[2] = ci + 1;
  49238. cs[3] = ci + 2;
  49239. cs[0] = ci;
  49240. cs[1] = ci + 3;
  49241. break;
  49242. case 1:
  49243. tmp1 = ps[12];
  49244. tmp2 = ps[13];
  49245. tmp3 = ps[14];
  49246. tmp4 = ps[15];
  49247. ps[12] = tmp4;
  49248. ps[13] = pi + 0;
  49249. ps[14] = pi + 1;
  49250. ps[15] = pi + 2;
  49251. ps[8] = tmp3;
  49252. ps[9] = pi + 9;
  49253. ps[10] = pi + 10;
  49254. ps[11] = pi + 3;
  49255. ps[4] = tmp2;
  49256. ps[5] = pi + 8;
  49257. ps[6] = pi + 11;
  49258. ps[7] = pi + 4;
  49259. ps[0] = tmp1;
  49260. ps[1] = pi + 7;
  49261. ps[2] = pi + 6;
  49262. ps[3] = pi + 5;
  49263. tmp1 = cs[2];
  49264. tmp2 = cs[3];
  49265. cs[2] = tmp2;
  49266. cs[3] = ci;
  49267. cs[0] = tmp1;
  49268. cs[1] = ci + 1;
  49269. break;
  49270. case 2:
  49271. tmp1 = ps[15];
  49272. tmp2 = ps[11];
  49273. ps[12] = ps[3];
  49274. ps[13] = pi + 0;
  49275. ps[14] = pi + 1;
  49276. ps[15] = pi + 2;
  49277. ps[8] = ps[7];
  49278. ps[9] = pi + 9;
  49279. ps[10] = pi + 10;
  49280. ps[11] = pi + 3;
  49281. ps[4] = tmp2;
  49282. ps[5] = pi + 8;
  49283. ps[6] = pi + 11;
  49284. ps[7] = pi + 4;
  49285. ps[0] = tmp1;
  49286. ps[1] = pi + 7;
  49287. ps[2] = pi + 6;
  49288. ps[3] = pi + 5;
  49289. tmp1 = cs[3];
  49290. cs[2] = cs[1];
  49291. cs[3] = ci;
  49292. cs[0] = tmp1;
  49293. cs[1] = ci + 1;
  49294. break;
  49295. case 3:
  49296. ps[12] = ps[0];
  49297. ps[13] = pi + 0;
  49298. ps[14] = pi + 1;
  49299. ps[15] = pi + 2;
  49300. ps[8] = ps[1];
  49301. ps[9] = pi + 9;
  49302. ps[10] = pi + 10;
  49303. ps[11] = pi + 3;
  49304. ps[4] = ps[2];
  49305. ps[5] = pi + 8;
  49306. ps[6] = pi + 11;
  49307. ps[7] = pi + 4;
  49308. ps[0] = ps[3];
  49309. ps[1] = pi + 7;
  49310. ps[2] = pi + 6;
  49311. ps[3] = pi + 5;
  49312. cs[2] = cs[0];
  49313. cs[3] = ci;
  49314. cs[0] = cs[1];
  49315. cs[1] = ci + 1;
  49316. break;
  49317. }
  49318. mesh.figures.push({
  49319. type: 'patch',
  49320. coords: new Int32Array(ps),
  49321. colors: new Int32Array(cs)
  49322. });
  49323. }
  49324. }
  49325. function updateBounds(mesh) {
  49326. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  49327. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  49328. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  49329. minX = minX > x ? x : minX;
  49330. minY = minY > y ? y : minY;
  49331. maxX = maxX < x ? x : maxX;
  49332. maxY = maxY < y ? y : maxY;
  49333. }
  49334. mesh.bounds = [
  49335. minX,
  49336. minY,
  49337. maxX,
  49338. maxY
  49339. ];
  49340. }
  49341. function packData(mesh) {
  49342. var i, ii, j, jj;
  49343. var coords = mesh.coords;
  49344. var coordsPacked = new Float32Array(coords.length * 2);
  49345. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  49346. var xy = coords[i];
  49347. coordsPacked[j++] = xy[0];
  49348. coordsPacked[j++] = xy[1];
  49349. }
  49350. mesh.coords = coordsPacked;
  49351. var colors = mesh.colors;
  49352. var colorsPacked = new Uint8Array(colors.length * 3);
  49353. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  49354. var c = colors[i];
  49355. colorsPacked[j++] = c[0];
  49356. colorsPacked[j++] = c[1];
  49357. colorsPacked[j++] = c[2];
  49358. }
  49359. mesh.colors = colorsPacked;
  49360. var figures = mesh.figures;
  49361. for (i = 0, ii = figures.length; i < ii; i++) {
  49362. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  49363. for (j = 0, jj = ps.length; j < jj; j++) {
  49364. ps[j] *= 2;
  49365. cs[j] *= 3;
  49366. }
  49367. }
  49368. }
  49369. function Mesh(stream, matrix, xref, res) {
  49370. assert(isStream(stream), 'Mesh data is not a stream');
  49371. var dict = stream.dict;
  49372. this.matrix = matrix;
  49373. this.shadingType = dict.get('ShadingType');
  49374. this.type = 'Pattern';
  49375. this.bbox = dict.getArray('BBox');
  49376. var cs = dict.get('ColorSpace', 'CS');
  49377. cs = ColorSpace.parse(cs, xref, res);
  49378. this.cs = cs;
  49379. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  49380. var fnObj = dict.get('Function');
  49381. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  49382. this.coords = [];
  49383. this.colors = [];
  49384. this.figures = [];
  49385. var decodeContext = {
  49386. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  49387. bitsPerComponent: dict.get('BitsPerComponent'),
  49388. bitsPerFlag: dict.get('BitsPerFlag'),
  49389. decode: dict.getArray('Decode'),
  49390. colorFn: fn,
  49391. colorSpace: cs,
  49392. numComps: fn ? 1 : cs.numComps
  49393. };
  49394. var reader = new MeshStreamReader(stream, decodeContext);
  49395. var patchMesh = false;
  49396. switch (this.shadingType) {
  49397. case ShadingType.FREE_FORM_MESH:
  49398. decodeType4Shading(this, reader);
  49399. break;
  49400. case ShadingType.LATTICE_FORM_MESH:
  49401. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  49402. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  49403. decodeType5Shading(this, reader, verticesPerRow);
  49404. break;
  49405. case ShadingType.COONS_PATCH_MESH:
  49406. decodeType6Shading(this, reader);
  49407. patchMesh = true;
  49408. break;
  49409. case ShadingType.TENSOR_PATCH_MESH:
  49410. decodeType7Shading(this, reader);
  49411. patchMesh = true;
  49412. break;
  49413. default:
  49414. error('Unsupported mesh type.');
  49415. break;
  49416. }
  49417. if (patchMesh) {
  49418. updateBounds(this);
  49419. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  49420. buildFigureFromPatch(this, i);
  49421. }
  49422. }
  49423. updateBounds(this);
  49424. packData(this);
  49425. }
  49426. Mesh.prototype = {
  49427. getIR: function Mesh_getIR() {
  49428. return [
  49429. 'Mesh',
  49430. this.shadingType,
  49431. this.coords,
  49432. this.colors,
  49433. this.figures,
  49434. this.bounds,
  49435. this.matrix,
  49436. this.bbox,
  49437. this.background
  49438. ];
  49439. }
  49440. };
  49441. return Mesh;
  49442. }();
  49443. Shadings.Dummy = function DummyClosure() {
  49444. function Dummy() {
  49445. this.type = 'Pattern';
  49446. }
  49447. Dummy.prototype = {
  49448. getIR: function Dummy_getIR() {
  49449. return ['Dummy'];
  49450. }
  49451. };
  49452. return Dummy;
  49453. }();
  49454. function getTilingPatternIR(operatorList, dict, args) {
  49455. var matrix = dict.getArray('Matrix');
  49456. var bbox = dict.getArray('BBox');
  49457. var xstep = dict.get('XStep');
  49458. var ystep = dict.get('YStep');
  49459. var paintType = dict.get('PaintType');
  49460. var tilingType = dict.get('TilingType');
  49461. return [
  49462. 'TilingPattern',
  49463. args,
  49464. operatorList,
  49465. matrix,
  49466. bbox,
  49467. xstep,
  49468. ystep,
  49469. paintType,
  49470. tilingType
  49471. ];
  49472. }
  49473. exports.Pattern = Pattern;
  49474. exports.getTilingPatternIR = getTilingPatternIR;
  49475. /***/ }),
  49476. /* 33 */
  49477. /***/ (function(module, exports, __w_pdfjs_require__) {
  49478. "use strict";
  49479. var sharedUtil = __w_pdfjs_require__(0);
  49480. var coreStream = __w_pdfjs_require__(2);
  49481. var coreChunkedStream = __w_pdfjs_require__(11);
  49482. var coreDocument = __w_pdfjs_require__(24);
  49483. var warn = sharedUtil.warn;
  49484. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  49485. var shadow = sharedUtil.shadow;
  49486. var NotImplementedException = sharedUtil.NotImplementedException;
  49487. var MissingDataException = sharedUtil.MissingDataException;
  49488. var createPromiseCapability = sharedUtil.createPromiseCapability;
  49489. var Util = sharedUtil.Util;
  49490. var Stream = coreStream.Stream;
  49491. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  49492. var PDFDocument = coreDocument.PDFDocument;
  49493. var BasePdfManager = function BasePdfManagerClosure() {
  49494. function BasePdfManager() {
  49495. throw new Error('Cannot initialize BaseManagerManager');
  49496. }
  49497. BasePdfManager.prototype = {
  49498. get docId() {
  49499. return this._docId;
  49500. },
  49501. get password() {
  49502. return this._password;
  49503. },
  49504. get docBaseUrl() {
  49505. var docBaseUrl = null;
  49506. if (this._docBaseUrl) {
  49507. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  49508. if (absoluteUrl) {
  49509. docBaseUrl = absoluteUrl.href;
  49510. } else {
  49511. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  49512. }
  49513. }
  49514. return shadow(this, 'docBaseUrl', docBaseUrl);
  49515. },
  49516. onLoadedStream: function BasePdfManager_onLoadedStream() {
  49517. throw new NotImplementedException();
  49518. },
  49519. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  49520. return this.ensure(this.pdfDocument, prop, args);
  49521. },
  49522. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  49523. return this.ensure(this.pdfDocument.xref, prop, args);
  49524. },
  49525. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  49526. return this.ensure(this.pdfDocument.catalog, prop, args);
  49527. },
  49528. getPage: function BasePdfManager_getPage(pageIndex) {
  49529. return this.pdfDocument.getPage(pageIndex);
  49530. },
  49531. cleanup: function BasePdfManager_cleanup() {
  49532. return this.pdfDocument.cleanup();
  49533. },
  49534. ensure: function BasePdfManager_ensure(obj, prop, args) {
  49535. return new NotImplementedException();
  49536. },
  49537. requestRange: function BasePdfManager_requestRange(begin, end) {
  49538. return new NotImplementedException();
  49539. },
  49540. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  49541. return new NotImplementedException();
  49542. },
  49543. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  49544. return new NotImplementedException();
  49545. },
  49546. updatePassword: function BasePdfManager_updatePassword(password) {
  49547. this._password = password;
  49548. },
  49549. terminate: function BasePdfManager_terminate() {
  49550. return new NotImplementedException();
  49551. }
  49552. };
  49553. return BasePdfManager;
  49554. }();
  49555. var LocalPdfManager = function LocalPdfManagerClosure() {
  49556. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  49557. this._docId = docId;
  49558. this._password = password;
  49559. this._docBaseUrl = docBaseUrl;
  49560. this.evaluatorOptions = evaluatorOptions;
  49561. var stream = new Stream(data);
  49562. this.pdfDocument = new PDFDocument(this, stream);
  49563. this._loadedStreamCapability = createPromiseCapability();
  49564. this._loadedStreamCapability.resolve(stream);
  49565. }
  49566. Util.inherit(LocalPdfManager, BasePdfManager, {
  49567. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  49568. return new Promise(function (resolve, reject) {
  49569. try {
  49570. var value = obj[prop];
  49571. var result;
  49572. if (typeof value === 'function') {
  49573. result = value.apply(obj, args);
  49574. } else {
  49575. result = value;
  49576. }
  49577. resolve(result);
  49578. } catch (e) {
  49579. reject(e);
  49580. }
  49581. });
  49582. },
  49583. requestRange: function LocalPdfManager_requestRange(begin, end) {
  49584. return Promise.resolve();
  49585. },
  49586. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  49587. },
  49588. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  49589. return this._loadedStreamCapability.promise;
  49590. },
  49591. terminate: function LocalPdfManager_terminate() {
  49592. }
  49593. });
  49594. return LocalPdfManager;
  49595. }();
  49596. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  49597. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  49598. this._docId = docId;
  49599. this._password = args.password;
  49600. this._docBaseUrl = docBaseUrl;
  49601. this.msgHandler = args.msgHandler;
  49602. this.evaluatorOptions = evaluatorOptions;
  49603. var params = {
  49604. msgHandler: args.msgHandler,
  49605. url: args.url,
  49606. length: args.length,
  49607. disableAutoFetch: args.disableAutoFetch,
  49608. rangeChunkSize: args.rangeChunkSize
  49609. };
  49610. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  49611. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  49612. }
  49613. Util.inherit(NetworkPdfManager, BasePdfManager, {
  49614. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  49615. var pdfManager = this;
  49616. return new Promise(function (resolve, reject) {
  49617. function ensureHelper() {
  49618. try {
  49619. var result;
  49620. var value = obj[prop];
  49621. if (typeof value === 'function') {
  49622. result = value.apply(obj, args);
  49623. } else {
  49624. result = value;
  49625. }
  49626. resolve(result);
  49627. } catch (e) {
  49628. if (!(e instanceof MissingDataException)) {
  49629. reject(e);
  49630. return;
  49631. }
  49632. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  49633. }
  49634. }
  49635. ensureHelper();
  49636. });
  49637. },
  49638. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  49639. return this.streamManager.requestRange(begin, end);
  49640. },
  49641. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  49642. this.streamManager.requestAllChunks();
  49643. },
  49644. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  49645. this.streamManager.onReceiveData({ chunk: chunk });
  49646. },
  49647. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  49648. return this.streamManager.onLoadedStream();
  49649. },
  49650. terminate: function NetworkPdfManager_terminate() {
  49651. this.streamManager.abort();
  49652. }
  49653. });
  49654. return NetworkPdfManager;
  49655. }();
  49656. exports.LocalPdfManager = LocalPdfManager;
  49657. exports.NetworkPdfManager = NetworkPdfManager;
  49658. /***/ }),
  49659. /* 34 */
  49660. /***/ (function(module, exports, __w_pdfjs_require__) {
  49661. "use strict";
  49662. var sharedUtil = __w_pdfjs_require__(0);
  49663. var corePrimitives = __w_pdfjs_require__(1);
  49664. var error = sharedUtil.error;
  49665. var isSpace = sharedUtil.isSpace;
  49666. var EOF = corePrimitives.EOF;
  49667. var PostScriptParser = function PostScriptParserClosure() {
  49668. function PostScriptParser(lexer) {
  49669. this.lexer = lexer;
  49670. this.operators = [];
  49671. this.token = null;
  49672. this.prev = null;
  49673. }
  49674. PostScriptParser.prototype = {
  49675. nextToken: function PostScriptParser_nextToken() {
  49676. this.prev = this.token;
  49677. this.token = this.lexer.getToken();
  49678. },
  49679. accept: function PostScriptParser_accept(type) {
  49680. if (this.token.type === type) {
  49681. this.nextToken();
  49682. return true;
  49683. }
  49684. return false;
  49685. },
  49686. expect: function PostScriptParser_expect(type) {
  49687. if (this.accept(type)) {
  49688. return true;
  49689. }
  49690. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  49691. },
  49692. parse: function PostScriptParser_parse() {
  49693. this.nextToken();
  49694. this.expect(PostScriptTokenTypes.LBRACE);
  49695. this.parseBlock();
  49696. this.expect(PostScriptTokenTypes.RBRACE);
  49697. return this.operators;
  49698. },
  49699. parseBlock: function PostScriptParser_parseBlock() {
  49700. while (true) {
  49701. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  49702. this.operators.push(this.prev.value);
  49703. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  49704. this.operators.push(this.prev.value);
  49705. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49706. this.parseCondition();
  49707. } else {
  49708. return;
  49709. }
  49710. }
  49711. },
  49712. parseCondition: function PostScriptParser_parseCondition() {
  49713. var conditionLocation = this.operators.length;
  49714. this.operators.push(null, null);
  49715. this.parseBlock();
  49716. this.expect(PostScriptTokenTypes.RBRACE);
  49717. if (this.accept(PostScriptTokenTypes.IF)) {
  49718. this.operators[conditionLocation] = this.operators.length;
  49719. this.operators[conditionLocation + 1] = 'jz';
  49720. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49721. var jumpLocation = this.operators.length;
  49722. this.operators.push(null, null);
  49723. var endOfTrue = this.operators.length;
  49724. this.parseBlock();
  49725. this.expect(PostScriptTokenTypes.RBRACE);
  49726. this.expect(PostScriptTokenTypes.IFELSE);
  49727. this.operators[jumpLocation] = this.operators.length;
  49728. this.operators[jumpLocation + 1] = 'j';
  49729. this.operators[conditionLocation] = endOfTrue;
  49730. this.operators[conditionLocation + 1] = 'jz';
  49731. } else {
  49732. error('PS Function: error parsing conditional.');
  49733. }
  49734. }
  49735. };
  49736. return PostScriptParser;
  49737. }();
  49738. var PostScriptTokenTypes = {
  49739. LBRACE: 0,
  49740. RBRACE: 1,
  49741. NUMBER: 2,
  49742. OPERATOR: 3,
  49743. IF: 4,
  49744. IFELSE: 5
  49745. };
  49746. var PostScriptToken = function PostScriptTokenClosure() {
  49747. function PostScriptToken(type, value) {
  49748. this.type = type;
  49749. this.value = value;
  49750. }
  49751. var opCache = Object.create(null);
  49752. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  49753. var opValue = opCache[op];
  49754. if (opValue) {
  49755. return opValue;
  49756. }
  49757. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49758. };
  49759. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  49760. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  49761. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  49762. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  49763. return PostScriptToken;
  49764. }();
  49765. var PostScriptLexer = function PostScriptLexerClosure() {
  49766. function PostScriptLexer(stream) {
  49767. this.stream = stream;
  49768. this.nextChar();
  49769. this.strBuf = [];
  49770. }
  49771. PostScriptLexer.prototype = {
  49772. nextChar: function PostScriptLexer_nextChar() {
  49773. return this.currentChar = this.stream.getByte();
  49774. },
  49775. getToken: function PostScriptLexer_getToken() {
  49776. var comment = false;
  49777. var ch = this.currentChar;
  49778. while (true) {
  49779. if (ch < 0) {
  49780. return EOF;
  49781. }
  49782. if (comment) {
  49783. if (ch === 0x0A || ch === 0x0D) {
  49784. comment = false;
  49785. }
  49786. } else if (ch === 0x25) {
  49787. comment = true;
  49788. } else if (!isSpace(ch)) {
  49789. break;
  49790. }
  49791. ch = this.nextChar();
  49792. }
  49793. switch (ch | 0) {
  49794. case 0x30:
  49795. case 0x31:
  49796. case 0x32:
  49797. case 0x33:
  49798. case 0x34:
  49799. case 0x35:
  49800. case 0x36:
  49801. case 0x37:
  49802. case 0x38:
  49803. case 0x39:
  49804. case 0x2B:
  49805. case 0x2D:
  49806. case 0x2E:
  49807. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49808. case 0x7B:
  49809. this.nextChar();
  49810. return PostScriptToken.LBRACE;
  49811. case 0x7D:
  49812. this.nextChar();
  49813. return PostScriptToken.RBRACE;
  49814. }
  49815. var strBuf = this.strBuf;
  49816. strBuf.length = 0;
  49817. strBuf[0] = String.fromCharCode(ch);
  49818. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  49819. strBuf.push(String.fromCharCode(ch));
  49820. }
  49821. var str = strBuf.join('');
  49822. switch (str.toLowerCase()) {
  49823. case 'if':
  49824. return PostScriptToken.IF;
  49825. case 'ifelse':
  49826. return PostScriptToken.IFELSE;
  49827. default:
  49828. return PostScriptToken.getOperator(str);
  49829. }
  49830. },
  49831. getNumber: function PostScriptLexer_getNumber() {
  49832. var ch = this.currentChar;
  49833. var strBuf = this.strBuf;
  49834. strBuf.length = 0;
  49835. strBuf[0] = String.fromCharCode(ch);
  49836. while ((ch = this.nextChar()) >= 0) {
  49837. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49838. strBuf.push(String.fromCharCode(ch));
  49839. } else {
  49840. break;
  49841. }
  49842. }
  49843. var value = parseFloat(strBuf.join(''));
  49844. if (isNaN(value)) {
  49845. error('Invalid floating point number: ' + value);
  49846. }
  49847. return value;
  49848. }
  49849. };
  49850. return PostScriptLexer;
  49851. }();
  49852. exports.PostScriptLexer = PostScriptLexer;
  49853. exports.PostScriptParser = PostScriptParser;
  49854. /***/ }),
  49855. /* 35 */
  49856. /***/ (function(module, exports, __w_pdfjs_require__) {
  49857. "use strict";
  49858. var sharedUtil = __w_pdfjs_require__(0);
  49859. var coreStream = __w_pdfjs_require__(2);
  49860. var coreEncodings = __w_pdfjs_require__(4);
  49861. var warn = sharedUtil.warn;
  49862. var isSpace = sharedUtil.isSpace;
  49863. var Stream = coreStream.Stream;
  49864. var getEncoding = coreEncodings.getEncoding;
  49865. var HINTING_ENABLED = false;
  49866. var Type1CharString = function Type1CharStringClosure() {
  49867. var COMMAND_MAP = {
  49868. 'hstem': [1],
  49869. 'vstem': [3],
  49870. 'vmoveto': [4],
  49871. 'rlineto': [5],
  49872. 'hlineto': [6],
  49873. 'vlineto': [7],
  49874. 'rrcurveto': [8],
  49875. 'callsubr': [10],
  49876. 'flex': [
  49877. 12,
  49878. 35
  49879. ],
  49880. 'drop': [
  49881. 12,
  49882. 18
  49883. ],
  49884. 'endchar': [14],
  49885. 'rmoveto': [21],
  49886. 'hmoveto': [22],
  49887. 'vhcurveto': [30],
  49888. 'hvcurveto': [31]
  49889. };
  49890. function Type1CharString() {
  49891. this.width = 0;
  49892. this.lsb = 0;
  49893. this.flexing = false;
  49894. this.output = [];
  49895. this.stack = [];
  49896. }
  49897. Type1CharString.prototype = {
  49898. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49899. var count = encoded.length;
  49900. var error = false;
  49901. var wx, sbx, subrNumber;
  49902. for (var i = 0; i < count; i++) {
  49903. var value = encoded[i];
  49904. if (value < 32) {
  49905. if (value === 12) {
  49906. value = (value << 8) + encoded[++i];
  49907. }
  49908. switch (value) {
  49909. case 1:
  49910. if (!HINTING_ENABLED) {
  49911. this.stack = [];
  49912. break;
  49913. }
  49914. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49915. break;
  49916. case 3:
  49917. if (!HINTING_ENABLED) {
  49918. this.stack = [];
  49919. break;
  49920. }
  49921. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49922. break;
  49923. case 4:
  49924. if (this.flexing) {
  49925. if (this.stack.length < 1) {
  49926. error = true;
  49927. break;
  49928. }
  49929. var dy = this.stack.pop();
  49930. this.stack.push(0, dy);
  49931. break;
  49932. }
  49933. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49934. break;
  49935. case 5:
  49936. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49937. break;
  49938. case 6:
  49939. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49940. break;
  49941. case 7:
  49942. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49943. break;
  49944. case 8:
  49945. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49946. break;
  49947. case 9:
  49948. this.stack = [];
  49949. break;
  49950. case 10:
  49951. if (this.stack.length < 1) {
  49952. error = true;
  49953. break;
  49954. }
  49955. subrNumber = this.stack.pop();
  49956. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49957. break;
  49958. case 11:
  49959. return error;
  49960. case 13:
  49961. if (this.stack.length < 2) {
  49962. error = true;
  49963. break;
  49964. }
  49965. wx = this.stack.pop();
  49966. sbx = this.stack.pop();
  49967. this.lsb = sbx;
  49968. this.width = wx;
  49969. this.stack.push(wx, sbx);
  49970. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49971. break;
  49972. case 14:
  49973. this.output.push(COMMAND_MAP.endchar[0]);
  49974. break;
  49975. case 21:
  49976. if (this.flexing) {
  49977. break;
  49978. }
  49979. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49980. break;
  49981. case 22:
  49982. if (this.flexing) {
  49983. this.stack.push(0);
  49984. break;
  49985. }
  49986. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49987. break;
  49988. case 30:
  49989. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49990. break;
  49991. case 31:
  49992. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49993. break;
  49994. case (12 << 8) + 0:
  49995. this.stack = [];
  49996. break;
  49997. case (12 << 8) + 1:
  49998. if (!HINTING_ENABLED) {
  49999. this.stack = [];
  50000. break;
  50001. }
  50002. error = this.executeCommand(2, COMMAND_MAP.vstem);
  50003. break;
  50004. case (12 << 8) + 2:
  50005. if (!HINTING_ENABLED) {
  50006. this.stack = [];
  50007. break;
  50008. }
  50009. error = this.executeCommand(2, COMMAND_MAP.hstem);
  50010. break;
  50011. case (12 << 8) + 6:
  50012. if (seacAnalysisEnabled) {
  50013. this.seac = this.stack.splice(-4, 4);
  50014. error = this.executeCommand(0, COMMAND_MAP.endchar);
  50015. } else {
  50016. error = this.executeCommand(4, COMMAND_MAP.endchar);
  50017. }
  50018. break;
  50019. case (12 << 8) + 7:
  50020. if (this.stack.length < 4) {
  50021. error = true;
  50022. break;
  50023. }
  50024. this.stack.pop();
  50025. wx = this.stack.pop();
  50026. var sby = this.stack.pop();
  50027. sbx = this.stack.pop();
  50028. this.lsb = sbx;
  50029. this.width = wx;
  50030. this.stack.push(wx, sbx, sby);
  50031. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  50032. break;
  50033. case (12 << 8) + 12:
  50034. if (this.stack.length < 2) {
  50035. error = true;
  50036. break;
  50037. }
  50038. var num2 = this.stack.pop();
  50039. var num1 = this.stack.pop();
  50040. this.stack.push(num1 / num2);
  50041. break;
  50042. case (12 << 8) + 16:
  50043. if (this.stack.length < 2) {
  50044. error = true;
  50045. break;
  50046. }
  50047. subrNumber = this.stack.pop();
  50048. var numArgs = this.stack.pop();
  50049. if (subrNumber === 0 && numArgs === 3) {
  50050. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  50051. 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]);
  50052. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  50053. this.flexing = false;
  50054. this.stack.push(flexArgs[15], flexArgs[16]);
  50055. } else if (subrNumber === 1 && numArgs === 0) {
  50056. this.flexing = true;
  50057. }
  50058. break;
  50059. case (12 << 8) + 17:
  50060. break;
  50061. case (12 << 8) + 33:
  50062. this.stack = [];
  50063. break;
  50064. default:
  50065. warn('Unknown type 1 charstring command of "' + value + '"');
  50066. break;
  50067. }
  50068. if (error) {
  50069. break;
  50070. }
  50071. continue;
  50072. } else if (value <= 246) {
  50073. value = value - 139;
  50074. } else if (value <= 250) {
  50075. value = (value - 247) * 256 + encoded[++i] + 108;
  50076. } else if (value <= 254) {
  50077. value = -((value - 251) * 256) - encoded[++i] - 108;
  50078. } else {
  50079. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  50080. }
  50081. this.stack.push(value);
  50082. }
  50083. return error;
  50084. },
  50085. executeCommand: function (howManyArgs, command, keepStack) {
  50086. var stackLength = this.stack.length;
  50087. if (howManyArgs > stackLength) {
  50088. return true;
  50089. }
  50090. var start = stackLength - howManyArgs;
  50091. for (var i = start; i < stackLength; i++) {
  50092. var value = this.stack[i];
  50093. if (value === (value | 0)) {
  50094. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  50095. } else {
  50096. value = 65536 * value | 0;
  50097. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  50098. }
  50099. }
  50100. this.output.push.apply(this.output, command);
  50101. if (keepStack) {
  50102. this.stack.splice(start, howManyArgs);
  50103. } else {
  50104. this.stack.length = 0;
  50105. }
  50106. return false;
  50107. }
  50108. };
  50109. return Type1CharString;
  50110. }();
  50111. var Type1Parser = function Type1ParserClosure() {
  50112. var EEXEC_ENCRYPT_KEY = 55665;
  50113. var CHAR_STRS_ENCRYPT_KEY = 4330;
  50114. function isHexDigit(code) {
  50115. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  50116. }
  50117. function decrypt(data, key, discardNumber) {
  50118. if (discardNumber >= data.length) {
  50119. return new Uint8Array(0);
  50120. }
  50121. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  50122. for (i = 0; i < discardNumber; i++) {
  50123. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  50124. }
  50125. var count = data.length - discardNumber;
  50126. var decrypted = new Uint8Array(count);
  50127. for (i = discardNumber, j = 0; j < count; i++, j++) {
  50128. var value = data[i];
  50129. decrypted[j] = value ^ r >> 8;
  50130. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50131. }
  50132. return decrypted;
  50133. }
  50134. function decryptAscii(data, key, discardNumber) {
  50135. var r = key | 0, c1 = 52845, c2 = 22719;
  50136. var count = data.length, maybeLength = count >>> 1;
  50137. var decrypted = new Uint8Array(maybeLength);
  50138. var i, j;
  50139. for (i = 0, j = 0; i < count; i++) {
  50140. var digit1 = data[i];
  50141. if (!isHexDigit(digit1)) {
  50142. continue;
  50143. }
  50144. i++;
  50145. var digit2;
  50146. while (i < count && !isHexDigit(digit2 = data[i])) {
  50147. i++;
  50148. }
  50149. if (i < count) {
  50150. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  50151. decrypted[j++] = value ^ r >> 8;
  50152. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50153. }
  50154. }
  50155. return Array.prototype.slice.call(decrypted, discardNumber, j);
  50156. }
  50157. function isSpecial(c) {
  50158. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  50159. }
  50160. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  50161. if (encrypted) {
  50162. var data = stream.getBytes();
  50163. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  50164. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  50165. }
  50166. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  50167. this.stream = stream;
  50168. this.nextChar();
  50169. }
  50170. Type1Parser.prototype = {
  50171. readNumberArray: function Type1Parser_readNumberArray() {
  50172. this.getToken();
  50173. var array = [];
  50174. while (true) {
  50175. var token = this.getToken();
  50176. if (token === null || token === ']' || token === '}') {
  50177. break;
  50178. }
  50179. array.push(parseFloat(token || 0));
  50180. }
  50181. return array;
  50182. },
  50183. readNumber: function Type1Parser_readNumber() {
  50184. var token = this.getToken();
  50185. return parseFloat(token || 0);
  50186. },
  50187. readInt: function Type1Parser_readInt() {
  50188. var token = this.getToken();
  50189. return parseInt(token || 0, 10) | 0;
  50190. },
  50191. readBoolean: function Type1Parser_readBoolean() {
  50192. var token = this.getToken();
  50193. return token === 'true' ? 1 : 0;
  50194. },
  50195. nextChar: function Type1_nextChar() {
  50196. return this.currentChar = this.stream.getByte();
  50197. },
  50198. getToken: function Type1Parser_getToken() {
  50199. var comment = false;
  50200. var ch = this.currentChar;
  50201. while (true) {
  50202. if (ch === -1) {
  50203. return null;
  50204. }
  50205. if (comment) {
  50206. if (ch === 0x0A || ch === 0x0D) {
  50207. comment = false;
  50208. }
  50209. } else if (ch === 0x25) {
  50210. comment = true;
  50211. } else if (!isSpace(ch)) {
  50212. break;
  50213. }
  50214. ch = this.nextChar();
  50215. }
  50216. if (isSpecial(ch)) {
  50217. this.nextChar();
  50218. return String.fromCharCode(ch);
  50219. }
  50220. var token = '';
  50221. do {
  50222. token += String.fromCharCode(ch);
  50223. ch = this.nextChar();
  50224. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  50225. return token;
  50226. },
  50227. extractFontProgram: function Type1Parser_extractFontProgram() {
  50228. var stream = this.stream;
  50229. var subrs = [], charstrings = [];
  50230. var privateData = Object.create(null);
  50231. privateData['lenIV'] = 4;
  50232. var program = {
  50233. subrs: [],
  50234. charstrings: [],
  50235. properties: { 'privateData': privateData }
  50236. };
  50237. var token, length, data, lenIV, encoded;
  50238. while ((token = this.getToken()) !== null) {
  50239. if (token !== '/') {
  50240. continue;
  50241. }
  50242. token = this.getToken();
  50243. switch (token) {
  50244. case 'CharStrings':
  50245. this.getToken();
  50246. this.getToken();
  50247. this.getToken();
  50248. this.getToken();
  50249. while (true) {
  50250. token = this.getToken();
  50251. if (token === null || token === 'end') {
  50252. break;
  50253. }
  50254. if (token !== '/') {
  50255. continue;
  50256. }
  50257. var glyph = this.getToken();
  50258. length = this.readInt();
  50259. this.getToken();
  50260. data = stream.makeSubStream(stream.pos, length);
  50261. lenIV = program.properties.privateData['lenIV'];
  50262. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50263. stream.skip(length);
  50264. this.nextChar();
  50265. token = this.getToken();
  50266. if (token === 'noaccess') {
  50267. this.getToken();
  50268. }
  50269. charstrings.push({
  50270. glyph: glyph,
  50271. encoded: encoded
  50272. });
  50273. }
  50274. break;
  50275. case 'Subrs':
  50276. this.readInt();
  50277. this.getToken();
  50278. while ((token = this.getToken()) === 'dup') {
  50279. var index = this.readInt();
  50280. length = this.readInt();
  50281. this.getToken();
  50282. data = stream.makeSubStream(stream.pos, length);
  50283. lenIV = program.properties.privateData['lenIV'];
  50284. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50285. stream.skip(length);
  50286. this.nextChar();
  50287. token = this.getToken();
  50288. if (token === 'noaccess') {
  50289. this.getToken();
  50290. }
  50291. subrs[index] = encoded;
  50292. }
  50293. break;
  50294. case 'BlueValues':
  50295. case 'OtherBlues':
  50296. case 'FamilyBlues':
  50297. case 'FamilyOtherBlues':
  50298. var blueArray = this.readNumberArray();
  50299. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  50300. program.properties.privateData[token] = blueArray;
  50301. }
  50302. break;
  50303. case 'StemSnapH':
  50304. case 'StemSnapV':
  50305. program.properties.privateData[token] = this.readNumberArray();
  50306. break;
  50307. case 'StdHW':
  50308. case 'StdVW':
  50309. program.properties.privateData[token] = this.readNumberArray()[0];
  50310. break;
  50311. case 'BlueShift':
  50312. case 'lenIV':
  50313. case 'BlueFuzz':
  50314. case 'BlueScale':
  50315. case 'LanguageGroup':
  50316. case 'ExpansionFactor':
  50317. program.properties.privateData[token] = this.readNumber();
  50318. break;
  50319. case 'ForceBold':
  50320. program.properties.privateData[token] = this.readBoolean();
  50321. break;
  50322. }
  50323. }
  50324. for (var i = 0; i < charstrings.length; i++) {
  50325. glyph = charstrings[i].glyph;
  50326. encoded = charstrings[i].encoded;
  50327. var charString = new Type1CharString();
  50328. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  50329. var output = charString.output;
  50330. if (error) {
  50331. output = [14];
  50332. }
  50333. program.charstrings.push({
  50334. glyphName: glyph,
  50335. charstring: output,
  50336. width: charString.width,
  50337. lsb: charString.lsb,
  50338. seac: charString.seac
  50339. });
  50340. }
  50341. return program;
  50342. },
  50343. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  50344. var token;
  50345. while ((token = this.getToken()) !== null) {
  50346. if (token !== '/') {
  50347. continue;
  50348. }
  50349. token = this.getToken();
  50350. switch (token) {
  50351. case 'FontMatrix':
  50352. var matrix = this.readNumberArray();
  50353. properties.fontMatrix = matrix;
  50354. break;
  50355. case 'Encoding':
  50356. var encodingArg = this.getToken();
  50357. var encoding;
  50358. if (!/^\d+$/.test(encodingArg)) {
  50359. encoding = getEncoding(encodingArg);
  50360. } else {
  50361. encoding = [];
  50362. var size = parseInt(encodingArg, 10) | 0;
  50363. this.getToken();
  50364. for (var j = 0; j < size; j++) {
  50365. token = this.getToken();
  50366. while (token !== 'dup' && token !== 'def') {
  50367. token = this.getToken();
  50368. if (token === null) {
  50369. return;
  50370. }
  50371. }
  50372. if (token === 'def') {
  50373. break;
  50374. }
  50375. var index = this.readInt();
  50376. this.getToken();
  50377. var glyph = this.getToken();
  50378. encoding[index] = glyph;
  50379. this.getToken();
  50380. }
  50381. }
  50382. properties.builtInEncoding = encoding;
  50383. break;
  50384. case 'FontBBox':
  50385. var fontBBox = this.readNumberArray();
  50386. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  50387. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  50388. properties.ascentScaled = true;
  50389. break;
  50390. }
  50391. }
  50392. }
  50393. };
  50394. return Type1Parser;
  50395. }();
  50396. exports.Type1Parser = Type1Parser;
  50397. /***/ }),
  50398. /* 36 */
  50399. /***/ (function(module, exports, __w_pdfjs_require__) {
  50400. "use strict";
  50401. var pdfjsVersion = '1.7.294';
  50402. var pdfjsBuild = '8aad33e8';
  50403. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50404. {
  50405. __w_pdfjs_require__(18);
  50406. }
  50407. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50408. /***/ })
  50409. /******/ ]);
  50410. });